@aws-amplify/api-graphql 4.0.1-unstable.cfbde4c.0 → 4.0.2-unstable.b778a9e.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 (226) hide show
  1. package/{lib → dist/cjs}/GraphQLAPI.js +8 -4
  2. package/dist/cjs/GraphQLAPI.js.map +1 -0
  3. package/{lib → dist/cjs}/Providers/AWSAppSyncRealTimeProvider/index.js +11 -8
  4. package/dist/cjs/Providers/AWSAppSyncRealTimeProvider/index.js.map +1 -0
  5. package/{lib → dist/cjs}/Providers/constants.js +8 -8
  6. package/dist/cjs/Providers/constants.js.map +1 -0
  7. package/dist/cjs/index.js +15 -0
  8. package/dist/cjs/index.js.map +1 -0
  9. package/dist/cjs/internals/APIClient.js +503 -0
  10. package/dist/cjs/internals/APIClient.js.map +1 -0
  11. package/{lib → dist/cjs}/internals/InternalGraphQLAPI.js +19 -19
  12. package/dist/cjs/internals/InternalGraphQLAPI.js.map +1 -0
  13. package/dist/cjs/internals/generateClient.js +33 -0
  14. package/dist/cjs/internals/generateClient.js.map +1 -0
  15. package/dist/cjs/internals/generateModelsProperty.js +43 -0
  16. package/dist/cjs/internals/generateModelsProperty.js.map +1 -0
  17. package/dist/cjs/internals/index.js +16 -0
  18. package/dist/cjs/internals/index.js.map +1 -0
  19. package/dist/cjs/internals/operations/get.js +61 -0
  20. package/dist/cjs/internals/operations/get.js.map +1 -0
  21. package/dist/cjs/internals/operations/list.js +73 -0
  22. package/dist/cjs/internals/operations/list.js.map +1 -0
  23. package/dist/cjs/internals/operations/observeQuery.js +121 -0
  24. package/dist/cjs/internals/operations/observeQuery.js.map +1 -0
  25. package/dist/cjs/internals/operations/subscription.js +29 -0
  26. package/dist/cjs/internals/operations/subscription.js.map +1 -0
  27. package/dist/cjs/internals/server/generateClient.js +32 -0
  28. package/dist/cjs/internals/server/generateClient.js.map +1 -0
  29. package/dist/cjs/internals/server/generateModelsProperty.js +47 -0
  30. package/dist/cjs/internals/server/generateModelsProperty.js.map +1 -0
  31. package/dist/cjs/internals/server/index.js +9 -0
  32. package/dist/cjs/internals/server/index.js.map +1 -0
  33. package/dist/cjs/internals/types.js +4 -0
  34. package/dist/cjs/internals/types.js.map +1 -0
  35. package/{lib → dist/cjs}/internals/v6.js +4 -1
  36. package/dist/cjs/internals/v6.js.map +1 -0
  37. package/{lib → dist/cjs}/types/PubSub.js +6 -6
  38. package/dist/cjs/types/PubSub.js.map +1 -0
  39. package/dist/cjs/types/index.js +18 -0
  40. package/dist/cjs/types/index.js.map +1 -0
  41. package/{lib → dist/cjs}/utils/ConnectionStateMonitor.js +8 -5
  42. package/dist/cjs/utils/ConnectionStateMonitor.js.map +1 -0
  43. package/{lib → dist/cjs}/utils/ReachabilityMonitor/index.js +6 -2
  44. package/dist/cjs/utils/ReachabilityMonitor/index.js.map +1 -0
  45. package/{lib → dist/cjs}/utils/ReachabilityMonitor/index.native.js +6 -2
  46. package/dist/cjs/utils/ReachabilityMonitor/index.native.js.map +1 -0
  47. package/{lib → dist/cjs}/utils/ReconnectionMonitor.js +4 -1
  48. package/dist/cjs/utils/ReconnectionMonitor.js.map +1 -0
  49. package/{lib → dist/cjs}/utils/errors/APIError.js +4 -1
  50. package/dist/cjs/utils/errors/APIError.js.map +1 -0
  51. package/{lib → dist/cjs}/utils/errors/assertValidationError.js +4 -1
  52. package/dist/cjs/utils/errors/assertValidationError.js.map +1 -0
  53. package/dist/cjs/utils/errors/index.js +14 -0
  54. package/dist/cjs/utils/errors/index.js.map +1 -0
  55. package/{lib → dist/cjs}/utils/errors/validation.js +4 -1
  56. package/dist/cjs/utils/errors/validation.js.map +1 -0
  57. package/dist/cjs/utils/findIndexByFields.js +25 -0
  58. package/dist/cjs/utils/findIndexByFields.js.map +1 -0
  59. package/dist/cjs/utils/index.js +15 -0
  60. package/dist/cjs/utils/index.js.map +1 -0
  61. package/{lib → dist/cjs}/utils/resolveConfig.js +7 -3
  62. package/dist/cjs/utils/resolveConfig.js.map +1 -0
  63. package/{lib-esm → dist/cjs}/utils/resolveLibraryOptions.js +7 -1
  64. package/dist/cjs/utils/resolveLibraryOptions.js.map +1 -0
  65. package/dist/cjs/utils/resolveOwnerFields.js +42 -0
  66. package/dist/cjs/utils/resolveOwnerFields.js.map +1 -0
  67. package/dist/cjs/utils/resolvePKFields.js +17 -0
  68. package/dist/cjs/utils/resolvePKFields.js.map +1 -0
  69. package/{lib-esm → dist/esm}/GraphQLAPI.d.ts +2 -2
  70. package/{lib-esm/GraphQLAPI.js → dist/esm/GraphQLAPI.mjs} +8 -4
  71. package/dist/esm/GraphQLAPI.mjs.map +1 -0
  72. package/{lib → dist/esm}/Providers/AWSAppSyncRealTimeProvider/index.d.ts +1 -1
  73. package/{lib-esm/Providers/AWSAppSyncRealTimeProvider/index.js → dist/esm/Providers/AWSAppSyncRealTimeProvider/index.mjs} +13 -9
  74. package/dist/esm/Providers/AWSAppSyncRealTimeProvider/index.mjs.map +1 -0
  75. package/{lib-esm/Providers/constants.js → dist/esm/Providers/constants.mjs} +18 -14
  76. package/dist/esm/Providers/constants.mjs.map +1 -0
  77. package/dist/esm/index.mjs +5 -0
  78. package/dist/esm/index.mjs.map +1 -0
  79. package/dist/esm/internals/APIClient.d.ts +121 -0
  80. package/dist/esm/internals/APIClient.mjs +493 -0
  81. package/dist/esm/internals/APIClient.mjs.map +1 -0
  82. package/{lib → dist/esm}/internals/InternalGraphQLAPI.d.ts +1 -1
  83. package/{lib-esm/internals/InternalGraphQLAPI.js → dist/esm/internals/InternalGraphQLAPI.mjs} +20 -19
  84. package/dist/esm/internals/InternalGraphQLAPI.mjs.map +1 -0
  85. package/dist/esm/internals/generateClient.d.ts +12 -0
  86. package/dist/esm/internals/generateClient.mjs +31 -0
  87. package/dist/esm/internals/generateClient.mjs.map +1 -0
  88. package/dist/esm/internals/generateModelsProperty.d.ts +4 -0
  89. package/dist/esm/internals/generateModelsProperty.mjs +41 -0
  90. package/dist/esm/internals/generateModelsProperty.mjs.map +1 -0
  91. package/{lib → dist/esm}/internals/index.d.ts +1 -0
  92. package/dist/esm/internals/index.mjs +4 -0
  93. package/dist/esm/internals/index.mjs.map +1 -0
  94. package/dist/esm/internals/operations/get.d.ts +2 -0
  95. package/dist/esm/internals/operations/get.mjs +59 -0
  96. package/dist/esm/internals/operations/get.mjs.map +1 -0
  97. package/dist/esm/internals/operations/list.d.ts +2 -0
  98. package/dist/esm/internals/operations/list.mjs +71 -0
  99. package/dist/esm/internals/operations/list.mjs.map +1 -0
  100. package/dist/esm/internals/operations/observeQuery.d.ts +2 -0
  101. package/dist/esm/internals/operations/observeQuery.mjs +122 -0
  102. package/dist/esm/internals/operations/observeQuery.mjs.map +1 -0
  103. package/dist/esm/internals/operations/subscription.d.ts +1 -0
  104. package/dist/esm/internals/operations/subscription.mjs +27 -0
  105. package/dist/esm/internals/operations/subscription.mjs.map +1 -0
  106. package/dist/esm/internals/server/generateClient.d.ts +11 -0
  107. package/dist/esm/internals/server/generateClient.mjs +34 -0
  108. package/dist/esm/internals/server/generateClient.mjs.map +1 -0
  109. package/dist/esm/internals/server/generateModelsProperty.d.ts +3 -0
  110. package/dist/esm/internals/server/generateModelsProperty.mjs +45 -0
  111. package/dist/esm/internals/server/generateModelsProperty.mjs.map +1 -0
  112. package/dist/esm/internals/server/index.d.ts +1 -0
  113. package/dist/esm/internals/server/index.mjs +2 -0
  114. package/dist/esm/internals/server/index.mjs.map +1 -0
  115. package/dist/esm/internals/types.d.ts +17 -0
  116. package/dist/esm/internals/types.mjs +2 -0
  117. package/dist/esm/internals/types.mjs.map +1 -0
  118. package/{lib-esm/internals/v6.js → dist/esm/internals/v6.mjs} +9 -5
  119. package/dist/esm/internals/v6.mjs.map +1 -0
  120. package/{lib → dist/esm}/types/PubSub.d.ts +2 -2
  121. package/{lib-esm/types/PubSub.js → dist/esm/types/PubSub.mjs} +5 -2
  122. package/dist/esm/types/PubSub.mjs.map +1 -0
  123. package/{lib-esm → dist/esm}/types/index.d.ts +46 -26
  124. package/{lib-esm/types/index.js → dist/esm/types/index.mjs} +9 -3
  125. package/dist/esm/types/index.mjs.map +1 -0
  126. package/{lib-esm → dist/esm}/utils/ConnectionStateMonitor.d.ts +3 -3
  127. package/{lib-esm/utils/ConnectionStateMonitor.js → dist/esm/utils/ConnectionStateMonitor.mjs} +9 -5
  128. package/dist/esm/utils/ConnectionStateMonitor.mjs.map +1 -0
  129. package/dist/esm/utils/ReachabilityMonitor/index.d.ts +1 -0
  130. package/{lib-esm/utils/ReachabilityMonitor/index.js → dist/esm/utils/ReachabilityMonitor/index.mjs} +6 -2
  131. package/dist/esm/utils/ReachabilityMonitor/index.mjs.map +1 -0
  132. package/dist/esm/utils/ReachabilityMonitor/index.native.d.ts +1 -0
  133. package/dist/esm/utils/ReachabilityMonitor/index.native.mjs +9 -0
  134. package/dist/esm/utils/ReachabilityMonitor/index.native.mjs.map +1 -0
  135. package/{lib-esm/utils/ReconnectionMonitor.js → dist/esm/utils/ReconnectionMonitor.mjs} +7 -3
  136. package/dist/esm/utils/ReconnectionMonitor.mjs.map +1 -0
  137. package/{lib-esm/utils/errors/APIError.js → dist/esm/utils/errors/APIError.mjs} +6 -2
  138. package/dist/esm/utils/errors/APIError.mjs.map +1 -0
  139. package/{lib-esm/utils/errors/assertValidationError.js → dist/esm/utils/errors/assertValidationError.mjs} +7 -3
  140. package/dist/esm/utils/errors/assertValidationError.mjs.map +1 -0
  141. package/dist/esm/utils/errors/index.mjs +4 -0
  142. package/dist/esm/utils/errors/index.mjs.map +1 -0
  143. package/{lib-esm/utils/errors/validation.js → dist/esm/utils/errors/validation.mjs} +5 -2
  144. package/dist/esm/utils/errors/validation.mjs.map +1 -0
  145. package/dist/esm/utils/findIndexByFields.d.ts +9 -0
  146. package/dist/esm/utils/findIndexByFields.mjs +22 -0
  147. package/dist/esm/utils/findIndexByFields.mjs.map +1 -0
  148. package/{lib → dist/esm}/utils/index.d.ts +2 -0
  149. package/dist/esm/utils/index.mjs +5 -0
  150. package/dist/esm/utils/index.mjs.map +1 -0
  151. package/{lib → dist/esm}/utils/resolveConfig.d.ts +1 -1
  152. package/{lib-esm/utils/resolveConfig.js → dist/esm/utils/resolveConfig.mjs} +8 -2
  153. package/dist/esm/utils/resolveConfig.mjs.map +1 -0
  154. package/{lib → dist/esm}/utils/resolveLibraryOptions.d.ts +2 -2
  155. package/{lib/utils/resolveLibraryOptions.js → dist/esm/utils/resolveLibraryOptions.mjs} +4 -3
  156. package/dist/esm/utils/resolveLibraryOptions.mjs.map +1 -0
  157. package/dist/esm/utils/resolveOwnerFields.d.ts +12 -0
  158. package/dist/esm/utils/resolveOwnerFields.mjs +39 -0
  159. package/dist/esm/utils/resolveOwnerFields.mjs.map +1 -0
  160. package/dist/esm/utils/resolvePKFields.d.ts +13 -0
  161. package/dist/esm/utils/resolvePKFields.mjs +14 -0
  162. package/dist/esm/utils/resolvePKFields.mjs.map +1 -0
  163. package/internals/package.json +4 -4
  164. package/internals/server/package.json +8 -0
  165. package/package.json +56 -26
  166. package/src/GraphQLAPI.ts +1 -1
  167. package/src/internals/APIClient.ts +724 -0
  168. package/src/internals/InternalGraphQLAPI.ts +1 -1
  169. package/src/internals/generateClient.ts +33 -0
  170. package/src/internals/generateModelsProperty.ts +70 -0
  171. package/src/internals/index.ts +1 -0
  172. package/src/internals/operations/get.ts +121 -0
  173. package/src/internals/operations/list.ts +111 -0
  174. package/src/internals/operations/observeQuery.ts +140 -0
  175. package/src/internals/operations/subscription.ts +59 -0
  176. package/src/internals/server/generateClient.ts +45 -0
  177. package/src/internals/server/generateModelsProperty.ts +70 -0
  178. package/src/internals/server/index.ts +4 -0
  179. package/src/internals/types.ts +21 -0
  180. package/src/types/index.ts +28 -2
  181. package/src/utils/findIndexByFields.ts +29 -0
  182. package/src/utils/index.ts +2 -0
  183. package/src/utils/resolveOwnerFields.ts +65 -0
  184. package/src/utils/resolvePKFields.ts +22 -0
  185. package/lib/GraphQLAPI.d.ts +0 -38
  186. package/lib/Providers/constants.d.ts +0 -95
  187. package/lib/index.d.ts +0 -3
  188. package/lib/index.js +0 -12
  189. package/lib/internals/index.js +0 -11
  190. package/lib/internals/v6.d.ts +0 -101
  191. package/lib/tsconfig.tsbuildinfo +0 -6813
  192. package/lib/types/index.d.ts +0 -309
  193. package/lib/types/index.js +0 -14
  194. package/lib/utils/ConnectionStateMonitor.d.ts +0 -41
  195. package/lib/utils/ReachabilityMonitor/index.d.ts +0 -1
  196. package/lib/utils/ReachabilityMonitor/index.native.d.ts +0 -1
  197. package/lib/utils/ReconnectionMonitor.d.ts +0 -29
  198. package/lib/utils/errors/APIError.d.ts +0 -7
  199. package/lib/utils/errors/assertValidationError.d.ts +0 -5
  200. package/lib/utils/errors/index.d.ts +0 -3
  201. package/lib/utils/errors/index.js +0 -11
  202. package/lib/utils/errors/validation.d.ts +0 -7
  203. package/lib/utils/index.js +0 -8
  204. package/lib-esm/Providers/AWSAppSyncRealTimeProvider/index.d.ts +0 -64
  205. package/lib-esm/index.js +0 -5
  206. package/lib-esm/internals/InternalGraphQLAPI.d.ts +0 -58
  207. package/lib-esm/internals/index.d.ts +0 -2
  208. package/lib-esm/internals/index.js +0 -4
  209. package/lib-esm/tsconfig.tsbuildinfo +0 -6813
  210. package/lib-esm/types/PubSub.d.ts +0 -27
  211. package/lib-esm/utils/ReachabilityMonitor/index.d.ts +0 -1
  212. package/lib-esm/utils/ReachabilityMonitor/index.native.d.ts +0 -1
  213. package/lib-esm/utils/ReachabilityMonitor/index.native.js +0 -5
  214. package/lib-esm/utils/errors/index.js +0 -5
  215. package/lib-esm/utils/index.d.ts +0 -2
  216. package/lib-esm/utils/index.js +0 -4
  217. package/lib-esm/utils/resolveConfig.d.ts +0 -12
  218. package/lib-esm/utils/resolveLibraryOptions.d.ts +0 -11
  219. /package/{lib-esm → dist/esm}/Providers/constants.d.ts +0 -0
  220. /package/{lib-esm → dist/esm}/index.d.ts +0 -0
  221. /package/{lib-esm → dist/esm}/internals/v6.d.ts +0 -0
  222. /package/{lib-esm → dist/esm}/utils/ReconnectionMonitor.d.ts +0 -0
  223. /package/{lib-esm → dist/esm}/utils/errors/APIError.d.ts +0 -0
  224. /package/{lib-esm → dist/esm}/utils/errors/assertValidationError.d.ts +0 -0
  225. /package/{lib-esm → dist/esm}/utils/errors/index.d.ts +0 -0
  226. /package/{lib-esm → dist/esm}/utils/errors/validation.d.ts +0 -0
