@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.
Files changed (209) hide show
  1. package/{lib → dist/cjs}/authModeStrategies/defaultAuthStrategy.js +3 -1
  2. package/dist/cjs/authModeStrategies/defaultAuthStrategy.js.map +1 -0
  3. package/{lib → dist/cjs}/authModeStrategies/index.js +3 -1
  4. package/dist/cjs/authModeStrategies/index.js.map +1 -0
  5. package/{lib → dist/cjs}/authModeStrategies/multiAuthStrategy.js +3 -3
  6. package/dist/cjs/authModeStrategies/multiAuthStrategy.js.map +1 -0
  7. package/{lib → dist/cjs}/datastore/datastore.js +5 -3
  8. package/dist/cjs/datastore/datastore.js.map +1 -0
  9. package/{lib → dist/cjs}/index.js +5 -16
  10. package/dist/cjs/index.js.map +1 -0
  11. package/{lib → dist/cjs}/predicates/index.js +3 -1
  12. package/dist/cjs/predicates/index.js.map +1 -0
  13. package/{lib → dist/cjs}/predicates/next.js +3 -1
  14. package/dist/cjs/predicates/next.js.map +1 -0
  15. package/{lib → dist/cjs}/predicates/sort.js +4 -3
  16. package/dist/cjs/predicates/sort.js.map +1 -0
  17. package/{lib → dist/cjs}/storage/adapter/AsyncStorageAdapter.js +5 -5
  18. package/dist/cjs/storage/adapter/AsyncStorageAdapter.js.map +1 -0
  19. package/{lib → dist/cjs}/storage/adapter/AsyncStorageDatabase.js +3 -1
  20. package/dist/cjs/storage/adapter/AsyncStorageDatabase.js.map +1 -0
  21. package/{lib → dist/cjs}/storage/adapter/InMemoryStore.js +3 -1
  22. package/dist/cjs/storage/adapter/InMemoryStore.js.map +1 -0
  23. package/{lib → dist/cjs}/storage/adapter/InMemoryStore.native.js +5 -5
  24. package/dist/cjs/storage/adapter/InMemoryStore.native.js.map +1 -0
  25. package/{lib → dist/cjs}/storage/adapter/IndexedDBAdapter.js +5 -25
  26. package/dist/cjs/storage/adapter/IndexedDBAdapter.js.map +1 -0
  27. package/{lib → dist/cjs}/storage/adapter/StorageAdapterBase.js +3 -1
  28. package/dist/cjs/storage/adapter/StorageAdapterBase.js.map +1 -0
  29. package/{lib → dist/cjs}/storage/adapter/getDefaultAdapter/index.js +6 -6
  30. package/dist/cjs/storage/adapter/getDefaultAdapter/index.js.map +1 -0
  31. package/dist/cjs/storage/adapter/getDefaultAdapter/index.native.js +10 -0
  32. package/dist/cjs/storage/adapter/getDefaultAdapter/index.native.js.map +1 -0
  33. package/{lib → dist/cjs}/storage/adapter/index.js +3 -1
  34. package/dist/cjs/storage/adapter/index.js.map +1 -0
  35. package/{lib → dist/cjs}/storage/relationship.js +3 -1
  36. package/dist/cjs/storage/relationship.js.map +1 -0
  37. package/{lib → dist/cjs}/storage/storage.js +5 -5
  38. package/dist/cjs/storage/storage.js.map +1 -0
  39. package/{lib → dist/cjs}/sync/datastoreConnectivity.js +4 -2
  40. package/dist/cjs/sync/datastoreConnectivity.js.map +1 -0
  41. package/{lib → dist/cjs}/sync/datastoreReachability/index.js +3 -1
  42. package/dist/cjs/sync/datastoreReachability/index.js.map +1 -0
  43. package/{lib → dist/cjs}/sync/datastoreReachability/index.native.js +3 -1
  44. package/dist/cjs/sync/datastoreReachability/index.native.js.map +1 -0
  45. package/{lib → dist/cjs}/sync/index.js +6 -7
  46. package/dist/cjs/sync/index.js.map +1 -0
  47. package/{lib → dist/cjs}/sync/merger.js +3 -1
  48. package/dist/cjs/sync/merger.js.map +1 -0
  49. package/{lib → dist/cjs}/sync/outbox.js +3 -1
  50. package/dist/cjs/sync/outbox.js.map +1 -0
  51. package/{lib → dist/cjs}/sync/processors/errorMaps.js +4 -4
  52. package/dist/cjs/sync/processors/errorMaps.js.map +1 -0
  53. package/{lib → dist/cjs}/sync/processors/mutation.js +3 -1
  54. package/dist/cjs/sync/processors/mutation.js.map +1 -0
  55. package/{lib → dist/cjs}/sync/processors/subscription.js +4 -4
  56. package/dist/cjs/sync/processors/subscription.js.map +1 -0
  57. package/{lib → dist/cjs}/sync/processors/sync.js +3 -1
  58. package/dist/cjs/sync/processors/sync.js.map +1 -0
  59. package/{lib → dist/cjs}/sync/utils.js +3 -1
  60. package/dist/cjs/sync/utils.js.map +1 -0
  61. package/{lib → dist/cjs}/types.js +12 -21
  62. package/dist/cjs/types.js.map +1 -0
  63. package/{lib → dist/cjs}/util.js +3 -1
  64. package/dist/cjs/util.js.map +1 -0
  65. package/{lib-esm/authModeStrategies/defaultAuthStrategy.js → dist/esm/authModeStrategies/defaultAuthStrategy.mjs} +4 -1
  66. package/dist/esm/authModeStrategies/defaultAuthStrategy.mjs.map +1 -0
  67. package/dist/esm/authModeStrategies/index.mjs +3 -0
  68. package/dist/esm/authModeStrategies/index.mjs.map +1 -0
  69. package/{lib-esm/authModeStrategies/multiAuthStrategy.js → dist/esm/authModeStrategies/multiAuthStrategy.mjs} +7 -5
  70. package/dist/esm/authModeStrategies/multiAuthStrategy.mjs.map +1 -0
  71. package/{lib-esm/datastore/datastore.js → dist/esm/datastore/datastore.mjs} +30 -26
  72. package/dist/esm/datastore/datastore.mjs.map +1 -0
  73. package/dist/esm/index.mjs +19 -0
  74. package/dist/esm/index.mjs.map +1 -0
  75. package/{lib-esm/predicates/index.js → dist/esm/predicates/index.mjs} +10 -7
  76. package/dist/esm/predicates/index.mjs.map +1 -0
  77. package/{lib-esm/predicates/next.js → dist/esm/predicates/next.mjs} +15 -11
  78. package/dist/esm/predicates/next.mjs.map +1 -0
  79. package/{lib-esm/predicates/sort.js → dist/esm/predicates/sort.mjs} +3 -2
  80. package/dist/esm/predicates/sort.mjs.map +1 -0
  81. package/{lib-esm/storage/adapter/AsyncStorageAdapter.js → dist/esm/storage/adapter/AsyncStorageAdapter.mjs} +10 -6
  82. package/dist/esm/storage/adapter/AsyncStorageAdapter.mjs.map +1 -0
  83. package/{lib-esm/storage/adapter/AsyncStorageDatabase.js → dist/esm/storage/adapter/AsyncStorageDatabase.mjs} +7 -4
  84. package/dist/esm/storage/adapter/AsyncStorageDatabase.mjs.map +1 -0
  85. package/{lib-esm/storage/adapter/InMemoryStore.js → dist/esm/storage/adapter/InMemoryStore.mjs} +5 -2
  86. package/dist/esm/storage/adapter/InMemoryStore.mjs.map +1 -0
  87. package/{lib-esm/storage/adapter/InMemoryStore.native.js → dist/esm/storage/adapter/InMemoryStore.native.mjs} +6 -2
  88. package/dist/esm/storage/adapter/InMemoryStore.native.mjs.map +1 -0
  89. package/{lib-esm/storage/adapter/IndexedDBAdapter.js → dist/esm/storage/adapter/IndexedDBAdapter.mjs} +10 -6
  90. package/dist/esm/storage/adapter/IndexedDBAdapter.mjs.map +1 -0
  91. package/{lib-esm/storage/adapter/StorageAdapterBase.js → dist/esm/storage/adapter/StorageAdapterBase.mjs} +9 -5
  92. package/dist/esm/storage/adapter/StorageAdapterBase.mjs.map +1 -0
  93. package/dist/esm/storage/adapter/getDefaultAdapter/index.mjs +13 -0
  94. package/dist/esm/storage/adapter/getDefaultAdapter/index.mjs.map +1 -0
  95. package/dist/esm/storage/adapter/getDefaultAdapter/index.native.mjs +8 -0
  96. package/dist/esm/storage/adapter/getDefaultAdapter/index.native.mjs.map +1 -0
  97. package/dist/esm/storage/adapter/index.mjs +2 -0
  98. package/dist/esm/storage/adapter/index.mjs.map +1 -0
  99. package/{lib-esm/storage/relationship.js → dist/esm/storage/relationship.mjs} +6 -2
  100. package/dist/esm/storage/relationship.mjs.map +1 -0
  101. package/{lib-esm/storage/storage.js → dist/esm/storage/storage.mjs} +11 -8
  102. package/dist/esm/storage/storage.mjs.map +1 -0
  103. package/{lib-esm/sync/datastoreConnectivity.js → dist/esm/sync/datastoreConnectivity.mjs} +9 -5
  104. package/dist/esm/sync/datastoreConnectivity.mjs.map +1 -0
  105. package/dist/esm/sync/datastoreReachability/index.d.ts +1 -0
  106. package/{lib-esm/sync/datastoreReachability/index.js → dist/esm/sync/datastoreReachability/index.mjs} +6 -2
  107. package/dist/esm/sync/datastoreReachability/index.mjs.map +1 -0
  108. package/dist/esm/sync/datastoreReachability/index.native.d.ts +1 -0
  109. package/{lib-esm/sync/datastoreReachability/index.native.js → dist/esm/sync/datastoreReachability/index.native.mjs} +7 -3
  110. package/dist/esm/sync/datastoreReachability/index.native.mjs.map +1 -0
  111. package/{lib-esm/sync/index.js → dist/esm/sync/index.mjs} +24 -21
  112. package/dist/esm/sync/index.mjs.map +1 -0
  113. package/{lib-esm/sync/merger.js → dist/esm/sync/merger.mjs} +5 -2
  114. package/dist/esm/sync/merger.mjs.map +1 -0
  115. package/{lib-esm/sync/outbox.js → dist/esm/sync/outbox.mjs} +7 -4
  116. package/dist/esm/sync/outbox.mjs.map +1 -0
  117. package/{lib-esm/sync/processors/errorMaps.js → dist/esm/sync/processors/errorMaps.mjs} +13 -11
  118. package/dist/esm/sync/processors/errorMaps.mjs.map +1 -0
  119. package/{lib → dist/esm}/sync/processors/mutation.d.ts +1 -1
  120. package/{lib-esm/sync/processors/mutation.js → dist/esm/sync/processors/mutation.mjs} +10 -7
  121. package/dist/esm/sync/processors/mutation.mjs.map +1 -0
  122. package/{lib-esm/sync/processors/subscription.js → dist/esm/sync/processors/subscription.mjs} +18 -17
  123. package/dist/esm/sync/processors/subscription.mjs.map +1 -0
  124. package/{lib-esm/sync/processors/sync.js → dist/esm/sync/processors/sync.mjs} +8 -5
  125. package/dist/esm/sync/processors/sync.mjs.map +1 -0
  126. package/{lib-esm/sync/utils.js → dist/esm/sync/utils.mjs} +30 -26
  127. package/dist/esm/sync/utils.mjs.map +1 -0
  128. package/{lib-esm/types.js → dist/esm/types.mjs} +34 -30
  129. package/dist/esm/types.mjs.map +1 -0
  130. package/{lib-esm/util.js → dist/esm/util.mjs} +61 -57
  131. package/dist/esm/util.mjs.map +1 -0
  132. package/package.json +133 -137
  133. package/lib/authModeStrategies/defaultAuthStrategy.d.ts +0 -2
  134. package/lib/authModeStrategies/index.d.ts +0 -2
  135. package/lib/authModeStrategies/multiAuthStrategy.d.ts +0 -13
  136. package/lib/datastore/datastore.d.ts +0 -231
  137. package/lib/index.d.ts +0 -16
  138. package/lib/predicates/index.d.ts +0 -100
  139. package/lib/predicates/next.d.ts +0 -317
  140. package/lib/predicates/sort.d.ts +0 -8
  141. package/lib/ssr/index.d.ts +0 -3
  142. package/lib/ssr/index.js +0 -18
  143. package/lib/storage/adapter/AsyncStorageAdapter.d.ts +0 -40
  144. package/lib/storage/adapter/AsyncStorageDatabase.d.ts +0 -39
  145. package/lib/storage/adapter/InMemoryStore.d.ts +0 -11
  146. package/lib/storage/adapter/InMemoryStore.native.d.ts +0 -1
  147. package/lib/storage/adapter/IndexedDBAdapter.d.ts +0 -70
  148. package/lib/storage/adapter/StorageAdapterBase.d.ts +0 -134
  149. package/lib/storage/adapter/getDefaultAdapter/index.d.ts +0 -3
  150. package/lib/storage/adapter/getDefaultAdapter/index.native.d.ts +0 -3
  151. package/lib/storage/adapter/getDefaultAdapter/index.native.js +0 -10
  152. package/lib/storage/adapter/index.d.ts +0 -9
  153. package/lib/storage/relationship.d.ts +0 -149
  154. package/lib/storage/storage.d.ts +0 -50
  155. package/lib/sync/datastoreConnectivity.d.ts +0 -16
  156. package/lib/sync/datastoreReachability/index.d.ts +0 -1
  157. package/lib/sync/datastoreReachability/index.native.d.ts +0 -1
  158. package/lib/sync/index.d.ts +0 -103
  159. package/lib/sync/merger.d.ts +0 -17
  160. package/lib/sync/outbox.d.ts +0 -27
  161. package/lib/sync/processors/errorMaps.d.ts +0 -17
  162. package/lib/sync/processors/subscription.d.ts +0 -42
  163. package/lib/sync/processors/sync.d.ts +0 -28
  164. package/lib/sync/utils.d.ts +0 -107
  165. package/lib/tsconfig.tsbuildinfo +0 -1
  166. package/lib/types.d.ts +0 -641
  167. package/lib/util.d.ts +0 -196
  168. package/lib-esm/authModeStrategies/index.js +0 -4
  169. package/lib-esm/index.js +0 -14
  170. package/lib-esm/ssr/index.d.ts +0 -3
  171. package/lib-esm/ssr/index.js +0 -13
  172. package/lib-esm/storage/adapter/getDefaultAdapter/index.js +0 -10
  173. package/lib-esm/storage/adapter/getDefaultAdapter/index.native.js +0 -5
  174. package/lib-esm/storage/adapter/index.js +0 -1
  175. package/lib-esm/sync/datastoreReachability/index.d.ts +0 -1
  176. package/lib-esm/sync/datastoreReachability/index.native.d.ts +0 -1
  177. package/lib-esm/sync/processors/mutation.d.ts +0 -67
  178. package/lib-esm/tsconfig.tsbuildinfo +0 -1
  179. package/src/ssr/index.ts +0 -27
  180. package/ssr/package.json +0 -8
  181. /package/{lib-esm → dist/esm}/authModeStrategies/defaultAuthStrategy.d.ts +0 -0
  182. /package/{lib-esm → dist/esm}/authModeStrategies/index.d.ts +0 -0
  183. /package/{lib-esm → dist/esm}/authModeStrategies/multiAuthStrategy.d.ts +0 -0
  184. /package/{lib-esm → dist/esm}/datastore/datastore.d.ts +0 -0
  185. /package/{lib-esm → dist/esm}/index.d.ts +0 -0
  186. /package/{lib-esm → dist/esm}/predicates/index.d.ts +0 -0
  187. /package/{lib-esm → dist/esm}/predicates/next.d.ts +0 -0
  188. /package/{lib-esm → dist/esm}/predicates/sort.d.ts +0 -0
  189. /package/{lib-esm → dist/esm}/storage/adapter/AsyncStorageAdapter.d.ts +0 -0
  190. /package/{lib-esm → dist/esm}/storage/adapter/AsyncStorageDatabase.d.ts +0 -0
  191. /package/{lib-esm → dist/esm}/storage/adapter/InMemoryStore.d.ts +0 -0
  192. /package/{lib-esm → dist/esm}/storage/adapter/InMemoryStore.native.d.ts +0 -0
  193. /package/{lib-esm → dist/esm}/storage/adapter/IndexedDBAdapter.d.ts +0 -0
  194. /package/{lib-esm → dist/esm}/storage/adapter/StorageAdapterBase.d.ts +0 -0
  195. /package/{lib-esm → dist/esm}/storage/adapter/getDefaultAdapter/index.d.ts +0 -0
  196. /package/{lib-esm → dist/esm}/storage/adapter/getDefaultAdapter/index.native.d.ts +0 -0
  197. /package/{lib-esm → dist/esm}/storage/adapter/index.d.ts +0 -0
  198. /package/{lib-esm → dist/esm}/storage/relationship.d.ts +0 -0
  199. /package/{lib-esm → dist/esm}/storage/storage.d.ts +0 -0
  200. /package/{lib-esm → dist/esm}/sync/datastoreConnectivity.d.ts +0 -0
  201. /package/{lib-esm → dist/esm}/sync/index.d.ts +0 -0
  202. /package/{lib-esm → dist/esm}/sync/merger.d.ts +0 -0
  203. /package/{lib-esm → dist/esm}/sync/outbox.d.ts +0 -0
  204. /package/{lib-esm → dist/esm}/sync/processors/errorMaps.d.ts +0 -0
  205. /package/{lib-esm → dist/esm}/sync/processors/subscription.d.ts +0 -0
  206. /package/{lib-esm → dist/esm}/sync/processors/sync.d.ts +0 -0
  207. /package/{lib-esm → dist/esm}/sync/utils.d.ts +0 -0
  208. /package/{lib-esm → dist/esm}/types.d.ts +0 -0
  209. /package/{lib-esm → dist/esm}/util.d.ts +0 -0
