dexie-cloud-addon 4.2.5 → 4.3.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.
Files changed (168) hide show
  1. package/TODO-SOCIALAUTH.md +545 -0
  2. package/dist/modern/DexieCloudAPI.d.ts +4 -0
  3. package/dist/modern/DexieCloudOptions.d.ts +20 -0
  4. package/dist/modern/authentication/exchangeOAuthCode.d.ts +23 -0
  5. package/dist/modern/authentication/fetchAuthProviders.d.ts +14 -0
  6. package/dist/modern/authentication/handleOAuthCallback.d.ts +57 -0
  7. package/dist/modern/authentication/interactWithUser.d.ts +19 -0
  8. package/dist/modern/authentication/oauthLogin.d.ts +37 -0
  9. package/dist/modern/default-ui/AuthProviderButton.d.ts +21 -0
  10. package/dist/modern/default-ui/LoginDialog.d.ts +5 -2
  11. package/dist/modern/default-ui/ProviderSelectionDialog.d.ts +7 -0
  12. package/dist/modern/dexie-cloud-addon.js +577 -5
  13. package/dist/modern/dexie-cloud-addon.js.map +1 -1
  14. package/dist/modern/dexie-cloud-addon.min.js +1 -1
  15. package/dist/modern/dexie-cloud-addon.min.js.gz +0 -0
  16. package/dist/modern/dexie-cloud-addon.min.js.map +1 -1
  17. package/dist/modern/errors/OAuthError.d.ts +10 -0
  18. package/dist/modern/service-worker.js +577 -5
  19. package/dist/modern/service-worker.js.map +1 -1
  20. package/dist/modern/service-worker.min.js +1 -1
  21. package/dist/modern/service-worker.min.js.map +1 -1
  22. package/dist/modern/types/DXCUserInteraction.d.ts +24 -1
  23. package/dist/umd/DISABLE_SERVICEWORKER_STRATEGY.d.ts +1 -0
  24. package/dist/umd/DXCWebSocketStatus.d.ts +1 -0
  25. package/dist/umd/DexieCloudAPI.d.ts +75 -0
  26. package/dist/umd/DexieCloudOptions.d.ts +27 -0
  27. package/dist/umd/DexieCloudSyncOptions.d.ts +4 -0
  28. package/dist/umd/DexieCloudTable.d.ts +18 -0
  29. package/dist/umd/InvalidLicenseError.d.ts +5 -0
  30. package/dist/umd/Invite.d.ts +8 -0
  31. package/dist/umd/PermissionChecker.d.ts +15 -0
  32. package/dist/umd/TSON.d.ts +17 -0
  33. package/dist/umd/WSObservable.d.ts +72 -0
  34. package/dist/umd/associate.d.ts +1 -0
  35. package/dist/umd/authentication/AuthPersistedContext.d.ts +9 -0
  36. package/dist/umd/authentication/TokenErrorResponseError.d.ts +10 -0
  37. package/dist/umd/authentication/TokenExpiredError.d.ts +3 -0
  38. package/dist/umd/authentication/UNAUTHORIZED_USER.d.ts +2 -0
  39. package/dist/umd/authentication/authenticate.d.ts +13 -0
  40. package/dist/umd/authentication/currentUserObservable.d.ts +1 -0
  41. package/dist/umd/authentication/interactWithUser.d.ts +21 -0
  42. package/dist/umd/authentication/login.d.ts +3 -0
  43. package/dist/umd/authentication/logout.d.ts +5 -0
  44. package/dist/umd/authentication/otpFetchTokenCallback.d.ts +3 -0
  45. package/dist/umd/authentication/setCurrentUser.d.ts +14 -0
  46. package/dist/umd/authentication/waitUntil.d.ts +3 -0
  47. package/dist/umd/computeSyncState.d.ts +4 -0
  48. package/dist/umd/createSharedValueObservable.d.ts +3 -0
  49. package/dist/umd/currentUserEmitter.d.ts +3 -0
  50. package/dist/umd/db/DexieCloudDB.d.ts +61 -0
  51. package/dist/umd/db/entities/BaseRevisionMapEntry.d.ts +5 -0
  52. package/dist/umd/db/entities/EntityCommon.d.ts +5 -0
  53. package/dist/umd/db/entities/GuardedJob.d.ts +5 -0
  54. package/dist/umd/db/entities/Member.d.ts +19 -0
  55. package/dist/umd/db/entities/PersistedSyncState.d.ts +22 -0
  56. package/dist/umd/db/entities/Realm.d.ts +14 -0
  57. package/dist/umd/db/entities/Role.d.ts +11 -0
  58. package/dist/umd/db/entities/UserLogin.d.ts +23 -0
  59. package/dist/umd/default-ui/Dialog.d.ts +5 -0
  60. package/dist/umd/default-ui/LoginDialog.d.ts +3 -0
  61. package/dist/umd/default-ui/Styles.d.ts +3 -0
  62. package/dist/umd/default-ui/index.d.ts +24 -0
  63. package/dist/umd/define-ydoc-trigger.d.ts +3 -0
  64. package/dist/umd/dexie-cloud-addon.d.ts +3 -0
  65. package/dist/umd/dexie-cloud-addon.js +578 -6
  66. package/dist/umd/dexie-cloud-addon.js.gz +0 -0
  67. package/dist/umd/dexie-cloud-addon.js.map +1 -1
  68. package/dist/umd/dexie-cloud-addon.min.js +1 -1
  69. package/dist/umd/dexie-cloud-addon.min.js.gz +0 -0
  70. package/dist/umd/dexie-cloud-addon.min.js.map +1 -1
  71. package/dist/umd/dexie-cloud-client.d.ts +23 -0
  72. package/dist/umd/errors/HttpError.d.ts +5 -0
  73. package/dist/umd/extend-dexie-interface.d.ts +23 -0
  74. package/dist/umd/getGlobalRolesObservable.d.ts +5 -0
  75. package/dist/umd/getInternalAccessControlObservable.d.ts +12 -0
  76. package/dist/umd/getInvitesObservable.d.ts +23 -0
  77. package/dist/umd/getPermissionsLookupObservable.d.ts +16 -0
  78. package/dist/umd/getTiedRealmId.d.ts +2 -0
  79. package/dist/umd/helpers/BroadcastedAndLocalEvent.d.ts +8 -0
  80. package/dist/umd/helpers/CancelToken.d.ts +4 -0
  81. package/dist/umd/helpers/IS_SERVICE_WORKER.d.ts +1 -0
  82. package/dist/umd/helpers/SWBroadcastChannel.d.ts +12 -0
  83. package/dist/umd/helpers/allSettled.d.ts +1 -0
  84. package/dist/umd/helpers/bulkUpdate.d.ts +4 -0
  85. package/dist/umd/helpers/computeRealmSetHash.d.ts +2 -0
  86. package/dist/umd/helpers/date-constants.d.ts +5 -0
  87. package/dist/umd/helpers/flatten.d.ts +1 -0
  88. package/dist/umd/helpers/getMutationTable.d.ts +1 -0
  89. package/dist/umd/helpers/getSyncableTables.d.ts +4 -0
  90. package/dist/umd/helpers/getTableFromMutationTable.d.ts +1 -0
  91. package/dist/umd/helpers/makeArray.d.ts +1 -0
  92. package/dist/umd/helpers/randomString.d.ts +1 -0
  93. package/dist/umd/helpers/resolveText.d.ts +16 -0
  94. package/dist/umd/helpers/throwVersionIncrementNeeded.d.ts +1 -0
  95. package/dist/umd/helpers/visibilityState.d.ts +1 -0
  96. package/dist/umd/isEagerSyncDisabled.d.ts +2 -0
  97. package/dist/umd/isFirefox.d.ts +1 -0
  98. package/dist/umd/isSafari.d.ts +2 -0
  99. package/dist/umd/mapValueObservable.d.ts +5 -0
  100. package/dist/umd/mergePermissions.d.ts +2 -0
  101. package/dist/umd/middleware-helpers/guardedTable.d.ts +11 -0
  102. package/dist/umd/middleware-helpers/idGenerationHelpers.d.ts +18 -0
  103. package/dist/umd/middlewares/createIdGenerationMiddleware.d.ts +3 -0
  104. package/dist/umd/middlewares/createImplicitPropSetterMiddleware.d.ts +3 -0
  105. package/dist/umd/middlewares/createMutationTrackingMiddleware.d.ts +17 -0
  106. package/dist/umd/middlewares/outstandingTransaction.d.ts +4 -0
  107. package/dist/umd/overrideParseStoresSpec.d.ts +4 -0
  108. package/dist/umd/performInitialSync.d.ts +4 -0
  109. package/dist/umd/permissions.d.ts +9 -0
  110. package/dist/umd/prodLog.d.ts +9 -0
  111. package/dist/umd/service-worker.d.ts +1 -0
  112. package/dist/umd/service-worker.js +578 -6
  113. package/dist/umd/service-worker.js.map +1 -1
  114. package/dist/umd/service-worker.min.js +1 -1
  115. package/dist/umd/service-worker.min.js.map +1 -1
  116. package/dist/umd/sync/DEXIE_CLOUD_SYNCER_ID.d.ts +1 -0
  117. package/dist/umd/sync/LocalSyncWorker.d.ts +7 -0
  118. package/dist/umd/sync/SyncRequiredError.d.ts +3 -0
  119. package/dist/umd/sync/applyServerChanges.d.ts +3 -0
  120. package/dist/umd/sync/connectWebSocket.d.ts +2 -0
  121. package/dist/umd/sync/encodeIdsForServer.d.ts +4 -0
  122. package/dist/umd/sync/extractRealm.d.ts +2 -0
  123. package/dist/umd/sync/getLatestRevisionsPerTable.d.ts +6 -0
  124. package/dist/umd/sync/getTablesToSyncify.d.ts +3 -0
  125. package/dist/umd/sync/isOnline.d.ts +1 -0
  126. package/dist/umd/sync/isSyncNeeded.d.ts +2 -0
  127. package/dist/umd/sync/listClientChanges.d.ts +9 -0
  128. package/dist/umd/sync/listSyncifiedChanges.d.ts +5 -0
  129. package/dist/umd/sync/messageConsumerIsReady.d.ts +2 -0
  130. package/dist/umd/sync/messagesFromServerQueue.d.ts +8 -0
  131. package/dist/umd/sync/modifyLocalObjectsWithNewUserId.d.ts +4 -0
  132. package/dist/umd/sync/myId.d.ts +1 -0
  133. package/dist/umd/sync/numUnsyncedMutations.d.ts +2 -0
  134. package/dist/umd/sync/old_startSyncingClientChanges.d.ts +39 -0
  135. package/dist/umd/sync/performGuardedJob.d.ts +2 -0
  136. package/dist/umd/sync/ratelimit.d.ts +3 -0
  137. package/dist/umd/sync/registerSyncEvent.d.ts +3 -0
  138. package/dist/umd/sync/sync.d.ts +15 -0
  139. package/dist/umd/sync/syncIfPossible.d.ts +5 -0
  140. package/dist/umd/sync/syncWithServer.d.ts +6 -0
  141. package/dist/umd/sync/triggerSync.d.ts +2 -0
  142. package/dist/umd/sync/updateBaseRevs.d.ts +5 -0
  143. package/dist/umd/types/DXCAlert.d.ts +25 -0
  144. package/dist/umd/types/DXCInputField.d.ts +11 -0
  145. package/dist/umd/types/DXCUserInteraction.d.ts +93 -0
  146. package/dist/umd/types/NewIdOptions.d.ts +3 -0
  147. package/dist/umd/types/SWMessageEvent.d.ts +3 -0
  148. package/dist/umd/types/SWSyncEvent.d.ts +4 -0
  149. package/dist/umd/types/SyncState.d.ts +9 -0
  150. package/dist/umd/types/TXExpandos.d.ts +11 -0
  151. package/dist/umd/updateSchemaFromOptions.d.ts +3 -0
  152. package/dist/umd/userIsActive.d.ts +7 -0
  153. package/dist/umd/verifyConfig.d.ts +2 -0
  154. package/dist/umd/verifySchema.d.ts +2 -0
  155. package/dist/umd/yjs/YDexieCloudSyncState.d.ts +3 -0
  156. package/dist/umd/yjs/YTable.d.ts +3 -0
  157. package/dist/umd/yjs/applyYMessages.d.ts +9 -0
  158. package/dist/umd/yjs/awareness.d.ts +3 -0
  159. package/dist/umd/yjs/createYClientUpdateObservable.d.ts +4 -0
  160. package/dist/umd/yjs/createYHandler.d.ts +2 -0
  161. package/dist/umd/yjs/downloadYDocsFromServer.d.ts +3 -0
  162. package/dist/umd/yjs/getUpdatesTable.d.ts +3 -0
  163. package/dist/umd/yjs/listUpdatesSince.d.ts +3 -0
  164. package/dist/umd/yjs/listYClientMessagesAndStateVector.d.ts +26 -0
  165. package/dist/umd/yjs/reopenDocSignal.d.ts +10 -0
  166. package/dist/umd/yjs/updateYSyncStates.d.ts +6 -0
  167. package/oauth_flow.md +299 -0
  168. package/package.json +3 -3
