@aerogel/plugin-local-first 0.1.0 → 0.1.1-next.0a6591c4aa884d1bdaa587100f91f93db4017e6e

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.
@@ -1,16 +1,16 @@
1
- import { AcceptRefs } from '@aerogel/core';
2
1
  import { Authenticator } from '@aerogel/plugin-solid';
3
2
  import { ComponentOptionsMixin } from 'vue';
4
3
  import { ComponentProvideOptions } from 'vue';
5
4
  import { Cr } from '@noeldemartin/utils';
6
5
  import { DefineComponent } from 'vue';
6
+ import { DocumentsCache } from 'soukai-solid';
7
7
  import { Engine } from 'soukai';
8
+ import { EngineDocument } from 'soukai';
8
9
  import { ErrorSource } from '@aerogel/core';
9
10
  import { Facade } from '@noeldemartin/utils';
10
11
  import { Job } from '@aerogel/core';
11
12
  import { JobListener } from '@aerogel/core';
12
13
  import { JobStatus } from '@aerogel/core';
13
- import { ModalExpose } from '@aerogel/core';
14
14
  import { Nullable } from '@noeldemartin/utils';
15
15
  import { ObjectsMap } from '@noeldemartin/utils';
16
16
  import { Plugin as Plugin_2 } from '@aerogel/core';
@@ -18,7 +18,6 @@ import { PublicProps } from 'vue';
18
18
  import { Replace } from '@aerogel/core';
19
19
  import { Semaphore } from '@noeldemartin/utils';
20
20
  import { ServiceWithState } from '@aerogel/core';
21
- import { ShallowUnwrapRef } from 'vue';
22
21
  import { SolidContainer } from 'soukai-solid';
23
22
  import { SolidDocument } from 'soukai-solid';
24
23
  import { SolidModel } from 'soukai-solid';
@@ -35,9 +34,7 @@ export declare const AccountLoggedOut: DefineComponent< {}, {}, {}, {}, {}, C
35
34
 
36
35
  export declare const AccountLoginModal: DefineComponent< {}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
37
36
 
38
- export declare const AccountModal: DefineComponent< {}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {
39
- $modalRef: ShallowUnwrapRef<AcceptRefs<ModalExpose<void>>> | null;
40
- }, any>;
37
+ export declare const AccountModal: DefineComponent< {}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
41
38
 
42
39
  export declare const Cloud: Facade<CloudService>;
43
40
 
