dexie-cloud-addon 4.4.4 → 4.4.5

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 (157) hide show
  1. package/dist/modern/default-ui/AuthProviderButton.d.ts +21 -0
  2. package/dist/modern/default-ui/ProviderSelectionDialog.d.ts +7 -0
  3. package/dist/modern/default-ui/SelectDialog.d.ts +10 -0
  4. package/dist/modern/dexie-cloud-addon.js +18 -14
  5. package/dist/modern/dexie-cloud-addon.js.map +1 -1
  6. package/dist/modern/dexie-cloud-addon.min.js +1 -1
  7. package/dist/modern/dexie-cloud-addon.min.js.gz +0 -0
  8. package/dist/modern/dexie-cloud-addon.min.js.map +1 -1
  9. package/dist/modern/service-worker.js +18 -14
  10. package/dist/modern/service-worker.js.map +1 -1
  11. package/dist/modern/service-worker.min.js +1 -1
  12. package/dist/modern/service-worker.min.js.map +1 -1
  13. package/dist/umd/DISABLE_SERVICEWORKER_STRATEGY.d.ts +1 -0
  14. package/dist/umd/DXCWebSocketStatus.d.ts +1 -0
  15. package/dist/umd/DexieCloudAPI.d.ts +75 -0
  16. package/dist/umd/DexieCloudOptions.d.ts +27 -0
  17. package/dist/umd/DexieCloudSyncOptions.d.ts +4 -0
  18. package/dist/umd/DexieCloudTable.d.ts +18 -0
  19. package/dist/umd/InvalidLicenseError.d.ts +5 -0
  20. package/dist/umd/Invite.d.ts +8 -0
  21. package/dist/umd/PermissionChecker.d.ts +15 -0
  22. package/dist/umd/TSON.d.ts +17 -0
  23. package/dist/umd/WSObservable.d.ts +72 -0
  24. package/dist/umd/associate.d.ts +1 -0
  25. package/dist/umd/authentication/AuthPersistedContext.d.ts +9 -0
  26. package/dist/umd/authentication/TokenErrorResponseError.d.ts +10 -0
  27. package/dist/umd/authentication/TokenExpiredError.d.ts +3 -0
  28. package/dist/umd/authentication/UNAUTHORIZED_USER.d.ts +2 -0
  29. package/dist/umd/authentication/authenticate.d.ts +13 -0
  30. package/dist/umd/authentication/currentUserObservable.d.ts +1 -0
  31. package/dist/umd/authentication/interactWithUser.d.ts +21 -0
  32. package/dist/umd/authentication/login.d.ts +3 -0
  33. package/dist/umd/authentication/logout.d.ts +5 -0
  34. package/dist/umd/authentication/otpFetchTokenCallback.d.ts +3 -0
  35. package/dist/umd/authentication/setCurrentUser.d.ts +14 -0
  36. package/dist/umd/authentication/waitUntil.d.ts +3 -0
  37. package/dist/umd/computeSyncState.d.ts +4 -0
  38. package/dist/umd/createSharedValueObservable.d.ts +3 -0
  39. package/dist/umd/currentUserEmitter.d.ts +3 -0
  40. package/dist/umd/db/DexieCloudDB.d.ts +61 -0
  41. package/dist/umd/db/entities/BaseRevisionMapEntry.d.ts +5 -0
  42. package/dist/umd/db/entities/EntityCommon.d.ts +5 -0
  43. package/dist/umd/db/entities/GuardedJob.d.ts +5 -0
  44. package/dist/umd/db/entities/Member.d.ts +19 -0
  45. package/dist/umd/db/entities/PersistedSyncState.d.ts +22 -0
  46. package/dist/umd/db/entities/Realm.d.ts +14 -0
  47. package/dist/umd/db/entities/Role.d.ts +11 -0
  48. package/dist/umd/db/entities/UserLogin.d.ts +23 -0
  49. package/dist/umd/default-ui/Dialog.d.ts +5 -0
  50. package/dist/umd/default-ui/LoginDialog.d.ts +3 -0
  51. package/dist/umd/default-ui/Styles.d.ts +3 -0
  52. package/dist/umd/default-ui/index.d.ts +24 -0
  53. package/dist/umd/define-ydoc-trigger.d.ts +3 -0
  54. package/dist/umd/dexie-cloud-addon.d.ts +3 -0
  55. package/dist/umd/dexie-cloud-addon.js +18 -14
  56. package/dist/umd/dexie-cloud-addon.js.gz +0 -0
  57. package/dist/umd/dexie-cloud-addon.js.map +1 -1
  58. package/dist/umd/dexie-cloud-addon.min.js +1 -1
  59. package/dist/umd/dexie-cloud-addon.min.js.gz +0 -0
  60. package/dist/umd/dexie-cloud-addon.min.js.map +1 -1
  61. package/dist/umd/dexie-cloud-client.d.ts +23 -0
  62. package/dist/umd/errors/HttpError.d.ts +5 -0
  63. package/dist/umd/extend-dexie-interface.d.ts +23 -0
  64. package/dist/umd/getGlobalRolesObservable.d.ts +5 -0
  65. package/dist/umd/getInternalAccessControlObservable.d.ts +12 -0
  66. package/dist/umd/getInvitesObservable.d.ts +23 -0
  67. package/dist/umd/getPermissionsLookupObservable.d.ts +16 -0
  68. package/dist/umd/getTiedRealmId.d.ts +2 -0
  69. package/dist/umd/helpers/BroadcastedAndLocalEvent.d.ts +8 -0
  70. package/dist/umd/helpers/CancelToken.d.ts +4 -0
  71. package/dist/umd/helpers/IS_SERVICE_WORKER.d.ts +1 -0
  72. package/dist/umd/helpers/SWBroadcastChannel.d.ts +12 -0
  73. package/dist/umd/helpers/allSettled.d.ts +1 -0
  74. package/dist/umd/helpers/bulkUpdate.d.ts +4 -0
  75. package/dist/umd/helpers/computeRealmSetHash.d.ts +2 -0
  76. package/dist/umd/helpers/date-constants.d.ts +5 -0
  77. package/dist/umd/helpers/flatten.d.ts +1 -0
  78. package/dist/umd/helpers/getMutationTable.d.ts +1 -0
  79. package/dist/umd/helpers/getSyncableTables.d.ts +4 -0
  80. package/dist/umd/helpers/getTableFromMutationTable.d.ts +1 -0
  81. package/dist/umd/helpers/makeArray.d.ts +1 -0
  82. package/dist/umd/helpers/randomString.d.ts +1 -0
  83. package/dist/umd/helpers/resolveText.d.ts +16 -0
  84. package/dist/umd/helpers/throwVersionIncrementNeeded.d.ts +1 -0
  85. package/dist/umd/helpers/visibilityState.d.ts +1 -0
  86. package/dist/umd/isEagerSyncDisabled.d.ts +2 -0
  87. package/dist/umd/isFirefox.d.ts +1 -0
  88. package/dist/umd/isSafari.d.ts +2 -0
  89. package/dist/umd/mapValueObservable.d.ts +5 -0
  90. package/dist/umd/mergePermissions.d.ts +2 -0
  91. package/dist/umd/middleware-helpers/guardedTable.d.ts +11 -0
  92. package/dist/umd/middleware-helpers/idGenerationHelpers.d.ts +18 -0
  93. package/dist/umd/middlewares/createIdGenerationMiddleware.d.ts +3 -0
  94. package/dist/umd/middlewares/createImplicitPropSetterMiddleware.d.ts +3 -0
  95. package/dist/umd/middlewares/createMutationTrackingMiddleware.d.ts +17 -0
  96. package/dist/umd/middlewares/outstandingTransaction.d.ts +4 -0
  97. package/dist/umd/overrideParseStoresSpec.d.ts +4 -0
  98. package/dist/umd/performInitialSync.d.ts +4 -0
  99. package/dist/umd/permissions.d.ts +9 -0
  100. package/dist/umd/prodLog.d.ts +9 -0
  101. package/dist/umd/service-worker.d.ts +1 -0
  102. package/dist/umd/service-worker.js +18 -14
  103. package/dist/umd/service-worker.js.map +1 -1
  104. package/dist/umd/service-worker.min.js +1 -1
  105. package/dist/umd/service-worker.min.js.map +1 -1
  106. package/dist/umd/sync/DEXIE_CLOUD_SYNCER_ID.d.ts +1 -0
  107. package/dist/umd/sync/LocalSyncWorker.d.ts +7 -0
  108. package/dist/umd/sync/SyncRequiredError.d.ts +3 -0
  109. package/dist/umd/sync/applyServerChanges.d.ts +3 -0
  110. package/dist/umd/sync/connectWebSocket.d.ts +2 -0
  111. package/dist/umd/sync/encodeIdsForServer.d.ts +4 -0
  112. package/dist/umd/sync/extractRealm.d.ts +2 -0
  113. package/dist/umd/sync/getLatestRevisionsPerTable.d.ts +6 -0
  114. package/dist/umd/sync/getTablesToSyncify.d.ts +3 -0
  115. package/dist/umd/sync/isOnline.d.ts +1 -0
  116. package/dist/umd/sync/isSyncNeeded.d.ts +2 -0
  117. package/dist/umd/sync/listClientChanges.d.ts +9 -0
  118. package/dist/umd/sync/listSyncifiedChanges.d.ts +5 -0
  119. package/dist/umd/sync/messageConsumerIsReady.d.ts +2 -0
  120. package/dist/umd/sync/messagesFromServerQueue.d.ts +8 -0
  121. package/dist/umd/sync/modifyLocalObjectsWithNewUserId.d.ts +4 -0
  122. package/dist/umd/sync/myId.d.ts +1 -0
  123. package/dist/umd/sync/numUnsyncedMutations.d.ts +2 -0
  124. package/dist/umd/sync/old_startSyncingClientChanges.d.ts +39 -0
  125. package/dist/umd/sync/performGuardedJob.d.ts +2 -0
  126. package/dist/umd/sync/ratelimit.d.ts +3 -0
  127. package/dist/umd/sync/registerSyncEvent.d.ts +3 -0
  128. package/dist/umd/sync/sync.d.ts +15 -0
  129. package/dist/umd/sync/syncIfPossible.d.ts +5 -0
  130. package/dist/umd/sync/syncWithServer.d.ts +6 -0
  131. package/dist/umd/sync/triggerSync.d.ts +2 -0
  132. package/dist/umd/sync/updateBaseRevs.d.ts +5 -0
  133. package/dist/umd/types/DXCAlert.d.ts +25 -0
  134. package/dist/umd/types/DXCInputField.d.ts +11 -0
  135. package/dist/umd/types/DXCUserInteraction.d.ts +93 -0
  136. package/dist/umd/types/NewIdOptions.d.ts +3 -0
  137. package/dist/umd/types/SWMessageEvent.d.ts +3 -0
  138. package/dist/umd/types/SWSyncEvent.d.ts +4 -0
  139. package/dist/umd/types/SyncState.d.ts +9 -0
  140. package/dist/umd/types/TXExpandos.d.ts +11 -0
  141. package/dist/umd/updateSchemaFromOptions.d.ts +3 -0
  142. package/dist/umd/userIsActive.d.ts +7 -0
  143. package/dist/umd/verifyConfig.d.ts +2 -0
  144. package/dist/umd/verifySchema.d.ts +2 -0
  145. package/dist/umd/yjs/YDexieCloudSyncState.d.ts +3 -0
  146. package/dist/umd/yjs/YTable.d.ts +3 -0
  147. package/dist/umd/yjs/applyYMessages.d.ts +9 -0
  148. package/dist/umd/yjs/awareness.d.ts +3 -0
  149. package/dist/umd/yjs/createYClientUpdateObservable.d.ts +4 -0
  150. package/dist/umd/yjs/createYHandler.d.ts +2 -0
  151. package/dist/umd/yjs/downloadYDocsFromServer.d.ts +3 -0
  152. package/dist/umd/yjs/getUpdatesTable.d.ts +3 -0
  153. package/dist/umd/yjs/listUpdatesSince.d.ts +3 -0
  154. package/dist/umd/yjs/listYClientMessagesAndStateVector.d.ts +26 -0
  155. package/dist/umd/yjs/reopenDocSignal.d.ts +10 -0
  156. package/dist/umd/yjs/updateYSyncStates.d.ts +6 -0
  157. package/package.json +3 -3
