@sparkvault/sdk-js 13.3.0 → 14.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
@@ -604,10 +604,12 @@ declare class IdentityModule {
604
604
  /**
605
605
  * Notify Module Types
606
606
  *
607
- * SparkVault's first-party inbox: the notifications SparkVault itself delivered
608
- * `in_app` to a signed-in SparkVault user. Unlike Entropy/Sparks, notification
607
+ * A signed-in SparkVault user's own feed: the notifications SparkVault itself
608
+ * delivered `in_app` to them and those their own organization's Notify did, as
609
+ * one feed, each row saying which (`from`). Unlike Entropy/Sparks, notification
609
610
  * ROWS are NOT remapped to camelCase: their fields mirror the wire, and a tenant's
610
- * sender-side feed (`sv.products.notify.getInbox`) returns the same row. A row carries
611
+ * sender-side feed (`sv.products.notify.getInbox`) returns the same row without
612
+ * `from`, since it reads one sending account's inbox. A row carries
611
613
  * its cleartext part (`title`, and for a cleartext send a short `body`) natively;
612
614
  * a SECURE send's content is never carried here — it lives behind the SparkLink
613
615
  * `sparklink_code`. Keeping the wire shape verbatim is the single source of truth
@@ -620,13 +622,27 @@ type NotificationInboxState = 'all' | 'unseen' | 'unread' | 'archived';
620
622
  /** Terminal display states the recipient can apply to one of their rows. */
621
623
  type NotificationMarkState = 'seen' | 'read' | 'archived';
622
624
  /**
623
- * An inbox row in the two-part notification model. The `title` (and, for a
624
- * cleartext send, the short `body`) is the NON-sensitive cleartext part, shown
625
- * natively. A SECURE send's content lives behind the SparkLink (`sparklink_code`)
626
- * and is never carried here — open the pointer to reveal it. Timestamps are epoch
627
- * SECONDS.
625
+ * Who a row of the person's own feed is from: SparkVault itself, or their own
626
+ * organization by its name. `name` is null when the organization has no name the
627
+ * feed can show (none, or one that reads as SparkVault's): label such a row
628
+ * generically, never as SparkVault's.
628
629
  */
629
- interface NotificationRow {
630
+ type NotificationSender = {
631
+ type: 'sparkvault';
632
+ } | {
633
+ type: 'organization';
634
+ name: string | null;
635
+ };
636
+ /**
637
+ * An inbox row in the two-part notification model, as one sending account's
638
+ * inbox read (`sv.products.notify.getInbox`) returns it: no `from`, since the
639
+ * sender reading its own inbox is who sent every row in it. The `title` (and,
640
+ * for a cleartext send, the short `body`) is the NON-sensitive cleartext part,
641
+ * shown natively. A SECURE send's content lives behind the SparkLink
642
+ * (`sparklink_code`) and is never carried here — open the pointer to reveal it.
643
+ * Timestamps are epoch SECONDS.
644
+ */
645
+ interface NotifyInboxRow {
630
646
  notification_id: string;
631
647
  send_id: string;
632
648
  created_at: number;
@@ -673,6 +689,13 @@ interface NotificationRow {
673
689
  */
674
690
  recalled: boolean;
675
691
  }
692
+ /**
693
+ * A row of the person's own feed: an inbox row, and who sent it. Show `from` on
694
+ * every row: an organization's title alone could read as SparkVault's own.
695
+ */
696
+ interface NotificationRow extends NotifyInboxRow {
697
+ from: NotificationSender;
698
+ }
676
699
  interface ListNotificationsOptions {
677
700
  state?: NotificationInboxState;
678
701
  /** Page size, 1-100 (server default 50). */
@@ -1013,17 +1036,68 @@ interface UpdateVaultUploadOptions {
1013
1036
  /**
1014
1037
  * Every transport the dispatch seam can carry a notification on: what a send's
1015
1038
  * status, a stored ladder and a config read can name. An organization's own
1016
- * send, and its config's ladders, may name only two of them:
1039
+ * send, and its config's ladders, may name four of them:
1017
1040
  *
1018
1041
  * | Channel | An organization's send |
1019
1042
  * | --- | --- |
1020
1043
  * | `in_app` | Delivered by the notification's row in your Notify inbox, which your app reads through `getInbox`: the inbox lists a recipient's row when their `in_app` step runs, at once when it leads the ladder and only when that step comes due when it follows `email` (a stop that ends the ladder first, such as an unsubscribe on a non-critical send or a recall, leaves it unlisted), so a send naming `email` alone lists nothing there, and neither does one to a recipient who switched In-app off for your site on auth.sv (any send but a `security` one, which crosses that switch) |
1021
1044
  * | `email` | Goes out from your organization's own sender (`getEmailSender`) |
1045
+ * | `push`, `web_push` | Reach the devices an active member of your organization, addressed by their SparkVault user id (`usr_*`), registered with SparkVault (its phone app and browser push), titled with your organization's name first; dropped from the ladder of a recipient with none |
1022
1046
  * | `sms`, `voice`, `whatsapp`, `rcs` | Refused 403 `NOTIFY_CHANNEL_NOT_AVAILABLE`: Notify delivers no text, call or chat message |
1023
- * | `push`, `web_push` | Refused 403 `NOTIFY_CHANNEL_NOT_AVAILABLE`: SparkVault's own devices only |
1024
- * | `webhook`, `slack`, `teams` | Refused 403 `NOTIFY_CHANNEL_NOT_AVAILABLE`: SparkVault's own destinations only |
1047
+ *
1048
+ * A send's posts to your organization's own webhook, Slack channel or Teams
1049
+ * workflow are no channel: they are its destinations (`NotifyConfig['destinations']`).
1050
+ */
1051
+ type NotifyChannel = 'in_app' | 'email' | 'sms' | 'push' | 'web_push' | 'voice' | 'whatsapp' | 'rcs';
1052
+ /**
1053
+ * The kinds of send-level destination your organization's Notify config names,
1054
+ * at most one of each, in the order every reader lists them: a webhook of your
1055
+ * own, a Slack channel (through your organization's SparkVault Slack app) and a
1056
+ * Microsoft Teams workflow. Each receives one post of every send whose category
1057
+ * it lists, never one per recipient, and never a `security` send.
1025
1058
  */
1026
- type NotifyChannel = 'in_app' | 'email' | 'sms' | 'push' | 'web_push' | 'voice' | 'whatsapp' | 'rcs' | 'webhook' | 'slack' | 'teams';
1059
+ type NotifyDestinationKind = 'webhook' | 'slack' | 'teams';
1060
+ /**
1061
+ * One of a send's destinations, as its status and its history summary report it.
1062
+ *
1063
+ * - `pending` — the post has not settled yet (it is queued, or waits to be tried again).
1064
+ * - `delivered` — the destination accepted the post.
1065
+ * - `skipped` — nothing was posted, and trying again would not post it.
1066
+ * - `failed` — the post was given up on.
1067
+ * - `recalled` — the whole send was recalled before the post settled.
1068
+ * - `unknown` — the send's delivery record is gone (past its history horizon).
1069
+ */
1070
+ type NotifyDestinationState = 'pending' | 'delivered' | 'skipped' | 'failed' | 'recalled' | 'unknown';
1071
+ /**
1072
+ * Why a destination's post was skipped: the sending account was suspended or
1073
+ * is being deleted (`account_inactive`), the destination was removed
1074
+ * (`destination_removed`) or stopped listing the send's category
1075
+ * (`destination_unrouted`) before the post went out, its URL no longer
1076
+ * resolves to a public host (`unsafe_url`) or answered with a redirect, which
1077
+ * is never followed (`redirect_refused`), or Slack's own reasons: no
1078
+ * SparkVault Slack app is installed (`slack_not_installed`), it needs an
1079
+ * admin's Refresh Connection (`slack_reauthorization_required`), the channel
1080
+ * is gone (`channel_not_found`) or archived (`is_archived`), the app was
1081
+ * removed from it (`not_in_channel`: saving the destination again adds it back
1082
+ * to a public channel), the notification has no visible title or sender name
1083
+ * (`display_not_shown`), or Slack refused it with a code of no fixed form
1084
+ * (`rejected_unrecognized`).
1085
+ */
1086
+ type NotifyDestinationSkipReason = 'account_inactive' | 'destination_removed' | 'destination_unrouted' | 'unsafe_url' | 'redirect_refused' | 'slack_not_installed' | 'slack_reauthorization_required' | 'channel_not_found' | 'is_archived' | 'not_in_channel' | 'display_not_shown' | 'rejected_unrecognized';
1087
+ /**
1088
+ * Why a destination's post failed: it was sent and its answer was lost, so it
1089
+ * may have landed and is never tried again, since that could post it twice
1090
+ * (`possibly_delivered`), or every attempt met a fault that may clear, and
1091
+ * none was left (`attempts_exhausted`).
1092
+ */
1093
+ type NotifyDestinationFailureReason = 'possibly_delivered' | 'attempts_exhausted';
1094
+ /**
1095
+ * The `reason` beside a skipped or failed destination: a fixed reason, the
1096
+ * HTTP status a webhook or Teams workflow refused the post with
1097
+ * (`status_404`), or the error code Slack refused it with
1098
+ * (`rejected_restricted_action`).
1099
+ */
1100
+ type NotifyDestinationReason = NotifyDestinationSkipReason | NotifyDestinationFailureReason | `status_${number}` | `rejected_${string}`;
1027
1101
  /**
1028
1102
  * How a send's content reaches the recipient.
1029
1103
  * - `sealed` (default): content is sealed into a Spark behind a single-use
@@ -1031,7 +1105,7 @@ type NotifyChannel = 'in_app' | 'email' | 'sms' | 'push' | 'web_push' | 'voice'
1031
1105
  * - `plaintext`: a short non-confidential body rendered INLINE in the channel
1032
1106
  * payload. Fail-closed — at most 50 recipients, never allowed on a
1033
1107
  * confidential category, and on the inline-capable channels alone, which
1034
- * for an organization's send are both of its own (`in_app` and `email`).
1108
+ * are all four of an organization's (`in_app`, `email`, `push`, `web_push`).
1035
1109
  */
1036
1110
  type NotifyDeliveryMode = 'sealed' | 'plaintext';
1037
1111
  /**
@@ -1072,11 +1146,13 @@ type NotifyCategory = NotifyPresetCategory | (string & Record<never, never>);
1072
1146
  type NotifyPresetName = 'alert' | 'secureMessage' | 'conversation' | 'approval' | 'signatureRequest';
1073
1147
  /**
1074
1148
  * A recipient addressed by the handles the SENDER knows them by. `id` is your
1075
- * own key for them, or their Identity id (SVID, `ing_*`); `email` is where the
1076
- * email channel delivers and the address a sealed send's recipient proves to
1077
- * open it. A bare string is an email address or an SVID: a bare address is
1078
- * also the address its recipient proves, while a bare SVID keys the person's
1079
- * inbox row and carries no address to verify.
1149
+ * own key for them, their Identity id (SVID, `ing_*`), or the SparkVault user
1150
+ * id (`usr_*`) of an active member of your organization, which also reaches the
1151
+ * devices they registered with SparkVault (`push`, `web_push`); `email` is
1152
+ * where the email channel delivers and the address a sealed send's recipient
1153
+ * proves to open it. A bare string is an email address or one of those
1154
+ * SparkVault ids: a bare address is also the address its recipient proves,
1155
+ * while a bare id keys the person's inbox row and carries no address to verify.
1080
1156
  *
1081
1157
  * The recipient's key is its `id`, else its `email`, trimmed, with an email
1082
1158
  * address lowercased the way Identity stores it: it names their row in your
@@ -1088,13 +1164,15 @@ type NotifyPresetName = 'alert' | 'secureMessage' | 'conversation' | 'approval'
1088
1164
  * resolved to the person who holds it through Identity's directory.
1089
1165
  *
1090
1166
  * Refused with one 400 (`serviceCode` `VALIDATION_ERROR`) naming each such entry
1091
- * by index: a SparkVault user id (`usr_*`), which only SparkVault's own
1092
- * notifications address; a recipient with no email address that a phone number
1093
- * would key (a bare number, `{ phone }`, or an `id` that is an E.164 number);
1094
- * on a sealed send, one whose only handle is a phone (`{ id, phone }`); and, on
1095
- * a sealed send at the default `identifier` level or at `passkey`, one with no
1096
- * address to verify (a bare SVID, or an `id` alone): give it `{ id, email }`,
1097
- * or send at `verificationLevel: 'none'`.
1167
+ * by index: a SparkVault user id (`usr_*`) that is not an active member of your
1168
+ * organization (another account's member, one still invited, or no member at
1169
+ * all), and any id that only starts as one (`usr_`, `usr_x-1`), which names no
1170
+ * member; a recipient with no email address that a phone number would key (a
1171
+ * bare number, `{ phone }`, or an `id` that is an E.164 number); on a sealed
1172
+ * send, one whose only handle is a phone (`{ id, phone }`); and, on a sealed
1173
+ * send at the default `identifier` level or at `passkey`, one with no address
1174
+ * to verify (a bare id, or an `id` alone): give it `{ id, email }`, or send at
1175
+ * `verificationLevel: 'none'`.
1098
1176
  */
1099
1177
  interface NotifyRecipientRef {
1100
1178
  /** At most 256 bytes of UTF-8 with no control characters: it keys the recipient's inbox. */
@@ -1208,11 +1286,11 @@ interface CreateNotifySendOptions {
1208
1286
  policy?: NotifySendPolicy;
1209
1287
  /**
1210
1288
  * Channel ladder override, in escalation order; omit to resolve from the
1211
- * account config per category. An organization's send names its own two
1289
+ * account config per category. An organization's send names its own four
1212
1290
  * channels (see `NotifyChannel`): any other is refused 403, `serviceCode`
1213
1291
  * `NOTIFY_CHANNEL_NOT_AVAILABLE`, `details: { field: 'channels', channels }`.
1214
1292
  */
1215
- channels?: Array<'in_app' | 'email'>;
1293
+ channels?: Array<'in_app' | 'email' | 'push' | 'web_push'>;
1216
1294
  escalation?: NotifyEscalation;
1217
1295
  /**
1218
1296
  * Channel-agnostic display title (rides the email subject). Cut to 200
@@ -1302,6 +1380,10 @@ interface ListNotifyInboxOptions {
1302
1380
  * under the key they were sent to: none is moved or aliased when the person
1303
1381
  * later gets an SVID, so a tenant that switches from email to SVID addressing
1304
1382
  * should also read the email-keyed inbox for its `history_ttl_days` window.
1383
+ * A SparkVault user id (`usr_*`), or any id that only starts as one, names a
1384
+ * member's own inbox, which only that member reads, signed in to SparkVault:
1385
+ * it is refused 400 `VALIDATION_ERROR` before anything is read, here and on
1386
+ * both marks.
1305
1387
  */
1306
1388
  recipientId: string;
1307
1389
  state?: NotifyInboxView;
@@ -1309,13 +1391,14 @@ interface ListNotifyInboxOptions {
1309
1391
  limit?: number;
1310
1392
  cursor?: string;
1311
1393
  }
1394
+
1312
1395
  /**
1313
- * Both Notify inbox front doors run on one engine and return one row shape, so
1314
- * the sender-side feed is typed as the recipient feed rather than duplicated.
1396
+ * Both Notify inbox front doors run on one engine and page alike, so the
1397
+ * sender-side page is typed as the recipient feed's, with the sender's rows.
1315
1398
  */
1316
- type ListNotifyInboxResponse = ListNotificationsResponse;
1317
- /** The feed's row shape — one projection shared by both front doors. */
1318
- type NotifyInboxRow = NotificationRow;
1399
+ type ListNotifyInboxResponse = Omit<ListNotificationsResponse, 'notifications'> & {
1400
+ notifications: NotifyInboxRow[];
1401
+ };
1319
1402
  interface MarkNotifyInboxStateOptions {
1320
1403
  recipientId: string;
1321
1404
  /** The row's own `created_at` (epoch seconds), round-tripped from the feed row. */
@@ -1585,6 +1668,27 @@ interface NotifySendStatus {
1585
1668
  type: string | null;
1586
1669
  recipients: NotifySendStatusRecipient[];
1587
1670
  counts: NotifySendStatusCounts;
1671
+ /**
1672
+ * Each of your organization's destinations the send was routed to when it
1673
+ * was accepted, in `NotifyDestinationKind` order; empty when none was.
1674
+ * Reported beside the recipients, never part of them: `status` and `counts`
1675
+ * are the recipients' alone.
1676
+ */
1677
+ destinations: NotifySendStatusDestination[];
1678
+ }
1679
+ /** One of a send status's `destinations`. */
1680
+ interface NotifySendStatusDestination {
1681
+ kind: NotifyDestinationKind;
1682
+ state: NotifyDestinationState;
1683
+ /** Epoch seconds the state was recorded; null for a post no attempt has recorded anything for yet. */
1684
+ at: number | null;
1685
+ /** Beside a `skipped` or `failed` state; null otherwise. */
1686
+ reason: NotifyDestinationReason | null;
1687
+ /**
1688
+ * Where the post went: the webhook's host, the Slack channel id, or the
1689
+ * Teams workflow's host. Null when no attempt recorded one.
1690
+ */
1691
+ target: string | null;
1588
1692
  }
1589
1693
  /**
1590
1694
  * A send's delivery state, DERIVED from its counters — the send row itself is
@@ -1657,6 +1761,18 @@ interface NotifySendSummary {
1657
1761
  */
1658
1762
  recalled_at: number | null;
1659
1763
  state: NotifySendState;
1764
+ /**
1765
+ * The state of each of your organization's destinations the send was routed
1766
+ * to, in `NotifyDestinationKind` order (empty when none was), as
1767
+ * `getSendStatus` reports it; null when the send's delivery record is gone
1768
+ * (`state: 'unknown'`).
1769
+ */
1770
+ destinations: NotifySendSummaryDestination[] | null;
1771
+ }
1772
+ /** One of a send-history summary's `destinations`. */
1773
+ interface NotifySendSummaryDestination {
1774
+ kind: NotifyDestinationKind;
1775
+ state: NotifyDestinationState;
1660
1776
  }
1661
1777
  interface ListNotifySendsOptions {
1662
1778
  /** Page size, 1-100 (server default 50). */
@@ -1813,11 +1929,12 @@ interface NotifyConfigDelivery {
1813
1929
  escalation_enabled?: boolean;
1814
1930
  }
1815
1931
  /**
1816
- * `delivery` as a patch writes it. Its ladders name an organization's own two
1817
- * channels, `in_app` and `email` (see `NotifyChannel`): any other is refused
1818
- * 403, `serviceCode` `NOTIFY_CHANNEL_NOT_AVAILABLE`, `details.field` naming the
1819
- * ladder's field (and `details.category` the category, for a category's ladder
1820
- * in `channel_priority`), and nothing is stored.
1932
+ * `delivery` as a patch writes it. Its ladders name an organization's own four
1933
+ * channels, `in_app`, `email`, `push` and `web_push` (see `NotifyChannel`): any
1934
+ * other is refused 403, `serviceCode` `NOTIFY_CHANNEL_NOT_AVAILABLE`,
1935
+ * `details.field` naming the ladder's field (and `details.category` the
1936
+ * category, for a category's ladder in `channel_priority`), and nothing is
1937
+ * stored.
1821
1938
  */
1822
1939
  interface NotifyConfigDeliveryPatch extends Omit<NotifyConfigDelivery, 'channel_priority'> {
1823
1940
  /**
@@ -1863,14 +1980,22 @@ interface NotifyConfigSecurity {
1863
1980
  *
1864
1981
  * Both fields are required before anything is sent: an unsigned event is not
1865
1982
  * offered. `webhook_url` must be https on a public host (loopback, private,
1866
- * link-local, and CGNAT addresses are rejected server-side).
1983
+ * link-local, and CGNAT addresses are rejected server-side). A patch names only
1984
+ * what it changes, but a `webhook_url` on another host or port than the
1985
+ * stored one needs a new `secret` in the same patch (400 `VALIDATION_ERROR`
1986
+ * naming `events.secret`, `details.missing: ['secret']`): a secret never
1987
+ * follows its URL to a different host.
1867
1988
  *
1868
1989
  * Delivery is BEST EFFORT — one retry, then the event is dropped. Polling
1869
1990
  * (`listSends`, `getSendStatus`, `listReceipts`) remains the source of truth;
1870
1991
  * the webhook exists to make that poll rare, not to replace it.
1871
1992
  */
1872
1993
  interface NotifyConfigEvents {
1873
- /** https only, ≤2048 chars. */
1994
+ /**
1995
+ * https only, ≤2048 chars. WRITE-ONLY: a config read reports
1996
+ * `webhook_url_set` and `webhook_url_host` instead, since a catch hook's URL
1997
+ * carries its own token.
1998
+ */
1874
1999
  webhook_url?: string;
1875
2000
  /**
1876
2001
  * HMAC-SHA256 signing secret, 16-256 chars. Sent as the hex digest of the raw
@@ -1879,12 +2004,101 @@ interface NotifyConfigEvents {
1879
2004
  */
1880
2005
  secret?: string;
1881
2006
  }
1882
- /** `events` as it comes BACK from a read — the secret is never echoed. */
2007
+ /** `events` as it comes BACK from a read — neither the URL nor the secret is ever echoed. */
1883
2008
  interface NotifyConfigEventsRead {
1884
- webhook_url?: string;
2009
+ /** Whether an event webhook URL is stored. The URL itself is never returned. */
2010
+ webhook_url_set?: boolean;
2011
+ /** The stored event webhook URL's host, so an editor can say where events go. */
2012
+ webhook_url_host?: string;
1885
2013
  /** Whether a signing secret is stored. The secret itself is never returned. */
1886
2014
  secret_set?: boolean;
1887
2015
  }
2016
+ /**
2017
+ * Your own HTTPS endpoint as a destination. Each routed send is POSTed to `url`
2018
+ * once as JSON, signed like the event webhook (the hex HMAC-SHA256 of the raw
2019
+ * body under `secret`, in `X-SparkVault-Signature`); a post that may not have
2020
+ * landed is tried again with the same `delivery_id`, so drop a repeat you
2021
+ * already received. A redirect is never followed.
2022
+ */
2023
+ interface NotifyWebhookDestination {
2024
+ /**
2025
+ * https only on a public host, ≤2048 chars. WRITE-ONLY: a read reports
2026
+ * `url_set` and `url_host` instead, since a catch hook's URL carries its own
2027
+ * token.
2028
+ */
2029
+ url: string;
2030
+ /** Signing secret, 16-256 chars. WRITE-ONLY: a read reports `secret_set` instead. */
2031
+ secret: string;
2032
+ /**
2033
+ * The categories whose sends it receives one post of: 1-50, each once, each a
2034
+ * category a send can carry, never `security` (a person's security notices go
2035
+ * only to that person). A refused one is a 400 naming it in `details.category`.
2036
+ */
2037
+ categories: string[];
2038
+ }
2039
+ /** The webhook destination as a read returns it: neither its URL nor its secret is ever echoed. */
2040
+ interface NotifyWebhookDestinationRead {
2041
+ /** Whether an endpoint URL is stored. The URL itself is never returned. */
2042
+ url_set: boolean;
2043
+ /** The stored endpoint URL's host, so an editor can say which endpoint it is. */
2044
+ url_host: string;
2045
+ /** Whether a signing secret is stored. The secret itself is never returned. */
2046
+ secret_set: boolean;
2047
+ categories: string[];
2048
+ }
2049
+ /**
2050
+ * A channel in your organization's Slack workspace as a destination, posted to
2051
+ * through its SparkVault Slack app installation. A save naming `channel_id`
2052
+ * (even the one already saved) prepares the channel first: the app reads it and
2053
+ * joins a public one it is not in, and a private channel needs the app invited
2054
+ * first. A channel the app cannot post in is refused 400 with `details.reason`
2055
+ * naming why, and nothing is stored.
2056
+ */
2057
+ interface NotifySlackDestination {
2058
+ /** The channel's Slack id, as the console's channel picker lists it. */
2059
+ channel_id: string;
2060
+ /** As `NotifyWebhookDestination['categories']`. */
2061
+ categories: string[];
2062
+ }
2063
+ /** A Microsoft Teams workflow as a destination, posted to through its webhook URL. */
2064
+ interface NotifyTeamsDestination {
2065
+ /**
2066
+ * https only on a public host, ≤2048 chars. The URL is itself the credential
2067
+ * that posts to the channel. WRITE-ONLY: a read reports `webhook_url_set`
2068
+ * and `webhook_url_host` instead.
2069
+ */
2070
+ webhook_url: string;
2071
+ /** As `NotifyWebhookDestination['categories']`. */
2072
+ categories: string[];
2073
+ }
2074
+ /** The Teams destination as a read returns it: the workflow URL is never echoed. */
2075
+ interface NotifyTeamsDestinationRead {
2076
+ /** Whether a workflow URL is stored. */
2077
+ webhook_url_set: boolean;
2078
+ /** The stored workflow URL's host, so an editor can say which workflow it is. */
2079
+ webhook_url_host: string;
2080
+ categories: string[];
2081
+ }
2082
+ /** The destinations a config read returns, each present only once configured. */
2083
+ interface NotifyConfigDestinations {
2084
+ webhook?: NotifyWebhookDestinationRead;
2085
+ slack?: NotifySlackDestination;
2086
+ teams?: NotifyTeamsDestinationRead;
2087
+ }
2088
+ /**
2089
+ * A patch of the destinations: null removes the destination of its kind; an
2090
+ * object creates it, naming every field, or patches the one stored, naming
2091
+ * only what it changes (a credential it leaves out stays as stored). A webhook
2092
+ * `url` on another host or port than the stored one needs a new `secret` in
2093
+ * the same patch (400 `VALIDATION_ERROR` naming
2094
+ * `destinations.webhook.secret`, `details.missing: ['secret']`): a secret
2095
+ * never follows its URL to a different host.
2096
+ */
2097
+ interface NotifyConfigDestinationsPatch {
2098
+ webhook?: Partial<NotifyWebhookDestination> | null;
2099
+ slack?: Partial<NotifySlackDestination> | null;
2100
+ teams?: Partial<NotifyTeamsDestination> | null;
2101
+ }
1888
2102
  /** The account's effective config: secure defaults deep-merged with its overrides. */
1889
2103
  interface NotifyConfig {
1890
2104
  delivery: NotifyConfigDelivery;
@@ -1902,6 +2116,8 @@ interface NotifyConfig {
1902
2116
  email: {
1903
2117
  sending_domain: string | null;
1904
2118
  };
2119
+ /** Your organization's send-level destinations; empty until an admin configures one. */
2120
+ destinations: NotifyConfigDestinations;
1905
2121
  /** Tombstoned entries are already dropped — a deleted category is simply gone. */
1906
2122
  categories: Record<string, NotifyConfigCategory>;
1907
2123
  }
@@ -1913,9 +2129,12 @@ interface NotifyConfig {
1913
2129
  * `marketing`) is stored as a tombstone, which keeps the default from
1914
2130
  * re-appearing on the next merge; any other delete leaves no entry. Storing a
1915
2131
  * normal object under the same key later re-creates it. The reserved `security`
1916
- * category can neither be removed nor made optional, and the promotional
2132
+ * category can neither be removed nor made optional, the promotional
1917
2133
  * categories `marketing` and `product` can never be made required: their email
1918
- * always carries an unsubscribe link.
2134
+ * always carries an unsubscribe link, and `help_desk_alert` can be neither
2135
+ * removed nor made required: each member decides on auth.sv, under it, whether
2136
+ * the help desk's alerts reach them. Each refusal is a 400 `VALIDATION_ERROR`
2137
+ * naming the category in `details.category`.
1919
2138
  */
1920
2139
  interface NotifyConfigPatch {
1921
2140
  delivery?: NotifyConfigDeliveryPatch;
@@ -1937,15 +2156,21 @@ interface NotifyConfigPatch {
1937
2156
  email?: {
1938
2157
  sending_domain?: string | null;
1939
2158
  };
2159
+ /** Admin only. */
2160
+ destinations?: NotifyConfigDestinationsPatch;
1940
2161
  categories?: Record<string, NotifyConfigCategory | null>;
1941
2162
  }
1942
2163
  /**
1943
2164
  * The stored override delta, seeded-category tombstones included, because that is
1944
- * what a write merges onto. One value is held back: `events.secret` comes back as
1945
- * `secret_set`, never the secret — a patch never has to resend it.
2165
+ * what a write merges onto. The credentials are held back: `events.secret` and
2166
+ * the webhook destination's `secret` come back as `secret_set`, the webhook
2167
+ * destination's `url` as `url_set` and `url_host`, and `events.webhook_url` and
2168
+ * the Teams destination's `webhook_url` as `webhook_url_set` and
2169
+ * `webhook_url_host` — a patch never has to resend them.
1946
2170
  */
1947
- type NotifyConfigOverrides = Omit<NotifyConfigPatch, 'events'> & {
2171
+ type NotifyConfigOverrides = Omit<NotifyConfigPatch, 'events' | 'destinations'> & {
1948
2172
  events?: NotifyConfigEventsRead;
2173
+ destinations?: NotifyConfigDestinations;
1949
2174
  };
1950
2175
  interface NotifyConfigResponse {
1951
2176
  effective: NotifyConfig;
@@ -2264,14 +2489,20 @@ declare class NotifyProductModule {
2264
2489
  *
2265
2490
  * Delete a category by storing an explicit `null` TOMBSTONE — that is what keeps
2266
2491
  * a seeded default from re-appearing on the next merge. The reserved `security`
2267
- * category can neither be removed nor made optional, and the promotional
2492
+ * category can neither be removed nor made optional, the promotional
2268
2493
  * categories `marketing` and `product` can never be made required: their email
2269
- * always carries an unsubscribe link.
2494
+ * always carries an unsubscribe link, and `help_desk_alert` can be neither
2495
+ * removed nor made required: each member decides on auth.sv, under it, whether
2496
+ * the help desk's alerts reach them.
2270
2497
  *
2271
2498
  * The `events` section configures the outbound event webhook: `webhook_url`
2272
2499
  * must be https on a public host, and `secret` (16-256 chars) signs every event
2273
- * body as `X-SparkVault-Signature: hex(HMAC-SHA256(secret, rawBody))`. The
2274
- * secret is WRITE-ONLY — reads report `events.secret_set`, never the value.
2500
+ * body as `X-SparkVault-Signature: hex(HMAC-SHA256(secret, rawBody))`. Both
2501
+ * are WRITE-ONLY — reads report `events.webhook_url_set`,
2502
+ * `events.webhook_url_host` and `events.secret_set`, never the values. A
2503
+ * `webhook_url` on another host or port needs a new `secret` in the same
2504
+ * patch (400 `VALIDATION_ERROR` naming `events.secret`), so a secret never
2505
+ * follows its URL to a different host.
2275
2506
  *
2276
2507
  * The `email` section selects a domain of your own for your Notify email to go
2277
2508
  * out from. `security`, `events` and `email` are an org admin's to change: a
@@ -4164,8 +4395,9 @@ declare class EntropyModule {
4164
4395
  *
4165
4396
  * SparkVault's first-party Notify surface: the metadata-only inbox of a user
4166
4397
  * signed in to SparkVault itself (a Core session JWT; an API key or an
4167
- * identity-only token is refused), holding the notifications SparkVault
4168
- * delivered to them `in_app`, plus this browser's Web Push registration. It is
4398
+ * identity-only token is refused), holding the notifications SparkVault and the
4399
+ * organization they signed in to delivered to them `in_app`, plus this browser's
4400
+ * Web Push registration. It is
4169
4401
  * not a tenant's inbox for its own end users: a tenant reads its recipients'
4170
4402
  * feeds with `sv.products.notify.getInbox`. The recipient is ALWAYS derived
4171
4403
  * from the session on the server — no method takes a `recipient_id`, and any
@@ -4427,4 +4659,4 @@ declare global {
4427
4659
  }
4428
4660
 
4429
4661
  export { AuthenticationError, AuthorizationError, EntropyModule, FoldersModule, 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 };
4430
- 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, 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, NotifyCategory, NotifyChannel, NotifyConfig, NotifyConfigCategory, NotifyConfigDelivery, NotifyConfigDeliveryPatch, 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, NotifyRecipientState, NotifyReportableVerificationLevel, NotifySendContent, NotifySendPolicy, NotifySendReceipt, NotifySendReceiptsResponse, NotifySendResult, NotifySendState, NotifySendStatus, NotifySendStatusCounts, NotifySendStatusRecipient, NotifySendSummary, NotifySuppressionReason, NotifyVerificationLevel, 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, UnsealedVault, UnsubscribeWebPushResponse, UpdateFolderOptions, UpdateIngotSharingOptions, UpdateVaultUploadOptions, UpdatedVault, UploadAttachOptions, UploadBranding, UploadEnd, UploadIngotOptions, UploadOptions, UploadProgress, UploadResult, UploadSession, Vault, VaultDetail, VaultLifecycle, VaultSharingConfig, VaultSharingOptions, VaultSummary, VaultUploadConfig, VaultUploadSettings, VerifyOptions, VerifyResult, WebPushKeyResponse, WebPushStatus, WebPushStatusOptions, WebPushStatusResult, WebPushSubscriptionInput };
4662
+ 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, 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, UnsealedVault, UnsubscribeWebPushResponse, UpdateFolderOptions, UpdateIngotSharingOptions, UpdateVaultUploadOptions, UpdatedVault, UploadAttachOptions, UploadBranding, UploadEnd, UploadIngotOptions, UploadOptions, UploadProgress, UploadResult, UploadSession, Vault, VaultDetail, VaultLifecycle, VaultSharingConfig, VaultSharingOptions, VaultSummary, VaultUploadConfig, VaultUploadSettings, VerifyOptions, VerifyResult, WebPushKeyResponse, WebPushStatus, WebPushStatusOptions, WebPushStatusResult, WebPushSubscriptionInput };
package/dist/index.mjs CHANGED
@@ -11261,6 +11261,21 @@ class IdentityModule {
11261
11261
  const NOTIFY_SEND_ID_PATTERN = /^[A-Za-z0-9_.:-]+$/;
11262
11262
  const NOTIFY_SEND_ID_MAX_LENGTH = 128;
11263
11263
 
11264
+ /**
11265
+ * The Notify category a help desk's alerts to its own staff are classified
11266
+ * as: a new request in a team's queue, a customer's message, an assignment, a
11267
+ * mention, a reply to review, and the problems the desk tells its admins of.
11268
+ * Every account's categories carry it and every send may carry it
11269
+ * (NOTIFY_ALWAYS_SENDABLE_CATEGORIES), so an organization that removes it
11270
+ * from its own categories still alerts its staff. It is never required: the
11271
+ * Core API's config write refuses `required: true` on it, and the console
11272
+ * offers no Required for it. So a member's mute of it for the organization on
11273
+ * auth.sv, and their switching the organization off there, hold on whichever
11274
+ * route the alert takes: the organization's own Notify, or SparkVault's email
11275
+ * to an organization without it.
11276
+ */
11277
+ const NOTIFY_HELP_DESK_ALERT_CATEGORY = 'help_desk_alert';
11278
+
11264
11279
  /** Inbox states a recipient can set on one notification. */
11265
11280
  const NOTIFY_INBOX_MARK_STATES = Object.freeze(['seen', 'read', 'archived']);
11266
11281
 
@@ -11284,7 +11299,8 @@ const NOTIFY_INBOX_BULK_MARK_STATES = Object.freeze(['seen', 'read']);
11284
11299
  * The ladders the sealed presets name are the channels every sender's recipients
11285
11300
  * are reached on: the sender's Notify inbox (`in_app`, which the sender's own app
11286
11301
  * reads) and email. `secureMessage` goes to the person's mailbox alone. The
11287
- * device channels reach SparkVault's own devices only, so no preset names them.
11302
+ * device channels reach only a recipient addressed by a SparkVault member's
11303
+ * user id, so no preset names them.
11288
11304
  *
11289
11305
  * `approval` and `signatureRequest` verify at `identifier`, not `passkey`: a
11290
11306
  * passkey-level grant is satisfiable only by a recipient who ALREADY has a
@@ -11328,10 +11344,27 @@ const NOTIFY_PRESETS$1 = Object.freeze({
11328
11344
  * narrows what it derives (its place on the compliance floor, its toggle on the
11329
11345
  * recipient's settings), never what a preset send may be classified as.
11330
11346
  */
11331
- Object.freeze([
11347
+ const NOTIFY_PRESET_CATEGORIES = Object.freeze([
11332
11348
  ...new Set(Object.values(NOTIFY_PRESETS$1).map((preset) => preset.category))
11333
11349
  ]);
11334
11350
 
11351
+ /**
11352
+ * The categories a send may carry whatever the account's own categories hold:
11353
+ * every preset category (NOTIFY_PRESET_CATEGORIES) and the help desk's staff
11354
+ * alerts (NOTIFY_HELP_DESK_ALERT_CATEGORY), each of which a first-class
11355
+ * surface sends under on its own. Every account's config seeds them, so they
11356
+ * derive like any other category, and an account that deletes one narrows
11357
+ * what it derives (its place on the compliance floor, its toggle on the
11358
+ * recipient's settings), never what a send may be classified as. The Core
11359
+ * API's send and config checks accept them (notify/categories.js
11360
+ * sendableCategoryKeys), and the console says so before such a category is
11361
+ * deleted.
11362
+ */
11363
+ Object.freeze([
11364
+ ...NOTIFY_PRESET_CATEGORIES,
11365
+ NOTIFY_HELP_DESK_ALERT_CATEGORY
11366
+ ]);
11367
+
11335
11368
  /**
11336
11369
  * A preset's bundle with the caller's send arguments over it: the one merge the
11337
11370
  * Core API's presets (`buildPresetSend`) and the JS SDK's
@@ -11825,14 +11858,20 @@ class NotifyProductModule {
11825
11858
  *
11826
11859
  * Delete a category by storing an explicit `null` TOMBSTONE — that is what keeps
11827
11860
  * a seeded default from re-appearing on the next merge. The reserved `security`
11828
- * category can neither be removed nor made optional, and the promotional
11861
+ * category can neither be removed nor made optional, the promotional
11829
11862
  * categories `marketing` and `product` can never be made required: their email
11830
- * always carries an unsubscribe link.
11863
+ * always carries an unsubscribe link, and `help_desk_alert` can be neither
11864
+ * removed nor made required: each member decides on auth.sv, under it, whether
11865
+ * the help desk's alerts reach them.
11831
11866
  *
11832
11867
  * The `events` section configures the outbound event webhook: `webhook_url`
11833
11868
  * must be https on a public host, and `secret` (16-256 chars) signs every event
11834
- * body as `X-SparkVault-Signature: hex(HMAC-SHA256(secret, rawBody))`. The
11835
- * secret is WRITE-ONLY — reads report `events.secret_set`, never the value.
11869
+ * body as `X-SparkVault-Signature: hex(HMAC-SHA256(secret, rawBody))`. Both
11870
+ * are WRITE-ONLY — reads report `events.webhook_url_set`,
11871
+ * `events.webhook_url_host` and `events.secret_set`, never the values. A
11872
+ * `webhook_url` on another host or port needs a new `secret` in the same
11873
+ * patch (400 `VALIDATION_ERROR` naming `events.secret`), so a secret never
11874
+ * follows its URL to a different host.
11836
11875
  *
11837
11876
  * The `email` section selects a domain of your own for your Notify email to go
11838
11877
  * out from. `security`, `events` and `email` are an org admin's to change: a
@@ -17993,8 +18032,9 @@ function validateEntropyRequest(bytes, format) {
17993
18032
  *
17994
18033
  * SparkVault's first-party Notify surface: the metadata-only inbox of a user
17995
18034
  * signed in to SparkVault itself (a Core session JWT; an API key or an
17996
- * identity-only token is refused), holding the notifications SparkVault
17997
- * delivered to them `in_app`, plus this browser's Web Push registration. It is
18035
+ * identity-only token is refused), holding the notifications SparkVault and the
18036
+ * organization they signed in to delivered to them `in_app`, plus this browser's
18037
+ * Web Push registration. It is
17998
18038
  * not a tenant's inbox for its own end users: a tenant reads its recipients'
17999
18039
  * feeds with `sv.products.notify.getInbox`. The recipient is ALWAYS derived
18000
18040
  * from the session on the server — no method takes a `recipient_id`, and any
@@ -18452,7 +18492,7 @@ class SparkVault {
18452
18492
  }
18453
18493
  /** Get the SDK version */
18454
18494
  static get version() {
18455
- return '13.3.0';
18495
+ return '14.0.0';
18456
18496
  }
18457
18497
  }
18458
18498
  if (typeof window !== 'undefined') {