@sparkvault/sdk-js 11.3.1 → 12.0.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.
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
- /** Ingot sort field (name | size | content_type | created | access_count | bandwidth); `created` by default */
2469
- sortBy?: string;
2470
- /** Sort direction; `desc` by default */
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 whole listing, in one response: the folder itself, the trail
2475
- * from the vault root to it, its direct subfolders (pinned first) and every
2476
- * ingot directly in it, in the requested order.
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, or null at the vault root */
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
- /** Direct subfolders */
2514
+ /** This page's subfolders */
2488
2515
  folders: Folder[];
2489
- /** Every ingot directly in the folder */
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, whole: the folder, its breadcrumb trail,
2839
- * its direct subfolders and every ingot directly in it, in one response.
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
- * const { folders, ingots } = await sv.ingots.listContents(unsealed, { folderId: 'fld_x' });
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
- * List all folders in a vault (flat list — build the tree client-side).
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
- * const folders = await sv.folders.list(unsealed);
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<Folder[]>;
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
@@ -3606,4 +3650,4 @@ declare global {
3606
3650
  }
3607
3651
 
3608
3652
  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 };
3653
+ 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, 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
- * List all folders in a vault (flat list — build the tree client-side).
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
- * const folders = await sv.folders.list(unsealed);
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 (response.data.folders ?? []).map(mapFolder);
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, whole: the folder, its breadcrumb trail,
16619
- * its direct subfolders and every ingot directly in it, in one response.
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
- * const { folders, ingots } = await sv.ingots.listContents(unsealed, { folderId: 'fld_x' });
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
- sort_by: options.sortBy,
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) {
@@ -17601,7 +17621,7 @@ class SparkVault {
17601
17621
  }
17602
17622
  /** Get the SDK version */
17603
17623
  static get version() {
17604
- return '11.3.1';
17624
+ return '12.0.0';
17605
17625
  }
17606
17626
  }
17607
17627
  if (typeof window !== 'undefined') {