dexie-cloud-addon 4.4.1 → 4.4.2
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/modern/DexieCloudOptions.d.ts +2 -0
- package/dist/modern/default-ui/AuthProviderButton.d.ts +21 -0
- package/dist/modern/default-ui/ProviderSelectionDialog.d.ts +7 -0
- package/dist/modern/default-ui/SelectDialog.d.ts +10 -0
- package/dist/modern/dexie-cloud-addon.js +23 -12
- package/dist/modern/dexie-cloud-addon.js.map +1 -1
- package/dist/modern/dexie-cloud-addon.min.js +1 -1
- package/dist/modern/dexie-cloud-addon.min.js.gz +0 -0
- package/dist/modern/dexie-cloud-addon.min.js.map +1 -1
- package/dist/modern/service-worker.js +23 -12
- package/dist/modern/service-worker.js.map +1 -1
- package/dist/modern/service-worker.min.js +1 -1
- package/dist/modern/service-worker.min.js.map +1 -1
- package/dist/umd/DISABLE_SERVICEWORKER_STRATEGY.d.ts +1 -0
- package/dist/umd/DXCWebSocketStatus.d.ts +1 -0
- package/dist/umd/DexieCloudAPI.d.ts +75 -0
- package/dist/umd/DexieCloudOptions.d.ts +27 -0
- package/dist/umd/DexieCloudSyncOptions.d.ts +4 -0
- package/dist/umd/DexieCloudTable.d.ts +18 -0
- package/dist/umd/InvalidLicenseError.d.ts +5 -0
- package/dist/umd/Invite.d.ts +8 -0
- package/dist/umd/PermissionChecker.d.ts +15 -0
- package/dist/umd/TSON.d.ts +17 -0
- package/dist/umd/WSObservable.d.ts +72 -0
- package/dist/umd/associate.d.ts +1 -0
- package/dist/umd/authentication/AuthPersistedContext.d.ts +9 -0
- package/dist/umd/authentication/TokenErrorResponseError.d.ts +10 -0
- package/dist/umd/authentication/TokenExpiredError.d.ts +3 -0
- package/dist/umd/authentication/UNAUTHORIZED_USER.d.ts +2 -0
- package/dist/umd/authentication/authenticate.d.ts +13 -0
- package/dist/umd/authentication/currentUserObservable.d.ts +1 -0
- package/dist/umd/authentication/interactWithUser.d.ts +21 -0
- package/dist/umd/authentication/login.d.ts +3 -0
- package/dist/umd/authentication/logout.d.ts +5 -0
- package/dist/umd/authentication/otpFetchTokenCallback.d.ts +3 -0
- package/dist/umd/authentication/setCurrentUser.d.ts +14 -0
- package/dist/umd/authentication/waitUntil.d.ts +3 -0
- package/dist/umd/computeSyncState.d.ts +4 -0
- package/dist/umd/createSharedValueObservable.d.ts +3 -0
- package/dist/umd/currentUserEmitter.d.ts +3 -0
- package/dist/umd/db/DexieCloudDB.d.ts +61 -0
- package/dist/umd/db/entities/BaseRevisionMapEntry.d.ts +5 -0
- package/dist/umd/db/entities/EntityCommon.d.ts +5 -0
- package/dist/umd/db/entities/GuardedJob.d.ts +5 -0
- package/dist/umd/db/entities/Member.d.ts +19 -0
- package/dist/umd/db/entities/PersistedSyncState.d.ts +22 -0
- package/dist/umd/db/entities/Realm.d.ts +14 -0
- package/dist/umd/db/entities/Role.d.ts +11 -0
- package/dist/umd/db/entities/UserLogin.d.ts +23 -0
- package/dist/umd/default-ui/Dialog.d.ts +5 -0
- package/dist/umd/default-ui/LoginDialog.d.ts +3 -0
- package/dist/umd/default-ui/Styles.d.ts +3 -0
- package/dist/umd/default-ui/index.d.ts +24 -0
- package/dist/umd/define-ydoc-trigger.d.ts +3 -0
- package/dist/umd/dexie-cloud-addon.d.ts +3 -0
- package/dist/umd/dexie-cloud-addon.js +23 -12
- package/dist/umd/dexie-cloud-addon.js.gz +0 -0
- package/dist/umd/dexie-cloud-addon.js.map +1 -1
- package/dist/umd/dexie-cloud-addon.min.js +1 -1
- package/dist/umd/dexie-cloud-addon.min.js.gz +0 -0
- package/dist/umd/dexie-cloud-addon.min.js.map +1 -1
- package/dist/umd/dexie-cloud-client.d.ts +23 -0
- package/dist/umd/errors/HttpError.d.ts +5 -0
- package/dist/umd/extend-dexie-interface.d.ts +23 -0
- package/dist/umd/getGlobalRolesObservable.d.ts +5 -0
- package/dist/umd/getInternalAccessControlObservable.d.ts +12 -0
- package/dist/umd/getInvitesObservable.d.ts +23 -0
- package/dist/umd/getPermissionsLookupObservable.d.ts +16 -0
- package/dist/umd/getTiedRealmId.d.ts +2 -0
- package/dist/umd/helpers/BroadcastedAndLocalEvent.d.ts +8 -0
- package/dist/umd/helpers/CancelToken.d.ts +4 -0
- package/dist/umd/helpers/IS_SERVICE_WORKER.d.ts +1 -0
- package/dist/umd/helpers/SWBroadcastChannel.d.ts +12 -0
- package/dist/umd/helpers/allSettled.d.ts +1 -0
- package/dist/umd/helpers/bulkUpdate.d.ts +4 -0
- package/dist/umd/helpers/computeRealmSetHash.d.ts +2 -0
- package/dist/umd/helpers/date-constants.d.ts +5 -0
- package/dist/umd/helpers/flatten.d.ts +1 -0
- package/dist/umd/helpers/getMutationTable.d.ts +1 -0
- package/dist/umd/helpers/getSyncableTables.d.ts +4 -0
- package/dist/umd/helpers/getTableFromMutationTable.d.ts +1 -0
- package/dist/umd/helpers/makeArray.d.ts +1 -0
- package/dist/umd/helpers/randomString.d.ts +1 -0
- package/dist/umd/helpers/resolveText.d.ts +16 -0
- package/dist/umd/helpers/throwVersionIncrementNeeded.d.ts +1 -0
- package/dist/umd/helpers/visibilityState.d.ts +1 -0
- package/dist/umd/isEagerSyncDisabled.d.ts +2 -0
- package/dist/umd/isFirefox.d.ts +1 -0
- package/dist/umd/isSafari.d.ts +2 -0
- package/dist/umd/mapValueObservable.d.ts +5 -0
- package/dist/umd/mergePermissions.d.ts +2 -0
- package/dist/umd/middleware-helpers/guardedTable.d.ts +11 -0
- package/dist/umd/middleware-helpers/idGenerationHelpers.d.ts +18 -0
- package/dist/umd/middlewares/createIdGenerationMiddleware.d.ts +3 -0
- package/dist/umd/middlewares/createImplicitPropSetterMiddleware.d.ts +3 -0
- package/dist/umd/middlewares/createMutationTrackingMiddleware.d.ts +17 -0
- package/dist/umd/middlewares/outstandingTransaction.d.ts +4 -0
- package/dist/umd/overrideParseStoresSpec.d.ts +4 -0
- package/dist/umd/performInitialSync.d.ts +4 -0
- package/dist/umd/permissions.d.ts +9 -0
- package/dist/umd/prodLog.d.ts +9 -0
- package/dist/umd/service-worker.d.ts +1 -0
- package/dist/umd/service-worker.js +23 -12
- package/dist/umd/service-worker.js.map +1 -1
- package/dist/umd/service-worker.min.js +1 -1
- package/dist/umd/service-worker.min.js.map +1 -1
- package/dist/umd/sync/DEXIE_CLOUD_SYNCER_ID.d.ts +1 -0
- package/dist/umd/sync/LocalSyncWorker.d.ts +7 -0
- package/dist/umd/sync/SyncRequiredError.d.ts +3 -0
- package/dist/umd/sync/applyServerChanges.d.ts +3 -0
- package/dist/umd/sync/connectWebSocket.d.ts +2 -0
- package/dist/umd/sync/encodeIdsForServer.d.ts +4 -0
- package/dist/umd/sync/extractRealm.d.ts +2 -0
- package/dist/umd/sync/getLatestRevisionsPerTable.d.ts +6 -0
- package/dist/umd/sync/getTablesToSyncify.d.ts +3 -0
- package/dist/umd/sync/isOnline.d.ts +1 -0
- package/dist/umd/sync/isSyncNeeded.d.ts +2 -0
- package/dist/umd/sync/listClientChanges.d.ts +9 -0
- package/dist/umd/sync/listSyncifiedChanges.d.ts +5 -0
- package/dist/umd/sync/messageConsumerIsReady.d.ts +2 -0
- package/dist/umd/sync/messagesFromServerQueue.d.ts +8 -0
- package/dist/umd/sync/modifyLocalObjectsWithNewUserId.d.ts +4 -0
- package/dist/umd/sync/myId.d.ts +1 -0
- package/dist/umd/sync/numUnsyncedMutations.d.ts +2 -0
- package/dist/umd/sync/old_startSyncingClientChanges.d.ts +39 -0
- package/dist/umd/sync/performGuardedJob.d.ts +2 -0
- package/dist/umd/sync/ratelimit.d.ts +3 -0
- package/dist/umd/sync/registerSyncEvent.d.ts +3 -0
- package/dist/umd/sync/sync.d.ts +15 -0
- package/dist/umd/sync/syncIfPossible.d.ts +5 -0
- package/dist/umd/sync/syncWithServer.d.ts +6 -0
- package/dist/umd/sync/triggerSync.d.ts +2 -0
- package/dist/umd/sync/updateBaseRevs.d.ts +5 -0
- package/dist/umd/types/DXCAlert.d.ts +25 -0
- package/dist/umd/types/DXCInputField.d.ts +11 -0
- package/dist/umd/types/DXCUserInteraction.d.ts +93 -0
- package/dist/umd/types/NewIdOptions.d.ts +3 -0
- package/dist/umd/types/SWMessageEvent.d.ts +3 -0
- package/dist/umd/types/SWSyncEvent.d.ts +4 -0
- package/dist/umd/types/SyncState.d.ts +9 -0
- package/dist/umd/types/TXExpandos.d.ts +11 -0
- package/dist/umd/updateSchemaFromOptions.d.ts +3 -0
- package/dist/umd/userIsActive.d.ts +7 -0
- package/dist/umd/verifyConfig.d.ts +2 -0
- package/dist/umd/verifySchema.d.ts +2 -0
- package/dist/umd/yjs/YDexieCloudSyncState.d.ts +3 -0
- package/dist/umd/yjs/YTable.d.ts +3 -0
- package/dist/umd/yjs/applyYMessages.d.ts +9 -0
- package/dist/umd/yjs/awareness.d.ts +3 -0
- package/dist/umd/yjs/createYClientUpdateObservable.d.ts +4 -0
- package/dist/umd/yjs/createYHandler.d.ts +2 -0
- package/dist/umd/yjs/downloadYDocsFromServer.d.ts +3 -0
- package/dist/umd/yjs/getUpdatesTable.d.ts +3 -0
- package/dist/umd/yjs/listUpdatesSince.d.ts +3 -0
- package/dist/umd/yjs/listYClientMessagesAndStateVector.d.ts +26 -0
- package/dist/umd/yjs/reopenDocSignal.d.ts +10 -0
- package/dist/umd/yjs/updateYSyncStates.d.ts +6 -0
- package/package.json +1 -1
|
@@ -56,6 +56,8 @@ export interface DexieCloudOptions {
|
|
|
56
56
|
* reducing sync payload size. The original string is kept intact in IndexedDB.
|
|
57
57
|
*
|
|
58
58
|
* Set to `Infinity` to disable string offloading.
|
|
59
|
+
* Minimum value is 100 to prevent accidental offloading of primary keys.
|
|
60
|
+
* Maximum value is 32768 (server limit).
|
|
59
61
|
*
|
|
60
62
|
* @default 32768
|
|
61
63
|
*/
|
|
@@ -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.
|
|
11
|
+
* Version 4.4.2, Thu Mar 19 2026
|
|
12
12
|
*
|
|
13
13
|
* https://dexie.org
|
|
14
14
|
*
|
|
@@ -4861,13 +4861,13 @@ function MessagesFromServerConsumer(db) {
|
|
|
4861
4861
|
//triggerSync(db, 'pull');
|
|
4862
4862
|
yield db.cloud.sync({ purpose: 'pull', wait: true });
|
|
4863
4863
|
break;
|
|
4864
|
-
case 'changes':
|
|
4864
|
+
case 'changes': {
|
|
4865
4865
|
console.debug('changes');
|
|
4866
4866
|
if (((_f = db.cloud.syncState.value) === null || _f === void 0 ? void 0 : _f.phase) === 'error') {
|
|
4867
4867
|
triggerSync(db, 'pull');
|
|
4868
4868
|
break;
|
|
4869
4869
|
}
|
|
4870
|
-
yield db.transaction('rw', db.dx.tables, (tx) => __awaiter(this, void 0, void 0, function* () {
|
|
4870
|
+
const didApplyChanges = yield db.transaction('rw', db.dx.tables, (tx) => __awaiter(this, void 0, void 0, function* () {
|
|
4871
4871
|
// @ts-ignore
|
|
4872
4872
|
tx.idbtrans.disableChangeTracking = true;
|
|
4873
4873
|
// @ts-ignore
|
|
@@ -4884,7 +4884,7 @@ function MessagesFromServerConsumer(db) {
|
|
|
4884
4884
|
schema,
|
|
4885
4885
|
currentUser,
|
|
4886
4886
|
});
|
|
4887
|
-
return; // Initial sync must have taken place - otherwise, ignore this.
|
|
4887
|
+
return false; // Initial sync must have taken place - otherwise, ignore this.
|
|
4888
4888
|
}
|
|
4889
4889
|
// Verify again in ACID tx that we're on same server revision.
|
|
4890
4890
|
if (msg.baseRev !== syncState.serverRevision) {
|
|
@@ -4905,7 +4905,7 @@ function MessagesFromServerConsumer(db) {
|
|
|
4905
4905
|
// If we don't do a sync request now, we could stuck in an endless loop.
|
|
4906
4906
|
triggerSync(db, 'pull');
|
|
4907
4907
|
}
|
|
4908
|
-
return; // Ignore message
|
|
4908
|
+
return false; // Ignore message
|
|
4909
4909
|
}
|
|
4910
4910
|
// Verify also that the message is based on the exact same set of realms
|
|
4911
4911
|
const ourRealmSetHash = yield Dexie.waitFor(
|
|
@@ -4917,7 +4917,7 @@ function MessagesFromServerConsumer(db) {
|
|
|
4917
4917
|
triggerSync(db, 'pull');
|
|
4918
4918
|
// The message isn't based on the same realms.
|
|
4919
4919
|
// Trigger a sync instead to resolve all things up.
|
|
4920
|
-
return;
|
|
4920
|
+
return false;
|
|
4921
4921
|
}
|
|
4922
4922
|
// Get clientChanges
|
|
4923
4923
|
let clientChanges = [];
|
|
@@ -4947,9 +4947,17 @@ function MessagesFromServerConsumer(db) {
|
|
|
4947
4947
|
//
|
|
4948
4948
|
console.debug('Updating syncState', syncState);
|
|
4949
4949
|
yield db.$syncState.put(syncState, 'syncState');
|
|
4950
|
+
return true;
|
|
4950
4951
|
}));
|
|
4951
4952
|
console.debug('msg queue: done with rw transaction');
|
|
4953
|
+
// Trigger eager blob download for any BlobRefs received via WebSocket.
|
|
4954
|
+
// This mirrors the behavior after normal HTTP sync (syncCompleteEvent).
|
|
4955
|
+
// Only emit if changes were actually applied (not on early returns).
|
|
4956
|
+
if (didApplyChanges && msg.changes.length > 0) {
|
|
4957
|
+
db.syncCompleteEvent.next();
|
|
4958
|
+
}
|
|
4952
4959
|
break;
|
|
4960
|
+
}
|
|
4953
4961
|
}
|
|
4954
4962
|
}
|
|
4955
4963
|
catch (error) {
|
|
@@ -5920,7 +5928,7 @@ function createBlobResolveMiddleware(db) {
|
|
|
5920
5928
|
return {
|
|
5921
5929
|
stack: 'dbcore',
|
|
5922
5930
|
name: 'blobResolve',
|
|
5923
|
-
level:
|
|
5931
|
+
level: 2, // Run above cache (0) and other middlewares (1) to resolve BlobRefs from cached data
|
|
5924
5932
|
create(downlevelDatabase) {
|
|
5925
5933
|
// Create a single queue instance for this database
|
|
5926
5934
|
const blobSavingQueue = new BlobSavingQueue(db);
|
|
@@ -8265,7 +8273,7 @@ function dexieCloud(dexie) {
|
|
|
8265
8273
|
const downloading$ = createDownloadingState();
|
|
8266
8274
|
dexie.cloud = {
|
|
8267
8275
|
// @ts-ignore
|
|
8268
|
-
version: "4.4.
|
|
8276
|
+
version: "4.4.2",
|
|
8269
8277
|
options: Object.assign({}, DEFAULT_OPTIONS),
|
|
8270
8278
|
schema: null,
|
|
8271
8279
|
get currentUserId() {
|
|
@@ -8294,14 +8302,17 @@ function dexieCloud(dexie) {
|
|
|
8294
8302
|
roles: getGlobalRolesObservable(dexie),
|
|
8295
8303
|
configure(options) {
|
|
8296
8304
|
// Validate maxStringLength — Infinity disables offloading, otherwise must be
|
|
8297
|
-
// a finite
|
|
8305
|
+
// a finite number between 100 and the server limit (32768).
|
|
8306
|
+
// Minimum 100 prevents accidental offloading of primary keys and short strings
|
|
8307
|
+
// that would break sync.
|
|
8308
|
+
const MIN_STRING_LENGTH = 100;
|
|
8298
8309
|
const MAX_SERVER_STRING_LENGTH = 32768;
|
|
8299
8310
|
if (options.maxStringLength !== undefined &&
|
|
8300
8311
|
options.maxStringLength !== Infinity &&
|
|
8301
8312
|
(!Number.isFinite(options.maxStringLength) ||
|
|
8302
|
-
options.maxStringLength <
|
|
8313
|
+
options.maxStringLength < MIN_STRING_LENGTH ||
|
|
8303
8314
|
options.maxStringLength > MAX_SERVER_STRING_LENGTH)) {
|
|
8304
|
-
throw new Error(`maxStringLength must be Infinity or a finite number in [
|
|
8315
|
+
throw new Error(`maxStringLength must be Infinity or a finite number in [${MIN_STRING_LENGTH}, ${MAX_SERVER_STRING_LENGTH}]. Got: ${options.maxStringLength}`);
|
|
8305
8316
|
}
|
|
8306
8317
|
options = dexie.cloud.options = Object.assign(Object.assign({}, dexie.cloud.options), options);
|
|
8307
8318
|
configuredProgramatically = true;
|
|
@@ -8689,7 +8700,7 @@ function dexieCloud(dexie) {
|
|
|
8689
8700
|
}
|
|
8690
8701
|
}
|
|
8691
8702
|
// @ts-ignore
|
|
8692
|
-
dexieCloud.version = "4.4.
|
|
8703
|
+
dexieCloud.version = "4.4.2";
|
|
8693
8704
|
Dexie.Cloud = dexieCloud;
|
|
8694
8705
|
|
|
8695
8706
|
export { dexieCloud as default, defineYDocTrigger, dexieCloud, getTiedObjectId, getTiedRealmId, resolveText };
|