@aws-amplify/datastore 3.4.9-in-app-messaging.62 → 3.4.9-in-app-messaging.70

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 (106) hide show
  1. package/CHANGELOG.md +166 -9
  2. package/README.md +154 -0
  3. package/dist/aws-amplify-datastore.js +2334 -1104
  4. package/dist/aws-amplify-datastore.js.map +1 -1
  5. package/dist/aws-amplify-datastore.min.js +24 -94
  6. package/dist/aws-amplify-datastore.min.js.map +1 -1
  7. package/lib/authModeStrategies/multiAuthStrategy.d.ts +2 -2
  8. package/lib/authModeStrategies/multiAuthStrategy.js +32 -26
  9. package/lib/authModeStrategies/multiAuthStrategy.js.map +1 -1
  10. package/lib/datastore/datastore.d.ts +4 -0
  11. package/lib/datastore/datastore.js +158 -20
  12. package/lib/datastore/datastore.js.map +1 -1
  13. package/lib/storage/adapter/AsyncStorageAdapter.js.map +1 -1
  14. package/lib/storage/adapter/InMemoryStore.js +2 -2
  15. package/lib/storage/adapter/InMemoryStore.js.map +1 -1
  16. package/lib/storage/adapter/IndexedDBAdapter.d.ts +1 -0
  17. package/lib/storage/adapter/IndexedDBAdapter.js +39 -7
  18. package/lib/storage/adapter/IndexedDBAdapter.js.map +1 -1
  19. package/lib/storage/storage.d.ts +2 -2
  20. package/lib/storage/storage.js +17 -4
  21. package/lib/storage/storage.js.map +1 -1
  22. package/lib/sync/index.d.ts +3 -4
  23. package/lib/sync/index.js +5 -6
  24. package/lib/sync/index.js.map +1 -1
  25. package/lib/sync/merger.js +1 -0
  26. package/lib/sync/merger.js.map +1 -1
  27. package/lib/sync/outbox.js +1 -0
  28. package/lib/sync/outbox.js.map +1 -1
  29. package/lib/sync/processors/errorMaps.d.ts +17 -0
  30. package/lib/sync/processors/errorMaps.js +125 -0
  31. package/lib/sync/processors/errorMaps.js.map +1 -0
  32. package/lib/sync/processors/mutation.d.ts +22 -4
  33. package/lib/sync/processors/mutation.js +48 -10
  34. package/lib/sync/processors/mutation.js.map +1 -1
  35. package/lib/sync/processors/subscription.d.ts +4 -2
  36. package/lib/sync/processors/subscription.js +76 -41
  37. package/lib/sync/processors/subscription.js.map +1 -1
  38. package/lib/sync/processors/sync.d.ts +4 -2
  39. package/lib/sync/processors/sync.js +62 -27
  40. package/lib/sync/processors/sync.js.map +1 -1
  41. package/lib/sync/utils.js.map +1 -1
  42. package/lib/types.d.ts +29 -9
  43. package/lib/types.js +6 -1
  44. package/lib/types.js.map +1 -1
  45. package/lib/util.d.ts +31 -11
  46. package/lib/util.js +45 -15
  47. package/lib/util.js.map +1 -1
  48. package/lib-esm/authModeStrategies/multiAuthStrategy.d.ts +2 -2
  49. package/lib-esm/authModeStrategies/multiAuthStrategy.js +32 -26
  50. package/lib-esm/authModeStrategies/multiAuthStrategy.js.map +1 -1
  51. package/lib-esm/datastore/datastore.d.ts +4 -0
  52. package/lib-esm/datastore/datastore.js +159 -21
  53. package/lib-esm/datastore/datastore.js.map +1 -1
  54. package/lib-esm/storage/adapter/AsyncStorageAdapter.js.map +1 -1
  55. package/lib-esm/storage/adapter/InMemoryStore.js +2 -2
  56. package/lib-esm/storage/adapter/InMemoryStore.js.map +1 -1
  57. package/lib-esm/storage/adapter/IndexedDBAdapter.d.ts +1 -0
  58. package/lib-esm/storage/adapter/IndexedDBAdapter.js +39 -7
  59. package/lib-esm/storage/adapter/IndexedDBAdapter.js.map +1 -1
  60. package/lib-esm/storage/storage.d.ts +2 -2
  61. package/lib-esm/storage/storage.js +17 -4
  62. package/lib-esm/storage/storage.js.map +1 -1
  63. package/lib-esm/sync/index.d.ts +3 -4
  64. package/lib-esm/sync/index.js +5 -6
  65. package/lib-esm/sync/index.js.map +1 -1
  66. package/lib-esm/sync/merger.js +1 -0
  67. package/lib-esm/sync/merger.js.map +1 -1
  68. package/lib-esm/sync/outbox.js +1 -0
  69. package/lib-esm/sync/outbox.js.map +1 -1
  70. package/lib-esm/sync/processors/errorMaps.d.ts +17 -0
  71. package/lib-esm/sync/processors/errorMaps.js +119 -0
  72. package/lib-esm/sync/processors/errorMaps.js.map +1 -0
  73. package/lib-esm/sync/processors/mutation.d.ts +22 -4
  74. package/lib-esm/sync/processors/mutation.js +51 -13
  75. package/lib-esm/sync/processors/mutation.js.map +1 -1
  76. package/lib-esm/sync/processors/subscription.d.ts +4 -2
  77. package/lib-esm/sync/processors/subscription.js +77 -42
  78. package/lib-esm/sync/processors/subscription.js.map +1 -1
  79. package/lib-esm/sync/processors/sync.d.ts +4 -2
  80. package/lib-esm/sync/processors/sync.js +62 -27
  81. package/lib-esm/sync/processors/sync.js.map +1 -1
  82. package/lib-esm/sync/utils.js.map +1 -1
  83. package/lib-esm/types.d.ts +29 -9
  84. package/lib-esm/types.js +6 -1
  85. package/lib-esm/types.js.map +1 -1
  86. package/lib-esm/util.d.ts +31 -11
  87. package/lib-esm/util.js +41 -12
  88. package/lib-esm/util.js.map +1 -1
  89. package/package.json +10 -9
  90. package/src/authModeStrategies/multiAuthStrategy.ts +24 -21
  91. package/src/datastore/datastore.ts +207 -42
  92. package/src/storage/adapter/AsyncStorageAdapter.ts +1 -0
  93. package/src/storage/adapter/InMemoryStore.ts +2 -2
  94. package/src/storage/adapter/IndexedDBAdapter.ts +49 -11
  95. package/src/storage/storage.ts +20 -7
  96. package/src/sync/index.ts +37 -36
  97. package/src/sync/merger.ts +2 -0
  98. package/src/sync/outbox.ts +1 -0
  99. package/src/sync/processors/errorMaps.ts +93 -0
  100. package/src/sync/processors/mutation.ts +83 -39
  101. package/src/sync/processors/subscription.ts +68 -36
  102. package/src/sync/processors/sync.ts +36 -9
  103. package/src/sync/utils.ts +3 -5
  104. package/src/types.ts +42 -9
  105. package/src/util.ts +55 -17
  106. package/ssr/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -3,32 +3,189 @@
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
- ## [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)
6
+ ## [3.12.8](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/datastore@3.12.7...@aws-amplify/datastore@3.12.8) (2022-08-23)
7
7
 