@@ -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;
@@ -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;
@@ -0,0 +1,10 @@
1
+ import { h } from 'preact';
2
+ import { DXCSelect } from '../types/DXCUserInteraction';
3
+ /**
4
+ * Dialog component for generic option selection.
5
+ * Displays available options as buttons.
6
+ *
7
+ * This component is UI-agnostic and works with any DXCSelect interaction,
8
+ * whether for authentication, settings, or other selection purposes.
9
+ */
10
+ export declare function SelectDialog({ title, alerts, options, cancelLabel, onSelect, onCancel, }: DXCSelect): h.JSX.Element;
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * ==========================================================================
10
10
  *
11
- * Version 4.4.4, Wed Mar 25 2026
11
+ * Version 4.4.5, Wed Mar 25 2026
12
12
  *
13
13
  * https://dexie.org
14
14
  *
@@ -6773,14 +6773,13 @@ function connectWebSocket(db) {
6773
6773
  throw new Error(`No database URL to connect WebSocket to`);
6774
6774
  }
6775
6775
  const readyForChangesMessage = db.messageConsumer.readyToServe.pipe(filter$1((isReady) => isReady), // When consumer is ready for new messages, produce such a message to inform server about it
6776
- switchMap(() => db.getPersistedSyncState()), // We need the info on which server revision we are at:
6777
- filter$1((syncState) => syncState && syncState.serverRevision), // We wont send anything to server before inital sync has taken place
6776
+ switchMap(() => db.cloud.persistedSyncState.pipe(filter$1((syncState) => !!(syncState && syncState.serverRevision)), take(1))), // Wait reactively for syncState with serverRevision (avoids race with logout/re-sync)
6778
6777
  switchMap((syncState) => __awaiter(this, void 0, void 0, function* () {
6779
6778
  return ({
6780
6779
  // Produce the message to trigger server to send us new messages to consume:
6781
6780
  type: 'ready',
6782
6781
  rev: syncState.serverRevision,
6783
- realmSetHash: yield computeRealmSetHash(syncState)
6782
+ realmSetHash: yield computeRealmSetHash(syncState),
6784
6783
  });
6785
6784
  })));
