@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.
Files changed (60) hide show
  1. package/README.md +6 -0
  2. package/dist/create-99Ksgl_O.mjs +952 -0
  3. package/dist/create-99Ksgl_O.mjs.map +1 -0
  4. package/dist/handle-TnxwtQ4T.mjs +634 -0
  5. package/dist/handle-TnxwtQ4T.mjs.map +1 -0
  6. package/dist/index-Cg_iY2yY.d.mts +608 -0
  7. package/dist/index-DmIapvr-.d.mts +1669 -0
  8. package/dist/index-O1A3CdBV.d.mts +119 -0
  9. package/dist/index.d.mts +3 -353
  10. package/dist/index.mjs +1127 -364
  11. package/dist/index.mjs.map +1 -1
  12. package/dist/router-DUh3bhLy.mjs +245 -0
  13. package/dist/router-DUh3bhLy.mjs.map +1 -0
  14. package/dist/rx/index.d.mts +68 -0
  15. package/dist/rx/index.mjs +2 -0
  16. package/dist/rx-B3OU17wu.mjs +1105 -0
  17. package/dist/rx-B3OU17wu.mjs.map +1 -0
  18. package/dist/server/index.d.mts +20 -0
  19. package/dist/server/index.mjs +29 -0
  20. package/dist/server/index.mjs.map +1 -0
  21. package/dist/test/index.d.mts +101 -0
  22. package/dist/test/index.mjs +270 -0
  23. package/dist/test/index.mjs.map +1 -0
  24. package/dist/uri-string-BPNbIMgv.mjs +300 -0
  25. package/dist/uri-string-BPNbIMgv.mjs.map +1 -0
  26. package/dist/web/index.d.mts +93 -363
  27. package/dist/web/index.mjs +335 -428
  28. package/dist/web/index.mjs.map +1 -1
  29. package/dist/webext/index.d.mts +73 -0
  30. package/dist/webext/index.mjs +231 -0
  31. package/dist/webext/index.mjs.map +1 -0
  32. package/package.json +28 -21
  33. package/dist/auth-coordination/index.d.mts +0 -198
  34. package/dist/auth-coordination/index.mjs +0 -107
  35. package/dist/auth-coordination/index.mjs.map +0 -1
  36. package/dist/client-environment-CaumNmir.mjs +0 -812
  37. package/dist/client-environment-CaumNmir.mjs.map +0 -1
  38. package/dist/client-environment-CdHtVxKW.d.mts +0 -401
  39. package/dist/events/index.d.mts +0 -2
  40. package/dist/events/index.mjs +0 -2
  41. package/dist/events-BUlfsRfl.mjs +0 -127
  42. package/dist/events-BUlfsRfl.mjs.map +0 -1
  43. package/dist/index-C4xlKhG7.d.mts +0 -102
  44. package/dist/index-COUt5x9Z.d.mts +0 -39
  45. package/dist/persistence/index.d.mts +0 -3
  46. package/dist/persistence/index.mjs +0 -2
  47. package/dist/persistence/web/index.d.mts +0 -16
  48. package/dist/persistence/web/index.mjs +0 -2
  49. package/dist/persistence-CSB8770k.mjs +0 -108
  50. package/dist/persistence-CSB8770k.mjs.map +0 -1
  51. package/dist/planner-host-BTWie0lo.mjs +0 -197
  52. package/dist/planner-host-BTWie0lo.mjs.map +0 -1
  53. package/dist/planner-host-DN9dRsQx.d.mts +0 -190
  54. package/dist/types-BJqUdH2e.d.mts +0 -32
  55. package/dist/types-BwcnUGNl.d.mts +0 -52
  56. package/dist/web-DQmMqZnR.mjs +0 -51
  57. package/dist/web-DQmMqZnR.mjs.map +0 -1
  58. package/dist/web-router/index.d.mts +0 -259
  59. package/dist/web-router/index.mjs +0 -395
  60. package/dist/web-router/index.mjs.map +0 -1
