dexie-cloud-addon 1.0.0-alpha.6 → 1.0.0-beta.11
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/copydts.sh +5 -0
- package/dist/modern/dexie-cloud-addon.js +5954 -0
- package/dist/modern/dexie-cloud-addon.js.map +1 -0
- package/dist/modern/dexie-cloud-addon.min.js +1 -0
- package/dist/modern/dexie-cloud-addon.min.js.map +1 -0
- package/dist/modern/service-worker.js +6054 -0
- package/dist/modern/service-worker.js.map +1 -0
- package/dist/modern/service-worker.min.js +1 -0
- package/dist/modern/service-worker.min.js.map +1 -0
- package/dist/module-es5/dexie-cloud-addon.js +6908 -0
- package/dist/module-es5/dexie-cloud-addon.js.map +1 -0
- package/dist/module-es5/dexie-cloud-addon.min.js +1 -0
- package/dist/module-es5/dexie-cloud-addon.min.js.map +1 -0
- package/dist/types/DISABLE_SERVICEWORKER_STRATEGY.d.ts +1 -0
- package/dist/types/DXCWebSocketStatus.d.ts +1 -0
- package/dist/types/DexieCloudOptions.d.ts +19 -0
- package/dist/types/DexieCloudServerState.d.ts +5 -0
- package/dist/types/TSON.d.ts +17 -0
- package/dist/types/WSObservable.d.ts +62 -0
- package/dist/types/WebSocketStatus.d.ts +1 -0
- package/dist/types/authentication/AuthPersistedContext.d.ts +9 -0
- package/dist/types/authentication/TokenExpiredError.d.ts +3 -0
- package/dist/types/authentication/UNAUTHORIZED_USER.d.ts +2 -0
- package/dist/types/authentication/authenticate.d.ts +20 -0
- package/dist/types/authentication/currentUserObservable.d.ts +1 -0
- package/dist/types/authentication/interactWithUser.d.ts +18 -0
- package/dist/types/authentication/login.d.ts +6 -0
- package/dist/types/authentication/otpFetchTokenCallback.d.ts +3 -0
- package/dist/types/authentication/setCurrentUser.d.ts +14 -0
- package/dist/types/computeSyncState.d.ts +4 -0
- package/dist/types/db/DexieCloudDB.d.ts +58 -0
- package/dist/types/db/entities/BaseRevisionMapEntry.d.ts +5 -0
- package/dist/types/db/entities/EntityCommon.d.ts +4 -0
- package/dist/types/db/entities/GuardedJob.d.ts +5 -0
- package/dist/types/db/entities/Member.d.ts +19 -0
- package/dist/types/db/entities/PersistedSyncState.d.ts +14 -0
- package/dist/types/db/entities/Realm.d.ts +16 -0
- package/dist/types/db/entities/Role.d.ts +11 -0
- package/dist/types/db/entities/UserLogin.d.ts +18 -0
- package/dist/types/default-ui/Dialog.d.ts +4 -0
- package/dist/types/default-ui/LoginDialog.d.ts +6 -0
- package/dist/types/default-ui/Styles.d.ts +3 -0
- package/dist/types/default-ui/index.d.ts +24 -0
- package/dist/types/dexie-cloud-client.d.ts +8 -0
- package/dist/types/errors/HttpError.d.ts +5 -0
- package/dist/types/extend-dexie-interface.d.ts +59 -0
- package/dist/types/helpers/BroadcastedAndLocalEvent.d.ts +8 -0
- package/dist/types/helpers/BroadcastedLocalEvent.d.ts +8 -0
- package/dist/types/helpers/CancelToken.d.ts +4 -0
- package/dist/types/helpers/IS_SERVICE_WORKER.d.ts +1 -0
- package/dist/types/helpers/SWBroadcastChannel.d.ts +6 -0
- package/dist/types/helpers/allSettled.d.ts +1 -0
- package/dist/types/helpers/bulkUpdate.d.ts +4 -0
- package/dist/types/helpers/computeRealmSetHash.d.ts +2 -0
- package/dist/types/helpers/date-constants.d.ts +5 -0
- package/dist/types/helpers/dbOnClosed.d.ts +2 -0
- package/dist/types/helpers/getMutationTable.d.ts +1 -0
- package/dist/types/helpers/getSyncableTables.d.ts +4 -0
- package/dist/types/helpers/getTableFromMutationTable.d.ts +1 -0
- package/dist/types/helpers/makeArray.d.ts +1 -0
- package/dist/types/helpers/randomString.d.ts +1 -0
- package/dist/types/helpers/resolveText.d.ts +2 -0
- package/dist/types/helpers/throwVersionIncrementNeeded.d.ts +1 -0
- package/dist/types/helpers/visibilityState.d.ts +1 -0
- package/dist/types/helpers/visibleState.d.ts +1 -0
- package/dist/types/isFirefox.d.ts +1 -0
- package/dist/types/isSafari.d.ts +2 -0
- package/dist/types/middleware-helpers/guardedTable.d.ts +11 -0
- package/dist/types/middlewares/createIdGenerationMiddleware.d.ts +8 -0
- package/dist/types/middlewares/createImplicitPropSetterMiddleware.d.ts +3 -0
- package/dist/types/middlewares/createMutationTrackingMiddleware.d.ts +17 -0
- package/dist/types/middlewares/outstandingTransaction.d.ts +4 -0
- package/dist/types/overrideParseStoresSpec.d.ts +4 -0
- package/dist/types/performInitialSync.d.ts +4 -0
- package/dist/types/service-worker.d.ts +1 -0
- package/dist/types/sync/LocalSyncWorker.d.ts +7 -0
- package/dist/types/sync/SyncRequiredError.d.ts +3 -0
- package/dist/types/sync/connectWebSocket.d.ts +2 -0
- package/dist/types/sync/extractRealm.d.ts +2 -0
- package/dist/types/sync/getLatestRevisionsPerTable.d.ts +6 -0
- package/dist/types/sync/getTablesToSyncify.d.ts +3 -0
- package/dist/types/sync/isOnline.d.ts +1 -0
- package/dist/types/sync/isSyncNeeded.d.ts +2 -0
- package/dist/types/sync/listClientChanges.d.ts +9 -0
- package/dist/types/sync/listSyncifiedChanges.d.ts +5 -0
- package/dist/types/sync/messageConsumerIsReady.d.ts +2 -0
- package/dist/types/sync/messagesFromServerQueue.d.ts +8 -0
- package/dist/types/sync/modifyLocalObjectsWithNewUserId.d.ts +4 -0
- package/dist/types/sync/myId.d.ts +1 -0
- package/dist/types/sync/numUnsyncedMutations.d.ts +2 -0
- package/dist/types/sync/old_startSyncingClientChanges.d.ts +39 -0
- package/dist/types/sync/performGuardedJob.d.ts +4 -0
- package/dist/types/sync/registerSyncEvent.d.ts +3 -0
- package/dist/types/sync/sync.d.ts +17 -0
- package/dist/types/sync/syncIfPossible.d.ts +5 -0
- package/dist/types/sync/syncServerToClientOnly.d.ts +3 -0
- package/dist/types/sync/syncWithServer.d.ts +5 -0
- package/dist/types/sync/triggerSync.d.ts +2 -0
- package/dist/types/sync/updateBaseRevs.d.ts +5 -0
- package/dist/types/types/CloudConnectionStatus.d.ts +0 -0
- package/dist/types/types/ConnectionStatus.d.ts +0 -0
- package/dist/types/types/DXCAlert.d.ts +25 -0
- package/dist/types/types/DXCInputField.d.ts +11 -0
- package/dist/types/types/DXCUserInteraction.d.ts +55 -0
- package/dist/types/types/LoginState.d.ts +41 -0
- package/dist/types/types/SWMessageEvent.d.ts +3 -0
- package/dist/types/types/SWSyncEvent.d.ts +4 -0
- package/dist/types/types/SyncConnectionStatus.d.ts +1 -0
- package/dist/types/types/SyncFlowStatus.d.ts +6 -0
- package/dist/types/types/SyncState.d.ts +8 -0
- package/dist/types/types/SyncStatus.d.ts +6 -0
- package/dist/types/types/TXExpandos.d.ts +10 -0
- package/dist/types/updateSchemaFromOptions.d.ts +3 -0
- package/dist/types/userIsActive.d.ts +7 -0
- package/dist/types/verifyConfig.d.ts +2 -0
- package/dist/types/verifySchema.d.ts +2 -0
- package/dist/umd/dexie-cloud-addon.js +6919 -0
- package/dist/umd/dexie-cloud-addon.js.map +1 -0
- package/dist/umd/dexie-cloud-addon.min.js +1 -0
- package/dist/umd/dexie-cloud-addon.min.js.map +1 -0
- package/dist/umd/service-worker.js +6063 -0
- package/dist/umd/service-worker.js.map +1 -0
- package/dist/umd/service-worker.min.js +1 -0
- package/dist/umd/service-worker.min.js.map +1 -0
- package/dist/umd-modern/dexie-cloud-addon.js +5965 -0
- package/dist/umd-modern/dexie-cloud-addon.js.map +1 -0
- package/package.json +71 -39
- package/dist/dexie-cloud.d.ts +0 -27
- package/dist/dexie-cloud.js +0 -285
- package/dist/dexie-cloud.js.map +0 -1
- package/dist/dexie-cloud.min.js +0 -1
- package/dist/dexie-cloud.min.js.map +0 -1
- package/dist/dexie-cloud.mjs +0 -273
- package/dist/dexie-cloud.mjs.map +0 -1
- package/esnext/dexie-cloud.js +0 -278
- package/esnext/dexie-cloud.js.map +0 -1
- package/esnext/dexie-cloud.min.js +0 -1
- package/esnext/dexie-cloud.min.js.map +0 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { DexieCloudDB } from '../db/DexieCloudDB';
|
|
2
|
+
import { SyncOptions } from './sync';
|
|
3
|
+
import { DexieCloudOptions } from '../DexieCloudOptions';
|
|
4
|
+
import { DexieCloudSchema } from 'dexie-cloud-common';
|
|
5
|
+
export declare function syncIfPossible(db: DexieCloudDB, cloudOptions: DexieCloudOptions, cloudSchema: DexieCloudSchema, options?: SyncOptions): any;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { DexieCloudDB } from '../db/DexieCloudDB';
|
|
2
|
+
import { ChangesFromServerMessage } from '../WSObservable';
|
|
3
|
+
export declare function syncServerToClientOnly(db: DexieCloudDB, { baseRev, newRev, changes, realmSetHash }: ChangesFromServerMessage): import("rxjs").Observable<void>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { DexieCloudDB } from '../db/DexieCloudDB';
|
|
2
|
+
import { PersistedSyncState } from '../db/entities/PersistedSyncState';
|
|
3
|
+
import { BaseRevisionMapEntry } from '../db/entities/BaseRevisionMapEntry';
|
|
4
|
+
import { DBOperationsSet, DexieCloudSchema, SyncResponse } from 'dexie-cloud-common';
|
|
5
|
+
export declare function syncWithServer(changes: DBOperationsSet, syncState: PersistedSyncState | undefined, baseRevs: BaseRevisionMapEntry[], db: DexieCloudDB, databaseUrl: string, schema: DexieCloudSchema | null, clientIdentity: string): Promise<SyncResponse>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { DexieCloudDB } from '../db/DexieCloudDB';
|
|
2
|
+
import { DexieCloudSchema } from 'dexie-cloud-common';
|
|
3
|
+
export declare function updateBaseRevs(db: DexieCloudDB, schema: DexieCloudSchema, latestRevisions: {
|
|
4
|
+
[table: string]: number;
|
|
5
|
+
}, serverRev: any): Promise<void>;
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare type DXCAlert = DXCErrorAlert | DXCWarningAlert | DXCInfoAlert;
|
|
2
|
+
export interface DXCErrorAlert {
|
|
3
|
+
type: 'error';
|
|
4
|
+
messageCode: 'INVALID_OTP' | 'INVALID_EMAIL' | 'LICENSE_LIMIT_REACHED' | 'GENERIC_ERROR';
|
|
5
|
+
message: string;
|
|
6
|
+
messageParams: {
|
|
7
|
+
[paramName: string]: string;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export interface DXCWarningAlert {
|
|
11
|
+
type: 'warning';
|
|
12
|
+
messageCode: 'GENERIC_WARNING';
|
|
13
|
+
message: string;
|
|
14
|
+
messageParams: {
|
|
15
|
+
[paramName: string]: string;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export interface DXCInfoAlert {
|
|
19
|
+
type: 'info';
|
|
20
|
+
messageCode: 'GENERIC_INFO' | 'OTP_SENT';
|
|
21
|
+
message: string;
|
|
22
|
+
messageParams: {
|
|
23
|
+
[paramName: string]: string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare type DXCInputField = DXCTextField | DXCPasswordField;
|
|
2
|
+
export interface DXCTextField {
|
|
3
|
+
type: 'text' | 'email' | 'otp';
|
|
4
|
+
label?: string;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface DXCPasswordField {
|
|
8
|
+
type: 'password';
|
|
9
|
+
label?: string;
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { DXCAlert } from './DXCAlert';
|
|
2
|
+
import { DXCInputField } from './DXCInputField';
|
|
3
|
+
export declare type DXCUserInteraction = DXCGenericUserInteraction | DXCEmailPrompt | DXCOTPPrompt | DXCMessageAlert;
|
|
4
|
+
export interface DXCGenericUserInteraction<Type extends string = "generic", TFields extends {
|
|
5
|
+
[name: string]: DXCInputField;
|
|
6
|
+
} = any> {
|
|
7
|
+
type: Type;
|
|
8
|
+
title: string;
|
|
9
|
+
alerts: DXCAlert[];
|
|
10
|
+
fields: TFields;
|
|
11
|
+
onSubmit: (params: {
|
|
12
|
+
[P in keyof TFields]: string;
|
|
13
|
+
}) => void;
|
|
14
|
+
onCancel: () => void;
|
|
15
|
+
}
|
|
16
|
+
export interface DXCEmailPrompt {
|
|
17
|
+
type: 'email';
|
|
18
|
+
title: string;
|
|
19
|
+
alerts: DXCAlert[];
|
|
20
|
+
fields: {
|
|
21
|
+
email: {
|
|
22
|
+
type: 'text';
|
|
23
|
+
placeholder: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
onSubmit: (params: {
|
|
27
|
+
email: string;
|
|
28
|
+
}) => void;
|
|
29
|
+
onCancel: () => void;
|
|
30
|
+
}
|
|
31
|
+
export interface DXCOTPPrompt {
|
|
32
|
+
type: 'otp';
|
|
33
|
+
title: string;
|
|
34
|
+
alerts: DXCAlert[];
|
|
35
|
+
fields: {
|
|
36
|
+
otp: {
|
|
37
|
+
type: 'text';
|
|
38
|
+
label: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
onSubmit: (params: {
|
|
42
|
+
otp: string;
|
|
43
|
+
}) => void;
|
|
44
|
+
onCancel: () => void;
|
|
45
|
+
}
|
|
46
|
+
export interface DXCMessageAlert {
|
|
47
|
+
type: 'message-alert';
|
|
48
|
+
title: string;
|
|
49
|
+
alerts: DXCAlert[];
|
|
50
|
+
fields: {};
|
|
51
|
+
onSubmit: (params: {
|
|
52
|
+
[paramName: string]: string;
|
|
53
|
+
}) => void;
|
|
54
|
+
onCancel: () => void;
|
|
55
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export declare type LoginState = LoginStateSilent | LoginStateInteraction | LoginStateError;
|
|
2
|
+
export interface LoginStateSilent {
|
|
3
|
+
type: 'silent';
|
|
4
|
+
}
|
|
5
|
+
export declare type LoginStateInteraction = (Alert | EmailRequested | OTPRequested) & {
|
|
6
|
+
type: 'interaction';
|
|
7
|
+
alerts?: {
|
|
8
|
+
type: 'error' | 'warning' | 'info';
|
|
9
|
+
message: string;
|
|
10
|
+
}[];
|
|
11
|
+
isWorking?: boolean;
|
|
12
|
+
onSubmit: (params: LoginPromptReply) => void;
|
|
13
|
+
onCancel: () => void;
|
|
14
|
+
};
|
|
15
|
+
export declare type LoginPromptReply = {
|
|
16
|
+
email?: string;
|
|
17
|
+
otp?: string;
|
|
18
|
+
name?: string;
|
|
19
|
+
};
|
|
20
|
+
export interface LoginStateError {
|
|
21
|
+
type: 'error';
|
|
22
|
+
message: string;
|
|
23
|
+
}
|
|
24
|
+
interface Alert {
|
|
25
|
+
interactionType: 'alert';
|
|
26
|
+
alerts: {
|
|
27
|
+
type: 'error' | 'warning' | 'info';
|
|
28
|
+
message: string;
|
|
29
|
+
}[];
|
|
30
|
+
submitText: 'OK';
|
|
31
|
+
}
|
|
32
|
+
interface EmailRequested {
|
|
33
|
+
interactionType: 'emailRequested';
|
|
34
|
+
submitText: 'Send OTP';
|
|
35
|
+
}
|
|
36
|
+
interface OTPRequested {
|
|
37
|
+
interactionType: 'otpRequested';
|
|
38
|
+
isWorking: boolean;
|
|
39
|
+
submitText: 'Login';
|
|
40
|
+
}
|
|
41
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare type SyncConnectionStatus = "not-started" | "connecting" | "connected" | "disconnected" | "error" | "offline";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare type SyncStatePhase = "initial" | "not-in-sync" | "pushing" | "pulling" | "in-sync" | 'error' | 'offline';
|
|
2
|
+
export declare type SyncStatus = "not-started" | "connecting" | "connected" | "disconnected" | "error" | "offline";
|
|
3
|
+
export interface SyncState {
|
|
4
|
+
status: SyncStatus;
|
|
5
|
+
phase: SyncStatePhase;
|
|
6
|
+
progress?: number;
|
|
7
|
+
error?: Error;
|
|
8
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DexieCloudSchema } from "dexie-cloud-common";
|
|
2
|
+
import { UserLogin } from '../db/entities/UserLogin';
|
|
3
|
+
export interface TXExpandos {
|
|
4
|
+
txid: string;
|
|
5
|
+
currentUser: UserLogin;
|
|
6
|
+
schema: DexieCloudSchema;
|
|
7
|
+
disableChangeTracking?: boolean;
|
|
8
|
+
disableAccessControl?: boolean;
|
|
9
|
+
mutationsAdded?: boolean;
|
|
10
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BehaviorSubject } from 'rxjs';
|
|
2
|
+
export declare const userIsActive: BehaviorSubject<boolean>;
|
|
3
|
+
export declare const userIsReallyActive: BehaviorSubject<boolean>;
|
|
4
|
+
export declare const visibilityStateIsChanged: import("rxjs").Observable<{}>;
|
|
5
|
+
export declare const documentBecomesHidden: import("rxjs").Observable<{}>;
|
|
6
|
+
export declare const documentBecomesVisible: import("rxjs").Observable<{}>;
|
|
7
|
+
export declare const userDoesSomething: import("rxjs").Observable<Event | {}>;
|