@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
@@ -1,9 +1,10 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
1
  import { GraphQLAuthError } from '@aws-amplify/api';
4
- import { isEnumFieldType, isGraphQLScalarType, isPredicateObj, isSchemaModel, isSchemaModelWithAttributes, isTargetNameAssociation, isNonModelFieldType, OpType, ModelOperation, isPredicateGroup, } from '../types';
5
- import { extractPrimaryKeyFieldNames, establishRelationAndKeys, IDENTIFIER_KEY_SEPARATOR, } from '../util';
2
+ import { isSchemaModel, isSchemaModelWithAttributes, isGraphQLScalarType, isEnumFieldType, isTargetNameAssociation, isNonModelFieldType, OpType, isPredicateObj, isPredicateGroup, ModelOperation } from '../types.mjs';
3
+ import { establishRelationAndKeys, extractPrimaryKeyFieldNames, IDENTIFIER_KEY_SEPARATOR } from '../util.mjs';
6
4
  import { ConsoleLogger } from '@aws-amplify/core';
5
+
6
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
7
+ // SPDX-License-Identifier: Apache-2.0
7
8
  const logger = new ConsoleLogger('DataStore');
8
9
  var GraphQLOperationType;
9
10
  (function (GraphQLOperationType) {
@@ -13,7 +14,7 @@ var GraphQLOperationType;
13
14
  GraphQLOperationType["DELETE"] = "mutation";
14
15
  GraphQLOperationType["GET"] = "query";
15
16
  })(GraphQLOperationType || (GraphQLOperationType = {}));
