CLI perf: reduce deps (#22652)
This commit is contained in:
parent
150ab07a83
commit
675a46e23e
84 changed files with 1413 additions and 1009 deletions
|
|
@ -4,6 +4,12 @@ export abstract class NamedError extends Error {
|
|||
abstract schema(): z.core.$ZodType
|
||||
abstract toObject(): { name: string; data: any }
|
||||
|
||||
static hasName(error: unknown, name: string): boolean {
|
||||
return (
|
||||
typeof error === "object" && error !== null && "name" in error && (error as Record<string, unknown>).name === name
|
||||
)
|
||||
}
|
||||
|
||||
static create<Name extends string, Data extends z.core.$ZodType>(name: Name, data: Data) {
|
||||
const schema = z
|
||||
.object({
|
||||
|
|
|
|||
|
|
@ -345,10 +345,14 @@ export namespace Flock {
|
|||
return await fn()
|
||||
}
|
||||
|
||||
export const effect = Effect.fn("Flock.effect")(function* (key: string) {
|
||||
export const effect = Effect.fn("Flock.effect")(function* (key: string, input: Options = {}) {
|
||||
return yield* Effect.acquireRelease(
|
||||
Effect.promise((signal) => Flock.acquire(key, { signal })),
|
||||
(foo) => Effect.promise(() => foo.release()),
|
||||
Effect.promise((signal) => Flock.acquire(key, { ...input, signal })).pipe(
|
||||
Effect.withSpan("Flock.acquire", {
|
||||
attributes: { key },
|
||||
}),
|
||||
),
|
||||
(lock) => Effect.promise(() => lock.release()).pipe(Effect.withSpan("Flock.release")),
|
||||
).pipe(Effect.asVoid)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue