dexie-cloud-addon 1.0.0-beta.8 → 4.0.0-beta.14

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 (56) hide show
  1. package/dist/modern/dexie-cloud-addon.js +2108 -1962
  2. package/dist/modern/dexie-cloud-addon.js.map +1 -1
  3. package/dist/modern/dexie-cloud-addon.min.js +1 -1
  4. package/dist/modern/dexie-cloud-addon.min.js.map +1 -1
  5. package/dist/modern/service-worker.js +3097 -2957
  6. package/dist/modern/service-worker.js.map +1 -1
  7. package/dist/modern/service-worker.min.js +1 -1
  8. package/dist/modern/service-worker.min.js.map +1 -1
  9. package/dist/module-es5/dexie-cloud-addon.js +2835 -2527
  10. package/dist/module-es5/dexie-cloud-addon.js.map +1 -1
  11. package/dist/module-es5/dexie-cloud-addon.min.js +1 -1
  12. package/dist/module-es5/dexie-cloud-addon.min.js.map +1 -1
  13. package/dist/types/DexieCloudAPI.d.ts +49 -0
  14. package/dist/types/DexieCloudOptions.d.ts +1 -0
  15. package/dist/types/DexieCloudSyncOptions.d.ts +4 -0
  16. package/dist/types/DexieCloudTable.d.ts +2 -0
  17. package/dist/types/Invite.d.ts +6 -0
  18. package/dist/types/PermissionChecker.d.ts +15 -0
  19. package/dist/types/WSObservable.d.ts +16 -7
  20. package/dist/types/associate.d.ts +1 -0
  21. package/dist/types/authentication/setCurrentUser.d.ts +2 -2
  22. package/dist/types/createSharedValueObservable.d.ts +3 -0
  23. package/dist/types/currentUserEmitter.d.ts +3 -0
  24. package/dist/types/db/DexieCloudDB.d.ts +1 -1
  25. package/dist/types/db/entities/EntityCommon.d.ts +1 -0
  26. package/dist/types/dexie-cloud-client.d.ts +4 -1
  27. package/dist/types/extend-dexie-interface.d.ts +11 -49
  28. package/dist/types/getInternalAccessControlObservable.d.ts +12 -0
  29. package/dist/types/getInvitesObservable.d.ts +25 -0
  30. package/dist/types/getPermissionsLookupObservable.d.ts +16 -0
  31. package/dist/types/getTiedRealmId.d.ts +2 -0
  32. package/dist/types/helpers/flatten.d.ts +1 -0
  33. package/dist/types/mapValueObservable.d.ts +5 -0
  34. package/dist/types/mergePermissions.d.ts +2 -0
  35. package/dist/types/middleware-helpers/idGenerationHelpers.d.ts +18 -0
  36. package/dist/types/middlewares/createIdGenerationMiddleware.d.ts +1 -6
  37. package/dist/types/permissions.d.ts +9 -0
  38. package/dist/types/sync/applyServerChanges.d.ts +3 -0
  39. package/dist/types/sync/encodeIdsForServer.d.ts +4 -0
  40. package/dist/types/sync/getTablesToSyncify.d.ts +1 -1
  41. package/dist/types/sync/listClientChanges.d.ts +3 -3
  42. package/dist/types/sync/listSyncifiedChanges.d.ts +4 -4
  43. package/dist/types/sync/sync.d.ts +2 -2
  44. package/dist/types/sync/syncWithServer.d.ts +2 -1
  45. package/dist/types/types/NewIdOptions.d.ts +3 -0
  46. package/dist/umd/dexie-cloud-addon.js +2834 -2523
  47. package/dist/umd/dexie-cloud-addon.js.map +1 -1
  48. package/dist/umd/dexie-cloud-addon.min.js +1 -1
  49. package/dist/umd/dexie-cloud-addon.min.js.map +1 -1
  50. package/dist/umd/service-worker.js +3100 -2960
  51. package/dist/umd/service-worker.js.map +1 -1
  52. package/dist/umd/service-worker.min.js +1 -1
  53. package/dist/umd/service-worker.min.js.map +1 -1
  54. package/dist/umd-modern/dexie-cloud-addon.js +2115 -1966
  55. package/dist/umd-modern/dexie-cloud-addon.js.map +1 -1
  56. package/package.json +6 -5
