@aws-amplify/api-graphql 4.0.1-api-v6-models.6720ee0.0 → 4.0.1-api-v6-models.13c9b49.0

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 (220) hide show
  1. package/{lib → dist/cjs}/GraphQLAPI.js +5 -3
  2. package/dist/cjs/GraphQLAPI.js.map +1 -0
  3. package/{lib → dist/cjs}/Providers/AWSAppSyncRealTimeProvider/index.js +3 -1
  4. package/dist/cjs/Providers/AWSAppSyncRealTimeProvider/index.js.map +1 -0
  5. package/{lib → dist/cjs}/Providers/constants.js +6 -7
  6. package/dist/cjs/Providers/constants.js.map +1 -0
  7. package/{lib → dist/cjs}/index.js +3 -1
  8. package/dist/cjs/index.js.map +1 -0
  9. package/{lib → dist/cjs}/internals/APIClient.js +3 -4
  10. package/dist/cjs/internals/APIClient.js.map +1 -0
  11. package/{lib → dist/cjs}/internals/InternalGraphQLAPI.js +4 -6
  12. package/dist/cjs/internals/InternalGraphQLAPI.js.map +1 -0
  13. package/{lib → dist/cjs}/internals/generateClient.js +3 -1
  14. package/dist/cjs/internals/generateClient.js.map +1 -0
  15. package/{lib → dist/cjs}/internals/generateModelsProperty.js +6 -1
  16. package/dist/cjs/internals/generateModelsProperty.js.map +1 -0
  17. package/{lib → dist/cjs}/internals/index.js +3 -1
  18. package/dist/cjs/internals/index.js.map +1 -0
  19. package/{lib → dist/cjs}/internals/operations/get.js +3 -1
  20. package/dist/cjs/internals/operations/get.js.map +1 -0
  21. package/{lib → dist/cjs}/internals/operations/list.js +3 -1
  22. package/dist/cjs/internals/operations/list.js.map +1 -0
  23. package/{lib → dist/cjs}/internals/operations/observeQuery.js +3 -1
  24. package/dist/cjs/internals/operations/observeQuery.js.map +1 -0
  25. package/{lib → dist/cjs}/internals/operations/subscription.js +3 -1
  26. package/dist/cjs/internals/operations/subscription.js.map +1 -0
  27. package/{lib → dist/cjs}/internals/server/generateClient.js +3 -1
  28. package/dist/cjs/internals/server/generateClient.js.map +1 -0
  29. package/{lib → dist/cjs}/internals/server/generateModelsProperty.js +3 -1
  30. package/dist/cjs/internals/server/generateModelsProperty.js.map +1 -0
  31. package/{lib → dist/cjs}/internals/server/index.js +3 -1
  32. package/dist/cjs/internals/server/index.js.map +1 -0
  33. package/{lib → dist/cjs}/internals/types.js +3 -1
  34. package/dist/cjs/internals/types.js.map +1 -0
  35. package/{lib → dist/cjs}/internals/v6.js +3 -1
  36. package/dist/cjs/internals/v6.js.map +1 -0
  37. package/{lib → dist/cjs}/types/PubSub.js +5 -6
  38. package/dist/cjs/types/PubSub.js.map +1 -0
  39. package/{lib → dist/cjs}/types/index.js +4 -3
  40. package/dist/cjs/types/index.js.map +1 -0
  41. package/{lib → dist/cjs}/utils/ConnectionStateMonitor.js +3 -1
  42. package/dist/cjs/utils/ConnectionStateMonitor.js.map +1 -0
  43. package/{lib → dist/cjs}/utils/ReachabilityMonitor/index.js +3 -1
  44. package/dist/cjs/utils/ReachabilityMonitor/index.js.map +1 -0
  45. package/{lib → dist/cjs}/utils/ReachabilityMonitor/index.native.js +3 -1
  46. package/dist/cjs/utils/ReachabilityMonitor/index.native.js.map +1 -0
  47. package/{lib → dist/cjs}/utils/ReconnectionMonitor.js +4 -2
  48. package/dist/cjs/utils/ReconnectionMonitor.js.map +1 -0
  49. package/{lib → dist/cjs}/utils/errors/APIError.js +3 -1
  50. package/dist/cjs/utils/errors/APIError.js.map +1 -0
  51. package/{lib → dist/cjs}/utils/errors/assertValidationError.js +3 -1
  52. package/dist/cjs/utils/errors/assertValidationError.js.map +1 -0
  53. package/{lib → dist/cjs}/utils/errors/index.js +3 -1
  54. package/dist/cjs/utils/errors/index.js.map +1 -0
  55. package/{lib → dist/cjs}/utils/errors/validation.js +4 -2
  56. package/dist/cjs/utils/errors/validation.js.map +1 -0
  57. package/{lib → dist/cjs}/utils/findIndexByFields.js +3 -1
  58. package/dist/cjs/utils/findIndexByFields.js.map +1 -0
  59. package/{lib → dist/cjs}/utils/index.js +3 -1
  60. package/dist/cjs/utils/index.js.map +1 -0
  61. package/{lib → dist/cjs}/utils/resolveConfig.js +3 -1
  62. package/dist/cjs/utils/resolveConfig.js.map +1 -0
  63. package/{lib → dist/cjs}/utils/resolveLibraryOptions.js +3 -1
  64. package/dist/cjs/utils/resolveLibraryOptions.js.map +1 -0
  65. package/{lib → dist/cjs}/utils/resolveOwnerFields.js +3 -1
  66. package/dist/cjs/utils/resolveOwnerFields.js.map +1 -0
  67. package/{lib → dist/cjs}/utils/resolvePKFields.js +3 -1
  68. package/dist/cjs/utils/resolvePKFields.js.map +1 -0
  69. package/{lib-esm → dist/esm}/GraphQLAPI.d.ts +1 -1
  70. package/{lib-esm/GraphQLAPI.js → dist/esm/GraphQLAPI.mjs} +8 -4
  71. package/dist/esm/GraphQLAPI.mjs.map +1 -0
  72. package/{lib-esm/Providers/AWSAppSyncRealTimeProvider/index.js → dist/esm/Providers/AWSAppSyncRealTimeProvider/index.mjs} +13 -9
  73. package/dist/esm/Providers/AWSAppSyncRealTimeProvider/index.mjs.map +1 -0
  74. package/{lib-esm/Providers/constants.js → dist/esm/Providers/constants.mjs} +18 -14
  75. package/dist/esm/Providers/constants.mjs.map +1 -0
  76. package/dist/esm/index.mjs +5 -0
  77. package/dist/esm/index.mjs.map +1 -0
  78. package/{lib-esm/internals/APIClient.js → dist/esm/internals/APIClient.mjs} +16 -15
  79. package/dist/esm/internals/APIClient.mjs.map +1 -0
  80. package/{lib-esm/internals/InternalGraphQLAPI.js → dist/esm/internals/InternalGraphQLAPI.mjs} +19 -18
  81. package/dist/esm/internals/InternalGraphQLAPI.mjs.map +1 -0
  82. package/{lib-esm/internals/generateClient.js → dist/esm/internals/generateClient.mjs} +8 -4
  83. package/dist/esm/internals/generateClient.mjs.map +1 -0
  84. package/{lib-esm/internals/generateModelsProperty.js → dist/esm/internals/generateModelsProperty.mjs} +13 -6
  85. package/dist/esm/internals/generateModelsProperty.mjs.map +1 -0
  86. package/dist/esm/internals/index.mjs +4 -0
  87. package/dist/esm/internals/index.mjs.map +1 -0
  88. package/{lib-esm/internals/operations/get.js → dist/esm/internals/operations/get.mjs} +6 -2
  89. package/dist/esm/internals/operations/get.mjs.map +1 -0
  90. package/{lib-esm/internals/operations/list.js → dist/esm/internals/operations/list.mjs} +6 -2
  91. package/dist/esm/internals/operations/list.mjs.map +1 -0
  92. package/{lib-esm/internals/operations/observeQuery.js → dist/esm/internals/operations/observeQuery.mjs} +10 -3
  93. package/dist/esm/internals/operations/observeQuery.mjs.map +1 -0
  94. package/{lib-esm/internals/operations/subscription.js → dist/esm/internals/operations/subscription.mjs} +7 -3
  95. package/dist/esm/internals/operations/subscription.mjs.map +1 -0
  96. package/{lib-esm/internals/server/generateClient.js → dist/esm/internals/server/generateClient.mjs} +12 -4
  97. package/dist/esm/internals/server/generateClient.mjs.map +1 -0
  98. package/{lib-esm/internals/server/generateModelsProperty.js → dist/esm/internals/server/generateModelsProperty.mjs} +8 -4
  99. package/dist/esm/internals/server/generateModelsProperty.mjs.map +1 -0
  100. package/dist/esm/internals/server/index.mjs +2 -0
  101. package/dist/esm/internals/server/index.mjs.map +1 -0
  102. package/dist/esm/internals/types.mjs +2 -0
  103. package/dist/esm/internals/types.mjs.map +1 -0
  104. package/{lib-esm/internals/v6.js → dist/esm/internals/v6.mjs} +9 -5
  105. package/dist/esm/internals/v6.mjs.map +1 -0
  106. package/{lib-esm/types/PubSub.js → dist/esm/types/PubSub.mjs} +5 -2
  107. package/dist/esm/types/PubSub.mjs.map +1 -0
  108. package/{lib-esm/types/index.js → dist/esm/types/index.mjs} +9 -5
  109. package/dist/esm/types/index.mjs.map +1 -0
  110. package/{lib-esm/utils/ConnectionStateMonitor.js → dist/esm/utils/ConnectionStateMonitor.mjs} +9 -5
  111. package/dist/esm/utils/ConnectionStateMonitor.mjs.map +1 -0
  112. package/dist/esm/utils/ReachabilityMonitor/index.d.ts +1 -0
  113. package/{lib-esm/utils/ReachabilityMonitor/index.js → dist/esm/utils/ReachabilityMonitor/index.mjs} +6 -2
  114. package/dist/esm/utils/ReachabilityMonitor/index.mjs.map +1 -0
  115. package/dist/esm/utils/ReachabilityMonitor/index.native.d.ts +1 -0
  116. package/dist/esm/utils/ReachabilityMonitor/index.native.mjs +9 -0
  117. package/dist/esm/utils/ReachabilityMonitor/index.native.mjs.map +1 -0
  118. package/{lib-esm/utils/ReconnectionMonitor.js → dist/esm/utils/ReconnectionMonitor.mjs} +7 -3
  119. package/dist/esm/utils/ReconnectionMonitor.mjs.map +1 -0
  120. package/{lib-esm/utils/errors/APIError.js → dist/esm/utils/errors/APIError.mjs} +6 -2
  121. package/dist/esm/utils/errors/APIError.mjs.map +1 -0
  122. package/{lib-esm/utils/errors/assertValidationError.js → dist/esm/utils/errors/assertValidationError.mjs} +7 -3
  123. package/dist/esm/utils/errors/assertValidationError.mjs.map +1 -0
  124. package/dist/esm/utils/errors/index.mjs +4 -0
  125. package/dist/esm/utils/errors/index.mjs.map +1 -0
  126. package/{lib-esm/utils/errors/validation.js → dist/esm/utils/errors/validation.mjs} +5 -2
  127. package/dist/esm/utils/errors/validation.mjs.map +1 -0
  128. package/{lib-esm/utils/findIndexByFields.js → dist/esm/utils/findIndexByFields.mjs} +4 -1
  129. package/dist/esm/utils/findIndexByFields.mjs.map +1 -0
  130. package/dist/esm/utils/index.mjs +5 -0
  131. package/dist/esm/utils/index.mjs.map +1 -0
  132. package/{lib-esm → dist/esm}/utils/resolveConfig.d.ts +1 -1
  133. package/{lib-esm/utils/resolveConfig.js → dist/esm/utils/resolveConfig.mjs} +8 -2
  134. package/dist/esm/utils/resolveConfig.mjs.map +1 -0
  135. package/{lib → dist/esm}/utils/resolveLibraryOptions.d.ts +2 -2
  136. package/{lib-esm/utils/resolveLibraryOptions.js → dist/esm/utils/resolveLibraryOptions.mjs} +4 -1
  137. package/dist/esm/utils/resolveLibraryOptions.mjs.map +1 -0
  138. package/{lib-esm/utils/resolveOwnerFields.js → dist/esm/utils/resolveOwnerFields.mjs} +4 -1
  139. package/dist/esm/utils/resolveOwnerFields.mjs.map +1 -0
  140. package/{lib-esm/utils/resolvePKFields.js → dist/esm/utils/resolvePKFields.mjs} +4 -1
  141. package/dist/esm/utils/resolvePKFields.mjs.map +1 -0
  142. package/internals/package.json +4 -4
  143. package/internals/server/package.json +4 -4
  144. package/package.json +51 -25
  145. package/src/GraphQLAPI.ts +1 -1
  146. package/src/internals/generateModelsProperty.ts +6 -0
  147. package/lib/GraphQLAPI.d.ts +0 -38
  148. package/lib/Providers/AWSAppSyncRealTimeProvider/index.d.ts +0 -64
  149. package/lib/Providers/constants.d.ts +0 -95
  150. package/lib/index.d.ts +0 -3
  151. package/lib/internals/APIClient.d.ts +0 -121
  152. package/lib/internals/InternalGraphQLAPI.d.ts +0 -58
  153. package/lib/internals/generateClient.d.ts +0 -12
  154. package/lib/internals/generateModelsProperty.d.ts +0 -4
  155. package/lib/internals/index.d.ts +0 -3
  156. package/lib/internals/operations/get.d.ts +0 -2
  157. package/lib/internals/operations/list.d.ts +0 -2
  158. package/lib/internals/operations/observeQuery.d.ts +0 -2
  159. package/lib/internals/operations/subscription.d.ts +0 -1
  160. package/lib/internals/server/generateClient.d.ts +0 -11
  161. package/lib/internals/server/generateModelsProperty.d.ts +0 -3
  162. package/lib/internals/server/index.d.ts +0 -1
  163. package/lib/internals/types.d.ts +0 -17
  164. package/lib/internals/v6.d.ts +0 -101
  165. package/lib/tsconfig.tsbuildinfo +0 -1
  166. package/lib/types/PubSub.d.ts +0 -27
  167. package/lib/types/index.d.ts +0 -329
  168. package/lib/utils/ConnectionStateMonitor.d.ts +0 -41
  169. package/lib/utils/ReachabilityMonitor/index.d.ts +0 -1
  170. package/lib/utils/ReachabilityMonitor/index.native.d.ts +0 -1
  171. package/lib/utils/ReconnectionMonitor.d.ts +0 -29
  172. package/lib/utils/errors/APIError.d.ts +0 -7
  173. package/lib/utils/errors/assertValidationError.d.ts +0 -5
  174. package/lib/utils/errors/index.d.ts +0 -3
  175. package/lib/utils/errors/validation.d.ts +0 -7
  176. package/lib/utils/findIndexByFields.d.ts +0 -9
  177. package/lib/utils/index.d.ts +0 -4
  178. package/lib/utils/resolveConfig.d.ts +0 -12
  179. package/lib/utils/resolveOwnerFields.d.ts +0 -12
  180. package/lib/utils/resolvePKFields.d.ts +0 -13
  181. package/lib-esm/index.js +0 -5
  182. package/lib-esm/internals/index.js +0 -5
  183. package/lib-esm/internals/server/index.js +0 -3
  184. package/lib-esm/internals/types.js +0 -1
  185. package/lib-esm/tsconfig.tsbuildinfo +0 -1
  186. package/lib-esm/utils/ReachabilityMonitor/index.d.ts +0 -1
  187. package/lib-esm/utils/ReachabilityMonitor/index.native.d.ts +0 -1
  188. package/lib-esm/utils/ReachabilityMonitor/index.native.js +0 -5
  189. package/lib-esm/utils/errors/index.js +0 -5
  190. package/lib-esm/utils/index.js +0 -6
  191. package/lib-esm/utils/resolveLibraryOptions.d.ts +0 -11
  192. /package/{lib-esm → dist/esm}/Providers/AWSAppSyncRealTimeProvider/index.d.ts +0 -0
  193. /package/{lib-esm → dist/esm}/Providers/constants.d.ts +0 -0
  194. /package/{lib-esm → dist/esm}/index.d.ts +0 -0
  195. /package/{lib-esm → dist/esm}/internals/APIClient.d.ts +0 -0
  196. /package/{lib-esm → dist/esm}/internals/InternalGraphQLAPI.d.ts +0 -0
  197. /package/{lib-esm → dist/esm}/internals/generateClient.d.ts +0 -0
  198. /package/{lib-esm → dist/esm}/internals/generateModelsProperty.d.ts +0 -0
  199. /package/{lib-esm → dist/esm}/internals/index.d.ts +0 -0
  200. /package/{lib-esm → dist/esm}/internals/operations/get.d.ts +0 -0
  201. /package/{lib-esm → dist/esm}/internals/operations/list.d.ts +0 -0
  202. /package/{lib-esm → dist/esm}/internals/operations/observeQuery.d.ts +0 -0
  203. /package/{lib-esm → dist/esm}/internals/operations/subscription.d.ts +0 -0
  204. /package/{lib-esm → dist/esm}/internals/server/generateClient.d.ts +0 -0
  205. /package/{lib-esm → dist/esm}/internals/server/generateModelsProperty.d.ts +0 -0
  206. /package/{lib-esm → dist/esm}/internals/server/index.d.ts +0 -0
  207. /package/{lib-esm → dist/esm}/internals/types.d.ts +0 -0
  208. /package/{lib-esm → dist/esm}/internals/v6.d.ts +0 -0
  209. /package/{lib-esm → dist/esm}/types/PubSub.d.ts +0 -0
  210. /package/{lib-esm → dist/esm}/types/index.d.ts +0 -0
  211. /package/{lib-esm → dist/esm}/utils/ConnectionStateMonitor.d.ts +0 -0
  212. /package/{lib-esm → dist/esm}/utils/ReconnectionMonitor.d.ts +0 -0
  213. /package/{lib-esm → dist/esm}/utils/errors/APIError.d.ts +0 -0
  214. /package/{lib-esm → dist/esm}/utils/errors/assertValidationError.d.ts +0 -0
  215. /package/{lib-esm → dist/esm}/utils/errors/index.d.ts +0 -0
  216. /package/{lib-esm → dist/esm}/utils/errors/validation.d.ts +0 -0
  217. /package/{lib-esm → dist/esm}/utils/findIndexByFields.d.ts +0 -0
  218. /package/{lib-esm → dist/esm}/utils/index.d.ts +0 -0
  219. /package/{lib-esm → dist/esm}/utils/resolveOwnerFields.d.ts +0 -0
  220. /package/{lib-esm → dist/esm}/utils/resolvePKFields.d.ts +0 -0
