@aws-amplify/api-graphql 0.0.0-unstable-1ca644b-20260128091132

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 (257) hide show
  1. package/README.md +3 -0
  2. package/dist/cjs/GraphQLAPI.js +66 -0
  3. package/dist/cjs/GraphQLAPI.js.map +1 -0
  4. package/dist/cjs/Providers/AWSAppSyncEventsProvider/index.js +117 -0
  5. package/dist/cjs/Providers/AWSAppSyncEventsProvider/index.js.map +1 -0
  6. package/dist/cjs/Providers/AWSAppSyncRealTimeProvider/index.js +96 -0
  7. package/dist/cjs/Providers/AWSAppSyncRealTimeProvider/index.js.map +1 -0
  8. package/dist/cjs/Providers/AWSWebSocketProvider/appsyncUrl.js +113 -0
  9. package/dist/cjs/Providers/AWSWebSocketProvider/appsyncUrl.js.map +1 -0
  10. package/dist/cjs/Providers/AWSWebSocketProvider/authHeaders.js +99 -0
  11. package/dist/cjs/Providers/AWSWebSocketProvider/authHeaders.js.map +1 -0
  12. package/dist/cjs/Providers/AWSWebSocketProvider/index.js +693 -0
  13. package/dist/cjs/Providers/AWSWebSocketProvider/index.js.map +1 -0
  14. package/dist/cjs/Providers/constants.js +149 -0
  15. package/dist/cjs/Providers/constants.js.map +1 -0
  16. package/dist/cjs/index.js +18 -0
  17. package/dist/cjs/index.js.map +1 -0
  18. package/dist/cjs/internals/InternalGraphQLAPI.js +269 -0
  19. package/dist/cjs/internals/InternalGraphQLAPI.js.map +1 -0
  20. package/dist/cjs/internals/events/appsyncRequest.js +96 -0
  21. package/dist/cjs/internals/events/appsyncRequest.js.map +1 -0
  22. package/dist/cjs/internals/events/index.js +142 -0
  23. package/dist/cjs/internals/events/index.js.map +1 -0
  24. package/dist/cjs/internals/events/types.js +6 -0
  25. package/dist/cjs/internals/events/types.js.map +1 -0
  26. package/dist/cjs/internals/events/utils.js +57 -0
  27. package/dist/cjs/internals/events/utils.js.map +1 -0
  28. package/dist/cjs/internals/generateClient.js +86 -0
  29. package/dist/cjs/internals/generateClient.js.map +1 -0
  30. package/dist/cjs/internals/graphqlAuth.js +63 -0
  31. package/dist/cjs/internals/graphqlAuth.js.map +1 -0
  32. package/dist/cjs/internals/graphqlRequest.js +19 -0
  33. package/dist/cjs/internals/graphqlRequest.js.map +1 -0
  34. package/dist/cjs/internals/index.js +16 -0
  35. package/dist/cjs/internals/index.js.map +1 -0
  36. package/dist/cjs/internals/server/generateClientWithAmplifyInstance.js +48 -0
  37. package/dist/cjs/internals/server/generateClientWithAmplifyInstance.js.map +1 -0
  38. package/dist/cjs/internals/server/index.js +9 -0
  39. package/dist/cjs/internals/server/index.js.map +1 -0
  40. package/dist/cjs/internals/types.js +4 -0
  41. package/dist/cjs/internals/types.js.map +1 -0
  42. package/dist/cjs/internals/utils/runtimeTypeGuards/isApiGraphQLProviderConfig.js +10 -0
  43. package/dist/cjs/internals/utils/runtimeTypeGuards/isApiGraphQLProviderConfig.js.map +1 -0
  44. package/dist/cjs/internals/utils/runtimeTypeGuards/isConfigureEventWithResourceConfig.js +10 -0
  45. package/dist/cjs/internals/utils/runtimeTypeGuards/isConfigureEventWithResourceConfig.js.map +1 -0
  46. package/dist/cjs/internals/utils/runtimeTypeGuards/isGraphQLResponseWithErrors.js +14 -0
  47. package/dist/cjs/internals/utils/runtimeTypeGuards/isGraphQLResponseWithErrors.js.map +1 -0
  48. package/dist/cjs/internals/v6.js +155 -0
  49. package/dist/cjs/internals/v6.js.map +1 -0
  50. package/dist/cjs/server/generateClient.js +42 -0
  51. package/dist/cjs/server/generateClient.js.map +1 -0
  52. package/dist/cjs/server/index.js +9 -0
  53. package/dist/cjs/server/index.js.map +1 -0
  54. package/dist/cjs/types/PubSub.js +49 -0
  55. package/dist/cjs/types/PubSub.js.map +1 -0
  56. package/dist/cjs/types/index.js +34 -0
  57. package/dist/cjs/types/index.js.map +1 -0
  58. package/dist/cjs/utils/ConnectionStateMonitor.js +134 -0
  59. package/dist/cjs/utils/ConnectionStateMonitor.js.map +1 -0
  60. package/dist/cjs/utils/ReachabilityMonitor/index.js +10 -0
  61. package/dist/cjs/utils/ReachabilityMonitor/index.js.map +1 -0
  62. package/dist/cjs/utils/ReachabilityMonitor/index.native.js +12 -0
  63. package/dist/cjs/utils/ReachabilityMonitor/index.native.js.map +1 -0
  64. package/dist/cjs/utils/ReconnectionMonitor.js +71 -0
  65. package/dist/cjs/utils/ReconnectionMonitor.js.map +1 -0
  66. package/dist/cjs/utils/errors/GraphQLApiError.js +21 -0
  67. package/dist/cjs/utils/errors/GraphQLApiError.js.map +1 -0
  68. package/dist/cjs/utils/errors/assertValidationError.js +18 -0
  69. package/dist/cjs/utils/errors/assertValidationError.js.map +1 -0
  70. package/dist/cjs/utils/errors/constants.js +47 -0
  71. package/dist/cjs/utils/errors/constants.js.map +1 -0
  72. package/dist/cjs/utils/errors/createGraphQLResultWithError.js +15 -0
  73. package/dist/cjs/utils/errors/createGraphQLResultWithError.js.map +1 -0
  74. package/dist/cjs/utils/errors/index.js +16 -0
  75. package/dist/cjs/utils/errors/index.js.map +1 -0
  76. package/dist/cjs/utils/errors/repackageAuthError.js +38 -0
  77. package/dist/cjs/utils/errors/repackageAuthError.js.map +1 -0
  78. package/dist/cjs/utils/errors/validation.js +28 -0
  79. package/dist/cjs/utils/errors/validation.js.map +1 -0
  80. package/dist/cjs/utils/index.js +11 -0
  81. package/dist/cjs/utils/index.js.map +1 -0
  82. package/dist/cjs/utils/resolveConfig.js +32 -0
  83. package/dist/cjs/utils/resolveConfig.js.map +1 -0
  84. package/dist/cjs/utils/resolveLibraryOptions.js +16 -0
  85. package/dist/cjs/utils/resolveLibraryOptions.js.map +1 -0
  86. package/dist/esm/GraphQLAPI.d.ts +37 -0
  87. package/dist/esm/GraphQLAPI.mjs +63 -0
  88. package/dist/esm/GraphQLAPI.mjs.map +1 -0
  89. package/dist/esm/Providers/AWSAppSyncEventsProvider/index.d.ts +49 -0
  90. package/dist/esm/Providers/AWSAppSyncEventsProvider/index.mjs +115 -0
  91. package/dist/esm/Providers/AWSAppSyncEventsProvider/index.mjs.map +1 -0
  92. package/dist/esm/Providers/AWSAppSyncRealTimeProvider/index.d.ts +47 -0
  93. package/dist/esm/Providers/AWSAppSyncRealTimeProvider/index.mjs +94 -0
  94. package/dist/esm/Providers/AWSAppSyncRealTimeProvider/index.mjs.map +1 -0
  95. package/dist/esm/Providers/AWSWebSocketProvider/appsyncUrl.d.ts +21 -0
  96. package/dist/esm/Providers/AWSWebSocketProvider/appsyncUrl.mjs +107 -0
  97. package/dist/esm/Providers/AWSWebSocketProvider/appsyncUrl.mjs.map +1 -0
  98. package/dist/esm/Providers/AWSWebSocketProvider/authHeaders.d.ts +8 -0
  99. package/dist/esm/Providers/AWSWebSocketProvider/authHeaders.mjs +97 -0
  100. package/dist/esm/Providers/AWSWebSocketProvider/authHeaders.mjs.map +1 -0
  101. package/dist/esm/Providers/AWSWebSocketProvider/index.d.ts +99 -0
  102. package/dist/esm/Providers/AWSWebSocketProvider/index.mjs +691 -0
  103. package/dist/esm/Providers/AWSWebSocketProvider/index.mjs.map +1 -0
  104. package/dist/esm/Providers/constants.d.ts +135 -0
  105. package/dist/esm/Providers/constants.mjs +147 -0
  106. package/dist/esm/Providers/constants.mjs.map +1 -0
  107. package/dist/esm/index.d.ts +6 -0
  108. package/dist/esm/index.mjs +7 -0
  109. package/dist/esm/index.mjs.map +1 -0
  110. package/dist/esm/internals/InternalGraphQLAPI.d.ts +45 -0
  111. package/dist/esm/internals/InternalGraphQLAPI.mjs +270 -0
  112. package/dist/esm/internals/InternalGraphQLAPI.mjs.map +1 -0
  113. package/dist/esm/internals/events/appsyncRequest.d.ts +14 -0
  114. package/dist/esm/internals/events/appsyncRequest.mjs +96 -0
  115. package/dist/esm/internals/events/appsyncRequest.mjs.map +1 -0
  116. package/dist/esm/internals/events/index.d.ts +58 -0
  117. package/dist/esm/internals/events/index.mjs +139 -0
  118. package/dist/esm/internals/events/index.mjs.map +1 -0
  119. package/dist/esm/internals/events/types.d.ts +93 -0
  120. package/dist/esm/internals/events/types.mjs +2 -0
  121. package/dist/esm/internals/events/types.mjs.map +1 -0
  122. package/dist/esm/internals/events/utils.d.ts +16 -0
  123. package/dist/esm/internals/events/utils.mjs +53 -0
  124. package/dist/esm/internals/events/utils.mjs.map +1 -0
  125. package/dist/esm/internals/generateClient.d.ts +12 -0
  126. package/dist/esm/internals/generateClient.mjs +85 -0
  127. package/dist/esm/internals/generateClient.mjs.map +1 -0
  128. package/dist/esm/internals/graphqlAuth.d.ts +3 -0
  129. package/dist/esm/internals/graphqlAuth.mjs +64 -0
  130. package/dist/esm/internals/graphqlAuth.mjs.map +1 -0
  131. package/dist/esm/internals/graphqlRequest.d.ts +3 -0
  132. package/dist/esm/internals/graphqlRequest.mjs +18 -0
  133. package/dist/esm/internals/graphqlRequest.mjs.map +1 -0
  134. package/dist/esm/internals/index.d.ts +4 -0
  135. package/dist/esm/internals/index.mjs +4 -0
  136. package/dist/esm/internals/index.mjs.map +1 -0
  137. package/dist/esm/internals/server/generateClientWithAmplifyInstance.d.ts +13 -0
  138. package/dist/esm/internals/server/generateClientWithAmplifyInstance.mjs +61 -0
  139. package/dist/esm/internals/server/generateClientWithAmplifyInstance.mjs.map +1 -0
  140. package/dist/esm/internals/server/index.d.ts +1 -0
  141. package/dist/esm/internals/server/index.mjs +2 -0
  142. package/dist/esm/internals/server/index.mjs.map +1 -0
  143. package/dist/esm/internals/types.d.ts +34 -0
  144. package/dist/esm/internals/types.mjs +2 -0
  145. package/dist/esm/internals/types.mjs.map +1 -0
  146. package/dist/esm/internals/utils/runtimeTypeGuards/isApiGraphQLProviderConfig.d.ts +2 -0
  147. package/dist/esm/internals/utils/runtimeTypeGuards/isApiGraphQLProviderConfig.mjs +8 -0
  148. package/dist/esm/internals/utils/runtimeTypeGuards/isApiGraphQLProviderConfig.mjs.map +1 -0
  149. package/dist/esm/internals/utils/runtimeTypeGuards/isConfigureEventWithResourceConfig.d.ts +8 -0
  150. package/dist/esm/internals/utils/runtimeTypeGuards/isConfigureEventWithResourceConfig.mjs +8 -0
  151. package/dist/esm/internals/utils/runtimeTypeGuards/isConfigureEventWithResourceConfig.mjs.map +1 -0
  152. package/dist/esm/internals/utils/runtimeTypeGuards/isGraphQLResponseWithErrors.d.ts +2 -0
  153. package/dist/esm/internals/utils/runtimeTypeGuards/isGraphQLResponseWithErrors.mjs +12 -0
  154. package/dist/esm/internals/utils/runtimeTypeGuards/isGraphQLResponseWithErrors.mjs.map +1 -0
  155. package/dist/esm/internals/v6.d.ts +100 -0
  156. package/dist/esm/internals/v6.mjs +152 -0
  157. package/dist/esm/internals/v6.mjs.map +1 -0
  158. package/dist/esm/server/generateClient.d.ts +21 -0
  159. package/dist/esm/server/generateClient.mjs +41 -0
  160. package/dist/esm/server/generateClient.mjs.map +1 -0
  161. package/dist/esm/server/index.d.ts +1 -0
  162. package/dist/esm/server/index.mjs +2 -0
  163. package/dist/esm/server/index.mjs.map +1 -0
  164. package/dist/esm/types/PubSub.d.ts +27 -0
  165. package/dist/esm/types/PubSub.mjs +47 -0
  166. package/dist/esm/types/PubSub.mjs.map +1 -0
  167. package/dist/esm/types/index.d.ts +369 -0
  168. package/dist/esm/types/index.mjs +30 -0
  169. package/dist/esm/types/index.mjs.map +1 -0
  170. package/dist/esm/utils/ConnectionStateMonitor.d.ts +69 -0
  171. package/dist/esm/utils/ConnectionStateMonitor.mjs +132 -0
  172. package/dist/esm/utils/ConnectionStateMonitor.mjs.map +1 -0
  173. package/dist/esm/utils/ReachabilityMonitor/index.d.ts +1 -0
  174. package/dist/esm/utils/ReachabilityMonitor/index.mjs +8 -0
  175. package/dist/esm/utils/ReachabilityMonitor/index.mjs.map +1 -0
  176. package/dist/esm/utils/ReachabilityMonitor/index.native.d.ts +1 -0
  177. package/dist/esm/utils/ReachabilityMonitor/index.native.mjs +9 -0
  178. package/dist/esm/utils/ReachabilityMonitor/index.native.mjs.map +1 -0
  179. package/dist/esm/utils/ReconnectionMonitor.d.ts +29 -0
  180. package/dist/esm/utils/ReconnectionMonitor.mjs +69 -0
  181. package/dist/esm/utils/ReconnectionMonitor.mjs.map +1 -0
  182. package/dist/esm/utils/errors/GraphQLApiError.d.ts +7 -0
  183. package/dist/esm/utils/errors/GraphQLApiError.mjs +19 -0
  184. package/dist/esm/utils/errors/GraphQLApiError.mjs.map +1 -0
  185. package/dist/esm/utils/errors/assertValidationError.d.ts +5 -0
  186. package/dist/esm/utils/errors/assertValidationError.mjs +17 -0
  187. package/dist/esm/utils/errors/assertValidationError.mjs.map +1 -0
  188. package/dist/esm/utils/errors/constants.d.ts +7 -0
  189. package/dist/esm/utils/errors/constants.mjs +46 -0
  190. package/dist/esm/utils/errors/constants.mjs.map +1 -0
  191. package/dist/esm/utils/errors/createGraphQLResultWithError.d.ts +2 -0
  192. package/dist/esm/utils/errors/createGraphQLResultWithError.mjs +13 -0
  193. package/dist/esm/utils/errors/createGraphQLResultWithError.mjs.map +1 -0
  194. package/dist/esm/utils/errors/index.d.ts +4 -0
  195. package/dist/esm/utils/errors/index.mjs +5 -0
  196. package/dist/esm/utils/errors/index.mjs.map +1 -0
  197. package/dist/esm/utils/errors/repackageAuthError.d.ts +7 -0
  198. package/dist/esm/utils/errors/repackageAuthError.mjs +36 -0
  199. package/dist/esm/utils/errors/repackageAuthError.mjs.map +1 -0
  200. package/dist/esm/utils/errors/validation.d.ts +7 -0
  201. package/dist/esm/utils/errors/validation.mjs +26 -0
  202. package/dist/esm/utils/errors/validation.mjs.map +1 -0
  203. package/dist/esm/utils/index.d.ts +2 -0
  204. package/dist/esm/utils/index.mjs +3 -0
  205. package/dist/esm/utils/index.mjs.map +1 -0
  206. package/dist/esm/utils/resolveConfig.d.ts +12 -0
  207. package/dist/esm/utils/resolveConfig.mjs +33 -0
  208. package/dist/esm/utils/resolveConfig.mjs.map +1 -0
  209. package/dist/esm/utils/resolveLibraryOptions.d.ts +11 -0
  210. package/dist/esm/utils/resolveLibraryOptions.mjs +13 -0
  211. package/dist/esm/utils/resolveLibraryOptions.mjs.map +1 -0
  212. package/internals/package.json +8 -0
  213. package/internals/server/package.json +8 -0
  214. package/package.json +99 -0
  215. package/server/package.json +7 -0
  216. package/src/GraphQLAPI.ts +97 -0
  217. package/src/Providers/AWSAppSyncEventsProvider/index.ts +218 -0
  218. package/src/Providers/AWSAppSyncRealTimeProvider/index.ts +185 -0
  219. package/src/Providers/AWSWebSocketProvider/appsyncUrl.ts +152 -0
  220. package/src/Providers/AWSWebSocketProvider/authHeaders.ts +146 -0
  221. package/src/Providers/AWSWebSocketProvider/index.ts +1028 -0
  222. package/src/Providers/constants.ts +154 -0
  223. package/src/index.ts +12 -0
  224. package/src/internals/InternalGraphQLAPI.ts +424 -0
  225. package/src/internals/events/appsyncRequest.ts +169 -0
  226. package/src/internals/events/index.ts +199 -0
  227. package/src/internals/events/types.ts +109 -0
  228. package/src/internals/events/utils.ts +77 -0
  229. package/src/internals/generateClient.ts +120 -0
  230. package/src/internals/graphqlAuth.ts +87 -0
  231. package/src/internals/graphqlRequest.ts +30 -0
  232. package/src/internals/index.ts +10 -0
  233. package/src/internals/server/generateClientWithAmplifyInstance.ts +73 -0
  234. package/src/internals/server/index.ts +4 -0
  235. package/src/internals/types.ts +42 -0
  236. package/src/internals/utils/runtimeTypeGuards/isApiGraphQLProviderConfig.ts +10 -0
  237. package/src/internals/utils/runtimeTypeGuards/isConfigureEventWithResourceConfig.ts +13 -0
  238. package/src/internals/utils/runtimeTypeGuards/isGraphQLResponseWithErrors.ts +15 -0
  239. package/src/internals/v6.ts +189 -0
  240. package/src/server/generateClient.ts +68 -0
  241. package/src/server/index.ts +4 -0
  242. package/src/types/PubSub.ts +57 -0
  243. package/src/types/index.ts +524 -0
  244. package/src/utils/ConnectionStateMonitor.ts +195 -0
  245. package/src/utils/ReachabilityMonitor/index.native.ts +7 -0
  246. package/src/utils/ReachabilityMonitor/index.ts +5 -0
  247. package/src/utils/ReconnectionMonitor.ts +77 -0
  248. package/src/utils/errors/GraphQLApiError.ts +21 -0
  249. package/src/utils/errors/assertValidationError.ts +19 -0
  250. package/src/utils/errors/constants.ts +56 -0
  251. package/src/utils/errors/createGraphQLResultWithError.ts +15 -0
  252. package/src/utils/errors/index.ts +7 -0
  253. package/src/utils/errors/repackageAuthError.ts +43 -0
  254. package/src/utils/errors/validation.ts +26 -0
  255. package/src/utils/index.ts +5 -0
  256. package/src/utils/resolveConfig.ts +46 -0
  257. package/src/utils/resolveLibraryOptions.ts +14 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InternalGraphQLAPI.js","sources":["../../../src/internals/InternalGraphQLAPI.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.InternalGraphQLAPI = exports.InternalGraphQLAPIClass = void 0;\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst graphql_1 = require(\"graphql\");\nconst rxjs_1 = require(\"rxjs\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst api_rest_1 = require(\"@aws-amplify/api-rest\");\nconst internals_1 = require(\"@aws-amplify/api-rest/internals\");\nconst AWSAppSyncRealTimeProvider_1 = require(\"../Providers/AWSAppSyncRealTimeProvider\");\nconst utils_2 = require(\"../utils\");\nconst repackageAuthError_1 = require(\"../utils/errors/repackageAuthError\");\nconst constants_1 = require(\"../utils/errors/constants\");\nconst errors_1 = require(\"../utils/errors\");\nconst isGraphQLResponseWithErrors_1 = require(\"./utils/runtimeTypeGuards/isGraphQLResponseWithErrors\");\nconst graphqlAuth_1 = require(\"./graphqlAuth\");\nconst USER_AGENT_HEADER = 'x-amz-user-agent';\nconst isAmplifyInstance = (amplify) => {\n return typeof amplify !== 'function';\n};\n/**\n * Export Cloud Logic APIs\n */\nclass InternalGraphQLAPIClass {\n constructor() {\n /**\n * @private\n */\n this.appSyncRealTime = new Map();\n this._api = {\n post: internals_1.post,\n cancelREST: internals_1.cancel,\n isCancelErrorREST: api_rest_1.isCancelError,\n updateRequestToBeCancellable: internals_1.updateRequestToBeCancellable,\n };\n }\n getModuleName() {\n return 'InternalGraphQLAPI';\n }\n /**\n * to get the operation type\n * @param operation\n */\n getGraphqlOperationType(operation) {\n const doc = (0, graphql_1.parse)(operation);\n const definitions = doc.definitions;\n const [{ operation: operationType }] = definitions;\n return operationType;\n }\n /**\n * Executes a GraphQL operation\n *\n * @param options - GraphQL Options\n * @param [additionalHeaders] - headers to merge in after any `libraryConfigHeaders` set in the config\n * @returns An Observable if the query is a subscription query, else a promise of the graphql result.\n */\n graphql(amplify, { query: paramQuery, variables = {}, authMode, authToken, endpoint, apiKey, }, additionalHeaders, customUserAgentDetails) {\n const query = typeof paramQuery === 'string'\n ? (0, graphql_1.parse)(paramQuery)\n : (0, graphql_1.parse)((0, graphql_1.print)(paramQuery));\n const [operationDef = {}] = query.definitions.filter(def => def.kind === 'OperationDefinition');\n const { operation: operationType } = operationDef;\n const headers = additionalHeaders || {};\n switch (operationType) {\n case 'query':\n case 'mutation': {\n const abortController = new AbortController();\n let responsePromise;\n if (isAmplifyInstance(amplify)) {\n responsePromise = this._graphql(amplify, { query, variables, authMode, apiKey, endpoint }, headers, abortController, customUserAgentDetails, authToken);\n }\n else {\n // NOTE: this wrapper function must be await-able so the Amplify server context manager can\n // destroy the context only after it completes\n const wrapper = async (amplifyInstance) => {\n const result = await this._graphql(amplifyInstance, { query, variables, authMode, apiKey, endpoint }, headers, abortController, customUserAgentDetails, authToken);\n return result;\n };\n responsePromise = amplify(wrapper);\n }\n this._api.updateRequestToBeCancellable(responsePromise, abortController);\n return responsePromise;\n }\n case 'subscription':\n return this._graphqlSubscribe(amplify, { query, variables, authMode, apiKey, endpoint }, headers, customUserAgentDetails, authToken);\n default:\n throw new Error(`invalid operation type: ${operationType}`);\n }\n }\n async _graphql(amplify, { query, variables, authMode: authModeOverride, endpoint: endpointOverride, apiKey: apiKeyOverride, }, additionalHeaders = {}, abortController, customUserAgentDetails, authToken) {\n const { apiKey, region, endpoint: appSyncGraphqlEndpoint, customEndpoint, customEndpointRegion, defaultAuthMode, } = (0, utils_2.resolveConfig)(amplify);\n const initialAuthMode = authModeOverride || defaultAuthMode || 'iam';\n // identityPool is an alias for iam. TODO: remove 'iam' in v7\n const authMode = initialAuthMode === 'identityPool' ? 'iam' : initialAuthMode;\n /**\n * Retrieve library options from Amplify configuration.\n * `customHeaders` here are from the Amplify configuration options,\n * and are for non-AppSync endpoints only. These are *not* the same as\n * `additionalHeaders`, which are custom headers that are either 1)\n * included when configuring the API client or 2) passed along with\n * individual requests.\n */\n const { headers: customHeaders, withCredentials } = (0, utils_2.resolveLibraryOptions)(amplify);\n /**\n * Client or request-specific custom headers that may or may not be\n * returned by a function:\n */\n let additionalCustomHeaders;\n if (typeof additionalHeaders === 'function') {\n const requestOptions = {\n method: 'POST',\n url: new utils_1.AmplifyUrl(endpointOverride || customEndpoint || appSyncGraphqlEndpoint || '').toString(),\n queryString: (0, graphql_1.print)(query),\n };\n additionalCustomHeaders = await additionalHeaders(requestOptions);\n }\n else {\n additionalCustomHeaders = additionalHeaders;\n }\n // if an authorization header is set, have the explicit authToken take precedence\n if (authToken) {\n additionalCustomHeaders = {\n ...additionalCustomHeaders,\n Authorization: authToken,\n };\n }\n const authHeaders = await (0, graphqlAuth_1.headerBasedAuth)(amplify, authMode, apiKeyOverride ?? apiKey, additionalCustomHeaders);\n const headers = {\n ...(!customEndpoint && authHeaders),\n /**\n * Custom endpoint headers.\n * If there is both a custom endpoint and custom region present, we get the headers.\n * If there is a custom endpoint but no region, we return an empty object.\n * If neither are present, we return an empty object.\n */\n ...((customEndpoint && (customEndpointRegion ? authHeaders : {})) || {}),\n // Custom headers included in Amplify configuration options:\n ...(customHeaders &&\n (await customHeaders({\n query: (0, graphql_1.print)(query),\n variables,\n }))),\n // Custom headers from individual requests or API client configuration:\n ...additionalCustomHeaders,\n // User agent headers:\n ...(!customEndpoint && {\n [USER_AGENT_HEADER]: (0, utils_1.getAmplifyUserAgent)(customUserAgentDetails),\n }),\n };\n const body = {\n query: (0, graphql_1.print)(query),\n variables: variables || null,\n };\n let signingServiceInfo;\n /**\n * We do not send the signing service info to the REST API under the\n * following conditions (i.e. it will not sign the request):\n * - there is a custom endpoint but no region\n * - the auth mode is `none`, or `apiKey`\n * - the auth mode is a type other than the types listed below\n */\n if ((customEndpoint && !customEndpointRegion) ||\n (authMode !== 'oidc' &&\n authMode !== 'userPool' &&\n authMode !== 'iam' &&\n authMode !== 'lambda')) {\n signingServiceInfo = undefined;\n }\n else {\n signingServiceInfo = {\n service: !customEndpointRegion ? 'appsync' : 'execute-api',\n region: !customEndpointRegion ? region : customEndpointRegion,\n };\n }\n const endpoint = endpointOverride || customEndpoint || appSyncGraphqlEndpoint;\n if (!endpoint) {\n throw (0, errors_1.createGraphQLResultWithError)(new errors_1.GraphQLApiError(constants_1.NO_ENDPOINT));\n }\n let response;\n try {\n // \t// // See the inline doc of the REST `post()` API for possible errors to be thrown.\n // \t// // As these errors are catastrophic they should be caught and handled by GraphQL\n // \t// // API consumers.\n const { body: responseBody } = await this._api.post(amplify, {\n url: new utils_1.AmplifyUrl(endpoint),\n options: {\n headers,\n body,\n signingServiceInfo,\n withCredentials,\n },\n abortController,\n });\n response = await responseBody.json();\n }\n catch (error) {\n if (this.isCancelError(error)) {\n throw error;\n }\n response = (0, errors_1.createGraphQLResultWithError)(error);\n }\n if ((0, isGraphQLResponseWithErrors_1.isGraphQLResponseWithErrors)(response)) {\n throw (0, repackageAuthError_1.repackageUnauthorizedError)(response);\n }\n return response;\n }\n /**\n * Checks to see if an error thrown is from an api request cancellation\n * @param {any} error - Any error\n * @return {boolean} - A boolean indicating if the error was from an api request cancellation\n */\n isCancelError(error) {\n return this._api.isCancelErrorREST(error);\n }\n /**\n * Cancels an inflight request. Only applicable for graphql queries and mutations\n * @param {any} request - request to cancel\n * @returns - A boolean indicating if the request was cancelled\n */\n cancel(request, message) {\n return this._api.cancelREST(request, message);\n }\n _graphqlSubscribe(amplify, { query, variables, authMode: authModeOverride, apiKey: apiKeyOverride, endpoint, }, additionalHeaders = {}, customUserAgentDetails, authToken) {\n const config = (0, utils_2.resolveConfig)(amplify);\n const initialAuthMode = authModeOverride || config?.defaultAuthMode || 'iam';\n // identityPool is an alias for iam. TODO: remove 'iam' in v7\n const authMode = initialAuthMode === 'identityPool' ? 'iam' : initialAuthMode;\n /**\n * Retrieve library options from Amplify configuration.\n * `libraryConfigHeaders` are from the Amplify configuration options,\n * and will not be overwritten by other custom headers. These are *not*\n * the same as `additionalHeaders`, which are custom headers that are\n * either 1)included when configuring the API client or 2) passed along\n * with individual requests.\n */\n const { headers: libraryConfigHeaders } = (0, utils_2.resolveLibraryOptions)(amplify);\n const appSyncGraphqlEndpoint = endpoint ?? config?.endpoint;\n // TODO: This could probably be an exception. But, lots of tests rely on\n // attempting to connect to nowhere. So, I'm treating as the opposite of\n // a Chesterton's fence for now. (A fence I shouldn't build, because I don't\n // know why somethings depends on its absence!)\n const memoKey = appSyncGraphqlEndpoint ?? 'none';\n const realtimeProvider = this.appSyncRealTime.get(memoKey) ?? new AWSAppSyncRealTimeProvider_1.AWSAppSyncRealTimeProvider();\n this.appSyncRealTime.set(memoKey, realtimeProvider);\n return realtimeProvider\n .subscribe({\n query: (0, graphql_1.print)(query),\n variables,\n appSyncGraphqlEndpoint,\n region: config?.region,\n authenticationType: authMode,\n apiKey: apiKeyOverride ?? config?.apiKey,\n additionalHeaders,\n authToken,\n libraryConfigHeaders,\n }, customUserAgentDetails)\n .pipe((0, rxjs_1.catchError)(e => {\n if (e.errors) {\n throw (0, repackageAuthError_1.repackageUnauthorizedError)(e);\n }\n throw e;\n }));\n }\n}\nexports.InternalGraphQLAPIClass = InternalGraphQLAPIClass;\nexports.InternalGraphQLAPI = new InternalGraphQLAPIClass();\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,kBAAkB,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kBAAkB,EAAE,QAAQ;AACxC,YAAY,MAAM,EAAE,cAAc,IAAI,MAAM,EAAE,MAAM;AACpD,YAAY,iBAAiB;AAC7B,YAAY,SAAS;AACrB,YAAY,oBAAoB;AAChC,SAAS,EAAE,sBAAsB;AACjC,aAAa,IAAI,CAAC,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC,IAAI;AAC9C,YAAY,IAAI,CAAC,CAAC,MAAM,EAAE;AAC1B,gBAAgB,MAAM,IAAI,oBAAoB,CAAC,0BAA0B,EAAE,CAAC,CAAC;AAC7E,YAAY;AACZ,YAAY,MAAM,CAAC;AACnB,QAAQ,CAAC,CAAC,CAAC;AACX,IAAI;AACJ;AACA,OAAO,CAAC,uBAAuB,GAAG,uBAAuB;AACzD,OAAO,CAAC,kBAAkB,GAAG,IAAI,uBAAuB,EAAE;;"}
