dexie-cloud-addon 4.2.3 → 4.2.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 (152) hide show
  1. package/dexie-cloud-import.json +2 -1
  2. package/dist/modern/dexie-cloud-addon.js +146 -168
  3. package/dist/modern/dexie-cloud-addon.js.map +1 -1
  4. package/dist/modern/dexie-cloud-addon.min.js +1 -1
  5. package/dist/modern/dexie-cloud-addon.min.js.map +1 -1
  6. package/dist/modern/service-worker.js +146 -168
  7. package/dist/modern/service-worker.js.map +1 -1
  8. package/dist/modern/service-worker.min.js +1 -1
  9. package/dist/modern/service-worker.min.js.map +1 -1
  10. package/dist/umd/dexie-cloud-addon.js +1623 -2458
  11. package/dist/umd/dexie-cloud-addon.js.map +1 -1
  12. package/dist/umd/dexie-cloud-addon.min.js +1 -1
  13. package/dist/umd/dexie-cloud-addon.min.js.map +1 -1
  14. package/dist/umd/service-worker.js +2003 -2838
  15. package/dist/umd/service-worker.js.map +1 -1
  16. package/dist/umd/service-worker.min.js +1 -1
  17. package/dist/umd/service-worker.min.js.map +1 -1
  18. package/package.json +14 -11
  19. package/dist/umd/DISABLE_SERVICEWORKER_STRATEGY.d.ts +0 -1
  20. package/dist/umd/DXCWebSocketStatus.d.ts +0 -1
  21. package/dist/umd/DexieCloudAPI.d.ts +0 -75
  22. package/dist/umd/DexieCloudOptions.d.ts +0 -27
  23. package/dist/umd/DexieCloudSyncOptions.d.ts +0 -4
  24. package/dist/umd/DexieCloudTable.d.ts +0 -18
  25. package/dist/umd/InvalidLicenseError.d.ts +0 -5
  26. package/dist/umd/Invite.d.ts +0 -8
  27. package/dist/umd/PermissionChecker.d.ts +0 -15
  28. package/dist/umd/TSON.d.ts +0 -17
  29. package/dist/umd/WSObservable.d.ts +0 -72
  30. package/dist/umd/associate.d.ts +0 -1
  31. package/dist/umd/authentication/AuthPersistedContext.d.ts +0 -9
  32. package/dist/umd/authentication/TokenErrorResponseError.d.ts +0 -10
  33. package/dist/umd/authentication/TokenExpiredError.d.ts +0 -3
  34. package/dist/umd/authentication/UNAUTHORIZED_USER.d.ts +0 -2
  35. package/dist/umd/authentication/authenticate.d.ts +0 -13
  36. package/dist/umd/authentication/currentUserObservable.d.ts +0 -1
  37. package/dist/umd/authentication/interactWithUser.d.ts +0 -21
  38. package/dist/umd/authentication/login.d.ts +0 -3
  39. package/dist/umd/authentication/logout.d.ts +0 -5
  40. package/dist/umd/authentication/otpFetchTokenCallback.d.ts +0 -3
  41. package/dist/umd/authentication/setCurrentUser.d.ts +0 -14
  42. package/dist/umd/authentication/waitUntil.d.ts +0 -3
  43. package/dist/umd/computeSyncState.d.ts +0 -4
  44. package/dist/umd/createSharedValueObservable.d.ts +0 -3
  45. package/dist/umd/currentUserEmitter.d.ts +0 -3
  46. package/dist/umd/db/DexieCloudDB.d.ts +0 -61
  47. package/dist/umd/db/entities/BaseRevisionMapEntry.d.ts +0 -5
  48. package/dist/umd/db/entities/EntityCommon.d.ts +0 -5
  49. package/dist/umd/db/entities/GuardedJob.d.ts +0 -5
  50. package/dist/umd/db/entities/Member.d.ts +0 -19
  51. package/dist/umd/db/entities/PersistedSyncState.d.ts +0 -22
  52. package/dist/umd/db/entities/Realm.d.ts +0 -14
  53. package/dist/umd/db/entities/Role.d.ts +0 -11
  54. package/dist/umd/db/entities/UserLogin.d.ts +0 -23
  55. package/dist/umd/default-ui/Dialog.d.ts +0 -5
  56. package/dist/umd/default-ui/LoginDialog.d.ts +0 -3
  57. package/dist/umd/default-ui/Styles.d.ts +0 -3
  58. package/dist/umd/default-ui/index.d.ts +0 -24
  59. package/dist/umd/define-ydoc-trigger.d.ts +0 -3
  60. package/dist/umd/dexie-cloud-addon.d.ts +0 -3
  61. package/dist/umd/dexie-cloud-client.d.ts +0 -23
  62. package/dist/umd/errors/HttpError.d.ts +0 -5
  63. package/dist/umd/extend-dexie-interface.d.ts +0 -23
  64. package/dist/umd/getGlobalRolesObservable.d.ts +0 -5
  65. package/dist/umd/getInternalAccessControlObservable.d.ts +0 -12
  66. package/dist/umd/getInvitesObservable.d.ts +0 -23
  67. package/dist/umd/getPermissionsLookupObservable.d.ts +0 -16
  68. package/dist/umd/getTiedRealmId.d.ts +0 -2
  69. package/dist/umd/helpers/BroadcastedAndLocalEvent.d.ts +0 -8
  70. package/dist/umd/helpers/CancelToken.d.ts +0 -4
  71. package/dist/umd/helpers/IS_SERVICE_WORKER.d.ts +0 -1
  72. package/dist/umd/helpers/SWBroadcastChannel.d.ts +0 -12
  73. package/dist/umd/helpers/allSettled.d.ts +0 -1
  74. package/dist/umd/helpers/bulkUpdate.d.ts +0 -4
  75. package/dist/umd/helpers/computeRealmSetHash.d.ts +0 -2
  76. package/dist/umd/helpers/date-constants.d.ts +0 -5
  77. package/dist/umd/helpers/flatten.d.ts +0 -1
  78. package/dist/umd/helpers/getMutationTable.d.ts +0 -1
  79. package/dist/umd/helpers/getSyncableTables.d.ts +0 -4
  80. package/dist/umd/helpers/getTableFromMutationTable.d.ts +0 -1
  81. package/dist/umd/helpers/makeArray.d.ts +0 -1
  82. package/dist/umd/helpers/randomString.d.ts +0 -1
  83. package/dist/umd/helpers/resolveText.d.ts +0 -16
  84. package/dist/umd/helpers/throwVersionIncrementNeeded.d.ts +0 -1
  85. package/dist/umd/helpers/visibilityState.d.ts +0 -1
  86. package/dist/umd/isEagerSyncDisabled.d.ts +0 -2
  87. package/dist/umd/isFirefox.d.ts +0 -1
  88. package/dist/umd/isSafari.d.ts +0 -2
  89. package/dist/umd/mapValueObservable.d.ts +0 -5
  90. package/dist/umd/mergePermissions.d.ts +0 -2
  91. package/dist/umd/middleware-helpers/guardedTable.d.ts +0 -11
  92. package/dist/umd/middleware-helpers/idGenerationHelpers.d.ts +0 -18
  93. package/dist/umd/middlewares/createIdGenerationMiddleware.d.ts +0 -3
  94. package/dist/umd/middlewares/createImplicitPropSetterMiddleware.d.ts +0 -3
  95. package/dist/umd/middlewares/createMutationTrackingMiddleware.d.ts +0 -17
  96. package/dist/umd/middlewares/outstandingTransaction.d.ts +0 -4
  97. package/dist/umd/overrideParseStoresSpec.d.ts +0 -4
  98. package/dist/umd/performInitialSync.d.ts +0 -4
  99. package/dist/umd/permissions.d.ts +0 -9
  100. package/dist/umd/prodLog.d.ts +0 -9
  101. package/dist/umd/service-worker.d.ts +0 -1
  102. package/dist/umd/sync/DEXIE_CLOUD_SYNCER_ID.d.ts +0 -1
  103. package/dist/umd/sync/LocalSyncWorker.d.ts +0 -7
  104. package/dist/umd/sync/SyncRequiredError.d.ts +0 -3
  105. package/dist/umd/sync/applyServerChanges.d.ts +0 -3
  106. package/dist/umd/sync/connectWebSocket.d.ts +0 -2
  107. package/dist/umd/sync/encodeIdsForServer.d.ts +0 -4
  108. package/dist/umd/sync/extractRealm.d.ts +0 -2
  109. package/dist/umd/sync/getLatestRevisionsPerTable.d.ts +0 -6
  110. package/dist/umd/sync/getTablesToSyncify.d.ts +0 -3
  111. package/dist/umd/sync/isOnline.d.ts +0 -1
  112. package/dist/umd/sync/isSyncNeeded.d.ts +0 -2
  113. package/dist/umd/sync/listClientChanges.d.ts +0 -9
  114. package/dist/umd/sync/listSyncifiedChanges.d.ts +0 -5
  115. package/dist/umd/sync/messageConsumerIsReady.d.ts +0 -2
  116. package/dist/umd/sync/messagesFromServerQueue.d.ts +0 -8
  117. package/dist/umd/sync/modifyLocalObjectsWithNewUserId.d.ts +0 -4
  118. package/dist/umd/sync/myId.d.ts +0 -1
  119. package/dist/umd/sync/numUnsyncedMutations.d.ts +0 -2
  120. package/dist/umd/sync/old_startSyncingClientChanges.d.ts +0 -39
  121. package/dist/umd/sync/performGuardedJob.d.ts +0 -2
  122. package/dist/umd/sync/ratelimit.d.ts +0 -3
  123. package/dist/umd/sync/registerSyncEvent.d.ts +0 -3
  124. package/dist/umd/sync/sync.d.ts +0 -15
  125. package/dist/umd/sync/syncIfPossible.d.ts +0 -5
  126. package/dist/umd/sync/syncWithServer.d.ts +0 -6
  127. package/dist/umd/sync/triggerSync.d.ts +0 -2
  128. package/dist/umd/sync/updateBaseRevs.d.ts +0 -5
  129. package/dist/umd/types/DXCAlert.d.ts +0 -25
  130. package/dist/umd/types/DXCInputField.d.ts +0 -11
  131. package/dist/umd/types/DXCUserInteraction.d.ts +0 -93
  132. package/dist/umd/types/NewIdOptions.d.ts +0 -3
  133. package/dist/umd/types/SWMessageEvent.d.ts +0 -3
  134. package/dist/umd/types/SWSyncEvent.d.ts +0 -4
  135. package/dist/umd/types/SyncState.d.ts +0 -9
  136. package/dist/umd/types/TXExpandos.d.ts +0 -11
  137. package/dist/umd/updateSchemaFromOptions.d.ts +0 -3
  138. package/dist/umd/userIsActive.d.ts +0 -7
  139. package/dist/umd/verifyConfig.d.ts +0 -2
  140. package/dist/umd/verifySchema.d.ts +0 -2
  141. package/dist/umd/yjs/YDexieCloudSyncState.d.ts +0 -3
  142. package/dist/umd/yjs/YTable.d.ts +0 -3
  143. package/dist/umd/yjs/applyYMessages.d.ts +0 -9
  144. package/dist/umd/yjs/awareness.d.ts +0 -3
  145. package/dist/umd/yjs/createYClientUpdateObservable.d.ts +0 -4
  146. package/dist/umd/yjs/createYHandler.d.ts +0 -2
  147. package/dist/umd/yjs/downloadYDocsFromServer.d.ts +0 -3
  148. package/dist/umd/yjs/getUpdatesTable.d.ts +0 -3
  149. package/dist/umd/yjs/listUpdatesSince.d.ts +0 -3
  150. package/dist/umd/yjs/listYClientMessagesAndStateVector.d.ts +0 -26
  151. package/dist/umd/yjs/reopenDocSignal.d.ts +0 -10
  152. package/dist/umd/yjs/updateYSyncStates.d.ts +0 -6