@@ -45,8 +42,11 @@ export declare class CloudService extends _default {
45
42
  protected asyncLock: Semaphore;
46
43
  protected engine: Engine | null;
47
44
  protected pollingInterval: NodeJS.Timeout | null;
45
+ protected documentsCache: DocumentsCache | null;
48
46
  whenReady<T>(callback: () => T): Promise<T>;
49
47
  setup(modelUrlMappings?: WeakMap<SolidModelConstructor, Record<string, string>>): Promise<void>;
48
+ getEngine(): Engine | null;
49
+ requireEngine(): Engine;
50
50
  dismissSetup(): void;
51
51
  dismissMigration(): void;
52
52
  postponeMigration(): void;
@@ -61,16 +61,17 @@ export declare class CloudService extends _default {
61
61
  register(modelClass: SolidModelConstructor, options?: RegisterOptions): Promise<void>;
62
62
  registerSchemaMigration(modelClass: SolidModelConstructor, schema: SolidModelConstructor | SolidSchemaDefinition): void;
63
63
  requireRemoteCollection(modelClass: SolidModelConstructor): string;
64
+ getDocumentsCache(): DocumentsCache;
64
65
  protected boot(): Promise<void>;
65
66
  protected getDirtyLocalModels(): SolidModel[];
66
67
  protected getModelsIn(urls: string[], model: SolidModel): SolidModel[];
67
- protected requireEngine(): Engine;
68
68
  protected setReady(ready: boolean): Promise<void>;
69
69
  protected backup(modelUrlMappings?: WeakMap<SolidModelConstructor, Record<string, string>>): Promise<void>;
70
70
  protected onApplicationReady(): Promise<void>;
71
71
  protected onApplicationMounted(): Promise<void>;
72
72
  protected login(authenticator: Authenticator): void;
73
- protected logout(): void;
73
+ protected logout(): Promise<void>;
74
+ private watchNetworkStatus;
74
75
  private syncOnStartup;
75
76
  private bustDocumentsCache;
76
77
  private registerModels;
@@ -78,6 +79,7 @@ export declare class CloudService extends _default {
78
79
 
79
80
  declare const CloudStatus: {
80
81
  readonly Disconnected: "disconnected";
82
+ readonly Offline: "offline";
81
83
  readonly Online: "online";
82
84
  readonly Syncing: "syncing";
83
85
  readonly Migrating: "migrating";
@@ -90,9 +92,11 @@ migrationDismissed: boolean;
90
92
  migrationJob: Nullable<Migrate>;
91
93
  migrationPostponed: boolean;
92
94
  modelCollections: Record<string, string[]>;
95
+ rootModelCollections: Record<string, string>;
93
96
  pollingEnabled: boolean;
94
97
  pollingMinutes: number;
95
98
  ready: boolean;
99
+ manualSetup: boolean;
96
100
  registeredModels: ModelRegistration[];
97
101
  schemaMigrations: Map<SolidModelConstructor, SolidModelConstructor | SolidSchemaDefinition>;
98
102
  setupDismissed: boolean;
@@ -104,6 +108,7 @@ syncJob: Nullable<Sync>;
104
108
  }, {
105
109
  disconnected: boolean;
106
110
  online: boolean;
111
+ offline: boolean;
107
112
  syncing: boolean;
108
113
  migrating: boolean;
109
114
  localChanges: number;
@@ -117,9 +122,11 @@ migrationDismissed: boolean;
117
122
  migrationJob: Nullable<Migrate>;
118
123
  migrationPostponed: boolean;
119
124
  modelCollections: Record<string, string[]>;
125
+ rootModelCollections: Record<string, string>;
120
126
  pollingEnabled: boolean;
121
127
  pollingMinutes: number;
122
128
  ready: boolean;
129
+ manualSetup: boolean;
123
130
  registeredModels: ModelRegistration[];
124
131
  schemaMigrations: Map<SolidModelConstructor, SolidModelConstructor | SolidSchemaDefinition>;
125
132
  setupDismissed: boolean;
@@ -141,15 +148,14 @@ declare class LoadsChildren {
141
148
  onDocumentError?: (error: unknown) => unknown;
142
149
  onDocumentRead?: (document: SolidDocument) => unknown;
143
150
  }): Promise<SolidModel[]>;
144
- protected loadDocumentChildren(model: SolidContainer, documentUrl: string, documents: ObjectsMap<SolidDocument>, onDocumentError?: (error: unknown) => unknown, onDocumentRead?: (document: SolidDocument) => unknown): Promise<{
145
- children: Record<string, SolidModel[]>;
146
- tombstones: Tombstone[];
147
- }>;
148
- protected loadDocumentChildrenFromLocal(model: SolidModel, document: SolidDocument): Promise<Record<string, SolidModel[]>>;
149
- protected loadDocumentChildrenFromRemote(model: SolidContainer, documentUrl: string, onDocumentError?: (error: unknown) => unknown, onDocumentRead?: (document: SolidDocument) => unknown): Promise<{
150
- children: Record<string, SolidModel[]>;
151
- tombstones: Tombstone[];
152
- }>;
151
+ protected loadContainedDocuments(model: SolidContainer, options?: {
152
+ status?: ResourceJobStatus;
153
+ onDocumentLoaded?: () => unknown;
154
+ onDocumentError?: (error: unknown) => unknown;
155
+ onDocumentRead?: (document: SolidDocument) => unknown;
156
+ }): Promise<Record<string, EngineDocument>>;
157
+ private loadDocumentChildren;
158
+ private loadDocumentChildrenFromRemote;
153
159
  }
154
160
 
155
161
  declare class LoadsTypeIndex {
@@ -163,7 +169,7 @@ declare class LoadsTypeIndex {
163
169
  }): Promise<SolidTypeIndex>;
164
170
  }
165
171
 
166
- declare function localFirst(): Plugin_2;
172
+ declare function localFirst(options?: Options): Plugin_2;
167
173
  export default localFirst;
168
174
 
169
175
  export declare type LocalFirstServices = typeof services;
@@ -196,6 +202,10 @@ declare interface ModelRegistration {
196
202
  path?: string;
197
203
  }
198
204
 
205
+ export declare interface Options {
206
+ manualSetup?: boolean;
207
+ }
208
+
199
209
  export declare interface RegisterOptions {
200
210
  path?: string;
201
211
  }
@@ -230,12 +240,13 @@ declare class Sync extends Sync_base {
230
240
  private pullChanges;
231
241
  private pushChanges;
232
242
  private fetchRemoteModels;
243
+ private fetchRemoteModelsFromContainer;
233
244
  private fetchRemoteModelsForLocal;
234
245
  private getTypeRegistrations;
235
246
  private updateTypeRegistrations;
236
247
  private loadChildren;
237
248
  private deleteChild;
238
- private saveModelAndChildren;
249
+ private saveModelAndRelated;
239
250
  private synchronizeModels;
240
251
  private reconcileInconsistencies;
241
252
  private synchronizeContainerDocuments;