6786
6785
  const messageProducer = merge(readyForChangesMessage, db.messageProducer);
@@ -6793,7 +6792,8 @@ function connectWebSocket(db) {
6793
6792
  }*/
6794
6793
  return userIsReallyActive.pipe(map((isActive) => [isActive ? userLogin : null, syncState]));
6795
6794
  }), switchMap(([userLogin, syncState]) => {
6796
- if ((userLogin === null || userLogin === void 0 ? void 0 : userLogin.isLoggedIn) && !(syncState === null || syncState === void 0 ? void 0 : syncState.realms.includes(userLogin.userId))) {
6795
+ if ((userLogin === null || userLogin === void 0 ? void 0 : userLogin.isLoggedIn) &&
6796
+ !(syncState === null || syncState === void 0 ? void 0 : syncState.realms.includes(userLogin.userId))) {
6797
6797
  // We're in an in-between state when user is logged in but the user's realms are not yet synced.
6798
6798
  // Don't make this change reconnect the websocket just yet. Wait till syncState is updated
6799
6799
  // to iclude the user's realm.
@@ -6828,7 +6828,7 @@ function connectWebSocket(db) {
6828
6828
  accessTokenExpiration: refreshedLogin.accessTokenExpiration,
6829
6829
  claims: refreshedLogin.claims,
6830
6830
  license: refreshedLogin.license,
6831
- data: refreshedLogin.data
6831
+ data: refreshedLogin.data,
6832
6832
  });
6833
6833
  })), switchMap(() => createObservable()));
