@aerogel/plugin-local-first 0.1.0 → 0.1.1-next.26f3c2c807213724de7500a899a6712abae430ad

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.
@@ -4,7 +4,9 @@ import { ComponentOptionsMixin } from 'vue';
4
4
  import { ComponentProvideOptions } from 'vue';
5
5
  import { Cr } from '@noeldemartin/utils';
6
6
  import { DefineComponent } from 'vue';
7
+ import { DocumentsCache } from 'soukai-solid';
7
8
  import { Engine } from 'soukai';
9
+ import { EngineDocument } from 'soukai';
8
10
  import { ErrorSource } from '@aerogel/core';
9
11
  import { Facade } from '@noeldemartin/utils';
10
12
  import { Job } from '@aerogel/core';
@@ -45,8 +47,11 @@ export declare class CloudService extends _default {
45
47
  protected asyncLock: Semaphore;
46
48
  protected engine: Engine | null;
47
49
  protected pollingInterval: NodeJS.Timeout | null;
50
+ protected documentsCache: DocumentsCache | null;
48
51
  whenReady<T>(callback: () => T): Promise<T>;
49
52
  setup(modelUrlMappings?: WeakMap<SolidModelConstructor, Record<string, string>>): Promise<void>;
53
+ getEngine(): Engine | null;
54
+ requireEngine(): Engine;
50
55
  dismissSetup(): void;
51
56
  dismissMigration(): void;
52
57
  postponeMigration(): void;
@@ -61,16 +66,17 @@ export declare class CloudService extends _default {
61
66
  register(modelClass: SolidModelConstructor, options?: RegisterOptions): Promise<void>;
62
67
  registerSchemaMigration(modelClass: SolidModelConstructor, schema: SolidModelConstructor | SolidSchemaDefinition): void;
63
68
  requireRemoteCollection(modelClass: SolidModelConstructor): string;
69
+ getDocumentsCache(): DocumentsCache;
64
70
  protected boot(): Promise<void>;
65
71
  protected getDirtyLocalModels(): SolidModel[];
66
72
  protected getModelsIn(urls: string[], model: SolidModel): SolidModel[];
67
- protected requireEngine(): Engine;
68
73
  protected setReady(ready: boolean): Promise<void>;
69
74
  protected backup(modelUrlMappings?: WeakMap<SolidModelConstructor, Record<string, string>>): Promise<void>;
70
75
  protected onApplicationReady(): Promise<void>;
71
76
  protected onApplicationMounted(): Promise<void>;
72
77
  protected login(authenticator: Authenticator): void;
73
- protected logout(): void;
78
+ protected logout(): Promise<void>;
79
+ private watchNetworkStatus;
74
80
  private syncOnStartup;
75
81
  private bustDocumentsCache;
76
82
  private registerModels;
@@ -78,6 +84,7 @@ export declare class CloudService extends _default {
78
84
 
79
85
  declare const CloudStatus: {
80
86
  readonly Disconnected: "disconnected";
87
+ readonly Offline: "offline";
81
88
  readonly Online: "online";
82
89
  readonly Syncing: "syncing";
83
90
  readonly Migrating: "migrating";
@@ -93,6 +100,7 @@ modelCollections: Record<string, string[]>;
93
100
  pollingEnabled: boolean;
94
101
  pollingMinutes: number;
95
102
  ready: boolean;
103
+ manualSetup: boolean;
96
104
  registeredModels: ModelRegistration[];
97
105
  schemaMigrations: Map<SolidModelConstructor, SolidModelConstructor | SolidSchemaDefinition>;
98
106
  setupDismissed: boolean;
@@ -104,6 +112,7 @@ syncJob: Nullable<Sync>;
104
112
  }, {
105
113
  disconnected: boolean;
106
114
  online: boolean;
115
+ offline: boolean;
107
116
  syncing: boolean;
108
117
  migrating: boolean;
109
118
  localChanges: number;
@@ -120,6 +129,7 @@ modelCollections: Record<string, string[]>;
120
129
  pollingEnabled: boolean;
121
130
  pollingMinutes: number;
122
131
  ready: boolean;
132
+ manualSetup: boolean;
123
133
  registeredModels: ModelRegistration[];
124
134
  schemaMigrations: Map<SolidModelConstructor, SolidModelConstructor | SolidSchemaDefinition>;
125
135
  setupDismissed: boolean;
@@ -141,15 +151,14 @@ declare class LoadsChildren {
141
151
  onDocumentError?: (error: unknown) => unknown;
142
152
  onDocumentRead?: (document: SolidDocument) => unknown;
143
153
  }): 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
- }>;
154
+ protected loadContainedDocuments(model: SolidContainer, options?: {
155
+ status?: ResourceJobStatus;
156
+ onDocumentLoaded?: () => unknown;
157
+ onDocumentError?: (error: unknown) => unknown;
158
+ onDocumentRead?: (document: SolidDocument) => unknown;
159
+ }): Promise<Record<string, EngineDocument>>;
160
+ private loadDocumentChildren;
161
+ private loadDocumentChildrenFromRemote;
153
162
  }
154
163
 
155
164
  declare class LoadsTypeIndex {
@@ -163,7 +172,7 @@ declare class LoadsTypeIndex {
163
172
  }): Promise<SolidTypeIndex>;
164
173
  }
165
174
 
166
- declare function localFirst(): Plugin_2;
175
+ declare function localFirst(options?: Options): Plugin_2;
167
176
  export default localFirst;
168
177
 
169
178
  export declare type LocalFirstServices = typeof services;
@@ -196,6 +205,10 @@ declare interface ModelRegistration {
196
205
  path?: string;
197
206
  }
198
207
 
208
+ export declare interface Options {
209
+ manualSetup?: boolean;
210
+ }
211
+
199
212
  export declare interface RegisterOptions {
200
213
  path?: string;
201
214
  }
@@ -230,12 +243,13 @@ declare class Sync extends Sync_base {
230
243
  private pullChanges;
231
244
  private pushChanges;
232
245
  private fetchRemoteModels;
246
+ private fetchRemoteModelsFromContainer;
233
247
  private fetchRemoteModelsForLocal;
234
248
  private getTypeRegistrations;
235
249
  private updateTypeRegistrations;
236
250
  private loadChildren;
237
251
  private deleteChild;
238
- private saveModelAndChildren;
252
+ private saveModelAndRelated;
239
253
  private synchronizeModels;
240
254
  private reconcileInconsistencies;
241
255
  private synchronizeContainerDocuments;