@@ -0,0 +1,49 @@
1
+ import { DexieCloudOptions } from './DexieCloudOptions';
2
+ import { DexieCloudSchema } from 'dexie-cloud-common';
3
+ import { UserLogin } from './db/entities/UserLogin';
4
+ import * as Rx from 'rxjs';
5
+ import { PersistedSyncState } from './db/entities/PersistedSyncState';
6
+ import { SyncState } from './types/SyncState';
7
+ import { DexieCloudServerState } from './DexieCloudServerState';
8
+ import { DXCUserInteraction } from './types/DXCUserInteraction';
9
+ import { DXCWebSocketStatus } from './DXCWebSocketStatus';
10
+ import { PermissionChecker } from './PermissionChecker';
11
+ import { DexieCloudSyncOptions } from "./DexieCloudSyncOptions";
12
+ import { Invite } from './Invite';
13
+ export interface DexieCloudAPI {
14
+ version: string;
15
+ options: DexieCloudOptions | null;
16
+ schema: DexieCloudSchema | null;
17
+ serverState: DexieCloudServerState | null;
18
+ currentUserId: string;
19
+ currentUser: Rx.BehaviorSubject<UserLogin>;
20
+ webSocketStatus: Rx.BehaviorSubject<DXCWebSocketStatus>;
21
+ syncState: Rx.BehaviorSubject<SyncState>;
22
+ persistedSyncState: Rx.BehaviorSubject<PersistedSyncState | undefined>;
23
+ userInteraction: Rx.BehaviorSubject<DXCUserInteraction | undefined>;
24
+ invites: Rx.Observable<Invite[]>;
25
+ usingServiceWorker?: boolean;
26
+ /** Login using Dexie Cloud OTP or Demo user.
27
+ *
28
+ * @param email Email to authenticate
29
+ */
30
+ login(hint?: {
31
+ email?: string;
32
+ userId?: string;
33
+ grant_type?: 'demo' | 'otp';
34
+ }): Promise<void>;
35
+ /**
36
+ * Connect to given URL
37
+ */
38
+ configure(options: DexieCloudOptions): void;
39
+ /** Wait until a full sync is done.
40
+ *
41
+ */
42
+ sync(options?: DexieCloudSyncOptions): Promise<void>;
43
+ permissions<T extends {
44
+ owner: string;
45
+ realmId: string;
46
+ table: () => string;
47
+ }>(entity: T): Rx.Observable<PermissionChecker<T>>;
48
+ permissions<T>(obj: T, table: string): Rx.Observable<PermissionChecker<T, string>>;
49
+ }
@@ -9,6 +9,7 @@ export interface DexieCloudOptions {
9
9
  customLoginGui?: boolean;
10
10
  unsyncedTables?: string[];
11
11
  periodicSync?: PeriodicSyncOptions;
12
+ nameSuffix?: boolean;
12
13
  fetchTokens?: (tokenParams: {
13
14
  public_key: string;
14
15
  hints?: {
@@ -0,0 +1,4 @@
1
+ export interface DexieCloudSyncOptions {
2
+ wait: boolean;
3
+ purpose: 'push' | 'pull';
4
+ }
@@ -0,0 +1,2 @@
1
+ import { Table } from 'dexie';
2
+ export declare type DexieCloudTable<T = any, TKey = string> = Table<T, TKey, 'realmId' | 'owner'>;
@@ -0,0 +1,6 @@
1
+ import { DBPermissionSet, DBRealm, DBRealmMember } from 'dexie-cloud-common';
2
+ export interface Invite extends DBRealmMember {
3
+ realm?: DBRealm & {
4
+ permissions: DBPermissionSet;
5
+ };
6
+ }
@@ -0,0 +1,15 @@
1
+ import { KeyPaths } from 'dexie';
2
+ import { DBPermissionSet } from 'dexie-cloud-common';
3
+ declare type TableName<T> = T extends {
4
+ table: () => infer TABLE;
5
+ } ? TABLE extends string ? TABLE : string : string;
6
+ export declare class PermissionChecker<T, TableNames extends string = TableName<T>> {
7
+ private permissions;
8
+ private tableName;
9
+ private isOwner;
10
+ constructor(permissions: DBPermissionSet, tableName: TableNames, isOwner: boolean);
11
+ add(...tableNames: TableNames[]): boolean;
12
+ update(...props: KeyPaths<T>[]): boolean;
13
+ delete(): boolean;
14
+ }
15
+ export {};
@@ -4,15 +4,15 @@ import { DXCWebSocketStatus } from './DXCWebSocketStatus';
4
4
  export declare type WSClientToServerMsg = ReadyForChangesMessage;
5
5
  export interface ReadyForChangesMessage {
6
6
  type: 'ready';
7
- rev: bigint;
7
+ rev: string;
8
8
  }
9
- export declare type WSConnectionMsg = RevisionChangedMessage | RealmAddedMessage | RealmRemovedMessage | ChangesFromServerMessage | TokenExpiredMessage;
9
+ export declare type WSConnectionMsg = RevisionChangedMessage | RealmAddedMessage | RealmAcceptedMessage | RealmRemovedMessage | RealmsChangedMessage | ChangesFromServerMessage | TokenExpiredMessage;
10
10
  export interface ChangesFromServerMessage {
11
11
  type: 'changes';
12
- baseRev: bigint;
12
+ baseRev: string;
13
13
  realmSetHash: string;
14
- newRev: bigint;
15
- changes: DBOperationsSet;
14
+ newRev: string;
15
+ changes: DBOperationsSet<string>;
16
16
  }
17
17
  export interface RevisionChangedMessage {
18
18
  type: 'rev';
@@ -22,15 +22,23 @@ export interface RealmAddedMessage {
22
22
  type: 'realm-added';
23
23
  realm: string;
24
24
  }
25
+ export interface RealmAcceptedMessage {
26
+ type: 'realm-accepted';
27
+ realm: string;
28
+ }
25
29
  export interface RealmRemovedMessage {
26
30
  type: 'realm-removed';
27
31
  realm: string;
28
32
  }
33
+ export interface RealmsChangedMessage {
34
+ type: 'realms-changed';
35
+ realmsHash: string;
36
+ }
29
37
  export interface TokenExpiredMessage {
30
38
  type: 'token-expired';
31
39
  }
32
40
  export declare class WSObservable extends Observable<WSConnectionMsg> {
33
- constructor(databaseUrl: string, rev: string, clientIdentity: string, messageProducer: Observable<WSClientToServerMsg>, webSocketStatus: BehaviorSubject<DXCWebSocketStatus>, token?: string, tokenExpiration?: Date);
41
+ constructor(databaseUrl: string, rev: string, realmSetHash: string, clientIdentity: string, messageProducer: Observable<WSClientToServerMsg>, webSocketStatus: BehaviorSubject<DXCWebSocketStatus>, token?: string, tokenExpiration?: Date);
34
42
  }
35
43
  export declare class WSConnection extends Subscription {
36
44
  ws: WebSocket | null;
@@ -39,6 +47,7 @@ export declare class WSConnection extends Subscription {
39
47
  lastPing: Date;
40
48
  databaseUrl: string;
41
49
  rev: string;
50
+ realmSetHash: string;
42
51
  clientIdentity: string;
43
52
  token: string | undefined;
44
53
  tokenExpiration: Date | undefined;
@@ -49,7 +58,7 @@ export declare class WSConnection extends Subscription {
49
58
  id: number;
50
59
  private pinger;
51
60
  private messageProducerSubscription;
52
- constructor(databaseUrl: string, rev: string, clientIdentity: string, token: string | undefined, tokenExpiration: Date | undefined, subscriber: Subscriber<WSConnectionMsg>, messageProducer: Observable<WSClientToServerMsg>, webSocketStatus: BehaviorSubject<DXCWebSocketStatus>);
61
+ constructor(databaseUrl: string, rev: string, realmSetHash: string, clientIdentity: string, token: string | undefined, tokenExpiration: Date | undefined, subscriber: Subscriber<WSConnectionMsg>, messageProducer: Observable<WSClientToServerMsg>, webSocketStatus: BehaviorSubject<DXCWebSocketStatus>);
53
62
  private teardown;
54
63
  private disconnect;
55
64
  reconnect(): void;
@@ -0,0 +1 @@
1
+ export declare function associate<T extends object, M>(factory: (x: T) => M): (x: T) => M;
@@ -1,5 +1,5 @@
1
- import { DexieCloudDB } from "../db/DexieCloudDB";
2
- import { AuthPersistedContext } from "./AuthPersistedContext";
1
+ import { DexieCloudDB } from '../db/DexieCloudDB';
2
+ import { AuthPersistedContext } from './AuthPersistedContext';
3
3
  /** This function changes or sets the current user as requested.
4
4
  *
5
5
  * Use cases:
@@ -0,0 +1,3 @@
1
+ import { ObservableInput } from 'rxjs';
2
+ import { ObservableWithCurrentValue } from './mapValueObservable';
3
+ export declare function createSharedValueObservable<T>(o: ObservableInput<T>, defaultValue: T): ObservableWithCurrentValue<T>;
@@ -0,0 +1,3 @@
1
+ import Dexie from "dexie";
2
+ import { BehaviorSubject } from "rxjs";
3
+ export declare const getCurrentUserEmitter: (x: Dexie) => BehaviorSubject<import("./db/entities/UserLogin").UserLogin>;
@@ -46,9 +46,9 @@ export interface DexieCloudDB extends DexieCloudDBBase {
46
46
  messageConsumer: MessagesFromServerConsumer;
47
47
  }
48
48
  export declare const DEXIE_CLOUD_SCHEMA: {
49
- realms: string;
50
49
  members: string;
51
50
  roles: string;
51
+ realms: string;
52
52
  $jobs: string;
53
53
  $syncState: string;
54
54
  $baseRevs: string;
@@ -1,4 +1,5 @@
1
1
  export interface EntityCommon {
2
2
  realmId?: string;
3
3
  owner?: string;
4
+ $ts?: string;
4
5
  }
@@ -1,6 +1,9 @@
1
1
  import Dexie from 'dexie';
2
2
  import './extend-dexie-interface';
3
- export { DexieCloudTable } from './extend-dexie-interface';
3
+ export { DexieCloudTable } from './DexieCloudTable';
4
+ export * from './getTiedRealmId';
5
+ export { DBRealm, DBRealmMember, DBRealmRole, DBSyncedObject, DBPermissionSet, } from 'dexie-cloud-common';
6
+ export { Invite } from './Invite';
4
7
  export declare function dexieCloud(dexie: Dexie): void;
5
8
  export declare namespace dexieCloud {
6
9
  var version: string;
@@ -1,54 +1,16 @@
1
- import { Table } from 'dexie';
2
- import { DexieCloudOptions } from './DexieCloudOptions';
3
- import { DBRealm, DBRealmMember, DBRealmRole, DexieCloudSchema } from 'dexie-cloud-common';
4
- import { UserLogin } from './db/entities/UserLogin';
5
- import * as Rx from 'rxjs';
6
- import { PersistedSyncState } from './db/entities/PersistedSyncState';
7
- import { SyncState } from './types/SyncState';
8
- import { DexieCloudServerState } from './DexieCloudServerState';
9
- import { EntityCommon } from './db/entities/EntityCommon';
10
- import { DXCUserInteraction } from './types/DXCUserInteraction';
11
- import { DXCWebSocketStatus } from './DXCWebSocketStatus';
12
- export interface DexieCloudSyncOptions {
13
- wait: boolean;
14
- purpose: "push" | "pull";
15
- }
16
- export declare type DexieCloudTable<T = any> = Table<T & EntityCommon, string>;
1
+ import { DBRealm, DBRealmMember, DBRealmRole } from 'dexie-cloud-common';
2
+ import { DexieCloudAPI } from './DexieCloudAPI';
3
+ import { NewIdOptions } from './types/NewIdOptions';
17
4
  declare module 'dexie' {
18
5
  interface Dexie {
19
- cloud: {
20
- version: string;
21
- options: DexieCloudOptions | null;
22
- schema: DexieCloudSchema | null;
23
- serverState: DexieCloudServerState | null;
24
- currentUserId: string;
25
- currentUser: Rx.BehaviorSubject<UserLogin>;
26
- webSocketStatus: Rx.BehaviorSubject<DXCWebSocketStatus>;
27
- syncState: Rx.BehaviorSubject<SyncState>;
28
- persistedSyncState: Rx.BehaviorSubject<PersistedSyncState | undefined>;
29
- userInteraction: Rx.BehaviorSubject<DXCUserInteraction | undefined>;
30
- usingServiceWorker?: boolean;
31
- /** Login using Dexie Cloud OTP or Demo user.
32
- *
33
- * @param email Email to authenticate
34
- */
35
- login(hint?: {
36
- email?: string;
37
- userId?: string;
38
- grant_type?: 'demo' | 'otp';
39
- }): Promise<void>;
40
- /**
41
- * Connect to given URL
42
- */
43
- configure(options: DexieCloudOptions): void;
44
- /** Wait until a full sync is done.
45
- *
46
- */
47
- sync(options?: DexieCloudSyncOptions): Promise<void>;
48
- };
49
- realms: Table<Partial<DBRealm>, string>;
50
- members: Table<Partial<DBRealmMember>, string>;
51
- roles: Table<DBRealmRole, [string, string]>;
6
+ cloud: DexieCloudAPI;
7
+ realms: Table<DBRealm, 'realmId', 'owner'>;
8
+ members: Table<DBRealmMember, 'id', 'realmId' | 'owner'>;
9
+ roles: Table<DBRealmRole, [string, string], 'owner'>;
10
+ }
11
+ interface Table {
12
+ newId(options: NewIdOptions): string;
13
+ idPrefix(): string;
52
14
  }
53
15
  interface DexieConstructor {
54
16
  Cloud: {
@@ -0,0 +1,12 @@
1
+ import Dexie from 'dexie';
2
+ import { DBRealm, DBRealmMember } from 'dexie-cloud-common';
3
+ export declare 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
+ }>;
@@ -0,0 +1,25 @@
1
+ import { Dexie } from 'dexie';
2
+ import { Invite } from './Invite';
3
+ export declare const getInvitesObservable: (x: Dexie) => import("./mapValueObservable").ObservableWithCurrentValue<(Invite | {
4
+ realm: import("dexie-cloud-common").DBRealm & {
5
+ permissions: import("dexie-cloud-common").DBPermissionSet;
6
+ };
7
+ id?: string | undefined;
8
+ userId?: string | undefined;
9
+ email?: string | undefined;
10
+ name?: string | undefined;
11
+ invite?: boolean | undefined;
12
+ invitedDate?: Date | undefined;
13
+ invitedBy?: {
14
+ name: string;
15
+ email: string;
16
+ userId: string;
17
+ } | undefined;
18
+ accepted?: Date | undefined;
19
+ rejected?: Date | undefined;
20
+ roles?: string[] | undefined;
21
+ permissions?: import("dexie-cloud-common").DBPermissionSet | undefined;
22
+ realmId: string;
23
+ owner: string;
24
+ $ts?: number | undefined;
25
+ })[]>;
@@ -0,0 +1,16 @@
1
+ import Dexie from 'dexie';
2
+ import { DBPermissionSet, DBRealm } from 'dexie-cloud-common';
3
+ import { Observable } from 'rxjs';
4
+ export declare type PermissionsLookup = {
5
+ [realmId: string]: DBRealm & {
6
+ permissions: DBPermissionSet;
7
+ };
8
+ };
9
+ export declare 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
+ }>;
@@ -0,0 +1,2 @@
1
+ export declare function getTiedRealmId(objectId: string): string;
2
+ export declare function getTiedObjectId(realmId: string): string | null;
@@ -0,0 +1 @@
1
+ export declare function flatten<T>(a: (T | T[])[]): T[];
@@ -0,0 +1,5 @@
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>;
@@ -0,0 +1,2 @@
1
+ import { DBPermissionSet } from 'dexie-cloud-common';
2
+ export declare function mergePermissions(...permissions: DBPermissionSet[]): DBPermissionSet;
@@ -0,0 +1,18 @@
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,8 +1,3 @@
1
- import { DBCore, DBCoreAddRequest, DBCoreDeleteRequest, DBCoreIndex, DBCorePutRequest, Middleware } from 'dexie';
1
+ import { DBCore, Middleware } from 'dexie';
2
2
  import { DexieCloudDB } from '../db/DexieCloudDB';
3
- export declare function toStringTag(o: Object): any;
4
- export declare function getEffectiveKeys(primaryKey: DBCoreIndex, req: (Pick<DBCoreAddRequest | DBCorePutRequest, 'type' | 'values'> & {
5
- keys?: any[];
6
- }) | Pick<DBCoreDeleteRequest, 'keys' | 'type'>): any[];
7
- export declare function generateTablePrefix(tableName: string, allPrefixes: Set<string>): string;
8
3
  export declare function createIdGenerationMiddleware(db: DexieCloudDB): Middleware<DBCore>;
@@ -0,0 +1,9 @@
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>>;
@@ -0,0 +1,3 @@
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>;
@@ -0,0 +1,4 @@
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,3 +1,3 @@
1
1
  import { DexieCloudDB } from "../db/DexieCloudDB";
2
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, import("dexie").IndexableType>[];
3
+ export declare function getTablesToSyncify(db: DexieCloudDB, syncState: PersistedSyncState | undefined): import("dexie").Table<import("../db/entities/EntityCommon").EntityCommon, import("dexie").IndexableType, void>[];
@@ -1,6 +1,6 @@
1
- import { Table } from "dexie";
2
- import { DexieCloudDB } from "../db/DexieCloudDB";
3
- import { DBOperationsSet } from "dexie-cloud-common";
1
+ import { Table } from 'dexie';
2
+ import { DexieCloudDB } from '../db/DexieCloudDB';
3
+ import { DBOperationsSet } from 'dexie-cloud-common';
4
4
  export declare function listClientChanges(mutationTables: Table[], db: DexieCloudDB, { since, limit }?: {
5
5
  since?: {
6
6
  [table: string]: number;
@@ -1,5 +1,5 @@
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";
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
5
  export declare function listSyncifiedChanges(tablesToSyncify: Table<EntityCommon>[], currentUser: UserLogin, schema: DexieCloudSchema, alreadySyncedRealms?: string[]): Promise<DBOperationsSet>;
@@ -2,6 +2,7 @@ import { DexieCloudDB } from '../db/DexieCloudDB';
2
2
  import { DexieCloudOptions } from '../DexieCloudOptions';
3
3
  import { DBOperationsSet, DexieCloudSchema } from 'dexie-cloud-common';
4
4
  export declare const CURRENT_SYNC_WORKER = "currentSyncWorker";
5
+ export declare let numberOfSyncRequests: number;
5
6
  export interface SyncOptions {
6
7
  isInitialSync?: boolean;
7
8
  cancelToken?: {
@@ -12,5 +13,4 @@ export interface SyncOptions {
12
13
  purpose?: 'pull' | 'push';
13
14
  }
14
15
  export declare function sync(db: DexieCloudDB, options: DexieCloudOptions, schema: DexieCloudSchema, syncOptions?: SyncOptions): Promise<boolean>;
15
- export declare function applyServerChanges(changes: DBOperationsSet, db: DexieCloudDB): Promise<void>;
16
- export declare function filterServerChangesThroughAddedClientChanges(serverChanges: DBOperationsSet, addedClientChanges: DBOperationsSet): DBOperationsSet;
16
+ export declare function filterServerChangesThroughAddedClientChanges(serverChanges: DBOperationsSet<string>, addedClientChanges: DBOperationsSet): DBOperationsSet<string>;
@@ -2,4 +2,5 @@ import { DexieCloudDB } from '../db/DexieCloudDB';
2
2
  import { PersistedSyncState } from '../db/entities/PersistedSyncState';
3
3
  import { BaseRevisionMapEntry } from '../db/entities/BaseRevisionMapEntry';
4
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>;
5
+ import { UserLogin } from '../db/entities/UserLogin';
6
+ export declare function syncWithServer(changes: DBOperationsSet, syncState: PersistedSyncState | undefined, baseRevs: BaseRevisionMapEntry[], db: DexieCloudDB, databaseUrl: string, schema: DexieCloudSchema | null, clientIdentity: string, currentUser: UserLogin): Promise<SyncResponse>;
@@ -0,0 +1,3 @@
1
+ export interface NewIdOptions {
2
+ colocateWith?: string;
3
+ }