@sparkvault/sdk-js 8.14.0 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -5
- package/dist/config.d.ts +6 -4
- package/dist/{sparkvault.cjs.js → index.cjs} +245 -35
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +341 -32
- package/dist/{sparkvault.esm.js → index.mjs} +245 -35
- package/dist/index.mjs.map +1 -0
- package/dist/products/identity/index.d.ts +13 -2
- package/dist/products/identity/types.d.ts +8 -0
- package/dist/products/index.d.ts +1 -1
- package/dist/products/notify/index.d.ts +72 -11
- package/dist/products/notify/types.d.ts +243 -16
- package/dist/sparkvault.js +1 -1
- package/dist/sparkvault.js.map +1 -1
- package/package.json +17 -6
- package/dist/sparkvault.cjs.js.map +0 -1
- package/dist/sparkvault.esm.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -24,10 +24,12 @@ interface SparkVaultConfig {
|
|
|
24
24
|
/** Request timeout in milliseconds (default: 30000) */
|
|
25
25
|
timeout?: number;
|
|
26
26
|
/**
|
|
27
|
-
* Preload Identity configuration on SDK init (default: true
|
|
28
|
-
* When enabled, the /config call is made immediately when the
|
|
29
|
-
* so verify() opens instantly without waiting for the config
|
|
30
|
-
*
|
|
27
|
+
* Preload Identity configuration on SDK init (default: true in a browser,
|
|
28
|
+
* false off-DOM). When enabled, the /config call is made immediately when the
|
|
29
|
+
* SDK initializes, so verify() opens instantly without waiting for the config
|
|
30
|
+
* fetch. It buys nothing in a server process — there is no dialog to open —
|
|
31
|
+
* so a Node host does not pay for a network call it will never use.
|
|
32
|
+
* Set explicitly to override in either direction.
|
|
31
33
|
*/
|
|
32
34
|
preloadConfig?: boolean;
|
|
33
35
|
/** Enable backdrop blur on dialogs (default: true) */
|
|
@@ -193,6 +195,12 @@ interface VerifyOptions {
|
|
|
193
195
|
* hosts that prefer a full-page redirect over a popup on mobile.
|
|
194
196
|
*/
|
|
195
197
|
flow?: 'auto' | 'popup' | 'redirect';
|
|
198
|
+
/**
|
|
199
|
+
* `'select_account'` always shows the sign-in page's account chooser instead
|
|
200
|
+
* of silently continuing as the current account — even when only one saved
|
|
201
|
+
* account exists. Any other value is dropped at URL serialization.
|
|
202
|
+
*/
|
|
203
|
+
prompt?: 'select_account';
|
|
196
204
|
/**
|
|
197
205
|
* Rendering strategy (internal). `'local'` renders the flow directly in this
|
|
198
206
|
* document — used inside the popup that runs the flow, and forced for inline
|
|
@@ -215,6 +223,8 @@ interface AttachOptions {
|
|
|
215
223
|
phone?: string;
|
|
216
224
|
/** Auth context for OIDC/simple mode flows */
|
|
217
225
|
authContext?: AuthContext;
|
|
226
|
+
/** `'select_account'` always shows the account chooser (see `VerifyOptions.prompt`) */
|
|
227
|
+
prompt?: 'select_account';
|
|
218
228
|
/** Called when user cancels */
|
|
219
229
|
onCancel?: () => void;
|
|
220
230
|
/** Called when verification completes */
|
|
@@ -552,13 +562,24 @@ declare class IdentityModule {
|
|
|
552
562
|
* session storage or WebCrypto is unavailable so callers can degrade.
|
|
553
563
|
*/
|
|
554
564
|
private prepareHandoffNavigation;
|
|
565
|
+
/**
|
|
566
|
+
* Arm the self-heal marker for an in-flight sign-in. `hint` is the identifier
|
|
567
|
+
* (email or phone) the sign-in was started with, when the caller supplied
|
|
568
|
+
* one — the recovery bounce forwards it as the /sso `login_hint`, so with
|
|
569
|
+
* several hub sessions recovery re-mints the account this sign-in was for,
|
|
570
|
+
* never a different one.
|
|
571
|
+
*/
|
|
555
572
|
private markSignInPending;
|
|
556
573
|
private clearSignInPending;
|
|
557
|
-
/**
|
|
574
|
+
/**
|
|
575
|
+
* Consume the pending marker: `fresh` is true once (then cleared) if a recent
|
|
576
|
+
* sign-in is still awaiting its result; `hint` is the identifier that sign-in
|
|
577
|
+
* carried, for the recovery bounce's `login_hint`.
|
|
578
|
+
*/
|
|
558
579
|
private consumeSignInPending;
|
|
559
580
|
/** Remove the result fragment from the URL bar (and history entry). */
|
|
560
581
|
private clearUrlFragment;
|
|
561
|
-
/** Drop the one-shot PKCE state/verifier a
|
|
582
|
+
/** Drop the one-shot PKCE state/verifier (+ recovery hint) a bounce staged. */
|
|
562
583
|
private clearOneShotAuthState;
|
|
563
584
|
private consumeRedirectResult;
|
|
564
585
|
/**
|
|
@@ -773,8 +794,20 @@ type NotifyChannel = 'in_app' | 'websocket' | 'email' | 'sms' | 'push' | 'web_pu
|
|
|
773
794
|
* allowed on a confidential category.
|
|
774
795
|
*/
|
|
775
796
|
type NotifyDeliveryMode = 'sealed' | 'plaintext';
|
|
776
|
-
/**
|
|
777
|
-
|
|
797
|
+
/**
|
|
798
|
+
* What a recipient must prove before the SparkLink reveals its content.
|
|
799
|
+
*
|
|
800
|
+
* Three levels, because three is what the Identity ceremony can achieve, and the
|
|
801
|
+
* bar is enforced on the method the recipient ACHIEVED — a passkey-level grant is
|
|
802
|
+
* never satisfied by an identifier session. A level the reveal cannot satisfy is
|
|
803
|
+
* not a stronger guarantee; it is a send nobody can open.
|
|
804
|
+
*
|
|
805
|
+
* `identifier` is the platform default for a sealed send: unset here, the
|
|
806
|
+
* account config's `security.verification_level` applies, and it ships as
|
|
807
|
+
* `identifier` rather than `none` because a sealed pointer under no verification
|
|
808
|
+
* is a bearer token.
|
|
809
|
+
*/
|
|
810
|
+
type NotifyVerificationLevel = 'none' | 'identifier' | 'passkey';
|
|
778
811
|
/** What the recipient does at the reveal — the interaction the receipt attests to. */
|
|
779
812
|
type NotifyInteraction = 'view' | 'acknowledge' | 'sign' | 'approve' | 'reply';
|
|
780
813
|
/**
|
|
@@ -861,7 +894,15 @@ interface CreateNotifySendOptions {
|
|
|
861
894
|
escalation?: NotifyEscalation;
|
|
862
895
|
/** Channel-agnostic display title (rides the email subject). Truncated at 200 chars, never rejected. */
|
|
863
896
|
title?: string;
|
|
864
|
-
|
|
897
|
+
/**
|
|
898
|
+
* REQUIRED. The category this send is classified as — one of your configured
|
|
899
|
+
* `categories`, or a preset category. It decides the channel ladder, whether a
|
|
900
|
+
* recipient may mute it, and whether the mail carries an unsubscribe
|
|
901
|
+
* affordance, so the server rejects a send without one rather than guessing:
|
|
902
|
+
* defaulting an uncategorized send either way silently changes what the
|
|
903
|
+
* recipient consented to. The preset helpers stamp their own.
|
|
904
|
+
*/
|
|
905
|
+
category: NotifyCategory;
|
|
865
906
|
/** Free-form display type the tenant uses to classify the send. */
|
|
866
907
|
type?: string;
|
|
867
908
|
/**
|
|
@@ -941,13 +982,37 @@ interface MarkNotifyInboxAllResponse {
|
|
|
941
982
|
/** Next page, or null when the drain is complete. */
|
|
942
983
|
cursor: string | null;
|
|
943
984
|
}
|
|
985
|
+
/**
|
|
986
|
+
* The one answer for a recipient, derived from their row (never stored, so it
|
|
987
|
+
* cannot drift from the facts it summarizes).
|
|
988
|
+
*
|
|
989
|
+
* - `pending` — still in flight, or not yet driven.
|
|
990
|
+
* - `delivered` — a channel accepted it and no provider has repudiated that.
|
|
991
|
+
* - `undeliverable` — every channel attempted declined (no handle, bounced, not
|
|
992
|
+
* implemented). The recipient cannot be reached as addressed.
|
|
993
|
+
* - `failed` — a channel exhausted its retries. OUR transport gave up; the
|
|
994
|
+
* address may be perfectly good.
|
|
995
|
+
* - `suppressed` — the PERSON chose silence (site off, category muted, every
|
|
996
|
+
* offered channel opted out). Not a fault, and not something to route around.
|
|
997
|
+
* - `rate_limited` — skipped by the per-recipient abuse ceiling for that minute.
|
|
998
|
+
*/
|
|
999
|
+
type NotifyRecipientState = 'pending' | 'delivered' | 'undeliverable' | 'failed' | 'suppressed' | 'rate_limited';
|
|
944
1000
|
interface NotifySendStatusRecipient {
|
|
945
1001
|
recipient_id: string;
|
|
1002
|
+
/** The derived per-recipient state — the field to branch on. */
|
|
1003
|
+
state: NotifyRecipientState;
|
|
946
1004
|
/** True once the recipient's first delivery step was enqueued. */
|
|
947
1005
|
enqueued: boolean;
|
|
948
1006
|
seen_at: number | null;
|
|
949
1007
|
read_at: number | null;
|
|
950
1008
|
archived_at: number | null;
|
|
1009
|
+
/** When the recipient's own preference took them out of the ladder. */
|
|
1010
|
+
suppressed_at: number | null;
|
|
1011
|
+
/**
|
|
1012
|
+
* When the per-recipient ceiling skipped them. Cleared if a later fan-out
|
|
1013
|
+
* drives them, so it never outlives the skip it describes.
|
|
1014
|
+
*/
|
|
1015
|
+
rate_limited_at: number | null;
|
|
951
1016
|
/**
|
|
952
1017
|
* The latest dispatch outcome per attempted channel — the difference between a
|
|
953
1018
|
* notification that actually left the building and one whose every channel
|
|
@@ -956,7 +1021,15 @@ interface NotifySendStatusRecipient {
|
|
|
956
1021
|
* (and with it the recipient's raw contact), which this rollup never exposes.
|
|
957
1022
|
*/
|
|
958
1023
|
channel_outcomes: Partial<Record<NotifyChannel, {
|
|
959
|
-
outcome: 'delivered' | 'skipped' | 'not_implemented' | 'retryable'
|
|
1024
|
+
outcome: 'delivered' | 'skipped' | 'not_implemented' | 'retryable'
|
|
1025
|
+
/** The step exhausted its retries — terminal, unlike `retryable`. */
|
|
1026
|
+
| 'failed'
|
|
1027
|
+
/**
|
|
1028
|
+
* The provider repudiated a delivery it had accepted. It REPLACES the
|
|
1029
|
+
* channel's `delivered` entry: handing a message to SES was never
|
|
1030
|
+
* proof it reached a mailbox.
|
|
1031
|
+
*/
|
|
1032
|
+
| 'bounced';
|
|
960
1033
|
/** Epoch seconds the outcome was recorded. */
|
|
961
1034
|
at: number | null;
|
|
962
1035
|
/** Escalation step index the outcome came from. */
|
|
@@ -965,12 +1038,18 @@ interface NotifySendStatusRecipient {
|
|
|
965
1038
|
/** At least one channel accepted the notification for this recipient. */
|
|
966
1039
|
delivered: boolean;
|
|
967
1040
|
/**
|
|
968
|
-
* Every channel attempted for this recipient declined (`skipped
|
|
969
|
-
* `not_implemented`) and none delivered — a silent
|
|
970
|
-
* nothing has been attempted yet and while a
|
|
971
|
-
* flight.
|
|
1041
|
+
* Every channel attempted for this recipient declined (`skipped`,
|
|
1042
|
+
* `not_implemented`, or `bounced`) and none delivered — a silent
|
|
1043
|
+
* non-delivery. False while nothing has been attempted yet and while a
|
|
1044
|
+
* `retryable` attempt is still in flight.
|
|
972
1045
|
*/
|
|
973
1046
|
undeliverable: boolean;
|
|
1047
|
+
/**
|
|
1048
|
+
* Every attempt is terminal, nothing delivered, and at least one channel
|
|
1049
|
+
* exhausted its retries. Distinct from `undeliverable`: this one is a
|
|
1050
|
+
* transport problem on our side, not an address that cannot receive.
|
|
1051
|
+
*/
|
|
1052
|
+
failed: boolean;
|
|
974
1053
|
}
|
|
975
1054
|
interface NotifySendStatusCounts {
|
|
976
1055
|
total: number;
|
|
@@ -978,10 +1057,23 @@ interface NotifySendStatusCounts {
|
|
|
978
1057
|
seen: number;
|
|
979
1058
|
read: number;
|
|
980
1059
|
archived: number;
|
|
1060
|
+
/**
|
|
1061
|
+
* The six state counters below PARTITION the audience:
|
|
1062
|
+
* `pending + delivered + undeliverable + failed + suppressed + rate_limited === total`.
|
|
1063
|
+
* (`enqueued` / `seen` / `read` / `archived` are independent progress markers
|
|
1064
|
+
* and do not partition anything.)
|
|
1065
|
+
*/
|
|
1066
|
+
pending: number;
|
|
981
1067
|
/** Recipients with at least one `delivered` channel outcome. */
|
|
982
1068
|
delivered: number;
|
|
983
1069
|
/** Recipients whose every attempted channel declined — the silent-failure count. */
|
|
984
1070
|
undeliverable: number;
|
|
1071
|
+
/** Recipients whose ladder ended with a channel that exhausted its retries. */
|
|
1072
|
+
failed: number;
|
|
1073
|
+
/** Recipients who opted out. Never a failure. */
|
|
1074
|
+
suppressed: number;
|
|
1075
|
+
/** Recipients skipped by the per-recipient ceiling. */
|
|
1076
|
+
rate_limited: number;
|
|
985
1077
|
}
|
|
986
1078
|
/**
|
|
987
1079
|
* The sender's per-recipient delivery rollup. Metadata only by construction: it
|
|
@@ -990,7 +1082,24 @@ interface NotifySendStatusCounts {
|
|
|
990
1082
|
*/
|
|
991
1083
|
interface NotifySendStatus {
|
|
992
1084
|
send_id: string;
|
|
993
|
-
|
|
1085
|
+
/**
|
|
1086
|
+
* DERIVED, never stored — and by the SAME function the send-history list uses,
|
|
1087
|
+
* so a send cannot read one way in the list and another here.
|
|
1088
|
+
*
|
|
1089
|
+
* - `unknown` — no audience denominator, so no honest statement about "all
|
|
1090
|
+
* recipients" can be made.
|
|
1091
|
+
* - `pending` — accepted; nothing handed to delivery yet.
|
|
1092
|
+
* - `sending` — in flight.
|
|
1093
|
+
* - `delivered` — every recipient reached a channel that accepted.
|
|
1094
|
+
* - `partial` — every recipient resolved; some delivered, some did not.
|
|
1095
|
+
* - `failed` — every recipient resolved and none delivered.
|
|
1096
|
+
*
|
|
1097
|
+
* The list feeds it the send row's best-effort counters; this view recomputes
|
|
1098
|
+
* them from the authoritative per-recipient rows, so the list can lag but the
|
|
1099
|
+
* two can never contradict. For WHY a given recipient did not get it, read
|
|
1100
|
+
* that recipient's `state`.
|
|
1101
|
+
*/
|
|
1102
|
+
status: 'unknown' | 'pending' | 'sending' | 'delivered' | 'partial' | 'failed';
|
|
994
1103
|
channels: NotifyChannel[];
|
|
995
1104
|
created_at: number;
|
|
996
1105
|
title: string | null;
|
|
@@ -999,6 +1108,82 @@ interface NotifySendStatus {
|
|
|
999
1108
|
recipients: NotifySendStatusRecipient[];
|
|
1000
1109
|
counts: NotifySendStatusCounts;
|
|
1001
1110
|
}
|
|
1111
|
+
/**
|
|
1112
|
+
* A send's delivery state, DERIVED from its counters — the send row itself is
|
|
1113
|
+
* write-once, so there is no stored lifecycle to read.
|
|
1114
|
+
*
|
|
1115
|
+
* `failed` counts recipients whose every attempted channel declined, so
|
|
1116
|
+
* `delivered + failed` is how many have reached a terminal answer; a recipient
|
|
1117
|
+
* still climbing the escalation ladder is in neither, which is why an in-flight
|
|
1118
|
+
* send reads `sending` rather than being scored early.
|
|
1119
|
+
*
|
|
1120
|
+
* `unknown` means the row predates the counters: the state is genuinely not
|
|
1121
|
+
* knowable, and is reported as such rather than guessed at.
|
|
1122
|
+
*/
|
|
1123
|
+
type NotifySendState = 'unknown' | 'pending' | 'sending' | 'delivered' | 'partial' | 'failed';
|
|
1124
|
+
/**
|
|
1125
|
+
* One row of the account's send history. Metadata only: the audience is not
|
|
1126
|
+
* projected into the history index, so this shape cannot carry a recipient's
|
|
1127
|
+
* contact or the SparkLink pointer. Counters are `null` (never 0) on a send that
|
|
1128
|
+
* predates them — 0 delivered would report a failure that never happened.
|
|
1129
|
+
*/
|
|
1130
|
+
interface NotifySendSummary {
|
|
1131
|
+
send_id: string | null;
|
|
1132
|
+
/** Epoch seconds. */
|
|
1133
|
+
created_at: number | null;
|
|
1134
|
+
title: string | null;
|
|
1135
|
+
category: string | null;
|
|
1136
|
+
delivery: NotifyDeliveryMode | null;
|
|
1137
|
+
/** The sender name recipients saw. Display only — nothing routes on it. */
|
|
1138
|
+
display_sender_name: string | null;
|
|
1139
|
+
/** Audience size at accept — the denominator of the counters below. */
|
|
1140
|
+
recipient_count: number | null;
|
|
1141
|
+
enqueued_count: number | null;
|
|
1142
|
+
delivered_count: number | null;
|
|
1143
|
+
/** Recipients whose every attempted channel declined. */
|
|
1144
|
+
failed_count: number | null;
|
|
1145
|
+
state: NotifySendState;
|
|
1146
|
+
}
|
|
1147
|
+
interface ListNotifySendsOptions {
|
|
1148
|
+
/** Page size, 1-100 (server default 50). */
|
|
1149
|
+
limit?: number;
|
|
1150
|
+
cursor?: string;
|
|
1151
|
+
}
|
|
1152
|
+
interface ListNotifySendsResponse {
|
|
1153
|
+
sends: NotifySendSummary[];
|
|
1154
|
+
/** Next-page cursor, or null on the last page. This is a real key query: a full page means more may follow, a null cursor means the end. */
|
|
1155
|
+
cursor: string | null;
|
|
1156
|
+
}
|
|
1157
|
+
/**
|
|
1158
|
+
* Recall depth.
|
|
1159
|
+
* - `grant` (default): revoke the access grant; the content survives.
|
|
1160
|
+
* - `content`: hard-burn the sealed spark so the content is unreadable for
|
|
1161
|
+
* everyone, then drop the grant. Spark-backed sends only — an ingot send
|
|
1162
|
+
* references the owner's durable vault content and can only be grant-recalled.
|
|
1163
|
+
*/
|
|
1164
|
+
type NotifyRecallMode = 'grant' | 'content';
|
|
1165
|
+
interface RecallNotifySendOptions {
|
|
1166
|
+
/**
|
|
1167
|
+
* Recall only these recipients. OMIT to recall the whole audience — an empty
|
|
1168
|
+
* array is rejected rather than guessed at, because "nobody" and "everybody"
|
|
1169
|
+
* are both plausible readings of it on a destructive call.
|
|
1170
|
+
*/
|
|
1171
|
+
recipientIds?: string[];
|
|
1172
|
+
mode?: NotifyRecallMode;
|
|
1173
|
+
}
|
|
1174
|
+
interface RecallNotifySendResponse {
|
|
1175
|
+
send_id: string;
|
|
1176
|
+
mode: NotifyRecallMode;
|
|
1177
|
+
/** Grants revoked. An already-revoked grant counts here — recall is idempotent. */
|
|
1178
|
+
recalled: number;
|
|
1179
|
+
failed: number;
|
|
1180
|
+
/** Requested recipient ids that are not on this send's audience. */
|
|
1181
|
+
not_found: string[];
|
|
1182
|
+
failures: Array<{
|
|
1183
|
+
recipient_id: string;
|
|
1184
|
+
error: string;
|
|
1185
|
+
}>;
|
|
1186
|
+
}
|
|
1002
1187
|
/** The five verified-interaction receipt subtypes (SparkLink lifecycle events are not receipts). */
|
|
1003
1188
|
type NotifyReceiptEventType = 'sparklink_accessed' | 'sparklink_signed' | 'sparklink_approved' | 'sparklink_denied' | 'sparklink_replied';
|
|
1004
1189
|
/**
|
|
@@ -1007,7 +1192,7 @@ type NotifyReceiptEventType = 'sparklink_accessed' | 'sparklink_signed' | 'spark
|
|
|
1007
1192
|
* action. `link_code` is masked (`abc123***`) exactly as stored.
|
|
1008
1193
|
*/
|
|
1009
1194
|
interface NotifyReceipt {
|
|
1010
|
-
event_type: NotifyReceiptEventType;
|
|
1195
|
+
event_type: NotifyReceiptEventType | null;
|
|
1011
1196
|
occurred_at: number | null;
|
|
1012
1197
|
interaction: NotifyInteraction | null;
|
|
1013
1198
|
identity: string | null;
|
|
@@ -1021,7 +1206,19 @@ interface NotifyReceipt {
|
|
|
1021
1206
|
decision: string | null;
|
|
1022
1207
|
thread_id: string | null;
|
|
1023
1208
|
reply_spark_id: string | null;
|
|
1209
|
+
/**
|
|
1210
|
+
* The send whose grant produced this receipt, stamped at mint time — so it is
|
|
1211
|
+
* present for grants a Notify send created, and null for a standalone
|
|
1212
|
+
* SparkLink or a receipt served from the legacy audit walk.
|
|
1213
|
+
*/
|
|
1214
|
+
send_id: string | null;
|
|
1215
|
+
/** The send's display title, alongside `send_id` and under the same conditions. */
|
|
1216
|
+
title: string | null;
|
|
1217
|
+
/** The receipt row's own id. Null on the legacy source. */
|
|
1218
|
+
receipt_id: string | null;
|
|
1024
1219
|
}
|
|
1220
|
+
/** Which store answered a receipts listing (see `ListNotifyReceiptsResponse.source`). */
|
|
1221
|
+
type NotifyReceiptSource = 'receipt_index' | 'legacy_scan';
|
|
1025
1222
|
/** A receipt correlated to the recipient whose grant produced it. */
|
|
1026
1223
|
interface NotifySendReceipt extends NotifyReceipt {
|
|
1027
1224
|
recipient_id: string;
|
|
@@ -1036,12 +1233,26 @@ interface ListNotifyReceiptsOptions {
|
|
|
1036
1233
|
interface ListNotifyReceiptsResponse {
|
|
1037
1234
|
receipts: NotifyReceipt[];
|
|
1038
1235
|
/**
|
|
1039
|
-
* Next-page cursor, or null on the last page. A page can
|
|
1040
|
-
*
|
|
1041
|
-
*
|
|
1042
|
-
*
|
|
1236
|
+
* Next-page cursor, or null on the last page. A page can still come back SHORT
|
|
1237
|
+
* of `limit` while more rows follow — `interaction` narrows with a DynamoDB
|
|
1238
|
+
* filter applied after the key evaluation — so follow the cursor; never treat
|
|
1239
|
+
* a short page as the end.
|
|
1043
1240
|
*/
|
|
1044
1241
|
cursor: string | null;
|
|
1242
|
+
/**
|
|
1243
|
+
* Which store answered.
|
|
1244
|
+
*
|
|
1245
|
+
* `receipt_index` is the normal path: one bounded query on the account's
|
|
1246
|
+
* receipt partition, with real pagination.
|
|
1247
|
+
*
|
|
1248
|
+
* `legacy_scan` appears only for an account whose receipts were all emitted
|
|
1249
|
+
* before the receipt index existed. It walks the account audit log with a
|
|
1250
|
+
* filter, so it can return EMPTY pages that are nowhere near the end of the
|
|
1251
|
+
* data — on that source, keep following the cursor until it is null before
|
|
1252
|
+
* concluding there are no receipts. The two sources are never merged into one
|
|
1253
|
+
* page; the cursor stays on whichever source started the walk.
|
|
1254
|
+
*/
|
|
1255
|
+
source: NotifyReceiptSource;
|
|
1045
1256
|
}
|
|
1046
1257
|
interface NotifySendReceiptsResponse {
|
|
1047
1258
|
send_id: string;
|
|
@@ -1100,12 +1311,42 @@ interface NotifyConfigSecurity {
|
|
|
1100
1311
|
*/
|
|
1101
1312
|
mandatory_seal_categories?: string[];
|
|
1102
1313
|
}
|
|
1314
|
+
/**
|
|
1315
|
+
* The account's outbound EVENT webhook — how a backend learns that a recipient
|
|
1316
|
+
* opened, signed, approved, denied, or replied without polling for it.
|
|
1317
|
+
*
|
|
1318
|
+
* Both fields are required before anything is sent: an unsigned event is not
|
|
1319
|
+
* offered. `webhook_url` must be https on a public host (loopback, private,
|
|
1320
|
+
* link-local, and CGNAT addresses are rejected server-side).
|
|
1321
|
+
*
|
|
1322
|
+
* Delivery is BEST EFFORT — one retry, then the event is dropped. Polling
|
|
1323
|
+
* (`listSends`, `getSendStatus`, `listReceipts`) remains the source of truth;
|
|
1324
|
+
* the webhook exists to make that poll rare, not to replace it.
|
|
1325
|
+
*/
|
|
1326
|
+
interface NotifyConfigEvents {
|
|
1327
|
+
/** https only, ≤2048 chars. */
|
|
1328
|
+
webhook_url?: string;
|
|
1329
|
+
/**
|
|
1330
|
+
* HMAC-SHA256 signing secret, 16-256 chars. Sent as the hex digest of the raw
|
|
1331
|
+
* body in `X-SparkVault-Signature`. WRITE-ONLY: a config read reports
|
|
1332
|
+
* `secret_set` instead of the value.
|
|
1333
|
+
*/
|
|
1334
|
+
secret?: string;
|
|
1335
|
+
}
|
|
1336
|
+
/** `events` as it comes BACK from a read — the secret is never echoed. */
|
|
1337
|
+
interface NotifyConfigEventsRead {
|
|
1338
|
+
webhook_url?: string;
|
|
1339
|
+
/** Whether a signing secret is stored. The secret itself is never returned. */
|
|
1340
|
+
secret_set?: boolean;
|
|
1341
|
+
}
|
|
1103
1342
|
/** The account's effective config: secure defaults deep-merged with its overrides. */
|
|
1104
1343
|
interface NotifyConfig {
|
|
1105
1344
|
delivery: NotifyConfigDelivery;
|
|
1106
1345
|
reliability: NotifyConfigReliability;
|
|
1107
1346
|
history: NotifyConfigHistory;
|
|
1108
1347
|
security: NotifyConfigSecurity;
|
|
1348
|
+
/** Absent until the account configures an event webhook. */
|
|
1349
|
+
events?: NotifyConfigEventsRead;
|
|
1109
1350
|
/** Tombstoned entries are already dropped — a deleted category is simply gone. */
|
|
1110
1351
|
categories: Record<string, NotifyConfigCategory>;
|
|
1111
1352
|
/** Owner-managed SSM references. Readable, never account-writable. */
|
|
@@ -1125,10 +1366,17 @@ interface NotifyConfigPatch {
|
|
|
1125
1366
|
reliability?: NotifyConfigReliability;
|
|
1126
1367
|
history?: NotifyConfigHistory;
|
|
1127
1368
|
security?: NotifyConfigSecurity;
|
|
1369
|
+
events?: NotifyConfigEvents;
|
|
1128
1370
|
categories?: Record<string, NotifyConfigCategory | null>;
|
|
1129
1371
|
}
|
|
1130
|
-
/**
|
|
1131
|
-
|
|
1372
|
+
/**
|
|
1373
|
+
* The stored override delta, tombstones included, because that is what a write
|
|
1374
|
+
* merges onto. One value is held back: `events.secret` comes back as
|
|
1375
|
+
* `secret_set`, never the secret — a patch never has to resend it.
|
|
1376
|
+
*/
|
|
1377
|
+
type NotifyConfigOverrides = Omit<NotifyConfigPatch, 'events'> & {
|
|
1378
|
+
events?: NotifyConfigEventsRead;
|
|
1379
|
+
};
|
|
1132
1380
|
interface NotifyConfigResponse {
|
|
1133
1381
|
effective: NotifyConfig;
|
|
1134
1382
|
overrides: NotifyConfigOverrides;
|
|
@@ -1139,8 +1387,9 @@ interface NotifyConfigResponse {
|
|
|
1139
1387
|
*
|
|
1140
1388
|
* The counterpart to `sv.notify`: where that module is session-scoped and reads
|
|
1141
1389
|
* only the signed-in person's OWN inbox, this one is the account-scoped product
|
|
1142
|
-
* surface a tenant's BACKEND drives — send, sender-side
|
|
1143
|
-
* send status, receipts, and the account's Notify config.
|
|
1390
|
+
* surface a tenant's BACKEND drives — send, send history, recall, sender-side
|
|
1391
|
+
* inbox reads and state, send status, receipts, and the account's Notify config.
|
|
1392
|
+
* Every method maps to
|
|
1144
1393
|
* `/v1/products/notify/*` and is authorized by the caller's account, so the
|
|
1145
1394
|
* recipient is supplied explicitly rather than derived from a session.
|
|
1146
1395
|
*
|
|
@@ -1209,9 +1458,9 @@ declare class NotifyProductModule {
|
|
|
1209
1458
|
sendSecureMessage(options: CreateNotifySendOptions): Promise<NotifySendResult>;
|
|
1210
1459
|
/** Two-way thread: identifier-verified reveal plus an encrypted reply. */
|
|
1211
1460
|
sendConversation(options: CreateNotifySendOptions): Promise<NotifySendResult>;
|
|
1212
|
-
/** High-stakes approve/deny —
|
|
1461
|
+
/** High-stakes approve/deny — identifier-verified, with `action_hash` binding. */
|
|
1213
1462
|
sendApproval(options: CreateNotifySendOptions): Promise<NotifySendResult>;
|
|
1214
|
-
/** Signature-on-delivery —
|
|
1463
|
+
/** Signature-on-delivery — identifier-verified, with `action_hash` binding. */
|
|
1215
1464
|
sendSignatureRequest(options: CreateNotifySendOptions): Promise<NotifySendResult>;
|
|
1216
1465
|
/**
|
|
1217
1466
|
* Read one recipient's metadata-only feed, newest first. Rows are pointers: a
|
|
@@ -1254,6 +1503,56 @@ declare class NotifyProductModule {
|
|
|
1254
1503
|
* } while (cursor);
|
|
1255
1504
|
*/
|
|
1256
1505
|
markInboxAll(options: MarkNotifyInboxAllOptions): Promise<MarkNotifyInboxAllResponse>;
|
|
1506
|
+
/**
|
|
1507
|
+
* The account's send history, newest first — what you sent, to how many, and
|
|
1508
|
+
* how it landed.
|
|
1509
|
+
*
|
|
1510
|
+
* Metadata only by construction: the history index does not project the
|
|
1511
|
+
* audience, so no recipient contact or SparkLink pointer can travel here. Take
|
|
1512
|
+
* `getSendStatus(sendId)` for the per-recipient detail.
|
|
1513
|
+
*
|
|
1514
|
+
* Real pagination: a null `cursor` means the end of the account's history.
|
|
1515
|
+
*
|
|
1516
|
+
* @example
|
|
1517
|
+
* let cursor: string | undefined;
|
|
1518
|
+
* do {
|
|
1519
|
+
* const page = await sv.products.notify.listSends({ cursor, limit: 50 });
|
|
1520
|
+
* for (const send of page.sends) {
|
|
1521
|
+
* console.log(send.created_at, send.title, send.state,
|
|
1522
|
+
* `${send.delivered_count ?? '?'} / ${send.recipient_count ?? '?'}`);
|
|
1523
|
+
* }
|
|
1524
|
+
* cursor = page.cursor ?? undefined;
|
|
1525
|
+
* } while (cursor);
|
|
1526
|
+
*/
|
|
1527
|
+
listSends(options?: ListNotifySendsOptions): Promise<ListNotifySendsResponse>;
|
|
1528
|
+
/**
|
|
1529
|
+
* Recall a sealed send: revoke the single-use SparkLink grants it minted, so
|
|
1530
|
+
* the content can no longer be revealed.
|
|
1531
|
+
*
|
|
1532
|
+
* `mode: 'grant'` (the default) drops access and leaves the content intact.
|
|
1533
|
+
* `mode: 'content'` hard-burns the sealed spark so it is unreadable for
|
|
1534
|
+
* everyone — spark-backed sends only, since an ingot send merely references the
|
|
1535
|
+
* owner's durable vault content.
|
|
1536
|
+
*
|
|
1537
|
+
* Idempotent: a grant already revoked (or already consumed) counts as recalled,
|
|
1538
|
+
* so a repeated call converges rather than accumulating failures. One
|
|
1539
|
+
* recipient's failure never stops the rest — the response reports every one.
|
|
1540
|
+
*
|
|
1541
|
+
* PLAINTEXT SENDS CANNOT BE RECALLED (400): they delivered their body inline,
|
|
1542
|
+
* in the clear, and minted no grant. There is nothing to revoke, and saying
|
|
1543
|
+
* otherwise would be a lie about the one thing you are asking.
|
|
1544
|
+
*
|
|
1545
|
+
* @example
|
|
1546
|
+
* // Whole audience, access only
|
|
1547
|
+
* await sv.products.notify.recallSend(send.send_id);
|
|
1548
|
+
*
|
|
1549
|
+
* // One recipient, burn the content for everyone
|
|
1550
|
+
* const { recalled, failed } = await sv.products.notify.recallSend(send.send_id, {
|
|
1551
|
+
* recipientIds: [user.svid],
|
|
1552
|
+
* mode: 'content',
|
|
1553
|
+
* });
|
|
1554
|
+
*/
|
|
1555
|
+
recallSend(sendId: string, options?: RecallNotifySendOptions): Promise<RecallNotifySendResponse>;
|
|
1257
1556
|
/**
|
|
1258
1557
|
* The sender's per-recipient delivery rollup for one send: who it reached and
|
|
1259
1558
|
* how far each recipient got. Metadata only — never the pointer or contacts.
|
|
@@ -1266,13 +1565,14 @@ declare class NotifyProductModule {
|
|
|
1266
1565
|
* The account's verified-interaction receipts (portable, JWKS-verifiable
|
|
1267
1566
|
* proofs), newest first. Follow `cursor` to page.
|
|
1268
1567
|
*
|
|
1269
|
-
*
|
|
1270
|
-
*
|
|
1271
|
-
*
|
|
1272
|
-
*
|
|
1568
|
+
* `source` says which store answered. `receipt_index` is the normal path — a
|
|
1569
|
+
* bounded query with real pagination. `legacy_scan` appears only for an account
|
|
1570
|
+
* whose receipts all predate that index; it filters the account audit log, so
|
|
1571
|
+
* it can hand back EMPTY pages that are nowhere near the end. On EITHER source,
|
|
1572
|
+
* follow the cursor until it is null before concluding there are none.
|
|
1273
1573
|
*
|
|
1274
1574
|
* @example
|
|
1275
|
-
* const { receipts, cursor } = await sv.products.notify.listReceipts({ interaction: 'approve' });
|
|
1575
|
+
* const { receipts, cursor, source } = await sv.products.notify.listReceipts({ interaction: 'approve' });
|
|
1276
1576
|
*/
|
|
1277
1577
|
listReceipts(options?: ListNotifyReceiptsOptions): Promise<ListNotifyReceiptsResponse>;
|
|
1278
1578
|
/**
|
|
@@ -1310,12 +1610,21 @@ declare class NotifyProductModule {
|
|
|
1310
1610
|
* a seeded default from re-appearing on the next merge. The reserved `security`
|
|
1311
1611
|
* category can neither be removed nor made optional.
|
|
1312
1612
|
*
|
|
1613
|
+
* The `events` section configures the outbound event webhook: `webhook_url`
|
|
1614
|
+
* must be https on a public host, and `secret` (16-256 chars) signs every event
|
|
1615
|
+
* body as `X-SparkVault-Signature: hex(HMAC-SHA256(secret, rawBody))`. The
|
|
1616
|
+
* secret is WRITE-ONLY — reads report `events.secret_set`, never the value.
|
|
1617
|
+
*
|
|
1313
1618
|
* @example
|
|
1314
1619
|
* await sv.products.notify.updateConfig({
|
|
1315
1620
|
* categories: {
|
|
1316
1621
|
* weekly_newsletter: { label: 'Weekly newsletter', required: false },
|
|
1317
1622
|
* marketing: null, // tombstone — remove the seeded default
|
|
1318
1623
|
* },
|
|
1624
|
+
* events: {
|
|
1625
|
+
* webhook_url: 'https://api.example.com/hooks/sparkvault',
|
|
1626
|
+
* secret: process.env.SPARKVAULT_EVENT_SECRET,
|
|
1627
|
+
* },
|
|
1319
1628
|
* });
|
|
1320
1629
|
*/
|
|
1321
1630
|
updateConfig(patch: NotifyConfigPatch): Promise<NotifyConfigResponse>;
|
|
@@ -2853,4 +3162,4 @@ declare global {
|
|
|
2853
3162
|
}
|
|
2854
3163
|
|
|
2855
3164
|
export { AuthenticationError, AuthorizationError, EntropyModule, FoldersModule, IdentityModule, IngotsModule, NOTIFY_PRESETS, NetworkError, NotifyModule, NotifyProductModule, NotifySubscriptionRequiredError, PlanRequiredError, PopupBlockedError, ProductsModule, QuotaExceededError, SparkVault, SparkVaultError, SparksModule, TimeoutError, UserCancelledError, ValidationError, VaultsModule, buildNotifyPresetSend, SparkVault as default, logger, setDebugMode };
|
|
2856
|
-
export type { AccessLogRetention, AccessLogsOptions, ApiResponse, AuthMethod, BandwidthPool, CreateFolderOptions, CreateNotifySendOptions, CreateSparkOptions, CreateUploadOptions, CreateVaultOptions, CreatedIngot, CreatedSpark, EntropyFormat, EntropyResult, Folder, FolderBreadcrumbItem, GenerateEntropyOptions, HealthCheckOptions, HealthCheckResult, AttachOptions as IdentityAttachOptions, Ingot, IngotAccessLog, IngotAccessLogPage, IngotDownloadLink, IngotInvite, IngotPage, IngotSharingConfig, IngotUpload, ListContentsOptions, ListIngotsOptions, ListNotificationsOptions, ListNotificationsResponse, ListNotifyInboxOptions, ListNotifyInboxResponse, ListNotifyReceiptsOptions, ListNotifyReceiptsResponse, ListSparksOptions, MarkAllNotificationsStateOptions, MarkAllNotificationsStateResponse, MarkAllReadResult, MarkNotificationStateOptions, MarkNotificationStateResponse, MarkNotifyInboxAllOptions, MarkNotifyInboxAllResponse, MarkNotifyInboxStateOptions, MarkNotifyInboxStateResponse, NotificationBulkMarkState, NotificationInboxState, NotificationMarkState, NotificationRow, NotifyCategory, NotifyChannel, NotifyConfig, NotifyConfigCategory, NotifyConfigDelivery, NotifyConfigHistory, NotifyConfigOverrides, NotifyConfigPatch, NotifyConfigRealtimeFallbackDelay, NotifyConfigReliability, NotifyConfigResponse, NotifyConfigSecurity, NotifyDeliveryMode, NotifyEscalation, NotifyInboxBulkMarkState, NotifyInboxMarkState, NotifyInboxRow, NotifyInboxView, NotifyIngotRef, NotifyInteraction, NotifyPreset, NotifyPresetCategory, NotifyPresetName, NotifyReceipt, NotifyReceiptEventType, NotifyRecipient, NotifyRecipientRef, NotifySendContent, NotifySendPolicy, NotifySendReceipt, NotifySendReceiptsResponse, NotifySendResult, NotifySendStatus, NotifySendStatusCounts, NotifySendStatusRecipient, NotifyVerificationLevel, PoolState, PoolsMeta, QuotaResource, RegisterWebPushResponse, ReplaceIngotOptions, ResponseMeta, SearchIngotsOptions, ShareSparkOptions, Spark, SparkPage, SparkShare, SparkSummary, SparkVaultConfig, SparkVisibility, StoragePool, SubscribeWebPushOptions, SubscribeWebPushResult, SubscribeWebPushStatus, Theme, TokenClaims, UnreadCountResponse, UnsealedVault, UnsubscribeWebPushResponse, UpdateFolderOptions, UpdateIngotSharingOptions, UpdateVaultUploadOptions, UpdatedVault, UploadAttachOptions, UploadBranding, UploadIngotOptions, UploadOptions, UploadProgress, UploadResult, Vault, VaultDetail, VaultSharingConfig, VaultSharingOptions, VaultSummary, VaultUploadConfig, VaultUploadSettings, VerifyOptions, VerifyResult, WebPushKeyResponse, WebPushSubscriptionInput };
|
|
3165
|
+
export type { AccessLogRetention, AccessLogsOptions, ApiResponse, AuthMethod, BandwidthPool, CreateFolderOptions, CreateNotifySendOptions, CreateSparkOptions, CreateUploadOptions, CreateVaultOptions, CreatedIngot, CreatedSpark, EntropyFormat, EntropyResult, Folder, FolderBreadcrumbItem, GenerateEntropyOptions, HealthCheckOptions, HealthCheckResult, AttachOptions as IdentityAttachOptions, Ingot, IngotAccessLog, IngotAccessLogPage, IngotDownloadLink, IngotInvite, IngotPage, IngotSharingConfig, IngotUpload, ListContentsOptions, ListIngotsOptions, ListNotificationsOptions, ListNotificationsResponse, ListNotifyInboxOptions, ListNotifyInboxResponse, ListNotifyReceiptsOptions, ListNotifyReceiptsResponse, ListNotifySendsOptions, ListNotifySendsResponse, ListSparksOptions, MarkAllNotificationsStateOptions, MarkAllNotificationsStateResponse, MarkAllReadResult, MarkNotificationStateOptions, MarkNotificationStateResponse, MarkNotifyInboxAllOptions, MarkNotifyInboxAllResponse, MarkNotifyInboxStateOptions, MarkNotifyInboxStateResponse, 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, NotifyRecallMode, NotifyReceipt, NotifyReceiptEventType, NotifyReceiptSource, NotifyRecipient, NotifyRecipientRef, NotifySendContent, NotifySendPolicy, NotifySendReceipt, NotifySendReceiptsResponse, NotifySendResult, NotifySendState, NotifySendStatus, NotifySendStatusCounts, NotifySendStatusRecipient, NotifySendSummary, NotifyVerificationLevel, PoolState, PoolsMeta, QuotaResource, RecallNotifySendOptions, RecallNotifySendResponse, RegisterWebPushResponse, ReplaceIngotOptions, ResponseMeta, SearchIngotsOptions, ShareSparkOptions, Spark, SparkPage, SparkShare, SparkSummary, SparkVaultConfig, SparkVisibility, StoragePool, SubscribeWebPushOptions, SubscribeWebPushResult, SubscribeWebPushStatus, Theme, TokenClaims, UnreadCountResponse, UnsealedVault, UnsubscribeWebPushResponse, UpdateFolderOptions, UpdateIngotSharingOptions, UpdateVaultUploadOptions, UpdatedVault, UploadAttachOptions, UploadBranding, UploadIngotOptions, UploadOptions, UploadProgress, UploadResult, Vault, VaultDetail, VaultSharingConfig, VaultSharingOptions, VaultSummary, VaultUploadConfig, VaultUploadSettings, VerifyOptions, VerifyResult, WebPushKeyResponse, WebPushSubscriptionInput };
|