@aws-amplify/datastore 3.4.8 → 3.4.9-in-app-messaging.35
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/CHANGELOG.md +92 -449
- package/dist/aws-amplify-datastore.js +28008 -13243
- package/dist/aws-amplify-datastore.js.map +1 -1
- package/dist/aws-amplify-datastore.min.js +8 -8
- package/dist/aws-amplify-datastore.min.js.map +1 -1
- package/lib/.tsbuildinfo +1 -1
- package/lib/datastore/datastore.d.ts +4 -1
- package/lib/datastore/datastore.js +118 -4
- package/lib/datastore/datastore.js.map +1 -1
- package/lib/sync/index.d.ts +3 -1
- package/lib/sync/index.js +10 -1
- package/lib/sync/index.js.map +1 -1
- package/lib/sync/processors/subscription.js +2 -2
- package/lib/sync/processors/subscription.js.map +1 -1
- package/lib/sync/processors/sync.d.ts +1 -3
- package/lib/sync/processors/sync.js +8 -19
- package/lib/sync/processors/sync.js.map +1 -1
- package/lib/types.d.ts +4 -0
- package/lib/types.js.map +1 -1
- package/lib-esm/.tsbuildinfo +1 -1
- package/lib-esm/datastore/datastore.d.ts +4 -1
- package/lib-esm/datastore/datastore.js +119 -5
- package/lib-esm/datastore/datastore.js.map +1 -1
- package/lib-esm/sync/index.d.ts +3 -1
- package/lib-esm/sync/index.js +11 -2
- package/lib-esm/sync/index.js.map +1 -1
- package/lib-esm/sync/processors/subscription.js +2 -2
- package/lib-esm/sync/processors/subscription.js.map +1 -1
- package/lib-esm/sync/processors/sync.d.ts +1 -3
- package/lib-esm/sync/processors/sync.js +8 -19
- package/lib-esm/sync/processors/sync.js.map +1 -1
- package/lib-esm/types.d.ts +4 -0
- package/lib-esm/types.js.map +1 -1
- package/package.json +7 -7
- package/src/datastore/datastore.ts +146 -5
- package/src/sync/index.ts +19 -3
- package/src/sync/processors/subscription.ts +1 -1
- package/src/sync/processors/sync.ts +1 -17
- package/src/types.ts +5 -0
|
@@ -25,9 +25,6 @@ import {
|
|
|
25
25
|
} from '@aws-amplify/core';
|
|
26
26
|
import { ModelPredicateCreator } from '../../predicates';
|
|
27
27
|
|
|
28
|
-
const DEFAULT_PAGINATION_LIMIT = 1000;
|
|
29
|
-
const DEFAULT_MAX_RECORDS_TO_SYNC = 10000;
|
|
30
|
-
|
|
31
28
|
const opResultDefaults = {
|
|
32
29
|
items: [],
|
|
33
30
|
nextToken: null,
|
|
@@ -41,8 +38,6 @@ class SyncProcessor {
|
|
|
41
38
|
|
|
42
39
|
constructor(
|
|
43
40
|
private readonly schema: InternalSchema,
|
|
44
|
-
private readonly maxRecordsToSync: number = DEFAULT_MAX_RECORDS_TO_SYNC,
|
|
45
|
-
private readonly syncPageSize: number = DEFAULT_PAGINATION_LIMIT,
|
|
46
41
|
private readonly syncPredicates: WeakMap<SchemaModel, ModelPredicate<any>>,
|
|
47
42
|
private readonly amplifyConfig: Record<string, any> = {},
|
|
48
43
|
private readonly authModeStrategy: AuthModeStrategy
|
|
@@ -289,19 +284,8 @@ class SyncProcessor {
|
|
|
289
284
|
typesLastSync: Map<SchemaModel, [string, number]>
|
|
290
285
|
): Observable<SyncModelPage> {
|
|
291
286
|
let processing = true;
|
|
292
|
-
|
|
293
|
-
const maxRecordsToSync =
|
|
294
|
-
this.maxRecordsToSync !== undefined
|
|
295
|
-
? this.maxRecordsToSync
|
|
296
|
-
: DEFAULT_MAX_RECORDS_TO_SYNC;
|
|
297
|
-
|
|
298
|
-
const syncPageSize =
|
|
299
|
-
this.syncPageSize !== undefined
|
|
300
|
-
? this.syncPageSize
|
|
301
|
-
: DEFAULT_PAGINATION_LIMIT;
|
|
302
|
-
|
|
287
|
+
const { maxRecordsToSync, syncPageSize } = this.amplifyConfig;
|
|
303
288
|
const parentPromises = new Map<string, Promise<void>>();
|
|
304
|
-
|
|
305
289
|
const observable = new Observable<SyncModelPage>(observer => {
|
|
306
290
|
const sortedTypesLastSyncs = Object.values(this.schema.namespaces).reduce(
|
|
307
291
|
(map, namespace) => {
|
package/src/types.ts
CHANGED
|
@@ -398,6 +398,11 @@ export type SubscriptionMessage<T extends PersistentModel> = {
|
|
|
398
398
|
model: PersistentModelConstructor<T>;
|
|
399
399
|
condition: PredicatesGroup<T> | null;
|
|
400
400
|
};
|
|
401
|
+
|
|
402
|
+
export type DataStoreSnapshot<T extends PersistentModel> = {
|
|
403
|
+
items: T[];
|
|
404
|
+
isSynced: boolean;
|
|
405
|
+
};
|
|
401
406
|
//#endregion
|
|
402
407
|
|
|
403
408
|
//#region Predicates
|