8
8
  **Note:** Version bump only for package @aws-amplify/datastore
9
9
 
10
- ## [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)
10
+
11
+
12
+
13
+
14
+ ## [3.12.7](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/datastore@3.12.6...@aws-amplify/datastore@3.12.7) (2022-08-18)
11
15
 
12
16
  **Note:** Version bump only for package @aws-amplify/datastore
13
17
 
14
- ## [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)
18
+
19
+
20
+
21
+
22
+ ## [3.12.6](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/datastore@3.12.5...@aws-amplify/datastore@3.12.6) (2022-08-16)
23
+
15
24
 
16
25
  ### Bug Fixes
17
26
 
18
- - **@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))
27
+ * **datastore:** make di context fields private ([#10162](https://github.com/aws-amplify/amplify-js/issues/10162)) ([88a9ec9](https://github.com/aws-amplify/amplify-js/commit/88a9ec97fca2eb19c9cc9496b8b7d25b75f02073))
28
+
29
+
30
+
19
31
 
20
- ## [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)
32
+
33
+ ## [3.12.5](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/datastore@3.12.4...@aws-amplify/datastore@3.12.5) (2022-08-01)
34
+
35
+ **Note:** Version bump only for package @aws-amplify/datastore
36
+
37
+
38
+
39
+
40
+
41
+ ## [3.12.4](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/datastore@3.12.3...@aws-amplify/datastore@3.12.4) (2022-07-28)
21
42
 
22
43
  **Note:** Version bump only for package @aws-amplify/datastore
23
44
 
24
- ## [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)
45
+
46
+
47
+
48
+
49
+ ## [3.12.3](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/datastore@3.12.2...@aws-amplify/datastore@3.12.3) (2022-07-21)
50
+
25
51
 
26
52
  ### Bug Fixes
27
53
 
28
- - **@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))
29
- - **@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))
54
+ * preserve ssr context when using DataStore ([#10088](https://github.com/aws-amplify/amplify-js/issues/10088)) ([a10d920](https://github.com/aws-amplify/amplify-js/commit/a10d920f7fb6199539fb8d9cec2cb4426dbfd47b))
30
55
 
31
- # [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)
56
+
57
+
58
+
59
+
60
+ ## [3.12.2](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/datastore@3.12.1...@aws-amplify/datastore@3.12.2) (2022-07-07)
61
+
62
+
63
+ ### Bug Fixes
64
+
65
+ * decrease error handler verbosity on self recovering errors ([#10030](https://github.com/aws-amplify/amplify-js/issues/10030)) ([fb1f02c](https://github.com/aws-amplify/amplify-js/commit/fb1f02cfa914b81fe0411e8f4d654c69aed22385))
66
+
67
+
68
+
69
+
70
+
71
+ ## [3.12.1](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/datastore@3.12.0...@aws-amplify/datastore@3.12.1) (2022-06-18)
72
+
73
+
74
+ ### Bug Fixes
75
+
76
+ * decrease error handler verbosity on self recovering errors ([#9987](https://github.com/aws-amplify/amplify-js/issues/9987)) ([67ccf09](https://github.com/aws-amplify/amplify-js/commit/67ccf09a93221a06d4560300cfd67fdd9efeda71))
77
+
78
+
79
+ ### Reverts
80
+
81
+ * Revert "fix: decrease error handler verbosity on self recovering errors (#9987)" (#10004) ([eb73ad7](https://github.com/aws-amplify/amplify-js/commit/eb73ad70b3eee0632eaed4bae00f1d2179ae45b5)), closes [#9987](https://github.com/aws-amplify/amplify-js/issues/9987) [#10004](https://github.com/aws-amplify/amplify-js/issues/10004)
82
+
83
+
84
+
85
+
86
+
87
+ # [3.12.0](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/datastore@3.11.3...@aws-amplify/datastore@3.12.0) (2022-06-15)
88
+
89
+
90
+ ### Bug Fixes
91
+
92
+ * **@aws-amplify/datastore:** adds missing fields to items sent through observe/observeQuery ([#9973](https://github.com/aws-amplify/amplify-js/issues/9973)) ([ca2a11b](https://github.com/aws-amplify/amplify-js/commit/ca2a11b5bc987e71ce3344058a4886bf067cb17b))
93
+ * merge patches for consecutive copyOf ([#9936](https://github.com/aws-amplify/amplify-js/issues/9936)) ([d5dd9cb](https://github.com/aws-amplify/amplify-js/commit/d5dd9cb5bf46131fb046cfe55e4899444f9d789e))
94
+ * **@aws-amplify/datastore:** fixes observeQuery not removing newly-filtered items from snapshot ([#9879](https://github.com/aws-amplify/amplify-js/issues/9879)) ([d1356b1](https://github.com/aws-amplify/amplify-js/commit/d1356b1e498eb71a4902892afbb41f6ff88abb6f))
95
+
96
+
97
+ ### Features
98
+
99
+ * **datastore:** add error maps for error handler ([#9918](https://github.com/aws-amplify/amplify-js/issues/9918)) ([3a27096](https://github.com/aws-amplify/amplify-js/commit/3a270969b6e097eeed73368091ace191cbc05511))
100
+
101
+
102
+
103
+
104
+
105
+ ## [3.11.3](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/datastore@3.11.2...@aws-amplify/datastore@3.11.3) (2022-05-24)
106
+
107
+ **Note:** Version bump only for package @aws-amplify/datastore
108
+
109
+
110
+
111
+
112
+
113
+ ## [3.11.2](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/datastore@3.11.1...@aws-amplify/datastore@3.11.2) (2022-05-23)
114
+
115
+
116
+ ### Bug Fixes
117
+
118
+ * **@aws-amplify/datastore-storage-adapter:** remove extra, invalid sqlite mutations again ([#9921](https://github.com/aws-amplify/amplify-js/issues/9921)) ([00923cf](https://github.com/aws-amplify/amplify-js/commit/00923cfaeafcee97a0f54cc6aa04724f7155e75d))
119
+
120
+
121
+
122
+
123
+
124
+ ## [3.11.1](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/datastore@3.11.0...@aws-amplify/datastore@3.11.1) (2022-05-12)
125
+
126
+ ### Bug Fixes
127
+
128
+ - add error for when schema is not initialized ([#9874](https://github.com/aws-amplify/amplify-js/issues/9874)) ([a63f0ee](https://github.com/aws-amplify/amplify-js/commit/a63f0eec70b96dba2d220f3eeb0c799af8622b5c))
129
+
130
+ # [3.11.0](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/datastore@3.10.0...@aws-amplify/datastore@3.11.0) (2022-05-03)
131
+
132
+ ### Bug Fixes
133
+
134
+ - add newly created models to IDB during migration ([#9754](https://github.com/aws-amplify/amplify-js/issues/9754)) ([58d7e00](https://github.com/aws-amplify/amplify-js/commit/58d7e003463e1cabe3a4bb5601a2cdf11736150d))
135
+ - **@aws-amplify/datastore-storage-adapter:** SQLite adapter NULL handling and mutation queue management bugs ([#9813](https://github.com/aws-amplify/amplify-js/issues/9813)) ([fe691fd](https://github.com/aws-amplify/amplify-js/commit/fe691fd4f67adc6ac973dd12ca056563d0720d69))
136
+
137
+ ### Features
138
+
139
+ - clear DataStore without first starting ([#9768](https://github.com/aws-amplify/amplify-js/issues/9768)) ([38bdabd](https://github.com/aws-amplify/amplify-js/commit/38bdabd5408e03595a90d673bbffd963cf432daa))
140
+ - rework error handler ([#9861](https://github.com/aws-amplify/amplify-js/issues/9861)) ([6ae8d10](https://github.com/aws-amplify/amplify-js/commit/6ae8d10569abf24559436a46e1723825e6472489))
141
+
142
+ # [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)
143
+
144
+ ### Features
145
+
146
+ - **data:** Datastore Docs ([#9753](https://github.com/aws-amplify/amplify-js/issues/9753)) ([4eb824f](https://github.com/aws-amplify/amplify-js/commit/4eb824f168df408469557e6ccc60edfee99953c2))
147
+
148
+ # [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)
149
+
150
+ ### Features
151
+
152
+ - 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))
153
+
154
+ # [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)
155
+
156
+ ### Features
157
+
158
+ - 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))
159
+
160
+ ## [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)
161
+
162
+ ### Bug Fixes
163
+
164
+ - **@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))
165
+
166
+ ## [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)
167
+
168
+ **Note:** Version bump only for package @aws-amplify/datastore
169
+
170
+ ## [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)
171
+
172
+ **Note:** Version bump only for package @aws-amplify/datastore
173
+
174
+ ## [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)
175
+
176
+ ### Bug Fixes
177
+
178
+ - **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))
179
+
180
+ ## [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)
181
+
182
+ **Note:** Version bump only for package @aws-amplify/datastore
183
+
184
+ ## [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)
185
+
186
+ **Note:** Version bump only for package @aws-amplify/datastore
187
+
188
+ ## [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)
32
189
 
33
190
  ### Bug Fixes
34
191
 
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 | ![npm](https://img.shields.io/npm/v/@aws-amplify/datastore.svg) | [![Open Issues](https://img.shields.io/github/issues/aws-amplify/amplify-js/DataStore?color=red)](https://github.com/aws-amplify/amplify-js/issues?q=is%3Aissue+label%3ADataStore+is%3Aopen) | [![Closed Issues](https://img.shields.io/github/issues-closed/aws-amplify/amplify-js/DataStore)](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)