chore: generate
This commit is contained in:
@@ -172,9 +172,9 @@ const audit = Effect.gen(function* () {
|
|||||||
const cassettes = yield* HttpRecorder.Cassette.Service
|
const cassettes = yield* HttpRecorder.Cassette.Service
|
||||||
const entries = yield* cassettes.list()
|
const entries = yield* cassettes.list()
|
||||||
const issues = yield* Effect.forEach(entries, (entry) =>
|
const issues = yield* Effect.forEach(entries, (entry) =>
|
||||||
cassettes.read(entry.name).pipe(
|
cassettes
|
||||||
Effect.map((interactions) => ({ name: entry.name, findings: HttpRecorder.secretFindings(interactions) })),
|
.read(entry.name)
|
||||||
),
|
.pipe(Effect.map((interactions) => ({ name: entry.name, findings: HttpRecorder.secretFindings(interactions) }))),
|
||||||
)
|
)
|
||||||
return issues.filter((i) => i.findings.length > 0)
|
return issues.filter((i) => i.findings.length > 0)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -20,11 +20,7 @@ export interface AppendResult {
|
|||||||
|
|
||||||
export interface Interface {
|
export interface Interface {
|
||||||
readonly read: (name: string) => Effect.Effect<ReadonlyArray<Interaction>, CassetteNotFoundError>
|
readonly read: (name: string) => Effect.Effect<ReadonlyArray<Interaction>, CassetteNotFoundError>
|
||||||
readonly append: (
|
readonly append: (name: string, interaction: Interaction, metadata?: CassetteMetadata) => Effect.Effect<AppendResult>
|
||||||
name: string,
|
|
||||||
interaction: Interaction,
|
|
||||||
metadata?: CassetteMetadata,
|
|
||||||
) => Effect.Effect<AppendResult>
|
|
||||||
readonly exists: (name: string) => Effect.Effect<boolean>
|
readonly exists: (name: string) => Effect.Effect<boolean>
|
||||||
readonly list: () => Effect.Effect<ReadonlyArray<string>>
|
readonly list: () => Effect.Effect<ReadonlyArray<string>>
|
||||||
}
|
}
|
||||||
@@ -112,7 +108,12 @@ export const fileSystem = (
|
|||||||
Effect.map((files) =>
|
Effect.map((files) =>
|
||||||
files
|
files
|
||||||
.filter((file) => file.endsWith(".json"))
|
.filter((file) => file.endsWith(".json"))
|
||||||
.map((file) => path.relative(directory, file).replace(/\\/g, "/").replace(/\.json$/, ""))
|
.map((file) =>
|
||||||
|
path
|
||||||
|
.relative(directory, file)
|
||||||
|
.replace(/\\/g, "/")
|
||||||
|
.replace(/\.json$/, ""),
|
||||||
|
)
|
||||||
.toSorted((a, b) => a.localeCompare(b)),
|
.toSorted((a, b) => a.localeCompare(b)),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -34,13 +34,13 @@ export const appendOrFail = (
|
|||||||
interaction: Interaction,
|
interaction: Interaction,
|
||||||
metadata: CassetteMetadata | undefined,
|
metadata: CassetteMetadata | undefined,
|
||||||
): Effect.Effect<void, UnsafeCassetteError> =>
|
): Effect.Effect<void, UnsafeCassetteError> =>
|
||||||
cassette.append(name, interaction, metadata).pipe(
|
cassette
|
||||||
Effect.flatMap(({ findings }) =>
|
.append(name, interaction, metadata)
|
||||||
findings.length === 0
|
.pipe(
|
||||||
? Effect.void
|
Effect.flatMap(({ findings }) =>
|
||||||
: Effect.fail(new UnsafeCassetteError({ cassetteName: name, findings })),
|
findings.length === 0 ? Effect.void : Effect.fail(new UnsafeCassetteError({ cassetteName: name, findings })),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
export interface ReplayState<T> {
|
export interface ReplayState<T> {
|
||||||
readonly load: Effect.Effect<ReadonlyArray<T>, CassetteNotFoundError>
|
readonly load: Effect.Effect<ReadonlyArray<T>, CassetteNotFoundError>
|
||||||
|
|||||||
@@ -110,4 +110,3 @@ export const secretFindings = (value: unknown): ReadonlyArray<SecretFinding> =>
|
|||||||
.filter((item) => entry.value.includes(item.value))
|
.filter((item) => entry.value.includes(item.value))
|
||||||
.map((item) => ({ path: entry.path, reason: `environment secret ${item.name}` })),
|
.map((item) => ({ path: entry.path, reason: `environment secret ${item.name}` })),
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|||||||
@@ -14,10 +14,7 @@ const seedCassetteDirectory = (directory: string, name: string, interactions: Re
|
|||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const cassette = yield* HttpRecorder.Cassette.Service
|
const cassette = yield* HttpRecorder.Cassette.Service
|
||||||
yield* Effect.forEach(interactions, (interaction) => cassette.append(name, interaction))
|
yield* Effect.forEach(interactions, (interaction) => cassette.append(name, interaction))
|
||||||
}).pipe(
|
}).pipe(Effect.provide(HttpRecorder.Cassette.fileSystem({ directory })), Effect.provide(NodeFileSystem.layer)),
|
||||||
Effect.provide(HttpRecorder.Cassette.fileSystem({ directory })),
|
|
||||||
Effect.provide(NodeFileSystem.layer),
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const post = (url: string, body: object) =>
|
const post = (url: string, body: object) =>
|
||||||
|
|||||||
Reference in New Issue
Block a user