@aws-amplify/datastore 4.1.1 → 4.1.2
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 +8 -0
- package/lib/storage/adapter/AsyncStorageAdapter.d.ts +52 -28
- package/lib/storage/adapter/AsyncStorageAdapter.js +212 -476
- package/lib/storage/adapter/AsyncStorageAdapter.js.map +1 -1
- package/lib/storage/adapter/AsyncStorageDatabase.js.map +1 -1
- package/lib/storage/adapter/IndexedDBAdapter.d.ts +53 -28
- package/lib/storage/adapter/IndexedDBAdapter.js +589 -892
- package/lib/storage/adapter/IndexedDBAdapter.js.map +1 -1
- package/lib/storage/adapter/StorageAdapterBase.d.ts +146 -0
- package/lib/storage/adapter/StorageAdapterBase.js +479 -0
- package/lib/storage/adapter/StorageAdapterBase.js.map +1 -0
- package/lib-esm/storage/adapter/AsyncStorageAdapter.d.ts +52 -28
- package/lib-esm/storage/adapter/AsyncStorageAdapter.js +215 -479
- package/lib-esm/storage/adapter/AsyncStorageAdapter.js.map +1 -1
- package/lib-esm/storage/adapter/AsyncStorageDatabase.js.map +1 -1
- package/lib-esm/storage/adapter/IndexedDBAdapter.d.ts +53 -28
- package/lib-esm/storage/adapter/IndexedDBAdapter.js +588 -891
- package/lib-esm/storage/adapter/IndexedDBAdapter.js.map +1 -1
- package/lib-esm/storage/adapter/StorageAdapterBase.d.ts +146 -0
- package/lib-esm/storage/adapter/StorageAdapterBase.js +477 -0
- package/lib-esm/storage/adapter/StorageAdapterBase.js.map +1 -0
- package/package.json +6 -6
- package/src/storage/adapter/AsyncStorageAdapter.ts +239 -543
- package/src/storage/adapter/AsyncStorageDatabase.ts +2 -2
- package/src/storage/adapter/IndexedDBAdapter.ts +423 -786
- package/src/storage/adapter/StorageAdapterBase.ts +639 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [4.1.2](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/datastore@4.1.1...@aws-amplify/datastore@4.1.2) (2023-03-16)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @aws-amplify/datastore
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [4.1.1](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/datastore@4.1.0...@aws-amplify/datastore@4.1.1) (2023-03-13)
|
|
7
15
|
|
|
8
16
|
|
|
@@ -1,42 +1,66 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { InternalSchema, ModelInstanceMetadata, ModelPredicate, NamespaceResolver, OpType, PaginationInput, PersistentModel, PersistentModelConstructor, QueryOne } from '../../types';
|
|
1
|
+
import AsyncStorageDatabase from './AsyncStorageDatabase';
|
|
2
|
+
import { ModelInstanceMetadata, ModelPredicate, OpType, PaginationInput, PersistentModel, PersistentModelConstructor, QueryOne, RelationType } from '../../types';
|
|
4
3
|
import { NAMESPACES } from '../../util';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
4
|
+
import { StorageAdapterBase } from './StorageAdapterBase';
|
|
5
|
+
export declare class AsyncStorageAdapter extends StorageAdapterBase {
|
|
6
|
+
protected db: AsyncStorageDatabase;
|
|
7
|
+
protected preSetUpChecks(): Promise<void>;
|
|
8
|
+
protected preOpCheck(): Promise<void>;
|
|
9
|
+
/**
|
|
10
|
+
* Open AsyncStorage database
|
|
11
|
+
* Create new DB if one doesn't exist
|
|
12
|
+
*
|
|
13
|
+
* Called by `StorageAdapterBase.setUp()`
|
|
14
|
+
*
|
|
15
|
+
* @returns AsyncStorageDatabase instance
|
|
16
|
+
*/
|
|
17
|
+
protected initDb(): Promise<AsyncStorageDatabase>;
|
|
18
|
+
clear(): Promise<void>;
|
|
19
|
+
batchSave<T extends PersistentModel>(modelConstructor: PersistentModelConstructor<any>, items: ModelInstanceMetadata[]): Promise<[T, OpType][]>;
|
|
20
|
+
protected _get<T>(storeName: string, keyArr: string[]): Promise<T>;
|
|
18
21
|
save<T extends PersistentModel>(model: T, condition?: ModelPredicate<T>): Promise<[T, OpType.INSERT | OpType.UPDATE][]>;
|
|
19
|
-
private load;
|
|
20
22
|
query<T extends PersistentModel>(modelConstructor: PersistentModelConstructor<T>, predicate?: ModelPredicate<T>, pagination?: PaginationInput<T>): Promise<T[]>;
|
|
21
23
|
private getByKey;
|
|
22
24
|
private getAll;
|
|
23
|
-
private keyValueFromPredicate;
|
|
24
25
|
private filterOnPredicate;
|
|
25
26
|
private inMemoryPagination;
|
|
26
27
|
queryOne<T extends PersistentModel>(modelConstructor: PersistentModelConstructor<T>, firstOrLast?: QueryOne): Promise<T | undefined>;
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
protected deleteItem<T extends PersistentModel>(deleteQueue?: {
|
|
29
|
+
storeName: string;
|
|
30
|
+
items: T[] | IDBValidKey[];
|
|
31
|
+
}[]): Promise<void>;
|
|
29
32
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* @param
|
|
33
|
+
* Gets related Has One record for `model`
|
|
34
|
+
*
|
|
35
|
+
* @param model
|
|
33
36
|
* @param srcModel
|
|
34
|
-
* @param
|
|
35
|
-
* @param
|
|
37
|
+
* @param namespace
|
|
38
|
+
* @param rel
|
|
39
|
+
* @returns
|
|
36
40
|
*/
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
41
|
+
protected getHasOneChild<T extends PersistentModel>(model: T, srcModel: string, namespace: NAMESPACES, rel: RelationType): Promise<any>;
|
|
42
|
+
/**
|
|
43
|
+
* Backwards compatability for pre-CPK codegen
|
|
44
|
+
* TODO - deprecate this in v6; will need to re-gen MIPR for older unit
|
|
45
|
+
* tests that hit this path
|
|
46
|
+
*/
|
|
47
|
+
protected getHasOneChildLegacy<T extends PersistentModel>(model: T, srcModel: string, namespace: NAMESPACES, rel: RelationType): Promise<T>;
|
|
48
|
+
/**
|
|
49
|
+
* Gets related Has Many records by given `storeName`, `index`, and `keyValues`
|
|
50
|
+
*
|
|
51
|
+
* @param storeName
|
|
52
|
+
* @param index
|
|
53
|
+
* @param keyValues
|
|
54
|
+
* @returns
|
|
55
|
+
*/
|
|
56
|
+
protected getHasManyChildren<T extends PersistentModel>(storeName: string, index: string, keyValues: string[]): Promise<T[]>;
|
|
57
|
+
/**
|
|
58
|
+
* Retrieves concatenated primary key values from a model
|
|
59
|
+
*
|
|
60
|
+
* @param model
|
|
61
|
+
* @returns
|
|
62
|
+
*/
|
|
63
|
+
private getIndexKeyValuesPath;
|
|
40
64
|
}
|
|
41
65
|
declare const _default: AsyncStorageAdapter;
|
|
42
66
|
export default _default;
|