@sparkvault/sdk-js 18.0.8 → 19.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -7
- package/dist/errors.d.ts +1 -14
- package/dist/index.cjs +27 -65
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +33 -96
- package/dist/index.mjs +28 -65
- package/dist/index.mjs.map +1 -1
- package/dist/products/notify/index.d.ts +11 -8
- package/dist/products/notify/project-types.d.ts +6 -57
- package/dist/products/notify/projects.d.ts +3 -9
- package/dist/products/notify/types.d.ts +11 -7
- package/dist/sparkvault.js +1 -1
- package/dist/sparkvault.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -753,28 +753,11 @@ declare class IdentityModule {
|
|
|
753
753
|
render(options: RenderOptions): Promise<VerifyResult>;
|
|
754
754
|
}
|
|
755
755
|
|
|
756
|
-
/** Named Notify projects owned and
|
|
757
|
-
type NotifyProjectStatus = '
|
|
756
|
+
/** Named Notify projects owned by one company and funded by its shared wallet. */
|
|
757
|
+
type NotifyProjectStatus = 'active' | 'archived';
|
|
758
758
|
interface NotifyProjectBilling {
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
enabled?: boolean;
|
|
762
|
-
included_monthly_credits?: number;
|
|
763
|
-
renewal_included_monthly_credits?: number;
|
|
764
|
-
subscription_item_id?: string | null;
|
|
765
|
-
subscription_id?: string | null;
|
|
766
|
-
status: 'draft' | 'active' | 'past_due' | 'read_only';
|
|
767
|
-
/** Historical tier allowance. The credit model's compatibility value is not a usage ceiling. */
|
|
768
|
-
notifications_cap: number;
|
|
769
|
-
/** Allowance selected for the next period when a downgrade is scheduled. */
|
|
770
|
-
renewal_notifications_cap?: number;
|
|
771
|
-
current_period_end?: number | null;
|
|
772
|
-
cancel_at_period_end?: boolean;
|
|
773
|
-
price_id?: string | null;
|
|
774
|
-
stripe_product_id?: string | null;
|
|
775
|
-
tier_price_id?: string | null;
|
|
776
|
-
/** Default uses the company's existing Notify subscription. */
|
|
777
|
-
legacy?: boolean;
|
|
759
|
+
billing_model: 'usage_credits';
|
|
760
|
+
enabled: boolean;
|
|
778
761
|
}
|
|
779
762
|
interface NotifyProjectUsage {
|
|
780
763
|
notifications_used: number;
|
|
@@ -800,6 +783,8 @@ interface ListNotifyProjectsResponse {
|
|
|
800
783
|
items: NotifyProject[];
|
|
801
784
|
}
|
|
802
785
|
interface CreateNotifyProjectOptions {
|
|
786
|
+
/** Stable idempotency key: 16 to 128 letters, numbers, underscores or hyphens. */
|
|
787
|
+
request_id: string;
|
|
803
788
|
/** A recognizable name, up to 80 characters. */
|
|
804
789
|
name: string;
|
|
805
790
|
/** Up to 240 characters. */
|
|
@@ -812,44 +797,8 @@ interface UpdateNotifyProjectOptions {
|
|
|
812
797
|
description?: string;
|
|
813
798
|
sender_name?: string | null;
|
|
814
799
|
}
|
|
815
|
-
type PreviewNotifyProjectSubscriptionOptions =
|
|
816
|
-
/** New project: one flat monthly plan with credits shared across the company. */
|
|
817
|
-
{
|
|
818
|
-
billingModel: 'usage_credits';
|
|
819
|
-
notificationsPerMonth?: never;
|
|
820
|
-
}
|
|
821
|
-
/** Existing legacy project: retain its published notification tier. */
|
|
822
|
-
| {
|
|
823
|
-
billingModel?: undefined;
|
|
824
|
-
notificationsPerMonth: number;
|
|
825
|
-
};
|
|
826
|
-
interface NotifyProjectSubscriptionPreview {
|
|
827
|
-
project_id: string;
|
|
828
|
-
/** Present for the flat shared-credit plan; absent for historical tier plans. */
|
|
829
|
-
billing_model?: 'usage_credits';
|
|
830
|
-
included_monthly_credits?: number;
|
|
831
|
-
/** Present only when reviewing a historical tier plan. */
|
|
832
|
-
notifications_per_month?: number;
|
|
833
|
-
/** Exact decimal USD amounts, as strings; repeat the quote without float conversion. */
|
|
834
|
-
monthly_usd: string;
|
|
835
|
-
amount_due_now_usd: string;
|
|
836
|
-
currency: string;
|
|
837
|
-
proration_date: number;
|
|
838
|
-
effective_at: number | null;
|
|
839
|
-
checkout_required: boolean;
|
|
840
|
-
}
|
|
841
|
-
type SubscribeNotifyProjectOptions = PreviewNotifyProjectSubscriptionOptions & {
|
|
842
|
-
/** Repeat the reviewed quote; a changed price is refused rather than charged. */
|
|
843
|
-
quotedAmountDueNowUsd: string;
|
|
844
|
-
prorationDate: number;
|
|
845
|
-
};
|
|
846
|
-
interface NotifyProjectSubscriptionResponse {
|
|
847
|
-
project: NotifyProject;
|
|
848
|
-
/** Present when the company's first subscription needs hosted payment setup. */
|
|
849
|
-
checkout_url?: string;
|
|
850
|
-
}
|
|
851
800
|
|
|
852
|
-
/** Company-level project management. Creation
|
|
801
|
+
/** Company-level project management. Creation is idempotent and charges nothing. */
|
|
853
802
|
declare class NotifyProjectsModule {
|
|
854
803
|
private readonly http;
|
|
855
804
|
constructor(http: HttpClient);
|
|
@@ -857,14 +806,8 @@ declare class NotifyProjectsModule {
|
|
|
857
806
|
create(options: CreateNotifyProjectOptions): Promise<NotifyProject>;
|
|
858
807
|
get(projectId: string): Promise<NotifyProject>;
|
|
859
808
|
update(projectId: string, options: UpdateNotifyProjectOptions): Promise<NotifyProject>;
|
|
860
|
-
/** Archive
|
|
809
|
+
/** Archive an active project; Default cannot be archived. */
|
|
861
810
|
archive(projectId: string): Promise<NotifyProject>;
|
|
862
|
-
/** Quote a named project's plan. Requires an interactive company-admin session. */
|
|
863
|
-
previewSubscription(projectId: string, options: PreviewNotifyProjectSubscriptionOptions): Promise<NotifyProjectSubscriptionPreview>;
|
|
864
|
-
/** Purchase the reviewed plan on the company's invoice; an API key cannot authorize spending. */
|
|
865
|
-
subscribe(projectId: string, options: SubscribeNotifyProjectOptions): Promise<NotifyProjectSubscriptionResponse>;
|
|
866
|
-
/** End a named project's plan at its paid period deadline; retained history stays readable. */
|
|
867
|
-
cancelSubscription(projectId: string): Promise<NotifyProjectSubscriptionResponse>;
|
|
868
811
|
}
|
|
869
812
|
|
|
870
813
|
/**
|
|
@@ -1440,7 +1383,7 @@ type NotifyDestinationReason = NotifyDestinationSkipReason | NotifyDestinationFa
|
|
|
1440
1383
|
* be sent at all (`unsent`), or too little of the post's time was left to
|
|
1441
1384
|
* start it (`deadline_reached`).
|
|
1442
1385
|
*/
|
|
1443
|
-
type NotifyDestinationTransportReason = 'network' | 'timeout' | 'unsent' | 'deadline_reached';
|
|
1386
|
+
type NotifyDestinationTransportReason = 'network' | 'timeout' | 'unsent' | 'deadline_reached' | 'usage_credits_exhausted' | 'usage_credit_funding_review' | 'usage_operation_pending' | 'usage_operation_released';
|
|
1444
1387
|
/**
|
|
1445
1388
|
* Why `updateConfig` refused a patch that lacks a field: the `details.reason`
|
|
1446
1389
|
* of its 400 `VALIDATION_ERROR`, beside `details.missing`.
|
|
@@ -1469,7 +1412,7 @@ type NotifyDestinationTestReason = NotifyDestinationSkipReason | 'possibly_deliv
|
|
|
1469
1412
|
/**
|
|
1470
1413
|
* What became of a test post to one of your destinations, in a send status's
|
|
1471
1414
|
* words. A test post is made once and never tried again, so a fault a send's
|
|
1472
|
-
* post would retry reads `failed`. No send is stored
|
|
1415
|
+
* post would retry reads `failed`. No send is stored. Each delivered test consumes usage credits.
|
|
1473
1416
|
*/
|
|
1474
1417
|
interface NotifyDestinationTestResult {
|
|
1475
1418
|
kind: NotifyDestinationKind;
|
|
@@ -1659,11 +1602,14 @@ interface NotifySendPolicy {
|
|
|
1659
1602
|
* schedule from the account config.
|
|
1660
1603
|
*/
|
|
1661
1604
|
interface NotifyEscalation {
|
|
1662
|
-
delays
|
|
1605
|
+
delays?: number[];
|
|
1606
|
+
/** Defaults to true. False delivers every configured step even after the notification is seen. */
|
|
1607
|
+
stop_on_seen?: boolean;
|
|
1663
1608
|
}
|
|
1664
1609
|
interface CreateNotifySendOptions {
|
|
1665
1610
|
/**
|
|
1666
|
-
* Idempotency key, `^[A-Za-z0-9_.:-]{1,128}$`.
|
|
1611
|
+
* Idempotency key, `^[A-Za-z0-9_.:-]{1,128}$`. The `hd.` and `identity-alert:`
|
|
1612
|
+
* prefixes are reserved for trusted product events. Replaying an existing id returns
|
|
1667
1613
|
* the stored send unchanged (never re-sealed, never re-delivered) with
|
|
1668
1614
|
* `idempotent: true`. Generated (`ntsnd_*`) when absent. A replay must repeat
|
|
1669
1615
|
* what the recipient meets (the delivery mode, the content or ingot, the
|
|
@@ -1677,7 +1623,7 @@ interface CreateNotifySendOptions {
|
|
|
1677
1623
|
* same send.
|
|
1678
1624
|
*/
|
|
1679
1625
|
sendId?: string;
|
|
1680
|
-
/** 1-500 recipients. An ingot send accepts exactly one. */
|
|
1626
|
+
/** 1-500 recipients, or [] for a plaintext destination-only send with explicit destinations and channels: []. An ingot send accepts exactly one. */
|
|
1681
1627
|
recipients: NotifyRecipient[];
|
|
1682
1628
|
/** Provide exactly one content source: `content` OR `ingot`. */
|
|
1683
1629
|
content?: NotifySendContent;
|
|
@@ -1734,9 +1680,10 @@ interface CreateNotifySendOptions {
|
|
|
1734
1680
|
* `false` keeps this one send out of the organization's destinations (its
|
|
1735
1681
|
* webhook, Slack channel and Teams workflow): none is posted to, and the
|
|
1736
1682
|
* send's status reports `destinations: []`. Omitted or `true`, the send is
|
|
1737
|
-
* posted to every destination that routes its category.
|
|
1683
|
+
* posted to every destination that routes its category. A list selects a
|
|
1684
|
+
* distinct subset of configured destinations routing this category.
|
|
1738
1685
|
*/
|
|
1739
|
-
destinations?: boolean;
|
|
1686
|
+
destinations?: boolean | NotifyDestinationKind[];
|
|
1740
1687
|
}
|
|
1741
1688
|
/**
|
|
1742
1689
|
* Options for a preset helper (`sendAlert`, `sendSecureMessage`, …): the one
|
|
@@ -3037,27 +2984,30 @@ declare class NotifyProductModule {
|
|
|
3037
2984
|
/**
|
|
3038
2985
|
* Post one test message to your destination of `kind` (a webhook, a Slack
|
|
3039
2986
|
* channel or a Teams workflow) and learn what became of it, without a send:
|
|
3040
|
-
* nothing reaches a recipient, no send is stored
|
|
3041
|
-
* the test never appears in send history. The post shows the title "Test
|
|
2987
|
+
* nothing reaches a recipient, no send is stored, and
|
|
2988
|
+
* the test spends destination delivery credits and never appears in send history. The post shows the title "Test
|
|
3042
2989
|
* post from SparkVault Notify" under your organization's name, through the
|
|
3043
2990
|
* sender a send's post takes. A webhook receives a body signed like any
|
|
3044
2991
|
* other, typed `notify.destination.test`, naming no send, with a
|
|
3045
2992
|
* `delivery_id` of its own. The post is made once and never tried again,
|
|
3046
|
-
* so a fault a send's post would retry reads `failed`.
|
|
2993
|
+
* so a fault a send's post would retry reads `failed`. Retain request_id across retries;
|
|
2994
|
+
* a replay returns the saved verdict without another post or charge.
|
|
3047
2995
|
*
|
|
3048
|
-
* An org admin's call
|
|
2996
|
+
* An org admin's call: anyone else is
|
|
3049
2997
|
* refused 403 `FORBIDDEN` (`details: { sections: ['destinations'],
|
|
3050
|
-
* required_role: 'admin' }`)
|
|
3051
|
-
* `
|
|
2998
|
+
* required_role: 'admin' }`). Insufficient credits returns a failed verdict
|
|
2999
|
+
* with reason `usage_credits_exhausted`. A kind with no destination saved is 404
|
|
3052
3000
|
* `NOT_FOUND`, an organization name a send would be refused under is 409
|
|
3053
3001
|
* (`NOTIFY_SENDER_NAME_REQUIRED` or `NOTIFY_SENDER_NAME_RESERVED`), and each
|
|
3054
3002
|
* kind takes 20 tests an hour (429 `RATE_LIMIT_EXCEEDED`).
|
|
3055
3003
|
*
|
|
3056
3004
|
* @example
|
|
3057
|
-
* const { state, reason } = await sv.products.notify.testDestination('webhook');
|
|
3005
|
+
* const { state, reason } = await sv.products.notify.testDestination('webhook', { request_id: 'test_webhook_0001' });
|
|
3058
3006
|
* if (state !== 'delivered') console.warn(`Test post ${state}: ${reason}`);
|
|
3059
3007
|
*/
|
|
3060
|
-
testDestination(kind: NotifyDestinationKind
|
|
3008
|
+
testDestination(kind: NotifyDestinationKind, request: {
|
|
3009
|
+
request_id: string;
|
|
3010
|
+
}): Promise<NotifyDestinationTestResult>;
|
|
3061
3011
|
/**
|
|
3062
3012
|
* Who your organization's Notify email is from, as the API answers it
|
|
3063
3013
|
* (verbatim snake_case): `"{organization name}" <from_address>`, with a
|
|
@@ -5412,7 +5362,7 @@ declare class SparkVaultError extends Error {
|
|
|
5412
5362
|
* answer named none (a gateway's HTML). A typed refusal's `code` names its
|
|
5413
5363
|
* class of failure: one per 400 (`validation_error`), two per 401
|
|
5414
5364
|
* (`authentication_error`, `UNAUTHORIZED`), 402 (`PLAN_REQUIRED`,
|
|
5415
|
-
* `QUOTA_EXCEEDED`, `USAGE_CREDITS_EXHAUSTED`) and 403 (`authorization_error
|
|
5365
|
+
* `QUOTA_EXCEEDED`, `USAGE_CREDITS_EXHAUSTED`) and 403 (`authorization_error`;
|
|
5416
5366
|
* http.ts createErrorFromResponse), so this is what tells apart two
|
|
5417
5367
|
* refusals that share a code.
|
|
5418
5368
|
* Undefined on an error the SDK raised itself, on the Identity product's
|
|
@@ -5477,19 +5427,6 @@ declare class QuotaExceededError extends SparkVaultError {
|
|
|
5477
5427
|
readonly resource?: QuotaResource;
|
|
5478
5428
|
constructor(message: string, details?: Record<string, unknown>, retryAfterMs?: number | null, serviceCode?: string);
|
|
5479
5429
|
}
|
|
5480
|
-
/**
|
|
5481
|
-
* Notify subscription gate (403 NOTIFY_SUBSCRIPTION_REQUIRED or
|
|
5482
|
-
* NOTIFY_PROJECT_SUBSCRIPTION_REQUIRED): the account or selected project
|
|
5483
|
-
* does not hold Notify and attempted a send that names no accepted send's
|
|
5484
|
-
* `sendId` (a replay of an accepted send, the same request under its `sendId`,
|
|
5485
|
-
* is answered with the stored send), or a config save that selects a new
|
|
5486
|
-
* `email.sending_domain`. Distinct from a generic authorization failure: the
|
|
5487
|
-
* credential is fine and re-authenticating changes nothing, so surface a
|
|
5488
|
-
* subscribe CTA rather than a sign-in prompt.
|
|
5489
|
-
*/
|
|
5490
|
-
declare class NotifySubscriptionRequiredError extends SparkVaultError {
|
|
5491
|
-
constructor(message: string, details?: Record<string, unknown>, retryAfterMs?: number | null, serviceCode?: string);
|
|
5492
|
-
}
|
|
5493
5430
|
declare class NetworkError extends SparkVaultError {
|
|
5494
5431
|
constructor(message: string, details?: Record<string, unknown>);
|
|
5495
5432
|
}
|
|
@@ -6691,5 +6628,5 @@ declare global {
|
|
|
6691
6628
|
}
|
|
6692
6629
|
}
|
|
6693
6630
|
|
|
6694
|
-
export { AuthenticationError, AuthorizationError, EntropyModule, FoldersModule, HelpDeskClient, HelpDeskModule, IdentityModule, IdentityProviderError, IngotsModule, MessagingModule, NAME_CONFLICT_POLICIES, NOTIFY_PRESETS, NetworkError, NotifyModule, NotifyProductModule, NotifyProjectsModule,
|
|
6695
|
-
export type { AccessLogRetention, AccessLogsOptions, BatchGetStructuredIngotsOptions, CreateFolderOptions, CreateMessagingConversationOptions, CreateNotifyProjectOptions, CreateNotifySendOptions, CreateSparkOptions, CreateStructuredIngotOptions, CreateStructuredTypeOptions, CreateUploadOptions, CreateVaultOptions, CreatedIngot, CreatedSpark, DeleteIngotOptions, DeleteStructuredIngotOptions, DownloadIngotOptions, EntropyFormat, EntropyResult, FetchDownloadOptions, FetchedDownload, Folder, FolderBreadcrumbItem, FolderContents, FolderPage, GenerateEntropyOptions, GetStructuredIngotOptions, HealthCheckOptions, HealthCheckResult, HelpDeskAttachmentDownload, HelpDeskAttachmentInput, HelpDeskAttachmentUpload, HelpDeskCarriedComposition, HelpDeskConnectOptions, HelpDeskCreateTicketOptions, HelpDeskCustomer, HelpDeskCustomerPatch, HelpDeskDesk, HelpDeskDraft, HelpDeskEvent, HelpDeskExternalChallenge, HelpDeskExternalIdentity, HelpDeskFormArrival, HelpDeskFormHandle, HelpDeskFormOptions, HelpDeskFormState, HelpDeskIdentityRequest, HelpDeskListTicketsOptions, HelpDeskMountFormOptions, HelpDeskOAuthIdentity, HelpDeskOpenFormOptions, HelpDeskPinChallenge, HelpDeskReplyCreated, HelpDeskReplyOptions, HelpDeskRequestContext, HelpDeskSession, HelpDeskSessionChange, HelpDeskSupportHandle, HelpDeskSupportLauncherOptions, HelpDeskSupportOpenOptions, HelpDeskSupportOptions, HelpDeskSupportStage, HelpDeskSupportState, HelpDeskTicket, HelpDeskTicketCreated, HelpDeskTicketDetail, HelpDeskTicketList, HelpDeskTimeline, HelpDeskVerifyPinOptions, HelpDeskWebsiteAccountReturn, HelpDeskWidgetFormIdentity, HelpDeskWidgetIdentityChallenge, HelpDeskWidgetIdentityOptions, HelpDeskWidgetIdentitySession, AttachOptions as IdentityAttachOptions, ImportStructuredIngotsOptions, Ingot, IngotAccessLog, IngotAccessLogPage, IngotDownload, IngotDownloadLink, IngotHistory, IngotInvitation, IngotInvite, IngotPage, IngotSharingConfig, IngotUpload, IngotVersion, IngotVersionDownloadLink, InitiateMessagingAttachmentOptions, ListContentsOptions, ListFoldersOptions, ListIngotsOptions, ListMessagingInboxOptions, ListNotificationsOptions, ListNotificationsResponse, ListNotifyInboxOptions, ListNotifyInboxResponse, ListNotifyProjectsResponse, ListNotifyReceiptsOptions, ListNotifyReceiptsResponse, ListNotifySendsOptions, ListNotifySendsResponse, ListSparksOptions, MarkAllNotificationsStateOptions, MarkAllNotificationsStateResponse, MarkAllReadResult, MarkNotificationStateOptions, MarkNotificationStateResponse, MarkNotifyInboxAllOptions, MarkNotifyInboxAllResponse, MarkNotifyInboxStateOptions, MarkNotifyInboxStateResponse, MessagingAttachment, MessagingAttachmentDownload, MessagingAttachmentUpload, MessagingContentMessage, MessagingConversation, MessagingConversationCreated, MessagingConversationSettings, MessagingIdentity, MessagingInboxCursor, MessagingInboxEntry, MessagingInboxPage, MessagingInviteResult, MessagingMessage, MessagingMessageReceipt, MessagingParticipant, MessagingParticipantInput, MessagingReadResult, MessagingRecalledMessage, MessagingReceiptToken, MessagingRecipientIdentity, MessagingSendResult, MessagingUnavailableMessage, NameConflictPolicy, NotificationBulkMarkState, NotificationInboxState, NotificationMarkState, NotificationRow, NotificationSender, NotifyCategory, NotifyChannel, NotifyConfig, NotifyConfigCategory, NotifyConfigDelivery, NotifyConfigDeliveryPatch, NotifyConfigDestinations, NotifyConfigDestinationsPatch, NotifyConfigEvents, NotifyConfigEventsRead, NotifyConfigHistory, NotifyConfigOverrides, NotifyConfigPatch, NotifyConfigRealtimeFallbackDelay, NotifyConfigRefusalReason, NotifyConfigReliability, NotifyConfigResponse, NotifyConfigSecurity, NotifyDeliveryMode, NotifyDestinationFailureReason, NotifyDestinationKind, NotifyDestinationReason, NotifyDestinationSkipReason, NotifyDestinationState, NotifyDestinationTestReason, NotifyDestinationTestResult, NotifyDestinationTransportReason, NotifyEscalation, NotifyInboxBulkMarkState, NotifyInboxMarkState, NotifyInboxRow, NotifyInboxView, NotifyIngotRef, NotifyInteraction, NotifyPreset, NotifyPresetCategory, NotifyPresetName, NotifyPresetSendOptions, NotifyProject, NotifyProjectBilling, NotifyProjectStatus,
|
|
6631
|
+
export { AuthenticationError, AuthorizationError, EntropyModule, FoldersModule, HelpDeskClient, HelpDeskModule, IdentityModule, IdentityProviderError, IngotsModule, MessagingModule, NAME_CONFLICT_POLICIES, NOTIFY_PRESETS, NetworkError, NotifyModule, NotifyProductModule, NotifyProjectsModule, PlanRequiredError, PopupBlockedError, PopupSeveredError, ProductsModule, QuotaExceededError, SparkVault, SparkVaultError, SparksModule, StructuredIngotTypesModule, StructuredIngotsModule, TimeoutError, UnauthorizedError, UsageCreditFundingReviewError, UsageCreditsExhaustedError, UserCancelledError, ValidationError, VaultsModule, buildNotifyPresetSend, SparkVault as default, fetchDownload, isReceivedUploadFailure, logger, setDebugMode };
|
|
6632
|
+
export type { AccessLogRetention, AccessLogsOptions, BatchGetStructuredIngotsOptions, CreateFolderOptions, CreateMessagingConversationOptions, CreateNotifyProjectOptions, CreateNotifySendOptions, CreateSparkOptions, CreateStructuredIngotOptions, CreateStructuredTypeOptions, CreateUploadOptions, CreateVaultOptions, CreatedIngot, CreatedSpark, DeleteIngotOptions, DeleteStructuredIngotOptions, DownloadIngotOptions, EntropyFormat, EntropyResult, FetchDownloadOptions, FetchedDownload, Folder, FolderBreadcrumbItem, FolderContents, FolderPage, GenerateEntropyOptions, GetStructuredIngotOptions, HealthCheckOptions, HealthCheckResult, HelpDeskAttachmentDownload, HelpDeskAttachmentInput, HelpDeskAttachmentUpload, HelpDeskCarriedComposition, HelpDeskConnectOptions, HelpDeskCreateTicketOptions, HelpDeskCustomer, HelpDeskCustomerPatch, HelpDeskDesk, HelpDeskDraft, HelpDeskEvent, HelpDeskExternalChallenge, HelpDeskExternalIdentity, HelpDeskFormArrival, HelpDeskFormHandle, HelpDeskFormOptions, HelpDeskFormState, HelpDeskIdentityRequest, HelpDeskListTicketsOptions, HelpDeskMountFormOptions, HelpDeskOAuthIdentity, HelpDeskOpenFormOptions, HelpDeskPinChallenge, HelpDeskReplyCreated, HelpDeskReplyOptions, HelpDeskRequestContext, HelpDeskSession, HelpDeskSessionChange, HelpDeskSupportHandle, HelpDeskSupportLauncherOptions, HelpDeskSupportOpenOptions, HelpDeskSupportOptions, HelpDeskSupportStage, HelpDeskSupportState, HelpDeskTicket, HelpDeskTicketCreated, HelpDeskTicketDetail, HelpDeskTicketList, HelpDeskTimeline, HelpDeskVerifyPinOptions, HelpDeskWebsiteAccountReturn, HelpDeskWidgetFormIdentity, HelpDeskWidgetIdentityChallenge, HelpDeskWidgetIdentityOptions, HelpDeskWidgetIdentitySession, AttachOptions as IdentityAttachOptions, ImportStructuredIngotsOptions, Ingot, IngotAccessLog, IngotAccessLogPage, IngotDownload, IngotDownloadLink, IngotHistory, IngotInvitation, IngotInvite, IngotPage, IngotSharingConfig, IngotUpload, IngotVersion, IngotVersionDownloadLink, InitiateMessagingAttachmentOptions, ListContentsOptions, ListFoldersOptions, ListIngotsOptions, ListMessagingInboxOptions, ListNotificationsOptions, ListNotificationsResponse, ListNotifyInboxOptions, ListNotifyInboxResponse, ListNotifyProjectsResponse, ListNotifyReceiptsOptions, ListNotifyReceiptsResponse, ListNotifySendsOptions, ListNotifySendsResponse, ListSparksOptions, MarkAllNotificationsStateOptions, MarkAllNotificationsStateResponse, MarkAllReadResult, MarkNotificationStateOptions, MarkNotificationStateResponse, MarkNotifyInboxAllOptions, MarkNotifyInboxAllResponse, MarkNotifyInboxStateOptions, MarkNotifyInboxStateResponse, MessagingAttachment, MessagingAttachmentDownload, MessagingAttachmentUpload, MessagingContentMessage, MessagingConversation, MessagingConversationCreated, MessagingConversationSettings, MessagingIdentity, MessagingInboxCursor, MessagingInboxEntry, MessagingInboxPage, MessagingInviteResult, MessagingMessage, MessagingMessageReceipt, MessagingParticipant, MessagingParticipantInput, MessagingReadResult, MessagingRecalledMessage, MessagingReceiptToken, MessagingRecipientIdentity, MessagingSendResult, MessagingUnavailableMessage, NameConflictPolicy, NotificationBulkMarkState, NotificationInboxState, NotificationMarkState, NotificationRow, NotificationSender, NotifyCategory, NotifyChannel, NotifyConfig, NotifyConfigCategory, NotifyConfigDelivery, NotifyConfigDeliveryPatch, NotifyConfigDestinations, NotifyConfigDestinationsPatch, NotifyConfigEvents, NotifyConfigEventsRead, NotifyConfigHistory, NotifyConfigOverrides, NotifyConfigPatch, NotifyConfigRealtimeFallbackDelay, NotifyConfigRefusalReason, NotifyConfigReliability, NotifyConfigResponse, NotifyConfigSecurity, NotifyDeliveryMode, NotifyDestinationFailureReason, NotifyDestinationKind, NotifyDestinationReason, NotifyDestinationSkipReason, NotifyDestinationState, NotifyDestinationTestReason, NotifyDestinationTestResult, NotifyDestinationTransportReason, NotifyEscalation, NotifyInboxBulkMarkState, NotifyInboxMarkState, NotifyInboxRow, NotifyInboxView, NotifyIngotRef, NotifyInteraction, NotifyPreset, NotifyPresetCategory, NotifyPresetName, NotifyPresetSendOptions, NotifyProject, NotifyProjectBilling, NotifyProjectStatus, NotifyProjectUsage, NotifyRecallMode, NotifyReceipt, NotifyReceiptEventType, NotifyRecipient, NotifyRecipientRef, NotifyRecipientState, NotifyReportableVerificationLevel, NotifySendContent, NotifySendPolicy, NotifySendReceipt, NotifySendReceiptsResponse, NotifySendResult, NotifySendState, NotifySendStatus, NotifySendStatusCounts, NotifySendStatusDestination, NotifySendStatusRecipient, NotifySendSummary, NotifySendSummaryDestination, NotifySlackDestination, NotifySlackDestinationRead, NotifySuppressionReason, NotifyTeamsDestination, NotifyTeamsDestinationRead, NotifyVerificationLevel, NotifyWebhookDestination, NotifyWebhookDestinationRead, PatchStructuredIngotOptions, PortableStructuredIngot, PortableStructuredType, PublishStructuredTypeOptions, QuotaResource, ReadMessagingConversationOptions, RecallNotifySendOptions, RecallNotifySendResponse, RegisterWebPushResponse, ReplaceIngotOptions, RestoreStructuredIngotOptions, ResumeUploadOptions, ScheduledVaultDeletion, SearchIngotsOptions, SendMessagingMessageOptions, SendUploadOptions, ShareSparkOptions, SignInOptions, SignInResult, SigninIdentityType, Spark, SparkInviteResend, SparkLinkActionOptions, SparkPage, SparkShare, SparkSummary, SparkVaultConfig, SparkVisibility, StartedVaultDeletion, StructuredAccountActivity, StructuredActivity, StructuredActivityOptions, StructuredActivityPeriod, StructuredActivityTotals, StructuredActivityTotalsWire, StructuredActivityWire, StructuredBinaryPath, StructuredExportOutcome, StructuredImportOutcome, StructuredIngot, StructuredIngotHistory, StructuredIngotMutation, StructuredIngotPrecondition, StructuredIngotSummary, StructuredIngotSummaryWire, StructuredIngotVersion, StructuredIngotWire, StructuredIterateOptions, StructuredJsonValue, StructuredMutationWire, StructuredOutcome, StructuredPage, StructuredPageOptions, StructuredPageWire, StructuredReadOutcome, StructuredTypeCreation, StructuredTypeDefinition, StructuredTypeDefinitionWire, StructuredTypePin, StructuredTypePinWire, StructuredTypeSummary, StructuredTypeSummaryWire, StructuredTypeTransform, StructuredValues, StructuredVaultActivity, SubscribeWebPushOptions, SubscribeWebPushResult, SubscribeWebPushStatus, TokenClaims, UnreachedAdmin, UnreadCountResponse, UnsealVaultOptions, UnsealedVault, UnsubscribeWebPushResponse, UpdateFolderOptions, UpdateIngotSharingOptions, UpdateNotifyProjectOptions, UpdateVaultUploadOptions, UpdatedVault, UploadAttachOptions, UploadBranding, UploadEnd, UploadIngotOptions, UploadOptions, UploadProgress, UploadResult, UploadSession, Vault, VaultDetail, VaultLifecycle, VaultResealDefaults, VaultResealSettings, VaultResealSettingsResult, VaultSessionExtension, VaultSessionTiming, VaultSharingConfig, VaultSharingOptions, VaultSummary, VaultUploadConfig, VaultUploadSettings, VerifyOptions, VerifyResult, WebPushKeyResponse, WebPushStatus, WebPushStatusOptions, WebPushStatusResult, WebPushSubscriptionInput };
|
package/dist/index.mjs
CHANGED
|
@@ -879,23 +879,6 @@ class QuotaExceededError extends SparkVaultError {
|
|
|
879
879
|
Object.setPrototypeOf(this, QuotaExceededError.prototype);
|
|
880
880
|
}
|
|
881
881
|
}
|
|
882
|
-
/**
|
|
883
|
-
* Notify subscription gate (403 NOTIFY_SUBSCRIPTION_REQUIRED or
|
|
884
|
-
* NOTIFY_PROJECT_SUBSCRIPTION_REQUIRED): the account or selected project
|
|
885
|
-
* does not hold Notify and attempted a send that names no accepted send's
|
|
886
|
-
* `sendId` (a replay of an accepted send, the same request under its `sendId`,
|
|
887
|
-
* is answered with the stored send), or a config save that selects a new
|
|
888
|
-
* `email.sending_domain`. Distinct from a generic authorization failure: the
|
|
889
|
-
* credential is fine and re-authenticating changes nothing, so surface a
|
|
890
|
-
* subscribe CTA rather than a sign-in prompt.
|
|
891
|
-
*/
|
|
892
|
-
class NotifySubscriptionRequiredError extends SparkVaultError {
|
|
893
|
-
constructor(message, details, retryAfterMs = null, serviceCode) {
|
|
894
|
-
super(message, 'NOTIFY_SUBSCRIPTION_REQUIRED', 403, details, retryAfterMs, serviceCode);
|
|
895
|
-
this.name = 'NotifySubscriptionRequiredError';
|
|
896
|
-
Object.setPrototypeOf(this, NotifySubscriptionRequiredError.prototype);
|
|
897
|
-
}
|
|
898
|
-
}
|
|
899
882
|
class NetworkError extends SparkVaultError {
|
|
900
883
|
constructor(message, details) {
|
|
901
884
|
super(message, 'network_error', undefined, details);
|
|
@@ -1701,12 +1684,6 @@ class HttpClient {
|
|
|
1701
1684
|
// PLAN_REQUIRED is the canonical 402 gate; treat any other 402 as one too.
|
|
1702
1685
|
return new PlanRequiredError(message, details, retryAfterMs, code);
|
|
1703
1686
|
case 403:
|
|
1704
|
-
// A Notify send, or a config save selecting a new sending domain, refused
|
|
1705
|
-
// because the account does not hold Notify is a billing gate, not a
|
|
1706
|
-
// credential problem; give it its own catchable type.
|
|
1707
|
-
if (code === 'NOTIFY_SUBSCRIPTION_REQUIRED' || code === 'NOTIFY_PROJECT_SUBSCRIPTION_REQUIRED') {
|
|
1708
|
-
return new NotifySubscriptionRequiredError(message, details, retryAfterMs, code);
|
|
1709
|
-
}
|
|
1710
1687
|
return new AuthorizationError(message, details, retryAfterMs, code);
|
|
1711
1688
|
default:
|
|
1712
1689
|
return new SparkVaultError(message, code, status, details, retryAfterMs, code);
|
|
@@ -13434,12 +13411,7 @@ function requireNotifyProjectId(projectId) {
|
|
|
13434
13411
|
field: 'projectId', received: projectId,
|
|
13435
13412
|
});
|
|
13436
13413
|
}
|
|
13437
|
-
|
|
13438
|
-
return options.billingModel === 'usage_credits'
|
|
13439
|
-
? { billing_model: 'usage_credits' }
|
|
13440
|
-
: { notifications_per_month: options.notificationsPerMonth };
|
|
13441
|
-
}
|
|
13442
|
-
/** Company-level project management. Creation saves a draft and charges nothing. */
|
|
13414
|
+
/** Company-level project management. Creation is idempotent and charges nothing. */
|
|
13443
13415
|
class NotifyProjectsModule {
|
|
13444
13416
|
constructor(http) {
|
|
13445
13417
|
this.http = http;
|
|
@@ -13462,34 +13434,12 @@ class NotifyProjectsModule {
|
|
|
13462
13434
|
const response = await this.http.put(apiPath `/v1/products/notify/projects/${id}`, options);
|
|
13463
13435
|
return response.data;
|
|
13464
13436
|
}
|
|
13465
|
-
/** Archive
|
|
13437
|
+
/** Archive an active project; Default cannot be archived. */
|
|
13466
13438
|
async archive(projectId) {
|
|
13467
13439
|
const id = requireNotifyProjectId(projectId);
|
|
13468
13440
|
const response = await this.http.post(apiPath `/v1/products/notify/projects/${id}/archive`, {});
|
|
13469
13441
|
return response.data;
|
|
13470
13442
|
}
|
|
13471
|
-
/** Quote a named project's plan. Requires an interactive company-admin session. */
|
|
13472
|
-
async previewSubscription(projectId, options) {
|
|
13473
|
-
const id = requireNotifyProjectId(projectId);
|
|
13474
|
-
const response = await this.http.post(apiPath `/v1/products/notify/projects/${id}/subscription/preview`, subscriptionPlan(options));
|
|
13475
|
-
return response.data;
|
|
13476
|
-
}
|
|
13477
|
-
/** Purchase the reviewed plan on the company's invoice; an API key cannot authorize spending. */
|
|
13478
|
-
async subscribe(projectId, options) {
|
|
13479
|
-
const id = requireNotifyProjectId(projectId);
|
|
13480
|
-
const response = await this.http.post(apiPath `/v1/products/notify/projects/${id}/subscription`, {
|
|
13481
|
-
...subscriptionPlan(options),
|
|
13482
|
-
quoted_amount_due_now_usd: options.quotedAmountDueNowUsd,
|
|
13483
|
-
proration_date: options.prorationDate,
|
|
13484
|
-
});
|
|
13485
|
-
return response.data;
|
|
13486
|
-
}
|
|
13487
|
-
/** End a named project's plan at its paid period deadline; retained history stays readable. */
|
|
13488
|
-
async cancelSubscription(projectId) {
|
|
13489
|
-
const id = requireNotifyProjectId(projectId);
|
|
13490
|
-
const response = await this.http.delete(apiPath `/v1/products/notify/projects/${id}/subscription`);
|
|
13491
|
-
return response.data;
|
|
13492
|
-
}
|
|
13493
13443
|
}
|
|
13494
13444
|
|
|
13495
13445
|
/**
|
|
@@ -13653,11 +13603,20 @@ class NotifyProductModule {
|
|
|
13653
13603
|
throw new ValidationError(`sendId must be 1-${NOTIFY_SEND_ID_MAX_LENGTH} characters of letters, digits, and _ . : -`, { field: 'sendId', received: options.sendId });
|
|
13654
13604
|
}
|
|
13655
13605
|
}
|
|
13656
|
-
|
|
13657
|
-
|
|
13606
|
+
const destinationOnly = Array.isArray(options?.recipients) && options.recipients.length === 0;
|
|
13607
|
+
if (!Array.isArray(options?.recipients) || (destinationOnly && (options.delivery !== 'plaintext' || !Array.isArray(options.destinations) || options.destinations.length === 0
|
|
13608
|
+
|| !Array.isArray(options.channels) || options.channels.length !== 0))) {
|
|
13609
|
+
throw new ValidationError('Name recipients, or use a plaintext destination-only send with explicit destinations and empty channels', {
|
|
13658
13610
|
field: 'recipients',
|
|
13659
13611
|
});
|
|
13660
13612
|
}
|
|
13613
|
+
if (Array.isArray(options.destinations) && (new Set(options.destinations).size !== options.destinations.length
|
|
13614
|
+
|| options.destinations.some((kind) => !NOTIFY_DESTINATION_KINDS.includes(kind)))) {
|
|
13615
|
+
throw new ValidationError('destinations must name distinct destination kinds', { field: 'destinations' });
|
|
13616
|
+
}
|
|
13617
|
+
if (options.escalation?.stop_on_seen !== undefined && typeof options.escalation.stop_on_seen !== 'boolean') {
|
|
13618
|
+
throw new ValidationError('escalation.stop_on_seen must be true or false', { field: 'escalation.stop_on_seen' });
|
|
13619
|
+
}
|
|
13661
13620
|
if (Boolean(options.content) === Boolean(options.ingot)) {
|
|
13662
13621
|
throw new ValidationError('Provide exactly one content source: content OR ingot');
|
|
13663
13622
|
}
|
|
@@ -14016,31 +13975,35 @@ class NotifyProductModule {
|
|
|
14016
13975
|
/**
|
|
14017
13976
|
* Post one test message to your destination of `kind` (a webhook, a Slack
|
|
14018
13977
|
* channel or a Teams workflow) and learn what became of it, without a send:
|
|
14019
|
-
* nothing reaches a recipient, no send is stored
|
|
14020
|
-
* the test never appears in send history. The post shows the title "Test
|
|
13978
|
+
* nothing reaches a recipient, no send is stored, and
|
|
13979
|
+
* the test spends destination delivery credits and never appears in send history. The post shows the title "Test
|
|
14021
13980
|
* post from SparkVault Notify" under your organization's name, through the
|
|
14022
13981
|
* sender a send's post takes. A webhook receives a body signed like any
|
|
14023
13982
|
* other, typed `notify.destination.test`, naming no send, with a
|
|
14024
13983
|
* `delivery_id` of its own. The post is made once and never tried again,
|
|
14025
|
-
* so a fault a send's post would retry reads `failed`.
|
|
13984
|
+
* so a fault a send's post would retry reads `failed`. Retain request_id across retries;
|
|
13985
|
+
* a replay returns the saved verdict without another post or charge.
|
|
14026
13986
|
*
|
|
14027
|
-
* An org admin's call
|
|
13987
|
+
* An org admin's call: anyone else is
|
|
14028
13988
|
* refused 403 `FORBIDDEN` (`details: { sections: ['destinations'],
|
|
14029
|
-
* required_role: 'admin' }`)
|
|
14030
|
-
* `
|
|
13989
|
+
* required_role: 'admin' }`). Insufficient credits returns a failed verdict
|
|
13990
|
+
* with reason `usage_credits_exhausted`. A kind with no destination saved is 404
|
|
14031
13991
|
* `NOT_FOUND`, an organization name a send would be refused under is 409
|
|
14032
13992
|
* (`NOTIFY_SENDER_NAME_REQUIRED` or `NOTIFY_SENDER_NAME_RESERVED`), and each
|
|
14033
13993
|
* kind takes 20 tests an hour (429 `RATE_LIMIT_EXCEEDED`).
|
|
14034
13994
|
*
|
|
14035
13995
|
* @example
|
|
14036
|
-
* const { state, reason } = await sv.products.notify.testDestination('webhook');
|
|
13996
|
+
* const { state, reason } = await sv.products.notify.testDestination('webhook', { request_id: 'test_webhook_0001' });
|
|
14037
13997
|
* if (state !== 'delivered') console.warn(`Test post ${state}: ${reason}`);
|
|
14038
13998
|
*/
|
|
14039
|
-
async testDestination(kind) {
|
|
13999
|
+
async testDestination(kind, request) {
|
|
14040
14000
|
if (!NOTIFY_DESTINATION_KINDS.includes(kind)) {
|
|
14041
14001
|
throw new ValidationError(`kind must be one of ${NOTIFY_DESTINATION_KINDS.join(', ')}`);
|
|
14042
14002
|
}
|
|
14043
|
-
|
|
14003
|
+
if (!request || typeof request.request_id !== 'string' || !/^[A-Za-z0-9_-]{16,128}$/.test(request.request_id)) {
|
|
14004
|
+
throw new ValidationError('request_id must be 16 to 128 letters, numbers, underscores or hyphens');
|
|
14005
|
+
}
|
|
14006
|
+
const response = await this.http.post(this.path `/v1/products/notify/destinations/${kind}/test`, request);
|
|
14044
14007
|
return response.data;
|
|
14045
14008
|
}
|
|
14046
14009
|
/**
|
|
@@ -33062,7 +33025,7 @@ class SparkVault {
|
|
|
33062
33025
|
}
|
|
33063
33026
|
/** Get the SDK version */
|
|
33064
33027
|
static get version() {
|
|
33065
|
-
return '
|
|
33028
|
+
return '19.0.1';
|
|
33066
33029
|
}
|
|
33067
33030
|
}
|
|
33068
33031
|
if (typeof window !== 'undefined') {
|
|
@@ -33072,5 +33035,5 @@ if (typeof window !== 'undefined') {
|
|
|
33072
33035
|
window.SparkVault = instance ?? SparkVault;
|
|
33073
33036
|
}
|
|
33074
33037
|
|
|
33075
|
-
export { AuthenticationError, AuthorizationError, EntropyModule, FoldersModule, HelpDeskClient, HelpDeskModule, IdentityModule, IdentityProviderError, IngotsModule, MessagingModule, NAME_CONFLICT_POLICIES, NOTIFY_PRESETS, NetworkError, NotifyModule, NotifyProductModule, NotifyProjectsModule,
|
|
33038
|
+
export { AuthenticationError, AuthorizationError, EntropyModule, FoldersModule, HelpDeskClient, HelpDeskModule, IdentityModule, IdentityProviderError, IngotsModule, MessagingModule, NAME_CONFLICT_POLICIES, NOTIFY_PRESETS, NetworkError, NotifyModule, NotifyProductModule, NotifyProjectsModule, PlanRequiredError, PopupBlockedError, PopupSeveredError, ProductsModule, QuotaExceededError, SparkVault, SparkVaultError, SparksModule, StructuredIngotTypesModule, StructuredIngotsModule, TimeoutError, UnauthorizedError, UsageCreditFundingReviewError, UsageCreditsExhaustedError, UserCancelledError, ValidationError, VaultsModule, buildNotifyPresetSend, SparkVault as default, fetchDownload, isReceivedUploadFailure, logger, setDebugMode };
|
|
33076
33039
|
//# sourceMappingURL=index.mjs.map
|