@sparkvault/sdk-js 12.0.5 → 13.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +98 -733
- package/dist/errors.d.ts +41 -11
- package/dist/http.d.ts +8 -6
- package/dist/index.cjs +597 -216
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +758 -207
- package/dist/index.mjs +597 -217
- package/dist/index.mjs.map +1 -1
- package/dist/ingots/index.d.ts +13 -4
- package/dist/ingots/types.d.ts +5 -2
- package/dist/notify/index.d.ts +50 -7
- package/dist/notify/types.d.ts +33 -9
- package/dist/products/identity/api.d.ts +25 -15
- package/dist/products/identity/index.d.ts +1 -1
- package/dist/products/identity/renderer.d.ts +12 -3
- package/dist/products/identity/state.d.ts +16 -1
- package/dist/products/identity/types.d.ts +26 -6
- package/dist/products/identity/views/error.d.ts +7 -0
- package/dist/products/index.d.ts +2 -2
- package/dist/products/notify/index.d.ts +154 -31
- package/dist/products/notify/types.d.ts +406 -121
- package/dist/sparkvault.js +1 -1
- package/dist/sparkvault.js.map +1 -1
- package/dist/vaults/index.d.ts +5 -2
- package/dist/vaults/types.d.ts +2 -8
- package/dist/vaults/upload/api.d.ts +7 -0
- package/dist/vaults/upload/types.d.ts +10 -7
- package/package.json +1 -1
- package/dist/products/identity/types.test-d.d.ts +0 -21
- package/dist/products/notify/types.test-d.d.ts +0 -35
package/dist/index.d.ts
CHANGED
|
@@ -126,12 +126,14 @@ declare class HttpClient {
|
|
|
126
126
|
request<T = unknown>(path: ApiPath, options?: RequestOptions): Promise<ApiResponse<T>>;
|
|
127
127
|
private parseResponse;
|
|
128
128
|
/**
|
|
129
|
-
* The SDK error for a failed answer, typed by its status
|
|
130
|
-
* page branches on get their own class,
|
|
131
|
-
* error under the service's own code.
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
129
|
+
* The SDK error for a failed answer, typed by its status (a 402's or a 403's
|
|
130
|
+
* by its code too): the gates a host page branches on get their own class,
|
|
131
|
+
* and every other answer is the base error under the service's own code.
|
|
132
|
+
* Each carries the service's code (`serviceCode`), which tells apart two
|
|
133
|
+
* refusals that share a typed class's `code`, and the answer's `Retry-After`
|
|
134
|
+
* (`retryAfterMs`), the floor for whoever retries it — the SDK's own
|
|
135
|
+
* transfers when the answer is a download link's mint, and the host page
|
|
136
|
+
* otherwise.
|
|
135
137
|
*/
|
|
136
138
|
private createErrorFromResponse;
|
|
137
139
|
private unwrapApiResponse;
|
|
@@ -153,13 +155,33 @@ type VerifiedIdentityType = 'email' | 'phone' | 'social';
|
|
|
153
155
|
interface AuthContext {
|
|
154
156
|
/** OIDC auth request ID for authorization code flow */
|
|
155
157
|
authRequestId?: string;
|
|
156
|
-
/**
|
|
158
|
+
/**
|
|
159
|
+
* A verification against a verify session, as the SparkVault-hosted page
|
|
160
|
+
* that serves it describes it. Every request of the verification names the
|
|
161
|
+
* session, and the server reads its destination, state and purpose from it.
|
|
162
|
+
* `methods` and `allowedIdentityTypes` are what the session admits, decided
|
|
163
|
+
* by the server from the session, and the page offers them in place of the
|
|
164
|
+
* account's sign-in methods: a Notify recipient's proof of address admits a
|
|
165
|
+
* code emailed to the address it was sent to and a passkey, whatever the
|
|
166
|
+
* account's sign-in switches on, and the passkey alone for a request its
|
|
167
|
+
* sender held to a passkey; no verify session admits a SparkLink or a social
|
|
168
|
+
* sign-in, neither of which can complete one.
|
|
169
|
+
*/
|
|
157
170
|
simpleMode?: {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
171
|
+
/** Opaque server-side verify session the verification completes against */
|
|
172
|
+
sessionId: string;
|
|
173
|
+
/** The methods the session admits */
|
|
174
|
+
methods: MethodId[];
|
|
175
|
+
/** The identifier types the session's methods deliver to */
|
|
176
|
+
allowedIdentityTypes: ('email' | 'phone')[];
|
|
177
|
+
/**
|
|
178
|
+
* True when the session proves a request its sender held to a passkey: it
|
|
179
|
+
* admits the passkey alone, so a person who holds no passkey registered
|
|
180
|
+
* with SparkVault is told that only the sender can resend the request at a
|
|
181
|
+
* level they can clear, never offered a way that cannot complete it.
|
|
182
|
+
* Absent reads as false.
|
|
183
|
+
*/
|
|
184
|
+
passkeyRequired?: boolean;
|
|
163
185
|
};
|
|
164
186
|
}
|
|
165
187
|
interface VerifyOptions {
|
|
@@ -324,6 +346,8 @@ interface TokenClaims {
|
|
|
324
346
|
*/
|
|
325
347
|
picture?: string;
|
|
326
348
|
}
|
|
349
|
+
/** Method ID returned by config endpoint */
|
|
350
|
+
type MethodId = 'otp_email' | 'otp_sms' | 'otp_voice' | 'passkey' | 'sparklink' | 'social_google' | 'social_apple' | 'social_microsoft' | 'social_github' | 'social_facebook' | 'social_linkedin';
|
|
327
351
|
|
|
328
352
|
/**
|
|
329
353
|
* Identity Module
|
|
@@ -379,7 +403,7 @@ declare class IdentityModule {
|
|
|
379
403
|
* error.
|
|
380
404
|
*
|
|
381
405
|
* @example
|
|
382
|
-
* const result =
|
|
406
|
+
* const result = IdentityModule.isFedcmAvailable()
|
|
383
407
|
* ? await sv.products.identity.signInWithFedcm().catch(() => sv.products.identity.signIn())
|
|
384
408
|
* : await sv.products.identity.signIn();
|
|
385
409
|
*/
|
|
@@ -576,8 +600,10 @@ declare class IdentityModule {
|
|
|
576
600
|
/**
|
|
577
601
|
* Notify Module Types
|
|
578
602
|
*
|
|
579
|
-
*
|
|
580
|
-
*
|
|
603
|
+
* SparkVault's first-party inbox: the notifications SparkVault itself delivered
|
|
604
|
+
* `in_app` to a signed-in SparkVault user. Unlike Entropy/Sparks, notification
|
|
605
|
+
* ROWS are NOT remapped to camelCase: their fields mirror the wire, and a tenant's
|
|
606
|
+
* sender-side feed (`sv.products.notify.getInbox`) returns the same row. A row carries
|
|
581
607
|
* its cleartext part (`title`, and for a cleartext send a short `body`) natively;
|
|
582
608
|
* a SECURE send's content is never carried here — it lives behind the SparkLink
|
|
583
609
|
* `sparklink_code`. Keeping the wire shape verbatim is the single source of truth
|
|
@@ -615,9 +641,11 @@ interface NotificationRow {
|
|
|
615
641
|
archived_at: number | null;
|
|
616
642
|
/**
|
|
617
643
|
* The grant to open. Present only while a live reveal stands behind it — a
|
|
618
|
-
* SEALED (secure) send
|
|
619
|
-
*
|
|
620
|
-
*
|
|
644
|
+
* SEALED (secure) send whose grant still opens: not yet opened (on a send that
|
|
645
|
+
* asks for an answer, not yet answered), not expired, not gone and not
|
|
646
|
+
* recalled. A cleartext send delivers its content inline in the channel and
|
|
647
|
+
* mints no grant; once the reveal no longer opens, the pointer is withheld
|
|
648
|
+
* rather than echoed.
|
|
621
649
|
*/
|
|
622
650
|
sparklink_code?: string;
|
|
623
651
|
/**
|
|
@@ -628,9 +656,10 @@ interface NotificationRow {
|
|
|
628
656
|
pointer_url?: string;
|
|
629
657
|
/**
|
|
630
658
|
* True only when there is a secure part left to reveal — exactly when
|
|
631
|
-
* `sparklink_code` is present. `false` does NOT mean "cleartext row": a
|
|
632
|
-
* row
|
|
633
|
-
*
|
|
659
|
+
* `sparklink_code` is present. `false` does NOT mean "cleartext row": a sealed
|
|
660
|
+
* row whose reveal no longer opens (opened, answered, expired or gone) is
|
|
661
|
+
* unlocked too, and so is a recalled one, with nothing behind it. Branch on
|
|
662
|
+
* `recalled` before treating an unlocked row as plain text.
|
|
634
663
|
*/
|
|
635
664
|
locked: boolean;
|
|
636
665
|
/**
|
|
@@ -639,7 +668,6 @@ interface NotificationRow {
|
|
|
639
668
|
* tap-to-reveal that opens nothing.
|
|
640
669
|
*/
|
|
641
670
|
recalled: boolean;
|
|
642
|
-
thread_id?: string;
|
|
643
671
|
}
|
|
644
672
|
interface ListNotificationsOptions {
|
|
645
673
|
state?: NotificationInboxState;
|
|
@@ -739,6 +767,26 @@ interface SubscribeWebPushResult {
|
|
|
739
767
|
/** The live PushSubscription on 'subscribed'/'already_subscribed'. */
|
|
740
768
|
subscription?: PushSubscription;
|
|
741
769
|
}
|
|
770
|
+
/**
|
|
771
|
+
* This browser's Web Push state, as getWebPushStatus reads it. `subscribed`
|
|
772
|
+
* means the browser holds a subscription made for the key the server signs
|
|
773
|
+
* with now; one made for another key can never deliver, so it reads
|
|
774
|
+
* `not_subscribed`.
|
|
775
|
+
*/
|
|
776
|
+
type WebPushStatus = 'subscribed' | 'not_subscribed' | 'not_supported' | 'not_configured';
|
|
777
|
+
interface WebPushStatusOptions {
|
|
778
|
+
/**
|
|
779
|
+
* The page's service-worker registration
|
|
780
|
+
* (`navigator.serviceWorker.getRegistration()`), when it has one: a page
|
|
781
|
+
* with no registration holds no subscription.
|
|
782
|
+
*/
|
|
783
|
+
serviceWorkerRegistration?: ServiceWorkerRegistration;
|
|
784
|
+
}
|
|
785
|
+
interface WebPushStatusResult {
|
|
786
|
+
status: WebPushStatus;
|
|
787
|
+
/** The live PushSubscription, on 'subscribed' only. */
|
|
788
|
+
subscription?: PushSubscription;
|
|
789
|
+
}
|
|
742
790
|
|
|
743
791
|
/**
|
|
744
792
|
* Vaults Module Types
|
|
@@ -922,16 +970,28 @@ interface UpdateVaultUploadOptions {
|
|
|
922
970
|
* silently corrupt them, so the config travels exactly as the server defines it.
|
|
923
971
|
*/
|
|
924
972
|
|
|
925
|
-
/**
|
|
973
|
+
/**
|
|
974
|
+
* Every transport the dispatch seam can carry a notification on: what a send's
|
|
975
|
+
* status, a stored ladder and a config read can name. An organization's own
|
|
976
|
+
* send, and its config's ladders, may name only two of them:
|
|
977
|
+
*
|
|
978
|
+
* | Channel | An organization's send |
|
|
979
|
+
* | --- | --- |
|
|
980
|
+
* | `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) |
|
|
981
|
+
* | `email` | Goes out from your organization's own sender (`getEmailSender`) |
|
|
982
|
+
* | `sms`, `voice`, `whatsapp`, `rcs` | Refused 403 `NOTIFY_CHANNEL_NOT_AVAILABLE`: Notify delivers no text, call or chat message |
|
|
983
|
+
* | `push`, `web_push` | Refused 403 `NOTIFY_CHANNEL_NOT_AVAILABLE`: SparkVault's own devices only |
|
|
984
|
+
* | `webhook`, `slack`, `teams` | Refused 403 `NOTIFY_CHANNEL_NOT_AVAILABLE`: SparkVault's own destinations only |
|
|
985
|
+
*/
|
|
926
986
|
type NotifyChannel = 'in_app' | 'email' | 'sms' | 'push' | 'web_push' | 'voice' | 'whatsapp' | 'rcs' | 'webhook' | 'slack' | 'teams';
|
|
927
987
|
/**
|
|
928
988
|
* How a send's content reaches the recipient.
|
|
929
989
|
* - `sealed` (default): content is sealed into a Spark behind a single-use
|
|
930
990
|
* SparkLink; channels carry only the pointer ("tap to view").
|
|
931
991
|
* - `plaintext`: a short non-confidential body rendered INLINE in the channel
|
|
932
|
-
* payload. Fail-closed —
|
|
933
|
-
*
|
|
934
|
-
*
|
|
992
|
+
* payload. Fail-closed — at most 50 recipients, never allowed on a
|
|
993
|
+
* confidential category, and on the inline-capable channels alone, which
|
|
994
|
+
* for an organization's send are both of its own (`in_app` and `email`).
|
|
935
995
|
*/
|
|
936
996
|
type NotifyDeliveryMode = 'sealed' | 'plaintext';
|
|
937
997
|
/**
|
|
@@ -951,9 +1011,14 @@ type NotifyVerificationLevel = 'none' | 'identifier' | 'passkey';
|
|
|
951
1011
|
/** What the recipient does at the reveal — the interaction the receipt attests to. */
|
|
952
1012
|
type NotifyInteraction = 'view' | 'acknowledge' | 'sign' | 'approve' | 'reply';
|
|
953
1013
|
/**
|
|
954
|
-
* The fixed categories the five presets classify their sends as.
|
|
955
|
-
*
|
|
956
|
-
* `
|
|
1014
|
+
* The fixed categories the five presets classify their sends as. Each is seeded
|
|
1015
|
+
* into the account's `config.categories` like any other topic, so its
|
|
1016
|
+
* `required` flag decides whether a recipient may mute it and whether it sits on
|
|
1017
|
+
* the compliance floor: `secure`, `approval` and `signature` are seeded
|
|
1018
|
+
* required, `alert` and `conversation` are not. A tenant may demote or tombstone
|
|
1019
|
+
* any of them (only `security` is reserved). The send endpoint accepts a preset
|
|
1020
|
+
* category whatever the map holds, so an edit changes what the category
|
|
1021
|
+
* derives, never whether it can be sent.
|
|
957
1022
|
*/
|
|
958
1023
|
type NotifyPresetCategory = 'alert' | 'secure' | 'conversation' | 'approval' | 'signature';
|
|
959
1024
|
/**
|
|
@@ -966,17 +1031,44 @@ type NotifyCategory = NotifyPresetCategory | (string & Record<never, never>);
|
|
|
966
1031
|
/** The five secure-by-default preset bundles. */
|
|
967
1032
|
type NotifyPresetName = 'alert' | 'secureMessage' | 'conversation' | 'approval' | 'signatureRequest';
|
|
968
1033
|
/**
|
|
969
|
-
* A recipient addressed by the handles the SENDER knows them by. `id` is
|
|
970
|
-
*
|
|
971
|
-
*
|
|
972
|
-
* is an
|
|
1034
|
+
* A recipient addressed by the handles the SENDER knows them by. `id` is your
|
|
1035
|
+
* own key for them, or their Identity id (SVID, `ing_*`); `email` is where the
|
|
1036
|
+
* email channel delivers and the address a sealed send's recipient proves to
|
|
1037
|
+
* open it. A bare string is an email address or an SVID: a bare address is
|
|
1038
|
+
* also the address its recipient proves, while a bare SVID keys the person's
|
|
1039
|
+
* inbox row and carries no address to verify.
|
|
1040
|
+
*
|
|
1041
|
+
* The recipient's key is its `id`, else its `email`, trimmed, with an email
|
|
1042
|
+
* address lowercased the way Identity stores it: it names their row in your
|
|
1043
|
+
* Notify inbox, and `getSendStatus` and `getSendReceipts` report it as
|
|
1044
|
+
* `recipient_id`.
|
|
973
1045
|
*
|
|
974
|
-
*
|
|
975
|
-
*
|
|
1046
|
+
* A person's stored notification preferences apply however you address them:
|
|
1047
|
+
* an SVID `id` names the person, and each address a recipient carries is
|
|
1048
|
+
* resolved to the person who holds it through Identity's directory.
|
|
1049
|
+
*
|
|
1050
|
+
* Refused with one 400 (`serviceCode` `VALIDATION_ERROR`) naming each such entry
|
|
1051
|
+
* by index: a SparkVault user id (`usr_*`), which only SparkVault's own
|
|
1052
|
+
* notifications address; a recipient with no email address that a phone number
|
|
1053
|
+
* would key (a bare number, `{ phone }`, or an `id` that is an E.164 number);
|
|
1054
|
+
* on a sealed send, one whose only handle is a phone (`{ id, phone }`); and, on
|
|
1055
|
+
* a sealed send at the default `identifier` level or at `passkey`, one with no
|
|
1056
|
+
* address to verify (a bare SVID, or an `id` alone): give it `{ id, email }`,
|
|
1057
|
+
* or send at `verificationLevel: 'none'`.
|
|
976
1058
|
*/
|
|
977
1059
|
interface NotifyRecipientRef {
|
|
1060
|
+
/** At most 256 bytes of UTF-8 with no control characters: it keys the recipient's inbox. */
|
|
978
1061
|
id?: string;
|
|
1062
|
+
/**
|
|
1063
|
+
* The address the email channel delivers to. A recipient with no `id` is keyed
|
|
1064
|
+
* by its address, which is then held to the id's 256-byte bound: give an address
|
|
1065
|
+
* longer than that an `id` of your own (`{ id, email }`), or the send is refused.
|
|
1066
|
+
*/
|
|
979
1067
|
email?: string;
|
|
1068
|
+
/**
|
|
1069
|
+
* E.164. Notify delivers nothing to a phone, so a recipient that names one
|
|
1070
|
+
* also needs an `email`, or, on a plaintext send, an `id`.
|
|
1071
|
+
*/
|
|
980
1072
|
phone?: string;
|
|
981
1073
|
}
|
|
982
1074
|
type NotifyRecipient = string | NotifyRecipientRef;
|
|
@@ -1011,6 +1103,10 @@ interface NotifySendContent {
|
|
|
1011
1103
|
* `AUTHENTICATION_ERROR`; an expired one 403 (`details.reason: 'VAT_EXPIRED'`,
|
|
1012
1104
|
* unseal again and retry), a read-only one 403 (`'VAT_READ_ONLY'`), and one for
|
|
1013
1105
|
* another vault 403 `FORBIDDEN`.
|
|
1106
|
+
*
|
|
1107
|
+
* Each code named here is the service's and arrives as the thrown error's
|
|
1108
|
+
* `serviceCode`; a 400, 401 or 403 error's own `code` names its class
|
|
1109
|
+
* (`validation_error`, `authentication_error`, `authorization_error`).
|
|
1014
1110
|
*/
|
|
1015
1111
|
interface NotifyIngotRef {
|
|
1016
1112
|
ingotId: string;
|
|
@@ -1027,6 +1123,17 @@ interface NotifySendPolicy {
|
|
|
1027
1123
|
interaction?: NotifyInteraction;
|
|
1028
1124
|
/** Require the recipient to have verified within N minutes of revealing. */
|
|
1029
1125
|
revealFreshnessMinutes?: number;
|
|
1126
|
+
/**
|
|
1127
|
+
* What an `approve` or `sign` receipt attests the recipient acted on: 64
|
|
1128
|
+
* lowercase hex, the SHA-256 of the canonical bytes of the thing being
|
|
1129
|
+
* approved or signed. It is stamped onto every grant, and the signed receipt
|
|
1130
|
+
* carries it verbatim as its `action_hash`, so a hash recomputed later from
|
|
1131
|
+
* your own copy proves WHAT was approved. Without it the receipt carries a
|
|
1132
|
+
* digest of the grant itself, which no hash of your document can match, so
|
|
1133
|
+
* supply it on every approve and sign send. A value of another shape is
|
|
1134
|
+
* refused with 400, `serviceCode` `VALIDATION_ERROR`.
|
|
1135
|
+
*/
|
|
1136
|
+
actionHash?: string;
|
|
1030
1137
|
}
|
|
1031
1138
|
/**
|
|
1032
1139
|
* Cumulative per-step delays in SECONDS from send time, one per channel step.
|
|
@@ -1042,7 +1149,12 @@ interface CreateNotifySendOptions {
|
|
|
1042
1149
|
/**
|
|
1043
1150
|
* Idempotency key, `^[A-Za-z0-9_.:-]{1,128}$`. Replaying an existing id returns
|
|
1044
1151
|
* the stored send unchanged — never re-sealed, never re-delivered — with
|
|
1045
|
-
* `idempotent: true`. Generated (`ntsnd_*`) when absent.
|
|
1152
|
+
* `idempotent: true`. Generated (`ntsnd_*`) when absent. A replay must repeat
|
|
1153
|
+
* what the recipient meets (the delivery mode, the content or ingot, the
|
|
1154
|
+
* recipients and their handles, title, category, instructions, policy,
|
|
1155
|
+
* channels and escalation): one that differs in any of them is refused 400
|
|
1156
|
+
* (`serviceCode` `VALIDATION_ERROR`), and the stored send stands. `type` and
|
|
1157
|
+
* `historyTtlDays` are not compared: the stored send keeps its own.
|
|
1046
1158
|
*/
|
|
1047
1159
|
sendId?: string;
|
|
1048
1160
|
/** 1-500 recipients. An ingot send accepts exactly one. */
|
|
@@ -1054,10 +1166,21 @@ interface CreateNotifySendOptions {
|
|
|
1054
1166
|
/** Defaults to `sealed`. */
|
|
1055
1167
|
delivery?: NotifyDeliveryMode;
|
|
1056
1168
|
policy?: NotifySendPolicy;
|
|
1057
|
-
/**
|
|
1058
|
-
|
|
1169
|
+
/**
|
|
1170
|
+
* Channel ladder override, in escalation order; omit to resolve from the
|
|
1171
|
+
* account config per category. An organization's send names its own two
|
|
1172
|
+
* channels (see `NotifyChannel`): any other is refused 403, `serviceCode`
|
|
1173
|
+
* `NOTIFY_CHANNEL_NOT_AVAILABLE`, `details: { field: 'channels', channels }`.
|
|
1174
|
+
*/
|
|
1175
|
+
channels?: Array<'in_app' | 'email'>;
|
|
1059
1176
|
escalation?: NotifyEscalation;
|
|
1060
|
-
/**
|
|
1177
|
+
/**
|
|
1178
|
+
* Channel-agnostic display title (rides the email subject). Cut to 200
|
|
1179
|
+
* characters, never rejected for its length. A title that reads as SparkVault,
|
|
1180
|
+
* or holds a text-direction control character, is refused 400 with
|
|
1181
|
+
* `details: { field: 'title', reason: 'reserved_name' }`: the notification goes
|
|
1182
|
+
* out in your organization's name.
|
|
1183
|
+
*/
|
|
1061
1184
|
title?: string;
|
|
1062
1185
|
/**
|
|
1063
1186
|
* REQUIRED. The category this send is classified as — one of your configured
|
|
@@ -1068,14 +1191,21 @@ interface CreateNotifySendOptions {
|
|
|
1068
1191
|
* recipient consented to. The preset helpers stamp their own.
|
|
1069
1192
|
*/
|
|
1070
1193
|
category: NotifyCategory;
|
|
1071
|
-
/**
|
|
1194
|
+
/**
|
|
1195
|
+
* Display classifier the tenant tags the send with, at most 64 characters once
|
|
1196
|
+
* folded to one line; a longer one is refused rather than cut short.
|
|
1197
|
+
*/
|
|
1072
1198
|
type?: string;
|
|
1073
1199
|
/**
|
|
1074
1200
|
* NON-SECRET display text (≤500 chars) shown alongside a sealed send — e.g.
|
|
1075
1201
|
* "verify with your passkey to open". It is never the sealed content.
|
|
1076
1202
|
*/
|
|
1077
1203
|
instructions?: string;
|
|
1078
|
-
/**
|
|
1204
|
+
/**
|
|
1205
|
+
* Inbox-row retention in days, 1 to 3650. Defaults to the account's
|
|
1206
|
+
* `history.history_ttl_days` (30 unless configured); a value outside the
|
|
1207
|
+
* range is refused 400. A plaintext send is capped at 7.
|
|
1208
|
+
*/
|
|
1079
1209
|
historyTtlDays?: number;
|
|
1080
1210
|
}
|
|
1081
1211
|
/**
|
|
@@ -1090,6 +1220,11 @@ interface NotifySendResult {
|
|
|
1090
1220
|
send_id: string;
|
|
1091
1221
|
/** Number of recipients the send was accepted for. */
|
|
1092
1222
|
recipients: number;
|
|
1223
|
+
/**
|
|
1224
|
+
* `pending`: accepted for delivery. The send row's status is written once and
|
|
1225
|
+
* never advances, so read how the send is landing from `getSendStatus` or
|
|
1226
|
+
* `listSends`, whose state is derived.
|
|
1227
|
+
*/
|
|
1093
1228
|
status: string;
|
|
1094
1229
|
/**
|
|
1095
1230
|
* Present (and `true`) ONLY on an idempotent replay of an existing `send_id`.
|
|
@@ -1097,14 +1232,18 @@ interface NotifySendResult {
|
|
|
1097
1232
|
*/
|
|
1098
1233
|
idempotent?: boolean;
|
|
1099
1234
|
}
|
|
1100
|
-
/**
|
|
1235
|
+
/**
|
|
1236
|
+
* One preset's fixed bundle, merged UNDER the caller's own arguments. The
|
|
1237
|
+
* exported table is shared by every send in the process, so it is read-only:
|
|
1238
|
+
* `buildNotifyPresetSend` hands back options of the caller's own to adjust.
|
|
1239
|
+
*/
|
|
1101
1240
|
interface NotifyPreset {
|
|
1102
|
-
category: NotifyPresetCategory;
|
|
1103
|
-
delivery?: NotifyDeliveryMode;
|
|
1104
|
-
channels?: NotifyChannel[];
|
|
1105
|
-
policy: {
|
|
1106
|
-
verificationLevel: NotifyVerificationLevel;
|
|
1107
|
-
interaction: NotifyInteraction;
|
|
1241
|
+
readonly category: NotifyPresetCategory;
|
|
1242
|
+
readonly delivery?: NotifyDeliveryMode;
|
|
1243
|
+
readonly channels?: readonly NotifyChannel[];
|
|
1244
|
+
readonly policy: {
|
|
1245
|
+
readonly verificationLevel: NotifyVerificationLevel;
|
|
1246
|
+
readonly interaction: NotifyInteraction;
|
|
1108
1247
|
};
|
|
1109
1248
|
}
|
|
1110
1249
|
/** Inbox views the feed can be filtered to. `all` excludes archived rows. */
|
|
@@ -1118,10 +1257,11 @@ type NotifyInboxMarkState = NotificationMarkState;
|
|
|
1118
1257
|
type NotifyInboxBulkMarkState = NotificationBulkMarkState;
|
|
1119
1258
|
interface ListNotifyInboxOptions {
|
|
1120
1259
|
/**
|
|
1121
|
-
* The inbox owner
|
|
1122
|
-
*
|
|
1123
|
-
*
|
|
1124
|
-
*
|
|
1260
|
+
* The inbox owner: the recipient's key (see `NotifyRecipientRef`), or the id
|
|
1261
|
+
* or address as the send named it, which is read in that form. Rows stay
|
|
1262
|
+
* under the key they were sent to: none is moved or aliased when the person
|
|
1263
|
+
* later gets an SVID, so a tenant that switches from email to SVID addressing
|
|
1264
|
+
* should also read the email-keyed inbox for its `history_ttl_days` window.
|
|
1125
1265
|
*/
|
|
1126
1266
|
recipientId: string;
|
|
1127
1267
|
state?: NotifyInboxView;
|
|
@@ -1159,26 +1299,73 @@ interface MarkNotifyInboxAllResponse {
|
|
|
1159
1299
|
* The one answer for a recipient, derived from their row (never stored, so it
|
|
1160
1300
|
* cannot drift from the facts it summarizes).
|
|
1161
1301
|
*
|
|
1162
|
-
* - `pending` — still in flight, or not yet driven
|
|
1302
|
+
* - `pending` — still in flight, or not yet driven: the escalation ladder has a
|
|
1303
|
+
* step left to run and nothing has settled them, whatever its steps so far
|
|
1304
|
+
* recorded short of a delivery. A recipient whose first channel declined
|
|
1305
|
+
* stays here while the next one waits its turn.
|
|
1163
1306
|
* - `delivered` — a channel accepted it and no provider has repudiated that, or
|
|
1164
1307
|
* the recipient opened the sealed content or marked it seen and a later
|
|
1165
1308
|
* escalation step recorded that before any recall.
|
|
1166
|
-
* - `undeliverable` —
|
|
1167
|
-
* implemented). The recipient cannot be
|
|
1168
|
-
*
|
|
1169
|
-
*
|
|
1170
|
-
*
|
|
1171
|
-
*
|
|
1172
|
-
*
|
|
1173
|
-
*
|
|
1174
|
-
*
|
|
1175
|
-
*
|
|
1176
|
-
*
|
|
1177
|
-
*
|
|
1178
|
-
*
|
|
1179
|
-
*
|
|
1309
|
+
* - `undeliverable` — the ladder ran its course and every channel attempted
|
|
1310
|
+
* declined (no handle, bounced, not implemented). The recipient cannot be
|
|
1311
|
+
* reached as addressed. A hard bounce of their only delivery moves them here
|
|
1312
|
+
* at once, even with a step left to run (or to `failed`, if another channel
|
|
1313
|
+
* gave up), until a later step delivers it or records that they opened or
|
|
1314
|
+
* marked it seen. A recipient whose grant expired before a channel reached
|
|
1315
|
+
* them reads `undeliverable` too, unless a channel had already failed. Their
|
|
1316
|
+
* address may be fine: the grant can expire before their first step goes, or
|
|
1317
|
+
* while their email retries or is deferred, and then `channel_outcomes`
|
|
1318
|
+
* record no decline.
|
|
1319
|
+
* - `failed` — the ladder ran its course (or their grant expired, or a hard
|
|
1320
|
+
* bounce of their only delivery settled them), every attempt ended, and a
|
|
1321
|
+
* channel gave up: it exhausted its retries, or their deferred email could
|
|
1322
|
+
* not go within 24 hours of the send. OUR transport gave up; the address may
|
|
1323
|
+
* be perfectly good.
|
|
1324
|
+
* - `suppressed` — taken out of the ladder by a decision, not a fault. Usually
|
|
1325
|
+
* the PERSON chose silence (site off, category muted, every offered channel
|
|
1326
|
+
* opted out, your site blocked on auth.sv for a sealed send, or the address
|
|
1327
|
+
* unsubscribed); otherwise your account was suspended or began deleting before
|
|
1328
|
+
* their next queued step came due. Not something to route around.
|
|
1329
|
+
* - `rate_limited` — skipped by the per-recipient abuse ceiling for that minute,
|
|
1330
|
+
* decided once per send and recipient.
|
|
1331
|
+
* - `recalled` — the sender took it back, and nothing on this recipient's row
|
|
1332
|
+
* outranks the recall. The reveal is revoked and no further delivery will be
|
|
1333
|
+
* attempted. Recall cannot undo what already happened, so it ranks BELOW every
|
|
1334
|
+
* answer the row already records: `delivered` (a channel reached them, or
|
|
1335
|
+
* engagement an escalation step recorded before the recall), `suppressed`,
|
|
1336
|
+
* `rate_limited`, and `undeliverable` / `failed` when no channel could reach
|
|
1337
|
+
* them or their ladder ran its course with every channel declining or giving
|
|
1338
|
+
* up before the recall. A recall that stops a ladder before it runs its course
|
|
1339
|
+
* reads `recalled`, whatever its earlier steps recorded — so a recipient whose
|
|
1340
|
+
* first channel skipped them and who was recalled before their next channel
|
|
1341
|
+
* reads `recalled`. It also covers recipients with no row
|
|
1342
|
+
* yet: everyone a whole-audience recall stopped the fan-out before reaching,
|
|
1343
|
+
* and everyone a targeted recall named before the fan-out reached them.
|
|
1180
1344
|
*/
|
|
1181
1345
|
type NotifyRecipientState = 'pending' | 'delivered' | 'undeliverable' | 'failed' | 'suppressed' | 'rate_limited' | 'recalled';
|
|
1346
|
+
/**
|
|
1347
|
+
* Why the pipeline took a recipient out of the ladder, as a fixed token (never a
|
|
1348
|
+
* transport's own words, so nothing recipient-identifying rides it).
|
|
1349
|
+
*
|
|
1350
|
+
* - `no_channels` — the send offered no usable channel at all.
|
|
1351
|
+
* - `unreachable` — every offered channel lacks a handle for them.
|
|
1352
|
+
* - `global_off` — the person switched this sender off entirely.
|
|
1353
|
+
* - `category_muted` — the person muted this category.
|
|
1354
|
+
* - `all_channels_opted_out` — the person opted out of every channel offered.
|
|
1355
|
+
* - `site_blocked` — the person blocked your site on auth.sv, and the send was
|
|
1356
|
+
* sealed: opening it asks them to prove the address it was sent to, a proof
|
|
1357
|
+
* of address that signs them in to nothing and opens no session, and their
|
|
1358
|
+
* block refuses that proof.
|
|
1359
|
+
* - `identifier_unsubscribed` — a transport reported, mid-ladder, that the
|
|
1360
|
+
* person unsubscribed the address the send was addressed to.
|
|
1361
|
+
* - `account_unavailable` — your account was suspended or began deleting before
|
|
1362
|
+
* the recipient's next queued step came due, so their ladder ended there.
|
|
1363
|
+
*
|
|
1364
|
+
* The first two roll up to the `undeliverable` state (they need an address that
|
|
1365
|
+
* reaches them), the other six to `suppressed` (a decision, not a fault: the
|
|
1366
|
+
* person asked to be left alone, or your account was stopped).
|
|
1367
|
+
*/
|
|
1368
|
+
type NotifySuppressionReason = 'no_channels' | 'unreachable' | 'global_off' | 'category_muted' | 'all_channels_opted_out' | 'site_blocked' | 'identifier_unsubscribed' | 'account_unavailable';
|
|
1182
1369
|
interface NotifySendStatusRecipient {
|
|
1183
1370
|
recipient_id: string;
|
|
1184
1371
|
/** The derived per-recipient state — the field to branch on. */
|
|
@@ -1188,34 +1375,68 @@ interface NotifySendStatusRecipient {
|
|
|
1188
1375
|
seen_at: number | null;
|
|
1189
1376
|
read_at: number | null;
|
|
1190
1377
|
archived_at: number | null;
|
|
1191
|
-
/**
|
|
1378
|
+
/**
|
|
1379
|
+
* When the recipient was taken out of the ladder: by their own choice or their
|
|
1380
|
+
* block of your site, for want of an address that reaches them, or by your
|
|
1381
|
+
* account's stop. Not always an opt-out: `suppressed_reason` says why, and
|
|
1382
|
+
* `state` already separates an unreachable recipient from one who opted out.
|
|
1383
|
+
*/
|
|
1192
1384
|
suppressed_at: number | null;
|
|
1385
|
+
/** Why the recipient was taken out of the ladder; null while `suppressed_at` is. */
|
|
1386
|
+
suppressed_reason: NotifySuppressionReason | null;
|
|
1193
1387
|
/**
|
|
1194
|
-
* When the per-recipient ceiling skipped them
|
|
1195
|
-
*
|
|
1388
|
+
* When the per-recipient ceiling skipped them, decided once per send and
|
|
1389
|
+
* recipient. Only a delivery that raced the refusal (a retried fan-out that
|
|
1390
|
+
* read them admitted before it landed) clears it, and then they read as any
|
|
1391
|
+
* driven recipient.
|
|
1196
1392
|
*/
|
|
1197
1393
|
rate_limited_at: number | null;
|
|
1198
1394
|
/**
|
|
1199
1395
|
* The latest dispatch outcome per attempted channel — the difference between a
|
|
1200
1396
|
* notification that actually left the building and one whose every channel
|
|
1201
1397
|
* declined. `{}` until the first dispatch is recorded. The adapter `detail`
|
|
1202
|
-
* string is deliberately NOT carried here: it can echo a provider response body
|
|
1203
|
-
*
|
|
1398
|
+
* string is deliberately NOT carried here: it can echo a provider response body,
|
|
1399
|
+
* and with it a phone number or address the rollup does not otherwise carry.
|
|
1204
1400
|
*/
|
|
1205
1401
|
channel_outcomes: Partial<Record<NotifyChannel, {
|
|
1206
1402
|
outcome: 'delivered' | 'skipped' | 'not_implemented' | 'retryable'
|
|
1207
|
-
/**
|
|
1403
|
+
/**
|
|
1404
|
+
* An email step that could not go yet, tried again at `retry_at` for
|
|
1405
|
+
* its `reason` — not terminal: a step that cannot go within 24 hours
|
|
1406
|
+
* of the send is recorded `failed` instead. Left out once the
|
|
1407
|
+
* recipient's record holds a stop its step meets when it wakes (they
|
|
1408
|
+
* saw the notification, it was recalled, or their ladder already
|
|
1409
|
+
* ended undelivered), since that step sends nothing. A stop held on
|
|
1410
|
+
* no record (their grant spent or expired, your account stopped) is
|
|
1411
|
+
* met only when the step wakes, and the entry stays until then.
|
|
1412
|
+
*/
|
|
1413
|
+
| 'deferred'
|
|
1414
|
+
/**
|
|
1415
|
+
* The step exhausted its retries, or was deferred and could not go
|
|
1416
|
+
* within 24 hours of the send — terminal, unlike `retryable`. The
|
|
1417
|
+
* ladder moves on to its next channel.
|
|
1418
|
+
*/
|
|
1208
1419
|
| 'failed'
|
|
1209
1420
|
/**
|
|
1210
1421
|
* The provider repudiated a delivery it had accepted. It REPLACES the
|
|
1211
|
-
* channel's `delivered` entry: handing a message to
|
|
1212
|
-
* proof it reached a mailbox.
|
|
1422
|
+
* channel's `delivered` entry: handing a message to the email provider
|
|
1423
|
+
* was never proof it reached a mailbox.
|
|
1213
1424
|
*/
|
|
1214
1425
|
| 'bounced';
|
|
1215
1426
|
/** Epoch seconds the outcome was recorded. */
|
|
1216
1427
|
at: number | null;
|
|
1217
1428
|
/** Escalation step index the outcome came from. */
|
|
1218
1429
|
step: number | null;
|
|
1430
|
+
/** For a `deferred` step, epoch seconds it is tried again; null on every other outcome. */
|
|
1431
|
+
retry_at: number | null;
|
|
1432
|
+
/**
|
|
1433
|
+
* For a `deferred` step, why it waits: the platform's per-second rate or
|
|
1434
|
+
* its hourly email lane, your account's hourly email share, the provider
|
|
1435
|
+
* refusing for its rate, the provider's sending paused, or the platform's
|
|
1436
|
+
* own mail domain the email goes out from not verified for sending. Null
|
|
1437
|
+
* on every other outcome.
|
|
1438
|
+
*/
|
|
1439
|
+
reason: 'platform_rate' | 'platform_hourly' | 'account_hourly' | 'provider_throttled' | 'sending_paused' | 'sender_identity_unverified' | null;
|
|
1219
1440
|
}>>;
|
|
1220
1441
|
/**
|
|
1221
1442
|
* At least one channel accepted the notification for this recipient. A
|
|
@@ -1224,16 +1445,19 @@ interface NotifySendStatusRecipient {
|
|
|
1224
1445
|
*/
|
|
1225
1446
|
delivered: boolean;
|
|
1226
1447
|
/**
|
|
1227
|
-
*
|
|
1228
|
-
* `not_implemented`, or `bounced`)
|
|
1229
|
-
*
|
|
1230
|
-
*
|
|
1448
|
+
* Something was attempted, nothing delivered, and every recorded outcome
|
|
1449
|
+
* declined (`skipped`, `not_implemented`, or `bounced`). False while nothing
|
|
1450
|
+
* has been attempted yet and while a `retryable` attempt is still in flight. A
|
|
1451
|
+
* transport fact about the attempts so far: while the ladder has a step left
|
|
1452
|
+
* to run it can be true with `state` still `pending`.
|
|
1231
1453
|
*/
|
|
1232
1454
|
undeliverable: boolean;
|
|
1233
1455
|
/**
|
|
1234
|
-
* Every attempt is terminal, nothing delivered, and at least one channel
|
|
1235
|
-
* exhausted its retries
|
|
1236
|
-
* transport problem on our side, not
|
|
1456
|
+
* Every attempt is terminal, nothing delivered, and at least one channel's
|
|
1457
|
+
* outcome is `failed`: it exhausted its retries, or was deferred and could
|
|
1458
|
+
* not go within 24 hours of the send — a transport problem on our side, not
|
|
1459
|
+
* an address that cannot receive. A transport fact about the attempts so
|
|
1460
|
+
* far, like `undeliverable`.
|
|
1237
1461
|
*/
|
|
1238
1462
|
failed: boolean;
|
|
1239
1463
|
}
|
|
@@ -1243,40 +1467,58 @@ interface NotifySendStatusCounts {
|
|
|
1243
1467
|
seen: number;
|
|
1244
1468
|
read: number;
|
|
1245
1469
|
archived: number;
|
|
1470
|
+
/**
|
|
1471
|
+
* Recipients with a deferred email step, whatever their `state`: one no
|
|
1472
|
+
* other channel reached reads `pending` until the step runs, and one
|
|
1473
|
+
* another channel already reached reads `delivered` while it waits. A wait
|
|
1474
|
+
* is not counted once the recipient's record holds a stop its step meets
|
|
1475
|
+
* when it wakes (they saw the notification, it was recalled, or their
|
|
1476
|
+
* ladder already ended undelivered): that step sends nothing. A stop held
|
|
1477
|
+
* on no record (their grant spent or expired, your account stopped) is met
|
|
1478
|
+
* only when the step wakes, and the wait is counted until then.
|
|
1479
|
+
*/
|
|
1480
|
+
deferred: number;
|
|
1246
1481
|
/**
|
|
1247
1482
|
* The seven state counters below PARTITION the audience — one per
|
|
1248
1483
|
* `NotifyRecipientState`:
|
|
1249
1484
|
* `pending + delivered + undeliverable + failed + suppressed + rate_limited + recalled === total`.
|
|
1250
|
-
* (`enqueued` / `seen` / `read` / `archived` are independent
|
|
1251
|
-
* and do not partition anything.)
|
|
1485
|
+
* (`enqueued` / `seen` / `read` / `archived` / `deferred` are independent
|
|
1486
|
+
* progress markers and do not partition anything.)
|
|
1252
1487
|
*/
|
|
1253
1488
|
pending: number;
|
|
1254
1489
|
/** Recipients whose `state` is `delivered`. */
|
|
1255
1490
|
delivered: number;
|
|
1256
|
-
/** Recipients whose
|
|
1491
|
+
/** Recipients whose `state` is `undeliverable`. */
|
|
1257
1492
|
undeliverable: number;
|
|
1258
|
-
/** Recipients whose
|
|
1493
|
+
/** Recipients whose `state` is `failed`. */
|
|
1259
1494
|
failed: number;
|
|
1260
|
-
/**
|
|
1495
|
+
/**
|
|
1496
|
+
* Recipients taken out of the ladder by a decision: their own, or your
|
|
1497
|
+
* account's stop. Never a delivery failure.
|
|
1498
|
+
*/
|
|
1261
1499
|
suppressed: number;
|
|
1262
1500
|
/** Recipients skipped by the per-recipient ceiling. */
|
|
1263
1501
|
rate_limited: number;
|
|
1264
1502
|
/**
|
|
1265
|
-
* Recipients
|
|
1503
|
+
* Recipients whose `state` is `recalled`: taken back by the sender with nothing
|
|
1504
|
+
* on their row outranking the recall (see `NotifyRecipientState`). A recalled
|
|
1266
1505
|
* send therefore settles instead of sitting on `pending` until it expires.
|
|
1267
1506
|
*/
|
|
1268
1507
|
recalled: number;
|
|
1269
1508
|
}
|
|
1270
1509
|
/**
|
|
1271
1510
|
* The sender's per-recipient delivery rollup. Metadata only by construction: it
|
|
1272
|
-
* never carries the SparkLink pointer,
|
|
1273
|
-
*
|
|
1511
|
+
* never carries the SparkLink pointer, policy internals, or a contact you did not
|
|
1512
|
+
* supply — `recipient_id` is the recipient's key (see `NotifyRecipientRef`), so a
|
|
1513
|
+
* recipient addressed by email alone appears as that address, trimmed and
|
|
1514
|
+
* lowercased. Address recipients as `{ id, email }` to keep their addresses out
|
|
1515
|
+
* of the rollup.
|
|
1274
1516
|
*/
|
|
1275
1517
|
interface NotifySendStatus {
|
|
1276
1518
|
send_id: string;
|
|
1277
1519
|
/**
|
|
1278
1520
|
* DERIVED, never stored — and by the SAME function the send-history list uses,
|
|
1279
|
-
* so
|
|
1521
|
+
* so the two never disagree about what a state means.
|
|
1280
1522
|
*
|
|
1281
1523
|
* - `unknown` — no audience denominator, so no honest statement about "all
|
|
1282
1524
|
* recipients" can be made.
|
|
@@ -1287,13 +1529,13 @@ interface NotifySendStatus {
|
|
|
1287
1529
|
* - `partial` — every recipient resolved; some delivered, some did not.
|
|
1288
1530
|
* - `failed` — every recipient resolved and none delivered.
|
|
1289
1531
|
*
|
|
1290
|
-
*
|
|
1291
|
-
*
|
|
1292
|
-
*
|
|
1293
|
-
*
|
|
1294
|
-
*
|
|
1295
|
-
*
|
|
1296
|
-
*
|
|
1532
|
+
* A whole-audience recall resolves every recipient a channel had not already
|
|
1533
|
+
* reached, so a recalled send reads `partial`, `failed` when nothing had been
|
|
1534
|
+
* delivered, or `delivered` when every recipient already had been. The list
|
|
1535
|
+
* feeds it the send's best-effort counters (and its `recalled_at`); this view
|
|
1536
|
+
* recomputes them from the authoritative per-recipient rows. When the two
|
|
1537
|
+
* differ, this view is the one to trust; for WHY a given recipient did not get
|
|
1538
|
+
* it, read that recipient's `state`.
|
|
1297
1539
|
*/
|
|
1298
1540
|
status: 'unknown' | 'pending' | 'sending' | 'delivered' | 'partial' | 'failed';
|
|
1299
1541
|
channels: NotifyChannel[];
|
|
@@ -1309,21 +1551,30 @@ interface NotifySendStatus {
|
|
|
1309
1551
|
* write-once, so there is no stored lifecycle to read.
|
|
1310
1552
|
*
|
|
1311
1553
|
* `failed` counts every recipient who reached a terminal answer without being
|
|
1312
|
-
* delivered (declined, retries exhausted, opted out, rate limited,
|
|
1313
|
-
*
|
|
1314
|
-
* resolved; a recipient
|
|
1315
|
-
*
|
|
1316
|
-
* send reads `sending` rather than being scored early.
|
|
1554
|
+
* delivered (declined, retries exhausted, opted out, rate limited, a bounce that
|
|
1555
|
+
* repudiated a delivery, or a recall that ended their ladder), so
|
|
1556
|
+
* `delivered + failed` is how many have resolved; a recipient still climbing
|
|
1557
|
+
* the escalation ladder is in neither,
|
|
1558
|
+
* which is why an in-flight send reads `sending` rather than being scored early.
|
|
1559
|
+
* A whole-audience recall resolves every recipient a channel had not already
|
|
1560
|
+
* reached, so a recalled send reads `partial` or `failed` (see `recalled_at`).
|
|
1317
1561
|
*
|
|
1318
|
-
* `unknown` means
|
|
1319
|
-
*
|
|
1562
|
+
* `unknown` means no statement about all of a send's recipients can be made:
|
|
1563
|
+
* it carries no audience denominator (`recipient_count` null or 0), or its
|
|
1564
|
+
* counters cannot be read (it is past its history horizon and its counters are
|
|
1565
|
+
* already gone). The state is reported as not knowable rather than guessed at.
|
|
1320
1566
|
*/
|
|
1321
1567
|
type NotifySendState = 'unknown' | 'pending' | 'sending' | 'delivered' | 'partial' | 'failed';
|
|
1322
1568
|
/**
|
|
1323
1569
|
* One row of the account's send history. Metadata only: the audience is not
|
|
1324
1570
|
* projected into the history index, so this shape cannot carry a recipient's
|
|
1325
|
-
* contact or the SparkLink pointer.
|
|
1326
|
-
*
|
|
1571
|
+
* contact or the SparkLink pointer.
|
|
1572
|
+
*
|
|
1573
|
+
* A counter the send row does not carry is `null`, never an invented 0: each
|
|
1574
|
+
* delivery counter is created by its first increment, so on a send with a
|
|
1575
|
+
* `recipient_count` a null counter counts 0. An in-flight send reads
|
|
1576
|
+
* `delivered_count: null` until its first delivery, and a send no recipient
|
|
1577
|
+
* failed keeps `failed_count: null`.
|
|
1327
1578
|
*/
|
|
1328
1579
|
interface NotifySendSummary {
|
|
1329
1580
|
send_id: string | null;
|
|
@@ -1334,8 +1585,13 @@ interface NotifySendSummary {
|
|
|
1334
1585
|
delivery: NotifyDeliveryMode | null;
|
|
1335
1586
|
/** The sender name recipients saw. Display only — nothing routes on it. */
|
|
1336
1587
|
display_sender_name: string | null;
|
|
1337
|
-
/**
|
|
1588
|
+
/**
|
|
1589
|
+
* Audience size at accept — the denominator of the counters below. Null or 0
|
|
1590
|
+
* only on a send that carries no audience count, which reads
|
|
1591
|
+
* `state: 'unknown'`.
|
|
1592
|
+
*/
|
|
1338
1593
|
recipient_count: number | null;
|
|
1594
|
+
/** Recipients whose first delivery step was handed to delivery. */
|
|
1339
1595
|
enqueued_count: number | null;
|
|
1340
1596
|
/**
|
|
1341
1597
|
* Recipients settled delivered, on the same evidence as the recipient
|
|
@@ -1345,9 +1601,21 @@ interface NotifySendSummary {
|
|
|
1345
1601
|
delivered_count: number | null;
|
|
1346
1602
|
/**
|
|
1347
1603
|
* Recipients who reached a terminal answer without being delivered: every
|
|
1348
|
-
* attempted channel declined or gave up,
|
|
1604
|
+
* attempted channel declined or gave up, they were suppressed or rate limited,
|
|
1605
|
+
* or they were recalled before a channel reached them (counted when the next
|
|
1606
|
+
* step of their ladder stops on the revoked grant).
|
|
1349
1607
|
*/
|
|
1350
1608
|
failed_count: number | null;
|
|
1609
|
+
/**
|
|
1610
|
+
* Epoch seconds of a whole-audience recall; null when there was none (a
|
|
1611
|
+
* targeted recall of named recipients never sets it: those recipients resolve
|
|
1612
|
+
* through `failed_count`, and `getSendStatus` names them `recalled`). A
|
|
1613
|
+
* recalled send settles: the remainder it withdrew counts as resolved without
|
|
1614
|
+
* being delivered, so `state` reads `partial`, `failed` when nothing had been
|
|
1615
|
+
* delivered, or `delivered` when every recipient already had been: this is
|
|
1616
|
+
* what tells that recall apart from a delivery failure.
|
|
1617
|
+
*/
|
|
1618
|
+
recalled_at: number | null;
|
|
1351
1619
|
state: NotifySendState;
|
|
1352
1620
|
}
|
|
1353
1621
|
interface ListNotifySendsOptions {
|
|
@@ -1365,7 +1633,9 @@ interface ListNotifySendsResponse {
|
|
|
1365
1633
|
* - `grant` (default): revoke the access grant; the content survives.
|
|
1366
1634
|
* - `content`: hard-burn the sealed spark so the content is unreadable for
|
|
1367
1635
|
* everyone, then drop the grant. Spark-backed sends only — an ingot send
|
|
1368
|
-
* references the owner's durable vault content and can only be grant-recalled
|
|
1636
|
+
* references the owner's durable vault content and can only be grant-recalled:
|
|
1637
|
+
* a `content` recall of one is a 400, refused before anything is revoked or
|
|
1638
|
+
* stopped.
|
|
1369
1639
|
*/
|
|
1370
1640
|
type NotifyRecallMode = 'grant' | 'content';
|
|
1371
1641
|
interface RecallNotifySendOptions {
|
|
@@ -1385,6 +1655,12 @@ interface RecallNotifySendResponse {
|
|
|
1385
1655
|
failed: number;
|
|
1386
1656
|
/** Requested recipient ids that are not on this send's audience. */
|
|
1387
1657
|
not_found: string[];
|
|
1658
|
+
/**
|
|
1659
|
+
* One entry per recipient whose recall failed (the rest still ran). `error`
|
|
1660
|
+
* is the code the API answers that failure with on its own: a refusal's code
|
|
1661
|
+
* (such as `VALIDATION_ERROR`), else `INTERNAL_ERROR` or a public server
|
|
1662
|
+
* error code (such as `CRYPTOGRAPHIC_ERROR`); never the error's text.
|
|
1663
|
+
*/
|
|
1388
1664
|
failures: Array<{
|
|
1389
1665
|
recipient_id: string;
|
|
1390
1666
|
error: string;
|
|
@@ -1393,9 +1669,20 @@ interface RecallNotifySendResponse {
|
|
|
1393
1669
|
/** The five verified-interaction receipt subtypes (SparkLink lifecycle events are not receipts). */
|
|
1394
1670
|
type NotifyReceiptEventType = 'sparklink_accessed' | 'sparklink_signed' | 'sparklink_approved' | 'sparklink_denied' | 'sparklink_replied';
|
|
1395
1671
|
/**
|
|
1396
|
-
*
|
|
1397
|
-
*
|
|
1398
|
-
*
|
|
1672
|
+
* Every verification level a receipt can report: the levels a send may ask for,
|
|
1673
|
+
* and `out_of_band` and `dual_control`, which no send can ask for but a stored
|
|
1674
|
+
* grant may name, and is enforced at.
|
|
1675
|
+
*/
|
|
1676
|
+
type NotifyReportableVerificationLevel = NotifyVerificationLevel | 'out_of_band' | 'dual_control';
|
|
1677
|
+
/**
|
|
1678
|
+
* The receipt of a verified interaction. A ceremony's (acknowledge, sign,
|
|
1679
|
+
* approve, reply) is portable proof: `signed_token` is the Identity-signed
|
|
1680
|
+
* EdDSA token a third party verifies against the tenant's JWKS, and
|
|
1681
|
+
* `action_hash` binds it to the action an approve or a sign answered. An
|
|
1682
|
+
* open's (`sparklink_accessed`) is an unsigned access record: its
|
|
1683
|
+
* `signed_token` is null. An acknowledge records `sparklink_signed`, as a sign
|
|
1684
|
+
* does; `interaction` tells them apart. `link_code` is masked (`abc123***`)
|
|
1685
|
+
* exactly as stored.
|
|
1399
1686
|
*/
|
|
1400
1687
|
interface NotifyReceipt {
|
|
1401
1688
|
event_type: NotifyReceiptEventType | null;
|
|
@@ -1406,22 +1693,25 @@ interface NotifyReceipt {
|
|
|
1406
1693
|
vault_id: string | null;
|
|
1407
1694
|
link_code: string | null;
|
|
1408
1695
|
/**
|
|
1409
|
-
* The correlation key
|
|
1410
|
-
*
|
|
1411
|
-
*
|
|
1696
|
+
* The correlation key the interaction events quote (`notify.signed`,
|
|
1697
|
+
* `notify.approved`, `notify.denied`, `notify.replied`): 32 hex of the SHA-256
|
|
1698
|
+
* over the grant code, never the code itself. Match an event to its receipt on
|
|
1699
|
+
* this, never on `link_code`. Null on a receipt stored without one, which only
|
|
1700
|
+
* its `link_code` names.
|
|
1412
1701
|
*/
|
|
1413
1702
|
link_code_hash: string | null;
|
|
1414
1703
|
link_type: string | null;
|
|
1415
|
-
verification_level:
|
|
1704
|
+
verification_level: NotifyReportableVerificationLevel | null;
|
|
1416
1705
|
action_hash: string | null;
|
|
1417
1706
|
signed_token: string | null;
|
|
1418
1707
|
decision: string | null;
|
|
1419
1708
|
thread_id: string | null;
|
|
1420
1709
|
reply_spark_id: string | null;
|
|
1421
1710
|
/**
|
|
1422
|
-
* The send whose grant produced this receipt, stamped at mint time
|
|
1423
|
-
*
|
|
1424
|
-
* SparkLink.
|
|
1711
|
+
* The send whose grant produced this receipt, stamped at mint time: present on
|
|
1712
|
+
* a `listReceipts` receipt of a grant a Notify send created, and null for a
|
|
1713
|
+
* standalone SparkLink. Null on every `getSendReceipts` row, which is read from
|
|
1714
|
+
* the audit rows; the send there is the one you asked for.
|
|
1425
1715
|
*/
|
|
1426
1716
|
send_id: string | null;
|
|
1427
1717
|
/** The send's display title, alongside `send_id` and under the same conditions. */
|
|
@@ -1454,16 +1744,14 @@ interface NotifySendReceiptsResponse {
|
|
|
1454
1744
|
send_id: string;
|
|
1455
1745
|
receipts: NotifySendReceipt[];
|
|
1456
1746
|
/**
|
|
1457
|
-
* True when the
|
|
1458
|
-
*
|
|
1459
|
-
*
|
|
1747
|
+
* True when the call's page cap stopped the walk before it reached the send's
|
|
1748
|
+
* creation, so more receipts of this send may follow: re-call with `cursor`.
|
|
1749
|
+
* False means `receipts` is the send's whole set — no receipt of a send
|
|
1750
|
+
* predates it, so the walk never reads further back.
|
|
1460
1751
|
*/
|
|
1461
|
-
truncated
|
|
1462
|
-
/**
|
|
1463
|
-
|
|
1464
|
-
* absent when the scan completed.
|
|
1465
|
-
*/
|
|
1466
|
-
cursor?: string | null;
|
|
1752
|
+
truncated: boolean;
|
|
1753
|
+
/** Where the next call resumes a truncated walk; null when it is complete. */
|
|
1754
|
+
cursor: string | null;
|
|
1467
1755
|
}
|
|
1468
1756
|
/** One notification topic. `required: true` is the compliance floor — unmutable by the recipient. */
|
|
1469
1757
|
interface NotifyConfigCategory {
|
|
@@ -1473,11 +1761,9 @@ interface NotifyConfigCategory {
|
|
|
1473
1761
|
description?: string;
|
|
1474
1762
|
required?: boolean;
|
|
1475
1763
|
}
|
|
1476
|
-
/**
|
|
1764
|
+
/** When the email step goes, in whole minutes from send time, 0..1440 (24 hours). */
|
|
1477
1765
|
interface NotifyConfigRealtimeFallbackDelay {
|
|
1478
1766
|
email_minutes?: number;
|
|
1479
|
-
sms_minutes?: number;
|
|
1480
|
-
voice_minutes?: number;
|
|
1481
1767
|
}
|
|
1482
1768
|
interface NotifyConfigDelivery {
|
|
1483
1769
|
default_channels?: NotifyChannel[];
|
|
@@ -1486,15 +1772,34 @@ interface NotifyConfigDelivery {
|
|
|
1486
1772
|
realtime_fallback_delay?: NotifyConfigRealtimeFallbackDelay;
|
|
1487
1773
|
escalation_enabled?: boolean;
|
|
1488
1774
|
}
|
|
1775
|
+
/**
|
|
1776
|
+
* `delivery` as a patch writes it. Its ladders name an organization's own two
|
|
1777
|
+
* channels, `in_app` and `email` (see `NotifyChannel`): any other is refused
|
|
1778
|
+
* 403, `serviceCode` `NOTIFY_CHANNEL_NOT_AVAILABLE`, `details.field` naming the
|
|
1779
|
+
* ladder's field (and `details.category` the category, for a category's ladder
|
|
1780
|
+
* in `channel_priority`), and nothing is stored.
|
|
1781
|
+
*/
|
|
1782
|
+
interface NotifyConfigDeliveryPatch extends Omit<NotifyConfigDelivery, 'channel_priority'> {
|
|
1783
|
+
/**
|
|
1784
|
+
* Per-category channel order. Each ladder names at least one channel, each at
|
|
1785
|
+
* most once; a NEW key must name a category a send can carry (one of the
|
|
1786
|
+
* account's, one the same patch creates, or a preset category). `null` removes
|
|
1787
|
+
* that category's ladder. At most 50 ladders.
|
|
1788
|
+
*/
|
|
1789
|
+
channel_priority?: Record<string, NotifyChannel[] | null>;
|
|
1790
|
+
}
|
|
1489
1791
|
interface NotifyConfigReliability {
|
|
1490
1792
|
/**
|
|
1491
|
-
*
|
|
1492
|
-
*
|
|
1793
|
+
* Notifications per recipient per minute, 1-600, counted per person: a
|
|
1794
|
+
* recipient counts against its own id and each email or phone it names. An
|
|
1795
|
+
* abuse/bug backstop the tenant cannot switch off — 0 is rejected.
|
|
1493
1796
|
*/
|
|
1494
1797
|
rate_limit_per_recipient_per_minute?: number;
|
|
1495
1798
|
}
|
|
1496
1799
|
interface NotifyConfigHistory {
|
|
1800
|
+
/** Inbox-row retention in whole days, 1 to 3650 (default 30). */
|
|
1497
1801
|
history_ttl_days?: number;
|
|
1802
|
+
/** Receipt retention in whole days, 1 to 3650 (default 365). */
|
|
1498
1803
|
receipt_retention_days?: number;
|
|
1499
1804
|
}
|
|
1500
1805
|
interface NotifyConfigSecurity {
|
|
@@ -1509,8 +1814,12 @@ interface NotifyConfigSecurity {
|
|
|
1509
1814
|
mandatory_seal_categories?: string[];
|
|
1510
1815
|
}
|
|
1511
1816
|
/**
|
|
1512
|
-
* The account's outbound EVENT webhook — how a backend learns
|
|
1513
|
-
*
|
|
1817
|
+
* The account's outbound EVENT webhook — how a backend learns, without polling
|
|
1818
|
+
* for it, that a recipient signed, approved, denied, or replied
|
|
1819
|
+
* (`notify.signed`, `notify.approved`, `notify.denied`, `notify.replied`), and
|
|
1820
|
+
* how delivery to each recipient turned out (`notify.delivered`,
|
|
1821
|
+
* `notify.failed`, `notify.bounced`). Opening a notification emits no event:
|
|
1822
|
+
* read view receipts with `listReceipts`.
|
|
1514
1823
|
*
|
|
1515
1824
|
* Both fields are required before anything is sent: an unsigned event is not
|
|
1516
1825
|
* offered. `webhook_url` must be https on a public host (loopback, private,
|
|
@@ -1544,6 +1853,15 @@ interface NotifyConfig {
|
|
|
1544
1853
|
security: NotifyConfigSecurity;
|
|
1545
1854
|
/** Absent until the account configures an event webhook. */
|
|
1546
1855
|
events?: NotifyConfigEventsRead;
|
|
1856
|
+
/**
|
|
1857
|
+
* Who the organization's Notify email is from. `sending_domain` is the
|
|
1858
|
+
* organization's own domain its email is selected to go out from (as
|
|
1859
|
+
* `notify@{domain}`), or null for its handle under send.sv; `getEmailSender`
|
|
1860
|
+
* says whether it serves now.
|
|
1861
|
+
*/
|
|
1862
|
+
email: {
|
|
1863
|
+
sending_domain: string | null;
|
|
1864
|
+
};
|
|
1547
1865
|
/** Tombstoned entries are already dropped — a deleted category is simply gone. */
|
|
1548
1866
|
categories: Record<string, NotifyConfigCategory>;
|
|
1549
1867
|
}
|
|
@@ -1551,22 +1869,37 @@ interface NotifyConfig {
|
|
|
1551
1869
|
* A partial PATCH of the account's config overrides. Only the sections present are
|
|
1552
1870
|
* touched, and every field is validated server-side before any write.
|
|
1553
1871
|
*
|
|
1554
|
-
* `categories.<key>: null`
|
|
1555
|
-
*
|
|
1556
|
-
*
|
|
1557
|
-
*
|
|
1872
|
+
* `categories.<key>: null` DELETES a category. A seeded default's delete (say
|
|
1873
|
+
* `marketing`) is stored as a tombstone, which keeps the default from
|
|
1874
|
+
* re-appearing on the next merge; any other delete leaves no entry. Storing a
|
|
1875
|
+
* normal object under the same key later re-creates it. The reserved `security`
|
|
1876
|
+
* category can neither be removed nor made optional.
|
|
1558
1877
|
*/
|
|
1559
1878
|
interface NotifyConfigPatch {
|
|
1560
|
-
delivery?:
|
|
1879
|
+
delivery?: NotifyConfigDeliveryPatch;
|
|
1561
1880
|
reliability?: NotifyConfigReliability;
|
|
1562
1881
|
history?: NotifyConfigHistory;
|
|
1882
|
+
/** Admin only. */
|
|
1563
1883
|
security?: NotifyConfigSecurity;
|
|
1884
|
+
/** Admin only. */
|
|
1564
1885
|
events?: NotifyConfigEvents;
|
|
1886
|
+
/**
|
|
1887
|
+
* Admin only. `sending_domain`: one of the organization's own domains, its
|
|
1888
|
+
* ownership verified and its email sending ready, to send from as
|
|
1889
|
+
* `notify@{domain}`; null sends from the organization's handle,
|
|
1890
|
+
* `notify@{handle}.send.sv`. A domain the organization does not hold is
|
|
1891
|
+
* refused 404, one not ready for Notify 409 `DOMAIN_NOT_READY`
|
|
1892
|
+
* (`details: { domain, product: 'notify' }`), and a change past the
|
|
1893
|
+
* organization's hourly sending-domain selections 429.
|
|
1894
|
+
*/
|
|
1895
|
+
email?: {
|
|
1896
|
+
sending_domain?: string | null;
|
|
1897
|
+
};
|
|
1565
1898
|
categories?: Record<string, NotifyConfigCategory | null>;
|
|
1566
1899
|
}
|
|
1567
1900
|
/**
|
|
1568
|
-
* The stored override delta, tombstones included, because that is
|
|
1569
|
-
* merges onto. One value is held back: `events.secret` comes back as
|
|
1901
|
+
* The stored override delta, seeded-category tombstones included, because that is
|
|
1902
|
+
* what a write merges onto. One value is held back: `events.secret` comes back as
|
|
1570
1903
|
* `secret_set`, never the secret — a patch never has to resend it.
|
|
1571
1904
|
*/
|
|
1572
1905
|
type NotifyConfigOverrides = Omit<NotifyConfigPatch, 'events'> & {
|
|
@@ -1580,11 +1913,14 @@ interface NotifyConfigResponse {
|
|
|
1580
1913
|
/**
|
|
1581
1914
|
* Notify Product Module — the TENANT (sender) surface.
|
|
1582
1915
|
*
|
|
1583
|
-
* The counterpart to `sv.notify`: where that module is
|
|
1584
|
-
*
|
|
1585
|
-
*
|
|
1586
|
-
*
|
|
1587
|
-
*
|
|
1916
|
+
* The counterpart to `sv.notify`: where that module is SparkVault's own
|
|
1917
|
+
* first-party inbox, which a signed-in SparkVault user reads for the
|
|
1918
|
+
* notifications SparkVault delivered to them `in_app`, this one is the
|
|
1919
|
+
* account-scoped product surface a tenant's BACKEND drives — send, send
|
|
1920
|
+
* history, recall, sender-side inbox reads and state, send status, receipts,
|
|
1921
|
+
* the account's Notify config, and who its email is from.
|
|
1922
|
+
* A tenant reads its own recipients' feeds here (`getInbox`), never through
|
|
1923
|
+
* `sv.notify`. Every method maps to
|
|
1588
1924
|
* `/v1/products/notify/*` and is authorized by the caller's account, so the
|
|
1589
1925
|
* recipient is supplied explicitly rather than derived from a session.
|
|
1590
1926
|
*
|
|
@@ -1603,20 +1939,28 @@ interface NotifyConfigResponse {
|
|
|
1603
1939
|
*
|
|
1604
1940
|
* There is no preset endpoint — presets are a merge over the one send contract,
|
|
1605
1941
|
* so they are applied client-side and produce an ordinary `send` request. Caller
|
|
1606
|
-
* arguments
|
|
1607
|
-
* account config resolve the ladder per category.
|
|
1942
|
+
* arguments win over a preset's defaults wherever they state a value;
|
|
1943
|
+
* `channels` left unset lets the account config resolve the ladder per category.
|
|
1608
1944
|
*
|
|
1609
1945
|
* `alert` is the only plaintext preset: a non-confidential ping is read at a
|
|
1610
|
-
* glance rather than behind a tap-to-view link
|
|
1946
|
+
* glance rather than behind a tap-to-view link, on the account's ladder. The
|
|
1947
|
+
* other four seal, on the channels every organization's recipients are reached
|
|
1948
|
+
* on: `secureMessage` by email alone, `conversation`, `approval` and
|
|
1949
|
+
* `signatureRequest` in your Notify inbox (`in_app`) and then by email.
|
|
1611
1950
|
* `approval` and `signatureRequest` verify at `identifier`: pass
|
|
1612
1951
|
* `policy: { verificationLevel: 'passkey' }` explicitly when the audience is
|
|
1613
1952
|
* known to be enrolled.
|
|
1953
|
+
*
|
|
1954
|
+
* Every send in the process reads this one table, so it is frozen all the way
|
|
1955
|
+
* down; `buildNotifyPresetSend` hands back options of the caller's own.
|
|
1614
1956
|
*/
|
|
1615
1957
|
declare const NOTIFY_PRESETS: Readonly<Record<NotifyPresetName, NotifyPreset>>;
|
|
1616
1958
|
/**
|
|
1617
1959
|
* Merge a preset's bundle UNDER the caller's arguments, yielding ordinary send
|
|
1618
|
-
* options
|
|
1619
|
-
*
|
|
1960
|
+
* options: the Core API's own merge (`mergePresetSend`), so a preset sends the
|
|
1961
|
+
* same through either. Exported so a caller can inspect (or further adjust)
|
|
1962
|
+
* what a preset would send before sending it: the options are the caller's own,
|
|
1963
|
+
* so adjusting them never reaches the preset table or any other send.
|
|
1620
1964
|
*/
|
|
1621
1965
|
declare function buildNotifyPresetSend(preset: NotifyPresetName, options: NotifyPresetSendOptions): CreateNotifySendOptions;
|
|
1622
1966
|
declare class NotifyProductModule {
|
|
@@ -1626,8 +1970,28 @@ declare class NotifyProductModule {
|
|
|
1626
1970
|
* Send a notification: seal the content, mint one single-use SparkLink per
|
|
1627
1971
|
* recipient, and enqueue delivery across the resolved channel ladder.
|
|
1628
1972
|
*
|
|
1629
|
-
* `sendId` is the idempotency key. Replaying an existing one
|
|
1630
|
-
* send unchanged — never re-sealed, never
|
|
1973
|
+
* `sendId` is the idempotency key. Replaying an existing one with the same
|
|
1974
|
+
* request returns the stored send unchanged — never re-sealed, never
|
|
1975
|
+
* re-delivered — flagged `idempotent`; another request under it is refused 400
|
|
1976
|
+
* (`sendId` on `CreateNotifySendOptions`).
|
|
1977
|
+
*
|
|
1978
|
+
* The send speaks in your organization's name, and one that would email
|
|
1979
|
+
* someone goes out from your organization's own sender (`getEmailSender`) and
|
|
1980
|
+
* is admitted against your hourly share of sending capacity. Each refusal is
|
|
1981
|
+
* a thrown `SparkVaultError` whose `serviceCode` names it, made before
|
|
1982
|
+
* anything is sealed, charged or stored:
|
|
1983
|
+
*
|
|
1984
|
+
* | Status | `serviceCode` | `details` | Next |
|
|
1985
|
+
* | --- | --- | --- | --- |
|
|
1986
|
+
* | 403 | `NOTIFY_CHANNEL_NOT_AVAILABLE` | `{ field, channels }` | Name only `in_app` and `email` |
|
|
1987
|
+
* | 409 | `NOTIFY_SENDER_NAME_REQUIRED` | — | Name the organization in Settings |
|
|
1988
|
+
* | 409 | `NOTIFY_SENDER_NAME_RESERVED` | `{ reason: 'reserved_name' }` | Rename the organization |
|
|
1989
|
+
* | 409 | `HANDLE_REQUIRED` | `{ product: 'notify' }` | Choose the organization's handle in Company Settings |
|
|
1990
|
+
* | 429 | `NOTIFY_EMAIL_ADMISSION_LIMIT` | `{ limit, window: 'hour', resets_at }` | Wait `retryAfterMs`, then send |
|
|
1991
|
+
* | 503 | `EMAIL_SETUP_BUSY` | — | Retry the same send after `retryAfterMs` |
|
|
1992
|
+
* | 503 | `NOTIFY_EMAIL_CAPACITY_UNAVAILABLE` | — | Retry the same send |
|
|
1993
|
+
*
|
|
1994
|
+
* A replay is answered from the stored send and meets none of them again.
|
|
1631
1995
|
*
|
|
1632
1996
|
* @example
|
|
1633
1997
|
* const send = await sv.products.notify.send({
|
|
@@ -1653,7 +2017,7 @@ declare class NotifyProductModule {
|
|
|
1653
2017
|
/**
|
|
1654
2018
|
* Frictionless informational ping — no verification, view-only, delivered
|
|
1655
2019
|
* INLINE (plaintext) so it is read at a glance. Channels resolve from the
|
|
1656
|
-
* account config
|
|
2020
|
+
* account config, narrowed to the ones that render cleartext.
|
|
1657
2021
|
*
|
|
1658
2022
|
* @example
|
|
1659
2023
|
* await sv.products.notify.sendAlert({
|
|
@@ -1667,13 +2031,53 @@ declare class NotifyProductModule {
|
|
|
1667
2031
|
sendSecureMessage(options: NotifyPresetSendOptions): Promise<NotifySendResult>;
|
|
1668
2032
|
/** Two-way thread: identifier-verified reveal plus an encrypted reply. */
|
|
1669
2033
|
sendConversation(options: NotifyPresetSendOptions): Promise<NotifySendResult>;
|
|
1670
|
-
/**
|
|
2034
|
+
/**
|
|
2035
|
+
* High-stakes approve/deny, identifier-verified. Pass `policy.actionHash`, the
|
|
2036
|
+
* SHA-256 of the thing being approved, so the signed receipt attests to THAT:
|
|
2037
|
+
* without it the receipt binds a digest of the grant, which no hash of your
|
|
2038
|
+
* own copy can match.
|
|
2039
|
+
*
|
|
2040
|
+
* @example
|
|
2041
|
+
* const actionHash = createHash('sha256').update(canonicalWire).digest('hex');
|
|
2042
|
+
* await sv.products.notify.sendApproval({
|
|
2043
|
+
* sendId: `wire-approval-${wire.id}`,
|
|
2044
|
+
* recipients: [{ id: approver.svid, email: approver.email }],
|
|
2045
|
+
* content: { payload: `Approve ${wire.amount} to ${wire.payee}?` },
|
|
2046
|
+
* policy: { actionHash },
|
|
2047
|
+
* });
|
|
2048
|
+
*/
|
|
1671
2049
|
sendApproval(options: NotifyPresetSendOptions): Promise<NotifySendResult>;
|
|
1672
|
-
/**
|
|
2050
|
+
/**
|
|
2051
|
+
* Signature-on-delivery, identifier-verified. Pass `policy.actionHash`, the
|
|
2052
|
+
* SHA-256 of the document being signed, so the signed receipt attests to THAT
|
|
2053
|
+
* document.
|
|
2054
|
+
*
|
|
2055
|
+
* @example
|
|
2056
|
+
* await sv.products.notify.sendSignatureRequest({
|
|
2057
|
+
* sendId: `contract-${contract.id}`,
|
|
2058
|
+
* recipients: [{ email: signer.email }],
|
|
2059
|
+
* content: { payload: contractPdfBase64, contentType: 'application/pdf' },
|
|
2060
|
+
* policy: { actionHash: createHash('sha256').update(contractPdfBytes).digest('hex') },
|
|
2061
|
+
* });
|
|
2062
|
+
*/
|
|
1673
2063
|
sendSignatureRequest(options: NotifyPresetSendOptions): Promise<NotifySendResult>;
|
|
1674
2064
|
/**
|
|
1675
|
-
* Read one recipient's
|
|
1676
|
-
*
|
|
2065
|
+
* Read one recipient's feed in your Notify inbox, newest first: exactly the
|
|
2066
|
+
* notifications delivered to them `in_app`. The row IS the `in_app`
|
|
2067
|
+
* delivery: its ladder carries `in_app`, because the send named it or your
|
|
2068
|
+
* config resolved it and the recipient left In-app on for your site (a
|
|
2069
|
+
* `security` send crosses that switch), and it is listed when that step
|
|
2070
|
+
* runs: as the send fans out when `in_app` leads the ladder, and only when
|
|
2071
|
+
* the step comes due when it follows `email`. A notification whose ladder
|
|
2072
|
+
* carries no `in_app` (a send naming `email` alone, a recipient who switched
|
|
2073
|
+
* In-app off for your site on auth.sv on any send but a `security` one, one
|
|
2074
|
+
* their own preferences or block refused, one no channel reaches), one whose
|
|
2075
|
+
* `in_app` step has not delivered it (and never will once a stop ended its
|
|
2076
|
+
* ladder first), and the per-recipient ceiling's skip are status records
|
|
2077
|
+
* only: in no view, and a mark of one is refused as not found. A sealed row carries
|
|
2078
|
+
* the recipient's own pointer (`sparklink_code`, `pointer_url`) while its
|
|
2079
|
+
* grant still opens, never the content; a plaintext row carries its body.
|
|
2080
|
+
* Treat the answer as sensitive and keep it out of logs.
|
|
1677
2081
|
*
|
|
1678
2082
|
* A page can come back SHORT of `limit` yet still carry a non-null cursor —
|
|
1679
2083
|
* follow the cursor; never treat a short page as the end.
|
|
@@ -1687,8 +2091,9 @@ declare class NotifyProductModule {
|
|
|
1687
2091
|
getInbox(options: ListNotifyInboxOptions): Promise<ListNotifyInboxResponse>;
|
|
1688
2092
|
/**
|
|
1689
2093
|
* Apply a terminal display state to one row (idempotent). `createdAt` MUST be
|
|
1690
|
-
* the row's own `created_at`, round-tripped from the feed
|
|
1691
|
-
*
|
|
2094
|
+
* the row's own `created_at`, round-tripped from the feed row — the id alone
|
|
2095
|
+
* cannot address the row. Any mark (seen, read or archived) marks the row seen,
|
|
2096
|
+
* which stops its escalation.
|
|
1692
2097
|
*
|
|
1693
2098
|
* @example
|
|
1694
2099
|
* await sv.products.notify.markInboxState(row.notification_id, {
|
|
@@ -1721,6 +2126,7 @@ declare class NotifyProductModule {
|
|
|
1721
2126
|
* `getSendStatus(sendId)` for the per-recipient detail.
|
|
1722
2127
|
*
|
|
1723
2128
|
* Real pagination: a null `cursor` means the end of the account's history.
|
|
2129
|
+
* A delivery counter is null until its first increment, so it reads 0 there.
|
|
1724
2130
|
*
|
|
1725
2131
|
* @example
|
|
1726
2132
|
* let cursor: string | undefined;
|
|
@@ -1728,7 +2134,7 @@ declare class NotifyProductModule {
|
|
|
1728
2134
|
* const page = await sv.products.notify.listSends({ cursor, limit: 50 });
|
|
1729
2135
|
* for (const send of page.sends) {
|
|
1730
2136
|
* console.log(send.created_at, send.title, send.state,
|
|
1731
|
-
* `${send.delivered_count ??
|
|
2137
|
+
* `${send.delivered_count ?? 0} / ${send.recipient_count ?? '?'}`);
|
|
1732
2138
|
* }
|
|
1733
2139
|
* cursor = page.cursor ?? undefined;
|
|
1734
2140
|
* } while (cursor);
|
|
@@ -1740,8 +2146,9 @@ declare class NotifyProductModule {
|
|
|
1740
2146
|
*
|
|
1741
2147
|
* `mode: 'grant'` (the default) drops access and leaves the content intact.
|
|
1742
2148
|
* `mode: 'content'` hard-burns the sealed spark so it is unreadable for
|
|
1743
|
-
* everyone — spark-backed sends only
|
|
1744
|
-
* owner's durable vault content
|
|
2149
|
+
* everyone — spark-backed sends only: an ingot send merely references the
|
|
2150
|
+
* owner's durable vault content, so a content recall of one is a 400, refused
|
|
2151
|
+
* before anything is revoked or stopped.
|
|
1745
2152
|
*
|
|
1746
2153
|
* Idempotent: a grant already revoked (or already consumed) counts as recalled,
|
|
1747
2154
|
* so a repeated call converges rather than accumulating failures. One
|
|
@@ -1764,17 +2171,19 @@ declare class NotifyProductModule {
|
|
|
1764
2171
|
recallSend(sendId: string, options?: RecallNotifySendOptions): Promise<RecallNotifySendResponse>;
|
|
1765
2172
|
/**
|
|
1766
2173
|
* The sender's per-recipient delivery rollup for one send: who it reached and
|
|
1767
|
-
* how far each recipient got. Metadata only — never the pointer
|
|
2174
|
+
* how far each recipient got. Metadata only — never the pointer, and no contact
|
|
2175
|
+
* beyond the handle each recipient was addressed by (`recipient_id`).
|
|
1768
2176
|
*
|
|
1769
2177
|
* @example
|
|
1770
2178
|
* const { counts } = await sv.products.notify.getSendStatus(send.send_id);
|
|
1771
2179
|
*/
|
|
1772
2180
|
getSendStatus(sendId: string): Promise<NotifySendStatus>;
|
|
1773
2181
|
/**
|
|
1774
|
-
* The account's verified-interaction receipts (portable,
|
|
1775
|
-
*
|
|
1776
|
-
*
|
|
1777
|
-
* it is null before
|
|
2182
|
+
* The account's verified-interaction receipts (a ceremony's carries portable,
|
|
2183
|
+
* JWKS-verifiable proof; an open's is an unsigned access record), newest
|
|
2184
|
+
* first, with real pagination. An `interaction` filter can hand back a short
|
|
2185
|
+
* or empty page while more follow, so follow `cursor` until it is null before
|
|
2186
|
+
* concluding there are none.
|
|
1778
2187
|
*
|
|
1779
2188
|
* @example
|
|
1780
2189
|
* const { receipts, cursor } = await sv.products.notify.listReceipts({ interaction: 'approve' });
|
|
@@ -1782,9 +2191,9 @@ declare class NotifyProductModule {
|
|
|
1782
2191
|
listReceipts(options?: ListNotifyReceiptsOptions): Promise<ListNotifyReceiptsResponse>;
|
|
1783
2192
|
/**
|
|
1784
2193
|
* Every receipt for one send, each attached to the recipient who produced it.
|
|
1785
|
-
* The
|
|
1786
|
-
*
|
|
1787
|
-
* to resume
|
|
2194
|
+
* The walk reads the account's receipts back to the send's creation, and no
|
|
2195
|
+
* further. One call is bounded: when `truncated` is true it stopped first —
|
|
2196
|
+
* pass the returned `cursor` back in to resume exactly where it stopped.
|
|
1788
2197
|
*
|
|
1789
2198
|
* @example
|
|
1790
2199
|
* const all: NotifySendReceipt[] = [];
|
|
@@ -1820,6 +2229,14 @@ declare class NotifyProductModule {
|
|
|
1820
2229
|
* body as `X-SparkVault-Signature: hex(HMAC-SHA256(secret, rawBody))`. The
|
|
1821
2230
|
* secret is WRITE-ONLY — reads report `events.secret_set`, never the value.
|
|
1822
2231
|
*
|
|
2232
|
+
* The `email` section selects a domain of your own for your Notify email to go
|
|
2233
|
+
* out from. `security`, `events` and `email` are an org admin's to change: a
|
|
2234
|
+
* patch from anyone else naming one is refused whole, 403 `FORBIDDEN`
|
|
2235
|
+
* (`details: { sections, required_role: 'admin' }`). A ladder naming a channel
|
|
2236
|
+
* other than `in_app` and `email` is refused 403 `NOTIFY_CHANNEL_NOT_AVAILABLE`
|
|
2237
|
+
* (`details: { field, channels }`); a save that overlapping saves kept
|
|
2238
|
+
* outracing is refused 409 `CONFLICT`: reload and patch again.
|
|
2239
|
+
*
|
|
1823
2240
|
* @example
|
|
1824
2241
|
* await sv.products.notify.updateConfig({
|
|
1825
2242
|
* categories: {
|
|
@@ -1833,6 +2250,45 @@ declare class NotifyProductModule {
|
|
|
1833
2250
|
* });
|
|
1834
2251
|
*/
|
|
1835
2252
|
updateConfig(patch: NotifyConfigPatch): Promise<NotifyConfigResponse>;
|
|
2253
|
+
/**
|
|
2254
|
+
* Who your organization's Notify email is from, as the API answers it
|
|
2255
|
+
* (verbatim snake_case): `"{organization name}" <from_address>`, with a
|
|
2256
|
+
* notice naming SparkVault Notify. A reply reaches no one when the email goes
|
|
2257
|
+
* out from the handle host, or from a domain of your own that is set up as a
|
|
2258
|
+
* help-desk web host or receives the help desk's email; from a domain that
|
|
2259
|
+
* only sends, a reply goes wherever that domain's own MX records route it.
|
|
2260
|
+
*
|
|
2261
|
+
* - `ready`: the email goes out from `from_address`, on `sending_host`: the
|
|
2262
|
+
* domain `email.sending_domain` selects while it serves sending (its
|
|
2263
|
+
* ownership verified and its sending ready), else the organization's handle
|
|
2264
|
+
* host under send.sv, `handle_host`, which it falls back to the moment the
|
|
2265
|
+
* domain stops serving.
|
|
2266
|
+
* - `handle_required`: the organization has not chosen its handle, so a send
|
|
2267
|
+
* that would email someone is refused 409 `HANDLE_REQUIRED` until it does.
|
|
2268
|
+
* - `platform_sender`: SparkVault's own account, whose Notify email is
|
|
2269
|
+
* platform mail.
|
|
2270
|
+
*
|
|
2271
|
+
* `domain_readiness` is the selected domain's readiness flags, null with no
|
|
2272
|
+
* selection or while the organization does not hold the domain's claim.
|
|
2273
|
+
*
|
|
2274
|
+
* @example
|
|
2275
|
+
* const sender = await sv.products.notify.getEmailSender();
|
|
2276
|
+
* if (sender.state === 'handle_required') promptForHandle();
|
|
2277
|
+
*/
|
|
2278
|
+
getEmailSender(): Promise<{
|
|
2279
|
+
state: 'ready' | 'handle_required' | 'platform_sender';
|
|
2280
|
+
from_address: string | null;
|
|
2281
|
+
handle_host: string | null;
|
|
2282
|
+
sending_domain: string | null;
|
|
2283
|
+
sending_host: string | null;
|
|
2284
|
+
domain_readiness: {
|
|
2285
|
+
email_sending_ready: boolean;
|
|
2286
|
+
email_receiving_ready: boolean;
|
|
2287
|
+
web_ready: boolean;
|
|
2288
|
+
help_desk_selectable: boolean;
|
|
2289
|
+
notify_selectable: boolean;
|
|
2290
|
+
} | null;
|
|
2291
|
+
}>;
|
|
1836
2292
|
}
|
|
1837
2293
|
|
|
1838
2294
|
/**
|
|
@@ -1934,9 +2390,12 @@ interface UploadOptions {
|
|
|
1934
2390
|
*/
|
|
1935
2391
|
file?: File;
|
|
1936
2392
|
/**
|
|
1937
|
-
* Vault Access Token
|
|
1938
|
-
*
|
|
1939
|
-
* is
|
|
2393
|
+
* Vault Access Token, sent only on the upload's POST, where it supplies the
|
|
2394
|
+
* vault key in place of the System DVAK the widget setting provisions; a
|
|
2395
|
+
* read-only VAT is refused 403. It does not lift the vault's Embedded Upload
|
|
2396
|
+
* Widget setting: the widget opens by reading the vault's upload info, a
|
|
2397
|
+
* request that carries no VAT and is refused (UPLOAD_SOURCE_DISABLED) while
|
|
2398
|
+
* the setting is off.
|
|
1940
2399
|
*/
|
|
1941
2400
|
token?: string;
|
|
1942
2401
|
/**
|
|
@@ -1944,11 +2403,11 @@ interface UploadOptions {
|
|
|
1944
2403
|
* Missing path segments are find-or-created. Omitted means the vault root.
|
|
1945
2404
|
*/
|
|
1946
2405
|
folder?: string;
|
|
1947
|
-
/** Callback when upload completes successfully
|
|
2406
|
+
/** Callback when upload completes successfully */
|
|
1948
2407
|
onSuccess?: (result: UploadResult) => void;
|
|
1949
|
-
/** Callback when an error occurs
|
|
2408
|
+
/** Callback when an error occurs */
|
|
1950
2409
|
onError?: (error: Error) => void;
|
|
1951
|
-
/** Callback when user cancels
|
|
2410
|
+
/** Callback when user cancels */
|
|
1952
2411
|
onCancel?: () => void;
|
|
1953
2412
|
/** Callback for upload progress */
|
|
1954
2413
|
onProgress?: (progress: UploadProgress) => void;
|
|
@@ -1998,7 +2457,7 @@ interface UploadResult {
|
|
|
1998
2457
|
filename: string;
|
|
1999
2458
|
/** File size in bytes */
|
|
2000
2459
|
sizeBytes: number;
|
|
2001
|
-
/** Upload
|
|
2460
|
+
/** Upload time in UTC, as "YYYY-MM-DD HH:MM:SS UTC" */
|
|
2002
2461
|
uploadTime: string;
|
|
2003
2462
|
}
|
|
2004
2463
|
|
|
@@ -2116,7 +2575,8 @@ declare class VaultsModule {
|
|
|
2116
2575
|
/** Cancel this exact deletion schedule before its deadline; company admins only. */
|
|
2117
2576
|
cancelDeletion(vaultId: string, deletionScheduleId: string): Promise<VaultDetail>;
|
|
2118
2577
|
/**
|
|
2119
|
-
* Get a vault's public-sharing configuration.
|
|
2578
|
+
* Get a vault's public-sharing configuration. Every sharing write below
|
|
2579
|
+
* answers the same configuration as that write left it.
|
|
2120
2580
|
*
|
|
2121
2581
|
* @example
|
|
2122
2582
|
* const sharing = await sv.vaults.getSharingConfig('vlt_abc');
|
|
@@ -2166,7 +2626,9 @@ declare class VaultsModule {
|
|
|
2166
2626
|
*/
|
|
2167
2627
|
updateAccessLogRetention(vaultId: string, seconds: number): Promise<AccessLogRetention>;
|
|
2168
2628
|
/**
|
|
2169
|
-
* Get a vault's upload-channel configuration.
|
|
2629
|
+
* Get a vault's upload-channel configuration. Every upload write below
|
|
2630
|
+
* answers the same configuration as that write left it: both channels, the
|
|
2631
|
+
* shared settings, and the portal's URL while the portal is on.
|
|
2170
2632
|
*
|
|
2171
2633
|
* @example
|
|
2172
2634
|
* const upload = await sv.vaults.getUploadConfig('vlt_abc');
|
|
@@ -2506,9 +2968,12 @@ interface ListIngotsOptions {
|
|
|
2506
2968
|
limit?: number;
|
|
2507
2969
|
/** Pagination cursor */
|
|
2508
2970
|
cursor?: string;
|
|
2509
|
-
/**
|
|
2971
|
+
/**
|
|
2972
|
+
* Sort field (name | size | content_type | created | access_count): it
|
|
2973
|
+
* orders only the page answered, never the list across pages
|
|
2974
|
+
*/
|
|
2510
2975
|
sortBy?: string;
|
|
2511
|
-
/** Sort direction */
|
|
2976
|
+
/** Sort direction of the page */
|
|
2512
2977
|
sortOrder?: 'asc' | 'desc';
|
|
2513
2978
|
}
|
|
2514
2979
|
/** Options for listContents. */
|
|
@@ -2747,16 +3212,43 @@ declare class SparkVaultError extends Error {
|
|
|
2747
3212
|
* carried none the policy could read, or no answer arrived.
|
|
2748
3213
|
*/
|
|
2749
3214
|
readonly retryAfterMs: number | null;
|
|
2750
|
-
|
|
3215
|
+
/**
|
|
3216
|
+
* The machine-readable code the API answered with (`INVALID_CURSOR`,
|
|
3217
|
+
* `LICENSE_REQUIRED`), on every error the SDK's API client builds from a
|
|
3218
|
+
* refused call of a data-plane module (`vaults`, `ingots`, `folders`,
|
|
3219
|
+
* `sparks`, `entropy`, `notify`, `products.notify`); `api_error` when the
|
|
3220
|
+
* answer named none (a gateway's HTML). A typed refusal's `code` names its
|
|
3221
|
+
* class of failure: one per 400 (`validation_error`), two per 401
|
|
3222
|
+
* (`authentication_error`, `UNAUTHORIZED`), 402 (`PLAN_REQUIRED`,
|
|
3223
|
+
* `QUOTA_EXCEEDED`) and 403 (`authorization_error`, `NOTIFY_SUBSCRIPTION_REQUIRED`;
|
|
3224
|
+
* http.ts createErrorFromResponse), so this is what tells apart two
|
|
3225
|
+
* refusals that share a code.
|
|
3226
|
+
* Undefined on an error the SDK raised itself, on the Identity product's
|
|
3227
|
+
* errors (`products.identity`, whose `code` is the service's own), and on the
|
|
3228
|
+
* errors of an upload's transfer (`UploadApiError`, which names Core's code in
|
|
3229
|
+
* its `code` or `details.coreCode`, a staging call Core refused for good among
|
|
3230
|
+
* them) and of a download (`download_failed`, its status alone).
|
|
3231
|
+
*/
|
|
3232
|
+
readonly serviceCode?: string;
|
|
3233
|
+
constructor(message: string, code: string, statusCode?: number, details?: Record<string, unknown>, retryAfterMs?: number | null, serviceCode?: string);
|
|
2751
3234
|
}
|
|
2752
3235
|
declare class AuthenticationError extends SparkVaultError {
|
|
2753
|
-
constructor(message: string, details?: Record<string, unknown>, retryAfterMs?: number | null);
|
|
3236
|
+
constructor(message: string, details?: Record<string, unknown>, retryAfterMs?: number | null, serviceCode?: string);
|
|
3237
|
+
}
|
|
3238
|
+
/**
|
|
3239
|
+
* A key the request presents was refused (401 UNAUTHORIZED): the DVAK an
|
|
3240
|
+
* unseal names is invalid or revoked. The caller's own credential stood, so
|
|
3241
|
+
* this is no ended session, and signing in again changes nothing: present a
|
|
3242
|
+
* live key. Every other 401 is an {@link AuthenticationError}.
|
|
3243
|
+
*/
|
|
3244
|
+
declare class UnauthorizedError extends SparkVaultError {
|
|
3245
|
+
constructor(message: string, details?: Record<string, unknown>, retryAfterMs?: number | null, serviceCode?: string);
|
|
2754
3246
|
}
|
|
2755
3247
|
declare class AuthorizationError extends SparkVaultError {
|
|
2756
|
-
constructor(message: string, details?: Record<string, unknown>, retryAfterMs?: number | null);
|
|
3248
|
+
constructor(message: string, details?: Record<string, unknown>, retryAfterMs?: number | null, serviceCode?: string);
|
|
2757
3249
|
}
|
|
2758
3250
|
declare class ValidationError extends SparkVaultError {
|
|
2759
|
-
constructor(message: string, details?: Record<string, unknown>, retryAfterMs?: number | null);
|
|
3251
|
+
constructor(message: string, details?: Record<string, unknown>, retryAfterMs?: number | null, serviceCode?: string);
|
|
2760
3252
|
}
|
|
2761
3253
|
/**
|
|
2762
3254
|
* The pooled-capacity resource a quota gate refers to. Only the byte pools
|
|
@@ -2771,7 +3263,7 @@ type QuotaResource = 'storage' | 'bandwidth';
|
|
|
2771
3263
|
* to admins, or "ask your account admin" to members.
|
|
2772
3264
|
*/
|
|
2773
3265
|
declare class PlanRequiredError extends SparkVaultError {
|
|
2774
|
-
constructor(message: string, details?: Record<string, unknown>, retryAfterMs?: number | null);
|
|
3266
|
+
constructor(message: string, details?: Record<string, unknown>, retryAfterMs?: number | null, serviceCode?: string);
|
|
2775
3267
|
}
|
|
2776
3268
|
/**
|
|
2777
3269
|
* Quota exceeded gate (402 QUOTA_EXCEEDED) — a pooled-capacity limit is
|
|
@@ -2780,16 +3272,19 @@ declare class PlanRequiredError extends SparkVaultError {
|
|
|
2780
3272
|
*/
|
|
2781
3273
|
declare class QuotaExceededError extends SparkVaultError {
|
|
2782
3274
|
readonly resource?: QuotaResource;
|
|
2783
|
-
constructor(message: string, details?: Record<string, unknown>, retryAfterMs?: number | null);
|
|
3275
|
+
constructor(message: string, details?: Record<string, unknown>, retryAfterMs?: number | null, serviceCode?: string);
|
|
2784
3276
|
}
|
|
2785
3277
|
/**
|
|
2786
|
-
* Notify subscription gate (403 NOTIFY_SUBSCRIPTION_REQUIRED) — the account
|
|
2787
|
-
*
|
|
2788
|
-
*
|
|
2789
|
-
*
|
|
3278
|
+
* Notify subscription gate (403 NOTIFY_SUBSCRIPTION_REQUIRED) — the account
|
|
3279
|
+
* does not hold Notify and attempted a send that names no accepted send's
|
|
3280
|
+
* `sendId` (a replay of an accepted send, the same request under its `sendId`,
|
|
3281
|
+
* is answered with the stored send), or a config save that selects a new
|
|
3282
|
+
* `email.sending_domain`. Distinct from a generic authorization failure: the
|
|
3283
|
+
* credential is fine and re-authenticating changes nothing, so surface a
|
|
3284
|
+
* subscribe CTA rather than a sign-in prompt.
|
|
2790
3285
|
*/
|
|
2791
3286
|
declare class NotifySubscriptionRequiredError extends SparkVaultError {
|
|
2792
|
-
constructor(message: string, details?: Record<string, unknown>, retryAfterMs?: number | null);
|
|
3287
|
+
constructor(message: string, details?: Record<string, unknown>, retryAfterMs?: number | null, serviceCode?: string);
|
|
2793
3288
|
}
|
|
2794
3289
|
declare class NetworkError extends SparkVaultError {
|
|
2795
3290
|
constructor(message: string, details?: Record<string, unknown>);
|
|
@@ -2919,7 +3414,10 @@ declare class IngotsModule {
|
|
|
2919
3414
|
* `upload_received_publishing`: every byte is received, and the server
|
|
2920
3415
|
* finishes the publication on its own, so never upload the file again; a
|
|
2921
3416
|
* caller that kept the session (`onSessionCreated`) learns what became of
|
|
2922
|
-
* it with {@link resumeUpload}.
|
|
3417
|
+
* it with {@link resumeUpload}. A chunk's upload progress needs the
|
|
3418
|
+
* browser's XMLHttpRequest: where there is none (a Node server) it rejects
|
|
3419
|
+
* with code `environment_unsupported` before any request; a server sends
|
|
3420
|
+
* the bytes over tus to `uploadUrl` itself.
|
|
2923
3421
|
*
|
|
2924
3422
|
* @param options.signal - Cancels this transfer (it rejects with code
|
|
2925
3423
|
* `cancelled`); other transfers carry on.
|
|
@@ -2987,7 +3485,10 @@ declare class IngotsModule {
|
|
|
2987
3485
|
* any way but one the server received whole ({@link isReceivedUploadFailure}:
|
|
2988
3486
|
* the server publishes or ends that one on its own) is given up: the end of
|
|
2989
3487
|
* it with the file its create made ({@link endUpload}) starts as it
|
|
2990
|
-
* rejects, without holding up its own error.
|
|
3488
|
+
* rejects, without holding up its own error. It needs the browser's
|
|
3489
|
+
* XMLHttpRequest, as {@link sendUpload} does: in a server process it
|
|
3490
|
+
* rejects with code `environment_unsupported` before any request, so no
|
|
3491
|
+
* create stages an ingot it cannot send.
|
|
2991
3492
|
*
|
|
2992
3493
|
* @example
|
|
2993
3494
|
* const ingot = await sv.ingots.upload(unsealed, {
|
|
@@ -3004,7 +3505,8 @@ declare class IngotsModule {
|
|
|
3004
3505
|
/**
|
|
3005
3506
|
* Replace an existing ingot's content (high-level flow). Rejects as
|
|
3006
3507
|
* {@link upload} does, a replacement another upload of the same ingot
|
|
3007
|
-
* superseded included (`upload_refused`)
|
|
3508
|
+
* superseded included (`upload_refused`), and `environment_unsupported`
|
|
3509
|
+
* before the replacement is staged where there is no XMLHttpRequest.
|
|
3008
3510
|
*
|
|
3009
3511
|
* @example
|
|
3010
3512
|
* await sv.ingots.replace(unsealed, 'ing_abc', { file: updatedFile });
|
|
@@ -3040,7 +3542,9 @@ declare class IngotsModule {
|
|
|
3040
3542
|
*/
|
|
3041
3543
|
get(vault: UnsealedVault, ingotId: string): Promise<Ingot>;
|
|
3042
3544
|
/**
|
|
3043
|
-
* List ingots in an unsealed vault
|
|
3545
|
+
* List ingots in an unsealed vault, one page at a time in the vault index's
|
|
3546
|
+
* order: follow `nextCursor`. `sortBy` orders only the page answered; for
|
|
3547
|
+
* one order across a vault, search or list a folder's contents.
|
|
3044
3548
|
*
|
|
3045
3549
|
* @example
|
|
3046
3550
|
* const { ingots } = await sv.ingots.list(unsealed);
|
|
@@ -3598,11 +4102,16 @@ declare class EntropyModule {
|
|
|
3598
4102
|
/**
|
|
3599
4103
|
* Notify Module
|
|
3600
4104
|
*
|
|
3601
|
-
*
|
|
3602
|
-
*
|
|
3603
|
-
*
|
|
3604
|
-
* to
|
|
3605
|
-
*
|
|
4105
|
+
* SparkVault's first-party Notify surface: the metadata-only inbox of a user
|
|
4106
|
+
* signed in to SparkVault itself (a Core session JWT; an API key or an
|
|
4107
|
+
* identity-only token is refused), holding the notifications SparkVault
|
|
4108
|
+
* delivered to them `in_app`, plus this browser's Web Push registration. It is
|
|
4109
|
+
* not a tenant's inbox for its own end users: a tenant reads its recipients'
|
|
4110
|
+
* feeds with `sv.products.notify.getInbox`. The recipient is ALWAYS derived
|
|
4111
|
+
* from the session on the server — no method takes a `recipient_id`, and any
|
|
4112
|
+
* account/recipient a caller might try to supply is ignored. This mirrors
|
|
4113
|
+
* `@sparkvault/sdk-mobile`'s notify client; device push registration is
|
|
4114
|
+
* intentionally omitted (Expo-only on mobile).
|
|
3606
4115
|
*/
|
|
3607
4116
|
|
|
3608
4117
|
declare class NotifyModule {
|
|
@@ -3674,6 +4183,24 @@ declare class NotifyModule {
|
|
|
3674
4183
|
* enable-notifications affordance while false.
|
|
3675
4184
|
*/
|
|
3676
4185
|
getWebPushKey(): Promise<WebPushKeyResponse>;
|
|
4186
|
+
/**
|
|
4187
|
+
* The VAPID public key the server signs every push with, as the bytes a
|
|
4188
|
+
* browser subscription is bound to; null while no keypair is provisioned.
|
|
4189
|
+
*/
|
|
4190
|
+
private serverKey;
|
|
4191
|
+
/**
|
|
4192
|
+
* This browser's Web Push state, read without prompting, subscribing or
|
|
4193
|
+
* registering anything: `subscribed` only when the browser holds a
|
|
4194
|
+
* subscription made for the key the server signs with now. One made for
|
|
4195
|
+
* another key reads `not_subscribed`: its push service refuses every push
|
|
4196
|
+
* signed with the current key, and `subscribeWebPush` replaces it. Read it to
|
|
4197
|
+
* show whether this browser's notifications are on.
|
|
4198
|
+
*
|
|
4199
|
+
* @example
|
|
4200
|
+
* const registration = await navigator.serviceWorker.getRegistration();
|
|
4201
|
+
* const { status } = await sv.notify.getWebPushStatus({ serviceWorkerRegistration: registration });
|
|
4202
|
+
*/
|
|
4203
|
+
getWebPushStatus(options?: WebPushStatusOptions): Promise<WebPushStatusResult>;
|
|
3677
4204
|
/**
|
|
3678
4205
|
* Register (or refresh) a browser push subscription for the signed-in user.
|
|
3679
4206
|
* Accepts a live PushSubscription or its JSON shape.
|
|
@@ -3689,11 +4216,31 @@ declare class NotifyModule {
|
|
|
3689
4216
|
* permission denied) so a host can branch on the outcome. Call it from a user
|
|
3690
4217
|
* gesture (permission prompts require one).
|
|
3691
4218
|
*
|
|
4219
|
+
* A subscription the browser holds for the current key is kept
|
|
4220
|
+
* (`already_subscribed`); one made for a previous key can never deliver
|
|
4221
|
+
* again, so it is removed and replaced (`subscribed`). Enabling again is
|
|
4222
|
+
* therefore how a browser recovers after the platform's key changes, and
|
|
4223
|
+
* `getWebPushStatus` reads such a browser as `not_subscribed` until it does.
|
|
4224
|
+
*
|
|
3692
4225
|
* @example
|
|
3693
4226
|
* const reg = await navigator.serviceWorker.register('/sw.js');
|
|
3694
4227
|
* const { status } = await sv.notify.subscribeWebPush({ serviceWorkerRegistration: reg });
|
|
3695
4228
|
*/
|
|
3696
4229
|
subscribeWebPush(options: SubscribeWebPushOptions): Promise<SubscribeWebPushResult>;
|
|
4230
|
+
/**
|
|
4231
|
+
* Retire a browser subscription bound to a key the server no longer signs
|
|
4232
|
+
* with: the server forgets its endpoint first (still authenticated, and the
|
|
4233
|
+
* push service would otherwise refuse that endpoint's every push without it
|
|
4234
|
+
* ever being pruned), then the browser drops it, which a subscribe against the
|
|
4235
|
+
* new key needs. A failure stops here with nothing half-done, so enabling
|
|
4236
|
+
* again starts from the same state.
|
|
4237
|
+
*
|
|
4238
|
+
* `unsubscribe()` resolves false only when the subscription is already gone
|
|
4239
|
+
* (another tab dropped it first), which leaves the browser as a subscribe
|
|
4240
|
+
* needs it; a browser that kept one refuses that subscribe outright
|
|
4241
|
+
* (InvalidStateError), so a kept subscription is never reused unseen.
|
|
4242
|
+
*/
|
|
4243
|
+
private dropDeadSubscription;
|
|
3697
4244
|
/**
|
|
3698
4245
|
* Disable Web Push on this device: unsubscribe the browser subscription and
|
|
3699
4246
|
* remove it server-side. Safe to call when not subscribed (returns false).
|
|
@@ -3778,7 +4325,11 @@ declare class SparkVault {
|
|
|
3778
4325
|
readonly sparks: SparksModule;
|
|
3779
4326
|
/** Hardware-backed random generation. */
|
|
3780
4327
|
readonly entropy: EntropyModule;
|
|
3781
|
-
/**
|
|
4328
|
+
/**
|
|
4329
|
+
* SparkVault's first-party notification inbox, for a user signed in to
|
|
4330
|
+
* SparkVault itself. A tenant reads its own recipients' feeds through
|
|
4331
|
+
* `products.notify`.
|
|
4332
|
+
*/
|
|
3782
4333
|
readonly notify: NotifyModule;
|
|
3783
4334
|
/** API availability checks. */
|
|
3784
4335
|
readonly health: HealthModule;
|
|
@@ -3815,5 +4366,5 @@ declare global {
|
|
|
3815
4366
|
}
|
|
3816
4367
|
}
|
|
3817
4368
|
|
|
3818
|
-
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, UserCancelledError, ValidationError, VaultsModule, buildNotifyPresetSend, SparkVault as default, fetchDownload, isReceivedUploadFailure, logger, setDebugMode };
|
|
3819
|
-
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, 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, UploadEnd, UploadIngotOptions, UploadOptions, UploadProgress, UploadResult, UploadSession, Vault, VaultDetail, VaultLifecycle, VaultSharingConfig, VaultSharingOptions, VaultSummary, VaultUploadConfig, VaultUploadSettings, VerifyOptions, VerifyResult, WebPushKeyResponse, WebPushSubscriptionInput };
|
|
4369
|
+
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 };
|
|
4370
|
+
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, SubscribeWebPushOptions, SubscribeWebPushResult, SubscribeWebPushStatus, TokenClaims, 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 };
|