@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.
Files changed (39) hide show
  1. package/CHANGELOG.md +92 -449
  2. package/dist/aws-amplify-datastore.js +28008 -13243
  3. package/dist/aws-amplify-datastore.js.map +1 -1
  4. package/dist/aws-amplify-datastore.min.js +8 -8
  5. package/dist/aws-amplify-datastore.min.js.map +1 -1
  6. package/lib/.tsbuildinfo +1 -1
  7. package/lib/datastore/datastore.d.ts +4 -1
  8. package/lib/datastore/datastore.js +118 -4
  9. package/lib/datastore/datastore.js.map +1 -1
  10. package/lib/sync/index.d.ts +3 -1
  11. package/lib/sync/index.js +10 -1
  12. package/lib/sync/index.js.map +1 -1
  13. package/lib/sync/processors/subscription.js +2 -2
  14. package/lib/sync/processors/subscription.js.map +1 -1
  15. package/lib/sync/processors/sync.d.ts +1 -3
  16. package/lib/sync/processors/sync.js +8 -19
  17. package/lib/sync/processors/sync.js.map +1 -1
  18. package/lib/types.d.ts +4 -0
  19. package/lib/types.js.map +1 -1
  20. package/lib-esm/.tsbuildinfo +1 -1
  21. package/lib-esm/datastore/datastore.d.ts +4 -1
  22. package/lib-esm/datastore/datastore.js +119 -5
  23. package/lib-esm/datastore/datastore.js.map +1 -1
  24. package/lib-esm/sync/index.d.ts +3 -1
  25. package/lib-esm/sync/index.js +11 -2
  26. package/lib-esm/sync/index.js.map +1 -1
  27. package/lib-esm/sync/processors/subscription.js +2 -2
  28. package/lib-esm/sync/processors/subscription.js.map +1 -1
  29. package/lib-esm/sync/processors/sync.d.ts +1 -3
  30. package/lib-esm/sync/processors/sync.js +8 -19
  31. package/lib-esm/sync/processors/sync.js.map +1 -1
  32. package/lib-esm/types.d.ts +4 -0
  33. package/lib-esm/types.js.map +1 -1
  34. package/package.json +7 -7
  35. package/src/datastore/datastore.ts +146 -5
  36. package/src/sync/index.ts +19 -3
  37. package/src/sync/processors/subscription.ts +1 -1
  38. package/src/sync/processors/sync.ts +1 -17
  39. 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