@@ -1,10 +1,11 @@
1
+ import { AmplifyError } from '@aws-amplify/core/internals/utils';
2
+
1
3
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
4
  // SPDX-License-Identifier: Apache-2.0
3
- import { AmplifyError, } from '@aws-amplify/core/internals/utils';
4
5
  /**
5
6
  * @internal
6
7
  */
7
- export class APIError extends AmplifyError {
8
+ class APIError extends AmplifyError {
8
9
  constructor(params) {
9
10
  super(params);
10
11
  // Hack for making the custom error class work when transpiled to es5
@@ -13,3 +14,6 @@ export class APIError extends AmplifyError {
13
14
  Object.setPrototypeOf(this, APIError.prototype);
14
15
  }
15
16
  }
17
+
18
+ export { APIError };
19
+ //# sourceMappingURL=APIError.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"APIError.mjs","sources":["../../../../src/utils/errors/APIError.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AmplifyError, } from '@aws-amplify/core/internals/utils';\n/**\n * @internal\n */\nexport class APIError extends AmplifyError {\n constructor(params) {\n super(params);\n // Hack for making the custom error class work when transpiled to es5\n // TODO: Delete the following 2 lines after we change the build target to >= es2015\n this.constructor = APIError;\n Object.setPrototypeOf(this, APIError.prototype);\n }\n}\n"],"names":[],"mappings":";;AAAA;AACA;AAEA;AACA;AACA;AACO,MAAM,QAAQ,SAAS,YAAY,CAAC;AAC3C,IAAI,WAAW,CAAC,MAAM,EAAE;AACxB,QAAQ,KAAK,CAAC,MAAM,CAAC,CAAC;AACtB;AACA;AACA,QAAQ,IAAI,CAAC,WAAW,GAAG,QAAQ,CAAC;AACpC,QAAQ,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;AACxD,KAAK;AACL;;;;"}
@@ -1,13 +1,17 @@
1
+ import { APIError } from './APIError.mjs';
2
+ import { validationErrorMap } from './validation.mjs';
3
+
1
4
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
5
  // SPDX-License-Identifier: Apache-2.0
3
- import { APIError } from './APIError';
4
- import { validationErrorMap } from './validation';
5
6
  /**
6
7
  * @internal
7
8
  */
8
- export function assertValidationError(assertion, name) {
9
+ function assertValidationError(assertion, name) {
9
10
  const { message, recoverySuggestion } = validationErrorMap[name];
10
11
  if (!assertion) {
11
12
  throw new APIError({ name, message, recoverySuggestion });
12
13
  }
13
14
  }
15
+
16
+ export { assertValidationError };
17
+ //# sourceMappingURL=assertValidationError.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assertValidationError.mjs","sources":["../../../../src/utils/errors/assertValidationError.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { APIError } from './APIError';\nimport { validationErrorMap } from './validation';\n/**\n * @internal\n */\nexport function assertValidationError(assertion, name) {\n const { message, recoverySuggestion } = validationErrorMap[name];\n if (!assertion) {\n throw new APIError({ name, message, recoverySuggestion });\n }\n}\n"],"names":[],"mappings":";;;AAAA;AACA;AAGA;AACA;AACA;AACO,SAAS,qBAAqB,CAAC,SAAS,EAAE,IAAI,EAAE;AACvD,IAAI,MAAM,EAAE,OAAO,EAAE,kBAAkB,EAAE,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC;AACrE,IAAI,IAAI,CAAC,SAAS,EAAE;AACpB,QAAQ,MAAM,IAAI,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC,CAAC;AAClE,KAAK;AACL;;;;"}
@@ -0,0 +1,4 @@
1
+ export { APIError } from './APIError.mjs';
2
+ export { assertValidationError } from './assertValidationError.mjs';
3
+ export { APIValidationErrorCode, validationErrorMap } from './validation.mjs';
4
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -1,12 +1,12 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
- export var APIValidationErrorCode;
3
+ var APIValidationErrorCode;
4
4
  (function (APIValidationErrorCode) {
5
5
  APIValidationErrorCode["NoAuthSession"] = "NoAuthSession";
6
6
  APIValidationErrorCode["NoRegion"] = "NoRegion";
7
7
  APIValidationErrorCode["NoCustomEndpoint"] = "NoCustomEndpoint";
8
8
  })(APIValidationErrorCode || (APIValidationErrorCode = {}));
9
- export const validationErrorMap = {
9
+ const validationErrorMap = {
10
10
  [APIValidationErrorCode.NoAuthSession]: {
11
11
  message: 'Auth session should not be empty.',
12
12
  },
@@ -21,3 +21,6 @@ export const validationErrorMap = {
21
21
  message: 'Custom endpoint region is present without custom endpoint.',
22
22
  },
23
23
  };
24
+
25
+ export { APIValidationErrorCode, validationErrorMap };
26
+ //# sourceMappingURL=validation.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.mjs","sources":["../../../../src/utils/errors/validation.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nexport var APIValidationErrorCode;\n(function (APIValidationErrorCode) {\n APIValidationErrorCode[\"NoAuthSession\"] = \"NoAuthSession\";\n APIValidationErrorCode[\"NoRegion\"] = \"NoRegion\";\n APIValidationErrorCode[\"NoCustomEndpoint\"] = \"NoCustomEndpoint\";\n})(APIValidationErrorCode || (APIValidationErrorCode = {}));\nexport const validationErrorMap = {\n [APIValidationErrorCode.NoAuthSession]: {\n message: 'Auth session should not be empty.',\n },\n // TODO: re-enable when working in all test environments:\n // [APIValidationErrorCode.NoEndpoint]: {\n // \tmessage: 'Missing endpoint',\n // },\n [APIValidationErrorCode.NoRegion]: {\n message: 'Missing region.',\n },\n [APIValidationErrorCode.NoCustomEndpoint]: {\n message: 'Custom endpoint region is present without custom endpoint.',\n },\n};\n"],"names":[],"mappings":"AAAA;AACA;AACU,IAAC,uBAAuB;AAClC,CAAC,UAAU,sBAAsB,EAAE;AACnC,IAAI,sBAAsB,CAAC,eAAe,CAAC,GAAG,eAAe,CAAC;AAC9D,IAAI,sBAAsB,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC;AACpD,IAAI,sBAAsB,CAAC,kBAAkB,CAAC,GAAG,kBAAkB,CAAC;AACpE,CAAC,EAAE,sBAAsB,KAAK,sBAAsB,GAAG,EAAE,CAAC,CAAC,CAAC;AAChD,MAAC,kBAAkB,GAAG;AAClC,IAAI,CAAC,sBAAsB,CAAC,aAAa,GAAG;AAC5C,QAAQ,OAAO,EAAE,mCAAmC;AACpD,KAAK;AACL;AACA;AACA;AACA;AACA,IAAI,CAAC,sBAAsB,CAAC,QAAQ,GAAG;AACvC,QAAQ,OAAO,EAAE,iBAAiB;AAClC,KAAK;AACL,IAAI,CAAC,sBAAsB,CAAC,gBAAgB,GAAG;AAC/C,QAAQ,OAAO,EAAE,4DAA4D;AAC7E,KAAK;AACL;;;;"}
@@ -8,7 +8,7 @@
8
8
  * @param keyFields The fields used to indicate a match
9
9
  * @returns Index of `needle` in `haystack`, otherwise -1 if not found.
10
10
  */
11
- export function findIndexByFields(needle, haystack, keyFields) {
11
+ function findIndexByFields(needle, haystack, keyFields) {
12
12
  const searchObject = Object.fromEntries(keyFields.map(fieldName => [fieldName, needle[fieldName]]));
13
13
  for (let i = 0; i < haystack.length; i++) {
14
14
  if (Object.keys(searchObject).every(k => searchObject[k] === haystack[i][k])) {
@@ -17,3 +17,6 @@ export function findIndexByFields(needle, haystack, keyFields) {
17
17
  }
18
18
  return -1;
19
19
  }
20
+
21
+ export { findIndexByFields };
22
+ //# sourceMappingURL=findIndexByFields.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findIndexByFields.mjs","sources":["../../../src/utils/findIndexByFields.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/**\n * Iterates through a collection to find a matching item and returns the index.\n *\n * @param needle The item to search for\n * @param haystack The collection to search\n * @param keyFields The fields used to indicate a match\n * @returns Index of `needle` in `haystack`, otherwise -1 if not found.\n */\nexport function findIndexByFields(needle, haystack, keyFields) {\n const searchObject = Object.fromEntries(keyFields.map(fieldName => [fieldName, needle[fieldName]]));\n for (let i = 0; i < haystack.length; i++) {\n if (Object.keys(searchObject).every(k => searchObject[k] === haystack[i][k])) {\n return i;\n }\n }\n return -1;\n}\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,iBAAiB,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE;AAC/D,IAAI,MAAM,YAAY,GAAG,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AACxG,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AAC9C,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,YAAY,CAAC,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;AACtF,YAAY,OAAO,CAAC,CAAC;AACrB,SAAS;AACT,KAAK;AACL,IAAI,OAAO,CAAC,CAAC,CAAC;AACd;;;;"}
@@ -0,0 +1,5 @@
1
+ export { resolveConfig } from './resolveConfig.mjs';
2
+ export { resolveLibraryOptions } from './resolveLibraryOptions.mjs';
3
+ export { resolvePKFields } from './resolvePKFields.mjs';
4
+ export { findIndexByFields } from './findIndexByFields.mjs';
5
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
@@ -6,7 +6,7 @@ export declare const resolveConfig: (amplify: AmplifyClassV6) => {
6
6
  apiKey: string | undefined;
7
7
  customEndpoint: string | undefined;
8
8
  customEndpointRegion: string | undefined;
9
- defaultAuthMode: import("@aws-amplify/core/lib-esm/libraryUtils").GraphQLAuthMode | undefined;
9
+ defaultAuthMode: import("@aws-amplify/core/internals/utils").GraphQLAuthMode | undefined;
10
10
  endpoint: string | undefined;
11
11
  region: string | undefined;
12
12
  };
@@ -1,10 +1,13 @@
1
+ import '@aws-amplify/core/internals/utils';
2
+ import { assertValidationError } from './errors/assertValidationError.mjs';
3
+ import { APIValidationErrorCode } from './errors/validation.mjs';
4
+
1
5
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
6
  // SPDX-License-Identifier: Apache-2.0
3
- import { APIValidationErrorCode, assertValidationError } from './errors';
4
7
  /**
5
8
  * @internal
6
9
  */
7
- export const resolveConfig = (amplify) => {
10
+ const resolveConfig = (amplify) => {
8
11
  const { apiKey, customEndpoint, customEndpointRegion, defaultAuthMode, endpoint, region, } = amplify.getConfig().API?.GraphQL ?? {};
9
12
  // TODO: re-enable when working in all test environments:
10
13
  // assertValidationError(!!endpoint, APIValidationErrorCode.NoEndpoint);
@@ -18,3 +21,6 @@ export const resolveConfig = (amplify) => {
18
21
  region,
19
22
  };
20
23
  };
24
+
25
+ export { resolveConfig };
26
+ //# sourceMappingURL=resolveConfig.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveConfig.mjs","sources":["../../../src/utils/resolveConfig.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { APIValidationErrorCode, assertValidationError } from './errors';\n/**\n * @internal\n */\nexport const resolveConfig = (amplify) => {\n const { apiKey, customEndpoint, customEndpointRegion, defaultAuthMode, endpoint, region, } = amplify.getConfig().API?.GraphQL ?? {};\n // TODO: re-enable when working in all test environments:\n // assertValidationError(!!endpoint, APIValidationErrorCode.NoEndpoint);\n assertValidationError(!(!customEndpoint && customEndpointRegion), APIValidationErrorCode.NoCustomEndpoint);\n return {\n apiKey,\n customEndpoint,\n customEndpointRegion,\n defaultAuthMode,\n endpoint,\n region,\n };\n};\n"],"names":[],"mappings":";;;;AAAA;AACA;AAEA;AACA;AACA;AACY,MAAC,aAAa,GAAG,CAAC,OAAO,KAAK;AAC1C,IAAI,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,oBAAoB,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,GAAG,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,GAAG,EAAE,OAAO,IAAI,EAAE,CAAC;AACxI;AACA;AACA,IAAI,qBAAqB,CAAC,EAAE,CAAC,cAAc,IAAI,oBAAoB,CAAC,EAAE,sBAAsB,CAAC,gBAAgB,CAAC,CAAC;AAC/G,IAAI,OAAO;AACX,QAAQ,MAAM;AACd,QAAQ,cAAc;AACtB,QAAQ,oBAAoB;AAC5B,QAAQ,eAAe;AACvB,QAAQ,QAAQ;AAChB,QAAQ,MAAM;AACd,KAAK,CAAC;AACN;;;;"}
@@ -5,7 +5,7 @@ import { AmplifyClassV6 } from '@aws-amplify/core';
5
5
  export declare const resolveLibraryOptions: (amplify: AmplifyClassV6) => {
6
6
  headers: ((options: {
7
7
  query: string;
8
- variables?: Record<string, import("@aws-amplify/core/lib-esm/libraryUtils").DocumentType> | undefined;
9
- }) => Promise<import("@aws-amplify/core/lib-esm/clients").Headers>) | undefined;
8
+ variables?: Record<string, import("@aws-amplify/core/internals/utils").DocumentType> | undefined;
9
+ }) => Promise<import("@aws-amplify/core/internals/aws-client-utils").Headers>) | undefined;
10
10
  withCredentials: boolean | undefined;
11
11
  };
@@ -3,8 +3,11 @@
3
3
  /**
4
4
  * @internal
5
5
  */
6
- export const resolveLibraryOptions = (amplify) => {
6
+ const resolveLibraryOptions = (amplify) => {
7
7
  const headers = amplify.libraryOptions?.API?.GraphQL?.headers;
8
8
  const withCredentials = amplify.libraryOptions?.API?.GraphQL?.withCredentials;
9
9
  return { headers, withCredentials };
10
10
  };
11
+
12
+ export { resolveLibraryOptions };
13
+ //# sourceMappingURL=resolveLibraryOptions.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveLibraryOptions.mjs","sources":["../../../src/utils/resolveLibraryOptions.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/**\n * @internal\n */\nexport const resolveLibraryOptions = (amplify) => {\n const headers = amplify.libraryOptions?.API?.GraphQL?.headers;\n const withCredentials = amplify.libraryOptions?.API?.GraphQL?.withCredentials;\n return { headers, withCredentials };\n};\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACY,MAAC,qBAAqB,GAAG,CAAC,OAAO,KAAK;AAClD,IAAI,MAAM,OAAO,GAAG,OAAO,CAAC,cAAc,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC;AAClE,IAAI,MAAM,eAAe,GAAG,OAAO,CAAC,cAAc,EAAE,GAAG,EAAE,OAAO,EAAE,eAAe,CAAC;AAClF,IAAI,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,CAAC;AACxC;;;;"}
@@ -4,7 +4,7 @@
4
4
  * @param model Model from an introspection schema
5
5
  * @returns List of owner field names
6
6
  */
7
- export function resolveOwnerFields(model) {
7
+ function resolveOwnerFields(model) {
8
8
  const ownerFields = new Set();
9
9
  for (const attr of model.attributes || []) {
10
10
  if (isAuthAttribute(attr)) {
@@ -34,3 +34,6 @@ function isAuthAttribute(attribute) {
34
34
  }
35
35
  return false;
36
36
  }
37
+
38
+ export { resolveOwnerFields };
39
+ //# sourceMappingURL=resolveOwnerFields.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveOwnerFields.mjs","sources":["../../../src/utils/resolveOwnerFields.ts"],"sourcesContent":["/**\n * Given an introspection schema model, returns all owner fields.\n *\n * @param model Model from an introspection schema\n * @returns List of owner field names\n */\nexport function resolveOwnerFields(model) {\n const ownerFields = new Set();\n for (const attr of model.attributes || []) {\n if (isAuthAttribute(attr)) {\n for (const rule of attr.properties.rules) {\n if (rule.allow === 'owner') {\n ownerFields.add(rule.ownerField || 'owner');\n }\n }\n }\n }\n return Array.from(ownerFields);\n}\n/**\n * Type guard that identifies an auth attribute with an attached rules list that\n * specifies an `allow` attribute at a minimum.\n *\n * @param attribute Any object. Ideally a model introspection schema model attribute\n * @returns True if given object is an auth attribute\n */\nfunction isAuthAttribute(attribute) {\n if (attribute?.type === 'auth') {\n if (typeof attribute?.properties === 'object') {\n if (Array.isArray(attribute?.properties?.rules)) {\n return (attribute?.properties?.rules).every(rule => !!rule.allow);\n }\n }\n }\n return false;\n}\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,kBAAkB,CAAC,KAAK,EAAE;AAC1C,IAAI,MAAM,WAAW,GAAG,IAAI,GAAG,EAAE,CAAC;AAClC,IAAI,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,UAAU,IAAI,EAAE,EAAE;AAC/C,QAAQ,IAAI,eAAe,CAAC,IAAI,CAAC,EAAE;AACnC,YAAY,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE;AACtD,gBAAgB,IAAI,IAAI,CAAC,KAAK,KAAK,OAAO,EAAE;AAC5C,oBAAoB,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,IAAI,OAAO,CAAC,CAAC;AAChE,iBAAiB;AACjB,aAAa;AACb,SAAS;AACT,KAAK;AACL,IAAI,OAAO,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AACnC,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,eAAe,CAAC,SAAS,EAAE;AACpC,IAAI,IAAI,SAAS,EAAE,IAAI,KAAK,MAAM,EAAE;AACpC,QAAQ,IAAI,OAAO,SAAS,EAAE,UAAU,KAAK,QAAQ,EAAE;AACvD,YAAY,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE;AAC7D,gBAAgB,OAAO,CAAC,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAClF,aAAa;AACb,SAAS;AACT,KAAK;AACL,IAAI,OAAO,KAAK,CAAC;AACjB;;;;"}
@@ -5,7 +5,10 @@
5
5
  * @param model The model object
6
6
  * @returns Array of field names
7
7
  */
8
- export function resolvePKFields(model) {
8
+ function resolvePKFields(model) {
9
9
  const { primaryKeyFieldName, sortKeyFieldNames } = model.primaryKeyInfo;
10
10
  return [primaryKeyFieldName, ...sortKeyFieldNames];
11
11
  }
12
+
13
+ export { resolvePKFields };
14
+ //# sourceMappingURL=resolvePKFields.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolvePKFields.mjs","sources":["../../../src/utils/resolvePKFields.ts"],"sourcesContent":["/**\n * Given a SchemaModel from a ModelIntrospectionSchema, returns the primary key\n * as an array of field names.\n *\n * @param model The model object\n * @returns Array of field names\n */\nexport function resolvePKFields(model) {\n const { primaryKeyFieldName, sortKeyFieldNames } = model.primaryKeyInfo;\n return [primaryKeyFieldName, ...sortKeyFieldNames];\n}\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,eAAe,CAAC,KAAK,EAAE;AACvC,IAAI,MAAM,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,GAAG,KAAK,CAAC,cAAc,CAAC;AAC5E,IAAI,OAAO,CAAC,mBAAmB,EAAE,GAAG,iBAAiB,CAAC,CAAC;AACvD;;;;"}
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@aws-amplify/api-graphql/internals",
3
- "types": "../lib-esm/internals/index.d.ts",
4
- "main": "../lib/internals/index.js",
5
- "module": "../lib-esm/internals/index.js",
6
- "react-native": "../lib-esm/internals/index.js",
3
+ "types": "../dist/esm/internals/index.d.ts",
4
+ "main": "../dist/cjs/internals/index.js",
5
+ "module": "../dist/esm/internals/index.mjs",
6
+ "react-native": "../src/internals/index.ts",
7
7
  "sideEffects": false
8
8
  }
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@aws-amplify/api-graphql/internals/server",
3
- "types": "../../lib-esm/internals/server/index.d.ts",
4
- "main": "../../lib/internals/server/index.js",
5
- "module": "../../lib-esm/internals/server/index.js",
6
- "react-native": "../../lib-esm/internals/server/index.js",
3
+ "types": "../../dist/esm/internals/server/index.d.ts",
4
+ "main": "../../dist/cjs/internals/server/index.js",
5
+ "module": "../../dist/esm/internals/server/index.js",
6
+ "react-native": "../../src/internals/server/index.ts",
7
7
  "sideEffects": false
8
8
  }
package/package.json CHANGED
@@ -1,16 +1,14 @@
1
1
  {
2
2
  "name": "@aws-amplify/api-graphql",
3
- "version": "4.0.1-api-v6-models.6720ee0.0+6720ee0",
3
+ "version": "4.0.1-api-v6-models.13c9b49.0+13c9b49",
4
4
  "description": "Api-graphql category of 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
- },
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",
11
9
  "sideEffects": [
12
- "./lib/GraphQLAPI.js",
13
- "./lib-esm/GraphQLAPI.js"
10
+ "./dist/cjs/GraphQLAPI.js",
11
+ "./dist/esm/GraphQLAPI.mjs"
14
12
  ],
15
13
  "publishConfig": {
16
14
  "access": "public"
@@ -18,18 +16,46 @@
18
16
  "scripts": {
19
17
  "test": "npm run lint && jest -w 1 --coverage",
20
18
  "test:watch": "tslint 'src/**/*.ts' && jest -w 1 --watch",
21
- "build-with-test": "npm run clean && npm test && tsc && webpack",
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": "npm run clean && npm run build:esm && npm run build:cjs",
27
- "clean": "npm run clean:size && rimraf lib-esm lib dist",
19
+ "build-with-test": "npm test && npm 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",
28
26
  "clean:size": "rimraf dual-publish-tmp tmp*",
29
27
  "format": "echo \"Not implemented\"",
30
28
  "lint": "tslint 'src/**/*.ts' && npm run ts-coverage",
31
29
  "ts-coverage": "typescript-coverage-report -p ./tsconfig.json -t 70.0"
32
30
  },
31
+ "exports": {
32
+ ".": {
33
+ "types": "./dist/esm/index.d.ts",
34
+ "import": "./dist/esm/index.mjs",
35
+ "require": "./dist/cjs/index.js",
36
+ "react-native": "./src/index.ts"
37
+ },
38
+ "./internals": {
39
+ "types": "./dist/esm/internals/index.d.ts",
40
+ "import": "./dist/esm/internals/index.mjs",
41
+ "require": "./dist/cjs/internals/index.js",
42
+ "react-native": "./src/internals/index.ts"
43
+ },
44
+ "./internals/server": {
45
+ "types": "./dist/esm/internals/server/index.d.ts",
46
+ "import": "./dist/esm/internals/server/index.mjs",
47
+ "require": "./dist/cjs/internals/server/index.js",
48
+ "react-native": "./src/internals/server/index.ts"
49
+ },
50
+ "./package.json": "./package.json"
51
+ },
52
+ "typesVersions": {
53
+ ">=4.2": {
54
+ "internals": [
55
+ "./dist/esm/internals/index.d.ts"
56
+ ]
57
+ }
58
+ },
33
59
  "repository": {
34
60
  "type": "git",
35
61
  "url": "https://github.com/aws-amplify/amplify-js.git"
@@ -42,19 +68,21 @@
42
68
  "homepage": "https://aws-amplify.github.io/",
43
69
  "devDependencies": {
44
70
  "@aws-amplify/amplify-api-next-alpha": "^0.6.0",
71
+ "@rollup/plugin-typescript": "11.1.5",
72
+ "rollup": "3.29.4",
45
73
  "typescript": "5.1.6"
46
74
  },
47
75
  "files": [
48
- "lib",
49
- "lib-esm",
76
+ "dist/cjs",
77
+ "dist/esm",
50
78
  "src",
51
79
  "internals"
52
80
  ],
53
81
  "dependencies": {
54
82
  "@aws-amplify/amplify-api-next-types-alpha": "^0.3.0",
55
- "@aws-amplify/api-rest": "4.0.1-api-v6-models.6720ee0.0+6720ee0",
56
- "@aws-amplify/auth": "6.0.1-api-v6-models.6720ee0.0+6720ee0",
57
- "@aws-amplify/core": "6.0.1-api-v6-models.6720ee0.0+6720ee0",
83
+ "@aws-amplify/api-rest": "4.0.1-api-v6-models.13c9b49.0+13c9b49",
84
+ "@aws-amplify/auth": "6.0.1-api-v6-models.13c9b49.0+13c9b49",
85
+ "@aws-amplify/core": "6.0.1-api-v6-models.13c9b49.0+13c9b49",
58
86
  "@aws-sdk/types": "3.387.0",
59
87
  "graphql": "15.8.0",
60
88
  "rxjs": "^7.8.1",
@@ -65,7 +93,7 @@
65
93
  "size-limit": [
66
94
  {
67
95
  "name": "API (GraphQL client)",
68
- "path": "./lib-esm/index.js",
96
+ "path": "./dist/esm/index.mjs",
69
97
  "import": "{ Amplify, GraphQLAPI }",
70
98
  "limit": "91.7 kB"
71
99
  }
@@ -122,10 +150,8 @@
122
150
  "coveragePathIgnorePatterns": [
123
151
  "<rootDir>/node_modules/",
124
152
  "<rootDir>/dist",
125
- "<rootDir>/lib",
126
- "<rootDir>/lib-esm",
127
153
  "<rootDir>/__tests__"
128
154
  ]
129
155
  },
130
- "gitHead": "6720ee03ed374c045c73e49b103fdfb3078b4cfa"
156
+ "gitHead": "13c9b494833497bfe62c4052f14faba43c9cad23"
131
157
  }
package/src/GraphQLAPI.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  import { AmplifyClassV6 } from '@aws-amplify/core';
4
4
  import { Category, ApiAction } from '@aws-amplify/core/internals/utils';
5
5
  import { GraphQLOptions, GraphQLResult } from './types';
6
- import { InternalGraphQLAPIClass } from './internals';
6
+ import { InternalGraphQLAPIClass } from './internals/InternalGraphQLAPI';
7
7
  import { Observable } from 'rxjs';
8
8
 
9
9
  export const graphqlOperation = (
@@ -17,6 +17,12 @@ export function generateModelsProperty<T extends Record<any, any> = never>(
17
17
  const models = {} as any;
18
18
  const config = params.amplify.getConfig();
19
19
 
20
+ if (!config.API?.GraphQL) {
21
+ throw new Error(
22
+ 'The API configuration is missing. This is likely due to Amplify.configure() not being called prior to generateClient().'
23
+ );
24
+ }
25
+
20
26
  const modelIntrospection = config.API?.GraphQL?.modelIntrospection;
21
27
  if (!modelIntrospection) {
22
28
  return {} as any;
@@ -1,38 +0,0 @@
1
- import { AmplifyClassV6 } from '@aws-amplify/core';
2
- import { GraphQLOptions, GraphQLResult } from './types';
3
- import { InternalGraphQLAPIClass } from './internals';
4
- import { Observable } from 'rxjs';
5
- export declare const graphqlOperation: (query: any, variables?: {}, authToken?: string) => {
6
- query: any;
7
- variables: {};
8
- authToken: string | undefined;
9
- };
10
- /**
11
- * Export Cloud Logic APIs
12
- */
13
- export declare class GraphQLAPIClass extends InternalGraphQLAPIClass {
14
- getModuleName(): string;
15
- /**
16
- * Executes a GraphQL operation
17
- *
18
- * @param options - GraphQL Options
19
- * @param [additionalHeaders] - headers to merge in after any `graphql_headers` set in the config
20
- * @returns An Observable if the query is a subscription query, else a promise of the graphql result.
21
- */
22
- graphql<T = any>(amplify: AmplifyClassV6 | (() => Promise<AmplifyClassV6>), options: GraphQLOptions, additionalHeaders?: {
23
- [key: string]: string;
24
- }): Observable<GraphQLResult<T>> | Promise<GraphQLResult<T>>;
25
- /**
26
- * Checks to see if an error thrown is from an api request cancellation
27
- * @param error - Any error
28
- * @returns A boolean indicating if the error was from an api request cancellation
29
- */
30
- isCancelError(error: any): boolean;
31
- /**
32
- * Cancels an inflight request. Only applicable for graphql queries and mutations
33
- * @param {any} request - request to cancel
34
- * @returns A boolean indicating if the request was cancelled
35
- */
36
- cancel(request: Promise<any>, message?: string): boolean;
37
- }
38
- export declare const GraphQLAPI: GraphQLAPIClass;
@@ -1,64 +0,0 @@
1
- import { Observable } from 'rxjs';
2
- import { GraphQLAuthMode, CustomUserAgentDetails, DocumentType } from '@aws-amplify/core/internals/utils';
3
- import { PubSubContentObserver } from '../../types/PubSub';
4
- import { SUBSCRIPTION_STATUS } from '../constants';
5
- export type ObserverQuery = {
6
- observer: PubSubContentObserver;
7
- query: string;
8
- variables: Record<string, DocumentType>;
9
- subscriptionState: SUBSCRIPTION_STATUS;
10
- subscriptionReadyCallback?: Function;
11
- subscriptionFailedCallback?: Function;
12
- startAckTimeoutId?: ReturnType<typeof setTimeout>;
13
- };
14
- export interface AWSAppSyncRealTimeProviderOptions {
15
- appSyncGraphqlEndpoint?: string;
16
- authenticationType?: GraphQLAuthMode;
17
- query?: string;
18
- variables?: Record<string, DocumentType>;
19
- apiKey?: string;
20
- region?: string;
21
- graphql_headers?: () => {} | (() => Promise<{}>);
22
- additionalHeaders?: {
23
- [key: string]: string;
24
- };
25
- }
26
- export declare class AWSAppSyncRealTimeProvider {
27
- private awsRealTimeSocket?;
28
- private socketStatus;
29
- private keepAliveTimeoutId?;
30
- private keepAliveTimeout;
31
- private keepAliveAlertTimeoutId?;
32
- private subscriptionObserverMap;
33
- private promiseArray;
34
- private connectionState;
35
- private readonly connectionStateMonitor;
36
- private readonly reconnectionMonitor;
37
- private connectionStateMonitorSubscription;
38
- constructor(options?: AWSAppSyncRealTimeProviderOptions);
39
- /**
40
- * Mark the socket closed and release all active listeners
41
- */
42
- close(): void;
43
- getNewWebSocket(url: string, protocol: string): WebSocket;
44
- getProviderName(): string;
45
- private isCustomDomain;
46
- subscribe(options?: AWSAppSyncRealTimeProviderOptions, customUserAgentDetails?: CustomUserAgentDetails): Observable<Record<string, unknown>>;
47
- private _startSubscriptionWithAWSAppSyncRealTime;
48
- private _logStartSubscriptionError;
49
- private _waitForSubscriptionToBeConnected;
50
- private _sendUnsubscriptionMessage;
51
- private _removeSubscriptionObserver;
52
- private _closeSocketIfRequired;
53
- private _handleIncomingSubscriptionMessage;
54
- private _errorDisconnect;
55
- private _timeoutStartSubscriptionAck;
56
- private _initializeWebSocketConnection;
57
- private _initializeRetryableHandshake;
58
- private _initializeHandshake;
59
- private _awsRealTimeHeaderBasedAuth;
60
- private _awsAuthTokenHeader;
61
- private _awsRealTimeApiKeyHeader;
62
- private _awsRealTimeIAMHeader;
63
- private _customAuthHeader;
64
- }
@@ -1,95 +0,0 @@
1
- export { AMPLIFY_SYMBOL } from '@aws-amplify/core/internals/utils';
2
- export declare const MAX_DELAY_MS = 5000;
3
- export declare const NON_RETRYABLE_CODES: number[];
4
- export declare const CONNECTION_STATE_CHANGE = "ConnectionStateChange";
5
- export declare enum MESSAGE_TYPES {
6
- /**
7
- * Client -> Server message.
8
- * This message type is the first message after handshake and this will initialize AWS AppSync RealTime communication
9
- */
10
- GQL_CONNECTION_INIT = "connection_init",
11
- /**
12
- * Server -> Client message
13
- * This message type is in case there is an issue with AWS AppSync RealTime when establishing connection
14
- */
15
- GQL_CONNECTION_ERROR = "connection_error",
16
- /**
17
- * Server -> Client message.
18
- * This message type is for the ack response from AWS AppSync RealTime for GQL_CONNECTION_INIT message
19
- */
20
- GQL_CONNECTION_ACK = "connection_ack",
21
- /**
22
- * Client -> Server message.
23
- * This message type is for register subscriptions with AWS AppSync RealTime
24
- */
25
- GQL_START = "start",
26
- /**
27
- * Server -> Client message.
28
- * This message type is for the ack response from AWS AppSync RealTime for GQL_START message
29
- */
30
- GQL_START_ACK = "start_ack",
31
- /**
32
- * Server -> Client message.
33
- * This message type is for subscription message from AWS AppSync RealTime
34
- */
35
- GQL_DATA = "data",
36
- /**
37
- * Server -> Client message.
38
- * This message type helps the client to know is still receiving messages from AWS AppSync RealTime
39
- */
40
- GQL_CONNECTION_KEEP_ALIVE = "ka",
41
- /**
42
- * Client -> Server message.
43
- * This message type is for unregister subscriptions with AWS AppSync RealTime
44
- */
45
- GQL_STOP = "stop",
46
- /**
47
- * Server -> Client message.
48
- * This message type is for the ack response from AWS AppSync RealTime for GQL_STOP message
49
- */
50
- GQL_COMPLETE = "complete",
51
- /**
52
- * Server -> Client message.
53
- * This message type is for sending error messages from AWS AppSync RealTime to the client
54
- */
55
- GQL_ERROR = "error"
56
- }
57
- export declare enum SUBSCRIPTION_STATUS {
58
- PENDING = 0,
59
- CONNECTED = 1,
60
- FAILED = 2
61
- }
62
- export declare enum SOCKET_STATUS {
63
- CLOSED = 0,
64
- READY = 1,
65
- CONNECTING = 2
66
- }
67
- export declare const AWS_APPSYNC_REALTIME_HEADERS: {
68
- accept: string;
69
- 'content-encoding': string;
70
- 'content-type': string;
71
- };
72
- /**
73
- * Time in milleseconds to wait for GQL_CONNECTION_INIT message
74
- */
75
- export declare const CONNECTION_INIT_TIMEOUT = 15000;
76
- /**
77
- * Time in milleseconds to wait for GQL_START_ACK message
78
- */
79
- export declare const START_ACK_TIMEOUT = 15000;
80
- /**
81
- * Default Time in milleseconds to wait for GQL_CONNECTION_KEEP_ALIVE message
82
- */
83
- export declare const DEFAULT_KEEP_ALIVE_TIMEOUT: number;
84
- /**
85
- * Default Time in milleseconds to alert for missed GQL_CONNECTION_KEEP_ALIVE message
86
- */
87
- export declare const DEFAULT_KEEP_ALIVE_ALERT_TIMEOUT: number;
88
- /**
89
- * Default delay time in milleseconds between when reconnect is triggered vs when it is attempted
90
- */
91
- export declare const RECONNECT_DELAY: number;
92
- /**
93
- * Default interval time in milleseconds between when reconnect is re-attempted
94
- */
95
- export declare const RECONNECT_INTERVAL: number;
package/lib/index.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export { GraphQLAPI, GraphQLAPIClass, graphqlOperation } from './GraphQLAPI';
2
- export * from './types';
3
- export { CONNECTION_STATE_CHANGE } from './Providers/constants';