@sparkvault/sdk-js 15.10.0 → 15.11.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.d.ts CHANGED
@@ -4233,12 +4233,213 @@ declare class StructuredIngotsModule {
4233
4233
  importRecords(vault: UnsealedVault, records: AsyncIterable<PortableStructuredIngot> | Iterable<PortableStructuredIngot>, options?: ImportStructuredIngotsOptions): AsyncGenerator<StructuredImportOutcome>;
4234
4234
  }
4235
4235
 
4236
+ /** The authenticated business API; account-less recipient sign-in is separate. */
4237
+ type MessagingIdentity = string | Record<string, unknown>;
4238
+ interface MessagingParticipant {
4239
+ svid: string;
4240
+ role: 'owner' | 'member';
4241
+ addedAt: number;
4242
+ /** Opaque display descriptor, preserved as stored (including user_id/email). */
4243
+ identity?: MessagingIdentity;
4244
+ optedOut?: boolean;
4245
+ }
4246
+ interface MessagingParticipantInput {
4247
+ /** Business member principal. Account-less recipients must join by invite. */
4248
+ svid: string;
4249
+ identity?: MessagingIdentity;
4250
+ }
4251
+ interface MessagingConversationSettings {
4252
+ /** Audit-row retention and receipt lifetime in seconds; 0 disables both. */
4253
+ auditRetentionSeconds?: number;
4254
+ }
4255
+ interface CreateMessagingConversationOptions {
4256
+ participants?: MessagingParticipantInput[];
4257
+ settings?: MessagingConversationSettings;
4258
+ }
4259
+ interface MessagingConversationCreated {
4260
+ conversationId: string;
4261
+ vaultId: string;
4262
+ participants: MessagingParticipant[];
4263
+ createdAt: number;
4264
+ }
4265
+ interface MessagingConversation {
4266
+ conversationId: string;
4267
+ participants: MessagingParticipant[];
4268
+ /** Contiguous durable boundary, not a ceiling for reads. */
4269
+ committedThrough: number;
4270
+ compactedThrough: number;
4271
+ settings: MessagingConversationSettings;
4272
+ createdAt: number;
4273
+ }
4274
+ /** Opaque start key: pass the object from the preceding page back unchanged. */
4275
+ type MessagingInboxCursor = Record<string, string | number>;
4276
+ interface ListMessagingInboxOptions {
4277
+ /** Server default 25, capped at 100. */
4278
+ limit?: number;
4279
+ cursor?: MessagingInboxCursor;
4280
+ }
4281
+ interface MessagingInboxEntry {
4282
+ conversationId: string;
4283
+ accountId: string;
4284
+ lastActivityTs: number;
4285
+ lastMessageId: number;
4286
+ unreadCount: number;
4287
+ lastReadId?: number;
4288
+ archived: boolean;
4289
+ otherParticipants?: unknown;
4290
+ }
4291
+ interface MessagingInboxPage {
4292
+ conversations: MessagingInboxEntry[];
4293
+ /** A short/empty page may still have a continuation. */
4294
+ cursor?: MessagingInboxCursor;
4295
+ }
4296
+ interface MessagingAttachment {
4297
+ ingotId: string;
4298
+ /** Display filename sealed in the message, not in the transfer URL. */
4299
+ name: string;
4300
+ }
4301
+ interface MessagingContentMessage {
4302
+ messageId: number;
4303
+ schemaVersion: number;
4304
+ senderSvid: string;
4305
+ senderIdentity: MessagingIdentity;
4306
+ /** Epoch seconds. */
4307
+ ts: number;
4308
+ contentType: string;
4309
+ content: string;
4310
+ attachments: MessagingAttachment[];
4311
+ recalled?: false;
4312
+ unavailable?: false;
4313
+ }
4314
+ interface MessagingRecalledMessage {
4315
+ messageId: number;
4316
+ recalled: true;
4317
+ unavailable?: false;
4318
+ }
4319
+ interface MessagingUnavailableMessage {
4320
+ messageId: number;
4321
+ unavailable: true;
4322
+ recalled?: false;
4323
+ }
4324
+ /** A gap may become readable on a later read; a recall never carries content. */
4325
+ type MessagingMessage = MessagingContentMessage | MessagingRecalledMessage | MessagingUnavailableMessage;
4326
+ interface ReadMessagingConversationOptions {
4327
+ /** Inclusive range; supply both fromId and toId to page through history. */
4328
+ fromId?: number;
4329
+ toId?: number;
4330
+ /** Newest-page size when no range is supplied; server default 25, cap 50. */
4331
+ limit?: number;
4332
+ }
4333
+ interface MessagingReadResult {
4334
+ messages: MessagingMessage[];
4335
+ committedThrough: number;
4336
+ compactedThrough: number;
4337
+ }
4338
+ interface SendMessagingMessageOptions {
4339
+ /** Non-empty text, at most 64 KiB UTF-8 (enforced by Core). */
4340
+ content: string;
4341
+ contentType?: 'text/plain';
4342
+ /** Completed, live unsent uploads belonging to this sender/conversation. */
4343
+ attachments?: MessagingAttachment[];
4344
+ }
4345
+ interface MessagingMessageReceipt {
4346
+ accountId: string;
4347
+ conversationId: string;
4348
+ messageId: number;
4349
+ senderSvid: string;
4350
+ contentHash: string;
4351
+ ts: number;
4352
+ }
4353
+ interface MessagingSendResult {
4354
+ messageId: number;
4355
+ conversationId: string;
4356
+ ts: number;
4357
+ ingotId: string;
4358
+ contentHash: string;
4359
+ committedThrough: number;
4360
+ /** Pending means an earlier allocated id has not been resolved yet. */
4361
+ status: 'committed' | 'pending';
4362
+ receipt: MessagingMessageReceipt;
4363
+ }
4364
+ interface MessagingReceiptToken {
4365
+ receiptToken: string;
4366
+ expiresAt: number;
4367
+ receipt: Omit<MessagingMessageReceipt, 'ts'> & {
4368
+ messageTs: number;
4369
+ };
4370
+ }
4371
+ interface MessagingRecipientIdentity {
4372
+ type: 'email' | 'phone';
4373
+ value: string;
4374
+ }
4375
+ interface MessagingInviteResult {
4376
+ svid: string;
4377
+ accessUrl: string;
4378
+ }
4379
+ interface InitiateMessagingAttachmentOptions {
4380
+ sizeBytes: number;
4381
+ contentType?: string;
4382
+ }
4383
+ interface MessagingAttachmentUpload {
4384
+ ingotId: string;
4385
+ /** Client-direct upload URL; this method does not transfer bytes. */
4386
+ forgeUrl: string;
4387
+ expiresAt: number;
4388
+ maxBytes: number;
4389
+ }
4390
+ interface MessagingAttachmentDownload {
4391
+ ingotId: string;
4392
+ /** Client-direct download URL; the filename comes from the message. */
4393
+ forgeUrl: string;
4394
+ expiresAt: number;
4395
+ sizeBytes: number;
4396
+ contentType: string;
4397
+ }
4398
+
4399
+ /**
4400
+ * Business-side Messaging operations using the caller's Core JWT or API key.
4401
+ * Core brokers the keys and returns plaintext reads; this is not end-to-end
4402
+ * encryption. No recipient login, DOM widget, polling or message cache lives here.
4403
+ */
4404
+
4405
+ /** Stateless, authenticated business API for the pre-launch Messaging product. */
4406
+ declare class MessagingModule {
4407
+ private readonly http;
4408
+ constructor(http: HttpClient);
4409
+ /** Follow cursor even when a page contains fewer than limit conversations. */
4410
+ getInbox(options?: ListMessagingInboxOptions): Promise<MessagingInboxPage>;
4411
+ /** Create with business members; invite account-less recipients separately. */
4412
+ createConversation(options?: CreateMessagingConversationOptions): Promise<MessagingConversationCreated>;
4413
+ getConversation(conversationId: string): Promise<MessagingConversation>;
4414
+ /** Sends are never retried automatically: Core allocates a new id per send. */
4415
+ send(conversationId: string, options: SendMessagingMessageOptions): Promise<MessagingSendResult>;
4416
+ /** Fresh read each time, including recalls and newly resolved gaps at old ids. */
4417
+ read(conversationId: string, options?: ReadMessagingConversationOptions): Promise<MessagingReadResult>;
4418
+ markRead(conversationId: string, lastReadId: number): Promise<void>;
4419
+ archive(conversationId: string, archived?: boolean): Promise<void>;
4420
+ invite(conversationId: string, identity: MessagingRecipientIdentity): Promise<MessagingInviteResult>;
4421
+ addParticipant(conversationId: string, input: MessagingParticipantInput): Promise<MessagingParticipant[]>;
4422
+ removeParticipant(conversationId: string, svid: string): Promise<MessagingParticipant[]>;
4423
+ recall(conversationId: string, messageId: number): Promise<void>;
4424
+ getReceipt(conversationId: string, messageId: number): Promise<MessagingReceiptToken>;
4425
+ /** Owner-only; a closed conversation refuses new sends. */
4426
+ close(conversationId: string, closed?: boolean): Promise<void>;
4427
+ /** Stores the caller's preference; Core currently does not gate sends on it. */
4428
+ setOptOut(conversationId: string, optedOut: boolean): Promise<void>;
4429
+ /** Owner-only; legal hold prevents recall, not account deletion. */
4430
+ setLegalHold(conversationId: string, held: boolean): Promise<void>;
4431
+ /** Returns transfer metadata only; no account credential is sent to Forge. */
4432
+ initiateAttachmentUpload(conversationId: string, options: InitiateMessagingAttachmentOptions): Promise<MessagingAttachmentUpload>;
4433
+ getAttachmentDownload(conversationId: string, ingotId: string): Promise<MessagingAttachmentDownload>;
4434
+ }
4435
+
4236
4436
  /**
4237
4437
  * Products Module
4238
4438
  *
4239
4439
  * Namespace for SparkVault first-party products. Each product is a
4240
4440
  * self-contained surface (UI + API) the account can enable independently.
4241
- * Identity, Notify, and the customer-facing Help Desk attach here.
4441
+ * Identity, Notify, customer-facing Help Desk, Structured Ingots, and the
4442
+ * pre-launch Messaging business API attach here.
4242
4443
  */
