@sparkvault/sdk-js 14.2.0 → 14.2.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
@@ -800,8 +800,14 @@ interface UnsubscribeWebPushResponse {
800
800
  success: boolean;
801
801
  deleted: boolean;
802
802
  }
803
- /** Terminal outcomes of the end-to-end subscribeWebPush ceremony. */
804
- type SubscribeWebPushStatus = 'subscribed' | 'already_subscribed' | 'not_supported' | 'not_configured' | 'permission_denied';
803
+ /**
804
+ * Terminal outcomes of the end-to-end subscribeWebPush ceremony.
805
+ * `permission_denied`: notifications are blocked for the site (the person
806
+ * chose Block, now or before), so only the browser's site settings can allow
807
+ * them. `permission_dismissed`: the person closed the permission prompt
808
+ * without answering, so the site still asks and calling again prompts again.
809
+ */
810
+ type SubscribeWebPushStatus = 'subscribed' | 'already_subscribed' | 'not_supported' | 'not_configured' | 'permission_denied' | 'permission_dismissed';
805
811
  interface SubscribeWebPushOptions {
806
812
  /**
807
813
  * The caller's service-worker registration (the app owns the worker file and
@@ -1155,6 +1161,37 @@ type NotifyDestinationFailureReason = 'possibly_delivered' | 'attempts_exhausted
1155
1161
  * (`rejected_restricted_action`).
1156
1162
  */
1157
1163
  type NotifyDestinationReason = NotifyDestinationSkipReason | NotifyDestinationFailureReason | `status_${number}` | `rejected_${string}`;
1164
+ /**
1165
+ * Why a test post reached no answer that settles it, a fault a send's post
1166
+ * would be tried again on: the receiver could not be reached (`network`) or
1167
+ * did not answer in time (`timeout`), the Teams workflow's request could not
1168
+ * be sent at all (`unsent`), or too little of the post's time was left to
1169
+ * start it (`deadline_reached`).
1170
+ */
1171
+ type NotifyDestinationTransportReason = 'network' | 'timeout' | 'unsent' | 'deadline_reached';
1172
+ /**
1173
+ * The `reason` beside a test post's `skipped` or `failed`
1174
+ * (`testDestination`): a skip reason a send status reports, or, beside
1175
+ * `failed`, `possibly_delivered` (the post was sent and its answer was lost),
1176
+ * a transport fault, a status a retry can clear (`status_503`), or the Slack
1177
+ * app's own: Slack limited the call (`slack_rate_limited`), another worker was
1178
+ * renewing the app's token (`slack_token_refresh_in_progress`), Slack could
1179
+ * not be reached (`slack_unavailable`), or the installation could not be read
1180
+ * (`installation_unavailable`).
1181
+ */
1182
+ type NotifyDestinationTestReason = NotifyDestinationSkipReason | 'possibly_delivered' | NotifyDestinationTransportReason | 'slack_rate_limited' | 'slack_token_refresh_in_progress' | 'slack_unavailable' | 'installation_unavailable' | `status_${number}` | `rejected_${string}`;
1183
+ /**
1184
+ * What became of a test post to one of your destinations, in a send status's
1185
+ * words. A test post is made once and never tried again, so a fault a send's
1186
+ * post would retry reads `failed`. No send is stored and nothing is metered.
1187
+ */
1188
+ interface NotifyDestinationTestResult {
1189
+ kind: NotifyDestinationKind;
1190
+ /** `delivered` once the destination accepted it; `skipped` when nothing was posted; `failed` when no answer settled it. */
1191
+ state: 'delivered' | 'skipped' | 'failed';
1192
+ /** Null when delivered. */
1193
+ reason: NotifyDestinationTestReason | null;
1194
+ }
1158
1195
  /**
1159
1196
  * How a send's content reaches the recipient.
1160
1197
  * - `sealed` (default): content is sealed into a Spark behind a single-use
@@ -1210,6 +1247,9 @@ type NotifyPresetName = 'alert' | 'secureMessage' | 'conversation' | 'approval'
1210
1247
  * proves to open it. A bare string is an email address or one of those
1211
1248
  * SparkVault ids: a bare address is also the address its recipient proves,
1212
1249
  * while a bare id keys the person's inbox row and carries no address to verify.
1250
+ * An `id` that is an email address, with no `email` beside it, is that address:
1251
+ * `{ id: 'pat@example.com' }`, `'pat@example.com'` and
1252
+ * `{ email: 'pat@example.com' }` are one recipient, emailed and verified alike.
1213
1253
  *
1214
1254
  * The recipient's key is its `id`, else its `email`, trimmed, with an email
1215
1255
  * address lowercased the way Identity stores it: it names their row in your
@@ -1228,11 +1268,15 @@ type NotifyPresetName = 'alert' | 'secureMessage' | 'conversation' | 'approval'
1228
1268
  * bare number, `{ phone }`, or an `id` that is an E.164 number); on a sealed
1229
1269
  * send, one whose only handle is a phone (`{ id, phone }`); and, on a sealed
1230
1270
  * send at the default `identifier` level or at `passkey`, one with no address
1231
- * to verify (a bare id, or an `id` alone): give it `{ id, email }`, or send at
1232
- * `verificationLevel: 'none'`.
1271
+ * to verify (a bare id, or an `id` alone that is no email address): give it
1272
+ * `{ id, email }`, or send at `verificationLevel: 'none'`.
1233
1273
  */
1234
1274
  interface NotifyRecipientRef {
1235
- /** At most 256 bytes of UTF-8 with no control characters: it keys the recipient's inbox. */
1275
+ /**
1276
+ * At most 256 bytes of UTF-8 with no control characters: it keys the
1277
+ * recipient's inbox. One that is an email address, with no `email` beside
1278
+ * it, is also the address the recipient is emailed at and verified against.
1279
+ */
1236
1280
  id?: string;
1237
1281
  /**
1238
1282
  * The address the email channel delivers to. A recipient with no `id` is keyed
@@ -1249,6 +1293,11 @@ interface NotifyRecipientRef {
1249
1293
  type NotifyRecipient = string | NotifyRecipientRef;
1250
1294
  /** Content to seal into a fresh Spark, one per recipient. */
1251
1295
  interface NotifySendContent {
1296
+ /**
1297
+ * Sealed as written. A plaintext send's has its text-direction control
1298
+ * characters (U+202A to U+202E, U+2066 to U+2069) removed, so it shows in
1299
+ * the order it is written.
1300
+ */
1252
1301
  payload: string;
1253
1302
  /** Defaults to `text/plain`. A plaintext send accepts only `text/plain` or `text/html`. */
1254
1303
  contentType?: string;
@@ -1327,9 +1376,13 @@ interface CreateNotifySendOptions {
1327
1376
  * `idempotent: true`. Generated (`ntsnd_*`) when absent. A replay must repeat
1328
1377
  * what the recipient meets (the delivery mode, the content or ingot, the
1329
1378
  * recipients and their handles, title, category, instructions, policy,
1330
- * channels and escalation): one that differs in any of them is refused 400
1331
- * (`serviceCode` `VALIDATION_ERROR`), and the stored send stands. `type` and
1332
- * `historyTtlDays` are not compared: the stored send keeps its own.
1379
+ * channels, escalation and destinations): one that differs in any of them is
1380
+ * refused 400 (`serviceCode` `VALIDATION_ERROR`), and the stored send stands. `type` and
1381
+ * `historyTtlDays` are not compared: the stored send keeps its own. The send
1382
+ * stores the title, instructions and a plaintext payload without their
1383
+ * text-direction control characters (U+202A to U+202E, U+2066 to U+2069) and
1384
+ * compares a replay's the same way, so one that differs only by them is the
1385
+ * same send.
1333
1386
  */
1334
1387
  sendId?: string;
1335
1388
  /** 1-500 recipients. An ingot send accepts exactly one. */
@@ -1350,9 +1403,10 @@ interface CreateNotifySendOptions {
1350
1403
  channels?: Array<'in_app' | 'email' | 'push' | 'web_push'>;
1351
1404
  escalation?: NotifyEscalation;
1352
1405
  /**
1353
- * Channel-agnostic display title (rides the email subject). Cut to 200
1354
- * characters, never rejected for its length. A title that reads as SparkVault,
1355
- * or holds a text-direction control character, is refused 400 with
1406
+ * Channel-agnostic display title (rides the email subject). Its text-direction
1407
+ * control characters (U+202A to U+202E, U+2066 to U+2069) are removed, and it
1408
+ * is cut to 200 characters, never rejected for its length. A title that reads
1409
+ * as SparkVault is refused 400 with
1356
1410
  * `details: { field: 'title', reason: 'reserved_name' }`: the notification goes
1357
1411
  * out in your organization's name.
1358
1412
  */
@@ -1372,7 +1426,8 @@ interface CreateNotifySendOptions {
1372
1426
  */
1373
1427
  type?: string;
1374
1428
  /**
1375
- * NON-SECRET display text (≤500 chars) shown alongside a sealed send — e.g.
1429
+ * NON-SECRET display text (≤500 chars once its text-direction control
1430
+ * characters are removed) shown alongside a sealed send, such as
1376
1431
  * "verify with your passkey to open". It is never the sealed content.
1377
1432
  */
1378
1433
  instructions?: string;
@@ -1382,6 +1437,13 @@ interface CreateNotifySendOptions {
1382
1437
  * range is refused 400. A plaintext send is capped at 7.
1383
1438
  */
1384
1439
  historyTtlDays?: number;
1440
+ /**
1441
+ * `false` keeps this one send out of the organization's destinations (its
1442
+ * webhook, Slack channel and Teams workflow): none is posted to, and the
1443
+ * send's status reports `destinations: []`. Omitted or `true`, the send is
1444
+ * posted to every destination that routes its category.
1445
+ */
1446
+ destinations?: boolean;
1385
1447
  }
1386
1448
  /**
1387
1449
  * Options for a preset helper (`sendAlert`, `sendSecureMessage`, …): the one
@@ -1612,11 +1674,13 @@ interface NotifySendStatusRecipient {
1612
1674
  /**
1613
1675
  * For a `deferred` step, why it waits: the platform's per-second rate or
1614
1676
  * its hourly email lane, your account's hourly email share, the provider
1615
- * refusing for its rate, the provider's sending paused, or the platform's
1616
- * own mail domain the email goes out from not verified for sending. Null
1617
- * on every other outcome.
1677
+ * refusing for its rate, the provider's sending paused, the platform's
1678
+ * own mail domain the email goes out from not verified for sending, or
1679
+ * your organization's own sending domain not verified for sending (the
1680
+ * step waits while the domain is checked again). Null on every other
1681
+ * outcome.
1618
1682
  */
1619
- reason: 'platform_rate' | 'platform_hourly' | 'account_hourly' | 'provider_throttled' | 'sending_paused' | 'sender_identity_unverified' | null;
1683
+ reason: 'platform_rate' | 'platform_hourly' | 'account_hourly' | 'provider_throttled' | 'sending_paused' | 'sender_identity_unverified' | 'sending_domain_unverified' | null;
1620
1684
  }>>;
1621
1685
  /**
1622
1686
  * At least one channel accepted the notification for this recipient. A
@@ -1723,6 +1787,19 @@ interface NotifySendStatus {
1723
1787
  title: string | null;
1724
1788
  category: string | null;
1725
1789
  type: string | null;
1790
+ /**
1791
+ * How the send carries its message. Only a `sealed` send minted a link per
1792
+ * recipient, so only a sealed send can be recalled (`recallSend`); a
1793
+ * `plaintext` one delivered its body inline.
1794
+ */
1795
+ delivery: NotifyDeliveryMode;
1796
+ /**
1797
+ * Epoch seconds of a whole-audience recall; null when there was none. A
1798
+ * targeted recall of named recipients never sets it; a named recipient reads
1799
+ * `recalled` in their `state` unless their row records something recall does
1800
+ * not undo (one a channel already reached stays `delivered`).
1801
+ */
1802
+ recalled_at: number | null;
1726
1803
  recipients: NotifySendStatusRecipient[];
1727
1804
  counts: NotifySendStatusCounts;
1728
1805
  /**
@@ -2041,7 +2118,13 @@ interface NotifyConfigSecurity {
2041
2118
  * what it changes, but a `webhook_url` on another host or port than the
2042
2119
  * stored one needs a new `secret` in the same patch (400 `VALIDATION_ERROR`
2043
2120
  * naming `events.secret`, `details.missing: ['secret']`): a secret never
2044
- * follows its URL to a different host.
2121
+ * follows its URL to a different host. A patch of `events: null` removes the
2122
+ * webhook, URL and secret together, and no event is sent from then on; a
2123
+ * `null` for either field alone is refused 400.
2124
+ *
2125
+ * Each event is POSTed as JSON with a `User-Agent` that begins `SparkVault/`,
2126
+ * so an edge in front of the receiver that refuses a request without one lets
2127
+ * it through.
2045
2128
  *
2046
2129
  * Delivery is BEST EFFORT — one retry, then the event is dropped. Polling
2047
2130
  * (`listSends`, `getSendStatus`, `listReceipts`) remains the source of truth;
@@ -2073,7 +2156,8 @@ interface NotifyConfigEventsRead {
2073
2156
  /**
2074
2157
  * Your own HTTPS endpoint as a destination. Each routed send is POSTed to `url`
2075
2158
  * once as JSON, signed like the event webhook (the hex HMAC-SHA256 of the raw
2076
- * body under `secret`, in `X-SparkVault-Signature`); a post that may not have
2159
+ * body under `secret`, in `X-SparkVault-Signature`) and, like it, with a
2160
+ * `User-Agent` that begins `SparkVault/`; a post that may not have
2077
2161
  * landed is tried again with the same `delivery_id`, so drop a repeat you
2078
2162
  * already received. A redirect is never followed.
2079
2163
  */
@@ -2199,8 +2283,8 @@ interface NotifyConfigPatch {
2199
2283
  history?: NotifyConfigHistory;
2200
2284
  /** Admin only. */
2201
2285
  security?: NotifyConfigSecurity;
2202
- /** Admin only. */
2203
- events?: NotifyConfigEvents;
2286
+ /** Admin only. `null` removes the event webhook. */
2287
+ events?: NotifyConfigEvents | null;
2204
2288
  /**
2205
2289
  * Admin only. `sending_domain`: one of the organization's own domains, its
2206
2290
  * ownership verified and its email sending ready, to send from as
@@ -2303,7 +2387,9 @@ declare class NotifyProductModule {
2303
2387
  * someone goes out from your organization's own sender (`getEmailSender`) and
2304
2388
  * is admitted against your hourly share of sending capacity. Each refusal is
2305
2389
  * a thrown `SparkVaultError` whose `serviceCode` names it, made before
2306
- * anything is sealed, charged or stored:
2390
+ * anything is sealed, charged or stored; a send that fails while it seals
2391
+ * gives its admitted recipients back, so its retry is admitted in the same
2392
+ * hour:
2307
2393
  *
2308
2394
  * | Status | `serviceCode` | `details` | Next |
2309
2395
  * | --- | --- | --- | --- |
@@ -2559,7 +2645,8 @@ declare class NotifyProductModule {
2559
2645
  * `events.webhook_url_host` and `events.secret_set`, never the values. A
2560
2646
  * `webhook_url` on another host or port needs a new `secret` in the same
2561
2647
  * patch (400 `VALIDATION_ERROR` naming `events.secret`), so a secret never
2562
- * follows its URL to a different host.
2648
+ * follows its URL to a different host. `events: null` removes the webhook,
2649
+ * URL and secret together.
2563
2650
  *
2564
2651
  * The `email` section selects a domain of your own for your Notify email to go
2565
2652
  * out from. `security`, `events` and `email` are an org admin's to change: a
@@ -2582,6 +2669,30 @@ declare class NotifyProductModule {
2582
2669
  * });
2583
2670
  */
2584
2671
  updateConfig(patch: NotifyConfigPatch): Promise<NotifyConfigResponse>;
2672
+ /**
2673
+ * Post one test message to your destination of `kind` (a webhook, a Slack
2674
+ * channel or a Teams workflow) and learn what became of it, without a send:
2675
+ * nothing reaches a recipient, no send is stored and nothing is metered, and
2676
+ * the test never appears in send history. The post shows the title "Test
2677
+ * post from SparkVault Notify" under your organization's name, through the
2678
+ * sender a send's post takes. A webhook receives a body signed like any
2679
+ * other, typed `notify.destination.test`, naming no send, with a
2680
+ * `delivery_id` of its own. The post is made once and never tried again,
2681
+ * so a fault a send's post would retry reads `failed`.
2682
+ *
2683
+ * An org admin's call, on an account that holds Notify: anyone else is
2684
+ * refused 403 `FORBIDDEN` (`details: { sections: ['destinations'],
2685
+ * required_role: 'admin' }`), an account without Notify 403
2686
+ * `NOTIFY_SUBSCRIPTION_REQUIRED`. A kind with no destination saved is 404
2687
+ * `NOT_FOUND`, an organization name a send would be refused under is 409
2688
+ * (`NOTIFY_SENDER_NAME_REQUIRED` or `NOTIFY_SENDER_NAME_RESERVED`), and each
2689
+ * kind takes 20 tests an hour (429 `RATE_LIMIT_EXCEEDED`).
2690
+ *
2691
+ * @example
2692
+ * const { state, reason } = await sv.products.notify.testDestination('webhook');
2693
+ * if (state !== 'delivered') console.warn(`Test post ${state}: ${reason}`);
2694
+ */
2695
+ testDestination(kind: NotifyDestinationKind): Promise<NotifyDestinationTestResult>;
2585
2696
  /**
2586
2697
  * Who your organization's Notify email is from, as the API answers it
2587
2698
  * (verbatim snake_case): `"{organization name}" <from_address>`, with a
@@ -4942,9 +5053,12 @@ declare class NotifyModule {
4942
5053
  * End-to-end enable ceremony: feature-detect, fetch the VAPID key, ensure
4943
5054
  * Notification permission, subscribe via the caller's service worker, and
4944
5055
  * register the subscription with the server. Returns a typed status instead
4945
- * of throwing on the expected declines (unsupported / not configured /
4946
- * permission denied) so a host can branch on the outcome. Call it from a user
4947
- * gesture (permission prompts require one).
5056
+ * of throwing on the expected declines so a host can branch on the outcome:
5057
+ * unsupported, not configured, `permission_denied` (the person blocked
5058
+ * notifications for the site, now or before, so only the browser's site
5059
+ * settings can allow them) and `permission_dismissed` (the person closed the
5060
+ * prompt without answering: the site still asks, so enabling again shows the
5061
+ * prompt again). Call it from a user gesture (permission prompts require one).
4948
5062
  *
4949
5063
  * A subscription the browser holds for the current key is kept
4950
5064
  * (`already_subscribed`); one made for a previous key can never deliver
@@ -5097,4 +5211,4 @@ declare global {
5097
5211
  }
5098
5212
 
5099
5213
  export { AuthenticationError, AuthorizationError, EntropyModule, FoldersModule, HelpDeskClient, HelpDeskModule, IdentityModule, IdentityProviderError, IngotsModule, NAME_CONFLICT_POLICIES, NOTIFY_PRESETS, NetworkError, NotifyModule, NotifyProductModule, NotifySubscriptionRequiredError, PlanRequiredError, PopupBlockedError, ProductsModule, QuotaExceededError, SparkVault, SparkVaultError, SparksModule, TimeoutError, UnauthorizedError, UserCancelledError, ValidationError, VaultsModule, buildNotifyPresetSend, SparkVault as default, fetchDownload, isReceivedUploadFailure, logger, setDebugMode };
5100
- export type { AccessLogRetention, AccessLogsOptions, CreateFolderOptions, CreateNotifySendOptions, CreateSparkOptions, CreateUploadOptions, CreateVaultOptions, CreatedIngot, CreatedSpark, DownloadIngotOptions, EntropyFormat, EntropyResult, FetchDownloadOptions, FetchedDownload, Folder, FolderBreadcrumbItem, FolderContents, FolderPage, GenerateEntropyOptions, HealthCheckOptions, HealthCheckResult, HelpDeskAttachmentDownload, HelpDeskAttachmentInput, HelpDeskAttachmentUpload, HelpDeskConnectOptions, HelpDeskCreateTicketOptions, HelpDeskCustomer, HelpDeskCustomerPatch, HelpDeskDesk, HelpDeskDraft, HelpDeskEvent, HelpDeskExternalChallenge, HelpDeskExternalIdentity, HelpDeskFormHandle, HelpDeskFormOptions, HelpDeskFormState, HelpDeskIdentityRequest, HelpDeskListTicketsOptions, HelpDeskMountFormOptions, HelpDeskOpenFormOptions, HelpDeskPinChallenge, HelpDeskReplyCreated, HelpDeskReplyOptions, HelpDeskRequestContext, HelpDeskSession, HelpDeskSessionChange, HelpDeskTicket, HelpDeskTicketCreated, HelpDeskTicketDetail, HelpDeskTicketList, HelpDeskTimeline, HelpDeskVerifyPinOptions, AttachOptions as IdentityAttachOptions, Ingot, IngotAccessLog, IngotAccessLogPage, IngotDownloadLink, IngotInvitation, 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, NotificationSender, NotifyCategory, NotifyChannel, NotifyConfig, NotifyConfigCategory, NotifyConfigDelivery, NotifyConfigDeliveryPatch, NotifyConfigDestinations, NotifyConfigDestinationsPatch, NotifyConfigEvents, NotifyConfigEventsRead, NotifyConfigHistory, NotifyConfigOverrides, NotifyConfigPatch, NotifyConfigRealtimeFallbackDelay, NotifyConfigReliability, NotifyConfigResponse, NotifyConfigSecurity, NotifyDeliveryMode, NotifyDestinationFailureReason, NotifyDestinationKind, NotifyDestinationReason, NotifyDestinationSkipReason, NotifyDestinationState, NotifyEscalation, NotifyInboxBulkMarkState, NotifyInboxMarkState, NotifyInboxRow, NotifyInboxView, NotifyIngotRef, NotifyInteraction, NotifyPreset, NotifyPresetCategory, NotifyPresetName, NotifyPresetSendOptions, NotifyRecallMode, NotifyReceipt, NotifyReceiptEventType, NotifyRecipient, NotifyRecipientRef, NotifyRecipientState, NotifyReportableVerificationLevel, NotifySendContent, NotifySendPolicy, NotifySendReceipt, NotifySendReceiptsResponse, NotifySendResult, NotifySendState, NotifySendStatus, NotifySendStatusCounts, NotifySendStatusDestination, NotifySendStatusRecipient, NotifySendSummary, NotifySendSummaryDestination, NotifySlackDestination, NotifySuppressionReason, NotifyTeamsDestination, NotifyTeamsDestinationRead, NotifyVerificationLevel, NotifyWebhookDestination, NotifyWebhookDestinationRead, QuotaResource, RecallNotifySendOptions, RecallNotifySendResponse, RegisterWebPushResponse, ReplaceIngotOptions, ResumeUploadOptions, ScheduledVaultDeletion, SearchIngotsOptions, SendUploadOptions, ShareSparkOptions, SignInOptions, SignInResult, Spark, SparkInviteResend, SparkPage, SparkShare, SparkSummary, SparkVaultConfig, SparkVisibility, StartedVaultDeletion, SubscribeWebPushOptions, SubscribeWebPushResult, SubscribeWebPushStatus, TokenClaims, UnreachedAdmin, UnreadCountResponse, UnsealVaultOptions, UnsealedVault, UnsubscribeWebPushResponse, UpdateFolderOptions, UpdateIngotSharingOptions, UpdateVaultUploadOptions, UpdatedVault, UploadAttachOptions, UploadBranding, UploadEnd, UploadIngotOptions, UploadOptions, UploadProgress, UploadResult, UploadSession, Vault, VaultDetail, VaultLifecycle, VaultResealDefaults, VaultResealSettings, VaultResealSettingsResult, VaultSessionExtension, VaultSessionTiming, VaultSharingConfig, VaultSharingOptions, VaultSummary, VaultUploadConfig, VaultUploadSettings, VerifyOptions, VerifyResult, WebPushKeyResponse, WebPushStatus, WebPushStatusOptions, WebPushStatusResult, WebPushSubscriptionInput };
5214
+ export type { AccessLogRetention, AccessLogsOptions, CreateFolderOptions, CreateNotifySendOptions, CreateSparkOptions, CreateUploadOptions, CreateVaultOptions, CreatedIngot, CreatedSpark, DownloadIngotOptions, EntropyFormat, EntropyResult, FetchDownloadOptions, FetchedDownload, Folder, FolderBreadcrumbItem, FolderContents, FolderPage, GenerateEntropyOptions, HealthCheckOptions, HealthCheckResult, HelpDeskAttachmentDownload, HelpDeskAttachmentInput, HelpDeskAttachmentUpload, HelpDeskConnectOptions, HelpDeskCreateTicketOptions, HelpDeskCustomer, HelpDeskCustomerPatch, HelpDeskDesk, HelpDeskDraft, HelpDeskEvent, HelpDeskExternalChallenge, HelpDeskExternalIdentity, HelpDeskFormHandle, HelpDeskFormOptions, HelpDeskFormState, HelpDeskIdentityRequest, HelpDeskListTicketsOptions, HelpDeskMountFormOptions, HelpDeskOpenFormOptions, HelpDeskPinChallenge, HelpDeskReplyCreated, HelpDeskReplyOptions, HelpDeskRequestContext, HelpDeskSession, HelpDeskSessionChange, HelpDeskTicket, HelpDeskTicketCreated, HelpDeskTicketDetail, HelpDeskTicketList, HelpDeskTimeline, HelpDeskVerifyPinOptions, AttachOptions as IdentityAttachOptions, Ingot, IngotAccessLog, IngotAccessLogPage, IngotDownloadLink, IngotInvitation, 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, NotificationSender, NotifyCategory, NotifyChannel, NotifyConfig, NotifyConfigCategory, NotifyConfigDelivery, NotifyConfigDeliveryPatch, NotifyConfigDestinations, NotifyConfigDestinationsPatch, NotifyConfigEvents, NotifyConfigEventsRead, NotifyConfigHistory, NotifyConfigOverrides, NotifyConfigPatch, NotifyConfigRealtimeFallbackDelay, NotifyConfigReliability, NotifyConfigResponse, NotifyConfigSecurity, NotifyDeliveryMode, NotifyDestinationFailureReason, NotifyDestinationKind, NotifyDestinationReason, NotifyDestinationSkipReason, NotifyDestinationState, NotifyDestinationTestReason, NotifyDestinationTestResult, NotifyDestinationTransportReason, NotifyEscalation, NotifyInboxBulkMarkState, NotifyInboxMarkState, NotifyInboxRow, NotifyInboxView, NotifyIngotRef, NotifyInteraction, NotifyPreset, NotifyPresetCategory, NotifyPresetName, NotifyPresetSendOptions, NotifyRecallMode, NotifyReceipt, NotifyReceiptEventType, NotifyRecipient, NotifyRecipientRef, NotifyRecipientState, NotifyReportableVerificationLevel, NotifySendContent, NotifySendPolicy, NotifySendReceipt, NotifySendReceiptsResponse, NotifySendResult, NotifySendState, NotifySendStatus, NotifySendStatusCounts, NotifySendStatusDestination, NotifySendStatusRecipient, NotifySendSummary, NotifySendSummaryDestination, NotifySlackDestination, NotifySuppressionReason, NotifyTeamsDestination, NotifyTeamsDestinationRead, NotifyVerificationLevel, NotifyWebhookDestination, NotifyWebhookDestinationRead, QuotaResource, RecallNotifySendOptions, RecallNotifySendResponse, RegisterWebPushResponse, ReplaceIngotOptions, ResumeUploadOptions, ScheduledVaultDeletion, SearchIngotsOptions, SendUploadOptions, ShareSparkOptions, SignInOptions, SignInResult, Spark, SparkInviteResend, SparkPage, SparkShare, SparkSummary, SparkVaultConfig, SparkVisibility, StartedVaultDeletion, SubscribeWebPushOptions, SubscribeWebPushResult, SubscribeWebPushStatus, TokenClaims, UnreachedAdmin, UnreadCountResponse, UnsealVaultOptions, UnsealedVault, UnsubscribeWebPushResponse, UpdateFolderOptions, UpdateIngotSharingOptions, UpdateVaultUploadOptions, UpdatedVault, UploadAttachOptions, UploadBranding, UploadEnd, UploadIngotOptions, UploadOptions, UploadProgress, UploadResult, UploadSession, Vault, VaultDetail, VaultLifecycle, VaultResealDefaults, VaultResealSettings, VaultResealSettingsResult, VaultSessionExtension, VaultSessionTiming, VaultSharingConfig, VaultSharingOptions, VaultSummary, VaultUploadConfig, VaultUploadSettings, VerifyOptions, VerifyResult, WebPushKeyResponse, WebPushStatus, WebPushStatusOptions, WebPushStatusResult, WebPushSubscriptionInput };
package/dist/index.mjs CHANGED
@@ -11344,6 +11344,16 @@ class IdentityModule {
11344
11344
  const NOTIFY_SEND_ID_PATTERN = /^[A-Za-z0-9_.:-]+$/;
11345
11345
  const NOTIFY_SEND_ID_MAX_LENGTH = 128;
11346
11346
 
11347
+ /**
11348
+ * The kinds of send-level destination an organization's Notify config names,
11349
+ * at most one of each (`destinations.<kind>`), in the one order every reader
11350
+ * lists them in: a send's `destinations`, its status and its history summary.
11351
+ * A destination receives one post per accepted send whose category it routes,
11352
+ * never one per recipient; it never routes `security`, a person's own notices,
11353
+ * and it is never metered.
11354
+ */
11355
+ const NOTIFY_DESTINATION_KINDS = Object.freeze(['webhook', 'slack', 'teams']);
11356
+
11347
11357
  /**
11348
11358
  * The Notify category a help desk's alerts to its own staff are classified
11349
11359
  * as: a new request in a team's queue, a customer's message, an assignment, a
@@ -11588,7 +11598,9 @@ class NotifyProductModule {
11588
11598
  * someone goes out from your organization's own sender (`getEmailSender`) and
11589
11599
  * is admitted against your hourly share of sending capacity. Each refusal is
11590
11600
  * a thrown `SparkVaultError` whose `serviceCode` names it, made before
11591
- * anything is sealed, charged or stored:
11601
+ * anything is sealed, charged or stored; a send that fails while it seals
11602
+ * gives its admitted recipients back, so its retry is admitted in the same
11603
+ * hour:
11592
11604
  *
11593
11605
  * | Status | `serviceCode` | `details` | Next |
11594
11606
  * | --- | --- | --- | --- |
@@ -11954,7 +11966,8 @@ class NotifyProductModule {
11954
11966
  * `events.webhook_url_host` and `events.secret_set`, never the values. A
11955
11967
  * `webhook_url` on another host or port needs a new `secret` in the same
11956
11968
  * patch (400 `VALIDATION_ERROR` naming `events.secret`), so a secret never
11957
- * follows its URL to a different host.
11969
+ * follows its URL to a different host. `events: null` removes the webhook,
11970
+ * URL and secret together.
11958
11971
  *
11959
11972
  * The `email` section selects a domain of your own for your Notify email to go
11960
11973
  * out from. `security`, `events` and `email` are an org admin's to change: a
@@ -11983,6 +11996,36 @@ class NotifyProductModule {
11983
11996
  const response = await this.http.put(apiPath `/v1/products/notify/config`, patch);
11984
11997
  return response.data;
11985
11998
  }
11999
+ /**
12000
+ * Post one test message to your destination of `kind` (a webhook, a Slack
12001
+ * channel or a Teams workflow) and learn what became of it, without a send:
12002
+ * nothing reaches a recipient, no send is stored and nothing is metered, and
12003
+ * the test never appears in send history. The post shows the title "Test
12004
+ * post from SparkVault Notify" under your organization's name, through the
12005
+ * sender a send's post takes. A webhook receives a body signed like any
12006
+ * other, typed `notify.destination.test`, naming no send, with a
12007
+ * `delivery_id` of its own. The post is made once and never tried again,
12008
+ * so a fault a send's post would retry reads `failed`.
12009
+ *
12010
+ * An org admin's call, on an account that holds Notify: anyone else is
12011
+ * refused 403 `FORBIDDEN` (`details: { sections: ['destinations'],
12012
+ * required_role: 'admin' }`), an account without Notify 403
12013
+ * `NOTIFY_SUBSCRIPTION_REQUIRED`. A kind with no destination saved is 404
12014
+ * `NOT_FOUND`, an organization name a send would be refused under is 409
12015
+ * (`NOTIFY_SENDER_NAME_REQUIRED` or `NOTIFY_SENDER_NAME_RESERVED`), and each
12016
+ * kind takes 20 tests an hour (429 `RATE_LIMIT_EXCEEDED`).
12017
+ *
12018
+ * @example
12019
+ * const { state, reason } = await sv.products.notify.testDestination('webhook');
12020
+ * if (state !== 'delivered') console.warn(`Test post ${state}: ${reason}`);
12021
+ */
12022
+ async testDestination(kind) {
12023
+ if (!NOTIFY_DESTINATION_KINDS.includes(kind)) {
12024
+ throw new ValidationError(`kind must be one of ${NOTIFY_DESTINATION_KINDS.join(', ')}`);
12025
+ }
12026
+ const response = await this.http.post(apiPath `/v1/products/notify/destinations/${kind}/test`);
12027
+ return response.data;
12028
+ }
11986
12029
  /**
11987
12030
  * Who your organization's Notify email is from, as the API answers it
11988
12031
  * (verbatim snake_case): `"{organization name}" <from_address>`, with a
@@ -12048,6 +12091,7 @@ function toSendBody(options) {
12048
12091
  type: options.type,
12049
12092
  instructions: options.instructions,
12050
12093
  history_ttl_days: options.historyTtlDays,
12094
+ destinations: options.destinations,
12051
12095
  };
12052
12096
  }
12053
12097
  function requireRecipientId(recipientId) {
@@ -16492,14 +16536,17 @@ const BRACKET_PAIRS =
16492
16536
  * right-to-left letter or mark, or an Arabic digit, between Latin words
16493
16537
  * reverses their order: "Vault", U+05BE HEBREW PUNCTUATION MAQAF, "Spark" is
16494
16538
  * laid out in a right-to-left paragraph as "Spark", the maqaf, "Vault".
16495
- * An explicit direction control (holdsDirectionControl) sets the direction of
16496
- * the text after it beyond what this lays out, so a caller that judges what a
16497
- * reader sees refuses it as well, as isReservedDisplayText, for any text an
16498
- * organization shows under its name, and isReservedOrganizationName do. Both
16499
- * also judge a text at every cut of it as stored, each cut read in this way,
16500
- * since the platform shows a text cut to fit.
16539
+ * An explicit direction control (holdsDirectionControl, ./display-text.js)
16540
+ * sets the direction of the text after it beyond what this lays out, so a
16541
+ * caller that judges what a reader sees refuses it as well, as
16542
+ * isReservedDisplayText, for any text an organization shows under its name,
16543
+ * and isReservedOrganizationName do. Both also judge a text at every cut of it
16544
+ * as stored, each cut read in this way, since the platform shows a text cut to
16545
+ * fit. The implicit marks are no such control: each is a strong character of
16546
+ * its direction, laid out as a letter of that direction is.
16501
16547
  *
16502
- * BROWSER-SAFE: imports only ./organization-name-unicode.js, and needs
16548
+ * BROWSER-SAFE: imports only ./display-text.js and
16549
+ * ./organization-name-unicode.js, neither of which imports anything, and needs
16503
16550
  * String.prototype.isWellFormed and toWellFormed (ES2024: Chrome 111,
16504
16551
  * Firefox 119, Safari 16.4).
16505
16552
  */
@@ -21241,9 +21288,12 @@ class NotifyModule {
21241
21288
  * End-to-end enable ceremony: feature-detect, fetch the VAPID key, ensure
21242
21289
  * Notification permission, subscribe via the caller's service worker, and
21243
21290
  * register the subscription with the server. Returns a typed status instead
21244
- * of throwing on the expected declines (unsupported / not configured /
21245
- * permission denied) so a host can branch on the outcome. Call it from a user
21246
- * gesture (permission prompts require one).
21291
+ * of throwing on the expected declines so a host can branch on the outcome:
21292
+ * unsupported, not configured, `permission_denied` (the person blocked
21293
+ * notifications for the site, now or before, so only the browser's site
21294
+ * settings can allow them) and `permission_dismissed` (the person closed the
21295
+ * prompt without answering: the site still asks, so enabling again shows the
21296
+ * prompt again). Call it from a user gesture (permission prompts require one).
21247
21297
  *
21248
21298
  * A subscription the browser holds for the current key is kept
21249
21299
  * (`already_subscribed`); one made for a previous key can never deliver
@@ -21274,6 +21324,9 @@ class NotifyModule {
21274
21324
  }
21275
21325
  if (Notification.permission === 'default') {
21276
21326
  const permission = await Notification.requestPermission();
21327
+ if (permission === 'default') {
21328
+ return { status: 'permission_dismissed' };
21329
+ }
21277
21330
  if (permission !== 'granted') {
21278
21331
  return { status: 'permission_denied' };
21279
21332
  }
@@ -21464,7 +21517,7 @@ class SparkVault {
21464
21517
  }
21465
21518
  /** Get the SDK version */
21466
21519
  static get version() {
21467
- return '14.2.0';
21520
+ return '14.2.2';
21468
21521
  }
21469
21522
  }
21470
21523
  if (typeof window !== 'undefined') {