@sparkvault/sdk-js 19.0.0 → 19.1.0

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 (132) hide show
  1. package/README.md +26 -4
  2. package/dist/npm/chunks/index-BnP-2w0t.cjs +13025 -0
  3. package/dist/npm/chunks/index-BnP-2w0t.cjs.map +1 -0
  4. package/dist/npm/chunks/index-CgR08uMG.mjs +12960 -0
  5. package/dist/npm/chunks/index-CgR08uMG.mjs.map +1 -0
  6. package/dist/npm/identity.cjs +23 -0
  7. package/dist/npm/identity.cjs.map +1 -0
  8. package/dist/npm/identity.mjs +12 -0
  9. package/dist/npm/identity.mjs.map +1 -0
  10. package/dist/{index.cjs → npm/index.cjs} +799 -13755
  11. package/dist/npm/index.cjs.map +1 -0
  12. package/dist/{index.mjs → npm/index.mjs} +200 -13155
  13. package/dist/npm/index.mjs.map +1 -0
  14. package/dist/sparkvault-identity.js +2 -0
  15. package/dist/sparkvault-identity.js.map +1 -0
  16. package/dist/sparkvault.js +1 -1
  17. package/dist/types/identity.d.ts +8 -0
  18. package/dist/{index.d.ts → types/index.d.ts} +4 -790
  19. package/dist/types/shared/errors-C-gjmGBs.d.ts +800 -0
  20. package/package.json +20 -9
  21. package/dist/api-base.d.ts +0 -116
  22. package/dist/auto-init.d.ts +0 -32
  23. package/dist/config.d.ts +0 -79
  24. package/dist/entropy/index.d.ts +0 -35
  25. package/dist/entropy/types.d.ts +0 -32
  26. package/dist/errors.d.ts +0 -146
  27. package/dist/folders/index.d.ts +0 -102
  28. package/dist/folders/types.d.ts +0 -91
  29. package/dist/health.d.ts +0 -18
  30. package/dist/http.d.ts +0 -46
  31. package/dist/index.cjs.map +0 -1
  32. package/dist/index.mjs.map +0 -1
  33. package/dist/ingots/fetch-download.d.ts +0 -78
  34. package/dist/ingots/history.d.ts +0 -4
  35. package/dist/ingots/index.d.ts +0 -388
  36. package/dist/ingots/revision.d.ts +0 -4
  37. package/dist/ingots/types.d.ts +0 -556
  38. package/dist/logger.d.ts +0 -32
  39. package/dist/notify/index.d.ts +0 -154
  40. package/dist/notify/types.d.ts +0 -232
  41. package/dist/products/help-desk/client.d.ts +0 -198
  42. package/dist/products/help-desk/desk-id.d.ts +0 -2
  43. package/dist/products/help-desk/form-draft.d.ts +0 -37
  44. package/dist/products/help-desk/form-types.d.ts +0 -123
  45. package/dist/products/help-desk/form.d.ts +0 -83
  46. package/dist/products/help-desk/index.d.ts +0 -47
  47. package/dist/products/help-desk/kb-client.d.ts +0 -48
  48. package/dist/products/help-desk/kb-types.d.ts +0 -59
  49. package/dist/products/help-desk/modal.d.ts +0 -8
  50. package/dist/products/help-desk/styles.d.ts +0 -9
  51. package/dist/products/help-desk/support-analytics-types.d.ts +0 -32
  52. package/dist/products/help-desk/support-analytics.d.ts +0 -3
  53. package/dist/products/help-desk/support-brand.d.ts +0 -49
  54. package/dist/products/help-desk/support-controller.d.ts +0 -4
  55. package/dist/products/help-desk/support-history.d.ts +0 -38
  56. package/dist/products/help-desk/support-launcher.d.ts +0 -12
  57. package/dist/products/help-desk/support-styles.d.ts +0 -14
  58. package/dist/products/help-desk/support-types.d.ts +0 -66
  59. package/dist/products/help-desk/support-view.d.ts +0 -173
  60. package/dist/products/help-desk/types.d.ts +0 -285
  61. package/dist/products/help-desk/widget-identity.d.ts +0 -32
  62. package/dist/products/identity/api.d.ts +0 -237
  63. package/dist/products/identity/container.d.ts +0 -44
  64. package/dist/products/identity/dialog-launcher.d.ts +0 -133
  65. package/dist/products/identity/federation-flow.d.ts +0 -31
  66. package/dist/products/identity/handlers/otp-handler.d.ts +0 -69
  67. package/dist/products/identity/handlers/passkey-handler.d.ts +0 -105
  68. package/dist/products/identity/handlers/sparklink-handler.d.ts +0 -34
  69. package/dist/products/identity/index.d.ts +0 -296
  70. package/dist/products/identity/inline-container.d.ts +0 -53
  71. package/dist/products/identity/methods.d.ts +0 -19
  72. package/dist/products/identity/modal.d.ts +0 -51
  73. package/dist/products/identity/pending-signin.d.ts +0 -102
  74. package/dist/products/identity/popup-launcher.d.ts +0 -73
  75. package/dist/products/identity/renderer.d.ts +0 -525
  76. package/dist/products/identity/state.d.ts +0 -84
  77. package/dist/products/identity/styles.d.ts +0 -31
  78. package/dist/products/identity/types.d.ts +0 -561
  79. package/dist/products/identity/utils/cooldown-timer.d.ts +0 -73
  80. package/dist/products/identity/utils.d.ts +0 -85
  81. package/dist/products/identity/views/backup-verify.d.ts +0 -42
  82. package/dist/products/identity/views/base.d.ts +0 -51
  83. package/dist/products/identity/views/error.d.ts +0 -65
  84. package/dist/products/identity/views/icons.d.ts +0 -41
  85. package/dist/products/identity/views/identity-input.d.ts +0 -80
  86. package/dist/products/identity/views/index.d.ts +0 -20
  87. package/dist/products/identity/views/loading.d.ts +0 -23
  88. package/dist/products/identity/views/method-button.d.ts +0 -14
  89. package/dist/products/identity/views/method-select.d.ts +0 -42
  90. package/dist/products/identity/views/origin-not-allowed.d.ts +0 -25
  91. package/dist/products/identity/views/otp-verify.d.ts +0 -58
  92. package/dist/products/identity/views/passkey-auto.d.ts +0 -22
  93. package/dist/products/identity/views/passkey-prompt.d.ts +0 -25
  94. package/dist/products/identity/views/passkey.d.ts +0 -38
  95. package/dist/products/identity/views/product-not-configured.d.ts +0 -21
  96. package/dist/products/identity/views/service-unavailable.d.ts +0 -21
  97. package/dist/products/identity/views/sms-consent.d.ts +0 -16
  98. package/dist/products/identity/views/sparklink-waiting.d.ts +0 -40
  99. package/dist/products/identity/views/two-factor.d.ts +0 -37
  100. package/dist/products/index.d.ts +0 -51
  101. package/dist/products/messaging/index.d.ts +0 -38
  102. package/dist/products/messaging/types.d.ts +0 -162
  103. package/dist/products/notify/index.d.ts +0 -436
  104. package/dist/products/notify/project-types.d.ts +0 -44
  105. package/dist/products/notify/projects.d.ts +0 -15
  106. package/dist/products/notify/types.d.ts +0 -1327
  107. package/dist/products/structured-ingots/index.d.ts +0 -31
  108. package/dist/products/structured-ingots/types-client.d.ts +0 -19
  109. package/dist/products/structured-ingots/types.d.ts +0 -293
  110. package/dist/products/structured-ingots/validation.d.ts +0 -25
  111. package/dist/request-path.d.ts +0 -44
  112. package/dist/sparks/index.d.ts +0 -91
  113. package/dist/sparks/types.d.ts +0 -304
  114. package/dist/ui/chrome.d.ts +0 -16
  115. package/dist/ui/ds-tokens.d.ts +0 -59
  116. package/dist/ui/inline-shell.d.ts +0 -19
  117. package/dist/ui/live-region.d.ts +0 -15
  118. package/dist/ui/modal-shell.d.ts +0 -67
  119. package/dist/ui/target.d.ts +0 -6
  120. package/dist/utils/dom.d.ts +0 -26
  121. package/dist/vault-session.d.ts +0 -2
  122. package/dist/vaults/index.d.ts +0 -254
  123. package/dist/vaults/types.d.ts +0 -368
  124. package/dist/vaults/upload/api.d.ts +0 -310
  125. package/dist/vaults/upload/chrome.d.ts +0 -21
  126. package/dist/vaults/upload/container.d.ts +0 -37
  127. package/dist/vaults/upload/index.d.ts +0 -76
  128. package/dist/vaults/upload/inline-container.d.ts +0 -41
  129. package/dist/vaults/upload/modal.d.ts +0 -55
  130. package/dist/vaults/upload/renderer.d.ts +0 -150
  131. package/dist/vaults/upload/styles.d.ts +0 -14
  132. package/dist/vaults/upload/types.d.ts +0 -220
