@securitydept/client 0.3.0-beta.9 → 0.3.1
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/dist/{create-i5VyYgN6.mjs → create-BBdGfVCt.mjs} +2 -2
- package/dist/{create-i5VyYgN6.mjs.map → create-BBdGfVCt.mjs.map} +1 -1
- package/dist/{handle-DwMgqe7R.mjs → handle-DCHUG9HI.mjs} +3 -3
- package/dist/{handle-DwMgqe7R.mjs.map → handle-DCHUG9HI.mjs.map} +1 -1
- package/dist/{index-CbeZ3AfB.d.mts → index-1mOA_4l_.d.mts} +2 -2
- package/dist/{index-CFAJ969E.d.mts → index-_1lhMnf9.d.mts} +29 -8
- package/dist/{index-Bo1BtjZH.d.mts → index-kvxJ3X0n.d.mts} +3 -3
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +3 -3
- package/dist/{router-at5bTdJQ.mjs → router-BawAJQ1s.mjs} +3 -3
- package/dist/{router-at5bTdJQ.mjs.map → router-BawAJQ1s.mjs.map} +1 -1
- package/dist/rx/index.d.mts +1 -1
- package/dist/rx/index.mjs +1 -1
- package/dist/{rx-DM6Ouv-m.mjs → rx-82t7QNQL.mjs} +209 -28
- package/dist/rx-82t7QNQL.mjs.map +1 -0
- package/dist/server/index.d.mts +1 -1
- package/dist/server/index.mjs +1 -1
- package/dist/test/index.d.mts +2 -2
- package/dist/test/index.mjs +2 -2
- package/dist/web/index.d.mts +3 -3
- package/dist/web/index.mjs +4 -4
- package/dist/webext/index.d.mts +2 -2
- package/dist/webext/index.mjs +3 -3
- package/package.json +1 -1
- package/dist/rx-DM6Ouv-m.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rx-82t7QNQL.mjs","names":["BehaviorSubject"],"sources":["../src/errors/types.ts","../src/errors/client-error.ts","../src/compat/disposable.ts","../src/compat/observable.ts","../src/rx/event.ts","../src/rx/internal/reactive-system/base.ts","../src/rx/signal.ts","../src/rx/command.ts","../src/rx/environment.ts","../src/cancellation/create.ts","../src/signals/error.ts","../src/signals/types.ts","../src/signals/resource-snapshot.ts","../src/rx/resource.ts"],"sourcesContent":["// --- Error model ---\n// Dual-layer: machine-facing runtime error + user-facing presentation / recovery hint.\n\nimport { type SpanNodeAttributes } from \"../span/types\";\n\nexport type ClientErrorSpanContext = readonly SpanNodeAttributes[];\n\n/** Recovery actions the user might take. Aligned with server-side `UserRecovery`. */\nexport const UserRecovery = {\n\tNone: \"none\",\n\tRetry: \"retry\",\n\tRestartFlow: \"restart_flow\",\n\tReauthenticate: \"reauthenticate\",\n\tContactSupport: \"contact_support\",\n} as const;\n\nexport type UserRecovery = (typeof UserRecovery)[keyof typeof UserRecovery];\n\n/** Safe user-facing presentation supplied by a server error response. */\nexport interface ServerErrorPresentation {\n\tcode: string;\n\tmessage: string;\n\trecovery: UserRecovery;\n}\n\nexport const ErrorPresentationTone = {\n\tNeutral: \"neutral\",\n\tWarning: \"warning\",\n\tDanger: \"danger\",\n} as const;\n\nexport type ErrorPresentationTone =\n\t(typeof ErrorPresentationTone)[keyof typeof ErrorPresentationTone];\n\nexport interface ErrorRecoveryActionDescriptor {\n\trecovery: UserRecovery;\n\tlabel: string;\n\thref: string | null;\n}\n\nexport interface ErrorPresentationDescriptor {\n\tcode: string | null;\n\ttitle: string;\n\tdescription: string;\n\trecovery: UserRecovery;\n\ttone: ErrorPresentationTone;\n\tprimaryAction: ErrorRecoveryActionDescriptor | null;\n}\n\nexport interface ReadErrorPresentationDescriptorOptions {\n\tfallbackTitle?: string;\n\tfallbackDescription?: string;\n\tcodePresentations?: Readonly<Record<string, ErrorCodePresentation>>;\n\trecoveryLinks?: Partial<Record<UserRecovery, string>>;\n\trecoveryLabels?: Partial<Record<UserRecovery, string>>;\n\tcontextFormatter?: ClientErrorContextFormatter | null;\n}\n\nexport type ClientErrorContextFormatter = (\n\tcontext: ClientErrorSpanContext,\n) => string | undefined;\n\nexport interface ErrorCodePresentation {\n\ttitle: string;\n\tdescription: string;\n\ttone?: ErrorPresentationTone;\n\trecovery?: UserRecovery;\n}\n\n/** Machine-facing error kind discriminator. */\nexport const ClientErrorKind = {\n\tAuthorization: \"authorization\",\n\tTransport: \"transport\",\n\tServer: \"server\",\n\tProtocol: \"protocol\",\n\tStorage: \"storage\",\n\tConfiguration: \"configuration\",\n\tUnauthenticated: \"unauthenticated\",\n\tUnauthorized: \"unauthorized\",\n\tCancelled: \"cancelled\",\n\tTimeout: \"timeout\",\n\tInternal: \"internal\",\n} as const;\n\nexport type ClientErrorKind =\n\t(typeof ClientErrorKind)[keyof typeof ClientErrorKind];\n\n/** Stable source vocabulary for common client error producers. */\nexport const ClientErrorSource = {\n\tTransport: \"transport\",\n\tServer: \"server\",\n\tClient: \"client\",\n} as const;\n\nexport type ClientErrorSource =\n\t(typeof ClientErrorSource)[keyof typeof ClientErrorSource];\n","import { type SpanTrait } from \"../span/types\";\nimport {\n\tClientErrorKind,\n\tClientErrorSource,\n\ttype ClientErrorSpanContext,\n\ttype ServerErrorPresentation,\n\tUserRecovery,\n\ttype UserRecovery as UserRecoveryType,\n} from \"./types\";\n\nexport const CLIENT_ERROR_SPAN_ATTRIBUTE_PROVIDER_ID =\n\t\"@securitydept/client/error\";\n\ntype ServerErrorBody = {\n\tkind?: string;\n\tcode?: string;\n\tmessage?: string;\n\trecovery?: string;\n\tpresentation?: {\n\t\tcode?: string;\n\t\tmessage?: string;\n\t\trecovery?: string;\n\t};\n};\n\nexport interface ClientErrorFromUnknownOptions {\n\tmessage: string;\n\tcode: string;\n\tsource: string;\n\tspan?: SpanTrait;\n}\n\nexport interface ClientErrorFromHttpResponseOptions {\n\tstatus: number;\n\tbody?: unknown;\n\tsource?: string;\n\tspan?: SpanTrait;\n}\n\nconst userRecoveryValues = new Set<string>(Object.values(UserRecovery));\n\nfunction readUserRecovery(value: unknown): UserRecoveryType | undefined {\n\treturn typeof value === \"string\" && userRecoveryValues.has(value)\n\t\t? (value as UserRecoveryType)\n\t\t: undefined;\n}\n\nfunction mapServerErrorKind(\n\tkind: string | undefined,\n\tstatus: number,\n): ClientErrorKind {\n\tswitch (kind) {\n\t\tcase \"unauthenticated\":\n\t\t\treturn ClientErrorKind.Unauthenticated;\n\t\tcase \"unauthorized\":\n\t\t\treturn ClientErrorKind.Unauthorized;\n\t\tcase \"unavailable\":\n\t\tcase \"internal\":\n\t\t\treturn ClientErrorKind.Server;\n\t\tcase \"invalid_request\":\n\t\tcase \"conflict\":\n\t\t\treturn ClientErrorKind.Protocol;\n\t\tdefault:\n\t\t\treturn status === 401\n\t\t\t\t? ClientErrorKind.Unauthenticated\n\t\t\t\t: status === 403\n\t\t\t\t\t? ClientErrorKind.Unauthorized\n\t\t\t\t\t: status === 408\n\t\t\t\t\t\t? ClientErrorKind.Timeout\n\t\t\t\t\t\t: status >= 500\n\t\t\t\t\t\t\t? ClientErrorKind.Server\n\t\t\t\t\t\t\t: ClientErrorKind.Protocol;\n\t}\n}\n\nfunction readServerErrorBody(body: unknown): ServerErrorBody | undefined {\n\tif (!body || typeof body !== \"object\") {\n\t\treturn undefined;\n\t}\n\tconst record = body as Record<string, unknown>;\n\tconst error =\n\t\trecord.error && typeof record.error === \"object\"\n\t\t\t? (record.error as Record<string, unknown>)\n\t\t\t: record;\n\n\treturn {\n\t\tkind: typeof error.kind === \"string\" ? error.kind : undefined,\n\t\tcode: typeof error.code === \"string\" ? error.code : undefined,\n\t\tmessage: typeof error.message === \"string\" ? error.message : undefined,\n\t\trecovery: typeof error.recovery === \"string\" ? error.recovery : undefined,\n\t\tpresentation:\n\t\t\terror.presentation && typeof error.presentation === \"object\"\n\t\t\t\t? {\n\t\t\t\t\t\tcode:\n\t\t\t\t\t\t\ttypeof (error.presentation as Record<string, unknown>).code ===\n\t\t\t\t\t\t\t\"string\"\n\t\t\t\t\t\t\t\t? ((error.presentation as Record<string, unknown>)\n\t\t\t\t\t\t\t\t\t\t.code as string)\n\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\ttypeof (error.presentation as Record<string, unknown>).message ===\n\t\t\t\t\t\t\t\"string\"\n\t\t\t\t\t\t\t\t? ((error.presentation as Record<string, unknown>)\n\t\t\t\t\t\t\t\t\t\t.message as string)\n\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\trecovery:\n\t\t\t\t\t\t\ttypeof (error.presentation as Record<string, unknown>)\n\t\t\t\t\t\t\t\t.recovery === \"string\"\n\t\t\t\t\t\t\t\t? ((error.presentation as Record<string, unknown>)\n\t\t\t\t\t\t\t\t\t\t.recovery as string)\n\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t}\n\t\t\t\t: undefined,\n\t};\n}\n\n/**\n * Base client error carrying both machine-facing context and an optional\n * user-facing presentation layer.\n *\n * Top-level `code` and `recovery` provide stable machine contracts for\n * policy decisions without requiring callers to unwrap `presentation`.\n */\nexport class ClientError extends Error {\n\tprivate _spanContext: ClientErrorSpanContext | undefined;\n\n\treadonly kind: ClientErrorKind;\n\n\t/**\n\t * Stable machine-readable error code.\n\t * Matches `presentation.code` when present, otherwise a default\n\t * derived from `kind`.\n\t */\n\treadonly code: string;\n\n\t/** Recovery hint at the machine level. */\n\treadonly recovery: UserRecoveryType;\n\n\t/** Whether this error is safe to retry. */\n\treadonly retryable: boolean;\n\n\t/** Structured user-facing error presentation from the server. */\n\treadonly presentation?: ServerErrorPresentation;\n\n\t/** Source subsystem or component that produced the error. */\n\treadonly source?: string;\n\n\tget spanContext(): ClientErrorSpanContext | undefined {\n\t\treturn this._spanContext;\n\t}\n\n\tconstructor(options: {\n\t\tkind: ClientErrorKind;\n\t\tmessage: string;\n\t\tcode?: string;\n\t\trecovery?: UserRecoveryType;\n\t\tretryable?: boolean;\n\t\tpresentation?: ServerErrorPresentation;\n\t\tsource?: string;\n\t\tcause?: unknown;\n\t\tspan?: SpanTrait;\n\t}) {\n\t\tsuper(options.message, { cause: options.cause });\n\t\tthis.name = \"ClientError\";\n\t\tthis.kind = options.kind;\n\t\tthis.code =\n\t\t\toptions.code ?? options.presentation?.code ?? `client.${options.kind}`;\n\t\tthis.recovery =\n\t\t\toptions.recovery ?? options.presentation?.recovery ?? UserRecovery.None;\n\t\tthis.retryable = options.retryable ?? this.recovery === UserRecovery.Retry;\n\t\tthis.presentation = options.presentation;\n\t\tthis.source = options.source;\n\t\tif (options.span) {\n\t\t\tthis.captureSpanContext(options.span);\n\t\t}\n\t}\n\n\tcaptureSpanContext(span: SpanTrait): this {\n\t\tthis._spanContext ??= span.getRootToNodeAttributes({\n\t\t\tproviderId: CLIENT_ERROR_SPAN_ATTRIBUTE_PROVIDER_ID,\n\t\t});\n\t\treturn this;\n\t}\n\n\t/** Create a `ClientError` from a server error response body. */\n\tstatic fromServerError(\n\t\tbody: {\n\t\t\tkind?: string;\n\t\t\tcode?: string;\n\t\t\tmessage?: string;\n\t\t\trecovery?: string;\n\t\t\tpresentation?: {\n\t\t\t\tcode?: string;\n\t\t\t\tmessage?: string;\n\t\t\t\trecovery?: string;\n\t\t\t};\n\t\t},\n\t\toverrides?: {\n\t\t\tkind?: ClientErrorKind;\n\t\t\tsource?: string;\n\t\t\tspan?: SpanTrait;\n\t\t},\n\t): ClientError {\n\t\tconst rawPresentation = body.presentation;\n\t\tconst recovery =\n\t\t\treadUserRecovery(body.recovery) ??\n\t\t\treadUserRecovery(rawPresentation?.recovery) ??\n\t\t\tUserRecovery.None;\n\t\tconst presentation: ServerErrorPresentation | undefined =\n\t\t\trawPresentation?.code && rawPresentation.message\n\t\t\t\t? {\n\t\t\t\t\t\tcode: rawPresentation.code,\n\t\t\t\t\t\tmessage: rawPresentation.message,\n\t\t\t\t\t\trecovery: readUserRecovery(rawPresentation.recovery) ?? recovery,\n\t\t\t\t\t}\n\t\t\t\t: undefined;\n\n\t\treturn new ClientError({\n\t\t\tkind: overrides?.kind ?? mapServerErrorKind(body.kind, 400),\n\t\t\tmessage: body.message ?? presentation?.message ?? \"Unknown server error\",\n\t\t\tcode: body.code ?? presentation?.code,\n\t\t\trecovery,\n\t\t\tretryable: recovery === UserRecovery.Retry,\n\t\t\tpresentation,\n\t\t\tsource: overrides?.source,\n\t\t\tspan: overrides?.span,\n\t\t});\n\t}\n\n\tstatic fromUnknown(\n\t\terror: unknown,\n\t\toptions: ClientErrorFromUnknownOptions,\n\t): ClientError {\n\t\tif (error instanceof ClientError) {\n\t\t\treturn options.span ? error.captureSpanContext(options.span) : error;\n\t\t}\n\n\t\treturn new ClientError({\n\t\t\tkind: ClientErrorKind.Internal,\n\t\t\tmessage: options.message,\n\t\t\tcode: options.code,\n\t\t\tsource: options.source,\n\t\t\tcause: error,\n\t\t\tspan: options.span,\n\t\t});\n\t}\n\n\t/**\n\t * Create a `ClientError` from an HTTP response status and optional body.\n\t * Used when a non-success status is unexpected.\n\t */\n\tstatic fromHttpResponse(\n\t\toptions: ClientErrorFromHttpResponseOptions,\n\t): ClientError {\n\t\tconst { status, body } = options;\n\t\tconst serverBody = readServerErrorBody(body);\n\n\t\t// Derive kind and source from HTTP status first — these apply\n\t\t// whether or not the response carries a structured error body.\n\t\tconst kind = mapServerErrorKind(serverBody?.kind, status);\n\n\t\tconst source = options.source ?? ClientErrorSource.Server;\n\t\tconst fallbackRecovery: UserRecoveryType =\n\t\t\tkind === ClientErrorKind.Unauthenticated\n\t\t\t\t? UserRecovery.Reauthenticate\n\t\t\t\t: status === 408 || status >= 500\n\t\t\t\t\t? UserRecovery.Retry\n\t\t\t\t\t: UserRecovery.None;\n\n\t\t// If the server returned a structured error body, preserve it\n\t\t// but keep the status-derived kind/source.\n\t\tif (serverBody?.code && serverBody?.message) {\n\t\t\tconst recovery =\n\t\t\t\treadUserRecovery(serverBody.presentation?.recovery) ??\n\t\t\t\treadUserRecovery(serverBody.recovery) ??\n\t\t\t\tfallbackRecovery;\n\t\t\treturn ClientError.fromServerError(\n\t\t\t\t{\n\t\t\t\t\t...serverBody,\n\t\t\t\t\trecovery,\n\t\t\t\t\tpresentation: serverBody.presentation\n\t\t\t\t\t\t? { ...serverBody.presentation, recovery }\n\t\t\t\t\t\t: undefined,\n\t\t\t\t},\n\t\t\t\t{ kind, source, span: options.span },\n\t\t\t);\n\t\t}\n\n\t\treturn new ClientError({\n\t\t\tkind,\n\t\t\tmessage: serverBody?.message ?? `HTTP ${status}`,\n\t\t\tcode: serverBody?.code ?? `http.${status}`,\n\t\t\trecovery: fallbackRecovery,\n\t\t\tretryable: status === 408 || status >= 500,\n\t\t\tsource,\n\t\t\tspan: options.span,\n\t\t});\n\t}\n}\n","export const SYMBOL_DISPOSE: typeof Symbol.dispose =\n\ttypeof Symbol !== \"undefined\" && Symbol.dispose\n\t\t? Symbol.dispose\n\t\t: (\"@@dispose\" as unknown as typeof Symbol.dispose);\n\nexport interface DisposableTrait {\n\tdispose(): void;\n\t[SYMBOL_DISPOSE](): void;\n}\n\nexport const SYMBOL_ASYNC_DISPOSE: typeof Symbol.asyncDispose =\n\ttypeof Symbol !== \"undefined\" && Symbol.asyncDispose\n\t\t? Symbol.asyncDispose\n\t\t: (\"@@asyncDispose\" as unknown as typeof Symbol.asyncDispose);\n\nexport interface AsyncDisposableTrait {\n\tdispose(): Promise<void>;\n\t[SYMBOL_ASYNC_DISPOSE](): Promise<void>;\n}\n\nexport interface DisposableStackTrait extends DisposableTrait {\n\treadonly disposed: boolean;\n\tuse<T extends DisposableTrait>(disposable: T): T;\n\tdispose(): void;\n\t[SYMBOL_DISPOSE](): void;\n}\n\nexport const SYMBOL_DISPOSABLE_STACK = \"@@disposableStack\";\n\nexport function injectDisposableStackFrom(\n\targ: unknown,\n\tisOptions = false,\n): DisposableStackTrait | undefined {\n\treturn (\n\t\tisOptions && typeof arg === \"object\" && arg !== null\n\t\t\t? (arg as Record<PropertyKey, unknown>)[SYMBOL_DISPOSABLE_STACK]\n\t\t\t: arg\n\t) as DisposableStackTrait | undefined;\n}\n\nexport class SimpleDisposableStack implements DisposableStackTrait {\n\tprivate readonly stack: DisposableTrait[] = [];\n\tdisposed = false;\n\n\tuse<T extends DisposableTrait>(disposable: T): T {\n\t\tif (this.disposed) {\n\t\t\tthrow new ReferenceError(\"Disposable stack is already disposed\");\n\t\t}\n\t\tthis.stack.push(disposable);\n\t\treturn disposable;\n\t}\n\n\tdispose(): void {\n\t\tif (this.disposed) {\n\t\t\treturn;\n\t\t}\n\t\tthis.disposed = true;\n\t\tconst errors: unknown[] = [];\n\t\tfor (\n\t\t\tlet disposable = this.stack.pop();\n\t\t\tdisposable;\n\t\t\tdisposable = this.stack.pop()\n\t\t) {\n\t\t\ttry {\n\t\t\t\tdisposable.dispose();\n\t\t\t} catch (error) {\n\t\t\t\terrors.push(error);\n\t\t\t}\n\t\t}\n\t\tif (errors.length === 1) {\n\t\t\tthrow errors[0];\n\t\t}\n\t\tif (errors.length > 1) {\n\t\t\tthrow new AggregateError(errors, \"Failed to dispose disposable stack\");\n\t\t}\n\t}\n\n\t[SYMBOL_DISPOSE](): void {\n\t\tthis.dispose();\n\t}\n}\n\ninterface NativeDisposableStackLike {\n\treadonly disposed: boolean;\n\tuse<T extends DisposableTrait>(disposable: T): T;\n\tdispose(): void;\n}\n\ntype NativeDisposableStackConstructor = new () => NativeDisposableStackLike;\n\nexport class StdDisposableStack implements DisposableStackTrait {\n\tprivate readonly stack: NativeDisposableStackLike;\n\n\tconstructor(\n\t\tStack: NativeDisposableStackConstructor = (\n\t\t\tglobalThis as typeof globalThis & {\n\t\t\t\tDisposableStack: NativeDisposableStackConstructor;\n\t\t\t}\n\t\t).DisposableStack,\n\t) {\n\t\tthis.stack = new Stack();\n\t}\n\n\tget disposed(): boolean {\n\t\treturn this.stack.disposed;\n\t}\n\n\tuse<T extends DisposableTrait>(disposable: T): T {\n\t\treturn this.stack.use(disposable);\n\t}\n\n\tdispose(): void {\n\t\tthis.stack.dispose();\n\t}\n\n\t[SYMBOL_DISPOSE](): void {\n\t\tthis.dispose();\n\t}\n}\n\nexport function createDisposableStack(): DisposableStackTrait {\n\tconst Stack = (\n\t\tglobalThis as typeof globalThis & {\n\t\t\tDisposableStack?: NativeDisposableStackConstructor;\n\t\t}\n\t).DisposableStack;\n\treturn typeof Stack === \"function\"\n\t\t? new StdDisposableStack(Stack)\n\t\t: new SimpleDisposableStack();\n}\n\nexport function withDisposableStack(index: number, isOptions = false) {\n\treturn <TThis, TArgs extends unknown[], TReturn>(\n\t\ttarget: (this: TThis, ...args: TArgs) => TReturn,\n\t\t_context: ClassMethodDecoratorContext<\n\t\t\tTThis,\n\t\t\t(this: TThis, ...args: TArgs) => TReturn\n\t\t>,\n\t) =>\n\t\tfunction (this: TThis, ...args: TArgs): TReturn {\n\t\t\tconst disposableStack = createDisposableStack();\n\t\t\tconst injectedArgs = [...args] as unknown[];\n\t\t\tif (isOptions) {\n\t\t\t\tconst value = injectedArgs[index];\n\t\t\t\tinjectedArgs[index] = Object.assign(\n\t\t\t\t\t{},\n\t\t\t\t\ttypeof value === \"object\" && value !== null ? value : undefined,\n\t\t\t\t\t{ [SYMBOL_DISPOSABLE_STACK]: disposableStack },\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tinjectedArgs[index] = disposableStack;\n\t\t\t}\n\n\t\t\tlet result: TReturn;\n\t\t\ttry {\n\t\t\t\tresult = target.call(this, ...(injectedArgs as TArgs));\n\t\t\t} catch (error) {\n\t\t\t\tdisposableStack.dispose();\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\ttypeof result === \"object\" &&\n\t\t\t\tresult !== null &&\n\t\t\t\t\"then\" in result &&\n\t\t\t\ttypeof result.then === \"function\"\n\t\t\t) {\n\t\t\t\treturn Promise.resolve(result).finally(() => {\n\t\t\t\t\tdisposableStack.dispose();\n\t\t\t\t}) as TReturn;\n\t\t\t}\n\n\t\t\tdisposableStack.dispose();\n\t\t\treturn result;\n\t\t};\n}\n","export const SYMBOL_OBSERVABLE: typeof Symbol.observable =\n\ttypeof Symbol !== \"undefined\" && Symbol.observable\n\t\t? Symbol.observable\n\t\t: (\"@@observable\" as unknown as typeof Symbol.observable);\n\n/** Subscription handle with explicit unsubscribe. */\nexport interface SubscriptionTrait {\n\tunsubscribe(): void;\n}\n\n/** Observer for event streams — mirrors the Observable observer pattern. */\nexport interface ObserverTrait<T> {\n\tnext(value: T): void;\n\terror(error: unknown): void;\n\tcomplete(): void;\n}\n\nexport interface SubscribableTrait<T> {\n\tsubscribe(observer: Partial<ObserverTrait<T>>): SubscriptionTrait;\n}\n\nexport interface InteropObservableTrait<T> {\n\t[SYMBOL_OBSERVABLE](): SubscribableTrait<T>;\n}\n\nexport type WithInteropObservableTraitCompat<\n\tO extends InteropObservableTrait<unknown>,\n\tT extends O extends InteropObservableTrait<infer U> ? U : never,\n> = O & InteropObservableTrait<T>;\n\nexport function isInteropObservableTrait<T>(\n\tvalue: unknown,\n): value is InteropObservableTrait<T> {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\tSYMBOL_OBSERVABLE in value &&\n\t\ttypeof value[SYMBOL_OBSERVABLE] === \"function\"\n\t);\n}\n","import {\n\tfrom,\n\tObservable,\n\ttype ObservableInput,\n\ttype OperatorFunction,\n\tReplaySubject,\n\tSubject,\n} from \"rxjs\";\nimport {\n\ttype InteropObservableTrait,\n\tisInteropObservableTrait,\n\ttype SubscribableTrait,\n\tSYMBOL_OBSERVABLE,\n} from \"../compat\";\nimport {\n\ttype EventObserverTrait,\n\ttype EventStreamTrait,\n\ttype EventSubjectTrait,\n} from \"../events/types\";\n\nexport type RxEventStreamProducer<T> = (\n\tobserver: EventObserverTrait<T>,\n) => (() => void) | void;\n\nexport type RxEventStreamInput<T> =\n\t| ObservableInput<T>\n\t| InteropObservableTrait<T>\n\t| SubscribableTrait<T>;\n\nexport class RxEventStream<T>\n\textends Observable<T>\n\timplements EventStreamTrait<T>, InteropObservableTrait<T>\n{\n\tconstructor(source: RxEventStreamInput<T> | RxEventStreamProducer<T>) {\n\t\tsuper((subscriber) => {\n\t\t\tif (typeof source === \"function\") {\n\t\t\t\treturn source(subscriber);\n\t\t\t}\n\t\t\tif (isInteropObservableTrait<T>(source)) {\n\t\t\t\tconst subscription = source[SYMBOL_OBSERVABLE]().subscribe(subscriber);\n\t\t\t\treturn () => {\n\t\t\t\t\tsubscription.unsubscribe();\n\t\t\t\t};\n\t\t\t}\n\t\t\tif (\n\t\t\t\ttypeof source === \"object\" &&\n\t\t\t\tsource !== null &&\n\t\t\t\t\"subscribe\" in source &&\n\t\t\t\ttypeof source.subscribe === \"function\"\n\t\t\t) {\n\t\t\t\tconst subscription = source.subscribe(subscriber);\n\t\t\t\treturn () => {\n\t\t\t\t\tsubscription.unsubscribe();\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst subscription = from(source as ObservableInput<T>).subscribe(\n\t\t\t\tsubscriber,\n\t\t\t);\n\t\t\treturn () => {\n\t\t\t\tsubscription.unsubscribe();\n\t\t\t};\n\t\t});\n\t}\n\n\t[SYMBOL_OBSERVABLE](): RxEventStream<T> {\n\t\treturn this;\n\t}\n\n\tstatic fromObservableInput<T>(\n\t\tinput: RxEventStreamInput<T>,\n\t): RxEventStream<T> {\n\t\tif (input instanceof RxEventStream) {\n\t\t\treturn input;\n\t\t}\n\t\treturn new RxEventStream(input);\n\t}\n\n\t// @ts-expect-error RxJS pipe overloads are intentionally narrowed to RxEventStream.\n\toverride pipe(): RxEventStream<T>;\n\toverride pipe<A>(op1: OperatorFunction<T, A>): RxEventStream<A>;\n\toverride pipe<A, B>(\n\t\top1: OperatorFunction<T, A>,\n\t\top2: OperatorFunction<A, B>,\n\t): RxEventStream<B>;\n\toverride pipe<A, B, C>(\n\t\top1: OperatorFunction<T, A>,\n\t\top2: OperatorFunction<A, B>,\n\t\top3: OperatorFunction<B, C>,\n\t): RxEventStream<C>;\n\toverride pipe<A, B, C, D>(\n\t\top1: OperatorFunction<T, A>,\n\t\top2: OperatorFunction<A, B>,\n\t\top3: OperatorFunction<B, C>,\n\t\top4: OperatorFunction<C, D>,\n\t): RxEventStream<D>;\n\toverride pipe<A, B, C, D, E>(\n\t\top1: OperatorFunction<T, A>,\n\t\top2: OperatorFunction<A, B>,\n\t\top3: OperatorFunction<B, C>,\n\t\top4: OperatorFunction<C, D>,\n\t\top5: OperatorFunction<D, E>,\n\t): RxEventStream<E>;\n\toverride pipe<A, B, C, D, E, F>(\n\t\top1: OperatorFunction<T, A>,\n\t\top2: OperatorFunction<A, B>,\n\t\top3: OperatorFunction<B, C>,\n\t\top4: OperatorFunction<C, D>,\n\t\top5: OperatorFunction<D, E>,\n\t\top6: OperatorFunction<E, F>,\n\t): RxEventStream<F>;\n\toverride pipe<A, B, C, D, E, F, G>(\n\t\top1: OperatorFunction<T, A>,\n\t\top2: OperatorFunction<A, B>,\n\t\top3: OperatorFunction<B, C>,\n\t\top4: OperatorFunction<C, D>,\n\t\top5: OperatorFunction<D, E>,\n\t\top6: OperatorFunction<E, F>,\n\t\top7: OperatorFunction<F, G>,\n\t): RxEventStream<G>;\n\toverride pipe<A, B, C, D, E, F, G, H>(\n\t\top1: OperatorFunction<T, A>,\n\t\top2: OperatorFunction<A, B>,\n\t\top3: OperatorFunction<B, C>,\n\t\top4: OperatorFunction<C, D>,\n\t\top5: OperatorFunction<D, E>,\n\t\top6: OperatorFunction<E, F>,\n\t\top7: OperatorFunction<F, G>,\n\t\top8: OperatorFunction<G, H>,\n\t): RxEventStream<H>;\n\toverride pipe<A, B, C, D, E, F, G, H, I>(\n\t\top1: OperatorFunction<T, A>,\n\t\top2: OperatorFunction<A, B>,\n\t\top3: OperatorFunction<B, C>,\n\t\top4: OperatorFunction<C, D>,\n\t\top5: OperatorFunction<D, E>,\n\t\top6: OperatorFunction<E, F>,\n\t\top7: OperatorFunction<F, G>,\n\t\top8: OperatorFunction<G, H>,\n\t\top9: OperatorFunction<H, I>,\n\t): RxEventStream<I>;\n\toverride pipe<A, B, C, D, E, F, G, H, I>(\n\t\top1: OperatorFunction<T, A>,\n\t\top2: OperatorFunction<A, B>,\n\t\top3: OperatorFunction<B, C>,\n\t\top4: OperatorFunction<C, D>,\n\t\top5: OperatorFunction<D, E>,\n\t\top6: OperatorFunction<E, F>,\n\t\top7: OperatorFunction<F, G>,\n\t\top8: OperatorFunction<G, H>,\n\t\top9: OperatorFunction<H, I>,\n\t\t...operations: OperatorFunction<any, any>[]\n\t): RxEventStream<unknown>;\n\toverride pipe(\n\t\t...args: Parameters<Observable<T>[\"pipe\"]>\n\t): RxEventStream<unknown> {\n\t\tconst piped = super.pipe(...args);\n\t\treturn RxEventStream.fromObservableInput(piped);\n\t}\n}\n\nexport class RxEventSubject<T>\n\textends Subject<T>\n\timplements EventSubjectTrait<T>\n{\n\t[SYMBOL_OBSERVABLE](): RxEventStream<T> {\n\t\treturn this.asObservable();\n\t}\n\n\toverride asObservable(): RxEventStream<T> {\n\t\treturn RxEventStream.fromObservableInput(super.asObservable());\n\t}\n}\n\nexport class RxEventReplaySubject<T>\n\textends ReplaySubject<T>\n\timplements EventSubjectTrait<T>\n{\n\t[SYMBOL_OBSERVABLE](): RxEventStream<T> {\n\t\treturn this.asObservable();\n\t}\n\n\toverride asObservable(): RxEventStream<T> {\n\t\treturn RxEventStream.fromObservableInput(super.asObservable());\n\t}\n}\n","import {\n\tanimationFrameScheduler,\n\tasapScheduler,\n\taudit,\n\tauditTime,\n\tfromEventPattern,\n\ttype MonoTypeOperatorFunction,\n\tmap,\n\ttype Observable,\n\ttype Observer,\n\tshareReplay,\n} from \"rxjs\";\nimport {\n\ttype InteropObservableTrait,\n\tSYMBOL_OBSERVABLE,\n} from \"../../../compat\";\nimport {\n\ttype ReadableSignalTrait,\n\ttype SignalOptions,\n} from \"../../../signals/types\";\nimport { RxEventStream } from \"../../event\";\n\nexport interface RxSignalDirtyEvent<T> {\n\tepoch: number;\n\tsignal: ReadableSignalTrait<T>;\n}\n\nexport type RxSignalDirtyObserver<T> = Pick<\n\tObserver<RxSignalDirtyEvent<T>>,\n\t\"next\" | \"error\"\n>;\n\nexport type RxSignalOptions<T> = SignalOptions<T>;\n\nexport type RxSignalWatchScheduler<THandle = unknown> = (\n\tflush: () => void,\n) => THandle;\n\nexport type RxSignalWatchCanceller<THandle = unknown> = (\n\thandle: THandle,\n) => void;\n\nexport interface RxSignalWatchOptions {\n\tschedule: RxSignalWatchScheduler;\n\tcancel?: RxSignalWatchCanceller;\n}\n\nfunction watchOptionsToAuditOperator<T>(\n\toptions: RxSignalWatchOptions,\n): MonoTypeOperatorFunction<T> {\n\tif (options.schedule === globalThis.queueMicrotask) {\n\t\treturn auditTime(0, asapScheduler);\n\t}\n\tif (\n\t\toptions.schedule === globalThis.requestAnimationFrame &&\n\t\toptions.cancel === globalThis.cancelAnimationFrame\n\t) {\n\t\treturn auditTime(0, animationFrameScheduler);\n\t}\n\treturn audit(() =>\n\t\tfromEventPattern<void>(\n\t\t\t(handler) => options.schedule(() => handler()),\n\t\t\t(_handler, handle) => {\n\t\t\t\tif (options.cancel) {\n\t\t\t\t\toptions.cancel(handle);\n\t\t\t\t} else if (typeof handle === \"function\") {\n\t\t\t\t\thandle();\n\t\t\t\t}\n\t\t\t},\n\t\t),\n\t);\n}\n\nexport abstract class RxSignal<T>\n\timplements ReadableSignalTrait<T>, InteropObservableTrait<T>\n{\n\tprotected static globalEpoch = 0;\n\tprotected static currentContext: {\n\t\tmarkDependency(signal: RxSignal<any>): void;\n\t} | null = null;\n\tprivate static dirtyFrame:\n\t\t| { epoch: number; notified?: Set<RxSignal<any>> }\n\t\t| undefined;\n\n\tprotected valueEqVersion = 0;\n\n\treadonly equals: (a: unknown, b: unknown) => boolean;\n\tabstract get(): T;\n\tabstract dirtyObservable(): Observable<RxSignalDirtyEvent<T>>;\n\n\tprotected constructor(options: RxSignalOptions<T> | undefined) {\n\t\tthis.equals = (options?.equals ?? Object.is) as (\n\t\t\tleft: unknown,\n\t\t\tright: unknown,\n\t\t) => boolean;\n\t}\n\n\twatchStream(\n\t\toptions: RxSignalWatchOptions = { schedule: globalThis.queueMicrotask },\n\t): RxEventStream<void> {\n\t\treturn RxEventStream.fromObservableInput(\n\t\t\tthis.dirtyObservable().pipe(\n\t\t\t\twatchOptionsToAuditOperator(options),\n\t\t\t\tmap(() => undefined),\n\t\t\t\tshareReplay({ bufferSize: 1, refCount: true }),\n\t\t\t),\n\t\t);\n\t}\n\n\t[SYMBOL_OBSERVABLE](): RxEventStream<T> {\n\t\treturn new RxEventStream((observer) => {\n\t\t\t// Establish listening before replay so a replay callback can write again.\n\t\t\tthis.get();\n\t\t\tconst subscription = this.dirtyObservable().subscribe({\n\t\t\t\tnext: () => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tobserver.next(this.get());\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tobserver.error(error);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\terror: (error) => observer.error(error),\n\t\t\t\tcomplete: () => observer.complete(),\n\t\t\t});\n\t\t\ttry {\n\t\t\t\tobserver.next(this.get());\n\t\t\t} catch (error) {\n\t\t\t\tsubscription.unsubscribe();\n\t\t\t\tobserver.error(error);\n\t\t\t}\n\t\t\treturn () => subscription.unsubscribe();\n\t\t});\n\t}\n\n\tprotected static dispatchDirty(epoch: number, publish: () => void): void {\n\t\tconst previous = RxSignal.dirtyFrame;\n\t\tRxSignal.dirtyFrame = { epoch };\n\t\ttry {\n\t\t\tpublish();\n\t\t} finally {\n\t\t\tRxSignal.dirtyFrame = previous;\n\t\t}\n\t}\n\n\tprotected acceptDirtyEpoch(epoch: number): boolean {\n\t\tconst frame = RxSignal.dirtyFrame;\n\t\tif (!frame || frame.epoch !== epoch) {\n\t\t\treturn true;\n\t\t}\n\t\tframe.notified ??= new Set();\n\t\tif (frame.notified.has(this)) {\n\t\t\treturn false;\n\t\t}\n\t\tframe.notified.add(this);\n\t\treturn true;\n\t}\n\n\t// Native SDK nodes override this; external RxSignal subclasses retain their observable protocol.\n\tprotected listenDirty(listener: RxSignalDirtyObserver<T>): () => void {\n\t\tconst subscription = this.dirtyObservable().subscribe(listener);\n\t\treturn () => subscription.unsubscribe();\n\t}\n\n\tprotected static listenToDirty<T>(\n\t\tsignal: RxSignal<T>,\n\t\tlistener: RxSignalDirtyObserver<T>,\n\t\tnative: boolean,\n\t): () => void {\n\t\tif (native) {\n\t\t\treturn signal.listenDirty(listener);\n\t\t}\n\t\tconst subscription = signal.dirtyObservable().subscribe(listener);\n\t\treturn () => subscription.unsubscribe();\n\t}\n\n\tabstract validateForEpoch(epoch: number): void;\n}\n","import { BehaviorSubject, Observable, UnsubscriptionError } from \"rxjs\";\nimport {\n\ttype InteropObservableTrait,\n\tSYMBOL_OBSERVABLE,\n\ttype WithInteropObservableTraitCompat,\n} from \"../compat\";\nimport { type WritableSignalTrait } from \"../signals/types\";\nimport { RxEventStream } from \"./event\";\nimport {\n\tRxSignal,\n\ttype RxSignalDirtyEvent,\n\ttype RxSignalDirtyObserver,\n\ttype RxSignalOptions,\n} from \"./internal/reactive-system/base\";\n\nexport {\n\tRxSignal,\n\ttype RxSignalDirtyEvent,\n\ttype RxSignalOptions,\n\ttype RxSignalWatchCanceller,\n\ttype RxSignalWatchOptions,\n\ttype RxSignalWatchScheduler,\n} from \"./internal/reactive-system/base\";\nexport class RxStateSignal<T>\n\textends RxSignal<T>\n\timplements InteropObservableTrait<T>, WritableSignalTrait<T>\n{\n\tprotected dirtyListeners: Set<RxSignalDirtyObserver<T>> | undefined;\n\tprivate dirtySnapshot: RxSignalDirtyObserver<T>[] | undefined;\n\tprivate dirty$: Observable<RxSignalDirtyEvent<T>> | undefined;\n\tprotected value: T;\n\tprivate valueSubject: BehaviorSubject<T> | undefined;\n\n\tprotected constructor(\n\t\tinitialValue: T,\n\t\toptions: RxSignalOptions<T> | undefined,\n\t) {\n\t\tsuper(options);\n\t\tthis.value = initialValue;\n\t}\n\n\tset(input: T): void {\n\t\tconst changed = !this.equals(this.value, input);\n\t\tthis.value = input;\n\t\tif (changed) {\n\t\t\tthis.valueEqVersion += 1;\n\t\t}\n\t\tRxSignal.globalEpoch += 1;\n\t\tconst epoch = RxSignal.globalEpoch;\n\t\t// Commit versions before synchronous observers can read cached computed values.\n\t\tthis.valueSubject?.next(input);\n\t\tconst listeners = this.dirtyListeners;\n\t\tif (listeners?.size) {\n\t\t\tlet snapshot = this.dirtySnapshot;\n\t\t\tif (!snapshot) {\n\t\t\t\tsnapshot = [...listeners];\n\t\t\t\tthis.dirtySnapshot = snapshot;\n\t\t\t}\n\t\t\tRxSignal.dispatchDirty(epoch, () => {\n\t\t\t\tconst event = { epoch, signal: this };\n\t\t\t\tfor (const listener of snapshot) {\n\t\t\t\t\tlistener.next(event);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\tstatic fromInitialValue<T>(\n\t\tinitialValue: T,\n\t\toptions?: RxSignalOptions<T>,\n\t): RxStateSignalCompat<T> {\n\t\treturn new RxStateSignal<T>(initialValue, options);\n\t}\n\n\tget(): T {\n\t\tconst value = this.value;\n\t\tRxSignal.currentContext?.markDependency(this);\n\t\treturn value;\n\t}\n\n\toverride validateForEpoch(): void {}\n\n\toverride dirtyObservable(): Observable<RxSignalDirtyEvent<T>> {\n\t\tthis.dirty$ ??= new Observable((observer) =>\n\t\t\tthis.listenDirty({\n\t\t\t\tnext: (event) => observer.next(event),\n\t\t\t\terror: (error) => observer.error(error),\n\t\t\t}),\n\t\t);\n\t\treturn this.dirty$;\n\t}\n\n\tprotected override listenDirty(\n\t\tlistener: RxSignalDirtyObserver<T>,\n\t): () => void {\n\t\tthis.dirtyListeners ??= new Set();\n\t\tthis.dirtySnapshot = undefined;\n\t\tthis.dirtyListeners.add(listener);\n\t\treturn () => {\n\t\t\tthis.dirtySnapshot = undefined;\n\t\t\tthis.dirtyListeners?.delete(listener);\n\t\t};\n\t}\n\n\toverride [SYMBOL_OBSERVABLE](): RxEventStream<T> {\n\t\treturn new RxEventStream((observer) => {\n\t\t\tthis.valueSubject ??= new BehaviorSubject(this.value);\n\t\t\tconst subject = this.valueSubject;\n\t\t\tconst subscription = subject.subscribe(observer);\n\t\t\treturn () => {\n\t\t\t\tsubscription.unsubscribe();\n\t\t\t\tif (!subject.observed && this.valueSubject === subject) {\n\t\t\t\t\tthis.valueSubject = undefined;\n\t\t\t\t}\n\t\t\t};\n\t\t});\n\t}\n}\n\nexport type RxStateSignalCompat<T> = WithInteropObservableTraitCompat<\n\tRxStateSignal<T>,\n\tT\n>;\n\ntype AnyRxSignal = RxSignal<any> & { valueEqVersion: number };\n\ntype ComputedCacheState<T> =\n\t| { kind: \"empty\" }\n\t| { kind: \"value\"; value: T }\n\t| { kind: \"error\"; error: unknown };\n\nfunction haveSameSourceKeys(\n\tleft: ReadonlyMap<AnyRxSignal, number>,\n\tright: ReadonlyMap<AnyRxSignal, number>,\n): boolean {\n\tif (left.size !== right.size) {\n\t\treturn false;\n\t}\n\tconst leftSources = left.keys();\n\tconst rightSources = right.keys();\n\twhile (true) {\n\t\tconst leftSource = leftSources.next();\n\t\tconst rightSource = rightSources.next();\n\t\tif (leftSource.done || rightSource.done) {\n\t\t\treturn leftSource.done === rightSource.done;\n\t\t}\n\t\tif (leftSource.value !== rightSource.value) {\n\t\t\treturn false;\n\t\t}\n\t}\n}\n\nexport class RxComputedSignal<T> extends RxSignal<T> {\n\tprotected cacheState: ComputedCacheState<T> = { kind: \"empty\" };\n\tprotected sources: ReadonlyMap<AnyRxSignal, number> = new Map();\n\tprivate dirtyListeners: Set<RxSignalDirtyObserver<T>> | undefined;\n\tprivate dirtySnapshot: RxSignalDirtyObserver<T>[] | undefined;\n\tprivate dirtyStops: Map<AnyRxSignal, () => void> | undefined;\n\tprivate dirtyConnection = 0;\n\tprivate validatedEpoch = -1;\n\tprivate isComputing = false;\n\tprivate collectingSources: Map<AnyRxSignal, number> | null = null;\n\tprivate dirty$: Observable<RxSignalDirtyEvent<T>> | undefined;\n\n\tprotected constructor(\n\t\tprotected readonly computeFn: () => T,\n\t\toptions: RxSignalOptions<T> | undefined,\n\t) {\n\t\tsuper(options);\n\t}\n\n\tmarkDependency(signal: RxSignal<any>): void {\n\t\tconst source = signal as AnyRxSignal;\n\t\tthis.collectingSources?.set(source, source.valueEqVersion);\n\t}\n\n\tprotected cacheStatesEqual(\n\t\tleft: ComputedCacheState<T>,\n\t\tright: ComputedCacheState<T>,\n\t): boolean {\n\t\tif (left.kind !== right.kind) {\n\t\t\treturn false;\n\t\t}\n\t\tif (left.kind === \"empty\" || right.kind === \"empty\") {\n\t\t\treturn false;\n\t\t}\n\t\tif (left.kind === \"value\" && right.kind === \"value\") {\n\t\t\treturn this.equals(left.value, right.value);\n\t\t}\n\t\tif (left.kind === \"error\" && right.kind === \"error\") {\n\t\t\treturn Object.is(left.error, right.error);\n\t\t}\n\t\treturn false;\n\t}\n\n\tprotected recompute(): void {\n\t\tif (this.isComputing) {\n\t\t\tthrow new Error(\"Circular computed dependency detected\");\n\t\t}\n\t\tconst prevContext = RxSignal.currentContext;\n\t\tconst prevCollectingSources = this.collectingSources;\n\t\tconst nextSources = new Map<AnyRxSignal, number>();\n\t\tRxSignal.currentContext = this;\n\t\tthis.collectingSources = nextSources;\n\t\tthis.isComputing = true;\n\t\tlet nextCacheState: ComputedCacheState<T>;\n\t\ttry {\n\t\t\tconst computed = this.computeFn();\n\t\t\tnextCacheState = { kind: \"value\", value: computed };\n\t\t} catch (error) {\n\t\t\tnextCacheState = { kind: \"error\", error };\n\t\t} finally {\n\t\t\tthis.collectingSources = prevCollectingSources;\n\t\t\tRxSignal.currentContext = prevContext;\n\t\t\tthis.isComputing = false;\n\t\t}\n\t\tconst previousSources = this.sources;\n\t\t// Key changes only matter to the optional observable dependency graph.\n\t\tconst sourcesChanged = this.dirtyListeners?.size\n\t\t\t? !haveSameSourceKeys(previousSources, nextSources)\n\t\t\t: undefined;\n\t\tlet cacheStateChanged: boolean;\n\t\ttry {\n\t\t\tcacheStateChanged = !this.cacheStatesEqual(\n\t\t\t\tthis.cacheState,\n\t\t\t\tnextCacheState,\n\t\t\t);\n\t\t} catch (error) {\n\t\t\tnextCacheState = { kind: \"error\", error };\n\t\t\tcacheStateChanged = !this.cacheStatesEqual(\n\t\t\t\tthis.cacheState,\n\t\t\t\tnextCacheState,\n\t\t\t);\n\t\t}\n\t\tif (cacheStateChanged) {\n\t\t\tthis.valueEqVersion += 1;\n\t\t}\n\t\tthis.cacheState = nextCacheState;\n\t\tthis.sources = nextSources;\n\t\t// A custom equality function can attach an observer during comparison.\n\t\tif (\n\t\t\tthis.dirtyListeners?.size &&\n\t\t\t(sourcesChanged ?? !haveSameSourceKeys(previousSources, nextSources))\n\t\t) {\n\t\t\ttry {\n\t\t\t\tthis.syncDirtySources(nextSources);\n\t\t\t} catch (error) {\n\t\t\t\tthis.failDirtySources(error);\n\t\t\t}\n\t\t}\n\t\tif (nextCacheState.kind === \"error\") {\n\t\t\tthrow nextCacheState.error;\n\t\t}\n\t}\n\n\toverride validateForEpoch(epoch: number): void {\n\t\tif (this.validatedEpoch === epoch) {\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\tif (this.cacheState.kind === \"empty\") {\n\t\t\t\tthis.recompute();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tfor (const [source, version] of this.sources) {\n\t\t\t\ttry {\n\t\t\t\t\tsource.validateForEpoch(epoch);\n\t\t\t\t} catch {\n\t\t\t\t\tthis.recompute();\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (source.valueEqVersion !== version) {\n\t\t\t\t\tthis.recompute();\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t} finally {\n\t\t\tthis.validatedEpoch = epoch;\n\t\t}\n\t}\n\n\toverride get(): T {\n\t\tthis.validateForEpoch(RxSignal.globalEpoch);\n\t\tRxSignal.currentContext?.markDependency(this);\n\t\tswitch (this.cacheState.kind) {\n\t\t\tcase \"value\":\n\t\t\t\treturn this.cacheState.value;\n\t\t\tcase \"error\":\n\t\t\t\tthrow this.cacheState.error;\n\t\t\tcase \"empty\":\n\t\t\t\tthrow new Error(\"Computed signal has not been initialized\");\n\t\t}\n\t}\n\n\toverride dirtyObservable(): Observable<RxSignalDirtyEvent<T>> {\n\t\tthis.dirty$ ??= new Observable((observer) =>\n\t\t\tthis.listenDirty({\n\t\t\t\tnext: (event) => observer.next(event),\n\t\t\t\terror: (error) => observer.error(error),\n\t\t\t}),\n\t\t);\n\t\treturn this.dirty$;\n\t}\n\n\tprotected override listenDirty(\n\t\tlistener: RxSignalDirtyObserver<T>,\n\t): () => void {\n\t\tthis.validateForEpoch(RxSignal.globalEpoch);\n\t\tthis.dirtyListeners ??= new Set();\n\t\tconst first = this.dirtyListeners.size === 0;\n\t\tthis.dirtySnapshot = undefined;\n\t\tthis.dirtyListeners.add(listener);\n\t\tif (first) {\n\t\t\tthis.dirtyConnection++;\n\t\t\ttry {\n\t\t\t\tthis.syncDirtySources(this.sources);\n\t\t\t} catch (error) {\n\t\t\t\tthis.dirtySnapshot = undefined;\n\t\t\t\tthis.dirtyListeners.delete(listener);\n\t\t\t\tif (!this.dirtyListeners.size) {\n\t\t\t\t\tthis.disconnectDirtySources();\n\t\t\t\t}\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t\treturn () => {\n\t\t\tthis.dirtySnapshot = undefined;\n\t\t\tthis.dirtyListeners?.delete(listener);\n\t\t\tif (!this.dirtyListeners?.size) {\n\t\t\t\tthis.disconnectDirtySources();\n\t\t\t}\n\t\t};\n\t}\n\n\tprivate disconnectDirtySources(): void {\n\t\tthis.dirtyConnection++;\n\t\tconst stops = this.dirtyStops;\n\t\tthis.dirtyStops = undefined;\n\t\tlet errors: unknown[] | undefined;\n\t\tfor (const stop of stops?.values() ?? []) {\n\t\t\ttry {\n\t\t\t\tstop();\n\t\t\t} catch (error) {\n\t\t\t\terrors ??= [];\n\t\t\t\terrors.push(\n\t\t\t\t\t...(error instanceof UnsubscriptionError ? error.errors : [error]),\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tif (errors) {\n\t\t\tthrow new UnsubscriptionError(errors);\n\t\t}\n\t}\n\n\tprivate failDirtySources(error: unknown): void {\n\t\tconst listeners = [...(this.dirtyListeners ?? [])];\n\t\tthis.dirtyListeners?.clear();\n\t\tthis.dirtySnapshot = undefined;\n\t\t// Reset before an error callback can reconnect; notification errors do not poison snapshots.\n\t\tlet notificationError = error;\n\t\ttry {\n\t\t\tthis.disconnectDirtySources();\n\t\t} catch (cleanupError) {\n\t\t\tnotificationError = new AggregateError(\n\t\t\t\t[error, cleanupError],\n\t\t\t\t\"Dirty propagation and cleanup failed\",\n\t\t\t);\n\t\t}\n\t\tfor (const listener of listeners) {\n\t\t\tlistener.error(notificationError);\n\t\t}\n\t}\n\n\tprivate syncDirtySources(sources: ReadonlyMap<AnyRxSignal, number>): void {\n\t\tthis.dirtyStops ??= new Map();\n\t\tconst stops = this.dirtyStops;\n\t\tconst connection = this.dirtyConnection;\n\t\tfor (const [source, stop] of stops) {\n\t\t\tif (!sources.has(source)) {\n\t\t\t\tstop();\n\t\t\t\tstops.delete(source);\n\t\t\t}\n\t\t\tif (this.dirtyConnection !== connection) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tfor (const source of sources.keys()) {\n\t\t\tif (stops.has(source)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tlet active = true;\n\t\t\tconst detach = RxSignal.listenToDirty(\n\t\t\t\tsource,\n\t\t\t\t{\n\t\t\t\t\tnext: (event) => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t!active ||\n\t\t\t\t\t\t\tthis.dirtyConnection !== connection ||\n\t\t\t\t\t\t\t!this.dirtyListeners?.size ||\n\t\t\t\t\t\t\t!this.acceptDirtyEpoch(event.epoch)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst dirtyEvent = { epoch: event.epoch, signal: this };\n\t\t\t\t\t\tlet snapshot = this.dirtySnapshot;\n\t\t\t\t\t\tif (!snapshot) {\n\t\t\t\t\t\t\tsnapshot = [...this.dirtyListeners];\n\t\t\t\t\t\t\tthis.dirtySnapshot = snapshot;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfor (const listener of snapshot) {\n\t\t\t\t\t\t\tlistener.next(dirtyEvent);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\terror: (error) => {\n\t\t\t\t\t\tif (!active || this.dirtyConnection !== connection) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.failDirtySources(error);\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tsource.dirtyObservable === RxStateSignal.prototype.dirtyObservable ||\n\t\t\t\t\tsource.dirtyObservable === RxComputedSignal.prototype.dirtyObservable,\n\t\t\t);\n\t\t\tconst stop = () => {\n\t\t\t\tactive = false;\n\t\t\t\tdetach();\n\t\t\t};\n\t\t\tif (\n\t\t\t\t!active ||\n\t\t\t\tthis.dirtyConnection !== connection ||\n\t\t\t\t!this.dirtyListeners?.size\n\t\t\t) {\n\t\t\t\tstop();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tstops.set(source, stop);\n\t\t}\n\t}\n\n\tstatic computed<T>(\n\t\tfn: () => T,\n\t\toptions?: RxSignalOptions<T>,\n\t): RxComputedSignalCompat<T> {\n\t\treturn new RxComputedSignal<T>(fn, options);\n\t}\n}\n\nexport type RxComputedSignalCompat<T> = WithInteropObservableTraitCompat<\n\tRxComputedSignal<T>,\n\tT\n>;\n","/** biome-ignore-all lint/complexity/noBannedTypes: false negative */\nimport {\n\tconcatAll,\n\tfilter,\n\tfrom,\n\tlastValueFrom,\n\tmap,\n\tObservable,\n\ttype ObservableInput,\n\ttype Observer,\n\ttype OperatorFunction,\n\ttype Subscription,\n\ttakeLast,\n\ttakeWhile,\n\ttoArray,\n} from \"rxjs\";\nimport { ClientError, ClientErrorKind } from \"../errors\";\n\nexport const CommandResponseType = {\n\tData: \"data\",\n\tSuccess: \"success\",\n\tError: \"error\",\n\tCancel: \"cancel\",\n\tRejected: \"rejected\",\n} as const;\n\nexport type CommandResponseType =\n\t(typeof CommandResponseType)[keyof typeof CommandResponseType];\n\nexport type Command<Payload = unknown, Extra extends {} = {}> = Extra & {\n\treadonly payload: Payload;\n};\n\nexport type CommandDataResponse<TCmd extends Command, TData = unknown> = {\n\treadonly type: typeof CommandResponseType.Data;\n\treadonly command: TCmd;\n\treadonly data: TData;\n};\n\nexport type CommandSuccessResponse<TCmd extends Command> = {\n\treadonly type: typeof CommandResponseType.Success;\n\treadonly command: TCmd;\n};\n\nexport type CommandErrorResponse<TCmd extends Command> = {\n\treadonly type: typeof CommandResponseType.Error;\n\treadonly command: TCmd;\n\treadonly error: unknown;\n};\n\nexport type CommandCancelResponse<TCmd extends Command> = {\n\treadonly type: typeof CommandResponseType.Cancel;\n\treadonly command: TCmd;\n};\n\nexport type CommandRejectedResponse<TCmd extends Command> = {\n\treadonly type: typeof CommandResponseType.Rejected;\n\treadonly command: TCmd;\n\treadonly reason: string;\n};\n\nexport type CommandTerminalResponse<TCmd extends Command> =\n\t| CommandSuccessResponse<TCmd>\n\t| CommandErrorResponse<TCmd>\n\t| CommandCancelResponse<TCmd>\n\t| CommandRejectedResponse<TCmd>;\n\nexport type CommandResponse<TCmd extends Command, TData = unknown> =\n\t| CommandDataResponse<TCmd, TData>\n\t| CommandTerminalResponse<TCmd>;\n\nexport interface DispatchCommandBaseOptions<\n\tTCmd extends Command,\n\tTData = unknown,\n> {\n\treadonly requestStream: Pick<Observer<TCmd>, \"next\">;\n\treadonly responseStream: ObservableInput<CommandResponse<TCmd, TData>>;\n}\n\nexport interface DispatchCommandLocallyOptions<\n\tTPayload,\n\tTCommandExtra extends {} = {},\n\tTData = unknown,\n\tTCmd extends Command<TPayload, TCommandExtra> = Command<\n\t\tTPayload,\n\t\tTCommandExtra\n\t>,\n> extends DispatchCommandBaseOptions<TCmd, TData> {\n\treadonly payload: TPayload;\n\treadonly createCommandExtra?: (payload: TPayload) => TCommandExtra;\n}\n\nexport interface DispatchCommandByIdOptions<\n\tTCmd extends Command,\n\tTId,\n\tTData = unknown,\n> extends DispatchCommandBaseOptions<TCmd, TData> {\n\treadonly command: TCmd;\n\treadonly selectCommandId: (command: TCmd) => TId;\n\treadonly areIdsEqual?: (left: TId, right: TId) => boolean;\n}\n\nfunction createCommandCancellationError<TCmd extends Command>(\n\tcommand: TCmd,\n): Error {\n\treturn new ClientError({\n\t\tkind: ClientErrorKind.Cancelled,\n\t\tmessage: \"Command was cancelled before completion\",\n\t\tcause: {\n\t\t\tcommand,\n\t\t},\n\t});\n}\n\nfunction createCommandRejectedError<TCmd extends Command>(\n\tcommand: TCmd,\n\treason: string,\n): Error {\n\treturn new ClientError({\n\t\tkind: ClientErrorKind.Cancelled,\n\t\tmessage: `Command was rejected before execution: ${reason}`,\n\t\tcause: {\n\t\t\tcommand,\n\t\t\treason,\n\t\t},\n\t});\n}\n\nexport function isCommandDataResponse<TCmd extends Command, TData>(\n\tresponse: CommandResponse<TCmd, TData>,\n): response is CommandDataResponse<TCmd, TData> {\n\treturn response.type === CommandResponseType.Data;\n}\n\nexport function isCommandTerminalResponse<TCmd extends Command, TData>(\n\tresponse: CommandResponse<TCmd, TData>,\n): response is CommandTerminalResponse<TCmd> {\n\treturn response.type !== CommandResponseType.Data;\n}\n\nfunction dispatchCommand<TCmd extends Command, TData>(\n\tdispatch: () => void,\n\tmatches: (response: CommandResponse<TCmd, TData>) => boolean,\n): OperatorFunction<\n\tCommandResponse<TCmd, TData>,\n\tCommandResponse<TCmd, TData>\n> {\n\treturn (source$) =>\n\t\tnew Observable<CommandResponse<TCmd, TData>>((subscriber) => {\n\t\t\tconst subscription = source$\n\t\t\t\t.pipe(filter(matches), takeWhile(isCommandDataResponse, true))\n\t\t\t\t.subscribe(subscriber);\n\n\t\t\tif (subscription.closed) {\n\t\t\t\treturn subscription;\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tdispatch();\n\t\t\t} catch (error) {\n\t\t\t\tif (!subscription.closed) {\n\t\t\t\t\tsubscriber.error(error);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn subscription;\n\t\t});\n}\n\nexport function unwrapCommandTerminalResponse<TCmd extends Command>(\n\tresponse: CommandTerminalResponse<TCmd>,\n): void {\n\tswitch (response.type) {\n\t\tcase CommandResponseType.Success:\n\t\t\treturn;\n\t\tcase CommandResponseType.Error:\n\t\t\tthrow response.error;\n\t\tcase CommandResponseType.Cancel:\n\t\t\tthrow createCommandCancellationError(response.command);\n\t\tcase CommandResponseType.Rejected:\n\t\t\tthrow createCommandRejectedError(response.command, response.reason);\n\t}\n}\n\nexport function commandResponseData<\n\tTCmd extends Command,\n\tTData,\n>(): OperatorFunction<CommandResponse<TCmd, TData>, TData> {\n\treturn (source$) =>\n\t\tsource$.pipe(\n\t\t\tfilter((response): response is CommandDataResponse<TCmd, TData> => {\n\t\t\t\tif (isCommandDataResponse(response)) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\tunwrapCommandTerminalResponse(response);\n\t\t\t\treturn false;\n\t\t\t}),\n\t\t\tmap((response) => response.data),\n\t\t);\n}\n\nexport function dispatchCommandLocallyToStream<\n\tTPayload,\n\tTCommandExtra extends {} = {},\n\tTData = unknown,\n\tTCmd extends Command<TPayload, TCommandExtra> = Command<\n\t\tTPayload,\n\t\tTCommandExtra\n\t>,\n>(\n\toptions: DispatchCommandLocallyOptions<TPayload, TCommandExtra, TData, TCmd>,\n): Observable<CommandResponse<TCmd, TData>> {\n\tconst command = {\n\t\tpayload: options.payload,\n\t\t...(options.createCommandExtra?.(options.payload) ?? {}),\n\t} as TCmd;\n\n\treturn from(options.responseStream).pipe(\n\t\tdispatchCommand(\n\t\t\t() => {\n\t\t\t\toptions.requestStream.next(command);\n\t\t\t},\n\t\t\t(response) => response.command === command,\n\t\t),\n\t);\n}\n\nexport function dispatchCommandByIdToStream<\n\tTCmd extends Command,\n\tTId,\n\tTData = unknown,\n>(\n\toptions: DispatchCommandByIdOptions<TCmd, TId, TData>,\n): Observable<CommandResponse<TCmd, TData>> {\n\tconst areIdsEqual = options.areIdsEqual ?? Object.is;\n\tconst commandId = options.selectCommandId(options.command);\n\n\treturn from(options.responseStream).pipe(\n\t\tdispatchCommand(\n\t\t\t() => {\n\t\t\t\toptions.requestStream.next(options.command);\n\t\t\t},\n\t\t\t(response) =>\n\t\t\t\tareIdsEqual(options.selectCommandId(response.command), commandId),\n\t\t),\n\t);\n}\n\nexport async function dispatchCommandLocallyToPromise<\n\tTPayload,\n\tTCommandExtra extends {} = {},\n\tTData = unknown,\n\tTCmd extends Command<TPayload, TCommandExtra> = Command<\n\t\tTPayload,\n\t\tTCommandExtra\n\t>,\n>(\n\toptions: DispatchCommandLocallyOptions<\n\t\tTPayload,\n\t\tTCommandExtra,\n\t\tTData,\n\t\tTCmd\n\t> & {},\n): Promise<CommandDataResponse<TCmd, TData>> {\n\tconst [data, terminal] = await lastValueFrom(\n\t\tdispatchCommandLocallyToStream(options).pipe(takeLast(2), toArray()),\n\t\t{\n\t\t\tdefaultValue: [],\n\t\t},\n\t);\n\tif (data === undefined) {\n\t\tthrow new ClientError({\n\t\t\tkind: ClientErrorKind.Configuration,\n\t\t\tmessage:\n\t\t\t\t\"the executor configuration of dispatchCommandLocallyToPromise should produce a valid data response.\",\n\t\t});\n\t}\n\tif (!isCommandDataResponse(data)) {\n\t\tthrow new ClientError({\n\t\t\tkind: ClientErrorKind.Configuration,\n\t\t\tmessage:\n\t\t\t\t\"the executor configuration of dispatchCommandLocallyToPromise should produce a valid data response.\",\n\t\t});\n\t}\n\tif (terminal === undefined) {\n\t\tthrow new ClientError({\n\t\t\tkind: ClientErrorKind.Internal,\n\t\t\tmessage:\n\t\t\t\t\"the execution of dispatchCommandLocallyToPromise must produce a valid terminal response.\",\n\t\t});\n\t}\n\tif (!isCommandTerminalResponse(terminal)) {\n\t\tthrow new ClientError({\n\t\t\tkind: ClientErrorKind.Internal,\n\t\t\tmessage:\n\t\t\t\t\"the execution of dispatchCommandLocallyToPromise must produce a valid terminal response.\",\n\t\t});\n\t}\n\tunwrapCommandTerminalResponse(terminal);\n\treturn data;\n}\n\nexport async function dispatchCommandByIdToPromise<\n\tTCmd extends Command,\n\tTId,\n\tTData = unknown,\n>(\n\toptions: DispatchCommandByIdOptions<TCmd, TId, TData>,\n): Promise<CommandDataResponse<TCmd, TData>> {\n\tconst [data, terminal] = await lastValueFrom(\n\t\tdispatchCommandByIdToStream(options).pipe(takeLast(2), toArray()),\n\t\t{\n\t\t\tdefaultValue: [],\n\t\t},\n\t);\n\tif (data === undefined) {\n\t\tthrow new ClientError({\n\t\t\tkind: ClientErrorKind.Configuration,\n\t\t\tmessage:\n\t\t\t\t\"the executor configuration of dispatchCommandLocallyToPromise should produce a valid data response.\",\n\t\t});\n\t}\n\tif (!isCommandDataResponse(data)) {\n\t\tthrow new ClientError({\n\t\t\tkind: ClientErrorKind.Configuration,\n\t\t\tmessage:\n\t\t\t\t\"the executor configuration of dispatchCommandLocallyToPromise should produce a valid data response.\",\n\t\t});\n\t}\n\tif (terminal === undefined) {\n\t\tthrow new ClientError({\n\t\t\tkind: ClientErrorKind.Internal,\n\t\t\tmessage:\n\t\t\t\t\"the execution of dispatchCommandLocallyToPromise must produce a valid terminal response.\",\n\t\t});\n\t}\n\tif (!isCommandTerminalResponse(terminal)) {\n\t\tthrow new ClientError({\n\t\t\tkind: ClientErrorKind.Internal,\n\t\t\tmessage:\n\t\t\t\t\"the execution of dispatchCommandLocallyToPromise must produce a valid terminal response.\",\n\t\t});\n\t}\n\tunwrapCommandTerminalResponse(terminal);\n\treturn data;\n}\n\nfunction createCommandExecutionStream<\n\tTCmd extends Command,\n\tTData = unknown,\n>(options: {\n\treadonly command: TCmd;\n\treadonly execute: (command: TCmd) => ObservableInput<TData>;\n\treadonly onStateEnd?: (command: TCmd) => void;\n}): Observable<CommandResponse<TCmd, TData>> {\n\treturn new Observable<CommandResponse<TCmd, TData>>((subscriber) => {\n\t\tlet didEmitTerminal = false;\n\n\t\tconst emitTerminal = (response: CommandTerminalResponse<TCmd>) => {\n\t\t\tif (didEmitTerminal) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tdidEmitTerminal = true;\n\t\t\tsubscriber.next(response);\n\t\t\tsubscriber.complete();\n\t\t};\n\n\t\tconst subscription = from(options.execute(options.command)).subscribe({\n\t\t\tnext: (data) => {\n\t\t\t\tsubscriber.next({\n\t\t\t\t\ttype: CommandResponseType.Data,\n\t\t\t\t\tcommand: options.command,\n\t\t\t\t\tdata,\n\t\t\t\t});\n\t\t\t},\n\t\t\terror: (error) => {\n\t\t\t\temitTerminal({\n\t\t\t\t\ttype: CommandResponseType.Error,\n\t\t\t\t\tcommand: options.command,\n\t\t\t\t\terror,\n\t\t\t\t});\n\t\t\t},\n\t\t\tcomplete: () => {\n\t\t\t\temitTerminal({\n\t\t\t\t\ttype: CommandResponseType.Success,\n\t\t\t\t\tcommand: options.command,\n\t\t\t\t});\n\t\t\t},\n\t\t});\n\n\t\treturn () => {\n\t\t\tconst wasTerminalEmitted = didEmitTerminal;\n\t\t\tsubscription.unsubscribe();\n\t\t\toptions.onStateEnd?.(options.command);\n\n\t\t\tif (!wasTerminalEmitted) {\n\t\t\t\tsubscriber.next({\n\t\t\t\t\ttype: CommandResponseType.Cancel,\n\t\t\t\t\tcommand: options.command,\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\t});\n}\n\nexport function switchCommand<TCmd extends Command, TData = unknown>(\n\texecute: (command: TCmd) => ObservableInput<TData>,\n): OperatorFunction<TCmd, CommandResponse<TCmd, TData>> {\n\treturn (source$) =>\n\t\tnew Observable<CommandResponse<TCmd, TData>>((destination) => {\n\t\t\tlet innerSubscription: Subscription | null = null;\n\t\t\tlet currentCommand: TCmd | null = null;\n\t\t\tlet isComplete = false;\n\n\t\t\tconst checkComplete = () => {\n\t\t\t\tif (isComplete && !innerSubscription) {\n\t\t\t\t\tdestination.complete();\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tconst sourceSubscription = source$.subscribe({\n\t\t\t\tnext: (command) => {\n\t\t\t\t\tconst cancelledCommand = currentCommand;\n\n\t\t\t\t\tinnerSubscription?.unsubscribe();\n\t\t\t\t\tinnerSubscription = null;\n\t\t\t\t\tcurrentCommand = null;\n\n\t\t\t\t\tif (cancelledCommand) {\n\t\t\t\t\t\tdestination.next({\n\t\t\t\t\t\t\ttype: CommandResponseType.Cancel,\n\t\t\t\t\t\t\tcommand: cancelledCommand,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\tcurrentCommand = command;\n\t\t\t\t\tlet didCompleteSynchronously = false;\n\t\t\t\t\tconst nextInnerSubscription = createCommandExecutionStream({\n\t\t\t\t\t\tcommand,\n\t\t\t\t\t\texecute,\n\t\t\t\t\t}).subscribe({\n\t\t\t\t\t\tnext: (response) => {\n\t\t\t\t\t\t\tdestination.next(response);\n\t\t\t\t\t\t},\n\t\t\t\t\t\terror: (error) => {\n\t\t\t\t\t\t\tdestination.error(error);\n\t\t\t\t\t\t},\n\t\t\t\t\t\tcomplete: () => {\n\t\t\t\t\t\t\tdidCompleteSynchronously = true;\n\t\t\t\t\t\t\tinnerSubscription = null;\n\t\t\t\t\t\t\tcurrentCommand = null;\n\t\t\t\t\t\t\tcheckComplete();\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\n\t\t\t\t\tif (!didCompleteSynchronously) {\n\t\t\t\t\t\tinnerSubscription = nextInnerSubscription;\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\terror: (error) => {\n\t\t\t\t\tdestination.error(error);\n\t\t\t\t},\n\t\t\t\tcomplete: () => {\n\t\t\t\t\tisComplete = true;\n\t\t\t\t\tcheckComplete();\n\t\t\t\t},\n\t\t\t});\n\n\t\t\treturn () => {\n\t\t\t\tsourceSubscription.unsubscribe();\n\t\t\t\tinnerSubscription?.unsubscribe();\n\t\t\t};\n\t\t});\n}\n\nexport function concatCommand<TCmd extends Command, TData = unknown>(\n\texecute: (command: TCmd) => ObservableInput<TData>,\n): OperatorFunction<TCmd, CommandResponse<TCmd, TData>> {\n\treturn (source$: Observable<TCmd>) =>\n\t\tsource$.pipe(\n\t\t\tmap((command) =>\n\t\t\t\tcreateCommandExecutionStream({\n\t\t\t\t\tcommand,\n\t\t\t\t\texecute,\n\t\t\t\t}),\n\t\t\t),\n\t\t\tconcatAll(),\n\t\t);\n}\n\nexport const exhaustCommand =\n\t<TCmd extends Command, TData = unknown>(\n\t\texecute: (command: TCmd) => ObservableInput<TData>,\n\t) =>\n\t(source$: Observable<TCmd>) =>\n\t\tnew Observable<CommandResponse<TCmd, TData>>((destination) => {\n\t\t\tlet innerSubscription: Subscription | null = null;\n\t\t\tlet isComplete = false;\n\n\t\t\tconst checkComplete = () => {\n\t\t\t\tif (isComplete && !innerSubscription) {\n\t\t\t\t\tdestination.complete();\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tconst sourceSubscription = source$.subscribe({\n\t\t\t\tnext: (command) => {\n\t\t\t\t\tif (innerSubscription) {\n\t\t\t\t\t\tdestination.next({\n\t\t\t\t\t\t\ttype: CommandResponseType.Rejected,\n\t\t\t\t\t\t\tcommand,\n\t\t\t\t\t\t\treason: \"Pessimistic lock active.\",\n\t\t\t\t\t\t});\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tlet didCompleteSynchronously = false;\n\t\t\t\t\tconst nextInnerSubscription = createCommandExecutionStream({\n\t\t\t\t\t\tcommand,\n\t\t\t\t\t\texecute,\n\t\t\t\t\t}).subscribe({\n\t\t\t\t\t\tnext: (response) => {\n\t\t\t\t\t\t\tdestination.next(response);\n\t\t\t\t\t\t},\n\t\t\t\t\t\terror: (error) => {\n\t\t\t\t\t\t\tdestination.error(error);\n\t\t\t\t\t\t},\n\t\t\t\t\t\tcomplete: () => {\n\t\t\t\t\t\t\tdidCompleteSynchronously = true;\n\t\t\t\t\t\t\tinnerSubscription = null;\n\t\t\t\t\t\t\tcheckComplete();\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\n\t\t\t\t\tif (!didCompleteSynchronously) {\n\t\t\t\t\t\tinnerSubscription = nextInnerSubscription;\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\terror: (error) => {\n\t\t\t\t\tdestination.error(error);\n\t\t\t\t},\n\t\t\t\tcomplete: () => {\n\t\t\t\t\tisComplete = true;\n\t\t\t\t\tcheckComplete();\n\t\t\t\t},\n\t\t\t});\n\n\t\t\treturn () => {\n\t\t\t\tsourceSubscription.unsubscribe();\n\t\t\t\tinnerSubscription?.unsubscribe();\n\t\t\t};\n\t\t});\n","import { AsyncAction } from \"rxjs/internal/scheduler/AsyncAction\";\nimport { AsyncScheduler } from \"rxjs/internal/scheduler/AsyncScheduler\";\nimport { type TimerHandle } from \"rxjs/internal/scheduler/timerHandle\";\nimport { type TimeTrait } from \"../scheduling\";\n\nexport function createAsyncSchedulerWithTimestampProvider(\n\ttime: TimeTrait,\n): AsyncScheduler {\n\tclass TimeTraitAsyncAction<T> extends AsyncAction<T> {\n\t\tprotected override requestAsyncId(\n\t\t\tscheduler: AsyncScheduler,\n\t\t\t_id?: TimerHandle,\n\t\t\tdelay = 0,\n\t\t): TimerHandle {\n\t\t\treturn time.setTimeout(() => {\n\t\t\t\tscheduler.flush(this);\n\t\t\t}, delay) as TimerHandle;\n\t\t}\n\n\t\tprotected override recycleAsyncId(\n\t\t\t_scheduler: AsyncScheduler,\n\t\t\tid?: TimerHandle,\n\t\t\tdelay: number | null = 0,\n\t\t): TimerHandle | undefined {\n\t\t\tif (delay != null && this.delay === delay && this.pending === false) {\n\t\t\t\treturn id;\n\t\t\t}\n\n\t\t\tif (id !== undefined) {\n\t\t\t\ttime.clearTimeout(id);\n\t\t\t}\n\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\treturn new AsyncScheduler(TimeTraitAsyncAction, time.now);\n}\n","import { filter, map, type Observable, take } from \"rxjs\";\nimport { BehaviorSubject } from \"rxjs/internal/BehaviorSubject\";\nimport {\n\ttype DisposableTrait,\n\tisInteropObservableTrait,\n\tSYMBOL_DISPOSE,\n\tSYMBOL_OBSERVABLE,\n} from \"../compat\";\nimport { ClientError } from \"../errors/client-error\";\nimport { ClientErrorKind, ClientErrorSource } from \"../errors/types\";\nimport {\n\ttype CancellationTokenErrorData,\n\ttype CancellationTokenSourceTrait,\n\ttype CancellationTokenTrait,\n} from \"./types\";\n\ninterface CancellationTokenCancelledState extends CancellationTokenErrorData {\n\treadonly isCancelled: true;\n}\n\ntype CancellationTokenUncancelledState = undefined;\n\ntype CancellationTokenState =\n\t| CancellationTokenCancelledState\n\t| CancellationTokenUncancelledState;\n\nexport class CancellationToken implements CancellationTokenTrait {\n\tprivate cancellationState = new BehaviorSubject<CancellationTokenState>(\n\t\tundefined,\n\t);\n\n\tget isCancellationRequested(): boolean {\n\t\treturn this.cancellationState.getValue()?.isCancelled === true;\n\t}\n\n\tget reason(): unknown {\n\t\treturn this.cancellationState.getValue()?.reason;\n\t}\n\n\t/** @internal — called by `CancellationTokenSource`. */\n\t_cancel(reason: unknown): void {\n\t\tif (this.isCancellationRequested) {\n\t\t\treturn;\n\t\t}\n\t\tthis.cancellationState.next({\n\t\t\tisCancelled: true,\n\t\t\treason,\n\t\t\tcancellationError: new ClientError({\n\t\t\t\tkind: ClientErrorKind.Cancelled,\n\t\t\t\tmessage: \"Operation was cancelled\",\n\t\t\t\tcode: \"client.cancelled\",\n\t\t\t\tsource: ClientErrorSource.Client,\n\t\t\t\tcause: reason,\n\t\t\t}),\n\t\t});\n\t}\n\n\tonCancellationRequested(\n\t\tlistener: (errorData: CancellationTokenErrorData) => void,\n\t): DisposableTrait {\n\t\tconst cancellationState = this.cancellationState.getValue();\n\t\tif (cancellationState?.isCancelled) {\n\t\t\tlistener({\n\t\t\t\tcancellationError: cancellationState.cancellationError,\n\t\t\t\treason: cancellationState.reason,\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tdispose() {},\n\t\t\t\t[SYMBOL_DISPOSE]() {},\n\t\t\t};\n\t\t}\n\n\t\tconst subscription = this.asObservable().subscribe((errorData) => {\n\t\t\tlistener(errorData);\n\t\t});\n\n\t\treturn {\n\t\t\tdispose() {\n\t\t\t\tsubscription.unsubscribe();\n\t\t\t},\n\t\t\t[SYMBOL_DISPOSE]: () => {\n\t\t\t\tsubscription.unsubscribe();\n\t\t\t},\n\t\t};\n\t}\n\n\tthrowIfCancellationRequested(): void {\n\t\tconst cancellationState = this.cancellationState.getValue();\n\t\tif (cancellationState?.cancellationError) {\n\t\t\tthrow cancellationState.cancellationError;\n\t\t}\n\t}\n\n\tget cancellationError(): ClientError | undefined {\n\t\tconst cancellationState = this.cancellationState.getValue();\n\t\treturn cancellationState?.cancellationError;\n\t}\n\n\tprotected asObservable(): Observable<CancellationTokenErrorData> {\n\t\treturn this.cancellationState.pipe(\n\t\t\tfilter(\n\t\t\t\t(state): state is CancellationTokenCancelledState =>\n\t\t\t\t\t!!state?.isCancelled,\n\t\t\t),\n\t\t\ttake(1),\n\t\t\tmap((state) => ({\n\t\t\t\tcancellationError: state.cancellationError,\n\t\t\t\treason: state.reason,\n\t\t\t})),\n\t\t);\n\t}\n\n\t[SYMBOL_OBSERVABLE]() {\n\t\treturn this.asObservable();\n\t}\n}\n\nexport class CancellationTokenSource implements CancellationTokenSourceTrait {\n\treadonly token = new CancellationToken();\n\n\tcancel(reason?: unknown) {\n\t\tthis.token._cancel(reason);\n\t}\n}\n\n/**\n * Create a `CancellationTokenSource` that produces a cooperative cancellation token.\n */\nexport function createCancellationTokenSource(): CancellationTokenSourceTrait {\n\treturn new CancellationTokenSource();\n}\n\nexport function isCancellationTokenTrait(\n\tobj: unknown,\n): obj is CancellationTokenTrait {\n\treturn (\n\t\ttypeof obj === \"object\" &&\n\t\tobj !== null &&\n\t\ttypeof (obj as CancellationTokenTrait).isCancellationRequested ===\n\t\t\t\"boolean\" &&\n\t\ttypeof (obj as CancellationTokenTrait).onCancellationRequested ===\n\t\t\t\"function\" &&\n\t\ttypeof (obj as CancellationTokenTrait).throwIfCancellationRequested ===\n\t\t\t\"function\" &&\n\t\tisInteropObservableTrait(obj)\n\t);\n}\n","export const ResourceErrorCode = {\n\tValueUnavailable: \"resource.value_unavailable\",\n} as const;\n\nexport type ResourceErrorCode =\n\t(typeof ResourceErrorCode)[keyof typeof ResourceErrorCode];\n\nexport interface ResourceValueUnavailableErrorOptions {\n\treadonly status: string;\n}\n\nexport class ResourceError extends Error {\n\toverride readonly name = \"ResourceError\";\n\treadonly code: ResourceErrorCode;\n\treadonly status?: string;\n\n\tconstructor(\n\t\tmessage: string,\n\t\toptions: { code: ResourceErrorCode; status?: string },\n\t) {\n\t\tsuper(message);\n\t\tthis.code = options.code;\n\t\tthis.status = options.status;\n\t}\n\n\tstatic valueUnavailable(\n\t\toptions: ResourceValueUnavailableErrorOptions,\n\t): ResourceError {\n\t\treturn new ResourceError(\n\t\t\t`Resource value is not available while status is \"${options.status}\".`,\n\t\t\t{\n\t\t\t\tcode: ResourceErrorCode.ValueUnavailable,\n\t\t\t\tstatus: options.status,\n\t\t\t},\n\t\t);\n\t}\n}\n","// --- Signal trait types ---\n\nimport { type CancellationTokenTrait } from \"../cancellation/types\";\nimport { type DisposableTrait, type InteropObservableTrait } from \"../compat\";\nimport { type EventStreamTrait } from \"../events/types\";\n\nexport interface SignalOptions<T> {\n\tequals?: (a: T, b: T) => boolean;\n}\n\n/**\n * Read-only signal interface.\n * Semantics align with TC39 Signals proposal, but uses an SDK-owned thin protocol\n * to avoid coupling to any specific polyfill or standard implementation.\n */\nexport interface ReadableSignalTrait<T> extends InteropObservableTrait<T> {\n\treadonly equals: (a: unknown, b: unknown) => boolean;\n\t/** Return the current snapshot value. */\n\tget(): T;\n\t/**\n\t * Watch value invalidations.\n\t * The stream does not emit the current value on subscription; use\n\t * `[SYMBOL_OBSERVABLE]()` when value replay is required.\n\t */\n\twatchStream(): EventStreamTrait<void>;\n}\n\n/**\n * Writable signal interface.\n * State transitions should be controlled by the client / service layer;\n * external consumers typically only see the read-only projection.\n */\nexport interface WritableSignalTrait<T> extends ReadableSignalTrait<T> {\n\tset(value: T): void;\n}\n\n/**\n * Computed (derived) signal — always read-only, value is derived from\n * other signals automatically.\n */\nexport interface ComputedSignalTrait<T> extends ReadableSignalTrait<T> {}\n\nexport const ResourceStatus = {\n\tIdle: \"idle\",\n\tLoading: \"loading\",\n\tLoadingError: \"loading_error\",\n\tReloading: \"reloading\",\n\tResolved: \"resolved\",\n\tError: \"error\",\n} as const;\n\nexport type ResourceStatus =\n\t(typeof ResourceStatus)[keyof typeof ResourceStatus];\n\nexport interface ResourceIdleSnapshot {\n\treadonly status: typeof ResourceStatus.Idle;\n}\n\nexport interface ResourceLoadingSnapshot {\n\treadonly status: typeof ResourceStatus.Loading;\n}\n\nexport interface ResourceLoadingErrorSnapshot {\n\treadonly status: typeof ResourceStatus.LoadingError;\n\treadonly error: unknown;\n}\n\nexport interface ResourceReloadingSnapshot<T> {\n\treadonly status: typeof ResourceStatus.Reloading;\n\treadonly value: T;\n}\n\nexport interface ResourceResolvedSnapshot<T> {\n\treadonly status: typeof ResourceStatus.Resolved;\n\treadonly value: T;\n}\n\nexport interface ResourceErrorSnapshot<T> {\n\treadonly status: typeof ResourceStatus.Error;\n\treadonly value: T;\n\treadonly error: unknown;\n}\n\nexport type ResourceSnapshot<T> =\n\t| ResourceIdleSnapshot\n\t| ResourceLoadingSnapshot\n\t| ResourceLoadingErrorSnapshot\n\t| ResourceReloadingSnapshot<T>\n\t| ResourceResolvedSnapshot<T>\n\t| ResourceErrorSnapshot<T>;\n\nexport interface ResourceWhenValueOptions {\n\treadonly cancellationToken?: CancellationTokenTrait;\n\treadonly staleValueWhenError?: boolean;\n}\n\nexport interface ResourceTrait<T>\n\textends DisposableTrait,\n\t\tInteropObservableTrait<ResourceSnapshot<T>> {\n\treadonly value: ReadableSignalTrait<T>;\n\treadonly status: ReadableSignalTrait<ResourceStatus>;\n\treadonly error: ReadableSignalTrait<unknown | undefined>;\n\treadonly isLoading: ReadableSignalTrait<boolean>;\n\treadonly snapshot: ReadableSignalTrait<ResourceSnapshot<T>>;\n\thasValue(): boolean;\n\twhenValue(options?: ResourceWhenValueOptions): Promise<T>;\n}\n","import { filter, firstValueFrom, from, map, merge, NEVER } from \"rxjs\";\nimport {\n\ttype ReadableSignalTrait,\n\ttype ResourceErrorSnapshot,\n\ttype ResourceLoadingErrorSnapshot,\n\ttype ResourceReloadingSnapshot,\n\ttype ResourceResolvedSnapshot,\n\ttype ResourceSnapshot,\n\tResourceStatus,\n\ttype ResourceWhenValueOptions,\n} from \"./types\";\n\nexport async function whenResourceSnapshotValue<T>(\n\tsnapshotSignal: ReadableSignalTrait<ResourceSnapshot<T>>,\n\toptions?: ResourceWhenValueOptions,\n): Promise<T> {\n\toptions?.cancellationToken?.throwIfCancellationRequested();\n\tconst staleValueWhenError = options?.staleValueWhenError ?? true;\n\tconst current = snapshotSignal.get();\n\tif (\n\t\tcurrent.status === ResourceStatus.Resolved ||\n\t\tcurrent.status === ResourceStatus.Reloading ||\n\t\t(current.status === ResourceStatus.Error && staleValueWhenError)\n\t) {\n\t\treturn current.value;\n\t}\n\tif (\n\t\tcurrent.status === ResourceStatus.LoadingError ||\n\t\tcurrent.status === ResourceStatus.Error\n\t) {\n\t\tthrow current.error;\n\t}\n\n\tconst snapshot = await firstValueFrom(\n\t\tmerge(\n\t\t\tfrom(snapshotSignal).pipe(\n\t\t\t\tfilter(\n\t\t\t\t\t(\n\t\t\t\t\t\tsnapshot,\n\t\t\t\t\t): snapshot is\n\t\t\t\t\t\t| ResourceResolvedSnapshot<T>\n\t\t\t\t\t\t| ResourceReloadingSnapshot<T>\n\t\t\t\t\t\t| ResourceLoadingErrorSnapshot\n\t\t\t\t\t\t| ResourceErrorSnapshot<T> =>\n\t\t\t\t\t\tsnapshot.status === ResourceStatus.Resolved ||\n\t\t\t\t\t\tsnapshot.status === ResourceStatus.Reloading ||\n\t\t\t\t\t\tsnapshot.status === ResourceStatus.LoadingError ||\n\t\t\t\t\t\tsnapshot.status === ResourceStatus.Error,\n\t\t\t\t),\n\t\t\t),\n\t\t\t(options?.cancellationToken\n\t\t\t\t? from(options.cancellationToken)\n\t\t\t\t: NEVER\n\t\t\t).pipe(\n\t\t\t\tmap(({ cancellationError }) => {\n\t\t\t\t\tthrow cancellationError;\n\t\t\t\t}),\n\t\t\t),\n\t\t),\n\t);\n\n\tif (snapshot.status === ResourceStatus.LoadingError) {\n\t\tthrow snapshot.error;\n\t}\n\tif (snapshot.status === ResourceStatus.Error && !staleValueWhenError) {\n\t\tthrow snapshot.error;\n\t}\n\treturn snapshot.value;\n}\n\ntype AnyResourceSnapshotSelector = (\n\t// More than four levels intentionally falls back to runtime composition.\n\tvalue: any,\n) => ReadableSignalTrait<ResourceSnapshot<unknown>>;\n\nexport function flattenResourceSnapshot<T1, T2>(\n\tsourceSnapshot: ResourceSnapshot<T1>,\n\tselect1: (value: T1) => ReadableSignalTrait<ResourceSnapshot<T2>>,\n): ResourceSnapshot<T2>;\nexport function flattenResourceSnapshot<T1, T2, T3>(\n\tsourceSnapshot: ResourceSnapshot<T1>,\n\tselect1: (value: T1) => ReadableSignalTrait<ResourceSnapshot<T2>>,\n\tselect2: (value: T2) => ReadableSignalTrait<ResourceSnapshot<T3>>,\n): ResourceSnapshot<T3>;\nexport function flattenResourceSnapshot<T1, T2, T3, T4>(\n\tsourceSnapshot: ResourceSnapshot<T1>,\n\tselect1: (value: T1) => ReadableSignalTrait<ResourceSnapshot<T2>>,\n\tselect2: (value: T2) => ReadableSignalTrait<ResourceSnapshot<T3>>,\n\tselect3: (value: T3) => ReadableSignalTrait<ResourceSnapshot<T4>>,\n): ResourceSnapshot<T4>;\nexport function flattenResourceSnapshot<T1, T2, T3, T4, T5>(\n\tsourceSnapshot: ResourceSnapshot<T1>,\n\tselect1: (value: T1) => ReadableSignalTrait<ResourceSnapshot<T2>>,\n\tselect2: (value: T2) => ReadableSignalTrait<ResourceSnapshot<T3>>,\n\tselect3: (value: T3) => ReadableSignalTrait<ResourceSnapshot<T4>>,\n\tselect4: (value: T4) => ReadableSignalTrait<ResourceSnapshot<T5>>,\n): ResourceSnapshot<T5>;\nexport function flattenResourceSnapshot(\n\tsourceSnapshot: ResourceSnapshot<unknown>,\n\tselect: AnyResourceSnapshotSelector,\n\t...selectors: readonly AnyResourceSnapshotSelector[]\n): ResourceSnapshot<unknown>;\n/**\n * Flatten nested resource snapshots while tracking each selected snapshot signal.\n * Ancestor reload and error states remain visible whenever the final snapshot has\n * a value; an ancestor error without a final value becomes a loading error.\n */\nexport function flattenResourceSnapshot(\n\tsourceSnapshot: ResourceSnapshot<unknown>,\n\t...selectors: readonly AnyResourceSnapshotSelector[]\n): ResourceSnapshot<unknown> {\n\tlet snapshot = sourceSnapshot;\n\tlet reloading = false;\n\tlet hasError = false;\n\tlet error: unknown;\n\n\tfor (const select of selectors) {\n\t\tswitch (snapshot.status) {\n\t\t\tcase ResourceStatus.Idle:\n\t\t\tcase ResourceStatus.Loading:\n\t\t\t\treturn hasError\n\t\t\t\t\t? { status: ResourceStatus.LoadingError, error }\n\t\t\t\t\t: snapshot;\n\t\t\tcase ResourceStatus.LoadingError:\n\t\t\t\treturn hasError\n\t\t\t\t\t? { status: ResourceStatus.LoadingError, error }\n\t\t\t\t\t: snapshot;\n\t\t\tcase ResourceStatus.Reloading:\n\t\t\t\treloading = true;\n\t\t\t\tsnapshot = select(snapshot.value).get();\n\t\t\t\tbreak;\n\t\t\tcase ResourceStatus.Resolved:\n\t\t\t\tsnapshot = select(snapshot.value).get();\n\t\t\t\tbreak;\n\t\t\tcase ResourceStatus.Error:\n\t\t\t\tif (!hasError) {\n\t\t\t\t\thasError = true;\n\t\t\t\t\terror = snapshot.error;\n\t\t\t\t}\n\t\t\t\tsnapshot = select(snapshot.value).get();\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tswitch (snapshot.status) {\n\t\tcase ResourceStatus.Idle:\n\t\tcase ResourceStatus.Loading:\n\t\tcase ResourceStatus.LoadingError:\n\t\t\treturn hasError\n\t\t\t\t? { status: ResourceStatus.LoadingError, error }\n\t\t\t\t: snapshot;\n\t\tcase ResourceStatus.Reloading:\n\t\t\treturn hasError\n\t\t\t\t? { status: ResourceStatus.Error, value: snapshot.value, error }\n\t\t\t\t: snapshot;\n\t\tcase ResourceStatus.Resolved:\n\t\t\treturn hasError\n\t\t\t\t? { status: ResourceStatus.Error, value: snapshot.value, error }\n\t\t\t\t: reloading\n\t\t\t\t\t? { status: ResourceStatus.Reloading, value: snapshot.value }\n\t\t\t\t\t: snapshot;\n\t\tcase ResourceStatus.Error:\n\t\t\treturn hasError\n\t\t\t\t? { status: ResourceStatus.Error, value: snapshot.value, error }\n\t\t\t\t: snapshot;\n\t}\n}\n\nexport const ResourceSnapshotUpdateKind = {\n\tLoad: \"load\",\n\tResolve: \"resolve\",\n\tFail: \"fail\",\n\tFailWithValue: \"fail_with_value\",\n} as const;\n\nexport type ResourceSnapshotUpdateKind =\n\t(typeof ResourceSnapshotUpdateKind)[keyof typeof ResourceSnapshotUpdateKind];\n\nexport type ResourceSnapshotUpdate<T> =\n\t| { readonly kind: typeof ResourceSnapshotUpdateKind.Load }\n\t| {\n\t\t\treadonly kind: typeof ResourceSnapshotUpdateKind.Resolve;\n\t\t\treadonly value: T;\n\t }\n\t| {\n\t\t\treadonly kind: typeof ResourceSnapshotUpdateKind.Fail;\n\t\t\treadonly error: unknown;\n\t }\n\t| {\n\t\t\treadonly kind: typeof ResourceSnapshotUpdateKind.FailWithValue;\n\t\t\treadonly value: T;\n\t\t\treadonly error: unknown;\n\t };\n\nexport function reduceResourceSnapshot<T>(\n\tprevious: ResourceSnapshot<T>,\n\tupdate: ResourceSnapshotUpdate<T>,\n): ResourceSnapshot<T> {\n\tswitch (update.kind) {\n\t\tcase ResourceSnapshotUpdateKind.Load:\n\t\t\treturn previous.status === ResourceStatus.Reloading ||\n\t\t\t\tprevious.status === ResourceStatus.Resolved ||\n\t\t\t\tprevious.status === ResourceStatus.Error\n\t\t\t\t? { status: ResourceStatus.Reloading, value: previous.value }\n\t\t\t\t: { status: ResourceStatus.Loading };\n\t\tcase ResourceSnapshotUpdateKind.Resolve:\n\t\t\treturn { status: ResourceStatus.Resolved, value: update.value };\n\t\tcase ResourceSnapshotUpdateKind.Fail:\n\t\t\treturn previous.status === ResourceStatus.Reloading ||\n\t\t\t\tprevious.status === ResourceStatus.Resolved ||\n\t\t\t\tprevious.status === ResourceStatus.Error\n\t\t\t\t? {\n\t\t\t\t\t\tstatus: ResourceStatus.Error,\n\t\t\t\t\t\tvalue: previous.value,\n\t\t\t\t\t\terror: update.error,\n\t\t\t\t\t}\n\t\t\t\t: {\n\t\t\t\t\t\tstatus: ResourceStatus.LoadingError,\n\t\t\t\t\t\terror: update.error,\n\t\t\t\t\t};\n\t\tcase ResourceSnapshotUpdateKind.FailWithValue:\n\t\t\treturn {\n\t\t\t\tstatus: ResourceStatus.Error,\n\t\t\t\tvalue: update.value,\n\t\t\t\terror: update.error,\n\t\t\t};\n\t}\n}\n","import {\n\tcatchError,\n\tdistinctUntilChanged,\n\tfilter,\n\tfinalize,\n\tfrom,\n\tmap,\n\ttype Observable,\n\ttype ObservableInput,\n\tof,\n\tswitchMap,\n\ttake,\n\ttakeUntil,\n} from \"rxjs\";\nimport {\n\ttype CancellationTokenTrait,\n\tcreateCancellationTokenSource,\n} from \"../cancellation\";\nimport {\n\ttype InteropObservableTrait,\n\tSYMBOL_DISPOSE,\n\tSYMBOL_OBSERVABLE,\n\ttype WithInteropObservableTraitCompat,\n} from \"../compat\";\nimport { ResourceError } from \"../signals/error\";\nimport {\n\tResourceSnapshotUpdateKind,\n\treduceResourceSnapshot,\n\twhenResourceSnapshotValue,\n} from \"../signals/resource-snapshot\";\nimport {\n\ttype ReadableSignalTrait,\n\ttype ResourceSnapshot,\n\tResourceStatus,\n\ttype ResourceTrait,\n\ttype ResourceWhenValueOptions,\n} from \"../signals/types\";\nimport { type RxEventStream } from \"./event\";\nimport {\n\tRxComputedSignal,\n\ttype RxComputedSignalCompat,\n\tRxStateSignal,\n\ttype RxStateSignalCompat,\n} from \"./signal\";\n\nexport {\n\ttype ResourceErrorSnapshot,\n\ttype ResourceIdleSnapshot,\n\ttype ResourceLoadingErrorSnapshot,\n\ttype ResourceLoadingSnapshot,\n\ttype ResourceReloadingSnapshot,\n\ttype ResourceResolvedSnapshot,\n\ttype ResourceSnapshot,\n\tResourceStatus,\n\ttype ResourceTrait,\n\ttype ResourceWhenValueOptions,\n} from \"../signals/types\";\n\nexport interface RxResourceStreamContext<T, R> {\n\treadonly request: R;\n\treadonly previous: ResourceSnapshot<T>;\n\treadonly cancellationToken: CancellationTokenTrait;\n}\n\nexport interface RxResourceOptions<T, R = undefined> {\n\treadonly request?: ReadableSignalTrait<R | undefined> | (() => R | undefined);\n\treadonly stream: (\n\t\tcontext: RxResourceStreamContext<T, R>,\n\t) => ObservableInput<T>;\n}\n\nabstract class RxResourceBase<T>\n\timplements ResourceTrait<T>, InteropObservableTrait<ResourceSnapshot<T>>\n{\n\tabstract readonly snapshot: ReadableSignalTrait<ResourceSnapshot<T>>;\n\treadonly value: RxComputedSignalCompat<T>;\n\treadonly status: RxComputedSignalCompat<ResourceStatus>;\n\treadonly error: RxComputedSignalCompat<unknown | undefined>;\n\treadonly isLoading: RxComputedSignalCompat<boolean>;\n\tprotected readonly destroyed = RxStateSignal.fromInitialValue(false);\n\tprotected readonly destroyed$ = from(this.destroyed).pipe(\n\t\tfilter((value): value is true => value),\n\t\ttake(1),\n\t);\n\n\tprotected constructor() {\n\t\tthis.value = RxComputedSignal.computed(() => {\n\t\t\tconst snapshot = this.snapshot.get();\n\t\t\tif (\n\t\t\t\tsnapshot.status === ResourceStatus.Resolved ||\n\t\t\t\tsnapshot.status === ResourceStatus.Reloading\n\t\t\t) {\n\t\t\t\treturn snapshot.value;\n\t\t\t}\n\t\t\tif (\n\t\t\t\tsnapshot.status === ResourceStatus.LoadingError ||\n\t\t\t\tsnapshot.status === ResourceStatus.Error\n\t\t\t) {\n\t\t\t\tthrow snapshot.error;\n\t\t\t}\n\t\t\tthrow ResourceError.valueUnavailable({ status: snapshot.status });\n\t\t});\n\t\tthis.status = RxComputedSignal.computed(() => this.snapshot.get().status);\n\t\tthis.error = RxComputedSignal.computed(() => {\n\t\t\tconst snapshot = this.snapshot.get();\n\t\t\treturn snapshot.status === ResourceStatus.LoadingError ||\n\t\t\t\tsnapshot.status === ResourceStatus.Error\n\t\t\t\t? snapshot.error\n\t\t\t\t: undefined;\n\t\t});\n\t\tthis.isLoading = RxComputedSignal.computed(() => {\n\t\t\tconst status = this.snapshot.get().status;\n\t\t\treturn (\n\t\t\t\tstatus === ResourceStatus.Loading || status === ResourceStatus.Reloading\n\t\t\t);\n\t\t});\n\t}\n\n\thasValue(): boolean {\n\t\tconst status = this.snapshot.get().status;\n\t\treturn (\n\t\t\tstatus === ResourceStatus.Resolved || status === ResourceStatus.Reloading\n\t\t);\n\t}\n\n\tasync whenValue(options?: ResourceWhenValueOptions): Promise<T> {\n\t\treturn whenResourceSnapshotValue(this.snapshot, options);\n\t}\n\n\tdispose(): void {\n\t\tthis.destroyed.set(true);\n\t}\n\n\t[SYMBOL_DISPOSE](): void {\n\t\tthis.dispose();\n\t}\n\n\t[SYMBOL_OBSERVABLE](): RxEventStream<ResourceSnapshot<T>> {\n\t\treturn this.snapshot[SYMBOL_OBSERVABLE]() as RxEventStream<\n\t\t\tResourceSnapshot<T>\n\t\t>;\n\t}\n}\n\nexport class RxResource<T, R = undefined> extends RxResourceBase<T> {\n\treadonly snapshot: RxStateSignalCompat<ResourceSnapshot<T>>;\n\n\tconstructor(private readonly options: RxResourceOptions<T, R>) {\n\t\tsuper();\n\t\tthis.snapshot = RxStateSignal.fromInitialValue<ResourceSnapshot<T>>({\n\t\t\tstatus: ResourceStatus.Idle,\n\t\t});\n\t\tthis.destroyed$.subscribe(() => {\n\t\t\tthis.snapshot.set({ status: ResourceStatus.Idle });\n\t\t});\n\t\tthis.connect();\n\t}\n\n\tprivate connect(): void {\n\t\tconst configuredRequest = this.options.request;\n\t\tconst requestObservable: Observable<R | undefined> =\n\t\t\tconfiguredRequest && typeof configuredRequest !== \"function\"\n\t\t\t\t? from(configuredRequest).pipe(\n\t\t\t\t\t\tdistinctUntilChanged(\n\t\t\t\t\t\t\tconfiguredRequest.equals as (\n\t\t\t\t\t\t\t\tleft: R | undefined,\n\t\t\t\t\t\t\t\tright: R | undefined,\n\t\t\t\t\t\t\t) => boolean,\n\t\t\t\t\t\t),\n\t\t\t\t\t)\n\t\t\t\t: of(\n\t\t\t\t\t\tconfiguredRequest && typeof configuredRequest === \"function\"\n\t\t\t\t\t\t\t? configuredRequest()\n\t\t\t\t\t\t\t: (undefined as R),\n\t\t\t\t\t);\n\t\tconst requestControlsLoading = configuredRequest !== undefined;\n\n\t\trequestObservable\n\t\t\t.pipe(\n\t\t\t\tswitchMap((request) => {\n\t\t\t\t\tif (requestControlsLoading && request === undefined) {\n\t\t\t\t\t\treturn of<ResourceSnapshot<T>>({ status: ResourceStatus.Idle });\n\t\t\t\t\t}\n\t\t\t\t\tconst previous = this.snapshot.get();\n\t\t\t\t\tconst loadingSnapshot = reduceResourceSnapshot(previous, {\n\t\t\t\t\t\tkind: ResourceSnapshotUpdateKind.Load,\n\t\t\t\t\t});\n\t\t\t\t\tthis.snapshot.set(loadingSnapshot);\n\n\t\t\t\t\tconst loadCancellation = createCancellationTokenSource();\n\t\t\t\t\treturn from(\n\t\t\t\t\t\tthis.options.stream({\n\t\t\t\t\t\t\trequest: request as R,\n\t\t\t\t\t\t\tprevious,\n\t\t\t\t\t\t\tcancellationToken: loadCancellation.token,\n\t\t\t\t\t\t}),\n\t\t\t\t\t).pipe(\n\t\t\t\t\t\tmap((value) =>\n\t\t\t\t\t\t\treduceResourceSnapshot(loadingSnapshot, {\n\t\t\t\t\t\t\t\tkind: ResourceSnapshotUpdateKind.Resolve,\n\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tcatchError((error: unknown) =>\n\t\t\t\t\t\t\tof(\n\t\t\t\t\t\t\t\treduceResourceSnapshot(loadingSnapshot, {\n\t\t\t\t\t\t\t\t\tkind: ResourceSnapshotUpdateKind.Fail,\n\t\t\t\t\t\t\t\t\terror,\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tfinalize(() => loadCancellation.cancel()),\n\t\t\t\t\t);\n\t\t\t\t}),\n\t\t\t\ttakeUntil(this.destroyed$),\n\t\t\t)\n\t\t\t.subscribe((snapshot) => this.snapshot.set(snapshot));\n\t}\n\n\tstatic create<T, R = undefined>(\n\t\toptions: RxResourceOptions<T, R>,\n\t): RxResource<T, R> {\n\t\treturn new RxResource(options);\n\t}\n}\n\nclass RxSnapshotResource<T> extends RxResourceBase<T> {\n\treadonly snapshot: RxComputedSignalCompat<ResourceSnapshot<T>>;\n\n\tconstructor(source: () => ResourceSnapshot<T>) {\n\t\tsuper();\n\t\tthis.snapshot = RxComputedSignal.computed(() =>\n\t\t\tthis.destroyed.get() ? { status: ResourceStatus.Idle } : source(),\n\t\t);\n\t}\n}\n\nexport function resourceFromSnapshots<T>(\n\tsource: () => ResourceSnapshot<T>,\n): WithInteropObservableTraitCompat<ResourceTrait<T>, ResourceSnapshot<T>> {\n\treturn new RxSnapshotResource(source);\n}\n\nexport function mapResource<T, U>(\n\tsource: ResourceTrait<T>,\n\tmapValue: (value: T) => U,\n): WithInteropObservableTraitCompat<ResourceTrait<U>, ResourceSnapshot<U>> {\n\treturn resourceFromSnapshots(() => {\n\t\tconst snapshot = source.snapshot.get();\n\t\tswitch (snapshot.status) {\n\t\t\tcase ResourceStatus.Idle:\n\t\t\tcase ResourceStatus.Loading:\n\t\t\tcase ResourceStatus.LoadingError:\n\t\t\t\treturn snapshot;\n\t\t\tcase ResourceStatus.Reloading:\n\t\t\tcase ResourceStatus.Resolved:\n\t\t\t\treturn { status: snapshot.status, value: mapValue(snapshot.value) };\n\t\t\tcase ResourceStatus.Error:\n\t\t\t\treturn {\n\t\t\t\t\tstatus: ResourceStatus.Error,\n\t\t\t\t\tvalue: mapValue(snapshot.value),\n\t\t\t\t\terror: snapshot.error,\n\t\t\t\t};\n\t\t}\n\t});\n}\n\nexport function rxResource<T, R = undefined>(\n\toptions: RxResourceOptions<T, R>,\n): WithInteropObservableTraitCompat<ResourceTrait<T>, ResourceSnapshot<T>> {\n\treturn new RxResource(options);\n}\n"],"mappings":";;;;;;AAQA,MAAa,eAAe;CAC3B,MAAM;CACN,OAAO;CACP,aAAa;CACb,gBAAgB;CAChB,gBAAgB;AACjB;AAWA,MAAa,wBAAwB;CACpC,SAAS;CACT,SAAS;CACT,QAAQ;AACT;;AAyCA,MAAa,kBAAkB;CAC9B,eAAe;CACf,WAAW;CACX,QAAQ;CACR,UAAU;CACV,SAAS;CACT,eAAe;CACf,iBAAiB;CACjB,cAAc;CACd,WAAW;CACX,SAAS;CACT,UAAU;AACX;;AAMA,MAAa,oBAAoB;CAChC,WAAW;CACX,QAAQ;CACR,QAAQ;AACT;;;AClFA,MAAa,0CACZ;AA4BD,MAAM,qBAAqB,IAAI,IAAY,OAAO,OAAO,YAAY,CAAC;AAEtE,SAAS,iBAAiB,OAA8C;CACvE,OAAO,OAAO,UAAU,YAAY,mBAAmB,IAAI,KAAK,IAC5D,QACD,KAAA;AACJ;AAEA,SAAS,mBACR,MACA,QACkB;CAClB,QAAQ,MAAR;EACC,KAAK,mBACJ,OAAO,gBAAgB;EACxB,KAAK,gBACJ,OAAO,gBAAgB;EACxB,KAAK;EACL,KAAK,YACJ,OAAO,gBAAgB;EACxB,KAAK;EACL,KAAK,YACJ,OAAO,gBAAgB;EACxB,SACC,OAAO,WAAW,MACf,gBAAgB,kBAChB,WAAW,MACV,gBAAgB,eAChB,WAAW,MACV,gBAAgB,UAChB,UAAU,MACT,gBAAgB,SAChB,gBAAgB;CACxB;AACD;AAEA,SAAS,oBAAoB,MAA4C;CACxE,IAAI,CAAC,QAAQ,OAAO,SAAS,UAC5B;CAED,MAAM,SAAS;CACf,MAAM,Q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eAAkB;CACrD;CAEA,YAAY,QAAmC;EAC9C,MAAM;EACN,KAAK,WAAW,iBAAiB,eAChC,KAAK,UAAU,IAAI,IAAI,EAAE,QAAQ,eAAe,KAAK,IAAI,OAAO,CACjE;CACD;AACD;AAEA,SAAgB,sBACf,QAC0E;CAC1E,OAAO,IAAI,mBAAmB,MAAM;AACrC;AAEA,SAAgB,YACf,QACA,UAC0E;CAC1E,OAAO,4BAA4B;EAClC,MAAM,WAAW,OAAO,SAAS,IAAI;EACrC,QAAQ,SAAS,QAAjB;GACC,KAAK,eAAe;GACpB,KAAK,eAAe;GACpB,KAAK,eAAe,cACnB,OAAO;GACR,KAAK,eAAe;GACpB,KAAK,eAAe,UACnB,OAAO;IAAE,QAAQ,SAAS;IAAQ,OAAO,SAAS,SAAS,KAAK;GAAE;GACnE,KAAK,eAAe,OACnB,OAAO;IACN,QAAQ,eAAe;IACvB,OAAO,SAAS,SAAS,KAAK;IAC9B,OAAO,SAAS;GACjB;EACF;CACD,CAAC;AACF;AAEA,SAAgB,WACf,SAC0E;CAC1E,OAAO,IAAI,WAAW,OAAO;AAC9B"}
|
package/dist/server/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Lt as CreateFoundationEnvironmentOptions, Vt as FoundationEnvironment, hn as BaseTransportTrait } from "../index-
|
|
1
|
+
import { Lt as CreateFoundationEnvironmentOptions, Vt as FoundationEnvironment, hn as BaseTransportTrait } from "../index-1mOA_4l_.mjs";
|
|
2
2
|
//#region src/server/transport.d.ts
|
|
3
3
|
interface ServerRequestContext {
|
|
4
4
|
headers: Record<string, string>;
|
package/dist/server/index.mjs
CHANGED
package/dist/test/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as IdleCallbackTrait, T as TimeTrait, on as SecuritydeptProvider, wt as EventSubjectTrait } from "../index-
|
|
2
|
-
import { Bt as EnvironmentValidators, Cr as PopupAttachResult, Er as PopupTrait, Hn as RouterTrait, Lt as CreateFoundationEnvironmentOptions, Mn as WithTraitInputValidator, Oi as PageLifecycleTrait, Tr as PopupOpenOptions, Vn as RouterNavigationRequest, Vt as FoundationEnvironment, _n as HttpResponse, ar as UriReferenceString, dn as SyncStorageTrait, gn as HttpRequest, hn as BaseTransportTrait } from "../index-
|
|
1
|
+
import { C as IdleCallbackTrait, T as TimeTrait, on as SecuritydeptProvider, wt as EventSubjectTrait } from "../index-_1lhMnf9.mjs";
|
|
2
|
+
import { Bt as EnvironmentValidators, Cr as PopupAttachResult, Er as PopupTrait, Hn as RouterTrait, Lt as CreateFoundationEnvironmentOptions, Mn as WithTraitInputValidator, Oi as PageLifecycleTrait, Tr as PopupOpenOptions, Vn as RouterNavigationRequest, Vt as FoundationEnvironment, _n as HttpResponse, ar as UriReferenceString, dn as SyncStorageTrait, gn as HttpRequest, hn as BaseTransportTrait } from "../index-1mOA_4l_.mjs";
|
|
3
3
|
//#region src/test/environment.d.ts
|
|
4
4
|
type EnvironmentCreatorOptions = {
|
|
5
5
|
providers?: readonly SecuritydeptProvider[];
|
package/dist/test/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { H as ClientError, U as ClientErrorKind, j as SYMBOL_OBSERVABLE } from "../rx-
|
|
2
|
-
import { $ as notMissingProvider, I as PopupAttachFailureReason, O as RouterNavigationMode, Q as getSecuritydeptProviderToken, R as throwValidationClientError, T as TIME_TRAIT_TOKEN, Z as createProviderIfTokenMissing, c as createInMemoryRecordStore, h as TRANSPORT_TRAIT_TOKEN, t as createFoundationEnvironment, z as validateTraitInput } from "../create-
|
|
1
|
+
import { H as ClientError, U as ClientErrorKind, j as SYMBOL_OBSERVABLE } from "../rx-82t7QNQL.mjs";
|
|
2
|
+
import { $ as notMissingProvider, I as PopupAttachFailureReason, O as RouterNavigationMode, Q as getSecuritydeptProviderToken, R as throwValidationClientError, T as TIME_TRAIT_TOKEN, Z as createProviderIfTokenMissing, c as createInMemoryRecordStore, h as TRANSPORT_TRAIT_TOKEN, t as createFoundationEnvironment, z as validateTraitInput } from "../create-BBdGfVCt.mjs";
|
|
3
3
|
import { n as UriReferenceString } from "../uri-string-BPNbIMgv.mjs";
|
|
4
4
|
import { type } from "arktype";
|
|
5
5
|
//#region src/test/time.ts
|
package/dist/web/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Ct as EventStreamTrait, T as TimeTrait, ln as WithTraitDeps } from "../index-
|
|
2
|
-
import { Bt as EnvironmentValidators, Er as PopupTrait, Hn as RouterTrait, Lt as CreateFoundationEnvironmentOptions, Mn as WithTraitInputValidator, Vt as FoundationEnvironment, dn as SyncStorageTrait } from "../index-
|
|
3
|
-
import { _ as createPageResumeSource, a as NativeWebWindowLike, b as fromStorageEvent, c as WebNavigationRouter, d as createPageLifecycleForNativeWeb, f as CreatePageResumeSourceOptions, g as PageResumeWindowTarget, h as PageResumeTriggerKind, i as NativeWebRouter, l as createRouterForNativeWeb, m as PageResumeEvent, n as NativeWebLocationLike, o as RouterForNativeWebCreateOptions, p as PageResumeDocumentTarget, r as NativeWebNavigationLike, s as WebLegacyRouter, t as NativeWebHistoryLike, u as PageLifecycleForNativeWebCreateOptions, v as FromStorageEventOptions, y as StorageEventTarget } from "../index-
|
|
1
|
+
import { Ct as EventStreamTrait, T as TimeTrait, ln as WithTraitDeps } from "../index-_1lhMnf9.mjs";
|
|
2
|
+
import { Bt as EnvironmentValidators, Er as PopupTrait, Hn as RouterTrait, Lt as CreateFoundationEnvironmentOptions, Mn as WithTraitInputValidator, Vt as FoundationEnvironment, dn as SyncStorageTrait } from "../index-1mOA_4l_.mjs";
|
|
3
|
+
import { _ as createPageResumeSource, a as NativeWebWindowLike, b as fromStorageEvent, c as WebNavigationRouter, d as createPageLifecycleForNativeWeb, f as CreatePageResumeSourceOptions, g as PageResumeWindowTarget, h as PageResumeTriggerKind, i as NativeWebRouter, l as createRouterForNativeWeb, m as PageResumeEvent, n as NativeWebLocationLike, o as RouterForNativeWebCreateOptions, p as PageResumeDocumentTarget, r as NativeWebNavigationLike, s as WebLegacyRouter, t as NativeWebHistoryLike, u as PageLifecycleForNativeWebCreateOptions, v as FromStorageEventOptions, y as StorageEventTarget } from "../index-kvxJ3X0n.mjs";
|
|
4
4
|
//#region src/web/popup.d.ts
|
|
5
5
|
interface PopupForNativeWebCreateOptions {
|
|
6
6
|
window?: unknown;
|
package/dist/web/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { A as RxEventSubject, H as ClientError, K as UserRecovery, U as ClientErrorKind, h as createAsyncSchedulerWithTimestampProvider, k as RxEventStream } from "../rx-
|
|
2
|
-
import { n as PopupServerWindowHandle, o as PopupErrorCode, t as PopupClientWindowHandle } from "../handle-
|
|
3
|
-
import { $ as notMissingProvider, E as ROUTER_TRAIT_TOKEN, F as POPUP_TRAIT_TOKEN, H as PAGE_LIFECYCLE_TRAIT_TOKEN, I as PopupAttachFailureReason, Q as getSecuritydeptProviderToken, R as throwValidationClientError, T as TIME_TRAIT_TOKEN, V as validateWithSchemaSync, Z as createProviderIfTokenMissing, d as SESSION_STORAGE_TRAIT_TOKEN, f as StorageChangeEventOrigin, l as PERSISTENT_STORAGE_TRAIT_TOKEN, t as createFoundationEnvironment, z as validateTraitInput } from "../create-
|
|
4
|
-
import { a as createPageLifecycleForNativeWeb, i as createRouterForNativeWeb, n as WebLegacyRouter, o as PageResumeTriggerKind, r as WebNavigationRouter, s as createPageResumeSource, t as NativeWebRouter } from "../router-
|
|
1
|
+
import { A as RxEventSubject, H as ClientError, K as UserRecovery, U as ClientErrorKind, h as createAsyncSchedulerWithTimestampProvider, k as RxEventStream } from "../rx-82t7QNQL.mjs";
|
|
2
|
+
import { n as PopupServerWindowHandle, o as PopupErrorCode, t as PopupClientWindowHandle } from "../handle-DCHUG9HI.mjs";
|
|
3
|
+
import { $ as notMissingProvider, E as ROUTER_TRAIT_TOKEN, F as POPUP_TRAIT_TOKEN, H as PAGE_LIFECYCLE_TRAIT_TOKEN, I as PopupAttachFailureReason, Q as getSecuritydeptProviderToken, R as throwValidationClientError, T as TIME_TRAIT_TOKEN, V as validateWithSchemaSync, Z as createProviderIfTokenMissing, d as SESSION_STORAGE_TRAIT_TOKEN, f as StorageChangeEventOrigin, l as PERSISTENT_STORAGE_TRAIT_TOKEN, t as createFoundationEnvironment, z as validateTraitInput } from "../create-BBdGfVCt.mjs";
|
|
4
|
+
import { a as createPageLifecycleForNativeWeb, i as createRouterForNativeWeb, n as WebLegacyRouter, o as PageResumeTriggerKind, r as WebNavigationRouter, s as createPageResumeSource, t as NativeWebRouter } from "../router-BawAJQ1s.mjs";
|
|
5
5
|
import { filter, from, fromEventPattern, map, merge, take, timer } from "rxjs";
|
|
6
6
|
import { type } from "arktype";
|
|
7
7
|
//#region src/web/events/from-storage.ts
|
package/dist/webext/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Bt as EnvironmentValidators, Hn as RouterTrait, Lt as CreateFoundationEnvironmentOptions, Mn as WithTraitInputValidator, Vt as FoundationEnvironment, ln as StorageTrait } from "../index-
|
|
2
|
-
import { o as RouterForNativeWebCreateOptions, u as PageLifecycleForNativeWebCreateOptions } from "../index-
|
|
1
|
+
import { Bt as EnvironmentValidators, Hn as RouterTrait, Lt as CreateFoundationEnvironmentOptions, Mn as WithTraitInputValidator, Vt as FoundationEnvironment, ln as StorageTrait } from "../index-1mOA_4l_.mjs";
|
|
2
|
+
import { o as RouterForNativeWebCreateOptions, u as PageLifecycleForNativeWebCreateOptions } from "../index-kvxJ3X0n.mjs";
|
|
3
3
|
//#region src/webext/router.d.ts
|
|
4
4
|
interface WebExtRouterBrowserLike {
|
|
5
5
|
runtime?: {
|
package/dist/webext/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { H as ClientError, U as ClientErrorKind } from "../rx-
|
|
2
|
-
import { $ as notMissingProvider, E as ROUTER_TRAIT_TOKEN, H as PAGE_LIFECYCLE_TRAIT_TOKEN, Q as getSecuritydeptProviderToken, R as throwValidationClientError, V as validateWithSchemaSync, Z as createProviderIfTokenMissing, d as SESSION_STORAGE_TRAIT_TOKEN, l as PERSISTENT_STORAGE_TRAIT_TOKEN, t as createFoundationEnvironment, z as validateTraitInput } from "../create-
|
|
3
|
-
import { a as createPageLifecycleForNativeWeb, i as createRouterForNativeWeb } from "../router-
|
|
1
|
+
import { H as ClientError, U as ClientErrorKind } from "../rx-82t7QNQL.mjs";
|
|
2
|
+
import { $ as notMissingProvider, E as ROUTER_TRAIT_TOKEN, H as PAGE_LIFECYCLE_TRAIT_TOKEN, Q as getSecuritydeptProviderToken, R as throwValidationClientError, V as validateWithSchemaSync, Z as createProviderIfTokenMissing, d as SESSION_STORAGE_TRAIT_TOKEN, l as PERSISTENT_STORAGE_TRAIT_TOKEN, t as createFoundationEnvironment, z as validateTraitInput } from "../create-BBdGfVCt.mjs";
|
|
3
|
+
import { a as createPageLifecycleForNativeWeb, i as createRouterForNativeWeb } from "../router-BawAJQ1s.mjs";
|
|
4
4
|
import { type } from "arktype";
|
|
5
5
|
//#region src/webext/router.ts
|
|
6
6
|
const WebExtRuntimeRouterLikeSchema = type({ getURL: "Function" });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@securitydept/client",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Client of the SecurityDept TypeScript SDK, a layered authentication and authorization toolkit built as reusable Rust crates, a TypeScript client SDK workspace, and reference server/web apps.",
|
|
5
5
|
"author": "Zhou Yeheng <root@aitiotekt.com>",
|
|
6
6
|
"license": "MIT",
|