package/package.json CHANGED
@@ -1,139 +1,135 @@
1
1
  {
2
- "name": "@aws-amplify/datastore",
3
- "version": "5.0.1-unstable.cfbde4c.0+cfbde4c",
4
- "description": "AppSyncLocal support for aws-amplify",
5
- "main": "./lib/index.js",
6
- "module": "./lib-esm/index.js",
7
- "typings": "./lib-esm/index.d.ts",
8
- "react-native": {
9
- "./lib/index": "./lib-esm/index.js"
10
- },
11
- "publishConfig": {
12
- "access": "public"
13
- },
14
- "sideEffects": [
15
- "./lib/datastore/datastore.js",
16
- "./lib-esm/datastore/datastore.js"
17
- ],
18
- "scripts": {
19
- "test": "npm run lint && jest -w 1 --coverage",
20
- "test:size": "size-limit",
21
- "build-with-test": "npm test && npm run build",
22
- "build:cjs": "rimraf lib && tsc -m commonjs --outDir lib && webpack && webpack --config ./webpack.config.dev.js",
23
- "build:esm": "rimraf lib-esm && tsc -m esnext --outDir lib-esm",
24
- "build:cjs:watch": "rimraf lib && tsc -m commonjs --outDir lib --watch",
25
- "build:esm:watch": "rimraf lib-esm && tsc -m esnext --outDir lib-esm --watch",
26
- "build": "yarn clean && yarn build:esm && npm run build:cjs",
27
- "clean": "npm run clean:size && rimraf lib-esm lib dist",
28
- "clean:size": "rimraf dual-publish-tmp tmp*",
29
- "format": "echo \"Not implemented\" && npm run ts-coverage",
30
- "lint": "tslint '{__tests__,src}/**/*.ts' && npm run ts-coverage",
31
- "ts-coverage": "typescript-coverage-report -p ./tsconfig.build.json -t 92.05"
32
- },
33
- "repository": {
34
- "type": "git",
35
- "url": "https://github.com/aws-amplify/amplify-js.git"
36
- },
37
- "author": "Amazon Web Services",
38
- "license": "Apache-2.0",
39
- "bugs": {
40
- "url": "https://github.com/aws/aws-amplify/issues"
41
- },
42
- "homepage": "https://aws-amplify.github.io/",
43
- "files": [
44
- "lib",
45
- "lib-esm",
46
- "src",
47
- "ssr"
48
- ],
49
- "dependencies": {
50
- "@aws-amplify/api": "6.0.1-unstable.cfbde4c.0+cfbde4c",
51
- "@aws-amplify/auth": "6.0.1-unstable.cfbde4c.0+cfbde4c",
52
- "buffer": "4.9.2",
53
- "idb": "5.0.6",
54
- "immer": "9.0.6",
55
- "rxjs": "^7.8.1",
56
- "ulid": "^2.3.0"
57
- },
58
- "peerDependencies": {
59
- "@aws-amplify/core": "6.0.1-unstable.cfbde4c.0+cfbde4c"
60
- },
61
- "devDependencies": {
62
- "@aws-amplify/core": "6.0.1-unstable.cfbde4c.0+cfbde4c",
63
- "@aws-amplify/react-native": "1.0.1-unstable.cfbde4c.0+cfbde4c",
64
- "@types/uuid-validate": "^0.0.1",
65
- "dexie": "3.2.2",
66
- "dexie-export-import": "1.0.3",
67
- "fake-indexeddb": "3.0.0",
68
- "graphql": "15.8.0",
69
- "typescript": "5.0.2"
70
- },
71
- "size-limit": [
72
- {
73
- "name": "DataStore (top-level class)",
74
- "path": "./lib-esm/index.js",
75
- "import": "{ Amplify, DataStore }",
76
- "limit": "65.25 kB"
77
- }
78
- ],
79
- "jest": {
80
- "globals": {
81
- "ts-jest": {
82
- "diagnostics": true,
83
- "tsConfig": {
84
- "lib": [
85
- "es5",
86
- "es2015",
87
- "dom",
88
- "esnext.asynciterable",
89
- "es2019"
90
- ],
91
- "target": "es5",
92
- "allowJs": true,
93
- "esModuleInterop": true,
94
- "strictNullChecks": false,
95
- "types": [
96
- "@types/jest"
97
- ]
98
- }
99
- }
100
- },
101
- "transform": {
102
- "^.+\\.(js|jsx|ts|tsx)$": "ts-jest"
103
- },
104
- "testRegex": "(/__tests__/.*|\\.(test|spec))\\.(tsx?|jsx?)$",
105
- "testPathIgnorePatterns": [
106
- "__tests__/model.ts",
107
- "__tests__/schema.ts",
108
- "__tests__/helpers/",
109
- "__tests__/commonAdapterTests.ts"
110
- ],
111
- "moduleFileExtensions": [
112
- "ts",
113
- "tsx",
114
- "js",
115
- "json",
116
- "jsx"
117
- ],
118
- "testEnvironment": "jsdom",
119
- "testURL": "http://localhost/",
120
- "coverageThreshold": {
121
- "global": {
122
- "branches": 0,
123
- "functions": 0,
124
- "lines": 0,
125
- "statements": 0
126
- }
127
- },
128
- "coveragePathIgnorePatterns": [
129
- "/node_modules/",
130
- "dist",
131
- "lib",
132
- "lib-esm"
133
- ],
134
- "setupFilesAfterEnv": [
135
- "<rootDir>/jest.setup.js"
136
- ]
137
- },
138
- "gitHead": "cfbde4c7962de77bd43ba20811b84c4d7d333b42"
2
+ "name": "@aws-amplify/datastore",
3
+ "version": "5.0.1",
4
+ "description": "AppSyncLocal support for aws-amplify",
5
+ "main": "./dist/cjs/index.js",
6
+ "module": "./dist/esm/index.mjs",
7
+ "typings": "./dist/esm/index.d.ts",
8
+ "react-native": "./src/index.ts",
9
+ "publishConfig": {
10
+ "access": "public"
11
+ },
12
+ "sideEffects": [
13
+ "./dist/cjs/datastore/datastore.js",
14
+ "./dist/esm/datastore/datastore.mjs"
15
+ ],
16
+ "scripts": {
17
+ "test": "npm run lint && jest -w 1 --coverage",
18
+ "test:size": "size-limit",
19
+ "build-with-test": "npm test && npm run build",
20
+ "build:umd": "webpack && webpack --config ./webpack.config.dev.js",
21
+ "build:esm-cjs": "rollup -c rollup.config.mjs",
22
+ "build:cjs:watch": "rimraf dist/cjs && tsc -m commonjs --outDir dist/cjs --watch",
23
+ "build:esm:watch": "rimraf dist/esm && tsc -m esnext --outDir dist/esm --watch",
24
+ "build": "npm run clean && npm run build:esm-cjs && npm run build:umd",
25
+ "clean": "npm run clean:size && rimraf dist lib lib-esm",
26
+ "clean:size": "rimraf dual-publish-tmp tmp*",
27
+ "format": "echo \"Not implemented\" && npm run ts-coverage",
28
+ "lint": "tslint '{__tests__,src}/**/*.ts' && npm run ts-coverage",
29
+ "ts-coverage": "typescript-coverage-report -p ./tsconfig.json -t 92.05"
30
+ },
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "https://github.com/aws-amplify/amplify-js.git"
34
+ },
35
+ "author": "Amazon Web Services",
36
+ "license": "Apache-2.0",
37
+ "bugs": {
38
+ "url": "https://github.com/aws/aws-amplify/issues"
39
+ },
40
+ "homepage": "https://aws-amplify.github.io/",
41
+ "files": [
42
+ "dist/cjs",
43
+ "dist/esm",
44
+ "src"
45
+ ],
46
+ "dependencies": {
47
+ "@aws-amplify/api": "6.0.1",
48
+ "buffer": "4.9.2",
49
+ "idb": "5.0.6",
50
+ "immer": "9.0.6",
51
+ "rxjs": "^7.8.1",
52
+ "ulid": "^2.3.0"
53
+ },
54
+ "peerDependencies": {
55
+ "@aws-amplify/core": "^6.0.0"
56
+ },
57
+ "devDependencies": {
58
+ "@aws-amplify/core": "6.0.1",
59
+ "@aws-amplify/react-native": "1.0.1",
60
+ "@rollup/plugin-typescript": "11.1.5",
61
+ "@types/uuid-validate": "^0.0.1",
62
+ "dexie": "3.2.2",
63
+ "dexie-export-import": "1.0.3",
64
+ "fake-indexeddb": "3.0.0",
65
+ "graphql": "15.8.0",
66
+ "rollup": "3.29.4",
67
+ "typescript": "5.0.2"
68
+ },
69
+ "size-limit": [
70
+ {
71
+ "name": "DataStore (top-level class)",
72
+ "path": "./dist/esm/index.mjs",
73
+ "import": "{ Amplify, DataStore }",
74
+ "limit": "65.25 kB"
75
+ }
76
+ ],
77
+ "jest": {
78
+ "globals": {
79
+ "ts-jest": {
80
+ "diagnostics": true,
81
+ "tsConfig": {
82
+ "lib": [
83
+ "es5",
84
+ "es2015",
85
+ "dom",
86
+ "esnext.asynciterable",
87
+ "es2019"
88
+ ],
89
+ "target": "es5",
90
+ "allowJs": true,
91
+ "esModuleInterop": true,
92
+ "strictNullChecks": false,
93
+ "types": [
94
+ "@types/jest"
95
+ ]
96
+ }
97
+ }
98
+ },
99
+ "transform": {
100
+ "^.+\\.(js|jsx|ts|tsx)$": "ts-jest"
101
+ },
102
+ "testRegex": "(/__tests__/.*|\\.(test|spec))\\.(tsx?|jsx?)$",
103
+ "testPathIgnorePatterns": [
104
+ "__tests__/model.ts",
105
+ "__tests__/schema.ts",
106
+ "__tests__/helpers/",
107
+ "__tests__/commonAdapterTests.ts"
108
+ ],
109
+ "moduleFileExtensions": [
110
+ "ts",
111
+ "tsx",
112
+ "js",
113
+ "json",
114
+ "jsx"
115
+ ],
116
+ "testEnvironment": "jsdom",
117
+ "testURL": "http://localhost/",
118
+ "coverageThreshold": {
119
+ "global": {
120
+ "branches": 0,
121
+ "functions": 0,
122
+ "lines": 0,
123
+ "statements": 0
124
+ }
125
+ },
126
+ "coveragePathIgnorePatterns": [
127
+ "/node_modules/",
128
+ "dist"
129
+ ],
130
+ "setupFilesAfterEnv": [
131
+ "<rootDir>/jest.setup.js"
132
+ ]
133
+ },
134
+ "gitHead": "f1408db3f570c4a18ada40cecbe7e68a0b31f1fe"
139
135
  }
