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.
Files changed (138) hide show
  1. package/copydts.sh +5 -0
  2. package/dist/modern/dexie-cloud-addon.js +5954 -0
  3. package/dist/modern/dexie-cloud-addon.js.map +1 -0
  4. package/dist/modern/dexie-cloud-addon.min.js +1 -0
  5. package/dist/modern/dexie-cloud-addon.min.js.map +1 -0
  6. package/dist/modern/service-worker.js +6054 -0
  7. package/dist/modern/service-worker.js.map +1 -0
  8. package/dist/modern/service-worker.min.js +1 -0
  9. package/dist/modern/service-worker.min.js.map +1 -0
  10. package/dist/module-es5/dexie-cloud-addon.js +6908 -0
  11. package/dist/module-es5/dexie-cloud-addon.js.map +1 -0
  12. package/dist/module-es5/dexie-cloud-addon.min.js +1 -0
  13. package/dist/module-es5/dexie-cloud-addon.min.js.map +1 -0
  14. package/dist/types/DISABLE_SERVICEWORKER_STRATEGY.d.ts +1 -0
  15. package/dist/types/DXCWebSocketStatus.d.ts +1 -0
  16. package/dist/types/DexieCloudOptions.d.ts +19 -0
  17. package/dist/types/DexieCloudServerState.d.ts +5 -0
  18. package/dist/types/TSON.d.ts +17 -0
  19. package/dist/types/WSObservable.d.ts +62 -0
  20. package/dist/types/WebSocketStatus.d.ts +1 -0
  21. package/dist/types/authentication/AuthPersistedContext.d.ts +9 -0
  22. package/dist/types/authentication/TokenExpiredError.d.ts +3 -0
  23. package/dist/types/authentication/UNAUTHORIZED_USER.d.ts +2 -0
  24. package/dist/types/authentication/authenticate.d.ts +20 -0
  25. package/dist/types/authentication/currentUserObservable.d.ts +1 -0
  26. package/dist/types/authentication/interactWithUser.d.ts +18 -0
  27. package/dist/types/authentication/login.d.ts +6 -0
  28. package/dist/types/authentication/otpFetchTokenCallback.d.ts +3 -0
  29. package/dist/types/authentication/setCurrentUser.d.ts +14 -0
  30. package/dist/types/computeSyncState.d.ts +4 -0
  31. package/dist/types/db/DexieCloudDB.d.ts +58 -0
  32. package/dist/types/db/entities/BaseRevisionMapEntry.d.ts +5 -0
  33. package/dist/types/db/entities/EntityCommon.d.ts +4 -0
  34. package/dist/types/db/entities/GuardedJob.d.ts +5 -0
  35. package/dist/types/db/entities/Member.d.ts +19 -0
  36. package/dist/types/db/entities/PersistedSyncState.d.ts +14 -0
  37. package/dist/types/db/entities/Realm.d.ts +16 -0
  38. package/dist/types/db/entities/Role.d.ts +11 -0
  39. package/dist/types/db/entities/UserLogin.d.ts +18 -0
  40. package/dist/types/default-ui/Dialog.d.ts +4 -0
  41. package/dist/types/default-ui/LoginDialog.d.ts +6 -0
  42. package/dist/types/default-ui/Styles.d.ts +3 -0
  43. package/dist/types/default-ui/index.d.ts +24 -0
  44. package/dist/types/dexie-cloud-client.d.ts +8 -0
  45. package/dist/types/errors/HttpError.d.ts +5 -0
  46. package/dist/types/extend-dexie-interface.d.ts +59 -0
  47. package/dist/types/helpers/BroadcastedAndLocalEvent.d.ts +8 -0
  48. package/dist/types/helpers/BroadcastedLocalEvent.d.ts +8 -0
  49. package/dist/types/helpers/CancelToken.d.ts +4 -0
  50. package/dist/types/helpers/IS_SERVICE_WORKER.d.ts +1 -0
  51. package/dist/types/helpers/SWBroadcastChannel.d.ts +6 -0
  52. package/dist/types/helpers/allSettled.d.ts +1 -0
  53. package/dist/types/helpers/bulkUpdate.d.ts +4 -0
  54. package/dist/types/helpers/computeRealmSetHash.d.ts +2 -0
  55. package/dist/types/helpers/date-constants.d.ts +5 -0
  56. package/dist/types/helpers/dbOnClosed.d.ts +2 -0
  57. package/dist/types/helpers/getMutationTable.d.ts +1 -0
  58. package/dist/types/helpers/getSyncableTables.d.ts +4 -0
  59. package/dist/types/helpers/getTableFromMutationTable.d.ts +1 -0
  60. package/dist/types/helpers/makeArray.d.ts +1 -0
  61. package/dist/types/helpers/randomString.d.ts +1 -0
  62. package/dist/types/helpers/resolveText.d.ts +2 -0
  63. package/dist/types/helpers/throwVersionIncrementNeeded.d.ts +1 -0
  64. package/dist/types/helpers/visibilityState.d.ts +1 -0
  65. package/dist/types/helpers/visibleState.d.ts +1 -0
  66. package/dist/types/isFirefox.d.ts +1 -0
  67. package/dist/types/isSafari.d.ts +2 -0
  68. package/dist/types/middleware-helpers/guardedTable.d.ts +11 -0
  69. package/dist/types/middlewares/createIdGenerationMiddleware.d.ts +8 -0
  70. package/dist/types/middlewares/createImplicitPropSetterMiddleware.d.ts +3 -0
  71. package/dist/types/middlewares/createMutationTrackingMiddleware.d.ts +17 -0
  72. package/dist/types/middlewares/outstandingTransaction.d.ts +4 -0
  73. package/dist/types/overrideParseStoresSpec.d.ts +4 -0
  74. package/dist/types/performInitialSync.d.ts +4 -0
  75. package/dist/types/service-worker.d.ts +1 -0
  76. package/dist/types/sync/LocalSyncWorker.d.ts +7 -0
  77. package/dist/types/sync/SyncRequiredError.d.ts +3 -0
  78. package/dist/types/sync/connectWebSocket.d.ts +2 -0
  79. package/dist/types/sync/extractRealm.d.ts +2 -0
  80. package/dist/types/sync/getLatestRevisionsPerTable.d.ts +6 -0
  81. package/dist/types/sync/getTablesToSyncify.d.ts +3 -0
  82. package/dist/types/sync/isOnline.d.ts +1 -0
  83. package/dist/types/sync/isSyncNeeded.d.ts +2 -0
  84. package/dist/types/sync/listClientChanges.d.ts +9 -0
  85. package/dist/types/sync/listSyncifiedChanges.d.ts +5 -0
  86. package/dist/types/sync/messageConsumerIsReady.d.ts +2 -0
  87. package/dist/types/sync/messagesFromServerQueue.d.ts +8 -0
  88. package/dist/types/sync/modifyLocalObjectsWithNewUserId.d.ts +4 -0
  89. package/dist/types/sync/myId.d.ts +1 -0
  90. package/dist/types/sync/numUnsyncedMutations.d.ts +2 -0
  91. package/dist/types/sync/old_startSyncingClientChanges.d.ts +39 -0
  92. package/dist/types/sync/performGuardedJob.d.ts +4 -0
  93. package/dist/types/sync/registerSyncEvent.d.ts +3 -0
  94. package/dist/types/sync/sync.d.ts +17 -0
  95. package/dist/types/sync/syncIfPossible.d.ts +5 -0
  96. package/dist/types/sync/syncServerToClientOnly.d.ts +3 -0
  97. package/dist/types/sync/syncWithServer.d.ts +5 -0
  98. package/dist/types/sync/triggerSync.d.ts +2 -0
  99. package/dist/types/sync/updateBaseRevs.d.ts +5 -0
  100. package/dist/types/types/CloudConnectionStatus.d.ts +0 -0
  101. package/dist/types/types/ConnectionStatus.d.ts +0 -0
  102. package/dist/types/types/DXCAlert.d.ts +25 -0
  103. package/dist/types/types/DXCInputField.d.ts +11 -0
  104. package/dist/types/types/DXCUserInteraction.d.ts +55 -0
  105. package/dist/types/types/LoginState.d.ts +41 -0
  106. package/dist/types/types/SWMessageEvent.d.ts +3 -0
  107. package/dist/types/types/SWSyncEvent.d.ts +4 -0
  108. package/dist/types/types/SyncConnectionStatus.d.ts +1 -0
  109. package/dist/types/types/SyncFlowStatus.d.ts +6 -0
  110. package/dist/types/types/SyncState.d.ts +8 -0
  111. package/dist/types/types/SyncStatus.d.ts +6 -0
  112. package/dist/types/types/TXExpandos.d.ts +10 -0
  113. package/dist/types/updateSchemaFromOptions.d.ts +3 -0
  114. package/dist/types/userIsActive.d.ts +7 -0
  115. package/dist/types/verifyConfig.d.ts +2 -0
  116. package/dist/types/verifySchema.d.ts +2 -0
  117. package/dist/umd/dexie-cloud-addon.js +6919 -0
  118. package/dist/umd/dexie-cloud-addon.js.map +1 -0
  119. package/dist/umd/dexie-cloud-addon.min.js +1 -0
  120. package/dist/umd/dexie-cloud-addon.min.js.map +1 -0
  121. package/dist/umd/service-worker.js +6063 -0
  122. package/dist/umd/service-worker.js.map +1 -0
  123. package/dist/umd/service-worker.min.js +1 -0
  124. package/dist/umd/service-worker.min.js.map +1 -0
  125. package/dist/umd-modern/dexie-cloud-addon.js +5965 -0
  126. package/dist/umd-modern/dexie-cloud-addon.js.map +1 -0
  127. package/package.json +71 -39
  128. package/dist/dexie-cloud.d.ts +0 -27
  129. package/dist/dexie-cloud.js +0 -285
  130. package/dist/dexie-cloud.js.map +0 -1
  131. package/dist/dexie-cloud.min.js +0 -1
  132. package/dist/dexie-cloud.min.js.map +0 -1
  133. package/dist/dexie-cloud.mjs +0 -273
  134. package/dist/dexie-cloud.mjs.map +0 -1
  135. package/esnext/dexie-cloud.js +0 -278
  136. package/esnext/dexie-cloud.js.map +0 -1
  137. package/esnext/dexie-cloud.min.js +0 -1
  138. 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,2 @@
