@sparkvault/sdk-js 19.0.1 → 19.1.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 +26 -4
- package/dist/npm/chunks/index-C97091lF.mjs +12959 -0
- package/dist/npm/chunks/index-C97091lF.mjs.map +1 -0
- package/dist/npm/chunks/index-D_p_8VO7.cjs +13024 -0
- package/dist/npm/chunks/index-D_p_8VO7.cjs.map +1 -0
- package/dist/npm/identity.cjs +23 -0
- package/dist/npm/identity.cjs.map +1 -0
- package/dist/npm/identity.mjs +12 -0
- package/dist/npm/identity.mjs.map +1 -0
- package/dist/{index.cjs → npm/index.cjs} +802 -13759
- package/dist/npm/index.cjs.map +1 -0
- package/dist/{index.mjs → npm/index.mjs} +203 -13159
- package/dist/npm/index.mjs.map +1 -0
- package/dist/sparkvault-identity.js +2 -0
- package/dist/sparkvault-identity.js.map +1 -0
- package/dist/sparkvault.js +1 -1
- package/dist/sparkvault.js.map +1 -1
- package/dist/types/identity.d.ts +8 -0
- package/dist/{index.d.ts → types/index.d.ts} +4 -790
- package/dist/types/shared/errors-C-gjmGBs.d.ts +800 -0
- package/package.json +20 -9
- package/dist/api-base.d.ts +0 -116
- package/dist/auto-init.d.ts +0 -32
- package/dist/config.d.ts +0 -79
- package/dist/entropy/index.d.ts +0 -35
- package/dist/entropy/types.d.ts +0 -32
- package/dist/errors.d.ts +0 -146
- package/dist/folders/index.d.ts +0 -102
- package/dist/folders/types.d.ts +0 -91
- package/dist/health.d.ts +0 -18
- package/dist/http.d.ts +0 -46
- package/dist/index.cjs.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/ingots/fetch-download.d.ts +0 -78
- package/dist/ingots/history.d.ts +0 -4
- package/dist/ingots/index.d.ts +0 -388
- package/dist/ingots/revision.d.ts +0 -4
- package/dist/ingots/types.d.ts +0 -556
- package/dist/logger.d.ts +0 -32
- package/dist/notify/index.d.ts +0 -154
- package/dist/notify/types.d.ts +0 -232
- package/dist/products/help-desk/client.d.ts +0 -198
- package/dist/products/help-desk/desk-id.d.ts +0 -2
- package/dist/products/help-desk/form-draft.d.ts +0 -37
- package/dist/products/help-desk/form-types.d.ts +0 -123
- package/dist/products/help-desk/form.d.ts +0 -83
- package/dist/products/help-desk/index.d.ts +0 -47
- package/dist/products/help-desk/kb-client.d.ts +0 -48
- package/dist/products/help-desk/kb-types.d.ts +0 -59
- package/dist/products/help-desk/modal.d.ts +0 -8
- package/dist/products/help-desk/styles.d.ts +0 -9
- package/dist/products/help-desk/support-analytics-types.d.ts +0 -32
- package/dist/products/help-desk/support-analytics.d.ts +0 -3
- package/dist/products/help-desk/support-brand.d.ts +0 -49
- package/dist/products/help-desk/support-controller.d.ts +0 -4
- package/dist/products/help-desk/support-history.d.ts +0 -38
- package/dist/products/help-desk/support-launcher.d.ts +0 -12
- package/dist/products/help-desk/support-styles.d.ts +0 -14
- package/dist/products/help-desk/support-types.d.ts +0 -66
- package/dist/products/help-desk/support-view.d.ts +0 -173
- package/dist/products/help-desk/types.d.ts +0 -285
- package/dist/products/help-desk/widget-identity.d.ts +0 -32
- package/dist/products/identity/api.d.ts +0 -237
- package/dist/products/identity/container.d.ts +0 -44
- package/dist/products/identity/dialog-launcher.d.ts +0 -133
- package/dist/products/identity/federation-flow.d.ts +0 -31
- package/dist/products/identity/handlers/otp-handler.d.ts +0 -69
- package/dist/products/identity/handlers/passkey-handler.d.ts +0 -105
- package/dist/products/identity/handlers/sparklink-handler.d.ts +0 -34
- package/dist/products/identity/index.d.ts +0 -296
- package/dist/products/identity/inline-container.d.ts +0 -53
- package/dist/products/identity/methods.d.ts +0 -19
- package/dist/products/identity/modal.d.ts +0 -51
- package/dist/products/identity/pending-signin.d.ts +0 -102
- package/dist/products/identity/popup-launcher.d.ts +0 -73
- package/dist/products/identity/renderer.d.ts +0 -525
- package/dist/products/identity/state.d.ts +0 -84
- package/dist/products/identity/styles.d.ts +0 -31
- package/dist/products/identity/types.d.ts +0 -561
- package/dist/products/identity/utils/cooldown-timer.d.ts +0 -73
- package/dist/products/identity/utils.d.ts +0 -85
- package/dist/products/identity/views/backup-verify.d.ts +0 -42
- package/dist/products/identity/views/base.d.ts +0 -51
- package/dist/products/identity/views/error.d.ts +0 -65
- package/dist/products/identity/views/icons.d.ts +0 -41
- package/dist/products/identity/views/identity-input.d.ts +0 -80
- package/dist/products/identity/views/index.d.ts +0 -20
- package/dist/products/identity/views/loading.d.ts +0 -23
- package/dist/products/identity/views/method-button.d.ts +0 -14
- package/dist/products/identity/views/method-select.d.ts +0 -42
- package/dist/products/identity/views/origin-not-allowed.d.ts +0 -25
- package/dist/products/identity/views/otp-verify.d.ts +0 -58
- package/dist/products/identity/views/passkey-auto.d.ts +0 -22
- package/dist/products/identity/views/passkey-prompt.d.ts +0 -25
- package/dist/products/identity/views/passkey.d.ts +0 -38
- package/dist/products/identity/views/product-not-configured.d.ts +0 -21
- package/dist/products/identity/views/service-unavailable.d.ts +0 -21
- package/dist/products/identity/views/sms-consent.d.ts +0 -16
- package/dist/products/identity/views/sparklink-waiting.d.ts +0 -40
- package/dist/products/identity/views/two-factor.d.ts +0 -37
- package/dist/products/index.d.ts +0 -51
- package/dist/products/messaging/index.d.ts +0 -38
- package/dist/products/messaging/types.d.ts +0 -162
- package/dist/products/notify/index.d.ts +0 -436
- package/dist/products/notify/project-types.d.ts +0 -44
- package/dist/products/notify/projects.d.ts +0 -15
- package/dist/products/notify/types.d.ts +0 -1327
- package/dist/products/structured-ingots/index.d.ts +0 -31
- package/dist/products/structured-ingots/types-client.d.ts +0 -19
- package/dist/products/structured-ingots/types.d.ts +0 -293
- package/dist/products/structured-ingots/validation.d.ts +0 -25
- package/dist/request-path.d.ts +0 -44
- package/dist/sparks/index.d.ts +0 -91
- package/dist/sparks/types.d.ts +0 -304
- package/dist/ui/chrome.d.ts +0 -16
- package/dist/ui/ds-tokens.d.ts +0 -59
- package/dist/ui/inline-shell.d.ts +0 -19
- package/dist/ui/live-region.d.ts +0 -15
- package/dist/ui/modal-shell.d.ts +0 -67
- package/dist/ui/target.d.ts +0 -6
- package/dist/utils/dom.d.ts +0 -26
- package/dist/vault-session.d.ts +0 -2
- package/dist/vaults/index.d.ts +0 -254
- package/dist/vaults/types.d.ts +0 -368
- package/dist/vaults/upload/api.d.ts +0 -310
- package/dist/vaults/upload/chrome.d.ts +0 -21
- package/dist/vaults/upload/container.d.ts +0 -37
- package/dist/vaults/upload/index.d.ts +0 -76
- package/dist/vaults/upload/inline-container.d.ts +0 -41
- package/dist/vaults/upload/modal.d.ts +0 -55
- package/dist/vaults/upload/renderer.d.ts +0 -150
- package/dist/vaults/upload/styles.d.ts +0 -14
- package/dist/vaults/upload/types.d.ts +0 -220
|
@@ -1,436 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Notify Product Module: the TENANT (sender) surface.
|
|
3
|
-
*
|
|
4
|
-
* The counterpart to `sv.notify`: where that module is SparkVault's own
|
|
5
|
-
* first-party inbox, which a signed-in SparkVault user reads for the
|
|
6
|
-
* notifications SparkVault delivered to them `in_app`, this one is the
|
|
7
|
-
* account-scoped product surface a tenant's BACKEND drives (send, send
|
|
8
|
-
* history, recall, sender-side inbox reads and state, send status, receipts,
|
|
9
|
-
* the account's Notify config, and who its email is from).
|
|
10
|
-
* A tenant reads its own recipients' feeds here (`getInbox`), never through
|
|
11
|
-
* `sv.notify`. Every method maps to
|
|
12
|
-
* `/v1/products/notify/*` and is authorized by the caller's account, so the
|
|
13
|
-
* recipient is supplied explicitly rather than derived from a session.
|
|
14
|
-
*
|
|
15
|
-
* Intended for server-side use with an `apiKey` (sent as `X-API-Key`); a Core JWT
|
|
16
|
-
* works identically. Note the API prefers a Bearer JWT when both credentials are
|
|
17
|
-
* configured, so a server integration should set `apiKey` alone.
|
|
18
|
-
*
|
|
19
|
-
* Notify never touches crypto here: `send` seals content and mints one single-use
|
|
20
|
-
* SparkLink per recipient server-side, and the client only ever carries pointers
|
|
21
|
-
* and metadata.
|
|
22
|
-
*/
|
|
23
|
-
import { HttpClient } from '../../http';
|
|
24
|
-
import { NotifyProjectsModule } from './projects';
|
|
25
|
-
import type { CreateNotifySendOptions, NotifySendResult, NotifyPreset, NotifyPresetName, NotifyPresetSendOptions, ListNotifyInboxOptions, ListNotifyInboxResponse, MarkNotifyInboxStateOptions, MarkNotifyInboxStateResponse, MarkNotifyInboxAllOptions, MarkNotifyInboxAllResponse, NotifySendStatus, ListNotifySendsOptions, ListNotifySendsResponse, RecallNotifySendOptions, RecallNotifySendResponse, ListNotifyReceiptsOptions, ListNotifyReceiptsResponse, NotifySendReceiptsResponse, NotifyConfigPatch, NotifyConfigResponse, NotifyDestinationKind, NotifyDestinationTestResult } from './types';
|
|
26
|
-
/**
|
|
27
|
-
* The five secure-by-default preset bundles: the server's own table, in this
|
|
28
|
-
* SDK's camelCase shape.
|
|
29
|
-
*
|
|
30
|
-
* There is no preset endpoint: presets are a merge over the one send contract,
|
|
31
|
-
* so they are applied client-side and produce an ordinary `send` request. Caller
|
|
32
|
-
* arguments win over a preset's defaults wherever they state a value;
|
|
33
|
-
* `channels` left unset lets the account config resolve the ladder per category.
|
|
34
|
-
*
|
|
35
|
-
* `alert` is the only plaintext preset: a non-confidential ping is read at a
|
|
36
|
-
* glance rather than behind a tap-to-view link, on the account's ladder. The
|
|
37
|
-
* other four seal, on the channels every organization's recipients are reached
|
|
38
|
-
* on: `secureMessage` by email alone, `conversation`, `approval` and
|
|
39
|
-
* `signatureRequest` in your Notify inbox (`in_app`) and then by email.
|
|
40
|
-
* `approval` and `signatureRequest` verify at `identifier`: pass
|
|
41
|
-
* `policy: { verificationLevel: 'passkey' }` explicitly when the audience is
|
|
42
|
-
* known to be enrolled.
|
|
43
|
-
*
|
|
44
|
-
* Every send in the process reads this one table, so it is frozen all the way
|
|
45
|
-
* down; `buildNotifyPresetSend` hands back options of the caller's own.
|
|
46
|
-
*/
|
|
47
|
-
export declare const NOTIFY_PRESETS: Readonly<Record<NotifyPresetName, NotifyPreset>>;
|
|
48
|
-
/**
|
|
49
|
-
* Merge a preset's bundle UNDER the caller's arguments, yielding ordinary send
|
|
50
|
-
* options: the Core API's own merge (`mergePresetSend`), so a preset sends the
|
|
51
|
-
* same through either. Exported so a caller can inspect (or further adjust)
|
|
52
|
-
* what a preset would send before sending it: the options are the caller's own,
|
|
53
|
-
* so adjusting them never reaches the preset table or any other send.
|
|
54
|
-
*/
|
|
55
|
-
export declare function buildNotifyPresetSend(preset: NotifyPresetName, options: NotifyPresetSendOptions): CreateNotifySendOptions;
|
|
56
|
-
export declare class NotifyProductModule {
|
|
57
|
-
private readonly http;
|
|
58
|
-
readonly projects: NotifyProjectsModule;
|
|
59
|
-
private readonly projectId?;
|
|
60
|
-
constructor(http: HttpClient, projectId?: string);
|
|
61
|
-
/**
|
|
62
|
-
* Bind every send, read and setting to one project. The original module keeps
|
|
63
|
-
* addressing Default for existing integrations; this never changes global state.
|
|
64
|
-
*/
|
|
65
|
-
project(projectId: string): NotifyProductModule;
|
|
66
|
-
/** Compose two already-validated paths; project selection never enters a body. */
|
|
67
|
-
private path;
|
|
68
|
-
/**
|
|
69
|
-
* Send a notification: seal the content, mint one single-use SparkLink per
|
|
70
|
-
* recipient, and enqueue delivery across the resolved channel ladder.
|
|
71
|
-
*
|
|
72
|
-
* `sendId` is the idempotency key. Replaying an existing one with the same
|
|
73
|
-
* request returns the stored send unchanged (never re-sealed, never
|
|
74
|
-
* re-delivered), flagged `idempotent`; another request under it is refused 400
|
|
75
|
-
* (`sendId` on `CreateNotifySendOptions`).
|
|
76
|
-
*
|
|
77
|
-
* The send speaks in your organization's name, and one that would email
|
|
78
|
-
* someone goes out from your organization's own sender (`getEmailSender`) and
|
|
79
|
-
* is admitted against your hourly share of sending capacity. Each refusal is
|
|
80
|
-
* a thrown `SparkVaultError` whose `serviceCode` names it, made before
|
|
81
|
-
* anything is sealed, charged or stored; a send that fails while it seals
|
|
82
|
-
* gives its admitted recipients back, so its retry is admitted in the same
|
|
83
|
-
* hour:
|
|
84
|
-
*
|
|
85
|
-
* | Status | `serviceCode` | `details` | Next |
|
|
86
|
-
* | --- | --- | --- | --- |
|
|
87
|
-
* | 403 | `NOTIFY_CHANNEL_NOT_AVAILABLE` | `{ field, channels }` | Name only `in_app` and `email` |
|
|
88
|
-
* | 409 | `NOTIFY_SENDER_NAME_REQUIRED` | none | Name the organization in Settings |
|
|
89
|
-
* | 409 | `NOTIFY_SENDER_NAME_RESERVED` | `{ reason: 'reserved_name' }` | Rename the organization |
|
|
90
|
-
* | 409 | `HANDLE_REQUIRED` | `{ product: 'notify' }` | Choose the organization's handle in Company Settings |
|
|
91
|
-
* | 429 | `NOTIFY_EMAIL_ADMISSION_LIMIT` | `{ limit, window: 'hour', resets_at }` | Wait `retryAfterMs`, then send |
|
|
92
|
-
* | 503 | `EMAIL_SETUP_BUSY` | none | Retry the same send after `retryAfterMs` |
|
|
93
|
-
* | 503 | `NOTIFY_EMAIL_CAPACITY_UNAVAILABLE` | none | Retry the same send |
|
|
94
|
-
*
|
|
95
|
-
* A replay is answered from the stored send and meets none of them again.
|
|
96
|
-
*
|
|
97
|
-
* @example
|
|
98
|
-
* const send = await sv.products.notify.send({
|
|
99
|
-
* sendId: `invoice:${invoice.id}`,
|
|
100
|
-
* recipients: [{ id: user.svid, email: user.email }],
|
|
101
|
-
* content: { payload: 'Your invoice is ready.' },
|
|
102
|
-
* policy: { verificationLevel: 'identifier', interaction: 'view' },
|
|
103
|
-
* title: 'Invoice ready',
|
|
104
|
-
* category: 'transactional',
|
|
105
|
-
* });
|
|
106
|
-
*
|
|
107
|
-
* @example Send a stored file: the unsealed vault proves you hold its key
|
|
108
|
-
* const vault = await sv.vaults.unseal('vlt_abc', process.env.CONTRACTS_DVAK);
|
|
109
|
-
* await sv.products.notify.send({
|
|
110
|
-
* sendId: `contract:${contract.id}`,
|
|
111
|
-
* recipients: [{ email: counterparty.email }],
|
|
112
|
-
* ingot: { ingotId: contract.ingotId, vault },
|
|
113
|
-
* title: 'Your signed contract',
|
|
114
|
-
* category: 'transactional',
|
|
115
|
-
* });
|
|
116
|
-
*/
|
|
117
|
-
send(options: CreateNotifySendOptions): Promise<NotifySendResult>;
|
|
118
|
-
/**
|
|
119
|
-
* Frictionless informational ping: no verification, view-only, delivered
|
|
120
|
-
* INLINE (plaintext) so it is read at a glance. Channels resolve from the
|
|
121
|
-
* account config, narrowed to the ones that render cleartext.
|
|
122
|
-
*
|
|
123
|
-
* @example
|
|
124
|
-
* await sv.products.notify.sendAlert({
|
|
125
|
-
* recipients: [{ id: user.svid }],
|
|
126
|
-
* content: { payload: 'Your export finished.' },
|
|
127
|
-
* title: 'Export complete',
|
|
128
|
-
* });
|
|
129
|
-
*/
|
|
130
|
-
sendAlert(options: NotifyPresetSendOptions): Promise<NotifySendResult>;
|
|
131
|
-
/** Confidential content revealed after the recipient proves their identifier. */
|
|
132
|
-
sendSecureMessage(options: NotifyPresetSendOptions): Promise<NotifySendResult>;
|
|
133
|
-
/** Two-way thread: identifier-verified reveal plus an encrypted reply. */
|
|
134
|
-
sendConversation(options: NotifyPresetSendOptions): Promise<NotifySendResult>;
|
|
135
|
-
/**
|
|
136
|
-
* High-stakes approve/deny, identifier-verified. Pass `policy.actionHash`, the
|
|
137
|
-
* SHA-256 of the thing being approved, so the signed receipt attests to THAT:
|
|
138
|
-
* without it the receipt binds a digest of the grant, which no hash of your
|
|
139
|
-
* own copy can match.
|
|
140
|
-
*
|
|
141
|
-
* @example
|
|
142
|
-
* const actionHash = createHash('sha256').update(canonicalWire).digest('hex');
|
|
143
|
-
* await sv.products.notify.sendApproval({
|
|
144
|
-
* sendId: `wire-approval-${wire.id}`,
|
|
145
|
-
* recipients: [{ id: approver.svid, email: approver.email }],
|
|
146
|
-
* content: { payload: `Approve ${wire.amount} to ${wire.payee}?` },
|
|
147
|
-
* policy: { actionHash },
|
|
148
|
-
* });
|
|
149
|
-
*/
|
|
150
|
-
sendApproval(options: NotifyPresetSendOptions): Promise<NotifySendResult>;
|
|
151
|
-
/**
|
|
152
|
-
* Signature-on-delivery, identifier-verified. Pass `policy.actionHash`, the
|
|
153
|
-
* SHA-256 of the document being signed, so the signed receipt attests to THAT
|
|
154
|
-
* document.
|
|
155
|
-
*
|
|
156
|
-
* @example
|
|
157
|
-
* await sv.products.notify.sendSignatureRequest({
|
|
158
|
-
* sendId: `contract-${contract.id}`,
|
|
159
|
-
* recipients: [{ email: signer.email }],
|
|
160
|
-
* content: { payload: contractPdfBase64, contentType: 'application/pdf' },
|
|
161
|
-
* policy: { actionHash: createHash('sha256').update(contractPdfBytes).digest('hex') },
|
|
162
|
-
* });
|
|
163
|
-
*/
|
|
164
|
-
sendSignatureRequest(options: NotifyPresetSendOptions): Promise<NotifySendResult>;
|
|
165
|
-
/**
|
|
166
|
-
* Read one recipient's feed in your Notify inbox, newest first: exactly the
|
|
167
|
-
* notifications delivered to them `in_app`. The row IS the `in_app`
|
|
168
|
-
* delivery: its ladder carries `in_app`, because the send named it or your
|
|
169
|
-
* config resolved it and the recipient left In-app on for your site (a
|
|
170
|
-
* `security` send crosses that switch), and it is listed when that step
|
|
171
|
-
* runs: as the send fans out when `in_app` leads the ladder, and only when
|
|
172
|
-
* the step comes due when it follows `email`. A notification whose ladder
|
|
173
|
-
* carries no `in_app` (a send naming `email` alone, a recipient who switched
|
|
174
|
-
* In-app off for your site on auth.sv on any send but a `security` one, one
|
|
175
|
-
* their own preferences or block refused, one no channel reaches), one whose
|
|
176
|
-
* `in_app` step has not delivered it (and never will once a stop ended its
|
|
177
|
-
* ladder first), and the per-recipient ceiling's skip are status records
|
|
178
|
-
* only: in no view, and a mark of one is refused as not found. A sealed row carries
|
|
179
|
-
* the recipient's own pointer (`sparklink_code`, `pointer_url`) while its
|
|
180
|
-
* grant still opens, never the content; a plaintext row carries its body.
|
|
181
|
-
* Treat the answer as sensitive and keep it out of logs.
|
|
182
|
-
*
|
|
183
|
-
* A page can come back SHORT of `limit` yet still carry a non-null cursor:
|
|
184
|
-
* follow the cursor; never treat a short page as the end.
|
|
185
|
-
*
|
|
186
|
-
* @example
|
|
187
|
-
* const { notifications, cursor } = await sv.products.notify.getInbox({
|
|
188
|
-
* recipientId: user.svid,
|
|
189
|
-
* state: 'unread',
|
|
190
|
-
* });
|
|
191
|
-
*/
|
|
192
|
-
getInbox(options: ListNotifyInboxOptions): Promise<ListNotifyInboxResponse>;
|
|
193
|
-
/**
|
|
194
|
-
* Apply a terminal display state to one row (idempotent). `createdAt` MUST be
|
|
195
|
-
* the row's own `created_at`, round-tripped from the feed row; the id alone
|
|
196
|
-
* cannot address the row. Any mark (seen, read or archived) marks the row seen,
|
|
197
|
-
* which stops its escalation.
|
|
198
|
-
*
|
|
199
|
-
* @example
|
|
200
|
-
* await sv.products.notify.markInboxState(row.notification_id, {
|
|
201
|
-
* recipientId: user.svid,
|
|
202
|
-
* createdAt: row.created_at,
|
|
203
|
-
* state: 'read',
|
|
204
|
-
* });
|
|
205
|
-
*/
|
|
206
|
-
markInboxState(notificationId: string, options: MarkNotifyInboxStateOptions): Promise<MarkNotifyInboxStateResponse>;
|
|
207
|
-
/**
|
|
208
|
-
* Bulk-mark one bounded page of a recipient's inbox `seen` or `read`. Loop on
|
|
209
|
-
* the returned cursor until it is null. `archived` is per-row only.
|
|
210
|
-
*
|
|
211
|
-
* @example
|
|
212
|
-
* let cursor: string | undefined;
|
|
213
|
-
* do {
|
|
214
|
-
* const page = await sv.products.notify.markInboxAll({
|
|
215
|
-
* recipientId: user.svid, state: 'read', cursor,
|
|
216
|
-
* });
|
|
217
|
-
* cursor = page.cursor ?? undefined;
|
|
218
|
-
* } while (cursor);
|
|
219
|
-
*/
|
|
220
|
-
markInboxAll(options: MarkNotifyInboxAllOptions): Promise<MarkNotifyInboxAllResponse>;
|
|
221
|
-
/**
|
|
222
|
-
* The account's send history, newest first: what you sent, to how many, and
|
|
223
|
-
* how it landed.
|
|
224
|
-
*
|
|
225
|
-
* Metadata only by construction: the history index does not project the
|
|
226
|
-
* audience, so no recipient contact or SparkLink pointer can travel here. Take
|
|
227
|
-
* `getSendStatus(sendId)` for the per-recipient detail.
|
|
228
|
-
*
|
|
229
|
-
* Real pagination: a null `cursor` means the end of the account's history.
|
|
230
|
-
* A delivery counter is null until its first increment, so it reads 0 there.
|
|
231
|
-
*
|
|
232
|
-
* @example
|
|
233
|
-
* let cursor: string | undefined;
|
|
234
|
-
* do {
|
|
235
|
-
* const page = await sv.products.notify.listSends({ cursor, limit: 50 });
|
|
236
|
-
* for (const send of page.sends) {
|
|
237
|
-
* console.log(send.created_at, send.title, send.state,
|
|
238
|
-
* `${send.delivered_count ?? 0} / ${send.recipient_count ?? '?'}`);
|
|
239
|
-
* }
|
|
240
|
-
* cursor = page.cursor ?? undefined;
|
|
241
|
-
* } while (cursor);
|
|
242
|
-
*/
|
|
243
|
-
listSends(options?: ListNotifySendsOptions): Promise<ListNotifySendsResponse>;
|
|
244
|
-
/**
|
|
245
|
-
* Recall a sealed send: revoke the single-use SparkLink grants it minted, so
|
|
246
|
-
* the content can no longer be revealed.
|
|
247
|
-
*
|
|
248
|
-
* `mode: 'grant'` (the default) drops access and leaves the content intact.
|
|
249
|
-
* `mode: 'content'` hard-burns the sealed spark so it is unreadable for
|
|
250
|
-
* everyone. Spark-backed sends only: an ingot send merely references the
|
|
251
|
-
* owner's durable vault content, so a content recall of one is a 400, refused
|
|
252
|
-
* before anything is revoked or stopped.
|
|
253
|
-
*
|
|
254
|
-
* Idempotent: a grant already revoked (or already consumed) counts as recalled,
|
|
255
|
-
* so a repeated call converges rather than accumulating failures. One
|
|
256
|
-
* recipient's failure never stops the rest; the response reports every one.
|
|
257
|
-
*
|
|
258
|
-
* PLAINTEXT SENDS CANNOT BE RECALLED (400): they delivered their body inline,
|
|
259
|
-
* in the clear, and minted no grant. There is nothing to revoke, and saying
|
|
260
|
-
* otherwise would be a lie about the one thing you are asking.
|
|
261
|
-
*
|
|
262
|
-
* @example
|
|
263
|
-
* // Whole audience, access only
|
|
264
|
-
* await sv.products.notify.recallSend(send.send_id);
|
|
265
|
-
*
|
|
266
|
-
* // One recipient, burn the content for everyone
|
|
267
|
-
* const { recalled, failed } = await sv.products.notify.recallSend(send.send_id, {
|
|
268
|
-
* recipientIds: [user.svid],
|
|
269
|
-
* mode: 'content',
|
|
270
|
-
* });
|
|
271
|
-
*/
|
|
272
|
-
recallSend(sendId: string, options?: RecallNotifySendOptions): Promise<RecallNotifySendResponse>;
|
|
273
|
-
/**
|
|
274
|
-
* The sender's per-recipient delivery rollup for one send: who it reached and
|
|
275
|
-
* how far each recipient got. Metadata only: never the pointer, and no contact
|
|
276
|
-
* beyond the handle each recipient was addressed by (`recipient_id`).
|
|
277
|
-
*
|
|
278
|
-
* @example
|
|
279
|
-
* const { counts } = await sv.products.notify.getSendStatus(send.send_id);
|
|
280
|
-
*/
|
|
281
|
-
getSendStatus(sendId: string): Promise<NotifySendStatus>;
|
|
282
|
-
/**
|
|
283
|
-
* The account's verified-interaction receipts (a ceremony's carries portable,
|
|
284
|
-
* JWKS-verifiable proof; an open's is an unsigned access record), newest
|
|
285
|
-
* first, with real pagination. An `interaction` filter can hand back a short
|
|
286
|
-
* or empty page while more follow, so follow `cursor` until it is null before
|
|
287
|
-
* concluding there are none.
|
|
288
|
-
*
|
|
289
|
-
* @example
|
|
290
|
-
* const { receipts, cursor } = await sv.products.notify.listReceipts({ interaction: 'approve' });
|
|
291
|
-
*/
|
|
292
|
-
listReceipts(options?: ListNotifyReceiptsOptions): Promise<ListNotifyReceiptsResponse>;
|
|
293
|
-
/**
|
|
294
|
-
* Every receipt for one send, each attached to the recipient who produced it.
|
|
295
|
-
* The walk reads the account's receipts back to the send's creation, and no
|
|
296
|
-
* further. One call is bounded: when `truncated` is true it stopped first;
|
|
297
|
-
* pass the returned `cursor` back in to resume exactly where it stopped.
|
|
298
|
-
*
|
|
299
|
-
* @example
|
|
300
|
-
* const all: NotifySendReceipt[] = [];
|
|
301
|
-
* let cursor: string | undefined;
|
|
302
|
-
* do {
|
|
303
|
-
* const page = await sv.products.notify.getSendReceipts(send.send_id, { cursor });
|
|
304
|
-
* all.push(...page.receipts);
|
|
305
|
-
* cursor = page.truncated ? page.cursor ?? undefined : undefined;
|
|
306
|
-
* } while (cursor);
|
|
307
|
-
*/
|
|
308
|
-
getSendReceipts(sendId: string, options?: {
|
|
309
|
-
cursor?: string;
|
|
310
|
-
}): Promise<NotifySendReceiptsResponse>;
|
|
311
|
-
/**
|
|
312
|
-
* The account's effective Notify config (secure defaults deep-merged with its
|
|
313
|
-
* overrides) plus the raw override delta, so an editor can show what is
|
|
314
|
-
* customized versus default, and the `version` of the stored config they
|
|
315
|
-
* show (0 before anything is saved, one higher with each save). Answers can
|
|
316
|
-
* arrive out of order, as two overlapping `updateConfig` calls' can: the one
|
|
317
|
-
* with the higher `version` is the newer config, so keep that one.
|
|
318
|
-
*
|
|
319
|
-
* @example
|
|
320
|
-
* const { effective, overrides, version } = await sv.products.notify.getConfig();
|
|
321
|
-
*/
|
|
322
|
-
getConfig(): Promise<NotifyConfigResponse>;
|
|
323
|
-
/**
|
|
324
|
-
* Merge a partial patch onto the account's config overrides. Unknown keys are
|
|
325
|
-
* rejected before any write.
|
|
326
|
-
*
|
|
327
|
-
* Delete a category by storing an explicit `null` TOMBSTONE: that is what keeps
|
|
328
|
-
* a seeded default from re-appearing on the next merge. The reserved `security`
|
|
329
|
-
* category can neither be removed nor made optional, the promotional
|
|
330
|
-
* categories `marketing` and `product` can never be made required: their email
|
|
331
|
-
* always carries an unsubscribe link, and `help_desk_alert` can be neither
|
|
332
|
-
* removed nor made required: each member decides on auth.sv, under it, whether
|
|
333
|
-
* the help desk's alerts reach them.
|
|
334
|
-
*
|
|
335
|
-
* The `events` section configures the outbound event webhook: `webhook_url`
|
|
336
|
-
* must be https on a public host, and `secret` (16-256 chars) signs every event
|
|
337
|
-
* body as `X-SparkVault-Signature: hex(HMAC-SHA256(secret, rawBody))`. Both
|
|
338
|
-
* are WRITE-ONLY: reads report `events.webhook_url_set`,
|
|
339
|
-
* `events.webhook_url_host` and `events.secret_set`, never the values. A
|
|
340
|
-
* `webhook_url` on another host or port needs a new `secret` in the same
|
|
341
|
-
* patch (400 `VALIDATION_ERROR` naming `events.secret`), so a secret never
|
|
342
|
-
* follows its URL to a different host. `events: null` removes the webhook,
|
|
343
|
-
* URL and secret together.
|
|
344
|
-
*
|
|
345
|
-
* The `email` section selects a domain of your own for your Notify email to go
|
|
346
|
-
* out from. `security`, `events` and `email` are an org admin's to change: a
|
|
347
|
-
* patch from anyone else naming one is refused whole, 403 `FORBIDDEN`
|
|
348
|
-
* (`details: { sections, required_role: 'admin' }`). A ladder naming a channel
|
|
349
|
-
* other than `in_app` and `email` is refused 403 `NOTIFY_CHANNEL_NOT_AVAILABLE`
|
|
350
|
-
* (`details: { field, channels }`); a save that overlapping saves kept
|
|
351
|
-
* outracing is refused 409 `CONFLICT`: reload and patch again. A save answers
|
|
352
|
-
* as `getConfig` does, its `version` the one this save wrote.
|
|
353
|
-
*
|
|
354
|
-
* @example
|
|
355
|
-
* await sv.products.notify.updateConfig({
|
|
356
|
-
* categories: {
|
|
357
|
-
* weekly_newsletter: { label: 'Weekly newsletter', required: false },
|
|
358
|
-
* marketing: null, // tombstone: remove the seeded default
|
|
359
|
-
* },
|
|
360
|
-
* events: {
|
|
361
|
-
* webhook_url: 'https://api.example.com/hooks/sparkvault',
|
|
362
|
-
* secret: process.env.SPARKVAULT_EVENT_SECRET,
|
|
363
|
-
* },
|
|
364
|
-
* });
|
|
365
|
-
*/
|
|
366
|
-
updateConfig(patch: NotifyConfigPatch): Promise<NotifyConfigResponse>;
|
|
367
|
-
/**
|
|
368
|
-
* Post one test message to your destination of `kind` (a webhook, a Slack
|
|
369
|
-
* channel or a Teams workflow) and learn what became of it, without a send:
|
|
370
|
-
* nothing reaches a recipient, no send is stored, and
|
|
371
|
-
* the test spends destination delivery credits and never appears in send history. The post shows the title "Test
|
|
372
|
-
* post from SparkVault Notify" under your organization's name, through the
|
|
373
|
-
* sender a send's post takes. A webhook receives a body signed like any
|
|
374
|
-
* other, typed `notify.destination.test`, naming no send, with a
|
|
375
|
-
* `delivery_id` of its own. The post is made once and never tried again,
|
|
376
|
-
* so a fault a send's post would retry reads `failed`. Retain request_id across retries;
|
|
377
|
-
* a replay returns the saved verdict without another post or charge.
|
|
378
|
-
*
|
|
379
|
-
* An org admin's call: anyone else is
|
|
380
|
-
* refused 403 `FORBIDDEN` (`details: { sections: ['destinations'],
|
|
381
|
-
* required_role: 'admin' }`). Insufficient credits returns a failed verdict
|
|
382
|
-
* with reason `usage_credits_exhausted`. A kind with no destination saved is 404
|
|
383
|
-
* `NOT_FOUND`, an organization name a send would be refused under is 409
|
|
384
|
-
* (`NOTIFY_SENDER_NAME_REQUIRED` or `NOTIFY_SENDER_NAME_RESERVED`), and each
|
|
385
|
-
* kind takes 20 tests an hour (429 `RATE_LIMIT_EXCEEDED`).
|
|
386
|
-
*
|
|
387
|
-
* @example
|
|
388
|
-
* const { state, reason } = await sv.products.notify.testDestination('webhook', { request_id: 'test_webhook_0001' });
|
|
389
|
-
* if (state !== 'delivered') console.warn(`Test post ${state}: ${reason}`);
|
|
390
|
-
*/
|
|
391
|
-
testDestination(kind: NotifyDestinationKind, request: {
|
|
392
|
-
request_id: string;
|
|
393
|
-
}): Promise<NotifyDestinationTestResult>;
|
|
394
|
-
/**
|
|
395
|
-
* Who your organization's Notify email is from, as the API answers it
|
|
396
|
-
* (verbatim snake_case): `"{organization name}" <from_address>`, with a
|
|
397
|
-
* notice naming SparkVault Notify. A reply reaches no one when the email goes
|
|
398
|
-
* out from the handle host, or from a domain of your own that is set up as a
|
|
399
|
-
* help-desk web host or receives the help desk's email; from a domain that
|
|
400
|
-
* only sends, a reply goes wherever that domain's own MX records route it.
|
|
401
|
-
*
|
|
402
|
-
* - `ready`: the email goes out from `from_address`, on `sending_host`: the
|
|
403
|
-
* domain `email.sending_domain` selects while it serves sending (its
|
|
404
|
-
* ownership verified and its sending ready), else the organization's handle
|
|
405
|
-
* host under send.sv, `handle_host`, which it falls back to the moment the
|
|
406
|
-
* domain stops serving.
|
|
407
|
-
* - `handle_required`: the organization has not chosen its handle, so a send
|
|
408
|
-
* that would email someone is refused 409 `HANDLE_REQUIRED` until it does.
|
|
409
|
-
* - `platform_sender`: SparkVault's own account, whose Notify email is
|
|
410
|
-
* platform mail.
|
|
411
|
-
*
|
|
412
|
-
* `domain_readiness` is the selected domain's readiness flags, null with no
|
|
413
|
-
* selection or while the organization does not hold the domain's claim.
|
|
414
|
-
*
|
|
415
|
-
* @example
|
|
416
|
-
* const sender = await sv.products.notify.getEmailSender();
|
|
417
|
-
* if (sender.state === 'handle_required') promptForHandle();
|
|
418
|
-
*/
|
|
419
|
-
getEmailSender(): Promise<{
|
|
420
|
-
state: 'ready' | 'handle_required' | 'platform_sender';
|
|
421
|
-
from_address: string | null;
|
|
422
|
-
handle_host: string | null;
|
|
423
|
-
sending_domain: string | null;
|
|
424
|
-
sending_host: string | null;
|
|
425
|
-
domain_readiness: {
|
|
426
|
-
email_sending_ready: boolean;
|
|
427
|
-
email_receiving_ready: boolean;
|
|
428
|
-
web_ready: boolean;
|
|
429
|
-
help_desk_selectable: boolean;
|
|
430
|
-
notify_selectable: boolean;
|
|
431
|
-
} | null;
|
|
432
|
-
}>;
|
|
433
|
-
}
|
|
434
|
-
export type { NotifyChannel, NotifyDeliveryMode, NotifyVerificationLevel, NotifyInteraction, NotifyPresetCategory, NotifyCategory, NotifyPresetName, NotifyPresetSendOptions, NotifyPreset, NotifyRecipient, NotifyRecipientRef, NotifySendContent, NotifyIngotRef, NotifySendPolicy, NotifyEscalation, CreateNotifySendOptions, NotifySendResult, NotifyInboxView, NotifyInboxMarkState, NotifyInboxBulkMarkState, NotifyInboxRow, ListNotifyInboxOptions, ListNotifyInboxResponse, MarkNotifyInboxStateOptions, MarkNotifyInboxStateResponse, MarkNotifyInboxAllOptions, MarkNotifyInboxAllResponse, NotifySendStatus, NotifySendStatusRecipient, NotifyRecipientState, NotifySuppressionReason, NotifySendStatusCounts, NotifySendState, NotifySendSummary, ListNotifySendsOptions, ListNotifySendsResponse, NotifyRecallMode, RecallNotifySendOptions, RecallNotifySendResponse, NotifyReceipt, NotifyReportableVerificationLevel, NotifyReceiptEventType, NotifySendReceipt, ListNotifyReceiptsOptions, ListNotifyReceiptsResponse, NotifySendReceiptsResponse, NotifyConfig, NotifyConfigCategory, NotifyConfigDelivery, NotifyConfigDeliveryPatch, NotifyConfigRealtimeFallbackDelay, NotifyConfigReliability, NotifyConfigHistory, NotifyConfigSecurity, NotifyConfigEvents, NotifyConfigEventsRead, NotifyConfigPatch, NotifyConfigOverrides, NotifyConfigResponse, NotifyDestinationKind, NotifyDestinationState, NotifyDestinationSkipReason, NotifyDestinationFailureReason, NotifyDestinationReason, NotifyDestinationTransportReason, NotifyConfigRefusalReason, NotifyDestinationTestReason, NotifyDestinationTestResult, NotifySendStatusDestination, NotifySendSummaryDestination, NotifyWebhookDestination, NotifyWebhookDestinationRead, NotifySlackDestination, NotifySlackDestinationRead, NotifyTeamsDestination, NotifyTeamsDestinationRead, NotifyConfigDestinations, NotifyConfigDestinationsPatch, } from './types';
|
|
435
|
-
export { NotifyProjectsModule } from './projects';
|
|
436
|
-
export type * from './project-types';
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/** Named Notify projects owned by one company and funded by its shared wallet. */
|
|
2
|
-
export type NotifyProjectStatus = 'active' | 'archived';
|
|
3
|
-
export interface NotifyProjectBilling {
|
|
4
|
-
billing_model: 'usage_credits';
|
|
5
|
-
enabled: boolean;
|
|
6
|
-
}
|
|
7
|
-
export interface NotifyProjectUsage {
|
|
8
|
-
notifications_used: number;
|
|
9
|
-
cycle_resets_at: number | null;
|
|
10
|
-
}
|
|
11
|
-
export interface NotifyProject {
|
|
12
|
-
/** Immutable project id. `default` addresses the existing account's Notify. */
|
|
13
|
-
project_id: string;
|
|
14
|
-
account_id: string;
|
|
15
|
-
name: string;
|
|
16
|
-
description: string;
|
|
17
|
-
/** Optional project sender name; null uses the organization's name. */
|
|
18
|
-
sender_name: string | null;
|
|
19
|
-
status: NotifyProjectStatus;
|
|
20
|
-
/** Epoch seconds. */
|
|
21
|
-
created_at: number;
|
|
22
|
-
updated_at: number;
|
|
23
|
-
archived_at?: number;
|
|
24
|
-
billing: NotifyProjectBilling;
|
|
25
|
-
usage: NotifyProjectUsage;
|
|
26
|
-
}
|
|
27
|
-
export interface ListNotifyProjectsResponse {
|
|
28
|
-
items: NotifyProject[];
|
|
29
|
-
}
|
|
30
|
-
export interface CreateNotifyProjectOptions {
|
|
31
|
-
/** Stable idempotency key: 16 to 128 letters, numbers, underscores or hyphens. */
|
|
32
|
-
request_id: string;
|
|
33
|
-
/** A recognizable name, up to 80 characters. */
|
|
34
|
-
name: string;
|
|
35
|
-
/** Up to 240 characters. */
|
|
36
|
-
description?: string;
|
|
37
|
-
/** Up to 64 characters; null uses the organization's name. */
|
|
38
|
-
sender_name?: string | null;
|
|
39
|
-
}
|
|
40
|
-
export interface UpdateNotifyProjectOptions {
|
|
41
|
-
name?: string;
|
|
42
|
-
description?: string;
|
|
43
|
-
sender_name?: string | null;
|
|
44
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { HttpClient } from '../../http';
|
|
2
|
-
import type { CreateNotifyProjectOptions, ListNotifyProjectsResponse, NotifyProject, UpdateNotifyProjectOptions } from './project-types';
|
|
3
|
-
/** Reject malformed project paths before a credentialed request leaves. */
|
|
4
|
-
export declare function requireNotifyProjectId(projectId: unknown): string;
|
|
5
|
-
/** Company-level project management. Creation is idempotent and charges nothing. */
|
|
6
|
-
export declare class NotifyProjectsModule {
|
|
7
|
-
private readonly http;
|
|
8
|
-
constructor(http: HttpClient);
|
|
9
|
-
list(): Promise<ListNotifyProjectsResponse>;
|
|
10
|
-
create(options: CreateNotifyProjectOptions): Promise<NotifyProject>;
|
|
11
|
-
get(projectId: string): Promise<NotifyProject>;
|
|
12
|
-
update(projectId: string, options: UpdateNotifyProjectOptions): Promise<NotifyProject>;
|
|
13
|
-
/** Archive an active project; Default cannot be archived. */
|
|
14
|
-
archive(projectId: string): Promise<NotifyProject>;
|
|
15
|
-
}
|