@arbidocs/client 0.5.132 → 0.5.134

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.cts CHANGED
@@ -143,6 +143,38 @@ interface operations$1 {
143
143
  * Do not make direct changes to the file.
144
144
  */
145
145
  interface paths$1 {
146
+ '/v1/user/projects/{project_ext_id}/spend-limits/confirm': {
147
+ post: {
148
+ parameters: {
149
+ path: {
150
+ project_ext_id: string;
151
+ };
152
+ };
153
+ requestBody: {
154
+ content: {
155
+ 'application/json': components$1['schemas']['ProjectSpendLimitsRequest'];
156
+ };
157
+ };
158
+ responses: {
159
+ 200: {
160
+ headers: {
161
+ [name: string]: unknown;
162
+ };
163
+ content: {
164
+ 'application/json': components$1['schemas']['ProjectResponse'];
165
+ };
166
+ };
167
+ 422: {
168
+ headers: {
169
+ [name: string]: unknown;
170
+ };
171
+ content: {
172
+ 'application/json': components$1['schemas']['HTTPValidationError'];
173
+ };
174
+ };
175
+ };
176
+ };
177
+ };
146
178
  '/v1/user/entitlements': {
147
179
  parameters: {
148
180
  query?: never;
@@ -5841,7 +5873,7 @@ interface paths$1 {
5841
5873
  * parts tell you where you are).
5842
5874
  *
5843
5875
  * * ``speaker``: your own microphone. You must be admissible to the call (the ``POST /token`` rule; for a thread
5844
- * call a member of its workspace, any role — the Read only role included) or already in the room; in a
5876
+ * call a member of its workspace, any role — the Viewer role included) or already in the room; in a
5845
5877
  * webinar, on stage (403 ``not_on_stage``).
5846
5878
  * * ``composite``: the host's view, host only, ``audio_video`` recordings only (422 ``composite_needs_video``).
5847
5879
  *
@@ -9147,6 +9179,11 @@ interface paths$1 {
9147
9179
  type webhooks = Record<string, never>;
9148
9180
  interface components$1 {
9149
9181
  schemas: {
9182
+ ProjectSpendLimitsRequest: {
9183
+ spend_cap_pence: number;
9184
+ daily_cap_per_user: number | null;
9185
+ name?: string | null;
9186
+ };
9150
9187
  /** AccountRead */
9151
9188
  AccountRead: {
9152
9189
  /** Id */
@@ -18361,8 +18398,8 @@ interface components$1 {
18361
18398
  */
18362
18399
  member_count: number;
18363
18400
  /**
18364
- * Read Only Count
18365
- * @description People with only the Read only role in its workspaces.
18401
+ * Viewer Count
18402
+ * @description People with only the Viewer role in its workspaces.
18366
18403
  * @default 0
18367
18404
  */
18368
18405
  guest_count: number;
@@ -18432,8 +18469,8 @@ interface components$1 {
18432
18469
  */
18433
18470
  member_count: number;
18434
18471
  /**
18435
- * Read Only Count
18436
- * @description People with only the Read only role in the projects' workspaces.
18472
+ * Viewer Count
18473
+ * @description People with only the Viewer role in the projects' workspaces.
18437
18474
  * @default 0
18438
18475
  */
18439
18476
  guest_count: number;
@@ -20092,6 +20129,7 @@ interface components$1 {
20092
20129
  * @description Stripe product with pricing information.
20093
20130
  */
20094
20131
  ProductResponse: {
20132
+ collaborator_daily_limit_step_gbp?: number;
20095
20133
  /**
20096
20134
  * Included Ai Gbp
20097
20135
  * @default 10
@@ -20440,6 +20478,7 @@ interface components$1 {
20440
20478
  * and renew with the plan until reduced, like any block.
20441
20479
  */
20442
20480
  ProjectCheckoutRequest: {
20481
+ require_spend_limit_confirmation?: boolean;
20443
20482
  /**
20444
20483
  * Interval
20445
20484
  * @default month
@@ -20723,6 +20762,8 @@ interface components$1 {
20723
20762
  * user's external_id.
20724
20763
  */
20725
20764
  ProjectResponse: {
20765
+ spend_limits_confirmation_required?: boolean;
20766
+ checkout_pending?: boolean;
20726
20767
  /** External Id */
20727
20768
  external_id: string;
20728
20769
  /** Name */
@@ -26777,8 +26818,8 @@ interface components$1 {
26777
26818
  /**
26778
26819
  * WorkspaceRole
26779
26820
  * @description Role of a user within a workspace: ``owner``, ``collaborator``, or ``guest``, which is shown to people as
26780
- * "Read only" (reads what is shared in the workspace; no editing, uploads or AI). ``guest`` is only the stored
26781
- * value of the Read only role: it has nothing to do with external accounts (user type ``external``).
26821
+ * "Viewer" (reads what is shared in the workspace; no editing, uploads or AI). ``guest`` is only the stored
26822
+ * value of the Viewer role: it has nothing to do with external accounts (user type ``external``).
26782
26823
  * @enum {string}
26783
26824
  */
26784
26825
  WorkspaceRole: 'owner' | 'collaborator' | 'guest';
@@ -42958,6 +42999,8 @@ declare function createWorkspaceOpens(): WorkspaceOpens;
42958
42999
  * Ported from: /home/dev/ARBI/src/static/js/storage.js
42959
43000
  */
42960
43001
 
43002
+ /** Observe a switch to a memory-only session, including failures after sign-in. */
43003
+ declare function subscribeSessionPersistence(listener: () => void): () => void;
42961
43004
  /** True when sessions can be persisted (encrypted at rest) rather than held in memory only. */
42962
43005
  declare function canPersistSession(): boolean;
42963
43006
  /**
@@ -43741,4 +43784,4 @@ type Quote = components['schemas']['TaxQuoteResponse'];
43741
43784
  /** Older add-on quote responses omit promotion fields. */
43742
43785
  type ProjectPlanQuoteResponse = Omit<Quote, 'discount_pence' | 'tax_calculated'> & Partial<Pick<Quote, 'discount_pence' | 'tax_calculated'>>;
43743
43786
 
43744
- export { type $defs, ACCESS_TOKEN_STORAGE_KEY, API_PREFIX, type ArbiClient, type ArbiClientOptions, type AuthStateProvider, type AutoReloginMiddlewareConfig, type BearerAuthMiddlewareConfig, CALL_KEY_BYTES, CHAT_KEY_BYTES, type CallPeer, type ChangePasswordParams, type ChangePasswordRequest, type ChangePasswordResult, type CryptoProvider, type DisconnectSsoParams, ENCRYPTED_RECOVERY_KEY_SIZE, type HttpErrorInfo, type HttpRequestInfo, type HttpResponseInfo, type HttpTransport, type HttpTransportOptions, type KeyLoginCredentials, type KeyPair, type ListedWorkspaceKey, type LoggerOptions, type LoginCredentials, type LoginParams, type LoginProfile, type LoginProvider, type LoginRequest, type LoginResponse, type LoginResult, type LoginWithKeyParams, type OfflineSealer, type OfflineSealerOptions, type OnReloginSuccess, type OpenAllDeps, type ParsedRecoveryUrl, type PasswordChangeCredentials, type ProjectPlanQuoteRequest, type ProjectPlanQuoteResponse, RECOVERY_KEY_ERRORS, type RecoveryKeyParams, type RecoveryKeyValidationResult, type ReferralInvitation, type ReferralSummary, type RegisterParams, type RegisterRequest, type RegisterResult, type RegistrationCredentials, type ReloginDeps, type ReloginFailure, type ReloginHandler, type ReopenDeps, SECURE_MAIL_KEY_BYTES, SETTINGS_WRITE_BREAKER_CODE, type SealedSecureMail, type SecureMailCiphertexts, type SecureMailClaim, type SessionClaims, type SessionData, type SessionKeys, type SessionManager, type SessionManagerOptions, type SessionPersistence, type SessionSignIn, type SessionState, type SessionStateStorage, type SessionUser, type SignInHooks, type SsoTokenSource, type StoredSessionState, type TokenProvider, UNENCRYPTED_RECOVERY_KEY_SIZE, type UserKeypairs, type WebSocketClientMessage, type WebSocketServerMessage, type WorkspaceKeyRefreshProvider, type WorkspaceKeys, type WorkspaceOpenProvider, type WorkspaceOpens, type WsAgentDmStatusMessage, type WsAuthMessage, type WsAuthResultMessage, type WsBatchCompleteMessage, type WsChatMessageMessage, type WsChatReadMessage, type WsChatUpdatedMessage, type WsConnectionClosedMessage, type WsConversationMessagePostedMessage, type WsErrorMessage, type WsNotificationResponse, type WsPresenceUpdateMessage, type WsResponseCompleteMessage, type WsTaskUpdateMessage, authRequestError, base64Decode, base64Encode, base64ToBytes, base64UrlToBytes, browserSessionStateStorage, buildCallFragment, buildCallLink, buildWebSocketUrl, bytesToBase64, bytesToBase64Url, canPersistSession, changePassword, clearAllData, clearSession, type components$1 as components, computeSharedSecret, configureLogger, createAllWorkspacesOpener, createArbiClient, createAuthMessage, createAutoReloginMiddleware, createBearerAuthMiddleware, createContentHash, createHttpTransport, createMemorySessionPersistence, createOfflineSealer, createRecoveryFile, createRecoveryUrl, createReloginHandler, createSessionManager, createWorkspaceKeys, createWorkspaceOpens, createWorkspaceReopener, decodeCallKey, decodeSecureMailKey, decryptCallTitle, decryptFile, decryptMessage, decryptMessageWithSharedSecret, decryptRecoveryKey, decryptWithChatKey, deriveDirectChatKey, deriveEncryptionKeypairFromSigning, derivePublicKey, disconnectSso, encodeCallKey, encryptCallTitle, encryptFile, encryptMessage, encryptMessageWithSharedSecret, encryptRecoveryKey, encryptWithChatKey, encryptionKeypairFromSigningKey, generateCallKey, generateChatKey, generateIdentityKeypair, generateKeyPairs, generateLoginCredentials, generateLoginCredentialsFromKey, generatePasswordChangeCredentials, generateRandomSigningKeypair, generateRegistrationCredentials, generateUserKeypairs, getRecoveryKeyFilename, getSession, getUserEncryptionKeypair, hasSession, identityFromLoginResponse, initSodium, initializeDatabase, isAbortError, isEncryptedRecoveryKey, isMessageType, logger, openCallKeyOf, openSealedCallKey, openSealedChatKey, openSecureMail, type operations, parseCallFragment, parseRecoveryUrl, parseServerMessage, passwordChangeErrorMessage, type paths, prewarmKeyPairs, readSessionClaims, requestSsoDisconnectCode, saveSession, sealCallKey, sealCallKeyForPeers, sealChatKey, sealKeyForSession, sealSecureMail, sealedBoxDecrypt, sealedBoxEncrypt, secureMailClaim, signMessage, unlockIdentityWithPassword, unwrapIdentityKey, unwrapWorkspaceKey, updateWrappedIdentityKey, validateRecoveryKeyFile, type webhooks, workspaceKeyRequiredOf, wrapIdentityKey };
43787
+ export { type $defs, ACCESS_TOKEN_STORAGE_KEY, API_PREFIX, type ArbiClient, type ArbiClientOptions, type AuthStateProvider, type AutoReloginMiddlewareConfig, type BearerAuthMiddlewareConfig, CALL_KEY_BYTES, CHAT_KEY_BYTES, type CallPeer, type ChangePasswordParams, type ChangePasswordRequest, type ChangePasswordResult, type CryptoProvider, type DisconnectSsoParams, ENCRYPTED_RECOVERY_KEY_SIZE, type HttpErrorInfo, type HttpRequestInfo, type HttpResponseInfo, type HttpTransport, type HttpTransportOptions, type KeyLoginCredentials, type KeyPair, type ListedWorkspaceKey, type LoggerOptions, type LoginCredentials, type LoginParams, type LoginProfile, type LoginProvider, type LoginRequest, type LoginResponse, type LoginResult, type LoginWithKeyParams, type OfflineSealer, type OfflineSealerOptions, type OnReloginSuccess, type OpenAllDeps, type ParsedRecoveryUrl, type PasswordChangeCredentials, type ProjectPlanQuoteRequest, type ProjectPlanQuoteResponse, RECOVERY_KEY_ERRORS, type RecoveryKeyParams, type RecoveryKeyValidationResult, type ReferralInvitation, type ReferralSummary, type RegisterParams, type RegisterRequest, type RegisterResult, type RegistrationCredentials, type ReloginDeps, type ReloginFailure, type ReloginHandler, type ReopenDeps, SECURE_MAIL_KEY_BYTES, SETTINGS_WRITE_BREAKER_CODE, type SealedSecureMail, type SecureMailCiphertexts, type SecureMailClaim, type SessionClaims, type SessionData, type SessionKeys, type SessionManager, type SessionManagerOptions, type SessionPersistence, type SessionSignIn, type SessionState, type SessionStateStorage, type SessionUser, type SignInHooks, type SsoTokenSource, type StoredSessionState, type TokenProvider, UNENCRYPTED_RECOVERY_KEY_SIZE, type UserKeypairs, type WebSocketClientMessage, type WebSocketServerMessage, type WorkspaceKeyRefreshProvider, type WorkspaceKeys, type WorkspaceOpenProvider, type WorkspaceOpens, type WsAgentDmStatusMessage, type WsAuthMessage, type WsAuthResultMessage, type WsBatchCompleteMessage, type WsChatMessageMessage, type WsChatReadMessage, type WsChatUpdatedMessage, type WsConnectionClosedMessage, type WsConversationMessagePostedMessage, type WsErrorMessage, type WsNotificationResponse, type WsPresenceUpdateMessage, type WsResponseCompleteMessage, type WsTaskUpdateMessage, authRequestError, base64Decode, base64Encode, base64ToBytes, base64UrlToBytes, browserSessionStateStorage, buildCallFragment, buildCallLink, buildWebSocketUrl, bytesToBase64, bytesToBase64Url, canPersistSession, changePassword, clearAllData, clearSession, type components$1 as components, computeSharedSecret, configureLogger, createAllWorkspacesOpener, createArbiClient, createAuthMessage, createAutoReloginMiddleware, createBearerAuthMiddleware, createContentHash, createHttpTransport, createMemorySessionPersistence, createOfflineSealer, createRecoveryFile, createRecoveryUrl, createReloginHandler, createSessionManager, createWorkspaceKeys, createWorkspaceOpens, createWorkspaceReopener, decodeCallKey, decodeSecureMailKey, decryptCallTitle, decryptFile, decryptMessage, decryptMessageWithSharedSecret, decryptRecoveryKey, decryptWithChatKey, deriveDirectChatKey, deriveEncryptionKeypairFromSigning, derivePublicKey, disconnectSso, encodeCallKey, encryptCallTitle, encryptFile, encryptMessage, encryptMessageWithSharedSecret, encryptRecoveryKey, encryptWithChatKey, encryptionKeypairFromSigningKey, generateCallKey, generateChatKey, generateIdentityKeypair, generateKeyPairs, generateLoginCredentials, generateLoginCredentialsFromKey, generatePasswordChangeCredentials, generateRandomSigningKeypair, generateRegistrationCredentials, generateUserKeypairs, getRecoveryKeyFilename, getSession, getUserEncryptionKeypair, hasSession, identityFromLoginResponse, initSodium, initializeDatabase, isAbortError, isEncryptedRecoveryKey, isMessageType, logger, openCallKeyOf, openSealedCallKey, openSealedChatKey, openSecureMail, type operations, parseCallFragment, parseRecoveryUrl, parseServerMessage, passwordChangeErrorMessage, type paths, prewarmKeyPairs, readSessionClaims, requestSsoDisconnectCode, saveSession, sealCallKey, sealCallKeyForPeers, sealChatKey, sealKeyForSession, sealSecureMail, sealedBoxDecrypt, sealedBoxEncrypt, secureMailClaim, signMessage, subscribeSessionPersistence, unlockIdentityWithPassword, unwrapIdentityKey, unwrapWorkspaceKey, updateWrappedIdentityKey, validateRecoveryKeyFile, type webhooks, workspaceKeyRequiredOf, wrapIdentityKey };
package/dist/index.d.ts CHANGED
@@ -143,6 +143,38 @@ interface operations$1 {
143
143
  * Do not make direct changes to the file.
144
144
  */
145
145
  interface paths$1 {
146
+ '/v1/user/projects/{project_ext_id}/spend-limits/confirm': {
147
+ post: {
148
+ parameters: {
149
+ path: {
150
+ project_ext_id: string;
151
+ };
152
+ };
153
+ requestBody: {
154
+ content: {
155
+ 'application/json': components$1['schemas']['ProjectSpendLimitsRequest'];
156
+ };
157
+ };
158
+ responses: {
159
+ 200: {
160
+ headers: {
161
+ [name: string]: unknown;
162
+ };
163
+ content: {
164
+ 'application/json': components$1['schemas']['ProjectResponse'];
165
+ };
166
+ };
167
+ 422: {
168
+ headers: {
169
+ [name: string]: unknown;
170
+ };
171
+ content: {
172
+ 'application/json': components$1['schemas']['HTTPValidationError'];
173
+ };
174
+ };
175
+ };
176
+ };
177
+ };
146
178
  '/v1/user/entitlements': {
147
179
  parameters: {
148
180
  query?: never;
@@ -5841,7 +5873,7 @@ interface paths$1 {
5841
5873
  * parts tell you where you are).
5842
5874
  *
5843
5875
  * * ``speaker``: your own microphone. You must be admissible to the call (the ``POST /token`` rule; for a thread
5844
- * call a member of its workspace, any role — the Read only role included) or already in the room; in a
5876
+ * call a member of its workspace, any role — the Viewer role included) or already in the room; in a
5845
5877
  * webinar, on stage (403 ``not_on_stage``).
5846
5878
  * * ``composite``: the host's view, host only, ``audio_video`` recordings only (422 ``composite_needs_video``).
5847
5879
  *
@@ -9147,6 +9179,11 @@ interface paths$1 {
9147
9179
  type webhooks = Record<string, never>;
9148
9180
  interface components$1 {
9149
9181
  schemas: {
9182
+ ProjectSpendLimitsRequest: {
9183
+ spend_cap_pence: number;
9184
+ daily_cap_per_user: number | null;
9185
+ name?: string | null;
9186
+ };
9150
9187
  /** AccountRead */
9151
9188
  AccountRead: {
9152
9189
  /** Id */
@@ -18361,8 +18398,8 @@ interface components$1 {
18361
18398
  */
18362
18399
  member_count: number;
18363
18400
  /**
18364
- * Read Only Count
18365
- * @description People with only the Read only role in its workspaces.
18401
+ * Viewer Count
18402
+ * @description People with only the Viewer role in its workspaces.
18366
18403
  * @default 0
18367
18404
  */
18368
18405
  guest_count: number;
@@ -18432,8 +18469,8 @@ interface components$1 {
18432
18469
  */
18433
18470
  member_count: number;
18434
18471
  /**
18435
- * Read Only Count
18436
- * @description People with only the Read only role in the projects' workspaces.
18472
+ * Viewer Count
18473
+ * @description People with only the Viewer role in the projects' workspaces.
18437
18474
  * @default 0
18438
18475
  */
18439
18476
  guest_count: number;
@@ -20092,6 +20129,7 @@ interface components$1 {
20092
20129
  * @description Stripe product with pricing information.
20093
20130
  */
20094
20131
  ProductResponse: {
20132
+ collaborator_daily_limit_step_gbp?: number;
20095
20133
  /**
20096
20134
  * Included Ai Gbp
20097
20135
  * @default 10
@@ -20440,6 +20478,7 @@ interface components$1 {
20440
20478
  * and renew with the plan until reduced, like any block.
20441
20479
  */
20442
20480
  ProjectCheckoutRequest: {
20481
+ require_spend_limit_confirmation?: boolean;
20443
20482
  /**
20444
20483
  * Interval
20445
20484
  * @default month
@@ -20723,6 +20762,8 @@ interface components$1 {
20723
20762
  * user's external_id.
20724
20763
  */
20725
20764
  ProjectResponse: {
20765
+ spend_limits_confirmation_required?: boolean;
20766
+ checkout_pending?: boolean;
20726
20767
  /** External Id */
20727
20768
  external_id: string;
20728
20769
  /** Name */
@@ -26777,8 +26818,8 @@ interface components$1 {
26777
26818
  /**
26778
26819
  * WorkspaceRole
26779
26820
  * @description Role of a user within a workspace: ``owner``, ``collaborator``, or ``guest``, which is shown to people as
26780
- * "Read only" (reads what is shared in the workspace; no editing, uploads or AI). ``guest`` is only the stored
26781
- * value of the Read only role: it has nothing to do with external accounts (user type ``external``).
26821
+ * "Viewer" (reads what is shared in the workspace; no editing, uploads or AI). ``guest`` is only the stored
26822
+ * value of the Viewer role: it has nothing to do with external accounts (user type ``external``).
26782
26823
  * @enum {string}
26783
26824
  */
26784
26825
  WorkspaceRole: 'owner' | 'collaborator' | 'guest';
@@ -42958,6 +42999,8 @@ declare function createWorkspaceOpens(): WorkspaceOpens;
42958
42999
  * Ported from: /home/dev/ARBI/src/static/js/storage.js
42959
43000
  */
42960
43001
 
43002
+ /** Observe a switch to a memory-only session, including failures after sign-in. */
43003
+ declare function subscribeSessionPersistence(listener: () => void): () => void;
42961
43004
  /** True when sessions can be persisted (encrypted at rest) rather than held in memory only. */
42962
43005
  declare function canPersistSession(): boolean;
42963
43006
  /**
@@ -43741,4 +43784,4 @@ type Quote = components['schemas']['TaxQuoteResponse'];
43741
43784
  /** Older add-on quote responses omit promotion fields. */
43742
43785
  type ProjectPlanQuoteResponse = Omit<Quote, 'discount_pence' | 'tax_calculated'> & Partial<Pick<Quote, 'discount_pence' | 'tax_calculated'>>;
43743
43786
 
43744
- export { type $defs, ACCESS_TOKEN_STORAGE_KEY, API_PREFIX, type ArbiClient, type ArbiClientOptions, type AuthStateProvider, type AutoReloginMiddlewareConfig, type BearerAuthMiddlewareConfig, CALL_KEY_BYTES, CHAT_KEY_BYTES, type CallPeer, type ChangePasswordParams, type ChangePasswordRequest, type ChangePasswordResult, type CryptoProvider, type DisconnectSsoParams, ENCRYPTED_RECOVERY_KEY_SIZE, type HttpErrorInfo, type HttpRequestInfo, type HttpResponseInfo, type HttpTransport, type HttpTransportOptions, type KeyLoginCredentials, type KeyPair, type ListedWorkspaceKey, type LoggerOptions, type LoginCredentials, type LoginParams, type LoginProfile, type LoginProvider, type LoginRequest, type LoginResponse, type LoginResult, type LoginWithKeyParams, type OfflineSealer, type OfflineSealerOptions, type OnReloginSuccess, type OpenAllDeps, type ParsedRecoveryUrl, type PasswordChangeCredentials, type ProjectPlanQuoteRequest, type ProjectPlanQuoteResponse, RECOVERY_KEY_ERRORS, type RecoveryKeyParams, type RecoveryKeyValidationResult, type ReferralInvitation, type ReferralSummary, type RegisterParams, type RegisterRequest, type RegisterResult, type RegistrationCredentials, type ReloginDeps, type ReloginFailure, type ReloginHandler, type ReopenDeps, SECURE_MAIL_KEY_BYTES, SETTINGS_WRITE_BREAKER_CODE, type SealedSecureMail, type SecureMailCiphertexts, type SecureMailClaim, type SessionClaims, type SessionData, type SessionKeys, type SessionManager, type SessionManagerOptions, type SessionPersistence, type SessionSignIn, type SessionState, type SessionStateStorage, type SessionUser, type SignInHooks, type SsoTokenSource, type StoredSessionState, type TokenProvider, UNENCRYPTED_RECOVERY_KEY_SIZE, type UserKeypairs, type WebSocketClientMessage, type WebSocketServerMessage, type WorkspaceKeyRefreshProvider, type WorkspaceKeys, type WorkspaceOpenProvider, type WorkspaceOpens, type WsAgentDmStatusMessage, type WsAuthMessage, type WsAuthResultMessage, type WsBatchCompleteMessage, type WsChatMessageMessage, type WsChatReadMessage, type WsChatUpdatedMessage, type WsConnectionClosedMessage, type WsConversationMessagePostedMessage, type WsErrorMessage, type WsNotificationResponse, type WsPresenceUpdateMessage, type WsResponseCompleteMessage, type WsTaskUpdateMessage, authRequestError, base64Decode, base64Encode, base64ToBytes, base64UrlToBytes, browserSessionStateStorage, buildCallFragment, buildCallLink, buildWebSocketUrl, bytesToBase64, bytesToBase64Url, canPersistSession, changePassword, clearAllData, clearSession, type components$1 as components, computeSharedSecret, configureLogger, createAllWorkspacesOpener, createArbiClient, createAuthMessage, createAutoReloginMiddleware, createBearerAuthMiddleware, createContentHash, createHttpTransport, createMemorySessionPersistence, createOfflineSealer, createRecoveryFile, createRecoveryUrl, createReloginHandler, createSessionManager, createWorkspaceKeys, createWorkspaceOpens, createWorkspaceReopener, decodeCallKey, decodeSecureMailKey, decryptCallTitle, decryptFile, decryptMessage, decryptMessageWithSharedSecret, decryptRecoveryKey, decryptWithChatKey, deriveDirectChatKey, deriveEncryptionKeypairFromSigning, derivePublicKey, disconnectSso, encodeCallKey, encryptCallTitle, encryptFile, encryptMessage, encryptMessageWithSharedSecret, encryptRecoveryKey, encryptWithChatKey, encryptionKeypairFromSigningKey, generateCallKey, generateChatKey, generateIdentityKeypair, generateKeyPairs, generateLoginCredentials, generateLoginCredentialsFromKey, generatePasswordChangeCredentials, generateRandomSigningKeypair, generateRegistrationCredentials, generateUserKeypairs, getRecoveryKeyFilename, getSession, getUserEncryptionKeypair, hasSession, identityFromLoginResponse, initSodium, initializeDatabase, isAbortError, isEncryptedRecoveryKey, isMessageType, logger, openCallKeyOf, openSealedCallKey, openSealedChatKey, openSecureMail, type operations, parseCallFragment, parseRecoveryUrl, parseServerMessage, passwordChangeErrorMessage, type paths, prewarmKeyPairs, readSessionClaims, requestSsoDisconnectCode, saveSession, sealCallKey, sealCallKeyForPeers, sealChatKey, sealKeyForSession, sealSecureMail, sealedBoxDecrypt, sealedBoxEncrypt, secureMailClaim, signMessage, unlockIdentityWithPassword, unwrapIdentityKey, unwrapWorkspaceKey, updateWrappedIdentityKey, validateRecoveryKeyFile, type webhooks, workspaceKeyRequiredOf, wrapIdentityKey };
43787
+ export { type $defs, ACCESS_TOKEN_STORAGE_KEY, API_PREFIX, type ArbiClient, type ArbiClientOptions, type AuthStateProvider, type AutoReloginMiddlewareConfig, type BearerAuthMiddlewareConfig, CALL_KEY_BYTES, CHAT_KEY_BYTES, type CallPeer, type ChangePasswordParams, type ChangePasswordRequest, type ChangePasswordResult, type CryptoProvider, type DisconnectSsoParams, ENCRYPTED_RECOVERY_KEY_SIZE, type HttpErrorInfo, type HttpRequestInfo, type HttpResponseInfo, type HttpTransport, type HttpTransportOptions, type KeyLoginCredentials, type KeyPair, type ListedWorkspaceKey, type LoggerOptions, type LoginCredentials, type LoginParams, type LoginProfile, type LoginProvider, type LoginRequest, type LoginResponse, type LoginResult, type LoginWithKeyParams, type OfflineSealer, type OfflineSealerOptions, type OnReloginSuccess, type OpenAllDeps, type ParsedRecoveryUrl, type PasswordChangeCredentials, type ProjectPlanQuoteRequest, type ProjectPlanQuoteResponse, RECOVERY_KEY_ERRORS, type RecoveryKeyParams, type RecoveryKeyValidationResult, type ReferralInvitation, type ReferralSummary, type RegisterParams, type RegisterRequest, type RegisterResult, type RegistrationCredentials, type ReloginDeps, type ReloginFailure, type ReloginHandler, type ReopenDeps, SECURE_MAIL_KEY_BYTES, SETTINGS_WRITE_BREAKER_CODE, type SealedSecureMail, type SecureMailCiphertexts, type SecureMailClaim, type SessionClaims, type SessionData, type SessionKeys, type SessionManager, type SessionManagerOptions, type SessionPersistence, type SessionSignIn, type SessionState, type SessionStateStorage, type SessionUser, type SignInHooks, type SsoTokenSource, type StoredSessionState, type TokenProvider, UNENCRYPTED_RECOVERY_KEY_SIZE, type UserKeypairs, type WebSocketClientMessage, type WebSocketServerMessage, type WorkspaceKeyRefreshProvider, type WorkspaceKeys, type WorkspaceOpenProvider, type WorkspaceOpens, type WsAgentDmStatusMessage, type WsAuthMessage, type WsAuthResultMessage, type WsBatchCompleteMessage, type WsChatMessageMessage, type WsChatReadMessage, type WsChatUpdatedMessage, type WsConnectionClosedMessage, type WsConversationMessagePostedMessage, type WsErrorMessage, type WsNotificationResponse, type WsPresenceUpdateMessage, type WsResponseCompleteMessage, type WsTaskUpdateMessage, authRequestError, base64Decode, base64Encode, base64ToBytes, base64UrlToBytes, browserSessionStateStorage, buildCallFragment, buildCallLink, buildWebSocketUrl, bytesToBase64, bytesToBase64Url, canPersistSession, changePassword, clearAllData, clearSession, type components$1 as components, computeSharedSecret, configureLogger, createAllWorkspacesOpener, createArbiClient, createAuthMessage, createAutoReloginMiddleware, createBearerAuthMiddleware, createContentHash, createHttpTransport, createMemorySessionPersistence, createOfflineSealer, createRecoveryFile, createRecoveryUrl, createReloginHandler, createSessionManager, createWorkspaceKeys, createWorkspaceOpens, createWorkspaceReopener, decodeCallKey, decodeSecureMailKey, decryptCallTitle, decryptFile, decryptMessage, decryptMessageWithSharedSecret, decryptRecoveryKey, decryptWithChatKey, deriveDirectChatKey, deriveEncryptionKeypairFromSigning, derivePublicKey, disconnectSso, encodeCallKey, encryptCallTitle, encryptFile, encryptMessage, encryptMessageWithSharedSecret, encryptRecoveryKey, encryptWithChatKey, encryptionKeypairFromSigningKey, generateCallKey, generateChatKey, generateIdentityKeypair, generateKeyPairs, generateLoginCredentials, generateLoginCredentialsFromKey, generatePasswordChangeCredentials, generateRandomSigningKeypair, generateRegistrationCredentials, generateUserKeypairs, getRecoveryKeyFilename, getSession, getUserEncryptionKeypair, hasSession, identityFromLoginResponse, initSodium, initializeDatabase, isAbortError, isEncryptedRecoveryKey, isMessageType, logger, openCallKeyOf, openSealedCallKey, openSealedChatKey, openSecureMail, type operations, parseCallFragment, parseRecoveryUrl, parseServerMessage, passwordChangeErrorMessage, type paths, prewarmKeyPairs, readSessionClaims, requestSsoDisconnectCode, saveSession, sealCallKey, sealCallKeyForPeers, sealChatKey, sealKeyForSession, sealSecureMail, sealedBoxDecrypt, sealedBoxEncrypt, secureMailClaim, signMessage, subscribeSessionPersistence, unlockIdentityWithPassword, unwrapIdentityKey, unwrapWorkspaceKey, updateWrappedIdentityKey, validateRecoveryKeyFile, type webhooks, workspaceKeyRequiredOf, wrapIdentityKey };
package/dist/index.js CHANGED
@@ -821,19 +821,58 @@ async function secureMailClaim(key, recipientPublicKey) {
821
821
  var DB_NAME = "arbi-crypto";
822
822
  var DB_VERSION = 2;
823
823
  var db = null;
824
+ var storageUnavailable = false;
825
+ var persistenceListeners = /* @__PURE__ */ new Set();
826
+ function subscribeSessionPersistence(listener) {
827
+ persistenceListeners.add(listener);
828
+ return () => {
829
+ persistenceListeners.delete(listener);
830
+ };
831
+ }
832
+ function fallBackToMemory(error) {
833
+ const name = error && typeof error === "object" && "name" in error ? error.name : "";
834
+ if (![
835
+ "UnknownError",
836
+ "QuotaExceededError",
837
+ "SecurityError",
838
+ "InvalidStateError",
839
+ "AbortError"
840
+ ].includes(String(name))) {
841
+ throw error;
842
+ }
843
+ storageUnavailable = true;
844
+ db?.close();
845
+ db = null;
846
+ console.warn("[STORAGE] Browser storage unavailable; keeping this session in memory only.");
847
+ for (const listener of persistenceListeners) listener();
848
+ }
824
849
  var memorySession = null;
825
850
  function canPersistSession() {
826
- return !!crypto?.subtle;
851
+ return !!globalThis.crypto?.subtle && !storageUnavailable;
827
852
  }
828
853
  async function initializeDatabase() {
829
854
  return new Promise((resolve, reject) => {
830
855
  const request = indexedDB.open(DB_NAME, DB_VERSION);
856
+ let blocked = false;
857
+ request.onblocked = () => {
858
+ blocked = true;
859
+ reject(new DOMException("Session storage is blocked by another tab", "UnknownError"));
860
+ };
831
861
  request.onerror = () => {
832
862
  console.error("[STORAGE] Failed to open IndexedDB:", request.error);
833
863
  reject(request.error);
834
864
  };
835
865
  request.onsuccess = () => {
866
+ if (blocked || storageUnavailable) {
867
+ request.result.close();
868
+ return;
869
+ }
836
870
  db = request.result;
871
+ const connection = db;
872
+ connection.onversionchange = () => {
873
+ connection.close();
874
+ if (db === connection) db = null;
875
+ };
837
876
  resolve(db);
838
877
  };
839
878
  request.onupgradeneeded = (event) => {
@@ -898,20 +937,18 @@ async function getOrCreateWrappingKey() {
898
937
  key,
899
938
  created: Date.now()
900
939
  });
901
- putRequest.onsuccess = () => {
902
- resolve(key);
903
- };
940
+ putTransaction.oncomplete = () => resolve(key);
941
+ putTransaction.onabort = () => reject(putTransaction.error ?? new DOMException("Key write aborted", "AbortError"));
904
942
  putRequest.onerror = () => {
905
- reject(new Error("Failed to store wrapping key"));
943
+ reject(putRequest.error);
906
944
  };
907
945
  }).catch((error) => {
908
- const errorMsg = error instanceof Error ? error.message : String(error);
909
- reject(new Error(`Failed to generate wrapping key: ${errorMsg}`));
946
+ reject(error);
910
947
  });
911
948
  }
912
949
  };
913
950
  request.onerror = () => {
914
- reject(new Error("Failed to retrieve wrapping key from IndexedDB"));
951
+ reject(request.error);
915
952
  };
916
953
  });
917
954
  }
@@ -944,6 +981,14 @@ async function decryptWithWrappingKey(ciphertext, iv) {
944
981
  return new Uint8Array(decrypted);
945
982
  }
946
983
  async function saveSession(sessionData) {
984
+ try {
985
+ await persistSession(sessionData);
986
+ } catch (error) {
987
+ fallBackToMemory(error);
988
+ }
989
+ memorySession = sessionData;
990
+ }
991
+ async function persistSession(sessionData) {
947
992
  if (!canPersistSession()) {
948
993
  memorySession = sessionData;
949
994
  return;
@@ -976,13 +1021,9 @@ async function saveSession(sessionData) {
976
1021
  timestamp: Date.now()
977
1022
  };
978
1023
  const request = store.put(data);
979
- request.onsuccess = () => {
980
- resolve();
981
- };
982
- request.onerror = () => {
983
- console.error("[STORAGE] Failed to save session:", request.error);
984
- reject(request.error);
985
- };
1024
+ transaction.oncomplete = () => resolve();
1025
+ transaction.onabort = () => reject(transaction.error ?? new DOMException("Session write aborted", "AbortError"));
1026
+ transaction.onerror = () => reject(transaction.error ?? request.error);
986
1027
  });
987
1028
  } catch (error) {
988
1029
  console.error("[STORAGE] Failed to encrypt session data:", error);
@@ -990,6 +1031,16 @@ async function saveSession(sessionData) {
990
1031
  }
991
1032
  }
992
1033
  async function getSession() {
1034
+ try {
1035
+ const session = await readSession();
1036
+ memorySession = session;
1037
+ return session;
1038
+ } catch (error) {
1039
+ fallBackToMemory(error);
1040
+ return memorySession;
1041
+ }
1042
+ }
1043
+ async function readSession() {
993
1044
  if (!canPersistSession()) {
994
1045
  return memorySession;
995
1046
  }
@@ -1048,6 +1099,14 @@ async function updateWrappedIdentityKey(wrappedIdentityKey) {
1048
1099
  await saveSession({ ...existingSession, wrappedIdentityKey });
1049
1100
  }
1050
1101
  async function clearSession() {
1102
+ memorySession = null;
1103
+ try {
1104
+ await deleteSession();
1105
+ } catch (error) {
1106
+ fallBackToMemory(error);
1107
+ }
1108
+ }
1109
+ async function deleteSession() {
1051
1110
  memorySession = null;
1052
1111
  if (!canPersistSession()) {
1053
1112
  return;
@@ -1101,7 +1160,13 @@ async function clearAllData() {
1101
1160
  return;
1102
1161
  }
1103
1162
  await clearSession();
1104
- await clearWrappingKey();
1163
+ if (canPersistSession()) {
1164
+ try {
1165
+ await clearWrappingKey();
1166
+ } catch (error) {
1167
+ fallBackToMemory(error);
1168
+ }
1169
+ }
1105
1170
  }
1106
1171
  async function hasSession() {
1107
1172
  const session = await getSession();
@@ -2506,6 +2571,6 @@ var logger = {
2506
2571
  }
2507
2572
  };
2508
2573
 
2509
- export { ACCESS_TOKEN_STORAGE_KEY, API_PREFIX, CALL_KEY_BYTES, CHAT_KEY_BYTES, ENCRYPTED_RECOVERY_KEY_SIZE, RECOVERY_KEY_ERRORS, SECURE_MAIL_KEY_BYTES, SETTINGS_WRITE_BREAKER_CODE, UNENCRYPTED_RECOVERY_KEY_SIZE, authRequestError, base64Decode, base64Encode, base64ToBytes, base64UrlToBytes, browserSessionStateStorage, buildCallFragment, buildCallLink, buildWebSocketUrl, bytesToBase64, bytesToBase64Url, canPersistSession, changePassword, clearAllData, clearSession, computeSharedSecret, configureLogger, createAllWorkspacesOpener, createArbiClient, createAuthMessage, createAutoReloginMiddleware, createBearerAuthMiddleware, createContentHash, createHttpTransport, createMemorySessionPersistence, createOfflineSealer, createRecoveryFile, createRecoveryUrl, createReloginHandler, createSessionManager, createWorkspaceKeys, createWorkspaceOpens, createWorkspaceReopener, decodeCallKey, decodeSecureMailKey, decryptCallTitle, decryptFile, decryptMessage, decryptMessageWithSharedSecret, decryptRecoveryKey, decryptWithChatKey, deriveDirectChatKey, deriveEncryptionKeypairFromSigning, derivePublicKey, disconnectSso, encodeCallKey, encryptCallTitle, encryptFile, encryptMessage, encryptMessageWithSharedSecret, encryptRecoveryKey, encryptWithChatKey, encryptionKeypairFromSigningKey, generateCallKey, generateChatKey, generateIdentityKeypair, generateKeyPairs, generateLoginCredentials, generateLoginCredentialsFromKey, generatePasswordChangeCredentials, generateRandomSigningKeypair, generateRegistrationCredentials, generateUserKeypairs, getRecoveryKeyFilename, getSession, getUserEncryptionKeypair, hasSession, identityFromLoginResponse, initSodium, initializeDatabase, isAbortError, isEncryptedRecoveryKey, isMessageType, logger, openCallKeyOf, openSealedCallKey, openSealedChatKey, openSecureMail, parseCallFragment, parseRecoveryUrl, parseServerMessage, passwordChangeErrorMessage, prewarmKeyPairs, readSessionClaims, requestSsoDisconnectCode, saveSession, sealCallKey, sealCallKeyForPeers, sealChatKey, sealKeyForSession, sealSecureMail, sealedBoxDecrypt, sealedBoxEncrypt, secureMailClaim, signMessage, unlockIdentityWithPassword, unwrapIdentityKey, unwrapWorkspaceKey, updateWrappedIdentityKey, validateRecoveryKeyFile, workspaceKeyRequiredOf, wrapIdentityKey };
2574
+ export { ACCESS_TOKEN_STORAGE_KEY, API_PREFIX, CALL_KEY_BYTES, CHAT_KEY_BYTES, ENCRYPTED_RECOVERY_KEY_SIZE, RECOVERY_KEY_ERRORS, SECURE_MAIL_KEY_BYTES, SETTINGS_WRITE_BREAKER_CODE, UNENCRYPTED_RECOVERY_KEY_SIZE, authRequestError, base64Decode, base64Encode, base64ToBytes, base64UrlToBytes, browserSessionStateStorage, buildCallFragment, buildCallLink, buildWebSocketUrl, bytesToBase64, bytesToBase64Url, canPersistSession, changePassword, clearAllData, clearSession, computeSharedSecret, configureLogger, createAllWorkspacesOpener, createArbiClient, createAuthMessage, createAutoReloginMiddleware, createBearerAuthMiddleware, createContentHash, createHttpTransport, createMemorySessionPersistence, createOfflineSealer, createRecoveryFile, createRecoveryUrl, createReloginHandler, createSessionManager, createWorkspaceKeys, createWorkspaceOpens, createWorkspaceReopener, decodeCallKey, decodeSecureMailKey, decryptCallTitle, decryptFile, decryptMessage, decryptMessageWithSharedSecret, decryptRecoveryKey, decryptWithChatKey, deriveDirectChatKey, deriveEncryptionKeypairFromSigning, derivePublicKey, disconnectSso, encodeCallKey, encryptCallTitle, encryptFile, encryptMessage, encryptMessageWithSharedSecret, encryptRecoveryKey, encryptWithChatKey, encryptionKeypairFromSigningKey, generateCallKey, generateChatKey, generateIdentityKeypair, generateKeyPairs, generateLoginCredentials, generateLoginCredentialsFromKey, generatePasswordChangeCredentials, generateRandomSigningKeypair, generateRegistrationCredentials, generateUserKeypairs, getRecoveryKeyFilename, getSession, getUserEncryptionKeypair, hasSession, identityFromLoginResponse, initSodium, initializeDatabase, isAbortError, isEncryptedRecoveryKey, isMessageType, logger, openCallKeyOf, openSealedCallKey, openSealedChatKey, openSecureMail, parseCallFragment, parseRecoveryUrl, parseServerMessage, passwordChangeErrorMessage, prewarmKeyPairs, readSessionClaims, requestSsoDisconnectCode, saveSession, sealCallKey, sealCallKeyForPeers, sealChatKey, sealKeyForSession, sealSecureMail, sealedBoxDecrypt, sealedBoxEncrypt, secureMailClaim, signMessage, subscribeSessionPersistence, unlockIdentityWithPassword, unwrapIdentityKey, unwrapWorkspaceKey, updateWrappedIdentityKey, validateRecoveryKeyFile, workspaceKeyRequiredOf, wrapIdentityKey };
2510
2575
  //# sourceMappingURL=index.js.map
2511
2576
  //# sourceMappingURL=index.js.map