better-effect 0.12.0 → 0.14.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.
- package/README.md +599 -30
- package/dist/adapters/iti.d.mts +2 -3
- package/dist/adapters/iti.d.mts.map +1 -1
- package/dist/adapters/iti.mjs +2 -2
- package/dist/bun.d.mts +95 -0
- package/dist/bun.d.mts.map +1 -0
- package/dist/bun.mjs +177 -0
- package/dist/bun.mjs.map +1 -0
- package/dist/{context-BUEf1qjL.mjs → context-DSGSqcJj.mjs} +14 -3
- package/dist/context-DSGSqcJj.mjs.map +1 -0
- package/dist/current-request-Bc1YHL0w.mjs +21 -0
- package/dist/current-request-Bc1YHL0w.mjs.map +1 -0
- package/dist/current-request-Dm-QQ3Xr.d.mts +22 -0
- package/dist/current-request-Dm-QQ3Xr.d.mts.map +1 -0
- package/dist/{effect-CK4YZaX0.mjs → effect-W0IQXY8P.mjs} +21 -2
- package/dist/effect-W0IQXY8P.mjs.map +1 -0
- package/dist/{errors-BKcsQ0ip.d.mts → errors-CpHMzPiP.d.mts} +6 -2
- package/dist/errors-CpHMzPiP.d.mts.map +1 -0
- package/dist/hono.d.mts +65 -27
- package/dist/hono.d.mts.map +1 -1
- package/dist/hono.mjs +177 -53
- package/dist/hono.mjs.map +1 -1
- package/dist/{index-CX6iAoCB.d.mts → index-3Bkl-sxS.d.mts} +7 -2
- package/dist/{index-CX6iAoCB.d.mts.map → index-3Bkl-sxS.d.mts.map} +1 -1
- package/dist/{index-B1nH4luq.d.mts → index-C2ed9Ilq.d.mts} +32 -21
- package/dist/index-C2ed9Ilq.d.mts.map +1 -0
- package/dist/{index-GYJ4qm9K.d.mts → index-ClNndn2-.d.mts} +93 -62
- package/dist/index-ClNndn2-.d.mts.map +1 -0
- package/dist/{index-BMdU_Z72.d.mts → index-Cy1VsU-u.d.mts} +2 -3
- package/dist/index-Cy1VsU-u.d.mts.map +1 -0
- package/dist/index.d.mts +6 -7
- package/dist/index.mjs +8 -8
- package/dist/{internal-identity-CbXoZIfw.mjs → internal-identity-BuHBtP0k.mjs} +2 -2
- package/dist/{internal-identity-CbXoZIfw.mjs.map → internal-identity-BuHBtP0k.mjs.map} +1 -1
- package/dist/layer-2kjHVv4N.mjs +343 -0
- package/dist/layer-2kjHVv4N.mjs.map +1 -0
- package/dist/{outcome-CB43bnFW.d.mts → layer-C2OaqTmB.d.mts} +683 -138
- package/dist/layer-C2OaqTmB.d.mts.map +1 -0
- package/dist/next.d.mts +192 -0
- package/dist/next.d.mts.map +1 -0
- package/dist/next.mjs +185 -0
- package/dist/next.mjs.map +1 -0
- package/dist/{node-context-DWsCUBRa.d.mts → node-context-1YEjrU9g.d.mts} +2 -2
- package/dist/{node-context-DWsCUBRa.d.mts.map → node-context-1YEjrU9g.d.mts.map} +1 -1
- package/dist/{node-context-lggRF4bR.mjs → node-context-g3bCcY9t.mjs} +2 -2
- package/dist/{node-context-lggRF4bR.mjs.map → node-context-g3bCcY9t.mjs.map} +1 -1
- package/dist/node.d.mts +11 -6
- package/dist/node.d.mts.map +1 -1
- package/dist/node.mjs +156 -10
- package/dist/node.mjs.map +1 -1
- package/dist/opentelemetry.d.mts +112 -0
- package/dist/opentelemetry.d.mts.map +1 -0
- package/dist/opentelemetry.mjs +871 -0
- package/dist/opentelemetry.mjs.map +1 -0
- package/dist/{registration-drnZk0SY.mjs → registration-Bwe2GbVu.mjs} +8 -2
- package/dist/registration-Bwe2GbVu.mjs.map +1 -0
- package/dist/runtime/explicit.d.mts +2 -2
- package/dist/runtime/explicit.mjs +1 -1
- package/dist/runtime/node.d.mts +3 -3
- package/dist/runtime/node.mjs +2 -2
- package/dist/runtime-qpcVwaz_.mjs +1680 -0
- package/dist/runtime-qpcVwaz_.mjs.map +1 -0
- package/dist/service-CO9VJQYa.mjs +74 -0
- package/dist/service-CO9VJQYa.mjs.map +1 -0
- package/dist/signal-5Rg9bUUe.mjs +52 -0
- package/dist/signal-5Rg9bUUe.mjs.map +1 -0
- package/dist/{standard-services-GBZ32tll.mjs → standard-services-B-iMM_W7.mjs} +39 -19
- package/dist/standard-services-B-iMM_W7.mjs.map +1 -0
- package/dist/standard-services.d.mts +4 -3
- package/dist/standard-services.mjs +3 -2
- package/dist/testing.d.mts +25 -6
- package/dist/testing.d.mts.map +1 -1
- package/dist/testing.mjs +51 -7
- package/dist/testing.mjs.map +1 -1
- package/dist/types-BFTqCCcw.d.mts +81 -0
- package/dist/types-BFTqCCcw.d.mts.map +1 -0
- package/dist/web-effect-B9hp9jIe.mjs +380 -0
- package/dist/web-effect-B9hp9jIe.mjs.map +1 -0
- package/dist/web.d.mts +56 -0
- package/dist/web.d.mts.map +1 -0
- package/dist/web.mjs +2 -0
- package/package.json +36 -11
- package/dist/context-BUEf1qjL.mjs.map +0 -1
- package/dist/effect-CK4YZaX0.mjs.map +0 -1
- package/dist/errors-BKcsQ0ip.d.mts.map +0 -1
- package/dist/index-B1nH4luq.d.mts.map +0 -1
- package/dist/index-BMdU_Z72.d.mts.map +0 -1
- package/dist/index-GYJ4qm9K.d.mts.map +0 -1
- package/dist/index-heuaRmXR.d.mts +0 -374
- package/dist/index-heuaRmXR.d.mts.map +0 -1
- package/dist/layer-D56fRdLt.mjs +0 -269
- package/dist/layer-D56fRdLt.mjs.map +0 -1
- package/dist/outcome-CB43bnFW.d.mts.map +0 -1
- package/dist/program-metadata-DhQCCirO.mjs +0 -260
- package/dist/program-metadata-DhQCCirO.mjs.map +0 -1
- package/dist/registration-drnZk0SY.mjs.map +0 -1
- package/dist/runtime-CBMrX8Wl.mjs +0 -776
- package/dist/runtime-CBMrX8Wl.mjs.map +0 -1
- package/dist/signal-D2UTcaaG.mjs +0 -105
- package/dist/signal-D2UTcaaG.mjs.map +0 -1
- package/dist/standard-services-GBZ32tll.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"standard-services-B-iMM_W7.mjs","names":[],"sources":["../src/standard-services/config.ts","../src/standard-services/id-generator.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/* oxlint-disable anti-slop/no-unsafe-dictionary-type -- schema output is opaque at this generic runtime boundary and is narrowed before storage. */\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/** The string keys exposed by a schema's decoded configuration output. */\ntype ConfigOutputObject<Schema extends StandardSchemaV1> =\n ConfigOutput<Schema> extends object ? ConfigOutput<Schema> : Record<never, never>\n\nexport type ConfigKey<Schema extends StandardSchemaV1> = Extract<\n keyof ConfigOutputObject<Schema>,\n string\n>\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\ntype ConfigWithOutput<Schema extends StandardSchemaV1> = Omit<Config, 'get'> & {\n get<Key extends ConfigKey<Schema>>(key: Key): ConfigOutputObject<Schema>[Key]\n}\n\ntype SchemaConfigToken<Schema extends StandardSchemaV1> = Service.Class<\n 'Config',\n ConfigWithOutput<Schema>\n> &\n Service.Token<'Config', ConfigWithOutput<Schema>> & {\n readonly [Symbol.asyncIterator]: () => AsyncGenerator<\n ServiceRequirement<ConfigWithOutput<Schema>>,\n ConfigWithOutput<Schema>,\n unknown\n >\n } & {\n readonly layer: (source: ConfigSource) => Layer<ConfigWithOutput<Schema>, never>\n readonly layerFromEnv: (options?: ConfigSourceOptions) => Layer<ConfigWithOutput<Schema>, never>\n }\n\n/** Host-backed raw configuration source and provider token. */\nexport class Config extends Service<Config>()('Config') {\n private values: Readonly<Record<string, unknown>>\n\n constructor(readonly source: ConfigSource) {\n super()\n this.values = source\n }\n\n /** Read one value from the configured source or decoded schema output. */\n get(key: string): string | undefined {\n // SAFETY: The unbound Config API contains raw string values; schema-bound tokens\n // narrow this method to their decoded output type.\n return this.values[key] as string | undefined\n }\n\n /**\n * Create a schema-bound Config token with a typed `get` accessor.\n *\n * The token validates its source while its Layer is acquired. The accessor then\n * reads the decoded schema output, so its return type follows the selected key.\n */\n static withSchema<Schema extends StandardSchemaV1>(schema: Schema): SchemaConfigToken<Schema> {\n class SchemaConfig extends Config {}\n\n // SAFETY: SchemaConfig is a Config subclass; this cast adds only schema-derived static signatures.\n // oxlint-disable-next-line anti-slop/no-chained-type-assertions\n const token = SchemaConfig as unknown as SchemaConfigToken<Schema>\n const acquire = async (source: ConfigSource): Promise<ConfigWithOutput<Schema>> => {\n const checked = await validate(schema, source)\n\n if (checked.status === 'error') {\n throw checked.error\n }\n\n const values = checked.value\n\n // oxlint-disable-next-line anti-slop/no-runtime-typeof -- Schema outputs must be objects for keyed access.\n if (typeof values !== 'object' || values === null) {\n throw new TypeError('Config schema output must be an object to use Config.get')\n }\n\n // SAFETY: Standard Schema returned a non-null object; this cast stores it behind the schema-derived Config.get type.\n const config = new Config(source)\n // SAFETY: The preceding object check establishes the runtime shape retained by Config.\n config.values = values as Readonly<Record<string, unknown>>\n // SAFETY: The validated output and schema key mapping establish this typed accessor.\n return config as ConfigWithOutput<Schema>\n }\n\n Object.assign(SchemaConfig, {\n layer: (source: ConfigSource) => Layer.make(token, () => acquire(source)),\n layerFromEnv: (options: ConfigSourceOptions = {}) =>\n Layer.make(token, async () => {\n const loaded = await Result.tryPromise({\n try: () => loadSource(options),\n catch: (cause) => sourceError(options.dotEnvPath, cause)\n })\n\n if (loaded.status === 'error') {\n throw loaded.error\n }\n\n return await acquire(loaded.value)\n })\n })\n\n return token\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 { Layer } from '../layer'\nimport { Service } from '../service'\n\ntype HostCrypto = {\n readonly randomUUID?: () => string\n}\n\nconst hostCrypto = (): HostCrypto | undefined => {\n // SAFETY: Supported hosts expose crypto on globalThis, but the optional property models older or restricted hosts.\n return (globalThis as { readonly crypto?: HostCrypto }).crypto\n}\n\n/** Thrown when the host does not expose the supported Web Crypto UUID API. */\nexport class IdGeneratorUnavailableError extends Error {\n constructor() {\n super('IdGenerator requires a host crypto.randomUUID implementation')\n\n this.name = 'IdGeneratorUnavailableError'\n }\n}\n\n/** Thrown when an {@link IdGeneratorTest} queue has no IDs left. */\nexport class IdGeneratorExhaustedError extends Error {\n constructor(readonly generated: number) {\n super(\n `IdGeneratorTest queue exhausted after ${generated} generated ID${generated === 1 ? '' : 's'}`\n )\n\n this.name = 'IdGeneratorExhaustedError'\n }\n}\n\n/** Host-backed UUID string ID service. */\nexport class IdGenerator extends Service<IdGenerator>()('IdGenerator') {\n /** Generate a cryptographically strong UUID string using the host Web Crypto API. */\n next(): string {\n const crypto = hostCrypto()\n\n // oxlint-disable-next-line anti-slop/no-runtime-typeof -- host feature detection must verify the callable Web Crypto method.\n if (crypto === undefined || typeof crypto.randomUUID !== 'function') {\n throw new IdGeneratorUnavailableError()\n }\n\n return crypto.randomUUID()\n }\n}\n\n/** The default host IdGenerator provider. */\nexport const IdGeneratorLive = Layer.make(IdGenerator)\n\ntype IdFactory = (index: number) => string\n\n// oxlint-disable-next-line anti-slop/no-unknown-parameters -- runtime validation protects the public string-ID boundary.\nconst validateId = (value: unknown, source: string): string => {\n // oxlint-disable-next-line anti-slop/no-runtime-typeof -- runtime validation rejects unsafe test doubles.\n if (typeof value !== 'string') {\n throw new TypeError(`${source} must return a string ID`)\n }\n\n return value\n}\n\n/** Deterministic queue- or factory-backed IdGenerator implementation for tests. */\nexport class IdGeneratorTest implements Service.Contract<IdGenerator> {\n private readonly queue: string[]\n\n private factory: IdFactory | undefined\n\n private generatedCount = 0\n\n constructor(ids: readonly string[] = []) {\n this.queue = ids.map((id) => validateId(id, 'IdGeneratorTest queue values'))\n }\n\n /** Number of IDs successfully returned by this test generator. */\n get generated(): number {\n return this.generatedCount\n }\n\n /** Number of queued IDs still available, or Infinity for a factory. */\n get remaining(): number {\n return this.factory === undefined ? this.queue.length : Infinity\n }\n\n /** Return the next queued or factory-generated string ID. */\n next(): string {\n if (this.factory === undefined) {\n const value = this.queue.shift()\n\n if (value === undefined) {\n throw new IdGeneratorExhaustedError(this.generatedCount)\n }\n\n this.generatedCount += 1\n return value\n }\n\n const value = validateId(this.factory(this.generatedCount), 'IdGeneratorTest factory')\n this.generatedCount += 1\n return value\n }\n\n /**\n * Create a factory-backed generator. The factory receives a monotonic\n * zero-based index: the first call receives 0, then 1, and so on.\n */\n static from(factory: IdFactory): IdGeneratorTest {\n // oxlint-disable-next-line anti-slop/no-runtime-typeof -- runtime validation rejects an invalid factory at the API boundary.\n if (typeof factory !== 'function') {\n throw new TypeError('IdGeneratorTest.from requires a factory function')\n }\n\n const generator = new IdGeneratorTest()\n generator.factory = factory\n return generator\n }\n\n /** Create a Layer for this generator, allocating a fresh empty queue by default. */\n static layer(generator: IdGeneratorTest = new IdGeneratorTest()) {\n return Layer.succeed(IdGenerator, generator)\n }\n}\n\n/** Compatible functional shorthand for {@link IdGeneratorTest.layer}. */\nexport const IdGeneratorTestLayer = (generator?: IdGeneratorTest) =>\n IdGeneratorTest.layer(generator)\n","import { CurrentAbortSignal } from '../runtime'\nimport { Layer } from '../layer'\nimport { Service } from '../service'\n\nexport { CurrentAbortSignal }\nexport { CurrentRequest, CurrentRequestLayer } from './current-request'\n\nexport { Config, ConfigLive, ConfigSourceError, ConfigValidationError } from './config'\n\nexport type {\n ConfigError,\n ConfigFromEnvOptions,\n ConfigInput,\n ConfigIssue,\n ConfigKey,\n ConfigOutput,\n ConfigSource,\n ConfigSourceOptions,\n ConfigValue,\n StandardSchemaV1\n} from './config'\n\nexport {\n IdGenerator,\n IdGeneratorExhaustedError,\n IdGeneratorLive,\n IdGeneratorTest,\n IdGeneratorTestLayer,\n IdGeneratorUnavailableError\n} from './id-generator'\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\nconst abortError = (): DOMException => new DOMException('The operation was aborted', 'AbortError')\n\nconst abortReason = (signal: AbortSignal): AbortSignal['reason'] =>\n signal.reason === undefined ? abortError() : signal.reason\n\n/** Optional cooperative cancellation for a host or test Clock sleep. */\nexport type ClockSleepOptions = {\n readonly signal?: AbortSignal\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 /** Rejects with the signal reason, or an AbortError-compatible fallback. */\n sleep(milliseconds: number, options?: ClockSleepOptions): Promise<void> {\n assertDelay(milliseconds)\n const signal = options?.signal\n\n if (signal?.aborted) {\n return Promise.reject(abortReason(signal))\n }\n\n return new Promise<void>((resolve, reject) => {\n let timer: ReturnType<typeof setTimeout> | undefined\n let settled = false\n\n function cleanup(): void {\n if (timer !== undefined) {\n clearTimeout(timer)\n timer = undefined\n }\n\n signal?.removeEventListener('abort', onAbort)\n }\n\n function settle(callback: () => void): void {\n if (settled) {\n return\n }\n\n settled = true\n cleanup()\n callback()\n }\n\n function onAbort(): void {\n if (signal !== undefined) {\n settle(() => reject(abortReason(signal)))\n }\n }\n\n try {\n signal?.addEventListener('abort', onAbort, { once: true })\n\n if (signal?.aborted) {\n onAbort()\n return\n }\n\n const handle = setTimeout(() => settle(resolve), milliseconds)\n\n if (settled) {\n clearTimeout(handle)\n } else {\n timer = handle\n }\n } catch (cause) {\n settle(() => reject(cause))\n }\n })\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 readonly reject: (cause?: unknown) => void\n readonly signal: AbortSignal | undefined\n readonly onAbort: () => void\n settled: boolean\n}\n\n/** Limits deadline advances performed by `ClockTest.runAll`. */\nexport type ClockTestRunAllOptions = {\n readonly maxSteps?: number\n}\n\nconst defaultClockTestMaxSteps = 1_000\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 /** Number of sleeps that have not been settled or cancelled. */\n get pendingSleeps(): number {\n return this.waiters.length\n }\n\n now(): Date {\n return new Date(this.currentTime)\n }\n\n /** Set an absolute time; moving backward leaves existing absolute deadlines unchanged. */\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, options?: ClockSleepOptions): Promise<void> {\n assertDelay(milliseconds)\n const signal = options?.signal\n\n if (signal?.aborted) {\n return Promise.reject(abortReason(signal))\n }\n\n return new Promise<void>((resolve, reject) => {\n let waiter!: ClockWaiter\n const onAbort = (): void => {\n if (signal !== undefined) {\n this.cancelWaiter(waiter, abortReason(signal))\n }\n }\n\n waiter = {\n at: this.currentTime + milliseconds,\n resolve,\n reject,\n signal,\n onAbort,\n settled: false\n }\n this.enqueueWaiter(waiter)\n\n try {\n signal?.addEventListener('abort', onAbort, { once: true })\n\n if (signal?.aborted) {\n this.cancelWaiter(waiter, abortReason(signal))\n return\n }\n } catch (cause) {\n this.cancelWaiter(waiter, cause)\n return\n }\n\n this.flushWaiters()\n })\n }\n\n /** Advance synchronously; due Promise continuations run after this method returns. */\n advanceToNext(): boolean {\n const next = this.waiters[0]\n\n if (next === undefined) {\n return false\n }\n\n this.currentTime = next.at\n this.flushWaiters()\n return true\n }\n\n /** Advance all pending deadlines, guarding at 1,000 steps by default. */\n async runAll(options?: ClockTestRunAllOptions): Promise<number> {\n const maxSteps = getMaxSteps(options)\n let steps = 0\n\n while (this.pendingSleeps > 0) {\n if (steps >= maxSteps) {\n throw new RangeError(`ClockTest.runAll exceeded maxSteps (${maxSteps})`)\n }\n\n this.advanceToNext()\n steps += 1\n await Promise.resolve()\n }\n\n return steps\n }\n\n static layer(initial: Date | number = 0) {\n return Layer.succeed(Clock, new ClockTest(initial))\n }\n\n private enqueueWaiter(waiter: ClockWaiter): void {\n const index = this.waiters.findIndex((pending) => pending.at > waiter.at)\n\n if (index === -1) {\n this.waiters.push(waiter)\n } else {\n this.waiters.splice(index, 0, waiter)\n }\n }\n\n private cancelWaiter(waiter: ClockWaiter, cause: unknown): void {\n const index = this.waiters.indexOf(waiter)\n\n if (index !== -1) {\n this.waiters.splice(index, 1)\n }\n\n this.finishWaiter(waiter, () => waiter.reject(cause))\n }\n\n private flushWaiters(): void {\n while (true) {\n const waiter = this.waiters[0]\n\n if (waiter === undefined || waiter.at > this.currentTime) {\n return\n }\n\n this.waiters.shift()\n this.finishWaiter(waiter, waiter.resolve)\n }\n }\n\n private finishWaiter(waiter: ClockWaiter, finish: () => void): void {\n if (waiter.settled) {\n return\n }\n\n waiter.settled = true\n waiter.signal?.removeEventListener('abort', waiter.onAbort)\n finish()\n }\n}\n\nconst getMaxSteps = (options?: ClockTestRunAllOptions): number => {\n const maxSteps = options?.maxSteps ?? defaultClockTestMaxSteps\n\n if (!Number.isInteger(maxSteps) || maxSteps < 0) {\n throw new RangeError('ClockTest.runAll maxSteps must be a finite non-negative integer')\n }\n\n return maxSteps\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"],"mappings":";;;;;AAgDA,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,aAA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ACxD;CAEA,OAAO,MAAM,SAAqB,IAAI,WAAW,GAAG;EAClD,OAAO,MAAM,QAAQ,QAAQ,MAAM;CACrC;AACF;AAEA,MAAa,wBAAwB,WAAW,MAAM"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { t as CurrentAbortSignal } from "./index-ClNndn2-.mjs";
|
|
2
|
+
import { n as CurrentRequestLayer, t as CurrentRequest } from "./current-request-Dm-QQ3Xr.mjs";
|
|
3
|
+
import { A as ConfigLive, C as IdGeneratorUnavailableError, D as ConfigInput, E as ConfigFromEnvOptions, F as ConfigValidationError, I as ConfigValue, L as StandardSchemaV1, M as ConfigSource, N as ConfigSourceError, O as ConfigIssue, P as ConfigSourceOptions, S as IdGeneratorTestLayer, T as ConfigError, _ as RandomSeededLayer, a as ClockTestLayer, b as IdGeneratorLive, c as LoggerData, d as LoggerLive, f as LoggerTest, g as RandomSeeded, h as RandomLive, i as ClockTest, j as ConfigOutput, k as ConfigKey, l as LoggerEvent, m as Random, n as ClockLive, o as ClockTestRunAllOptions, p as LoggerTestLayer, r as ClockSleepOptions, s as Logger, t as Clock, u as LoggerLevel, v as IdGenerator, w as Config, x as IdGeneratorTest, y as IdGeneratorExhaustedError } from "./index-C2ed9Ilq.mjs";
|
|
4
|
+
export { Clock, ClockLive, ClockSleepOptions, ClockTest, ClockTestLayer, ClockTestRunAllOptions, Config, type ConfigError, type ConfigFromEnvOptions, type ConfigInput, type ConfigIssue, type ConfigKey, ConfigLive, type ConfigOutput, type ConfigSource, ConfigSourceError, type ConfigSourceOptions, ConfigValidationError, type ConfigValue, CurrentAbortSignal, CurrentRequest, CurrentRequestLayer, IdGenerator, IdGeneratorExhaustedError, IdGeneratorLive, IdGeneratorTest, IdGeneratorTestLayer, IdGeneratorUnavailableError, Logger, LoggerData, LoggerEvent, LoggerLevel, LoggerLive, LoggerTest, LoggerTestLayer, Random, RandomLive, RandomSeeded, RandomSeededLayer, type StandardSchemaV1 };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import { t as CurrentAbortSignal } from "./signal-
|
|
2
|
-
import {
|
|
1
|
+
import { t as CurrentAbortSignal } from "./signal-5Rg9bUUe.mjs";
|
|
2
|
+
import { n as CurrentRequestLayer, t as CurrentRequest } from "./current-request-Bc1YHL0w.mjs";
|
|
3
|
+
import { S as ConfigValidationError, _ as IdGeneratorTestLayer, a as Logger, b as ConfigLive, c as LoggerTestLayer, d as RandomSeeded, f as RandomSeededLayer, g as IdGeneratorTest, h as IdGeneratorLive, i as ClockTestLayer, l as Random, m as IdGeneratorExhaustedError, n as ClockLive, o as LoggerLive, p as IdGenerator, r as ClockTest, s as LoggerTest, t as Clock, u as RandomLive, v as IdGeneratorUnavailableError, x as ConfigSourceError, y as Config } from "./standard-services-B-iMM_W7.mjs";
|
|
3
4
|
export { Clock, ClockLive, ClockTest, ClockTestLayer, Config, ConfigLive, ConfigSourceError, ConfigValidationError, CurrentAbortSignal, CurrentRequest, CurrentRequestLayer, IdGenerator, IdGeneratorExhaustedError, IdGeneratorLive, IdGeneratorTest, IdGeneratorTestLayer, IdGeneratorUnavailableError, Logger, LoggerLive, LoggerTest, LoggerTestLayer, Random, RandomLive, RandomSeeded, RandomSeededLayer };
|
package/dist/testing.d.mts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { C as IdGeneratorTest, i as ClockTest, m as LoggerTest, v as RandomSeeded } from "./index-B1nH4luq.mjs";
|
|
1
|
+
import { A as RuntimeServiceAcquireEvent, C as RuntimeExecutionStartEvent, D as RuntimeLifecycleStartEvent, E as RuntimeLifecycleReleaseEvent, I as RuntimeTaskStartEvent, Lt as AnyService, O as RuntimeObserver, P as RuntimeTaskEndEvent, Q as CompleteExecutionLayer, V as LayerBackend, Z as CompleteExecution, _ as RuntimeRunOptions, at as OverrideLayerResult, ct as ValidateLayerInput, dt as ValidateOverridesWitness, g as RuntimeOptions, h as RuntimeDisposeOptions, j as RuntimeServiceResolveEvent, k as RuntimeResourceReleaseEvent, l as RuntimeContextStorage, nt as LayerInputState, ot as ProvidedEnvironment, pt as MissingDependencies, st as RequiredEnvironment, tt as LayerInput, ut as ValidateOverrides, w as RuntimeLifecycleEndEvent, x as RuntimeExecutionEndEvent } from "./layer-C2OaqTmB.mjs";
|
|
2
|
+
import { t as MapLayerBackend } from "./index-Cy1VsU-u.mjs";
|
|
3
|
+
import { n as Runtime } from "./index-ClNndn2-.mjs";
|
|
4
|
+
import { f as LoggerTest, g as RandomSeeded, i as ClockTest, x as IdGeneratorTest } from "./index-C2ed9Ilq.mjs";
|
|
6
5
|
//#region src/testing/contracts.d.ts
|
|
7
6
|
/** One runner-neutral conformance scenario. */
|
|
8
7
|
interface ContractScenario {
|
|
@@ -61,14 +60,19 @@ declare const runtimeContextStorageContract: (options: RuntimeContextStorageCont
|
|
|
61
60
|
//#endregion
|
|
62
61
|
//#region src/testing/recorded-runtime-observer.d.ts
|
|
63
62
|
/** Every event emitted by a Runtime observer hook. */
|
|
64
|
-
type RuntimeObserverEvent = RuntimeServiceResolveEvent | RuntimeServiceAcquireEvent | RuntimeExecutionStartEvent | RuntimeExecutionEndEvent | RuntimeResourceReleaseEvent;
|
|
63
|
+
type RuntimeObserverEvent = RuntimeServiceResolveEvent | RuntimeServiceAcquireEvent | RuntimeExecutionStartEvent | RuntimeExecutionEndEvent | RuntimeTaskStartEvent | RuntimeTaskEndEvent | RuntimeResourceReleaseEvent | RuntimeLifecycleStartEvent | RuntimeLifecycleEndEvent | RuntimeLifecycleReleaseEvent;
|
|
65
64
|
/** Immutable views of events recorded by a {@link RecordedRuntimeObserver}. */
|
|
66
65
|
type RecordedRuntimeObserverSnapshot = {
|
|
67
66
|
readonly serviceResolutions: readonly RuntimeServiceResolveEvent[];
|
|
68
67
|
readonly serviceAcquisitions: readonly RuntimeServiceAcquireEvent[];
|
|
69
68
|
readonly executionStarts: readonly RuntimeExecutionStartEvent[];
|
|
70
69
|
readonly executionEnds: readonly RuntimeExecutionEndEvent[];
|
|
70
|
+
readonly taskStarts: readonly RuntimeTaskStartEvent[];
|
|
71
|
+
readonly taskEnds: readonly RuntimeTaskEndEvent[];
|
|
71
72
|
readonly resourceReleases: readonly RuntimeResourceReleaseEvent[];
|
|
73
|
+
readonly lifecycleStarts: readonly RuntimeLifecycleStartEvent[];
|
|
74
|
+
readonly lifecycleEnds: readonly RuntimeLifecycleEndEvent[];
|
|
75
|
+
readonly lifecycleReleases: readonly RuntimeLifecycleReleaseEvent[];
|
|
72
76
|
readonly timeline: readonly RuntimeObserverEvent[];
|
|
73
77
|
};
|
|
74
78
|
/** Records Runtime lifecycle events for assertions in tests. */
|
|
@@ -77,19 +81,34 @@ declare class RecordedRuntimeObserver implements RuntimeObserver {
|
|
|
77
81
|
private readonly serviceAcquisitionEvents;
|
|
78
82
|
private readonly executionStartEvents;
|
|
79
83
|
private readonly executionEndEvents;
|
|
84
|
+
private readonly taskStartEvents;
|
|
85
|
+
private readonly taskEndEvents;
|
|
80
86
|
private readonly resourceReleaseEvents;
|
|
87
|
+
private readonly lifecycleStartEvents;
|
|
88
|
+
private readonly lifecycleEndEvents;
|
|
89
|
+
private readonly lifecycleReleaseEvents;
|
|
81
90
|
private readonly timelineEvents;
|
|
82
91
|
static make(): RecordedRuntimeObserver;
|
|
83
92
|
readonly onServiceResolve: (event: RuntimeServiceResolveEvent) => void;
|
|
84
93
|
readonly onServiceAcquire: (event: RuntimeServiceAcquireEvent) => void;
|
|
85
94
|
readonly onExecutionStart: (event: RuntimeExecutionStartEvent) => void;
|
|
86
95
|
readonly onExecutionEnd: (event: RuntimeExecutionEndEvent) => void;
|
|
96
|
+
readonly onTaskStart: (event: RuntimeTaskStartEvent) => void;
|
|
97
|
+
readonly onTaskEnd: (event: RuntimeTaskEndEvent) => void;
|
|
87
98
|
readonly onResourceRelease: (event: RuntimeResourceReleaseEvent) => void;
|
|
99
|
+
readonly onLifecycleStart: (event: RuntimeLifecycleStartEvent) => void;
|
|
100
|
+
readonly onLifecycleEnd: (event: RuntimeLifecycleEndEvent) => void;
|
|
101
|
+
readonly onLifecycleRelease: (event: RuntimeLifecycleReleaseEvent) => void;
|
|
88
102
|
get serviceResolutions(): readonly RuntimeServiceResolveEvent[];
|
|
89
103
|
get serviceAcquisitions(): readonly RuntimeServiceAcquireEvent[];
|
|
90
104
|
get executionStarts(): readonly RuntimeExecutionStartEvent[];
|
|
91
105
|
get executionEnds(): readonly RuntimeExecutionEndEvent[];
|
|
106
|
+
get taskStarts(): readonly RuntimeTaskStartEvent[];
|
|
107
|
+
get taskEnds(): readonly RuntimeTaskEndEvent[];
|
|
92
108
|
get resourceReleases(): readonly RuntimeResourceReleaseEvent[];
|
|
109
|
+
get lifecycleStarts(): readonly RuntimeLifecycleStartEvent[];
|
|
110
|
+
get lifecycleEnds(): readonly RuntimeLifecycleEndEvent[];
|
|
111
|
+
get lifecycleReleases(): readonly RuntimeLifecycleReleaseEvent[];
|
|
93
112
|
get timeline(): readonly RuntimeObserverEvent[];
|
|
94
113
|
clear(): void;
|
|
95
114
|
snapshot(): RecordedRuntimeObserverSnapshot;
|
package/dist/testing.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.d.mts","names":[],"sources":["../src/testing/contracts.ts","../src/testing/recorded-runtime-observer.ts","../src/testing/runtime-graph-observer.ts","../src/testing/test-runtime.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"testing.d.mts","names":[],"sources":["../src/testing/contracts.ts","../src/testing/recorded-runtime-observer.ts","../src/testing/runtime-graph-observer.ts","../src/testing/test-runtime.ts"],"mappings":";;;;;;UAyBiB;;WAEN;;WAGA,WAAW;;;cAIT,yBAAyB;WAEzB;EADX,YACW,kBACT,gBACA;;;KASQ;;UAGK;;WAEN,mBAAmB,eAAe,YAAY;;WAG9C,oBAAoB;;WAGpB,WAAW,SA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,UAAU,oBACT,QAAQ,QAAQ;;EAKnB,QAAQ,UAAU,wBAAwB;;GAKzC,OAAO,iBAAiB;UAIjB;UAIA;UA4BA;UAQA;;SAcD,IAAI,GAAG,UAAU,YACtB,OAAO,IAAI,mBAAmB,IAC9B,KAAK,aAAa,oBAAoB,IAAI,KACzC,QAAQ,QAAQ;SAEZ,IAAI,GAAG,UAAU,kBAAkB,gBAAgB,yBACxD,OAAO,IAAI,mBAAmB,KAAK,mBAAmB,iBAAiB,GAAG,QAAQ,YAClF,SAAS,UAAU,6BAA6B,GAAG,UACnD,KAAK,aAAa,oBAAoB,iBAAiB,GAAG,WAAW,GAAG,WACvE,QAAQ,QAAQ;;;kBA8II;;OAEX,QACV,aAAa,aAAa,YAC1B,2BAA2B,8BACzB,mBAAmB,MAAM;;OAGjB,aAAa;;OAGb,iBAAiB"}
|
package/dist/testing.mjs
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { i as LayerDisposeError, r as DuplicateServiceError, s as ServiceTagCollisionError, u as ServiceNotFoundError } from "./registration-
|
|
2
|
-
import { g as RuntimeContextOverlapError, h as RuntimeContextNotConfiguredError } from "./context-
|
|
1
|
+
import { i as LayerDisposeError, r as DuplicateServiceError, s as ServiceTagCollisionError, u as ServiceNotFoundError } from "./registration-Bwe2GbVu.mjs";
|
|
2
|
+
import { g as RuntimeContextOverlapError, h as RuntimeContextNotConfiguredError } from "./context-DSGSqcJj.mjs";
|
|
3
3
|
import { t as isPromiseLike } from "./runtime-CDcCF5cb.mjs";
|
|
4
|
-
import { o as ScopeCloseError, s as ScopeClosedError } from "./
|
|
5
|
-
import {
|
|
6
|
-
import { i as Scope,
|
|
7
|
-
import {
|
|
8
|
-
import { d as Random, h as IdGenerator, l as LoggerTest, p as RandomSeeded, r as ClockTest, s as Logger, t as Clock, v as IdGeneratorTest } from "./standard-services-GBZ32tll.mjs";
|
|
4
|
+
import { l as ServiceRuntime, o as ScopeCloseError, s as ScopeClosedError, t as Layer } from "./layer-2kjHVv4N.mjs";
|
|
5
|
+
import { t as Service } from "./service-CO9VJQYa.mjs";
|
|
6
|
+
import { a as RuntimeObserver, c as MapLayerBackend, i as classifyRuntimeOutcome, l as Scope, t as Runtime, u as ScopeRuntime } from "./runtime-qpcVwaz_.mjs";
|
|
7
|
+
import { a as Logger, d as RandomSeeded, g as IdGeneratorTest, l as Random, p as IdGenerator, r as ClockTest, s as LoggerTest, t as Clock } from "./standard-services-B-iMM_W7.mjs";
|
|
9
8
|
//#region src/testing/contracts.ts
|
|
10
9
|
/** Thrown by a conformance scenario when an adapter violates its contract. */
|
|
11
10
|
var ConformanceError = class extends Error {
|
|
@@ -748,7 +747,12 @@ var RecordedRuntimeObserver = class RecordedRuntimeObserver {
|
|
|
748
747
|
serviceAcquisitionEvents = [];
|
|
749
748
|
executionStartEvents = [];
|
|
750
749
|
executionEndEvents = [];
|
|
750
|
+
taskStartEvents = [];
|
|
751
|
+
taskEndEvents = [];
|
|
751
752
|
resourceReleaseEvents = [];
|
|
753
|
+
lifecycleStartEvents = [];
|
|
754
|
+
lifecycleEndEvents = [];
|
|
755
|
+
lifecycleReleaseEvents = [];
|
|
752
756
|
timelineEvents = [];
|
|
753
757
|
static make() {
|
|
754
758
|
return new RecordedRuntimeObserver();
|
|
@@ -765,9 +769,24 @@ var RecordedRuntimeObserver = class RecordedRuntimeObserver {
|
|
|
765
769
|
onExecutionEnd = (event) => {
|
|
766
770
|
this.record(this.executionEndEvents, event);
|
|
767
771
|
};
|
|
772
|
+
onTaskStart = (event) => {
|
|
773
|
+
this.record(this.taskStartEvents, event);
|
|
774
|
+
};
|
|
775
|
+
onTaskEnd = (event) => {
|
|
776
|
+
this.record(this.taskEndEvents, event);
|
|
777
|
+
};
|
|
768
778
|
onResourceRelease = (event) => {
|
|
769
779
|
this.record(this.resourceReleaseEvents, event);
|
|
770
780
|
};
|
|
781
|
+
onLifecycleStart = (event) => {
|
|
782
|
+
this.record(this.lifecycleStartEvents, event);
|
|
783
|
+
};
|
|
784
|
+
onLifecycleEnd = (event) => {
|
|
785
|
+
this.record(this.lifecycleEndEvents, event);
|
|
786
|
+
};
|
|
787
|
+
onLifecycleRelease = (event) => {
|
|
788
|
+
this.record(this.lifecycleReleaseEvents, event);
|
|
789
|
+
};
|
|
771
790
|
get serviceResolutions() {
|
|
772
791
|
return immutableView(this.serviceResolutionEvents);
|
|
773
792
|
}
|
|
@@ -780,9 +799,24 @@ var RecordedRuntimeObserver = class RecordedRuntimeObserver {
|
|
|
780
799
|
get executionEnds() {
|
|
781
800
|
return immutableView(this.executionEndEvents);
|
|
782
801
|
}
|
|
802
|
+
get taskStarts() {
|
|
803
|
+
return immutableView(this.taskStartEvents);
|
|
804
|
+
}
|
|
805
|
+
get taskEnds() {
|
|
806
|
+
return immutableView(this.taskEndEvents);
|
|
807
|
+
}
|
|
783
808
|
get resourceReleases() {
|
|
784
809
|
return immutableView(this.resourceReleaseEvents);
|
|
785
810
|
}
|
|
811
|
+
get lifecycleStarts() {
|
|
812
|
+
return immutableView(this.lifecycleStartEvents);
|
|
813
|
+
}
|
|
814
|
+
get lifecycleEnds() {
|
|
815
|
+
return immutableView(this.lifecycleEndEvents);
|
|
816
|
+
}
|
|
817
|
+
get lifecycleReleases() {
|
|
818
|
+
return immutableView(this.lifecycleReleaseEvents);
|
|
819
|
+
}
|
|
786
820
|
get timeline() {
|
|
787
821
|
return immutableView(this.timelineEvents);
|
|
788
822
|
}
|
|
@@ -791,7 +825,12 @@ var RecordedRuntimeObserver = class RecordedRuntimeObserver {
|
|
|
791
825
|
this.serviceAcquisitionEvents.length = 0;
|
|
792
826
|
this.executionStartEvents.length = 0;
|
|
793
827
|
this.executionEndEvents.length = 0;
|
|
828
|
+
this.taskStartEvents.length = 0;
|
|
829
|
+
this.taskEndEvents.length = 0;
|
|
794
830
|
this.resourceReleaseEvents.length = 0;
|
|
831
|
+
this.lifecycleStartEvents.length = 0;
|
|
832
|
+
this.lifecycleEndEvents.length = 0;
|
|
833
|
+
this.lifecycleReleaseEvents.length = 0;
|
|
795
834
|
this.timelineEvents.length = 0;
|
|
796
835
|
}
|
|
797
836
|
snapshot() {
|
|
@@ -800,7 +839,12 @@ var RecordedRuntimeObserver = class RecordedRuntimeObserver {
|
|
|
800
839
|
serviceAcquisitions: this.serviceAcquisitions,
|
|
801
840
|
executionStarts: this.executionStarts,
|
|
802
841
|
executionEnds: this.executionEnds,
|
|
842
|
+
taskStarts: this.taskStarts,
|
|
843
|
+
taskEnds: this.taskEnds,
|
|
803
844
|
resourceReleases: this.resourceReleases,
|
|
845
|
+
lifecycleStarts: this.lifecycleStarts,
|
|
846
|
+
lifecycleEnds: this.lifecycleEnds,
|
|
847
|
+
lifecycleReleases: this.lifecycleReleases,
|
|
804
848
|
timeline: this.timeline
|
|
805
849
|
});
|
|
806
850
|
}
|