@aws-amplify/datastore 3.7.8-cloud-logging.7 → 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 +28 -55
- package/README.md +154 -0
- package/dist/aws-amplify-datastore.js +706 -370
- package/dist/aws-amplify-datastore.js.map +1 -1
- package/dist/aws-amplify-datastore.min.js +23 -79
- package/dist/aws-amplify-datastore.min.js.map +1 -1
- package/lib/datastore/datastore.js +16 -0
- package/lib/datastore/datastore.js.map +1 -1
- package/lib/storage/adapter/IndexedDBAdapter.js.map +1 -1
- package/lib/storage/storage.d.ts +2 -2
- package/lib/storage/storage.js +17 -4
- package/lib/storage/storage.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 +27 -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 +3 -1
- package/lib/types.js.map +1 -1
- package/lib-esm/datastore/datastore.js +16 -0
- package/lib-esm/datastore/datastore.js.map +1 -1
- package/lib-esm/storage/adapter/IndexedDBAdapter.js.map +1 -1
- package/lib-esm/storage/storage.d.ts +2 -2
- package/lib-esm/storage/storage.js +17 -4
- package/lib-esm/storage/storage.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 +28 -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 +3 -1
- package/lib-esm/types.js.map +1 -1
- package/package.json +7 -7
- package/src/datastore/datastore.ts +20 -0
- package/src/storage/adapter/IndexedDBAdapter.ts +1 -0
- package/src/storage/storage.ts +20 -7
- package/src/sync/merger.ts +2 -0
- package/src/sync/outbox.ts +1 -0
- package/src/sync/processors/mutation.ts +38 -3
- 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 +7 -1
- package/ssr/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,126 +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
|
-
|
|
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)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
### Features
|
|
9
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))
|
|
10
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)
|
|
11
13
|
|
|
14
|
+
### Features
|
|
12
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))
|
|
13
17
|
|
|
14
|
-
|
|
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)
|
|
15
19
|
|
|
20
|
+
### Features
|
|
16
21
|
|
|
17
|
-
|
|
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))
|
|
18
23
|
|
|
19
|
-
|
|
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)
|
|
20
25
|
|
|
26
|
+
### Bug Fixes
|
|
21
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))
|
|
22
29
|
|
|
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)
|
|
23
31
|
|
|
32
|
+
**Note:** Version bump only for package @aws-amplify/datastore
|
|
24
33
|
|
|
25
|
-
## [3.7.
|
|
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)
|
|
26
35
|
|
|
27
36
|
**Note:** Version bump only for package @aws-amplify/datastore
|
|
28
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)
|
|
29
39
|
|
|
40
|
+
### Bug Fixes
|
|
30
41
|
|
|
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))
|
|
31
43
|
|
|
32
|
-
|
|
33
|
-
## [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)
|
|
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)
|
|
34
45
|
|
|
35
46
|
**Note:** Version bump only for package @aws-amplify/datastore
|
|
36
47
|
|
|
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)
|
|
37
49
|
|
|
38
|
-
|
|
39
|
-
|
|
50
|
+
**Note:** Version bump only for package @aws-amplify/datastore
|
|
40
51
|
|
|
41
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)
|
|
42
53
|
|
|
43
|
-
|
|
44
54
|
### Bug Fixes
|
|
45
55
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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))
|
|
51
57
|
|
|
52
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)
|
|
53
59
|
|
|
54
60
|
**Note:** Version bump only for package @aws-amplify/datastore
|
|
55
61
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
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)
|
|
61
63
|
|
|
62
|
-
|
|
63
64
|
### Bug Fixes
|
|
64
65
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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))
|
|
71
68
|
|
|
72
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)
|
|
73
70
|
|
|
74
|
-
|
|
75
71
|
### Features
|
|
76
72
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
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))
|
|
82
74
|
|
|
83
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)
|
|
84
76
|
|
|
85
77
|
**Note:** Version bump only for package @aws-amplify/datastore
|
|
86
78
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
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)
|
|
92
80
|
|
|
93
|
-
|
|
94
81
|
### Features
|
|
95
82
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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))
|
|
101
84
|
|
|
102
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)
|
|
103
86
|
|
|
104
|
-
|
|
105
87
|
### Bug Fixes
|
|
106
88
|
|
|
107
|
-
|
|
108
|
-
|
|
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))
|
|
109
90
|
|
|
110
91
|
### Reverts
|
|
111
92
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
93
|
+
- uuid dependency upgrade ([#9159](https://github.com/aws-amplify/amplify-js/issues/9159)) ([4ef8aa9](https://github.com/aws-amplify/amplify-js/commit/4ef8aa9c7c25dbe921fd02b6205b8defb93fbaec))
|
|
117
94
|
|
|
118
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)
|
|
119
96
|
|
|
120
97
|
**Note:** Version bump only for package @aws-amplify/datastore
|
|
121
98
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
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)
|
|
127
100
|
|
|
128
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)
|