@@ -0,0 +1,96 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.appsyncRequest = appsyncRequest;
5
+ const utils_1 = require("@aws-amplify/core/internals/utils");
6
+ const internals_1 = require("@aws-amplify/api-rest/internals");
7
+ const utils_2 = require("../../utils");
8
+ const repackageAuthError_1 = require("../../utils/errors/repackageAuthError");
9
+ const graphqlAuth_1 = require("../graphqlAuth");
10
+ const isGraphQLResponseWithErrors_1 = require("../utils/runtimeTypeGuards/isGraphQLResponseWithErrors");
11
+ const USER_AGENT_HEADER = 'x-amz-user-agent';
12
+ // This is effectively a copy of InternalGraphQLAPI.ts._graphql(...)
13
+ // Our existing unit tests are tightly coupled to the implementation, so i was unable to refactor
14
+ // and extend _graphql() without having to change a bunch of tests as well... which in turn reduces confidence
15
+ // that this feature will _not affect_ GQL behavior.
16
+ async function appsyncRequest(amplify, options, additionalHeaders = {}, abortController, customUserAgentDetails) {
17
+ const { region, appSyncGraphqlEndpoint: endpoint, authenticationType: authMode, query, variables, } = options;
18
+ if (!endpoint) {
19
+ throw new Error('No endpoint');
20
+ }
21
+ const { withCredentials } = (0, utils_2.resolveLibraryOptions)(amplify);
22
+ const headers = await requestHeaders(amplify, options, additionalHeaders, customUserAgentDetails);
23
+ const body = {
24
+ channel: query,
25
+ events: variables,
26
+ };
27
+ const signingServiceInfo = ['apiKey', 'none'].includes(authMode)
28
+ ? undefined
29
+ : {
30
+ service: 'appsync',
31
+ region,
32
+ };
33
+ const { body: responseBody } = await (0, internals_1.post)(amplify, {
34
+ url: new utils_1.AmplifyUrl(endpoint),
35
+ options: {
36
+ headers,
37
+ body,
38
+ signingServiceInfo,
39
+ withCredentials,
40
+ },
41
+ abortController,
42
+ });
43
+ const response = await responseBody.json();
44
+ if ((0, isGraphQLResponseWithErrors_1.isGraphQLResponseWithErrors)(response)) {
45
+ throw (0, repackageAuthError_1.repackageUnauthorizedError)(response);
46
+ }
47
+ return response;
48
+ }
49
+ /**
50
+ * Computes all the necessary HTTP headers for the request based on:
51
+ * 1. Operation-level header options
52
+ * 2. Amplify.configure custom headers
53
+ * 3. AuthZ headers for explicit auth mode specified for operation ?? default auth mode in config
54
+ *
55
+ * @returns HTTP request headers key/value
56
+ */
57
+ async function requestHeaders(amplify, options, additionalHeaders, customUserAgentDetails) {
58
+ const { apiKey, appSyncGraphqlEndpoint: endpoint, authenticationType: authMode, query, variables, authToken, } = options;
59
+ const { headers: customHeadersFn } = (0, utils_2.resolveLibraryOptions)(amplify);
60
+ let additionalCustomHeaders;
61
+ if (typeof additionalHeaders === 'function') {
62
+ const requestOptions = {
63
+ method: 'POST',
64
+ url: new utils_1.AmplifyUrl(endpoint).toString(),
65
+ queryString: query,
66
+ };
67
+ additionalCustomHeaders = await additionalHeaders(requestOptions);
68
+ }
69
+ else {
70
+ additionalCustomHeaders = additionalHeaders;
71
+ }
72
+ // if an authorization header is set, have the operation-level authToken take precedence
73
+ if (authToken) {
74
+ additionalCustomHeaders = {
75
+ ...additionalCustomHeaders,
76
+ Authorization: authToken,
77
+ };
78
+ }
79
+ const authHeaders = await (0, graphqlAuth_1.headerBasedAuth)(amplify, authMode, apiKey, additionalCustomHeaders);
80
+ const customHeaders = customHeadersFn &&
81
+ (await customHeadersFn({
82
+ query,
83
+ variables: variables,
84
+ }));
85
+ const headers = {
86
+ ...authHeaders,
87
+ // Custom headers included in Amplify configuration options:
88
+ ...customHeaders,
89
+ // Custom headers from individual requests or API client configuration:
90
+ ...additionalCustomHeaders,
91
+ // User agent headers:
92
+ [USER_AGENT_HEADER]: (0, utils_1.getAmplifyUserAgent)(customUserAgentDetails),
93
+ };
94
+ return headers;
95
+ }
96
+ //# sourceMappingURL=appsyncRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"appsyncRequest.js","sources":["../../../../src/internals/events/appsyncRequest.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.appsyncRequest = appsyncRequest;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst internals_1 = require(\"@aws-amplify/api-rest/internals\");\nconst utils_2 = require(\"../../utils\");\nconst repackageAuthError_1 = require(\"../../utils/errors/repackageAuthError\");\nconst graphqlAuth_1 = require(\"../graphqlAuth\");\nconst isGraphQLResponseWithErrors_1 = require(\"../utils/runtimeTypeGuards/isGraphQLResponseWithErrors\");\nconst USER_AGENT_HEADER = 'x-amz-user-agent';\n// This is effectively a copy of InternalGraphQLAPI.ts._graphql(...)\n// Our existing unit tests are tightly coupled to the implementation, so i was unable to refactor\n// and extend _graphql() without having to change a bunch of tests as well... which in turn reduces confidence\n// that this feature will _not affect_ GQL behavior.\nasync function appsyncRequest(amplify, options, additionalHeaders = {}, abortController, customUserAgentDetails) {\n const { region, appSyncGraphqlEndpoint: endpoint, authenticationType: authMode, query, variables, } = options;\n if (!endpoint) {\n throw new Error('No endpoint');\n }\n const { withCredentials } = (0, utils_2.resolveLibraryOptions)(amplify);\n const headers = await requestHeaders(amplify, options, additionalHeaders, customUserAgentDetails);\n const body = {\n channel: query,\n events: variables,\n };\n const signingServiceInfo = ['apiKey', 'none'].includes(authMode)\n ? undefined\n : {\n service: 'appsync',\n region,\n };\n const { body: responseBody } = await (0, internals_1.post)(amplify, {\n url: new utils_1.AmplifyUrl(endpoint),\n options: {\n headers,\n body,\n signingServiceInfo,\n withCredentials,\n },\n abortController,\n });\n const response = await responseBody.json();\n if ((0, isGraphQLResponseWithErrors_1.isGraphQLResponseWithErrors)(response)) {\n throw (0, repackageAuthError_1.repackageUnauthorizedError)(response);\n }\n return response;\n}\n/**\n * Computes all the necessary HTTP headers for the request based on:\n * 1. Operation-level header options\n * 2. Amplify.configure custom headers\n * 3. AuthZ headers for explicit auth mode specified for operation ?? default auth mode in config\n *\n * @returns HTTP request headers key/value\n */\nasync function requestHeaders(amplify, options, additionalHeaders, customUserAgentDetails) {\n const { apiKey, appSyncGraphqlEndpoint: endpoint, authenticationType: authMode, query, variables, authToken, } = options;\n const { headers: customHeadersFn } = (0, utils_2.resolveLibraryOptions)(amplify);\n let additionalCustomHeaders;\n if (typeof additionalHeaders === 'function') {\n const requestOptions = {\n method: 'POST',\n url: new utils_1.AmplifyUrl(endpoint).toString(),\n queryString: query,\n };\n additionalCustomHeaders = await additionalHeaders(requestOptions);\n }\n else {\n additionalCustomHeaders = additionalHeaders;\n }\n // if an authorization header is set, have the operation-level authToken take precedence\n if (authToken) {\n additionalCustomHeaders = {\n ...additionalCustomHeaders,\n Authorization: authToken,\n };\n }\n const authHeaders = await (0, graphqlAuth_1.headerBasedAuth)(amplify, authMode, apiKey, additionalCustomHeaders);\n const customHeaders = customHeadersFn &&\n (await customHeadersFn({\n query,\n variables: variables,\n }));\n const headers = {\n ...authHeaders,\n // Custom headers included in Amplify configuration options:\n ...customHeaders,\n // Custom headers from individual requests or API client configuration:\n ...additionalCustomHeaders,\n // User agent headers:\n [USER_AGENT_HEADER]: (0, utils_1.getAmplifyUserAgent)(customUserAgentDetails),\n };\n return headers;\n}\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAA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cAAc,CAAC;AACzE,IAAI;AACJ,SAAS;AACT,QAAQ,uBAAuB,GAAG,iBAAiB;AACnD,IAAI;AACJ;AACA,IAAI,IAAI,SAAS,EAAE;AACnB,QAAQ,uBAAuB,GAAG;AAClC,YAAY,GAAG,uBAAuB;AACtC,YAAY,aAAa,EAAE,SAAS;AACpC,SAAS;AACT,IAAI;AACJ,IAAI,MAAM,WAAW,GAAG,MAAM,IAAI,aAAa,CAAC,eAAe,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,uBAAuB,CAAC;AACpH,IAAI,MAAM,aAAa,GAAG,eAAe;AACzC,SAAS,MAAM,eAAe,CAAC;AAC/B,YAAY,KAAK;AACjB,YAAY,SAAS,EAAE,SAAS;AAChC,SAAS,CAAC,CAAC;AACX,IAAI,MAAM,OAAO,GAAG;AACpB,QAAQ,GAAG,WAAW;AACtB;AACA,QAAQ,GAAG,aAAa;AACxB;AACA,QAAQ,GAAG,uBAAuB;AAClC;AACA,QAAQ,CAAC,iBAAiB,GAAG,IAAI,OAAO,CAAC,mBAAmB,EAAE,sBAAsB,CAAC;AACrF,KAAK;AACL,IAAI,OAAO,OAAO;AAClB;;"}
@@ -0,0 +1,142 @@
1
+ 'use strict';
2
+
3
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
+ // SPDX-License-Identifier: Apache-2.0
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.connect = connect;
7
+ exports.post = post;
8
+ exports.closeAll = closeAll;
9
+ const core_1 = require("@aws-amplify/core");
10
+ const utils_1 = require("@aws-amplify/core/internals/utils");
11
+ const AWSAppSyncEventsProvider_1 = require("../../Providers/AWSAppSyncEventsProvider");
12
+ const appsyncRequest_1 = require("./appsyncRequest");
13
+ const utils_2 = require("./utils");
14
+ // Keeps a list of open channels in the websocket
15
+ const openChannels = new Set();
16
+ /**
17
+ * @experimental API may change in future versions
18
+ *
19
+ * Establish a WebSocket connection to an Events channel
20
+ *
21
+ * @example
22
+ * const channel = await events.connect("default/channel")
23
+ *
24
+ * channel.subscribe({
25
+ * next: (data) => { console.log(data) },
26
+ * error: (err) => { console.error(err) },
27
+ * })
28
+ *
29
+ * @example // authMode override
30
+ * const channel = await events.connect("default/channel", { authMode: "userPool" })
31
+ *
32
+ * @param channel - channel path; `<namespace>/<channel>`
33
+ * @param options - request overrides: `authMode`, `authToken`
34
+ *
35
+ */
36
+ async function connect(channel, options) {
37
+ const providerOptions = (0, utils_2.configure)();
38
+ providerOptions.authenticationType = (0, utils_2.normalizeAuth)(options?.authMode, providerOptions.authenticationType);
39
+ providerOptions.apiKey = options?.apiKey || providerOptions.apiKey;
40
+ providerOptions.authToken = options?.authToken || providerOptions.authToken;
41
+ await AWSAppSyncEventsProvider_1.AppSyncEventProvider.connect(providerOptions);
42
+ const channelId = (0, utils_1.amplifyUuid)();
43
+ openChannels.add(channelId);
44
+ let _subscription;
45
+ const sub = (observer, subOptions) => {
46
+ if (!openChannels.has(channelId)) {
47
+ throw new Error('Channel is closed');
48
+ }
49
+ const subscribeOptions = { ...providerOptions, query: channel };
50
+ subscribeOptions.authenticationType = (0, utils_2.normalizeAuth)(subOptions?.authMode, subscribeOptions.authenticationType);
51
+ subscribeOptions.apiKey = subOptions?.apiKey || subscribeOptions.apiKey;
52
+ subscribeOptions.authToken =
53
+ subOptions?.authToken || subscribeOptions.authToken;
54
+ _subscription = AWSAppSyncEventsProvider_1.AppSyncEventProvider
55
+ .subscribe(subscribeOptions)
56
+ .subscribe(observer);
57
+ return _subscription;
58
+ };
59
+ const pub = async (event, pubOptions) => {
60
+ if (!openChannels.has(channelId)) {
61
+ throw new Error('Channel is closed');
62
+ }
63
+ const publishOptions = {
64
+ ...providerOptions,
65
+ query: channel,
66
+ variables: event,
67
+ };
68
+ publishOptions.authenticationType = (0, utils_2.normalizeAuth)(pubOptions?.authMode, publishOptions.authenticationType);
69
+ publishOptions.apiKey = pubOptions?.apiKey || publishOptions.apiKey;
70
+ publishOptions.authToken =
71
+ pubOptions?.authToken || publishOptions.authToken;
72
+ return AWSAppSyncEventsProvider_1.AppSyncEventProvider.publish(publishOptions);
73
+ };
74
+ const close = async () => {
75
+ _subscription && _subscription.unsubscribe();
76
+ openChannels.delete(channelId);
77
+ setTimeout(() => {
78
+ if (openChannels.size === 0) {
79
+ AWSAppSyncEventsProvider_1.AppSyncEventProvider.closeIfNoActiveSubscription();
80
+ }
81
+ }, 1000);
82
+ };
83
+ return {
84
+ subscribe: sub,
85
+ close,
86
+ publish: pub,
87
+ };
88
+ }
89
+ /**
90
+ * @experimental API may change in future versions
91
+ *
92
+ * Publish events to a channel via HTTP request
93
+ *
94
+ * @example
95
+ * await events.post("default/channel", { some: "event" })
96
+ *
97
+ * @example // event batching
98
+ * await events.post("default/channel", [{ some: "event" }, { some: "event2" }])
99
+ *
100
+ * @example // authMode override
101
+ * await events.post("default/channel", { some: "event" }, { authMode: "userPool" })
102
+ *
103
+ * @param channel - channel path; `<namespace>/<channel>`
104
+ * @param event - JSON-serializable value or an array of values
105
+ * @param options - request overrides: `authMode`, `authToken`
106
+ *
107
+ * @returns void on success
108
+ * @throws on error
109
+ */
110
+ async function post(channel, event, options) {
111
+ const providerOptions = (0, utils_2.configure)();
112
+ providerOptions.authenticationType = (0, utils_2.normalizeAuth)(options?.authMode, providerOptions.authenticationType);
113
+ providerOptions.apiKey = options?.apiKey || providerOptions.apiKey;
114
+ providerOptions.authToken = options?.authToken || providerOptions.authToken;
115
+ // trailing slash required in publish
116
+ const normalizedChannelName = channel[0] === '/' ? channel : `/${channel}`;
117
+ const publishOptions = {
118
+ ...providerOptions,
119
+ query: normalizedChannelName,
120
+ variables: (0, utils_2.serializeEvents)(event),
121
+ };
122
+ const abortController = new AbortController();
123
+ const res = await (0, appsyncRequest_1.appsyncRequest)(core_1.Amplify, publishOptions, {}, abortController);
124
+ if (res.failed?.length > 0) {
125
+ return res.failed;
126
+ }
127
+ }
128
+ /**
129
+ * @experimental API may change in future versions
130
+ *
131
+ * Close WebSocket connection, disconnect listeners and reconnect observers
132
+ *
133
+ * @example
134
+ * await events.closeAll()
135
+ *
136
+ * @returns void on success
137
+ * @throws on error
138
+ */
139
+ async function closeAll() {
140
+ await AWSAppSyncEventsProvider_1.AppSyncEventProvider.close();
141
+ }
142
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../src/internals/events/index.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.connect = connect;\nexports.post = post;\nexports.closeAll = closeAll;\nconst core_1 = require(\"@aws-amplify/core\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst AWSAppSyncEventsProvider_1 = require(\"../../Providers/AWSAppSyncEventsProvider\");\nconst appsyncRequest_1 = require(\"./appsyncRequest\");\nconst utils_2 = require(\"./utils\");\n// Keeps a list of open channels in the websocket\nconst openChannels = new Set();\n/**\n * @experimental API may change in future versions\n *\n * Establish a WebSocket connection to an Events channel\n *\n * @example\n * const channel = await events.connect(\"default/channel\")\n *\n * channel.subscribe({\n * next: (data) => { console.log(data) },\n * error: (err) => { console.error(err) },\n * })\n *\n * @example // authMode override\n * const channel = await events.connect(\"default/channel\", { authMode: \"userPool\" })\n *\n * @param channel - channel path; `<namespace>/<channel>`\n * @param options - request overrides: `authMode`, `authToken`\n *\n */\nasync function connect(channel, options) {\n const providerOptions = (0, utils_2.configure)();\n providerOptions.authenticationType = (0, utils_2.normalizeAuth)(options?.authMode, providerOptions.authenticationType);\n providerOptions.apiKey = options?.apiKey || providerOptions.apiKey;\n providerOptions.authToken = options?.authToken || providerOptions.authToken;\n await AWSAppSyncEventsProvider_1.AppSyncEventProvider.connect(providerOptions);\n const channelId = (0, utils_1.amplifyUuid)();\n openChannels.add(channelId);\n let _subscription;\n const sub = (observer, subOptions) => {\n if (!openChannels.has(channelId)) {\n throw new Error('Channel is closed');\n }\n const subscribeOptions = { ...providerOptions, query: channel };\n subscribeOptions.authenticationType = (0, utils_2.normalizeAuth)(subOptions?.authMode, subscribeOptions.authenticationType);\n subscribeOptions.apiKey = subOptions?.apiKey || subscribeOptions.apiKey;\n subscribeOptions.authToken =\n subOptions?.authToken || subscribeOptions.authToken;\n _subscription = AWSAppSyncEventsProvider_1.AppSyncEventProvider\n .subscribe(subscribeOptions)\n .subscribe(observer);\n return _subscription;\n };\n const pub = async (event, pubOptions) => {\n if (!openChannels.has(channelId)) {\n throw new Error('Channel is closed');\n }\n const publishOptions = {\n ...providerOptions,\n query: channel,\n variables: event,\n };\n publishOptions.authenticationType = (0, utils_2.normalizeAuth)(pubOptions?.authMode, publishOptions.authenticationType);\n publishOptions.apiKey = pubOptions?.apiKey || publishOptions.apiKey;\n publishOptions.authToken =\n pubOptions?.authToken || publishOptions.authToken;\n return AWSAppSyncEventsProvider_1.AppSyncEventProvider.publish(publishOptions);\n };\n const close = async () => {\n _subscription && _subscription.unsubscribe();\n openChannels.delete(channelId);\n setTimeout(() => {\n if (openChannels.size === 0) {\n AWSAppSyncEventsProvider_1.AppSyncEventProvider.closeIfNoActiveSubscription();\n }\n }, 1000);\n };\n return {\n subscribe: sub,\n close,\n publish: pub,\n };\n}\n/**\n * @experimental API may change in future versions\n *\n * Publish events to a channel via HTTP request\n *\n * @example\n * await events.post(\"default/channel\", { some: \"event\" })\n *\n * @example // event batching\n * await events.post(\"default/channel\", [{ some: \"event\" }, { some: \"event2\" }])\n *\n * @example // authMode override\n * await events.post(\"default/channel\", { some: \"event\" }, { authMode: \"userPool\" })\n *\n * @param channel - channel path; `<namespace>/<channel>`\n * @param event - JSON-serializable value or an array of values\n * @param options - request overrides: `authMode`, `authToken`\n *\n * @returns void on success\n * @throws on error\n */\nasync function post(channel, event, options) {\n const providerOptions = (0, utils_2.configure)();\n providerOptions.authenticationType = (0, utils_2.normalizeAuth)(options?.authMode, providerOptions.authenticationType);\n providerOptions.apiKey = options?.apiKey || providerOptions.apiKey;\n providerOptions.authToken = options?.authToken || providerOptions.authToken;\n // trailing slash required in publish\n const normalizedChannelName = channel[0] === '/' ? channel : `/${channel}`;\n const publishOptions = {\n ...providerOptions,\n query: normalizedChannelName,\n variables: (0, utils_2.serializeEvents)(event),\n };\n const abortController = new AbortController();\n const res = await (0, appsyncRequest_1.appsyncRequest)(core_1.Amplify, publishOptions, {}, abortController);\n if (res.failed?.length > 0) {\n return res.failed;\n }\n}\n/**\n * @experimental API may change in future versions\n *\n * Close WebSocket connection, disconnect listeners and reconnect observers\n *\n * @example\n * await events.closeAll()\n *\n * @returns void on success\n * @throws on error\n */\nasync function closeAll() {\n await AWSAppSyncEventsProvider_1.AppSyncEventProvider.close();\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,OAAO,GAAG,OAAO;AACzB,OAAO,CAAC,IAAI,GAAG,IAAI;AACnB,OAAO,CAAC,QAAQ,GAAG,QAAQ;AAC3B,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAC3C,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,0BAA0B,GAAG,OAAO,CAAC,0CAA0C,CAAC;AACtF,MAAM,gBAAgB,GAAG,OAAO,CAAC,kBAAkB,CAAC;AACpD,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC;AAClC;AACA,MAAM,YAAY,GAAG,IAAI,GAAG,EAAE;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE;AACzC,IAAI,MAAM,eAAe,GAAG,IAAI,OAAO,CAAC,SAAS,GAAG;AACpD,IAAI,eAAe,CAAC,kBAA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ier: Apache-2.0
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sources":["../../../../src/internals/events/types.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;;"}
@@ -0,0 +1,57 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.serializeEvents = exports.configure = exports.normalizeAuth = void 0;
5
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
6
+ // SPDX-License-Identifier: Apache-2.0
7
+ const core_1 = require("@aws-amplify/core");
8
+ const normalizeAuth = (explicitAuthMode, defaultAuthMode) => {
9
+ if (!explicitAuthMode) {
10
+ return defaultAuthMode;
11
+ }
12
+ if (explicitAuthMode === 'identityPool') {
13
+ return 'iam';
14
+ }
15
+ return explicitAuthMode;
16
+ };
17
+ exports.normalizeAuth = normalizeAuth;
18
+ const configure = () => {
19
+ const config = core_1.Amplify.getConfig();
20
+ const eventsConfig = config.API?.Events;
21
+ if (!eventsConfig) {
22
+ throw new Error('Amplify configuration is missing. Have you called Amplify.configure()?');
23
+ }
24
+ const configAuthMode = (0, exports.normalizeAuth)(eventsConfig.defaultAuthMode, 'apiKey');
25
+ const options = {
26
+ appSyncGraphqlEndpoint: eventsConfig.endpoint,
27
+ region: eventsConfig.region,
28
+ authenticationType: configAuthMode,
29
+ apiKey: eventsConfig.apiKey,
30
+ };
31
+ return options;
32
+ };
33
+ exports.configure = configure;
34
+ /**
35
+ * Event API expects an array of JSON strings
36
+ *
37
+ * @param events - JSON-serializable value or an array of values
38
+ * @returns array of JSON strings
39
+ */
40
+ const serializeEvents = (events) => {
41
+ if (Array.isArray(events)) {
42
+ return events.map((ev, idx) => {
43
+ const eventJson = JSON.stringify(ev);
44
+ if (eventJson === undefined) {
45
+ throw new Error(`Event must be a valid JSON value. Received ${ev} at index ${idx}`);
46
+ }
47
+ return eventJson;
48
+ });
49
+ }
50
+ const eventJson = JSON.stringify(events);
51
+ if (eventJson === undefined) {
52
+ throw new Error(`Event must be a valid JSON value. Received ${events}`);
53
+ }
54
+ return [eventJson];
55
+ };
56
+ exports.serializeEvents = serializeEvents;
57
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sources":["../../../../src/internals/events/utils.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.serializeEvents = exports.configure = exports.normalizeAuth = void 0;\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst core_1 = require(\"@aws-amplify/core\");\nconst normalizeAuth = (explicitAuthMode, defaultAuthMode) => {\n if (!explicitAuthMode) {\n return defaultAuthMode;\n }\n if (explicitAuthMode === 'identityPool') {\n return 'iam';\n }\n return explicitAuthMode;\n};\nexports.normalizeAuth = normalizeAuth;\nconst configure = () => {\n const config = core_1.Amplify.getConfig();\n const eventsConfig = config.API?.Events;\n if (!eventsConfig) {\n throw new Error('Amplify configuration is missing. Have you called Amplify.configure()?');\n }\n const configAuthMode = (0, exports.normalizeAuth)(eventsConfig.defaultAuthMode, 'apiKey');\n const options = {\n appSyncGraphqlEndpoint: eventsConfig.endpoint,\n region: eventsConfig.region,\n authenticationType: configAuthMode,\n apiKey: eventsConfig.apiKey,\n };\n return options;\n};\nexports.configure = configure;\n/**\n * Event API expects an array of JSON strings\n *\n * @param events - JSON-serializable value or an array of values\n * @returns array of JSON strings\n */\nconst serializeEvents = (events) => {\n if (Array.isArray(events)) {\n return events.map((ev, idx) => {\n const eventJson = JSON.stringify(ev);\n if (eventJson === undefined) {\n throw new Error(`Event must be a valid JSON value. Received ${ev} at index ${idx}`);\n }\n return eventJson;\n });\n }\n const eventJson = JSON.stringify(events);\n if (eventJson === undefined) {\n throw new Error(`Event must be a valid JSON value. Received ${events}`);\n }\n return [eventJson];\n};\nexports.serializeEvents = serializeEvents;\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,eAAe,GAAG,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,aAAa,GAAG,MAAM;AAC5E;AACA;AACA,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAC3C,MAAM,aAAa,GAAG,CAAC,gBAAgB,EAAE,eAAe,KAAK;AAC7D,IAAI,IAAI,CAAC,gBAAgB,EAAE;AAC3B,QAAQ,OAAO,eAAe;AAC9B,IAAI;AACJ,IAAI,IAAI,gBAAgB,KAAK,cAAc,EAAE;AAC7C,QAAQ,OAAO,KAAK;AACpB,IAAI;AACJ,IAAI,OAAO,gBAAgB;AAC3B,CAAC;AACD,OAAO,CAAC,aAAa,GAAG,aAAa;AACrC,MAAM,SAAS,GAAG,MAAM;AACxB,IAAI,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE;AAC7C,IAAI,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,EAAE,MAAM;AAC3C,IAAI,IAAI,CAAC,YAAY,EAAE;AACvB,QAAQ,MAAM,IAAI,KAAK,CAAC,wEAAwE,CAAC;AACjG,IAAI;AACJ,IAAI,MAAM,cAAc,GAAG,IAAI,OAAO,CAAC,aAAa,EAAE,YAAY,CAAC,eAAe,EAAE,QAAQ,CAAC;AAC7F,IAAI,MAAM,OAAO,GAAG;AACpB,QAAQ,sBAAsB,EAAE,YAAY,CAAC,QAAQ;AACrD,QAAQ,MAAM,EAAE,YAAY,CAAC,MAAM;AACnC,QAAQ,kBAAkB,EAAE,cAAc;AAC1C,QAAQ,MAAM,EAAE,YAAY,CAAC,MAAM;AACnC,KAAK;AACL,IAAI,OAAO,OAAO;AAClB,CAAC;AACD,OAAO,CAAC,SAAS,GAAG,SAAS;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,eAAe,GAAG,CAAC,MAAM,KAAK;AACpC,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;AAC/B,QAAQ,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,GAAG,KAAK;AACvC,YAAY,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;AAChD,YAAY,IAAI,SAAS,KAAK,SAAS,EAAE;AACzC,gBAAgB,MAAM,IAAI,KAAK,CAAC,CAAC,2CAA2C,EAAE,EAAE,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC;AACnG,YAAY;AACZ,YAAY,OAAO,SAAS;AAC5B,QAAQ,CAAC,CAAC;AACV,IAAI;AACJ,IAAI,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;AAC5C,IAAI,IAAI,SAAS,KAAK,SAAS,EAAE;AACjC,QAAQ,MAAM,IAAI,KAAK,CAAC,CAAC,2CAA2C,EAAE,MAAM,CAAC,CAAC,CAAC;AAC/E,IAAI;AACJ,IAAI,OAAO,CAAC,SAAS,CAAC;AACtB,CAAC;AACD,OAAO,CAAC,eAAe,GAAG,eAAe;;"}
@@ -0,0 +1,86 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.generateClient = generateClient;
5
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
6
+ // SPDX-License-Identifier: Apache-2.0
7
+ const core_1 = require("@aws-amplify/core");
8
+ const runtime_1 = require("@aws-amplify/data-schema/runtime");
9
+ const types_1 = require("../types");
10
+ const isApiGraphQLProviderConfig_1 = require("./utils/runtimeTypeGuards/isApiGraphQLProviderConfig");
11
+ const isConfigureEventWithResourceConfig_1 = require("./utils/runtimeTypeGuards/isConfigureEventWithResourceConfig");
12
+ const v6_1 = require("./v6");
13
+ /**
14
+ * @private
15
+ *
16
+ * Creates a client that can be used to make GraphQL requests, using a provided `AmplifyClassV6`
17
+ * compatible context object for config and auth fetching.
18
+ *
19
+ * @param params
20
+ * @returns
21
+ */
22
+ function generateClient(params) {
23
+ const client = {
24
+ [types_1.__amplify]: params.amplify,
25
+ [types_1.__authMode]: params.authMode,
26
+ [types_1.__authToken]: params.authToken,
27
+ [types_1.__apiKey]: 'apiKey' in params ? params.apiKey : undefined,
28
+ [types_1.__endpoint]: 'endpoint' in params ? params.endpoint : undefined,
29
+ [types_1.__headers]: params.headers,
30
+ graphql: v6_1.graphql,
31
+ cancel: v6_1.cancel,
32
+ isCancelError: v6_1.isCancelError,
33
+ models: emptyProperty,
34
+ enums: emptyProperty,
35
+ queries: emptyProperty,
36
+ mutations: emptyProperty,
37
+ subscriptions: emptyProperty,
38
+ };
39
+ const apiGraphqlConfig = params.amplify.getConfig().API?.GraphQL;
40
+ if (client[types_1.__endpoint]) {
41
+ if (!client[types_1.__authMode]) {
42
+ throw new Error('generateClient() requires an explicit `authMode` when `endpoint` is provided.');
43
+ }
44
+ if (client[types_1.__authMode] === 'apiKey' && !client[types_1.__apiKey]) {
45
+ throw new Error("generateClient() requires an explicit `apiKey` when `endpoint` is provided and `authMode = 'apiKey'`.");
46
+ }
47
+ }
48
+ if (!client[types_1.__endpoint]) {
49
+ if ((0, isApiGraphQLProviderConfig_1.isApiGraphQLConfig)(apiGraphqlConfig)) {
50
+ (0, runtime_1.addSchemaToClient)(client, apiGraphqlConfig, types_1.getInternals);
51
+ }
52
+ else {
53
+ // This happens when the `Amplify.configure()` call gets evaluated after the `generateClient()` call.
54
+ //
55
+ // Cause: when the `generateClient()` and the `Amplify.configure()` calls are located in
56
+ // different source files, script bundlers may randomly arrange their orders in the production
57
+ // bundle.
58
+ //
59
+ // With the current implementation, the `client.models` instance created by `generateClient()`
60
+ // will be rebuilt on every `Amplify.configure()` call that's provided with a valid GraphQL
61
+ // provider configuration.
62
+ //
63
+ // TODO: revisit, and reverify this approach when enabling multiple clients for multi-endpoints
64
+ // configuration.
65
+ generateModelsPropertyOnAmplifyConfigure(client);
66
+ }
67
+ }
68
+ return client;
69
+ }
70
+ const generateModelsPropertyOnAmplifyConfigure = (clientRef) => {
71
+ core_1.Hub.listen('core', coreEvent => {
72
+ if (!(0, isConfigureEventWithResourceConfig_1.isConfigureEventWithResourceConfig)(coreEvent.payload)) {
73
+ return;
74
+ }
75
+ const apiGraphQLConfig = coreEvent.payload.data.API?.GraphQL;
76
+ if ((0, isApiGraphQLProviderConfig_1.isApiGraphQLConfig)(apiGraphQLConfig)) {
77
+ (0, runtime_1.addSchemaToClient)(clientRef, apiGraphQLConfig, types_1.getInternals);
78
+ }
79
+ });
80
+ };
81
+ const emptyProperty = new Proxy({}, {
82
+ get() {
83
+ throw new Error('Client could not be generated. This is likely due to `Amplify.configure()` not being called prior to `generateClient()` or because the configuration passed to `Amplify.configure()` is missing GraphQL provider configuration.');
84
+ },
85
+ });
86
+ //# sourceMappingURL=generateClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateClient.js","sources":["../../../src/internals/generateClient.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.generateClient = generateClient;\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst core_1 = require(\"@aws-amplify/core\");\nconst runtime_1 = require(\"@aws-amplify/data-schema/runtime\");\nconst types_1 = require(\"../types\");\nconst isApiGraphQLProviderConfig_1 = require(\"./utils/runtimeTypeGuards/isApiGraphQLProviderConfig\");\nconst isConfigureEventWithResourceConfig_1 = require(\"./utils/runtimeTypeGuards/isConfigureEventWithResourceConfig\");\nconst v6_1 = require(\"./v6\");\n/**\n * @private\n *\n * Creates a client that can be used to make GraphQL requests, using a provided `AmplifyClassV6`\n * compatible context object for config and auth fetching.\n *\n * @param params\n * @returns\n */\nfunction generateClient(params) {\n const client = {\n [types_1.__amplify]: params.amplify,\n [types_1.__authMode]: params.authMode,\n [types_1.__authToken]: params.authToken,\n [types_1.__apiKey]: 'apiKey' in params ? params.apiKey : undefined,\n [types_1.__endpoint]: 'endpoint' in params ? params.endpoint : undefined,\n [types_1.__headers]: params.headers,\n graphql: v6_1.graphql,\n cancel: v6_1.cancel,\n isCancelError: v6_1.isCancelError,\n models: emptyProperty,\n enums: emptyProperty,\n queries: emptyProperty,\n mutations: emptyProperty,\n subscriptions: emptyProperty,\n };\n const apiGraphqlConfig = params.amplify.getConfig().API?.GraphQL;\n if (client[types_1.__endpoint]) {\n if (!client[types_1.__authMode]) {\n throw new Error('generateClient() requires an explicit `authMode` when `endpoint` is provided.');\n }\n if (client[types_1.__authMode] === 'apiKey' && !client[types_1.__apiKey]) {\n throw new Error(\"generateClient() requires an explicit `apiKey` when `endpoint` is provided and `authMode = 'apiKey'`.\");\n }\n }\n if (!client[types_1.__endpoint]) {\n if ((0, isApiGraphQLProviderConfig_1.isApiGraphQLConfig)(apiGraphqlConfig)) {\n (0, runtime_1.addSchemaToClient)(client, apiGraphqlConfig, types_1.getInternals);\n }\n else {\n // This happens when the `Amplify.configure()` call gets evaluated after the `generateClient()` call.\n //\n // Cause: when the `generateClient()` and the `Amplify.configure()` calls are located in\n // different source files, script bundlers may randomly arrange their orders in the production\n // bundle.\n //\n // With the current implementation, the `client.models` instance created by `generateClient()`\n // will be rebuilt on every `Amplify.configure()` call that's provided with a valid GraphQL\n // provider configuration.\n //\n // TODO: revisit, and reverify this approach when enabling multiple clients for multi-endpoints\n // configuration.\n generateModelsPropertyOnAmplifyConfigure(client);\n }\n }\n return client;\n}\nconst generateModelsPropertyOnAmplifyConfigure = (clientRef) => {\n core_1.Hub.listen('core', coreEvent => {\n if (!(0, isConfigureEventWithResourceConfig_1.isConfigureEventWithResourceConfig)(coreEvent.payload)) {\n return;\n }\n const apiGraphQLConfig = coreEvent.payload.data.API?.GraphQL;\n if ((0, isApiGraphQLProviderConfig_1.isApiGraphQLConfig)(apiGraphQLConfig)) {\n (0, runtime_1.addSchemaToClient)(clientRef, apiGraphQLConfig, types_1.getInternals);\n }\n });\n};\nconst emptyProperty = new Proxy({}, {\n get() {\n throw new Error('Client could not be generated. This is likely due to `Amplify.configure()` not being called prior to `generateClient()` or because the configuration passed to `Amplify.configure()` is missing GraphQL provider configuration.');\n },\n});\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,cAAc,GAAG,cAAc;AACvC;AACA;AACA,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAC3C,MAAM,SAAS,GAAG,OAAO,CAAC,kCAAkC,CAAC;AAC7D,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC;AACnC,MAAM,4BAA4B,GAAG,OAAO,CAAC,sDAAsD,CAAC;AACpG,MAAM,oCAAoC,GAAG,OAAO,CAAC,8DAA8D,CAAC;AACpH,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,cAAc,CAAC,MAAM,EAAE;AAChC,IAAI,MAAM,MAAM,GAAG;AACnB,QAAQ,CAAC,OAAO,CAAC,SAAS,GAAG,MAAM,CAAC,OAAO;AAC3C,QAAQ,CAAC,OAAO,CAAC,UAAU,GAAG,MAAM,CAAC,QAAQ;AAC7C,QAAQ,CAAC,OAAO,CAAC,WAAW,GAAG,MAAM,CAAC,SAAS;AAC/C,QAAQ,CAAC,OAAO,CAAC,QAAQ,GAAG,QAAQ,IAAI,MAAM,GAAG,MAAM,CAAC,MAAM,GAAG,SAAS;AAC1E,QAAQ,CAAC,OAAO,CAAC,UAAU,GAAG,U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wCAAwC,CAAC,MAAM,CAAC;AAC5D,QAAQ;AACR,IAAI;AACJ,IAAI,OAAO,MAAM;AACjB;AACA,MAAM,wCAAwC,GAAG,CAAC,SAAS,KAAK;AAChE,IAAI,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,IAAI;AAC3C,QAAQ,IAAI,CAAC,IAAI,oCAAoC,CAAC,kCAAkC,EAAE,SAAS,CAAC,OAAO,CAAC,EAAE;AAC9G,YAAY;AACZ,QAAQ;AACR,QAAQ,MAAM,gBAAgB,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO;AACpE,QAAQ,IAAI,IAAI,4BAA4B,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,EAAE;AACpF,YAAY,IAAI,SAAS,CAAC,iBAAiB,EAAE,SAAS,EAAE,gBAAgB,EAAE,OAAO,CAAC,YAAY,CAAC;AAC/F,QAAQ;AACR,IAAI,CAAC,CAAC;AACN,CAAC;AACD,MAAM,aAAa,GAAG,IAAI,KAAK,CAAC,EAAE,EAAE;AACpC,IAAI,GAAG,GAAG;AACV,QAAQ,MAAM,IAAI,KAAK,CAAC,iOAAiO,CAAC;AAC1P,IAAI,CAAC;AACL,CAAC,CAAC;;"}
@@ -0,0 +1,63 @@
1
+ 'use strict';
2
+
3
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
+ // SPDX-License-Identifier: Apache-2.0
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.headerBasedAuth = headerBasedAuth;
7
+ const errors_1 = require("../utils/errors");
8
+ const constants_1 = require("../utils/errors/constants");
9
+ async function headerBasedAuth(amplify, authMode, apiKey, additionalHeaders = {}) {
10
+ let headers = {};
11
+ switch (authMode) {
12
+ case 'apiKey':
13
+ if (!apiKey) {
14
+ throw new errors_1.GraphQLApiError(constants_1.NO_API_KEY);
15
+ }
16
+ headers = {
17
+ 'X-Api-Key': apiKey,
18
+ };
19
+ break;
20
+ case 'iam': {
21
+ const session = await amplify.Auth.fetchAuthSession();
22
+ if (session.credentials === undefined) {
23
+ throw new errors_1.GraphQLApiError(constants_1.NO_VALID_CREDENTIALS);
24
+ }
25
+ break;
26
+ }
27
+ case 'oidc':
28
+ case 'userPool': {
29
+ let token;
30
+ try {
31
+ token = (await amplify.Auth.fetchAuthSession()).tokens?.accessToken.toString();
32
+ }
33
+ catch (e) {
34
+ // fetchAuthSession failed
35
+ throw new errors_1.GraphQLApiError({
36
+ ...constants_1.NO_SIGNED_IN_USER,
37
+ underlyingError: e,
38
+ });
39
+ }
40
+ // `fetchAuthSession()` succeeded but didn't return `tokens`.
41
+ // This may happen when unauthenticated access is enabled and there is
42
+ // no user signed in.
43
+ if (!token) {
44
+ throw new errors_1.GraphQLApiError(constants_1.NO_VALID_AUTH_TOKEN);
45
+ }
46
+ headers = {
47
+ Authorization: token,
48
+ };
49
+ break;
50
+ }
51
+ case 'lambda':
52
+ if (typeof additionalHeaders === 'object' &&
53
+ !additionalHeaders.Authorization) {
54
+ throw new errors_1.GraphQLApiError(constants_1.NO_AUTH_TOKEN_HEADER);
55
+ }
56
+ headers = {
57
+ Authorization: additionalHeaders.Authorization,
58
+ };
59
+ break;
60
+ }
61
+ return headers;
62
+ }
63
+ //# sourceMappingURL=graphqlAuth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphqlAuth.js","sources":["../../../src/internals/graphqlAuth.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.headerBasedAuth = headerBasedAuth;\nconst errors_1 = require(\"../utils/errors\");\nconst constants_1 = require(\"../utils/errors/constants\");\nasync function headerBasedAuth(amplify, authMode, apiKey, additionalHeaders = {}) {\n let headers = {};\n switch (authMode) {\n case 'apiKey':\n if (!apiKey) {\n throw new errors_1.GraphQLApiError(constants_1.NO_API_KEY);\n }\n headers = {\n 'X-Api-Key': apiKey,\n };\n break;\n case 'iam': {\n const session = await amplify.Auth.fetchAuthSession();\n if (session.credentials === undefined) {\n throw new errors_1.GraphQLApiError(constants_1.NO_VALID_CREDENTIALS);\n }\n break;\n }\n case 'oidc':\n case 'userPool': {\n let token;\n try {\n token = (await amplify.Auth.fetchAuthSession()).tokens?.accessToken.toString();\n }\n catch (e) {\n // fetchAuthSession failed\n throw new errors_1.GraphQLApiError({\n ...constants_1.NO_SIGNED_IN_USER,\n underlyingError: e,\n });\n }\n // `fetchAuthSession()` succeeded but didn't return `tokens`.\n // This may happen when unauthenticated access is enabled and there is\n // no user signed in.\n if (!token) {\n throw new errors_1.GraphQLApiError(constants_1.NO_VALID_AUTH_TOKEN);\n }\n headers = {\n Authorization: token,\n };\n break;\n }\n case 'lambda':\n if (typeof additionalHeaders === 'object' &&\n !additionalHeaders.Authorization) {\n throw new errors_1.GraphQLApiError(constants_1.NO_AUTH_TOKEN_HEADER);\n }\n headers = {\n Authorization: additionalHeaders.Authorization,\n };\n break;\n case 'none':\n break;\n default:\n break;\n }\n return headers;\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,eAAe,GAAG,eAAe;AACzC,MAAM,QAAQ,GAAG,OAAO,CAAC,iBAAiB,CAAC;AAC3C,MAAM,WAAW,GAAG,OAAO,CAAC,2BAA2B,CAAC;AACxD,eAAe,eAAe,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,iBAAiB,GAAG,EAAE,EAAE;AAClF,IAAI,IAAI,OAAO,GAAG,EAAE;AACpB,IAAI,QAAQ,QAAQ;AACpB,QAAQ,KAAK,QAAQ;AACrB,YAAY,IAAI,CAAC,MAAM,EAAE;AACzB,gBAAgB,MAAM,IAAI,QAAQ,CAAC,eAAe,CAAC,WAAW,CAAC,UAAU,CAAC;AA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ACZ,YAAY,OAAO,GAAG;AACtB,gBAAgB,aAAa,EAAE,iBAAiB,CAAC,aAAa;AAC9D,aAAa;AACb,YAAY;AAKZ;AACA,IAAI,OAAO,OAAO;AAClB;;"}
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+
3
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
+ // SPDX-License-Identifier: Apache-2.0
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.graphqlRequest = graphqlRequest;
7
+ const utils_1 = require("@aws-amplify/core/internals/utils");
8
+ const internals_1 = require("@aws-amplify/api-rest/internals");
9
+ async function graphqlRequest(amplify, url, options, abortController, _post) {
10
+ const p = _post ?? internals_1.post;
11
+ const { body: responseBody } = await p(amplify, {
12
+ url: new utils_1.AmplifyUrl(url),
13
+ options,
14
+ abortController,
15
+ });
16
+ const response = await responseBody.json();
17
+ return response;
18
+ }
19
+ //# sourceMappingURL=graphqlRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphqlRequest.js","sources":["../../../src/internals/graphqlRequest.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.graphqlRequest = graphqlRequest;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst internals_1 = require(\"@aws-amplify/api-rest/internals\");\nasync function graphqlRequest(amplify, url, options, abortController, _post) {\n const p = _post ?? internals_1.post;\n const { body: responseBody } = await p(amplify, {\n url: new utils_1.AmplifyUrl(url),\n options,\n abortController,\n });\n const response = await responseBody.json();\n return response;\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,cAAc,GAAG,cAAc;AACvC,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,WAAW,GAAG,OAAO,CAAC,iCAAiC,CAAC;AAC9D,eAAe,cAAc,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE;AAC7E,IAAI,MAAM,CAAC,GAAG,KAAK,IAAI,WAAW,CAAC,IAAI;AACvC,IAAI,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,MAAM,CAAC,CAAC,OAAO,EAAE;AACpD,QAAQ,GAAG,EAAE,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC;AACxC,QAAQ,OAAO;AACf,QAAQ,eAAe;AACvB,KAAK,CAAC;AACN,IAAI,MAAM,QAAQ,GAAG,MAAM,YAAY,CAAC,IAAI,EAAE;AAC9C,IAAI,OAAO,QAAQ;AACnB;;"}
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.generateClient = exports.isCancelError = exports.cancel = exports.graphql = exports.InternalGraphQLAPIClass = exports.InternalGraphQLAPI = void 0;
5
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
6
+ // SPDX-License-Identifier: Apache-2.0
7
+ var InternalGraphQLAPI_1 = require("./InternalGraphQLAPI");
8
+ Object.defineProperty(exports, "InternalGraphQLAPI", { enumerable: true, get: function () { return InternalGraphQLAPI_1.InternalGraphQLAPI; } });
9
+ Object.defineProperty(exports, "InternalGraphQLAPIClass", { enumerable: true, get: function () { return InternalGraphQLAPI_1.InternalGraphQLAPIClass; } });
10
+ var v6_1 = require("./v6");
11
+ Object.defineProperty(exports, "graphql", { enumerable: true, get: function () { return v6_1.graphql; } });
12
+ Object.defineProperty(exports, "cancel", { enumerable: true, get: function () { return v6_1.cancel; } });
13
+ Object.defineProperty(exports, "isCancelError", { enumerable: true, get: function () { return v6_1.isCancelError; } });
14
+ var generateClient_1 = require("./generateClient");
15
+ Object.defineProperty(exports, "generateClient", { enumerable: true, get: function () { return generateClient_1.generateClient; } });
16
+ //# sourceMappingURL=index.js.map