@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/index.d.ts
CHANGED
|
@@ -2229,6 +2229,26 @@ interface FolderBreadcrumbItem {
|
|
|
2229
2229
|
/** Folder name */
|
|
2230
2230
|
name: string;
|
|
2231
2231
|
}
|
|
2232
|
+
/** Options for one page of a vault's folders. */
|
|
2233
|
+
interface ListFoldersOptions {
|
|
2234
|
+
/** Most folders on one page (1-500; server default 100) */
|
|
2235
|
+
limit?: number;
|
|
2236
|
+
/** A prior page's `nextPageToken` */
|
|
2237
|
+
pageToken?: string;
|
|
2238
|
+
}
|
|
2239
|
+
/**
|
|
2240
|
+
* One page of a vault's folders: at most `limit` of them, in an order that
|
|
2241
|
+
* holds from page to page and is not by name. A page can hold fewer, even
|
|
2242
|
+
* none, and still not be the last: follow `nextPageToken`, never the count,
|
|
2243
|
+
* and sort what you hold. To show one folder's subfolders, list its contents
|
|
2244
|
+
* (`ingots.listContents`), which pages them first.
|
|
2245
|
+
*/
|
|
2246
|
+
interface FolderPage {
|
|
2247
|
+
/** This page's folders */
|
|
2248
|
+
folders: Folder[];
|
|
2249
|
+
/** The next page's `pageToken`; null on the last page */
|
|
2250
|
+
nextPageToken: string | null;
|
|
2251
|
+
}
|
|
2232
2252
|
/** Options for creating a folder. */
|
|
2233
2253
|
interface CreateFolderOptions {
|
|
2234
2254
|
/** Folder name */
|
|
@@ -2465,29 +2485,38 @@ interface ListIngotsOptions {
|
|
|
2465
2485
|
interface ListContentsOptions {
|
|
2466
2486
|
/** Folder to list (null/omitted lists the vault root) */
|
|
2467
2487
|
folderId?: string | null;
|
|
2468
|
-
/**
|
|
2469
|
-
|
|
2470
|
-
/**
|
|
2488
|
+
/** Most children on one page (1-500; server default 100) */
|
|
2489
|
+
limit?: number;
|
|
2490
|
+
/** A prior page's `nextPageToken`, for the same folder and order */
|
|
2491
|
+
pageToken?: string;
|
|
2492
|
+
/** Ingot creation order; `desc` (newest first) by default */
|
|
2471
2493
|
sortOrder?: 'asc' | 'desc';
|
|
2472
2494
|
}
|
|
2473
2495
|
/**
|
|
2474
|
-
* One folder's
|
|
2475
|
-
*
|
|
2476
|
-
* ingot directly in
|
|
2496
|
+
* One page of a folder's listing. The folder's children run as one sequence
|
|
2497
|
+
* across its pages: every direct subfolder first, in a stable order that is
|
|
2498
|
+
* not by name, then every ingot directly in the folder in creation order
|
|
2499
|
+
* (newest first under `desc`). A page holds at most `limit` children in all,
|
|
2500
|
+
* so one page can hold the last subfolders and the first ingots, and a page
|
|
2501
|
+
* can hold fewer than `limit`, even none, and still not be the last: follow
|
|
2502
|
+
* `nextPageToken`, never the count. Ordering by name, size or type is the
|
|
2503
|
+
* caller's, over the children it holds.
|
|
2477
2504
|
*/
|
|
2478
2505
|
interface FolderContents {
|
|
2479
|
-
/** The folder listed,
|
|
2506
|
+
/** The folder listed, on every page; null at the vault root */
|
|
2480
2507
|
folder: {
|
|
2481
2508
|
id: string;
|
|
2482
2509
|
name: string;
|
|
2483
2510
|
parentId: string | null;
|
|
2484
2511
|
} | null;
|
|
2485
|
-
/** Root → … → the folder listed */
|
|
2512
|
+
/** Root → … → the folder listed, on every page */
|
|
2486
2513
|
breadcrumb: FolderBreadcrumbItem[];
|
|
2487
|
-
/**
|
|
2514
|
+
/** This page's subfolders */
|
|
2488
2515
|
folders: Folder[];
|
|
2489
|
-
/**
|
|
2516
|
+
/** This page's ingots */
|
|
2490
2517
|
ingots: Ingot[];
|
|
2518
|
+
/** The next page's `pageToken`; null on the last page */
|
|
2519
|
+
nextPageToken: string | null;
|
|
2491
2520
|
}
|
|
2492
2521
|
/** Options for search. */
|
|
2493
2522
|
interface SearchIngotsOptions {
|
|
@@ -2835,11 +2864,19 @@ declare class IngotsModule {
|
|
|
2835
2864
|
*/
|
|
2836
2865
|
search(vault: UnsealedVault, options?: SearchIngotsOptions): Promise<IngotPage>;
|
|
2837
2866
|
/**
|
|
2838
|
-
* List a folder, or the vault root,
|
|
2839
|
-
*
|
|
2867
|
+
* List one page of a folder's, or the vault root's, children: every direct
|
|
2868
|
+
* subfolder first, then the ingots directly in it in creation order
|
|
2869
|
+
* ({@link FolderContents}). Pass a page's `nextPageToken` back as
|
|
2870
|
+
* `pageToken`, with the same folder and order, until it is null.
|
|
2840
2871
|
*
|
|
2841
2872
|
* @example
|
|
2842
|
-
*
|
|
2873
|
+
* let pageToken: string | undefined;
|
|
2874
|
+
* do {
|
|
2875
|
+
* const page = await sv.ingots.listContents(unsealed, { folderId: 'fld_x', pageToken });
|
|
2876
|
+
* page.folders.forEach((f) => console.log(f.name));
|
|
2877
|
+
* page.ingots.forEach((i) => console.log(i.name));
|
|
2878
|
+
* pageToken = page.nextPageToken ?? undefined;
|
|
2879
|
+
* } while (pageToken);
|
|
2843
2880
|
*/
|
|
2844
2881
|
listContents(vault: UnsealedVault, options?: ListContentsOptions): Promise<FolderContents>;
|
|
2845
2882
|
/**
|
|
@@ -2959,12 +2996,19 @@ declare class FoldersModule {
|
|
|
2959
2996
|
private readonly http;
|
|
2960
2997
|
constructor(http: HttpClient);
|
|
2961
2998
|
/**
|
|
2962
|
-
*
|
|
2999
|
+
* One page of the vault's folders ({@link FolderPage}). Pass a page's
|
|
3000
|
+
* `nextPageToken` back as `pageToken` until it is null. To show one
|
|
3001
|
+
* folder's subfolders, list its contents (`ingots.listContents`) instead.
|
|
2963
3002
|
*
|
|
2964
3003
|
* @example
|
|
2965
|
-
*
|
|
3004
|
+
* let pageToken: string | undefined;
|
|
3005
|
+
* do {
|
|
3006
|
+
* const page = await sv.folders.list(unsealed, { pageToken });
|
|
3007
|
+
* page.folders.forEach((f) => console.log(f.name));
|
|
3008
|
+
* pageToken = page.nextPageToken ?? undefined;
|
|
3009
|
+
* } while (pageToken);
|
|
2966
3010
|
*/
|
|
2967
|
-
list(vault: UnsealedVault): Promise<
|
|
3011
|
+
list(vault: UnsealedVault, options?: ListFoldersOptions): Promise<FolderPage>;
|
|
2968
3012
|
/**
|
|
2969
3013
|
* The folder at `path`, or null when the vault has none there. `path` is an
|
|
2970
3014
|
* upload's folder path (`folder` on an upload): slash-delimited from the
|
|
@@ -3054,13 +3098,16 @@ interface SparkSummary {
|
|
|
3054
3098
|
contentType: string;
|
|
3055
3099
|
/** Size in bytes */
|
|
3056
3100
|
size: number;
|
|
3057
|
-
/**
|
|
3101
|
+
/**
|
|
3102
|
+
* Lifecycle status: active, expired, ash (a recipient read it, and it
|
|
3103
|
+
* burned) or deleted (its owner deleted it, which burns its content too)
|
|
3104
|
+
*/
|
|
3058
3105
|
status: string;
|
|
3059
3106
|
/** Creation timestamp (Unix seconds) */
|
|
3060
3107
|
createdAt: number;
|
|
3061
3108
|
/** Expiry timestamp (Unix seconds) */
|
|
3062
3109
|
expiresAt: number;
|
|
3063
|
-
/**
|
|
3110
|
+
/** The read's burn timestamp (Unix seconds), or null if not read (a deleted spark's included) */
|
|
3064
3111
|
burnedAt: number | null;
|
|
3065
3112
|
/** Seconds remaining until expiry */
|
|
3066
3113
|
timeRemaining: number;
|
|
@@ -3068,6 +3115,8 @@ interface SparkSummary {
|
|
|
3068
3115
|
filename?: string;
|
|
3069
3116
|
/** Optional kindling family ID */
|
|
3070
3117
|
kindling?: string;
|
|
3118
|
+
/** A link spark (contentType text/uri-list) only: its x.sv link */
|
|
3119
|
+
linkUrl?: string;
|
|
3071
3120
|
}
|
|
3072
3121
|
/** The decrypted spark, returned by get (reading burns it). */
|
|
3073
3122
|
interface Spark {
|
|
@@ -3122,6 +3171,13 @@ interface CreatedSpark {
|
|
|
3122
3171
|
filename?: string;
|
|
3123
3172
|
/** Optional kindling family ID (echoed when provided) */
|
|
3124
3173
|
kindling?: string;
|
|
3174
|
+
/**
|
|
3175
|
+
* A link spark (contentType text/uri-list) only: its x.sv link, which opens
|
|
3176
|
+
* once and redirects to the payload's URL. It is minted with the spark.
|
|
3177
|
+
*/
|
|
3178
|
+
linkUrl?: string;
|
|
3179
|
+
/** A link spark only: the code in linkUrl */
|
|
3180
|
+
linkCode?: string;
|
|
3125
3181
|
}
|
|
3126
3182
|
/** Options for list. */
|
|
3127
3183
|
interface ListSparksOptions {
|
|
@@ -3186,6 +3242,23 @@ interface SparkShare {
|
|
|
3186
3242
|
expiresAt?: number;
|
|
3187
3243
|
/** Link creation timestamp (Unix seconds) */
|
|
3188
3244
|
createdAt?: number;
|
|
3245
|
+
/**
|
|
3246
|
+
* The invitees this share delivered the link to (share only): none for a
|
|
3247
|
+
* share that invites no one new. An invitee already on the link is sent it
|
|
3248
|
+
* again by resendInvite.
|
|
3249
|
+
*/
|
|
3250
|
+
deliveredTo?: string[];
|
|
3251
|
+
}
|
|
3252
|
+
/** An invitation delivered again, as resendInvite answers it. */
|
|
3253
|
+
interface SparkInviteResend {
|
|
3254
|
+
/** Spark ID */
|
|
3255
|
+
sparkId: string;
|
|
3256
|
+
/** The invitee the link was delivered to */
|
|
3257
|
+
identity: string;
|
|
3258
|
+
/** How it was delivered: by email or by SMS */
|
|
3259
|
+
identityType: 'email' | 'phone';
|
|
3260
|
+
/** Delivery timestamp (Unix seconds) */
|
|
3261
|
+
sentAt: number;
|
|
3189
3262
|
}
|
|
3190
3263
|
|
|
3191
3264
|
/**
|
|
@@ -3215,10 +3288,12 @@ declare class SparksModule {
|
|
|
3215
3288
|
*/
|
|
3216
3289
|
get(sparkId: string): Promise<Spark>;
|
|
3217
3290
|
/**
|
|
3218
|
-
* Create a spark.
|
|
3291
|
+
* Create a spark. A link spark (contentType text/uri-list, the payload its
|
|
3292
|
+
* destination URL) is created with its x.sv link, `linkUrl`.
|
|
3219
3293
|
*
|
|
3220
3294
|
* @example
|
|
3221
3295
|
* const spark = await sv.sparks.create({ payload: 'top secret', ttlMinutes: 60 });
|
|
3296
|
+
* const { linkUrl } = await sv.sparks.create({ payload: 'https://example.com', contentType: 'text/uri-list' });
|
|
3222
3297
|
*/
|
|
3223
3298
|
create(options: CreateSparkOptions): Promise<CreatedSpark>;
|
|
3224
3299
|
/**
|
|
@@ -3236,6 +3311,17 @@ declare class SparksModule {
|
|
|
3236
3311
|
* console.log(share.shareUrl);
|
|
3237
3312
|
*/
|
|
3238
3313
|
share(sparkId: string, options?: ShareSparkOptions): Promise<SparkShare>;
|
|
3314
|
+
/**
|
|
3315
|
+
* Deliver an invite-only spark's link to its invitee again, changing
|
|
3316
|
+
* nothing about the link: the way on from an invitation that could not be
|
|
3317
|
+
* delivered (a share rejected with INVITATION_DELIVERY_FAILED leaves its
|
|
3318
|
+
* link in place, and the same share again delivers nothing), or one the
|
|
3319
|
+
* invitee never received.
|
|
3320
|
+
*
|
|
3321
|
+
* @example
|
|
3322
|
+
* const { identity } = await sv.sparks.resendInvite('spk_abc');
|
|
3323
|
+
*/
|
|
3324
|
+
resendInvite(sparkId: string): Promise<SparkInviteResend>;
|
|
3239
3325
|
/**
|
|
3240
3326
|
* Get a spark's sharing status.
|
|
3241
3327
|
*
|
|
@@ -3606,4 +3692,4 @@ declare global {
|
|
|
3606
3692
|
}
|
|
3607
3693
|
|
|
3608
3694
|
export { AuthenticationError, AuthorizationError, EntropyModule, FoldersModule, IdentityModule, IngotsModule, NAME_CONFLICT_POLICIES, NOTIFY_PRESETS, NetworkError, NotifyModule, NotifyProductModule, NotifySubscriptionRequiredError, PlanRequiredError, PopupBlockedError, ProductsModule, QuotaExceededError, SparkVault, SparkVaultError, SparksModule, TimeoutError, UserCancelledError, ValidationError, VaultsModule, buildNotifyPresetSend, SparkVault as default, fetchDownload, logger, setDebugMode };
|
|
3609
|
-
export type { AccessLogRetention, AccessLogsOptions, CreateFolderOptions, CreateNotifySendOptions, CreateSparkOptions, CreateUploadOptions, CreateVaultOptions, CreatedIngot, CreatedSpark, EntropyFormat, EntropyResult, FetchDownloadOptions, FetchedDownload, Folder, FolderBreadcrumbItem, FolderContents, GenerateEntropyOptions, HealthCheckOptions, HealthCheckResult, AttachOptions as IdentityAttachOptions, Ingot, IngotAccessLog, IngotAccessLogPage, IngotDownloadLink, IngotInvite, IngotPage, IngotSharingConfig, IngotUpload, ListContentsOptions, ListIngotsOptions, ListNotificationsOptions, ListNotificationsResponse, ListNotifyInboxOptions, ListNotifyInboxResponse, ListNotifyReceiptsOptions, ListNotifyReceiptsResponse, ListNotifySendsOptions, ListNotifySendsResponse, ListSparksOptions, MarkAllNotificationsStateOptions, MarkAllNotificationsStateResponse, MarkAllReadResult, MarkNotificationStateOptions, MarkNotificationStateResponse, MarkNotifyInboxAllOptions, MarkNotifyInboxAllResponse, MarkNotifyInboxStateOptions, MarkNotifyInboxStateResponse, NameConflictPolicy, NotificationBulkMarkState, NotificationInboxState, NotificationMarkState, NotificationRow, NotifyCategory, NotifyChannel, NotifyConfig, NotifyConfigCategory, NotifyConfigDelivery, NotifyConfigEvents, NotifyConfigEventsRead, NotifyConfigHistory, NotifyConfigOverrides, NotifyConfigPatch, NotifyConfigRealtimeFallbackDelay, NotifyConfigReliability, NotifyConfigResponse, NotifyConfigSecurity, NotifyDeliveryMode, NotifyEscalation, NotifyInboxBulkMarkState, NotifyInboxMarkState, NotifyInboxRow, NotifyInboxView, NotifyIngotRef, NotifyInteraction, NotifyPreset, NotifyPresetCategory, NotifyPresetName, NotifyPresetSendOptions, NotifyRecallMode, NotifyReceipt, NotifyReceiptEventType, NotifyRecipient, NotifyRecipientRef, NotifySendContent, NotifySendPolicy, NotifySendReceipt, NotifySendReceiptsResponse, NotifySendResult, NotifySendState, NotifySendStatus, NotifySendStatusCounts, NotifySendStatusRecipient, NotifySendSummary, NotifyVerificationLevel, QuotaResource, RecallNotifySendOptions, RecallNotifySendResponse, RegisterWebPushResponse, ReplaceIngotOptions, ResumeUploadOptions, ScheduledVaultDeletion, SearchIngotsOptions, SendUploadOptions, ShareSparkOptions, Spark, SparkPage, SparkShare, SparkSummary, SparkVaultConfig, SparkVisibility, SubscribeWebPushOptions, SubscribeWebPushResult, SubscribeWebPushStatus, TokenClaims, UnreadCountResponse, UnsealedVault, UnsubscribeWebPushResponse, UpdateFolderOptions, UpdateIngotSharingOptions, UpdateVaultUploadOptions, UpdatedVault, UploadAttachOptions, UploadBranding, UploadIngotOptions, UploadOptions, UploadProgress, UploadResult, UploadSession, Vault, VaultDetail, VaultLifecycle, VaultSharingConfig, VaultSharingOptions, VaultSummary, VaultUploadConfig, VaultUploadSettings, VerifyOptions, VerifyResult, WebPushKeyResponse, WebPushSubscriptionInput };
|
|
3695
|
+
export type { AccessLogRetention, AccessLogsOptions, CreateFolderOptions, CreateNotifySendOptions, CreateSparkOptions, CreateUploadOptions, CreateVaultOptions, CreatedIngot, CreatedSpark, EntropyFormat, EntropyResult, FetchDownloadOptions, FetchedDownload, Folder, FolderBreadcrumbItem, FolderContents, FolderPage, GenerateEntropyOptions, HealthCheckOptions, HealthCheckResult, AttachOptions as IdentityAttachOptions, Ingot, IngotAccessLog, IngotAccessLogPage, IngotDownloadLink, IngotInvite, IngotPage, IngotSharingConfig, IngotUpload, ListContentsOptions, ListFoldersOptions, ListIngotsOptions, ListNotificationsOptions, ListNotificationsResponse, ListNotifyInboxOptions, ListNotifyInboxResponse, ListNotifyReceiptsOptions, ListNotifyReceiptsResponse, ListNotifySendsOptions, ListNotifySendsResponse, ListSparksOptions, MarkAllNotificationsStateOptions, MarkAllNotificationsStateResponse, MarkAllReadResult, MarkNotificationStateOptions, MarkNotificationStateResponse, MarkNotifyInboxAllOptions, MarkNotifyInboxAllResponse, MarkNotifyInboxStateOptions, MarkNotifyInboxStateResponse, NameConflictPolicy, NotificationBulkMarkState, NotificationInboxState, NotificationMarkState, NotificationRow, NotifyCategory, NotifyChannel, NotifyConfig, NotifyConfigCategory, NotifyConfigDelivery, NotifyConfigEvents, NotifyConfigEventsRead, NotifyConfigHistory, NotifyConfigOverrides, NotifyConfigPatch, NotifyConfigRealtimeFallbackDelay, NotifyConfigReliability, NotifyConfigResponse, NotifyConfigSecurity, NotifyDeliveryMode, NotifyEscalation, NotifyInboxBulkMarkState, NotifyInboxMarkState, NotifyInboxRow, NotifyInboxView, NotifyIngotRef, NotifyInteraction, NotifyPreset, NotifyPresetCategory, NotifyPresetName, NotifyPresetSendOptions, NotifyRecallMode, NotifyReceipt, NotifyReceiptEventType, NotifyRecipient, NotifyRecipientRef, NotifySendContent, NotifySendPolicy, NotifySendReceipt, NotifySendReceiptsResponse, NotifySendResult, NotifySendState, NotifySendStatus, NotifySendStatusCounts, NotifySendStatusRecipient, NotifySendSummary, NotifyVerificationLevel, QuotaResource, RecallNotifySendOptions, RecallNotifySendResponse, RegisterWebPushResponse, ReplaceIngotOptions, ResumeUploadOptions, ScheduledVaultDeletion, SearchIngotsOptions, SendUploadOptions, ShareSparkOptions, Spark, SparkInviteResend, SparkPage, SparkShare, SparkSummary, SparkVaultConfig, SparkVisibility, SubscribeWebPushOptions, SubscribeWebPushResult, SubscribeWebPushStatus, TokenClaims, UnreadCountResponse, UnsealedVault, UnsubscribeWebPushResponse, UpdateFolderOptions, UpdateIngotSharingOptions, UpdateVaultUploadOptions, UpdatedVault, UploadAttachOptions, UploadBranding, UploadIngotOptions, UploadOptions, UploadProgress, UploadResult, UploadSession, Vault, VaultDetail, VaultLifecycle, VaultSharingConfig, VaultSharingOptions, VaultSummary, VaultUploadConfig, VaultUploadSettings, VerifyOptions, VerifyResult, WebPushKeyResponse, WebPushSubscriptionInput };
|
package/dist/index.mjs
CHANGED
|
@@ -16116,15 +16116,25 @@ class FoldersModule {
|
|
|
16116
16116
|
this.http = http;
|
|
16117
16117
|
}
|
|
16118
16118
|
/**
|
|
16119
|
-
*
|
|
16119
|
+
* One page of the vault's folders ({@link FolderPage}). Pass a page's
|
|
16120
|
+
* `nextPageToken` back as `pageToken` until it is null. To show one
|
|
16121
|
+
* folder's subfolders, list its contents (`ingots.listContents`) instead.
|
|
16120
16122
|
*
|
|
16121
16123
|
* @example
|
|
16122
|
-
*
|
|
16124
|
+
* let pageToken: string | undefined;
|
|
16125
|
+
* do {
|
|
16126
|
+
* const page = await sv.folders.list(unsealed, { pageToken });
|
|
16127
|
+
* page.folders.forEach((f) => console.log(f.name));
|
|
16128
|
+
* pageToken = page.nextPageToken ?? undefined;
|
|
16129
|
+
* } while (pageToken);
|
|
16123
16130
|
*/
|
|
16124
|
-
async list(vault) {
|
|
16131
|
+
async list(vault, options = {}) {
|
|
16125
16132
|
const vaultId = requireVaultId(vault);
|
|
16126
|
-
const response = await this.http.get(apiPath `/v1/vaults/${vaultId}/folders`, { vat: vault.vatToken });
|
|
16127
|
-
return
|
|
16133
|
+
const response = await this.http.get(apiPath `/v1/vaults/${vaultId}/folders`, { vat: vault.vatToken, query: { limit: options.limit, page_token: options.pageToken } });
|
|
16134
|
+
return {
|
|
16135
|
+
folders: (response.data.folders ?? []).map(mapFolder),
|
|
16136
|
+
nextPageToken: response.data.next_page_token ?? null,
|
|
16137
|
+
};
|
|
16128
16138
|
}
|
|
16129
16139
|
/**
|
|
16130
16140
|
* The folder at `path`, or null when the vault has none there. `path` is an
|
|
@@ -16615,11 +16625,19 @@ class IngotsModule {
|
|
|
16615
16625
|
return mapIngotPage(response.data);
|
|
16616
16626
|
}
|
|
16617
16627
|
/**
|
|
16618
|
-
* List a folder, or the vault root,
|
|
16619
|
-
*
|
|
16628
|
+
* List one page of a folder's, or the vault root's, children: every direct
|
|
16629
|
+
* subfolder first, then the ingots directly in it in creation order
|
|
16630
|
+
* ({@link FolderContents}). Pass a page's `nextPageToken` back as
|
|
16631
|
+
* `pageToken`, with the same folder and order, until it is null.
|
|
16620
16632
|
*
|
|
16621
16633
|
* @example
|
|
16622
|
-
*
|
|
16634
|
+
* let pageToken: string | undefined;
|
|
16635
|
+
* do {
|
|
16636
|
+
* const page = await sv.ingots.listContents(unsealed, { folderId: 'fld_x', pageToken });
|
|
16637
|
+
* page.folders.forEach((f) => console.log(f.name));
|
|
16638
|
+
* page.ingots.forEach((i) => console.log(i.name));
|
|
16639
|
+
* pageToken = page.nextPageToken ?? undefined;
|
|
16640
|
+
* } while (pageToken);
|
|
16623
16641
|
*/
|
|
16624
16642
|
async listContents(vault, options = {}) {
|
|
16625
16643
|
const vaultId = requireVaultId(vault);
|
|
@@ -16627,7 +16645,8 @@ class IngotsModule {
|
|
|
16627
16645
|
vat: vault.vatToken,
|
|
16628
16646
|
query: {
|
|
16629
16647
|
folder_id: options.folderId,
|
|
16630
|
-
|
|
16648
|
+
limit: options.limit,
|
|
16649
|
+
page_token: options.pageToken,
|
|
16631
16650
|
sort_order: options.sortOrder,
|
|
16632
16651
|
},
|
|
16633
16652
|
});
|
|
@@ -16885,6 +16904,7 @@ function mapFolderContents(wire) {
|
|
|
16885
16904
|
breadcrumb: (wire.breadcrumb ?? []).map((item) => ({ id: item.folder_id, name: item.name })),
|
|
16886
16905
|
folders: (wire.folders ?? []).map(mapFolder),
|
|
16887
16906
|
ingots: (wire.ingots ?? []).map(mapIngot),
|
|
16907
|
+
nextPageToken: wire.next_page_token ?? null,
|
|
16888
16908
|
};
|
|
16889
16909
|
}
|
|
16890
16910
|
function mapIngotPage(response) {
|
|
@@ -16963,10 +16983,12 @@ class SparksModule {
|
|
|
16963
16983
|
};
|
|
16964
16984
|
}
|
|
16965
16985
|
/**
|
|
16966
|
-
* Create a spark.
|
|
16986
|
+
* Create a spark. A link spark (contentType text/uri-list, the payload its
|
|
16987
|
+
* destination URL) is created with its x.sv link, `linkUrl`.
|
|
16967
16988
|
*
|
|
16968
16989
|
* @example
|
|
16969
16990
|
* const spark = await sv.sparks.create({ payload: 'top secret', ttlMinutes: 60 });
|
|
16991
|
+
* const { linkUrl } = await sv.sparks.create({ payload: 'https://example.com', contentType: 'text/uri-list' });
|
|
16970
16992
|
*/
|
|
16971
16993
|
async create(options) {
|
|
16972
16994
|
if (typeof options.payload !== 'string' || options.payload.length === 0) {
|
|
@@ -16993,6 +17015,8 @@ class SparksModule {
|
|
|
16993
17015
|
ttlMinutes: data.ttl_minutes,
|
|
16994
17016
|
filename: data.filename,
|
|
16995
17017
|
kindling: data.kindling,
|
|
17018
|
+
linkUrl: data.link_url,
|
|
17019
|
+
linkCode: data.link_code,
|
|
16996
17020
|
};
|
|
16997
17021
|
}
|
|
16998
17022
|
/**
|
|
@@ -17021,6 +17045,27 @@ class SparksModule {
|
|
|
17021
17045
|
});
|
|
17022
17046
|
return mapShare(response.data);
|
|
17023
17047
|
}
|
|
17048
|
+
/**
|
|
17049
|
+
* Deliver an invite-only spark's link to its invitee again, changing
|
|
17050
|
+
* nothing about the link: the way on from an invitation that could not be
|
|
17051
|
+
* delivered (a share rejected with INVITATION_DELIVERY_FAILED leaves its
|
|
17052
|
+
* link in place, and the same share again delivers nothing), or one the
|
|
17053
|
+
* invitee never received.
|
|
17054
|
+
*
|
|
17055
|
+
* @example
|
|
17056
|
+
* const { identity } = await sv.sparks.resendInvite('spk_abc');
|
|
17057
|
+
*/
|
|
17058
|
+
async resendInvite(sparkId) {
|
|
17059
|
+
const id = requireResourceId(sparkId, 'sparkId');
|
|
17060
|
+
const response = await this.http.post(apiPath `/v1/sparks/${id}/share/resend`);
|
|
17061
|
+
const data = response.data;
|
|
17062
|
+
return {
|
|
17063
|
+
sparkId: data.spark_id,
|
|
17064
|
+
identity: data.identity,
|
|
17065
|
+
identityType: data.identity_type,
|
|
17066
|
+
sentAt: data.sent_at,
|
|
17067
|
+
};
|
|
17068
|
+
}
|
|
17024
17069
|
/**
|
|
17025
17070
|
* Get a spark's sharing status.
|
|
17026
17071
|
*
|
|
@@ -17056,6 +17101,7 @@ function mapSummary(wire) {
|
|
|
17056
17101
|
timeRemaining: wire.time_remaining ?? 0,
|
|
17057
17102
|
filename: wire.filename,
|
|
17058
17103
|
kindling: wire.kindling,
|
|
17104
|
+
linkUrl: wire.link_url,
|
|
17059
17105
|
};
|
|
17060
17106
|
}
|
|
17061
17107
|
function mapShare(wire) {
|
|
@@ -17067,6 +17113,7 @@ function mapShare(wire) {
|
|
|
17067
17113
|
invites: wire.invites,
|
|
17068
17114
|
expiresAt: wire.expires_at,
|
|
17069
17115
|
createdAt: wire.created_at,
|
|
17116
|
+
deliveredTo: wire.delivered_to,
|
|
17070
17117
|
};
|
|
17071
17118
|
}
|
|
17072
17119
|
|
|
@@ -17601,7 +17648,7 @@ class SparkVault {
|
|
|
17601
17648
|
}
|
|
17602
17649
|
/** Get the SDK version */
|
|
17603
17650
|
static get version() {
|
|
17604
|
-
return '
|
|
17651
|
+
return '12.0.1';
|
|
17605
17652
|
}
|
|
17606
17653
|
}
|
|
17607
17654
|
if (typeof window !== 'undefined') {
|