@aws-amplify/datastore 5.0.1-unstable.cfbde4c.0 → 5.0.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/{lib → dist/cjs}/authModeStrategies/defaultAuthStrategy.js +3 -1
- package/dist/cjs/authModeStrategies/defaultAuthStrategy.js.map +1 -0
- package/{lib → dist/cjs}/authModeStrategies/index.js +3 -1
- package/dist/cjs/authModeStrategies/index.js.map +1 -0
- package/{lib → dist/cjs}/authModeStrategies/multiAuthStrategy.js +3 -3
- package/dist/cjs/authModeStrategies/multiAuthStrategy.js.map +1 -0
- package/{lib → dist/cjs}/datastore/datastore.js +5 -3
- package/dist/cjs/datastore/datastore.js.map +1 -0
- package/{lib → dist/cjs}/index.js +5 -16
- package/dist/cjs/index.js.map +1 -0
- package/{lib → dist/cjs}/predicates/index.js +3 -1
- package/dist/cjs/predicates/index.js.map +1 -0
- package/{lib → dist/cjs}/predicates/next.js +3 -1
- package/dist/cjs/predicates/next.js.map +1 -0
- package/{lib → dist/cjs}/predicates/sort.js +4 -3
- package/dist/cjs/predicates/sort.js.map +1 -0
- package/{lib → dist/cjs}/storage/adapter/AsyncStorageAdapter.js +5 -5
- package/dist/cjs/storage/adapter/AsyncStorageAdapter.js.map +1 -0
- package/{lib → dist/cjs}/storage/adapter/AsyncStorageDatabase.js +3 -1
- package/dist/cjs/storage/adapter/AsyncStorageDatabase.js.map +1 -0
- package/{lib → dist/cjs}/storage/adapter/InMemoryStore.js +3 -1
- package/dist/cjs/storage/adapter/InMemoryStore.js.map +1 -0
- package/{lib → dist/cjs}/storage/adapter/InMemoryStore.native.js +5 -5
- package/dist/cjs/storage/adapter/InMemoryStore.native.js.map +1 -0
- package/{lib → dist/cjs}/storage/adapter/IndexedDBAdapter.js +5 -25
- package/dist/cjs/storage/adapter/IndexedDBAdapter.js.map +1 -0
- package/{lib → dist/cjs}/storage/adapter/StorageAdapterBase.js +3 -1
- package/dist/cjs/storage/adapter/StorageAdapterBase.js.map +1 -0
- package/{lib → dist/cjs}/storage/adapter/getDefaultAdapter/index.js +6 -6
- package/dist/cjs/storage/adapter/getDefaultAdapter/index.js.map +1 -0
- package/dist/cjs/storage/adapter/getDefaultAdapter/index.native.js +10 -0
- package/dist/cjs/storage/adapter/getDefaultAdapter/index.native.js.map +1 -0
- package/{lib → dist/cjs}/storage/adapter/index.js +3 -1
- package/dist/cjs/storage/adapter/index.js.map +1 -0
- package/{lib → dist/cjs}/storage/relationship.js +3 -1
- package/dist/cjs/storage/relationship.js.map +1 -0
- package/{lib → dist/cjs}/storage/storage.js +5 -5
- package/dist/cjs/storage/storage.js.map +1 -0
- package/{lib → dist/cjs}/sync/datastoreConnectivity.js +4 -2
- package/dist/cjs/sync/datastoreConnectivity.js.map +1 -0
- package/{lib → dist/cjs}/sync/datastoreReachability/index.js +3 -1
- package/dist/cjs/sync/datastoreReachability/index.js.map +1 -0
- package/{lib → dist/cjs}/sync/datastoreReachability/index.native.js +3 -1
- package/dist/cjs/sync/datastoreReachability/index.native.js.map +1 -0
- package/{lib → dist/cjs}/sync/index.js +6 -7
- package/dist/cjs/sync/index.js.map +1 -0
- package/{lib → dist/cjs}/sync/merger.js +3 -1
- package/dist/cjs/sync/merger.js.map +1 -0
- package/{lib → dist/cjs}/sync/outbox.js +3 -1
- package/dist/cjs/sync/outbox.js.map +1 -0
- package/{lib → dist/cjs}/sync/processors/errorMaps.js +4 -4
- package/dist/cjs/sync/processors/errorMaps.js.map +1 -0
- package/{lib → dist/cjs}/sync/processors/mutation.js +3 -1
- package/dist/cjs/sync/processors/mutation.js.map +1 -0
- package/{lib → dist/cjs}/sync/processors/subscription.js +4 -4
- package/dist/cjs/sync/processors/subscription.js.map +1 -0
- package/{lib → dist/cjs}/sync/processors/sync.js +3 -1
- package/dist/cjs/sync/processors/sync.js.map +1 -0
- package/{lib → dist/cjs}/sync/utils.js +3 -1
- package/dist/cjs/sync/utils.js.map +1 -0
- package/{lib → dist/cjs}/types.js +12 -21
- package/dist/cjs/types.js.map +1 -0
- package/{lib → dist/cjs}/util.js +3 -1
- package/dist/cjs/util.js.map +1 -0
- package/{lib-esm/authModeStrategies/defaultAuthStrategy.js → dist/esm/authModeStrategies/defaultAuthStrategy.mjs} +4 -1
- package/dist/esm/authModeStrategies/defaultAuthStrategy.mjs.map +1 -0
- package/dist/esm/authModeStrategies/index.mjs +3 -0
- package/dist/esm/authModeStrategies/index.mjs.map +1 -0
- package/{lib-esm/authModeStrategies/multiAuthStrategy.js → dist/esm/authModeStrategies/multiAuthStrategy.mjs} +7 -5
- package/dist/esm/authModeStrategies/multiAuthStrategy.mjs.map +1 -0
- package/{lib-esm/datastore/datastore.js → dist/esm/datastore/datastore.mjs} +30 -26
- package/dist/esm/datastore/datastore.mjs.map +1 -0
- package/dist/esm/index.mjs +19 -0
- package/dist/esm/index.mjs.map +1 -0
- package/{lib-esm/predicates/index.js → dist/esm/predicates/index.mjs} +10 -7
- package/dist/esm/predicates/index.mjs.map +1 -0
- package/{lib-esm/predicates/next.js → dist/esm/predicates/next.mjs} +15 -11
- package/dist/esm/predicates/next.mjs.map +1 -0
- package/{lib-esm/predicates/sort.js → dist/esm/predicates/sort.mjs} +3 -2
- package/dist/esm/predicates/sort.mjs.map +1 -0
- package/{lib-esm/storage/adapter/AsyncStorageAdapter.js → dist/esm/storage/adapter/AsyncStorageAdapter.mjs} +10 -6
- package/dist/esm/storage/adapter/AsyncStorageAdapter.mjs.map +1 -0
- package/{lib-esm/storage/adapter/AsyncStorageDatabase.js → dist/esm/storage/adapter/AsyncStorageDatabase.mjs} +7 -4
- package/dist/esm/storage/adapter/AsyncStorageDatabase.mjs.map +1 -0
- package/{lib-esm/storage/adapter/InMemoryStore.js → dist/esm/storage/adapter/InMemoryStore.mjs} +5 -2
- package/dist/esm/storage/adapter/InMemoryStore.mjs.map +1 -0
- package/{lib-esm/storage/adapter/InMemoryStore.native.js → dist/esm/storage/adapter/InMemoryStore.native.mjs} +6 -2
- package/dist/esm/storage/adapter/InMemoryStore.native.mjs.map +1 -0
- package/{lib-esm/storage/adapter/IndexedDBAdapter.js → dist/esm/storage/adapter/IndexedDBAdapter.mjs} +10 -6
- package/dist/esm/storage/adapter/IndexedDBAdapter.mjs.map +1 -0
- package/{lib-esm/storage/adapter/StorageAdapterBase.js → dist/esm/storage/adapter/StorageAdapterBase.mjs} +9 -5
- package/dist/esm/storage/adapter/StorageAdapterBase.mjs.map +1 -0
- package/dist/esm/storage/adapter/getDefaultAdapter/index.mjs +13 -0
- package/dist/esm/storage/adapter/getDefaultAdapter/index.mjs.map +1 -0
- package/dist/esm/storage/adapter/getDefaultAdapter/index.native.mjs +8 -0
- package/dist/esm/storage/adapter/getDefaultAdapter/index.native.mjs.map +1 -0
- package/dist/esm/storage/adapter/index.mjs +2 -0
- package/dist/esm/storage/adapter/index.mjs.map +1 -0
- package/{lib-esm/storage/relationship.js → dist/esm/storage/relationship.mjs} +6 -2
- package/dist/esm/storage/relationship.mjs.map +1 -0
- package/{lib-esm/storage/storage.js → dist/esm/storage/storage.mjs} +11 -8
- package/dist/esm/storage/storage.mjs.map +1 -0
- package/{lib-esm/sync/datastoreConnectivity.js → dist/esm/sync/datastoreConnectivity.mjs} +9 -5
- package/dist/esm/sync/datastoreConnectivity.mjs.map +1 -0
- package/dist/esm/sync/datastoreReachability/index.d.ts +1 -0
- package/{lib-esm/sync/datastoreReachability/index.js → dist/esm/sync/datastoreReachability/index.mjs} +6 -2
- package/dist/esm/sync/datastoreReachability/index.mjs.map +1 -0
- package/dist/esm/sync/datastoreReachability/index.native.d.ts +1 -0
- package/{lib-esm/sync/datastoreReachability/index.native.js → dist/esm/sync/datastoreReachability/index.native.mjs} +7 -3
- package/dist/esm/sync/datastoreReachability/index.native.mjs.map +1 -0
- package/{lib-esm/sync/index.js → dist/esm/sync/index.mjs} +24 -21
- package/dist/esm/sync/index.mjs.map +1 -0
- package/{lib-esm/sync/merger.js → dist/esm/sync/merger.mjs} +5 -2
- package/dist/esm/sync/merger.mjs.map +1 -0
- package/{lib-esm/sync/outbox.js → dist/esm/sync/outbox.mjs} +7 -4
- package/dist/esm/sync/outbox.mjs.map +1 -0
- package/{lib-esm/sync/processors/errorMaps.js → dist/esm/sync/processors/errorMaps.mjs} +13 -11
- package/dist/esm/sync/processors/errorMaps.mjs.map +1 -0
- package/{lib → dist/esm}/sync/processors/mutation.d.ts +1 -1
- package/{lib-esm/sync/processors/mutation.js → dist/esm/sync/processors/mutation.mjs} +10 -7
- package/dist/esm/sync/processors/mutation.mjs.map +1 -0
- package/{lib-esm/sync/processors/subscription.js → dist/esm/sync/processors/subscription.mjs} +18 -17
- package/dist/esm/sync/processors/subscription.mjs.map +1 -0
- package/{lib-esm/sync/processors/sync.js → dist/esm/sync/processors/sync.mjs} +8 -5
- package/dist/esm/sync/processors/sync.mjs.map +1 -0
- package/{lib-esm/sync/utils.js → dist/esm/sync/utils.mjs} +30 -26
- package/dist/esm/sync/utils.mjs.map +1 -0
- package/{lib-esm/types.js → dist/esm/types.mjs} +34 -30
- package/dist/esm/types.mjs.map +1 -0
- package/{lib-esm/util.js → dist/esm/util.mjs} +61 -57
- package/dist/esm/util.mjs.map +1 -0
- package/package.json +133 -137
- package/lib/authModeStrategies/defaultAuthStrategy.d.ts +0 -2
- package/lib/authModeStrategies/index.d.ts +0 -2
- package/lib/authModeStrategies/multiAuthStrategy.d.ts +0 -13
- package/lib/datastore/datastore.d.ts +0 -231
- package/lib/index.d.ts +0 -16
- package/lib/predicates/index.d.ts +0 -100
- package/lib/predicates/next.d.ts +0 -317
- package/lib/predicates/sort.d.ts +0 -8
- package/lib/ssr/index.d.ts +0 -3
- package/lib/ssr/index.js +0 -18
- package/lib/storage/adapter/AsyncStorageAdapter.d.ts +0 -40
- package/lib/storage/adapter/AsyncStorageDatabase.d.ts +0 -39
- package/lib/storage/adapter/InMemoryStore.d.ts +0 -11
- package/lib/storage/adapter/InMemoryStore.native.d.ts +0 -1
- package/lib/storage/adapter/IndexedDBAdapter.d.ts +0 -70
- package/lib/storage/adapter/StorageAdapterBase.d.ts +0 -134
- package/lib/storage/adapter/getDefaultAdapter/index.d.ts +0 -3
- package/lib/storage/adapter/getDefaultAdapter/index.native.d.ts +0 -3
- package/lib/storage/adapter/getDefaultAdapter/index.native.js +0 -10
- package/lib/storage/adapter/index.d.ts +0 -9
- package/lib/storage/relationship.d.ts +0 -149
- package/lib/storage/storage.d.ts +0 -50
- package/lib/sync/datastoreConnectivity.d.ts +0 -16
- package/lib/sync/datastoreReachability/index.d.ts +0 -1
- package/lib/sync/datastoreReachability/index.native.d.ts +0 -1
- package/lib/sync/index.d.ts +0 -103
- package/lib/sync/merger.d.ts +0 -17
- package/lib/sync/outbox.d.ts +0 -27
- package/lib/sync/processors/errorMaps.d.ts +0 -17
- package/lib/sync/processors/subscription.d.ts +0 -42
- package/lib/sync/processors/sync.d.ts +0 -28
- package/lib/sync/utils.d.ts +0 -107
- package/lib/tsconfig.tsbuildinfo +0 -1
- package/lib/types.d.ts +0 -641
- package/lib/util.d.ts +0 -196
- package/lib-esm/authModeStrategies/index.js +0 -4
- package/lib-esm/index.js +0 -14
- package/lib-esm/ssr/index.d.ts +0 -3
- package/lib-esm/ssr/index.js +0 -13
- package/lib-esm/storage/adapter/getDefaultAdapter/index.js +0 -10
- package/lib-esm/storage/adapter/getDefaultAdapter/index.native.js +0 -5
- package/lib-esm/storage/adapter/index.js +0 -1
- package/lib-esm/sync/datastoreReachability/index.d.ts +0 -1
- package/lib-esm/sync/datastoreReachability/index.native.d.ts +0 -1
- package/lib-esm/sync/processors/mutation.d.ts +0 -67
- package/lib-esm/tsconfig.tsbuildinfo +0 -1
- package/src/ssr/index.ts +0 -27
- package/ssr/package.json +0 -8
- /package/{lib-esm → dist/esm}/authModeStrategies/defaultAuthStrategy.d.ts +0 -0
- /package/{lib-esm → dist/esm}/authModeStrategies/index.d.ts +0 -0
- /package/{lib-esm → dist/esm}/authModeStrategies/multiAuthStrategy.d.ts +0 -0
- /package/{lib-esm → dist/esm}/datastore/datastore.d.ts +0 -0
- /package/{lib-esm → dist/esm}/index.d.ts +0 -0
- /package/{lib-esm → dist/esm}/predicates/index.d.ts +0 -0
- /package/{lib-esm → dist/esm}/predicates/next.d.ts +0 -0
- /package/{lib-esm → dist/esm}/predicates/sort.d.ts +0 -0
- /package/{lib-esm → dist/esm}/storage/adapter/AsyncStorageAdapter.d.ts +0 -0
- /package/{lib-esm → dist/esm}/storage/adapter/AsyncStorageDatabase.d.ts +0 -0
- /package/{lib-esm → dist/esm}/storage/adapter/InMemoryStore.d.ts +0 -0
- /package/{lib-esm → dist/esm}/storage/adapter/InMemoryStore.native.d.ts +0 -0
- /package/{lib-esm → dist/esm}/storage/adapter/IndexedDBAdapter.d.ts +0 -0
- /package/{lib-esm → dist/esm}/storage/adapter/StorageAdapterBase.d.ts +0 -0
- /package/{lib-esm → dist/esm}/storage/adapter/getDefaultAdapter/index.d.ts +0 -0
- /package/{lib-esm → dist/esm}/storage/adapter/getDefaultAdapter/index.native.d.ts +0 -0
- /package/{lib-esm → dist/esm}/storage/adapter/index.d.ts +0 -0
- /package/{lib-esm → dist/esm}/storage/relationship.d.ts +0 -0
- /package/{lib-esm → dist/esm}/storage/storage.d.ts +0 -0
- /package/{lib-esm → dist/esm}/sync/datastoreConnectivity.d.ts +0 -0
- /package/{lib-esm → dist/esm}/sync/index.d.ts +0 -0
- /package/{lib-esm → dist/esm}/sync/merger.d.ts +0 -0
- /package/{lib-esm → dist/esm}/sync/outbox.d.ts +0 -0
- /package/{lib-esm → dist/esm}/sync/processors/errorMaps.d.ts +0 -0
- /package/{lib-esm → dist/esm}/sync/processors/subscription.d.ts +0 -0
- /package/{lib-esm → dist/esm}/sync/processors/sync.d.ts +0 -0
- /package/{lib-esm → dist/esm}/sync/utils.d.ts +0 -0
- /package/{lib-esm → dist/esm}/types.d.ts +0 -0
- /package/{lib-esm → dist/esm}/util.d.ts +0 -0
package/lib/util.d.ts
DELETED
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
import { ULID } from 'ulid';
|
|
2
|
-
import { Patch } from 'immer';
|
|
3
|
-
import { ModelInstanceCreator } from './datastore/datastore';
|
|
4
|
-
import { AllOperators, PersistentModel, PersistentModelConstructor, PredicateGroups, PredicateObject, PredicatesGroup, RelationshipType, RelationType, ModelKeys, ModelAttributes, SchemaNamespace, SortPredicatesGroup, NonModelTypeConstructor, PaginationInput, DeferredCallbackResolverOptions, SchemaModel, ModelAttribute, IndexesType, ModelAssociation } from './types';
|
|
5
|
-
export declare const ID = "id";
|
|
6
|
-
/**
|
|
7
|
-
* Used by the Async Storage Adapter to concatenate key values
|
|
8
|
-
* for a record. For instance, if a model has the following keys:
|
|
9
|
-
* `customId: ID! @primaryKey(sortKeyFields: ["createdAt"])`,
|
|
10
|
-
* we concatenate the `customId` and `createdAt` as:
|
|
11
|
-
* `12-234-5#2022-09-28T00:00:00.000Z`
|
|
12
|
-
*/
|
|
13
|
-
export declare const DEFAULT_PRIMARY_KEY_VALUE_SEPARATOR = "#";
|
|
14
|
-
/**
|
|
15
|
-
* Used for generating spinal-cased index name from an array of
|
|
16
|
-
* key field names.
|
|
17
|
-
* E.g. for keys `[id, title]` => 'id-title'
|
|
18
|
-
*/
|
|
19
|
-
export declare const IDENTIFIER_KEY_SEPARATOR = "-";
|
|
20
|
-
export declare const errorMessages: {
|
|
21
|
-
idEmptyString: string;
|
|
22
|
-
queryByPkWithCompositeKeyPresent: string;
|
|
23
|
-
deleteByPkWithCompositeKeyPresent: string;
|
|
24
|
-
observeWithObjectLiteral: string;
|
|
25
|
-
};
|
|
26
|
-
export declare enum NAMESPACES {
|
|
27
|
-
DATASTORE = "datastore",
|
|
28
|
-
USER = "user",
|
|
29
|
-
SYNC = "sync",
|
|
30
|
-
STORAGE = "storage"
|
|
31
|
-
}
|
|
32
|
-
declare const DATASTORE = NAMESPACES.DATASTORE;
|
|
33
|
-
declare const USER = NAMESPACES.USER;
|
|
34
|
-
declare const SYNC = NAMESPACES.SYNC;
|
|
35
|
-
declare const STORAGE = NAMESPACES.STORAGE;
|
|
36
|
-
export { USER, SYNC, STORAGE, DATASTORE };
|
|
37
|
-
export declare const exhaustiveCheck: (obj: never, throwOnError?: boolean) => void;
|
|
38
|
-
export declare const isNullOrUndefined: (val: any) => boolean;
|
|
39
|
-
export declare const validatePredicate: <T extends Readonly<Record<string, any>>>(model: T, groupType: keyof PredicateGroups<T>, predicatesOrGroups: (PredicateObject<T> | PredicatesGroup<T>)[]) => any;
|
|
40
|
-
export declare const validatePredicateField: <T>(value: T, operator: keyof AllOperators, operand: T | [T, T]) => boolean;
|
|
41
|
-
export declare const isModelConstructor: <T extends Readonly<Record<string, any>>>(obj: any) => obj is PersistentModelConstructor<T>;
|
|
42
|
-
export declare function registerNonModelClass(clazz: NonModelTypeConstructor<any>): void;
|
|
43
|
-
export declare const isNonModelConstructor: (obj: any) => obj is NonModelTypeConstructor<any>;
|
|
44
|
-
export declare const traverseModel: <T extends Readonly<Record<string, any>>>(srcModelName: string, instance: T, namespace: SchemaNamespace, modelInstanceCreator: ModelInstanceCreator, getModelConstructorByModelName: (namsespaceName: NAMESPACES, modelName: string) => PersistentModelConstructor<any>) => {
|
|
45
|
-
modelName: string;
|
|
46
|
-
item: T;
|
|
47
|
-
instance: T;
|
|
48
|
-
}[];
|
|
49
|
-
export declare const isPrivateMode: () => Promise<unknown>;
|
|
50
|
-
/**
|
|
51
|
-
* Whether the browser's implementation of IndexedDB breaks on array lookups
|
|
52
|
-
* against composite indexes whose keypath contains a single column.
|
|
53
|
-
*
|
|
54
|
-
* E.g., Whether `store.createIndex(indexName, ['id'])` followed by
|
|
55
|
-
* `store.index(indexName).get([1])` will *ever* return records.
|
|
56
|
-
*
|
|
57
|
-
* In all known, modern Safari browsers as of Q4 2022, the query against an index like
|
|
58
|
-
* this will *always* return `undefined`. So, the index needs to be created as a scalar.
|
|
59
|
-
*/
|
|
60
|
-
export declare const isSafariCompatabilityMode: () => Promise<boolean>;
|
|
61
|
-
export declare function monotonicUlidFactory(seed?: number): ULID;
|
|
62
|
-
/**
|
|
63
|
-
* Uses performance.now() if available, otherwise, uses Date.now() (e.g. react native without a polyfill)
|
|
64
|
-
*
|
|
65
|
-
* The values returned by performance.now() always increase at a constant rate,
|
|
66
|
-
* independent of the system clock (which might be adjusted manually or skewed
|
|
67
|
-
* by software like NTP).
|
|
68
|
-
*
|
|
69
|
-
* Otherwise, performance.timing.navigationStart + performance.now() will be
|
|
70
|
-
* approximately equal to Date.now()
|
|
71
|
-
*
|
|
72
|
-
* See: https://developer.mozilla.org/en-US/docs/Web/API/Performance/now#Example
|
|
73
|
-
*/
|
|
74
|
-
export declare function getNow(): number;
|
|
75
|
-
export declare function sortCompareFunction<T extends PersistentModel>(sortPredicates: SortPredicatesGroup<T>): (a: any, b: any) => number;
|
|
76
|
-
export declare function valuesEqual(valA: any, valB: any, nullish?: boolean): boolean;
|
|
77
|
-
/**
|
|
78
|
-
* Statelessly extracts the specified page from an array.
|
|
79
|
-
*
|
|
80
|
-
* @param records - The source array to extract a page from.
|
|
81
|
-
* @param pagination - A definition of the page to extract.
|
|
82
|
-
* @returns This items from `records` matching the `pagination` definition.
|
|
83
|
-
*/
|
|
84
|
-
export declare function inMemoryPagination<T extends PersistentModel>(records: T[], pagination?: PaginationInput<T>): T[];
|
|
85
|
-
/**
|
|
86
|
-
* An `aysnc` implementation of `Array.some()`. Returns as soon as a match is found.
|
|
87
|
-
* @param items The items to check.
|
|
88
|
-
* @param matches The async matcher function, expected to
|
|
89
|
-
* return Promise<boolean>: `true` for a matching item, `false` otherwise.
|
|
90
|
-
* @returns A `Promise<boolean>`, `true` if "some" items match; `false` otherwise.
|
|
91
|
-
*/
|
|
92
|
-
export declare function asyncSome(items: Record<string, any>[], matches: (item: Record<string, any>) => Promise<boolean>): Promise<boolean>;
|
|
93
|
-
/**
|
|
94
|
-
* An `aysnc` implementation of `Array.every()`. Returns as soon as a non-match is found.
|
|
95
|
-
* @param items The items to check.
|
|
96
|
-
* @param matches The async matcher function, expected to
|
|
97
|
-
* return Promise<boolean>: `true` for a matching item, `false` otherwise.
|
|
98
|
-
* @returns A `Promise<boolean>`, `true` if every item matches; `false` otherwise.
|
|
99
|
-
*/
|
|
100
|
-
export declare function asyncEvery(items: Record<string, any>[], matches: (item: Record<string, any>) => Promise<boolean>): Promise<boolean>;
|
|
101
|
-
/**
|
|
102
|
-
* An `async` implementation of `Array.filter()`. Returns after all items have been filtered.
|
|
103
|
-
* TODO: Return AsyncIterable.
|
|
104
|
-
* @param items The items to filter.
|
|
105
|
-
* @param matches The `async` matcher function, expected to
|
|
106
|
-
* return Promise<boolean>: `true` for a matching item, `false` otherwise.
|
|
107
|
-
* @returns A `Promise<T>` of matching items.
|
|
108
|
-
*/
|
|
109
|
-
export declare function asyncFilter<T>(items: T[], matches: (item: T) => Promise<boolean>): Promise<T[]>;
|
|
110
|
-
export declare const isAWSDate: (val: string) => boolean;
|
|
111
|
-
export declare const isAWSTime: (val: string) => boolean;
|
|
112
|
-
export declare const isAWSDateTime: (val: string) => boolean;
|
|
113
|
-
export declare const isAWSTimestamp: (val: number) => boolean;
|
|
114
|
-
export declare const isAWSEmail: (val: string) => boolean;
|
|
115
|
-
export declare const isAWSJSON: (val: string) => boolean;
|
|
116
|
-
export declare const isAWSURL: (val: string) => boolean;
|
|
117
|
-
export declare const isAWSPhone: (val: string) => boolean;
|
|
118
|
-
export declare const isAWSIPAddress: (val: string) => boolean;
|
|
119
|
-
export declare class DeferredPromise {
|
|
120
|
-
promise: Promise<string>;
|
|
121
|
-
resolve: (value: string | PromiseLike<string>) => void;
|
|
122
|
-
reject: () => void;
|
|
123
|
-
constructor();
|
|
124
|
-
}
|
|
125
|
-
export declare class DeferredCallbackResolver {
|
|
126
|
-
private limitPromise;
|
|
127
|
-
private timerPromise;
|
|
128
|
-
private maxInterval;
|
|
129
|
-
private timer;
|
|
130
|
-
private raceInFlight;
|
|
131
|
-
private callback;
|
|
132
|
-
private errorHandler;
|
|
133
|
-
private defaultErrorHandler;
|
|
134
|
-
constructor(options: DeferredCallbackResolverOptions);
|
|
135
|
-
private startTimer;
|
|
136
|
-
private racePromises;
|
|
137
|
-
start(): void;
|
|
138
|
-
clear(): void;
|
|
139
|
-
resolve(): void;
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* merge two sets of patches created by immer produce.
|
|
143
|
-
* newPatches take precedent over oldPatches for patches modifying the same path.
|
|
144
|
-
* In the case many consecutive pathces are merged the original model should
|
|
145
|
-
* always be the root model.
|
|
146
|
-
*
|
|
147
|
-
* Example:
|
|
148
|
-
* A -> B, patches1
|
|
149
|
-
* B -> C, patches2
|
|
150
|
-
*
|
|
151
|
-
* mergePatches(A, patches1, patches2) to get patches for A -> C
|
|
152
|
-
*
|
|
153
|
-
* @param originalSource the original Model the patches should be applied to
|
|
154
|
-
* @param oldPatches immer produce patch list
|
|
155
|
-
* @param newPatches immer produce patch list (will take precedence)
|
|
156
|
-
* @return merged patches
|
|
157
|
-
*/
|
|
158
|
-
export declare function mergePatches<T>(originalSource: T, oldPatches: Patch[], newPatches: Patch[]): Patch[];
|
|
159
|
-
export declare const getStorename: (namespace: string, modelName: string) => string;
|
|
160
|
-
export declare const processCompositeKeys: (attributes: ModelAttributes) => Set<string>[];
|
|
161
|
-
export declare const extractKeyIfExists: (modelDefinition: SchemaModel) => ModelAttribute | undefined;
|
|
162
|
-
export declare const extractPrimaryKeyFieldNames: (modelDefinition: SchemaModel) => string[];
|
|
163
|
-
export declare const extractPrimaryKeyValues: <T extends Readonly<Record<string, any>>>(model: T, keyFields: string[]) => string[];
|
|
164
|
-
export declare const extractPrimaryKeysAndValues: <T extends Readonly<Record<string, any>>>(model: T, keyFields: string[]) => any;
|
|
165
|
-
export declare const isIdManaged: (modelDefinition: SchemaModel) => boolean;
|
|
166
|
-
export declare const isIdOptionallyManaged: (modelDefinition: SchemaModel) => boolean;
|
|
167
|
-
export declare const establishRelationAndKeys: (namespace: SchemaNamespace) => [RelationshipType, ModelKeys];
|
|
168
|
-
export declare const getIndex: (rel: RelationType[], src: string) => string | undefined;
|
|
169
|
-
export declare const getIndexFromAssociation: (indexes: IndexesType, src: string | string[]) => string | undefined;
|
|
170
|
-
/**
|
|
171
|
-
* Backwards-compatability for schema generated prior to custom primary key support:
|
|
172
|
-
the single field `targetName` has been replaced with an array of `targetNames`.
|
|
173
|
-
`targetName` and `targetNames` are exclusive (will never exist on the same schema)
|
|
174
|
-
* @param src {RelationType | ModelAssociation | undefined}
|
|
175
|
-
* @returns array of targetNames, or `undefined`
|
|
176
|
-
*/
|
|
177
|
-
export declare const extractTargetNamesFromSrc: (src: RelationType | ModelAssociation | undefined) => string[] | undefined;
|
|
178
|
-
export declare const indexNameFromKeys: (keys: string[]) => string;
|
|
179
|
-
export declare const keysEqual: (keysA: any, keysB: any) => boolean;
|
|
180
|
-
export declare const getIndexKeys: (namespace: SchemaNamespace, modelName: string) => string[];
|
|
181
|
-
/**
|
|
182
|
-
* Determine what the managed timestamp field names are for the given model definition
|
|
183
|
-
* and return the mapping.
|
|
184
|
-
*
|
|
185
|
-
* All timestamp fields are included in the mapping, regardless of whether the final field
|
|
186
|
-
* names are the defaults or customized in the `@model` directive.
|
|
187
|
-
*
|
|
188
|
-
* @see https://docs.amplify.aws/cli/graphql/data-modeling/#customize-creation-and-update-timestamps
|
|
189
|
-
*
|
|
190
|
-
* @param definition modelDefinition to inspect.
|
|
191
|
-
* @returns An object mapping `createdAt` and `updatedAt` to their field names.
|
|
192
|
-
*/
|
|
193
|
-
export declare const getTimestampFields: (definition: SchemaModel) => {
|
|
194
|
-
createdAt: string;
|
|
195
|
-
updatedAt: string;
|
|
196
|
-
};
|
package/lib-esm/index.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
export { DataStore, DataStoreClass, initSchema, AsyncCollection, AsyncItem, } from './datastore/datastore';
|
|
4
|
-
export { Predicates, ModelPredicateCreator, ModelSortPredicateCreator, } from './predicates';
|
|
5
|
-
import { traverseModel, validatePredicate, USER, isNonModelConstructor, isModelConstructor, } from './util';
|
|
6
|
-
export { NAMESPACES } from './util';
|
|
7
|
-
export const utils = {
|
|
8
|
-
USER,
|
|
9
|
-
traverseModel,
|
|
10
|
-
validatePredicate,
|
|
11
|
-
isNonModelConstructor,
|
|
12
|
-
isModelConstructor,
|
|
13
|
-
};
|
|
14
|
-
export * from './types';
|
package/lib-esm/ssr/index.d.ts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { PersistentModel, PersistentModelConstructor } from '@aws-amplify/datastore';
|
|
2
|
-
export declare function deserializeModel<T extends PersistentModel>(Model: PersistentModelConstructor<T>, init: T | T[]): any;
|
|
3
|
-
export declare function serializeModel<T extends PersistentModel>(model: T | T[]): JSON;
|
package/lib-esm/ssr/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// Helper for converting JSON back into DataStore models (while respecting IDs)
|
|
2
|
-
export function deserializeModel(Model, init) {
|
|
3
|
-
if (Array.isArray(init)) {
|
|
4
|
-
return init.map(init => deserializeModel(Model, init));
|
|
5
|
-
}
|
|
6
|
-
// `fromJSON` is intentionally hidden from types as a "private" method (though it exists on the instance)
|
|
7
|
-
// @ts-ignore Property 'fromJSON' does not exist on type 'PersistentModelConstructor<T>'.ts(2339)
|
|
8
|
-
return Model.fromJSON(init);
|
|
9
|
-
}
|
|
10
|
-
// Helper for converting DataStore models to JSON
|
|
11
|
-
export function serializeModel(model) {
|
|
12
|
-
return JSON.parse(JSON.stringify(model));
|
|
13
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import IndexedDBAdapter from '../IndexedDBAdapter';
|
|
2
|
-
import AsyncStorageAdapter from '../AsyncStorageAdapter';
|
|
3
|
-
import { isWebWorker, isBrowser } from '@aws-amplify/core/internals/utils';
|
|
4
|
-
const getDefaultAdapter = () => {
|
|
5
|
-
if ((isBrowser && window.indexedDB) || (isWebWorker() && self.indexedDB)) {
|
|
6
|
-
return IndexedDBAdapter;
|
|
7
|
-
}
|
|
8
|
-
return AsyncStorageAdapter;
|
|
9
|
-
};
|
|
10
|
-
export default getDefaultAdapter;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const ReachabilityMonitor: import("rxjs").Observable<import("@aws-amplify/core/lib-esm/Reachability/types").NetworkStatus>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const ReachabilityMonitor: import("rxjs").Observable<import("@aws-amplify/core/lib-esm/Reachability/types").NetworkStatus>;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { Observable } from 'rxjs';
|
|
2
|
-
import { MutationEvent } from '../';
|
|
3
|
-
import { ModelInstanceCreator } from '../../datastore/datastore';
|
|
4
|
-
import { ExclusiveStorage as Storage } from '../../storage/storage';
|
|
5
|
-
import { AuthModeStrategy, ConflictHandler, ErrorHandler, InternalSchema, PersistentModel, PersistentModelConstructor, SchemaModel, TypeConstructorMap, AmplifyContext } from '../../types';
|
|
6
|
-
import { MutationEventOutbox } from '../outbox';
|
|
7
|
-
import { TransformerMutationType } from '../utils';
|
|
8
|
-
type MutationProcessorEvent = {
|
|
9
|
-
operation: TransformerMutationType;
|
|
10
|
-
modelDefinition: SchemaModel;
|
|
11
|
-
model: PersistentModel;
|
|
12
|
-
hasMore: boolean;
|
|
13
|
-
};
|
|
14
|
-
declare class MutationProcessor {
|
|
15
|
-
private readonly schema;
|
|
16
|
-
private readonly storage;
|
|
17
|
-
private readonly userClasses;
|
|
18
|
-
private readonly outbox;
|
|
19
|
-
private readonly modelInstanceCreator;
|
|
20
|
-
private readonly MutationEvent;
|
|
21
|
-
private readonly amplifyConfig;
|
|
22
|
-
private readonly authModeStrategy;
|
|
23
|
-
private readonly errorHandler;
|
|
24
|
-
private readonly conflictHandler;
|
|
25
|
-
private readonly amplifyContext;
|
|
26
|
-
/**
|
|
27
|
-
* The observer that receives messages when mutations are successfully completed
|
|
28
|
-
* against cloud storage.
|
|
29
|
-
*
|
|
30
|
-
* A value of `undefined` signals that the sync has either been stopped or has not
|
|
31
|
-
* yet started. In this case, `isReady()` will be `false` and `resume()` will exit
|
|
32
|
-
* early.
|
|
33
|
-
*/
|
|
34
|
-
private observer?;
|
|
35
|
-
private readonly typeQuery;
|
|
36
|
-
private processing;
|
|
37
|
-
private runningProcesses;
|
|
38
|
-
constructor(schema: InternalSchema, storage: Storage, userClasses: TypeConstructorMap, outbox: MutationEventOutbox, modelInstanceCreator: ModelInstanceCreator, MutationEvent: PersistentModelConstructor<MutationEvent>, amplifyConfig: Record<string, any>, authModeStrategy: AuthModeStrategy, errorHandler: ErrorHandler, conflictHandler: ConflictHandler, amplifyContext: AmplifyContext);
|
|
39
|
-
private generateQueries;
|
|
40
|
-
private isReady;
|
|
41
|
-
start(): Observable<MutationProcessorEvent>;
|
|
42
|
-
stop(): Promise<void>;
|
|
43
|
-
removeObserver(): void;
|
|
44
|
-
resume(): Promise<void>;
|
|
45
|
-
private jitteredRetry;
|
|
46
|
-
private createQueryVariables;
|
|
47
|
-
private opTypeFromTransformerOperation;
|
|
48
|
-
pause(): void;
|
|
49
|
-
}
|
|
50
|
-
declare const originalJitteredBackoff: import("@aws-amplify/core/lib-esm/types").DelayFunction;
|
|
51
|
-
/**
|
|
52
|
-
* @private
|
|
53
|
-
* Internal use of Amplify only.
|
|
54
|
-
*
|
|
55
|
-
* Wraps the jittered backoff calculation to retry Network Errors indefinitely.
|
|
56
|
-
* Backs off according to original jittered retry logic until the original retry
|
|
57
|
-
* logic hits its max. After this occurs, if the error is a Network Error, we
|
|
58
|
-
* ignore the attempt count and return MAX_RETRY_DELAY_MS to retry forever (until
|
|
59
|
-
* the request succeeds).
|
|
60
|
-
*
|
|
61
|
-
* @param attempt ignored
|
|
62
|
-
* @param _args ignored
|
|
63
|
-
* @param error tested to see if `.message` is 'Network Error'
|
|
64
|
-
* @returns number | false :
|
|
65
|
-
*/
|
|
66
|
-
export declare const safeJitteredBackoff: typeof originalJitteredBackoff;
|
|
67
|
-
export { MutationProcessor };
|