16
- export var TransformerMutationType;
17
+ var TransformerMutationType;
17
18
  (function (TransformerMutationType) {
18
19
  TransformerMutationType["CREATE"] = "Create";
19
20
  TransformerMutationType["UPDATE"] = "Update";
@@ -26,10 +27,10 @@ const dummyMetadata = {
26
27
  _deleted: undefined,
27
28
  };
28
29
  const metadataFields = (Object.keys(dummyMetadata));
29
- export function getMetadataFields() {
30
+ function getMetadataFields() {
30
31
  return metadataFields;
31
32
  }
32
- export function generateSelectionSet(namespace, modelDefinition) {
33
+ function generateSelectionSet(namespace, modelDefinition) {
33
34
  const scalarFields = getScalarFields(modelDefinition);
34
35
  const nonModelFields = getNonModelFields(namespace, modelDefinition);
35
36
  const implicitOwnerField = getImplicitOwnerField(modelDefinition, scalarFields);
@@ -137,7 +138,7 @@ function getNonModelFields(namespace, modelDefinition) {
137
138
  });
138
139
  return result;
139
140
  }
140
- export function getAuthorizationRules(modelDefinition) {
141
+ function getAuthorizationRules(modelDefinition) {
141
142
  // Searching for owner authorization on attributes
142
143
  const authConfig = []
143
144
  .concat(modelDefinition.attributes || [])
@@ -185,7 +186,7 @@ export function getAuthorizationRules(modelDefinition) {
185
186
  });
186
187
  return resultRules;
187
188
  }
188
- export function buildSubscriptionGraphQLOperation(namespace, modelDefinition, transformerMutationType, isOwnerAuthorization, ownerField, filterArg = false) {
189
+ function buildSubscriptionGraphQLOperation(namespace, modelDefinition, transformerMutationType, isOwnerAuthorization, ownerField, filterArg = false) {
189
190
  const selectionSet = generateSelectionSet(namespace, modelDefinition);
190
191
  const { name: typeName } = modelDefinition;
191
192
  const opName = `on${transformerMutationType}${typeName}`;
@@ -211,7 +212,7 @@ export function buildSubscriptionGraphQLOperation(namespace, modelDefinition, tr
211
212
  }`,
212
213
  ];
213
214
  }
214
- export function buildGraphQLOperation(namespace, modelDefinition, graphQLOpType) {
215
+ function buildGraphQLOperation(namespace, modelDefinition, graphQLOpType) {
215
216
  let selectionSet = generateSelectionSet(namespace, modelDefinition);
216
217
  const { name: typeName, pluralName: pluralTypeName } = modelDefinition;
217
218
  let operation;
@@ -269,7 +270,7 @@ export function buildGraphQLOperation(namespace, modelDefinition, graphQLOpType)
269
270
  ],
270
271
  ];
271
272
  }
272
- export function createMutationInstanceFromModelOperation(relationships, modelDefinition, opType, model, element, condition, MutationEventConstructor, modelInstanceCreator, id) {
273
+ function createMutationInstanceFromModelOperation(relationships, modelDefinition, opType, model, element, condition, MutationEventConstructor, modelInstanceCreator, id) {
273
274
  let operation;
274
275
  switch (opType) {
275
276
  case OpType.INSERT:
@@ -310,7 +311,7 @@ export function createMutationInstanceFromModelOperation(relationships, modelDef
310
311
  });
311
312
  return mutationEvent;
312
313
  }
313
- export function predicateToGraphQLCondition(predicate, modelDefinition) {
314
+ function predicateToGraphQLCondition(predicate, modelDefinition) {
314
315
  const result = {};
315
316
  if (!predicate || !Array.isArray(predicate.predicates)) {
316
317
  return result;
@@ -340,7 +341,7 @@ export function predicateToGraphQLCondition(predicate, modelDefinition) {
340
341
  { and:[{ username: { eq: 'bob' }}] }
341
342
  ```
342
343
  */
343
- export function predicateToGraphQLFilter(predicatesGroup, fieldsToOmit = [], root = true) {
344
+ function predicateToGraphQLFilter(predicatesGroup, fieldsToOmit = [], root = true) {
344
345
  const result = {};
345
346
  if (!predicatesGroup || !Array.isArray(predicatesGroup.predicates)) {
346
347
  return result;
@@ -401,7 +402,7 @@ export function predicateToGraphQLFilter(predicatesGroup, fieldsToOmit = [], roo
401
402
  * @param group - selective sync predicate group
402
403
  * @returns set of distinct field names in the filter group
403
404
  */
404
- export function filterFields(group) {
405
+ function filterFields(group) {
405
406
  const fields = new Set();
406
407
  if (!group || !Array.isArray(group.predicates))
407
408
  return fields;
@@ -423,7 +424,7 @@ export function filterFields(group) {
423
424
  * @param modelDefinition
424
425
  * @returns set of field names used with dynamic auth modes configured for the provided model definition
425
426
  */
426
- export function dynamicAuthFields(modelDefinition) {
427
+ function dynamicAuthFields(modelDefinition) {
427
428
  const rules = getAuthorizationRules(modelDefinition);
428
429
  const fields = new Set();
429
430
  for (const rule of rules) {
@@ -450,7 +451,7 @@ export function dynamicAuthFields(modelDefinition) {
450
451
  * ]}
451
452
  * ```
452
453
  */
453
- export function countFilterCombinations(group) {
454
+ function countFilterCombinations(group) {
454
455
  if (!group || !Array.isArray(group.predicates))
455
456
  return 0;
456
457
  let count = 0;
@@ -482,7 +483,7 @@ export function countFilterCombinations(group) {
482
483
  * ] }
483
484
  * ```
484
485
  */
485
- export function repeatedFieldInGroup(group) {
486
+ function repeatedFieldInGroup(group) {
486
487
  if (!group || !Array.isArray(group.predicates))
487
488
  return null;
488
489
  // convert to filter in order to flatten redundant groups
@@ -520,7 +521,7 @@ export function repeatedFieldInGroup(group) {
520
521
  }
521
522
  return null;
522
523
  }
523
- export var RTFError;
524
+ var RTFError;
524
525
  (function (RTFError) {
525
526
  RTFError[RTFError["UnknownField"] = 0] = "UnknownField";
526
527
  RTFError[RTFError["MaxAttributes"] = 1] = "MaxAttributes";
@@ -529,7 +530,7 @@ export var RTFError;
529
530
  RTFError[RTFError["NotGroup"] = 4] = "NotGroup";
530
531
  RTFError[RTFError["FieldNotInType"] = 5] = "FieldNotInType";
531
532
  })(RTFError || (RTFError = {}));
532
- export function generateRTFRemediation(errorType, modelDefinition, predicatesGroup) {
533
+ function generateRTFRemediation(errorType, modelDefinition, predicatesGroup) {
533
534
  const selSyncFields = filterFields(predicatesGroup);
534
535
  const selSyncFieldStr = [...selSyncFields].join(', ');
535
536
  const dynamicAuthModeFields = dynamicAuthFields(modelDefinition);
@@ -570,7 +571,7 @@ export function generateRTFRemediation(errorType, modelDefinition, predicatesGro
570
571
  return '';
571
572
  }
572
573
  }
573
- export function getUserGroupsFromToken(token, rule) {
574
+ function getUserGroupsFromToken(token, rule) {
574
575
  // validate token against groupClaim
575
576
  let userGroups = token[rule.groupClaim] || [];
576
577
  if (typeof userGroups === 'string') {
@@ -585,7 +586,7 @@ export function getUserGroupsFromToken(token, rule) {
585
586
  }
586
587
  return userGroups;
587
588
  }
588
- export async function getModelAuthModes({ authModeStrategy, defaultAuthMode, modelName, schema, }) {
589
+ async function getModelAuthModes({ authModeStrategy, defaultAuthMode, modelName, schema, }) {
589
590
  const operations = Object.values(ModelOperation);
590
591
  const modelAuthModes = {
591
592
  CREATE: [],
@@ -617,7 +618,7 @@ export async function getModelAuthModes({ authModeStrategy, defaultAuthMode, mod
617
618
  }
618
619
  return modelAuthModes;
619
620
  }
620
- export function getForbiddenError(error) {
621
+ function getForbiddenError(error) {
621
622
  const forbiddenErrorCodes = [401, 403];
622
623
  let forbiddenError;
623
624
  if (error && error.errors) {
@@ -632,7 +633,7 @@ export function getForbiddenError(error) {
632
633
  }
633
634
  return null;
634
635
  }
635
- export function resolveServiceErrorStatusCode(error) {
636
+ function resolveServiceErrorStatusCode(error) {
636
637
  if (error?.['$metadata']?.['httpStatusCode']) {
637
638
  return Number(error?.['$metadata']?.['httpStatusCode']);
638
639
  }
@@ -643,14 +644,14 @@ export function resolveServiceErrorStatusCode(error) {
643
644
  return null;
644
645
  }
645
646
  }
646
- export function getClientSideAuthError(error) {
647
+ function getClientSideAuthError(error) {
647
648
  const clientSideAuthErrors = Object.values(GraphQLAuthError);
648
649
  const clientSideError = error &&
649
650
  error.message &&
650
651
  clientSideAuthErrors.find(clientError => error.message.includes(clientError));
651
652
  return clientSideError || null;
652
653
  }
653
- export async function getTokenForCustomAuth(authMode, amplifyConfig = {}) {
654
+ async function getTokenForCustomAuth(authMode, amplifyConfig = {}) {
654
655
  if (authMode === 'lambda') {
655
656
  const { authProviders: { functionAuthProvider } = { functionAuthProvider: null }, } = amplifyConfig;
656
657
  if (functionAuthProvider && typeof functionAuthProvider === 'function') {
@@ -669,8 +670,11 @@ export async function getTokenForCustomAuth(authMode, amplifyConfig = {}) {
669
670
  }
670
671
  }
671
672
  // Util that takes a modelDefinition and model and returns either the id value(s) or the custom primary key value(s)
672
- export function getIdentifierValue(modelDefinition, model) {
673
+ function getIdentifierValue(modelDefinition, model) {
673
674
  const pkFieldNames = extractPrimaryKeyFieldNames(modelDefinition);
674
675
  const idOrPk = pkFieldNames.map(f => model[f]).join(IDENTIFIER_KEY_SEPARATOR);
675
676
  return idOrPk;
676
677
  }
678
+
679
+ export { RTFError, TransformerMutationType, buildGraphQLOperation, buildSubscriptionGraphQLOperation, countFilterCombinations, createMutationInstanceFromModelOperation, dynamicAuthFields, filterFields, generateRTFRemediation, generateSelectionSet, getAuthorizationRules, getClientSideAuthError, getForbiddenError, getIdentifierValue, getMetadataFields, getModelAuthModes, getTokenForCustomAuth, getUserGroupsFromToken, predicateToGraphQLCondition, predicateToGraphQLFilter, repeatedFieldInGroup, resolveServiceErrorStatusCode };
680
+ //# sourceMappingURL=utils.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.mjs","sources":["../../../src/sync/utils.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { GraphQLAuthError } from '@aws-amplify/api';\nimport { isEnumFieldType, isGraphQLScalarType, isPredicateObj, isSchemaModel, isSchemaModelWithAttributes, isTargetNameAssociation, isNonModelFieldType, OpType, ModelOperation, isPredicateGroup, } from '../types';\nimport { extractPrimaryKeyFieldNames, establishRelationAndKeys, IDENTIFIER_KEY_SEPARATOR, } from '../util';\nimport { ConsoleLogger } from '@aws-amplify/core';\nconst logger = new ConsoleLogger('DataStore');\nvar GraphQLOperationType;\n(function (GraphQLOperationType) {\n GraphQLOperationType[\"LIST\"] = \"query\";\n GraphQLOperationType[\"CREATE\"] = \"mutation\";\n GraphQLOperationType[\"UPDATE\"] = \"mutation\";\n GraphQLOperationType[\"DELETE\"] = \"mutation\";\n GraphQLOperationType[\"GET\"] = \"query\";\n})(GraphQLOperationType || (GraphQLOperationType = {}));\nexport var TransformerMutationType;\n(function (TransformerMutationType) {\n TransformerMutationType[\"CREATE\"] = \"Create\";\n TransformerMutationType[\"UPDATE\"] = \"Update\";\n TransformerMutationType[\"DELETE\"] = \"Delete\";\n TransformerMutationType[\"GET\"] = \"Get\";\n})(TransformerMutationType || (TransformerMutationType = {}));\nconst dummyMetadata = {\n _version: undefined,\n _lastChangedAt: undefined,\n _deleted: undefined,\n};\nconst metadataFields = (Object.keys(dummyMetadata));\nexport function getMetadataFields() {\n return metadataFields;\n}\nexport function generateSelectionSet(namespace, modelDefinition) {\n const scalarFields = getScalarFields(modelDefinition);\n const nonModelFields = getNonModelFields(namespace, modelDefinition);\n const implicitOwnerField = getImplicitOwnerField(modelDefinition, scalarFields);\n let scalarAndMetadataFields = Object.values(scalarFields)\n .map(({ name }) => name)\n .concat(implicitOwnerField)\n .concat(nonModelFields);\n if (isSchemaModel(modelDefinition)) {\n scalarAndMetadataFields = scalarAndMetadataFields\n .concat(getMetadataFields())\n .concat(getConnectionFields(modelDefinition, namespace));\n }\n const result = scalarAndMetadataFields.join('\\n');\n return result;\n}\nfunction getImplicitOwnerField(modelDefinition, scalarFields) {\n const ownerFields = getOwnerFields(modelDefinition);\n if (!scalarFields.owner && ownerFields.includes('owner')) {\n return ['owner'];\n }\n return [];\n}\nfunction getOwnerFields(modelDefinition) {\n const ownerFields = [];\n if (isSchemaModelWithAttributes(modelDefinition)) {\n modelDefinition.attributes.forEach(attr => {\n if (attr.properties && attr.properties.rules) {\n const rule = attr.properties.rules.find(rule => rule.allow === 'owner');\n if (rule && rule.ownerField) {\n ownerFields.push(rule.ownerField);\n }\n }\n });\n }\n return ownerFields;\n}\nfunction getScalarFields(modelDefinition) {\n const { fields } = modelDefinition;\n const result = Object.values(fields)\n .filter(field => {\n if (isGraphQLScalarType(field.type) || isEnumFieldType(field.type)) {\n return true;\n }\n return false;\n })\n .reduce((acc, field) => {\n acc[field.name] = field;\n return acc;\n }, {});\n return result;\n}\n// Used for generating the selection set for queries and mutations\nfunction getConnectionFields(modelDefinition, namespace) {\n const result = [];\n Object.values(modelDefinition.fields)\n .filter(({ association }) => association && Object.keys(association).length)\n .forEach(({ name, association }) => {\n const { connectionType } = association || {};\n switch (connectionType) {\n case 'HAS_ONE':\n case 'HAS_MANY':\n // Intentionally blank\n break;\n case 'BELONGS_TO':\n if (isTargetNameAssociation(association)) {\n // New codegen (CPK)\n if (association.targetNames && association.targetNames.length > 0) {\n // Need to retrieve relations in order to get connected model keys\n const [relations] = establishRelationAndKeys(namespace);\n const connectedModelName = modelDefinition.fields[name].type['model'];\n const byPkIndex = relations[connectedModelName].indexes.find(([name]) => name === 'byPk');\n const keyFields = byPkIndex && byPkIndex[1];\n const keyFieldSelectionSet = keyFields?.join(' ');\n // We rely on `_deleted` when we process the sync query (e.g. in batchSave in the adapters)\n result.push(`${name} { ${keyFieldSelectionSet} _deleted }`);\n }\n else {\n // backwards-compatability for schema generated prior to custom primary key support\n result.push(`${name} { id _deleted }`);\n }\n }\n break;\n default:\n throw new Error(`Invalid connection type ${connectionType}`);\n }\n });\n return result;\n}\nfunction getNonModelFields(namespace, modelDefinition) {\n const result = [];\n Object.values(modelDefinition.fields).forEach(({ name, type }) => {\n if (isNonModelFieldType(type)) {\n const typeDefinition = namespace.nonModels[type.nonModel];\n const scalarFields = Object.values(getScalarFields(typeDefinition)).map(({ name }) => name);\n const nested = [];\n Object.values(typeDefinition.fields).forEach(field => {\n const { type, name } = field;\n if (isNonModelFieldType(type)) {\n const typeDefinition = namespace.nonModels[type.nonModel];\n nested.push(`${name} { ${generateSelectionSet(namespace, typeDefinition)} }`);\n }\n });\n result.push(`${name} { ${scalarFields.join(' ')} ${nested.join(' ')} }`);\n }\n });\n return result;\n}\nexport function getAuthorizationRules(modelDefinition) {\n // Searching for owner authorization on attributes\n const authConfig = []\n .concat(modelDefinition.attributes || [])\n .find(attr => attr && attr.type === 'auth');\n const { properties: { rules = [] } = {} } = authConfig || {};\n const resultRules = [];\n // Multiple rules can be declared for allow: owner\n rules.forEach(rule => {\n // setting defaults for backwards compatibility with old cli\n const { identityClaim = 'cognito:username', ownerField = 'owner', operations = ['create', 'update', 'delete', 'read'], provider = 'userPools', groupClaim = 'cognito:groups', allow: authStrategy = 'iam', groups = [], groupsField = '', } = rule;\n const isReadAuthorized = operations.includes('read');\n const isOwnerAuth = authStrategy === 'owner';\n if (!isReadAuthorized && !isOwnerAuth) {\n return;\n }\n const authRule = {\n identityClaim,\n ownerField,\n provider,\n groupClaim,\n authStrategy,\n groups,\n groupsField,\n areSubscriptionsPublic: false,\n };\n if (isOwnerAuth) {\n // look for the subscription level override\n // only pay attention to the public level\n const modelConfig = []\n .concat(modelDefinition.attributes || [])\n .find(attr => attr && attr.type === 'model');\n // find the subscriptions level. ON is default\n const { properties: { subscriptions: { level = 'on' } = {} } = {} } = modelConfig || {};\n // treat subscriptions as public for owner auth with unprotected reads\n // when `read` is omitted from `operations`\n authRule.areSubscriptionsPublic =\n !operations.includes('read') || level === 'public';\n }\n if (isOwnerAuth) {\n // owner rules has least priority\n resultRules.push(authRule);\n return;\n }\n resultRules.unshift(authRule);\n });\n return resultRules;\n}\nexport function buildSubscriptionGraphQLOperation(namespace, modelDefinition, transformerMutationType, isOwnerAuthorization, ownerField, filterArg = false) {\n const selectionSet = generateSelectionSet(namespace, modelDefinition);\n const { name: typeName } = modelDefinition;\n const opName = `on${transformerMutationType}${typeName}`;\n const docArgs = [];\n const opArgs = [];\n if (filterArg) {\n docArgs.push(`$filter: ModelSubscription${typeName}FilterInput`);\n opArgs.push('filter: $filter');\n }\n if (isOwnerAuthorization) {\n docArgs.push(`$${ownerField}: String!`);\n opArgs.push(`${ownerField}: $${ownerField}`);\n }\n const docStr = docArgs.length ? `(${docArgs.join(',')})` : '';\n const opStr = opArgs.length ? `(${opArgs.join(',')})` : '';\n return [\n transformerMutationType,\n opName,\n `subscription operation${docStr}{\n\t\t\t${opName}${opStr}{\n\t\t\t\t${selectionSet}\n\t\t\t}\n\t\t}`,\n ];\n}\nexport function buildGraphQLOperation(namespace, modelDefinition, graphQLOpType) {\n let selectionSet = generateSelectionSet(namespace, modelDefinition);\n const { name: typeName, pluralName: pluralTypeName } = modelDefinition;\n let operation;\n let documentArgs;\n let operationArgs;\n let transformerMutationType;\n switch (graphQLOpType) {\n case 'LIST':\n operation = `sync${pluralTypeName}`;\n documentArgs = `($limit: Int, $nextToken: String, $lastSync: AWSTimestamp, $filter: Model${typeName}FilterInput)`;\n operationArgs =\n '(limit: $limit, nextToken: $nextToken, lastSync: $lastSync, filter: $filter)';\n selectionSet = `items {\n\t\t\t\t\t\t\t${selectionSet}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tnextToken\n\t\t\t\t\t\tstartedAt`;\n break;\n case 'CREATE':\n operation = `create${typeName}`;\n documentArgs = `($input: Create${typeName}Input!)`;\n operationArgs = '(input: $input)';\n transformerMutationType = TransformerMutationType.CREATE;\n break;\n case 'UPDATE':\n operation = `update${typeName}`;\n documentArgs = `($input: Update${typeName}Input!, $condition: Model${typeName}ConditionInput)`;\n operationArgs = '(input: $input, condition: $condition)';\n transformerMutationType = TransformerMutationType.UPDATE;\n break;\n case 'DELETE':\n operation = `delete${typeName}`;\n documentArgs = `($input: Delete${typeName}Input!, $condition: Model${typeName}ConditionInput)`;\n operationArgs = '(input: $input, condition: $condition)';\n transformerMutationType = TransformerMutationType.DELETE;\n break;\n case 'GET':\n operation = `get${typeName}`;\n documentArgs = `($id: ID!)`;\n operationArgs = '(id: $id)';\n transformerMutationType = TransformerMutationType.GET;\n break;\n default:\n throw new Error(`Invalid graphQlOpType ${graphQLOpType}`);\n }\n return [\n [\n transformerMutationType,\n operation,\n `${GraphQLOperationType[graphQLOpType]} operation${documentArgs}{\n\t\t${operation}${operationArgs}{\n\t\t\t${selectionSet}\n\t\t}\n\t}`,\n ],\n ];\n}\nexport function createMutationInstanceFromModelOperation(relationships, modelDefinition, opType, model, element, condition, MutationEventConstructor, modelInstanceCreator, id) {\n let operation;\n switch (opType) {\n case OpType.INSERT:\n operation = TransformerMutationType.CREATE;\n break;\n case OpType.UPDATE:\n operation = TransformerMutationType.UPDATE;\n break;\n case OpType.DELETE:\n operation = TransformerMutationType.DELETE;\n break;\n default:\n throw new Error(`Invalid opType ${opType}`);\n }\n // stringify nested objects of type AWSJSON\n // this allows us to return parsed JSON to users (see `castInstanceType()` in datastore.ts),\n // but still send the object correctly over the wire\n const replacer = (k, v) => {\n const isAWSJSON = k &&\n v !== null &&\n typeof v === 'object' &&\n modelDefinition.fields[k] &&\n modelDefinition.fields[k].type === 'AWSJSON';\n if (isAWSJSON) {\n return JSON.stringify(v);\n }\n return v;\n };\n const modelId = getIdentifierValue(modelDefinition, element);\n const optionalId = OpType.INSERT && id ? { id } : {};\n const mutationEvent = modelInstanceCreator(MutationEventConstructor, {\n ...optionalId,\n data: JSON.stringify(element, replacer),\n modelId,\n model: model.name,\n operation: operation,\n condition: JSON.stringify(condition),\n });\n return mutationEvent;\n}\nexport function predicateToGraphQLCondition(predicate, modelDefinition) {\n const result = {};\n if (!predicate || !Array.isArray(predicate.predicates)) {\n return result;\n }\n // This is compatible with how the GQL Transform currently generates the Condition Input,\n // i.e. any PK and SK fields are omitted and can't be used as conditions.\n // However, I think this limits usability.\n // What if we want to delete all records where SK > some value\n // Or all records where PK = some value but SKs are different values\n // TODO: if the Transform gets updated we'll need to modify this logic to only omit\n // key fields from the predicate/condition when ALL of the keyFields are present and using `eq` operators\n const keyFields = extractPrimaryKeyFieldNames(modelDefinition);\n return predicateToGraphQLFilter(predicate, keyFields);\n}\n/**\n * @param predicatesGroup - Predicate Group\n @returns GQL Filter Expression from Predicate Group\n \n @remarks Flattens redundant list predicates\n @example\n\n ```js\n { and:[{ and:[{ username: { eq: 'bob' }}] }] }\n ```\n Becomes\n ```js\n { and:[{ username: { eq: 'bob' }}] }\n ```\n */\nexport function predicateToGraphQLFilter(predicatesGroup, fieldsToOmit = [], root = true) {\n const result = {};\n if (!predicatesGroup || !Array.isArray(predicatesGroup.predicates)) {\n return result;\n }\n const { type, predicates } = predicatesGroup;\n const isList = type === 'and' || type === 'or';\n result[type] = isList ? [] : {};\n const children = [];\n predicates.forEach(predicate => {\n if (isPredicateObj(predicate)) {\n const { field, operator, operand } = predicate;\n if (fieldsToOmit.includes(field))\n return;\n const gqlField = {\n [field]: { [operator]: operand },\n };\n children.push(gqlField);\n return;\n }\n const child = predicateToGraphQLFilter(predicate, fieldsToOmit, false);\n if (Object.keys(child).length > 0) {\n children.push(child);\n }\n });\n // flatten redundant list predicates\n if (children.length === 1) {\n const [child] = children;\n if (\n // any nested list node\n (isList && !root) ||\n // root list node where the only child is also a list node\n (isList && root && ('and' in child || 'or' in child))) {\n delete result[type];\n Object.assign(result, child);\n return result;\n }\n }\n children.forEach(child => {\n if (isList) {\n result[type].push(child);\n }\n else {\n result[type] = child;\n }\n });\n if (isList) {\n if (result[type].length === 0)\n return {};\n }\n else {\n if (Object.keys(result[type]).length === 0)\n return {};\n }\n return result;\n}\n/**\n *\n * @param group - selective sync predicate group\n * @returns set of distinct field names in the filter group\n */\nexport function filterFields(group) {\n const fields = new Set();\n if (!group || !Array.isArray(group.predicates))\n return fields;\n const { predicates } = group;\n const stack = [...predicates];\n while (stack.length > 0) {\n const current = stack.pop();\n if (isPredicateObj(current)) {\n fields.add(current.field);\n }\n else if (isPredicateGroup(current)) {\n stack.push(...current.predicates);\n }\n }\n return fields;\n}\n/**\n *\n * @param modelDefinition\n * @returns set of field names used with dynamic auth modes configured for the provided model definition\n */\nexport function dynamicAuthFields(modelDefinition) {\n const rules = getAuthorizationRules(modelDefinition);\n const fields = new Set();\n for (const rule of rules) {\n if (rule.groupsField && !rule.groups.length) {\n // dynamic group rule will have no values in `rule.groups`\n fields.add(rule.groupsField);\n }\n else if (rule.ownerField) {\n fields.add(rule.ownerField);\n }\n }\n return fields;\n}\n/**\n *\n * @param group - selective sync predicate group\n * @returns the total number of OR'd predicates in the filter group\n *\n * @example returns 2\n * ```js\n * { type: \"or\", predicates: [\n * { field: \"username\", operator: \"beginsWith\", operand: \"a\" },\n * { field: \"title\", operator: \"contains\", operand: \"abc\" },\n * ]}\n * ```\n */\nexport function countFilterCombinations(group) {\n if (!group || !Array.isArray(group.predicates))\n return 0;\n let count = 0;\n const stack = [group];\n while (stack.length > 0) {\n const current = stack.pop();\n if (isPredicateGroup(current)) {\n const { predicates, type } = current;\n // ignore length = 1; groups with 1 predicate will get flattened when converted to gqlFilter\n if (type === 'or' && predicates.length > 1) {\n count += predicates.length;\n }\n stack.push(...predicates);\n }\n }\n // if we didn't encounter any OR groups, default to 1\n return count || 1;\n}\n/**\n *\n * @param group - selective sync predicate group\n * @returns name of repeated field | null\n *\n * @example returns \"username\"\n * ```js\n * { type: \"and\", predicates: [\n * \t\t{ field: \"username\", operator: \"beginsWith\", operand: \"a\" },\n * \t\t{ field: \"username\", operator: \"contains\", operand: \"abc\" },\n * ] }\n * ```\n */\nexport function repeatedFieldInGroup(group) {\n if (!group || !Array.isArray(group.predicates))\n return null;\n // convert to filter in order to flatten redundant groups\n const gqlFilter = predicateToGraphQLFilter(group);\n const stack = [gqlFilter];\n const hasGroupRepeatedFields = (fields) => {\n const seen = {};\n for (const f of fields) {\n const [fieldName] = Object.keys(f);\n if (seen[fieldName]) {\n return fieldName;\n }\n seen[fieldName] = true;\n }\n return null;\n };\n while (stack.length > 0) {\n const current = stack.pop();\n const [key] = Object.keys(current);\n const values = current[key];\n if (!Array.isArray(values)) {\n return null;\n }\n // field value will be single object\n const predicateObjects = values.filter(v => !Array.isArray(Object.values(v)[0]));\n // group value will be an array\n const predicateGroups = values.filter(v => Array.isArray(Object.values(v)[0]));\n if (key === 'and') {\n const repeatedField = hasGroupRepeatedFields(predicateObjects);\n if (repeatedField) {\n return repeatedField;\n }\n }\n stack.push(...predicateGroups);\n }\n return null;\n}\nexport var RTFError;\n(function (RTFError) {\n RTFError[RTFError[\"UnknownField\"] = 0] = \"UnknownField\";\n RTFError[RTFError[\"MaxAttributes\"] = 1] = \"MaxAttributes\";\n RTFError[RTFError[\"MaxCombinations\"] = 2] = \"MaxCombinations\";\n RTFError[RTFError[\"RepeatedFieldname\"] = 3] = \"RepeatedFieldname\";\n RTFError[RTFError[\"NotGroup\"] = 4] = \"NotGroup\";\n RTFError[RTFError[\"FieldNotInType\"] = 5] = \"FieldNotInType\";\n})(RTFError || (RTFError = {}));\nexport function generateRTFRemediation(errorType, modelDefinition, predicatesGroup) {\n const selSyncFields = filterFields(predicatesGroup);\n const selSyncFieldStr = [...selSyncFields].join(', ');\n const dynamicAuthModeFields = dynamicAuthFields(modelDefinition);\n const dynamicAuthFieldsStr = [...dynamicAuthModeFields].join(', ');\n const filterCombinations = countFilterCombinations(predicatesGroup);\n const repeatedField = repeatedFieldInGroup(predicatesGroup);\n switch (errorType) {\n case RTFError.UnknownField:\n return (`Your API was generated with an older version of the CLI that doesn't support backend subscription filtering.` +\n 'To enable backend subscription filtering, upgrade your Amplify CLI to the latest version and push your app by running `amplify upgrade` followed by `amplify push`');\n case RTFError.MaxAttributes: {\n let message = `Your selective sync expression for ${modelDefinition.name} contains ${selSyncFields.size} different model fields: ${selSyncFieldStr}.\\n\\n`;\n if (dynamicAuthModeFields.size > 0) {\n message +=\n `Note: the number of fields you can use with selective sync is affected by @auth rules configured on the model.\\n\\n` +\n `Dynamic auth modes, such as owner auth and dynamic group auth each utilize 1 field.\\n` +\n `You currently have ${dynamicAuthModeFields.size} dynamic auth mode(s) configured on this model: ${dynamicAuthFieldsStr}.`;\n }\n return message;\n }\n case RTFError.MaxCombinations: {\n let message = `Your selective sync expression for ${modelDefinition.name} contains ${filterCombinations} field combinations (total number of predicates in an OR expression).\\n\\n`;\n if (dynamicAuthModeFields.size > 0) {\n message +=\n `Note: the number of fields you can use with selective sync is affected by @auth rules configured on the model.\\n\\n` +\n `Dynamic auth modes, such as owner auth and dynamic group auth factor in to the number of combinations you're using.\\n` +\n `You currently have ${dynamicAuthModeFields.size} dynamic auth mode(s) configured on this model: ${dynamicAuthFieldsStr}.`;\n }\n return message;\n }\n case RTFError.RepeatedFieldname:\n return `Your selective sync expression for ${modelDefinition.name} contains multiple entries for ${repeatedField} in the same AND group.`;\n case RTFError.NotGroup:\n return (`Your selective sync expression for ${modelDefinition.name} uses a \\`not\\` group. If you'd like to filter subscriptions in the backend, ` +\n `rewrite your expression using \\`ne\\` or \\`notContains\\` operators.`);\n case RTFError.FieldNotInType:\n // no remediation instructions. We'll surface the message directly\n return '';\n }\n}\nexport function getUserGroupsFromToken(token, rule) {\n // validate token against groupClaim\n let userGroups = token[rule.groupClaim] || [];\n if (typeof userGroups === 'string') {\n let parsedGroups;\n try {\n parsedGroups = JSON.parse(userGroups);\n }\n catch (e) {\n parsedGroups = userGroups;\n }\n userGroups = [].concat(parsedGroups);\n }\n return userGroups;\n}\nexport async function getModelAuthModes({ authModeStrategy, defaultAuthMode, modelName, schema, }) {\n const operations = Object.values(ModelOperation);\n const modelAuthModes = {\n CREATE: [],\n READ: [],\n UPDATE: [],\n DELETE: [],\n };\n try {\n await Promise.all(operations.map(async (operation) => {\n const authModes = await authModeStrategy({\n schema,\n modelName,\n operation,\n });\n if (typeof authModes === 'string') {\n modelAuthModes[operation] = [authModes];\n }\n else if (Array.isArray(authModes) && authModes.length) {\n modelAuthModes[operation] = authModes;\n }\n else {\n // Use default auth mode if nothing is returned from authModeStrategy\n modelAuthModes[operation] = [defaultAuthMode];\n }\n }));\n }\n catch (error) {\n logger.debug(`Error getting auth modes for model: ${modelName}`, error);\n }\n return modelAuthModes;\n}\nexport function getForbiddenError(error) {\n const forbiddenErrorCodes = [401, 403];\n let forbiddenError;\n if (error && error.errors) {\n forbiddenError = error.errors.find(err => forbiddenErrorCodes.includes(resolveServiceErrorStatusCode(err)));\n }\n else if (error && error.message) {\n forbiddenError = error;\n }\n if (forbiddenError) {\n return (forbiddenError.message ??\n `Request failed with status code ${resolveServiceErrorStatusCode(forbiddenError)}`);\n }\n return null;\n}\nexport function resolveServiceErrorStatusCode(error) {\n if (error?.['$metadata']?.['httpStatusCode']) {\n return Number(error?.['$metadata']?.['httpStatusCode']);\n }\n else if (error?.originalError) {\n return resolveServiceErrorStatusCode(error?.originalError);\n }\n else {\n return null;\n }\n}\nexport function getClientSideAuthError(error) {\n const clientSideAuthErrors = Object.values(GraphQLAuthError);\n const clientSideError = error &&\n error.message &&\n clientSideAuthErrors.find(clientError => error.message.includes(clientError));\n return clientSideError || null;\n}\nexport async function getTokenForCustomAuth(authMode, amplifyConfig = {}) {\n if (authMode === 'lambda') {\n const { authProviders: { functionAuthProvider } = { functionAuthProvider: null }, } = amplifyConfig;\n if (functionAuthProvider && typeof functionAuthProvider === 'function') {\n try {\n const { token } = await functionAuthProvider();\n return token;\n }\n catch (error) {\n throw new Error(`Error retrieving token from \\`functionAuthProvider\\`: ${error}`);\n }\n }\n else {\n // TODO: add docs link once available\n throw new Error('You must provide a `functionAuthProvider` function to `DataStore.configure` when using lambda');\n }\n }\n}\n// Util that takes a modelDefinition and model and returns either the id value(s) or the custom primary key value(s)\nexport function getIdentifierValue(modelDefinition, model) {\n const pkFieldNames = extractPrimaryKeyFieldNames(modelDefinition);\n const idOrPk = pkFieldNames.map(f => model[f]).join(IDENTIFIER_KEY_SEPARATOR);\n return idOrPk;\n}\n"],"names":[],"mappings":";;;;;AAAA;AACA;AAKA,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,WAAW,CAAC,CAAC;AAC9C,IAAI,oBAAoB,CAAC;AACzB,CAAC,UAAU,oBAAoB,EAAE;AACjC,IAAI,oBAAoB,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC;AAC3C,IAAI,oBAAoB,CAAC,QAAQ,CAAC,GAAG,UAAU,CAAC;AAChD,IAAI,oBAAoB,CAAC,QAAQ,CAAC,GAAG,UAAU,CAAC;AAChD,IAAI,oBAAoB,CAAC,QAAQ,CAAC,GAAG,UAAU,CAAC;AAChD,IAAI,oBAAoB,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC;AAC1C,CAAC,EAAE,oBAAoB,KAAK,oBAAoB,GAAG,EAAE,CA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,EAAE,aAAa,EAAE,EAAE,oBAAoB,EAAE,GAAG,EAAE,oBAAoB,EAAE,IAAI,EAAE,GAAG,GAAG,aAAa,CAAC;AAC5G,QAAQ,IAAI,oBAAoB,IAAI,OAAO,oBAAoB,KAAK,UAAU,EAAE;AAChF,YAAY,IAAI;AAChB,gBAAgB,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,oBAAoB,EAAE,CAAC;AAC/D,gBAAgB,OAAO,KAAK,CAAC;AAC7B,aAAa;AACb,YAAY,OAAO,KAAK,EAAE;AAC1B,gBAAgB,MAAM,IAAI,KAAK,CAAC,CAAC,sDAAsD,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;AAClG,aAAa;AACb,SAAS;AACT,aAAa;AACb;AACA,YAAY,MAAM,IAAI,KAAK,CAAC,+FAA+F,CAAC,CAAC;AAC7H,SAAS;AACT,KAAK;AACL,CAAC;AACD;AACO,SAAS,kBAAkB,CAAC,eAAe,EAAE,KAAK,EAAE;AAC3D,IAAI,MAAM,YAAY,GAAG,2BAA2B,CAAC,eAAe,CAAC,CAAC;AACtE,IAAI,MAAM,MAAM,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;AAClF,IAAI,OAAO,MAAM,CAAC;AAClB;;;;"}
@@ -1,40 +1,41 @@
1
- import { isAWSDate, isAWSTime, isAWSDateTime, isAWSTimestamp, isAWSEmail, isAWSJSON, isAWSURL, isAWSPhone, isAWSIPAddress, extractPrimaryKeyFieldNames, } from './util';
2
- export function isSchemaModel(obj) {
1
+ import { isAWSIPAddress, isAWSPhone, isAWSURL, isAWSJSON, isAWSEmail, isAWSTimestamp, isAWSDateTime, isAWSTime, isAWSDate, extractPrimaryKeyFieldNames } from './util.mjs';
2
+
3
+ function isSchemaModel(obj) {
3
4
  return obj && obj.pluralName !== undefined;
4
5
  }
5
- export function isSchemaModelWithAttributes(m) {
6
+ function isSchemaModelWithAttributes(m) {
6
7
  return isSchemaModel(m) && m.attributes !== undefined;
7
8
  }
8
- export function isAssociatedWith(obj) {
9
+ function isAssociatedWith(obj) {
9
10
  return obj && obj.associatedWith;
10
11
  }
11
- export function isTargetNameAssociation(obj) {
12
+ function isTargetNameAssociation(obj) {
12
13
  return obj?.targetName || obj?.targetNames;
13
14
  }
14
- export function isFieldAssociation(obj, fieldName) {
15
+ function isFieldAssociation(obj, fieldName) {
15
16
  return obj?.fields[fieldName]?.association?.connectionType;
16
17
  }
17
- export function isModelAttributeAuth(attr) {
18
+ function isModelAttributeAuth(attr) {
18
19
  return (attr.type === 'auth' &&
19
20
  attr.properties &&
20
21
  attr.properties.rules &&
21
22
  attr.properties.rules.length > 0);
22
23
  }
23
- export function isModelAttributeKey(attr) {
24
+ function isModelAttributeKey(attr) {
24
25
  return (attr.type === 'key' &&
25
26
  attr.properties &&
26
27
  attr.properties.fields &&
27
28
  attr.properties.fields.length > 0);
28
29
  }
29
- export function isModelAttributePrimaryKey(attr) {
30
+ function isModelAttributePrimaryKey(attr) {
30
31
  return isModelAttributeKey(attr) && attr.properties.name === undefined;
31
32
  }
32
- export function isModelAttributeCompositeKey(attr) {
33
+ function isModelAttributeCompositeKey(attr) {
33
34
  return (isModelAttributeKey(attr) &&
34
35
  attr.properties.name !== undefined &&
35
36
  attr.properties.fields.length > 2);
36
37
  }
37
- export var ModelAttributeAuthAllow;
38
+ var ModelAttributeAuthAllow;
38
39
  (function (ModelAttributeAuthAllow) {
39
40
  ModelAttributeAuthAllow["CUSTOM"] = "custom";
40
41
  ModelAttributeAuthAllow["OWNER"] = "owner";
@@ -42,7 +43,7 @@ export var ModelAttributeAuthAllow;
42
43
  ModelAttributeAuthAllow["PRIVATE"] = "private";
43
44
  ModelAttributeAuthAllow["PUBLIC"] = "public";
44
45
  })(ModelAttributeAuthAllow || (ModelAttributeAuthAllow = {}));
45
- export var ModelAttributeAuthProvider;
46
+ var ModelAttributeAuthProvider;
46
47
  (function (ModelAttributeAuthProvider) {
47
48
  ModelAttributeAuthProvider["FUNCTION"] = "function";
48
49
  ModelAttributeAuthProvider["USER_POOLS"] = "userPools";
@@ -50,7 +51,7 @@ export var ModelAttributeAuthProvider;
50
51
  ModelAttributeAuthProvider["IAM"] = "iam";
51
52
  ModelAttributeAuthProvider["API_KEY"] = "apiKey";
52
53
  })(ModelAttributeAuthProvider || (ModelAttributeAuthProvider = {}));
53
- export var GraphQLScalarType;
54
+ var GraphQLScalarType;
54
55
  (function (GraphQLScalarType) {
55
56
  GraphQLScalarType[GraphQLScalarType["ID"] = 0] = "ID";
56
57
  GraphQLScalarType[GraphQLScalarType["String"] = 1] = "String";
@@ -119,81 +120,81 @@ export var GraphQLScalarType;
119
120
  }
120
121
  GraphQLScalarType.getValidationFunction = getValidationFunction;
121
122
  })(GraphQLScalarType || (GraphQLScalarType = {}));
122
- export function isGraphQLScalarType(obj) {
123
+ function isGraphQLScalarType(obj) {
123
124
  return obj && GraphQLScalarType[obj] !== undefined;
124
125
  }
125
- export function isModelFieldType(obj) {
126
+ function isModelFieldType(obj) {
126
127
  const modelField = 'model';
127
128
  if (obj && obj[modelField])
128
129
  return true;
129
130
  return false;
130
131
  }
131
- export function isNonModelFieldType(obj) {
132
+ function isNonModelFieldType(obj) {
132
133
  const typeField = 'nonModel';
133
134
  if (obj && obj[typeField])
134
135
  return true;
135
136
  return false;
136
137
  }
137
- export function isEnumFieldType(obj) {
138
+ function isEnumFieldType(obj) {
138
139
  const modelField = 'enum';
139
140
  if (obj && obj[modelField])
140
141
  return true;
141
142
  return false;
142
143
  }
143
- export function isIdentifierObject(obj, modelDefinition) {
144
+ function isIdentifierObject(obj, modelDefinition) {
144
145
  const keys = extractPrimaryKeyFieldNames(modelDefinition);
145
146
  return (typeof obj === 'object' && obj && keys.every(k => obj[k] !== undefined));
146
147
  }
147
148
  //#endregion
148
149
  //#region Subscription messages
149
- export var OpType;
150
+ var OpType;
150
151
  (function (OpType) {
151
152
  OpType["INSERT"] = "INSERT";
152
153
  OpType["UPDATE"] = "UPDATE";
153
154
  OpType["DELETE"] = "DELETE";
154
155
  })(OpType || (OpType = {}));
155
- export function isPredicateObj(obj) {
156
+ function isPredicateObj(obj) {
156
157
  return obj && obj.field !== undefined;
157
158
  }
158
- export function isPredicateGroup(obj) {
159
+ function isPredicateGroup(obj) {
159
160
  return obj && obj.type !== undefined;
160
161
  }
161
- export var QueryOne;
162
+ var QueryOne;
162
163
  (function (QueryOne) {
163
164
  QueryOne[QueryOne["FIRST"] = 0] = "FIRST";
164
165
  QueryOne[QueryOne["LAST"] = 1] = "LAST";
165
166
  })(QueryOne || (QueryOne = {}));
166
- export var SortDirection;
167
+ var SortDirection;
167
168
  (function (SortDirection) {
168
169
  SortDirection["ASCENDING"] = "ASCENDING";
169
170
  SortDirection["DESCENDING"] = "DESCENDING";
170
171
  })(SortDirection || (SortDirection = {}));
171
- export var AuthModeStrategyType;
172
+ var AuthModeStrategyType;
172
173
  (function (AuthModeStrategyType) {
173
174
  AuthModeStrategyType["DEFAULT"] = "DEFAULT";
174
175
  AuthModeStrategyType["MULTI_AUTH"] = "MULTI_AUTH";
175
176
  })(AuthModeStrategyType || (AuthModeStrategyType = {}));
176
- export var ModelOperation;
177
+ var ModelOperation;
177
178
  (function (ModelOperation) {
178
179
  ModelOperation["CREATE"] = "CREATE";
179
180
  ModelOperation["READ"] = "READ";
180
181
  ModelOperation["UPDATE"] = "UPDATE";
181
182
  ModelOperation["DELETE"] = "DELETE";
182
183
  })(ModelOperation || (ModelOperation = {}));
183
- export async function syncExpression(modelConstructor, conditionProducer) {
184
+ async function syncExpression(modelConstructor, conditionProducer) {
184
185
  return {
185
186
  modelConstructor,
186
187
  conditionProducer,
187
188
  };
188
189
  }
189
- export var ProcessName;
190
+ var ProcessName;
190
191
  (function (ProcessName) {
191
192
  ProcessName["sync"] = "sync";
192
193
  ProcessName["mutate"] = "mutate";
193
194
  ProcessName["subscribe"] = "subscribe";
194
195
  })(ProcessName || (ProcessName = {}));
195
- export const DISCARD = Symbol('DISCARD');
196
- export var LimitTimerRaceResolvedValues;
196
+ const DISCARD = Symbol('DISCARD');
197
+ var LimitTimerRaceResolvedValues;
197
198
  (function (LimitTimerRaceResolvedValues) {
198
199
  LimitTimerRaceResolvedValues["LIMIT"] = "LIMIT";
199
200
  LimitTimerRaceResolvedValues["TIMER"] = "TIMER";
@@ -202,9 +203,12 @@ export var LimitTimerRaceResolvedValues;
202
203
  * A pointer used by DataStore internally to lookup predicate details
203
204
  * that should not be exposed on public customer interfaces.
204
205
  */
205
- export class PredicateInternalsKey {
206
+ class PredicateInternalsKey {
206
207
  constructor() {
207
208
  this.__isPredicateInternalsKeySentinel = true;
208
209
  }
209
210
  }
210
211
  // #endregion
212
+
213
+ export { AuthModeStrategyType, DISCARD, GraphQLScalarType, LimitTimerRaceResolvedValues, ModelAttributeAuthAllow, ModelAttributeAuthProvider, ModelOperation, OpType, PredicateInternalsKey, ProcessName, QueryOne, SortDirection, isAssociatedWith, isEnumFieldType, isFieldAssociation, isGraphQLScalarType, isIdentifierObject, isModelAttributeAuth, isModelAttributeCompositeKey, isModelAttributeKey, isModelAttributePrimaryKey, isModelFieldType, isNonModelFieldType, isPredicateGroup, isPredicateObj, isSchemaModel, isSchemaModelWithAttributes, isTargetNameAssociation, syncExpression };
214
+ //# sourceMappingURL=types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.mjs","sources":["../../src/types.ts"],"sourcesContent":["import { isAWSDate, isAWSTime, isAWSDateTime, isAWSTimestamp, isAWSEmail, isAWSJSON, isAWSURL, isAWSPhone, isAWSIPAddress, extractPrimaryKeyFieldNames, } from './util';\nexport function isSchemaModel(obj) {\n return obj && obj.pluralName !== undefined;\n}\nexport function isSchemaModelWithAttributes(m) {\n return isSchemaModel(m) && m.attributes !== undefined;\n}\nexport function isAssociatedWith(obj) {\n return obj && obj.associatedWith;\n}\nexport function isTargetNameAssociation(obj) {\n return obj?.targetName || obj?.targetNames;\n}\nexport function isFieldAssociation(obj, fieldName) {\n return obj?.fields[fieldName]?.association?.connectionType;\n}\nexport function isModelAttributeAuth(attr) {\n return (attr.type === 'auth' &&\n attr.properties &&\n attr.properties.rules &&\n attr.properties.rules.length > 0);\n}\nexport function isModelAttributeKey(attr) {\n return (attr.type === 'key' &&\n attr.properties &&\n attr.properties.fields &&\n attr.properties.fields.length > 0);\n}\nexport function isModelAttributePrimaryKey(attr) {\n return isModelAttributeKey(attr) && attr.properties.name === undefined;\n}\nexport function isModelAttributeCompositeKey(attr) {\n return (isModelAttributeKey(attr) &&\n attr.properties.name !== undefined &&\n attr.properties.fields.length > 2);\n}\nexport var ModelAttributeAuthAllow;\n(function (ModelAttributeAuthAllow) {\n ModelAttributeAuthAllow[\"CUSTOM\"] = \"custom\";\n ModelAttributeAuthAllow[\"OWNER\"] = \"owner\";\n ModelAttributeAuthAllow[\"GROUPS\"] = \"groups\";\n ModelAttributeAuthAllow[\"PRIVATE\"] = \"private\";\n ModelAttributeAuthAllow[\"PUBLIC\"] = \"public\";\n})(ModelAttributeAuthAllow || (ModelAttributeAuthAllow = {}));\nexport var ModelAttributeAuthProvider;\n(function (ModelAttributeAuthProvider) {\n ModelAttributeAuthProvider[\"FUNCTION\"] = \"function\";\n ModelAttributeAuthProvider[\"USER_POOLS\"] = \"userPools\";\n ModelAttributeAuthProvider[\"OIDC\"] = \"oidc\";\n ModelAttributeAuthProvider[\"IAM\"] = \"iam\";\n ModelAttributeAuthProvider[\"API_KEY\"] = \"apiKey\";\n})(ModelAttributeAuthProvider || (ModelAttributeAuthProvider = {}));\nexport var GraphQLScalarType;\n(function (GraphQLScalarType) {\n GraphQLScalarType[GraphQLScalarType[\"ID\"] = 0] = \"ID\";\n GraphQLScalarType[GraphQLScalarType[\"String\"] = 1] = \"String\";\n GraphQLScalarType[GraphQLScalarType[\"Int\"] = 2] = \"Int\";\n GraphQLScalarType[GraphQLScalarType[\"Float\"] = 3] = \"Float\";\n GraphQLScalarType[GraphQLScalarType[\"Boolean\"] = 4] = \"Boolean\";\n GraphQLScalarType[GraphQLScalarType[\"AWSDate\"] = 5] = \"AWSDate\";\n GraphQLScalarType[GraphQLScalarType[\"AWSTime\"] = 6] = \"AWSTime\";\n GraphQLScalarType[GraphQLScalarType[\"AWSDateTime\"] = 7] = \"AWSDateTime\";\n GraphQLScalarType[GraphQLScalarType[\"AWSTimestamp\"] = 8] = \"AWSTimestamp\";\n GraphQLScalarType[GraphQLScalarType[\"AWSEmail\"] = 9] = \"AWSEmail\";\n GraphQLScalarType[GraphQLScalarType[\"AWSJSON\"] = 10] = \"AWSJSON\";\n GraphQLScalarType[GraphQLScalarType[\"AWSURL\"] = 11] = \"AWSURL\";\n GraphQLScalarType[GraphQLScalarType[\"AWSPhone\"] = 12] = \"AWSPhone\";\n GraphQLScalarType[GraphQLScalarType[\"AWSIPAddress\"] = 13] = \"AWSIPAddress\";\n})(GraphQLScalarType || (GraphQLScalarType = {}));\n(function (GraphQLScalarType) {\n function getJSType(scalar) {\n switch (scalar) {\n case 'Boolean':\n return 'boolean';\n case 'ID':\n case 'String':\n case 'AWSDate':\n case 'AWSTime':\n case 'AWSDateTime':\n case 'AWSEmail':\n case 'AWSURL':\n case 'AWSPhone':\n case 'AWSIPAddress':\n return 'string';\n case 'Int':\n case 'Float':\n case 'AWSTimestamp':\n return 'number';\n case 'AWSJSON':\n return 'object';\n default:\n throw new Error('Invalid scalar type');\n }\n }\n GraphQLScalarType.getJSType = getJSType;\n function getValidationFunction(scalar) {\n switch (scalar) {\n case 'AWSDate':\n return isAWSDate;\n case 'AWSTime':\n return isAWSTime;\n case 'AWSDateTime':\n return isAWSDateTime;\n case 'AWSTimestamp':\n return isAWSTimestamp;\n case 'AWSEmail':\n return isAWSEmail;\n case 'AWSJSON':\n return isAWSJSON;\n case 'AWSURL':\n return isAWSURL;\n case 'AWSPhone':\n return isAWSPhone;\n case 'AWSIPAddress':\n return isAWSIPAddress;\n default:\n return undefined;\n }\n }\n GraphQLScalarType.getValidationFunction = getValidationFunction;\n})(GraphQLScalarType || (GraphQLScalarType = {}));\nexport function isGraphQLScalarType(obj) {\n return obj && GraphQLScalarType[obj] !== undefined;\n}\nexport function isModelFieldType(obj) {\n const modelField = 'model';\n if (obj && obj[modelField])\n return true;\n return false;\n}\nexport function isNonModelFieldType(obj) {\n const typeField = 'nonModel';\n if (obj && obj[typeField])\n return true;\n return false;\n}\nexport function isEnumFieldType(obj) {\n const modelField = 'enum';\n if (obj && obj[modelField])\n return true;\n return false;\n}\nexport function isIdentifierObject(obj, modelDefinition) {\n const keys = extractPrimaryKeyFieldNames(modelDefinition);\n return (typeof obj === 'object' && obj && keys.every(k => obj[k] !== undefined));\n}\n//#endregion\n//#region Subscription messages\nexport var OpType;\n(function (OpType) {\n OpType[\"INSERT\"] = \"INSERT\";\n OpType[\"UPDATE\"] = \"UPDATE\";\n OpType[\"DELETE\"] = \"DELETE\";\n})(OpType || (OpType = {}));\nexport function isPredicateObj(obj) {\n return obj && obj.field !== undefined;\n}\nexport function isPredicateGroup(obj) {\n return obj && obj.type !== undefined;\n}\nexport var QueryOne;\n(function (QueryOne) {\n QueryOne[QueryOne[\"FIRST\"] = 0] = \"FIRST\";\n QueryOne[QueryOne[\"LAST\"] = 1] = \"LAST\";\n})(QueryOne || (QueryOne = {}));\nexport var SortDirection;\n(function (SortDirection) {\n SortDirection[\"ASCENDING\"] = \"ASCENDING\";\n SortDirection[\"DESCENDING\"] = \"DESCENDING\";\n})(SortDirection || (SortDirection = {}));\nexport var AuthModeStrategyType;\n(function (AuthModeStrategyType) {\n AuthModeStrategyType[\"DEFAULT\"] = \"DEFAULT\";\n AuthModeStrategyType[\"MULTI_AUTH\"] = \"MULTI_AUTH\";\n})(AuthModeStrategyType || (AuthModeStrategyType = {}));\nexport var ModelOperation;\n(function (ModelOperation) {\n ModelOperation[\"CREATE\"] = \"CREATE\";\n ModelOperation[\"READ\"] = \"READ\";\n ModelOperation[\"UPDATE\"] = \"UPDATE\";\n ModelOperation[\"DELETE\"] = \"DELETE\";\n})(ModelOperation || (ModelOperation = {}));\nexport async function syncExpression(modelConstructor, conditionProducer) {\n return {\n modelConstructor,\n conditionProducer,\n };\n}\nexport var ProcessName;\n(function (ProcessName) {\n ProcessName[\"sync\"] = \"sync\";\n ProcessName[\"mutate\"] = \"mutate\";\n ProcessName[\"subscribe\"] = \"subscribe\";\n})(ProcessName || (ProcessName = {}));\nexport const DISCARD = Symbol('DISCARD');\nexport var LimitTimerRaceResolvedValues;\n(function (LimitTimerRaceResolvedValues) {\n LimitTimerRaceResolvedValues[\"LIMIT\"] = \"LIMIT\";\n LimitTimerRaceResolvedValues[\"TIMER\"] = \"TIMER\";\n})(LimitTimerRaceResolvedValues || (LimitTimerRaceResolvedValues = {}));\n/**\n * A pointer used by DataStore internally to lookup predicate details\n * that should not be exposed on public customer interfaces.\n */\nexport class PredicateInternalsKey {\n constructor() {\n this.__isPredicateInternalsKeySentinel = true;\n }\n}\n// #endregion\n"],"names":[],"mappings":";;AACO,SAAS,aAAa,CAAC,GAAG,EAAE;AACnC,IAAI,OAAO,GAAG,IAAI,GAAG,CAAC,UAAU,KAAK,SAAS,CAAC;AAC/C,CAAC;AACM,SAAS,2BAA2B,CAAC,CAAC,EAAE;AAC/C,IAAI,OAAO,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,KAAK,SAAS,CAAC;AAC1D,CAAC;AACM,SAAS,gBAAgB,CAAC,GAAG,EAAE;AACtC,IAAI,OAAO,GAAG,IAAI,GAAG,CAAC,cAAc,CAAC;AACrC,CAAC;AACM,SAAS,uBAAuB,CAAC,GAAG,EAAE;AAC7C,IAAI,OAAO,GAAG,EAAE,UAAU,IAAI,GAAG,EAAE,WAAW,CAAC;AAC/C,CAAC;AACM,SAAS,kBAAkB,CAAC,GAAG,EAAE,SAAS,EAAE;AACnD,IAAI,OAAO,GAAG,EAAE,MAAM,CAAC,SAAS,CAAC,EAAE,WAAW,EAAE,cAAc,CAAC;AAC/D,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