@securitydept/client 0.3.0-beta.3 → 0.3.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/dist/create-99Ksgl_O.mjs +952 -0
- package/dist/create-99Ksgl_O.mjs.map +1 -0
- package/dist/handle-TnxwtQ4T.mjs +634 -0
- package/dist/handle-TnxwtQ4T.mjs.map +1 -0
- package/dist/index-Cg_iY2yY.d.mts +608 -0
- package/dist/index-DmIapvr-.d.mts +1669 -0
- package/dist/index-O1A3CdBV.d.mts +119 -0
- package/dist/index.d.mts +3 -353
- package/dist/index.mjs +1127 -364
- package/dist/index.mjs.map +1 -1
- package/dist/router-DUh3bhLy.mjs +245 -0
- package/dist/router-DUh3bhLy.mjs.map +1 -0
- package/dist/rx/index.d.mts +68 -0
- package/dist/rx/index.mjs +2 -0
- package/dist/rx-B3OU17wu.mjs +1105 -0
- package/dist/rx-B3OU17wu.mjs.map +1 -0
- package/dist/server/index.d.mts +20 -0
- package/dist/server/index.mjs +29 -0
- package/dist/server/index.mjs.map +1 -0
- package/dist/test/index.d.mts +101 -0
- package/dist/test/index.mjs +270 -0
- package/dist/test/index.mjs.map +1 -0
- package/dist/uri-string-BPNbIMgv.mjs +300 -0
- package/dist/uri-string-BPNbIMgv.mjs.map +1 -0
- package/dist/web/index.d.mts +93 -363
- package/dist/web/index.mjs +335 -428
- package/dist/web/index.mjs.map +1 -1
- package/dist/webext/index.d.mts +73 -0
- package/dist/webext/index.mjs +231 -0
- package/dist/webext/index.mjs.map +1 -0
- package/package.json +28 -21
- package/dist/auth-coordination/index.d.mts +0 -198
- package/dist/auth-coordination/index.mjs +0 -107
- package/dist/auth-coordination/index.mjs.map +0 -1
- package/dist/client-environment-CaumNmir.mjs +0 -812
- package/dist/client-environment-CaumNmir.mjs.map +0 -1
- package/dist/client-environment-CdHtVxKW.d.mts +0 -401
- package/dist/events/index.d.mts +0 -2
- package/dist/events/index.mjs +0 -2
- package/dist/events-BUlfsRfl.mjs +0 -127
- package/dist/events-BUlfsRfl.mjs.map +0 -1
- package/dist/index-C4xlKhG7.d.mts +0 -102
- package/dist/index-COUt5x9Z.d.mts +0 -39
- package/dist/persistence/index.d.mts +0 -3
- package/dist/persistence/index.mjs +0 -2
- package/dist/persistence/web/index.d.mts +0 -16
- package/dist/persistence/web/index.mjs +0 -2
- package/dist/persistence-CSB8770k.mjs +0 -108
- package/dist/persistence-CSB8770k.mjs.map +0 -1
- package/dist/planner-host-BTWie0lo.mjs +0 -197
- package/dist/planner-host-BTWie0lo.mjs.map +0 -1
- package/dist/planner-host-DN9dRsQx.d.mts +0 -190
- package/dist/types-BJqUdH2e.d.mts +0 -32
- package/dist/types-BwcnUGNl.d.mts +0 -52
- package/dist/web-DQmMqZnR.mjs +0 -51
- package/dist/web-DQmMqZnR.mjs.map +0 -1
- package/dist/web-router/index.d.mts +0 -259
- package/dist/web-router/index.mjs +0 -395
- package/dist/web-router/index.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"router-DUh3bhLy.mjs","names":["defineType","defineType","UriReferenceStringClass"],"sources":["../src/web/events/page-resume.ts","../src/web/page.ts","../src/web/router/router.ts"],"sourcesContent":["import {\n\tdefer,\n\tdistinctUntilChanged,\n\tfilter,\n\tfromEventPattern,\n\tmap,\n\tmerge,\n\ttype Observable,\n} from \"rxjs\";\nimport { type EventStreamTrait } from \"../../events/types\";\nimport { RxEventStream } from \"../../rx\";\n\nexport const PageResumeTriggerKind = {\n\tVisibility: \"visibility\",\n\tPageShow: \"pageshow\",\n\tFocus: \"focus\",\n\tOnline: \"online\",\n} as const;\n\nexport type PageResumeTriggerKind =\n\t(typeof PageResumeTriggerKind)[keyof typeof PageResumeTriggerKind];\n\nexport interface PageResumeEvent {\n\ttrigger: PageResumeTriggerKind;\n\tpersisted?: boolean;\n}\n\nexport interface PageResumeDocumentTarget {\n\taddEventListener(type: \"visibilitychange\", handler: EventListener): void;\n\tremoveEventListener(type: \"visibilitychange\", handler: EventListener): void;\n\tvisibilityState: DocumentVisibilityState;\n}\n\nexport interface PageResumeWindowTarget {\n\taddEventListener(\n\t\ttype: \"pageshow\" | \"focus\" | \"online\",\n\t\thandler: EventListener,\n\t): void;\n\tremoveEventListener(\n\t\ttype: \"pageshow\" | \"focus\" | \"online\",\n\t\thandler: EventListener,\n\t): void;\n}\n\nexport interface CreatePageResumeSourceOptions {\n\tdocumentTarget: PageResumeDocumentTarget | null | undefined;\n\twindowTarget: PageResumeWindowTarget | null | undefined;\n}\n\nexport function createPageResumeSource(\n\toptions: CreatePageResumeSourceOptions,\n): EventStreamTrait<PageResumeEvent> {\n\treturn RxEventStream.fromObservableInput(\n\t\tdefer(() => {\n\t\t\tconst { documentTarget, windowTarget } = options;\n\t\t\tconst streams: Observable<PageResumeEvent>[] = [];\n\n\t\t\tif (documentTarget) {\n\t\t\t\tstreams.push(\n\t\t\t\t\tfromEventPattern<Event>(\n\t\t\t\t\t\t(handler) =>\n\t\t\t\t\t\t\tdocumentTarget.addEventListener(\"visibilitychange\", handler),\n\t\t\t\t\t\t(handler) =>\n\t\t\t\t\t\t\tdocumentTarget.removeEventListener(\"visibilitychange\", handler),\n\t\t\t\t\t).pipe(\n\t\t\t\t\t\tmap(() => documentTarget.visibilityState),\n\t\t\t\t\t\tdistinctUntilChanged(),\n\t\t\t\t\t\tfilter((visibilityState) => visibilityState === \"visible\"),\n\t\t\t\t\t\tmap(() => ({\n\t\t\t\t\t\t\ttrigger: PageResumeTriggerKind.Visibility,\n\t\t\t\t\t\t})),\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (windowTarget) {\n\t\t\t\tstreams.push(\n\t\t\t\t\tfromEventPattern<Event>(\n\t\t\t\t\t\t(handler) => windowTarget.addEventListener(\"pageshow\", handler),\n\t\t\t\t\t\t(handler) => windowTarget.removeEventListener(\"pageshow\", handler),\n\t\t\t\t\t).pipe(\n\t\t\t\t\t\tmap((event) => ({\n\t\t\t\t\t\t\ttrigger: PageResumeTriggerKind.PageShow,\n\t\t\t\t\t\t\tpersisted: Boolean((event as PageTransitionEvent).persisted),\n\t\t\t\t\t\t})),\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\tstreams.push(\n\t\t\t\t\tfromEventPattern<Event>(\n\t\t\t\t\t\t(handler) => windowTarget.addEventListener(\"focus\", handler),\n\t\t\t\t\t\t(handler) => windowTarget.removeEventListener(\"focus\", handler),\n\t\t\t\t\t).pipe(map(() => ({ trigger: PageResumeTriggerKind.Focus }))),\n\t\t\t\t);\n\t\t\t\tstreams.push(\n\t\t\t\t\tfromEventPattern<Event>(\n\t\t\t\t\t\t(handler) => windowTarget.addEventListener(\"online\", handler),\n\t\t\t\t\t\t(handler) => windowTarget.removeEventListener(\"online\", handler),\n\t\t\t\t\t).pipe(map(() => ({ trigger: PageResumeTriggerKind.Online }))),\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn merge(...streams);\n\t\t}),\n\t);\n}\n","import { type as defineType } from \"arktype\";\nimport { type EnvironmentValidators } from \"../environment/types\";\nimport { type PageLifecycleTrait } from \"../page\";\nimport {\n\tthrowValidationClientError,\n\tvalidateTraitInput,\n\tvalidateWithSchemaSync,\n\ttype WithTraitInputValidator,\n} from \"../validation\";\nimport {\n\tcreatePageResumeSource,\n\ttype PageResumeDocumentTarget,\n\ttype PageResumeWindowTarget,\n} from \"./events\";\n\nexport interface PageLifecycleForNativeWebCreateOptions {\n\tdocument?: PageResumeDocumentTarget | null;\n\twindow?: PageResumeWindowTarget | null;\n}\n\nconst PageResumeDocumentTargetSchema = defineType({\n\taddEventListener: \"Function\",\n\tremoveEventListener: \"Function\",\n\tvisibilityState: \"string\",\n});\n\nconst PageResumeWindowTargetSchema = defineType({\n\taddEventListener: \"Function\",\n\tremoveEventListener: \"Function\",\n});\n\nconst PageLifecycleForNativeWebUnavailableProbeSchema = defineType({\n\tdocument: \"null | undefined\",\n\twindow: \"null | undefined\",\n});\n\nconst PageLifecycleForNativeWebCreateOptionsSchema = defineType({\n\tdocument: PageResumeDocumentTargetSchema.or(\"null\").or(\"undefined\"),\n\twindow: PageResumeWindowTargetSchema.or(\"null\").or(\"undefined\"),\n});\n\nexport function createPageLifecycleForNativeWeb(\n\toptions: PageLifecycleForNativeWebCreateOptions &\n\t\tWithTraitInputValidator<Pick<EnvironmentValidators, \"pageLifecycle\">> = {},\n): PageLifecycleTrait | null {\n\tconst { validators, ...createOptions } = options;\n\tconst global = globalThis as {\n\t\tdocument?: PageResumeDocumentTarget;\n\t\twindow?: PageResumeWindowTarget;\n\t};\n\tconst resolvedCreateOptions = {\n\t\tdocument: global.document ?? null,\n\t\twindow: global.window ?? null,\n\t\t...createOptions,\n\t};\n\tconst unavailableProbeResult = validateWithSchemaSync(\n\t\tPageLifecycleForNativeWebUnavailableProbeSchema,\n\t\tresolvedCreateOptions,\n\t);\n\tif (unavailableProbeResult.success) {\n\t\treturn null;\n\t}\n\tvalidateTraitInput({\n\t\tvalue: resolvedCreateOptions,\n\t\tbundledSchema: PageLifecycleForNativeWebCreateOptionsSchema,\n\t\tvalidator: validators?.pageLifecycle,\n\t\tonInvalid: (failure) =>\n\t\t\tthrowValidationClientError({\n\t\t\t\tcode: \"web.page.invalid_native_web_page_lifecycle_options\",\n\t\t\t\tsource: \"web\",\n\t\t\t\tmessagePrefix:\n\t\t\t\t\t\"createPageLifecycleForNativeWeb could not validate pageLifecycleForNativeWebCreateOptions\",\n\t\t\t\tfailure,\n\t\t\t}),\n\t});\n\tconst documentTarget = resolvedCreateOptions.document ?? null;\n\tconst windowTarget = resolvedCreateOptions.window ?? null;\n\treturn {\n\t\tresume: createPageResumeSource({\n\t\t\tdocumentTarget,\n\t\t\twindowTarget,\n\t\t}),\n\t};\n}\n","import { type as defineType } from \"arktype\";\nimport { type EnvironmentValidators } from \"../../environment/types\";\nimport { ClientError, ClientErrorKind } from \"../../errors\";\nimport {\n\tRouterNavigationMode,\n\ttype RouterNavigationRequest,\n\ttype RouterTrait,\n} from \"../../router\";\nimport {\n\ttype UriReferenceString,\n\tUriReferenceString as UriReferenceStringClass,\n} from \"../../struct/uri-string\";\nimport {\n\tthrowValidationClientError,\n\tvalidateTraitInput,\n\tvalidateWithSchemaSync,\n\ttype WithTraitInputValidator,\n} from \"../../validation\";\n\nexport interface NativeWebNavigateEventLike {\n\treadonly destination?: {\n\t\treadonly url: string;\n\t\tgetState?(): unknown;\n\t};\n\treadonly navigationType?: \"push\" | \"replace\" | \"reload\" | \"traverse\";\n\treadonly canIntercept?: boolean;\n\treadonly signal?: AbortSignal;\n\tintercept(options?: { handler?: () => Promise<void> | void }): void;\n\tredirect?(url: string, options?: { history?: \"push\" | \"replace\" }): void;\n}\n\nexport interface NativeWebNavigationLike {\n\tnavigate(\n\t\turl: string,\n\t\toptions?: { history?: \"push\" | \"replace\"; state?: unknown },\n\t): { committed?: Promise<unknown>; finished?: Promise<unknown> } | void;\n\taddEventListener?(\n\t\ttype: \"navigate\",\n\t\thandler: (event: NativeWebNavigateEventLike) => void,\n\t): void;\n\tremoveEventListener?(\n\t\ttype: \"navigate\",\n\t\thandler: (event: NativeWebNavigateEventLike) => void,\n\t): void;\n}\n\nexport interface NativeWebLocationLike {\n\thref: string;\n\thash?: string;\n\tpathname?: string;\n\tsearch?: string;\n\torigin?: string;\n}\n\nexport interface NativeWebHistoryLike {\n\tpushState(data: unknown, unused: string, url?: string | URL | null): void;\n\treplaceState(data: unknown, unused: string, url?: string | URL | null): void;\n}\n\nexport interface NativeWebWindowLike {\n\tlocation?: NativeWebLocationLike;\n\thistory?: NativeWebHistoryLike;\n}\n\nexport interface RouterForNativeWebCreateOptions {\n\tnavigation?: NativeWebNavigationLike | null;\n\tlocation?: NativeWebLocationLike | null;\n\thistory?: NativeWebHistoryLike | null;\n\twindow?: NativeWebWindowLike | null;\n}\n\nexport interface ResolvedRouterForNativeWebCreateOptions {\n\tnavigation: NativeWebNavigationLike | null;\n\tlocation: NativeWebLocationLike | null;\n\thistory: NativeWebHistoryLike | null;\n\twindow: NativeWebWindowLike | null;\n}\n\nconst NativeWebNavigationLikeSchema = defineType({\n\tnavigate: \"Function\",\n\taddEventListener: \"Function?\",\n\tremoveEventListener: \"Function?\",\n});\n\nconst NativeWebLocationLikeSchema = defineType({\n\thref: \"string\",\n});\n\nconst NativeWebHistoryLikeSchema = defineType({\n\tpushState: \"Function\",\n\treplaceState: \"Function\",\n});\n\nconst NativeWebWindowLikeSchema = defineType({\n\tlocation: NativeWebLocationLikeSchema.optional(),\n\thistory: NativeWebHistoryLikeSchema.optional(),\n\topen: \"Function?\",\n});\n\nconst NullableNativeWebHistoryLikeSchema =\n\tNativeWebHistoryLikeSchema.or(\"null\").or(\"undefined\");\nconst NullableNativeWebWindowLikeSchema =\n\tNativeWebWindowLikeSchema.or(\"null\").or(\"undefined\");\n\nconst RouterForNativeWebCreateOptionsSchema = defineType({\n\tnavigation: NativeWebNavigationLikeSchema,\n\tlocation: NativeWebLocationLikeSchema.or(\"null\").or(\"undefined\"),\n\thistory: NullableNativeWebHistoryLikeSchema,\n\twindow: NullableNativeWebWindowLikeSchema,\n}).or({\n\tnavigation: \"null | undefined\",\n\tlocation: NativeWebLocationLikeSchema,\n\thistory: NullableNativeWebHistoryLikeSchema,\n\twindow: NullableNativeWebWindowLikeSchema,\n});\n\nconst RouterForNativeWebUnavailableProbeSchema = defineType({\n\tnavigation: \"null | undefined\",\n\tlocation: \"null | undefined\",\n\thistory: \"null | undefined\",\n\twindow: \"null | undefined\",\n});\n\nexport function createRouterForNativeWeb(\n\toptions: RouterForNativeWebCreateOptions &\n\t\tWithTraitInputValidator<Pick<EnvironmentValidators, \"router\">> = {},\n): RouterTrait | null {\n\tconst resolvedCreateOptions = resolveRouterForNativeWebCreateOptions(options);\n\tif (\n\t\tvalidateWithSchemaSync(\n\t\t\tRouterForNativeWebUnavailableProbeSchema,\n\t\t\tresolvedCreateOptions,\n\t\t).success\n\t) {\n\t\treturn null;\n\t}\n\tvalidateTraitInput({\n\t\tvalue: resolvedCreateOptions,\n\t\tbundledSchema: RouterForNativeWebCreateOptionsSchema,\n\t\tvalidator: options.validators?.router,\n\t\tonInvalid: (failure) =>\n\t\t\tthrowValidationClientError({\n\t\t\t\tcode: \"web.router.invalid_native_web_router_options\",\n\t\t\t\tsource: \"web\",\n\t\t\t\tmessagePrefix:\n\t\t\t\t\t\"createRouterForNativeWeb could not validate routerForNativeWebCreateOptions\",\n\t\t\t\tfailure,\n\t\t\t}),\n\t});\n\tconst router = new NativeWebRouter(resolvedCreateOptions);\n\treturn {\n\t\tcurrentUrl() {\n\t\t\treturn router.currentUrl();\n\t\t},\n\t\tnavigate(request) {\n\t\t\treturn router.navigate(request);\n\t\t},\n\t};\n}\n\nexport class NativeWebRouter implements RouterTrait {\n\tprotected readonly router: WebNavigationRouter | WebLegacyRouter;\n\n\tconstructor(options: ResolvedRouterForNativeWebCreateOptions) {\n\t\tthis.router = options.navigation\n\t\t\t? new WebNavigationRouter(options)\n\t\t\t: new WebLegacyRouter(options);\n\t}\n\n\tcurrentUrl(): UriReferenceString | null {\n\t\treturn this.router.currentUrl();\n\t}\n\n\tnavigate(request: RouterNavigationRequest): void | Promise<void> {\n\t\treturn this.router.navigate(request);\n\t}\n}\n\nabstract class NativeWebRouterBase implements RouterTrait {\n\tprotected readonly location: NativeWebLocationLike | null;\n\n\tconstructor(options: ResolvedRouterForNativeWebCreateOptions) {\n\t\tthis.location = options.location;\n\t}\n\n\tcurrentUrl(): UriReferenceString | null {\n\t\treturn this.location?.href\n\t\t\t? UriReferenceStringClass.parse(this.location.href)\n\t\t\t: null;\n\t}\n\n\tprotected resolveNavigationTarget(request: RouterNavigationRequest): string {\n\t\treturn request.url.toString();\n\t}\n\n\tabstract navigate(request: RouterNavigationRequest): void | Promise<void>;\n}\n\nexport class WebNavigationRouter extends NativeWebRouterBase {\n\tprotected readonly navigation: NativeWebNavigationLike;\n\tprotected readonly history: NativeWebHistoryLike | null;\n\n\tconstructor(options: ResolvedRouterForNativeWebCreateOptions) {\n\t\tif (!options.navigation) {\n\t\t\tthrow new ClientError({\n\t\t\t\tkind: ClientErrorKind.Configuration,\n\t\t\t\tcode: \"web.router.navigation_unavailable\",\n\t\t\t\tmessage: \"WebNavigationRouter requires the Navigation API\",\n\t\t\t\tsource: \"web.router\",\n\t\t\t});\n\t\t}\n\t\tsuper(options);\n\t\tthis.navigation = options.navigation;\n\t\tthis.history = options.history;\n\t}\n\n\tasync navigate(request: RouterNavigationRequest): Promise<void> {\n\t\tconst target = this.resolveNavigationTarget(request);\n\t\tif (request.mode === RouterNavigationMode.External) {\n\t\t\tif (this.location) {\n\t\t\t\tthis.location.href = target;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthrow new ClientError({\n\t\t\t\tkind: ClientErrorKind.Configuration,\n\t\t\t\tcode: \"web.router.location_unavailable\",\n\t\t\t\tmessage:\n\t\t\t\t\t\"Native web router cannot perform external navigation without location\",\n\t\t\t\tsource: \"web.router\",\n\t\t\t});\n\t\t}\n\t\t// Prefer History API for same-origin Push/Replace. Unintercepted\n\t\t// Navigation API navigations load a new document even for in-app path,\n\t\t// query, or hash changes, which breaks SPA routing and aborts in-flight\n\t\t// OIDC callback handling after the callback payload has been taken.\n\t\tif (this.history && this.isSameOriginNavigation(request.url)) {\n\t\t\tif (request.mode === RouterNavigationMode.Replace) {\n\t\t\t\tthis.history.replaceState(request.state ?? null, \"\", target);\n\t\t\t} else {\n\t\t\t\tthis.history.pushState(request.state ?? null, \"\", target);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tconst result = this.navigation.navigate(target, {\n\t\t\thistory:\n\t\t\t\trequest.mode === RouterNavigationMode.Replace\n\t\t\t\t\t? RouterNavigationMode.Replace\n\t\t\t\t\t: RouterNavigationMode.Push,\n\t\t\tstate: request.state,\n\t\t});\n\t\tawait result?.committed;\n\t}\n\n\tprivate isSameOriginNavigation(url: UriReferenceString): boolean {\n\t\tconst current = this.currentUrl();\n\t\tif (!current) {\n\t\t\treturn false;\n\t\t}\n\t\tif (url.isAbsolute() && current.isAbsolute()) {\n\t\t\treturn url.origin === current.origin;\n\t\t}\n\t\t// Relative targets inherit the current document origin.\n\t\treturn url.isRelative();\n\t}\n}\n\nexport class WebLegacyRouter extends NativeWebRouterBase {\n\tprotected readonly history: NativeWebHistoryLike | null;\n\n\tconstructor(options: ResolvedRouterForNativeWebCreateOptions) {\n\t\tsuper(options);\n\t\tthis.history = options.history;\n\t}\n\n\tasync navigate(request: RouterNavigationRequest): Promise<void> {\n\t\tconst target = this.resolveNavigationTarget(request);\n\t\tif (request.mode === RouterNavigationMode.External) {\n\t\t\tif (this.location) {\n\t\t\t\tthis.location.href = target;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthrow new ClientError({\n\t\t\t\tkind: ClientErrorKind.Configuration,\n\t\t\t\tcode: \"web.router.location_unavailable\",\n\t\t\t\tmessage:\n\t\t\t\t\t\"Native web router cannot perform external navigation without location\",\n\t\t\t\tsource: \"web.router\",\n\t\t\t});\n\t\t}\n\t\tif (!this.history) {\n\t\t\tthrow new ClientError({\n\t\t\t\tkind: ClientErrorKind.Configuration,\n\t\t\t\tcode: \"web.router.history_unavailable\",\n\t\t\t\tmessage: \"Native web router requires history for in-page navigation\",\n\t\t\t\tsource: \"web.router\",\n\t\t\t});\n\t\t}\n\t\tif (request.mode === RouterNavigationMode.Replace) {\n\t\t\tthis.history.replaceState(request.state ?? null, \"\", target);\n\t\t} else {\n\t\t\tthis.history.pushState(request.state ?? null, \"\", target);\n\t\t}\n\t}\n}\n\nexport function resolveRouterForNativeWebCreateOptions(\n\toptions: RouterForNativeWebCreateOptions = {},\n): ResolvedRouterForNativeWebCreateOptions {\n\tconst global = globalThis as {\n\t\tnavigation?: NativeWebNavigationLike;\n\t\tlocation?: NativeWebLocationLike;\n\t\thistory?: NativeWebHistoryLike;\n\t\twindow?: NativeWebWindowLike;\n\t};\n\tconst windowLike = Object.hasOwn(options, \"window\")\n\t\t? (options.window ?? null)\n\t\t: (global.window ?? null);\n\tconst navigation = Object.hasOwn(options, \"navigation\")\n\t\t? (options.navigation ?? null)\n\t\t: (global.navigation ?? null);\n\tconst location = Object.hasOwn(options, \"location\")\n\t\t? (options.location ?? null)\n\t\t: (windowLike?.location ?? global.location ?? null);\n\tconst history = Object.hasOwn(options, \"history\")\n\t\t? (options.history ?? null)\n\t\t: (windowLike?.history ?? global.history ?? null);\n\treturn {\n\t\twindow: windowLike,\n\t\tnavigation,\n\t\tlocation,\n\t\thistory,\n\t};\n}\n"],"mappings":";;;;;;AAYA,MAAa,wBAAwB;CACpC,YAAY;CACZ,UAAU;CACV,OAAO;CACP,QAAQ;AACT;AAgCA,SAAgB,uBACf,SACoC;CACpC,OAAO,cAAc,oBACpB,YAAY;EACX,MAAM,EAAE,gBAAgB,iBAAiB;EACzC,MAAM,UAAyC,CAAC;EAEhD,IAAI,gBACH,QAAQ,KACP,kBACE,YACA,eAAe,iBAAiB,oBAAoB,OAAO,IAC3D,YACA,eAAe,oBAAoB,oBAAoB,OAAO,CAChE,CAAC,CAAC,KACD,UAAU,eAAe,eAAe,GACxC,qBAAqB,GACrB,QAAQ,oBAAoB,oBAAoB,SAAS,GACzD,WAAW,EACV,SAAS,sBAAsB,WAChC,EAAE,CACH,CACD;EAGD,IAAI,cAAc;GACjB,QAAQ,KACP,kBACE,YAAY,aAAa,iBAAiB,YAAY,OAAO,IAC7D,YAAY,aAAa,oBAAoB,YAAY,OAAO,CAClE,CAAC,CAAC,KACD,KAAK,WAAW;IACf,SAAS,sBAAsB;IAC/B,WAAW,QAAS,MAA8B,SAAS;GAC5D,EAAE,CACH,CACD;GACA,QAAQ,KACP,kBACE,YAAY,aAAa,iBAAiB,SAAS,OAAO,IAC1D,YAAY,aAAa,oBAAoB,SAAS,OAAO,CAC/D,CAAC,CAAC,KAAK,WAAW,EAAE,SAAS,sBAAsB,MAAM,EAAE,CAAC,CAC7D;GACA,QAAQ,KACP,kBACE,YAAY,aAAa,iBAAiB,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rait, _ as RxEventStream, a as resourceFromSnapshots, c as RxComputedSignalCompat, d as RxSignalWatchCanceller, f as RxSignalWatchOptions, g as RxEventReplaySubject, h as RxStateSignalCompat, i as mapResource, l as RxSignalDirtyEvent, m as RxStateSignal, n as RxResourceOptions, o as rxResource, p as RxSignalWatchScheduler, r as RxResourceStreamContext, s as RxComputedSignal, t as RxResource, u as RxSignalOptions, v as RxEventSubject } from "../index-Cg_iY2yY.mjs";
|
|
2
|
+
import { Observable, ObservableInput, Observer, OperatorFunction } from "rxjs";
|
|
3
|
+
import { AsyncScheduler } from "rxjs/internal/scheduler/AsyncScheduler";
|
|
4
|
+
//#region src/rx/command.d.ts
|
|
5
|
+
declare const CommandResponseType: {
|
|
6
|
+
readonly Data: "data";
|
|
7
|
+
readonly Success: "success";
|
|
8
|
+
readonly Error: "error";
|
|
9
|
+
readonly Cancel: "cancel";
|
|
10
|
+
readonly Rejected: "rejected";
|
|
11
|
+
};
|
|
12
|
+
type CommandResponseType = (typeof CommandResponseType)[keyof typeof CommandResponseType];
|
|
13
|
+
type Command<Payload = unknown, Extra extends {} = {}> = Extra & {
|
|
14
|
+
readonly payload: Payload;
|
|
15
|
+
};
|
|
16
|
+
type CommandDataResponse<TCmd extends Command, TData = unknown> = {
|
|
17
|
+
readonly type: typeof CommandResponseType.Data;
|
|
18
|
+
readonly command: TCmd;
|
|
19
|
+
readonly data: TData;
|
|
20
|
+
};
|
|
21
|
+
type CommandSuccessResponse<TCmd extends Command> = {
|
|
22
|
+
readonly type: typeof CommandResponseType.Success;
|
|
23
|
+
readonly command: TCmd;
|
|
24
|
+
};
|
|
25
|
+
type CommandErrorResponse<TCmd extends Command> = {
|
|
26
|
+
readonly type: typeof CommandResponseType.Error;
|
|
27
|
+
readonly command: TCmd;
|
|
28
|
+
readonly error: unknown;
|
|
29
|
+
};
|
|
30
|
+
type CommandCancelResponse<TCmd extends Command> = {
|
|
31
|
+
readonly type: typeof CommandResponseType.Cancel;
|
|
32
|
+
readonly command: TCmd;
|
|
33
|
+
};
|
|
34
|
+
type CommandRejectedResponse<TCmd extends Command> = {
|
|
35
|
+
readonly type: typeof CommandResponseType.Rejected;
|
|
36
|
+
readonly command: TCmd;
|
|
37
|
+
readonly reason: string;
|
|
38
|
+
};
|
|
39
|
+
type CommandTerminalResponse<TCmd extends Command> = CommandSuccessResponse<TCmd> | CommandErrorResponse<TCmd> | CommandCancelResponse<TCmd> | CommandRejectedResponse<TCmd>;
|
|
40
|
+
type CommandResponse<TCmd extends Command, TData = unknown> = CommandDataResponse<TCmd, TData> | CommandTerminalResponse<TCmd>;
|
|
41
|
+
interface DispatchCommandBaseOptions<TCmd extends Command, TData = unknown> {
|
|
42
|
+
readonly requestStream: Pick<Observer<TCmd>, "next">;
|
|
43
|
+
readonly responseStream: ObservableInput<CommandResponse<TCmd, TData>>;
|
|
44
|
+
}
|
|
45
|
+
interface DispatchCommandLocallyOptions<TPayload, TCommandExtra extends {} = {}, TData = unknown, TCmd extends Command<TPayload, TCommandExtra> = Command<TPayload, TCommandExtra>> extends DispatchCommandBaseOptions<TCmd, TData> {
|
|
46
|
+
readonly payload: TPayload;
|
|
47
|
+
readonly createCommandExtra?: (payload: TPayload) => TCommandExtra;
|
|
48
|
+
}
|
|
49
|
+
interface DispatchCommandByIdOptions<TCmd extends Command, TId, TData = unknown> extends DispatchCommandBaseOptions<TCmd, TData> {
|
|
50
|
+
readonly command: TCmd;
|
|
51
|
+
readonly selectCommandId: (command: TCmd) => TId;
|
|
52
|
+
readonly areIdsEqual?: (left: TId, right: TId) => boolean;
|
|
53
|
+
}
|
|
54
|
+
declare function unwrapCommandTerminalResponse<TCmd extends Command>(response: CommandTerminalResponse<TCmd>): void;
|
|
55
|
+
declare function commandResponseData<TCmd extends Command, TData>(): OperatorFunction<CommandResponse<TCmd, TData>, TData>;
|
|
56
|
+
declare function dispatchCommandLocallyToStream<TPayload, TCommandExtra extends {} = {}, TData = unknown, TCmd extends Command<TPayload, TCommandExtra> = Command<TPayload, TCommandExtra>>(options: DispatchCommandLocallyOptions<TPayload, TCommandExtra, TData, TCmd>): Observable<CommandResponse<TCmd, TData>>;
|
|
57
|
+
declare function dispatchCommandByIdToStream<TCmd extends Command, TId, TData = unknown>(options: DispatchCommandByIdOptions<TCmd, TId, TData>): Observable<CommandResponse<TCmd, TData>>;
|
|
58
|
+
declare function dispatchCommandLocallyToPromise<TPayload, TCommandExtra extends {} = {}, TData = unknown, TCmd extends Command<TPayload, TCommandExtra> = Command<TPayload, TCommandExtra>>(options: DispatchCommandLocallyOptions<TPayload, TCommandExtra, TData, TCmd> & {}): Promise<CommandDataResponse<TCmd, TData>>;
|
|
59
|
+
declare function dispatchCommandByIdToPromise<TCmd extends Command, TId, TData = unknown>(options: DispatchCommandByIdOptions<TCmd, TId, TData>): Promise<CommandDataResponse<TCmd, TData>>;
|
|
60
|
+
declare function switchCommand<TCmd extends Command, TData = unknown>(execute: (command: TCmd) => ObservableInput<TData>): OperatorFunction<TCmd, CommandResponse<TCmd, TData>>;
|
|
61
|
+
declare function concatCommand<TCmd extends Command, TData = unknown>(execute: (command: TCmd) => ObservableInput<TData>): OperatorFunction<TCmd, CommandResponse<TCmd, TData>>;
|
|
62
|
+
declare const exhaustCommand: <TCmd extends Command, TData = unknown>(execute: (command: TCmd) => ObservableInput<TData>) => (source$: Observable<TCmd>) => Observable<CommandResponse<TCmd, TData>>;
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/rx/environment.d.ts
|
|
65
|
+
declare function createAsyncSchedulerWithTimestampProvider(time: TimeTrait): AsyncScheduler;
|
|
66
|
+
//#endregion
|
|
67
|
+
export { type Command, type CommandCancelResponse, type CommandDataResponse, type CommandErrorResponse, type CommandRejectedResponse, type CommandResponse, CommandResponseType, type CommandSuccessResponse, type CommandTerminalResponse, type DispatchCommandBaseOptions, type DispatchCommandByIdOptions, type DispatchCommandLocallyOptions, type ResourceSnapshot, ResourceStatus, type ResourceTrait, RxComputedSignal, type RxComputedSignalCompat, RxEventReplaySubject, RxEventStream, RxEventSubject, RxResource, type RxResourceOptions, type RxResourceStreamContext, type RxSignalDirtyEvent, type RxSignalOptions, type RxSignalWatchCanceller, type RxSignalWatchOptions, type RxSignalWatchScheduler, RxStateSignal, type RxStateSignalCompat, commandResponseData, concatCommand, createAsyncSchedulerWithTimestampProvider, dispatchCommandByIdToPromise, dispatchCommandByIdToStream, dispatchCommandLocallyToPromise, dispatchCommandLocallyToStream, exhaustCommand, mapResource, resourceFromSnapshots, rxResource, switchCommand, unwrapCommandTerminalResponse };
|
|
68
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { A as RxEventSubject, C as exhaustCommand, D as RxStateSignal, E as RxComputedSignal, O as RxEventReplaySubject, S as dispatchCommandLocallyToStream, T as unwrapCommandTerminalResponse, _ as commandResponseData, b as dispatchCommandByIdToStream, g as CommandResponseType, h as createAsyncSchedulerWithTimestampProvider, i as rxResource, k as RxEventStream, l as ResourceStatus, n as mapResource, r as resourceFromSnapshots, t as RxResource, v as concatCommand, w as switchCommand, x as dispatchCommandLocallyToPromise, y as dispatchCommandByIdToPromise } from "../rx-B3OU17wu.mjs";
|
|
2
|
+
export { CommandResponseType, ResourceStatus, RxComputedSignal, RxEventReplaySubject, RxEventStream, RxEventSubject, RxResource, RxStateSignal, commandResponseData, concatCommand, createAsyncSchedulerWithTimestampProvider, dispatchCommandByIdToPromise, dispatchCommandByIdToStream, dispatchCommandLocallyToPromise, dispatchCommandLocallyToStream, exhaustCommand, mapResource, resourceFromSnapshots, rxResource, switchCommand, unwrapCommandTerminalResponse };
|