4243
4444
 
4244
4445
  declare class ProductsModule {
@@ -4254,6 +4455,8 @@ declare class ProductsModule {
4254
4455
  readonly helpDesk: HelpDeskModule;
4255
4456
  /** Encrypted structured records, optional types, and retained object history. */
4256
4457
  readonly structuredIngots: StructuredIngotsModule;
4458
+ /** Authenticated business API for pre-launch Messaging; no recipient widget. */
4459
+ readonly messaging: MessagingModule;
4257
4460
  /**
4258
4461
  * `http` defaults to a client over the same resolved config so constructing
4259
4462
  * this module standalone stays a one-argument call.
@@ -5956,7 +6159,7 @@ declare const logger: {
5956
6159
  */
5957
6160
 
5958
6161
  declare class SparkVault {
5959
- /** First-party Identity, Notify, Help Desk, and Structured Ingots products. */
6162
+ /** First-party products, including the pre-launch Messaging business API. */
5960
6163
  readonly products: ProductsModule;
5961
6164
  /** Encrypted vault control plane (create, unseal, sharing, upload config). */
5962
6165
  readonly vaults: VaultsModule;
@@ -6009,5 +6212,5 @@ declare global {
6009
6212
  }
6010
6213
  }
6011
6214
 
6012
- export { AuthenticationError, AuthorizationError, EntropyModule, FoldersModule, HelpDeskClient, HelpDeskModule, IdentityModule, IdentityProviderError, IngotsModule, NAME_CONFLICT_POLICIES, NOTIFY_PRESETS, NetworkError, NotifyModule, NotifyProductModule, NotifyProjectsModule, NotifySubscriptionRequiredError, PlanRequiredError, PopupBlockedError, ProductsModule, QuotaExceededError, SparkVault, SparkVaultError, SparksModule, StructuredIngotTypesModule, StructuredIngotsModule, TimeoutError, UnauthorizedError, UsageCreditFundingReviewError, UsageCreditsExhaustedError, UserCancelledError, ValidationError, VaultsModule, buildNotifyPresetSend, SparkVault as default, fetchDownload, isReceivedUploadFailure, logger, setDebugMode };
6013
- export type { AccessLogRetention, AccessLogsOptions, BatchGetStructuredIngotsOptions, CreateFolderOptions, 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, HelpDeskConnectOptions, HelpDeskCreateTicketOptions, HelpDeskCustomer, HelpDeskCustomerPatch, HelpDeskDesk, HelpDeskDraft, HelpDeskEvent, HelpDeskExternalChallenge, HelpDeskExternalIdentity, HelpDeskFormHandle, HelpDeskFormOptions, HelpDeskFormState, HelpDeskIdentityRequest, HelpDeskListTicketsOptions, HelpDeskMountFormOptions, HelpDeskOpenFormOptions, HelpDeskPinChallenge, HelpDeskReplyCreated, HelpDeskReplyOptions, HelpDeskRequestContext, HelpDeskSession, HelpDeskSessionChange, HelpDeskSupportHandle, HelpDeskSupportLauncherOptions, HelpDeskSupportOpenOptions, HelpDeskSupportOptions, HelpDeskSupportStage, HelpDeskSupportState, HelpDeskTicket, HelpDeskTicketCreated, HelpDeskTicketDetail, HelpDeskTicketList, HelpDeskTimeline, HelpDeskVerifyPinOptions, HelpDeskWidgetFormIdentity, HelpDeskWidgetIdentityChallenge, HelpDeskWidgetIdentityOptions, HelpDeskWidgetIdentitySession, AttachOptions as IdentityAttachOptions, ImportStructuredIngotsOptions, Ingot, IngotAccessLog, IngotAccessLogPage, IngotDownload, IngotDownloadLink, IngotHistory, IngotInvitation, IngotInvite, IngotPage, IngotSharingConfig, IngotUpload, IngotVersion, IngotVersionDownloadLink, ListContentsOptions, ListFoldersOptions, ListIngotsOptions, ListNotificationsOptions, ListNotificationsResponse, ListNotifyInboxOptions, ListNotifyInboxResponse, ListNotifyProjectsResponse, ListNotifyReceiptsOptions, ListNotifyReceiptsResponse, ListNotifySendsOptions, ListNotifySendsResponse, ListSparksOptions, MarkAllNotificationsStateOptions, MarkAllNotificationsStateResponse, MarkAllReadResult, MarkNotificationStateOptions, MarkNotificationStateResponse, MarkNotifyInboxAllOptions, MarkNotifyInboxAllResponse, MarkNotifyInboxStateOptions, MarkNotifyInboxStateResponse, NameConflictPolicy, NotificationBulkMarkState, NotificationInboxState, NotificationMarkState, NotificationRow, NotificationSender, NotifyCategory, NotifyChannel, NotifyConfig, NotifyConfigCategory, NotifyConfigDelivery, NotifyConfigDeliveryPatch, NotifyConfigDestinations, NotifyConfigDestinationsPatch, NotifyConfigEvents, NotifyConfigEventsRead, NotifyConfigHistory, NotifyConfigOverrides, NotifyConfigPatch, NotifyConfigRealtimeFallbackDelay, 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, NotifyProjectSubscriptionPreview, NotifyProjectSubscriptionResponse, NotifyProjectUsage, NotifyRecallMode, NotifyReceipt, NotifyReceiptEventType, NotifyRecipient, NotifyRecipientRef, NotifyRecipientState, NotifyReportableVerificationLevel, NotifySendContent, NotifySendPolicy, NotifySendReceipt, NotifySendReceiptsResponse, NotifySendResult, NotifySendState, NotifySendStatus, NotifySendStatusCounts, NotifySendStatusDestination, NotifySendStatusRecipient, NotifySendSummary, NotifySendSummaryDestination, NotifySlackDestination, NotifySuppressionReason, NotifyTeamsDestination, NotifyTeamsDestinationRead, NotifyVerificationLevel, NotifyWebhookDestination, NotifyWebhookDestinationRead, PatchStructuredIngotOptions, PortableStructuredIngot, PortableStructuredType, PreviewNotifyProjectSubscriptionOptions, PublishStructuredTypeOptions, QuotaResource, RecallNotifySendOptions, RecallNotifySendResponse, RegisterWebPushResponse, ReplaceIngotOptions, RestoreStructuredIngotOptions, ResumeUploadOptions, ScheduledVaultDeletion, SearchIngotsOptions, SendUploadOptions, ShareSparkOptions, SignInOptions, SignInResult, 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, SubscribeNotifyProjectOptions, 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 };
6215
+ export { AuthenticationError, AuthorizationError, EntropyModule, FoldersModule, HelpDeskClient, HelpDeskModule, IdentityModule, IdentityProviderError, IngotsModule, MessagingModule, NAME_CONFLICT_POLICIES, NOTIFY_PRESETS, NetworkError, NotifyModule, NotifyProductModule, NotifyProjectsModule, NotifySubscriptionRequiredError, PlanRequiredError, PopupBlockedError, ProductsModule, QuotaExceededError, SparkVault, SparkVaultError, SparksModule, StructuredIngotTypesModule, StructuredIngotsModule, TimeoutError, UnauthorizedError, UsageCreditFundingReviewError, UsageCreditsExhaustedError, UserCancelledError, ValidationError, VaultsModule, buildNotifyPresetSend, SparkVault as default, fetchDownload, isReceivedUploadFailure, logger, setDebugMode };
6216
+ 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, HelpDeskConnectOptions, HelpDeskCreateTicketOptions, HelpDeskCustomer, HelpDeskCustomerPatch, HelpDeskDesk, HelpDeskDraft, HelpDeskEvent, HelpDeskExternalChallenge, HelpDeskExternalIdentity, HelpDeskFormHandle, HelpDeskFormOptions, HelpDeskFormState, HelpDeskIdentityRequest, HelpDeskListTicketsOptions, HelpDeskMountFormOptions, HelpDeskOpenFormOptions, HelpDeskPinChallenge, HelpDeskReplyCreated, HelpDeskReplyOptions, HelpDeskRequestContext, HelpDeskSession, HelpDeskSessionChange, HelpDeskSupportHandle, HelpDeskSupportLauncherOptions, HelpDeskSupportOpenOptions, HelpDeskSupportOptions, HelpDeskSupportStage, HelpDeskSupportState, HelpDeskTicket, HelpDeskTicketCreated, HelpDeskTicketDetail, HelpDeskTicketList, HelpDeskTimeline, HelpDeskVerifyPinOptions, 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, 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, NotifyProjectSubscriptionPreview, NotifyProjectSubscriptionResponse, NotifyProjectUsage, NotifyRecallMode, NotifyReceipt, NotifyReceiptEventType, NotifyRecipient, NotifyRecipientRef, NotifyRecipientState, NotifyReportableVerificationLevel, NotifySendContent, NotifySendPolicy, NotifySendReceipt, NotifySendReceiptsResponse, NotifySendResult, NotifySendState, NotifySendStatus, NotifySendStatusCounts, NotifySendStatusDestination, NotifySendStatusRecipient, NotifySendSummary, NotifySendSummaryDestination, NotifySlackDestination, NotifySuppressionReason, NotifyTeamsDestination, NotifyTeamsDestinationRead, NotifyVerificationLevel, NotifyWebhookDestination, NotifyWebhookDestinationRead, PatchStructuredIngotOptions, PortableStructuredIngot, PortableStructuredType, PreviewNotifyProjectSubscriptionOptions, PublishStructuredTypeOptions, QuotaResource, ReadMessagingConversationOptions, RecallNotifySendOptions, RecallNotifySendResponse, RegisterWebPushResponse, ReplaceIngotOptions, RestoreStructuredIngotOptions, ResumeUploadOptions, ScheduledVaultDeletion, SearchIngotsOptions, SendMessagingMessageOptions, SendUploadOptions, ShareSparkOptions, SignInOptions, SignInResult, 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, SubscribeNotifyProjectOptions, 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
@@ -21543,12 +21543,12 @@ function requireRef(ref) {
21543
21543
  return ref;
21544
21544
  throw new ValidationError('ref must be an ingot ID or a :name reference');
21545
21545
  }
21546
- function integer(value, field, minimum, maximum) {
21546
+ function integer$1(value, field, minimum, maximum) {
21547
21547
  if (!Number.isSafeInteger(value) || value < minimum || value > maximum)
21548
21548
  throw new ValidationError(`${field} must be a whole number from ${minimum} to ${maximum}`);
21549
21549
  return value;
21550
21550
  }
21551
- function expectedVersion(value) { return integer(value, 'expectedVersion', 1, 0xFFFFFFFF); }
21551
+ function expectedVersion(value) { return integer$1(value, 'expectedVersion', 1, 0xFFFFFFFF); }
21552
21552
  function mutationPrecondition(options) {
21553
21553
  const revision = expectedRevision(options.expectedRevision);
21554
21554
  const version = options.expectedVersion;
@@ -21569,7 +21569,7 @@ function keysQuery(keys) {
21569
21569
  }
21570
21570
  function pageQuery(options) {
21571
21571
  if (options.limit !== undefined)
21572
- integer(options.limit, 'limit', 1, 200);
21572
+ integer$1(options.limit, 'limit', 1, 200);
21573
21573
  if (options.cursor !== undefined && (typeof options.cursor !== 'string' || !options.cursor.length || options.cursor.length > 8192)) {
21574
21574
  throw new ValidationError('cursor must be a non-empty continuation token');
21575
21575
  }
@@ -21622,7 +21622,7 @@ function idempotencyHeaders(key) {
21622
21622
  }
21623
21623
  /** Empty pages are legitimate; a repeated cursor is never drained forever. */
21624
21624
  async function* iteratePages(read, options = {}) {
21625
- const maxPages = integer(options.maxPages ?? 10000, 'maxPages', 1, 100000);
21625
+ const maxPages = integer$1(options.maxPages ?? 10000, 'maxPages', 1, 100000);
21626
21626
  pageQuery(options);
21627
21627
  const seen = new Set();
21628
21628
  let cursor = options.cursor;
@@ -21675,7 +21675,7 @@ class StructuredIngotTypesModule {
21675
21675
  async publish(vault, typeId, options) {
21676
21676
  const id = requireVault(vault);
21677
21677
  const type = wirePin({ typeId, version: options.expectedVersion }).type_id;
21678
- integer(options.expectedVersion, 'expectedVersion', 1, STRUCTURED_TYPE_LIMITS.maxVersions);
21678
+ integer$1(options.expectedVersion, 'expectedVersion', 1, STRUCTURED_TYPE_LIMITS.maxVersions);
21679
21679
  validateValues(options.schema);
21680
21680
  const { data } = await this.http.post(apiPath `/v1/products/structured-ingots/${id}/types/${type}/versions`, { expected_version: options.expectedVersion, schema: options.schema, transforms: options.transforms ?? [] }, { vat: vault.vatToken });
21681
21681
  return definition(data);
@@ -21799,7 +21799,7 @@ class StructuredIngotsModule {
21799
21799
  throw new ValidationError('batchGet accepts at most 100 references');
21800
21800
  refs.forEach(requireRef);
21801
21801
  keysQuery(options.keys);
21802
- const concurrency = integer(options.concurrency ?? 4, 'concurrency', 1, 8);
21802
+ const concurrency = integer$1(options.concurrency ?? 4, 'concurrency', 1, 8);
21803
21803
  // Keep the validated work bounded even if the caller reuses its arrays.
21804
21804
  const input = refs.slice();
21805
21805
  const keys = options.keys?.slice();
@@ -21891,12 +21891,156 @@ class StructuredIngotsModule {
21891
21891
  }
21892
21892
  }
21893
21893
 
21894
+ function integer(value, field, minimum = 1) {
21895
+ if (!Number.isSafeInteger(value) || value < minimum) {
21896
+ throw new ValidationError(`${field} must be a ${minimum === 0 ? 'non-negative' : 'positive'} safe integer`, { field });
21897
+ }
21898
+ }
21899
+ function participant(wire) {
21900
+ return { svid: wire.svid, role: wire.role, addedAt: wire.added_at,
21901
+ ...(wire.identity === undefined ? {} : { identity: wire.identity }),
21902
+ ...(wire.opted_out === undefined ? {} : { optedOut: wire.opted_out }) };
21903
+ }
21904
+ function message(wire) {
21905
+ if (wire.recalled)
21906
+ return { messageId: wire.message_id, recalled: true };
21907
+ if (wire.unavailable)
21908
+ return { messageId: wire.message_id, unavailable: true };
21909
+ return { messageId: wire.message_id, schemaVersion: wire.schema_version, senderSvid: wire.sender_svid,
21910
+ senderIdentity: wire.sender_identity, ts: wire.ts, contentType: wire.content_type, content: wire.content,
21911
+ attachments: (wire.attachments ?? []).map((item) => ({ ingotId: item.ingot_id, name: item.name })) };
21912
+ }
21913
+ function receipt(wire) {
21914
+ return { accountId: wire.account_id, conversationId: wire.conversation_id, messageId: wire.message_id,
21915
+ senderSvid: wire.sender_svid, contentHash: wire.content_hash };
21916
+ }
21917
+ /** Stateless, authenticated business API for the pre-launch Messaging product. */
21918
+ class MessagingModule {
21919
+ constructor(http) {
21920
+ this.http = http;
21921
+ }
21922
+ /** Follow cursor even when a page contains fewer than limit conversations. */
21923
+ async getInbox(options = {}) {
21924
+ if (options.limit !== undefined)
21925
+ integer(options.limit, 'limit');
21926
+ // Core decodes the query's cursor once more before JSON.parse. Encode the
21927
+ // serialized key here; the shared transport applies the outer query encoding.
21928
+ const { data } = await this.http.get(apiPath `/v1/products/messaging/inbox`, {
21929
+ query: { limit: options.limit, cursor: options.cursor === undefined ? undefined : encodeURIComponent(JSON.stringify(options.cursor)) },
21930
+ });
21931
+ return { conversations: data.items.map((item) => ({ conversationId: item.conversation_id, accountId: item.account_id,
21932
+ lastActivityTs: item.last_activity_ts, lastMessageId: item.last_message_id, unreadCount: item.unread_count ?? 0,
21933
+ archived: item.archived === true, ...(item.last_read_id === undefined ? {} : { lastReadId: item.last_read_id }),
21934
+ ...(item.other_participants === undefined ? {} : { otherParticipants: item.other_participants }) })),
21935
+ ...(data.cursor == null ? {} : { cursor: data.cursor }) };
21936
+ }
21937
+ /** Create with business members; invite account-less recipients separately. */
21938
+ async createConversation(options = {}) {
21939
+ const { data } = await this.http.post(apiPath `/v1/products/messaging/conversations`, {
21940
+ participants: options.participants,
21941
+ settings: options.settings === undefined ? undefined : { audit_retention_seconds: options.settings.auditRetentionSeconds },
21942
+ });
21943
+ return { conversationId: data.conversation_id, vaultId: data.vault_id,
21944
+ participants: data.participants.map(participant), createdAt: data.created_at };
21945
+ }
21946
+ async getConversation(conversationId) {
21947
+ const { data } = await this.http.get(apiPath `/v1/products/messaging/conversations/${conversationId}`);
21948
+ return { conversationId: data.conversation_id, participants: data.participants.map(participant),
21949
+ committedThrough: data.committed_through, compactedThrough: data.compacted_through, createdAt: data.created_at,
21950
+ settings: data.settings.audit_retention_seconds === undefined ? {} : { auditRetentionSeconds: data.settings.audit_retention_seconds } };
21951
+ }
21952
+ /** Sends are never retried automatically: Core allocates a new id per send. */
21953
+ async send(conversationId, options) {
21954
+ if (typeof options?.content !== 'string' || !options.content.length)
21955
+ throw new ValidationError('content must be a non-empty string');
21956
+ const { data } = await this.http.post(apiPath `/v1/products/messaging/conversations/${conversationId}/messages`, {
21957
+ content: options.content, content_type: options.contentType,
21958
+ attachments: options.attachments?.map((item) => ({ ingot_id: item.ingotId, name: item.name })),
21959
+ });
21960
+ return { messageId: data.message_id, conversationId: data.conversation_id, ts: data.ts, ingotId: data.ingot_id,
21961
+ contentHash: data.content_hash, committedThrough: data.committed_through, status: data.status,
21962
+ receipt: { ...receipt(data.receipt), ts: data.receipt.ts } };
21963
+ }
21964
+ /** Fresh read each time, including recalls and newly resolved gaps at old ids. */
21965
+ async read(conversationId, options = {}) {
21966
+ if ((options.fromId === undefined) !== (options.toId === undefined))
21967
+ throw new ValidationError('fromId and toId must be supplied together');
21968
+ if (options.fromId !== undefined)
21969
+ integer(options.fromId, 'fromId');
21970
+ if (options.toId !== undefined)
21971
+ integer(options.toId, 'toId');
21972
+ if (options.fromId !== undefined && options.toId < options.fromId)
21973
+ throw new ValidationError('toId must be at least fromId');
21974
+ if (options.limit !== undefined)
21975
+ integer(options.limit, 'limit');
21976
+ const { data } = await this.http.get(apiPath `/v1/products/messaging/conversations/${conversationId}/messages`, {
21977
+ query: { from_id: options.fromId, to_id: options.toId, limit: options.limit },
21978
+ });
21979
+ return { messages: data.messages.map(message), committedThrough: data.committed_through, compactedThrough: data.compacted_through };
21980
+ }
21981
+ async markRead(conversationId, lastReadId) {
21982
+ integer(lastReadId, 'lastReadId', 0);
21983
+ await this.http.post(apiPath `/v1/products/messaging/conversations/${conversationId}/read`, { last_read_id: lastReadId });
21984
+ }
21985
+ async archive(conversationId, archived = true) {
21986
+ await this.http.put(apiPath `/v1/products/messaging/conversations/${conversationId}/archive`, { archived });
21987
+ }
21988
+ async invite(conversationId, identity) {
21989
+ if (!identity || !['email', 'phone'].includes(identity.type) || typeof identity.value !== 'string' || !identity.value.trim()) {
21990
+ throw new ValidationError('type (email|phone) and a non-empty value are required');
21991
+ }
21992
+ const { data } = await this.http.post(apiPath `/v1/products/messaging/conversations/${conversationId}/invites`, identity);
21993
+ return { svid: data.svid, accessUrl: data.access_url };
21994
+ }
21995
+ async addParticipant(conversationId, input) {
21996
+ const { data } = await this.http.post(apiPath `/v1/products/messaging/conversations/${conversationId}/participants`, input);
21997
+ return data.participants.map(participant);
21998
+ }
21999
+ async removeParticipant(conversationId, svid) {
22000
+ const { data } = await this.http.delete(apiPath `/v1/products/messaging/conversations/${conversationId}/participants/${svid}`);
22001
+ return data.participants.map(participant);
22002
+ }
22003
+ async recall(conversationId, messageId) {
22004
+ integer(messageId, 'messageId');
22005
+ await this.http.post(apiPath `/v1/products/messaging/conversations/${conversationId}/messages/${String(messageId)}/recall`);
22006
+ }
22007
+ async getReceipt(conversationId, messageId) {
22008
+ integer(messageId, 'messageId');
22009
+ const { data } = await this.http.get(apiPath `/v1/products/messaging/conversations/${conversationId}/messages/${String(messageId)}/receipt`);
22010
+ return { receiptToken: data.receipt_token, expiresAt: data.expires_at,
22011
+ receipt: { ...receipt(data.receipt), messageTs: data.receipt.message_ts } };
22012
+ }
22013
+ /** Owner-only; a closed conversation refuses new sends. */
22014
+ async close(conversationId, closed = true) {
22015
+ await this.http.put(apiPath `/v1/products/messaging/conversations/${conversationId}/close`, { closed });
22016
+ }
22017
+ /** Stores the caller's preference; Core currently does not gate sends on it. */
22018
+ async setOptOut(conversationId, optedOut) {
22019
+ await this.http.put(apiPath `/v1/products/messaging/conversations/${conversationId}/opt-out`, { opted_out: optedOut });
22020
+ }
22021
+ /** Owner-only; legal hold prevents recall, not account deletion. */
22022
+ async setLegalHold(conversationId, held) {
22023
+ await this.http.put(apiPath `/v1/products/messaging/conversations/${conversationId}/legal-hold`, { held });
22024
+ }
22025
+ /** Returns transfer metadata only; no account credential is sent to Forge. */
22026
+ async initiateAttachmentUpload(conversationId, options) {
22027
+ integer(options.sizeBytes, 'sizeBytes');
22028
+ const { data } = await this.http.post(apiPath `/v1/products/messaging/conversations/${conversationId}/attachments`, { size_bytes: options.sizeBytes, content_type: options.contentType });
22029
+ return { ingotId: data.ingot_id, forgeUrl: data.forge_url, expiresAt: data.expires_at, maxBytes: data.max_bytes };
22030
+ }
22031
+ async getAttachmentDownload(conversationId, ingotId) {
22032
+ const { data } = await this.http.get(apiPath `/v1/products/messaging/conversations/${conversationId}/attachments/${ingotId}/download`);
22033
+ return { ingotId: data.ingot_id, forgeUrl: data.forge_url, expiresAt: data.expires_at, sizeBytes: data.size_bytes, contentType: data.content_type };
22034
+ }
22035
+ }
22036
+
21894
22037
  /**
21895
22038
  * Products Module
21896
22039
  *
21897
22040
  * Namespace for SparkVault first-party products. Each product is a
21898
22041
  * self-contained surface (UI + API) the account can enable independently.
21899
- * Identity, Notify, and the customer-facing Help Desk attach here.
22042
+ * Identity, Notify, customer-facing Help Desk, Structured Ingots, and the
22043
+ * pre-launch Messaging business API attach here.
21900
22044
  */
21901
22045
  class ProductsModule {
21902
22046
  /**
@@ -21908,6 +22052,7 @@ class ProductsModule {
21908
22052
  this.notify = new NotifyProductModule(http);
21909
22053
  this.helpDesk = new HelpDeskModule(config);
21910
22054
  this.structuredIngots = new StructuredIngotsModule(http);
22055
+ this.messaging = new MessagingModule(http);
21911
22056
  }
21912
22057
  }
21913
22058
 
@@ -25893,7 +26038,7 @@ class SparkVault {
25893
26038
  }
25894
26039
  /** Get the SDK version */
25895
26040
  static get version() {
25896
- return '15.10.0';
26041
+ return '15.11.0';
25897
26042
  }
25898
26043
  }
25899
26044
  if (typeof window !== 'undefined') {
@@ -25903,5 +26048,5 @@ if (typeof window !== 'undefined') {
25903
26048
  window.SparkVault = instance ?? SparkVault;
25904
26049
  }
25905
26050
 
25906
- export { AuthenticationError, AuthorizationError, EntropyModule, FoldersModule, HelpDeskClient, HelpDeskModule, IdentityModule, IdentityProviderError, IngotsModule, NAME_CONFLICT_POLICIES, NOTIFY_PRESETS, NetworkError, NotifyModule, NotifyProductModule, NotifyProjectsModule, NotifySubscriptionRequiredError, PlanRequiredError, PopupBlockedError, ProductsModule, QuotaExceededError, SparkVault, SparkVaultError, SparksModule, StructuredIngotTypesModule, StructuredIngotsModule, TimeoutError, UnauthorizedError, UsageCreditFundingReviewError, UsageCreditsExhaustedError, UserCancelledError, ValidationError, VaultsModule, buildNotifyPresetSend, SparkVault as default, fetchDownload, isReceivedUploadFailure, logger, setDebugMode };
26051
+ export { AuthenticationError, AuthorizationError, EntropyModule, FoldersModule, HelpDeskClient, HelpDeskModule, IdentityModule, IdentityProviderError, IngotsModule, MessagingModule, NAME_CONFLICT_POLICIES, NOTIFY_PRESETS, NetworkError, NotifyModule, NotifyProductModule, NotifyProjectsModule, NotifySubscriptionRequiredError, PlanRequiredError, PopupBlockedError, ProductsModule, QuotaExceededError, SparkVault, SparkVaultError, SparksModule, StructuredIngotTypesModule, StructuredIngotsModule, TimeoutError, UnauthorizedError, UsageCreditFundingReviewError, UsageCreditsExhaustedError, UserCancelledError, ValidationError, VaultsModule, buildNotifyPresetSend, SparkVault as default, fetchDownload, isReceivedUploadFailure, logger, setDebugMode };
25907
26052
  //# sourceMappingURL=index.mjs.map