1
+ import { DexieCloudDB } from "../db/DexieCloudDB";
2
+ export declare function triggerSync(db: DexieCloudDB, purpose: "push" | "pull"): void;
@@ -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,3 @@
1
+ export interface SWMessageEvent extends MessageEvent {
2
+ waitUntil(promise: Promise<any>): void;
3
+ }
@@ -0,0 +1,4 @@
1
+ export declare type SyncEvent = Event & {
2
+ tag: string;
3
+ waitUntil(promise: Promise<any>): void;
4
+ };
@@ -0,0 +1 @@
1
+ export declare type SyncConnectionStatus = "not-started" | "connecting" | "connected" | "disconnected" | "error" | "offline";
@@ -0,0 +1,6 @@
1
+ export declare type SyncPhase = "initial" | "not-in-sync" | "pushing" | "pulling" | "in-sync" | 'error' | 'offline';
2
+ export interface SyncFlowStatus {
3
+ phase: SyncPhase;
4
+ progress?: number;
5
+ error?: Error;
6
+ }
@@ -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,6 @@
1
+ export declare type SyncPhase = "initial" | "not-in-sync" | "pushing" | "pulling" | "in-sync" | 'error' | 'offline';
2
+ export interface SyncStatus {
3
+ phase: SyncPhase;
4
+ progress?: number;
5
+ error?: Error;
6
+ }
@@ -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,3 @@
1
+ import { DexieCloudSchema } from "dexie-cloud-common";
2
+ import { DexieCloudOptions } from "./DexieCloudOptions";
3
+ export declare function updateSchemaFromOptions(schema?: DexieCloudSchema | null, options?: DexieCloudOptions | null): void;
@@ -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 | {}>;
@@ -0,0 +1,2 @@
1
+ import { DexieCloudOptions } from "./DexieCloudOptions";
2
+ export declare function verifyConfig({ databaseUrl }?: DexieCloudOptions): void;
@@ -0,0 +1,2 @@
1
+ import { DexieCloudDB } from "./db/DexieCloudDB";
2
+ export declare function verifySchema(db: DexieCloudDB): void;