Skip to content

Commit 3fb05c7

Browse files
committed
refactor: removing file and function prefixes
1 parent 2355309 commit 3fb05c7

File tree

9 files changed

+14
-14
lines changed

9 files changed

+14
-14
lines changed

src/core/requestUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { log } from './logging'
33
import { formatBytes } from './util'
44
import { createHumanLog } from './errors'
55

6-
export async function newRequest<DataType = unknown>(
6+
export async function request<DataType = unknown>(
77
endpoint: string,
88
method: 'POST' | 'GET' | 'PUT' | 'DELETE',
99
body?: BodyInit,
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import { shouldIgnoreCapture } from './captureIgnores'
99
import { formatBytes } from './util'
1010
import { getUserId } from '../index'
1111
import { removeCircularsAndNonPojos, removeUnserializableValues, safeStringify } from './stringify'
12-
import { decryptCapture, encryptCapture } from './newEncryption'
13-
import { newRequest } from './requestUtils'
12+
import { decryptCapture, encryptCapture } from './encryption'
13+
import { request } from './requestUtils'
1414

1515
function findWithLatestErrorInvocation<T extends CapturedCall | CapturedFunction>(
1616
capturedFunctions: T[]
@@ -31,7 +31,7 @@ function findWithLatestErrorInvocation<T extends CapturedCall | CapturedFunction
3131
}
3232

3333
export async function fetchCapture(captureId: string, secretApiKey: string, privateKey: string) {
34-
const fetchCaptureResult = await newRequest<DatabaseCapture>(
34+
const fetchCaptureResult = await request<DatabaseCapture>(
3535
`${getApiBase()}/api/v1/captures/${captureId}`,
3636
'GET',
3737
undefined,
@@ -140,7 +140,7 @@ export async function saveCapture(
140140
return stringifiedPayload
141141
}
142142

143-
const captureRequestResult = await newRequest<{ success: true }>(
143+
const captureRequestResult = await request<{ success: true }>(
144144
`${getApiBase()}/api/v1/captures`,
145145
'POST',
146146
stringifiedPayload.val,

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
getMode
1414
} from './core/util'
1515
import { log } from './core/logging'
16-
import { saveCapture } from './core/newStorage'
16+
import { saveCapture } from './core/storage'
1717
import { getCapture } from './core/noop'
1818

1919
let _executingFunctions: CapturedFunction[] = []
@@ -339,5 +339,5 @@ export function invariant(condition: any, message?: string): asserts condition {
339339
// Export
340340
export * from './core/config'
341341
export * from './core/types'
342-
export * from './core/newEncryption'
342+
export * from './core/encryption'
343343
export * from './core/stringify'

src/replay/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Err, Ok } from 'ts-results'
33
import { getLoadedConfig } from '../core/config'
44
import { CaptureDecryptedAndRevived } from '../core/types'
55
import { createHumanLog } from '../core/errors'
6-
import { fetchCapture } from '../core/newStorage'
6+
import { fetchCapture } from '../core/storage'
77
import { log } from '../core/logging'
88
import { safeParse, safeStringify } from '../core/stringify'
99

src/transform.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { calculateSHA256Checksum, getFileExtension } from './transform/util'
1616
import { upsertArtifacts } from './transform/artifacts/cache'
1717
import { Artifact, FlytrapConfig } from './core/types'
1818
import { createHumanLog } from './core/errors'
19-
import { encrypt } from './core/newEncryption'
19+
import { encrypt } from './core/encryption'
2020

2121
const transformedFiles = new Set<string>([])
2222

src/transform/artifacts/batchedArtifactsUpload.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Result } from 'ts-results'
22
import { getApiBase } from '../../core/config'
33
import { Artifact } from '../../core/types'
4-
import { newRequest } from '../../core/requestUtils'
4+
import { request } from '../../core/requestUtils'
55

66
const MAX_BYTES_PER_BATCH = 3_000_000 // 3MB
77

@@ -44,7 +44,7 @@ export async function batchedArtifactsUpload(
4444
const uploadBatchesRequests = await Promise.all(
4545
batches.map(
4646
async (batch) =>
47-
await newRequest<string[]>(
47+
await request<string[]>(
4848
`${getApiBase()}/api/v1/artifacts/${projectId}`,
4949
'POST',
5050
JSON.stringify({

src/transform/artifacts/cache.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { getApiBase } from '../../core/config'
22
import { batchedArtifactsUpload } from './batchedArtifactsUpload'
33
import { Artifact } from '../../core/types'
4-
import { newRequest } from '../../core/requestUtils'
4+
import { request } from '../../core/requestUtils'
55

66
const getUploadedArtifacts = async (projectId: string, secretApiKey: string) => {
7-
return await newRequest<{ checksum: string; filePath: string }[]>(
7+
return await request<{ checksum: string; filePath: string }[]>(
88
`${getApiBase()}/api/v1/artifacts/${projectId}`,
99
'GET',
1010
undefined,

test/encryption.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import crypto from 'crypto'
33
// @ts-expect-error
44
globalThis.crypto = crypto
55

6-
import { generateKeyPair, encrypt, decrypt } from '../src/core/newEncryption'
6+
import { generateKeyPair, encrypt, decrypt } from '../src/core/encryption'
77
import { toOneLine } from './testUtils'
88

99
const exampleCapture = `

0 commit comments

Comments
 (0)