@aws-amplify/datastore 3.7.7-unstable.9 → 3.7.8-cloud-logging.8
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 +31 -50
- package/README.md +154 -0
- package/dist/aws-amplify-datastore.js +1083 -497
- package/dist/aws-amplify-datastore.js.map +1 -1
- package/dist/aws-amplify-datastore.min.js +22 -78
- package/dist/aws-amplify-datastore.min.js.map +1 -1
- package/lib/datastore/datastore.js +34 -9
- package/lib/datastore/datastore.js.map +1 -1
- package/lib/storage/adapter/IndexedDBAdapter.js.map +1 -1
- package/lib/storage/adapter/index.d.ts +1 -0
- package/lib/storage/storage.d.ts +4 -2
- package/lib/storage/storage.js +41 -4
- package/lib/storage/storage.js.map +1 -1
- package/lib/sync/index.js +20 -13
- package/lib/sync/index.js.map +1 -1
- package/lib/sync/merger.js +1 -0
- package/lib/sync/merger.js.map +1 -1
- package/lib/sync/outbox.js +1 -0
- package/lib/sync/outbox.js.map +1 -1
- package/lib/sync/processors/mutation.d.ts +17 -0
- package/lib/sync/processors/mutation.js +28 -2
- package/lib/sync/processors/mutation.js.map +1 -1
- package/lib/sync/processors/subscription.js +1 -2
- package/lib/sync/processors/subscription.js.map +1 -1
- package/lib/sync/processors/sync.js.map +1 -1
- package/lib/sync/utils.js.map +1 -1
- package/lib/types.d.ts +4 -1
- package/lib/types.js.map +1 -1
- package/lib-esm/datastore/datastore.js +34 -9
- package/lib-esm/datastore/datastore.js.map +1 -1
- package/lib-esm/storage/adapter/IndexedDBAdapter.js.map +1 -1
- package/lib-esm/storage/adapter/index.d.ts +1 -0
- package/lib-esm/storage/storage.d.ts +4 -2
- package/lib-esm/storage/storage.js +41 -4
- package/lib-esm/storage/storage.js.map +1 -1
- package/lib-esm/sync/index.js +20 -13
- package/lib-esm/sync/index.js.map +1 -1
- package/lib-esm/sync/merger.js +1 -0
- package/lib-esm/sync/merger.js.map +1 -1
- package/lib-esm/sync/outbox.js +1 -0
- package/lib-esm/sync/outbox.js.map +1 -1
- package/lib-esm/sync/processors/mutation.d.ts +17 -0
- package/lib-esm/sync/processors/mutation.js +29 -3
- package/lib-esm/sync/processors/mutation.js.map +1 -1
- package/lib-esm/sync/processors/subscription.js +1 -2
- package/lib-esm/sync/processors/subscription.js.map +1 -1
- package/lib-esm/sync/processors/sync.js.map +1 -1
- package/lib-esm/sync/utils.js.map +1 -1
- package/lib-esm/types.d.ts +4 -1
- package/lib-esm/types.js.map +1 -1
- package/package.json +7 -7
- package/src/datastore/datastore.ts +30 -1
- package/src/storage/adapter/IndexedDBAdapter.ts +1 -0
- package/src/storage/adapter/index.ts +1 -0
- package/src/storage/storage.ts +31 -7
- package/src/sync/index.ts +8 -0
- package/src/sync/merger.ts +2 -0
- package/src/sync/outbox.ts +1 -0
- package/src/sync/processors/mutation.ts +59 -27
- package/src/sync/processors/subscription.ts +18 -20
- package/src/sync/processors/sync.ts +5 -4
- package/src/sync/utils.ts +3 -5
- package/src/types.ts +18 -13
- package/ssr/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,118 +3,99 @@
|
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
### Bug Fixes
|
|
6
|
+
# [3.10.0](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/datastore@3.9.0...@aws-amplify/datastore@3.10.0) (2022-04-14)
|
|
10
7
|
|
|
11
|
-
|
|
8
|
+
### Features
|
|
12
9
|
|
|
10
|
+
- **data:** Datastore Docs ([#9753](https://github.com/aws-amplify/amplify-js/issues/9753)) ([4eb824f](https://github.com/aws-amplify/amplify-js/commit/4eb824f168df408469557e6ccc60edfee99953c2))
|
|
13
11
|
|
|
12
|
+
# [3.9.0](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/datastore@3.8.0...@aws-amplify/datastore@3.9.0) (2022-04-04)
|
|
14
13
|
|
|
14
|
+
### Features
|
|
15
15
|
|
|
16
|
+
- update DataStore observe / observeQuery to return all fields in local update snapshot ([#9556](https://github.com/aws-amplify/amplify-js/issues/9556)) ([40ee89b](https://github.com/aws-amplify/amplify-js/commit/40ee89b828e859bfaadea2269cce96562ab6c90a))
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
# [3.8.0](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/datastore@3.7.9...@aws-amplify/datastore@3.8.0) (2022-03-28)
|
|
18
19
|
|
|
19
|
-
|
|
20
|
+
### Features
|
|
20
21
|
|
|
22
|
+
- PubSub Add Options objects for all Providers and fix: Spelling error and deprecation of old exports ([#9683](https://github.com/aws-amplify/amplify-js/issues/9683)) ([b535af2](https://github.com/aws-amplify/amplify-js/commit/b535af2133b5460c6e8e2fcfd89e1fe235872c27))
|
|
21
23
|
|
|
24
|
+
## [3.7.9](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/datastore@3.7.8...@aws-amplify/datastore@3.7.9) (2022-03-22)
|
|
22
25
|
|
|
26
|
+
### Bug Fixes
|
|
23
27
|
|
|
28
|
+
- **@aws-amplify/datastore:** fix mutations to retry indefinitely on network error ([#9724](https://github.com/aws-amplify/amplify-js/issues/9724)) ([5371380](https://github.com/aws-amplify/amplify-js/commit/53713804b79df9c69ac29b75ffc576b4c2002507))
|
|
24
29
|
|
|
25
|
-
## [3.7.
|
|
30
|
+
## [3.7.8](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/datastore@3.7.7...@aws-amplify/datastore@3.7.8) (2022-03-10)
|
|
26
31
|
|
|
27
32
|
**Note:** Version bump only for package @aws-amplify/datastore
|
|
28
33
|
|
|
34
|
+
## [3.7.7](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/datastore@3.7.6...@aws-amplify/datastore@3.7.7) (2022-02-28)
|
|
29
35
|
|
|
36
|
+
**Note:** Version bump only for package @aws-amplify/datastore
|
|
30
37
|
|
|
38
|
+
## [3.7.6](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/datastore@3.7.5...@aws-amplify/datastore@3.7.6) (2022-02-03)
|
|
31
39
|
|
|
40
|
+
### Bug Fixes
|
|
32
41
|
|
|
33
|
-
|
|
42
|
+
- **datastore:** correctly apply config values ([#9542](https://github.com/aws-amplify/amplify-js/issues/9542)) ([3f8b838](https://github.com/aws-amplify/amplify-js/commit/3f8b83869becf5f9963d61e6f7cfe695badb3b53))
|
|
34
43
|
|
|
44
|
+
## [3.7.5](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/datastore@3.7.4...@aws-amplify/datastore@3.7.5) (2022-01-27)
|
|
35
45
|
|
|
36
|
-
|
|
46
|
+
**Note:** Version bump only for package @aws-amplify/datastore
|
|
37
47
|
|
|
38
|
-
|
|
48
|
+
## [3.7.4](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/datastore@3.7.3...@aws-amplify/datastore@3.7.4) (2022-01-07)
|
|
39
49
|
|
|
50
|
+
**Note:** Version bump only for package @aws-amplify/datastore
|
|
40
51
|
|
|
52
|
+
## [3.7.3](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/datastore@3.7.2...@aws-amplify/datastore@3.7.3) (2021-12-16)
|
|
41
53
|
|
|
54
|
+
### Bug Fixes
|
|
42
55
|
|
|
56
|
+
- **@aws-amplify/datastore:** fixes observeQuery in local-only mode ([#9300](https://github.com/aws-amplify/amplify-js/issues/9300)) ([b0b57fb](https://github.com/aws-amplify/amplify-js/commit/b0b57fb1ba81d8ad190c4e67efb878ef4c6a2344))
|
|
43
57
|
|
|
44
58
|
## [3.7.2](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/datastore@3.7.1...@aws-amplify/datastore@3.7.2) (2021-12-03)
|
|
45
59
|
|
|
46
60
|
**Note:** Version bump only for package @aws-amplify/datastore
|
|
47
61
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
62
|
## [3.7.1](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/datastore@3.7.0...@aws-amplify/datastore@3.7.1) (2021-12-02)
|
|
53
63
|
|
|
54
|
-
|
|
55
64
|
### Bug Fixes
|
|
56
65
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
66
|
+
- **@aws-amplify/datastore:** belongsTo bug ([#9268](https://github.com/aws-amplify/amplify-js/issues/9268)) ([5106639](https://github.com/aws-amplify/amplify-js/commit/510663981a32443b79dd065ca075b664ca8bdff6))
|
|
67
|
+
- **@aws-amplify/datastore:** consecutive saves with timestamps ([#9298](https://github.com/aws-amplify/amplify-js/issues/9298)) ([807dea0](https://github.com/aws-amplify/amplify-js/commit/807dea0acae8389854560ca73b035ecbf220d040))
|
|
63
68
|
|
|
64
69
|
# [3.7.0](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/datastore@3.6.1...@aws-amplify/datastore@3.7.0) (2021-11-18)
|
|
65
70
|
|
|
66
|
-
|
|
67
71
|
### Features
|
|
68
72
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
73
|
+
- **@aws-amplify/datastore:** hasOne CRUD improvements ([#9239](https://github.com/aws-amplify/amplify-js/issues/9239)) ([d521d17](https://github.com/aws-amplify/amplify-js/commit/d521d17c45a246c63c02a29e103e8a3db374c11e))
|
|
74
74
|
|
|
75
75
|
## [3.6.1](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/datastore@3.6.0...@aws-amplify/datastore@3.6.1) (2021-11-16)
|
|
76
76
|
|
|
77
77
|
**Note:** Version bump only for package @aws-amplify/datastore
|
|
78
78
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
79
|
# [3.6.0](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/datastore@3.5.2...@aws-amplify/datastore@3.6.0) (2021-11-12)
|
|
84
80
|
|
|
85
|
-
|
|
86
81
|
### Features
|
|
87
82
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
83
|
+
- **@aws-amplify/datastore:** ObserveQuery performance and type enhancements ([#9141](https://github.com/aws-amplify/amplify-js/issues/9141)) ([755ce09](https://github.com/aws-amplify/amplify-js/commit/755ce09f5152c54d215f023089f30b2c98ace33a))
|
|
93
84
|
|
|
94
85
|
## [3.5.2](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/datastore@3.5.1...@aws-amplify/datastore@3.5.2) (2021-11-09)
|
|
95
86
|
|
|
96
|
-
|
|
97
87
|
### Bug Fixes
|
|
98
88
|
|
|
99
|
-
|
|
100
|
-
|
|
89
|
+
- **@aws-amplify/datastore:** use forEach instead of map to iterate over unsubscribe callbacks ([#9146](https://github.com/aws-amplify/amplify-js/issues/9146)) ([ec6ee1c](https://github.com/aws-amplify/amplify-js/commit/ec6ee1c066a283e4e34a287db5712f2bb944e6ba))
|
|
101
90
|
|
|
102
91
|
### Reverts
|
|
103
92
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
93
|
+
- uuid dependency upgrade ([#9159](https://github.com/aws-amplify/amplify-js/issues/9159)) ([4ef8aa9](https://github.com/aws-amplify/amplify-js/commit/4ef8aa9c7c25dbe921fd02b6205b8defb93fbaec))
|
|
109
94
|
|
|
110
95
|
## [3.5.1](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/datastore@3.5.0...@aws-amplify/datastore@3.5.1) (2021-10-28)
|
|
111
96
|
|
|
112
97
|
**Note:** Version bump only for package @aws-amplify/datastore
|
|
113
98
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
99
|
# [3.5.0](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/datastore@3.4.8...@aws-amplify/datastore@3.5.0) (2021-10-21)
|
|
119
100
|
|
|
120
101
|
### Features
|
package/README.md
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# AWS Amplify DataStore Docs
|
|
2
|
+
|
|
3
|
+
[Amplify DataStore](https://docs.amplify.aws/lib/datastore/getting-started/q/platform/js/) provides a programming model for leveraging shared and distributed data without writing additional code for offline and online scenarios, which makes working with distributed, cross-user data just as simple as working with local-only data.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
| package | version | open issues | closed issues |
|
|
8
|
+
| ---------------------- | --------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
9
|
+
| @aws-amplify/datastore |  | [](https://github.com/aws-amplify/amplify-js/issues?q=is%3Aissue+label%3ADataStore+is%3Aopen) | [](https://github.com/aws-amplify/amplify-js/issues?q=is%3Aissue+label%3ADataStore+is%3Aclosed) |
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## **👋 Note For Contributers: 👋**
|
|
14
|
+
|
|
15
|
+
_**Please update these docs any time you find something that is incorrect or lacking. In particular, if a line in the docs prompts a question, take a moment to figure out the answer, then update the docs with the necessary detail.**_
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Getting Started
|
|
20
|
+
|
|
21
|
+
Before you start reading through these docs, take a moment to understand [how DataStore works at a high level](https://docs.amplify.aws/lib/datastore/how-it-works/q/platform/js/). Additionally, we recommend first reading through [docs.amplify.aws](https://docs.amplify.aws/lib/datastore/getting-started/q/platform/js/). The purpose of these docs is to dive deep into the codebase itself and understand the inner workings of DataStore for the purpose of contributing. Understanding these docs is **not** necessary for using DataStore. Lastly, before reading, take a look at [the diagrams below](#diagrams).
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Docs
|
|
26
|
+
|
|
27
|
+
- [Conflict Resolution](docs/conflict-resolution.md)
|
|
28
|
+
- [Contributing](docs/contributing.md)
|
|
29
|
+
- [DataStore Lifecycle Events ("Start", "Stop", "Clear")](docs/datastore-lifecycle-events.md)
|
|
30
|
+
- This explains how DataStore fundementally works, and is a great place to start.
|
|
31
|
+
- [Getting Started](docs/getting-started.md) (Running against a sample app, etc.)
|
|
32
|
+
- [Namespaces](docs/namespaces.md)
|
|
33
|
+
- [How DataStore uses Observables](docs/observables.md)
|
|
34
|
+
- [Schema Changes](docs/schema-changes.md)
|
|
35
|
+
- [Storage](docs/storage.md)
|
|
36
|
+
- [Sync Engine](docs/sync-engine.md)
|
|
37
|
+
- ["Unsupported hacks" / workarounds](docs/workarounds.md)
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
# Diagrams
|
|
42
|
+
|
|
43
|
+
_Note: relationships with dotted lines are explained more in a separate diagram._
|
|
44
|
+
|
|
45
|
+
## How the DataStore API and Storage Engine Interact
|
|
46
|
+
|
|
47
|
+
```mermaid
|
|
48
|
+
flowchart TD
|
|
49
|
+
%% API and Storage
|
|
50
|
+
api[[DS API]]-- observe -->storage{Storage Engine}
|
|
51
|
+
storage-- next -->adapter[[Adapter]]
|
|
52
|
+
adapter-->db[[Local DB]]
|
|
53
|
+
db-->api
|
|
54
|
+
sync[[Sync Engine*]]-.-storage
|
|
55
|
+
sync-.-appSync[(AppSync)]
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
# How the Sync Engine Observes Changes in Storage and AppSync
|
|
59
|
+
|
|
60
|
+
_Note: All green nodes belong to the Sync Engine._
|
|
61
|
+
|
|
62
|
+
\* Merger first checks outbox
|
|
63
|
+
|
|
64
|
+
\*\* Outbox sends outgoing messages to AppSync
|
|
65
|
+
|
|
66
|
+
```mermaid
|
|
67
|
+
flowchart TD
|
|
68
|
+
|
|
69
|
+
subgraph SyncEngine
|
|
70
|
+
index{index.ts}-- observe -->reach[Core reachability]
|
|
71
|
+
|
|
72
|
+
subgraph processors
|
|
73
|
+
mp[Mutation Processor]
|
|
74
|
+
sp[Subscription Processor]
|
|
75
|
+
syp[Sync Processor]
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
reach--next-->mp[Mutation Processor]
|
|
79
|
+
reach--next-->sp[Subscription Processor]
|
|
80
|
+
reach--next-->syp[Sync Processor]
|
|
81
|
+
|
|
82
|
+
subgraph outbox / merger
|
|
83
|
+
outbox[Outbox]
|
|
84
|
+
merger[Merger]
|
|
85
|
+
outbox---merger
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
api[DS API]-.->storage
|
|
91
|
+
mp-- 1. observe -->storage{Storage Engine}
|
|
92
|
+
storage-- 2. next -->merger[merger*]-- next -->storage
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
sp-- observe -->appsync[(AppSync)]
|
|
96
|
+
appsync-- next -->sp
|
|
97
|
+
|
|
98
|
+
syp---appsync
|
|
99
|
+
|
|
100
|
+
mp-->outbox[outbox**]
|
|
101
|
+
|
|
102
|
+
appsync<--->outbox
|
|
103
|
+
%% styling
|
|
104
|
+
classDef syncEngineClass fill:#8FB,stroke:#333,stroke-width:4px,color:#333;
|
|
105
|
+
class index,mp,sp,syp,merger,outbox syncEngineClass;
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
# Project Structure
|
|
111
|
+
|
|
112
|
+
<pre>
|
|
113
|
+
amplify-js/packages/datastore/src
|
|
114
|
+
├── authModeStrategies
|
|
115
|
+
│ └── defaultAuthStraegy.ts
|
|
116
|
+
│ └── index.ts
|
|
117
|
+
│ └── multiAuthStrategy.ts
|
|
118
|
+
├── datastore
|
|
119
|
+
│ └── datastore.ts # Entry point for DataStore
|
|
120
|
+
├── predicates
|
|
121
|
+
│ └── index.ts
|
|
122
|
+
│ └── sort.ts
|
|
123
|
+
├── ssr
|
|
124
|
+
├── storage # Storage Engine
|
|
125
|
+
│ └── adapter # Platform-specific Storage Adapters
|
|
126
|
+
│ └── getDefaultAdapter
|
|
127
|
+
│ └── AsyncStorageAdapter.ts
|
|
128
|
+
│ └── AsyncStorageDatabase.ts
|
|
129
|
+
│ └── index.ts
|
|
130
|
+
│ └── IndexedDBAdapter.ts
|
|
131
|
+
│ └── InMemoryStore.native.ts
|
|
132
|
+
│ └── InMemoryStore.ts
|
|
133
|
+
│ └── storage.ts # Entry point for Storage
|
|
134
|
+
├── sync # Sync Engine
|
|
135
|
+
│ └── dataStoreReachability
|
|
136
|
+
│ └── index.native.ts
|
|
137
|
+
│ └── index.ts
|
|
138
|
+
│ └── processors # Sync Engine Processors
|
|
139
|
+
│ └── mutation.ts
|
|
140
|
+
│ └── subscription.ts
|
|
141
|
+
│ └── sync.ts
|
|
142
|
+
│ └── datastoreConnectivity.ts # Subscribe to reachability monitor
|
|
143
|
+
│ └── index.ts # Entry point for Sync Engine
|
|
144
|
+
│ └── merger.ts # <a href="https://github.com/aws-amplify/amplify-js/blob/datastore-docs/packages/datastore/docs/sync-engine.md#merger" title="merger doc">doc</a>
|
|
145
|
+
│ └── outbox.ts # <a href="https://github.com/aws-amplify/amplify-js/blob/datastore-docs/packages/datastore/docs/sync-engine.md#outbox" title="outbox doc">doc</a>
|
|
146
|
+
</pre>
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Other Resources:
|
|
151
|
+
|
|
152
|
+
- [High-level overview of how DataStore works](https://docs.amplify.aws/lib/datastore/how-it-works/q/platform/js/)
|
|
153
|
+
- [DataStore Docs](https://docs.amplify.aws/lib/datastore/getting-started/q/platform/js/)
|
|
154
|
+
- [re:Invent talk](https://www.youtube.com/watch?v=KcYl6_We0EU)
|