@aerogel/plugin-local-first 0.0.0 → 0.1.0-next.8bc0e822ef9f54da0a08e4ec571f0d59d9c97eb2
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 +51 -17
- package/dist/aerogel-plugin-local-first.js +1238 -1232
- package/dist/aerogel-plugin-local-first.js.map +1 -1
- package/package.json +5 -5
- package/src/components/Account.vue +9 -0
- package/src/components/AccountLoggedIn.vue +87 -0
- package/src/components/AccountLoggedOut.vue +26 -0
- package/src/components/AccountLoginModal.vue +36 -0
- package/src/components/AccountModal.vue +223 -0
- package/src/components/index.ts +5 -3
- package/src/components/settings/PurgeData.vue +43 -0
- package/src/components/settings/index.ts +10 -0
- package/src/index.css +1 -0
- package/src/index.ts +5 -1
- package/src/jobs/Migrate.test.ts +1 -1
- package/src/jobs/Migrate.ts +8 -1
- package/src/jobs/Sync.test.ts +313 -35
- package/src/jobs/Sync.ts +183 -77
- package/src/jobs/mixins/LoadsChildren.ts +48 -31
- package/src/jobs/mixins/LoadsTypeIndex.ts +7 -5
- package/src/jobs/mixins/TracksLocalModels.ts +4 -4
- package/src/lib/mirroring.ts +45 -21
- package/src/services/Cloud.state.ts +2 -0
- package/src/services/Cloud.ts +103 -25
- package/src/services/DocumentsCache.ts +6 -2
- package/src/testing/cloud.ts +1 -1
- package/src/testing/setup.ts +6 -3
- package/src/testing/stubs/Person.schema.ts +9 -0
- package/src/testing/stubs/Person.ts +18 -0
- package/src/testing/stubs/Post.schema.ts +17 -0
- package/src/testing/stubs/Post.ts +18 -0
- package/dist/InruptAuthenticator.lazy-BvpQLGoj-BvpQLGoj.js +0 -9
- package/dist/InruptAuthenticator.lazy-BvpQLGoj-BvpQLGoj.js.map +0 -1
- package/dist/LegacyAuthenticator.lazy-ChFFqP14-ChFFqP14.js +0 -5
- package/dist/LegacyAuthenticator.lazy-ChFFqP14-ChFFqP14.js.map +0 -1
- package/src/components/AGCloudStatus.vue +0 -31
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AcceptRefs } from '@aerogel/core';
|
|
1
2
|
import { Authenticator } from '@aerogel/plugin-solid';
|
|
2
3
|
import { ComponentOptionsMixin } from 'vue';
|
|
3
4
|
import { ComponentProvideOptions } from 'vue';
|
|
@@ -9,6 +10,7 @@ import { Facade } from '@noeldemartin/utils';
|
|
|
9
10
|
import { Job } from '@aerogel/core';
|
|
10
11
|
import { JobListener } from '@aerogel/core';
|
|
11
12
|
import { JobStatus } from '@aerogel/core';
|
|
13
|
+
import { ModalExpose } from '@aerogel/core';
|
|
12
14
|
import { Nullable } from '@noeldemartin/utils';
|
|
13
15
|
import { ObjectsMap } from '@noeldemartin/utils';
|
|
14
16
|
import { Plugin as Plugin_2 } from '@aerogel/core';
|
|
@@ -16,6 +18,7 @@ import { PublicProps } from 'vue';
|
|
|
16
18
|
import { Replace } from '@aerogel/core';
|
|
17
19
|
import { Semaphore } from '@noeldemartin/utils';
|
|
18
20
|
import { ServiceWithState } from '@aerogel/core';
|
|
21
|
+
import { ShallowUnwrapRef } from 'vue';
|
|
19
22
|
import { SolidContainer } from 'soukai-solid';
|
|
20
23
|
import { SolidDocument } from 'soukai-solid';
|
|
21
24
|
import { SolidModel } from 'soukai-solid';
|
|
@@ -24,11 +27,17 @@ import { SolidSchemaDefinition } from 'soukai-solid';
|
|
|
24
27
|
import { SolidTypeIndex } from 'soukai-solid';
|
|
25
28
|
import { Tombstone } from 'soukai-solid';
|
|
26
29
|
|
|
27
|
-
export declare const
|
|
28
|
-
|
|
29
|
-
}, string, PublicProps, Readonly<{}> & Readonly<{
|
|
30
|
-
|
|
31
|
-
}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {},
|
|
30
|
+
export declare const Account: DefineComponent< {}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
31
|
+
|
|
32
|
+
export declare const AccountLoggedIn: DefineComponent< {}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
33
|
+
|
|
34
|
+
export declare const AccountLoggedOut: DefineComponent< {}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
35
|
+
|
|
36
|
+
export declare const AccountLoginModal: DefineComponent< {}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
37
|
+
|
|
38
|
+
export declare const AccountModal: DefineComponent< {}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {
|
|
39
|
+
$modalRef: ShallowUnwrapRef<AcceptRefs<ModalExpose<void>>> | null;
|
|
40
|
+
}, any>;
|
|
32
41
|
|
|
33
42
|
export declare const Cloud: Facade<CloudService>;
|
|
34
43
|
|
|
@@ -62,11 +71,15 @@ export declare class CloudService extends _default {
|
|
|
62
71
|
protected onApplicationMounted(): Promise<void>;
|
|
63
72
|
protected login(authenticator: Authenticator): void;
|
|
64
73
|
protected logout(): void;
|
|
74
|
+
private watchNetworkStatus;
|
|
65
75
|
private syncOnStartup;
|
|
76
|
+
private bustDocumentsCache;
|
|
77
|
+
private registerModels;
|
|
66
78
|
}
|
|
67
79
|
|
|
68
80
|
declare const CloudStatus: {
|
|
69
81
|
readonly Disconnected: "disconnected";
|
|
82
|
+
readonly Offline: "offline";
|
|
70
83
|
readonly Online: "online";
|
|
71
84
|
readonly Syncing: "syncing";
|
|
72
85
|
readonly Migrating: "migrating";
|
|
@@ -93,6 +106,7 @@ syncJob: Nullable<Sync>;
|
|
|
93
106
|
}, {
|
|
94
107
|
disconnected: boolean;
|
|
95
108
|
online: boolean;
|
|
109
|
+
offline: boolean;
|
|
96
110
|
syncing: boolean;
|
|
97
111
|
migrating: boolean;
|
|
98
112
|
localChanges: number;
|
|
@@ -126,27 +140,30 @@ declare class LoadsChildren {
|
|
|
126
140
|
protected loadContainedModels(model: SolidContainer, options?: {
|
|
127
141
|
ignoreTombstones?: boolean;
|
|
128
142
|
status?: ResourceJobStatus;
|
|
129
|
-
|
|
130
|
-
|
|
143
|
+
onDocumentLoaded?: () => unknown;
|
|
144
|
+
onDocumentError?: (error: unknown) => unknown;
|
|
145
|
+
onDocumentRead?: (document: SolidDocument) => unknown;
|
|
131
146
|
}): Promise<SolidModel[]>;
|
|
132
|
-
protected loadDocumentChildren(model:
|
|
147
|
+
protected loadDocumentChildren(model: SolidContainer, documentUrl: string, documents: ObjectsMap<SolidDocument>, onDocumentError?: (error: unknown) => unknown, onDocumentRead?: (document: SolidDocument) => unknown): Promise<{
|
|
133
148
|
children: Record<string, SolidModel[]>;
|
|
134
149
|
tombstones: Tombstone[];
|
|
135
150
|
}>;
|
|
136
151
|
protected loadDocumentChildrenFromLocal(model: SolidModel, document: SolidDocument): Promise<Record<string, SolidModel[]>>;
|
|
137
|
-
protected loadDocumentChildrenFromRemote(model:
|
|
152
|
+
protected loadDocumentChildrenFromRemote(model: SolidContainer, documentUrl: string, onDocumentError?: (error: unknown) => unknown, onDocumentRead?: (document: SolidDocument) => unknown): Promise<{
|
|
138
153
|
children: Record<string, SolidModel[]>;
|
|
139
154
|
tombstones: Tombstone[];
|
|
140
155
|
}>;
|
|
141
156
|
}
|
|
142
157
|
|
|
143
158
|
declare class LoadsTypeIndex {
|
|
144
|
-
protected loadTypeIndex(options: {
|
|
145
|
-
create: true;
|
|
146
|
-
}): Promise<SolidTypeIndex>;
|
|
147
159
|
protected loadTypeIndex(options?: {
|
|
148
|
-
create
|
|
160
|
+
create?: false;
|
|
161
|
+
fresh?: boolean;
|
|
149
162
|
}): Promise<SolidTypeIndex | null>;
|
|
163
|
+
protected loadTypeIndex(options?: {
|
|
164
|
+
create?: true;
|
|
165
|
+
fresh?: boolean;
|
|
166
|
+
}): Promise<SolidTypeIndex>;
|
|
150
167
|
}
|
|
151
168
|
|
|
152
169
|
declare function localFirst(): Plugin_2;
|
|
@@ -156,6 +173,7 @@ export declare type LocalFirstServices = typeof services;
|
|
|
156
173
|
|
|
157
174
|
declare class Migrate extends Migrate_base {
|
|
158
175
|
static restore(status: MigrateJobStatus): Migrate;
|
|
176
|
+
constructor();
|
|
159
177
|
protected _models?: SolidModel[];
|
|
160
178
|
get models(): SolidModel[] | undefined;
|
|
161
179
|
set models(models: SolidModel[] | undefined);
|
|
@@ -195,21 +213,28 @@ declare const services: {
|
|
|
195
213
|
};
|
|
196
214
|
|
|
197
215
|
declare class Sync extends Sync_base {
|
|
216
|
+
readonly documentsWithErrors: Set<string>;
|
|
198
217
|
protected models?: SolidModel[];
|
|
199
218
|
protected dirtyRemoteModels?: SolidModel[];
|
|
200
219
|
protected rootLocalModels: SolidModel[];
|
|
201
220
|
protected tombstones: ObjectsMap<Tombstone>;
|
|
202
|
-
protected
|
|
221
|
+
protected syncedModelUrls: Set<string>;
|
|
203
222
|
protected documentsModifiedAt: Record<string, Date>;
|
|
223
|
+
protected screenLock: Promise<void | {
|
|
224
|
+
release(): Promise<void>;
|
|
225
|
+
}> | null;
|
|
204
226
|
protected localModels: ObjectsMap<SolidModel>;
|
|
205
227
|
constructor(models?: SolidModel[]);
|
|
206
228
|
protected run(): Promise<void>;
|
|
229
|
+
protected lockScreen(): void;
|
|
230
|
+
protected releaseScreen(): void;
|
|
207
231
|
protected getInitialStatus(): SyncJobStatus;
|
|
208
232
|
protected calculateCurrentProgress(status?: JobStatus): number;
|
|
209
233
|
private pullChanges;
|
|
210
234
|
private pushChanges;
|
|
211
235
|
private fetchRemoteModels;
|
|
212
236
|
private fetchRemoteModelsForLocal;
|
|
237
|
+
private getTypeRegistrations;
|
|
213
238
|
private updateTypeRegistrations;
|
|
214
239
|
private loadChildren;
|
|
215
240
|
private deleteChild;
|
|
@@ -218,7 +243,8 @@ declare class Sync extends Sync_base {
|
|
|
218
243
|
private reconcileInconsistencies;
|
|
219
244
|
private synchronizeContainerDocuments;
|
|
220
245
|
private rememberModelDocuments;
|
|
221
|
-
private
|
|
246
|
+
private ignoringDocumentErrors;
|
|
247
|
+
private handleDocumentError;
|
|
222
248
|
}
|
|
223
249
|
|
|
224
250
|
declare const Sync_base: typeof Job<JobListener, SyncJobStatus, SyncJobStatus> & Cr<LoadsChildren & LoadsTypeIndex & TracksLocalModels>;
|
|
@@ -229,9 +255,10 @@ declare interface SyncJobStatus extends JobStatus {
|
|
|
229
255
|
}
|
|
230
256
|
|
|
231
257
|
export declare interface SyncOptions extends JobListener {
|
|
232
|
-
refreshUserProfile?: boolean;
|
|
233
258
|
model?: SolidModel;
|
|
234
259
|
models?: SolidModel[];
|
|
260
|
+
refreshUserProfile?: boolean;
|
|
261
|
+
syncDirty?: boolean;
|
|
235
262
|
}
|
|
236
263
|
|
|
237
264
|
declare interface SyncPullJobStatus extends JobStatus {
|
|
@@ -241,7 +268,7 @@ declare interface SyncPullJobStatus extends JobStatus {
|
|
|
241
268
|
declare type TCloudStatus = (typeof CloudStatus)[keyof typeof CloudStatus];
|
|
242
269
|
|
|
243
270
|
declare class TracksLocalModels {
|
|
244
|
-
protected localModels
|
|
271
|
+
protected localModels: ObjectsMap<SolidModel>;
|
|
245
272
|
protected indexLocalModels(models: SolidModel[]): Promise<void>;
|
|
246
273
|
protected addLocalModel(localModel: SolidModel): Promise<void>;
|
|
247
274
|
}
|
|
@@ -267,3 +294,10 @@ declare module '@aerogel/core' {
|
|
|
267
294
|
'cloud:sync-completed': SolidModel[] | undefined;
|
|
268
295
|
}
|
|
269
296
|
}
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
declare module 'soukai-solid' {
|
|
300
|
+
namespace SolidModel {
|
|
301
|
+
const cloud: boolean | RegisterOptions | undefined;
|
|
302
|
+
}
|
|
303
|
+
}
|