@@ -1,31 +0,0 @@
1
- import { HttpClient } from '../../http';
2
- import type { UnsealedVault } from '../../vaults/types';
3
- import { StructuredIngotTypesModule } from './types-client';
4
- import type { BatchGetStructuredIngotsOptions, CreateStructuredIngotOptions, DeleteStructuredIngotOptions, GetStructuredIngotOptions, ImportStructuredIngotsOptions, PatchStructuredIngotOptions, PortableStructuredIngot, StructuredExportOutcome, StructuredImportOutcome, StructuredIngot, StructuredIngotHistory, StructuredIngotMutation, StructuredIngotSummary, StructuredIterateOptions, StructuredPage, StructuredPageOptions, StructuredReadOutcome, StructuredValues, RestoreStructuredIngotOptions, StructuredAccountActivity, StructuredActivityOptions, StructuredVaultActivity } from './types';
5
- /** Typed record operations using the caller's existing account and vault session. */
6
- export declare class StructuredIngotsModule {
7
- private readonly http;
8
- readonly types: StructuredIngotTypesModule;
9
- constructor(http: HttpClient);
10
- /** Approximate account activity; requires an account credential, not a scoped service key. */
11
- activity(options?: StructuredActivityOptions): Promise<StructuredAccountActivity>;
12
- /** Approximate operational counters for one authorized, unsealed vault. */
13
- vaultActivity(vault: UnsealedVault, options?: StructuredActivityOptions): Promise<StructuredVaultActivity>;
14
- get<T extends object = StructuredValues>(vault: UnsealedVault, ref: string, options?: GetStructuredIngotOptions): Promise<StructuredIngot<T>>;
15
- list(vault: UnsealedVault, options?: StructuredPageOptions): Promise<StructuredPage<StructuredIngotSummary>>;
16
- iterate(vault: UnsealedVault, options?: StructuredIterateOptions): AsyncGenerator<StructuredIngotSummary>;
17
- /** Names use the server's documented Unicode caseless matching rules. */
18
- create<T extends object = StructuredValues>(vault: UnsealedVault, options: CreateStructuredIngotOptions<T>): Promise<StructuredIngotMutation>;
19
- patch<T extends object = StructuredValues>(vault: UnsealedVault, ref: string, options: PatchStructuredIngotOptions<T>): Promise<StructuredIngotMutation>;
20
- delete(vault: UnsealedVault, ref: string, options?: DeleteStructuredIngotOptions): Promise<void>;
21
- history(vault: UnsealedVault, ref: string): Promise<StructuredIngotHistory>;
22
- restore(vault: UnsealedVault, ref: string, versionId: string, options: RestoreStructuredIngotOptions): Promise<StructuredIngotMutation>;
23
- /** Bounded parallel reads with independent, ordered success/error outcomes. */
24
- batchGet<T extends object = StructuredValues>(vault: UnsealedVault, refs: string[], options?: BatchGetStructuredIngotsOptions): Promise<StructuredReadOutcome<T>[]>;
25
- /** Sequential record reads, not a transactionally consistent vault snapshot. */
26
- exportRecords(vault: UnsealedVault, options?: StructuredIterateOptions): AsyncGenerator<StructuredExportOutcome>;
27
- /** Imports create records. Existing names fail; typed imports need explicit mapping. */
28
- importRecords(vault: UnsealedVault, records: AsyncIterable<PortableStructuredIngot> | Iterable<PortableStructuredIngot>, options?: ImportStructuredIngotsOptions): AsyncGenerator<StructuredImportOutcome>;
29
- }
30
- export { StructuredIngotTypesModule } from './types-client';
31
- export type * from './types';
@@ -1,19 +0,0 @@
1
- import { HttpClient } from '../../http';
2
- import type { UnsealedVault } from '../../vaults/types';
3
- import type { CreateStructuredTypeOptions, PublishStructuredTypeOptions, StructuredIterateOptions, StructuredPage, StructuredPageOptions, StructuredTypeDefinition, StructuredTypeCreation, StructuredTypeSummary } from './types';
4
- /** Definitions live inside the same encrypted vault as the records they validate. */
5
- export declare class StructuredIngotTypesModule {
6
- private readonly http;
7
- constructor(http: HttpClient);
8
- list(vault: UnsealedVault, options?: StructuredPageOptions): Promise<StructuredPage<StructuredTypeSummary>>;
9
- iterate(vault: UnsealedVault, options?: StructuredIterateOptions): AsyncGenerator<StructuredTypeSummary>;
10
- get(vault: UnsealedVault, typeId: string, options?: {
11
- version?: number;
12
- }): Promise<StructuredTypeDefinition>;
13
- create(vault: UnsealedVault, options: CreateStructuredTypeOptions): Promise<StructuredTypeCreation>;
14
- publish(vault: UnsealedVault, typeId: string, options: PublishStructuredTypeOptions): Promise<StructuredTypeDefinition>;
15
- archive(vault: UnsealedVault, typeId: string): Promise<{
16
- typeId: string;
17
- archived: true;
18
- }>;
19
- }
@@ -1,293 +0,0 @@
1
- import type { IngotHistory, IngotVersion } from '../../ingots/types';
2
- /** JSON values travel without implicit coercion. Binary leaves use explicit paths. */
3
- export type StructuredJsonValue = null | boolean | number | string | StructuredJsonValue[] | {
4
- [key: string]: StructuredJsonValue;
5
- };
6
- export type StructuredValues = Record<string, StructuredJsonValue>;
7
- export type StructuredBinaryPath = Array<string | number>;
8
- export interface StructuredTypePin {
9
- typeId: string;
10
- version: number;
11
- }
12
- export interface StructuredPageOptions {
13
- limit?: number;
14
- cursor?: string;
15
- }
16
- export interface StructuredIterateOptions extends StructuredPageOptions {
17
- /** Bound continuation tracking; default 10,000 pages, maximum 100,000. */
18
- maxPages?: number;
19
- }
20
- export interface StructuredPage<T> {
21
- items: T[];
22
- count: number;
23
- nextCursor: string | null;
24
- hasMore: boolean;
25
- }
26
- export interface StructuredIngotSummary {
27
- id: string;
28
- name: string;
29
- /** Publication observed by the metadata page; absent when the server cannot supply it. */
30
- revision?: string;
31
- sizeBytes: number;
32
- createdAt: number;
33
- updatedAt: number | null;
34
- }
35
- export interface StructuredIngot<T extends object = StructuredValues> {
36
- id: string;
37
- name: string;
38
- version: number;
39
- /** Identity-bound content revision from the bytes read; absent on older servers. */
40
- revision?: string;
41
- keyCount: number;
42
- values: T;
43
- missingKeys: string[];
44
- /** Each path identifies a base64 string representing binary bytes. */
45
- binaryPaths: StructuredBinaryPath[];
46
- type: StructuredTypePin | null;
47
- createdAt: number;
48
- updatedAt: number;
49
- }
50
- export interface StructuredIngotMutation {
51
- id: string;
52
- version: number;
53
- /** The publication this operation committed; absent on older servers/creation receipts. */
54
- revision?: string;
55
- keyCount: number;
56
- type: StructuredTypePin | null;
57
- createdAt?: number;
58
- updatedAt?: number;
59
- created?: boolean;
60
- /** A creation receipt replay; its version is not a fresh read of current content. */
61
- replayed?: boolean;
62
- }
63
- export interface GetStructuredIngotOptions {
64
- keys?: string[];
65
- }
66
- export interface CreateStructuredIngotOptions<T extends object = StructuredValues> {
67
- name: string;
68
- data: T;
69
- type?: StructuredTypePin | null;
70
- binaryPaths?: StructuredBinaryPath[];
71
- /** 8 to 128 printable ASCII characters; bound to this name and semantic payload. */
72
- idempotencyKey?: string;
73
- }
74
- /** Prefer the opaque revision: it also rejects deletion and recreation under the same name. */
75
- export type StructuredIngotPrecondition = {
76
- expectedRevision: string;
77
- expectedVersion?: number;
78
- } | {
79
- expectedRevision?: undefined;
80
- expectedVersion: number;
81
- };
82
- export type PatchStructuredIngotOptions<T extends object = StructuredValues> = StructuredIngotPrecondition & {
83
- set?: Partial<T>;
84
- delete?: string[];
85
- /** Omitted preserves the current type; null explicitly removes it. */
86
- type?: StructuredTypePin | null;
87
- /** Paths are relative to the `set` object. */
88
- binaryPaths?: StructuredBinaryPath[];
89
- };
90
- export type RestoreStructuredIngotOptions = StructuredIngotPrecondition;
91
- export interface DeleteStructuredIngotOptions {
92
- /** Delete only this object publication. Omitted preserves unconditional deletion. */
93
- expectedRevision?: string;
94
- }
95
- export type StructuredIngotVersion = IngotVersion;
96
- export type StructuredIngotHistory = IngotHistory;
97
- export type StructuredActivityPeriod = '24h' | '7d';
98
- export interface StructuredActivityOptions {
99
- period?: StructuredActivityPeriod;
100
- }
101
- export interface StructuredActivityTotals {
102
- requests: number;
103
- reads: number;
104
- writes: number;
105
- errors: number;
106
- conflicts: number;
107
- averageLatencyMs: number | null;
108
- p95UpperBoundMs: number | null;
109
- p95Overflow: boolean;
110
- }
111
- export interface StructuredActivity {
112
- period: StructuredActivityPeriod;
113
- interval: 'hour' | 'day';
114
- asOf: number;
115
- windowStart: number;
116
- windowEnd: number;
117
- totals: StructuredActivityTotals;
118
- series: Array<StructuredActivityTotals & {
119
- start: number;
120
- end: number;
121
- }>;
122
- }
123
- export interface StructuredAccountActivity extends StructuredActivity {
124
- scope: 'account';
125
- }
126
- export interface StructuredVaultActivity extends StructuredActivity {
127
- vaultId: string;
128
- objectCount: number | null;
129
- vaultStorageBytes: number;
130
- }
131
- export interface StructuredTypeTransform {
132
- /** JSON Pointer to a field; transformations are explicit and ordered. */
133
- path: string;
134
- operations: Array<'trim' | 'lowercase' | 'uppercase'>;
135
- }
136
- export interface StructuredTypeSummary {
137
- typeId: string;
138
- name: string;
139
- createdAt: number;
140
- updatedAt: number | null;
141
- }
142
- export interface StructuredTypeDefinition extends StructuredTypeSummary {
143
- version: number;
144
- latestVersion: number;
145
- archived: boolean;
146
- schema: StructuredValues;
147
- transforms: StructuredTypeTransform[];
148
- }
149
- export interface StructuredTypeCreation extends StructuredTypeDefinition {
150
- created: boolean;
151
- /** Original version-one receipt; use types.get for current metadata. */
152
- replayed?: boolean;
153
- }
154
- export interface CreateStructuredTypeOptions {
155
- name: string;
156
- schema: StructuredValues;
157
- transforms?: StructuredTypeTransform[];
158
- /** 8 to 128 printable ASCII characters; bound to this name and definition. */
159
- idempotencyKey?: string;
160
- }
161
- export interface PublishStructuredTypeOptions {
162
- expectedVersion: number;
163
- schema: StructuredValues;
164
- transforms?: StructuredTypeTransform[];
165
- }
166
- export type StructuredOutcome<T> = {
167
- ok: true;
168
- value: T;
169
- } | {
170
- ok: false;
171
- error: unknown;
172
- };
173
- export type StructuredReadOutcome<T extends object = StructuredValues> = StructuredOutcome<StructuredIngot<T>> & {
174
- ref: string;
175
- };
176
- export interface BatchGetStructuredIngotsOptions extends GetStructuredIngotOptions {
177
- /** Default 4; maximum 8 simultaneous requests. At most 100 references. */
178
- concurrency?: number;
179
- }
180
- export interface PortableStructuredType {
181
- name: string;
182
- schema: StructuredValues;
183
- transforms: StructuredTypeTransform[];
184
- source: StructuredTypePin;
185
- }
186
- export interface PortableStructuredIngot {
187
- format: 'sparkvault-structured-ingot';
188
- formatVersion: 1;
189
- name: string;
190
- data: StructuredValues;
191
- binaryPaths: StructuredBinaryPath[];
192
- type: PortableStructuredType | null;
193
- source: {
194
- id: string;
195
- version: number;
196
- };
197
- }
198
- export type StructuredExportOutcome = {
199
- ok: true;
200
- record: PortableStructuredIngot;
201
- } | {
202
- ok: false;
203
- id: string;
204
- error: unknown;
205
- };
206
- export interface ImportStructuredIngotsOptions {
207
- /** Required for typed records. Resolve or create an explicit destination type. */
208
- mapType?: (definition: PortableStructuredType) => StructuredTypePin | Promise<StructuredTypePin>;
209
- /** Return a stable key for retrying this exact record; the SDK never invents one. */
210
- idempotencyKey?: (record: PortableStructuredIngot) => string | undefined;
211
- }
212
- export type StructuredImportOutcome = StructuredOutcome<StructuredIngotMutation> & {
213
- index: number;
214
- name: string | null;
215
- };
216
- export interface StructuredTypePinWire {
217
- type_id: string;
218
- version: number;
219
- }
220
- export interface StructuredIngotSummaryWire {
221
- ingot_id: string;
222
- name: string;
223
- size_bytes: number;
224
- created_at: number;
225
- updated_at?: number | null;
226
- revision?: string | null;
227
- }
228
- export interface StructuredIngotWire<T extends object = StructuredValues> {
229
- ingot_id: string;
230
- name: string;
231
- version: number;
232
- key_count: number;
233
- values: T;
234
- missing_keys: string[];
235
- revision?: string;
236
- binary_paths?: StructuredBinaryPath[];
237
- binary_keys?: string[];
238
- type?: StructuredTypePinWire | null;
239
- inline: boolean;
240
- created_at: number;
241
- updated_at: number;
242
- }
243
- export interface StructuredMutationWire {
244
- ingot_id: string;
245
- version: number;
246
- key_count: number;
247
- type?: StructuredTypePinWire | null;
248
- revision?: string;
249
- created_at?: number;
250
- updated_at?: number;
251
- created?: boolean;
252
- replayed?: boolean;
253
- }
254
- export interface StructuredTypeSummaryWire {
255
- type_id: string;
256
- name: string;
257
- created_at: number;
258
- updated_at: number | null;
259
- }
260
- export interface StructuredTypeDefinitionWire extends StructuredTypeSummaryWire {
261
- version: number;
262
- latest_version: number;
263
- archived: boolean;
264
- schema: StructuredValues;
265
- transforms: StructuredTypeTransform[];
266
- }
267
- export interface StructuredPageWire {
268
- count: number;
269
- next_cursor?: string | null;
270
- has_more: boolean;
271
- }
272
- export interface StructuredActivityTotalsWire {
273
- requests: number;
274
- reads: number;
275
- writes: number;
276
- errors: number;
277
- conflicts: number;
278
- average_latency_ms: number | null;
279
- p95_upper_bound_ms: number | null;
280
- p95_overflow: boolean;
281
- }
282
- export interface StructuredActivityWire {
283
- period: StructuredActivityPeriod;
284
- interval: 'hour' | 'day';
285
- as_of: number;
286
- window_start: number;
287
- window_end: number;
288
- totals: StructuredActivityTotalsWire;
289
- series: Array<StructuredActivityTotalsWire & {
290
- start: number;
291
- end: number;
292
- }>;
293
- }
@@ -1,25 +0,0 @@
1
- import type { UnsealedVault } from '../../vaults/types';
2
- import type { StructuredBinaryPath, StructuredIngotPrecondition, StructuredPageOptions, StructuredPageWire, StructuredPage, StructuredTypePin, StructuredTypePinWire } from './types';
3
- export declare function requireVault(vault: UnsealedVault): string;
4
- export declare function requireRef(ref: string): string;
5
- export declare function integer(value: number, field: string, minimum: number, maximum: number): number;
6
- export declare function expectedVersion(value: number): number;
7
- export declare function mutationPrecondition(options: StructuredIngotPrecondition): {
8
- expected_revision?: string;
9
- expected_version?: number;
10
- };
11
- export declare function keysQuery(keys: string[] | undefined): string | undefined;
12
- export declare function pageQuery(options: StructuredPageOptions): {
13
- limit?: number;
14
- cursor?: string;
15
- };
16
- export declare function page<T>(wire: StructuredPageWire, items: T[]): StructuredPage<T>;
17
- export declare function wirePin(pin: StructuredTypePin | null | undefined): StructuredTypePinWire | null | undefined;
18
- export declare function readPin(pin: StructuredTypePinWire | null | undefined): StructuredTypePin | null;
19
- export declare function validateValues(data: object): void;
20
- export declare function validateBinaryPaths(paths: StructuredBinaryPath[] | undefined): void;
21
- export declare function idempotencyHeaders(key: string | undefined): Record<string, string> | undefined;
22
- /** Empty pages are legitimate; a repeated cursor is never drained forever. */
23
- export declare function iteratePages<T>(read: (options: StructuredPageOptions) => Promise<StructuredPage<T>>, options?: StructuredPageOptions & {
24
- maxPages?: number;
25
- }): AsyncGenerator<T>;
@@ -1,44 +0,0 @@
1
- /**
2
- * Request paths: the one way a module names a SparkVault route.
3
- *
4
- * Every request the SDK sends carries the caller's credentials (a Bearer token
5
- * or API key, plus a Vault Access Token on vault data), so a value that
6
- * smuggled '/' or a dot-segment into a path would re-target that credentialed
7
- * request at another route. `apiPath` closes that by construction: each
8
- * interpolated value becomes exactly one percent-encoded segment, and a value
9
- * that cannot be one segment is refused before any request leaves. The
10
- * transports accept only an `ApiPath`, so no module can name a route any other
11
- * way. Server-issued ids are also checked for their shape first
12
- * (`requireResourceId`), so a malformed id fails with a ValidationError that
13
- * names the argument instead of reaching the server as a 404.
14
- *
15
- * The rules are the platform's one copy in `@sparkvault/app-sdk/request-path`
16
- * and, for ids, `@sparkvault/app-sdk/ids`, bundled into this SDK and mirrored
17
- * into sdk-mobile; this module only types them and raises this SDK's error.
18
- */
19
- declare const API_PATH: unique symbol;
20
- /** A route path whose every interpolated value is exactly one encoded segment. */
21
- export type ApiPath = string & {
22
- readonly [API_PATH]: true;
23
- };
24
- /** Query parameters; `undefined`, `null` and `''` are left out of the query. */
25
- export type QueryParams = Record<string, string | number | boolean | null | undefined>;
26
- /**
27
- * Build a route path from a template: `apiPath\`/v1/vaults/${vaultId}\``.
28
- *
29
- * @throws ValidationError when an interpolated value cannot be exactly one
30
- * path segment ('', '.', '..', a non-string, or malformed UTF-16).
31
- */
32
- export declare function apiPath(literals: TemplateStringsArray, ...values: string[]): ApiPath;
33
- /**
34
- * A server-issued resource id (`vlt_…`, `ing_…`, `fld_…`, `spk_…`, …), checked
35
- * before it names a route.
36
- *
37
- * @param field - The argument's name, reported on the ValidationError.
38
- */
39
- export declare function requireResourceId(value: unknown, field: string): string;
40
- /** The id of the unsealed vault a data-plane method was handed. */
41
- export declare function requireVaultId(vault: {
42
- readonly id?: unknown;
43
- } | null | undefined): string;
44
- export {};
@@ -1,91 +0,0 @@
1
- /**
2
- * Sparks Module
3
- *
4
- * Create, read, share, and delete ephemeral secrets, sealed server-side under
5
- * platform-held keys and read once. Ordinary Sparks are account-scoped;
6
- * values derived from Structured Ingots require the source vault's VAT.
7
- */
8
- import { HttpClient } from '../http';
9
- import type { Spark, CreatedSpark, ListSparksOptions, SparkPage, CreateSparkOptions, ShareSparkOptions, SparkLinkActionOptions, SparkShare, SparkInviteResend } from './types';
10
- export declare class SparksModule {
11
- private readonly http;
12
- constructor(http: HttpClient);
13
- /**
14
- * List sparks for the account.
15
- *
16
- * @example
17
- * const { sparks } = await sv.sparks.list();
18
- */
19
- list(options?: ListSparksOptions): Promise<SparkPage>;
20
- /**
21
- * Read (and burn) a spark. Reading is destructive: the spark can be read
22
- * exactly once.
23
- * Supply the source vault's VAT for a Structured Ingots field Spark.
24
- *
25
- * @example
26
- * const spark = await sv.sparks.get('spk_abc');
27
- * console.log(spark.payload);
28
- */
29
- get(sparkId: string, vat?: string): Promise<Spark>;
30
- /**
31
- * Create a spark. A link spark (contentType text/uri-list, the payload its
32
- * destination URL) is created with its x.sv link, `linkUrl`.
33
- *
34
- * @example
35
- * const spark = await sv.sparks.create({ payload: 'top secret', ttlMinutes: 60 });
36
- * const { linkUrl } = await sv.sparks.create({ payload: 'https://example.com', contentType: 'text/uri-list' });
37
- */
38
- create(options: CreateSparkOptions): Promise<CreatedSpark>;
39
- /**
40
- * Delete a spark.
41
- *
42
- * @example
43
- * await sv.sparks.delete('spk_abc');
44
- */
45
- delete(sparkId: string): Promise<void>;
46
- /**
47
- * Share a spark via a SparkLink (x.sv URL). A spark already shared keeps
48
- * its link: the settings are applied to it in place (`alreadyShared`), an
49
- * omitted visibility keeps the current one, and `expiresInSeconds` applies
50
- * to the first share only. `linkCode` names the link the change was asked
51
- * of: a change asked of a link replaced or turned off since is refused
52
- * (409 CONFLICT).
53
- *
54
- * @example
55
- * const share = await sv.sparks.share('spk_abc', { visibility: 'public' });
56
- * console.log(share.shareUrl);
57
- */
58
- share(sparkId: string, options?: ShareSparkOptions): Promise<SparkShare>;
59
- /**
60
- * Deliver an invite-only spark's link to its invitee again, changing
61
- * nothing about the link: the way on from an invitation that could not be
62
- * delivered (a share rejected with INVITATION_DELIVERY_FAILED or a 402
63
- * usage-credit funding refusal leaves its
64
- * link in place, and the same share again delivers nothing), or one the
65
- * invitee never received. `linkCode` names the link the resend was asked
66
- * of: a link replaced since is never delivered in its place (409 CONFLICT).
67
- *
68
- * @example
69
- * const { identity } = await sv.sparks.resendInvite('spk_abc');
70
- */
71
- resendInvite(sparkId: string, options?: SparkLinkActionOptions): Promise<SparkInviteResend>;
72
- /**
73
- * Get a spark's sharing status.
74
- *
75
- * @example
76
- * const share = await sv.sparks.getShare('spk_abc');
77
- */
78
- getShare(sparkId: string): Promise<SparkShare>;
79
- /**
80
- * Unshare a spark (delete its SparkLink). Idempotent: a spark with no link
81
- * answers `shared: false`, the link `linkCode` names included, so a retried
82
- * unshare is never refused. A `linkCode` naming a link another share
83
- * replaced since is refused (409 CONFLICT), so the link that took its place
84
- * is never deleted.
85
- *
86
- * @example
87
- * await sv.sparks.unshare('spk_abc');
88
- */
89
- unshare(sparkId: string, options?: SparkLinkActionOptions): Promise<SparkShare>;
90
- }
91
- export type { SparkSummary, Spark, CreatedSpark, ListSparksOptions, SparkPage, CreateSparkOptions, ShareSparkOptions, SparkLinkActionOptions, SparkShare, SparkInviteResend, SparkVisibility, } from './types';