@sparkvault/sdk-js 8.15.0 → 9.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 +11 -5
- package/dist/config.d.ts +6 -4
- package/dist/{sparkvault.cjs.js → index.cjs} +125 -72
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +321 -31
- package/dist/{sparkvault.esm.js → index.mjs} +125 -72
- package/dist/index.mjs.map +1 -0
- package/dist/products/identity/index.d.ts +1 -1
- 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) */
|
|
@@ -577,7 +579,7 @@ declare class IdentityModule {
|
|
|
577
579
|
private consumeSignInPending;
|
|
578
580
|
/** Remove the result fragment from the URL bar (and history entry). */
|
|
579
581
|
private clearUrlFragment;
|
|
580
|
-
/** Drop the one-shot PKCE state/verifier
|
|
582
|
+
/** Drop the one-shot PKCE state/verifier a bounce staged. */
|
|
581
583
|
private clearOneShotAuthState;
|
|
582
584
|
private consumeRedirectResult;
|
|
583
585
|
/**
|
|
@@ -792,8 +794,20 @@ type NotifyChannel = 'in_app' | 'websocket' | 'email' | 'sms' | 'push' | 'web_pu
|
|
|
792
794
|
* allowed on a confidential category.
|
|
793
795
|
*/
|
|
794
796
|
type NotifyDeliveryMode = 'sealed' | 'plaintext';
|
|
795
|
-
/**
|
|
796
|
-
|
|
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';
|
|
797
811
|
/** What the recipient does at the reveal — the interaction the receipt attests to. */
|
|
798
812
|
type NotifyInteraction = 'view' | 'acknowledge' | 'sign' | 'approve' | 'reply';
|
|
799
813
|
/**
|
|
@@ -880,7 +894,15 @@ interface CreateNotifySendOptions {
|
|
|
880
894
|
escalation?: NotifyEscalation;
|
|
881
895
|
/** Channel-agnostic display title (rides the email subject). Truncated at 200 chars, never rejected. */
|
|
882
896
|
title?: string;
|
|
883
|
-
|
|
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;
|
|
884
906
|
/** Free-form display type the tenant uses to classify the send. */
|
|
885
907
|
type?: string;
|
|
886
908
|
/**
|
|
@@ -960,13 +982,37 @@ interface MarkNotifyInboxAllResponse {
|
|
|
960
982
|
/** Next page, or null when the drain is complete. */
|
|
961
983
|
cursor: string | null;
|
|
962
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';
|
|
963
1000
|
interface NotifySendStatusRecipient {
|
|
964
1001
|
recipient_id: string;
|
|
1002
|
+
/** The derived per-recipient state — the field to branch on. */
|
|
1003
|
+
state: NotifyRecipientState;
|
|
965
1004
|
/** True once the recipient's first delivery step was enqueued. */
|
|
966
1005
|
enqueued: boolean;
|
|
967
1006
|
seen_at: number | null;
|
|
968
1007
|
read_at: number | null;
|
|
969
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;
|
|
970
1016
|
/**
|
|
971
1017
|
* The latest dispatch outcome per attempted channel — the difference between a
|
|
972
1018
|
* notification that actually left the building and one whose every channel
|
|
@@ -975,7 +1021,15 @@ interface NotifySendStatusRecipient {
|
|
|
975
1021
|
* (and with it the recipient's raw contact), which this rollup never exposes.
|
|
976
1022
|
*/
|
|
977
1023
|
channel_outcomes: Partial<Record<NotifyChannel, {
|
|
978
|
-
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';
|
|
979
1033
|
/** Epoch seconds the outcome was recorded. */
|
|
980
1034
|
at: number | null;
|
|
981
1035
|
/** Escalation step index the outcome came from. */
|
|
@@ -984,12 +1038,18 @@ interface NotifySendStatusRecipient {
|
|
|
984
1038
|
/** At least one channel accepted the notification for this recipient. */
|
|
985
1039
|
delivered: boolean;
|
|
986
1040
|
/**
|
|
987
|
-
* Every channel attempted for this recipient declined (`skipped
|
|
988
|
-
* `not_implemented`) and none delivered — a silent
|
|
989
|
-
* nothing has been attempted yet and while a
|
|
990
|
-
* 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.
|
|
991
1045
|
*/
|
|
992
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;
|
|
993
1053
|
}
|
|
994
1054
|
interface NotifySendStatusCounts {
|
|
995
1055
|
total: number;
|
|
@@ -997,10 +1057,23 @@ interface NotifySendStatusCounts {
|
|
|
997
1057
|
seen: number;
|
|
998
1058
|
read: number;
|
|
999
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;
|
|
1000
1067
|
/** Recipients with at least one `delivered` channel outcome. */
|
|
1001
1068
|
delivered: number;
|
|
1002
1069
|
/** Recipients whose every attempted channel declined — the silent-failure count. */
|
|
1003
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;
|
|
1004
1077
|
}
|
|
1005
1078
|
/**
|
|
1006
1079
|
* The sender's per-recipient delivery rollup. Metadata only by construction: it
|
|
@@ -1009,7 +1082,24 @@ interface NotifySendStatusCounts {
|
|
|
1009
1082
|
*/
|
|
1010
1083
|
interface NotifySendStatus {
|
|
1011
1084
|
send_id: string;
|
|
1012
|
-
|
|
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';
|
|
1013
1103
|
channels: NotifyChannel[];
|
|
1014
1104
|
created_at: number;
|
|
1015
1105
|
title: string | null;
|
|
@@ -1018,6 +1108,82 @@ interface NotifySendStatus {
|
|
|
1018
1108
|
recipients: NotifySendStatusRecipient[];
|
|
1019
1109
|
counts: NotifySendStatusCounts;
|
|
1020
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
|
+
}
|
|
1021
1187
|
/** The five verified-interaction receipt subtypes (SparkLink lifecycle events are not receipts). */
|
|
1022
1188
|
type NotifyReceiptEventType = 'sparklink_accessed' | 'sparklink_signed' | 'sparklink_approved' | 'sparklink_denied' | 'sparklink_replied';
|
|
1023
1189
|
/**
|
|
@@ -1026,7 +1192,7 @@ type NotifyReceiptEventType = 'sparklink_accessed' | 'sparklink_signed' | 'spark
|
|
|
1026
1192
|
* action. `link_code` is masked (`abc123***`) exactly as stored.
|
|
1027
1193
|
*/
|
|
1028
1194
|
interface NotifyReceipt {
|
|
1029
|
-
event_type: NotifyReceiptEventType;
|
|
1195
|
+
event_type: NotifyReceiptEventType | null;
|
|
1030
1196
|
occurred_at: number | null;
|
|
1031
1197
|
interaction: NotifyInteraction | null;
|
|
1032
1198
|
identity: string | null;
|
|
@@ -1040,7 +1206,19 @@ interface NotifyReceipt {
|
|
|
1040
1206
|
decision: string | null;
|
|
1041
1207
|
thread_id: string | null;
|
|
1042
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;
|
|
1043
1219
|
}
|
|
1220
|
+
/** Which store answered a receipts listing (see `ListNotifyReceiptsResponse.source`). */
|
|
1221
|
+
type NotifyReceiptSource = 'receipt_index' | 'legacy_scan';
|
|
1044
1222
|
/** A receipt correlated to the recipient whose grant produced it. */
|
|
1045
1223
|
interface NotifySendReceipt extends NotifyReceipt {
|
|
1046
1224
|
recipient_id: string;
|
|
@@ -1055,12 +1233,26 @@ interface ListNotifyReceiptsOptions {
|
|
|
1055
1233
|
interface ListNotifyReceiptsResponse {
|
|
1056
1234
|
receipts: NotifyReceipt[];
|
|
1057
1235
|
/**
|
|
1058
|
-
* Next-page cursor, or null on the last page. A page can
|
|
1059
|
-
*
|
|
1060
|
-
*
|
|
1061
|
-
*
|
|
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.
|
|
1062
1240
|
*/
|
|
1063
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;
|
|
1064
1256
|
}
|
|
1065
1257
|
interface NotifySendReceiptsResponse {
|
|
1066
1258
|
send_id: string;
|
|
@@ -1119,12 +1311,42 @@ interface NotifyConfigSecurity {
|
|
|
1119
1311
|
*/
|
|
1120
1312
|
mandatory_seal_categories?: string[];
|
|
1121
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
|
+
}
|
|
1122
1342
|
/** The account's effective config: secure defaults deep-merged with its overrides. */
|
|
1123
1343
|
interface NotifyConfig {
|
|
1124
1344
|
delivery: NotifyConfigDelivery;
|
|
1125
1345
|
reliability: NotifyConfigReliability;
|
|
1126
1346
|
history: NotifyConfigHistory;
|
|
1127
1347
|
security: NotifyConfigSecurity;
|
|
1348
|
+
/** Absent until the account configures an event webhook. */
|
|
1349
|
+
events?: NotifyConfigEventsRead;
|
|
1128
1350
|
/** Tombstoned entries are already dropped — a deleted category is simply gone. */
|
|
1129
1351
|
categories: Record<string, NotifyConfigCategory>;
|
|
1130
1352
|
/** Owner-managed SSM references. Readable, never account-writable. */
|
|
@@ -1144,10 +1366,17 @@ interface NotifyConfigPatch {
|
|
|
1144
1366
|
reliability?: NotifyConfigReliability;
|
|
1145
1367
|
history?: NotifyConfigHistory;
|
|
1146
1368
|
security?: NotifyConfigSecurity;
|
|
1369
|
+
events?: NotifyConfigEvents;
|
|
1147
1370
|
categories?: Record<string, NotifyConfigCategory | null>;
|
|
1148
1371
|
}
|
|
1149
|
-
/**
|
|
1150
|
-
|
|
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
|
+
};
|
|
1151
1380
|
interface NotifyConfigResponse {
|
|
1152
1381
|
effective: NotifyConfig;
|
|
1153
1382
|
overrides: NotifyConfigOverrides;
|
|
@@ -1158,8 +1387,9 @@ interface NotifyConfigResponse {
|
|
|
1158
1387
|
*
|
|
1159
1388
|
* The counterpart to `sv.notify`: where that module is session-scoped and reads
|
|
1160
1389
|
* only the signed-in person's OWN inbox, this one is the account-scoped product
|
|
1161
|
-
* surface a tenant's BACKEND drives — send, sender-side
|
|
1162
|
-
* 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
|
|
1163
1393
|
* `/v1/products/notify/*` and is authorized by the caller's account, so the
|
|
1164
1394
|
* recipient is supplied explicitly rather than derived from a session.
|
|
1165
1395
|
*
|
|
@@ -1228,9 +1458,9 @@ declare class NotifyProductModule {
|
|
|
1228
1458
|
sendSecureMessage(options: CreateNotifySendOptions): Promise<NotifySendResult>;
|
|
1229
1459
|
/** Two-way thread: identifier-verified reveal plus an encrypted reply. */
|
|
1230
1460
|
sendConversation(options: CreateNotifySendOptions): Promise<NotifySendResult>;
|
|
1231
|
-
/** High-stakes approve/deny —
|
|
1461
|
+
/** High-stakes approve/deny — identifier-verified, with `action_hash` binding. */
|
|
1232
1462
|
sendApproval(options: CreateNotifySendOptions): Promise<NotifySendResult>;
|
|
1233
|
-
/** Signature-on-delivery —
|
|
1463
|
+
/** Signature-on-delivery — identifier-verified, with `action_hash` binding. */
|
|
1234
1464
|
sendSignatureRequest(options: CreateNotifySendOptions): Promise<NotifySendResult>;
|
|
1235
1465
|
/**
|
|
1236
1466
|
* Read one recipient's metadata-only feed, newest first. Rows are pointers: a
|
|
@@ -1273,6 +1503,56 @@ declare class NotifyProductModule {
|
|
|
1273
1503
|
* } while (cursor);
|
|
1274
1504
|
*/
|
|
1275
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>;
|
|
1276
1556
|
/**
|
|
1277
1557
|
* The sender's per-recipient delivery rollup for one send: who it reached and
|
|
1278
1558
|
* how far each recipient got. Metadata only — never the pointer or contacts.
|
|
@@ -1285,13 +1565,14 @@ declare class NotifyProductModule {
|
|
|
1285
1565
|
* The account's verified-interaction receipts (portable, JWKS-verifiable
|
|
1286
1566
|
* proofs), newest first. Follow `cursor` to page.
|
|
1287
1567
|
*
|
|
1288
|
-
*
|
|
1289
|
-
*
|
|
1290
|
-
*
|
|
1291
|
-
*
|
|
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.
|
|
1292
1573
|
*
|
|
1293
1574
|
* @example
|
|
1294
|
-
* const { receipts, cursor } = await sv.products.notify.listReceipts({ interaction: 'approve' });
|
|
1575
|
+
* const { receipts, cursor, source } = await sv.products.notify.listReceipts({ interaction: 'approve' });
|
|
1295
1576
|
*/
|
|
1296
1577
|
listReceipts(options?: ListNotifyReceiptsOptions): Promise<ListNotifyReceiptsResponse>;
|
|
1297
1578
|
/**
|
|
@@ -1329,12 +1610,21 @@ declare class NotifyProductModule {
|
|
|
1329
1610
|
* a seeded default from re-appearing on the next merge. The reserved `security`
|
|
1330
1611
|
* category can neither be removed nor made optional.
|
|
1331
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
|
+
*
|
|
1332
1618
|
* @example
|
|
1333
1619
|
* await sv.products.notify.updateConfig({
|
|
1334
1620
|
* categories: {
|
|
1335
1621
|
* weekly_newsletter: { label: 'Weekly newsletter', required: false },
|
|
1336
1622
|
* marketing: null, // tombstone — remove the seeded default
|
|
1337
1623
|
* },
|
|
1624
|
+
* events: {
|
|
1625
|
+
* webhook_url: 'https://api.example.com/hooks/sparkvault',
|
|
1626
|
+
* secret: process.env.SPARKVAULT_EVENT_SECRET,
|
|
1627
|
+
* },
|
|
1338
1628
|
* });
|
|
1339
1629
|
*/
|
|
1340
1630
|
updateConfig(patch: NotifyConfigPatch): Promise<NotifyConfigResponse>;
|
|
@@ -2872,4 +3162,4 @@ declare global {
|
|
|
2872
3162
|
}
|
|
2873
3163
|
|
|
2874
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 };
|
|
2875
|
-
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 };
|