@@ -1,3 +0,0 @@
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;
@@ -1,3 +0,0 @@
1
- export declare const Styles: {
2
- [styleAlias: string]: Partial<CSSStyleDeclaration> | any;
3
- };
@@ -1,24 +0,0 @@
1
- import Dexie from "dexie";
2
- import "../extend-dexie-interface";
3
- import { h, Component } from "preact";
4
- import { Subscription } from "rxjs";
5
- import { DXCUserInteraction } from "../types/DXCUserInteraction";
6
- export interface Props {
7
- db: Dexie;
8
- }
9
- interface State {
10
- userInteraction: DXCUserInteraction | undefined;
11
- }
12
- export default class LoginGui extends Component<Props, State> {
13
- subscription?: Subscription;
14
- observer: (userInteraction: DXCUserInteraction | undefined) => void;
15
- constructor(props: Props);
16
- componentDidMount(): void;
17
- componentWillUnmount(): void;
18
- render(props: Props, { userInteraction }: State): h.JSX.Element | null;
19
- }
20
- export declare function setupDefaultGUI(db: Dexie): {
21
- unsubscribe(): void;
22
- readonly closed: boolean;
23
- };
24
- export {};
@@ -1,3 +0,0 @@
1
- import { type Table } from 'dexie';
2
- import type { Doc as YjsDoc } from 'yjs';
3
- export declare function defineYDocTrigger<T, TKey>(table: Table<T, TKey>, prop: keyof T & string, trigger: (ydoc: YjsDoc, parentId: TKey) => any): void;
@@ -1,3 +0,0 @@
1
- import dexieCloudAddon from './dexie-cloud-client';
2
- export * from './dexie-cloud-client';
3
- export default dexieCloudAddon;
@@ -1,23 +0,0 @@
1
- import Dexie from 'dexie';
2
- import './extend-dexie-interface';
3
- import { DexieCloudSyncOptions } from './DexieCloudSyncOptions';
4
- import { SyncState } from './types/SyncState';
5
- import { DXCWebSocketStatus } from './DXCWebSocketStatus';
6
- import { UserLogin } from './db/entities/UserLogin';
7
- export { DexieCloudTable } from './DexieCloudTable';
8
- export * from './getTiedRealmId';
9
- export { DBRealm, DBRealmMember, DBRealmRole, DBSyncedObject, DBPermissionSet, } from 'dexie-cloud-common';
10
- export { resolveText } from './helpers/resolveText';
11
- export { Invite } from './Invite';
12
- export type { UserLogin, DXCWebSocketStatus, SyncState };
13
- export type { DexieCloudSyncOptions };
14
- export type { DexieCloudOptions, PeriodicSyncOptions } from './DexieCloudOptions';
15
- export * from './types/DXCAlert';
16
- export * from './types/DXCInputField';
17
- export * from './types/DXCUserInteraction';
18
- export { defineYDocTrigger } from './define-ydoc-trigger';
19
- export declare function dexieCloud(dexie: Dexie): void;
20
- export declare namespace dexieCloud {
21
- var version: any;
22
- }
23
- export default dexieCloud;
@@ -1,5 +0,0 @@
1
- export declare class HttpError extends Error {
2
- httpStatus: number;
3
- constructor(res: Response, message?: string);
4
- get name(): string;
5
- }
@@ -1,23 +0,0 @@
1
- import { DBRealm, DBRealmMember, DBRealmRole } from 'dexie-cloud-common';
2
- import { DexieCloudAPI } from './DexieCloudAPI';
3
- import { NewIdOptions } from './types/NewIdOptions';
4
- type Optional<T, Props extends keyof T> = Omit<T, Props> & Partial<T>;
5
- declare module 'dexie' {
6
- interface Dexie {
7
- cloud: DexieCloudAPI;
8
- realms: Table<DBRealm, string, Optional<DBRealm, 'realmId' | 'owner'>>;
9
- members: Table<DBRealmMember, string, Optional<DBRealmMember, 'id' | 'owner'>>;
10
- roles: Table<DBRealmRole, [string, string], Optional<DBRealmRole, 'owner'>>;
11
- }
12
- interface Table {
13
- newId(options: NewIdOptions): string;
14
- idPrefix(): string;
15
- }
16
- interface DexieConstructor {
17
- Cloud: {
18
- (db: Dexie): void;
19
- version: string;
20
- };
21
- }
22
- }
23
- export {};
@@ -1,5 +0,0 @@
1
- import Dexie from 'dexie';
2
- import { DBRealmRole } from 'dexie-cloud-common';
3
- export declare const getGlobalRolesObservable: (x: Dexie) => import("./mapValueObservable").ObservableWithCurrentValue<{
4
- [roleName: string]: DBRealmRole;
5
- }>;
@@ -1,12 +0,0 @@
1
- import Dexie from 'dexie';
2
- import { DBRealm, DBRealmMember } from 'dexie-cloud-common';
3
- export type InternalAccessControlData = {
4
- readonly selfMembers: DBRealmMember[];
5
- readonly realms: DBRealm[];
6
- readonly userId: string;
7
- };
8
- export declare const getInternalAccessControlObservable: (x: Dexie) => import("./mapValueObservable").ObservableWithCurrentValue<{
9
- selfMembers: DBRealmMember[];
10
- realms: DBRealm[];
11
- userId: string;
12
- }>;
@@ -1,23 +0,0 @@
1
- import { Dexie } from 'dexie';
2
- export declare const getInvitesObservable: (x: Dexie) => import("./mapValueObservable").ObservableWithCurrentValue<{
3
- accept(): Promise<void>;
4
- reject(): Promise<void>;
5
- id: string;
6
- userId?: string;
7
- email?: string;
8
- name?: string;
9
- invite?: boolean;
10
- invitedDate?: Date;
11
- invitedBy?: {
12
- name: string;
13
- email: string;
14
- userId: string;
15
- };
16
- accepted?: Date;
17
- rejected?: Date;
18
- roles?: string[];
19
- permissions?: import("dexie-cloud-common").DBPermissionSet;
20
- realmId: string;
21
- owner: string;
22
- $ts?: number;
23
- }[]>;
@@ -1,16 +0,0 @@
1
- import Dexie from 'dexie';
2
- import { DBPermissionSet, DBRealm } from 'dexie-cloud-common';
3
- import { Observable } from 'rxjs';
4
- export type PermissionsLookup = {
5
- [realmId: string]: DBRealm & {
6
- permissions: DBPermissionSet;
7
- };
8
- };
9
- export type PermissionsLookupObservable = Observable<PermissionsLookup> & {
10
- getValue(): PermissionsLookup;
11
- };
12
- export declare const getPermissionsLookupObservable: (x: Dexie) => import("./mapValueObservable").ObservableWithCurrentValue<{
13
- [x: string]: DBRealm & {
14
- permissions: DBPermissionSet;
15
- };
16
- }>;
@@ -1,2 +0,0 @@
1
- export declare function getTiedRealmId(objectId: string): string;
2
- export declare function getTiedObjectId(realmId: string): string | null;
@@ -1,8 +0,0 @@
1
- import { Observable } from "rxjs";
2
- import { SWBroadcastChannel } from "./SWBroadcastChannel";
3
- export declare class BroadcastedAndLocalEvent<T> extends Observable<T> {
4
- name: string;
5
- bc: BroadcastChannel | SWBroadcastChannel;
6
- constructor(name: string);
7
- next(message: T): void;
8
- }
@@ -1,4 +0,0 @@
1
- export interface CancelToken {
2
- cancelled: boolean;
3
- }
4
- export declare function throwIfCancelled(cancelToken?: CancelToken): void;
@@ -1 +0,0 @@
1
- export declare const IS_SERVICE_WORKER: false;
@@ -1,12 +0,0 @@
1
- /** This class is a fallback for browsers that lacks BroadcastChannel but have
2
- * service workers (which is Safari versions 11.1 through 15.3).
3
- * Safari 15.4 with BroadcastChannel was released on 2022-03-14.
4
- * We might be able to remove this class in a near future as Safari < 15.4 is
5
- * already very low in market share as of 2023-03-10.
6
- */
7
- export declare class SWBroadcastChannel {
8
- name: string;
9
- constructor(name: string);
10
- subscribe(listener: (message: any) => void): () => void;
11
- postMessage(message: any): void;
12
- }
@@ -1 +0,0 @@
1
- export declare function allSettled(possiblePromises: any[]): Promise<unknown>;
@@ -1,4 +0,0 @@
1
- import { Table } from 'dexie';
2
- export declare function bulkUpdate(table: Table, keys: any[], changeSpecs: {
3
- [keyPath: string]: any;
4
- }[]): Promise<void>;
@@ -1,2 +0,0 @@
1
- import { PersistedSyncState } from '../db/entities/PersistedSyncState';
2
- export declare function computeRealmSetHash({ realms, inviteRealms, }: PersistedSyncState): Promise<string>;
@@ -1,5 +0,0 @@
1
- export declare const SECONDS = 1000;
2
- export declare const MINUTES: number;
3
- export declare const HOURS: number;
4
- export declare const DAYS: number;
5
- export declare const WEEKS: number;
@@ -1 +0,0 @@
1
- export declare function flatten<T>(a: (T | T[])[]): T[];
@@ -1 +0,0 @@
1
- export declare function getMutationTable(tableName: string): string;
@@ -1,4 +0,0 @@
1
- import { Table } from "dexie";
2
- import { DexieCloudDB } from "../db/DexieCloudDB";
3
- import { EntityCommon } from "../db/entities/EntityCommon";
4
- export declare function getSyncableTables(db: DexieCloudDB): Table<EntityCommon>[];
@@ -1 +0,0 @@
1
- export declare function getTableFromMutationTable(mutationTable: string): string;
@@ -1 +0,0 @@
1
- export declare function makeArray<T>(iterable: Iterable<T>): T[];
@@ -1 +0,0 @@
1
- export declare function randomString(bytes: number): string;
@@ -1,16 +0,0 @@
1
- import { DXCAlert } from "../types/DXCAlert";
2
- /** Resolve a message template with parameters.
3
- *
4
- * Example:
5
- * resolveText({
6
- * message: "Hello {name}!",
7
- * messageCode: "HELLO",
8
- * messageParams: {name: "David"}
9
- * }) => "Hello David!"
10
- *
11
- * @param message Template message with {vars} in it.
12
- * @param messageCode Unique code for the message. Can be used for translation.
13
- * @param messageParams Parameters to be used in the message.
14
- * @returns A final message where parameters have been replaced with values.
15
- */
16
- export declare function resolveText({ message, messageCode, messageParams }: DXCAlert): string;
@@ -1 +0,0 @@
1
- export declare function throwVersionIncrementNeeded(): void;
@@ -1 +0,0 @@
1
- export declare function createVisibilityStateObservable(): import("rxjs").Observable<DocumentVisibilityState>;
@@ -1,2 +0,0 @@
1
- import { DexieCloudDB } from './db/DexieCloudDB';
2
- export declare function isEagerSyncDisabled(db: DexieCloudDB): boolean;
@@ -1 +0,0 @@
1
- export declare const isFirefox: boolean;
@@ -1,2 +0,0 @@
1
- export declare const isSafari: boolean;
2
- export declare const safariVersion: number;
@@ -1,5 +0,0 @@
1
- import { Observable } from 'rxjs';
2
- export interface ObservableWithCurrentValue<T> extends Observable<T> {
3
- getValue(): T;
4
- }
5
- export declare function mapValueObservable<T, R>(o: ObservableWithCurrentValue<T>, mapper: (x: T) => R): ObservableWithCurrentValue<R>;
@@ -1,2 +0,0 @@
1
- import { DBPermissionSet } from 'dexie-cloud-common';
2
- export declare function mergePermissions(...permissions: DBPermissionSet[]): DBPermissionSet;
@@ -1,11 +0,0 @@
1
- import { DBCoreTable } from "dexie";
2
- export declare function guardedTable(table: DBCoreTable): {
3
- count: (req: import("dexie").DBCoreCountRequest) => Promise<number>;
4
- get: (req: import("dexie").DBCoreGetRequest) => Promise<any>;
5
- getMany: (req: import("dexie").DBCoreGetManyRequest) => Promise<any[]>;
6
- openCursor: (req: import("dexie").DBCoreOpenCursorRequest) => Promise<import("dexie").DBCoreCursor | null>;
7
- query: (req: import("dexie").DBCoreQueryRequest) => Promise<import("dexie").DBCoreQueryResponse>;
8
- mutate: (req: import("dexie").DBCoreMutateRequest) => Promise<import("dexie").DBCoreMutateResponse>;
9
- name: string;
10
- schema: import("dexie").DBCoreTableSchema;
11
- };
@@ -1,18 +0,0 @@
1
- import { DBCoreAddRequest, DBCoreDeleteRequest, DBCoreIndex, DBCorePutRequest } from 'dexie';
2
- export declare function toStringTag(o: Object): any;
3
- export declare function getEffectiveKeys(primaryKey: DBCoreIndex, req: (Pick<DBCoreAddRequest | DBCorePutRequest, 'type' | 'values'> & {
4
- keys?: any[];
5
- }) | Pick<DBCoreDeleteRequest, 'keys' | 'type'>): any[];
6
- export declare function generateTablePrefix(tableName: string, allPrefixes: Set<string>): string;
7
- /**
8
- *
9
- * @param prefix A unique 3-letter short-name of the table.
10
- * @param shardKey 3 last letters from another ID if colocation is requested. Verified on server on inserts - guarantees unique IDs across shards.
11
- * The shardKey part of the key represent the shardId where it was first created. An object with this
12
- * primary key can later on be moved to another shard without being altered. The reason for having
13
- * the origin shardKey as part of the key, is that the server will not need to check uniqueness constraint
14
- * across all shards on every insert. Updates / moves across shards are already controlled by the server
15
- * in the sense that the objects needs to be there already - we only need this part for inserts.
16
- * @returns
17
- */
18
- export declare function generateKey(prefix: string, shardKey?: string): string;
@@ -1,3 +0,0 @@
1
- import { DBCore, Middleware } from 'dexie';
2
- import { DexieCloudDB } from '../db/DexieCloudDB';
3
- export declare function createIdGenerationMiddleware(db: DexieCloudDB): Middleware<DBCore>;
@@ -1,3 +0,0 @@
1
- import { DBCore, Middleware } from 'dexie';
2
- import { DexieCloudDB } from '../db/DexieCloudDB';
3
- export declare function createImplicitPropSetterMiddleware(db: DexieCloudDB): Middleware<DBCore>;
@@ -1,17 +0,0 @@
1
- import { DBCore, Middleware } from 'dexie';
2
- import { BehaviorSubject } from 'rxjs';
3
- import { DexieCloudDB } from '../db/DexieCloudDB';
4
- import { UserLogin } from '../db/entities/UserLogin';
5
- export interface MutationTrackingMiddlewareArgs {
6
- currentUserObservable: BehaviorSubject<UserLogin>;
7
- db: DexieCloudDB;
8
- }
9
- /** Tracks all mutations in the same transaction as the mutations -
10
- * so it is guaranteed that no mutation goes untracked - and if transaction
11
- * aborts, the mutations won't be tracked.
12
- *
13
- * The sync job will use the tracked mutations as the source of truth when pushing
14
- * changes to server and cleanup the tracked mutations once the server has
15
- * ackowledged that it got them.
16
- */
17
- export declare function createMutationTrackingMiddleware({ currentUserObservable, db, }: MutationTrackingMiddlewareArgs): Middleware<DBCore>;
@@ -1,4 +0,0 @@
1
- import { DBCoreTransaction } from 'dexie';
2
- import { BehaviorSubject } from 'rxjs';
3
- import { TXExpandos } from '../types/TXExpandos';
4
- export declare const outstandingTransactions: BehaviorSubject<Set<DBCoreTransaction & IDBTransaction & TXExpandos>>;
@@ -1,4 +0,0 @@
1
- import Dexie, { DbSchema } from 'dexie';
2
- export declare function overrideParseStoresSpec(origFunc: Function, dexie: Dexie): (stores: {
3
- [tableName: string]: string;
4
- }, dbSchema: DbSchema) => any;
@@ -1,4 +0,0 @@
1
- import { DexieCloudSchema } from 'dexie-cloud-common';
2
- import { DexieCloudDB } from './db/DexieCloudDB';
3
- import { DexieCloudOptions } from './DexieCloudOptions';
4
- export declare function performInitialSync(db: DexieCloudDB, cloudOptions: DexieCloudOptions, cloudSchema: DexieCloudSchema): Promise<void>;
@@ -1,9 +0,0 @@
1
- import Dexie from 'dexie';
2
- import { Observable } from 'rxjs';
3
- import { PermissionChecker } from './PermissionChecker';
4
- import './extend-dexie-interface';
5
- export declare function permissions(dexie: Dexie, obj: {
6
- owner?: string;
7
- realmId?: string;
8
- table?: () => string;
9
- }, tableName?: string): Observable<PermissionChecker<any>>;
@@ -1,9 +0,0 @@
1
- /** A way to log to console in production without terser stripping out
2
- * it from the release bundle.
3
- * This should be used very rarely and only in places where it's
4
- * absolutely necessary to log something in production.
5
- *
6
- * @param level
7
- * @param args
8
- */
9
- export declare function prodLog(level: 'log' | 'warn' | 'error' | 'debug', ...args: any[]): void;
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export declare const DEXIE_CLOUD_SYNCER_ID = "dexie-cloud-syncer";
@@ -1,7 +0,0 @@
1
- import { DexieCloudDB } from '../db/DexieCloudDB';
2
- import { DexieCloudOptions } from '../DexieCloudOptions';
3
- import { DexieCloudSchema } from 'dexie-cloud-common';
4
- export declare function LocalSyncWorker(db: DexieCloudDB, cloudOptions: DexieCloudOptions, cloudSchema: DexieCloudSchema): {
5
- start: () => void;
6
- stop: () => void;
7
- };
@@ -1,3 +0,0 @@
1
- export declare class SyncRequiredError extends Error {
2
- name: string;
3
- }
@@ -1,3 +0,0 @@
1
- import { DexieCloudDB } from '../db/DexieCloudDB';
2
- import { DBOperationsSet } from 'dexie-cloud-common';
3
- export declare function applyServerChanges(changes: DBOperationsSet<string>, db: DexieCloudDB): Promise<void>;
@@ -1,2 +0,0 @@
1
- import { DexieCloudDB } from '../db/DexieCloudDB';
2
- export declare function connectWebSocket(db: DexieCloudDB): import("rxjs").Subscription;
@@ -1,4 +0,0 @@
1
- import { DBCoreSchema } from 'dexie';
2
- import { DBOperationsSet } from 'dexie-cloud-common';
3
- import { UserLogin } from '../db/entities/UserLogin';
4
- export declare function encodeIdsForServer(schema: DBCoreSchema, currentUser: UserLogin, changes: DBOperationsSet): DBOperationsSet;
@@ -1,2 +0,0 @@
1
- import { EntityCommon } from "../db/entities/EntityCommon";
2
- export declare function extractRealm(obj: EntityCommon): string | undefined;
@@ -1,6 +0,0 @@
1
- import { DBOperationsSet } from 'dexie-cloud-common';
2
- export declare function getLatestRevisionsPerTable(clientChangeSet: DBOperationsSet, lastRevisions?: {
3
- [table: string]: number;
4
- }): {
5
- [table: string]: number;
6
- };
@@ -1,3 +0,0 @@
1
- import { DexieCloudDB } from "../db/DexieCloudDB";
2
- import { PersistedSyncState } from "../db/entities/PersistedSyncState";
3
- export declare function getTablesToSyncify(db: DexieCloudDB, syncState: PersistedSyncState | undefined): import("dexie").Table<import("../db/entities/EntityCommon").EntityCommon, any, import("../db/entities/EntityCommon").EntityCommon>[];
@@ -1 +0,0 @@
1
- export declare let isOnline: boolean;
@@ -1,2 +0,0 @@
1
- import { DexieCloudDB } from "../db/DexieCloudDB";
2
- export declare function isSyncNeeded(db: DexieCloudDB): Promise<boolean>;
@@ -1,9 +0,0 @@
1
- import { Table } from 'dexie';
2
- import { DexieCloudDB } from '../db/DexieCloudDB';
3
- import { DBOperationsSet } from 'dexie-cloud-common';
4
- export declare function listClientChanges(mutationTables: Table[], db: DexieCloudDB, { since, limit }?: {
5
- since?: {
6
- [table: string]: number;
7
- } | undefined;
8
- limit?: number | undefined;
9
- }): Promise<DBOperationsSet>;
@@ -1,5 +0,0 @@
1
- import { UserLogin } from '../db/entities/UserLogin';
2
- import { EntityCommon } from '../db/entities/EntityCommon';
3
- import { Table } from 'dexie';
4
- import { DBOperationsSet, DexieCloudSchema } from 'dexie-cloud-common';
5
- export declare function listSyncifiedChanges(tablesToSyncify: Table<EntityCommon>[], currentUser: UserLogin, schema: DexieCloudSchema, alreadySyncedRealms?: string[]): Promise<DBOperationsSet>;
@@ -1,2 +0,0 @@
1
- import { BehaviorSubject } from "rxjs";
2
- export declare const messageConsumerIsReady: BehaviorSubject<boolean>;
@@ -1,8 +0,0 @@
1
- import { BehaviorSubject } from 'rxjs';
2
- import { DexieCloudDB } from '../db/DexieCloudDB';
3
- import { WSConnectionMsg } from '../WSObservable';
4
- export type MessagesFromServerConsumer = ReturnType<typeof MessagesFromServerConsumer>;
5
- export declare function MessagesFromServerConsumer(db: DexieCloudDB): {
6
- enqueue: (msg: WSConnectionMsg) => void;
7
- readyToServe: BehaviorSubject<boolean>;
8
- };
@@ -1,4 +0,0 @@
1
- import { Table } from "dexie";
2
- import { EntityCommon } from "../db/entities/EntityCommon";
3
- import { UserLogin } from "../db/entities/UserLogin";
4
- export declare function modifyLocalObjectsWithNewUserId(syncifiedTables: Table<EntityCommon>[], currentUser: UserLogin, alreadySyncedRealms?: string[]): Promise<void>;
@@ -1 +0,0 @@
1
- export declare const myId: string;
@@ -1,2 +0,0 @@
1
- import { DexieCloudDB } from "../db/DexieCloudDB";
2
- export declare function getNumUnsyncedMutationsObservable(db: DexieCloudDB): import("rxjs").Observable<number>;
@@ -1,39 +0,0 @@
1
- /** TODO:
2
- * 1. Convert these unsynced changes into sync mutations by resolving values from ordinaryTables.
3
- * 2. Append a convertion of mutReqs[table].muts into sync mutations.
4
- * 3. Send all this using fetch
5
- * 4. if successful response, delete muts from mutTables by
6
- * 1. a new rw-transaction where we start by finding revs above those we generated.
7
- * 2. for tables where none such found, clear the table. if some of those found, deleteRange on the table.
8
- *
9
- * Tankar att följa upp:
10
- * * Varje DOM environmnet får en MutationSyncer
11
- * * Håller koll på huruvida den tror att en sync redan pågår eller inte.
12
- * * Bro
13
- *
14
- * Leader election
15
- * * IDB persisted value: leaderId
16
- * * Varje browsing-env får en nodeId (random string).
17
- * * db.open: Kolla om det finns en leader. Om inte, sätt dig själv som leader.
18
- * * Leaders: Ha sync consumer uppe.
19
- * * Service worker: Ta ledarskap. Spara även en prop som säger att detta är service worker (för att workaround BroadCastChannel props)
20
- * * Om det finns en non-service worker ledare, försök kontakta den (via BroadCastChannel)
21
- * * Om ledaren inte svarar inom 1 sekund, ta ledarskap.
22
- * * Ledare: Lyssna på ändring av ledarskap och sluta vara ledare i så fall.
23
- * * Följare: Lyssna på ändring av ledarskap så att du alltid kontaktar rätt ledare.
24
- * * När man postar något till non-SW ledaren så ska den ACKa inom 1 sek. Annars, ta ledarskapet.
25
- *
26
- *
27
- * Enklare:
28
- * * Vi har en som leker service worker per window. Två aktiva flikar:
29
- * * Båda vaknar upp och låser tabellen X för skrivning, om ingen annan tagit jobbet, skriver timestamp till X och
30
- * börjar sedan synka. Under tiden för sync, uppdaterar den timestamp kontinuerligt för att signallera att den
31
- * jobbar. När klar, clearar ut timestampen och avslutar jobbet.
32
- * - Om det inte fanns nåt att göra så clearas timestamp ut och man schedulerar inget mer uppvaknande.
33
- * * Den som kom sist ser att annan tagit jobbet inom rimlig timestamp och väljer då att polla igen ifall timestampet
34
- * skulle timat ut.
35
- * * Om jobbaren verkar tajma ut: gör nytt försök från början. Kan leda till att du blir ledare denna gång.
36
- * * Om jobbaren clearar ut timestampen pga avslutat jobb så kan väntaren ädnå för säkerhets-skull göra om'et från början.
37
- *
38
- *
39
- */
@@ -1,2 +0,0 @@
1
- import { DexieCloudDB } from "../db/DexieCloudDB";
2
- export declare function performGuardedJob<T>(db: DexieCloudDB, jobName: string, job: () => Promise<T>): Promise<T>;
@@ -1,3 +0,0 @@
1
- import { DexieCloudDB } from '../db/DexieCloudDB';
2
- export declare function checkSyncRateLimitDelay(db: DexieCloudDB): Promise<void>;
3
- export declare function updateSyncRateLimitDelays(db: DexieCloudDB, res: Response): void;
@@ -1,3 +0,0 @@
1
- import { DexieCloudDB } from '../db/DexieCloudDB';
2
- export declare function registerSyncEvent(db: DexieCloudDB, purpose: "push" | "pull"): Promise<void>;
3
- export declare function registerPeriodicSyncEvent(db: DexieCloudDB): Promise<void>;
@@ -1,15 +0,0 @@
1
- import { DexieCloudDB } from '../db/DexieCloudDB';
2
- import { DexieCloudOptions } from '../DexieCloudOptions';
3
- import { DBOperationsSet, DexieCloudSchema } from 'dexie-cloud-common';
4
- export declare const CURRENT_SYNC_WORKER = "currentSyncWorker";
5
- export interface SyncOptions {
6
- isInitialSync?: boolean;
7
- cancelToken?: {
8
- cancelled: boolean;
9
- };
10
- justCheckIfNeeded?: boolean;
11
- retryImmediatelyOnFetchError?: boolean;
12
- purpose?: 'pull' | 'push';
13
- }
14
- export declare function sync(db: DexieCloudDB, options: DexieCloudOptions, schema: DexieCloudSchema, syncOptions?: SyncOptions): Promise<boolean>;
15
- export declare function filterServerChangesThroughAddedClientChanges(serverChanges: DBOperationsSet<string>, addedClientChanges: DBOperationsSet): DBOperationsSet<string>;
@@ -1,5 +0,0 @@
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;
@@ -1,6 +0,0 @@
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, YClientMessage } from 'dexie-cloud-common';
5
- import { UserLogin } from '../db/entities/UserLogin';
6
- export declare function syncWithServer(changes: DBOperationsSet, y: YClientMessage[], syncState: PersistedSyncState | undefined, baseRevs: BaseRevisionMapEntry[], db: DexieCloudDB, databaseUrl: string, schema: DexieCloudSchema | null, clientIdentity: string, currentUser: UserLogin): Promise<SyncResponse>;
@@ -1,2 +0,0 @@
1
- import { DexieCloudDB } from "../db/DexieCloudDB";
2
- export declare function triggerSync(db: DexieCloudDB, purpose: "push" | "pull"): void;
@@ -1,5 +0,0 @@
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>;