@@ -0,0 +1,608 @@
1
+ import { InjectionToken, Injector } from "injection-js";
2
+ import { BehaviorSubject, Observable, ObservableInput, OperatorFunction, ReplaySubject, Subject } from "rxjs";
3
+ //#region src/injection/types.d.ts
4
+ declare class SecuritydeptInjectionToken<T> extends InjectionToken<T> {}
5
+ type SecuritydeptAbstractType<T> = abstract new (...args: never[]) => T;
6
+ type SecuritydeptDependencyToken<T> = SecuritydeptInjectionToken<T> | SecuritydeptAbstractType<T>;
7
+ type SecuritydeptTypeProvider<T> = SecuritydeptAbstractType<T>;
8
+ declare const SecurityDeptOptional: import("injection-js").OptionalDecorator;
9
+ type SecuritydeptOptionalDependency<T> = readonly [InstanceType<typeof SecurityDeptOptional>, SecuritydeptDependencyToken<T>] | readonly [SecuritydeptDependencyToken<T>, InstanceType<typeof SecurityDeptOptional>];
10
+ type SecuritydeptDependencyDescriptor<T> = SecuritydeptDependencyToken<T> | SecuritydeptOptionalDependency<T>;
11
+ interface SecuritydeptValueProvider<T> {
12
+ provide: SecuritydeptDependencyToken<T>;
13
+ useValue: T;
14
+ }
15
+ interface SecuritydeptClassProvider<T> {
16
+ provide: SecuritydeptDependencyToken<T>;
17
+ useClass: SecuritydeptAbstractType<T>;
18
+ deps?: readonly SecuritydeptDependencyDescriptor<unknown>[];
19
+ }
20
+ interface SecuritydeptFactoryProvider<T> {
21
+ provide: SecuritydeptDependencyToken<T>;
22
+ useFactory: (...deps: never[]) => T;
23
+ deps?: readonly SecuritydeptDependencyDescriptor<unknown>[];
24
+ }
25
+ type WithTraitDeps<TDeps extends object> = TDeps;
26
+ interface SecuritydeptExistingProvider<T> {
27
+ provide: SecuritydeptDependencyToken<T>;
28
+ useExisting: SecuritydeptDependencyToken<T>;
29
+ }
30
+ type SecuritydeptProvider<T = unknown> = SecuritydeptTypeProvider<T> | SecuritydeptValueProvider<T> | SecuritydeptClassProvider<T> | SecuritydeptFactoryProvider<T> | SecuritydeptExistingProvider<T>;
31
+ declare function getSecuritydeptProviderToken(provider: SecuritydeptProvider): SecuritydeptDependencyToken<unknown>;
32
+ declare function createProviderIfTokenMissing<TProvider extends SecuritydeptProvider>(providedTokens: ReadonlySet<SecuritydeptDependencyToken<unknown>>, token: SecuritydeptDependencyToken<unknown>, createProvider: () => TProvider): TProvider | null;
33
+ declare function notMissingProvider(provider: SecuritydeptProvider | null): provider is SecuritydeptProvider;
34
+ interface SecuritydeptInjectorTrait {
35
+ get<T>(token: SecuritydeptDependencyToken<T>): T;
36
+ get<T>(token: SecuritydeptDependencyToken<T>, notFoundValue: T): T;
37
+ }
38
+ //#endregion
39
+ //#region src/injection/context.d.ts
40
+ interface SecuritydeptInjectOptions {
41
+ optional?: boolean;
42
+ }
43
+ declare function inject$1<T>(token: SecuritydeptDependencyToken<T>, options?: SecuritydeptInjectOptions & {
44
+ optional?: false;
45
+ }): T;
46
+ declare function inject$1<T>(token: SecuritydeptDependencyToken<T>, options?: SecuritydeptInjectOptions & {
47
+ optional?: true;
48
+ }): T | null;
49
+ declare function tryInjectInInjectionContext<T>(token: SecuritydeptDependencyToken<T>, options?: SecuritydeptInjectOptions): T | null;
50
+ declare function runInInjectionContext$1<ReturnT>(injector: SecuritydeptInjectorTrait, fn: () => ReturnT): ReturnT;
51
+ //#endregion
52
+ //#region src/compat/disposable.d.ts
53
+ declare const SYMBOL_DISPOSE: typeof Symbol.dispose;
54
+ interface DisposableTrait {
55
+ dispose(): void;
56
+ [SYMBOL_DISPOSE](): void;
57
+ }
58
+ declare const SYMBOL_ASYNC_DISPOSE: typeof Symbol.asyncDispose;
59
+ interface AsyncDisposableTrait {
60
+ dispose(): Promise<void>;
61
+ [SYMBOL_ASYNC_DISPOSE](): Promise<void>;
62
+ }
63
+ interface DisposableStackTrait extends DisposableTrait {
64
+ readonly disposed: boolean;
65
+ use<T extends DisposableTrait>(disposable: T): T;
66
+ dispose(): void;
67
+ [SYMBOL_DISPOSE](): void;
68
+ }
69
+ declare const SYMBOL_DISPOSABLE_STACK = "@@disposableStack";
70
+ declare function injectDisposableStackFrom(arg: unknown, isOptions?: boolean): DisposableStackTrait | undefined;
71
+ declare class SimpleDisposableStack implements DisposableStackTrait {
72
+ private readonly stack;
73
+ disposed: boolean;
74
+ use<T extends DisposableTrait>(disposable: T): T;
75
+ dispose(): void;
76
+ [SYMBOL_DISPOSE](): void;
77
+ }
78
+ interface NativeDisposableStackLike {
79
+ readonly disposed: boolean;
80
+ use<T extends DisposableTrait>(disposable: T): T;
81
+ dispose(): void;
82
+ }
83
+ type NativeDisposableStackConstructor = new () => NativeDisposableStackLike;
84
+ declare class StdDisposableStack implements DisposableStackTrait {
85
+ private readonly stack;
86
+ constructor(Stack?: NativeDisposableStackConstructor);
87
+ get disposed(): boolean;
88
+ use<T extends DisposableTrait>(disposable: T): T;
89
+ dispose(): void;
90
+ [SYMBOL_DISPOSE](): void;
91
+ }
92
+ declare function createDisposableStack(): DisposableStackTrait;
93
+ declare function withDisposableStack(index: number, isOptions?: boolean): <TThis, TArgs extends unknown[], TReturn>(target: (this: TThis, ...args: TArgs) => TReturn, _context: ClassMethodDecoratorContext<TThis, (this: TThis, ...args: TArgs) => TReturn>) => (this: TThis, ...args: TArgs) => TReturn;
94
+ //#endregion
95
+ //#region src/injection/injector.d.ts
96
+ declare class SecuritydeptInjector implements SecuritydeptInjectorTrait {
97
+ private readonly runtimeInjector;
98
+ static resolveAndCreate(providers: readonly SecuritydeptProvider[]): SecuritydeptInjector;
99
+ static fromParentInjector(parent: SecuritydeptInjectorTrait, providers: readonly SecuritydeptProvider[]): SecuritydeptInjector;
100
+ static fromRuntimeInjector(runtimeInjector: Injector): SecuritydeptInjector;
101
+ private constructor();
102
+ get<T>(token: SecuritydeptDependencyToken<T>): T;
103
+ get<T>(token: SecuritydeptDependencyToken<T>, notFoundValue: T): T;
104
+ }
105
+ declare const INJECTOR_TOKEN: SecuritydeptInjectionToken<SecuritydeptInjector>;
106
+ //#endregion
107
+ //#region src/compat/observable.d.ts
108
+ declare const SYMBOL_OBSERVABLE: typeof Symbol.observable;
109
+ /** Subscription handle with explicit unsubscribe. */
110
+ interface SubscriptionTrait {
111
+ unsubscribe(): void;
112
+ }
113
+ /** Observer for event streams — mirrors the Observable observer pattern. */
114
+ interface ObserverTrait<T> {
115
+ next(value: T): void;
116
+ error(error: unknown): void;
117
+ complete(): void;
118
+ }
119
+ interface SubscribableTrait<T> {
120
+ subscribe(observer: Partial<ObserverTrait<T>>): SubscriptionTrait;
121
+ }
122
+ interface InteropObservableTrait<T> {
123
+ [SYMBOL_OBSERVABLE](): SubscribableTrait<T>;
124
+ }
125
+ type WithInteropObservableTraitCompat<O extends InteropObservableTrait<unknown>, T extends O extends InteropObservableTrait<infer U> ? U : never> = O & InteropObservableTrait<T>;
126
+ declare function isInteropObservableTrait<T>(value: unknown): value is InteropObservableTrait<T>;
127
+ //#endregion
128
+ //#region src/events/types.d.ts
129
+ /** Subscription handle with explicit unsubscribe. */
130
+ type EventSubscriptionTrait = SubscriptionTrait;
131
+ /** Observer for event streams — mirrors the Observable observer pattern. */
132
+ interface EventObserverTrait<T> {
133
+ next(value: T): void;
134
+ error(error: unknown): void;
135
+ complete(): void;
136
+ }
137
+ /** Read-only event stream — lazy push-based sequence. */
138
+ interface EventStreamTrait<T> extends InteropObservableTrait<T> {
139
+ subscribe(observer: Partial<EventObserverTrait<T>>): EventSubscriptionTrait;
140
+ }
141
+ /** Hot event producer. */
142
+ interface EventSubjectTrait<T> extends EventStreamTrait<T> {
143
+ next(value: T): void;
144
+ error(error: unknown): void;
145
+ complete(): void;
146
+ }
147
+ declare const EventSourceKind: {
148
+ readonly User: "user";
149
+ readonly Timer: "timer";
150
+ readonly Http: "http";
151
+ readonly Storage: "storage";
152
+ readonly Framework: "framework";
153
+ readonly System: "system";
154
+ };
155
+ type EventSourceKind = (typeof EventSourceKind)[keyof typeof EventSourceKind];
156
+ type EventSource = {
157
+ kind: typeof EventSourceKind.User;
158
+ actor?: string;
159
+ } | {
160
+ kind: typeof EventSourceKind.Timer;
161
+ timer: string;
162
+ } | {
163
+ kind: typeof EventSourceKind.Http;
164
+ requestId: string;
165
+ endpoint?: string;
166
+ } | {
167
+ kind: typeof EventSourceKind.Storage;
168
+ operation: string;
169
+ } | {
170
+ kind: typeof EventSourceKind.Framework;
171
+ name: string;
172
+ } | {
173
+ kind: typeof EventSourceKind.System;
174
+ subsystem: string;
175
+ };
176
+ interface RuntimeEventEnvelope<TType extends string, TPayload> {
177
+ id: string;
178
+ type: TType;
179
+ at: number;
180
+ source: EventSource;
181
+ payload: TPayload;
182
+ }
183
+ type EventOperatorFunction<T, R> = (stream: EventStreamTrait<T>) => EventStreamTrait<R>;
184
+ //#endregion
185
+ //#region src/errors/types.d.ts
186
+ /** Recovery actions the user might take. Aligned with server-side `UserRecovery`. */
187
+ declare const UserRecovery: {
188
+ readonly None: "none";
189
+ readonly Retry: "retry";
190
+ readonly RestartFlow: "restart_flow";
191
+ readonly Reauthenticate: "reauthenticate";
192
+ readonly ContactSupport: "contact_support";
193
+ };
194
+ type UserRecovery = (typeof UserRecovery)[keyof typeof UserRecovery];
195
+ /** User-facing error presentation. `code` is the cross-platform stable contract. */
196
+ interface ErrorPresentation {
197
+ code: string;
198
+ message: string;
199
+ recovery: UserRecovery;
200
+ }
201
+ declare const ErrorPresentationTone: {
202
+ readonly Neutral: "neutral";
203
+ readonly Warning: "warning";
204
+ readonly Danger: "danger";
205
+ };
206
+ type ErrorPresentationTone = (typeof ErrorPresentationTone)[keyof typeof ErrorPresentationTone];
207
+ interface ErrorPresentationActionDescriptor {
208
+ recovery: UserRecovery;
209
+ label: string;
210
+ href: string | null;
211
+ }
212
+ interface ErrorPresentationDescriptor {
213
+ code: string | null;
214
+ kind: ClientErrorKind | null;
215
+ source?: string;
216
+ title: string;
217
+ description: string;
218
+ recovery: UserRecovery;
219
+ retryable: boolean;
220
+ tone: ErrorPresentationTone;
221
+ primaryAction: ErrorPresentationActionDescriptor | null;
222
+ }
223
+ interface ReadErrorPresentationDescriptorOptions {
224
+ fallbackTitle?: string;
225
+ fallbackDescription?: string;
226
+ codePresentations?: Readonly<Record<string, ErrorCodePresentationDescriptor>>;
227
+ recoveryLinks?: Partial<Record<UserRecovery, string>>;
228
+ recoveryLabels?: Partial<Record<UserRecovery, string>>;
229
+ }
230
+ interface ErrorCodePresentationDescriptor {
231
+ title: string;
232
+ description: string;
233
+ tone?: ErrorPresentationTone;
234
+ recovery?: UserRecovery;
235
+ }
236
+ /** Machine-facing error kind discriminator. */
237
+ declare const ClientErrorKind: {
238
+ readonly Authorization: "authorization";
239
+ readonly Transport: "transport";
240
+ readonly Server: "server";
241
+ readonly Protocol: "protocol";
242
+ readonly Storage: "storage";
243
+ readonly Configuration: "configuration";
244
+ readonly Unauthenticated: "unauthenticated";
245
+ readonly Unauthorized: "unauthorized";
246
+ readonly Cancelled: "cancelled";
247
+ readonly Timeout: "timeout";
248
+ readonly Internal: "internal";
249
+ };
250
+ type ClientErrorKind = (typeof ClientErrorKind)[keyof typeof ClientErrorKind];
251
+ /** Stable source vocabulary for common client error producers. */
252
+ declare const ClientErrorSource: {
253
+ readonly Transport: "transport";
254
+ readonly Server: "server";
255
+ readonly Client: "client";
256
+ };
257
+ type ClientErrorSource = (typeof ClientErrorSource)[keyof typeof ClientErrorSource];
258
+ //#endregion
259
+ //#region src/errors/client-error.d.ts
260
+ interface ClientErrorFromUnknownOptions {
261
+ message: string;
262
+ code: string;
263
+ source: string;
264
+ }
265
+ interface ClientErrorFromHttpResponseOptions {
266
+ status: number;
267
+ body?: unknown;
268
+ source?: string;
269
+ }
270
+ /**
271
+ * Base client error carrying both machine-facing context and an optional
272
+ * user-facing presentation layer.
273
+ *
274
+ * Top-level `code` and `recovery` provide stable machine contracts for
275
+ * policy decisions without requiring callers to unwrap `presentation`.
276
+ */
277
+ declare class ClientError extends Error {
278
+ readonly kind: ClientErrorKind;
279
+ /**
280
+ * Stable machine-readable error code.
281
+ * Matches `presentation.code` when present, otherwise a default
282
+ * derived from `kind`.
283
+ */
284
+ readonly code: string;
285
+ /** Recovery hint at the machine level. */
286
+ readonly recovery: UserRecovery;
287
+ /** Whether this error is safe to retry. */
288
+ readonly retryable: boolean;
289
+ /** Structured user-facing error presentation from the server. */
290
+ readonly presentation?: ErrorPresentation;
291
+ /** Source subsystem or component that produced the error. */
292
+ readonly source?: string;
293
+ constructor(options: {
294
+ kind: ClientErrorKind;
295
+ message: string;
296
+ code?: string;
297
+ recovery?: UserRecovery;
298
+ retryable?: boolean;
299
+ presentation?: ErrorPresentation;
300
+ source?: string;
301
+ cause?: unknown;
302
+ });
303
+ /** Create a `ClientError` from a server error response body. */
304
+ static fromServerError(body: {
305
+ kind?: string;
306
+ code?: string;
307
+ message?: string;
308
+ recovery?: string;
309
+ presentation?: {
310
+ code?: string;
311
+ message?: string;
312
+ recovery?: string;
313
+ };
314
+ }, overrides?: {
315
+ kind?: ClientErrorKind;
316
+ source?: string;
317
+ }): ClientError;
318
+ static fromUnknown(error: unknown, options: ClientErrorFromUnknownOptions): ClientError;
319
+ /**
320
+ * Create a `ClientError` from an HTTP response status and optional body.
321
+ * Used when a non-success status is unexpected.
322
+ */
323
+ static fromHttpResponse(options: ClientErrorFromHttpResponseOptions): ClientError;
324
+ }
325
+ //#endregion
326
+ //#region src/cancellation/types.d.ts
327
+ /** Cancelable operation handle. */
328
+ interface CancelableHandle {
329
+ cancel(): void;
330
+ }
331
+ interface CancellationTokenErrorData {
332
+ readonly cancellationError: ClientError;
333
+ readonly reason: unknown;
334
+ }
335
+ /** Cooperative cancellation token — consumers check / subscribe to cancellation. */
336
+ interface CancellationTokenTrait extends InteropObservableTrait<CancellationTokenErrorData> {
337
+ readonly isCancellationRequested: boolean;
338
+ readonly cancellationError?: ClientError | undefined;
339
+ readonly reason?: unknown;
340
+ onCancellationRequested(listener: (data: CancellationTokenErrorData) => void): DisposableTrait;
341
+ throwIfCancellationRequested(): void;
342
+ }
343
+ interface CancellationTokenOptions {
344
+ cancellationToken?: CancellationTokenTrait;
345
+ }
346
+ /** Cancellation source — producer-side control. */
347
+ interface CancellationTokenSourceTrait {
348
+ readonly token: CancellationTokenTrait;
349
+ cancel(reason?: unknown): void;
350
+ }
351
+ //#endregion
352
+ //#region src/signals/types.d.ts
353
+ interface SignalOptions<T> {
354
+ equals?: (a: T, b: T) => boolean;
355
+ }
356
+ /**
357
+ * Read-only signal interface.
358
+ * Semantics align with TC39 Signals proposal, but uses an SDK-owned thin protocol
359
+ * to avoid coupling to any specific polyfill or standard implementation.
360
+ */
361
+ interface ReadableSignalTrait<T> extends InteropObservableTrait<T> {
362
+ readonly equals: (a: unknown, b: unknown) => boolean;
363
+ /** Return the current snapshot value. */
364
+ get(): T;
365
+ /**
366
+ * Watch value invalidations.
367
+ * The stream does not emit the current value on subscription; use
368
+ * `[SYMBOL_OBSERVABLE]()` when value replay is required.
369
+ */
370
+ watchStream(): EventStreamTrait<void>;
371
+ }
372
+ /**
373
+ * Writable signal interface.
374
+ * State transitions should be controlled by the client / service layer;
375
+ * external consumers typically only see the read-only projection.
376
+ */
377
+ interface WritableSignalTrait<T> extends ReadableSignalTrait<T> {
378
+ set(value: T): void;
379
+ }
380
+ /**
381
+ * Computed (derived) signal — always read-only, value is derived from
382
+ * other signals automatically.
383
+ */
384
+ interface ComputedSignalTrait<T> extends ReadableSignalTrait<T> {}
385
+ declare const ResourceStatus: {
386
+ readonly Idle: "idle";
387
+ readonly Loading: "loading";
388
+ readonly LoadingError: "loading_error";
389
+ readonly Reloading: "reloading";
390
+ readonly Resolved: "resolved";
391
+ readonly Error: "error";
392
+ };
393
+ type ResourceStatus = (typeof ResourceStatus)[keyof typeof ResourceStatus];
394
+ interface ResourceIdleSnapshot {
395
+ readonly status: typeof ResourceStatus.Idle;
396
+ }
397
+ interface ResourceLoadingSnapshot {
398
+ readonly status: typeof ResourceStatus.Loading;
399
+ }
400
+ interface ResourceLoadingErrorSnapshot {
401
+ readonly status: typeof ResourceStatus.LoadingError;
402
+ readonly error: unknown;
403
+ }
404
+ interface ResourceReloadingSnapshot<T> {
405
+ readonly status: typeof ResourceStatus.Reloading;
406
+ readonly value: T;
407
+ }
408
+ interface ResourceResolvedSnapshot<T> {
409
+ readonly status: typeof ResourceStatus.Resolved;
410
+ readonly value: T;
411
+ }
412
+ interface ResourceErrorSnapshot<T> {
413
+ readonly status: typeof ResourceStatus.Error;
414
+ readonly value: T;
415
+ readonly error: unknown;
416
+ }
417
+ type ResourceSnapshot<T> = ResourceIdleSnapshot | ResourceLoadingSnapshot | ResourceLoadingErrorSnapshot | ResourceReloadingSnapshot<T> | ResourceResolvedSnapshot<T> | ResourceErrorSnapshot<T>;
418
+ interface ResourceWhenValueOptions {
419
+ readonly cancellationToken?: CancellationTokenTrait;
420
+ readonly staleValueWhenError?: boolean;
421
+ }
422
+ interface ResourceTrait<T> extends DisposableTrait, InteropObservableTrait<ResourceSnapshot<T>> {
423
+ readonly value: ReadableSignalTrait<T>;
424
+ readonly status: ReadableSignalTrait<ResourceStatus>;
425
+ readonly error: ReadableSignalTrait<unknown | undefined>;
426
+ readonly isLoading: ReadableSignalTrait<boolean>;
427
+ readonly snapshot: ReadableSignalTrait<ResourceSnapshot<T>>;
428
+ hasValue(): boolean;
429
+ whenValue(options?: ResourceWhenValueOptions): Promise<T>;
430
+ }
431
+ //#endregion
432
+ //#region src/scheduling/types.d.ts
433
+ interface TimestampProviderTrait {
434
+ /** Return current epoch milliseconds. */
435
+ now(): number;
436
+ }
437
+ /** Injectable time capability for host timers and deterministic tests. */
438
+ interface TimeTrait extends TimestampProviderTrait {
439
+ /** Return current epoch milliseconds. */
440
+ setTimeout(handler: () => void, delayMs: number): unknown;
441
+ clearTimeout(handle: unknown): void;
442
+ }
443
+ declare const TIME_TRAIT_TOKEN: SecuritydeptInjectionToken<TimeTrait>;
444
+ declare const IDLE_CALLBACK_TRAIT_TOKEN: SecuritydeptInjectionToken<IdleCallbackTrait | null>;
445
+ /** Injectable idle-callback capability for hosts that explicitly support it. */
446
+ interface IdleCallbackTrait {
447
+ requestIdleCallback(callback: () => void): unknown;
448
+ cancelIdleCallback(handle: unknown): void;
449
+ }
450
+ //#endregion
451
+ //#region src/cancellation/create.d.ts
452
+ /**
453
+ * Create a `CancellationTokenSource` that produces a cooperative cancellation token.
454
+ */
455
+ declare function createCancellationTokenSource(): CancellationTokenSourceTrait;
456
+ declare function isCancellationTokenTrait(obj: unknown): obj is CancellationTokenTrait;
457
+ //#endregion
458
+ //#region src/cancellation/linked.d.ts
459
+ /**
460
+ * Create a cancellation token that fires when ANY of the given source tokens
461
+ * is cancelled.
462
+ *
463
+ * - Zero sources → returns a token that is never cancelled.
464
+ * - One source → returns that source directly (no allocation).
465
+ * - N sources → creates a linked source, subscribes to all, and cleans up
466
+ * subscriptions once the linked token fires.
467
+ *
468
+ * @example
469
+ * const cts = createCancellationTokenSource();
470
+ * const linked = createLinkedCancellationToken(clientRoot.token, cts.token);
471
+ * await transport.execute({ ..., cancellationToken: linked });
472
+ */
473
+ declare function createLinkedCancellationToken(...sources: readonly (CancellationTokenTrait | undefined | null)[]): CancellationTokenTrait & DisposableTrait;
474
+ //#endregion
475
+ //#region src/rx/event.d.ts
476
+ type RxEventStreamProducer<T> = (observer: EventObserverTrait<T>) => (() => void) | void;
477
+ type RxEventStreamInput<T> = ObservableInput<T> | InteropObservableTrait<T> | SubscribableTrait<T>;
478
+ declare class RxEventStream<T> extends Observable<T> implements EventStreamTrait<T>, InteropObservableTrait<T> {
479
+ constructor(source: RxEventStreamInput<T> | RxEventStreamProducer<T>);
480
+ [SYMBOL_OBSERVABLE](): RxEventStream<T>;
481
+ static fromObservableInput<T>(input: RxEventStreamInput<T>): RxEventStream<T>;
482
+ pipe(): RxEventStream<T>;
483
+ pipe<A>(op1: OperatorFunction<T, A>): RxEventStream<A>;
484
+ pipe<A, B>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>): RxEventStream<B>;
485
+ pipe<A, B, C>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>): RxEventStream<C>;
486
+ pipe<A, B, C, D>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>): RxEventStream<D>;
487
+ pipe<A, B, C, D, E>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>): RxEventStream<E>;
488
+ pipe<A, B, C, D, E, F>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>): RxEventStream<F>;
489
+ pipe<A, B, C, D, E, F, G>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>): RxEventStream<G>;
490
+ pipe<A, B, C, D, E, F, G, H>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H>): RxEventStream<H>;
491
+ pipe<A, B, C, D, E, F, G, H, I>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H>, op9: OperatorFunction<H, I>): RxEventStream<I>;
492
+ pipe<A, B, C, D, E, F, G, H, I>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H>, op9: OperatorFunction<H, I>, ...operations: OperatorFunction<any, any>[]): RxEventStream<unknown>;
493
+ }
494
+ declare class RxEventSubject<T> extends Subject<T> implements EventSubjectTrait<T> {
495
+ [SYMBOL_OBSERVABLE](): RxEventStream<T>;
496
+ asObservable(): RxEventStream<T>;
497
+ }
498
+ declare class RxEventReplaySubject<T> extends ReplaySubject<T> implements EventSubjectTrait<T> {
499
+ [SYMBOL_OBSERVABLE](): RxEventStream<T>;
500
+ asObservable(): RxEventStream<T>;
501
+ }
502
+ //#endregion
503
+ //#region src/rx/signal.d.ts
504
+ interface RxSignalDirtyEvent<T> {
505
+ epoch: number;
506
+ signal: ReadableSignalTrait<T>;
507
+ }
508
+ type RxSignalOptions<T> = SignalOptions<T>;
509
+ type RxSignalWatchScheduler<THandle = unknown> = (flush: () => void) => THandle;
510
+ type RxSignalWatchCanceller<THandle = unknown> = (handle: THandle) => void;
511
+ interface RxSignalWatchOptions {
512
+ schedule: RxSignalWatchScheduler;
513
+ cancel?: RxSignalWatchCanceller;
514
+ }
515
+ declare abstract class RxSignal<T> implements ReadableSignalTrait<T>, InteropObservableTrait<T> {
516
+ protected static globalEpoch: number;
517
+ protected static currentContext: RxComputedSignal<any> | null;
518
+ protected valueEqVersion: number;
519
+ readonly equals: (a: unknown, b: unknown) => boolean;
520
+ abstract get(): T;
521
+ abstract dirtyObservable(): Observable<RxSignalDirtyEvent<T>>;
522
+ protected constructor(options: RxSignalOptions<T> | undefined);
523
+ watchStream(options?: RxSignalWatchOptions): RxEventStream<void>;
524
+ [SYMBOL_OBSERVABLE](): RxEventStream<T>;
525
+ abstract validateForEpoch(epoch: number): void;
526
+ }
527
+ declare class RxStateSignal<T> extends RxSignal<T> implements InteropObservableTrait<T>, WritableSignalTrait<T> {
528
+ protected dirtySubject: Subject<RxSignalDirtyEvent<T>>;
529
+ protected value: BehaviorSubject<T>;
530
+ protected constructor(initialValue: T, options: RxSignalOptions<T> | undefined);
531
+ set(input: T): void;
532
+ static fromInitialValue<T>(initialValue: T, options?: RxSignalOptions<T>): RxStateSignalCompat<T>;
533
+ get(): T;
534
+ validateForEpoch(): void;
535
+ dirtyObservable(): Observable<RxSignalDirtyEvent<T>>;
536
+ [SYMBOL_OBSERVABLE](): RxEventStream<T>;
537
+ }
538
+ type RxStateSignalCompat<T> = WithInteropObservableTraitCompat<RxStateSignal<T>, T>;
539
+ type AnyRxSignal = RxSignal<any> & {
540
+ valueEqVersion: number;
541
+ };
542
+ type ComputedCacheState<T> = {
543
+ kind: "empty";
544
+ } | {
545
+ kind: "value";
546
+ value: T;
547
+ } | {
548
+ kind: "error";
549
+ error: unknown;
550
+ };
551
+ declare class RxComputedSignal<T> extends RxSignal<T> {
552
+ protected readonly computeFn: () => T;
553
+ protected cacheState: ComputedCacheState<T>;
554
+ protected sources: ReadonlyMap<AnyRxSignal, number>;
555
+ protected sourcesSubject: BehaviorSubject<ReadonlyMap<AnyRxSignal, number>>;
556
+ private validatedEpoch;
557
+ private isComputing;
558
+ private collectingSources;
559
+ private dirty$;
560
+ protected constructor(computeFn: () => T, options: RxSignalOptions<T> | undefined);
561
+ markDependency(signal: RxSignal<any>): void;
562
+ protected cacheStatesEqual(left: ComputedCacheState<T>, right: ComputedCacheState<T>): boolean;
563
+ protected recompute(): void;
564
+ validateForEpoch(epoch: number): void;
565
+ get(): T;
566
+ dirtyObservable(): Observable<RxSignalDirtyEvent<T>>;
567
+ static computed<T>(fn: () => T, options?: RxSignalOptions<T>): RxComputedSignalCompat<T>;
568
+ }
569
+ type RxComputedSignalCompat<T> = WithInteropObservableTraitCompat<RxComputedSignal<T>, T>;
570
+ //#endregion
571
+ //#region src/rx/resource.d.ts
572
+ interface RxResourceStreamContext<T, R> {
573
+ readonly request: R;
574
+ readonly previous: ResourceSnapshot<T>;
575
+ readonly cancellationToken: CancellationTokenTrait;
576
+ }
577
+ interface RxResourceOptions<T, R = undefined> {
578
+ readonly request?: ReadableSignalTrait<R | undefined> | (() => R | undefined);
579
+ readonly stream: (context: RxResourceStreamContext<T, R>) => ObservableInput<T>;
580
+ }
581
+ declare abstract class RxResourceBase<T> implements ResourceTrait<T>, InteropObservableTrait<ResourceSnapshot<T>> {
582
+ abstract readonly snapshot: ReadableSignalTrait<ResourceSnapshot<T>>;
583
+ readonly value: RxComputedSignalCompat<T>;
584
+ readonly status: RxComputedSignalCompat<ResourceStatus>;
585
+ readonly error: RxComputedSignalCompat<unknown | undefined>;
586
+ readonly isLoading: RxComputedSignalCompat<boolean>;
587
+ protected readonly destroyed: RxStateSignalCompat<boolean>;
588
+ protected readonly destroyed$: Observable<true>;
589
+ protected constructor();
590
+ hasValue(): boolean;
591
+ whenValue(options?: ResourceWhenValueOptions): Promise<T>;
592
+ dispose(): void;
593
+ [SYMBOL_DISPOSE](): void;
594
+ [SYMBOL_OBSERVABLE](): RxEventStream<ResourceSnapshot<T>>;
595
+ }
596
+ declare class RxResource<T, R = undefined> extends RxResourceBase<T> {
597
+ private readonly options;
598
+ readonly snapshot: RxStateSignalCompat<ResourceSnapshot<T>>;
599
+ constructor(options: RxResourceOptions<T, R>);
600
+ private connect;
601
+ static create<T, R = undefined>(options: RxResourceOptions<T, R>): RxResource<T, R>;
602
+ }
603
+ declare function resourceFromSnapshots<T>(source: () => ResourceSnapshot<T>): WithInteropObservableTraitCompat<ResourceTrait<T>, ResourceSnapshot<T>>;
604
+ declare function mapResource<T, U>(source: ResourceTrait<T>, mapValue: (value: T) => U): WithInteropObservableTraitCompat<ResourceTrait<U>, ResourceSnapshot<U>>;
605
+ declare function rxResource<T, R = undefined>(options: RxResourceOptions<T, R>): WithInteropObservableTraitCompat<ResourceTrait<T>, ResourceSnapshot<T>>;
606
+ //#endregion
607
+ export { ErrorPresentationDescriptor as $, ResourceIdleSnapshot as A, withDisposableStack as At, WritableSignalTrait as B, SecuritydeptExistingProvider as Bt, IdleCallbackTrait as C, SYMBOL_ASYNC_DISPOSE as Ct, ComputedSignalTrait as D, StdDisposableStack as Dt, TimestampProviderTrait as E, SimpleDisposableStack as Et, ResourceSnapshot as F, SecurityDeptOptional as Ft, ClientError as G, SecuritydeptTypeProvider as Gt, CancellationTokenOptions as H, SecuritydeptInjectionToken as Ht, ResourceStatus as I, SecuritydeptAbstractType as It, ClientErrorKind as J, createProviderIfTokenMissing as Jt, ClientErrorFromHttpResponseOptions as K, SecuritydeptValueProvider as Kt, ResourceTrait as L, SecuritydeptClassProvider as Lt, ResourceLoadingSnapshot as M, inject$1 as Mt, ResourceReloadingSnapshot as N, runInInjectionContext$1 as Nt, ReadableSignalTrait as O, createDisposableStack as Ot, ResourceResolvedSnapshot as P, tryInjectInInjectionContext as Pt, ErrorPresentationActionDescriptor as Q, ResourceWhenValueOptions as R, SecuritydeptDependencyDescriptor as Rt, IDLE_CALLBACK_TRAIT_TOKEN as S, DisposableTrait as St, TimeTrait as T, SYMBOL_DISPOSE as Tt, CancellationTokenSourceTrait as U, SecuritydeptInjectorTrait as Ut, CancelableHandle as V, SecuritydeptFactoryProvider as Vt, CancellationTokenTrait as W, SecuritydeptProvider as Wt, ErrorCodePresentationDescriptor as X, notMissingProvider as Xt, ClientErrorSource as Y, getSecuritydeptProviderToken as Yt, ErrorPresentation as Z, RxEventStream as _, isInteropObservableTrait as _t, resourceFromSnapshots as a, EventSource as at, createCancellationTokenSource as b, AsyncDisposableTrait as bt, RxComputedSignalCompat as c, EventSubjectTrait as ct, RxSignalWatchCanceller as d, InteropObservableTrait as dt, ErrorPresentationTone as et, RxSignalWatchOptions as f, ObserverTrait as ft, RxEventReplaySubject as g, WithInteropObservableTraitCompat as gt, RxStateSignalCompat as h, SubscriptionTrait as ht, mapResource as i, EventOperatorFunction as it, ResourceLoadingErrorSnapshot as j, SecuritydeptInjectOptions as jt, ResourceErrorSnapshot as k, injectDisposableStackFrom as kt, RxSignalDirtyEvent as l, EventSubscriptionTrait as lt, RxStateSignal as m, SubscribableTrait as mt, RxResourceOptions as n, UserRecovery as nt, rxResource as o, EventSourceKind as ot, RxSignalWatchScheduler as p, SYMBOL_OBSERVABLE as pt, ClientErrorFromUnknownOptions as q, WithTraitDeps as qt, RxResourceStreamContext as r, EventObserverTrait as rt, RxComputedSignal as s, EventStreamTrait as st, RxResource as t, ReadErrorPresentationDescriptorOptions as tt, RxSignalOptions as u, RuntimeEventEnvelope as ut, RxEventSubject as v, INJECTOR_TOKEN as vt, TIME_TRAIT_TOKEN as w, SYMBOL_DISPOSABLE_STACK as wt, isCancellationTokenTrait as x, DisposableStackTrait as xt, createLinkedCancellationToken as y, SecuritydeptInjector as yt, SignalOptions as z, SecuritydeptDependencyToken as zt };
608
+ //# sourceMappingURL=index-Cg_iY2yY.d.mts.map