@@ -1,2 +0,0 @@
1
- import { AuthModeStrategy } from '../types';
2
- export declare const defaultAuthStrategy: AuthModeStrategy;
@@ -1,2 +0,0 @@
1
- export { defaultAuthStrategy } from './defaultAuthStrategy';
2
- export { multiAuthStrategy } from './multiAuthStrategy';
@@ -1,13 +0,0 @@
1
- import { AuthModeStrategy, AmplifyContext } from '../types';
2
- /**
3
- * Returns an array of auth modes to try based on the schema, model, and
4
- * authenticated user (or lack thereof). Rules are sourced from `getAuthRules`
5
- * and returned in the order they ought to be attempted.
6
- *
7
- * @see sortAuthRulesWithPriority
8
- * @see getAuthRules
9
- *
10
- * @param param0 The `{schema, modelName}` to inspect.
11
- * @returns A sorted array of auth modes to attempt.
12
- */
13
- export declare const multiAuthStrategy: (amplifyContext: AmplifyContext) => AuthModeStrategy;
@@ -1,231 +0,0 @@
1
- import { Observable } from 'rxjs';
2
- import { PredicateAll } from '../predicates';
3
- import { ConflictHandler, DataStoreConfig, ProducerPaginationInput, PersistentModel, PersistentModelConstructor, Schema, SubscriptionMessage, DataStoreSnapshot, TypeConstructorMap, ErrorHandler, ObserveQueryOptions, PersistentModelMetaData, IdentifierFieldOrIdentifierObject, RecursiveModelPredicateExtender, ModelPredicateExtender } from '../types';
4
- export declare let syncClasses: TypeConstructorMap;
5
- /**
6
- * Describes whether and to what a model is attached for lazy loading purposes.
7
- */
8
- declare enum ModelAttachment {
9
- /**
10
- * Model doesn't lazy load from any data source.
11
- *
12
- * Related entity properties provided at instantiation are returned
13
- * via the respective lazy interfaces when their properties are invoked.
14
- */
15
- Detached = "Detached",
16
- /**
17
- * Model lazy loads from the global DataStore.
18
- */
19
- DataStore = "DataStore",
20
- /**
21
- * Demonstrative. Not yet implemented.
22
- */
23
- API = "API"
24
- }
25
- /**
26
- * Registers a model instance against a data source (DataStore, API, or
27
- * Detached/None).
28
- *
29
- * The API option is demonstrative. Lazy loading against API is not yet
30
- * implemented.
31
- *
32
- * @param result A model instance or array of instances
33
- * @param attachment A ModelAttachment data source
34
- * @returns passes the `result` back through after attachment
35
- */
36
- export declare function attached<T extends PersistentModel | PersistentModel[]>(result: T, attachment: ModelAttachment): T;
37
- /**
38
- * Determines what source a model instance should lazy load from.
39
- *
40
- * If the instace was never explicitly registered, it is detached by default.
41
- *
42
- * @param instance A model instance
43
- */
44
- export declare const getAttachment: (instance: PersistentModel) => ModelAttachment;
45
- declare const initSchema: (userSchema: Schema) => TypeConstructorMap;
46
- /**
47
- * Constructs a model and records it with its metadata in a weakset. Allows for
48
- * the separate storage of core model fields and Amplify/DataStore metadata
49
- * fields that the customer app does not want exposed.
50
- *
51
- * @param modelConstructor The model constructor.
52
- * @param init Init data that would normally be passed to the constructor.
53
- * @returns The initialized model.
54
- */
55
- export declare type ModelInstanceCreator = typeof modelInstanceCreator;
56
- declare function modelInstanceCreator<T extends PersistentModel>(modelConstructor: PersistentModelConstructor<T>, init: Partial<T>): T;
57
- /**
58
- * An eventually loaded related model instance.
59
- */
60
- export declare class AsyncItem<T> extends Promise<T> {
61
- }
62
- /**
63
- * A collection of related model instances.
64
- *
65
- * This collection can be async-iterated or turned directly into an array using `toArray()`.
66
- */
67
- export declare class AsyncCollection<T> implements AsyncIterable<T> {
68
- private values;
69
- constructor(values: Array<any> | Promise<Array<any>>);
70
- /**
71
- * Facilitates async iteration.
72
- *
73
- * ```ts
74
- * for await (const item of collection) {
75
- * handle(item)
76
- * }
77
- * ```
78
- *
79
- * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of
80
- */
81
- [Symbol.asyncIterator](): AsyncIterator<T>;
82
- /**
83
- * Turns the collection into an array, up to the amount specified in `max` param.
84
- *
85
- * ```ts
86
- * const all = await collection.toArray();
87
- * const first100 = await collection.toArray({max: 100});
88
- * ```
89
- */
90
- toArray({ max, }?: {
91
- max?: number;
92
- }): Promise<T[]>;
93
- }
94
- declare class DataStore {
95
- private InternalAPI;
96
- private Cache;
97
- private amplifyConfig;
98
- private authModeStrategy;
99
- private conflictHandler;
100
- private errorHandler;
101
- private fullSyncInterval;
102
- private initialized?;
103
- private initReject;
104
- private initResolve;
105
- private maxRecordsToSync;
106
- private storage?;
107
- private sync?;
108
- private syncPageSize;
109
- private syncExpressions;
110
- private syncPredicates;
111
- private sessionId?;
112
- private storageAdapter;
113
- private amplifyContext;
114
- private connectivityMonitor?;
115
- /**
116
- * **IMPORTANT!**
117
- *
118
- * Accumulator for background things that can **and MUST** be called when
119
- * DataStore stops.
120
- *
121
- * These jobs **MUST** be *idempotent promises* that resolve ONLY
122
- * once the intended jobs are completely finished and/or otherwise destroyed
123
- * and cleaned up with ZERO outstanding:
124
- *
125
- * 1. side effects (e.g., state changes)
126
- * 1. callbacks
127
- * 1. subscriptions
128
- * 1. calls to storage
129
- * 1. *etc.*
130
- *
131
- * Methods that create pending promises, subscriptions, callbacks, or any
132
- * type of side effect **MUST** be registered with the manager. And, a new
133
- * manager must be created after each `exit()`.
134
- *
135
- * Failure to comply will put DataStore into a highly unpredictable state
136
- * when it needs to stop or clear -- which occurs when restarting with new
137
- * sync expressions, during testing, and potentially during app code
138
- * recovery handling, etc..
139
- *
140
- * It is up to the discretion of each disposer whether to wait for job
141
- * completion or to cancel operations and issue failures *as long as the
142
- * disposer returns in a reasonable amount of time.*
143
- *
144
- * (Reasonable = *seconds*, not minutes.)
145
- */
146
- private runningProcesses;
147
- /**
148
- * Indicates what state DataStore is in.
149
- *
150
- * Not [yet?] used for actual state management; but for messaging
151
- * when errors occur, to help troubleshoot.
152
- */
153
- private state;
154
- getModuleName(): string;
155
- /**
156
- * Builds a function to capture `BackgroundManagerNotOpenError`'s to produce friendlier,
157
- * more instructive errors for customers.
158
- *
159
- * @param operation The name of the operation (usually a Datastore method) the customer
160
- * tried to call.
161
- */
162
- handleAddProcError(operation: string): (err: Error) => never;
163
- /**
164
- * If not already done:
165
- * 1. Attaches and initializes storage.
166
- * 2. Loads the schema and records metadata.
167
- * 3. If `this.amplifyConfig.aws_appsync_graphqlEndpoint` contains a URL,
168
- * attaches a sync engine, starts it, and subscribes.
169
- */
170
- start: () => Promise<void>;
171
- query: {
172
- <T extends PersistentModel>(modelConstructor: PersistentModelConstructor<T>, identifier: IdentifierFieldOrIdentifierObject<T, PersistentModelMetaData<T>>): Promise<T | undefined>;
173
- <T extends PersistentModel>(modelConstructor: PersistentModelConstructor<T>, criteria?: RecursiveModelPredicateExtender<T> | typeof PredicateAll | null, paginationProducer?: ProducerPaginationInput<T>): Promise<T[]>;
174
- };
175
- save: <T extends Readonly<Record<string, any>>>(model: T, condition?: ModelPredicateExtender<T>) => Promise<T>;
176
- setConflictHandler: (config: DataStoreConfig) => ConflictHandler;
177
- setErrorHandler: (config: DataStoreConfig) => ErrorHandler;
178
- delete: {
179
- <T extends PersistentModel>(modelConstructor: PersistentModelConstructor<T>, identifier: IdentifierFieldOrIdentifierObject<T, PersistentModelMetaData<T>>): Promise<T[]>;
180
- <T extends PersistentModel>(modelConstructor: PersistentModelConstructor<T>, condition: ModelPredicateExtender<T> | typeof PredicateAll): Promise<T[]>;
181
- <T extends PersistentModel>(model: T, condition?: ModelPredicateExtender<T>): Promise<T>;
182
- };
183
- observe: {
184
- (): Observable<SubscriptionMessage<PersistentModel>>;
185
- <T extends PersistentModel>(modelConstructor: PersistentModelConstructor<T>, identifier: string): Observable<SubscriptionMessage<T>>;
186
- <T extends PersistentModel>(modelConstructor: PersistentModelConstructor<T>, criteria?: RecursiveModelPredicateExtender<T> | typeof PredicateAll): Observable<SubscriptionMessage<T>>;
187
- <T extends PersistentModel>(model: T): Observable<SubscriptionMessage<T>>;
188
- };
189
- observeQuery: {
190
- <T extends PersistentModel>(modelConstructor: PersistentModelConstructor<T>, criteria?: RecursiveModelPredicateExtender<T> | typeof PredicateAll, paginationProducer?: ObserveQueryOptions<T>): Observable<DataStoreSnapshot<T>>;
191
- };
192
- configure: (config?: DataStoreConfig) => void;
193
- /**
194
- * Clears all data from storage and removes all data, schema info, other
195
- * initialization details, and then stops DataStore.
196
- *
197
- * That said, reinitialization is required after clearing. This can be done
198
- * by explicitiliy calling `start()` or any method that implicitly starts
199
- * DataStore, such as `query()`, `save()`, or `delete()`.
200
- */
201
- clear(): Promise<void>;
202
- /**
203
- * Stops all DataStore sync activities.
204
- *
205
- * TODO: "Waits for graceful termination of
206
- * running queries and terminates subscriptions."
207
- */
208
- stop(this: InstanceType<typeof DataStore>): Promise<void>;
209
- /**
210
- * Validates given pagination input from a query and creates a pagination
211
- * argument for use against the storage layer.
212
- *
213
- * @param modelDefinition
214
- * @param paginationProducer
215
- */
216
- private processPagination;
217
- /**
218
- * Examines the configured `syncExpressions` and produces a WeakMap of
219
- * SchemaModel -> predicate to use during sync.
220
- */
221
- private processSyncExpressions;
222
- private unwrapPromise;
223
- private weakMapFromEntries;
224
- /**
225
- * A session ID to allow CMS to open databases against multiple apps.
226
- * This session ID is only expected be set by AWS Amplify Studio.
227
- */
228
- private retrieveSessionId;
229
- }
230
- declare const instance: DataStore;
231
- export { DataStore as DataStoreClass, initSchema, instance as DataStore };
package/lib/index.d.ts DELETED
@@ -1,16 +0,0 @@
1
- export { DataStore, DataStoreClass, initSchema, ModelInstanceCreator, AsyncCollection, AsyncItem, } from './datastore/datastore';
2
- export { Predicates, ModelPredicateCreator, ModelSortPredicateCreator, } from './predicates';
3
- export { Adapter as StorageAdapter } from './storage/adapter';
4
- export { NAMESPACES } from './util';
5
- export declare const utils: {
6
- USER: import("./util").NAMESPACES;
7
- traverseModel: <T extends Readonly<Record<string, any>>>(srcModelName: string, instance: T, namespace: import("./types").SchemaNamespace, modelInstanceCreator: <T_1 extends Readonly<Record<string, any>>>(modelConstructor: import("./types").PersistentModelConstructor<T_1>, init: Partial<T_1>) => T_1, getModelConstructorByModelName: (namsespaceName: import("./util").NAMESPACES, modelName: string) => import("./types").PersistentModelConstructor<any>) => {
8
- modelName: string;
9
- item: T;
10
- instance: T;
11
- }[];
12
- validatePredicate: <T_2 extends Readonly<Record<string, any>>>(model: T_2, groupType: keyof import("./types").PredicateGroups<T_2>, predicatesOrGroups: (import("./types").PredicateObject<T_2> | import("./types").PredicatesGroup<T_2>)[]) => any;
13
- isNonModelConstructor: (obj: any) => obj is import("./types").NonModelTypeConstructor<any>;
14
- isModelConstructor: <T_3 extends Readonly<Record<string, any>>>(obj: any) => obj is import("./types").PersistentModelConstructor<T_3>;
15
- };
16
- export * from './types';
@@ -1,100 +0,0 @@
1
- import { ModelPredicate, PersistentModel, PredicatesGroup, SchemaModel } from '../types';
2
- export { ModelSortPredicateCreator } from './sort';
3
- export declare function isPredicatesAll(predicate: any): predicate is typeof PredicateAll;
4
- /**
5
- * The valid comparison operators that can be used as keys in a predicate comparison object.
6
- */
7
- export declare const comparisonKeys: Set<string>;
8
- export declare const PredicateAll: unique symbol;
9
- export declare class Predicates {
10
- static get ALL(): typeof PredicateAll;
11
- }
12
- export declare class ModelPredicateCreator {
13
- /**
14
- * Map of storage predicates (key objects) to storage predicate AST's.
15
- */
16
- private static predicateGroupsMap;
17
- /**
18
- * Determines whether the given storage predicate (lookup key) is a predicate
19
- * key that DataStore recognizes.
20
- *
21
- * @param predicate The storage predicate (lookup key) to test.
22
- */
23
- static isValidPredicate<T extends PersistentModel>(predicate: any): predicate is ModelPredicate<T>;
24
- /**
25
- * Looks for the storage predicate AST that corresponds to a given storage
26
- * predicate key.
27
- *
28
- * The key must have been created internally by a DataStore utility
29
- * method, such as `ModelPredicate.createFromAST()`.
30
- *
31
- * @param predicate The predicate reference to look up.
32
- * @param throwOnInvalid Whether to throw an exception if the predicate
33
- * isn't a valid DataStore predicate.
34
- */
35
- static getPredicates<T extends PersistentModel>(predicate: ModelPredicate<T>, throwOnInvalid?: boolean): PredicatesGroup<any>;
36
- /**
37
- * using the PK values from the given `model` (which can be a partial of T
38
- * Creates a predicate that matches an instance described by `modelDefinition`
39
- * that contains only PK field values.)
40
- *
41
- * @param modelDefinition The model definition to create a predicate for.
42
- * @param model The model instance to extract value equalities from.
43
- */
44
- static createForPk<T extends PersistentModel>(modelDefinition: SchemaModel, model: T): ModelPredicate<T>;
45
- /**
46
- * Searches a `Model` table for records matching the given equalities object.
47
- *
48
- * This only matches against fields given in the equalities object. No other
49
- * fields are tested by the predicate.
50
- *
51
- * @param modelDefinition The model we need a predicate for.
52
- * @param flatEqualities An object holding field equalities to search for.
53
- */
54
- static createFromFlatEqualities<T extends PersistentModel>(modelDefinition: SchemaModel, flatEqualities: Record<string, any>): ModelPredicate<T>;
55
- /**
56
- * Accepts a GraphQL style filter predicate tree and transforms it into an
57
- * AST that can be used for a storage adapter predicate. Example input:
58
- *
59
- * ```js
60
- * {
61
- * and: [
62
- * { name: { eq: "Bob Jones" } },
63
- * { age: { between: [32, 64] } },
64
- * { not: {
65
- * or: [
66
- * { favoriteFood: { eq: 'pizza' } },
67
- * { favoriteFood: { eq: 'tacos' } },
68
- * ]
69
- * }}
70
- * ]
71
- * }
72
- * ```
73
- *
74
- * @param gql GraphQL style filter node.
75
- */
76
- static transformGraphQLFilterNodeToPredicateAST(gql: any): any;
77
- /**
78
- * Accepts a GraphQL style filter predicate tree and transforms it into a predicate
79
- * that storage adapters understand. Example input:
80
- *
81
- * ```js
82
- * {
83
- * and: [
84
- * { name: { eq: "Bob Jones" } },
85
- * { age: { between: [32, 64] } },
86
- * { not: {
87
- * or: [
88
- * { favoriteFood: { eq: 'pizza' } },
89
- * { favoriteFood: { eq: 'tacos' } },
90
- * ]
91
- * }}
92
- * ]
93
- * }
94
- * ```
95
- *
96
- * @param modelDefinition The model that the AST/predicate must be compatible with.
97
- * @param ast The graphQL style AST that should specify conditions for `modelDefinition`.
98
- */
99
- static createFromAST<T extends PersistentModel>(modelDefinition: SchemaModel, ast: any): ModelPredicate<T>;
100
- }