better-effect 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README.md +244 -5
  2. package/dist/adapters/iti.d.mts +3 -4
  3. package/dist/adapters/iti.d.mts.map +1 -1
  4. package/dist/adapters/iti.mjs +9 -4
  5. package/dist/adapters/iti.mjs.map +1 -1
  6. package/dist/effect-2ZcGZI8A.mjs +513 -0
  7. package/dist/effect-2ZcGZI8A.mjs.map +1 -0
  8. package/dist/hono.d.mts +18 -13
  9. package/dist/hono.d.mts.map +1 -1
  10. package/dist/hono.mjs +9 -5
  11. package/dist/hono.mjs.map +1 -1
  12. package/dist/{index-BafDna0B.d.mts → index-C7Qild0_.d.mts} +158 -28
  13. package/dist/index-C7Qild0_.d.mts.map +1 -0
  14. package/dist/{index-DklNCz7w.d.mts → index-DStz0JMN.d.mts} +4 -4
  15. package/dist/{index-DklNCz7w.d.mts.map → index-DStz0JMN.d.mts.map} +1 -1
  16. package/dist/{index-CULgSzUw.d.mts → index-heuaRmXR.d.mts} +5 -5
  17. package/dist/{index-CULgSzUw.d.mts.map → index-heuaRmXR.d.mts.map} +1 -1
  18. package/dist/{index-C7KX5rAP.d.mts → index-rQhZk3Nt.d.mts} +127 -24
  19. package/dist/index-rQhZk3Nt.d.mts.map +1 -0
  20. package/dist/index.d.mts +4 -5
  21. package/dist/index.mjs +7 -538
  22. package/dist/index.mjs.map +1 -1
  23. package/dist/runtime/explicit.d.mts +1 -1
  24. package/dist/runtime/node.d.mts +1 -1
  25. package/dist/runtime-DnMn0X0X.mjs +613 -0
  26. package/dist/runtime-DnMn0X0X.mjs.map +1 -0
  27. package/dist/scope-GGnmTQck.mjs +245 -0
  28. package/dist/scope-GGnmTQck.mjs.map +1 -0
  29. package/dist/{signal-C1bagvrO.mjs → signal-B97cs85Z.mjs} +81 -2
  30. package/dist/signal-B97cs85Z.mjs.map +1 -0
  31. package/dist/{standard-services-DW-i4UuA.mjs → standard-services-BFBq-4lo.mjs} +2 -2
  32. package/dist/{standard-services-DW-i4UuA.mjs.map → standard-services-BFBq-4lo.mjs.map} +1 -1
  33. package/dist/standard-services.d.mts +2 -2
  34. package/dist/standard-services.mjs +2 -2
  35. package/dist/testing.d.mts +198 -2
  36. package/dist/testing.d.mts.map +1 -0
  37. package/dist/testing.mjs +976 -2
  38. package/dist/testing.mjs.map +1 -0
  39. package/package.json +1 -1
  40. package/dist/effect-DAMqvegy.mjs +0 -544
  41. package/dist/effect-DAMqvegy.mjs.map +0 -1
  42. package/dist/index-BafDna0B.d.mts.map +0 -1
  43. package/dist/index-C7KX5rAP.d.mts.map +0 -1
  44. package/dist/map-layer-backend-gal-mcRv.mjs +0 -53
  45. package/dist/map-layer-backend-gal-mcRv.mjs.map +0 -1
  46. package/dist/map-layer-backend-rNwfH0Bz.d.mts +0 -42
  47. package/dist/map-layer-backend-rNwfH0Bz.d.mts.map +0 -1
  48. package/dist/signal-C1bagvrO.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"standard-services-DW-i4UuA.mjs","names":[],"sources":["../src/standard-services/config.ts","../src/standard-services/index.ts"],"sourcesContent":["import {\n Result,\n TaggedError,\n type Err,\n type Result as ResultType,\n type StandardSchemaV1,\n type UnhandledException\n} from 'better-result'\n\nimport type { ServiceRequirement } from '../effect/types'\nimport { Layer } from '../layer'\nimport { Service } from '../service'\n\n/** Raw string values supplied to a configuration schema. */\nexport type ConfigSource = Readonly<Record<string, string | undefined>>\n\n/** Optional sources used by environment-backed configuration values. */\nexport type ConfigSourceOptions = {\n readonly dotEnvPath?: string\n readonly envSource?: ConfigSource\n}\n\n/** Options for the one-call schema-bound configuration API. */\nexport type ConfigFromEnvOptions<Schema extends StandardSchemaV1> = ConfigSourceOptions & {\n readonly schema: Schema\n}\n\n/** The decoded value produced by a Standard Schema. */\nexport type ConfigOutput<Schema extends StandardSchemaV1> = StandardSchemaV1.InferOutput<Schema>\n\n/** The raw input type described by a Standard Schema. */\nexport type ConfigInput<Schema extends StandardSchemaV1> = StandardSchemaV1.InferInput<Schema>\n\n/** A safe validation issue exposed by a configuration failure. */\nexport type ConfigIssue = StandardSchemaV1.Issue\n\n/** A schema validation failure. Raw source values are intentionally omitted. */\nexport class ConfigValidationError extends TaggedError('ConfigValidationError')<{\n readonly issues: ReadonlyArray<ConfigIssue>\n readonly message: string\n}> {}\n\n/** A dotenv or host-source loading failure. Raw source values are intentionally omitted. */\nexport class ConfigSourceError extends TaggedError('ConfigSourceError')<{\n readonly cause: unknown\n readonly message: string\n readonly path?: string\n}> {}\n\n/** Errors that may be returned while loading or validating configuration. */\nexport type ConfigError = ConfigValidationError | ConfigSourceError | UnhandledException\n\ntype ConfigYield<Requirements extends Service.Any, Error> =\n | Err<never, Error>\n | ServiceRequirement<Requirements>\n\n/** A reusable, async-yieldable Standard Schema configuration descriptor. */\nexport type ConfigValue<\n Schema extends StandardSchemaV1,\n Requirements extends Service.Any = never,\n Error = ConfigError\n> = {\n [Symbol.asyncIterator](): AsyncGenerator<\n ConfigYield<Requirements, Error>,\n ConfigOutput<Schema>,\n unknown\n >\n}\n\ntype RuntimeConfigYield = Err<never, ConfigError> | ServiceRequirement<Service.Any>\n\ntype ConfigValueSpec<Schema extends StandardSchemaV1> = {\n readonly schema: Schema\n readonly source: 'bound' | 'provider'\n readonly sourceOptions?: ConfigSourceOptions\n}\n\ntype MutableConfigSourceOptions = {\n dotEnvPath?: string\n envSource?: ConfigSource\n}\n\ntype RuntimeGlobal = typeof globalThis & {\n readonly process?: { readonly env?: ConfigSource }\n readonly Bun?: {\n readonly env?: ConfigSource\n readonly file?: (path: string) => { text(): Promise<string> }\n }\n}\n\n// SAFETY: Hosts may expose process/Bun globals at runtime without declaring them on globalThis.\nconst runtimeGlobal = globalThis as RuntimeGlobal\n\nconst hostEnvironment = (): ConfigSource => {\n const processEnvironment = runtimeGlobal.process?.env\n\n if (processEnvironment !== undefined) {\n return processEnvironment\n }\n\n return runtimeGlobal.Bun?.env ?? {}\n}\n\nconst readText = async (path: string): Promise<string> => {\n const file = runtimeGlobal.Bun?.file\n\n if (file !== undefined) {\n return await file(path).text()\n }\n\n const { readFile } = await import('node:fs/promises')\n\n return await readFile(path, 'utf8')\n}\n\nconst parseDotEnv = (text: string) => {\n const values = new Map<string, string>()\n\n for (const [lineIndex, rawLine] of text\n .replace(/^\\uFEFF/, '')\n .split(/\\r?\\n/u)\n .entries()) {\n let line = rawLine.trim()\n\n if (line === '' || line.startsWith('#')) {\n continue\n }\n\n if (/^export\\s/u.test(line)) {\n line = line.replace(/^export\\s+/u, '')\n }\n\n const separator = line.indexOf('=')\n\n if (separator <= 0) {\n throw new Error(`Invalid dotenv entry at line ${lineIndex + 1}`)\n }\n\n const key = line.slice(0, separator).trim()\n\n if (!/^[A-Za-z_][A-Za-z0-9_]*$/u.test(key)) {\n throw new Error(`Invalid dotenv key at line ${lineIndex + 1}`)\n }\n\n let value = line.slice(separator + 1).trim()\n const quote = value[0]\n\n if (quote === '\"' || quote === \"'\") {\n const closingQuote = value.indexOf(quote, 1)\n const trailing = closingQuote < 0 ? '' : value.slice(closingQuote + 1).trim()\n\n if (closingQuote < 0 || (trailing !== '' && !trailing.startsWith('#'))) {\n throw new Error(`Unterminated dotenv value at line ${lineIndex + 1}`)\n }\n\n value = value.slice(1, closingQuote)\n } else {\n const comment = value.search(/\\s+#/u)\n\n if (comment >= 0) {\n value = value.slice(0, comment).trimEnd()\n }\n }\n\n values.set(key, value)\n }\n\n return Object.fromEntries(values)\n}\n\nconst loadSource = async (options: ConfigSourceOptions = {}): Promise<ConfigSource> => {\n const dotenv =\n options.dotEnvPath === undefined ? {} : parseDotEnv(await readText(options.dotEnvPath))\n const explicit = options.envSource ?? hostEnvironment()\n\n return {\n ...dotenv,\n ...explicit\n }\n}\n\nconst sourceError = (path: string | undefined, cause: unknown): ConfigSourceError => {\n const message =\n path === undefined\n ? 'Failed to load configuration source'\n : `Failed to load configuration source at ${path}`\n\n if (path === undefined) {\n return new ConfigSourceError({ cause, message })\n }\n\n return new ConfigSourceError({ cause, message, path })\n}\n\nconst validate = async <Schema extends StandardSchemaV1>(\n schema: Schema,\n source: ConfigSource\n): Promise<ResultType<ConfigOutput<Schema>, ConfigValidationError | UnhandledException>> => {\n const checked = await Result.tryPromise(() =>\n Promise.resolve(schema['~standard'].validate(source))\n )\n\n if (checked.status === 'error') {\n return checked\n }\n\n if (checked.value.issues !== undefined) {\n return Result.err(\n new ConfigValidationError({\n issues: Object.freeze([...checked.value.issues]),\n message: 'Configuration validation failed'\n })\n )\n }\n\n // SAFETY: A successful Standard Schema result carries its declared output type.\n return Result.ok(checked.value.value as ConfigOutput<Schema>)\n}\n\nconst evaluate = async <Schema extends StandardSchemaV1>(\n spec: ConfigValueSpec<Schema>,\n provider?: Config\n): Promise<ResultType<ConfigOutput<Schema>, ConfigError>> => {\n const loaded = await Result.tryPromise({\n try: async () => {\n if (spec.source === 'provider') {\n const base = provider?.source\n\n if (base === undefined) {\n throw new Error('Config provider did not expose a source')\n }\n\n if (spec.sourceOptions === undefined) {\n return base\n }\n\n return {\n ...base,\n ...(await loadSource(spec.sourceOptions))\n }\n }\n\n return await loadSource(spec.sourceOptions)\n },\n catch: (cause) => sourceError(spec.sourceOptions?.dotEnvPath, cause)\n })\n\n if (loaded.status === 'error') {\n return loaded\n }\n\n return await validate(spec.schema, loaded.value)\n}\n\nconst makeConfigValue = <Schema extends StandardSchemaV1, Requirements extends Service.Any>(\n spec: ConfigValueSpec<Schema>\n): ConfigValue<Schema, Requirements> => {\n const value = {\n ...spec,\n async *[Symbol.asyncIterator](): AsyncGenerator<\n RuntimeConfigYield,\n ConfigOutput<Schema>,\n unknown\n > {\n let provider: Config | undefined\n\n if (spec.source === 'provider') {\n provider = yield* Config\n }\n\n return yield* Result.await(evaluate(spec, provider))\n }\n }\n\n // SAFETY: The runtime iterator only yields Result errors and Service values; the public cast restores the phantom requirement.\n return value as ConfigValue<Schema, Requirements>\n}\n\n/** Host-backed raw configuration source and provider token. */\nexport class Config extends Service<Config>()('Config') {\n constructor(readonly source: ConfigSource) {\n super()\n }\n\n /** Read one raw value from the configured source. */\n get(key: string): string | undefined {\n return this.source[key]\n }\n\n /** Create a provider from an already-loaded source. */\n static layer(source: ConfigSource) {\n return Layer.succeed(Config, new Config(source))\n }\n\n /** Create a provider whose source is loaded from dotenv and the host environment. */\n static layerFromEnv(options: ConfigSourceOptions = {}) {\n return Layer.make(Config, async () => {\n try {\n return new Config(await loadSource(options))\n } catch (cause) {\n throw sourceError(options.dotEnvPath, cause)\n }\n })\n }\n\n /** Describe a configuration read from the contextual Config provider. */\n static schema<Schema extends StandardSchemaV1>(schema: Schema): ConfigValue<Schema, Config> {\n return makeConfigValue({ schema, source: 'provider' })\n }\n\n /** Describe a reusable configuration loaded from dotenv and the host environment. */\n static fromEnv<Schema extends StandardSchemaV1>(\n options: ConfigFromEnvOptions<Schema>\n ): ConfigValue<Schema> {\n const sourceOptions: MutableConfigSourceOptions = {}\n\n if (options.dotEnvPath !== undefined) {\n sourceOptions.dotEnvPath = options.dotEnvPath\n }\n\n if (options.envSource !== undefined) {\n sourceOptions.envSource = options.envSource\n }\n\n return makeConfigValue({\n schema: options.schema,\n source: 'bound',\n sourceOptions\n })\n }\n\n /** Add an environment source to a provider-backed descriptor for functional `pipe` composition. */\n static withEnv(options: ConfigSourceOptions) {\n return <Schema extends StandardSchemaV1, Requirements extends Service.Any, Error = ConfigError>(\n value: ConfigValue<Schema, Requirements, Error>\n ): ConfigValue<Schema, Requirements, Error> => {\n // SAFETY: Values produced by this module retain their schema/source descriptor fields; custom iterables pass through unchanged.\n const internal = value as ConfigValue<Schema, Requirements> & ConfigValueSpec<Schema>\n\n if (!('schema' in internal)) {\n return value\n }\n\n // SAFETY: The internal descriptor preserves the original schema and requirement phantom.\n return makeConfigValue({\n schema: internal.schema,\n source: internal.source,\n sourceOptions: options\n }) as ConfigValue<Schema, Requirements, Error>\n }\n }\n}\n\n/** The default lazy host-environment Config provider. */\nexport const ConfigLive = Config.layerFromEnv()\n\nexport type { StandardSchemaV1 }\n","import { CurrentAbortSignal } from '../runtime'\nimport { Layer } from '../layer'\nimport { Service } from '../service'\n\nexport { CurrentAbortSignal }\n\nexport { Config, ConfigLive, ConfigSourceError, ConfigValidationError } from './config'\n\nexport type {\n ConfigError,\n ConfigFromEnvOptions,\n ConfigInput,\n ConfigIssue,\n ConfigOutput,\n ConfigSource,\n ConfigSourceOptions,\n ConfigValue,\n StandardSchemaV1\n} from './config'\n\nconst assertDelay = (milliseconds: number): void => {\n if (!Number.isFinite(milliseconds) || milliseconds < 0) {\n throw new RangeError('Delay must be a finite non-negative number')\n }\n}\n\n/** Host-backed time and waiting service. */\nexport class Clock extends Service<Clock>()('Clock') {\n now(): Date {\n return new Date()\n }\n\n sleep(milliseconds: number): Promise<void> {\n assertDelay(milliseconds)\n return new Promise((resolve) => setTimeout(resolve, milliseconds))\n }\n}\n\n/** The default host Clock provider. */\nexport const ClockLive = Layer.make(Clock)\n\ntype ClockWaiter = {\n readonly at: number\n readonly resolve: () => void\n}\n\n/** Deterministic Clock implementation for tests. */\nexport class ClockTest implements Service.Contract<Clock> {\n private currentTime: number\n\n private readonly waiters: ClockWaiter[] = []\n\n constructor(initial: Date | number = 0) {\n this.currentTime = initial instanceof Date ? initial.getTime() : initial\n\n if (!Number.isFinite(this.currentTime)) {\n throw new RangeError('ClockTest time must be finite')\n }\n }\n\n now(): Date {\n return new Date(this.currentTime)\n }\n\n setTime(value: Date | number): void {\n const next = value instanceof Date ? value.getTime() : value\n\n if (!Number.isFinite(next)) {\n throw new RangeError('ClockTest time must be finite')\n }\n\n this.currentTime = next\n this.flushWaiters()\n }\n\n advance(milliseconds: number): void {\n assertDelay(milliseconds)\n this.currentTime += milliseconds\n this.flushWaiters()\n }\n\n sleep(milliseconds: number): Promise<void> {\n assertDelay(milliseconds)\n\n return new Promise((resolve) => {\n this.waiters.push({ at: this.currentTime + milliseconds, resolve })\n this.flushWaiters()\n })\n }\n\n static layer(initial: Date | number = 0) {\n return Layer.succeed(Clock, new ClockTest(initial))\n }\n\n private flushWaiters(): void {\n for (let index = this.waiters.length - 1; index >= 0; index--) {\n const waiter = this.waiters[index]!\n\n if (waiter.at <= this.currentTime) {\n this.waiters.splice(index, 1)\n waiter.resolve()\n }\n }\n }\n}\n\nexport const ClockTestLayer = (initial: Date | number = 0) => ClockTest.layer(initial)\n\n/** Host-backed pseudo-random number service. */\nexport class Random extends Service<Random>()('Random') {\n next(): number {\n return Math.random()\n }\n\n nextInt(maxExclusive: number): number {\n if (!Number.isInteger(maxExclusive) || maxExclusive <= 0) {\n throw new RangeError('Random.nextInt maxExclusive must be a positive integer')\n }\n\n return Math.floor(this.next() * maxExclusive)\n }\n}\n\n/** The default host Random provider. */\nexport const RandomLive = Layer.make(Random)\n\n/** Reproducible pseudo-random implementation with isolated mutable state. */\nexport class RandomSeeded implements Service.Contract<Random> {\n private state: number\n\n constructor(seed: number) {\n if (!Number.isFinite(seed)) {\n throw new RangeError('RandomSeeded seed must be finite')\n }\n\n this.state = seed >>> 0\n }\n\n next(): number {\n this.state = (1664525 * this.state + 1013904223) >>> 0\n return this.state / 0x1_0000_0000\n }\n\n nextInt(maxExclusive: number): number {\n if (!Number.isInteger(maxExclusive) || maxExclusive <= 0) {\n throw new RangeError('RandomSeeded.nextInt maxExclusive must be a positive integer')\n }\n\n return Math.floor(this.next() * maxExclusive)\n }\n\n static layer(seed: number) {\n return Layer.succeed(Random, new RandomSeeded(seed))\n }\n}\n\nexport const RandomSeededLayer = (seed: number) => RandomSeeded.layer(seed)\n\nexport type LoggerLevel = 'debug' | 'info' | 'warn' | 'error'\n\nexport type LoggerEvent = {\n level: LoggerLevel\n message: string\n data?: LoggerData\n}\n\nexport type LoggerData =\n | string\n | number\n | boolean\n | bigint\n | null\n | readonly LoggerData[]\n | { readonly [key: string]: LoggerData }\ntype LoggerInput = LoggerEvent | LoggerLevel\n\nconst isLoggerLevel = (value: LoggerInput): value is LoggerLevel =>\n value === 'debug' || value === 'info' || value === 'warn' || value === 'error'\n\nconst toLoggerEvent = (input: LoggerInput, message?: string, data?: LoggerData): LoggerEvent => {\n if (!isLoggerLevel(input)) {\n return input\n }\n\n const event: LoggerEvent = { level: input, message: message ?? '' }\n\n if (data !== undefined) {\n event.data = data\n }\n\n return event\n}\n\n/** Structured host logger bridge. */\nexport class Logger extends Service<Logger>()('Logger') {\n log(event: LoggerEvent): void\n log(level: LoggerLevel, message: string, data?: LoggerData): void\n log(first: LoggerInput, message?: string, data?: LoggerData): void {\n const event = toLoggerEvent(first, message, data)\n\n const write = console[event.level]\n\n if (event.data === undefined) {\n write.call(console, event.message)\n } else {\n write.call(console, event.message, event.data)\n }\n }\n\n debug(message: string, data?: LoggerData): void {\n this.log('debug', message, data)\n }\n\n info(message: string, data?: LoggerData): void {\n this.log('info', message, data)\n }\n\n warn(message: string, data?: LoggerData): void {\n this.log('warn', message, data)\n }\n\n error(message: string, data?: LoggerData): void {\n this.log('error', message, data)\n }\n}\n\n/** The default host Logger provider. */\nexport const LoggerLive = Layer.make(Logger)\n\n/** Ordered in-memory Logger implementation for tests. */\nexport class LoggerTest implements Service.Contract<Logger> {\n readonly events: LoggerEvent[] = []\n\n log(event: LoggerEvent): void\n log(level: LoggerLevel, message: string, data?: LoggerData): void\n log(first: LoggerInput, message?: string, data?: LoggerData): void {\n const event = toLoggerEvent(first, message, data)\n\n this.events.push(event)\n }\n\n debug(message: string, data?: LoggerData): void {\n this.log('debug', message, data)\n }\n\n info(message: string, data?: LoggerData): void {\n this.log('info', message, data)\n }\n\n warn(message: string, data?: LoggerData): void {\n this.log('warn', message, data)\n }\n\n error(message: string, data?: LoggerData): void {\n this.log('error', message, data)\n }\n\n clear(): void {\n this.events.length = 0\n }\n\n static make() {\n const logger = new LoggerTest()\n return { logger, layer: Layer.succeed(Logger, logger) }\n }\n\n static layer(logger: LoggerTest = new LoggerTest()) {\n return Layer.succeed(Logger, logger)\n }\n}\n\nexport const LoggerTestLayer = () => LoggerTest.layer()\n\n/** Execution-local request value carried by a normal Service provider. */\nexport class CurrentRequest extends Service<CurrentRequest>()('CurrentRequest') {\n readonly request: unknown\n\n // oxlint-disable-next-line anti-slop/no-unknown-parameters\n constructor(readonly value: unknown) {\n super()\n this.request = value\n }\n\n // oxlint-disable-next-line anti-slop/no-unknown-parameters\n static layer(value: unknown) {\n return Layer.succeed(CurrentRequest, new CurrentRequest(value))\n }\n}\n\n// oxlint-disable-next-line anti-slop/no-unknown-parameters\nexport const CurrentRequestLayer = (value: unknown) => CurrentRequest.layer(value)\n"],"mappings":";;;;AAqCA,IAAa,wBAAb,cAA2C,YAAY,uBAAuB,CAAC,CAG5E,CAAC;;AAGJ,IAAa,oBAAb,cAAuC,YAAY,mBAAmB,CAAC,CAIpE,CAAC;AA4CJ,MAAM,gBAAgB;AAEtB,MAAM,wBAAsC;CAC1C,MAAM,qBAAqB,cAAc,SAAS;CAElD,IAAI,uBAAuB,KAAA,GACzB,OAAO;CAGT,OAAO,cAAc,KAAK,OAAO,CAAC;AACpC;AAEA,MAAM,WAAW,OAAO,SAAkC;CACxD,MAAM,OAAO,cAAc,KAAK;CAEhC,IAAI,SAAS,KAAA,GACX,OAAO,MAAM,KAAK,IAAI,CAAC,CAAC,KAAK;CAG/B,MAAM,EAAE,aAAa,MAAM,OAAO;CAElC,OAAO,MAAM,SAAS,MAAM,MAAM;AACpC;AAEA,MAAM,eAAe,SAAiB;CACpC,MAAM,yBAAS,IAAI,IAAoB;CAEvC,KAAK,MAAM,CAAC,WAAW,YAAY,KAChC,QAAQ,WAAW,EAAE,CAAC,CACtB,MAAM,QAAQ,CAAC,CACf,QAAQ,GAAG;EACZ,IAAI,OAAO,QAAQ,KAAK;EAExB,IAAI,SAAS,MAAM,KAAK,WAAW,GAAG,GACpC;EAGF,IAAI,aAAa,KAAK,IAAI,GACxB,OAAO,KAAK,QAAQ,eAAe,EAAE;EAGvC,MAAM,YAAY,KAAK,QAAQ,GAAG;EA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,CAAC;CAIzD;CAHrB;CAGA,YAAY,OAAyB;EACnC,MAAM;EADa,KAAA,QAAA;EAEnB,KAAK,UAAU;CACjB;CAGA,OAAO,MAAM,OAAgB;EAC3B,OAAO,MAAM,QAAQ,gBAAgB,IAAI,eAAe,KAAK,CAAC;CAChE;AACF;AAGA,MAAa,uBAAuB,UAAmB,eAAe,MAAM,KAAK"}
