@dvina/sdk 3.3.124

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 (87) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +449 -0
  3. package/dist/_generated_documents-DF34ZUJ3.js +4 -0
  4. package/dist/_generated_documents-DF34ZUJ3.js.map +1 -0
  5. package/dist/_generated_documents-W4RHWJ4B.cjs +2041 -0
  6. package/dist/_generated_documents-W4RHWJ4B.cjs.map +1 -0
  7. package/dist/adapters/angular/index.cjs +163 -0
  8. package/dist/adapters/angular/index.cjs.map +1 -0
  9. package/dist/adapters/angular/index.d.cts +254 -0
  10. package/dist/adapters/angular/index.d.ts +254 -0
  11. package/dist/adapters/angular/index.js +159 -0
  12. package/dist/adapters/angular/index.js.map +1 -0
  13. package/dist/adapters/react/index.cjs +51 -0
  14. package/dist/adapters/react/index.cjs.map +1 -0
  15. package/dist/adapters/react/index.d.cts +62 -0
  16. package/dist/adapters/react/index.d.ts +62 -0
  17. package/dist/adapters/react/index.js +49 -0
  18. package/dist/adapters/react/index.js.map +1 -0
  19. package/dist/billing/index.cjs +26 -0
  20. package/dist/billing/index.cjs.map +1 -0
  21. package/dist/billing/index.d.cts +338 -0
  22. package/dist/billing/index.d.ts +338 -0
  23. package/dist/billing/index.js +5 -0
  24. package/dist/billing/index.js.map +1 -0
  25. package/dist/chunk-4QKWHQT2.cjs +104 -0
  26. package/dist/chunk-4QKWHQT2.cjs.map +1 -0
  27. package/dist/chunk-5WRI5ZAA.js +29 -0
  28. package/dist/chunk-5WRI5ZAA.js.map +1 -0
  29. package/dist/chunk-7JUBGIQ2.js +1008 -0
  30. package/dist/chunk-7JUBGIQ2.js.map +1 -0
  31. package/dist/chunk-7XBJ77RJ.js +103 -0
  32. package/dist/chunk-7XBJ77RJ.js.map +1 -0
  33. package/dist/chunk-DHUFVGJR.cjs +20389 -0
  34. package/dist/chunk-DHUFVGJR.cjs.map +1 -0
  35. package/dist/chunk-DZUJEN5N.cjs +32 -0
  36. package/dist/chunk-DZUJEN5N.cjs.map +1 -0
  37. package/dist/chunk-GDK2HJTF.cjs +1346 -0
  38. package/dist/chunk-GDK2HJTF.cjs.map +1 -0
  39. package/dist/chunk-KG3GNTYI.js +1339 -0
  40. package/dist/chunk-KG3GNTYI.js.map +1 -0
  41. package/dist/chunk-KV5SP7RP.cjs +114 -0
  42. package/dist/chunk-KV5SP7RP.cjs.map +1 -0
  43. package/dist/chunk-NPIKZKLU.cjs +27 -0
  44. package/dist/chunk-NPIKZKLU.cjs.map +1 -0
  45. package/dist/chunk-OAAZZUYL.cjs +1517 -0
  46. package/dist/chunk-OAAZZUYL.cjs.map +1 -0
  47. package/dist/chunk-P4BYTXZ7.js +98 -0
  48. package/dist/chunk-P4BYTXZ7.js.map +1 -0
  49. package/dist/chunk-PDM2KR7T.js +392 -0
  50. package/dist/chunk-PDM2KR7T.js.map +1 -0
  51. package/dist/chunk-QOZI2HY5.js +24 -0
  52. package/dist/chunk-QOZI2HY5.js.map +1 -0
  53. package/dist/chunk-RFBLNKW6.js +20035 -0
  54. package/dist/chunk-RFBLNKW6.js.map +1 -0
  55. package/dist/chunk-UELAE75E.cjs +408 -0
  56. package/dist/chunk-UELAE75E.cjs.map +1 -0
  57. package/dist/client-9Rwj21T9.d.cts +77 -0
  58. package/dist/client-Bskq7sc_.d.ts +77 -0
  59. package/dist/client-CLhQragb.d.cts +446 -0
  60. package/dist/client-CLhQragb.d.ts +446 -0
  61. package/dist/error-CsVoUTY8.d.cts +95 -0
  62. package/dist/error-CsVoUTY8.d.ts +95 -0
  63. package/dist/index-BrGSfyXq.d.cts +79 -0
  64. package/dist/index-zPcVLagO.d.ts +79 -0
  65. package/dist/index.cjs +1675 -0
  66. package/dist/index.cjs.map +1 -0
  67. package/dist/index.d.cts +9943 -0
  68. package/dist/index.d.ts +9943 -0
  69. package/dist/index.js +10 -0
  70. package/dist/index.js.map +1 -0
  71. package/dist/inference/index.cjs +70 -0
  72. package/dist/inference/index.cjs.map +1 -0
  73. package/dist/inference/index.d.cts +80 -0
  74. package/dist/inference/index.d.ts +80 -0
  75. package/dist/inference/index.js +5 -0
  76. package/dist/inference/index.js.map +1 -0
  77. package/dist/pagination/index.cjs +34 -0
  78. package/dist/pagination/index.cjs.map +1 -0
  79. package/dist/pagination/index.d.cts +6 -0
  80. package/dist/pagination/index.d.ts +6 -0
  81. package/dist/pagination/index.js +5 -0
  82. package/dist/pagination/index.js.map +1 -0
  83. package/dist/sync-engine-DVKQO-1-.d.cts +423 -0
  84. package/dist/sync-engine-cLwTqdjv.d.ts +423 -0
  85. package/dist/types-2RotD0Ab.d.cts +102 -0
  86. package/dist/types-2RotD0Ab.d.ts +102 -0
  87. package/package.json +143 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"_generated_documents-W4RHWJ4B.cjs"}
