@aerogel/plugin-local-first 0.1.1-next.91425fd73659d6cc241e50cdbda9be5ff119ecba → 0.1.1
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.
- package/dist/aerogel-plugin-local-first.d.ts +13 -24
- package/dist/aerogel-plugin-local-first.js +610 -655
- package/dist/aerogel-plugin-local-first.js.map +1 -1
- package/package.json +1 -1
- package/src/components/AccountModal.vue +1 -4
- package/src/index.ts +6 -12
- package/src/jobs/Backup.ts +0 -21
- package/src/jobs/Sync.test.ts +26 -22
- package/src/jobs/Sync.ts +35 -126
- package/src/jobs/mixins/LoadsChildren.ts +42 -41
- package/src/lib/inference.ts +0 -33
- package/src/lib/mirroring.ts +26 -31
- package/src/services/Cloud.state.ts +0 -3
- package/src/services/Cloud.ts +15 -32
- package/src/services/DocumentsCache.ts +39 -0
- package/src/testing/setup.ts +0 -14
- package/src/testing/mocks/documents-cache.ts +0 -25
|
@@ -4,9 +4,7 @@ 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';
|
|
8
7
|
import { Engine } from 'soukai';
|
|
9
|
-
import { EngineDocument } from 'soukai';
|
|
10
8
|
import { ErrorSource } from '@aerogel/core';
|
|
11
9
|
import { Facade } from '@noeldemartin/utils';
|
|
12
10
|
import { Job } from '@aerogel/core';
|
|
@@ -47,11 +45,8 @@ export declare class CloudService extends _default {
|
|
|
47
45
|
protected asyncLock: Semaphore;
|
|
48
46
|
protected engine: Engine | null;
|
|
49
47
|
protected pollingInterval: NodeJS.Timeout | null;
|
|
50
|
-
protected documentsCache: DocumentsCache | null;
|
|
51
48
|
whenReady<T>(callback: () => T): Promise<T>;
|
|
52
49
|
setup(modelUrlMappings?: WeakMap<SolidModelConstructor, Record<string, string>>): Promise<void>;
|
|
53
|
-
getEngine(): Engine | null;
|
|
54
|
-
requireEngine(): Engine;
|
|
55
50
|
dismissSetup(): void;
|
|
56
51
|
dismissMigration(): void;
|
|
57
52
|
postponeMigration(): void;
|
|
@@ -66,16 +61,16 @@ export declare class CloudService extends _default {
|
|
|
66
61
|
register(modelClass: SolidModelConstructor, options?: RegisterOptions): Promise<void>;
|
|
67
62
|
registerSchemaMigration(modelClass: SolidModelConstructor, schema: SolidModelConstructor | SolidSchemaDefinition): void;
|
|
68
63
|
requireRemoteCollection(modelClass: SolidModelConstructor): string;
|
|
69
|
-
getDocumentsCache(): DocumentsCache;
|
|
70
64
|
protected boot(): Promise<void>;
|
|
71
65
|
protected getDirtyLocalModels(): SolidModel[];
|
|
72
66
|
protected getModelsIn(urls: string[], model: SolidModel): SolidModel[];
|
|
67
|
+
protected requireEngine(): Engine;
|
|
73
68
|
protected setReady(ready: boolean): Promise<void>;
|
|
74
69
|
protected backup(modelUrlMappings?: WeakMap<SolidModelConstructor, Record<string, string>>): Promise<void>;
|
|
75
70
|
protected onApplicationReady(): Promise<void>;
|
|
76
71
|
protected onApplicationMounted(): Promise<void>;
|
|
77
72
|
protected login(authenticator: Authenticator): void;
|
|
78
|
-
protected logout():
|
|
73
|
+
protected logout(): void;
|
|
79
74
|
private watchNetworkStatus;
|
|
80
75
|
private syncOnStartup;
|
|
81
76
|
private bustDocumentsCache;
|
|
@@ -100,7 +95,6 @@ modelCollections: Record<string, string[]>;
|
|
|
100
95
|
pollingEnabled: boolean;
|
|
101
96
|
pollingMinutes: number;
|
|
102
97
|
ready: boolean;
|
|
103
|
-
manualSetup: boolean;
|
|
104
98
|
registeredModels: ModelRegistration[];
|
|
105
99
|
schemaMigrations: Map<SolidModelConstructor, SolidModelConstructor | SolidSchemaDefinition>;
|
|
106
100
|
setupDismissed: boolean;
|
|
@@ -129,7 +123,6 @@ modelCollections: Record<string, string[]>;
|
|
|
129
123
|
pollingEnabled: boolean;
|
|
130
124
|
pollingMinutes: number;
|
|
131
125
|
ready: boolean;
|
|
132
|
-
manualSetup: boolean;
|
|
133
126
|
registeredModels: ModelRegistration[];
|
|
134
127
|
schemaMigrations: Map<SolidModelConstructor, SolidModelConstructor | SolidSchemaDefinition>;
|
|
135
128
|
setupDismissed: boolean;
|
|
@@ -151,14 +144,15 @@ declare class LoadsChildren {
|
|
|
151
144
|
onDocumentError?: (error: unknown) => unknown;
|
|
152
145
|
onDocumentRead?: (document: SolidDocument) => unknown;
|
|
153
146
|
}): Promise<SolidModel[]>;
|
|
154
|
-
protected
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
147
|
+
protected loadDocumentChildren(model: SolidContainer, documentUrl: string, documents: ObjectsMap<SolidDocument>, onDocumentError?: (error: unknown) => unknown, onDocumentRead?: (document: SolidDocument) => unknown): Promise<{
|
|
148
|
+
children: Record<string, SolidModel[]>;
|
|
149
|
+
tombstones: Tombstone[];
|
|
150
|
+
}>;
|
|
151
|
+
protected loadDocumentChildrenFromLocal(model: SolidModel, document: SolidDocument): Promise<Record<string, SolidModel[]>>;
|
|
152
|
+
protected loadDocumentChildrenFromRemote(model: SolidContainer, documentUrl: string, onDocumentError?: (error: unknown) => unknown, onDocumentRead?: (document: SolidDocument) => unknown): Promise<{
|
|
153
|
+
children: Record<string, SolidModel[]>;
|
|
154
|
+
tombstones: Tombstone[];
|
|
155
|
+
}>;
|
|
162
156
|
}
|
|
163
157
|
|
|
164
158
|
declare class LoadsTypeIndex {
|
|
@@ -172,7 +166,7 @@ declare class LoadsTypeIndex {
|
|
|
172
166
|
}): Promise<SolidTypeIndex>;
|
|
173
167
|
}
|
|
174
168
|
|
|
175
|
-
declare function localFirst(
|
|
169
|
+
declare function localFirst(): Plugin_2;
|
|
176
170
|
export default localFirst;
|
|
177
171
|
|
|
178
172
|
export declare type LocalFirstServices = typeof services;
|
|
@@ -205,10 +199,6 @@ declare interface ModelRegistration {
|
|
|
205
199
|
path?: string;
|
|
206
200
|
}
|
|
207
201
|
|
|
208
|
-
export declare interface Options {
|
|
209
|
-
manualSetup?: boolean;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
202
|
export declare interface RegisterOptions {
|
|
213
203
|
path?: string;
|
|
214
204
|
}
|
|
@@ -243,13 +233,12 @@ declare class Sync extends Sync_base {
|
|
|
243
233
|
private pullChanges;
|
|
244
234
|
private pushChanges;
|
|
245
235
|
private fetchRemoteModels;
|
|
246
|
-
private fetchRemoteModelsFromContainer;
|
|
247
236
|
private fetchRemoteModelsForLocal;
|
|
248
237
|
private getTypeRegistrations;
|
|
249
238
|
private updateTypeRegistrations;
|
|
250
239
|
private loadChildren;
|
|
251
240
|
private deleteChild;
|
|
252
|
-
private
|
|
241
|
+
private saveModelAndChildren;
|
|
253
242
|
private synchronizeModels;
|
|
254
243
|
private reconcileInconsistencies;
|
|
255
244
|
private synchronizeContainerDocuments;
|