@sparkvault/sdk-js 13.4.0 → 14.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +7 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +205 -12
- package/dist/index.mjs +7 -3
- package/dist/index.mjs.map +1 -1
- package/dist/products/index.d.ts +1 -1
- package/dist/products/notify/index.d.ts +7 -3
- package/dist/products/notify/types.d.ts +198 -9
- package/dist/sparkvault.js +1 -1
- package/dist/sparkvault.js.map +1 -1
- package/package.json +1 -1
package/dist/products/index.d.ts
CHANGED
|
@@ -27,4 +27,4 @@ export declare class ProductsModule {
|
|
|
27
27
|
export { IdentityModule } from './identity';
|
|
28
28
|
export { NotifyProductModule, NOTIFY_PRESETS, buildNotifyPresetSend } from './notify';
|
|
29
29
|
export type { SignInOptions, SignInResult, VerifyOptions, AttachOptions, VerifyResult, TokenClaims, } from './identity';
|
|
30
|
-
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, } from './notify';
|
|
30
|
+
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';
|
|
@@ -319,8 +319,12 @@ export declare class NotifyProductModule {
|
|
|
319
319
|
*
|
|
320
320
|
* The `events` section configures the outbound event webhook: `webhook_url`
|
|
321
321
|
* must be https on a public host, and `secret` (16-256 chars) signs every event
|
|
322
|
-
* body as `X-SparkVault-Signature: hex(HMAC-SHA256(secret, rawBody))`.
|
|
323
|
-
*
|
|
322
|
+
* body as `X-SparkVault-Signature: hex(HMAC-SHA256(secret, rawBody))`. Both
|
|
323
|
+
* are WRITE-ONLY — reads report `events.webhook_url_set`,
|
|
324
|
+
* `events.webhook_url_host` and `events.secret_set`, never the values. A
|
|
325
|
+
* `webhook_url` on another host or port needs a new `secret` in the same
|
|
326
|
+
* patch (400 `VALIDATION_ERROR` naming `events.secret`), so a secret never
|
|
327
|
+
* follows its URL to a different host.
|
|
324
328
|
*
|
|
325
329
|
* The `email` section selects a domain of your own for your Notify email to go
|
|
326
330
|
* out from. `security`, `events` and `email` are an org admin's to change: a
|
|
@@ -383,4 +387,4 @@ export declare class NotifyProductModule {
|
|
|
383
387
|
} | null;
|
|
384
388
|
}>;
|
|
385
389
|
}
|
|
386
|
-
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, } from './types';
|
|
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';
|
|
@@ -30,9 +30,60 @@ import type { UnsealedVault } from '../../vaults/types';
|
|
|
30
30
|
* | `email` | Goes out from your organization's own sender (`getEmailSender`) |
|
|
31
31
|
* | `push`, `web_push` | Reach the devices an active member of your organization, addressed by their SparkVault user id (`usr_*`), registered with SparkVault (its phone app and browser push), titled with your organization's name first; dropped from the ladder of a recipient with none |
|
|
32
32
|
* | `sms`, `voice`, `whatsapp`, `rcs` | Refused 403 `NOTIFY_CHANNEL_NOT_AVAILABLE`: Notify delivers no text, call or chat message |
|
|
33
|
-
*
|
|
33
|
+
*
|
|
34
|
+
* A send's posts to your organization's own webhook, Slack channel or Teams
|
|
35
|
+
* workflow are no channel: they are its destinations (`NotifyConfig['destinations']`).
|
|
36
|
+
*/
|
|
37
|
+
export type NotifyChannel = 'in_app' | 'email' | 'sms' | 'push' | 'web_push' | 'voice' | 'whatsapp' | 'rcs';
|
|
38
|
+
/**
|
|
39
|
+
* The kinds of send-level destination your organization's Notify config names,
|
|
40
|
+
* at most one of each, in the order every reader lists them: a webhook of your
|
|
41
|
+
* own, a Slack channel (through your organization's SparkVault Slack app) and a
|
|
42
|
+
* Microsoft Teams workflow. Each receives one post of every send whose category
|
|
43
|
+
* it lists, never one per recipient, and never a `security` send.
|
|
44
|
+
*/
|
|
45
|
+
export type NotifyDestinationKind = 'webhook' | 'slack' | 'teams';
|
|
46
|
+
/**
|
|
47
|
+
* One of a send's destinations, as its status and its history summary report it.
|
|
48
|
+
*
|
|
49
|
+
* - `pending` — the post has not settled yet (it is queued, or waits to be tried again).
|
|
50
|
+
* - `delivered` — the destination accepted the post.
|
|
51
|
+
* - `skipped` — nothing was posted, and trying again would not post it.
|
|
52
|
+
* - `failed` — the post was given up on.
|
|
53
|
+
* - `recalled` — the whole send was recalled before the post settled.
|
|
54
|
+
* - `unknown` — the send's delivery record is gone (past its history horizon).
|
|
55
|
+
*/
|
|
56
|
+
export type NotifyDestinationState = 'pending' | 'delivered' | 'skipped' | 'failed' | 'recalled' | 'unknown';
|
|
57
|
+
/**
|
|
58
|
+
* Why a destination's post was skipped: the sending account was suspended or
|
|
59
|
+
* is being deleted (`account_inactive`), the destination was removed
|
|
60
|
+
* (`destination_removed`) or stopped listing the send's category
|
|
61
|
+
* (`destination_unrouted`) before the post went out, its URL no longer
|
|
62
|
+
* resolves to a public host (`unsafe_url`) or answered with a redirect, which
|
|
63
|
+
* is never followed (`redirect_refused`), or Slack's own reasons: no
|
|
64
|
+
* SparkVault Slack app is installed (`slack_not_installed`), it needs an
|
|
65
|
+
* admin's Refresh Connection (`slack_reauthorization_required`), the channel
|
|
66
|
+
* is gone (`channel_not_found`) or archived (`is_archived`), the app was
|
|
67
|
+
* removed from it (`not_in_channel`: saving the destination again adds it back
|
|
68
|
+
* to a public channel), the notification has no visible title or sender name
|
|
69
|
+
* (`display_not_shown`), or Slack refused it with a code of no fixed form
|
|
70
|
+
* (`rejected_unrecognized`).
|
|
71
|
+
*/
|
|
72
|
+
export type NotifyDestinationSkipReason = 'account_inactive' | 'destination_removed' | 'destination_unrouted' | 'unsafe_url' | 'redirect_refused' | 'slack_not_installed' | 'slack_reauthorization_required' | 'channel_not_found' | 'is_archived' | 'not_in_channel' | 'display_not_shown' | 'rejected_unrecognized';
|
|
73
|
+
/**
|
|
74
|
+
* Why a destination's post failed: it was sent and its answer was lost, so it
|
|
75
|
+
* may have landed and is never tried again, since that could post it twice
|
|
76
|
+
* (`possibly_delivered`), or every attempt met a fault that may clear, and
|
|
77
|
+
* none was left (`attempts_exhausted`).
|
|
78
|
+
*/
|
|
79
|
+
export type NotifyDestinationFailureReason = 'possibly_delivered' | 'attempts_exhausted';
|
|
80
|
+
/**
|
|
81
|
+
* The `reason` beside a skipped or failed destination: a fixed reason, the
|
|
82
|
+
* HTTP status a webhook or Teams workflow refused the post with
|
|
83
|
+
* (`status_404`), or the error code Slack refused it with
|
|
84
|
+
* (`rejected_restricted_action`).
|
|
34
85
|
*/
|
|
35
|
-
export type
|
|
86
|
+
export type NotifyDestinationReason = NotifyDestinationSkipReason | NotifyDestinationFailureReason | `status_${number}` | `rejected_${string}`;
|
|
36
87
|
/**
|
|
37
88
|
* How a send's content reaches the recipient.
|
|
38
89
|
* - `sealed` (default): content is sealed into a Spark behind a single-use
|
|
@@ -603,6 +654,27 @@ export interface NotifySendStatus {
|
|
|
603
654
|
type: string | null;
|
|
604
655
|
recipients: NotifySendStatusRecipient[];
|
|
605
656
|
counts: NotifySendStatusCounts;
|
|
657
|
+
/**
|
|
658
|
+
* Each of your organization's destinations the send was routed to when it
|
|
659
|
+
* was accepted, in `NotifyDestinationKind` order; empty when none was.
|
|
660
|
+
* Reported beside the recipients, never part of them: `status` and `counts`
|
|
661
|
+
* are the recipients' alone.
|
|
662
|
+
*/
|
|
663
|
+
destinations: NotifySendStatusDestination[];
|
|
664
|
+
}
|
|
665
|
+
/** One of a send status's `destinations`. */
|
|
666
|
+
export interface NotifySendStatusDestination {
|
|
667
|
+
kind: NotifyDestinationKind;
|
|
668
|
+
state: NotifyDestinationState;
|
|
669
|
+
/** Epoch seconds the state was recorded; null for a post no attempt has recorded anything for yet. */
|
|
670
|
+
at: number | null;
|
|
671
|
+
/** Beside a `skipped` or `failed` state; null otherwise. */
|
|
672
|
+
reason: NotifyDestinationReason | null;
|
|
673
|
+
/**
|
|
674
|
+
* Where the post went: the webhook's host, the Slack channel id, or the
|
|
675
|
+
* Teams workflow's host. Null when no attempt recorded one.
|
|
676
|
+
*/
|
|
677
|
+
target: string | null;
|
|
606
678
|
}
|
|
607
679
|
/**
|
|
608
680
|
* A send's delivery state, DERIVED from its counters — the send row itself is
|
|
@@ -675,6 +747,18 @@ export interface NotifySendSummary {
|
|
|
675
747
|
*/
|
|
676
748
|
recalled_at: number | null;
|
|
677
749
|
state: NotifySendState;
|
|
750
|
+
/**
|
|
751
|
+
* The state of each of your organization's destinations the send was routed
|
|
752
|
+
* to, in `NotifyDestinationKind` order (empty when none was), as
|
|
753
|
+
* `getSendStatus` reports it; null when the send's delivery record is gone
|
|
754
|
+
* (`state: 'unknown'`).
|
|
755
|
+
*/
|
|
756
|
+
destinations: NotifySendSummaryDestination[] | null;
|
|
757
|
+
}
|
|
758
|
+
/** One of a send-history summary's `destinations`. */
|
|
759
|
+
export interface NotifySendSummaryDestination {
|
|
760
|
+
kind: NotifyDestinationKind;
|
|
761
|
+
state: NotifyDestinationState;
|
|
678
762
|
}
|
|
679
763
|
export interface ListNotifySendsOptions {
|
|
680
764
|
/** Page size, 1-100 (server default 50). */
|
|
@@ -882,14 +966,22 @@ export interface NotifyConfigSecurity {
|
|
|
882
966
|
*
|
|
883
967
|
* Both fields are required before anything is sent: an unsigned event is not
|
|
884
968
|
* offered. `webhook_url` must be https on a public host (loopback, private,
|
|
885
|
-
* link-local, and CGNAT addresses are rejected server-side).
|
|
969
|
+
* link-local, and CGNAT addresses are rejected server-side). A patch names only
|
|
970
|
+
* what it changes, but a `webhook_url` on another host or port than the
|
|
971
|
+
* stored one needs a new `secret` in the same patch (400 `VALIDATION_ERROR`
|
|
972
|
+
* naming `events.secret`, `details.missing: ['secret']`): a secret never
|
|
973
|
+
* follows its URL to a different host.
|
|
886
974
|
*
|
|
887
975
|
* Delivery is BEST EFFORT — one retry, then the event is dropped. Polling
|
|
888
976
|
* (`listSends`, `getSendStatus`, `listReceipts`) remains the source of truth;
|
|
889
977
|
* the webhook exists to make that poll rare, not to replace it.
|
|
890
978
|
*/
|
|
891
979
|
export interface NotifyConfigEvents {
|
|
892
|
-
/**
|
|
980
|
+
/**
|
|
981
|
+
* https only, ≤2048 chars. WRITE-ONLY: a config read reports
|
|
982
|
+
* `webhook_url_set` and `webhook_url_host` instead, since a catch hook's URL
|
|
983
|
+
* carries its own token.
|
|
984
|
+
*/
|
|
893
985
|
webhook_url?: string;
|
|
894
986
|
/**
|
|
895
987
|
* HMAC-SHA256 signing secret, 16-256 chars. Sent as the hex digest of the raw
|
|
@@ -898,12 +990,101 @@ export interface NotifyConfigEvents {
|
|
|
898
990
|
*/
|
|
899
991
|
secret?: string;
|
|
900
992
|
}
|
|
901
|
-
/** `events` as it comes BACK from a read — the secret is
|
|
993
|
+
/** `events` as it comes BACK from a read — neither the URL nor the secret is ever echoed. */
|
|
902
994
|
export interface NotifyConfigEventsRead {
|
|
903
|
-
|
|
995
|
+
/** Whether an event webhook URL is stored. The URL itself is never returned. */
|
|
996
|
+
webhook_url_set?: boolean;
|
|
997
|
+
/** The stored event webhook URL's host, so an editor can say where events go. */
|
|
998
|
+
webhook_url_host?: string;
|
|
904
999
|
/** Whether a signing secret is stored. The secret itself is never returned. */
|
|
905
1000
|
secret_set?: boolean;
|
|
906
1001
|
}
|
|
1002
|
+
/**
|
|
1003
|
+
* Your own HTTPS endpoint as a destination. Each routed send is POSTed to `url`
|
|
1004
|
+
* once as JSON, signed like the event webhook (the hex HMAC-SHA256 of the raw
|
|
1005
|
+
* body under `secret`, in `X-SparkVault-Signature`); a post that may not have
|
|
1006
|
+
* landed is tried again with the same `delivery_id`, so drop a repeat you
|
|
1007
|
+
* already received. A redirect is never followed.
|
|
1008
|
+
*/
|
|
1009
|
+
export interface NotifyWebhookDestination {
|
|
1010
|
+
/**
|
|
1011
|
+
* https only on a public host, ≤2048 chars. WRITE-ONLY: a read reports
|
|
1012
|
+
* `url_set` and `url_host` instead, since a catch hook's URL carries its own
|
|
1013
|
+
* token.
|
|
1014
|
+
*/
|
|
1015
|
+
url: string;
|
|
1016
|
+
/** Signing secret, 16-256 chars. WRITE-ONLY: a read reports `secret_set` instead. */
|
|
1017
|
+
secret: string;
|
|
1018
|
+
/**
|
|
1019
|
+
* The categories whose sends it receives one post of: 1-50, each once, each a
|
|
1020
|
+
* category a send can carry, never `security` (a person's security notices go
|
|
1021
|
+
* only to that person). A refused one is a 400 naming it in `details.category`.
|
|
1022
|
+
*/
|
|
1023
|
+
categories: string[];
|
|
1024
|
+
}
|
|
1025
|
+
/** The webhook destination as a read returns it: neither its URL nor its secret is ever echoed. */
|
|
1026
|
+
export interface NotifyWebhookDestinationRead {
|
|
1027
|
+
/** Whether an endpoint URL is stored. The URL itself is never returned. */
|
|
1028
|
+
url_set: boolean;
|
|
1029
|
+
/** The stored endpoint URL's host, so an editor can say which endpoint it is. */
|
|
1030
|
+
url_host: string;
|
|
1031
|
+
/** Whether a signing secret is stored. The secret itself is never returned. */
|
|
1032
|
+
secret_set: boolean;
|
|
1033
|
+
categories: string[];
|
|
1034
|
+
}
|
|
1035
|
+
/**
|
|
1036
|
+
* A channel in your organization's Slack workspace as a destination, posted to
|
|
1037
|
+
* through its SparkVault Slack app installation. A save naming `channel_id`
|
|
1038
|
+
* (even the one already saved) prepares the channel first: the app reads it and
|
|
1039
|
+
* joins a public one it is not in, and a private channel needs the app invited
|
|
1040
|
+
* first. A channel the app cannot post in is refused 400 with `details.reason`
|
|
1041
|
+
* naming why, and nothing is stored.
|
|
1042
|
+
*/
|
|
1043
|
+
export interface NotifySlackDestination {
|
|
1044
|
+
/** The channel's Slack id, as the console's channel picker lists it. */
|
|
1045
|
+
channel_id: string;
|
|
1046
|
+
/** As `NotifyWebhookDestination['categories']`. */
|
|
1047
|
+
categories: string[];
|
|
1048
|
+
}
|
|
1049
|
+
/** A Microsoft Teams workflow as a destination, posted to through its webhook URL. */
|
|
1050
|
+
export interface NotifyTeamsDestination {
|
|
1051
|
+
/**
|
|
1052
|
+
* https only on a public host, ≤2048 chars. The URL is itself the credential
|
|
1053
|
+
* that posts to the channel. WRITE-ONLY: a read reports `webhook_url_set`
|
|
1054
|
+
* and `webhook_url_host` instead.
|
|
1055
|
+
*/
|
|
1056
|
+
webhook_url: string;
|
|
1057
|
+
/** As `NotifyWebhookDestination['categories']`. */
|
|
1058
|
+
categories: string[];
|
|
1059
|
+
}
|
|
1060
|
+
/** The Teams destination as a read returns it: the workflow URL is never echoed. */
|
|
1061
|
+
export interface NotifyTeamsDestinationRead {
|
|
1062
|
+
/** Whether a workflow URL is stored. */
|
|
1063
|
+
webhook_url_set: boolean;
|
|
1064
|
+
/** The stored workflow URL's host, so an editor can say which workflow it is. */
|
|
1065
|
+
webhook_url_host: string;
|
|
1066
|
+
categories: string[];
|
|
1067
|
+
}
|
|
1068
|
+
/** The destinations a config read returns, each present only once configured. */
|
|
1069
|
+
export interface NotifyConfigDestinations {
|
|
1070
|
+
webhook?: NotifyWebhookDestinationRead;
|
|
1071
|
+
slack?: NotifySlackDestination;
|
|
1072
|
+
teams?: NotifyTeamsDestinationRead;
|
|
1073
|
+
}
|
|
1074
|
+
/**
|
|
1075
|
+
* A patch of the destinations: null removes the destination of its kind; an
|
|
1076
|
+
* object creates it, naming every field, or patches the one stored, naming
|
|
1077
|
+
* only what it changes (a credential it leaves out stays as stored). A webhook
|
|
1078
|
+
* `url` on another host or port than the stored one needs a new `secret` in
|
|
1079
|
+
* the same patch (400 `VALIDATION_ERROR` naming
|
|
1080
|
+
* `destinations.webhook.secret`, `details.missing: ['secret']`): a secret
|
|
1081
|
+
* never follows its URL to a different host.
|
|
1082
|
+
*/
|
|
1083
|
+
export interface NotifyConfigDestinationsPatch {
|
|
1084
|
+
webhook?: Partial<NotifyWebhookDestination> | null;
|
|
1085
|
+
slack?: Partial<NotifySlackDestination> | null;
|
|
1086
|
+
teams?: Partial<NotifyTeamsDestination> | null;
|
|
1087
|
+
}
|
|
907
1088
|
/** The account's effective config: secure defaults deep-merged with its overrides. */
|
|
908
1089
|
export interface NotifyConfig {
|
|
909
1090
|
delivery: NotifyConfigDelivery;
|
|
@@ -921,6 +1102,8 @@ export interface NotifyConfig {
|
|
|
921
1102
|
email: {
|
|
922
1103
|
sending_domain: string | null;
|
|
923
1104
|
};
|
|
1105
|
+
/** Your organization's send-level destinations; empty until an admin configures one. */
|
|
1106
|
+
destinations: NotifyConfigDestinations;
|
|
924
1107
|
/** Tombstoned entries are already dropped — a deleted category is simply gone. */
|
|
925
1108
|
categories: Record<string, NotifyConfigCategory>;
|
|
926
1109
|
}
|
|
@@ -959,15 +1142,21 @@ export interface NotifyConfigPatch {
|
|
|
959
1142
|
email?: {
|
|
960
1143
|
sending_domain?: string | null;
|
|
961
1144
|
};
|
|
1145
|
+
/** Admin only. */
|
|
1146
|
+
destinations?: NotifyConfigDestinationsPatch;
|
|
962
1147
|
categories?: Record<string, NotifyConfigCategory | null>;
|
|
963
1148
|
}
|
|
964
1149
|
/**
|
|
965
1150
|
* The stored override delta, seeded-category tombstones included, because that is
|
|
966
|
-
* what a write merges onto.
|
|
967
|
-
*
|
|
1151
|
+
* what a write merges onto. The credentials are held back: `events.secret` and
|
|
1152
|
+
* the webhook destination's `secret` come back as `secret_set`, the webhook
|
|
1153
|
+
* destination's `url` as `url_set` and `url_host`, and `events.webhook_url` and
|
|
1154
|
+
* the Teams destination's `webhook_url` as `webhook_url_set` and
|
|
1155
|
+
* `webhook_url_host` — a patch never has to resend them.
|
|
968
1156
|
*/
|
|
969
|
-
export type NotifyConfigOverrides = Omit<NotifyConfigPatch, 'events'> & {
|
|
1157
|
+
export type NotifyConfigOverrides = Omit<NotifyConfigPatch, 'events' | 'destinations'> & {
|
|
970
1158
|
events?: NotifyConfigEventsRead;
|
|
1159
|
+
destinations?: NotifyConfigDestinations;
|
|
971
1160
|
};
|
|
972
1161
|
export interface NotifyConfigResponse {
|
|
973
1162
|
effective: NotifyConfig;
|