@@ -0,0 +1,163 @@
1
+ 'use strict';
2
+
3
+ var chunkDHUFVGJR_cjs = require('../../chunk-DHUFVGJR.cjs');
4
+ require('../../chunk-4QKWHQT2.cjs');
5
+ require('../../chunk-UELAE75E.cjs');
6
+ require('../../chunk-GDK2HJTF.cjs');
7
+ require('../../chunk-KV5SP7RP.cjs');
8
+ require('../../chunk-OAAZZUYL.cjs');
9
+ require('../../chunk-DZUJEN5N.cjs');
10
+ var core = require('@angular/core');
11
+
12
+ function toSignal(ref, options) {
13
+ const destroyRef = options?.destroyRef ?? core.inject(core.DestroyRef);
14
+ const sig = core.signal(ref.current);
15
+ let running = true;
16
+ (async () => {
17
+ try {
18
+ for await (const value of ref) {
19
+ if (!running) break;
20
+ sig.set(value);
21
+ }
22
+ } catch {
23
+ }
24
+ })();
25
+ destroyRef.onDestroy(() => {
26
+ running = false;
27
+ ref.dispose();
28
+ });
29
+ return sig.asReadonly();
30
+ }
31
+ function dvnResource(config) {
32
+ const destroyRef = core.inject(core.DestroyRef);
33
+ const hasParams = "params" in config && config.params !== void 0;
34
+ const _value = core.signal(void 0);
35
+ const _status = core.signal("idle");
36
+ const _error = core.signal(void 0);
37
+ let abortController = null;
38
+ let streamRunning = false;
39
+ let currentQueryRef = null;
40
+ const cleanup = () => {
41
+ abortController?.abort();
42
+ abortController = null;
43
+ streamRunning = false;
44
+ currentQueryRef?.dispose();
45
+ currentQueryRef = null;
46
+ };
47
+ const load = (params) => {
48
+ cleanup();
49
+ _error.set(void 0);
50
+ const hadValue = core.untracked(() => _value() !== void 0);
51
+ _status.set(hadValue ? "reloading" : "loading");
52
+ abortController = new AbortController();
53
+ const ctx = hasParams ? { params, abortSignal: abortController.signal } : { abortSignal: abortController.signal };
54
+ const result = config.loader(ctx);
55
+ if (isAsyncIterable(result)) {
56
+ if (hasDispose(result)) {
57
+ currentQueryRef = result;
58
+ }
59
+ streamRunning = true;
60
+ const capturedController = abortController;
61
+ (async () => {
62
+ try {
63
+ for await (const val of result) {
64
+ if (!streamRunning) break;
65
+ _value.set(val);
66
+ _status.set("resolved");
67
+ _error.set(void 0);
68
+ }
69
+ } catch (err) {
70
+ if (!streamRunning || capturedController.signal.aborted) return;
71
+ const wrapped = err instanceof Error ? err : new Error(String(err));
72
+ _error.set(wrapped);
73
+ _status.set("error");
74
+ }
75
+ })();
76
+ } else {
77
+ const capturedController = abortController;
78
+ result.then(
79
+ (val) => {
80
+ if (capturedController.signal.aborted) return;
81
+ _value.set(val);
82
+ _status.set("resolved");
83
+ },
84
+ (err) => {
85
+ if (capturedController.signal.aborted) return;
86
+ if (err instanceof DOMException && err.name === "AbortError") return;
87
+ const wrapped = err instanceof Error ? err : new Error(String(err));
88
+ _error.set(wrapped);
89
+ _status.set("error");
90
+ }
91
+ );
92
+ }
93
+ };
94
+ if (hasParams) {
95
+ core.effect(() => {
96
+ const params = config.params();
97
+ if (params !== void 0) {
98
+ load(params);
99
+ } else {
100
+ cleanup();
101
+ _value.set(void 0);
102
+ _status.set("idle");
103
+ _error.set(void 0);
104
+ }
105
+ });
106
+ } else {
107
+ load();
108
+ }
109
+ destroyRef.onDestroy(() => {
110
+ cleanup();
111
+ });
112
+ const status = _status.asReadonly();
113
+ const isLoading = core.computed(() => {
114
+ const s = _status();
115
+ return s === "loading" || s === "reloading";
116
+ });
117
+ return {
118
+ value: _value.asReadonly(),
119
+ status,
120
+ isLoading,
121
+ error: _error.asReadonly(),
122
+ hasValue: () => _value() !== void 0,
123
+ reload() {
124
+ if (hasParams) {
125
+ const params = config.params();
126
+ if (params !== void 0) {
127
+ load(params);
128
+ }
129
+ } else {
130
+ load();
131
+ }
132
+ },
133
+ destroy() {
134
+ cleanup();
135
+ _value.set(void 0);
136
+ _status.set("idle");
137
+ _error.set(void 0);
138
+ }
139
+ };
140
+ }
141
+ function isAsyncIterable(value) {
142
+ return value != null && typeof value === "object" && Symbol.asyncIterator in value;
143
+ }
144
+ function hasDispose(value) {
145
+ return value != null && typeof value === "object" && "dispose" in value && typeof value.dispose === "function";
146
+ }
147
+ function provideDvina(optionsOrFactory) {
148
+ return core.makeEnvironmentProviders([
149
+ {
150
+ provide: chunkDHUFVGJR_cjs.DvinaSdk,
151
+ useFactory: () => {
152
+ const options = typeof optionsOrFactory === "function" ? optionsOrFactory() : optionsOrFactory;
153
+ return new chunkDHUFVGJR_cjs.DvinaSdk(options);
154
+ }
155
+ }
156
+ ]);
157
+ }
158
+
159
+ exports.dvnResource = dvnResource;
160
+ exports.provideDvina = provideDvina;
161
+ exports.toSignal = toSignal;
162
+ //# sourceMappingURL=index.cjs.map
163
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/adapters/angular/index.ts"],"names":["inject","DestroyRef","signal","untracked","effect","computed","makeEnvironmentProviders","DvinaSdk"],"mappings":";;;;;;;;;;;AAkGO,SAAS,QAAA,CAAY,KAAuB,OAAA,EAAkD;AACpG,EAAA,MAAM,UAAA,GAAa,OAAA,EAAS,UAAA,IAAcA,WAAA,CAAOC,eAAU,CAAA;AAC3D,EAAA,MAAM,GAAA,GAAMC,WAAA,CAAsB,G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AA,EAASC,0BAAA;AAAA,MACT,YAAY,MAAM;AACjB,QAAA,MAAM,OAAA,GAAU,OAAO,gBAAA,KAAqB,UAAA,GAAa,kBAAiB,GAAI,gBAAA;AAC9E,QAAA,OAAO,IAAIA,2BAAS,OAAO,CAAA;AAAA,MAC5B;AAAA;AACD,GACA,CAAA;AACF","file":"index.cjs","sourcesContent":["/**\n * Angular adapter for @dvina/sdk.\n *\n * Provides primitives for integrating the Dvina SDK with Angular's DI and signal system:\n *\n * - {@link provideDvina} — register a singleton `DvinaSdk` instance in the Angular DI system\n * - {@link toSignal} — lightweight converter from `DvinaQueryRef` to a readonly `Signal`\n * - {@link dvnResource} — full resource primitive inspired by Angular's `resource()` API,\n * supporting both `Promise` and `AsyncIterable` loaders with reactive params tracking,\n * status/error signals, and automatic cleanup.\n *\n * @example\n * ```typescript\n * import { provideDvina, toSignal, dvnResource } from '@dvina/sdk/angular';\n * import { DvinaSdk } from '@dvina/sdk';\n *\n * // app.config.ts\n * export const appConfig: ApplicationConfig = {\n * providers: [\n * provideDvina(() => ({\n * getToken: (opts) => inject(AuthService).getAccessTokenSilently(opts),\n * language: () => inject(TranslocoService).getActiveLang(),\n * })),\n * ],\n * };\n *\n * // component.ts\n * @Component({ ... })\n * class ReportsComponent {\n * private sdk = inject(DvinaSdk);\n *\n * // Simple signal conversion\n * reports = toSignal(this.sdk.reports({ first: 20 }).watch());\n *\n * // Full resource with status tracking\n * reportResource = dvnResource({\n * params: () => ({ first: 20 }),\n * loader: ({ params }) => this.sdk.reports(params).watch(),\n * });\n * }\n * ```\n *\n * @packageDocumentation\n */\n\nimport {\n\ttype EnvironmentProviders,\n\ttype Signal,\n\tcomputed,\n\tDestroyRef,\n\teffect,\n\tinject,\n\tmakeEnvironmentProviders,\n\tsignal,\n\tuntracked,\n} from '@angular/core';\nimport { DvinaSdk } from '../../_generated_sdk.js';\nimport type { DvinaSdkOptions } from '../../client.js';\nimport type { DvinaQueryRef } from '../../types.js';\n\nexport interface ToSignalOptions {\n\t/**\n\t * Optional DestroyRef for automatic cleanup. If not provided, `inject(DestroyRef)`\n\t * is called — which requires an injection context (constructor, field initializer,\n\t * or `runInInjectionContext`).\n\t *\n\t * Pass explicitly when calling outside an injection context.\n\t *\n\t * Follows the same convention as Angular's `takeUntilDestroyed()`.\n\t */\n\tdestroyRef?: DestroyRef;\n}\n\n/**\n * Convert a `DvinaQueryRef` (AsyncIterable) into a readonly Angular Signal.\n *\n * The signal updates automatically whenever the underlying Dexie-based SyncEngine emits new data.\n * Cleanup (disposal of the async iterable) happens automatically when the component/service\n * is destroyed via `DestroyRef`.\n *\n * Must be called in an **injection context** (field initializer, constructor,\n * or `runInInjectionContext`) unless `options.destroyRef` is provided explicitly.\n *\n * @param ref - A DvinaQueryRef returned by `.watch()` on any SDK query\n * @param options - Optional configuration\n * @returns A readonly Signal that reflects the latest value from the query ref\n *\n * @example\n * ```typescript\n * // Field initializer (most common)\n * reports = toSignal(this.sdk.reports({ first: 20 }).watch());\n *\n * // With explicit DestroyRef (for use outside injection context)\n * const destroyRef = inject(DestroyRef);\n * // ... later, in a method:\n * this.reports = toSignal(ref, { destroyRef });\n * ```\n */\nexport function toSignal<T>(ref: DvinaQueryRef<T>, options?: ToSignalOptions): Signal<T | undefined> {\n\tconst destroyRef = options?.destroyRef ?? inject(DestroyRef);\n\tconst sig = signal<T | undefined>(ref.current);\n\n\tlet running = true;\n\n\t// Consume the AsyncIterable in the background, updating the signal on each emission\n\t(async () => {\n\t\ttry {\n\t\t\tfor await (const value of ref) {\n\t\t\t\tif (!running) break;\n\t\t\t\tsig.set(value);\n\t\t\t}\n\t\t} catch {\n\t\t\t// Query ref was disposed or errored — signal keeps its last value\n\t\t}\n\t})();\n\n\t// Cleanup when the Angular component/service is destroyed\n\tdestroyRef.onDestroy(() => {\n\t\trunning = false;\n\t\tref.dispose();\n\t});\n\n\treturn sig.asReadonly();\n}\n\n// ---------------------------------------------------------------------------\n// dvnResource\n// ---------------------------------------------------------------------------\n\n/**\n * Status of a {@link DvnResourceRef}.\n *\n * Mirrors Angular's `ResourceStatus` with the statuses relevant to\n * Dvina SDK operations.\n *\n * | Status | `value()` | Description |\n * |---------------|-------------------|-------------|\n * | `'idle'` | `undefined` | `params` returned `undefined`; loader has not run. |\n * | `'loading'` | `undefined` | Loader is running for the first time. |\n * | `'reloading'` | Previous value | Loader is re-running (params changed or `reload()` called). |\n * | `'resolved'` | Resolved value | Loader completed successfully. |\n * | `'error'` | `undefined` | Loader threw an error. |\n */\nexport type DvnResourceStatus = 'idle' | 'loading' | 'reloading' | 'resolved' | 'error';\n\n/**\n * The object returned by {@link dvnResource}.\n *\n * Provides reactive access to the loader's value, status, and error,\n * plus imperative `reload()` and `destroy()` methods.\n */\nexport interface DvnResourceRef<TResult> {\n\t/** The most recently resolved value, or `undefined` while loading / on error / idle. */\n\treadonly value: Signal<TResult | undefined>;\n\t/** Current lifecycle status of the resource. */\n\treadonly status: Signal<DvnResourceStatus>;\n\t/** `true` when status is `'loading'` or `'reloading'`. */\n\treadonly isLoading: Signal<boolean>;\n\t/** The last error thrown by the loader, or `undefined`. */\n\treadonly error: Signal<Error | undefined>;\n\t/** Whether `value()` is not `undefined`. */\n\thasValue(): boolean;\n\t/** Re-run the loader with the current params. Status transitions to `'reloading'`. */\n\treload(): void;\n\t/** Abort / dispose any active loader and reset to `'idle'`. */\n\tdestroy(): void;\n}\n\n/**\n * A loader function that returns either a `Promise` (one-shot fetch) or an\n * `AsyncIterable` / `DvinaQueryRef` (live stream).\n *\n * The runtime inspects the return value:\n * - If it has `Symbol.asyncIterator` → consumed as a stream (`for await…of`)\n * - Otherwise → awaited as a `Promise`\n */\nexport type DvnResourceLoader<TParams, TResult> = (\n\tctx: DvnResourceLoaderCtx<TParams>,\n) => Promise<TResult> | AsyncIterable<TResult>;\n\n/**\n * Context object passed to the loader function.\n *\n * When the resource has `params`, `ctx.params` contains the current\n * non-`undefined` params value. `abortSignal` can be forwarded to `fetch()`\n * or any other cancellable API.\n */\nexport interface DvnResourceLoaderCtx<TParams> {\n\t/** Current params value (never `undefined`). Only present when `params` is configured. */\n\tparams: TParams;\n\t/** Aborted when params change, `reload()` is called, or the resource is destroyed. */\n\tabortSignal: AbortSignal;\n}\n\n// ---- Overloads ------------------------------------------------------------\n\n/**\n * Create a Dvina resource **without reactive params**.\n *\n * The loader runs immediately and can be re-triggered via `reload()`.\n *\n * @example\n * ```typescript\n * config = dvnResource({\n * loader: () => this.sdk.config().fetch(),\n * });\n * ```\n */\nexport function dvnResource<TResult>(config: {\n\tparams?: never;\n\tloader: (ctx: { abortSignal: AbortSignal }) => Promise<TResult> | AsyncIterable<TResult>;\n}): DvnResourceRef<TResult>;\n\n/**\n * Create a Dvina resource **with reactive params**.\n *\n * The loader re-runs every time `params()` produces a new non-`undefined`\n * value. When `params()` returns `undefined` the resource enters `'idle'`.\n *\n * @example\n * ```typescript\n * // Promise-based (one-shot fetch)\n * userResource = dvnResource({\n * params: () => ({ id: this.userId() }),\n * loader: ({ params }) => this.sdk.user(params).fetch(),\n * });\n *\n * // AsyncIterable-based (live query)\n * reportsResource = dvnResource({\n * params: () => ({ first: 20 }),\n * loader: ({ params }) => this.sdk.reports(params).watch(),\n * });\n * ```\n */\nexport function dvnResource<TParams, TResult>(config: {\n\tparams: () => TParams | undefined;\n\tloader: (ctx: DvnResourceLoaderCtx<TParams>) => Promise<TResult> | AsyncIterable<TResult>;\n}): DvnResourceRef<TResult>;\n\n// ---- Implementation -------------------------------------------------------\n\nexport function dvnResource<TParams, TResult>(config: {\n\tparams?: () => TParams | undefined;\n\tloader: (ctx: any) => Promise<TResult> | AsyncIterable<TResult>;\n}): DvnResourceRef<TResult> {\n\tconst destroyRef = inject(DestroyRef);\n\tconst hasParams = 'params' in config && config.params !== undefined;\n\n\t// Internal writable signals\n\tconst _value = signal<TResult | undefined>(undefined);\n\tconst _status = signal<DvnResourceStatus>('idle');\n\tconst _error = signal<Error | undefined>(undefined);\n\n\t// Cleanup handles\n\tlet abortController: AbortController | null = null;\n\tlet streamRunning = false;\n\tlet currentQueryRef: { dispose(): void } | null = null;\n\n\t/**\n\t * Cancel any in-flight loader (Promise abort + AsyncIterable dispose).\n\t */\n\tconst cleanup = () => {\n\t\tabortController?.abort();\n\t\tabortController = null;\n\t\tstreamRunning = false;\n\t\tcurrentQueryRef?.dispose();\n\t\tcurrentQueryRef = null;\n\t};\n\n\t/**\n\t * Run the loader for the given params.\n\t */\n\tconst load = (params?: Exclude<TParams, undefined>) => {\n\t\tcleanup();\n\t\t_error.set(undefined);\n\n\t\tconst hadValue = untracked(() => _value() !== undefined);\n\t\t_status.set(hadValue ? 'reloading' : 'loading');\n\n\t\tabortController = new AbortController();\n\t\tconst ctx = hasParams\n\t\t\t? { params: params!, abortSignal: abortController.signal }\n\t\t\t: { abortSignal: abortController.signal };\n\n\t\tconst result = config.loader(ctx);\n\n\t\tif (isAsyncIterable(result)) {\n\t\t\t// --- Stream mode (AsyncIterable / DvinaQueryRef) ---\n\t\t\t// Keep a reference for disposal if it quacks like a DvinaQueryRef\n\t\t\tif (hasDispose(result)) {\n\t\t\t\tcurrentQueryRef = result;\n\t\t\t}\n\n\t\t\tstreamRunning = true;\n\t\t\tconst capturedController = abortController;\n\n\t\t\t(async () => {\n\t\t\t\ttry {\n\t\t\t\t\tfor await (const val of result) {\n\t\t\t\t\t\tif (!streamRunning) break;\n\t\t\t\t\t\t_value.set(val);\n\t\t\t\t\t\t_status.set('resolved');\n\t\t\t\t\t\t_error.set(undefined);\n\t\t\t\t\t}\n\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\tif (!streamRunning || capturedController.signal.aborted) return;\n\t\t\t\t\tconst wrapped = err instanceof Error ? err : new Error(String(err));\n\t\t\t\t\t_error.set(wrapped);\n\t\t\t\t\t_status.set('error');\n\t\t\t\t}\n\t\t\t})();\n\t\t} else {\n\t\t\t// --- Promise mode (one-shot) ---\n\t\t\tconst capturedController = abortController;\n\n\t\t\t(result as Promise<TResult>).then(\n\t\t\t\t(val) => {\n\t\t\t\t\tif (capturedController.signal.aborted) return;\n\t\t\t\t\t_value.set(val);\n\t\t\t\t\t_status.set('resolved');\n\t\t\t\t},\n\t\t\t\t(err: unknown) => {\n\t\t\t\t\tif (capturedController.signal.aborted) return;\n\t\t\t\t\tif (err instanceof DOMException && err.name === 'AbortError') return;\n\t\t\t\t\tconst wrapped = err instanceof Error ? err : new Error(String(err));\n\t\t\t\t\t_error.set(wrapped);\n\t\t\t\t\t_status.set('error');\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\t};\n\n\t// ---- Reactive params tracking (same pattern as yokaResource) ----\n\n\tif (hasParams) {\n\t\teffect(() => {\n\t\t\tconst params = config.params!();\n\n\t\t\tif (params !== undefined) {\n\t\t\t\tload(params as Exclude<TParams, undefined>);\n\t\t\t} else {\n\t\t\t\tcleanup();\n\t\t\t\t_value.set(undefined);\n\t\t\t\t_status.set('idle');\n\t\t\t\t_error.set(undefined);\n\t\t\t}\n\t\t});\n\t} else {\n\t\t// No params — run immediately\n\t\tload();\n\t}\n\n\t// Auto-cleanup on destroy\n\tdestroyRef.onDestroy(() => {\n\t\tcleanup();\n\t});\n\n\t// ---- Public API ----\n\n\tconst status = _status.asReadonly();\n\tconst isLoading = computed(() => {\n\t\tconst s = _status();\n\t\treturn s === 'loading' || s === 'reloading';\n\t});\n\n\treturn {\n\t\tvalue: _value.asReadonly(),\n\t\tstatus,\n\t\tisLoading,\n\t\terror: _error.asReadonly(),\n\t\thasValue: () => _value() !== undefined,\n\n\t\treload() {\n\t\t\tif (hasParams) {\n\t\t\t\tconst params = config.params!();\n\t\t\t\tif (params !== undefined) {\n\t\t\t\t\tload(params as Exclude<TParams, undefined>);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tload();\n\t\t\t}\n\t\t},\n\n\t\tdestroy() {\n\t\t\tcleanup();\n\t\t\t_value.set(undefined);\n\t\t\t_status.set('idle');\n\t\t\t_error.set(undefined);\n\t\t},\n\t};\n}\n\n// ---- Type guards ----------------------------------------------------------\n\nfunction isAsyncIterable(value: unknown): value is AsyncIterable<unknown> {\n\treturn value != null && typeof value === 'object' && Symbol.asyncIterator in value;\n}\n\nfunction hasDispose(value: unknown): value is { dispose(): void } {\n\treturn (\n\t\tvalue != null && typeof value === 'object' && 'dispose' in value && typeof (value as any).dispose === 'function'\n\t);\n}\n\n// ---------------------------------------------------------------------------\n// provideDvina\n// ---------------------------------------------------------------------------\n\n/**\n * Register a singleton {@link DvinaSdk} instance in the Angular dependency injection system.\n *\n * Accepts either a static options object or a **factory function**. The factory\n * variant runs inside an injection context, so Angular's `inject()` can be used\n * to resolve auth services, language providers, and other dependencies.\n *\n * The SDK instance is automatically destroyed (WebSocket terminated, SSE stopped,\n * IndexedDB closed) when the environment injector is torn down.\n *\n * @param optionsOrFactory - A {@link DvinaSdkOptions} object, or a factory\n * function that returns one. The factory is called within an injection context.\n * @returns `EnvironmentProviders` to be added to the application config.\n *\n * @example\n * ```typescript\n * // app.config.ts\n * import { provideDvina } from '@dvina/sdk/angular';\n *\n * export const appConfig: ApplicationConfig = {\n * providers: [\n * provideDvina(() => {\n * const auth = inject(AuthService);\n * const transloco = inject(TranslocoService);\n *\n * return {\n * getToken: (opts) => auth.getAccessTokenSilently(opts),\n * language: () => transloco.getActiveLang(),\n * };\n * }),\n * ],\n * };\n * ```\n *\n * @example\n * ```typescript\n * // Static token (scripts, tests)\n * provideDvina({\n * token: 'my-static-token',\n * baseUrl: 'localhost:4000',\n * })\n * ```\n *\n * @example\n * ```typescript\n * // Consuming the SDK in a service\n * import { DvinaSdk } from '@dvina/sdk';\n *\n * @Injectable({ providedIn: 'root' })\n * export class ReportService {\n * private readonly sdk = inject(DvinaSdk);\n *\n * reports = toSignal(this.sdk.reports({ first: 20 }).watch());\n * }\n * ```\n */\nexport function provideDvina(optionsOrFactory: DvinaSdkOptions | (() => DvinaSdkOptions)): EnvironmentProviders {\n\treturn makeEnvironmentProviders([\n\t\t{\n\t\t\tprovide: DvinaSdk,\n\t\t\tuseFactory: () => {\n\t\t\t\tconst options = typeof optionsOrFactory === 'function' ? optionsOrFactory() : optionsOrFactory;\n\t\t\t\treturn new DvinaSdk(options);\n\t\t\t},\n\t\t},\n\t]);\n}\n"]}
@@ -0,0 +1,254 @@
1
+ import { Signal, DestroyRef, EnvironmentProviders } from '@angular/core';
2
+ import { D as DvinaSdkOptions } from '../../client-9Rwj21T9.cjs';
3
+ import { D as DvinaQueryRef } from '../../types-2RotD0Ab.cjs';
4
+ import '../../error-CsVoUTY8.cjs';
5
+ import '../../sync-engine-DVKQO-1-.cjs';
6
+ import 'graphql';
7
+ import 'dexie';
8
+ import '../../client-CLhQragb.cjs';
9
+ import '../../billing/index.cjs';
10
+
11
+ /**
12
+ * Angular adapter for @dvina/sdk.
13
+ *
14
+ * Provides primitives for integrating the Dvina SDK with Angular's DI and signal system:
15
+ *
16
+ * - {@link provideDvina} — register a singleton `DvinaSdk` instance in the Angular DI system
17
+ * - {@link toSignal} — lightweight converter from `DvinaQueryRef` to a readonly `Signal`
18
+ * - {@link dvnResource} — full resource primitive inspired by Angular's `resource()` API,
19
+ * supporting both `Promise` and `AsyncIterable` loaders with reactive params tracking,
20
+ * status/error signals, and automatic cleanup.
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * import { provideDvina, toSignal, dvnResource } from '@dvina/sdk/angular';
25
+ * import { DvinaSdk } from '@dvina/sdk';
26
+ *
27
+ * // app.config.ts
28
+ * export const appConfig: ApplicationConfig = {
29
+ * providers: [
30
+ * provideDvina(() => ({
31
+ * getToken: (opts) => inject(AuthService).getAccessTokenSilently(opts),
32
+ * language: () => inject(TranslocoService).getActiveLang(),
33
+ * })),
34
+ * ],
35
+ * };
36
+ *
37
+ * // component.ts
38
+ * @Component({ ... })
39
+ * class ReportsComponent {
40
+ * private sdk = inject(DvinaSdk);
41
+ *
42
+ * // Simple signal conversion
43
+ * reports = toSignal(this.sdk.reports({ first: 20 }).watch());
44
+ *
45
+ * // Full resource with status tracking
46
+ * reportResource = dvnResource({
47
+ * params: () => ({ first: 20 }),
48
+ * loader: ({ params }) => this.sdk.reports(params).watch(),
49
+ * });
50
+ * }
51
+ * ```
52
+ *
53
+ * @packageDocumentation
54
+ */
55
+
56
+ interface ToSignalOptions {
57
+ /**
58
+ * Optional DestroyRef for automatic cleanup. If not provided, `inject(DestroyRef)`
59
+ * is called — which requires an injection context (constructor, field initializer,
60
+ * or `runInInjectionContext`).
61
+ *
62
+ * Pass explicitly when calling outside an injection context.
63
+ *
64
+ * Follows the same convention as Angular's `takeUntilDestroyed()`.
65
+ */
66
+ destroyRef?: DestroyRef;
67
+ }
68
+ /**
69
+ * Convert a `DvinaQueryRef` (AsyncIterable) into a readonly Angular Signal.
70
+ *
71
+ * The signal updates automatically whenever the underlying Dexie-based SyncEngine emits new data.
72
+ * Cleanup (disposal of the async iterable) happens automatically when the component/service
73
+ * is destroyed via `DestroyRef`.
74
+ *
75
+ * Must be called in an **injection context** (field initializer, constructor,
76
+ * or `runInInjectionContext`) unless `options.destroyRef` is provided explicitly.
77
+ *
78
+ * @param ref - A DvinaQueryRef returned by `.watch()` on any SDK query
79
+ * @param options - Optional configuration
80
+ * @returns A readonly Signal that reflects the latest value from the query ref
81
+ *
82
+ * @example
83
+ * ```typescript
84
+ * // Field initializer (most common)
85
+ * reports = toSignal(this.sdk.reports({ first: 20 }).watch());
86
+ *
87
+ * // With explicit DestroyRef (for use outside injection context)
88
+ * const destroyRef = inject(DestroyRef);
89
+ * // ... later, in a method:
90
+ * this.reports = toSignal(ref, { destroyRef });
91
+ * ```
92
+ */
93
+ declare function toSignal<T>(ref: DvinaQueryRef<T>, options?: ToSignalOptions): Signal<T | undefined>;
94
+ /**
95
+ * Status of a {@link DvnResourceRef}.
96
+ *
97
+ * Mirrors Angular's `ResourceStatus` with the statuses relevant to
98
+ * Dvina SDK operations.
99
+ *
100
+ * | Status | `value()` | Description |
101
+ * |---------------|-------------------|-------------|
102
+ * | `'idle'` | `undefined` | `params` returned `undefined`; loader has not run. |
103
+ * | `'loading'` | `undefined` | Loader is running for the first time. |
104
+ * | `'reloading'` | Previous value | Loader is re-running (params changed or `reload()` called). |
105
+ * | `'resolved'` | Resolved value | Loader completed successfully. |
106
+ * | `'error'` | `undefined` | Loader threw an error. |
107
+ */
108
+ type DvnResourceStatus = 'idle' | 'loading' | 'reloading' | 'resolved' | 'error';
109
+ /**
110
+ * The object returned by {@link dvnResource}.
111
+ *
112
+ * Provides reactive access to the loader's value, status, and error,
113
+ * plus imperative `reload()` and `destroy()` methods.
114
+ */
115
+ interface DvnResourceRef<TResult> {
116
+ /** The most recently resolved value, or `undefined` while loading / on error / idle. */
117
+ readonly value: Signal<TResult | undefined>;
118
+ /** Current lifecycle status of the resource. */
119
+ readonly status: Signal<DvnResourceStatus>;
120
+ /** `true` when status is `'loading'` or `'reloading'`. */
121
+ readonly isLoading: Signal<boolean>;
122
+ /** The last error thrown by the loader, or `undefined`. */
123
+ readonly error: Signal<Error | undefined>;
124
+ /** Whether `value()` is not `undefined`. */
125
+ hasValue(): boolean;
126
+ /** Re-run the loader with the current params. Status transitions to `'reloading'`. */
127
+ reload(): void;
128
+ /** Abort / dispose any active loader and reset to `'idle'`. */
129
+ destroy(): void;
130
+ }
131
+ /**
132
+ * A loader function that returns either a `Promise` (one-shot fetch) or an
133
+ * `AsyncIterable` / `DvinaQueryRef` (live stream).
134
+ *
135
+ * The runtime inspects the return value:
136
+ * - If it has `Symbol.asyncIterator` → consumed as a stream (`for await…of`)
137
+ * - Otherwise → awaited as a `Promise`
138
+ */
139
+ type DvnResourceLoader<TParams, TResult> = (ctx: DvnResourceLoaderCtx<TParams>) => Promise<TResult> | AsyncIterable<TResult>;
140
+ /**
141
+ * Context object passed to the loader function.
142
+ *
143
+ * When the resource has `params`, `ctx.params` contains the current
144
+ * non-`undefined` params value. `abortSignal` can be forwarded to `fetch()`
145
+ * or any other cancellable API.
146
+ */
147
+ interface DvnResourceLoaderCtx<TParams> {
148
+ /** Current params value (never `undefined`). Only present when `params` is configured. */
149
+ params: TParams;
150
+ /** Aborted when params change, `reload()` is called, or the resource is destroyed. */
151
+ abortSignal: AbortSignal;
152
+ }
153
+ /**
154
+ * Create a Dvina resource **without reactive params**.
155
+ *
156
+ * The loader runs immediately and can be re-triggered via `reload()`.
157
+ *
158
+ * @example
159
+ * ```typescript
160
+ * config = dvnResource({
161
+ * loader: () => this.sdk.config().fetch(),
162
+ * });
163
+ * ```
164
+ */
165
+ declare function dvnResource<TResult>(config: {
166
+ params?: never;
167
+ loader: (ctx: {
168
+ abortSignal: AbortSignal;
169
+ }) => Promise<TResult> | AsyncIterable<TResult>;
170
+ }): DvnResourceRef<TResult>;
171
+ /**
172
+ * Create a Dvina resource **with reactive params**.
173
+ *
174
+ * The loader re-runs every time `params()` produces a new non-`undefined`
175
+ * value. When `params()` returns `undefined` the resource enters `'idle'`.
176
+ *
177
+ * @example
178
+ * ```typescript
179
+ * // Promise-based (one-shot fetch)
180
+ * userResource = dvnResource({
181
+ * params: () => ({ id: this.userId() }),
182
+ * loader: ({ params }) => this.sdk.user(params).fetch(),
183
+ * });
184
+ *
185
+ * // AsyncIterable-based (live query)
186
+ * reportsResource = dvnResource({
187
+ * params: () => ({ first: 20 }),
188
+ * loader: ({ params }) => this.sdk.reports(params).watch(),
189
+ * });
190
+ * ```
191
+ */
192
+ declare function dvnResource<TParams, TResult>(config: {
193
+ params: () => TParams | undefined;
194
+ loader: (ctx: DvnResourceLoaderCtx<TParams>) => Promise<TResult> | AsyncIterable<TResult>;
195
+ }): DvnResourceRef<TResult>;
196
+ /**
197
+ * Register a singleton {@link DvinaSdk} instance in the Angular dependency injection system.
198
+ *
199
+ * Accepts either a static options object or a **factory function**. The factory
200
+ * variant runs inside an injection context, so Angular's `inject()` can be used
201
+ * to resolve auth services, language providers, and other dependencies.
202
+ *
203
+ * The SDK instance is automatically destroyed (WebSocket terminated, SSE stopped,
204
+ * IndexedDB closed) when the environment injector is torn down.
205
+ *
206
+ * @param optionsOrFactory - A {@link DvinaSdkOptions} object, or a factory
207
+ * function that returns one. The factory is called within an injection context.
208
+ * @returns `EnvironmentProviders` to be added to the application config.
209
+ *
210
+ * @example
211
+ * ```typescript
212
+ * // app.config.ts
213
+ * import { provideDvina } from '@dvina/sdk/angular';
214
+ *
215
+ * export const appConfig: ApplicationConfig = {
216
+ * providers: [
217
+ * provideDvina(() => {
218
+ * const auth = inject(AuthService);
219
+ * const transloco = inject(TranslocoService);
220
+ *
221
+ * return {
222
+ * getToken: (opts) => auth.getAccessTokenSilently(opts),
223
+ * language: () => transloco.getActiveLang(),
224
+ * };
225
+ * }),
226
+ * ],
227
+ * };
228
+ * ```
229
+ *
230
+ * @example
231
+ * ```typescript
232
+ * // Static token (scripts, tests)
233
+ * provideDvina({
234
+ * token: 'my-static-token',
235
+ * baseUrl: 'localhost:4000',
236
+ * })
237
+ * ```
238
+ *
239
+ * @example
240
+ * ```typescript
241
+ * // Consuming the SDK in a service
242
+ * import { DvinaSdk } from '@dvina/sdk';
243
+ *
244
+ * @Injectable({ providedIn: 'root' })
245
+ * export class ReportService {
246
+ * private readonly sdk = inject(DvinaSdk);
247
+ *
248
+ * reports = toSignal(this.sdk.reports({ first: 20 }).watch());
249
+ * }
250
+ * ```
251
+ */
252
+ declare function provideDvina(optionsOrFactory: DvinaSdkOptions | (() => DvinaSdkOptions)): EnvironmentProviders;
253
+
254
+ export { type DvnResourceLoader, type DvnResourceLoaderCtx, type DvnResourceRef, type DvnResourceStatus, type ToSignalOptions, dvnResource, provideDvina, toSignal };