@@ -0,0 +1,34 @@
1
+ import '../InternalGraphQLAPI.mjs';
2
+ import { graphql, cancel, isCancelError } from '../v6.mjs';
3
+ import { __amplify, __authMode, __authToken } from '../../types/index.mjs';
4
+ import 'rxjs';
5
+ import '@aws-amplify/core/internals/utils';
6
+ import '../../utils/errors/validation.mjs';
7
+ import { generateModelsProperty } from './generateModelsProperty.mjs';
8
+
9
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
10
+ // SPDX-License-Identifier: Apache-2.0
11
+ /**
12
+ * @private
13
+ *
14
+ * Creates a client that can be used to make GraphQL requests, using a provided `AmplifyClassV6`
15
+ * compatible context object for config and auth fetching.
16
+ *
17
+ * @param params
18
+ * @returns
19
+ */
20
+ function generateClient(params) {
21
+ const client = {
22
+ [__amplify]: params.amplify,
23
+ [__authMode]: params.authMode,
24
+ [__authToken]: params.authToken,
25
+ graphql,
26
+ cancel,
27
+ isCancelError,
28
+ };
29
+ client.models = generateModelsProperty(client, params);
30
+ return client;
31
+ }
32
+
33
+ export { generateClient };
34
+ //# sourceMappingURL=generateClient.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateClient.mjs","sources":["../../../../src/internals/server/generateClient.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { graphql, cancel, isCancelError } from '../';\nimport { generateModelsProperty } from './generateModelsProperty';\nimport { __amplify, __authMode, __authToken, } from '../../types';\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 */\nexport function generateClient(params) {\n const client = {\n [__amplify]: params.amplify,\n [__authMode]: params.authMode,\n [__authToken]: params.authToken,\n graphql,\n cancel,\n isCancelError,\n };\n client.models = generateModelsProperty(client, params);\n return client;\n}\n"],"names":[],"mappings":";;;;;;;;AAAA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,cAAc,CAAC,MAAM,EAAE;AACvC,IAAI,MAAM,MAAM,GAAG;AACnB,QAAQ,CAAC,SAAS,GAAG,MAAM,CAAC,OAAO;AACnC,QAAQ,CAAC,UAAU,GAAG,MAAM,CAAC,QAAQ;AACrC,QAAQ,CAAC,WAAW,GAAG,MAAM,CAAC,SAAS;AACvC,QAAQ,OAAO;AACf,QAAQ,MAAM;AACd,QAAQ,aAAa;AACrB,KAAK,CAAC;AACN,IAAI,MAAM,CAAC,MAAM,GAAG,sBAAsB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC3D,IAAI,OAAO,MAAM,CAAC;AAClB;;;;"}
@@ -0,0 +1,3 @@
1
+ import { ServerClientGenerationParams } from '../../types/';
2
+ import { V6ClientSSRRequest, V6ClientSSRCookies } from '../../types';
3
+ export declare function generateModelsProperty<T extends Record<any, any> = never, ClientType extends V6ClientSSRRequest<T> | V6ClientSSRCookies<T> = V6ClientSSRCookies<T>>(client: ClientType, params: ServerClientGenerationParams): ClientType;
@@ -0,0 +1,45 @@
1
+ import { graphQLOperationsInfo } from '../APIClient.mjs';
2
+ import { listFactory } from '../operations/list.mjs';
3
+ import { getFactory } from '../operations/get.mjs';
4
+
5
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
6
+ // SPDX-License-Identifier: Apache-2.0
7
+ function generateModelsProperty(client, params) {
8
+ const models = {};
9
+ const config = params.config;
10
+ const useContext = client === null;
11
+ if (!config) {
12
+ // TODO: improve
13
+ throw new Error('generateModelsProperty cannot retrieve Amplify config');
14
+ }
15
+ const modelIntrospection = config.API?.GraphQL?.modelIntrospection;
16
+ if (!modelIntrospection) {
17
+ return {};
18
+ }
19
+ const SSR_UNSUPORTED_OPS = [
20
+ 'ONCREATE',
21
+ 'ONUPDATE',
22
+ 'ONDELETE',
23
+ 'OBSERVE_QUERY',
24
+ ];
25
+ for (const model of Object.values(modelIntrospection.models)) {
26
+ const { name } = model;
27
+ models[name] = {};
28
+ Object.entries(graphQLOperationsInfo).forEach(([key, { operationPrefix }]) => {
29
+ const operation = key;
30
+ // subscriptions are not supported in SSR
31
+ if (SSR_UNSUPORTED_OPS.includes(operation))
32
+ return;
33
+ if (operation === 'LIST') {
34
+ models[name][operationPrefix] = listFactory(client, modelIntrospection, model, useContext);
35
+ }
36
+ else {
37
+ models[name][operationPrefix] = getFactory(client, modelIntrospection, model, operation, useContext);
38
+ }
39
+ });
40
+ }
41
+ return models;
42
+ }
43
+
44
+ export { generateModelsProperty };
45
+ //# sourceMappingURL=generateModelsProperty.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateModelsProperty.mjs","sources":["../../../../src/internals/server/generateModelsProperty.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { graphQLOperationsInfo } from '../APIClient';\nimport { listFactory } from '../operations/list';\nimport { getFactory } from '../operations/get';\nexport function generateModelsProperty(client, params) {\n const models = {};\n const config = params.config;\n const useContext = client === null;\n if (!config) {\n // TODO: improve\n throw new Error('generateModelsProperty cannot retrieve Amplify config');\n }\n const modelIntrospection = config.API?.GraphQL?.modelIntrospection;\n if (!modelIntrospection) {\n return {};\n }\n const SSR_UNSUPORTED_OPS = [\n 'ONCREATE',\n 'ONUPDATE',\n 'ONDELETE',\n 'OBSERVE_QUERY',\n ];\n for (const model of Object.values(modelIntrospection.models)) {\n const { name } = model;\n models[name] = {};\n Object.entries(graphQLOperationsInfo).forEach(([key, { operationPrefix }]) => {\n const operation = key;\n // subscriptions are not supported in SSR\n if (SSR_UNSUPORTED_OPS.includes(operation))\n return;\n if (operation === 'LIST') {\n models[name][operationPrefix] = listFactory(client, modelIntrospection, model, useContext);\n }\n else {\n models[name][operationPrefix] = getFactory(client, modelIntrospection, model, operation, useContext);\n }\n });\n }\n return models;\n}\n"],"names":[],"mappings":";;;;AAAA;AACA;AAIO,SAAS,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE;AACvD,IAAI,MAAM,MAAM,GAAG,EAAE,CAAC;AACtB,IAAI,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AACjC,IAAI,MAAM,UAAU,GAAG,MAAM,KAAK,IAAI,CAAC;AACvC,IAAI,IAAI,CAAC,MAAM,EAAE;AACjB;AACA,QAAQ,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;AACjF,KAAK;AACL,IAAI,MAAM,kBAAkB,GAAG,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,kBAAkB,CAAC;AACvE,IAAI,IAAI,CAAC,kBAAkB,EAAE;AAC7B,QAAQ,OAAO,EAAE,CAAC;AAClB,KAAK;AACL,IAAI,MAAM,kBAAkB,GAAG;AAC/B,QAAQ,UAAU;AAClB,QAAQ,UAAU;AAClB,QAAQ,UAAU;AAClB,QAAQ,eAAe;AACvB,KAAK,CAAC;AACN,IAAI,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,EAAE;AAClE,QAAQ,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;AAC/B,QAAQ,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;AAC1B,QAAQ,MAAM,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,eAAe,EAAE,CAAC,KAAK;AACtF,YAAY,MAAM,SAAS,GAAG,GAAG,CAAC;AAClC;AACA,YAAY,IAAI,kBAAkB,CAAC,QAAQ,CAAC,SAAS,CAAC;AACtD,gBAAgB,OAAO;AACvB,YAAY,IAAI,SAAS,KAAK,MAAM,EAAE;AACtC,gBAAgB,MAAM,CAAC,IAAI,CAAC,CAAC,eAAe,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;AAC3G,aAAa;AACb,iBAAiB;AACjB,gBAAgB,MAAM,CAAC,IAAI,CAAC,CAAC,eAAe,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;AACrH,aAAa;AACb,SAAS,CAAC,CAAC;AACX,KAAK;AACL,IAAI,OAAO,MAAM,CAAC;AAClB;;;;"}
@@ -0,0 +1 @@
1
+ export { generateClient } from './generateClient';
@@ -0,0 +1,2 @@
1
+ export { generateClient } from './generateClient.mjs';
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ import { AmplifyClassV6 } from '@aws-amplify/core';
2
+ import { GraphQLAuthMode } from '@aws-amplify/core/internals/utils';
3
+ /**
4
+ * @private
5
+ *
6
+ * The knobs available for configuring `generateClient` internally.
7
+ */
8
+ export type ClientGenerationParams = {
9
+ amplify: AmplifyClassV6;
10
+ } & CommonPublicClientOptions;
11
+ /**
12
+ * Common options that can be used on public `generateClient()` interfaces.
13
+ */
14
+ export type CommonPublicClientOptions = {
15
+ authMode?: GraphQLAuthMode;
16
+ authToken?: string;
17
+ };
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,7 +1,8 @@
1
+ import { GraphQLAPI } from '../GraphQLAPI.mjs';
2
+ import { __amplify } from '../types/index.mjs';
3
+
1
4
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
5
  // SPDX-License-Identifier: Apache-2.0