1
+ {"version":3,"file":"standard-services-BFBq-4lo.mjs","names":[],"sources":["../src/standard-services/config.ts","../src/standard-services/index.ts"],"sourcesContent":["import {\n Result,\n TaggedError,\n type Err,\n type Result as ResultType,\n type StandardSchemaV1,\n type UnhandledException\n} from 'better-result'\n\nimport type { ServiceRequirement } from '../effect/types'\nimport { Layer } from '../layer'\nimport { Service } from '../service'\n\n/** Raw string values supplied to a configuration schema. */\nexport type ConfigSource = Readonly<Record<string, string | undefined>>\n\n/** Optional sources used by environment-backed configuration values. */\nexport type ConfigSourceOptions = {\n readonly dotEnvPath?: string\n readonly envSource?: ConfigSource\n}\n\n/** Options for the one-call schema-bound configuration API. */\nexport type ConfigFromEnvOptions<Schema extends StandardSchemaV1> = ConfigSourceOptions & {\n readonly schema: Schema\n}\n\n/** The decoded value produced by a Standard Schema. */\nexport type ConfigOutput<Schema extends StandardSchemaV1> = StandardSchemaV1.InferOutput<Schema>\n\n/** The raw input type described by a Standard Schema. */\nexport type ConfigInput<Schema extends StandardSchemaV1> = StandardSchemaV1.InferInput<Schema>\n\n/** A safe validation issue exposed by a configuration failure. */\nexport type ConfigIssue = StandardSchemaV1.Issue\n\n/** A schema validation failure. Raw source values are intentionally omitted. */\nexport class ConfigValidationError extends TaggedError('ConfigValidationError')<{\n readonly issues: ReadonlyArray<ConfigIssue>\n readonly message: string\n}> {}\n\n/** A dotenv or host-source loading failure. Raw source values are intentionally omitted. */\nexport class ConfigSourceError extends TaggedError('ConfigSourceError')<{\n readonly cause: unknown\n readonly message: string\n readonly path?: string\n}> {}\n\n/** Errors that may be returned while loading or validating configuration. */\nexport type ConfigError = ConfigValidationError | ConfigSourceError | UnhandledException\n\ntype ConfigYield<Requirements extends Service.Any, Error> =\n | Err<never, Error>\n | ServiceRequirement<Requirements>\n\n/** A reusable, async-yieldable Standard Schema configuration descriptor. */\nexport type ConfigValue<\n Schema extends StandardSchemaV1,\n Requirements extends Service.Any = never,\n Error = ConfigError\n> = {\n [Symbol.asyncIterator](): AsyncGenerator<\n ConfigYield<Requirements, Error>,\n ConfigOutput<Schema>,\n unknown\n >\n}\n\ntype RuntimeConfigYield = Err<never, ConfigError> | ServiceRequirement<Service.Any>\n\ntype ConfigValueSpec<Schema extends StandardSchemaV1> = {\n readonly schema: Schema\n readonly source: 'bound' | 'provider'\n readonly sourceOptions?: ConfigSourceOptions\n}\n\ntype MutableConfigSourceOptions = {\n dotEnvPath?: string\n envSource?: ConfigSource\n}\n\ntype RuntimeGlobal = typeof globalThis & {\n readonly process?: { readonly env?: ConfigSource }\n readonly Bun?: {\n readonly env?: ConfigSource\n readonly file?: (path: string) => { text(): Promise<string> }\n }\n}\n\n// SAFETY: Hosts may expose process/Bun globals at runtime without declaring them on globalThis.\nconst runtimeGlobal = globalThis as RuntimeGlobal\n\nconst hostEnvironment = (): ConfigSource => {\n const processEnvironment = runtimeGlobal.process?.env\n\n if (processEnvironment !== undefined) {\n return processEnvironment\n }\n\n return runtimeGlobal.Bun?.env ?? {}\n}\n\nconst readText = async (path: string): Promise<string> => {\n const file = runtimeGlobal.Bun?.file\n\n if (file !== undefined) {\n return await file(path).text()\n }\n\n const { readFile } = await import('node:fs/promises')\n\n return await readFile(path, 'utf8')\n}\n\nconst parseDotEnv = (text: string) => {\n const values = new Map<string, string>()\n\n for (const [lineIndex, rawLine] of text\n .replace(/^\\uFEFF/, '')\n .split(/\\r?\\n/u)\n .entries()) {\n let line = rawLine.trim()\n\n if (line === '' || line.startsWith('#')) {\n continue\n }\n\n if (/^export\\s/u.test(line)) {\n line = line.replace(/^export\\s+/u, '')\n }\n\n const separator = line.indexOf('=')\n\n if (separator <= 0) {\n throw new Error(`Invalid dotenv entry at line ${lineIndex + 1}`)\n }\n\n const key = line.slice(0, separator).trim()\n\n if (!/^[A-Za-z_][A-Za-z0-9_]*$/u.test(key)) {\n throw new Error(`Invalid dotenv key at line ${lineIndex + 1}`)\n }\n\n let value = line.slice(separator + 1).trim()\n const quote = value[0]\n\n if (quote === '\"' || quote === \"'\") {\n const closingQuote = value.indexOf(quote, 1)\n const trailing = closingQuote < 0 ? '' : value.slice(closingQuote + 1).trim()\n\n if (closingQuote < 0 || (trailing !== '' && !trailing.startsWith('#'))) {\n throw new Error(`Unterminated dotenv value at line ${lineIndex + 1}`)\n }\n\n value = value.slice(1, closingQuote)\n } else {\n const comment = value.search(/\\s+#/u)\n\n if (comment >= 0) {\n value = value.slice(0, comment).trimEnd()\n }\n }\n\n values.set(key, value)\n }\n\n return Object.fromEntries(values)\n}\n\nconst loadSource = async (options: ConfigSourceOptions = {}): Promise<ConfigSource> => {\n const dotenv =\n options.dotEnvPath === undefined ? {} : parseDotEnv(await readText(options.dotEnvPath))\n const explicit = options.envSource ?? hostEnvironment()\n\n return {\n ...dotenv,\n ...explicit\n }\n}\n\nconst sourceError = (path: string | undefined, cause: unknown): ConfigSourceError => {\n const message =\n path === undefined\n ? 'Failed to load configuration source'\n : `Failed to load configuration source at ${path}`\n\n if (path === undefined) {\n return new ConfigSourceError({ cause, message })\n }\n\n return new ConfigSourceError({ cause, message, path })\n}\n\nconst validate = async <Schema extends StandardSchemaV1>(\n schema: Schema,\n source: ConfigSource\n): Promise<ResultType<ConfigOutput<Schema>, ConfigValidationError | UnhandledException>> => {\n const checked = await Result.tryPromise(() =>\n Promise.resolve(schema['~standard'].validate(source))\n )\n\n if (checked.status === 'error') {\n return checked\n }\n\n if (checked.value.issues !== undefined) {\n return Result.err(\n new ConfigValidationError({\n issues: Object.freeze([...checked.value.issues]),\n message: 'Configuration validation failed'\n })\n )\n }\n\n // SAFETY: A successful Standard Schema result carries its declared output type.\n return Result.ok(checked.value.value as ConfigOutput<Schema>)\n}\n\nconst evaluate = async <Schema extends StandardSchemaV1>(\n spec: ConfigValueSpec<Schema>,\n provider?: Config\n): Promise<ResultType<ConfigOutput<Schema>, ConfigError>> => {\n const loaded = await Result.tryPromise({\n try: async () => {\n if (spec.source === 'provider') {\n const base = provider?.source\n\n if (base === undefined) {\n throw new Error('Config provider did not expose a source')\n }\n\n if (spec.sourceOptions === undefined) {\n return base\n }\n\n return {\n ...base,\n ...(await loadSource(spec.sourceOptions))\n }\n }\n\n return await loadSource(spec.sourceOptions)\n },\n catch: (cause) => sourceError(spec.sourceOptions?.dotEnvPath, cause)\n })\n\n if (loaded.status === 'error') {\n return loaded\n }\n\n return await validate(spec.schema, loaded.value)\n}\n\nconst makeConfigValue = <Schema extends StandardSchemaV1, Requirements extends Service.Any>(\n spec: ConfigValueSpec<Schema>\n): ConfigValue<Schema, Requirements> => {\n const value = {\n ...spec,\n async *[Symbol.asyncIterator](): AsyncGenerator<\n RuntimeConfigYield,\n ConfigOutput<Schema>,\n unknown\n > {\n let provider: Config | undefined\n\n if (spec.source === 'provider') {\n provider = yield* Config\n }\n\n return yield* Result.await(evaluate(spec, provider))\n }\n }\n\n // SAFETY: The runtime iterator only yields Result errors and Service values; the public cast restores the phantom requirement.\n return value as ConfigValue<Schema, Requirements>\n}\n\n/** Host-backed raw configuration source and provider token. */\nexport class Config extends Service<Config>()('Config') {\n constructor(readonly source: ConfigSource) {\n super()\n }\n\n /** Read one raw value from the configured source. */\n get(key: string): string | undefined {\n return this.source[key]\n }\n\n /** Create a provider from an already-loaded source. */\n static layer(source: ConfigSource) {\n return Layer.succeed(Config, new Config(source))\n }\n\n /** Create a provider whose source is loaded from dotenv and the host environment. */\n static layerFromEnv(options: ConfigSourceOptions = {}) {\n return Layer.make(Config, async () => {\n try {\n return new Config(await loadSource(options))\n } catch (cause) {\n throw sourceError(options.dotEnvPath, cause)\n }\n })\n }\n\n /** Describe a configuration read from the contextual Config provider. */\n static schema<Schema extends StandardSchemaV1>(schema: Schema): ConfigValue<Schema, Config> {\n return makeConfigValue({ schema, source: 'provider' })\n }\n\n /** Describe a reusable configuration loaded from dotenv and the host environment. */\n static fromEnv<Schema extends StandardSchemaV1>(\n options: ConfigFromEnvOptions<Schema>\n ): ConfigValue<Schema> {\n const sourceOptions: MutableConfigSourceOptions = {}\n\n if (options.dotEnvPath !== undefined) {\n sourceOptions.dotEnvPath = options.dotEnvPath\n }\n\n if (options.envSource !== undefined) {\n sourceOptions.envSource = options.envSource\n }\n\n return makeConfigValue({\n schema: options.schema,\n source: 'bound',\n sourceOptions\n })\n }\n\n /** Add an environment source to a provider-backed descriptor for functional `pipe` composition. */\n static withEnv(options: ConfigSourceOptions) {\n return <Schema extends StandardSchemaV1, Requirements extends Service.Any, Error = ConfigError>(\n value: ConfigValue<Schema, Requirements, Error>\n ): ConfigValue<Schema, Requirements, Error> => {\n // SAFETY: Values produced by this module retain their schema/source descriptor fields; custom iterables pass through unchanged.\n const internal = value as ConfigValue<Schema, Requirements> & ConfigValueSpec<Schema>\n\n if (!('schema' in internal)) {\n return value\n }\n\n // SAFETY: The internal descriptor preserves the original schema and requirement phantom.\n return makeConfigValue({\n schema: internal.schema,\n source: internal.source,\n sourceOptions: options\n }) as ConfigValue<Schema, Requirements, Error>\n }\n }\n}\n\n/** The default lazy host-environment Config provider. */\nexport const ConfigLive = Config.layerFromEnv()\n\nexport type { StandardSchemaV1 }\n","import { CurrentAbortSignal } from '../runtime'\nimport { Layer } from '../layer'\nimport { Service } from '../service'\n\nexport { CurrentAbortSignal }\n\nexport { Config, ConfigLive, ConfigSourceError, ConfigValidationError } from './config'\n\nexport type {\n ConfigError,\n ConfigFromEnvOptions,\n ConfigInput,\n ConfigIssue,\n ConfigOutput,\n ConfigSource,\n ConfigSourceOptions,\n ConfigValue,\n StandardSchemaV1\n} from './config'\n\nconst assertDelay = (milliseconds: number): void => {\n if (!Number.isFinite(milliseconds) || milliseconds < 0) {\n throw new RangeError('Delay must be a finite non-negative number')\n }\n}\n\n/** Host-backed time and waiting service. */\nexport class Clock extends Service<Clock>()('Clock') {\n now(): Date {\n return new Date()\n }\n\n sleep(milliseconds: number): Promise<void> {\n assertDelay(milliseconds)\n return new Promise((resolve) => setTimeout(resolve, milliseconds))\n }\n}\n\n/** The default host Clock provider. */\nexport const ClockLive = Layer.make(Clock)\n\ntype ClockWaiter = {\n readonly at: number\n readonly resolve: () => void\n}\n\n/** Deterministic Clock implementation for tests. */\nexport class ClockTest implements Service.Contract<Clock> {\n private currentTime: number\n\n private readonly waiters: ClockWaiter[] = []\n\n constructor(initial: Date | number = 0) {\n this.currentTime = initial instanceof Date ? initial.getTime() : initial\n\n if (!Number.isFinite(this.currentTime)) {\n throw new RangeError('ClockTest time must be finite')\n }\n }\n\n now(): Date {\n return new Date(this.currentTime)\n }\n\n setTime(value: Date | number): void {\n const next = value instanceof Date ? value.getTime() : value\n\n if (!Number.isFinite(next)) {\n throw new RangeError('ClockTest time must be finite')\n }\n\n this.currentTime = next\n this.flushWaiters()\n }\n\n advance(milliseconds: number): void {\n assertDelay(milliseconds)\n this.currentTime += milliseconds\n this.flushWaiters()\n }\n\n sleep(milliseconds: number): Promise<void> {\n assertDelay(milliseconds)\n\n return new Promise((resolve) => {\n this.waiters.push({ at: this.currentTime + milliseconds, resolve })\n this.flushWaiters()\n })\n }\n\n static layer(initial: Date | number = 0) {\n return Layer.succeed(Clock, new ClockTest(initial))\n }\n\n private flushWaiters(): void {\n for (let index = this.waiters.length - 1; index >= 0; index--) {\n const waiter = this.waiters[index]!\n\n if (waiter.at <= this.currentTime) {\n this.waiters.splice(index, 1)\n waiter.resolve()\n }\n }\n }\n}\n\nexport const ClockTestLayer = (initial: Date | number = 0) => ClockTest.layer(initial)\n\n/** Host-backed pseudo-random number service. */\nexport class Random extends Service<Random>()('Random') {\n next(): number {\n return Math.random()\n }\n\n nextInt(maxExclusive: number): number {\n if (!Number.isInteger(maxExclusive) || maxExclusive <= 0) {\n throw new RangeError('Random.nextInt maxExclusive must be a positive integer')\n }\n\n return Math.floor(this.next() * maxExclusive)\n }\n}\n\n/** The default host Random provider. */\nexport const RandomLive = Layer.make(Random)\n\n/** Reproducible pseudo-random implementation with isolated mutable state. */\nexport class RandomSeeded implements Service.Contract<Random> {\n private state: number\n\n constructor(seed: number) {\n if (!Number.isFinite(seed)) {\n throw new RangeError('RandomSeeded seed must be finite')\n }\n\n this.state = seed >>> 0\n }\n\n next(): number {\n this.state = (1664525 * this.state + 1013904223) >>> 0\n return this.state / 0x1_0000_0000\n }\n\n nextInt(maxExclusive: number): number {\n if (!Number.isInteger(maxExclusive) || maxExclusive <= 0) {\n throw new RangeError('RandomSeeded.nextInt maxExclusive must be a positive integer')\n }\n\n return Math.floor(this.next() * maxExclusive)\n }\n\n static layer(seed: number) {\n return Layer.succeed(Random, new RandomSeeded(seed))\n }\n}\n\nexport const RandomSeededLayer = (seed: number) => RandomSeeded.layer(seed)\n\nexport type LoggerLevel = 'debug' | 'info' | 'warn' | 'error'\n\nexport type LoggerEvent = {\n level: LoggerLevel\n message: string\n data?: LoggerData\n}\n\nexport type LoggerData =\n | string\n | number\n | boolean\n | bigint\n | null\n | readonly LoggerData[]\n | { readonly [key: string]: LoggerData }\ntype LoggerInput = LoggerEvent | LoggerLevel\n\nconst isLoggerLevel = (value: LoggerInput): value is LoggerLevel =>\n value === 'debug' || value === 'info' || value === 'warn' || value === 'error'\n\nconst toLoggerEvent = (input: LoggerInput, message?: string, data?: LoggerData): LoggerEvent => {\n if (!isLoggerLevel(input)) {\n return input\n }\n\n const event: LoggerEvent = { level: input, message: message ?? '' }\n\n if (data !== undefined) {\n event.data = data\n }\n\n return event\n}\n\n/** Structured host logger bridge. */\nexport class Logger extends Service<Logger>()('Logger') {\n log(event: LoggerEvent): void\n log(level: LoggerLevel, message: string, data?: LoggerData): void\n log(first: LoggerInput, message?: string, data?: LoggerData): void {\n const event = toLoggerEvent(first, message, data)\n\n const write = console[event.level]\n\n if (event.data === undefined) {\n write.call(console, event.message)\n } else {\n write.call(console, event.message, event.data)\n }\n }\n\n debug(message: string, data?: LoggerData): void {\n this.log('debug', message, data)\n }\n\n info(message: string, data?: LoggerData): void {\n this.log('info', message, data)\n }\n\n warn(message: string, data?: LoggerData): void {\n this.log('warn', message, data)\n }\n\n error(message: string, data?: LoggerData): void {\n this.log('error', message, data)\n }\n}\n\n/** The default host Logger provider. */\nexport const LoggerLive = Layer.make(Logger)\n\n/** Ordered in-memory Logger implementation for tests. */\nexport class LoggerTest implements Service.Contract<Logger> {\n readonly events: LoggerEvent[] = []\n\n log(event: LoggerEvent): void\n log(level: LoggerLevel, message: string, data?: LoggerData): void\n log(first: LoggerInput, message?: string, data?: LoggerData): void {\n const event = toLoggerEvent(first, message, data)\n\n this.events.push(event)\n }\n\n debug(message: string, data?: LoggerData): void {\n this.log('debug', message, data)\n }\n\n info(message: string, data?: LoggerData): void {\n this.log('info', message, data)\n }\n\n warn(message: string, data?: LoggerData): void {\n this.log('warn', message, data)\n }\n\n error(message: string, data?: LoggerData): void {\n this.log('error', message, data)\n }\n\n clear(): void {\n this.events.length = 0\n }\n\n static make() {\n const logger = new LoggerTest()\n return { logger, layer: Layer.succeed(Logger, logger) }\n }\n\n static layer(logger: LoggerTest = new LoggerTest()) {\n return Layer.succeed(Logger, logger)\n }\n}\n\nexport const LoggerTestLayer = () => LoggerTest.layer()\n\n/** Execution-local request value carried by a normal Service provider. */\nexport class CurrentRequest extends Service<CurrentRequest>()('CurrentRequest') {\n readonly request: unknown\n\n // oxlint-disable-next-line anti-slop/no-unknown-parameters\n constructor(readonly value: unknown) {\n super()\n this.request = value\n }\n\n // oxlint-disable-next-line anti-slop/no-unknown-parameters\n static layer(value: unknown) {\n return Layer.succeed(CurrentRequest, new CurrentRequest(value))\n }\n}\n\n// oxlint-disable-next-line anti-slop/no-unknown-parameters\nexport const CurrentRequestLayer = (value: unknown) => CurrentRequest.layer(value)\n"],"mappings":";;;;AAqCA,IAAa,wBAAb,cAA2C,YA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AAM,KAAK,MAAM;;AAG3C,IAAa,aAAb,MAAa,WAA+C;CAC1D,SAAiC,CAAC;CAIlC,IAAI,OAAoB,SAAkB,MAAyB;EACjE,MAAM,QAAQ,cAAc,OAAO,SAAS,IAAI;EAEhD,KAAK,OAAO,KAAK,KAAK;CACxB;CAEA,MAAM,SAAiB,MAAyB;EAC9C,KAAK,IAAI,SAAS,SAAS,IAAI;CACjC;CAEA,KAAK,SAAiB,MAAyB;EAC7C,KAAK,IAAI,QAAQ,SAAS,IAAI;CAChC;CAEA,KAAK,SAAiB,MAAyB;EAC7C,KAAK,IAAI,QAAQ,SAAS,IAAI;CAChC;CAEA,MAAM,SAAiB,MAAyB;EAC9C,KAAK,IAAI,SAAS,SAAS,IAAI;CACjC;CAEA,QAAc;EACZ,KAAK,OAAO,SAAS;CACvB;CAEA,OAAO,OAAO;EACZ,MAAM,SAAS,IAAI,WAAW;EAC9B,OAAO;GAAE;GAAQ,OAAO,MAAM,QAAQ,QAAQ,MAAM;EAAE;CACxD;CAEA,OAAO,MAAM,SAAqB,IAAI,WAAW,GAAG;EAClD,OAAO,MAAM,QAAQ,QAAQ,MAAM;CACrC;AACF;AAEA,MAAa,wBAAwB,WAAW,MAAM;;AAGtD,IAAa,iBAAb,MAAa,uBAAuB,QAAwB,CAAC,CAAC,gBAAgB,CAAC,CAAC;CAIzD;CAHrB;CAGA,YAAY,OAAyB;EACnC,MAAM;EADa,KAAA,QAAA;EAEnB,KAAK,UAAU;CACjB;CAGA,OAAO,MAAM,OAAgB;EAC3B,OAAO,MAAM,QAAQ,gBAAgB,IAAI,eAAe,KAAK,CAAC;CAChE;AACF;AAGA,MAAa,uBAAuB,UAAmB,eAAe,MAAM,KAAK"}
@@ -1,3 +1,3 @@
1
- import { d as CurrentAbortSignal } from "./index-BafDna0B.mjs";
2
- import { A as StandardSchemaV1, C as ConfigLive, D as ConfigSourceOptions, E as ConfigSourceError, O as ConfigValidationError, S as ConfigIssue, T as ConfigSource, _ as RandomSeededLayer, a as CurrentRequest, b as ConfigFromEnvOptions, c as LoggerData, d as LoggerLive, f as LoggerTest, g as RandomSeeded, h as RandomLive, i as ClockTestLayer, k as ConfigValue, l as LoggerEvent, m as Random, n as ClockLive, o as CurrentRequestLayer, p as LoggerTestLayer, r as ClockTest, s as Logger, t as Clock, u as LoggerLevel, v as Config, w as ConfigOutput, x as ConfigInput, y as ConfigError } from "./index-DklNCz7w.mjs";
1
+ import { d as CurrentAbortSignal } from "./index-C7Qild0_.mjs";
2
+ import { A as StandardSchemaV1, C as ConfigLive, D as ConfigSourceOptions, E as ConfigSourceError, O as ConfigValidationError, S as ConfigIssue, T as ConfigSource, _ as RandomSeededLayer, a as CurrentRequest, b as ConfigFromEnvOptions, c as LoggerData, d as LoggerLive, f as LoggerTest, g as RandomSeeded, h as RandomLive, i as ClockTestLayer, k as ConfigValue, l as LoggerEvent, m as Random, n as ClockLive, o as CurrentRequestLayer, p as LoggerTestLayer, r as ClockTest, s as Logger, t as Clock, u as LoggerLevel, v as Config, w as ConfigOutput, x as ConfigInput, y as ConfigError } from "./index-DStz0JMN.mjs";
3
3
  export { Clock, ClockLive, ClockTest, ClockTestLayer, Config, type ConfigError, type ConfigFromEnvOptions, type ConfigInput, type ConfigIssue, ConfigLive, type ConfigOutput, type ConfigSource, ConfigSourceError, type ConfigSourceOptions, ConfigValidationError, type ConfigValue, CurrentAbortSignal, CurrentRequest, CurrentRequestLayer, Logger, LoggerData, LoggerEvent, LoggerLevel, LoggerLive, LoggerTest, LoggerTestLayer, Random, RandomLive, RandomSeeded, RandomSeededLayer, type StandardSchemaV1 };
