@sparkvault/sdk-js 11.3.1 → 12.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/folders/index.d.ts +12 -5
- package/dist/folders/types.d.ts +28 -1
- package/dist/index.cjs +58 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +106 -20
- package/dist/index.mjs +58 -11
- package/dist/index.mjs.map +1 -1
- package/dist/ingots/index.d.ts +11 -3
- package/dist/ingots/types.d.ts +22 -11
- package/dist/sparks/index.d.ts +16 -3
- package/dist/sparks/types.d.ts +42 -2
- package/dist/sparkvault.js +1 -1
- package/dist/sparkvault.js.map +1 -1
- package/package.json +1 -1
package/dist/ingots/index.d.ts
CHANGED
|
@@ -181,11 +181,19 @@ export declare class IngotsModule {
|
|
|
181
181
|
*/
|
|
182
182
|
search(vault: UnsealedVault, options?: SearchIngotsOptions): Promise<IngotPage>;
|
|
183
183
|
/**
|
|
184
|
-
* List a folder, or the vault root,
|
|
185
|
-
*
|
|
184
|
+
* List one page of a folder's, or the vault root's, children: every direct
|
|
185
|
+
* subfolder first, then the ingots directly in it in creation order
|
|
186
|
+
* ({@link FolderContents}). Pass a page's `nextPageToken` back as
|
|
187
|
+
* `pageToken`, with the same folder and order, until it is null.
|
|
186
188
|
*
|
|
187
189
|
* @example
|
|
188
|
-
*
|
|
190
|
+
* let pageToken: string | undefined;
|
|
191
|
+
* do {
|
|
192
|
+
* const page = await sv.ingots.listContents(unsealed, { folderId: 'fld_x', pageToken });
|
|
193
|
+
* page.folders.forEach((f) => console.log(f.name));
|
|
194
|
+
* page.ingots.forEach((i) => console.log(i.name));
|
|
195
|
+
* pageToken = page.nextPageToken ?? undefined;
|
|
196
|
+
* } while (pageToken);
|
|
189
197
|
*/
|
|
190
198
|
listContents(vault: UnsealedVault, options?: ListContentsOptions): Promise<FolderContents>;
|
|
191
199
|
/**
|
package/dist/ingots/types.d.ts
CHANGED
|
@@ -219,29 +219,38 @@ export interface ListIngotsOptions {
|
|
|
219
219
|
export interface ListContentsOptions {
|
|
220
220
|
/** Folder to list (null/omitted lists the vault root) */
|
|
221
221
|
folderId?: string | null;
|
|
222
|
-
/**
|
|
223
|
-
|
|
224
|
-
/**
|
|
222
|
+
/** Most children on one page (1-500; server default 100) */
|
|
223
|
+
limit?: number;
|
|
224
|
+
/** A prior page's `nextPageToken`, for the same folder and order */
|
|
225
|
+
pageToken?: string;
|
|
226
|
+
/** Ingot creation order; `desc` (newest first) by default */
|
|
225
227
|
sortOrder?: 'asc' | 'desc';
|
|
226
228
|
}
|
|
227
229
|
/**
|
|
228
|
-
* One folder's
|
|
229
|
-
*
|
|
230
|
-
* ingot directly in
|
|
230
|
+
* One page of a folder's listing. The folder's children run as one sequence
|
|
231
|
+
* across its pages: every direct subfolder first, in a stable order that is
|
|
232
|
+
* not by name, then every ingot directly in the folder in creation order
|
|
233
|
+
* (newest first under `desc`). A page holds at most `limit` children in all,
|
|
234
|
+
* so one page can hold the last subfolders and the first ingots, and a page
|
|
235
|
+
* can hold fewer than `limit`, even none, and still not be the last: follow
|
|
236
|
+
* `nextPageToken`, never the count. Ordering by name, size or type is the
|
|
237
|
+
* caller's, over the children it holds.
|
|
231
238
|
*/
|
|
232
239
|
export interface FolderContents {
|
|
233
|
-
/** The folder listed,
|
|
240
|
+
/** The folder listed, on every page; null at the vault root */
|
|
234
241
|
folder: {
|
|
235
242
|
id: string;
|
|
236
243
|
name: string;
|
|
237
244
|
parentId: string | null;
|
|
238
245
|
} | null;
|
|
239
|
-
/** Root → … → the folder listed */
|
|
246
|
+
/** Root → … → the folder listed, on every page */
|
|
240
247
|
breadcrumb: FolderBreadcrumbItem[];
|
|
241
|
-
/**
|
|
248
|
+
/** This page's subfolders */
|
|
242
249
|
folders: Folder[];
|
|
243
|
-
/**
|
|
250
|
+
/** This page's ingots */
|
|
244
251
|
ingots: Ingot[];
|
|
252
|
+
/** The next page's `pageToken`; null on the last page */
|
|
253
|
+
nextPageToken: string | null;
|
|
245
254
|
}
|
|
246
255
|
/** Options for search. */
|
|
247
256
|
export interface SearchIngotsOptions {
|
|
@@ -375,7 +384,7 @@ export interface ListIngotsResponse {
|
|
|
375
384
|
count?: number;
|
|
376
385
|
next_cursor?: string;
|
|
377
386
|
}
|
|
378
|
-
/** GET /vaults/:id/contents */
|
|
387
|
+
/** GET /vaults/:id/contents: one page */
|
|
379
388
|
export interface ListContentsResponse {
|
|
380
389
|
folder: {
|
|
381
390
|
folder_id: string;
|
|
@@ -388,6 +397,8 @@ export interface ListContentsResponse {
|
|
|
388
397
|
}[];
|
|
389
398
|
folders?: FolderWire[];
|
|
390
399
|
ingots?: IngotWire[];
|
|
400
|
+
/** Null on the last page; read as null when absent, so a page without it ends the walk instead of looping. */
|
|
401
|
+
next_page_token?: string | null;
|
|
391
402
|
}
|
|
392
403
|
export interface DownloadIngotResponse {
|
|
393
404
|
content_version?: string | null;
|
package/dist/sparks/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* secrets. Sparks are account-scoped — no vault or VAT is involved.
|
|
6
6
|
*/
|
|
7
7
|
import { HttpClient } from '../http';
|
|
8
|
-
import type { Spark, CreatedSpark, ListSparksOptions, SparkPage, CreateSparkOptions, ShareSparkOptions, SparkShare } from './types';
|
|
8
|
+
import type { Spark, CreatedSpark, ListSparksOptions, SparkPage, CreateSparkOptions, ShareSparkOptions, SparkShare, SparkInviteResend } from './types';
|
|
9
9
|
export declare class SparksModule {
|
|
10
10
|
private readonly http;
|
|
11
11
|
constructor(http: HttpClient);
|
|
@@ -26,10 +26,12 @@ export declare class SparksModule {
|
|
|
26
26
|
*/
|
|
27
27
|
get(sparkId: string): Promise<Spark>;
|
|
28
28
|
/**
|
|
29
|
-
* Create a spark.
|
|
29
|
+
* Create a spark. A link spark (contentType text/uri-list, the payload its
|
|
30
|
+
* destination URL) is created with its x.sv link, `linkUrl`.
|
|
30
31
|
*
|
|
31
32
|
* @example
|
|
32
33
|
* const spark = await sv.sparks.create({ payload: 'top secret', ttlMinutes: 60 });
|
|
34
|
+
* const { linkUrl } = await sv.sparks.create({ payload: 'https://example.com', contentType: 'text/uri-list' });
|
|
33
35
|
*/
|
|
34
36
|
create(options: CreateSparkOptions): Promise<CreatedSpark>;
|
|
35
37
|
/**
|
|
@@ -47,6 +49,17 @@ export declare class SparksModule {
|
|
|
47
49
|
* console.log(share.shareUrl);
|
|
48
50
|
*/
|
|
49
51
|
share(sparkId: string, options?: ShareSparkOptions): Promise<SparkShare>;
|
|
52
|
+
/**
|
|
53
|
+
* Deliver an invite-only spark's link to its invitee again, changing
|
|
54
|
+
* nothing about the link: the way on from an invitation that could not be
|
|
55
|
+
* delivered (a share rejected with INVITATION_DELIVERY_FAILED leaves its
|
|
56
|
+
* link in place, and the same share again delivers nothing), or one the
|
|
57
|
+
* invitee never received.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* const { identity } = await sv.sparks.resendInvite('spk_abc');
|
|
61
|
+
*/
|
|
62
|
+
resendInvite(sparkId: string): Promise<SparkInviteResend>;
|
|
50
63
|
/**
|
|
51
64
|
* Get a spark's sharing status.
|
|
52
65
|
*
|
|
@@ -62,4 +75,4 @@ export declare class SparksModule {
|
|
|
62
75
|
*/
|
|
63
76
|
unshare(sparkId: string): Promise<SparkShare>;
|
|
64
77
|
}
|
|
65
|
-
export type { SparkSummary, Spark, CreatedSpark, ListSparksOptions, SparkPage, CreateSparkOptions, ShareSparkOptions, SparkShare, SparkVisibility, } from './types';
|
|
78
|
+
export type { SparkSummary, Spark, CreatedSpark, ListSparksOptions, SparkPage, CreateSparkOptions, ShareSparkOptions, SparkShare, SparkInviteResend, SparkVisibility, } from './types';
|
package/dist/sparks/types.d.ts
CHANGED
|
@@ -13,13 +13,16 @@ export interface SparkSummary {
|
|
|
13
13
|
contentType: string;
|
|
14
14
|
/** Size in bytes */
|
|
15
15
|
size: number;
|
|
16
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Lifecycle status: active, expired, ash (a recipient read it, and it
|
|
18
|
+
* burned) or deleted (its owner deleted it, which burns its content too)
|
|
19
|
+
*/
|
|
17
20
|
status: string;
|
|
18
21
|
/** Creation timestamp (Unix seconds) */
|
|
19
22
|
createdAt: number;
|
|
20
23
|
/** Expiry timestamp (Unix seconds) */
|
|
21
24
|
expiresAt: number;
|
|
22
|
-
/**
|
|
25
|
+
/** The read's burn timestamp (Unix seconds), or null if not read (a deleted spark's included) */
|
|
23
26
|
burnedAt: number | null;
|
|
24
27
|
/** Seconds remaining until expiry */
|
|
25
28
|
timeRemaining: number;
|
|
@@ -27,6 +30,8 @@ export interface SparkSummary {
|
|
|
27
30
|
filename?: string;
|
|
28
31
|
/** Optional kindling family ID */
|
|
29
32
|
kindling?: string;
|
|
33
|
+
/** A link spark (contentType text/uri-list) only: its x.sv link */
|
|
34
|
+
linkUrl?: string;
|
|
30
35
|
}
|
|
31
36
|
/** The decrypted spark, returned by get (reading burns it). */
|
|
32
37
|
export interface Spark {
|
|
@@ -81,6 +86,13 @@ export interface CreatedSpark {
|
|
|
81
86
|
filename?: string;
|
|
82
87
|
/** Optional kindling family ID (echoed when provided) */
|
|
83
88
|
kindling?: string;
|
|
89
|
+
/**
|
|
90
|
+
* A link spark (contentType text/uri-list) only: its x.sv link, which opens
|
|
91
|
+
* once and redirects to the payload's URL. It is minted with the spark.
|
|
92
|
+
*/
|
|
93
|
+
linkUrl?: string;
|
|
94
|
+
/** A link spark only: the code in linkUrl */
|
|
95
|
+
linkCode?: string;
|
|
84
96
|
}
|
|
85
97
|
/** Options for list. */
|
|
86
98
|
export interface ListSparksOptions {
|
|
@@ -145,6 +157,23 @@ export interface SparkShare {
|
|
|
145
157
|
expiresAt?: number;
|
|
146
158
|
/** Link creation timestamp (Unix seconds) */
|
|
147
159
|
createdAt?: number;
|
|
160
|
+
/**
|
|
161
|
+
* The invitees this share delivered the link to (share only): none for a
|
|
162
|
+
* share that invites no one new. An invitee already on the link is sent it
|
|
163
|
+
* again by resendInvite.
|
|
164
|
+
*/
|
|
165
|
+
deliveredTo?: string[];
|
|
166
|
+
}
|
|
167
|
+
/** An invitation delivered again, as resendInvite answers it. */
|
|
168
|
+
export interface SparkInviteResend {
|
|
169
|
+
/** Spark ID */
|
|
170
|
+
sparkId: string;
|
|
171
|
+
/** The invitee the link was delivered to */
|
|
172
|
+
identity: string;
|
|
173
|
+
/** How it was delivered: by email or by SMS */
|
|
174
|
+
identityType: 'email' | 'phone';
|
|
175
|
+
/** Delivery timestamp (Unix seconds) */
|
|
176
|
+
sentAt: number;
|
|
148
177
|
}
|
|
149
178
|
export interface SparkSummaryWire {
|
|
150
179
|
spark_id: string;
|
|
@@ -157,6 +186,7 @@ export interface SparkSummaryWire {
|
|
|
157
186
|
time_remaining?: number;
|
|
158
187
|
filename?: string;
|
|
159
188
|
kindling?: string;
|
|
189
|
+
link_url?: string;
|
|
160
190
|
}
|
|
161
191
|
export interface ListSparksResponse {
|
|
162
192
|
sparks: SparkSummaryWire[];
|
|
@@ -182,6 +212,8 @@ export interface CreateSparkResponse {
|
|
|
182
212
|
ttl_minutes: number;
|
|
183
213
|
filename?: string;
|
|
184
214
|
kindling?: string;
|
|
215
|
+
link_url?: string;
|
|
216
|
+
link_code?: string;
|
|
185
217
|
}
|
|
186
218
|
export interface SparkShareResponse {
|
|
187
219
|
shared: boolean;
|
|
@@ -191,4 +223,12 @@ export interface SparkShareResponse {
|
|
|
191
223
|
invites?: string[];
|
|
192
224
|
expires_at?: number;
|
|
193
225
|
created_at?: number;
|
|
226
|
+
delivered_to?: string[];
|
|
227
|
+
}
|
|
228
|
+
export interface SparkInviteResendResponse {
|
|
229
|
+
resent: boolean;
|
|
230
|
+
spark_id: string;
|
|
231
|
+
identity: string;
|
|
232
|
+
identity_type: 'email' | 'phone';
|
|
233
|
+
sent_at: number;
|
|
194
234
|
}
|