@sparkvault/sdk-js 12.0.0 → 12.0.2

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
@@ -2303,15 +2303,17 @@ interface Ingot {
2303
2303
  * kept as it is when the first word of the extension it shows (up to an
2304
2304
  * ASCII space, in any case) is one the MIME registry knows or holds a
2305
2305
  * character none of the registry's extensions is spelled with, which may
2306
- * draw as one, and otherwise completed with the first extension the
2307
- * registry lists for `contentType`, never one a saved copy must never open
2308
- * as. Save a copy under it, handed to a browser as
2309
- * `application/octet-stream` unless `contentType` is a raster image, audio,
2310
- * video or PDF format (never SVG, a playlist or a stream redirector): a
2311
- * browser renames a saved copy by the type it is handed (Chrome saves
2312
- * `Invoice` typed `application/x-msdownload` as `Invoice.exe`), and
2313
- * completes or replaces no extension of a copy handed as
2314
- * `application/octet-stream`.
2306
+ * draw as one, and otherwise completed with the extension `contentType`'s
2307
+ * files are named with (the first the registry lists for it, or, for the
2308
+ * few types whose first is not the one desktops name their files with, the
2309
+ * one they do: `.mp3` for `audio/mpeg`, `.mov` for `video/quicktime`), never
2310
+ * one a saved copy must never open as. Save a copy under it, handed to a
2311
+ * browser as `application/octet-stream` unless `contentType` is a raster
2312
+ * image, audio, video or PDF format (never SVG, a playlist or a stream
2313
+ * redirector): a browser renames a saved copy by the type it is handed
2314
+ * (Chrome saves `Invoice` typed `application/x-msdownload` as
2315
+ * `Invoice.exe`), and completes or replaces no extension of a copy handed
2316
+ * as `application/octet-stream`.
2315
2317
  */
2316
2318
  downloadFilename: string;
2317
2319
  /** Content type (MIME) */
@@ -3098,13 +3100,16 @@ interface SparkSummary {
3098
3100
  contentType: string;
3099
3101
  /** Size in bytes */
3100
3102
  size: number;
3101
- /** Lifecycle status (active | expired | ash) */
3103
+ /**
3104
+ * Lifecycle status: active, expired, ash (a recipient read it, and it
3105
+ * burned) or deleted (its owner deleted it, which burns its content too)
3106
+ */
3102
3107
  status: string;
3103
3108
  /** Creation timestamp (Unix seconds) */
3104
3109
  createdAt: number;
3105
3110
  /** Expiry timestamp (Unix seconds) */
3106
3111
  expiresAt: number;
3107
- /** Burn timestamp (Unix seconds), or null if not yet read */
3112
+ /** The read's burn timestamp (Unix seconds), or null if not read (a deleted spark's included) */
3108
3113
  burnedAt: number | null;
3109
3114
  /** Seconds remaining until expiry */
3110
3115
  timeRemaining: number;
@@ -3112,6 +3117,8 @@ interface SparkSummary {
3112
3117
  filename?: string;
3113
3118
  /** Optional kindling family ID */
3114
3119
  kindling?: string;
3120
+ /** A link spark (contentType text/uri-list) only: its x.sv link */
3121
+ linkUrl?: string;
3115
3122
  }
3116
3123
  /** The decrypted spark, returned by get (reading burns it). */
3117
3124
  interface Spark {
@@ -3136,9 +3143,12 @@ interface Spark {
3136
3143
  * with none, kept as it is when the first word of the extension it shows
3137
3144
  * (up to an ASCII space, in any case) is one the MIME registry knows or
3138
3145
  * holds a character none of the registry's extensions is spelled with,
3139
- * which may draw as one, and otherwise completed with the first extension
3140
- * the registry lists for `contentType`, never one a saved copy must never
3141
- * open as. Save a copy under it, handed to a browser as
3146
+ * which may draw as one, and otherwise completed with the extension
3147
+ * `contentType`'s files are named with (the first the registry lists for
3148
+ * it, or, for the few types whose first is not the one desktops name their
3149
+ * files with, the one they do: `.mp3` for `audio/mpeg`, `.mov` for
3150
+ * `video/quicktime`), never one a saved copy must never open as. Save a
3151
+ * copy under it, handed to a browser as
3142
3152
  * `application/octet-stream` unless `contentType` is a raster image, audio,
3143
3153
  * video or PDF format (never SVG, a playlist or a stream redirector): a
3144
3154
  * browser renames a saved copy by the type it is handed (Chrome saves
@@ -3166,6 +3176,13 @@ interface CreatedSpark {
3166
3176
  filename?: string;
3167
3177
  /** Optional kindling family ID (echoed when provided) */
3168
3178
  kindling?: string;
3179
+ /**
3180
+ * A link spark (contentType text/uri-list) only: its x.sv link, which opens
3181
+ * once and redirects to the payload's URL. It is minted with the spark.
3182
+ */
3183
+ linkUrl?: string;
3184
+ /** A link spark only: the code in linkUrl */
3185
+ linkCode?: string;
3169
3186
  }
3170
3187
  /** Options for list. */
3171
3188
  interface ListSparksOptions {
@@ -3230,6 +3247,23 @@ interface SparkShare {
3230
3247
  expiresAt?: number;
3231
3248
  /** Link creation timestamp (Unix seconds) */
3232
3249
  createdAt?: number;
3250
+ /**
3251
+ * The invitees this share delivered the link to (share only): none for a
3252
+ * share that invites no one new. An invitee already on the link is sent it
3253
+ * again by resendInvite.
3254
+ */
3255
+ deliveredTo?: string[];
3256
+ }
3257
+ /** An invitation delivered again, as resendInvite answers it. */
3258
+ interface SparkInviteResend {
3259
+ /** Spark ID */
3260
+ sparkId: string;
3261
+ /** The invitee the link was delivered to */
3262
+ identity: string;
3263
+ /** How it was delivered: by email or by SMS */
3264
+ identityType: 'email' | 'phone';
3265
+ /** Delivery timestamp (Unix seconds) */
3266
+ sentAt: number;
3233
3267
  }
3234
3268
 
3235
3269
  /**
@@ -3259,10 +3293,12 @@ declare class SparksModule {
3259
3293
  */
3260
3294
  get(sparkId: string): Promise<Spark>;
3261
3295
  /**
3262
- * Create a spark.
3296
+ * Create a spark. A link spark (contentType text/uri-list, the payload its
3297
+ * destination URL) is created with its x.sv link, `linkUrl`.
3263
3298
  *
3264
3299
  * @example
3265
3300
  * const spark = await sv.sparks.create({ payload: 'top secret', ttlMinutes: 60 });
3301
+ * const { linkUrl } = await sv.sparks.create({ payload: 'https://example.com', contentType: 'text/uri-list' });
3266
3302
  */
3267
3303
  create(options: CreateSparkOptions): Promise<CreatedSpark>;
3268
3304
  /**
@@ -3280,6 +3316,17 @@ declare class SparksModule {
3280
3316
  * console.log(share.shareUrl);
3281
3317
  */
3282
3318
  share(sparkId: string, options?: ShareSparkOptions): Promise<SparkShare>;
3319
+ /**
3320
+ * Deliver an invite-only spark's link to its invitee again, changing
3321
+ * nothing about the link: the way on from an invitation that could not be
3322
+ * delivered (a share rejected with INVITATION_DELIVERY_FAILED leaves its
3323
+ * link in place, and the same share again delivers nothing), or one the
3324
+ * invitee never received.
3325
+ *
3326
+ * @example
3327
+ * const { identity } = await sv.sparks.resendInvite('spk_abc');
3328
+ */
3329
+ resendInvite(sparkId: string): Promise<SparkInviteResend>;
3283
3330
  /**
3284
3331
  * Get a spark's sharing status.
3285
3332
  *
@@ -3650,4 +3697,4 @@ declare global {
3650
3697
  }
3651
3698
 
3652
3699
  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 };
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 };
3700
+ 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
@@ -16983,10 +16983,12 @@ class SparksModule {
16983
16983
  };
16984
16984
  }
16985
16985
  /**
16986
- * 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`.
16987
16988
  *
16988
16989
  * @example
16989
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' });
16990
16992
  */
16991
16993
  async create(options) {
16992
16994
  if (typeof options.payload !== 'string' || options.payload.length === 0) {
@@ -17013,6 +17015,8 @@ class SparksModule {
17013
17015
  ttlMinutes: data.ttl_minutes,
17014
17016
  filename: data.filename,
17015
17017
  kindling: data.kindling,
17018
+ linkUrl: data.link_url,
17019
+ linkCode: data.link_code,
17016
17020
  };
17017
17021
  }
17018
17022
  /**
@@ -17041,6 +17045,27 @@ class SparksModule {
17041
17045
  });
17042
17046
  return mapShare(response.data);
17043
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
+ }
17044
17069
  /**
17045
17070
  * Get a spark's sharing status.
17046
17071
  *
@@ -17076,6 +17101,7 @@ function mapSummary(wire) {
17076
17101
  timeRemaining: wire.time_remaining ?? 0,
17077
17102
  filename: wire.filename,
17078
17103
  kindling: wire.kindling,
17104
+ linkUrl: wire.link_url,
17079
17105
  };
17080
17106
  }
17081
17107
  function mapShare(wire) {
@@ -17087,6 +17113,7 @@ function mapShare(wire) {
17087
17113
  invites: wire.invites,
17088
17114
  expiresAt: wire.expires_at,
17089
17115
  createdAt: wire.created_at,
17116
+ deliveredTo: wire.delivered_to,
17090
17117
  };
17091
17118
  }
17092
17119
 
@@ -17621,7 +17648,7 @@ class SparkVault {
17621
17648
  }
17622
17649
  /** Get the SDK version */
17623
17650
  static get version() {
17624
- return '12.0.0';
17651
+ return '12.0.2';
17625
17652
  }
17626
17653
  }
17627
17654
  if (typeof window !== 'undefined') {