@@ -1,3 +1,3 @@
1
- import { t as CurrentAbortSignal } from "./signal-C1bagvrO.mjs";
2
- import { _ as ConfigSourceError, a as CurrentRequest, c as LoggerLive, d as Random, f as RandomLive, g as ConfigLive, h as Config, i as ClockTestLayer, l as LoggerTest, m as RandomSeededLayer, n as ClockLive, o as CurrentRequestLayer, p as RandomSeeded, r as ClockTest, s as Logger, t as Clock, u as LoggerTestLayer, v as ConfigValidationError } from "./standard-services-DW-i4UuA.mjs";
1
+ import { t as CurrentAbortSignal } from "./signal-B97cs85Z.mjs";
2
+ import { _ as ConfigSourceError, a as CurrentRequest, c as LoggerLive, d as Random, f as RandomLive, g as ConfigLive, h as Config, i as ClockTestLayer, l as LoggerTest, m as RandomSeededLayer, n as ClockLive, o as CurrentRequestLayer, p as RandomSeeded, r as ClockTest, s as Logger, t as Clock, u as LoggerTestLayer, v as ConfigValidationError } from "./standard-services-BFBq-4lo.mjs";
3
3
  export { Clock, ClockLive, ClockTest, ClockTestLayer, Config, ConfigLive, ConfigSourceError, ConfigValidationError, CurrentAbortSignal, CurrentRequest, CurrentRequestLayer, Logger, LoggerLive, LoggerTest, LoggerTestLayer, Random, RandomLive, RandomSeeded, RandomSeededLayer };
