@sparkvault/sdk-js 15.4.0 → 15.5.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.
@@ -29,6 +29,9 @@ export type NotificationSender = {
29
29
  } | {
30
30
  type: 'organization';
31
31
  name: string | null;
32
+ /** Present for a named project's notifications. */
33
+ project_id?: string;
34
+ project_name?: string | null;
32
35
  };
33
36
  /**
34
37
  * An inbox row in the two-part notification model, as one sending account's
@@ -41,6 +44,8 @@ export type NotificationSender = {
41
44
  */
42
45
  export interface NotifyInboxRow {
43
46
  notification_id: string;
47
+ /** Named project attribution; absent on Default's legacy rows. */
48
+ notify_project_id?: string;
44
49
  send_id: string;
45
50
  created_at: number;
46
51
  title: string;
@@ -28,7 +28,7 @@ export declare class ProductsModule {
28
28
  constructor(config: ResolvedConfig, http?: HttpClient);
29
29
  }
30
30
  export { IdentityModule } from './identity';
31
- export { NotifyProductModule, NOTIFY_PRESETS, buildNotifyPresetSend } from './notify';
31
+ export { NotifyProductModule, NotifyProjectsModule, NOTIFY_PRESETS, buildNotifyPresetSend } from './notify';
32
32
  export { HelpDeskModule, HelpDeskClient } from './help-desk';
33
33
  export type * from './help-desk/types';
34
34
  export type * from './help-desk/form-types';
@@ -37,3 +37,4 @@ export type { HelpDeskWidgetIdentityOptions, HelpDeskWidgetIdentityChallenge, He
37
37
  export type { HelpDeskMountFormOptions, HelpDeskOpenFormOptions } from './help-desk';
38
38
  export type { SignInOptions, SignInResult, VerifyOptions, AttachOptions, VerifyResult, TokenClaims, } from './identity';
39
39
  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';
40
+ export type * from './notify/project-types';
@@ -21,6 +21,7 @@
21
21
  * and metadata.
22
22
  */
23
23
  import { HttpClient } from '../../http';
24
+ import { NotifyProjectsModule } from './projects';
24
25
  import type { CreateNotifySendOptions, NotifySendResult, NotifyPreset, NotifyPresetName, NotifyPresetSendOptions, ListNotifyInboxOptions, ListNotifyInboxResponse, MarkNotifyInboxStateOptions, MarkNotifyInboxStateResponse, MarkNotifyInboxAllOptions, MarkNotifyInboxAllResponse, NotifySendStatus, ListNotifySendsOptions, ListNotifySendsResponse, RecallNotifySendOptions, RecallNotifySendResponse, ListNotifyReceiptsOptions, ListNotifyReceiptsResponse, NotifySendReceiptsResponse, NotifyConfigPatch, NotifyConfigResponse, NotifyDestinationKind, NotifyDestinationTestResult } from './types';
25
26
  /**
26
27
  * The five secure-by-default preset bundles: the server's own table, in this
@@ -54,7 +55,16 @@ export declare const NOTIFY_PRESETS: Readonly<Record<NotifyPresetName, NotifyPre
54
55
  export declare function buildNotifyPresetSend(preset: NotifyPresetName, options: NotifyPresetSendOptions): CreateNotifySendOptions;
55
56
  export declare class NotifyProductModule {
56
57
  private readonly http;
57
- constructor(http: HttpClient);
58
+ readonly projects: NotifyProjectsModule;
59
+ private readonly projectId?;
60
+ constructor(http: HttpClient, projectId?: string);
61
+ /**
62
+ * Bind every send, read and setting to one project. The original module keeps
63
+ * addressing Default for existing integrations; this never changes global state.
64
+ */
65
+ project(projectId: string): NotifyProductModule;
66
+ /** Compose two already-validated paths; project selection never enters a body. */
67
+ private path;
58
68
  /**
59
69
  * Send a notification: seal the content, mint one single-use SparkLink per
60
70
  * recipient, and enqueue delivery across the resolved channel ladder.
@@ -415,3 +425,5 @@ export declare class NotifyProductModule {
415
425
  }>;
416
426
  }
417
427
  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';
428
+ export { NotifyProjectsModule } from './projects';
429
+ export type * from './project-types';
@@ -0,0 +1,77 @@
1
+ /** Named Notify projects owned and billed by one company account. */
2
+ export type NotifyProjectStatus = 'draft' | 'active' | 'read_only' | 'archived';
3
+ export interface NotifyProjectBilling {
4
+ subscription_item_id?: string | null;
5
+ subscription_id?: string | null;
6
+ status: 'draft' | 'active' | 'past_due' | 'read_only';
7
+ notifications_cap: number;
8
+ /** Allowance selected for the next period when a downgrade is scheduled. */
9
+ renewal_notifications_cap?: number;
10
+ current_period_end?: number | null;
11
+ cancel_at_period_end?: boolean;
12
+ price_id?: string | null;
13
+ stripe_product_id?: string | null;
14
+ tier_price_id?: string | null;
15
+ /** Default uses the company's existing Notify subscription. */
16
+ legacy?: boolean;
17
+ }
18
+ export interface NotifyProjectUsage {
19
+ notifications_used: number;
20
+ cycle_resets_at: number | null;
21
+ }
22
+ export interface NotifyProject {
23
+ /** Immutable project id. `default` addresses the existing account's Notify. */
24
+ project_id: string;
25
+ account_id: string;
26
+ name: string;
27
+ description: string;
28
+ /** Optional project sender name; null uses the organization's name. */
29
+ sender_name: string | null;
30
+ status: NotifyProjectStatus;
31
+ /** Epoch seconds. */
32
+ created_at: number;
33
+ updated_at: number;
34
+ archived_at?: number;
35
+ billing: NotifyProjectBilling;
36
+ usage: NotifyProjectUsage;
37
+ }
38
+ export interface ListNotifyProjectsResponse {
39
+ items: NotifyProject[];
40
+ }
41
+ export interface CreateNotifyProjectOptions {
42
+ /** A recognizable name, up to 80 characters. */
43
+ name: string;
44
+ /** Up to 240 characters. */
45
+ description?: string;
46
+ /** Up to 64 characters; null uses the organization's name. */
47
+ sender_name?: string | null;
48
+ }
49
+ export interface UpdateNotifyProjectOptions {
50
+ name?: string;
51
+ description?: string;
52
+ sender_name?: string | null;
53
+ }
54
+ export interface PreviewNotifyProjectSubscriptionOptions {
55
+ notificationsPerMonth: number;
56
+ }
57
+ export interface NotifyProjectSubscriptionPreview {
58
+ project_id: string;
59
+ notifications_per_month: number;
60
+ /** Exact decimal USD amounts, as strings; repeat the quote without float conversion. */
61
+ monthly_usd: string;
62
+ amount_due_now_usd: string;
63
+ currency: string;
64
+ proration_date: number;
65
+ effective_at: number | null;
66
+ checkout_required: boolean;
67
+ }
68
+ export interface SubscribeNotifyProjectOptions extends PreviewNotifyProjectSubscriptionOptions {
69
+ /** Repeat the reviewed quote; a changed price is refused rather than charged. */
70
+ quotedAmountDueNowUsd: string;
71
+ prorationDate: number;
72
+ }
73
+ export interface NotifyProjectSubscriptionResponse {
74
+ project: NotifyProject;
75
+ /** Present when the company's first subscription needs hosted payment setup. */
76
+ checkout_url?: string;
77
+ }
@@ -0,0 +1,21 @@
1
+ import { HttpClient } from '../../http';
2
+ import type { CreateNotifyProjectOptions, ListNotifyProjectsResponse, NotifyProject, NotifyProjectSubscriptionPreview, NotifyProjectSubscriptionResponse, PreviewNotifyProjectSubscriptionOptions, SubscribeNotifyProjectOptions, UpdateNotifyProjectOptions } from './project-types';
3
+ /** Reject malformed project paths before a credentialed request leaves. */
4
+ export declare function requireNotifyProjectId(projectId: unknown): string;
5
+ /** Company-level project management. Creation saves a draft and charges nothing. */
6
+ export declare class NotifyProjectsModule {
7
+ private readonly http;
8
+ constructor(http: HttpClient);
9
+ list(): Promise<ListNotifyProjectsResponse>;
10
+ create(options: CreateNotifyProjectOptions): Promise<NotifyProject>;
11
+ get(projectId: string): Promise<NotifyProject>;
12
+ update(projectId: string, options: UpdateNotifyProjectOptions): Promise<NotifyProject>;
13
+ /** Archive after its paid plan has ended; Default cannot be archived. */
14
+ archive(projectId: string): Promise<NotifyProject>;
15
+ /** Quote a named project's plan. Requires an interactive company-admin session. */
16
+ previewSubscription(projectId: string, options: PreviewNotifyProjectSubscriptionOptions): Promise<NotifyProjectSubscriptionPreview>;
17
+ /** Purchase the reviewed plan on the company's invoice; an API key cannot authorize spending. */
18
+ subscribe(projectId: string, options: SubscribeNotifyProjectOptions): Promise<NotifyProjectSubscriptionResponse>;
19
+ /** End a named project's plan at its paid period deadline; retained history stays readable. */
20
+ cancelSubscription(projectId: string): Promise<NotifyProjectSubscriptionResponse>;
21
+ }
@@ -779,6 +779,8 @@ export type NotifySendState = 'unknown' | 'pending' | 'sending' | 'delivered' |
779
779
  */
780
780
  export interface NotifySendSummary {
781
781
  send_id: string | null;
782
+ /** Named project id; absent on Default. */
783
+ notify_project_id?: string;
782
784
  /** Epoch seconds. */
783
785
  created_at: number | null;
784
786
  title: string | null;