@@ -1,3 +1,4 @@
1
+ import type { OAuthProviderInfo } from 'dexie-cloud-common';
1
2
  import { BehaviorSubject } from 'rxjs';
2
3
  import { DXCAlert } from '../types/DXCAlert';
3
4
  import { DXCInputField } from '../types/DXCInputField';
@@ -19,3 +20,21 @@ export declare function alertUser(userInteraction: BehaviorSubject<DXCUserIntera
19
20
  export declare function promptForEmail(userInteraction: BehaviorSubject<DXCUserInteraction | undefined>, title: string, emailHint?: string): Promise<string>;
20
21
  export declare function promptForOTP(userInteraction: BehaviorSubject<DXCUserInteraction | undefined>, email: string, alert?: DXCAlert): Promise<string>;
21
22
  export declare function confirmLogout(userInteraction: BehaviorSubject<DXCUserInteraction | undefined>, currentUserId: string, numUnsyncedChanges: number): Promise<boolean>;
23
+ /** Result from provider selection prompt */
24
+ export type ProviderSelectionResult = {
25
+ type: 'provider';
26
+ provider: string;
27
+ } | {
28
+ type: 'otp';
29
+ };
30
+ /**
31
+ * Prompts the user to select an authentication method (OAuth provider or OTP).
32
+ *
33
+ * @param userInteraction - The user interaction BehaviorSubject
34
+ * @param providers - Available OAuth providers
35
+ * @param otpEnabled - Whether OTP is available
36
+ * @param title - Dialog title
37
+ * @param alerts - Optional alerts to display
38
+ * @returns Promise resolving to the user's selection
39
+ */
40
+ export declare function promptForProvider(userInteraction: BehaviorSubject<DXCUserInteraction | undefined>, providers: OAuthProviderInfo[], otpEnabled: boolean, title?: string, alerts?: DXCAlert[]): Promise<ProviderSelectionResult>;
@@ -0,0 +1,37 @@
1
+ /** Options for OAuth login */
2
+ export interface OAuthLoginOptions {
3
+ /** The Dexie Cloud database URL */
4
+ databaseUrl: string;
5
+ /** The OAuth provider name */
6
+ provider: string;
7
+ /** Optional redirect URI for non-popup flows */
8
+ redirectUri?: string;
9
+ /** Whether to use popup (default: true) */
10
+ usePopup?: boolean;
11
+ }
12
+ /** Result from OAuth login */
13
+ export interface OAuthLoginResult {
14
+ /** The Dexie Cloud authorization code */
15
+ code: string;
16
+ /** The provider that was used */
17
+ provider: string;
18
+ /** The state parameter */
19
+ state: string;
20
+ }
21
+ /**
22
+ * Initiates OAuth login flow using a popup window.
23
+ *
24
+ * Opens a popup to the OAuth provider, listens for postMessage with the result,
25
+ * and returns the Dexie Cloud authorization code.
26
+ *
27
+ * @param options - OAuth login options
28
+ * @returns Promise resolving to OAuthLoginResult
29
+ * @throws OAuthError on failure
30
+ */
31
+ export declare function oauthLogin(options: OAuthLoginOptions): Promise<OAuthLoginResult>;
32
+ /**
33
+ * Initiates OAuth login via redirect (non-popup flow).
34
+ * The page will navigate to the OAuth provider and redirect back to the app.
35
+ * Use handleOAuthCallback on the callback page to complete the flow.
36
+ */
37
+ export declare function startOAuthRedirect(options: OAuthLoginOptions): void;
@@ -0,0 +1,21 @@
1
+ import { h } from 'preact';
2
+ import type { OAuthProviderInfo } from 'dexie-cloud-common';
3
+ export interface AuthProviderButtonProps {
4
+ provider: OAuthProviderInfo;
5
+ onClick: () => void;
6
+ }
7
+ /**
8
+ * Button component for OAuth provider login.
9
+ * Displays the provider's icon and name following provider branding guidelines.
10
+ */
11
+ export declare function AuthProviderButton({ provider, onClick }: AuthProviderButtonProps): h.JSX.Element;
12
+ /**
13
+ * Button for email/OTP authentication option.
14
+ */
15
+ export declare function OtpButton({ onClick }: {
16
+ onClick: () => void;
17
+ }): h.JSX.Element;
18
+ /**
19
+ * Visual divider with "or" text.
20
+ */
21
+ export declare function Divider(): h.JSX.Element;
@@ -1,3 +1,6 @@
1
1
  import { h } from 'preact';
2
- import { DXCUserInteraction } from '../types/DXCUserInteraction';
3
- export declare function LoginDialog({ title, type, alerts, fields, submitLabel, cancelLabel, onCancel, onSubmit, }: DXCUserInteraction): h.JSX.Element;
2
+ import { DXCUserInteraction, DXCProviderSelection } from '../types/DXCUserInteraction';
3
+ /** User interactions that have the standard form-based structure */
4
+ type FormBasedInteraction = Exclude<DXCUserInteraction, DXCProviderSelection>;
5
+ export declare function LoginDialog({ title, type, alerts, fields, submitLabel, cancelLabel, onCancel, onSubmit, }: FormBasedInteraction): h.JSX.Element;
6
+ export {};
@@ -0,0 +1,7 @@
1
+ import { h } from 'preact';
2
+ import { DXCProviderSelection } from '../types/DXCUserInteraction';
3
+ /**
4
+ * Dialog component for OAuth provider selection.
5
+ * Displays available OAuth providers as buttons and optionally an email/OTP option.
6
+ */
7
+ export declare function ProviderSelectionDialog({ title, alerts, providers, otpEnabled, cancelLabel, onSelectProvider, onSelectOtp, onCancel, }: DXCProviderSelection): h.JSX.Element;