@@ -1,2 +1,198 @@
1
- import { t as MapLayerBackend } from "./map-layer-backend-rNwfH0Bz.mjs";
2
- export { MapLayerBackend as MemoryLayerBackend };
1
+ import { M as AnyService, c as RuntimeContextStorage } from "./index-heuaRmXR.mjs";
2
+ import { A as OverrideLayerResult, C as CompleteExecutionLayer, D as LayerInputState, E as LayerInput, F as ValidateOverrides, I as ValidateOverridesWitness, M as RequiredEnvironment, N as ValidateLayerInput, R as MissingDependencies, S as CompleteExecution, _ as MapLayerBackend, c as RuntimeObserver, d as RuntimeServiceResolveEvent, i as RuntimeRunOptions, j as ProvidedEnvironment, l as RuntimeResourceReleaseEvent, n as RuntimeDisposeOptions, o as RuntimeExecutionEndEvent, r as RuntimeOptions, s as RuntimeExecutionStartEvent, u as RuntimeServiceAcquireEvent, v as LayerBackend } from "./index-rQhZk3Nt.mjs";
3
+ import { f as Runtime } from "./index-C7Qild0_.mjs";
4
+ import { f as LoggerTest, g as RandomSeeded, r as ClockTest } from "./index-DStz0JMN.mjs";
5
+ //#region src/testing/contracts.d.ts
6
+ /** One runner-neutral conformance scenario. */
7
+ interface ContractScenario {
8
+ /** Stable human-readable scenario name for test-runner registration. */
9
+ readonly name: string;
10
+ /** Execute the scenario and reject with a diagnostic when its contract is violated. */
11
+ readonly run: () => Promise<void>;
12
+ }
13
+ /** Thrown by a conformance scenario when an adapter violates its contract. */
14
+ declare class ConformanceError extends Error {
15
+ readonly scenario: string;
16
+ constructor(scenario: string, detail: string, cause?: unknown);
17
+ }
18
+ /** Declared behavior for a backend after a provider acquisition fails. */
19
+ type LayerBackendAcquisitionFailure = 'retry' | 'sticky';
20
+ /** Configuration for the LayerBackend conformance scenarios. */
21
+ interface LayerBackendContractOptions {
22
+ /** Create a new, isolated backend for every scenario. */
23
+ readonly makeBackend: () => LayerBackend | PromiseLike<LayerBackend>;
24
+ /** Declare whether failed acquisitions retry or remain cached until disposal. */
25
+ readonly acquisitionFailure: LayerBackendAcquisitionFailure;
26
+ /** Run adapter-specific cleanup after every scenario, including failed assertions. */
27
+ readonly cleanup?: (backend: LayerBackend) => void | PromiseLike<void>;
28
+ }
29
+ /** Supported overlap behavior for RuntimeContextStorage implementations. */
30
+ type ContextConcurrency = 'concurrent' | 'sequential';
31
+ /** Configuration for the RuntimeContextStorage conformance scenarios. */
32
+ interface RuntimeContextStorageContractOptions {
33
+ /** Create a new, isolated storage instance for every scenario. */
34
+ readonly makeStorage: () => RuntimeContextStorage;
35
+ /** Declare whether one storage instance supports overlapping root contexts. */
36
+ readonly concurrency: ContextConcurrency;
37
+ /** Recognize the implementation's standard missing-context error. */
38
+ readonly isMissingContextError?: (cause: unknown) => boolean;
39
+ /** Recognize the implementation's standard unsupported-overlap error. */
40
+ readonly isOverlapError?: (cause: unknown) => boolean;
41
+ /** Create a storage that should not leak a frame into this storage. */
42
+ readonly makeCompanionStorage?: () => RuntimeContextStorage;
43
+ /** Run adapter-specific cleanup after every scenario, including failed assertions. */
44
+ readonly cleanup?: (storage: RuntimeContextStorage) => void | PromiseLike<void>;
45
+ }
46
+ /**
47
+ * Return runner-neutral scenarios for a LayerBackend implementation.
48
+ *
49
+ * Every scenario creates a fresh backend and invokes `cleanup` in `finally`,
50
+ * so consumers can register `scenario.run` directly with their test runner.
51
+ */
52
+ declare const layerBackendContract: (options: LayerBackendContractOptions) => readonly ContractScenario[];
53
+ /**
54
+ * Return runner-neutral scenarios for a RuntimeContextStorage implementation.
55
+ *
56
+ * Every scenario creates a fresh storage and invokes `cleanup` in `finally`,
57
+ * so consumers can register `scenario.run` directly with their test runner.
58
+ */
59
+ declare const runtimeContextStorageContract: (options: RuntimeContextStorageContractOptions) => readonly ContractScenario[];
60
+ //#endregion
61
+ //#region src/testing/recorded-runtime-observer.d.ts
62
+ /** Every event emitted by a Runtime observer hook. */
63
+ type RuntimeObserverEvent = RuntimeServiceResolveEvent | RuntimeServiceAcquireEvent | RuntimeExecutionStartEvent | RuntimeExecutionEndEvent | RuntimeResourceReleaseEvent;
64
+ /** Immutable views of events recorded by a {@link RecordedRuntimeObserver}. */
65
+ type RecordedRuntimeObserverSnapshot = {
66
+ readonly serviceResolutions: readonly RuntimeServiceResolveEvent[];
67
+ readonly serviceAcquisitions: readonly RuntimeServiceAcquireEvent[];
68
+ readonly executionStarts: readonly RuntimeExecutionStartEvent[];
69
+ readonly executionEnds: readonly RuntimeExecutionEndEvent[];
70
+ readonly resourceReleases: readonly RuntimeResourceReleaseEvent[];
71
+ readonly timeline: readonly RuntimeObserverEvent[];
72
+ };
73
+ /** Records Runtime lifecycle events for assertions in tests. */
74
+ declare class RecordedRuntimeObserver implements RuntimeObserver {
75
+ private readonly serviceResolutionEvents;
76
+ private readonly serviceAcquisitionEvents;
77
+ private readonly executionStartEvents;
78
+ private readonly executionEndEvents;
79
+ private readonly resourceReleaseEvents;
80
+ private readonly timelineEvents;
81
+ static make(): RecordedRuntimeObserver;
82
+ readonly onServiceResolve: (event: RuntimeServiceResolveEvent) => void;
83
+ readonly onServiceAcquire: (event: RuntimeServiceAcquireEvent) => void;
84
+ readonly onExecutionStart: (event: RuntimeExecutionStartEvent) => void;
85
+ readonly onExecutionEnd: (event: RuntimeExecutionEndEvent) => void;
86
+ readonly onResourceRelease: (event: RuntimeResourceReleaseEvent) => void;
87
+ get serviceResolutions(): readonly RuntimeServiceResolveEvent[];
88
+ get serviceAcquisitions(): readonly RuntimeServiceAcquireEvent[];
89
+ get executionStarts(): readonly RuntimeExecutionStartEvent[];
90
+ get executionEnds(): readonly RuntimeExecutionEndEvent[];
91
+ get resourceReleases(): readonly RuntimeResourceReleaseEvent[];
92
+ get timeline(): readonly RuntimeObserverEvent[];
93
+ clear(): void;
94
+ snapshot(): RecordedRuntimeObserverSnapshot;
95
+ private record;
96
+ }
97
+ //#endregion
98
+ //#region src/testing/test-runtime.d.ts
99
+ declare const TestRuntimeOptionsOverridesTypeId: unique symbol;
100
+ type ValidatedTestServiceOption<Base extends LayerInput, Overrides extends readonly LayerInput[], Replacement extends LayerInput, Value> = Value & ValidateOverridesWitness<Base, readonly [...Overrides, Replacement]>;
101
+ /** Options for an isolated TestRuntime. */
102
+ type TestRuntimeOptions<Base extends LayerInput = LayerInput, Overrides extends readonly LayerInput[] = readonly []> = Omit<RuntimeOptions, 'backend' | 'observers'> & {
103
+ /** Explicitly replace or add providers through `Layer.override`. */
104
+ readonly overrides?: Overrides & ValidateOverrides<Base, Overrides>;
105
+ /** Backend used by the underlying Runtime. Defaults to a fresh MapLayerBackend. */
106
+ readonly backend?: LayerBackend;
107
+ /** Deterministic Clock provider to install for this TestRuntime. */
108
+ readonly clock?: ValidatedTestServiceOption<Base, Overrides, ClockTestLayer, ClockTest>;
109
+ /** In-memory Logger provider to install for this TestRuntime. */
110
+ readonly logger?: ValidatedTestServiceOption<Base, Overrides, LoggerTestLayer, LoggerTest>;
111
+ /** Seeded Random provider to install for this TestRuntime. */
112
+ readonly random?: ValidatedTestServiceOption<Base, Overrides, RandomSeededLayer, RandomSeeded>;
113
+ /** Additional best-effort observers after the default recorder. */
114
+ readonly observers?: readonly RuntimeObserver[];
115
+ } & {
116
+ readonly [TestRuntimeOptionsOverridesTypeId]?: Overrides;
117
+ };
118
+ type ClockTestLayer = ReturnType<typeof ClockTest.layer>;
119
+ type LoggerTestLayer = ReturnType<typeof LoggerTest.layer>;
120
+ type RandomSeededLayer = ReturnType<typeof RandomSeeded.layer>;
121
+ type TestRuntimeOptionsInput = Omit<RuntimeOptions, 'backend' | 'observers'> & {
122
+ readonly overrides?: readonly LayerInput[];
123
+ readonly backend?: LayerBackend;
124
+ readonly clock?: ClockTest;
125
+ readonly logger?: LoggerTest;
126
+ readonly random?: RandomSeeded;
127
+ readonly observers?: readonly RuntimeObserver[];
128
+ };
129
+ type ExplicitOverrides<Options extends TestRuntimeOptionsInput> = typeof TestRuntimeOptionsOverridesTypeId extends keyof Options ? Exclude<Options[typeof TestRuntimeOptionsOverridesTypeId], undefined> extends (infer Overrides extends readonly LayerInput[]) ? Overrides : readonly [] : Exclude<Options['overrides'], undefined> extends (infer Overrides extends readonly LayerInput[]) ? Overrides : readonly [];
130
+ type HasDefinedOption<Options, Key extends PropertyKey> = true extends (Options extends unknown ? Key extends keyof Options ? {} extends Pick<Options, Key> ? false : undefined extends Options[Key] ? false : true : false : never) ? true : false;
131
+ type HasPotentialOption<Options, Key extends PropertyKey> = true extends (Options extends unknown ? Key extends keyof Options ? [Exclude<Options[Key], undefined>] extends [never] ? false : true : false : never) ? true : false;
132
+ type HasGuaranteedOption<Options, Key extends PropertyKey> = [Options] extends [never] ? false : false extends (Options extends unknown ? HasDefinedOption<Options, Key> : never) ? false : true;
133
+ type TestRuntimeOptionLayers<Options extends TestRuntimeOptionsInput> = [...ExplicitOverrides<Options>, ...(HasGuaranteedOption<Options, 'clock'> extends true ? [ClockTestLayer] : []), ...(HasGuaranteedOption<Options, 'logger'> extends true ? [LoggerTestLayer] : []), ...(HasGuaranteedOption<Options, 'random'> extends true ? [RandomSeededLayer] : [])];
134
+ type TestRuntimeValidationLayers<Options extends TestRuntimeOptionsInput> = [...ExplicitOverrides<Options>, ...(HasPotentialOption<Options, 'clock'> extends true ? [ClockTestLayer] : []), ...(HasPotentialOption<Options, 'logger'> extends true ? [LoggerTestLayer] : []), ...(HasPotentialOption<Options, 'random'> extends true ? [RandomSeededLayer] : [])];
135
+ type TestRuntimeLayer<Base extends LayerInput, Options extends TestRuntimeOptionsInput> = OverrideLayerResult<Base, TestRuntimeOptionLayers<Options>>;
136
+ type TestRuntimeOptionsValidation<Base extends LayerInput, Options extends TestRuntimeOptionsInput> = (Options extends {
137
+ readonly overrides?: infer Overrides extends readonly LayerInput[];
138
+ } ? {
139
+ readonly overrides?: Overrides & ValidateOverrides<Base, Overrides>;
140
+ } : unknown) & ValidateOverridesWitness<Base, TestRuntimeValidationLayers<Options>>;
141
+ type CompleteLayerCheck<L extends LayerInput> = ValidateLayerInput<L> & (LayerInputState<L> extends 'typed' ? [RequiredEnvironment<L>] extends [never] ? unknown : MissingDependencies<Extract<RequiredEnvironment<L>, AnyService>> : unknown);
142
+ type ConfiguredService<Options, Key extends PropertyKey, Service> = Options extends unknown ? Key extends keyof Options ? undefined extends Options[Key] ? undefined : Options[Key] extends Service ? Options[Key] : undefined : undefined : never;
143
+ type TestCallback<Provided extends AnyService, A, Options extends object = {}> = (test: TestRuntime<Provided, Options>) => A | PromiseLike<A>;
144
+ /**
145
+ * Thrown when the TestRuntime recorder contains an execution start or end
146
+ * event without its matching event at final disposal.
147
+ */
148
+ declare class TestRuntimeObserverError extends Error {
149
+ readonly unmatchedStarts: readonly RuntimeExecutionStartEvent[];
150
+ readonly unmatchedEnds: readonly RuntimeExecutionEndEvent[];
151
+ constructor(unmatchedStarts: readonly RuntimeExecutionStartEvent[], unmatchedEnds: readonly RuntimeExecutionEndEvent[]);
152
+ }
153
+ /**
154
+ * A disposable test boundary backed by the real Layer and Runtime
155
+ * implementations.
156
+ */
157
+ declare class TestRuntime<Provided extends AnyService = any, Options extends object = {}> {
158
+ /** The real Runtime used by this testing facade. */
159
+ readonly runtime: Runtime<Provided>;
160
+ /** Lifecycle events recorded by this TestRuntime. */
161
+ readonly observer: RecordedRuntimeObserver;
162
+ readonly clock: ConfiguredService<Options, 'clock', ClockTest>;
163
+ readonly logger: ConfiguredService<Options, 'logger', LoggerTest>;
164
+ readonly random: ConfiguredService<Options, 'random', RandomSeeded>;
165
+ private disposalPromise;
166
+ private constructor();
167
+ /** Create a TestRuntime with a fresh backend and default lifecycle recorder. */
168
+ static make<L extends LayerInput>(layer: L & CompleteLayerCheck<L>): Promise<TestRuntime<ProvidedEnvironment<L>>>;
169
+ static make<L extends LayerInput, const Options extends TestRuntimeOptionsInput>(layer: L & ValidateLayerInput<L> & CompleteLayerCheck<TestRuntimeLayer<L, NoInfer<Options>>>, options: Options & TestRuntimeOptionsValidation<L, Options>): Promise<TestRuntime<ProvidedEnvironment<TestRuntimeLayer<L, Options>>, Options>>;
170
+ private static makeInternal;
171
+ /** Run a fully typechecked program in the underlying Runtime. */
172
+ run<A>(program: CompleteExecution<Provided, A>, options?: RuntimeRunOptions): Promise<Awaited<A>>;
173
+ /** Run a fully typechecked program with an execution-local Layer. */
174
+ runWith<Request extends LayerInput, A>(layer: Request & CompleteExecutionLayer<Provided, Request>, program: CompleteExecution<Provided | ProvidedEnvironment<Request>, A>, options?: RuntimeRunOptions): Promise<Awaited<A>>;
175
+ /** Dispose the underlying Runtime and perform the final recorder consistency check. */
176
+ dispose(options?: RuntimeDisposeOptions): Promise<void>;
177
+ /** Release this TestRuntime through JavaScript's async disposal protocol. */
178
+ [Symbol.asyncDispose](): Promise<void>;
179
+ private disposeWithOutcome;
180
+ private disposeWithInput;
181
+ private assertObserverConsistency;
182
+ private observerConsistencyFailure;
183
+ /** Run a callback and always dispose this TestRuntime with its final outcome. */
184
+ static use<A, L extends LayerInput>(layer: L & CompleteLayerCheck<L>, use: TestCallback<ProvidedEnvironment<L>, A>): Promise<Awaited<A>>;
185
+ static use<A, L extends LayerInput, const Options extends TestRuntimeOptionsInput>(layer: L & ValidateLayerInput<L> & CompleteLayerCheck<TestRuntimeLayer<L, NoInfer<Options>>>, options: Options & TestRuntimeOptionsValidation<L, Options>, use: TestCallback<ProvidedEnvironment<TestRuntimeLayer<L, Options>>, A, Options>): Promise<Awaited<A>>;
186
+ }
187
+ /** Type-level aliases for TestRuntime configuration. */
188
+ declare namespace TestRuntime {
189
+ /** Options accepted by `TestRuntime.make` and `TestRuntime.use`. */
190
+ type Options<Base extends LayerInput = LayerInput, Overrides extends readonly LayerInput[] = readonly []> = TestRuntimeOptions<Base, Overrides>;
191
+ /** Optional signal supplied to one managed TestRuntime execution. */
192
+ type RunOptions = RuntimeRunOptions;
193
+ /** Cooperative shutdown policy for a managed TestRuntime. */
194
+ type DisposeOptions = RuntimeDisposeOptions;
195
+ }
196
+ //#endregion
197
+ export { ClockTest, ConformanceError, type ContextConcurrency, type ContractScenario, type LayerBackendAcquisitionFailure, type LayerBackendContractOptions, LoggerTest, MapLayerBackend as MemoryLayerBackend, RandomSeeded, RecordedRuntimeObserver, type RecordedRuntimeObserverSnapshot, type RuntimeContextStorageContractOptions, RuntimeObserver, type RuntimeObserverEvent, TestRuntime, TestRuntimeObserverError, type TestRuntimeOptions, layerBackendContract, runtimeContextStorageContract };
198
+ //# sourceMappingURL=testing.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testing.d.mts","names":[],"sources":["../src/testing/contracts.ts","../src/testing/recorded-runtime-observer.ts","../src/testing/test-runtime.ts"],"mappings":";;;;;;UAyBiB;;WAEN;;WAGA,WAAW;;;cAIT,yBAAyB;WAEzB;EAAA,YAAA,kBACT,gBACA;;;KASQ;;UAGK;;WAEN,mBAAmB,eAAe,YAAY;;WAG9C,oBAAoB;;WAGpB,WAAW,SAAS,wBAAwB;;;KAI3C;;UAGK;;WAEN,mBAAmB;;WAGnB,aAAa;;WAGb,yBAAyB;;WAGzB,kBAAkB;;WAGlB,6BAA6B;;WAG7B,WAAW,SAAS,iCAAiC;;;;;;;;cAmKnD,uBACX,SAAS,yCACC;;;;;;;cAohBC,gCACX,SAAS,kDACC;;;;KCnwBA,uBACR,6BACA,6BACA,6BACA,2BACA;;KAGQ;WACD,6B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