3
- import { GraphQLAPI } from '../GraphQLAPI';
4
- import { __amplify, } from '../types';
5
6
  /**
6
7
  * Invokes graphql operations against a graphql service, providing correct input and
7
8
  * output types if Amplify-generated graphql from a recent version of the CLI/codegen
@@ -86,7 +87,7 @@ import { __amplify, } from '../types';
86
87
  * @param options
87
88
  * @param additionalHeaders
88
89
  */
89
- export function graphql(options, additionalHeaders) {
90
+ function graphql(options, additionalHeaders) {
90
91
  /**
91
92
  * The correctness of these typings depends on correct string branding or overrides.
92
93
  * Neither of these can actually be validated at runtime. Hence, we don't perform
@@ -100,7 +101,7 @@ export function graphql(options, additionalHeaders) {
100
101
  * @param {any} request - request to cancel
101
102
  * @returns - A boolean indicating if the request was cancelled
102
103
  */
103
- export function cancel(promise, message) {
104
+ function cancel(promise, message) {
104
105
  return GraphQLAPI.cancel(promise, message);
105
106
  }
106
107
  /**
@@ -108,6 +109,9 @@ export function cancel(promise, message) {
108
109
  * @param {any} error - Any error
109
110
  * @returns - A boolean indicating if the error was from an api request cancellation
110
111
  */
111
- export function isCancelError(error) {
112
+ function isCancelError(error) {
112
113
  return GraphQLAPI.isCancelError(error);
113
114
  }
115
+
116
+ export { cancel, graphql, isCancelError };
117
+ //# sourceMappingURL=v6.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v6.mjs","sources":["../../../src/internals/v6.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { GraphQLAPI } from '../GraphQLAPI';\nimport { __amplify, } from '../types';\n/**\n * Invokes graphql operations against a graphql service, providing correct input and\n * output types if Amplify-generated graphql from a recent version of the CLI/codegen\n * are used *or* correct typing is provided via the type argument.\n *\n * Amplify-generated \"branded\" graphql queries will look similar to this:\n *\n * ```ts\n * //\n * // |-- branding\n * // v\n * export const getModel = `...` as GeneratedQuery<\n * \tGetModelQueryVariables,\n * \tGetModelQuery\n * >;\n * ```\n *\n * If this branding is not in your generated graphql, update to a newer version of\n * CLI/codegen and regenerate your graphql using `amplify codegen`.\n *\n * ## Using Amplify-generated graphql\n *\n * ```ts\n * import * as queries from './graphql/queries';\n *\n * //\n * // |-- correctly typed graphql response containing a Widget\n * // v\n * const queryResult = await graphql({\n * \tquery: queries.getWidget,\n * \tvariables: {\n * \t\tid: \"abc\", // <-- type hinted/enforced\n * \t},\n * });\n *\n * //\n * // |-- a correctly typed Widget\n * // v\n * const fetchedWidget = queryResult.data?.getWidget!;\n * ```\n *\n * ## Custom input + result types\n *\n * To provide input types (`variables`) and result types:\n *\n * ```ts\n * type GetById_NameOnly = {\n * \tvariables: {\n * \t\tid: string\n * \t},\n * \tresult: Promise<{\n * \t\tdata: { getWidget: { name: string } }\n * \t}>\n * }\n *\n * //\n * // |-- type is GetById_NameOnly[\"result\"]\n * // v\n * const result = graphql<GetById_NameOnly>({\n * \tquery: \"...\",\n * \tvariables: { id: \"abc\" } // <-- type of GetById_NameOnly[\"variables\"]\n * });\n * ```\n *\n * ## Custom result type only\n *\n * To specify result types only, use a type that is *not* in the `{variables, result}` shape:\n *\n * ```ts\n * type MyResultType = Promise<{\n * \tdata: {\n * \t\tgetWidget: { name: string }\n * \t}\n * }>\n *\n * //\n * // |-- type is MyResultType\n * // v\n * const result = graphql<MyResultType>({query: \"...\"});\n * ```\n *\n * @param options\n * @param additionalHeaders\n */\nexport function graphql(options, additionalHeaders) {\n /**\n * The correctness of these typings depends on correct string branding or overrides.\n * Neither of these can actually be validated at runtime. Hence, we don't perform\n * any validation or type-guarding here.\n */\n const result = GraphQLAPI.graphql(this[__amplify], options, additionalHeaders);\n return result;\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 */\nexport function cancel(promise, message) {\n return GraphQLAPI.cancel(promise, message);\n}\n/**\n * Checks to see if an error thrown is from an api request cancellation\n * @param {any} error - Any error\n * @returns - A boolean indicating if the error was from an api request cancellation\n */\nexport function isCancelError(error) {\n return GraphQLAPI.isCancelError(error);\n}\n"],"names":[],"mappings":";;;AAAA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,OAAO,CAAC,OAAO,EAAE,iBAAiB,EAAE;AACpD;AACA;AACA;AACA;AACA;AACA,IAAI,MAAM,MAAM,GAAG,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,iBAAiB,CAAC,CAAC;AACnF,IAAI,OAAO,MAAM,CAAC;AAClB,CAAC;AACD;AACA;AACA;AACA;AACA;AACO,SAAS,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE;AACzC,IAAI,OAAO,UAAU,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAC/C,CAAC;AACD;AACA;AACA;AACA;AACA;AACO,SAAS,aAAa,CAAC,KAAK,EAAE;AACrC,IAAI,OAAO,UAAU,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AAC3C;;;;"}
@@ -23,5 +23,5 @@ export declare enum ConnectionState {
23
23
  Disconnected = "Disconnected",
24
24
  ConnectedPendingKeepAlive = "ConnectedPendingKeepAlive"
25
25
  }
26
- export declare type PubSubContent = Record<string, unknown>;
27
- export declare type PubSubContentObserver = Observer<PubSubContent>;
26
+ export type PubSubContent = Record<string, unknown>;
27
+ export type PubSubContentObserver = Observer<PubSubContent>;
@@ -1,4 +1,4 @@
1
- export var CONTROL_MSG;
1
+ var CONTROL_MSG;
2
2
  (function (CONTROL_MSG) {
3
3
  CONTROL_MSG["CONNECTION_CLOSED"] = "Connection closed";
4
4
  CONTROL_MSG["CONNECTION_FAILED"] = "Connection failed";
@@ -7,7 +7,7 @@ export var CONTROL_MSG;
7
7
  CONTROL_MSG["TIMEOUT_DISCONNECT"] = "Timeout disconnect";
8
8
  })(CONTROL_MSG || (CONTROL_MSG = {}));
9
9
  /** @enum {string} */
10
- export var ConnectionState;
10
+ var ConnectionState;
11
11
  (function (ConnectionState) {
12
12
  /*
13
13
  * The connection is alive and healthy
@@ -42,3 +42,6 @@ export var ConnectionState;
42
42
  */
43
43
  ConnectionState["ConnectedPendingKeepAlive"] = "ConnectedPendingKeepAlive";
44
44
  })(ConnectionState || (ConnectionState = {}));
45
+
46
+ export { CONTROL_MSG, ConnectionState };
47
+ //# sourceMappingURL=PubSub.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PubSub.mjs","sources":["../../../src/types/PubSub.ts"],"sourcesContent":["export var CONTROL_MSG;\n(function (CONTROL_MSG) {\n CONTROL_MSG[\"CONNECTION_CLOSED\"] = \"Connection closed\";\n CONTROL_MSG[\"CONNECTION_FAILED\"] = \"Connection failed\";\n CONTROL_MSG[\"REALTIME_SUBSCRIPTION_INIT_ERROR\"] = \"AppSync Realtime subscription init error\";\n CONTROL_MSG[\"SUBSCRIPTION_ACK\"] = \"Subscription ack\";\n CONTROL_MSG[\"TIMEOUT_DISCONNECT\"] = \"Timeout disconnect\";\n})(CONTROL_MSG || (CONTROL_MSG = {}));\n/** @enum {string} */\nexport var ConnectionState;\n(function (ConnectionState) {\n /*\n * The connection is alive and healthy\n */\n ConnectionState[\"Connected\"] = \"Connected\";\n /*\n * The connection is alive, but the connection is offline\n */\n ConnectionState[\"ConnectedPendingNetwork\"] = \"ConnectedPendingNetwork\";\n /*\n * The connection has been disconnected while in use\n */\n ConnectionState[\"ConnectionDisrupted\"] = \"ConnectionDisrupted\";\n /*\n * The connection has been disconnected and the network is offline\n */\n ConnectionState[\"ConnectionDisruptedPendingNetwork\"] = \"ConnectionDisruptedPendingNetwork\";\n /*\n * The connection is in the process of connecting\n */\n ConnectionState[\"Connecting\"] = \"Connecting\";\n /*\n * The connection is not in use and is being disconnected\n */\n ConnectionState[\"ConnectedPendingDisconnect\"] = \"ConnectedPendingDisconnect\";\n /*\n * The connection is not in use and has been disconnected\n */\n ConnectionState[\"Disconnected\"] = \"Disconnected\";\n /*\n * The connection is alive, but a keep alive message has been missed\n */\n ConnectionState[\"ConnectedPendingKeepAlive\"] = \"ConnectedPendingKeepAlive\";\n})(ConnectionState || (ConnectionState = {}));\n"],"names":[],"mappings":"AAAU,IAAC,YAAY;AACvB,CAAC,UAAU,WAAW,EAAE;AACxB,IAAI,WAAW,CAAC,mBAAmB,CAAC,GAAG,mBAAmB,CAAC;AAC3D,IAAI,WAAW,CAAC,mBAAmB,CAAC,GAAG,mBAAmB,CAAC;AAC3D,IAAI,WAAW,CAAC,kCAAkC,CAAC,GAAG,0CAA0C,CAAC;AACjG,IAAI,WAAW,CAAC,kBAAkB,CAAC,GAAG,kBAAkB,CAAC;AACzD,IAAI,WAAW,CAAC,oBAAoB,CAAC,GAAG,oBAAoB,CAAC;AAC7D,CAAC,EAAE,WAAW,KAAK,WAAW,GAAG,EAAE,CAAC,CAAC,CAAC;AACtC;AACU,IAAC,gBAAgB;AAC3B,CAAC,UAAU,eAAe,EAAE;AAC5B;AACA;AACA;AACA,IAAI,eAAe,CAAC,WAAW,CAAC,GAAG,WAAW,CAAC;AAC/C;AACA;AACA;AACA,IAAI,eAAe,CAAC,yBAAyB,CAAC,GAAG,yBAAyB,CAAC;AAC3E;AACA;AACA;AACA,IAAI,eAAe,CAAC,qBAAqB,CAAC,GAAG,qBAAqB,CAAC;AACnE;AACA;AACA;AACA,IAAI,eAAe,CAAC,mCAAmC,CAAC,GAAG,mCAAmC,CAAC;AAC/F;AACA;AACA;AACA,IAAI,eAAe,CAAC,YAAY,CAAC,GAAG,YAAY,CAAC;AACjD;AACA;AACA;AACA,IAAI,eAAe,CAAC,4BAA4B,CAAC,GAAG,4BAA4B,CAAC;AACjF;AACA;AACA;AACA,IAAI,eAAe,CAAC,cAAc,CAAC,GAAG,cAAc,CAAC;AACrD;AACA;AACA;AACA,IAAI,eAAe,CAAC,2BAA2B,CAAC,GAAG,2BAA2B,CAAC;AAC/E,CAAC,EAAE,eAAe,KAAK,eAAe,GAAG,EAAE,CAAC,CAAC;;;;"}
@@ -1,10 +1,13 @@
1
1
  import { AmplifyClassV6, ResourcesConfig } from '@aws-amplify/core';
2
+ import { ModelTypes } from '@aws-amplify/data-schema-types';
2
3
  import { Source, DocumentNode, GraphQLError } from 'graphql';
3
4
  export { OperationTypeNode } from 'graphql';
4
5
  import { Observable } from 'rxjs';
5
6
  import { GraphQLAuthMode, DocumentType } from '@aws-amplify/core/internals/utils';
6
7
  import { AmplifyServer } from '@aws-amplify/core/internals/adapter-core';
7
8
  export { CONTROL_MSG, ConnectionState } from './PubSub';
9
+ export { SelectionSet } from '@aws-amplify/data-schema-types';
10
+ export { CommonPublicClientOptions } from '../internals/types';
8
11
  /**
9
12
  * Loose/Unknown options for raw GraphQLAPICategory `graphql()`.
10
13
  */
@@ -26,10 +29,10 @@ export interface GraphQLResult<T = object> {
26
29
  };
27
30
  }
28
31
  declare const queryType: unique symbol;
29
- export declare type GraphQLQuery<T> = T & {
32
+ export type GraphQLQuery<T> = T & {
30
33
  readonly [queryType]: 'query';
31
34
  };
32
- export declare type GraphQLSubscription<T> = T & {
35
+ export type GraphQLSubscription<T> = T & {
33
36
  readonly [queryType]: 'subscription';
34
37
  };
35
38
  /**
@@ -53,14 +56,14 @@ export declare type GraphQLSubscription<T> = T & {
53
56
  *
54
57
  * This util simply makes related model properties optional recursively.
55
58
  */
56
- export declare type GraphQLReturnType<T> = T extends {} ? {
59
+ export type GraphQLReturnType<T> = T extends {} ? {
57
60
  [K in keyof T]?: GraphQLReturnType<T[K]>;
58
61
  } : T;
59
62
  /**
60
63
  * Describes a paged list result from AppSync, which can either
61
64
  * live at the top query or property (e.g., related model) level.
62
65
  */
63
- declare type PagedList<T, TYPENAME> = {
66
+ type PagedList<T, TYPENAME> = {
64
67
  __typename: TYPENAME;
65
68
  nextToken?: string | null | undefined;
66
69
  items: Array<T>;
@@ -73,13 +76,13 @@ declare type PagedList<T, TYPENAME> = {
73
76
  * array, this will only be the case when we also have errors,
74
77
  * which will then be *thrown*.
75
78
  */
76
- declare type WithListsFixed<T> = T extends PagedList<infer IT, infer NAME> ? PagedList<Exclude<IT, null | undefined>, NAME> : T extends {} ? {
79
+ type WithListsFixed<T> = T extends PagedList<infer IT, infer NAME> ? PagedList<Exclude<IT, null | undefined>, NAME> : T extends {} ? {
77
80
  [K in keyof T]: WithListsFixed<T[K]>;
78
81
  } : T;
79
82
  /**
80
83
  * Returns an updated response type to always return a value.
81
84
  */
82
- declare type NeverEmpty<T> = {
85
+ type NeverEmpty<T> = {
83
86
  [K in keyof T]-?: Exclude<WithListsFixed<T[K]>, undefined | null>;
84
87
  };
85
88
  /**
@@ -89,7 +92,7 @@ declare type NeverEmpty<T> = {
89
92
  * If empty members are present, there will also be errors present,
90
93
  * and the response will instead be *thrown*.
91
94
  */
92
- declare type FixedQueryResult<T> = Exclude<T[keyof T], null | undefined> extends PagedList<any, any> ? {
95
+ type FixedQueryResult<T> = Exclude<T[keyof T], null | undefined> extends PagedList<any, any> ? {
93
96
  [K in keyof T]-?: WithListsFixed<Exclude<T[K], null | undefined>>;
94
97
  } : T;
95
98
  /**
@@ -112,7 +115,7 @@ declare type FixedQueryResult<T> = Exclude<T[keyof T], null | undefined> extends
112
115
  * })
113
116
  * ```
114
117
  */
115
- export declare type GraphqlSubscriptionResult<T> = Observable<GraphqlSubscriptionMessage<T>>;
118
+ export type GraphqlSubscriptionResult<T> = Observable<GraphqlSubscriptionMessage<T>>;
116
119
  /**
117
120
  * The shape of messages passed to `next()` from a graphql subscription. E.g.,
118
121
  *
@@ -129,7 +132,7 @@ export declare type GraphqlSubscriptionResult<T> = Observable<GraphqlSubscriptio
129
132
  * })
130
133
  * ```
131
134
  */
132
- export declare type GraphqlSubscriptionMessage<T> = {
135
+ export type GraphqlSubscriptionMessage<T> = {
133
136
  data: T;
134
137
  };
135
138
  export interface AWSAppSyncRealTimeProviderOptions {
@@ -144,7 +147,7 @@ export interface AWSAppSyncRealTimeProviderOptions {
144
147
  [key: string]: string;
145
148
  };
146
149
  }
147
- export declare type AWSAppSyncRealTimeProvider = {
150
+ export type AWSAppSyncRealTimeProvider = {
148
151
  subscribe(options?: AWSAppSyncRealTimeProviderOptions): Observable<Record<string, unknown>>;
149
152
  };
150
153
  export declare enum GraphQLAuthError {
@@ -158,7 +161,7 @@ export declare enum GraphQLAuthError {
158
161
  * GraphQLSource or string, the type of the parameter for calling graphql.parse
159
162
  * @see: https://graphql.org/graphql-js/language/#parse
160
163
  */
161
- export declare type GraphQLOperation = Source | string;
164
+ export type GraphQLOperation = Source | string;
162
165
  /**
163
166
  * API V6 `graphql({options})` type that can leverage branded graphql `query`
164
167
  * objects and fallback types.
@@ -180,17 +183,17 @@ export interface GraphQLOptionsV6<FALLBACK_TYPES = unknown, TYPED_GQL_STRING ext
180
183
  * Invoking code should either cast the result or use `?` and `!` operators to
181
184
  * navigate the result objects.
182
185
  */
183
- export declare type UnknownGraphQLResponse = Promise<GraphQLResult<any>> | GraphqlSubscriptionResult<any>;
186
+ export type UnknownGraphQLResponse = Promise<GraphQLResult<any>> | GraphqlSubscriptionResult<any>;
184
187
  /**
185
188
  * The expected type for `variables` in a V6 `graphql()` operation with
186
189
  * respect to the given `FALLBACK_TYPES` and `TYPED_GQL_STRING`.
187
190
  */
188
- export declare type GraphQLVariablesV6<FALLBACK_TYPES = unknown, TYPED_GQL_STRING extends string = string> = TYPED_GQL_STRING extends GeneratedQuery<infer IN, any> ? IN : TYPED_GQL_STRING extends GeneratedMutation<infer IN, any> ? IN : TYPED_GQL_STRING extends GeneratedSubscription<infer IN, any> ? IN : FALLBACK_TYPES extends GraphQLOperationType<infer IN, any> ? IN : any;
191
+ export type GraphQLVariablesV6<FALLBACK_TYPES = unknown, TYPED_GQL_STRING extends string = string> = TYPED_GQL_STRING extends GeneratedQuery<infer IN, any> ? IN : TYPED_GQL_STRING extends GeneratedMutation<infer IN, any> ? IN : TYPED_GQL_STRING extends GeneratedSubscription<infer IN, any> ? IN : FALLBACK_TYPES extends GraphQLOperationType<infer IN, any> ? IN : any;
189
192
  /**
190
193
  * The expected return type with respect to the given `FALLBACK_TYPE`
191
194
  * and `TYPED_GQL_STRING`.
192
195
  */
193
- export declare type GraphQLResponseV6<FALLBACK_TYPE = unknown, TYPED_GQL_STRING extends string = string> = TYPED_GQL_STRING extends GeneratedQuery<infer IN, infer QUERY_OUT> ? Promise<GraphQLResult<FixedQueryResult<QUERY_OUT>>> : TYPED_GQL_STRING extends GeneratedMutation<infer IN, infer MUTATION_OUT> ? Promise<GraphQLResult<NeverEmpty<MUTATION_OUT>>> : TYPED_GQL_STRING extends GeneratedSubscription<infer IN, infer SUB_OUT> ? GraphqlSubscriptionResult<NeverEmpty<SUB_OUT>> : FALLBACK_TYPE extends GraphQLQuery<infer T> ? Promise<GraphQLResult<FALLBACK_TYPE>> : FALLBACK_TYPE extends GraphQLSubscription<infer T> ? GraphqlSubscriptionResult<FALLBACK_TYPE> : FALLBACK_TYPE extends GraphQLOperationType<infer IN, infer CUSTOM_OUT> ? CUSTOM_OUT : UnknownGraphQLResponse;
196
+ export type GraphQLResponseV6<FALLBACK_TYPE = unknown, TYPED_GQL_STRING extends string = string> = TYPED_GQL_STRING extends GeneratedQuery<infer IN, infer QUERY_OUT> ? Promise<GraphQLResult<FixedQueryResult<QUERY_OUT>>> : TYPED_GQL_STRING extends GeneratedMutation<infer IN, infer MUTATION_OUT> ? Promise<GraphQLResult<NeverEmpty<MUTATION_OUT>>> : TYPED_GQL_STRING extends GeneratedSubscription<infer IN, infer SUB_OUT> ? GraphqlSubscriptionResult<NeverEmpty<SUB_OUT>> : FALLBACK_TYPE extends GraphQLQuery<infer T> ? Promise<GraphQLResult<FALLBACK_TYPE>> : FALLBACK_TYPE extends GraphQLSubscription<infer T> ? GraphqlSubscriptionResult<FALLBACK_TYPE> : FALLBACK_TYPE extends GraphQLOperationType<infer IN, infer CUSTOM_OUT> ? CUSTOM_OUT : UnknownGraphQLResponse;
194
197
  /**
195
198
  * The shape customers can use to provide `T` to `graphql<T>()` to specify both
196
199
  * `IN` and `OUT` types (the type of `variables` and the return type, respectively).
@@ -209,7 +212,7 @@ export declare type GraphQLResponseV6<FALLBACK_TYPE = unknown, TYPED_GQL_STRING
209
212
  * })
210
213
  * ```
211
214
  */
212
- export declare type GraphQLOperationType<IN extends {}, OUT extends {}> = {
215
+ export type GraphQLOperationType<IN extends {}, OUT extends {}> = {
213
216
  variables: IN;
214
217
  result: OUT;
215
218
  };
@@ -229,7 +232,7 @@ export declare type GraphQLOperationType<IN extends {}, OUT extends {}> = {
229
232
  * This allows `graphql()` to extract `InputType` and `OutputType` to correctly
230
233
  * assign types to the `variables` and result objects.
231
234
  */
232
- export declare type GeneratedQuery<InputType, OutputType> = string & {
235
+ export type GeneratedQuery<InputType, OutputType> = string & {
233
236
  __generatedQueryInput: InputType;
234
237
  __generatedQueryOutput: OutputType;
235
238
  };
@@ -249,7 +252,7 @@ export declare type GeneratedQuery<InputType, OutputType> = string & {
249
252
  * This allows `graphql()` to extract `InputType` and `OutputType` to correctly
250
253
  * assign types to the `variables` and result objects.
251
254
  */
252
- export declare type GeneratedMutation<InputType, OutputType> = string & {
255
+ export type GeneratedMutation<InputType, OutputType> = string & {
253
256
  __generatedMutationInput: InputType;
254
257
  __generatedMutationOutput: OutputType;
255
258
  };
@@ -269,33 +272,50 @@ export declare type GeneratedMutation<InputType, OutputType> = string & {
269
272
  * This allows `graphql()` to extract `InputType` and `OutputType` to correctly
270
273
  * assign types to the `variables` and result objects.
271
274
  */
272
- export declare type GeneratedSubscription<InputType, OutputType> = string & {
275
+ export type GeneratedSubscription<InputType, OutputType> = string & {
273
276
  __generatedSubscriptionInput: InputType;
274
277
  __generatedSubscriptionOutput: OutputType;
275
278
  };
276
- declare type FilteredKeys<T> = {
279
+ type FilteredKeys<T> = {
277
280
  [P in keyof T]: T[P] extends never ? never : P;
278
281
  }[keyof T];
279
- declare type ExcludeNeverFields<O> = {
282
+ type ExcludeNeverFields<O> = {
280
283
  [K in FilteredKeys<O>]: O[K];
281
284
  };
282
285
  export declare const __amplify: unique symbol;
283
- export declare type V6Client<T extends Record<any, any> = never> = ExcludeNeverFields<{
286
+ export declare const __authMode: unique symbol;
287
+ export declare const __authToken: unique symbol;
288
+ export type V6Client<T extends Record<any, any> = never> = ExcludeNeverFields<{
284
289
  [__amplify]: AmplifyClassV6;
290
+ [__authMode]?: GraphQLAuthMode;
291
+ [__authToken]?: string;
285
292
  graphql: GraphQLMethod;
286
293
  cancel: (promise: Promise<any>, message?: string) => boolean;
287
294
  isCancelError: (error: any) => boolean;
295
+ models: ModelTypes<T>;
288
296
  }>;
289
- export declare type V6ClientSSR<T extends Record<any, any> = never> = ExcludeNeverFields<{
297
+ export type V6ClientSSRRequest<T extends Record<any, any> = never> = ExcludeNeverFields<{
290
298
  [__amplify]: AmplifyClassV6;
299
+ [__authMode]?: GraphQLAuthMode;
300
+ [__authToken]?: string;
291
301
  graphql: GraphQLMethodSSR;
292
302
  cancel: (promise: Promise<any>, message?: string) => boolean;
293
303
  isCancelError: (error: any) => boolean;
304
+ models: ModelTypes<T, 'REQUEST'>;
294
305
  }>;
295
- export declare type GraphQLMethod = <FALLBACK_TYPES = unknown, TYPED_GQL_STRING extends string = string>(options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING>, additionalHeaders?: {
306
+ export type V6ClientSSRCookies<T extends Record<any, any> = never> = ExcludeNeverFields<{
307
+ [__amplify]: AmplifyClassV6;
308
+ [__authMode]?: GraphQLAuthMode;
309
+ [__authToken]?: string;
310
+ graphql: GraphQLMethod;
311
+ cancel: (promise: Promise<any>, message?: string) => boolean;
312
+ isCancelError: (error: any) => boolean;
313
+ models: ModelTypes<T, 'COOKIES'>;
314
+ }>;
315
+ export type GraphQLMethod = <FALLBACK_TYPES = unknown, TYPED_GQL_STRING extends string = string>(options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING>, additionalHeaders?: {
296
316
  [key: string]: string;
297
317
  } | undefined) => GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
298
- export declare type GraphQLMethodSSR = <FALLBACK_TYPES = unknown, TYPED_GQL_STRING extends string = string>(contextSpec: AmplifyServer.ContextSpec, options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING>, additionalHeaders?: {
318
+ export type GraphQLMethodSSR = <FALLBACK_TYPES = unknown, TYPED_GQL_STRING extends string = string>(contextSpec: AmplifyServer.ContextSpec, options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING>, additionalHeaders?: {
299
319
  [key: string]: string;
300
320
  } | undefined) => GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
301
321
  /**
@@ -303,7 +323,7 @@ export declare type GraphQLMethodSSR = <FALLBACK_TYPES = unknown, TYPED_GQL_STRI
303
323
  *
304
324
  * The knobs available for configuring `server/generateClient` internally.
305
325
  */
306
- export declare type ServerClientGenerationParams = {
307
- amplify: null | ((fn: (amplify: any) => Promise<any>) => Promise<AmplifyClassV6>);
326
+ export type ServerClientGenerationParams = {
327
+ amplify: null | ((fn: (amplify: AmplifyClassV6) => Promise<any>) => Promise<any>);
308
328
  config: ResourcesConfig;
309
329
  };
@@ -1,5 +1,6 @@
1
- export { CONTROL_MSG, ConnectionState } from './PubSub';
2
- export var GraphQLAuthError;
1
+ export { CONTROL_MSG, ConnectionState } from './PubSub.mjs';
2
+
3
+ var GraphQLAuthError;
3
4
  (function (GraphQLAuthError) {
4
5
  GraphQLAuthError["NO_API_KEY"] = "No api-key configured";
5
6
  GraphQLAuthError["NO_CURRENT_USER"] = "No current user";
@@ -7,4 +8,9 @@ export var GraphQLAuthError;
7
8
  GraphQLAuthError["NO_FEDERATED_JWT"] = "No federated jwt";
8
9
  GraphQLAuthError["NO_AUTH_TOKEN"] = "No auth token specified";
9
10
  })(GraphQLAuthError || (GraphQLAuthError = {}));
10
- export const __amplify = Symbol('amplify');
11
+ const __amplify = Symbol('amplify');
12
+ const __authMode = Symbol('authMode');
13
+ const __authToken = Symbol('authToken');
14
+
15
+ export { GraphQLAuthError, __amplify, __authMode, __authToken };
16
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":["../../../src/types/index.ts"],"sourcesContent":["export { CONTROL_MSG, ConnectionState } from './PubSub';\nexport var GraphQLAuthError;\n(function (GraphQLAuthError) {\n GraphQLAuthError[\"NO_API_KEY\"] = \"No api-key configured\";\n GraphQLAuthError[\"NO_CURRENT_USER\"] = \"No current user\";\n GraphQLAuthError[\"NO_CREDENTIALS\"] = \"No credentials\";\n GraphQLAuthError[\"NO_FEDERATED_JWT\"] = \"No federated jwt\";\n GraphQLAuthError[\"NO_AUTH_TOKEN\"] = \"No auth token specified\";\n})(GraphQLAuthError || (GraphQLAuthError = {}));\nexport const __amplify = Symbol('amplify');\nexport const __authMode = Symbol('authMode');\nexport const __authToken = Symbol('authToken');\n"],"names":[],"mappings":";;AACU,IAAC,iBAAiB;AAC5B,CAAC,UAAU,gBAAgB,EAAE;AAC7B,IAAI,gBAAgB,CAAC,YAAY,CAAC,GAAG,uBAAuB,CAAC;AAC7D,IAAI,gBAAgB,CAAC,iBAAiB,CAAC,GAAG,iBAAiB,CAAC;AAC5D,IAAI,gBAAgB,CAAC,gBAAgB,CAAC,GAAG,gBAAgB,CAAC;AAC1D,IAAI,gBAAgB,CAAC,kBAAkB,CAAC,GAAG,kBAAkB,CAAC;AAC9D,IAAI,gBAAgB,CAAC,eAAe,CAAC,GAAG,yBAAyB,CAAC;AAClE,CAAC,EAAE,gBAAgB,KAAK,gBAAgB,GAAG,EAAE,CAAC,CAAC,CAAC;AACpC,MAAC,SAAS,GAAG,MAAM,CAAC,SAAS,EAAE;AAC/B,MAAC,UAAU,GAAG,MAAM,CAAC,UAAU,EAAE;AACjC,MAAC,WAAW,GAAG,MAAM,CAAC,WAAW;;;;"}
@@ -1,8 +1,8 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import { ConnectionState } from '../types/PubSub';
3
- declare type LinkedConnectionState = 'connected' | 'disconnected';
4
- declare type LinkedHealthState = 'healthy' | 'unhealthy';
5
- declare type LinkedConnectionStates = {
3
+ type LinkedConnectionState = 'connected' | 'disconnected';
4
+ type LinkedHealthState = 'healthy' | 'unhealthy';
5
+ type LinkedConnectionStates = {
6
6
  networkState: LinkedConnectionState;
7
7
  connectionState: LinkedConnectionState | 'connecting';
8
8
  intendedConnectionState: LinkedConnectionState;
@@ -1,9 +1,10 @@
1
+ import { Observable, map, filter } from 'rxjs';
2
+ import { ConnectionState } from '../types/PubSub.mjs';
3
+ import { ReachabilityMonitor } from './ReachabilityMonitor/index.mjs';
4
+
1
5
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
6
  // SPDX-License-Identifier: Apache-2.0
3
- import { Observable, map, filter } from 'rxjs';
4
- import { ConnectionState } from '../types/PubSub';
5
- import { ReachabilityMonitor } from './ReachabilityMonitor';
6
- export const CONNECTION_CHANGE = {
7
+ const CONNECTION_CHANGE = {
7
8
  KEEP_ALIVE_MISSED: { keepAliveState: 'unhealthy' },
8
9
  KEEP_ALIVE: { keepAliveState: 'healthy' },
9
10
  CONNECTION_ESTABLISHED: { connectionState: 'connected' },
@@ -20,7 +21,7 @@ export const CONNECTION_CHANGE = {
20
21
  ONLINE: { networkState: 'connected' },
21
22
  OFFLINE: { networkState: 'disconnected' },
22
23
  };
23
- export class ConnectionStateMonitor {
24
+ class ConnectionStateMonitor {
24
25
  constructor() {
25
26
  this._networkMonitoringSubscription = undefined;
26
27
  this._linkedConnectionState = {
@@ -126,3 +127,6 @@ export class ConnectionStateMonitor {
126
127
  return ConnectionState.Connected;
127
128
  }
128
129
  }
130
+
131
+ export { CONNECTION_CHANGE, ConnectionStateMonitor };
132
+ //# sourceMappingURL=ConnectionStateMonitor.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConnectionStateMonitor.mjs","sources":["../../../src/utils/ConnectionStateMonitor.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Observable, map, filter } from 'rxjs';\nimport { ConnectionState } from '../types/PubSub';\nimport { ReachabilityMonitor } from './ReachabilityMonitor';\nexport const CONNECTION_CHANGE = {\n KEEP_ALIVE_MISSED: { keepAliveState: 'unhealthy' },\n KEEP_ALIVE: { keepAliveState: 'healthy' },\n CONNECTION_ESTABLISHED: { connectionState: 'connected' },\n CONNECTION_FAILED: {\n intendedConnectionState: 'disconnected',\n connectionState: 'disconnected',\n },\n CLOSING_CONNECTION: { intendedConnectionState: 'disconnected' },\n OPENING_CONNECTION: {\n intendedConnectionState: 'connected',\n connectionState: 'connecting',\n },\n CLOSED: { connectionState: 'disconnected' },\n ONLINE: { networkState: 'connected' },\n OFFLINE: { networkState: 'disconnected' },\n};\nexport class ConnectionStateMonitor {\n constructor() {\n this._networkMonitoringSubscription = undefined;\n this._linkedConnectionState = {\n networkState: 'connected',\n connectionState: 'disconnected',\n intendedConnectionState: 'disconnected',\n keepAliveState: 'healthy',\n };\n // Attempt to update the state with the current actual network state\n this._initialNetworkStateSubscription = ReachabilityMonitor().subscribe(({ online }) => {\n this.record(online ? CONNECTION_CHANGE.ONLINE : CONNECTION_CHANGE.OFFLINE);\n this._initialNetworkStateSubscription?.unsubscribe();\n });\n this._linkedConnectionStateObservable =\n new Observable(connectionStateObserver => {\n connectionStateObserver.next(this._linkedConnectionState);\n this._linkedConnectionStateObserver = connectionStateObserver;\n });\n }\n /**\n * Turn network state monitoring on if it isn't on already\n */\n enableNetworkMonitoring() {\n // If no initial network state was discovered, stop trying\n this._initialNetworkStateSubscription?.unsubscribe();\n // Maintain the network state based on the reachability monitor\n if (this._networkMonitoringSubscription === undefined) {\n this._networkMonitoringSubscription = ReachabilityMonitor().subscribe(({ online }) => {\n this.record(online ? CONNECTION_CHANGE.ONLINE : CONNECTION_CHANGE.OFFLINE);\n });\n }\n }\n /**\n * Turn network state monitoring off if it isn't off already\n */\n disableNetworkMonitoring() {\n this._networkMonitoringSubscription?.unsubscribe();\n this._networkMonitoringSubscription = undefined;\n }\n /**\n * Get the observable that allows us to monitor the connection state\n *\n * @returns {Observable<ConnectionState>} - The observable that emits ConnectionState updates\n */\n get connectionStateObservable() {\n let previous;\n // The linked state aggregates state changes to any of the network, connection,\n // intendedConnection and keepAliveHealth. Some states will change these independent\n // states without changing the overall connection state.\n // After translating from linked states to ConnectionState, then remove any duplicates\n return this._linkedConnectionStateObservable\n .pipe(map(value => {\n return this.connectionStatesTranslator(value);\n }))\n .pipe(filter(current => {\n const toInclude = current !== previous;\n previous = current;\n return toInclude;\n }));\n }\n /*\n * Updates local connection state and emits the full state to the observer.\n */\n record(statusUpdates) {\n // Maintain the network monitor\n if (statusUpdates.intendedConnectionState === 'connected') {\n this.enableNetworkMonitoring();\n }\n else if (statusUpdates.intendedConnectionState === 'disconnected') {\n this.disableNetworkMonitoring();\n }\n // Maintain the socket state\n const newSocketStatus = {\n ...this._linkedConnectionState,\n ...statusUpdates,\n };\n this._linkedConnectionState = { ...newSocketStatus };\n this._linkedConnectionStateObserver?.next(this._linkedConnectionState);\n }\n /*\n * Translate the ConnectionState structure into a specific ConnectionState string literal union\n */\n connectionStatesTranslator({ connectionState, networkState, intendedConnectionState, keepAliveState, }) {\n if (connectionState === 'connected' && networkState === 'disconnected')\n return ConnectionState.ConnectedPendingNetwork;\n if (connectionState === 'connected' &&\n intendedConnectionState === 'disconnected')\n return ConnectionState.ConnectedPendingDisconnect;\n if (connectionState === 'disconnected' &&\n intendedConnectionState === 'connected' &&\n networkState === 'disconnected')\n return ConnectionState.ConnectionDisruptedPendingNetwork;\n if (connectionState === 'disconnected' &&\n intendedConnectionState === 'connected')\n return ConnectionState.ConnectionDisrupted;\n if (connectionState === 'connected' && keepAliveState === 'unhealthy')\n return ConnectionState.ConnectedPendingKeepAlive;\n // All remaining states directly correspond to the connection state\n if (connectionState === 'connecting')\n return ConnectionState.Connecting;\n if (connectionState === 'disconnected')\n return ConnectionState.Disconnected;\n return ConnectionState.Connected;\n }\n}\n"],"names":[],"mappings":"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"}
@@ -0,0 +1 @@
1
+ export declare const ReachabilityMonitor: () => import("rxjs").Observable<import("@aws-amplify/core/dist/esm/Reachability/types").NetworkStatus>;
@@ -1,4 +1,8 @@
1
+ import { Reachability } 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 { Reachability } from '@aws-amplify/core/internals/utils';
4
- export const ReachabilityMonitor = () => new Reachability().networkMonitor();
5
+ const ReachabilityMonitor = () => new Reachability().networkMonitor();
6
+
7
+ export { ReachabilityMonitor };
8
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":["../../../../src/utils/ReachabilityMonitor/index.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Reachability } from '@aws-amplify/core/internals/utils';\nexport const ReachabilityMonitor = () => new Reachability().networkMonitor();\n"],"names":[],"mappings":";;AAAA;AACA;AAEY,MAAC,mBAAmB,GAAG,MAAM,IAAI,YAAY,EAAE,CAAC,cAAc;;;;"}
@@ -0,0 +1 @@
1
+ export declare const ReachabilityMonitor: () => import("rxjs").Observable<import("@aws-amplify/core/dist/esm/Reachability/types").NetworkStatus>;
@@ -0,0 +1,9 @@
1
+ import { Reachability } from '@aws-amplify/core/internals/utils';
2
+ import NetInfo from '@react-native-community/netinfo';
3
+
4
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ // SPDX-License-Identifier: Apache-2.0
6
+ const ReachabilityMonitor = () => new Reachability().networkMonitor(NetInfo);
7
+
8
+ export { ReachabilityMonitor };
9
+ //# sourceMappingURL=index.native.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.native.mjs","sources":["../../../../src/utils/ReachabilityMonitor/index.native.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Reachability } from '@aws-amplify/core/internals/utils';\nimport { default as NetInfo } from '@react-native-community/netinfo';\nexport const ReachabilityMonitor = () => new Reachability().networkMonitor(NetInfo);\n"],"names":[],"mappings":";;;AAAA;AACA;AAGY,MAAC,mBAAmB,GAAG,MAAM,IAAI,YAAY,EAAE,CAAC,cAAc,CAAC,OAAO;;;;"}
@@ -1,5 +1,6 @@
1
- import { RECONNECT_DELAY, RECONNECT_INTERVAL } from '../Providers/constants';
2
- export var ReconnectEvent;
1
+ import { RECONNECT_INTERVAL, RECONNECT_DELAY } from '../Providers/constants.mjs';
2
+
3
+ var ReconnectEvent;
3
4
  (function (ReconnectEvent) {
4
5
  ReconnectEvent["START_RECONNECT"] = "START_RECONNECT";
5
6
  ReconnectEvent["HALT_RECONNECT"] = "HALT_RECONNECT";
@@ -10,7 +11,7 @@ export var ReconnectEvent;
10
11
  * Attempting to reconnect only once creates unrecoverable states when the network state isn't
11
12
  * supported by the browser, so this keeps retrying every minute until halted.
12
13
  */
13
- export class ReconnectionMonitor {
14
+ class ReconnectionMonitor {
14
15
  constructor() {
15
16
  this.reconnectObservers = [];
16
17
  }
@@ -63,3 +64,6 @@ export class ReconnectionMonitor {
63
64
  });
64
65
  }
65
66
  }
67
+
68
+ export { ReconnectEvent, ReconnectionMonitor };
69
+ //# sourceMappingURL=ReconnectionMonitor.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReconnectionMonitor.mjs","sources":["../../../src/utils/ReconnectionMonitor.ts"],"sourcesContent":["import { RECONNECT_DELAY, RECONNECT_INTERVAL } from '../Providers/constants';\nexport var ReconnectEvent;\n(function (ReconnectEvent) {\n ReconnectEvent[\"START_RECONNECT\"] = \"START_RECONNECT\";\n ReconnectEvent[\"HALT_RECONNECT\"] = \"HALT_RECONNECT\";\n})(ReconnectEvent || (ReconnectEvent = {}));\n/**\n * Captures the reconnect event logic used to determine when to reconnect to PubSub providers.\n * Reconnnect attempts are delayed by 5 seconds to let the interface settle.\n * Attempting to reconnect only once creates unrecoverable states when the network state isn't\n * supported by the browser, so this keeps retrying every minute until halted.\n */\nexport class ReconnectionMonitor {\n constructor() {\n this.reconnectObservers = [];\n }\n /**\n * Add reconnect observer to the list of observers to alert on reconnect\n */\n addObserver(reconnectObserver) {\n this.reconnectObservers.push(reconnectObserver);\n }\n /**\n * Given a reconnect event, start the appropriate behavior\n */\n record(event) {\n if (event === ReconnectEvent.START_RECONNECT) {\n // If the reconnection hasn't been started\n if (this.reconnectSetTimeoutId === undefined &&\n this.reconnectIntervalId === undefined) {\n this.reconnectSetTimeoutId = setTimeout(() => {\n // Reconnect now\n this._triggerReconnect();\n // Retry reconnect every periodically until it works\n this.reconnectIntervalId = setInterval(() => {\n this._triggerReconnect();\n }, RECONNECT_INTERVAL);\n }, RECONNECT_DELAY);\n }\n }\n if (event === ReconnectEvent.HALT_RECONNECT) {\n if (this.reconnectIntervalId) {\n clearInterval(this.reconnectIntervalId);\n this.reconnectIntervalId = undefined;\n }\n if (this.reconnectSetTimeoutId) {\n clearTimeout(this.reconnectSetTimeoutId);\n this.reconnectSetTimeoutId = undefined;\n }\n }\n }\n /**\n * Complete all reconnect observers\n */\n close() {\n this.reconnectObservers.forEach(reconnectObserver => {\n reconnectObserver.complete?.();\n });\n }\n _triggerReconnect() {\n this.reconnectObservers.forEach(reconnectObserver => {\n reconnectObserver.next?.();\n });\n }\n}\n"],"names":[],"mappings":";;AACU,IAAC,eAAe;AAC1B,CAAC,UAAU,cAAc,EAAE;AAC3B,IAAI,cAAc,CAAC,iBAAiB,CAAC,GAAG,iBAAiB,CAAC;AAC1D,IAAI,cAAc,CAAC,gBAAgB,CAAC,GAAG,gBAAgB,CAAC;AACxD,CAAC,EAAE,cAAc,KAAK,cAAc,GAAG,EAAE,CAAC,CAAC,CAAC;AAC5C;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,mBAAmB,CAAC;AACjC,IAAI,WAAW,GAAG;AAClB,QAAQ,IAAI,CAAC,kBAAkB,GAAG,EAAE,CAAC;AACrC,KAAK;AACL;AACA;AACA;AACA,IAAI,WAAW,CAAC,iBAAiB,EAAE;AACnC,QAAQ,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;AACxD,KAAK;AACL;AACA;AACA;AACA,IAAI,MAAM,CAAC,KAAK,EAAE;AAClB,QAAQ,IAAI,KAAK,KAAK,cAAc,CAAC,eAAe,EAAE;AACtD;AACA,YAAY,IAAI,IAAI,CAAC,qBAAqB,KAAK,SAAS;AACxD,gBAAgB,IAAI,CAAC,mBAAmB,KAAK,SAAS,EAAE;AACxD,gBAAgB,IAAI,CAAC,qBAAqB,GAAG,UAAU,CAAC,MAAM;AAC9D;AACA,oBAAoB,IAAI,CAAC,iBAAiB,EAAE,CAAC;AAC7C;AACA,oBAAoB,IAAI,CAAC,mBAAmB,GAAG,WAAW,CAAC,MAAM;AACjE,wBAAwB,IAAI,CAAC,iBAAiB,EAAE,CAAC;AACjD,qBAAqB,EAAE,kBAAkB,CAAC,CAAC;AAC3C,iBAAiB,EAAE,eAAe,CAAC,CAAC;AACpC,aAAa;AACb,SAAS;AACT,QAAQ,IAAI,KAAK,KAAK,cAAc,CAAC,cAAc,EAAE;AACrD,YAAY,IAAI,IAAI,CAAC,mBAAmB,EAAE;AAC1C,gBAAgB,aAAa,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;AACxD,gBAAgB,IAAI,CAAC,mBAAmB,GAAG,SAAS,CAAC;AACrD,aAAa;AACb,YAAY,IAAI,IAAI,CAAC,qBAAqB,EAAE;AAC5C,gBAAgB,YAAY,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;AACzD,gBAAgB,IAAI,CAAC,qBAAqB,GAAG,SAAS,CAAC;AACvD,aAAa;AACb,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA,IAAI,KAAK,GAAG;AACZ,QAAQ,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,iBAAiB,IAAI;AAC7D,YAAY,iBAAiB,CAAC,QAAQ,IAAI,CAAC;AAC3C,SAAS,CAAC,CAAC;AACX,KAAK;AACL,IAAI,iBAAiB,GAAG;AACxB,QAAQ,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,iBAAiB,IAAI;AAC7D,YAAY,iBAAiB,CAAC,IAAI,IAAI,CAAC;AACvC,SAAS,CAAC,CAAC;AACX,KAAK;AACL;;;;"}