6834
6834
  }
@@ -6836,7 +6836,7 @@ function connectWebSocket(db) {
6836
6836
  return throwError(() => error);
6837
6837
  }
6838
6838
  }), catchError((error) => {
6839
- db.cloud.webSocketStatus.next("error");
6839
+ db.cloud.webSocketStatus.next('error');
6840
6840
  if (error instanceof InvalidLicenseError) {
6841
6841
  // Don't retry. Just throw and don't try connect again.
6842
6842
  return throwError(() => error);
@@ -6948,27 +6948,30 @@ function LocalSyncWorker(db, cloudOptions, cloudSchema) {
6948
6948
  // break free from possible active transaction:
6949
6949
  setTimeout(() => {
6950
6950
  const purpose = pullSignalled ? 'pull' : 'push';
6951
+ pullSignalled = false;
6952
+ pushSignalled = false;
6951
6953
  syncStartTime = Date.now();
6952
6954
  syncIfPossible(db, cloudOptions, cloudSchema, {
6953
6955
  cancelToken,
6954
6956
  retryImmediatelyOnFetchError: true, // workaround for "net::ERR_NETWORK_CHANGED" in chrome.
6955
6957
  purpose,
6956
- }).then(() => {
6958
+ })
6959
+ .then(() => {
6957
6960
  if (cancelToken.cancelled) {
6958
6961
  stop();
6959
6962
  }
6960
6963
  else {
6961
6964
  if (pullSignalled || pushSignalled) {
6962
6965
  // If we have signalled for more sync, do it now.
6963
- pullSignalled = false;
6964
- pushSignalled = false;
6966
+ // Note: don't reset flags here - syncAndRetry reads them in setTimeout
6965
6967
  return syncAndRetry();
6966
6968
  }
6967
6969
  }
6968
6970
  ongoingSync = false;
6969
6971
  nextRetryTime = 0;
6970
6972
  syncStartTime = 0;
6971
- }).catch((error) => {
6973
+ })
6974
+ .catch((error) => {
6972
6975
  console.error('error in syncIfPossible()', error);
6973
6976
  if (cancelToken.cancelled) {
6974
6977
  stop();
@@ -7011,7 +7014,8 @@ function LocalSyncWorker(db, cloudOptions, cloudSchema) {
7011
7014
  if (nextRetryTime) {
7012
7015
  console.debug(`Sync is paused until ${new Date(nextRetryTime).toISOString()} due to error in last sync attempt`);
7013
7016
  }
7014
- else if (syncStartTime > 0 && Date.now() - syncStartTime > 20 * SECONDS) {
7017
+ else if (syncStartTime > 0 &&
7018
+ Date.now() - syncStartTime > 20 * SECONDS) {
7015
7019
  console.debug(`An existing sync operation is taking more than 20 seconds. Will resync when done.`);
7016
7020
  }
7017
7021
  return;
@@ -8373,7 +8377,7 @@ function dexieCloud(dexie) {
8373
8377
  const downloading$ = createDownloadingState();
8374
8378
  dexie.cloud = {
8375
8379
  // @ts-ignore
8376
- version: "4.4.4",
8380
+ version: "4.4.5",
8377
8381
  options: Object.assign({}, DEFAULT_OPTIONS),
8378
8382
  schema: null,
8379
8383
  get currentUserId() {
@@ -8800,7 +8804,7 @@ function dexieCloud(dexie) {
8800
8804
  }
8801
8805
  }
8802
8806
  // @ts-ignore
8803
- dexieCloud.version = "4.4.4";
8807
+ dexieCloud.version = "4.4.5";
8804
8808
  Dexie.Cloud = dexieCloud;
8805
8809
 
8806
8810
  export { dexieCloud as default, defineYDocTrigger, dexieCloud, getTiedObjectId, getTiedRealmId, resolveText };