@sparkvault/sdk-js 14.2.1 → 14.2.3
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 -6
- package/dist/index.cjs +1734 -1114
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +145 -26
- package/dist/index.mjs +1734 -1114
- package/dist/index.mjs.map +1 -1
- package/dist/notify/index.d.ts +6 -3
- package/dist/notify/types.d.ts +8 -2
- package/dist/products/help-desk/client.d.ts +18 -4
- package/dist/products/help-desk/form-attachments.d.ts +1 -0
- package/dist/products/help-desk/form.d.ts +20 -1
- package/dist/products/help-desk/types.d.ts +3 -1
- package/dist/products/index.d.ts +1 -1
- package/dist/products/notify/index.d.ts +31 -4
- package/dist/products/notify/types.d.ts +80 -13
- package/dist/sparkvault.js +1 -1
- package/dist/sparkvault.js.map +1 -1
- package/dist/ui/modal-shell.d.ts +41 -8
- package/package.json +1 -1
package/dist/notify/index.d.ts
CHANGED
|
@@ -113,9 +113,12 @@ export declare class NotifyModule {
|
|
|
113
113
|
* End-to-end enable ceremony: feature-detect, fetch the VAPID key, ensure
|
|
114
114
|
* Notification permission, subscribe via the caller's service worker, and
|
|
115
115
|
* register the subscription with the server. Returns a typed status instead
|
|
116
|
-
* of throwing on the expected declines
|
|
117
|
-
*
|
|
118
|
-
*
|
|
116
|
+
* of throwing on the expected declines so a host can branch on the outcome:
|
|
117
|
+
* unsupported, not configured, `permission_denied` (the person blocked
|
|
118
|
+
* notifications for the site, now or before, so only the browser's site
|
|
119
|
+
* settings can allow them) and `permission_dismissed` (the person closed the
|
|
120
|
+
* prompt without answering: the site still asks, so enabling again shows the
|
|
121
|
+
* prompt again). Call it from a user gesture (permission prompts require one).
|
|
119
122
|
*
|
|
120
123
|
* A subscription the browser holds for the current key is kept
|
|
121
124
|
* (`already_subscribed`); one made for a previous key can never deliver
|
package/dist/notify/types.d.ts
CHANGED
|
@@ -177,8 +177,14 @@ export interface UnsubscribeWebPushResponse {
|
|
|
177
177
|
success: boolean;
|
|
178
178
|
deleted: boolean;
|
|
179
179
|
}
|
|
180
|
-
/**
|
|
181
|
-
|
|
180
|
+
/**
|
|
181
|
+
* Terminal outcomes of the end-to-end subscribeWebPush ceremony.
|
|
182
|
+
* `permission_denied`: notifications are blocked for the site (the person
|
|
183
|
+
* chose Block, now or before), so only the browser's site settings can allow
|
|
184
|
+
* them. `permission_dismissed`: the person closed the permission prompt
|
|
185
|
+
* without answering, so the site still asks and calling again prompts again.
|
|
186
|
+
*/
|
|
187
|
+
export type SubscribeWebPushStatus = 'subscribed' | 'already_subscribed' | 'not_supported' | 'not_configured' | 'permission_denied' | 'permission_dismissed';
|
|
182
188
|
export interface SubscribeWebPushOptions {
|
|
183
189
|
/**
|
|
184
190
|
* The caller's service-worker registration (the app owns the worker file and
|
|
@@ -18,15 +18,24 @@ export declare class HelpDeskClient {
|
|
|
18
18
|
private authorityRevision;
|
|
19
19
|
private readonly listeners;
|
|
20
20
|
private session;
|
|
21
|
+
/**
|
|
22
|
+
* When the installed session ends on this device's clock, in seconds: set
|
|
23
|
+
* from `ttl_seconds` as an answer lands from Core. Null for a session whose
|
|
24
|
+
* landing this client did not see (setSession), which ends at Core's 401.
|
|
25
|
+
*/
|
|
26
|
+
private deadline;
|
|
21
27
|
private token;
|
|
22
28
|
private revision;
|
|
23
29
|
private constructor();
|
|
24
30
|
/** Discover a desk by its configured host, before any customer credentials are sent. */
|
|
25
31
|
static connect(config: ResolvedConfig, options: HelpDeskConnectOptions): Promise<HelpDeskClient>;
|
|
26
32
|
/**
|
|
27
|
-
* Install a customer session answer
|
|
28
|
-
*
|
|
29
|
-
*
|
|
33
|
+
* Install a customer session answer the host holds, such as one restored
|
|
34
|
+
* from its own storage. Its landing time is unknown, so this client sets it
|
|
35
|
+
* no deadline of its own: it lasts until Core answers 401, which clears it.
|
|
36
|
+
* A company provider verifies restored sessions again before use. Null
|
|
37
|
+
* stays signed out until refreshSession() or authenticate() explicitly
|
|
38
|
+
* resumes the provider.
|
|
30
39
|
*/
|
|
31
40
|
setSession(session: HelpDeskSession | null): void;
|
|
32
41
|
private installSession;
|
|
@@ -46,7 +55,11 @@ export declare class HelpDeskClient {
|
|
|
46
55
|
private rememberToken;
|
|
47
56
|
private send;
|
|
48
57
|
private establish;
|
|
49
|
-
/**
|
|
58
|
+
/**
|
|
59
|
+
* A public, short-lived challenge from the help desk's own Entropy service.
|
|
60
|
+
* Core refuses a nonce past its `expires_at` on its own clock, so this
|
|
61
|
+
* device's clock never judges it.
|
|
62
|
+
*/
|
|
50
63
|
startExternalChallenge(): Promise<HelpDeskExternalChallenge>;
|
|
51
64
|
/** Exchange only a purpose-specific company assertion, never an ordinary website token. */
|
|
52
65
|
completeExternal(options: {
|
|
@@ -56,6 +69,7 @@ export declare class HelpDeskClient {
|
|
|
56
69
|
private exchangeExternal;
|
|
57
70
|
/** Silently establish/renew a company session. Concurrent calls share one proof. */
|
|
58
71
|
authenticate(): Promise<HelpDeskSession | null>;
|
|
72
|
+
/** Install a company session answer that just landed from Core, timed from its `ttl_seconds`. */
|
|
59
73
|
private acceptExternalSession;
|
|
60
74
|
/** Mint an opaque hosted-portal code from an assertion binding the registered redirect challenge. */
|
|
61
75
|
createExternalHandoff(options: {
|
|
@@ -8,6 +8,7 @@ export declare function createFormAttachments(client: HelpDeskClient, prefix: st
|
|
|
8
8
|
element: HTMLDivElement;
|
|
9
9
|
readonly attachmentIds: string[];
|
|
10
10
|
readonly unresolved: boolean;
|
|
11
|
+
readonly hasEntries: boolean;
|
|
11
12
|
readonly busy: boolean;
|
|
12
13
|
start(): Promise<void>;
|
|
13
14
|
lock(value: boolean): void;
|
|
@@ -1,8 +1,27 @@
|
|
|
1
1
|
import type { HelpDeskClient } from './client';
|
|
2
2
|
import type { HelpDeskFormHandle, HelpDeskFormOptions } from './form-types';
|
|
3
|
+
/**
|
|
4
|
+
* The form's handle and the one dismissal every close control and the SDK's
|
|
5
|
+
* modal route through. Internal: the package's public API hands out only
|
|
6
|
+
* HelpDeskFormHandle.
|
|
7
|
+
*/
|
|
8
|
+
export interface HelpDeskFormController extends HelpDeskFormHandle {
|
|
9
|
+
/**
|
|
10
|
+
* Close at once when nothing is unsent. Otherwise ask whether to discard
|
|
11
|
+
* the request, and a second request while that question shows keeps
|
|
12
|
+
* editing.
|
|
13
|
+
*/
|
|
14
|
+
requestDismiss(): void;
|
|
15
|
+
}
|
|
3
16
|
/**
|
|
4
17
|
* Inject a ticket form using only the requester's customer API. Authentication
|
|
5
18
|
* is the desk's email-code flow or an explicit host-provided customer session.
|
|
6
19
|
* Files use the same direct resumable Forge ceremony as the hosted portal.
|
|
20
|
+
*
|
|
21
|
+
* A check the form makes itself (an empty subject, a short code) and the
|
|
22
|
+
* server's refusal of a code read under the field they concern; the status
|
|
23
|
+
* line carries the flow (a code sent, a send in progress or uncertain, a
|
|
24
|
+
* changed sign-in, a server error). Closing with unsent work asks first.
|
|
25
|
+
* A confirmed send replaces the form with its confirmation.
|
|
7
26
|
*/
|
|
8
|
-
export declare function mountHelpDeskForm(client: HelpDeskClient, options: HelpDeskFormOptions):
|
|
27
|
+
export declare function mountHelpDeskForm(client: HelpDeskClient, options: HelpDeskFormOptions): HelpDeskFormController;
|
|
@@ -66,8 +66,10 @@ export interface HelpDeskCustomer {
|
|
|
66
66
|
}
|
|
67
67
|
export interface HelpDeskSession {
|
|
68
68
|
token: string;
|
|
69
|
-
/**
|
|
69
|
+
/** When Core ends the session at the latest, in Unix seconds on Core's clock. Never compared with this device's clock, which may run apart from Core's. */
|
|
70
70
|
expires_at: number;
|
|
71
|
+
/** The session's lifetime in seconds from when its answer lands; the client times a fresh answer on this device's clock from it. */
|
|
72
|
+
ttl_seconds: number;
|
|
71
73
|
customer: HelpDeskCustomer;
|
|
72
74
|
}
|
|
73
75
|
/** Why customer-specific UI is being told to reconsider its current session. */
|
package/dist/products/index.d.ts
CHANGED
|
@@ -34,4 +34,4 @@ export type * from './help-desk/types';
|
|
|
34
34
|
export type * from './help-desk/form-types';
|
|
35
35
|
export type { HelpDeskMountFormOptions, HelpDeskOpenFormOptions } from './help-desk';
|
|
36
36
|
export type { SignInOptions, SignInResult, VerifyOptions, AttachOptions, VerifyResult, TokenClaims, } from './identity';
|
|
37
|
-
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, NotifySendStatusDestination, NotifySendSummaryDestination, NotifyWebhookDestination, NotifyWebhookDestinationRead, NotifySlackDestination, NotifyTeamsDestination, NotifyTeamsDestinationRead, NotifyConfigDestinations, NotifyConfigDestinationsPatch, } from './notify';
|
|
37
|
+
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, NotifyDestinationTestReason, NotifyDestinationTestResult, NotifySendStatusDestination, NotifySendSummaryDestination, NotifyWebhookDestination, NotifyWebhookDestinationRead, NotifySlackDestination, NotifyTeamsDestination, NotifyTeamsDestinationRead, NotifyConfigDestinations, NotifyConfigDestinationsPatch, } from './notify';
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* and metadata.
|
|
22
22
|
*/
|
|
23
23
|
import { HttpClient } from '../../http';
|
|
24
|
-
import type { CreateNotifySendOptions, NotifySendResult, NotifyPreset, NotifyPresetName, NotifyPresetSendOptions, ListNotifyInboxOptions, ListNotifyInboxResponse, MarkNotifyInboxStateOptions, MarkNotifyInboxStateResponse, MarkNotifyInboxAllOptions, MarkNotifyInboxAllResponse, NotifySendStatus, ListNotifySendsOptions, ListNotifySendsResponse, RecallNotifySendOptions, RecallNotifySendResponse, ListNotifyReceiptsOptions, ListNotifyReceiptsResponse, NotifySendReceiptsResponse, NotifyConfigPatch, NotifyConfigResponse } from './types';
|
|
24
|
+
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';
|
|
25
25
|
/**
|
|
26
26
|
* The five secure-by-default preset bundles: the server's own table, in this
|
|
27
27
|
* SDK's camelCase shape.
|
|
@@ -68,7 +68,9 @@ export declare class NotifyProductModule {
|
|
|
68
68
|
* someone goes out from your organization's own sender (`getEmailSender`) and
|
|
69
69
|
* is admitted against your hourly share of sending capacity. Each refusal is
|
|
70
70
|
* a thrown `SparkVaultError` whose `serviceCode` names it, made before
|
|
71
|
-
* anything is sealed, charged or stored
|
|
71
|
+
* anything is sealed, charged or stored; a send that fails while it seals
|
|
72
|
+
* gives its admitted recipients back, so its retry is admitted in the same
|
|
73
|
+
* hour:
|
|
72
74
|
*
|
|
73
75
|
* | Status | `serviceCode` | `details` | Next |
|
|
74
76
|
* | --- | --- | --- | --- |
|
|
@@ -324,7 +326,8 @@ export declare class NotifyProductModule {
|
|
|
324
326
|
* `events.webhook_url_host` and `events.secret_set`, never the values. A
|
|
325
327
|
* `webhook_url` on another host or port needs a new `secret` in the same
|
|
326
328
|
* patch (400 `VALIDATION_ERROR` naming `events.secret`), so a secret never
|
|
327
|
-
* follows its URL to a different host.
|
|
329
|
+
* follows its URL to a different host. `events: null` removes the webhook,
|
|
330
|
+
* URL and secret together.
|
|
328
331
|
*
|
|
329
332
|
* The `email` section selects a domain of your own for your Notify email to go
|
|
330
333
|
* out from. `security`, `events` and `email` are an org admin's to change: a
|
|
@@ -347,6 +350,30 @@ export declare class NotifyProductModule {
|
|
|
347
350
|
* });
|
|
348
351
|
*/
|
|
349
352
|
updateConfig(patch: NotifyConfigPatch): Promise<NotifyConfigResponse>;
|
|
353
|
+
/**
|
|
354
|
+
* Post one test message to your destination of `kind` (a webhook, a Slack
|
|
355
|
+
* channel or a Teams workflow) and learn what became of it, without a send:
|
|
356
|
+
* nothing reaches a recipient, no send is stored and nothing is metered, and
|
|
357
|
+
* the test never appears in send history. The post shows the title "Test
|
|
358
|
+
* post from SparkVault Notify" under your organization's name, through the
|
|
359
|
+
* sender a send's post takes. A webhook receives a body signed like any
|
|
360
|
+
* other, typed `notify.destination.test`, naming no send, with a
|
|
361
|
+
* `delivery_id` of its own. The post is made once and never tried again,
|
|
362
|
+
* so a fault a send's post would retry reads `failed`.
|
|
363
|
+
*
|
|
364
|
+
* An org admin's call, on an account that holds Notify: anyone else is
|
|
365
|
+
* refused 403 `FORBIDDEN` (`details: { sections: ['destinations'],
|
|
366
|
+
* required_role: 'admin' }`), an account without Notify 403
|
|
367
|
+
* `NOTIFY_SUBSCRIPTION_REQUIRED`. A kind with no destination saved is 404
|
|
368
|
+
* `NOT_FOUND`, an organization name a send would be refused under is 409
|
|
369
|
+
* (`NOTIFY_SENDER_NAME_REQUIRED` or `NOTIFY_SENDER_NAME_RESERVED`), and each
|
|
370
|
+
* kind takes 20 tests an hour (429 `RATE_LIMIT_EXCEEDED`).
|
|
371
|
+
*
|
|
372
|
+
* @example
|
|
373
|
+
* const { state, reason } = await sv.products.notify.testDestination('webhook');
|
|
374
|
+
* if (state !== 'delivered') console.warn(`Test post ${state}: ${reason}`);
|
|
375
|
+
*/
|
|
376
|
+
testDestination(kind: NotifyDestinationKind): Promise<NotifyDestinationTestResult>;
|
|
350
377
|
/**
|
|
351
378
|
* Who your organization's Notify email is from, as the API answers it
|
|
352
379
|
* (verbatim snake_case): `"{organization name}" <from_address>`, with a
|
|
@@ -387,4 +414,4 @@ export declare class NotifyProductModule {
|
|
|
387
414
|
} | null;
|
|
388
415
|
}>;
|
|
389
416
|
}
|
|
390
|
-
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, NotifySendStatusDestination, NotifySendSummaryDestination, NotifyWebhookDestination, NotifyWebhookDestinationRead, NotifySlackDestination, NotifyTeamsDestination, NotifyTeamsDestinationRead, NotifyConfigDestinations, NotifyConfigDestinationsPatch, } from './types';
|
|
417
|
+
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, NotifyDestinationTestReason, NotifyDestinationTestResult, NotifySendStatusDestination, NotifySendSummaryDestination, NotifyWebhookDestination, NotifyWebhookDestinationRead, NotifySlackDestination, NotifyTeamsDestination, NotifyTeamsDestinationRead, NotifyConfigDestinations, NotifyConfigDestinationsPatch, } from './types';
|
|
@@ -84,6 +84,37 @@ export type NotifyDestinationFailureReason = 'possibly_delivered' | 'attempts_ex
|
|
|
84
84
|
* (`rejected_restricted_action`).
|
|
85
85
|
*/
|
|
86
86
|
export type NotifyDestinationReason = NotifyDestinationSkipReason | NotifyDestinationFailureReason | `status_${number}` | `rejected_${string}`;
|
|
87
|
+
/**
|
|
88
|
+
* Why a test post reached no answer that settles it, a fault a send's post
|
|
89
|
+
* would be tried again on: the receiver could not be reached (`network`) or
|
|
90
|
+
* did not answer in time (`timeout`), the Teams workflow's request could not
|
|
91
|
+
* be sent at all (`unsent`), or too little of the post's time was left to
|
|
92
|
+
* start it (`deadline_reached`).
|
|
93
|
+
*/
|
|
94
|
+
export type NotifyDestinationTransportReason = 'network' | 'timeout' | 'unsent' | 'deadline_reached';
|
|
95
|
+
/**
|
|
96
|
+
* The `reason` beside a test post's `skipped` or `failed`
|
|
97
|
+
* (`testDestination`): a skip reason a send status reports, or, beside
|
|
98
|
+
* `failed`, `possibly_delivered` (the post was sent and its answer was lost),
|
|
99
|
+
* a transport fault, a status a retry can clear (`status_503`), or the Slack
|
|
100
|
+
* app's own: Slack limited the call (`slack_rate_limited`), another worker was
|
|
101
|
+
* renewing the app's token (`slack_token_refresh_in_progress`), Slack could
|
|
102
|
+
* not be reached (`slack_unavailable`), or the installation could not be read
|
|
103
|
+
* (`installation_unavailable`).
|
|
104
|
+
*/
|
|
105
|
+
export type NotifyDestinationTestReason = NotifyDestinationSkipReason | 'possibly_delivered' | NotifyDestinationTransportReason | 'slack_rate_limited' | 'slack_token_refresh_in_progress' | 'slack_unavailable' | 'installation_unavailable' | `status_${number}` | `rejected_${string}`;
|
|
106
|
+
/**
|
|
107
|
+
* What became of a test post to one of your destinations, in a send status's
|
|
108
|
+
* words. A test post is made once and never tried again, so a fault a send's
|
|
109
|
+
* post would retry reads `failed`. No send is stored and nothing is metered.
|
|
110
|
+
*/
|
|
111
|
+
export interface NotifyDestinationTestResult {
|
|
112
|
+
kind: NotifyDestinationKind;
|
|
113
|
+
/** `delivered` once the destination accepted it; `skipped` when nothing was posted; `failed` when no answer settled it. */
|
|
114
|
+
state: 'delivered' | 'skipped' | 'failed';
|
|
115
|
+
/** Null when delivered. */
|
|
116
|
+
reason: NotifyDestinationTestReason | null;
|
|
117
|
+
}
|
|
87
118
|
/**
|
|
88
119
|
* How a send's content reaches the recipient.
|
|
89
120
|
* - `sealed` (default): content is sealed into a Spark behind a single-use
|
|
@@ -139,6 +170,9 @@ export type NotifyPresetName = 'alert' | 'secureMessage' | 'conversation' | 'app
|
|
|
139
170
|
* proves to open it. A bare string is an email address or one of those
|
|
140
171
|
* SparkVault ids: a bare address is also the address its recipient proves,
|
|
141
172
|
* while a bare id keys the person's inbox row and carries no address to verify.
|
|
173
|
+
* An `id` that is an email address, with no `email` beside it, is that address:
|
|
174
|
+
* `{ id: 'pat@example.com' }`, `'pat@example.com'` and
|
|
175
|
+
* `{ email: 'pat@example.com' }` are one recipient, emailed and verified alike.
|
|
142
176
|
*
|
|
143
177
|
* The recipient's key is its `id`, else its `email`, trimmed, with an email
|
|
144
178
|
* address lowercased the way Identity stores it: it names their row in your
|
|
@@ -157,11 +191,15 @@ export type NotifyPresetName = 'alert' | 'secureMessage' | 'conversation' | 'app
|
|
|
157
191
|
* bare number, `{ phone }`, or an `id` that is an E.164 number); on a sealed
|
|
158
192
|
* send, one whose only handle is a phone (`{ id, phone }`); and, on a sealed
|
|
159
193
|
* send at the default `identifier` level or at `passkey`, one with no address
|
|
160
|
-
* to verify (a bare id, or an `id` alone
|
|
161
|
-
* `verificationLevel: 'none'`.
|
|
194
|
+
* to verify (a bare id, or an `id` alone that is no email address): give it
|
|
195
|
+
* `{ id, email }`, or send at `verificationLevel: 'none'`.
|
|
162
196
|
*/
|
|
163
197
|
export interface NotifyRecipientRef {
|
|
164
|
-
/**
|
|
198
|
+
/**
|
|
199
|
+
* At most 256 bytes of UTF-8 with no control characters: it keys the
|
|
200
|
+
* recipient's inbox. One that is an email address, with no `email` beside
|
|
201
|
+
* it, is also the address the recipient is emailed at and verified against.
|
|
202
|
+
*/
|
|
165
203
|
id?: string;
|
|
166
204
|
/**
|
|
167
205
|
* The address the email channel delivers to. A recipient with no `id` is keyed
|
|
@@ -261,8 +299,8 @@ export interface CreateNotifySendOptions {
|
|
|
261
299
|
* `idempotent: true`. Generated (`ntsnd_*`) when absent. A replay must repeat
|
|
262
300
|
* what the recipient meets (the delivery mode, the content or ingot, the
|
|
263
301
|
* recipients and their handles, title, category, instructions, policy,
|
|
264
|
-
* channels and
|
|
265
|
-
* (`serviceCode` `VALIDATION_ERROR`), and the stored send stands. `type` and
|
|
302
|
+
* channels, escalation and destinations): one that differs in any of them is
|
|
303
|
+
* refused 400 (`serviceCode` `VALIDATION_ERROR`), and the stored send stands. `type` and
|
|
266
304
|
* `historyTtlDays` are not compared: the stored send keeps its own. The send
|
|
267
305
|
* stores the title, instructions and a plaintext payload without their
|
|
268
306
|
* text-direction control characters (U+202A to U+202E, U+2066 to U+2069) and
|
|
@@ -322,6 +360,13 @@ export interface CreateNotifySendOptions {
|
|
|
322
360
|
* range is refused 400. A plaintext send is capped at 7.
|
|
323
361
|
*/
|
|
324
362
|
historyTtlDays?: number;
|
|
363
|
+
/**
|
|
364
|
+
* `false` keeps this one send out of the organization's destinations (its
|
|
365
|
+
* webhook, Slack channel and Teams workflow): none is posted to, and the
|
|
366
|
+
* send's status reports `destinations: []`. Omitted or `true`, the send is
|
|
367
|
+
* posted to every destination that routes its category.
|
|
368
|
+
*/
|
|
369
|
+
destinations?: boolean;
|
|
325
370
|
}
|
|
326
371
|
/**
|
|
327
372
|
* Options for a preset helper (`sendAlert`, `sendSecureMessage`, …): the one
|
|
@@ -552,11 +597,13 @@ export interface NotifySendStatusRecipient {
|
|
|
552
597
|
/**
|
|
553
598
|
* For a `deferred` step, why it waits: the platform's per-second rate or
|
|
554
599
|
* its hourly email lane, your account's hourly email share, the provider
|
|
555
|
-
* refusing for its rate, the provider's sending paused,
|
|
556
|
-
* own mail domain the email goes out from not verified for sending
|
|
557
|
-
*
|
|
600
|
+
* refusing for its rate, the provider's sending paused, the platform's
|
|
601
|
+
* own mail domain the email goes out from not verified for sending, or
|
|
602
|
+
* your organization's own sending domain not verified for sending (the
|
|
603
|
+
* step waits while the domain is checked again). Null on every other
|
|
604
|
+
* outcome.
|
|
558
605
|
*/
|
|
559
|
-
reason: 'platform_rate' | 'platform_hourly' | 'account_hourly' | 'provider_throttled' | 'sending_paused' | 'sender_identity_unverified' | null;
|
|
606
|
+
reason: 'platform_rate' | 'platform_hourly' | 'account_hourly' | 'provider_throttled' | 'sending_paused' | 'sender_identity_unverified' | 'sending_domain_unverified' | null;
|
|
560
607
|
}>>;
|
|
561
608
|
/**
|
|
562
609
|
* At least one channel accepted the notification for this recipient. A
|
|
@@ -663,6 +710,19 @@ export interface NotifySendStatus {
|
|
|
663
710
|
title: string | null;
|
|
664
711
|
category: string | null;
|
|
665
712
|
type: string | null;
|
|
713
|
+
/**
|
|
714
|
+
* How the send carries its message. Only a `sealed` send minted a link per
|
|
715
|
+
* recipient, so only a sealed send can be recalled (`recallSend`); a
|
|
716
|
+
* `plaintext` one delivered its body inline.
|
|
717
|
+
*/
|
|
718
|
+
delivery: NotifyDeliveryMode;
|
|
719
|
+
/**
|
|
720
|
+
* Epoch seconds of a whole-audience recall; null when there was none. A
|
|
721
|
+
* targeted recall of named recipients never sets it; a named recipient reads
|
|
722
|
+
* `recalled` in their `state` unless their row records something recall does
|
|
723
|
+
* not undo (one a channel already reached stays `delivered`).
|
|
724
|
+
*/
|
|
725
|
+
recalled_at: number | null;
|
|
666
726
|
recipients: NotifySendStatusRecipient[];
|
|
667
727
|
counts: NotifySendStatusCounts;
|
|
668
728
|
/**
|
|
@@ -981,7 +1041,13 @@ export interface NotifyConfigSecurity {
|
|
|
981
1041
|
* what it changes, but a `webhook_url` on another host or port than the
|
|
982
1042
|
* stored one needs a new `secret` in the same patch (400 `VALIDATION_ERROR`
|
|
983
1043
|
* naming `events.secret`, `details.missing: ['secret']`): a secret never
|
|
984
|
-
* follows its URL to a different host.
|
|
1044
|
+
* follows its URL to a different host. A patch of `events: null` removes the
|
|
1045
|
+
* webhook, URL and secret together, and no event is sent from then on; a
|
|
1046
|
+
* `null` for either field alone is refused 400.
|
|
1047
|
+
*
|
|
1048
|
+
* Each event is POSTed as JSON with a `User-Agent` that begins `SparkVault/`,
|
|
1049
|
+
* so an edge in front of the receiver that refuses a request without one lets
|
|
1050
|
+
* it through.
|
|
985
1051
|
*
|
|
986
1052
|
* Delivery is BEST EFFORT — one retry, then the event is dropped. Polling
|
|
987
1053
|
* (`listSends`, `getSendStatus`, `listReceipts`) remains the source of truth;
|
|
@@ -1013,7 +1079,8 @@ export interface NotifyConfigEventsRead {
|
|
|
1013
1079
|
/**
|
|
1014
1080
|
* Your own HTTPS endpoint as a destination. Each routed send is POSTed to `url`
|
|
1015
1081
|
* once as JSON, signed like the event webhook (the hex HMAC-SHA256 of the raw
|
|
1016
|
-
* body under `secret`, in `X-SparkVault-Signature`)
|
|
1082
|
+
* body under `secret`, in `X-SparkVault-Signature`) and, like it, with a
|
|
1083
|
+
* `User-Agent` that begins `SparkVault/`; a post that may not have
|
|
1017
1084
|
* landed is tried again with the same `delivery_id`, so drop a repeat you
|
|
1018
1085
|
* already received. A redirect is never followed.
|
|
1019
1086
|
*/
|
|
@@ -1139,8 +1206,8 @@ export interface NotifyConfigPatch {
|
|
|
1139
1206
|
history?: NotifyConfigHistory;
|
|
1140
1207
|
/** Admin only. */
|
|
1141
1208
|
security?: NotifyConfigSecurity;
|
|
1142
|
-
/** Admin only. */
|
|
1143
|
-
events?: NotifyConfigEvents;
|
|
1209
|
+
/** Admin only. `null` removes the event webhook. */
|
|
1210
|
+
events?: NotifyConfigEvents | null;
|
|
1144
1211
|
/**
|
|
1145
1212
|
* Admin only. `sending_domain`: one of the organization's own domains, its
|
|
1146
1213
|
* ownership verified and its email sending ready, to send from as
|