@securitydept/client 0.3.0-beta.5 → 0.3.0-beta.7
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-Bm-XRA3G.mjs → create-i5VyYgN6.mjs} +68 -652
- package/dist/create-i5VyYgN6.mjs.map +1 -0
- package/dist/handle-DwMgqe7R.mjs +638 -0
- package/dist/handle-DwMgqe7R.mjs.map +1 -0
- package/dist/{index-D5mW18cM.d.mts → index-B9SEJGU2.d.mts} +108 -89
- package/dist/{index-BT-u3qNI.d.mts → index-BjCFWcmV.d.mts} +3 -4
- package/dist/{index-Ch8lrE44.d.mts → index-CFAJ969E.d.mts} +81 -32
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +99 -99
- package/dist/index.mjs.map +1 -1
- package/dist/{router-BJ8LqNJ1.mjs → router-at5bTdJQ.mjs} +4 -4
- package/dist/{router-BJ8LqNJ1.mjs.map → router-at5bTdJQ.mjs.map} +1 -1
- package/dist/rx/index.d.mts +1 -2
- package/dist/rx/index.mjs +1 -1
- package/dist/{rx-BoB32Dzg.mjs → rx-DM6Ouv-m.mjs} +21 -8
- package/dist/rx-DM6Ouv-m.mjs.map +1 -0
- package/dist/server/index.d.mts +1 -2
- package/dist/server/index.mjs +1 -1
- package/dist/server/index.mjs.map +1 -1
- package/dist/test/index.d.mts +2 -3
- package/dist/test/index.mjs +3 -3
- package/dist/test/index.mjs.map +1 -1
- package/dist/{uri-string-BfnIT4gJ.mjs → uri-string-BPNbIMgv.mjs} +5 -3
- package/dist/{uri-string-BfnIT4gJ.mjs.map → uri-string-BPNbIMgv.mjs.map} +1 -1
- package/dist/web/index.d.mts +3 -4
- package/dist/web/index.mjs +27 -21
- package/dist/web/index.mjs.map +1 -1
- package/dist/webext/index.d.mts +2 -3
- package/dist/webext/index.mjs +12 -10
- package/dist/webext/index.mjs.map +1 -1
- package/package.json +14 -5
- package/dist/create-Bm-XRA3G.mjs.map +0 -1
- package/dist/rx-BoB32Dzg.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handle-DwMgqe7R.mjs","names":["UserRecoveryValue","ClientErrorKindValue","defineType"],"sources":["../src/span/attributes.ts","../src/errors/presentation-descriptor.ts","../src/signals/signal.ts","../src/popup/errors.ts","../src/protocol/json-rpc/types.ts","../src/protocol/json-rpc/create.ts","../src/popup/session.ts","../src/popup/handle.ts"],"sourcesContent":["export const SpanSharedAttributeName = {\n\tClientName: \"client.name\",\n\tClientId: \"client.id\",\n\tOperationName: \"operation.name\",\n} as const;\n\nexport type SpanSharedAttributeName =\n\t(typeof SpanSharedAttributeName)[keyof typeof SpanSharedAttributeName];\n","import { SpanSharedAttributeName } from \"../span/attributes\";\nimport { ClientError } from \"./client-error\";\nimport {\n\ttype ClientErrorContextFormatter,\n\ttype ClientErrorKind,\n\tClientErrorKind as ClientErrorKindValue,\n\ttype ErrorPresentationDescriptor,\n\tErrorPresentationTone,\n\ttype ErrorRecoveryActionDescriptor,\n\ttype ReadErrorPresentationDescriptorOptions,\n\ttype UserRecovery,\n\tUserRecovery as UserRecoveryValue,\n} from \"./types\";\n\nconst DEFAULT_RECOVERY_LABELS: Record<UserRecovery, string> = {\n\t[UserRecoveryValue.None]: \"\",\n\t[UserRecoveryValue.Retry]: \"Try again\",\n\t[UserRecoveryValue.RestartFlow]: \"Restart flow\",\n\t[UserRecoveryValue.Reauthenticate]: \"Sign in again\",\n\t[UserRecoveryValue.ContactSupport]: \"Contact support\",\n};\n\nexport const formatClientErrorContext: ClientErrorContextFormatter = (\n\tcontext,\n) => {\n\tlet clientName: string | undefined;\n\tlet clientId: string | undefined;\n\tlet operationName: string | undefined;\n\tfor (const frame of context) {\n\t\tconst frameClientName =\n\t\t\tframe.attributes[SpanSharedAttributeName.ClientName];\n\t\tconst frameClientId = frame.attributes[SpanSharedAttributeName.ClientId];\n\t\tconst frameOperationName =\n\t\t\tframe.attributes[SpanSharedAttributeName.OperationName];\n\t\tif (typeof frameClientName === \"string\") {\n\t\t\tclientName = frameClientName;\n\t\t}\n\t\tif (typeof frameClientId === \"string\") {\n\t\t\tclientId = frameClientId;\n\t\t}\n\t\tif (typeof frameOperationName === \"string\") {\n\t\t\toperationName = frameOperationName;\n\t\t}\n\t}\n\tconst contextLabel = [clientName ?? clientId, operationName]\n\t\t.filter((value): value is string => Boolean(value))\n\t\t.join(\" · \");\n\treturn contextLabel || undefined;\n};\n\nexport function readErrorPresentationDescriptor(\n\terror: unknown,\n\toptions: ReadErrorPresentationDescriptorOptions = {},\n): ErrorPresentationDescriptor {\n\tif (!(error instanceof ClientError)) {\n\t\treturn {\n\t\t\tcode: null,\n\t\t\ttitle: options.fallbackTitle ?? \"Operation failed\",\n\t\t\tdescription:\n\t\t\t\toptions.fallbackDescription ??\n\t\t\t\t\"An unexpected error prevented the operation from completing.\",\n\t\t\trecovery: UserRecoveryValue.None,\n\t\t\ttone: ErrorPresentationTone.Danger,\n\t\t\tprimaryAction: null,\n\t\t};\n\t}\n\tconst clientError = error;\n\n\tconst code = clientError.presentation?.code ?? clientError.code;\n\tconst codePresentation = code ? options.codePresentations?.[code] : undefined;\n\tconst recovery =\n\t\tclientError.presentation?.recovery ??\n\t\tcodePresentation?.recovery ??\n\t\tclientError.recovery;\n\tconst generic = readGenericPresentation(clientError.kind);\n\n\tconst descriptor: ErrorPresentationDescriptor = {\n\t\tcode,\n\t\ttitle: codePresentation?.title ?? generic.title,\n\t\tdescription:\n\t\t\tclientError.presentation?.message ??\n\t\t\tcodePresentation?.description ??\n\t\t\tgeneric.description,\n\t\trecovery,\n\t\ttone:\n\t\t\tcodePresentation?.tone ?? readClientErrorTone(clientError.kind, recovery),\n\t\tprimaryAction: readPrimaryAction(recovery, options),\n\t};\n\tif (!clientError.spanContext || options.contextFormatter === null) {\n\t\treturn descriptor;\n\t}\n\tconst contextLabel = (options.contextFormatter ?? formatClientErrorContext)(\n\t\tclientError.spanContext,\n\t);\n\treturn contextLabel\n\t\t? { ...descriptor, title: `${contextLabel}: ${descriptor.title}` }\n\t\t: descriptor;\n}\n\nfunction readGenericPresentation(kind: ClientErrorKind | null): {\n\ttitle: string;\n\tdescription: string;\n} {\n\tswitch (kind) {\n\t\tcase ClientErrorKindValue.Unauthenticated:\n\t\t\treturn {\n\t\t\t\ttitle: \"Authentication required\",\n\t\t\t\tdescription: \"Sign in again to continue.\",\n\t\t\t};\n\t\tcase ClientErrorKindValue.Unauthorized:\n\t\t\treturn {\n\t\t\t\ttitle: \"Access denied\",\n\t\t\t\tdescription: \"You do not have permission to complete this operation.\",\n\t\t\t};\n\t\tcase ClientErrorKindValue.Cancelled:\n\t\t\treturn {\n\t\t\t\ttitle: \"Operation cancelled\",\n\t\t\t\tdescription: \"The operation was cancelled before it completed.\",\n\t\t\t};\n\t\tcase ClientErrorKindValue.Timeout:\n\t\t\treturn {\n\t\t\t\ttitle: \"Request timed out\",\n\t\t\t\tdescription: \"The operation did not complete in time.\",\n\t\t\t};\n\t\tcase ClientErrorKindValue.Configuration:\n\t\t\treturn {\n\t\t\t\ttitle: \"Configuration error\",\n\t\t\t\tdescription: \"The client is not configured to complete this operation.\",\n\t\t\t};\n\t\tcase ClientErrorKindValue.Storage:\n\t\t\treturn {\n\t\t\t\ttitle: \"Storage failed\",\n\t\t\t\tdescription: \"The client could not access required stored data.\",\n\t\t\t};\n\t\tcase ClientErrorKindValue.Transport:\n\t\t\treturn {\n\t\t\t\ttitle: \"Network request failed\",\n\t\t\t\tdescription: \"The client could not reach the service.\",\n\t\t\t};\n\t\tcase ClientErrorKindValue.Server:\n\t\t\treturn {\n\t\t\t\ttitle: \"Server request failed\",\n\t\t\t\tdescription: \"The service could not complete the request.\",\n\t\t\t};\n\t\tcase ClientErrorKindValue.Protocol:\n\t\t\treturn {\n\t\t\t\ttitle: \"Invalid response\",\n\t\t\t\tdescription:\n\t\t\t\t\t\"The service response did not satisfy the expected protocol.\",\n\t\t\t};\n\t\tcase ClientErrorKindValue.Authorization:\n\t\t\treturn {\n\t\t\t\ttitle: \"Authorization failed\",\n\t\t\t\tdescription: \"The authorization flow could not be completed.\",\n\t\t\t};\n\t\tdefault:\n\t\t\treturn {\n\t\t\t\ttitle: \"Operation failed\",\n\t\t\t\tdescription: \"The operation could not be completed.\",\n\t\t\t};\n\t}\n}\n\nfunction readClientErrorTone(\n\tkind: ClientErrorKind | null,\n\trecovery: UserRecovery,\n) {\n\tif (kind === ClientErrorKindValue.Cancelled) {\n\t\treturn ErrorPresentationTone.Neutral;\n\t}\n\tif (\n\t\tkind === ClientErrorKindValue.Unauthenticated ||\n\t\tkind === ClientErrorKindValue.Timeout ||\n\t\tkind === ClientErrorKindValue.Transport ||\n\t\tkind === ClientErrorKindValue.Server ||\n\t\trecovery === UserRecoveryValue.Retry ||\n\t\trecovery === UserRecoveryValue.RestartFlow ||\n\t\trecovery === UserRecoveryValue.Reauthenticate\n\t) {\n\t\treturn ErrorPresentationTone.Warning;\n\t}\n\treturn ErrorPresentationTone.Danger;\n}\n\nfunction readPrimaryAction(\n\trecovery: UserRecovery,\n\toptions: ReadErrorPresentationDescriptorOptions,\n): ErrorRecoveryActionDescriptor | null {\n\tif (recovery === UserRecoveryValue.None) {\n\t\treturn null;\n\t}\n\tconst label =\n\t\toptions.recoveryLabels?.[recovery] ?? DEFAULT_RECOVERY_LABELS[recovery];\n\tif (!label) {\n\t\treturn null;\n\t}\n\treturn {\n\t\trecovery,\n\t\tlabel,\n\t\thref: options.recoveryLinks?.[recovery] ?? null,\n\t};\n}\n","import { SYMBOL_OBSERVABLE } from \"../compat\";\nimport { RxStateSignal } from \"../rx/signal\";\nimport {\n\ttype ReadableSignalTrait,\n\ttype SignalOptions,\n\ttype WritableSignalTrait,\n} from \"./types\";\n\n/**\n * Minimal writable signal implementation.\n * `set()` always publishes a write. Equality-based value-version suppression is\n * handled by the underlying Rx signal for computed dependency validation.\n */\nexport function createSignal<T>(\n\tinitial: T,\n\toptions?: SignalOptions<T>,\n): WritableSignalTrait<T> {\n\treturn RxStateSignal.fromInitialValue(initial, options);\n}\n\n/**\n * Create a read-only view of a writable signal.\n */\nexport function readonlySignal<T>(\n\tsignal: WritableSignalTrait<T>,\n): ReadableSignalTrait<T> {\n\treturn signal;\n}\n\nexport function isSignalTrait<T>(obj: unknown): obj is ReadableSignalTrait<T> {\n\treturn (\n\t\ttypeof obj === \"object\" &&\n\t\tobj !== null &&\n\t\ttypeof (obj as ReadableSignalTrait<T>).equals === \"function\" &&\n\t\ttypeof (obj as ReadableSignalTrait<T>).get === \"function\" &&\n\t\ttypeof (obj as ReadableSignalTrait<T>).watchStream === \"function\" &&\n\t\ttypeof (obj as ReadableSignalTrait<T>)[SYMBOL_OBSERVABLE] === \"function\"\n\t);\n}\n","export const PopupErrorCode = {\n\tBlocked: \"popup.blocked\",\n\tClosed: \"popup.closed_by_user\",\n} as const;\n\nexport type PopupErrorCode =\n\t(typeof PopupErrorCode)[keyof typeof PopupErrorCode];\n\nexport function readPopupErrorPresentationDescriptor(\n\terror: unknown,\n\toptions: ReadErrorPresentationDescriptorOptions = {},\n): ErrorPresentationDescriptor {\n\treturn readErrorPresentationDescriptor(error, {\n\t\t...options,\n\t\tcodePresentations: {\n\t\t\t[PopupErrorCode.Blocked]: {\n\t\t\t\ttitle: \"Popup was blocked\",\n\t\t\t\tdescription:\n\t\t\t\t\t\"The browser blocked the popup window. Allow popups for this site, then try again.\",\n\t\t\t\trecovery: UserRecovery.Retry,\n\t\t\t\ttone: ErrorPresentationTone.Warning,\n\t\t\t},\n\t\t\t[PopupErrorCode.Closed]: {\n\t\t\t\ttitle: \"Popup was closed\",\n\t\t\t\tdescription:\n\t\t\t\t\t\"The popup window was closed before the operation completed. Start the flow again.\",\n\t\t\t\trecovery: UserRecovery.RestartFlow,\n\t\t\t\ttone: ErrorPresentationTone.Warning,\n\t\t\t},\n\t\t\t...options.codePresentations,\n\t\t},\n\t});\n}\n\nimport {\n\ttype ErrorPresentationDescriptor,\n\tErrorPresentationTone,\n\ttype ReadErrorPresentationDescriptorOptions,\n\treadErrorPresentationDescriptor,\n\tUserRecovery,\n} from \"../errors\";\n","import { type as defineType } from \"arktype\";\nimport { type DisposableTrait } from \"../../compat\";\nimport { type EventStreamTrait } from \"../../events\";\nimport { type TimeTrait } from \"../../scheduling/types\";\n\nexport const JsonRpcIdSchema = defineType(\"string | number\");\n\nexport type JsonRpcId = typeof JsonRpcIdSchema.infer;\n\nexport const JsonRpcErrorPayloadSchema = defineType({\n\tcode: \"number\",\n\tmessage: \"string\",\n\tdata: \"unknown?\",\n});\n\nexport type JsonRpcErrorPayload = typeof JsonRpcErrorPayloadSchema.infer;\n\nexport const JsonRpcRequestMessageSchema = defineType({\n\tjsonrpc: '\"2.0\"',\n\tid: JsonRpcIdSchema,\n\tmethod: \"string\",\n\tparams: \"unknown?\",\n});\n\nexport type JsonRpcRequestMessage = typeof JsonRpcRequestMessageSchema.infer;\n\nexport const JsonRpcNotificationMessageSchema = defineType({\n\tjsonrpc: '\"2.0\"',\n\tmethod: \"string\",\n\tparams: \"unknown?\",\n});\n\nexport type JsonRpcNotificationMessage =\n\ttypeof JsonRpcNotificationMessageSchema.infer;\n\nexport const JsonRpcSuccessResponseMessageSchema = defineType({\n\tjsonrpc: '\"2.0\"',\n\tid: JsonRpcIdSchema,\n\tresult: \"unknown\",\n});\n\nexport type JsonRpcSuccessResponseMessage =\n\ttypeof JsonRpcSuccessResponseMessageSchema.infer;\n\nexport const JsonRpcErrorResponseMessageSchema = defineType({\n\tjsonrpc: '\"2.0\"',\n\tid: JsonRpcIdSchema,\n\terror: JsonRpcErrorPayloadSchema,\n});\n\nexport type JsonRpcErrorResponseMessage =\n\ttypeof JsonRpcErrorResponseMessageSchema.infer;\n\nexport const JsonRpcMessageSchema = JsonRpcRequestMessageSchema.or(\n\tJsonRpcNotificationMessageSchema,\n)\n\t.or(JsonRpcSuccessResponseMessageSchema)\n\t.or(JsonRpcErrorResponseMessageSchema);\n\nexport type JsonRpcMessage = typeof JsonRpcMessageSchema.infer;\n\nexport interface JsonRpcRequestEvent {\n\tid: JsonRpcId;\n\tmethod: string;\n\tparams?: unknown;\n}\n\nexport interface JsonRpcNotificationEvent {\n\tmethod: string;\n\tparams?: unknown;\n}\n\nexport interface JsonRpcRequestOptions {\n\ttimeoutMs?: number;\n}\n\nexport interface JsonRpcSendOptions {\n\tsend(message: JsonRpcMessage): void;\n}\n\nexport interface CreateJsonRpcClientOptions extends JsonRpcSendOptions {\n\ttime: TimeTrait;\n\tdefaultRequestTimeoutMs?: number;\n}\n\nexport interface CreateJsonRpcServerOptions extends JsonRpcSendOptions {}\n\nexport interface CreateJsonRpcServerAndClientOptions\n\textends JsonRpcSendOptions {\n\ttime: TimeTrait;\n\tdefaultRequestTimeoutMs?: number;\n}\n\nexport interface JsonRpcClientTrait extends DisposableTrait {\n\treadonly onNotification: EventStreamTrait<JsonRpcNotificationEvent>;\n\trequest<TResult = unknown>(\n\t\tmethod: string,\n\t\tparams?: unknown,\n\t\toptions?: JsonRpcRequestOptions,\n\t): Promise<TResult>;\n\tnotify(method: string, params?: unknown): void;\n\treceive(message: unknown): void;\n\trejectAllPendingRequests(reason: unknown): void;\n}\n\nexport interface JsonRpcServerTrait extends DisposableTrait {\n\treadonly onRequest: EventStreamTrait<JsonRpcRequestEvent>;\n\treadonly onNotification: EventStreamTrait<JsonRpcNotificationEvent>;\n\tnotify(method: string, params?: unknown): void;\n\treceive(message: unknown): void;\n\trespondSuccess(id: JsonRpcId, result: unknown): void;\n\trespondError(id: JsonRpcId, error: JsonRpcErrorPayload): void;\n}\n\nexport interface JsonRpcServerAndClientTrait\n\textends JsonRpcClientTrait,\n\t\tJsonRpcServerTrait {}\n","import { SYMBOL_DISPOSE } from \"../../compat\";\nimport { type EventStreamTrait } from \"../../events\";\nimport { RxEventSubject } from \"../../rx/event\";\nimport { validateWithSchemaSync } from \"../../validation\";\nimport {\n\ttype CreateJsonRpcClientOptions,\n\ttype CreateJsonRpcServerAndClientOptions,\n\ttype CreateJsonRpcServerOptions,\n\ttype JsonRpcClientTrait,\n\ttype JsonRpcErrorPayload,\n\ttype JsonRpcErrorResponseMessage,\n\ttype JsonRpcId,\n\ttype JsonRpcMessage,\n\tJsonRpcMessageSchema,\n\ttype JsonRpcNotificationEvent,\n\ttype JsonRpcNotificationMessage,\n\ttype JsonRpcRequestEvent,\n\ttype JsonRpcRequestMessage,\n\ttype JsonRpcRequestOptions,\n\ttype JsonRpcServerAndClientTrait,\n\ttype JsonRpcServerTrait,\n\ttype JsonRpcSuccessResponseMessage,\n} from \"./types\";\n\ntype JsonRpcResponseMessage =\n\t| JsonRpcSuccessResponseMessage\n\t| JsonRpcErrorResponseMessage;\n\ninterface PendingRequest {\n\tmethod: string;\n\treject(reason: unknown): void;\n\tresolve(value: unknown): void;\n\ttimeoutHandle?: unknown;\n}\n\nexport function createJsonRpcClient(\n\toptions: CreateJsonRpcClientOptions,\n): JsonRpcClientTrait {\n\treturn new JsonRpcClient(options);\n}\n\nexport function createJsonRpcServer(\n\toptions: CreateJsonRpcServerOptions,\n): JsonRpcServerTrait {\n\treturn new JsonRpcServer(options);\n}\n\nexport function createJsonRpcServerAndClient(\n\toptions: CreateJsonRpcServerAndClientOptions,\n): JsonRpcServerAndClientTrait {\n\treturn new JsonRpcServerAndClient(options);\n}\n\nclass JsonRpcClient implements JsonRpcClientTrait {\n\treadonly onNotification: EventStreamTrait<JsonRpcNotificationEvent>;\n\n\tprivate readonly notificationSubject =\n\t\tnew RxEventSubject<JsonRpcNotificationEvent>();\n\tprivate readonly pendingRequests = new Map<JsonRpcId, PendingRequest>();\n\tprivate disposed = false;\n\tprivate nextRequestId = 1;\n\n\tconstructor(private readonly options: CreateJsonRpcClientOptions) {\n\t\tthis.onNotification = this.notificationSubject;\n\t}\n\n\trequest<TResult = unknown>(\n\t\tmethod: string,\n\t\tparams?: unknown,\n\t\trequestOptions: JsonRpcRequestOptions = {},\n\t): Promise<TResult> {\n\t\tif (this.disposed) {\n\t\t\treturn Promise.reject(createJsonRpcDisposedError(\"client\"));\n\t\t}\n\n\t\tconst id = this.nextRequestId++;\n\t\tconst timeoutMs =\n\t\t\trequestOptions.timeoutMs ?? this.options.defaultRequestTimeoutMs;\n\n\t\treturn new Promise<TResult>((resolve, reject) => {\n\t\t\tconst pendingRequest: PendingRequest = {\n\t\t\t\tmethod,\n\t\t\t\treject,\n\t\t\t\tresolve,\n\t\t\t};\n\n\t\t\tif (timeoutMs !== undefined) {\n\t\t\t\tpendingRequest.timeoutHandle = this.options.time.setTimeout(() => {\n\t\t\t\t\tthis.pendingRequests.delete(id);\n\t\t\t\t\treject(new Error(`JSON-RPC request timed out for ${method}.`));\n\t\t\t\t}, timeoutMs);\n\t\t\t}\n\n\t\t\tthis.pendingRequests.set(id, pendingRequest);\n\n\t\t\ttry {\n\t\t\t\tthis.options.send({\n\t\t\t\t\tjsonrpc: \"2.0\",\n\t\t\t\t\tid,\n\t\t\t\t\tmethod,\n\t\t\t\t\tparams,\n\t\t\t\t} satisfies JsonRpcRequestMessage);\n\t\t\t} catch (error) {\n\t\t\t\tthis.clearPendingRequest(id);\n\t\t\t\treject(error);\n\t\t\t}\n\t\t});\n\t}\n\n\tnotify(method: string, params?: unknown): void {\n\t\tif (this.disposed) {\n\t\t\treturn;\n\t\t}\n\t\tthis.options.send({\n\t\t\tjsonrpc: \"2.0\",\n\t\t\tmethod,\n\t\t\tparams,\n\t\t} satisfies JsonRpcNotificationMessage);\n\t}\n\n\treceive(message: unknown): void {\n\t\tif (this.disposed) {\n\t\t\treturn;\n\t\t}\n\n\t\tfor (const parsedMessage of parseIncomingMessages(message)) {\n\t\t\tif (isJsonRpcResponseMessage(parsedMessage)) {\n\t\t\t\tthis.resolvePendingRequest(parsedMessage);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (isJsonRpcNotificationMessage(parsedMessage)) {\n\t\t\t\tthis.notificationSubject.next({\n\t\t\t\t\tmethod: parsedMessage.method,\n\t\t\t\t\tparams: parsedMessage.params,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\trejectAllPendingRequests(reason: unknown): void {\n\t\tfor (const [id, pendingRequest] of this.pendingRequests) {\n\t\t\tthis.clearPendingRequest(id);\n\t\t\tpendingRequest.reject(reason);\n\t\t}\n\t}\n\n\tdispose(): void {\n\t\tif (this.disposed) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.disposed = true;\n\t\tthis.rejectAllPendingRequests(new Error(\"JSON-RPC client disposed.\"));\n\t\tthis.notificationSubject.complete();\n\t}\n\n\t[SYMBOL_DISPOSE](): void {\n\t\tthis.dispose();\n\t}\n\n\tprivate resolvePendingRequest(message: JsonRpcResponseMessage): void {\n\t\tconst pendingRequest = this.pendingRequests.get(message.id);\n\t\tif (!pendingRequest) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.clearPendingRequest(message.id);\n\n\t\tif (\"error\" in message) {\n\t\t\tpendingRequest.reject(\n\t\t\t\tnew Error(\n\t\t\t\t\t`JSON-RPC request failed for ${pendingRequest.method}: ${message.error.message}`,\n\t\t\t\t),\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tpendingRequest.resolve(message.result);\n\t}\n\n\tprivate clearPendingRequest(id: JsonRpcId): void {\n\t\tconst pendingRequest = this.pendingRequests.get(id);\n\t\tif (!pendingRequest) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (pendingRequest.timeoutHandle !== undefined) {\n\t\t\tthis.options.time.clearTimeout(pendingRequest.timeoutHandle);\n\t\t}\n\n\t\tthis.pendingRequests.delete(id);\n\t}\n}\n\nclass JsonRpcServer implements JsonRpcServerTrait {\n\treadonly onRequest: EventStreamTrait<JsonRpcRequestEvent>;\n\treadonly onNotification: EventStreamTrait<JsonRpcNotificationEvent>;\n\n\tprivate readonly requestSubject = new RxEventSubject<JsonRpcRequestEvent>();\n\tprivate readonly notificationSubject =\n\t\tnew RxEventSubject<JsonRpcNotificationEvent>();\n\tprivate disposed = false;\n\n\tconstructor(private readonly options: CreateJsonRpcServerOptions) {\n\t\tthis.onRequest = this.requestSubject;\n\t\tthis.onNotification = this.notificationSubject;\n\t}\n\n\tnotify(method: string, params?: unknown): void {\n\t\tif (this.disposed) {\n\t\t\treturn;\n\t\t}\n\t\tthis.options.send({\n\t\t\tjsonrpc: \"2.0\",\n\t\t\tmethod,\n\t\t\tparams,\n\t\t} satisfies JsonRpcNotificationMessage);\n\t}\n\n\treceive(message: unknown): void {\n\t\tif (this.disposed) {\n\t\t\treturn;\n\t\t}\n\n\t\tfor (const parsedMessage of parseIncomingMessages(message)) {\n\t\t\tif (isJsonRpcRequestMessage(parsedMessage)) {\n\t\t\t\tthis.requestSubject.next({\n\t\t\t\t\tid: parsedMessage.id,\n\t\t\t\t\tmethod: parsedMessage.method,\n\t\t\t\t\tparams: parsedMessage.params,\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (isJsonRpcNotificationMessage(parsedMessage)) {\n\t\t\t\tthis.notificationSubject.next({\n\t\t\t\t\tmethod: parsedMessage.method,\n\t\t\t\t\tparams: parsedMessage.params,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\trespondSuccess(id: JsonRpcId, result: unknown): void {\n\t\tif (this.disposed) {\n\t\t\treturn;\n\t\t}\n\t\tthis.options.send({\n\t\t\tjsonrpc: \"2.0\",\n\t\t\tid,\n\t\t\tresult,\n\t\t} satisfies JsonRpcSuccessResponseMessage);\n\t}\n\n\trespondError(id: JsonRpcId, error: JsonRpcErrorPayload): void {\n\t\tif (this.disposed) {\n\t\t\treturn;\n\t\t}\n\t\tthis.options.send({\n\t\t\tjsonrpc: \"2.0\",\n\t\t\tid,\n\t\t\terror,\n\t\t} satisfies JsonRpcErrorResponseMessage);\n\t}\n\n\tdispose(): void {\n\t\tif (this.disposed) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.disposed = true;\n\t\tthis.requestSubject.complete();\n\t\tthis.notificationSubject.complete();\n\t}\n\n\t[SYMBOL_DISPOSE](): void {\n\t\tthis.dispose();\n\t}\n}\n\nclass JsonRpcServerAndClient implements JsonRpcServerAndClientTrait {\n\treadonly onNotification: EventStreamTrait<JsonRpcNotificationEvent>;\n\treadonly onRequest: EventStreamTrait<JsonRpcRequestEvent>;\n\n\tprivate readonly client: JsonRpcClient;\n\tprivate readonly server: JsonRpcServer;\n\tprivate disposed = false;\n\n\tconstructor(options: CreateJsonRpcServerAndClientOptions) {\n\t\tthis.client = new JsonRpcClient(options);\n\t\tthis.server = new JsonRpcServer(options);\n\t\tthis.onNotification = this.server.onNotification;\n\t\tthis.onRequest = this.server.onRequest;\n\t}\n\n\trequest<TResult = unknown>(\n\t\tmethod: string,\n\t\tparams?: unknown,\n\t\toptions?: JsonRpcRequestOptions,\n\t): Promise<TResult> {\n\t\treturn this.client.request<TResult>(method, params, options);\n\t}\n\n\tnotify(method: string, params?: unknown): void {\n\t\tthis.client.notify(method, params);\n\t}\n\n\treceive(message: unknown): void {\n\t\tfor (const parsedMessage of parseIncomingMessages(message)) {\n\t\t\tif (isJsonRpcResponseMessage(parsedMessage)) {\n\t\t\t\tthis.client.receive(parsedMessage);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tthis.server.receive(parsedMessage);\n\t\t}\n\t}\n\n\trejectAllPendingRequests(reason: unknown): void {\n\t\tthis.client.rejectAllPendingRequests(reason);\n\t}\n\n\trespondSuccess(id: JsonRpcId, result: unknown): void {\n\t\tthis.server.respondSuccess(id, result);\n\t}\n\n\trespondError(id: JsonRpcId, error: JsonRpcErrorPayload): void {\n\t\tthis.server.respondError(id, error);\n\t}\n\n\tdispose(): void {\n\t\tif (this.disposed) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.disposed = true;\n\t\tthis.client.dispose();\n\t\tthis.server.dispose();\n\t}\n\n\t[SYMBOL_DISPOSE](): void {\n\t\tthis.dispose();\n\t}\n}\n\nfunction parseIncomingMessages(message: unknown): JsonRpcMessage[] {\n\tif (!Array.isArray(message)) {\n\t\treturn parseJsonRpcMessage(message);\n\t}\n\n\tconst parsedMessages: JsonRpcMessage[] = [];\n\tfor (const entry of message) {\n\t\tparsedMessages.push(...parseJsonRpcMessage(entry));\n\t}\n\treturn parsedMessages;\n}\n\nfunction parseJsonRpcMessage(message: unknown): JsonRpcMessage[] {\n\tconst result = validateWithSchemaSync(JsonRpcMessageSchema, message);\n\treturn result.success ? [result.value] : [];\n}\n\nfunction isJsonRpcRequestMessage(\n\tmessage: JsonRpcMessage,\n): message is JsonRpcRequestMessage {\n\treturn \"method\" in message && \"id\" in message;\n}\n\nfunction isJsonRpcResponseMessage(\n\tmessage: JsonRpcMessage,\n): message is JsonRpcResponseMessage {\n\treturn \"id\" in message && !(\"method\" in message);\n}\n\nfunction isJsonRpcNotificationMessage(\n\tmessage: JsonRpcMessage,\n): message is JsonRpcNotificationMessage {\n\treturn \"method\" in message && !(\"id\" in message);\n}\n\nfunction createJsonRpcDisposedError(role: \"client\" | \"server\"): Error {\n\treturn new Error(`JSON-RPC ${role} disposed.`);\n}\n","import {\n\tBehaviorSubject,\n\tcatchError,\n\tdelayWhen,\n\tdistinctUntilChanged,\n\texhaustMap,\n\tfilter,\n\tfrom,\n\tmap,\n\tmerge,\n\tof,\n\tReplaySubject,\n\tSubject,\n\tshareReplay,\n\ttake,\n\ttakeUntil,\n\ttimeout,\n\ttimer,\n} from \"rxjs\";\nimport { SYMBOL_DISPOSE } from \"../compat\";\nimport { ClientError, ClientErrorKind, UserRecovery } from \"../errors\";\nimport { type EventStreamTrait } from \"../events\";\nimport {\n\ttype JsonRpcClientTrait,\n\ttype JsonRpcNotificationEvent,\n\ttype JsonRpcServerTrait,\n} from \"../protocol/json-rpc\";\nimport { createAsyncSchedulerWithTimestampProvider } from \"../rx\";\nimport { type TimeTrait } from \"../scheduling/types\";\nimport { createSignal } from \"../signals\";\nimport { PopupErrorCode } from \"./errors\";\n\nexport const PopupSessionControlMethod = {\n\tReady: \"securitydept.popup.session.ready\",\n\tPing: \"securitydept.popup.session.ping\",\n\tPong: \"securitydept.popup.session.pong\",\n} as const;\n\nconst DEFAULT_READY_TIMEOUT_MS = 10_000;\nconst DEFAULT_HEARTBEAT_INTERVAL_MS = 5_000;\nconst DEFAULT_HEARTBEAT_TIMEOUT_MS = 15_000;\n\nexport interface CreatePopupClientSessionOptions {\n\tjsonRpc: JsonRpcClientTrait;\n\ttime: TimeTrait;\n\tclosedStream: EventStreamTrait<boolean>;\n\treadyTimeoutMs?: number;\n\theartbeatIntervalMs?: number;\n\theartbeatTimeoutMs?: number;\n}\n\nexport interface CreatePopupServerSessionOptions {\n\tjsonRpc: JsonRpcServerTrait;\n}\n\nexport class PopupClientSession {\n\treadonly failure = createSignal<ClientError | null>(null);\n\treadonly isActive = createSignal(false);\n\n\tprivate readonly init$ = new ReplaySubject<true>();\n\tprivate readonly destroyed = createSignal<boolean>(false);\n\tprivate readonly destroyed$ = from(this.destroyed).pipe(\n\t\tdistinctUntilChanged(),\n\t\tfilter(Boolean),\n\t\tshareReplay(1),\n\t);\n\n\tconstructor(options: CreatePopupClientSessionOptions) {\n\t\tconst timestampScheduler = createAsyncSchedulerWithTimestampProvider(\n\t\t\toptions.time,\n\t\t);\n\t\tconst ready$ = new Subject<boolean>();\n\t\tconst pong$ = new Subject<boolean>();\n\t\tconst closed$ = from(options.closedStream).pipe(filter(Boolean));\n\n\t\tconst ping$ = merge(\n\t\t\tready$.pipe(filter(Boolean)),\n\t\t\tpong$.pipe(filter(Boolean)),\n\t\t).pipe(\n\t\t\tdelayWhen(() =>\n\t\t\t\ttimer(\n\t\t\t\t\toptions.heartbeatIntervalMs ?? DEFAULT_HEARTBEAT_INTERVAL_MS,\n\t\t\t\t\ttimestampScheduler,\n\t\t\t\t),\n\t\t\t),\n\t\t);\n\n\t\tfrom(this.init$)\n\t\t\t.pipe(\n\t\t\t\texhaustMap(() =>\n\t\t\t\t\tfrom(options.jsonRpc.onNotification).pipe(\n\t\t\t\t\t\tfilter(function isReadyNotification(event): event is {\n\t\t\t\t\t\t\tmethod: typeof PopupSessionControlMethod.Ready;\n\t\t\t\t\t\t} {\n\t\t\t\t\t\t\treturn event.method === PopupSessionControlMethod.Ready;\n\t\t\t\t\t\t}),\n\t\t\t\t\t\ttake(1),\n\t\t\t\t\t\ttimeout({\n\t\t\t\t\t\t\teach: options.readyTimeoutMs ?? DEFAULT_READY_TIMEOUT_MS,\n\t\t\t\t\t\t\tscheduler: timestampScheduler,\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tmap(() => true),\n\t\t\t\t\t\tcatchError(() => of(false)),\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(ready$);\n\n\t\tping$\n\t\t\t.pipe(\n\t\t\t\texhaustMap(() =>\n\t\t\t\t\tfrom(options.jsonRpc.onNotification).pipe(\n\t\t\t\t\t\tfilter(function isPongNotification(event): event is {\n\t\t\t\t\t\t\tmethod: typeof PopupSessionControlMethod.Pong;\n\t\t\t\t\t\t} {\n\t\t\t\t\t\t\treturn event.method === PopupSessionControlMethod.Pong;\n\t\t\t\t\t\t}),\n\t\t\t\t\t\ttake(1),\n\t\t\t\t\t\ttimeout({\n\t\t\t\t\t\t\tfirst: options.heartbeatTimeoutMs ?? DEFAULT_HEARTBEAT_TIMEOUT_MS,\n\t\t\t\t\t\t\tscheduler: timestampScheduler,\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tmap(() => true),\n\t\t\t\t\t\tcatchError(() => of(false)),\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(pong$);\n\n\t\tmerge(\n\t\t\tclosed$.pipe(\n\t\t\t\tmap(\n\t\t\t\t\t() =>\n\t\t\t\t\t\tnew ClientError({\n\t\t\t\t\t\t\tkind: ClientErrorKind.Authorization,\n\t\t\t\t\t\t\tcode: PopupErrorCode.Closed,\n\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t\"Popup window was closed before completing the login flow.\",\n\t\t\t\t\t\t\trecovery: UserRecovery.RestartFlow,\n\t\t\t\t\t\t\tsource: \"popup\",\n\t\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t),\n\t\t\tready$.pipe(\n\t\t\t\tmap((success) =>\n\t\t\t\t\t!success\n\t\t\t\t\t\t? new ClientError({\n\t\t\t\t\t\t\t\tkind: ClientErrorKind.Protocol,\n\t\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t\t\"Did not receive ready notification from popup within the expected time.\",\n\t\t\t\t\t\t\t\trecovery: UserRecovery.RestartFlow,\n\t\t\t\t\t\t\t\tsource: \"popup\",\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t: null,\n\t\t\t\t),\n\t\t\t),\n\t\t\tpong$.pipe(\n\t\t\t\tmap((success) =>\n\t\t\t\t\t!success\n\t\t\t\t\t\t? new ClientError({\n\t\t\t\t\t\t\t\tkind: ClientErrorKind.Protocol,\n\t\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t\t\"Did not receive pong notification from popup within the expected time.\",\n\t\t\t\t\t\t\t\trecovery: UserRecovery.RestartFlow,\n\t\t\t\t\t\t\t\tsource: \"popup\",\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t: null,\n\t\t\t\t),\n\t\t\t),\n\t\t)\n\t\t\t.pipe(\n\t\t\t\ttakeUntil(this.destroyed$),\n\t\t\t\tshareReplay({\n\t\t\t\t\tbufferSize: 1,\n\t\t\t\t\trefCount: false,\n\t\t\t\t}),\n\t\t\t)\n\t\t\t.subscribe((error) => this.failure.set(error));\n\n\t\tmerge(\n\t\t\tclosed$.pipe(map(() => false)),\n\t\t\tready$.pipe(map(Boolean)),\n\t\t\tpong$.pipe(map(Boolean)),\n\t\t)\n\t\t\t.pipe(takeUntil(this.destroyed$))\n\t\t\t.subscribe((nextIsActive) => {\n\t\t\t\tthis.isActive.set(nextIsActive);\n\t\t\t});\n\t}\n\n\tinit(): void {\n\t\tthis.init$.next(true);\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\nexport class PopupServerSession {\n\tprivate readonly init$ = new ReplaySubject<true>();\n\tprivate readonly destroyed$$ = new BehaviorSubject<boolean>(false);\n\tprivate readonly destroyed$ = this.destroyed$$.pipe(\n\t\tdistinctUntilChanged(),\n\t\tfilter(Boolean),\n\t\tshareReplay(1),\n\t);\n\n\tconstructor(options: CreatePopupServerSessionOptions) {\n\t\tconst ready$ = from(this.init$);\n\t\tconst ping$ = from(options.jsonRpc.onNotification).pipe(\n\t\t\tfilter(function isPing(event) {\n\t\t\t\treturn event.method === PopupSessionControlMethod.Ping;\n\t\t\t}),\n\t\t);\n\t\tconst pong$ = ping$;\n\n\t\tmerge(\n\t\t\tready$.pipe(\n\t\t\t\tmap(function createReadyNotify(): JsonRpcNotificationEvent {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tmethod: PopupSessionControlMethod.Ready,\n\t\t\t\t\t};\n\t\t\t\t}),\n\t\t\t),\n\t\t\tpong$.pipe(\n\t\t\t\tmap(function createPongNotify(): JsonRpcNotificationEvent {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tmethod: PopupSessionControlMethod.Pong,\n\t\t\t\t\t};\n\t\t\t\t}),\n\t\t\t),\n\t\t)\n\t\t\t.pipe(takeUntil(this.destroyed$))\n\t\t\t.subscribe((event) => {\n\t\t\t\toptions.jsonRpc.notify(event.method, event.params);\n\t\t\t});\n\t}\n\n\tinit(): void {\n\t\tthis.init$.next(true);\n\t}\n\n\tdispose(): void {\n\t\tthis.destroyed$$.next(true);\n\t}\n\n\t[SYMBOL_DISPOSE](): void {\n\t\tthis.dispose();\n\t}\n}\n","import { type DisposableTrait, SYMBOL_DISPOSE } from \"../compat\";\nimport { type ClientError } from \"../errors\";\nimport {\n\ttype EventStreamTrait,\n\ttype EventSubjectTrait,\n\ttype EventSubscriptionTrait,\n} from \"../events\";\nimport {\n\tcreateJsonRpcClient,\n\tcreateJsonRpcServer,\n\ttype JsonRpcClientTrait,\n\ttype JsonRpcMessage,\n\ttype JsonRpcNotificationEvent,\n\ttype JsonRpcRequestEvent,\n\ttype JsonRpcRequestOptions,\n\ttype JsonRpcServerTrait,\n} from \"../protocol/json-rpc\";\nimport { type TimeTrait } from \"../scheduling/types\";\nimport { type ReadableSignalTrait } from \"../signals\";\nimport { PopupClientSession, PopupServerSession } from \"./session\";\n\nexport interface PopupMessageChannelTrait<\n\tTOutgoing = unknown,\n\tTIncoming = unknown,\n> {\n\toutgoing: EventSubjectTrait<TOutgoing>;\n\tincoming: EventStreamTrait<TIncoming>;\n}\n\nexport interface PopupWindowHandleTrait extends DisposableTrait {\n\tmessaging: PopupMessageChannelTrait;\n\treadonly onNotification: EventStreamTrait<JsonRpcNotificationEvent>;\n\tclose(): void;\n\tdispose(): void;\n\tnotify(method: string, params?: unknown): Promise<void>;\n}\n\nexport interface PopupClientWindowHandleTrait extends PopupWindowHandleTrait {\n\treadonly failure: ReadableSignalTrait<ClientError | null>;\n\treadonly isActive: ReadableSignalTrait<boolean>;\n\trequest<TResult = unknown>(\n\t\tmethod: string,\n\t\tparams?: unknown,\n\t\toptions?: JsonRpcRequestOptions,\n\t): Promise<TResult>;\n}\n\nexport interface PopupServerWindowHandleTrait extends PopupWindowHandleTrait {}\n\nexport interface PopupClientWindowHandleOptions {\n\tclose(): void;\n\tmessaging: PopupMessageChannelTrait<JsonRpcMessage, unknown>;\n\ttime: TimeTrait;\n\tclosedStream: EventStreamTrait<boolean>;\n}\n\nexport interface PopupServerWindowHandleOptions {\n\tclose(): void;\n\tmessaging: PopupMessageChannelTrait<JsonRpcMessage, unknown>;\n}\n\n/**\n * popup opener\n */\nexport class PopupClientWindowHandle implements PopupClientWindowHandleTrait {\n\treadonly messaging: PopupMessageChannelTrait<JsonRpcMessage, unknown>;\n\tprivate disposed = false;\n\tprivate readonly jsonRpc: JsonRpcClientTrait;\n\tprivate readonly session: PopupClientSession;\n\tprivate readonly incomingSubscription: EventSubscriptionTrait;\n\tprivate readonly closePopup: () => void;\n\n\tconstructor(options: PopupClientWindowHandleOptions) {\n\t\tthis.messaging = options.messaging;\n\t\tthis.closePopup = options.close;\n\t\tthis.jsonRpc = createJsonRpcClient({\n\t\t\tsend: (message) => {\n\t\t\t\toptions.messaging.outgoing.next(message);\n\t\t\t},\n\t\t\ttime: options.time,\n\t\t});\n\t\tthis.session = new PopupClientSession({\n\t\t\tjsonRpc: this.jsonRpc,\n\t\t\ttime: options.time,\n\t\t\tclosedStream: options.closedStream,\n\t\t});\n\t\tthis.incomingSubscription = options.messaging.incoming.subscribe({\n\t\t\tnext: (message) => {\n\t\t\t\tthis.jsonRpc.receive(message);\n\t\t\t},\n\t\t});\n\t\tthis.session.init();\n\t}\n\n\tget onNotification(): EventStreamTrait<JsonRpcNotificationEvent> {\n\t\treturn this.jsonRpc.onNotification;\n\t}\n\n\tget failure(): ReadableSignalTrait<ClientError | null> {\n\t\treturn this.session.failure;\n\t}\n\n\tget isActive(): ReadableSignalTrait<boolean> {\n\t\treturn this.session.isActive;\n\t}\n\n\tasync notify(method: string, params?: unknown): Promise<void> {\n\t\tthis.jsonRpc.notify(method, params);\n\t}\n\n\trequest<TResult = unknown>(\n\t\tmethod: string,\n\t\tparams?: unknown,\n\t\toptions?: JsonRpcRequestOptions,\n\t): Promise<TResult> {\n\t\treturn this.jsonRpc.request(method, params, options);\n\t}\n\n\tclose(): void {\n\t\tthis.closePopup();\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\tthis.session.dispose();\n\t\tthis.jsonRpc.dispose();\n\t\tthis.incomingSubscription.unsubscribe();\n\t\tthis.messaging.outgoing.complete();\n\t}\n\n\t[SYMBOL_DISPOSE](): void {\n\t\tthis.dispose();\n\t}\n}\n\n/**\n * popup target\n */\nexport class PopupServerWindowHandle implements PopupServerWindowHandleTrait {\n\treadonly messaging: PopupMessageChannelTrait<JsonRpcMessage, unknown>;\n\tprivate disposed = false;\n\tprivate readonly jsonRpc: JsonRpcServerTrait;\n\tprivate readonly session: PopupServerSession;\n\tprivate readonly incomingSubscription: EventSubscriptionTrait;\n\tprivate readonly closePopup: () => void;\n\n\tconstructor(options: PopupServerWindowHandleOptions) {\n\t\tthis.messaging = options.messaging;\n\t\tthis.closePopup = options.close;\n\t\tthis.jsonRpc = createJsonRpcServer({\n\t\t\tsend: (message) => {\n\t\t\t\toptions.messaging.outgoing.next(message);\n\t\t\t},\n\t\t});\n\t\tthis.session = new PopupServerSession({ jsonRpc: this.jsonRpc });\n\t\tthis.incomingSubscription = options.messaging.incoming.subscribe({\n\t\t\tnext: (message) => {\n\t\t\t\tthis.jsonRpc.receive(message);\n\t\t\t},\n\t\t});\n\t\tthis.session.init();\n\t}\n\n\tget onNotification(): EventStreamTrait<JsonRpcNotificationEvent> {\n\t\treturn this.jsonRpc.onNotification;\n\t}\n\n\tget onRequest(): EventStreamTrait<JsonRpcRequestEvent> {\n\t\treturn this.jsonRpc.onRequest;\n\t}\n\n\tnotify(method: string, params?: unknown): Promise<void> {\n\t\tthis.jsonRpc.notify(method, params);\n\t\treturn Promise.resolve();\n\t}\n\n\tclose(): void {\n\t\tthis.closePopup();\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\tthis.session.dispose();\n\t\tthis.jsonRpc.dispose();\n\t\tthis.incomingSubscription.unsubscribe();\n\t\tthis.messaging.outgoing.complete();\n\t}\n\n\t[SYMBOL_DISPOSE](): void {\n\t\tthis.dispose();\n\t}\n}\n"],"mappings":";;;;;AAAA,MAAa,0BAA0B;CACtC,YAAY;CACZ,UAAU;CACV,eAAe;AAChB;;;ACUA,MAAM,0BAAwD;EAC5DA,aAAkB,OAAO;EACzBA,aAAkB,QAAQ;EAC1BA,aAAkB,cAAc;EAChCA,aAAkB,iBAAiB;EACnCA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_internal_variants_object_ts0 from "arktype/internal/variants/object.ts";
|
|
4
|
-
import * as _$arktype_internal_variants_string_ts0 from "arktype/internal/variants/string.ts";
|
|
1
|
+
import { B as WritableSignalTrait, C as IdleCallbackTrait, Ct as EventStreamTrait, D as ComputedSignalTrait, Dt as InteropObservableTrait, E as TimestampProviderTrait, F as ResourceSnapshot, Ft as SecuritydeptInjector, L as ResourceTrait, O as ReadableSignalTrait, R as ResourceWhenValueOptions, Rt as DisposableTrait, T as TimeTrait, Vt as SYMBOL_DISPOSE, W as CancellationTokenTrait, X as ClientError, an as SecuritydeptInjectorTrait, gt as SpanNodeAttributes, ht as SpanCreateOptions, in as SecuritydeptInjectionToken, it as ErrorPresentationDescriptor, mt as SpanAttributes, on as SecuritydeptProvider, st as ReadErrorPresentationDescriptorOptions, ut as MutableSpanTrait, v as RxEventSubject, vt as SpanTrait, wt as EventSubjectTrait, yt as EventObserverTrait, z as SignalOptions } from "./index-CFAJ969E.mjs";
|
|
2
|
+
import { Queue } from "mnemonist";
|
|
5
3
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
6
|
-
|
|
4
|
+
//#region src/injection/destroy.d.ts
|
|
5
|
+
declare abstract class SecuritydeptDestroyRef implements DisposableTrait {
|
|
6
|
+
abstract readonly destroyed: boolean;
|
|
7
|
+
abstract onDestroy(callback: () => void): () => void;
|
|
8
|
+
abstract dispose(): void;
|
|
9
|
+
[SYMBOL_DISPOSE](): void;
|
|
10
|
+
}
|
|
11
|
+
declare function createSecuritydeptDestroyRef(): SecuritydeptDestroyRef;
|
|
12
|
+
//#endregion
|
|
7
13
|
//#region src/compat/base64.d.ts
|
|
8
14
|
declare const Base64CompatErrorCode: {
|
|
9
15
|
readonly EncoderUnavailable: "compat.base64.encoder_unavailable";
|
|
@@ -22,19 +28,6 @@ interface PageLifecycleTrait<TResumeEvent = unknown> {
|
|
|
22
28
|
}
|
|
23
29
|
declare const PAGE_LIFECYCLE_TRAIT_TOKEN: SecuritydeptInjectionToken<PageLifecycleTrait<unknown> | null>;
|
|
24
30
|
//#endregion
|
|
25
|
-
//#region src/errors/error-attributes.d.ts
|
|
26
|
-
interface ErrorSummary {
|
|
27
|
-
errorName: string;
|
|
28
|
-
errorKind?: ClientErrorKind;
|
|
29
|
-
errorCode?: string;
|
|
30
|
-
recovery?: UserRecovery;
|
|
31
|
-
}
|
|
32
|
-
/** Extract secret-safe diagnostic attributes without copying runtime messages. */
|
|
33
|
-
declare function describeError(error: unknown): ErrorSummary;
|
|
34
|
-
//#endregion
|
|
35
|
-
//#region src/errors/presentation-descriptor.d.ts
|
|
36
|
-
declare function readErrorPresentationDescriptor(error: unknown, options?: ReadErrorPresentationDescriptorOptions): ErrorPresentationDescriptor;
|
|
37
|
-
//#endregion
|
|
38
31
|
//#region src/std/events/from-abort.d.ts
|
|
39
32
|
type AbortSignalStdSource = Pick<AbortSignal, "aborted" | "reason"> & {
|
|
40
33
|
addEventListener?: (type: "abort", listener: EventListener) => void;
|
|
@@ -59,39 +52,50 @@ declare function createEventReplaySubject<T>(bufferSize?: number): EventSubjectT
|
|
|
59
52
|
declare function createEmptyEventStream<T>(): EventStreamTrait<T>;
|
|
60
53
|
declare function createNeverEventStream<T>(): EventStreamTrait<T>;
|
|
61
54
|
//#endregion
|
|
55
|
+
//#region src/events/error.d.ts
|
|
56
|
+
type ClientErrorEvent = {
|
|
57
|
+
readonly error: ClientError;
|
|
58
|
+
} | {
|
|
59
|
+
readonly payload: {
|
|
60
|
+
readonly error: ClientError;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
type ExtractClientErrorEvent<TEvent> = Extract<TEvent, ClientErrorEvent>;
|
|
64
|
+
declare function isClientErrorEvent<TEvent>(event: TEvent): event is ExtractClientErrorEvent<TEvent>;
|
|
65
|
+
//#endregion
|
|
62
66
|
//#region src/events/interop.d.ts
|
|
63
67
|
type ToEventStreamInput<T> = InteropObservableTrait<T> | Promise<T> | AsyncIterable<T> | PromiseLike<T> | ArrayLike<T> | Iterable<T> | EventStreamTrait<T> | ReadableSignalTrait<T>;
|
|
64
68
|
declare function toEventStream<T>(input: ToEventStreamInput<T>): EventStreamTrait<T>;
|
|
65
69
|
//#endregion
|
|
66
70
|
//#region src/protocol/json-rpc/types.d.ts
|
|
67
|
-
declare const JsonRpcIdSchema:
|
|
71
|
+
declare const JsonRpcIdSchema: import("arktype").BaseType<string | number, {}>;
|
|
68
72
|
type JsonRpcId = typeof JsonRpcIdSchema.infer;
|
|
69
|
-
declare const JsonRpcErrorPayloadSchema:
|
|
73
|
+
declare const JsonRpcErrorPayloadSchema: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
70
74
|
code: number;
|
|
71
75
|
message: string;
|
|
72
76
|
data?: unknown;
|
|
73
77
|
}, {}>;
|
|
74
78
|
type JsonRpcErrorPayload = typeof JsonRpcErrorPayloadSchema.infer;
|
|
75
|
-
declare const JsonRpcRequestMessageSchema:
|
|
79
|
+
declare const JsonRpcRequestMessageSchema: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
76
80
|
jsonrpc: "2.0";
|
|
77
81
|
id: string | number;
|
|
78
82
|
method: string;
|
|
79
83
|
params?: unknown;
|
|
80
84
|
}, {}>;
|
|
81
85
|
type JsonRpcRequestMessage = typeof JsonRpcRequestMessageSchema.infer;
|
|
82
|
-
declare const JsonRpcNotificationMessageSchema:
|
|
86
|
+
declare const JsonRpcNotificationMessageSchema: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
83
87
|
jsonrpc: "2.0";
|
|
84
88
|
method: string;
|
|
85
89
|
params?: unknown;
|
|
86
90
|
}, {}>;
|
|
87
91
|
type JsonRpcNotificationMessage = typeof JsonRpcNotificationMessageSchema.infer;
|
|
88
|
-
declare const JsonRpcSuccessResponseMessageSchema:
|
|
92
|
+
declare const JsonRpcSuccessResponseMessageSchema: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
89
93
|
jsonrpc: "2.0";
|
|
90
94
|
id: string | number;
|
|
91
95
|
result: unknown;
|
|
92
96
|
}, {}>;
|
|
93
97
|
type JsonRpcSuccessResponseMessage = typeof JsonRpcSuccessResponseMessageSchema.infer;
|
|
94
|
-
declare const JsonRpcErrorResponseMessageSchema:
|
|
98
|
+
declare const JsonRpcErrorResponseMessageSchema: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
95
99
|
jsonrpc: "2.0";
|
|
96
100
|
id: string | number;
|
|
97
101
|
error: {
|
|
@@ -101,7 +105,7 @@ declare const JsonRpcErrorResponseMessageSchema: _$arktype_internal_variants_obj
|
|
|
101
105
|
};
|
|
102
106
|
}, {}>;
|
|
103
107
|
type JsonRpcErrorResponseMessage = typeof JsonRpcErrorResponseMessageSchema.infer;
|
|
104
|
-
declare const JsonRpcMessageSchema:
|
|
108
|
+
declare const JsonRpcMessageSchema: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
105
109
|
jsonrpc: "2.0";
|
|
106
110
|
id: string | number;
|
|
107
111
|
method: string;
|
|
@@ -367,10 +371,10 @@ interface PopupTrait {
|
|
|
367
371
|
declare const POPUP_TRAIT_TOKEN: SecuritydeptInjectionToken<PopupTrait | null>;
|
|
368
372
|
//#endregion
|
|
369
373
|
//#region src/validation/schemas/uri.d.ts
|
|
370
|
-
declare const UriStringSchema:
|
|
371
|
-
declare const BaseURIStringSchema:
|
|
372
|
-
declare const UriRelativeStringSchema:
|
|
373
|
-
declare const UriReferenceStringSchema:
|
|
374
|
+
declare const UriStringSchema: import("arktype/internal/variants/string.ts").StringType<string, {}>;
|
|
375
|
+
declare const BaseURIStringSchema: import("arktype/internal/variants/string.ts").StringType<string, {}>;
|
|
376
|
+
declare const UriRelativeStringSchema: import("arktype/internal/variants/string.ts").StringType<string, {}>;
|
|
377
|
+
declare const UriReferenceStringSchema: import("arktype/internal/variants/string.ts").StringType<string, {}>;
|
|
374
378
|
//#endregion
|
|
375
379
|
//#region src/router/metadata.d.ts
|
|
376
380
|
/** Route-data key holding the SecurityDept metadata blob for a segment. */
|
|
@@ -654,32 +658,6 @@ interface TakeCompatFragmentFromRouterOptions {
|
|
|
654
658
|
declare function takeCompatFragmentFromRouter(router: RouterTrait, options?: TakeCompatFragmentFromRouterOptions): Promise<CompatFragment | null>;
|
|
655
659
|
declare const ROUTER_TRAIT_TOKEN: SecuritydeptInjectionToken<RouterTrait | null>;
|
|
656
660
|
//#endregion
|
|
657
|
-
//#region src/span/types.d.ts
|
|
658
|
-
interface SpanCreateOptions {
|
|
659
|
-
idFactory?: () => string;
|
|
660
|
-
attributes?: Record<string, unknown>;
|
|
661
|
-
mutable?: false;
|
|
662
|
-
}
|
|
663
|
-
interface MutableSpanCreateOptions extends Omit<SpanCreateOptions, "mutable"> {
|
|
664
|
-
mutable: true;
|
|
665
|
-
}
|
|
666
|
-
interface SpanTrait {
|
|
667
|
-
readonly id: string;
|
|
668
|
-
readonly parent?: SpanTrait;
|
|
669
|
-
readonly attributes: Readonly<Record<string, unknown>>;
|
|
670
|
-
fork(options: MutableSpanCreateOptions): MutableSpanTrait;
|
|
671
|
-
fork(options?: SpanCreateOptions): SpanTrait;
|
|
672
|
-
fork(options?: SpanCreateOptions | MutableSpanCreateOptions): SpanTrait | MutableSpanTrait;
|
|
673
|
-
}
|
|
674
|
-
interface MutableSpanTrait extends SpanTrait {
|
|
675
|
-
setAttributes(attributes: Record<string, unknown>): void;
|
|
676
|
-
}
|
|
677
|
-
declare const SPAN_TRAIT_TOKEN: SecuritydeptInjectionToken<SpanTrait>;
|
|
678
|
-
interface OperationSpanTrait extends MutableSpanTrait {
|
|
679
|
-
addEvent(type: string, attributes?: Record<string, unknown>): void;
|
|
680
|
-
recordError(error: unknown, attributes?: Record<string, unknown>): void;
|
|
681
|
-
}
|
|
682
|
-
//#endregion
|
|
683
661
|
//#region src/validation/validator.d.ts
|
|
684
662
|
/**
|
|
685
663
|
* Successful validation result.
|
|
@@ -911,13 +889,20 @@ declare const OperationTraceEventType: {
|
|
|
911
889
|
readonly Ended: "operation.ended";
|
|
912
890
|
};
|
|
913
891
|
type OperationTraceEventType = (typeof OperationTraceEventType)[keyof typeof OperationTraceEventType];
|
|
892
|
+
declare const TRACING_SPAN_ATTRIBUTE_PROVIDER_ID = "@securitydept/client/tracing";
|
|
893
|
+
interface OperationSpanTrait {
|
|
894
|
+
readonly span: MutableSpanTrait;
|
|
895
|
+
setTraceAttributes(attributes: SpanAttributes): void;
|
|
896
|
+
addEvent(type: string, attributes?: SpanAttributes): void;
|
|
897
|
+
recordError(error: unknown, attributes?: SpanAttributes): void;
|
|
898
|
+
}
|
|
914
899
|
interface TracingEvent {
|
|
915
900
|
name: string;
|
|
916
901
|
at: number;
|
|
917
902
|
span: SpanTrait;
|
|
918
903
|
level: TracingLevel;
|
|
919
904
|
target: string;
|
|
920
|
-
fields?:
|
|
905
|
+
fields?: SpanAttributes;
|
|
921
906
|
}
|
|
922
907
|
interface TracingTrait extends DisposableTrait {
|
|
923
908
|
record(event: TracingEvent): void;
|
|
@@ -1057,7 +1042,9 @@ interface RequirementResolution {
|
|
|
1057
1042
|
}
|
|
1058
1043
|
/** Overall plan status. */
|
|
1059
1044
|
declare const PlanStatus: {
|
|
1060
|
-
/** There are still pending requirements. */
|
|
1045
|
+
/** There are still pending requirements. */
|
|
1046
|
+
readonly Pending: "pending";
|
|
1047
|
+
/** All requirements have been resolved. */
|
|
1061
1048
|
readonly Settled: "settled";
|
|
1062
1049
|
};
|
|
1063
1050
|
type PlanStatus = (typeof PlanStatus)[keyof typeof PlanStatus];
|
|
@@ -1086,8 +1073,10 @@ type UnauthenticatedAction = boolean | string | Promise<boolean | string>;
|
|
|
1086
1073
|
*/
|
|
1087
1074
|
type RequirementBehaviourContext<TAuthRequirement extends AuthRequirement = AuthRequirement, TPlanContext = {}> = {
|
|
1088
1075
|
readonly planContext: TPlanContext;
|
|
1089
|
-
readonly environment: FoundationEnvironment;
|
|
1090
|
-
|
|
1076
|
+
readonly environment: FoundationEnvironment;
|
|
1077
|
+
/** The full effective requirement list for the active plan. */
|
|
1078
|
+
readonly requirements: readonly TAuthRequirement[];
|
|
1079
|
+
/** Resolutions collected so far (in requirement order). */
|
|
1091
1080
|
readonly resolutionList: readonly RequirementResolution[];
|
|
1092
1081
|
};
|
|
1093
1082
|
/** Stream of unauthenticated requirements discovered by the planner. */
|
|
@@ -1101,7 +1090,8 @@ type RequirementCandidateGenerator<TAuthRequirement extends AuthRequirement = Au
|
|
|
1101
1090
|
* stream with `for await`.
|
|
1102
1091
|
*/
|
|
1103
1092
|
type RequirementCandidateSelectionContext<TAuthRequirement extends AuthRequirement = AuthRequirement, TPlanContext = {}> = RequirementBehaviourContext<TAuthRequirement, TPlanContext> & {
|
|
1104
|
-
/** Requirements not yet satisfied, yielded as their checks complete. */
|
|
1093
|
+
/** Requirements not yet satisfied, yielded as their checks complete. */
|
|
1094
|
+
readonly candidateList: RequirementCandidateGenerator<TAuthRequirement>;
|
|
1105
1095
|
};
|
|
1106
1096
|
/** Decide whether a single requirement is already satisfied. */
|
|
1107
1097
|
type CheckAuthenticated<TAuthRequirement extends AuthRequirement = AuthRequirement, TPlanContext = {}> = (requirement: TAuthRequirement, context: RequirementBehaviourContext<TAuthRequirement, TPlanContext>) => AuthenticatedCheck;
|
|
@@ -1132,9 +1122,13 @@ declare function isRouteBehaviourContextExtra(value: unknown): value is RouteBeh
|
|
|
1132
1122
|
type RequirementBehaviourWithRouteContext<TAuthRequirement extends AuthRequirement = AuthRequirement> = RequirementBehaviour<TAuthRequirement, RouteBehaviourContextExtra>;
|
|
1133
1123
|
/** Outcome of a pipeline step or run. */
|
|
1134
1124
|
declare const PipelineOutcome: {
|
|
1135
|
-
/** No candidates remain — the plan is satisfied. */
|
|
1136
|
-
readonly
|
|
1137
|
-
|
|
1125
|
+
/** No candidates remain — the plan is satisfied. */
|
|
1126
|
+
readonly Settled: "settled";
|
|
1127
|
+
/** A candidate was resolved as fulfilled; more may remain. */
|
|
1128
|
+
readonly Resolved: "resolved";
|
|
1129
|
+
/** A candidate's handler blocked progress. */
|
|
1130
|
+
readonly Blocked: "blocked";
|
|
1131
|
+
/** A candidate's handler requested a redirect. */
|
|
1138
1132
|
readonly Redirect: "redirect";
|
|
1139
1133
|
};
|
|
1140
1134
|
type PipelineOutcome = (typeof PipelineOutcome)[keyof typeof PipelineOutcome];
|
|
@@ -1418,20 +1412,20 @@ declare function parseIdentityPrincipalWire(input: unknown): IdentityPrincipal;
|
|
|
1418
1412
|
declare function projectIdentityPrincipal(options: ProjectIdentityPrincipalOptions): IdentityPrincipal;
|
|
1419
1413
|
//#endregion
|
|
1420
1414
|
//#region src/identity/schemas.d.ts
|
|
1421
|
-
declare const IdentityPrincipalSchema:
|
|
1415
|
+
declare const IdentityPrincipalSchema: import("arktype/internal/variants/object.ts").ObjectType<(In: {
|
|
1422
1416
|
subject: string;
|
|
1423
1417
|
displayName?: string | null | undefined;
|
|
1424
1418
|
picture?: string | null | undefined;
|
|
1425
1419
|
issuer?: string | null | undefined;
|
|
1426
1420
|
claims?: object | null | undefined;
|
|
1427
|
-
}) =>
|
|
1428
|
-
declare const IdentityPrincipalWireSchema:
|
|
1421
|
+
}) => import("arktype").Out<IdentityPrincipal>, {}>;
|
|
1422
|
+
declare const IdentityPrincipalWireSchema: import("arktype/internal/variants/object.ts").ObjectType<(In: {
|
|
1429
1423
|
subject: string;
|
|
1430
1424
|
display_name?: string | null | undefined;
|
|
1431
1425
|
picture?: string | null | undefined;
|
|
1432
1426
|
issuer?: string | null | undefined;
|
|
1433
1427
|
claims?: object | null | undefined;
|
|
1434
|
-
}) =>
|
|
1428
|
+
}) => import("arktype").Out<IdentityPrincipal>, {}>;
|
|
1435
1429
|
//#endregion
|
|
1436
1430
|
//#region src/protocol/jwt/types.d.ts
|
|
1437
1431
|
type JwtAudienceClaim = string | readonly string[];
|
|
@@ -1470,6 +1464,21 @@ declare class JwtDecodeError extends ClientError {
|
|
|
1470
1464
|
});
|
|
1471
1465
|
}
|
|
1472
1466
|
//#endregion
|
|
1467
|
+
//#region src/scheduling/duration.d.ts
|
|
1468
|
+
/**
|
|
1469
|
+
* Parse a human-readable duration string (for example `5m` or `300s`) into
|
|
1470
|
+
* milliseconds.
|
|
1471
|
+
*/
|
|
1472
|
+
declare function parseDurationToMs(duration: string): number;
|
|
1473
|
+
//#endregion
|
|
1474
|
+
//#region src/span/attributes.d.ts
|
|
1475
|
+
declare const SpanSharedAttributeName: {
|
|
1476
|
+
readonly ClientName: "client.name";
|
|
1477
|
+
readonly ClientId: "client.id";
|
|
1478
|
+
readonly OperationName: "operation.name";
|
|
1479
|
+
};
|
|
1480
|
+
type SpanSharedAttributeName = (typeof SpanSharedAttributeName)[keyof typeof SpanSharedAttributeName];
|
|
1481
|
+
//#endregion
|
|
1473
1482
|
//#region src/span/span.d.ts
|
|
1474
1483
|
declare function createRootSpan(options?: SpanCreateOptions & WithTraitInputValidator<TraitInputValidator>): SpanTrait;
|
|
1475
1484
|
//#endregion
|
|
@@ -1570,28 +1579,24 @@ interface RunOperationOptionsBase extends RunOperationEnvironment {
|
|
|
1570
1579
|
span: SpanTrait;
|
|
1571
1580
|
name: string;
|
|
1572
1581
|
target: string;
|
|
1573
|
-
|
|
1582
|
+
traceAttributes?: SpanAttributes;
|
|
1574
1583
|
idFactory?: () => string;
|
|
1575
|
-
|
|
1584
|
+
clientErrorFromUnknown?: (error: unknown, options: {
|
|
1585
|
+
span: SpanTrait;
|
|
1586
|
+
}) => ClientError;
|
|
1576
1587
|
}
|
|
1577
1588
|
interface RunOperationOptions<T> extends RunOperationOptionsBase {
|
|
1578
1589
|
execute: (span: OperationSpanTrait) => T;
|
|
1579
1590
|
}
|
|
1580
1591
|
declare class OperationSpan implements OperationSpanTrait {
|
|
1581
|
-
|
|
1592
|
+
readonly span: MutableSpanTrait;
|
|
1582
1593
|
private readonly _environment;
|
|
1583
|
-
private readonly _name;
|
|
1584
1594
|
private readonly _target;
|
|
1585
1595
|
private constructor();
|
|
1586
1596
|
static start(options: RunOperationOptionsBase): OperationSpan;
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
fork(options: MutableSpanCreateOptions): MutableSpanTrait;
|
|
1591
|
-
fork(options?: SpanCreateOptions): SpanTrait;
|
|
1592
|
-
setAttributes(attributes: Record<string, unknown>): void;
|
|
1593
|
-
addEvent(name: string, fields?: Record<string, unknown>): void;
|
|
1594
|
-
recordError(error: unknown, fields?: Record<string, unknown>): void;
|
|
1597
|
+
setTraceAttributes(attributes: SpanAttributes): void;
|
|
1598
|
+
addEvent(name: string, fields?: SpanAttributes): void;
|
|
1599
|
+
recordError(error: unknown, fields?: SpanAttributes): void;
|
|
1595
1600
|
recordStarted(): void;
|
|
1596
1601
|
recordEnded(outcome: "succeeded" | "failed"): void;
|
|
1597
1602
|
private _record;
|
|
@@ -1616,25 +1621,39 @@ type DefineInstrumentMethodDecoratorFactory<TFactoryArgs extends unknown[], TBas
|
|
|
1616
1621
|
declare function defineInstrumentMethodDecorator<TFactoryArgs extends unknown[], TBaseThis extends object = object>(factory: DefineInstrumentMethodDecoratorFactory<TFactoryArgs, TBaseThis>): (...factoryArgs: TFactoryArgs) => <TThis extends TBaseThis, TArgs extends unknown[], TReturn>(target: (this: TThis, ...args: TArgs) => TReturn, context: ClassMethodDecoratorContext<TThis, (this: TThis, ...args: TArgs) => TReturn>) => (this: TThis, ...args: TArgs) => TReturn;
|
|
1617
1622
|
//#endregion
|
|
1618
1623
|
//#region src/tracing/subscriber/console.d.ts
|
|
1619
|
-
declare
|
|
1624
|
+
declare class ConsoleTracingSubscriber implements TracingSubscriberTrait {
|
|
1625
|
+
record(event: TracingEvent): void;
|
|
1626
|
+
}
|
|
1627
|
+
declare function createConsoleTracingSubscriber(): ConsoleTracingSubscriber;
|
|
1620
1628
|
//#endregion
|
|
1621
1629
|
//#region src/tracing/subscriber/timeline-store.d.ts
|
|
1622
|
-
interface TraceTimelineEntry extends TracingEvent {
|
|
1630
|
+
interface TraceTimelineEntry extends Omit<TracingEvent, "span"> {
|
|
1623
1631
|
id: number;
|
|
1624
1632
|
recordedAtIso: string;
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1633
|
+
span: {
|
|
1634
|
+
readonly id: string;
|
|
1635
|
+
readonly parentId?: string;
|
|
1636
|
+
};
|
|
1637
|
+
spanAttributes: readonly SpanNodeAttributes[];
|
|
1630
1638
|
}
|
|
1631
1639
|
/**
|
|
1632
|
-
*
|
|
1640
|
+
* Bounded subscriber-side trace timeline.
|
|
1633
1641
|
*
|
|
1634
1642
|
* This store consumes tracing events through `record(event)` and keeps a
|
|
1635
1643
|
* bounded local timeline for tests and UI surfaces. It is not the tracing
|
|
1636
1644
|
* runtime itself.
|
|
1637
1645
|
*/
|
|
1646
|
+
declare class TraceTimelineStore implements TracingSubscriberTrait {
|
|
1647
|
+
protected readonly limit: number;
|
|
1648
|
+
protected nextId: number;
|
|
1649
|
+
protected readonly timeline: Queue<TraceTimelineEntry>;
|
|
1650
|
+
protected readonly latestEntrySubject: RxEventSubject<TraceTimelineEntry | null>;
|
|
1651
|
+
constructor(limit?: number);
|
|
1652
|
+
get latestEntry(): EventStreamTrait<TraceTimelineEntry | null>;
|
|
1653
|
+
get entries(): readonly TraceTimelineEntry[];
|
|
1654
|
+
record(event: TracingEvent): void;
|
|
1655
|
+
clear(): void;
|
|
1656
|
+
}
|
|
1638
1657
|
declare function createTraceTimelineStore(limit?: number): TraceTimelineStore;
|
|
1639
1658
|
//#endregion
|
|
1640
1659
|
//#region src/transport/url.d.ts
|
|
@@ -1644,5 +1663,5 @@ declare function createTraceTimelineStore(limit?: number): TraceTimelineStore;
|
|
|
1644
1663
|
*/
|
|
1645
1664
|
declare function isLoopbackHttpUrl(url: URL): boolean;
|
|
1646
1665
|
//#endregion
|
|
1647
|
-
export {
|
|
1648
|
-
//# sourceMappingURL=index-
|
|
1666
|
+
export { RequirementPlan as $, appendOrReplaceCompatFragment as $n, createJsonRpcServerAndClient as $r, Codec as $t, abortSignalToCancellationToken as A, Base64CompatErrorCode as Ai, ValidationResult as An, readPopupErrorPresentationDescriptor as Ar, SelectCandidate as At, JwtAudienceClaim as B, RouterNavigationMode as Bn, ResourceSnapshotUpdateKind as Br, EnvironmentValidators as Bt, OnceAsyncLockState as C, createEventStream as Ci, CreateAuthorizationInterceptedFetchOptions as Cn, PopupAttachResult as Cr, RequirementResolution as Ct, createJsonCodec as D, PAGE_LIFECYCLE_TRAIT_TOKEN as Di, TraitInputValidator as Dn, CreatePopupClientSessionOptions as Dr, RouteRequirementsDeclaration as Dt, createInMemoryRecordStore as E, abortSignalToEventStream as Ei, createTimeForStd as En, PopupTrait as Er, RouteBehaviourContextExtra as Et, parseDurationToMs as F, validateTraitInput as Fn, PopupServerWindowHandleTrait as Fr, isRouteStateSnapshotTrait as Ft, parseIdentityPrincipalWire as G, AppendOrReplaceCompatFragmentOptions as Gn, ResourceStreamContext as Gr, TracingSubscriberTrait as Gt, IdentityPrincipalSchema as H, RouterTrait as Hn, reduceResourceSnapshot as Hr, ServiceWorkerEnvironment as Ht, JwtDecodeError as I, validateWithSchema as In, PopupWindowHandleTrait as Ir, resolveEffectiveRequirements as It, ProjectIdentityPrincipalOptions as J, CompatFragmentParameters as Jn, ResourceErrorCode as Jr, TRACING_SPAN_ATTRIBUTE_PROVIDER_ID as Jt, projectIdentityPrincipal as K, AppendOrReplaceCompatFragmentResult as Kn, createResource as Kr, OperationSpanTrait as Kt, JwtDecodeErrorCode as L, validateWithSchemaSync as Ln, createSignal as Lr, CreateFoundationEnvironmentOptions as Lt, normalizeAbortError as M, encodeUint8ArrayToBase64 as Mi, WithTraitInputValidator as Mn, PopupClientWindowHandleTrait as Mr, StaticAttrsAuthRequirementInput as Mt, createRootSpan as N, SecuritydeptDestroyRef as Ni, formatValidationFailure as Nn, PopupMessageChannelTrait as Nr, UnauthenticatedAction as Nt, createEphemeralFlowStore as O, PageLifecycleTrait as Oi, ValidateTraitInputOptions as On, CreatePopupServerSessionOptions as Or, RouteStateSnapshotTrait as Ot, SpanSharedAttributeName as P, createSecuritydeptDestroyRef as Pi, throwValidationClientError as Pn, PopupServerWindowHandle as Pr, isRouteBehaviourContextExtra as Pt, BaseRequirementPlanner as Q, UpdateUriFragmentHash as Qn, createJsonRpcServer as Qr, TracingTrait as Qt, decodeJwtPayload as R, ROUTER_TRAIT_TOKEN as Rn, readonlySignal as Rr, createFoundationEnvironment as Rt, OnceAsyncLockRunning as S, createEventReplaySubject as Si, AuthorizationSignal as Sn, PopupAttachFailureReason as Sr, RequirementPlannerError as St, createOnceAsyncLockCallable as T, createNeverEventStream as Ti, TimeForStdCreateOptions as Tn, PopupOpenOptions as Tr, ResolutionStatus as Tt, IdentityPrincipalWireSchema as U, TakeCompatFragmentFromRouterOptions as Un, whenResourceSnapshotValue as Ur, TracingCreateOptions as Ut, JwtClaimsSet as V, RouterNavigationRequest as Vn, flattenResourceSnapshot as Vr, FoundationEnvironment as Vt, parseIdentityPrincipal as W, takeCompatFragmentFromRouter as Wn, CreateResourceOptions as Wr, createTracing as Wt, RouteCompositionRequirementPlanner as X, TakeCompatFragmentOptions as Xn, createComputed as Xr, TracingEvent as Xt, StaticRequirementPlanner as Y, SECURITYDEPT_COMPAT_FRAGMENT_VERSION as Yn, ResourceValueUnavailableErrorOptions as Yr, TRACING_TRAIT_TOKEN as Yt, MergeRequirementPlanner as Z, TakeCompatFragmentResult as Zn, createJsonRpcClient as Zr, TracingLevel as Zt, runOperation as _, toEventStream as _i, HttpResponse as _n, UriReferenceStringSchema as _r, RequirementBehaviour as _t, ConsoleTracingSubscriber as a, JsonRpcErrorResponseMessage as ai, RecoverableStateStore as an, UriReferenceString as ar, RequirementPlannerHostOptions as at, OnceAsyncLockError as b, isClientErrorEvent as bi, TransportErrorCode as bn, POPUP_TRAIT_TOKEN as br, RequirementCandidateGenerator as bt, DefineInstrumentMethodDecoratorFactory as c, JsonRpcNotificationEvent as ci, StorageChangeEventOrigin as cn, UriRelativeParts as cr, provideRequirementPlannerHost as ct, InstrumentMethodThisResolver as d, JsonRpcRequestMessage as di, SyncStorageTrait as dn, UriString as dr, CheckAuthenticated as dt, CreateJsonRpcClientOptions as ei, EphemeralFlowStore as en, isCompatFragmentBlock as er, InjectRequirementPlannerHostOptions as et, defineInstrumentMethodDecorator as f, JsonRpcRequestOptions as fi, BaseTransportForStdFetchCreateOptions as fn, SECURITYDEPT_ROUTE_METADATA_KEY as fr, OnUnauthenticated as ft, RunOperationOptionsBase as g, ToEventStreamInput as gi, HttpRequest as gn, BaseURIStringSchema as gr, PlanStatus as gt, RunOperationOptions as h, JsonRpcSuccessResponseMessage as hi, BaseTransportTrait as hn, writeSecuritydeptRouteMetadata as hr, PipelineStepResult as ht, createTraceTimelineStore as i, JsonRpcErrorPayload as ii, REALM_STORAGE_TRAIT_TOKEN as in, UriParseError as ir, RequirementPlannerHostBehaviour as it, cancellationTokenToAbortSignal as j, decodeBase64ToUint8Array as ji, ValidationSuccess as jn, PopupClientWindowHandle as jr, StaticAttrsAuthRequirement as jt, createKeyedEphemeralFlowStore as k, promisesToRacedAsyncGenerator as ki, ValidationFailure as kn, PopupErrorCode as kr, RouteTreeSegment as kt, InstrumentMethodResolvedOptions as l, JsonRpcNotificationMessage as li, StorageTrait as ln, UriRelativeString as lr, AuthRequirement as lt, RunOperationEnvironment as m, JsonRpcServerTrait as mi, createBaseTransportForStdFetch as mn, readSecuritydeptRouteMetadata as mr, PipelineRunResult as mt, TraceTimelineEntry as n, CreateJsonRpcServerOptions as ni, PERSISTENT_STORAGE_TRAIT_TOKEN as nn, takeCompatFragment as nr, REQUIREMENT_PLANNER_HOST as nt, createConsoleTracingSubscriber as o, JsonRpcId as oi, SESSION_STORAGE_TRAIT_TOKEN as on, UriReferenceStringInput as or, defaultSelectCandidate as ot, OperationSpan as p, JsonRpcServerAndClientTrait as pi, FetchTransportRedirectKind as pn, SecuritydeptRouteMetadata as pr, PipelineOutcome as pt, IdentityPrincipal as q, CompatFragment as qn, ResourceError as qr, OperationTraceEventType as qt, TraceTimelineStore as r, JsonRpcClientTrait as ri, PersistentAuthStore as rn, UriFragmentPart as rr, RequirementPlannerHost as rt, DefineInstrumentMethodDecoratorContext as s, JsonRpcMessage as si, StorageChangeEvent as sn, UriReferenceStringLike as sr, injectRequirementPlannerHost as st, isLoopbackHttpUrl as t, CreateJsonRpcServerAndClientOptions as ti, KeyedEphemeralFlowStore as tn, parseCompatFragment as tr, ProvideRequirementPlannerHostOptions as tt, InstrumentMethodThisContext as u, JsonRpcRequestEvent as ui, StoredEnvelope as un, UriSearchParamsInit as ur, AuthenticatedCheck as ut, OnceAsyncLock as v, ClientErrorEvent as vi, HttpResponseJsonBody as vn, UriRelativeStringSchema as vr, RequirementBehaviourContext as vt, OnceAsyncLockSuccess as w, createEventSubject as wi, createAuthorizationInterceptedFetch as wn, PopupAttachSuccess as wr, RequirementsComposition as wt, OnceAsyncLockInit as x, createEmptyEventStream as xi, AuthorizationInterceptedFetchPredicate as xn, PopupAttachFailure as xr, RequirementCandidateSelectionContext as xt, OnceAsyncLockCallable as y, ExtractClientErrorEvent as yi, TRANSPORT_TRAIT_TOKEN as yn, UriStringSchema as yr, RequirementBehaviourWithRouteContext as yt, DecodeJwtPayloadOptions as z, RouterNavigationIntent as zn, ResourceSnapshotUpdate as zr, ENVIRONMENT_TOKEN as zt };
|
|
1667
|
+
//# sourceMappingURL=index-B9SEJGU2.d.mts.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { Ct as EventStreamTrait } from "./index-CFAJ969E.mjs";
|
|
2
|
+
import { Bt as EnvironmentValidators, Hn as RouterTrait, Mn as WithTraitInputValidator, Oi as PageLifecycleTrait, Vn as RouterNavigationRequest, ar as UriReferenceString } from "./index-B9SEJGU2.mjs";
|
|
4
3
|
//#region src/web/events/from-storage.d.ts
|
|
5
4
|
interface StorageEventTarget {
|
|
6
5
|
addEventListener(type: "storage", listener: EventListener): void;
|
|
@@ -130,4 +129,4 @@ declare class WebLegacyRouter extends NativeWebRouterBase {
|
|
|
130
129
|
}
|
|
131
130
|
//#endregion
|
|
132
131
|
export { createPageResumeSource as _, NativeWebWindowLike as a, fromStorageEvent as b, WebNavigationRouter as c, createPageLifecycleForNativeWeb as d, CreatePageResumeSourceOptions as f, PageResumeWindowTarget as g, PageResumeTriggerKind as h, NativeWebRouter as i, createRouterForNativeWeb as l, PageResumeEvent as m, NativeWebLocationLike as n, RouterForNativeWebCreateOptions as o, PageResumeDocumentTarget as p, NativeWebNavigationLike as r, WebLegacyRouter as s, NativeWebHistoryLike as t, PageLifecycleForNativeWebCreateOptions as u, FromStorageEventOptions as v, StorageEventTarget as y };
|
|
133
|
-
//# sourceMappingURL=index-
|
|
132
|
+
//# sourceMappingURL=index-BjCFWcmV.d.mts.map
|