@aws-amplify/api-graphql 4.0.29-unstable.390c159.0 → 4.0.29-unstable.8b21eae.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 (129) hide show
  1. package/dist/cjs/internals/generateClient.js +4 -14
  2. package/dist/cjs/internals/generateClient.js.map +1 -1
  3. package/dist/cjs/internals/server/generateClientWithAmplifyInstance.js +3 -8
  4. package/dist/cjs/internals/server/generateClientWithAmplifyInstance.js.map +1 -1
  5. package/dist/cjs/internals/v6.js +6 -3
  6. package/dist/cjs/internals/v6.js.map +1 -1
  7. package/dist/cjs/types/index.js +11 -1
  8. package/dist/cjs/types/index.js.map +1 -1
  9. package/dist/cjs/utils/index.js +1 -5
  10. package/dist/cjs/utils/index.js.map +1 -1
  11. package/dist/esm/GraphQLAPI.d.ts +1 -1
  12. package/dist/esm/Providers/AWSAppSyncRealTimeProvider/index.d.ts +1 -1
  13. package/dist/esm/index.mjs +1 -1
  14. package/dist/esm/internals/InternalGraphQLAPI.d.ts +1 -1
  15. package/dist/esm/internals/generateClient.mjs +5 -15
  16. package/dist/esm/internals/generateClient.mjs.map +1 -1
  17. package/dist/esm/internals/server/generateClientWithAmplifyInstance.mjs +4 -9
  18. package/dist/esm/internals/server/generateClientWithAmplifyInstance.mjs.map +1 -1
  19. package/dist/esm/internals/types.d.ts +1 -1
  20. package/dist/esm/internals/v6.d.ts +1 -1
  21. package/dist/esm/internals/v6.mjs +7 -4
  22. package/dist/esm/internals/v6.mjs.map +1 -1
  23. package/dist/esm/types/index.d.ts +10 -40
  24. package/dist/esm/types/index.mjs +10 -1
  25. package/dist/esm/types/index.mjs.map +1 -1
  26. package/dist/esm/utils/index.d.ts +0 -2
  27. package/dist/esm/utils/index.mjs +0 -2
  28. package/dist/esm/utils/index.mjs.map +1 -1
  29. package/package.json +5 -6
  30. package/src/GraphQLAPI.ts +1 -1
  31. package/src/Providers/AWSAppSyncRealTimeProvider/index.ts +4 -1
  32. package/src/internals/InternalGraphQLAPI.ts +4 -1
  33. package/src/internals/generateClient.ts +8 -36
  34. package/src/internals/server/generateClientWithAmplifyInstance.ts +6 -16
  35. package/src/internals/types.ts +1 -1
  36. package/src/internals/v6.ts +7 -7
  37. package/src/server/generateClient.ts +1 -1
  38. package/src/types/index.ts +36 -60
  39. package/src/utils/index.ts +0 -2
  40. package/dist/cjs/internals/APIClient.js +0 -719
  41. package/dist/cjs/internals/APIClient.js.map +0 -1
  42. package/dist/cjs/internals/clientUtils.js +0 -29
  43. package/dist/cjs/internals/clientUtils.js.map +0 -1
  44. package/dist/cjs/internals/generateCustomOperationsProperty.js +0 -50
  45. package/dist/cjs/internals/generateCustomOperationsProperty.js.map +0 -1
  46. package/dist/cjs/internals/operations/custom.js +0 -356
  47. package/dist/cjs/internals/operations/custom.js.map +0 -1
  48. package/dist/cjs/internals/operations/get.js +0 -62
  49. package/dist/cjs/internals/operations/get.js.map +0 -1
  50. package/dist/cjs/internals/operations/indexQuery.js +0 -75
  51. package/dist/cjs/internals/operations/indexQuery.js.map +0 -1
  52. package/dist/cjs/internals/operations/list.js +0 -74
  53. package/dist/cjs/internals/operations/list.js.map +0 -1
  54. package/dist/cjs/internals/operations/observeQuery.js +0 -121
  55. package/dist/cjs/internals/operations/observeQuery.js.map +0 -1
  56. package/dist/cjs/internals/operations/subscription.js +0 -31
  57. package/dist/cjs/internals/operations/subscription.js.map +0 -1
  58. package/dist/cjs/internals/server/generateModelsProperty.js +0 -53
  59. package/dist/cjs/internals/server/generateModelsProperty.js.map +0 -1
  60. package/dist/cjs/internals/utils/clientProperties/generateEnumsProperty.js +0 -21
  61. package/dist/cjs/internals/utils/clientProperties/generateEnumsProperty.js.map +0 -1
  62. package/dist/cjs/internals/utils/clientProperties/generateModelsProperty.js +0 -45
  63. package/dist/cjs/internals/utils/clientProperties/generateModelsProperty.js.map +0 -1
  64. package/dist/cjs/utils/findIndexByFields.js +0 -25
  65. package/dist/cjs/utils/findIndexByFields.js.map +0 -1
  66. package/dist/cjs/utils/resolveOwnerFields.js +0 -48
  67. package/dist/cjs/utils/resolveOwnerFields.js.map +0 -1
  68. package/dist/cjs/utils/resolvePKFields.js +0 -17
  69. package/dist/cjs/utils/resolvePKFields.js.map +0 -1
  70. package/dist/esm/internals/APIClient.d.ts +0 -126
  71. package/dist/esm/internals/APIClient.mjs +0 -707
  72. package/dist/esm/internals/APIClient.mjs.map +0 -1
  73. package/dist/esm/internals/clientUtils.d.ts +0 -6
  74. package/dist/esm/internals/clientUtils.mjs +0 -26
  75. package/dist/esm/internals/clientUtils.mjs.map +0 -1
  76. package/dist/esm/internals/generateCustomOperationsProperty.d.ts +0 -9
  77. package/dist/esm/internals/generateCustomOperationsProperty.mjs +0 -45
  78. package/dist/esm/internals/generateCustomOperationsProperty.mjs.map +0 -1
  79. package/dist/esm/internals/operations/custom.d.ts +0 -63
  80. package/dist/esm/internals/operations/custom.mjs +0 -354
  81. package/dist/esm/internals/operations/custom.mjs.map +0 -1
  82. package/dist/esm/internals/operations/get.d.ts +0 -5
  83. package/dist/esm/internals/operations/get.mjs +0 -60
  84. package/dist/esm/internals/operations/get.mjs.map +0 -1
  85. package/dist/esm/internals/operations/indexQuery.d.ts +0 -9
  86. package/dist/esm/internals/operations/indexQuery.mjs +0 -73
  87. package/dist/esm/internals/operations/indexQuery.mjs.map +0 -1
  88. package/dist/esm/internals/operations/list.d.ts +0 -4
  89. package/dist/esm/internals/operations/list.mjs +0 -72
  90. package/dist/esm/internals/operations/list.mjs.map +0 -1
  91. package/dist/esm/internals/operations/observeQuery.d.ts +0 -3
  92. package/dist/esm/internals/operations/observeQuery.mjs +0 -121
  93. package/dist/esm/internals/operations/observeQuery.mjs.map +0 -1
  94. package/dist/esm/internals/operations/subscription.d.ts +0 -3
  95. package/dist/esm/internals/operations/subscription.mjs +0 -29
  96. package/dist/esm/internals/operations/subscription.mjs.map +0 -1
  97. package/dist/esm/internals/server/generateModelsProperty.d.ts +0 -3
  98. package/dist/esm/internals/server/generateModelsProperty.mjs +0 -51
  99. package/dist/esm/internals/server/generateModelsProperty.mjs.map +0 -1
  100. package/dist/esm/internals/utils/clientProperties/generateEnumsProperty.d.ts +0 -3
  101. package/dist/esm/internals/utils/clientProperties/generateEnumsProperty.mjs +0 -18
  102. package/dist/esm/internals/utils/clientProperties/generateEnumsProperty.mjs.map +0 -1
  103. package/dist/esm/internals/utils/clientProperties/generateModelsProperty.d.ts +0 -4
  104. package/dist/esm/internals/utils/clientProperties/generateModelsProperty.mjs +0 -43
  105. package/dist/esm/internals/utils/clientProperties/generateModelsProperty.mjs.map +0 -1
  106. package/dist/esm/utils/findIndexByFields.d.ts +0 -9
  107. package/dist/esm/utils/findIndexByFields.mjs +0 -22
  108. package/dist/esm/utils/findIndexByFields.mjs.map +0 -1
  109. package/dist/esm/utils/resolveOwnerFields.d.ts +0 -12
  110. package/dist/esm/utils/resolveOwnerFields.mjs +0 -45
  111. package/dist/esm/utils/resolveOwnerFields.mjs.map +0 -1
  112. package/dist/esm/utils/resolvePKFields.d.ts +0 -13
  113. package/dist/esm/utils/resolvePKFields.mjs +0 -14
  114. package/dist/esm/utils/resolvePKFields.mjs.map +0 -1
  115. package/src/internals/APIClient.ts +0 -1058
  116. package/src/internals/clientUtils.ts +0 -37
  117. package/src/internals/generateCustomOperationsProperty.ts +0 -112
  118. package/src/internals/operations/custom.ts +0 -492
  119. package/src/internals/operations/get.ts +0 -140
  120. package/src/internals/operations/indexQuery.ts +0 -170
  121. package/src/internals/operations/list.ts +0 -135
  122. package/src/internals/operations/observeQuery.ts +0 -146
  123. package/src/internals/operations/subscription.ts +0 -75
  124. package/src/internals/server/generateModelsProperty.ts +0 -97
  125. package/src/internals/utils/clientProperties/generateEnumsProperty.ts +0 -34
  126. package/src/internals/utils/clientProperties/generateModelsProperty.ts +0 -81
  127. package/src/utils/findIndexByFields.ts +0 -31
  128. package/src/utils/resolveOwnerFields.ts +0 -77
  129. package/src/utils/resolvePKFields.ts +0 -23
@@ -5,13 +5,11 @@ exports.generateClient = void 0;
5
5
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
6
6
  // SPDX-License-Identifier: Apache-2.0
7
7
  const core_1 = require("@aws-amplify/core");
8
+ const runtime_1 = require("@aws-amplify/data-schema/runtime");
8
9
  const types_1 = require("../types");
9
- const v6_1 = require("./v6");
10
- const generateEnumsProperty_1 = require("./utils/clientProperties/generateEnumsProperty");
11
- const generateModelsProperty_1 = require("./utils/clientProperties/generateModelsProperty");
12
10
  const isApiGraphQLProviderConfig_1 = require("./utils/runtimeTypeGuards/isApiGraphQLProviderConfig");
13
- const generateCustomOperationsProperty_1 = require("./generateCustomOperationsProperty");
14
11
  const isConfigureEventWithResourceConfig_1 = require("./utils/runtimeTypeGuards/isConfigureEventWithResourceConfig");
12
+ const v6_1 = require("./v6");
15
13
  /**
16
14
  * @private
17
15
  *
@@ -38,11 +36,7 @@ function generateClient(params) {
38
36
  };
39
37
  const apiGraphqlConfig = params.amplify.getConfig().API?.GraphQL;
40
38
  if ((0, isApiGraphQLProviderConfig_1.isApiGraphQLConfig)(apiGraphqlConfig)) {
41
- client.models = (0, generateModelsProperty_1.generateModelsProperty)(client, apiGraphqlConfig);
42
- client.enums = (0, generateEnumsProperty_1.generateEnumsProperty)(apiGraphqlConfig);
43
- client.queries = (0, generateCustomOperationsProperty_1.generateCustomQueriesProperty)(client, apiGraphqlConfig);
44
- client.mutations = (0, generateCustomOperationsProperty_1.generateCustomMutationsProperty)(client, apiGraphqlConfig);
45
- client.subscriptions = (0, generateCustomOperationsProperty_1.generateCustomSubscriptionsProperty)(client, apiGraphqlConfig);
39
+ (0, runtime_1.addSchemaToClient)(client, apiGraphqlConfig, types_1.getInternals);
46
40
  }
47
41
  else {
48
42
  // This happens when the `Amplify.configure()` call gets evaluated after the `generateClient()` call.
@@ -69,11 +63,7 @@ const generateModelsPropertyOnAmplifyConfigure = (clientRef) => {
69
63
  }
70
64
  const apiGraphQLConfig = coreEvent.payload.data.API?.GraphQL;
71
65
  if ((0, isApiGraphQLProviderConfig_1.isApiGraphQLConfig)(apiGraphQLConfig)) {
72
- clientRef.models = (0, generateModelsProperty_1.generateModelsProperty)(clientRef, apiGraphQLConfig);
73
- clientRef.enums = (0, generateEnumsProperty_1.generateEnumsProperty)(apiGraphQLConfig);
74
- clientRef.queries = (0, generateCustomOperationsProperty_1.generateCustomQueriesProperty)(clientRef, apiGraphQLConfig);
75
- clientRef.mutations = (0, generateCustomOperationsProperty_1.generateCustomMutationsProperty)(clientRef, apiGraphQLConfig);
76
- clientRef.subscriptions = (0, generateCustomOperationsProperty_1.generateCustomSubscriptionsProperty)(clientRef, apiGraphQLConfig);
66
+ (0, runtime_1.addSchemaToClient)(clientRef, apiGraphQLConfig, types_1.getInternals);
77
67
  }
78
68
  });
79
69
  };
@@ -1 +1 @@
1
- {"version":3,"file":"generateClient.js","sources":["../../../src/internals/generateClient.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.generateClient = 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 types_1 = require(\"../types\");\nconst v6_1 = require(\"./v6\");\nconst generateEnumsProperty_1 = require(\"./utils/clientProperties/generateEnumsProperty\");\nconst generateModelsProperty_1 = require(\"./utils/clientProperties/generateModelsProperty\");\nconst isApiGraphQLProviderConfig_1 = require(\"./utils/runtimeTypeGuards/isApiGraphQLProviderConfig\");\nconst generateCustomOperationsProperty_1 = require(\"./generateCustomOperationsProperty\");\nconst isConfigureEventWithResourceConfig_1 = require(\"./utils/runtimeTypeGuards/isConfigureEventWithResourceConfig\");\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.__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 ((0, isApiGraphQLProviderConfig_1.isApiGraphQLConfig)(apiGraphqlConfig)) {\n client.models = (0, generateModelsProperty_1.generateModelsProperty)(client, apiGraphqlConfig);\n client.enums = (0, generateEnumsProperty_1.generateEnumsProperty)(apiGraphqlConfig);\n client.queries = (0, generateCustomOperationsProperty_1.generateCustomQueriesProperty)(client, apiGraphqlConfig);\n client.mutations = (0, generateCustomOperationsProperty_1.generateCustomMutationsProperty)(client, apiGraphqlConfig);\n client.subscriptions = (0, generateCustomOperationsProperty_1.generateCustomSubscriptionsProperty)(client, apiGraphqlConfig);\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 return client;\n}\nexports.generateClient = generateClient;\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 clientRef.models = (0, generateModelsProperty_1.generateModelsProperty)(clientRef, apiGraphQLConfig);\n clientRef.enums = (0, generateEnumsProperty_1.generateEnumsProperty)(apiGraphQLConfig);\n clientRef.queries = (0, generateCustomOperationsProperty_1.generateCustomQueriesProperty)(clientRef, apiGraphQLConfig);\n clientRef.mutations = (0, generateCustomOperationsProperty_1.generateCustomMutationsProperty)(clientRef, apiGraphQLConfig);\n clientRef.subscriptions = (0, generateCustomOperationsProperty_1.generateCustomSubscriptionsProperty)(clientRef, apiGraphQLConfig);\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,CAAC;AAC9D,OAAO,CAAC,cAAc,GAAG,KAAK,CAAC,CAAC;AAChC;AACA;AACA,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAC5C,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACpC,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC7B,MAAM,uBAAuB,GAAG,OAAO,CAAC,gDAAgD,CAAC,CAAC;AAC1F,MAAM,wBAAwB,GAAG,OAAO,CAAC,iDAAiD,CAAC,CAAC;AAC5F,MAAM,4BAA4B,GAAG,OAAO,CAAC,sDAAsD,CAAC,CAAC;AACrG,MAAM,kCAAkC,GAAG,OAAO,CAAC,oCAAoC,CAAC,CAAC;AACzF,MAAM,oCAAoC,GAAG,OAAO,CAAC,8DAA8D,CAAC,CAAC;AACrH;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,OA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iO,CAAC,CAAC;AAC3P,KAAK;AACL,CAAC,CAAC;;"}
1
+ {"version":3,"file":"generateClient.js","sources":["../../../src/internals/generateClient.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.generateClient = 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 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.__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 ((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 return client;\n}\nexports.generateClient = generateClient;\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,CAAC;AAC9D,OAAO,CAAC,cAAc,GAAG,KAAK,CAAC,CAAC;AAChC;AACA;AACA,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAC5C,MAAM,SAAS,GAAG,OAAO,CAAC,kCAAkC,CAAC,CAAC;AAC9D,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACpC,MAAM,4BAA4B,GAAG,OAAO,CAAC,sDAAsD,CAAC,CAAC;AACrG,MAAM,oCAAoC,GAAG,OAAO,CAAC,8DAA8D,CAAC,CAAC;AACrH,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC7B;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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AAQ,MAAM,gBAAgB,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC;AACrE,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,CAAC;AAChG,SAAS;AACT,KAAK,CAAC,CAAC;AACP,CAAC,CAAC;AACF,MAAM,aAAa,GAAG,IAAI,KAAK,CAAC,EAAE,EAAE;AACpC,IAAI,GAAG,GAAG;AACV,QAAQ,MAAM,IAAI,KAAK,CAAC,iOAAiO,CAAC,CAAC;AAC3P,KAAK;AACL,CAAC,CAAC;;"}
@@ -4,12 +4,10 @@
4
4
  // SPDX-License-Identifier: Apache-2.0
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.generateClientWithAmplifyInstance = void 0;
7
- const __1 = require("..");
7
+ const runtime_1 = require("@aws-amplify/data-schema/runtime");
8
8
  const types_1 = require("../../types");
9
9
  const isApiGraphQLProviderConfig_1 = require("../utils/runtimeTypeGuards/isApiGraphQLProviderConfig");
10
- const generateEnumsProperty_1 = require("../utils/clientProperties/generateEnumsProperty");
11
- const generateCustomOperationsProperty_1 = require("../generateCustomOperationsProperty");
12
- const generateModelsProperty_1 = require("./generateModelsProperty");
10
+ const __1 = require("..");
13
11
  /**
14
12
  * @private
15
13
  *
@@ -33,10 +31,7 @@ function generateClientWithAmplifyInstance(params) {
33
31
  };
34
32
  const apiGraphqlConfig = params.config?.API?.GraphQL;
35
33
  if ((0, isApiGraphQLProviderConfig_1.isApiGraphQLConfig)(apiGraphqlConfig)) {
36
- client.models = (0, generateModelsProperty_1.generateModelsProperty)(client, params);
37
- client.enums = (0, generateEnumsProperty_1.generateEnumsProperty)(apiGraphqlConfig);
38
- client.queries = (0, generateCustomOperationsProperty_1.generateCustomQueriesProperty)(client, apiGraphqlConfig);
39
- client.mutations = (0, generateCustomOperationsProperty_1.generateCustomMutationsProperty)(client, apiGraphqlConfig);
34
+ (0, runtime_1.addSchemaToClientWithInstance)(client, params, types_1.getInternals);
40
35
  }
41
36
  return client;
42
37
  }
@@ -1 +1 @@
1
- {"version":3,"file":"generateClientWithAmplifyInstance.js","sources":["../../../../src/internals/server/generateClientWithAmplifyInstance.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.generateClientWithAmplifyInstance = void 0;\nconst __1 = require(\"..\");\nconst types_1 = require(\"../../types\");\nconst isApiGraphQLProviderConfig_1 = require(\"../utils/runtimeTypeGuards/isApiGraphQLProviderConfig\");\nconst generateEnumsProperty_1 = require(\"../utils/clientProperties/generateEnumsProperty\");\nconst generateCustomOperationsProperty_1 = require(\"../generateCustomOperationsProperty\");\nconst generateModelsProperty_1 = require(\"./generateModelsProperty\");\n/**\n * @private\n *\n * Used internally by `adapter-nextjs` package.\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 generateClientWithAmplifyInstance(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.__headers]: params.headers,\n graphql: __1.graphql,\n cancel: __1.cancel,\n isCancelError: __1.isCancelError,\n };\n const apiGraphqlConfig = params.config?.API?.GraphQL;\n if ((0, isApiGraphQLProviderConfig_1.isApiGraphQLConfig)(apiGraphqlConfig)) {\n client.models = (0, generateModelsProperty_1.generateModelsProperty)(client, params);\n client.enums = (0, generateEnumsProperty_1.generateEnumsProperty)(apiGraphqlConfig);\n client.queries = (0, generateCustomOperationsProperty_1.generateCustomQueriesProperty)(client, apiGraphqlConfig);\n client.mutations = (0, generateCustomOperationsProperty_1.generateCustomMutationsProperty)(client, apiGraphqlConfig);\n }\n return client;\n}\nexports.generateClientWithAmplifyInstance = generateClientWithAmplifyInstance;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,iCAAiC,GAAG,KAAK,CAAC,CAAC;AACnD,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAC1B,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AACvC,MAAM,4BAA4B,GAAG,OAAO,CAAC,uDAAuD,CAAC,CAAC;AACtG,MAAM,uBAAuB,GAAG,OAAO,CAAC,iDAAiD,CAAC,CAAC;AAC3F,MAAM,kCAAkC,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC;AAC1F,MAAM,wBAAwB,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,iCAAiC,CAAC,MAAM,EAAE;AACnD,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,SAAS,GAAG,MAAM,CAAC,OAAO;AAC3C,QAAQ,OAAO,EAAE,GAAG,CAAC,OAAO;AAC5B,QAAQ,MAAM,EAAE,GAAG,CAAC,MAAM;AAC1B,QAAQ,aAAa,EAAE,GAAG,CAAC,aAAa;AACxC,KAAK,CAAC;AACN,IAAI,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,CAAC;AACzD,IAAI,IAAI,IAAI,4BAA4B,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,EAAE;AAChF,QAAQ,MAAM,CAAC,MAAM,GAAG,IAAI,wBAAwB,CAAC,sBAAsB,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAC7F,QAAQ,MAAM,CAAC,KAAK,GAAG,IAAI,uBAAuB,CAAC,qBAAqB,EAAE,gBAAgB,CAAC,CAAC;AAC5F,QAAQ,MAAM,CAAC,OAAO,GAAG,IAAI,kCAAkC,CAAC,6BAA6B,EAAE,MAAM,EAAE,gBAAgB,CAAC,CAAC;AACzH,QAAQ,MAAM,CAAC,SAAS,GAAG,IAAI,kCAAkC,CAAC,+BAA+B,EAAE,MAAM,EAAE,gBAAgB,CAAC,CAAC;AAC7H,KAAK;AACL,IAAI,OAAO,MAAM,CAAC;AAClB,CAAC;AACD,OAAO,CAAC,iCAAiC,GAAG,iCAAiC;;"}
1
+ {"version":3,"file":"generateClientWithAmplifyInstance.js","sources":["../../../../src/internals/server/generateClientWithAmplifyInstance.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.generateClientWithAmplifyInstance = void 0;\nconst runtime_1 = require(\"@aws-amplify/data-schema/runtime\");\nconst types_1 = require(\"../../types\");\nconst isApiGraphQLProviderConfig_1 = require(\"../utils/runtimeTypeGuards/isApiGraphQLProviderConfig\");\nconst __1 = require(\"..\");\n/**\n * @private\n *\n * Used internally by `adapter-nextjs` package.\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 generateClientWithAmplifyInstance(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.__headers]: params.headers,\n graphql: __1.graphql,\n cancel: __1.cancel,\n isCancelError: __1.isCancelError,\n };\n const apiGraphqlConfig = params.config?.API?.GraphQL;\n if ((0, isApiGraphQLProviderConfig_1.isApiGraphQLConfig)(apiGraphqlConfig)) {\n (0, runtime_1.addSchemaToClientWithInstance)(client, params, types_1.getInternals);\n }\n return client;\n}\nexports.generateClientWithAmplifyInstance = generateClientWithAmplifyInstance;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,iCAAiC,GAAG,KAAK,CAAC,CAAC;AACnD,MAAM,SAAS,GAAG,OAAO,CAAC,kCAAkC,CAAC,CAAC;AAC9D,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AACvC,MAAM,4BAA4B,GAAG,OAAO,CAAC,uDAAuD,CAAC,CAAC;AACtG,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,iCAAiC,CAAC,MAAM,EAAE;AACnD,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,SAAS,GAAG,MAAM,CAAC,OAAO;AAC3C,QAAQ,OAAO,EAAE,GAAG,CAAC,OAAO;AAC5B,QAAQ,MAAM,EAAE,GAAG,CAAC,MAAM;AAC1B,QAAQ,aAAa,EAAE,GAAG,CAAC,aAAa;AACxC,KAAK,CAAC;AACN,IAAI,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,CAAC;AACzD,IAAI,IAAI,IAAI,4BAA4B,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,EAAE;AAChF,QAAQ,IAAI,SAAS,CAAC,6BAA6B,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;AAC3F,KAAK;AACL,IAAI,OAAO,MAAM,CAAC;AAClB,CAAC;AACD,OAAO,CAAC,iCAAiC,GAAG,iCAAiC;;"}
@@ -90,14 +90,17 @@ const types_1 = require("../types");
90
90
  */
91
91
  function graphql(options, additionalHeaders) {
92
92
  // inject client-level auth
93
- options.authMode = options.authMode || this[types_1.__authMode];
94
- options.authToken = options.authToken || this[types_1.__authToken];
93
+ const internals = (0, types_1.getInternals)(this);
94
+ options.authMode = options.authMode || internals.authMode;
95
+ options.authToken = options.authToken || internals.authToken;
95
96
  /**
96
97
  * The correctness of these typings depends on correct string branding or overrides.
97
98
  * Neither of these can actually be validated at runtime. Hence, we don't perform
98
99
  * any validation or type-guarding here.
99
100
  */
100
- const result = GraphQLAPI_1.GraphQLAPI.graphql(this[types_1.__amplify], options, additionalHeaders);
101
+ const result = GraphQLAPI_1.GraphQLAPI.graphql(
102
+ // TODO: move V6Client back into this package?
103
+ internals.amplify, options, additionalHeaders);
101
104
  return result;
102
105
  }
103
106
  exports.graphql = graphql;
@@ -1 +1 @@
1
- {"version":3,"file":"v6.js","sources":["../../../src/internals/v6.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isCancelError = exports.cancel = exports.graphql = void 0;\nconst GraphQLAPI_1 = require(\"../GraphQLAPI\");\nconst types_1 = require(\"../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 */\nfunction graphql(options, additionalHeaders) {\n // inject client-level auth\n options.authMode = options.authMode || this[types_1.__authMode];\n options.authToken = options.authToken || this[types_1.__authToken];\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_1.GraphQLAPI.graphql(this[types_1.__amplify], options, additionalHeaders);\n return result;\n}\nexports.graphql = graphql;\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 */\nfunction cancel(promise, message) {\n return GraphQLAPI_1.GraphQLAPI.cancel(promise, message);\n}\nexports.cancel = cancel;\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 */\nfunction isCancelError(error) {\n return GraphQLAPI_1.GraphQLAPI.isCancelError(error);\n}\nexports.isCancelError = isCancelError;\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC;AAClE,MAAM,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AAC9C,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACpC;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;AACA,SAAS,OAAO,CAAC,OAAO,EAAE,iBAAiB,EAAE;AAC7C;AACA,IAAI,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AACpE,IAAI,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;AACvE;AACA;AACA;AACA;AACA;AACA,IAAI,MAAM,MAAM,GAAG,YAAY,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,iBAAiB,CAAC,CAAC;AACxG,IAAI,OAAO,MAAM,CAAC;AAClB,CAAC;AACD,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC;AAC1B;AACA;AACA;AACA;AACA;AACA,SAAS,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE;AAClC,IAAI,OAAO,YAAY,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAC5D,CAAC;AACD,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;AACxB;AACA;AACA;AACA;AACA;AACA,SAAS,aAAa,CAAC,KAAK,EAAE;AAC9B,IAAI,OAAO,YAAY,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AACxD,CAAC;AACD,OAAO,CAAC,aAAa,GAAG,aAAa;;"}
1
+ {"version":3,"file":"v6.js","sources":["../../../src/internals/v6.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isCancelError = exports.cancel = exports.graphql = void 0;\nconst GraphQLAPI_1 = require(\"../GraphQLAPI\");\nconst types_1 = require(\"../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 */\nfunction graphql(options, additionalHeaders) {\n // inject client-level auth\n const internals = (0, types_1.getInternals)(this);\n options.authMode = options.authMode || internals.authMode;\n options.authToken = options.authToken || internals.authToken;\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_1.GraphQLAPI.graphql(\n // TODO: move V6Client back into this package?\n internals.amplify, options, additionalHeaders);\n return result;\n}\nexports.graphql = graphql;\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 */\nfunction cancel(promise, message) {\n return GraphQLAPI_1.GraphQLAPI.cancel(promise, message);\n}\nexports.cancel = cancel;\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 */\nfunction isCancelError(error) {\n return GraphQLAPI_1.GraphQLAPI.isCancelError(error);\n}\nexports.isCancelError = isCancelError;\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC;AAClE,MAAM,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AAC9C,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACpC;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;AACA,SAAS,OAAO,CAAC,OAAO,EAAE,iBAAiB,EAAE;AAC7C;AACA,IAAI,MAAM,SAAS,GAAG,IAAI,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;AACtD,IAAI,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,SAAS,CAAC,QAAQ,CAAC;AAC9D,IAAI,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,SAAS,CAAC,SAAS,CAAC;AACjE;AACA;AACA;AACA;AACA;AACA,IAAI,MAAM,MAAM,GAAG,YAAY,CAAC,UAAU,CAAC,OAAO;AAClD;AACA,IAAI,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,iBAAiB,CAAC,CAAC;AACnD,IAAI,OAAO,MAAM,CAAC;AAClB,CAAC;AACD,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC;AAC1B;AACA;AACA;AACA;AACA;AACA,SAAS,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE;AAClC,IAAI,OAAO,YAAY,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAC5D,CAAC;AACD,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;AACxB;AACA;AACA;AACA;AACA;AACA,SAAS,aAAa,CAAC,KAAK,EAAE;AAC9B,IAAI,OAAO,YAAY,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AACxD,CAAC;AACD,OAAO,CAAC,aAAa,GAAG,aAAa;;"}
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.__headers = exports.__authToken = exports.__authMode = exports.__amplify = exports.GraphQLAuthError = exports.ConnectionState = exports.CONTROL_MSG = void 0;
4
+ exports.getInternals = exports.__headers = exports.__authToken = exports.__authMode = exports.__amplify = exports.GraphQLAuthError = exports.ConnectionState = exports.CONTROL_MSG = void 0;
5
5
  var PubSub_1 = require("./PubSub");
6
6
  Object.defineProperty(exports, "CONTROL_MSG", { enumerable: true, get: function () { return PubSub_1.CONTROL_MSG; } });
7
7
  Object.defineProperty(exports, "ConnectionState", { enumerable: true, get: function () { return PubSub_1.ConnectionState; } });
@@ -16,4 +16,14 @@ exports.__amplify = Symbol('amplify');
16
16
  exports.__authMode = Symbol('authMode');
17
17
  exports.__authToken = Symbol('authToken');
18
18
  exports.__headers = Symbol('headers');
19
+ function getInternals(client) {
20
+ const c = client;
21
+ return {
22
+ amplify: c[exports.__amplify],
23
+ authMode: c[exports.__authMode],
24
+ authToken: c[exports.__authToken],
25
+ headers: c[exports.__headers],
26
+ };
27
+ }
28
+ exports.getInternals = getInternals;
19
29
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/types/index.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.__headers = exports.__authToken = exports.__authMode = exports.__amplify = exports.GraphQLAuthError = exports.ConnectionState = exports.CONTROL_MSG = void 0;\nvar PubSub_1 = require(\"./PubSub\");\nObject.defineProperty(exports, \"CONTROL_MSG\", { enumerable: true, get: function () { return PubSub_1.CONTROL_MSG; } });\nObject.defineProperty(exports, \"ConnectionState\", { enumerable: true, get: function () { return PubSub_1.ConnectionState; } });\nvar 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 = exports.GraphQLAuthError || (exports.GraphQLAuthError = {}));\nexports.__amplify = Symbol('amplify');\nexports.__authMode = Symbol('authMode');\nexports.__authToken = Symbol('authToken');\nexports.__headers = Symbol('headers');\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,WAAW,GAAG,OAAO,CAAC,UAAU,GAAG,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,gBAAgB,GAAG,OAAO,CAAC,eAAe,GAAG,OAAO,CAAC,WAAW,GAAG,KAAK,CAAC,CAAC;AACrK,IAAI,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACnC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,QAAQ,CAAC,WAAW,CAAC,EAAE,EAAE,CAAC,CAAC;AACvH,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,iBAAiB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,QAAQ,CAAC,eAAe,CAAC,EAAE,EAAE,CAAC,CAAC;AAE/H,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,EAAqB,OAAO,CAAC,gBAAgB,KAAK,OAAO,CAAC,gBAAgB,GAAG,EAAE,CAAC,CAAC,CAAC;AACnF,OAAO,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;AACtC,OAAO,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;AACxC,OAAO,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;AAC1C,OAAO,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/types/index.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getInternals = exports.__headers = exports.__authToken = exports.__authMode = exports.__amplify = exports.GraphQLAuthError = exports.ConnectionState = exports.CONTROL_MSG = void 0;\nvar PubSub_1 = require(\"./PubSub\");\nObject.defineProperty(exports, \"CONTROL_MSG\", { enumerable: true, get: function () { return PubSub_1.CONTROL_MSG; } });\nObject.defineProperty(exports, \"ConnectionState\", { enumerable: true, get: function () { return PubSub_1.ConnectionState; } });\nvar 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 = exports.GraphQLAuthError || (exports.GraphQLAuthError = {}));\nexports.__amplify = Symbol('amplify');\nexports.__authMode = Symbol('authMode');\nexports.__authToken = Symbol('authToken');\nexports.__headers = Symbol('headers');\nfunction getInternals(client) {\n const c = client;\n return {\n amplify: c[exports.__amplify],\n authMode: c[exports.__authMode],\n authToken: c[exports.__authToken],\n headers: c[exports.__headers],\n };\n}\nexports.getInternals = getInternals;\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,YAAY,GAAG,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,WAAW,GAAG,OAAO,CAAC,UAAU,GAAG,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,gBAAgB,GAAG,OAAO,CAAC,eAAe,GAAG,OAAO,CAAC,WAAW,GAAG,KAAK,CAAC,CAAC;AAC5L,IAAI,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACnC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,QAAQ,CAAC,WAAW,CAAC,EAAE,EAAE,CAAC,CAAC;AACvH,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,iBAAiB,EAAE,EAAE,UAAU,EAAE,I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ates. All Rights Reserved.
4
4
  // SPDX-License-Identifier: Apache-2.0
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.findIndexByFields = exports.resolvePKFields = exports.resolveLibraryOptions = exports.resolveConfig = void 0;
6
+ exports.resolveLibraryOptions = exports.resolveConfig = void 0;
7
7
  var resolveConfig_1 = require("./resolveConfig");
8
8
  Object.defineProperty(exports, "resolveConfig", { enumerable: true, get: function () { return resolveConfig_1.resolveConfig; } });
9
9
  var resolveLibraryOptions_1 = require("./resolveLibraryOptions");
10
10
  Object.defineProperty(exports, "resolveLibraryOptions", { enumerable: true, get: function () { return resolveLibraryOptions_1.resolveLibraryOptions; } });
11
- var resolvePKFields_1 = require("./resolvePKFields");
12
- Object.defineProperty(exports, "resolvePKFields", { enumerable: true, get: function () { return resolvePKFields_1.resolvePKFields; } });
13
- var findIndexByFields_1 = require("./findIndexByFields");
14
- Object.defineProperty(exports, "findIndexByFields", { enumerable: true, get: function () { return findIndexByFields_1.findIndexByFields; } });
15
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/utils/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.findIndexByFields = exports.resolvePKFields = exports.resolveLibraryOptions = exports.resolveConfig = void 0;\nvar resolveConfig_1 = require(\"./resolveConfig\");\nObject.defineProperty(exports, \"resolveConfig\", { enumerable: true, get: function () { return resolveConfig_1.resolveConfig; } });\nvar resolveLibraryOptions_1 = require(\"./resolveLibraryOptions\");\nObject.defineProperty(exports, \"resolveLibraryOptions\", { enumerable: true, get: function () { return resolveLibraryOptions_1.resolveLibraryOptions; } });\nvar resolvePKFields_1 = require(\"./resolvePKFields\");\nObject.defineProperty(exports, \"resolvePKFields\", { enumerable: true, get: function () { return resolvePKFields_1.resolvePKFields; } });\nvar findIndexByFields_1 = require(\"./findIndexByFields\");\nObject.defineProperty(exports, \"findIndexByFields\", { enumerable: true, get: function () { return findIndexByFields_1.findIndexByFields; } });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,iBAAiB,GAAG,OAAO,CAAC,eAAe,GAAG,OAAO,CAAC,qBAAqB,GAAG,OAAO,CAAC,aAAa,GAAG,KAAK,CAAC,CAAC;AACrH,IAAI,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AACjD,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,eAAe,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,eAAe,CAAC,aAAa,CAAC,EAAE,EAAE,CAAC,CAAC;AAClI,IAAI,uBAAuB,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;AACjE,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,uBAAuB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,uBAAuB,CAAC,qBAAqB,CAAC,EAAE,EAAE,CAAC,CAAC;AAC1J,IAAI,iBAAiB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AACrD,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,iBAAiB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,iBAAiB,CAAC,eAAe,CAAC,EAAE,EAAE,CAAC,CAAC;AACxI,IAAI,mBAAmB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;AACzD,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,mBAAmB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,mBAAmB,CAAC,iBAAiB,CAAC,EAAE,EAAE,CAAC;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/utils/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.resolveLibraryOptions = exports.resolveConfig = void 0;\nvar resolveConfig_1 = require(\"./resolveConfig\");\nObject.defineProperty(exports, \"resolveConfig\", { enumerable: true, get: function () { return resolveConfig_1.resolveConfig; } });\nvar resolveLibraryOptions_1 = require(\"./resolveLibraryOptions\");\nObject.defineProperty(exports, \"resolveLibraryOptions\", { enumerable: true, get: function () { return resolveLibraryOptions_1.resolveLibraryOptions; } });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,qBAAqB,GAAG,OAAO,CAAC,aAAa,GAAG,KAAK,CAAC,CAAC;AAC/D,IAAI,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AACjD,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,eAAe,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,eAAe,CAAC,aAAa,CAAC,EAAE,EAAE,CAAC,CAAC;AAClI,IAAI,uBAAuB,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;AACjE,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,uBAAuB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,uBAAuB,CAAC,qBAAqB,CAAC,EAAE,EAAE,CAAC;;"}
@@ -1,5 +1,5 @@
1
1
  import { AmplifyClassV6 } from '@aws-amplify/core';
2
- import { CustomHeaders } from '@aws-amplify/data-schema-types';
2
+ import { CustomHeaders } from '@aws-amplify/data-schema/runtime';
3
3
  import { Observable } from 'rxjs';
4
4
  import { GraphQLOptions, GraphQLResult } from './types';
5
5
  import { InternalGraphQLAPIClass } from './internals/InternalGraphQLAPI';
@@ -1,6 +1,6 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import { CustomUserAgentDetails, DocumentType, GraphQLAuthMode } from '@aws-amplify/core/internals/utils';
3
- import { CustomHeaders } from '@aws-amplify/data-schema-types';
3
+ import { CustomHeaders } from '@aws-amplify/data-schema/runtime';
4
4
  import { PubSubContentObserver } from '../../types/PubSub';
5
5
  import { SUBSCRIPTION_STATUS } from '../constants';
6
6
  export interface ObserverQuery {
@@ -1,5 +1,5 @@
1
1
  export { GraphQLAPI, GraphQLAPIClass, graphqlOperation } from './GraphQLAPI.mjs';
2
- export { GraphQLAuthError, __amplify, __authMode, __authToken, __headers } from './types/index.mjs';
2
+ export { GraphQLAuthError, __amplify, __authMode, __authToken, __headers, getInternals } from './types/index.mjs';
3
3
  export { CONNECTION_STATE_CHANGE } from './Providers/constants.mjs';
4
4
  export { CONTROL_MSG, ConnectionState } from './types/PubSub.mjs';
5
5
  //# sourceMappingURL=index.mjs.map
@@ -2,7 +2,7 @@ import { OperationTypeNode } from 'graphql';
2
2
  import { Observable } from 'rxjs';
3
3
  import { AmplifyClassV6 } from '@aws-amplify/core';
4
4
  import { CustomUserAgentDetails } from '@aws-amplify/core/internals/utils';
5
- import { CustomHeaders } from '@aws-amplify/data-schema-types';
5
+ import { CustomHeaders } from '@aws-amplify/data-schema/runtime';
6
6
  import { GraphQLOperation, GraphQLOptions, GraphQLResult } from '../types';
7
7
  /**
8
8
  * Export Cloud Logic APIs
@@ -1,11 +1,9 @@
1
1
  import { Hub } from '@aws-amplify/core';
2
- import { __amplify, __authMode, __authToken, __headers } from '../types/index.mjs';
3
- import { graphql, cancel, isCancelError } from './v6.mjs';
4
- import { generateEnumsProperty } from './utils/clientProperties/generateEnumsProperty.mjs';
5
- import { generateModelsProperty } from './utils/clientProperties/generateModelsProperty.mjs';
2
+ import { addSchemaToClient } from '@aws-amplify/data-schema/runtime';
3
+ import { __amplify, __authMode, __authToken, __headers, getInternals } from '../types/index.mjs';
6
4
  import { isApiGraphQLConfig } from './utils/runtimeTypeGuards/isApiGraphQLProviderConfig.mjs';
7
- import { generateCustomQueriesProperty, generateCustomMutationsProperty, generateCustomSubscriptionsProperty } from './generateCustomOperationsProperty.mjs';
8
5
  import { isConfigureEventWithResourceConfig } from './utils/runtimeTypeGuards/isConfigureEventWithResourceConfig.mjs';
6
+ import { graphql, cancel, isCancelError } from './v6.mjs';
9
7
 
10
8
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
11
9
  // SPDX-License-Identifier: Apache-2.0
@@ -35,11 +33,7 @@ function generateClient(params) {
35
33
  };
36
34
  const apiGraphqlConfig = params.amplify.getConfig().API?.GraphQL;
37
35
  if (isApiGraphQLConfig(apiGraphqlConfig)) {
38
- client.models = generateModelsProperty(client, apiGraphqlConfig);
39
- client.enums = generateEnumsProperty(apiGraphqlConfig);
40
- client.queries = generateCustomQueriesProperty(client, apiGraphqlConfig);
41
- client.mutations = generateCustomMutationsProperty(client, apiGraphqlConfig);
42
- client.subscriptions = generateCustomSubscriptionsProperty(client, apiGraphqlConfig);
36
+ addSchemaToClient(client, apiGraphqlConfig, getInternals);
43
37
  }
44
38
  else {
45
39
  // This happens when the `Amplify.configure()` call gets evaluated after the `generateClient()` call.
@@ -65,11 +59,7 @@ const generateModelsPropertyOnAmplifyConfigure = (clientRef) => {
65
59
  }
66
60
  const apiGraphQLConfig = coreEvent.payload.data.API?.GraphQL;
67
61
  if (isApiGraphQLConfig(apiGraphQLConfig)) {
68
- clientRef.models = generateModelsProperty(clientRef, apiGraphQLConfig);
69
- clientRef.enums = generateEnumsProperty(apiGraphQLConfig);
70
- clientRef.queries = generateCustomQueriesProperty(clientRef, apiGraphQLConfig);
71
- clientRef.mutations = generateCustomMutationsProperty(clientRef, apiGraphQLConfig);
72
- clientRef.subscriptions = generateCustomSubscriptionsProperty(clientRef, apiGraphQLConfig);
62
+ addSchemaToClient(clientRef, apiGraphQLConfig, getInternals);
73
63
  }
74
64
  });
75
65
  };
@@ -1 +1 @@
1
- {"version":3,"file":"generateClient.mjs","sources":["../../../src/internals/generateClient.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Hub } from '@aws-amplify/core';\nimport { __amplify, __authMode, __authToken, __headers, } from '../types';\nimport { cancel, graphql, isCancelError } from './v6';\nimport { generateEnumsProperty } from './utils/clientProperties/generateEnumsProperty';\nimport { generateModelsProperty } from './utils/clientProperties/generateModelsProperty';\nimport { isApiGraphQLConfig } from './utils/runtimeTypeGuards/isApiGraphQLProviderConfig';\nimport { generateCustomMutationsProperty, generateCustomQueriesProperty, generateCustomSubscriptionsProperty, } from './generateCustomOperationsProperty';\nimport { isConfigureEventWithResourceConfig } from './utils/runtimeTypeGuards/isConfigureEventWithResourceConfig';\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 [__headers]: params.headers,\n graphql,\n cancel,\n 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 (isApiGraphQLConfig(apiGraphqlConfig)) {\n client.models = generateModelsProperty(client, apiGraphqlConfig);\n client.enums = generateEnumsProperty(apiGraphqlConfig);\n client.queries = generateCustomQueriesProperty(client, apiGraphqlConfig);\n client.mutations = generateCustomMutationsProperty(client, apiGraphqlConfig);\n client.subscriptions = generateCustomSubscriptionsProperty(client, apiGraphqlConfig);\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 return client;\n}\nconst generateModelsPropertyOnAmplifyConfigure = (clientRef) => {\n Hub.listen('core', coreEvent => {\n if (!isConfigureEventWithResourceConfig(coreEvent.payload)) {\n return;\n }\n const apiGraphQLConfig = coreEvent.payload.data.API?.GraphQL;\n if (isApiGraphQLConfig(apiGraphQLConfig)) {\n clientRef.models = generateModelsProperty(clientRef, apiGraphQLConfig);\n clientRef.enums = generateEnumsProperty(apiGraphQLConfig);\n clientRef.queries = generateCustomQueriesProperty(clientRef, apiGraphQLConfig);\n clientRef.mutations = generateCustomMutationsProperty(clientRef, apiGraphQLConfig);\n clientRef.subscriptions = generateCustomSubscriptionsProperty(clientRef, apiGraphQLConfig);\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":";;;;;;;;;AAAA;AACA;AASA;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,CAAC,SAAS,GAAG,MAAM,CAAC,OAAO;AACnC,QAAQ,OAAO;AACf,QAAQ,MAAM;AACd,QAAQ,aAAa;AACrB,QAAQ,MAAM,EAAE,aAAa;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EAAE;AAClD,YAAY,SAAS,CAAC,MAAM,GAAG,sBAAsB,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;AACnF,YAAY,SAAS,CAAC,KAAK,GAAG,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;AACtE,YAAY,SAAS,CAAC,OAAO,GAAG,6BAA6B,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;AAC3F,YAAY,SAAS,CAAC,SAAS,GAAG,+BAA+B,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;AAC/F,YAAY,SAAS,CAAC,aAAa,GAAG,mCAAmC,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;AACvG,SAAS;AACT,KAAK,CAAC,CAAC;AACP,CAAC,CAAC;AACF,MAAM,aAAa,GAAG,IAAI,KAAK,CAAC,EAAE,EAAE;AACpC,IAAI,GAAG,GAAG;AACV,QAAQ,MAAM,IAAI,KAAK,CAAC,iOAAiO,CAAC,CAAC;AAC3P,KAAK;AACL,CAAC,CAAC;;;;"}
1
+ {"version":3,"file":"generateClient.mjs","sources":["../../../src/internals/generateClient.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Hub } from '@aws-amplify/core';\nimport { addSchemaToClient, } from '@aws-amplify/data-schema/runtime';\nimport { __amplify, __authMode, __authToken, __headers, getInternals, } from '../types';\nimport { isApiGraphQLConfig } from './utils/runtimeTypeGuards/isApiGraphQLProviderConfig';\nimport { isConfigureEventWithResourceConfig } from './utils/runtimeTypeGuards/isConfigureEventWithResourceConfig';\nimport { cancel, graphql, isCancelError } from './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 */\nexport function generateClient(params) {\n const client = {\n [__amplify]: params.amplify,\n [__authMode]: params.authMode,\n [__authToken]: params.authToken,\n [__headers]: params.headers,\n graphql,\n cancel,\n 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 (isApiGraphQLConfig(apiGraphqlConfig)) {\n addSchemaToClient(client, apiGraphqlConfig, 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 return client;\n}\nconst generateModelsPropertyOnAmplifyConfigure = (clientRef) => {\n Hub.listen('core', coreEvent => {\n if (!isConfigureEventWithResourceConfig(coreEvent.payload)) {\n return;\n }\n const apiGraphQLConfig = coreEvent.payload.data.API?.GraphQL;\n if (isApiGraphQLConfig(apiGraphQLConfig)) {\n addSchemaToClient(clientRef, apiGraphQLConfig, 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":";;;;;;;AAAA;AACA;AAOA;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,CAAC,SAAS,GAAG,MAAM,CAAC,OAAO;AACn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CAAC;AAC3P,KAAK;AACL,CAAC,CAAC;;;;"}
@@ -1,11 +1,9 @@
1
+ import { addSchemaToClientWithInstance } from '@aws-amplify/data-schema/runtime';
2
+ import { __amplify, __authMode, __authToken, __headers, getInternals } from '../../types/index.mjs';
3
+ import { isApiGraphQLConfig } from '../utils/runtimeTypeGuards/isApiGraphQLProviderConfig.mjs';
1
4
  import '../InternalGraphQLAPI.mjs';
2
5
  import { graphql, cancel, isCancelError } from '../v6.mjs';
3
6
  import '../generateClient.mjs';
4
- import { __amplify, __authMode, __authToken, __headers } from '../../types/index.mjs';
5
- import { isApiGraphQLConfig } from '../utils/runtimeTypeGuards/isApiGraphQLProviderConfig.mjs';
6
- import { generateEnumsProperty } from '../utils/clientProperties/generateEnumsProperty.mjs';
7
- import { generateCustomQueriesProperty, generateCustomMutationsProperty } from '../generateCustomOperationsProperty.mjs';
8
- import { generateModelsProperty } from './generateModelsProperty.mjs';
9
7
 
10
8
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
11
9
  // SPDX-License-Identifier: Apache-2.0
@@ -32,10 +30,7 @@ function generateClientWithAmplifyInstance(params) {
32
30
  };
33
31
  const apiGraphqlConfig = params.config?.API?.GraphQL;
34
32
  if (isApiGraphQLConfig(apiGraphqlConfig)) {
35
- client.models = generateModelsProperty(client, params);
36
- client.enums = generateEnumsProperty(apiGraphqlConfig);
37
- client.queries = generateCustomQueriesProperty(client, apiGraphqlConfig);
38
- client.mutations = generateCustomMutationsProperty(client, apiGraphqlConfig);
33
+ addSchemaToClientWithInstance(client, params, getInternals);
39
34
  }
40
35
  return client;
41
36
  }
@@ -1 +1 @@
1
- {"version":3,"file":"generateClientWithAmplifyInstance.mjs","sources":["../../../../src/internals/server/generateClientWithAmplifyInstance.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { cancel, graphql, isCancelError } from '..';\nimport { __amplify, __authMode, __authToken, __headers, } from '../../types';\nimport { isApiGraphQLConfig } from '../utils/runtimeTypeGuards/isApiGraphQLProviderConfig';\nimport { generateEnumsProperty } from '../utils/clientProperties/generateEnumsProperty';\nimport { generateCustomMutationsProperty, generateCustomQueriesProperty, } from '../generateCustomOperationsProperty';\nimport { generateModelsProperty } from './generateModelsProperty';\n/**\n * @private\n *\n * Used internally by `adapter-nextjs` package.\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 generateClientWithAmplifyInstance(params) {\n const client = {\n [__amplify]: params.amplify,\n [__authMode]: params.authMode,\n [__authToken]: params.authToken,\n [__headers]: params.headers,\n graphql,\n cancel,\n isCancelError,\n };\n const apiGraphqlConfig = params.config?.API?.GraphQL;\n if (isApiGraphQLConfig(apiGraphqlConfig)) {\n client.models = generateModelsProperty(client, params);\n client.enums = generateEnumsProperty(apiGraphqlConfig);\n client.queries = generateCustomQueriesProperty(client, apiGraphqlConfig);\n client.mutations = generateCustomMutationsProperty(client, apiGraphqlConfig);\n }\n return client;\n}\n"],"names":[],"mappings":";;;;;;;;;AAAA;AACA;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,iCAAiC,CAAC,MAAM,EAAE;AAC1D,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,CAAC,SAAS,GAAG,MAAM,CAAC,OAAO;AACnC,QAAQ,OAAO;AACf,QAAQ,MAAM;AACd,QAAQ,aAAa;AACrB,KAAK,CAAC;AACN,IAAI,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,CAAC;AACzD,IAAI,IAAI,kBAAkB,CAAC,gBAAgB,CAAC,EAAE;AAC9C,QAAQ,MAAM,CAAC,MAAM,GAAG,sBAAsB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC/D,QAAQ,MAAM,CAAC,KAAK,GAAG,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;AAC/D,QAAQ,MAAM,CAAC,OAAO,GAAG,6BAA6B,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;AACjF,QAAQ,MAAM,CAAC,SAAS,GAAG,+BAA+B,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;AACrF,KAAK;AACL,IAAI,OAAO,MAAM,CAAC;AAClB;;;;"}
1
+ {"version":3,"file":"generateClientWithAmplifyInstance.mjs","sources":["../../../../src/internals/server/generateClientWithAmplifyInstance.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { addSchemaToClientWithInstance } from '@aws-amplify/data-schema/runtime';\nimport { __amplify, __authMode, __authToken, __headers, getInternals, } from '../../types';\nimport { isApiGraphQLConfig } from '../utils/runtimeTypeGuards/isApiGraphQLProviderConfig';\nimport { cancel, graphql, isCancelError } from '..';\n/**\n * @private\n *\n * Used internally by `adapter-nextjs` package.\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 generateClientWithAmplifyInstance(params) {\n const client = {\n [__amplify]: params.amplify,\n [__authMode]: params.authMode,\n [__authToken]: params.authToken,\n [__headers]: params.headers,\n graphql,\n cancel,\n isCancelError,\n };\n const apiGraphqlConfig = params.config?.API?.GraphQL;\n if (isApiGraphQLConfig(apiGraphqlConfig)) {\n addSchemaToClientWithInstance(client, params, getInternals);\n }\n return client;\n}\n"],"names":[],"mappings":";;;;;;;AAAA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,iCAAiC,CAAC,MAAM,EAAE;AAC1D,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,CAAC,SAAS,GAAG,MAAM,CAAC,OAAO;AACnC,QAAQ,OAAO;AACf,QAAQ,MAAM;AACd,QAAQ,aAAa;AACrB,KAAK,CAAC;AACN,IAAI,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,CAAC;AACzD,IAAI,IAAI,kBAAkB,CAAC,gBAAgB,CAAC,EAAE;AAC9C,QAAQ,6BAA6B,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;AACpE,KAAK;AACL,IAAI,OAAO,MAAM,CAAC;AAClB;;;;"}
@@ -1,6 +1,6 @@
1
1
  import { AmplifyClassV6 } from '@aws-amplify/core';
2
2
  import { GraphQLAuthMode } from '@aws-amplify/core/internals/utils';
3
- import { CustomHeaders } from '@aws-amplify/data-schema-types';
3
+ import { CustomHeaders } from '@aws-amplify/data-schema/runtime';
4
4
  /**
5
5
  * @private
6
6
  *
@@ -1,4 +1,4 @@
1
- import { CustomHeaders } from '@aws-amplify/data-schema-types';
1
+ import { CustomHeaders } from '@aws-amplify/data-schema/runtime';
2
2
  import { GraphQLOptionsV6, GraphQLResponseV6, V6Client } from '../types';
3
3
  /**
4
4
  * Invokes graphql operations against a graphql service, providing correct input and
@@ -1,5 +1,5 @@
1
1
  import { GraphQLAPI } from '../GraphQLAPI.mjs';
2
- import { __authMode, __authToken, __amplify } from '../types/index.mjs';
2
+ import { getInternals } from '../types/index.mjs';
3
3
 
4
4
  /**
5
5
  * Invokes graphql operations against a graphql service, providing correct input and
@@ -87,14 +87,17 @@ import { __authMode, __authToken, __amplify } from '../types/index.mjs';
87
87
  */
88
88
  function graphql(options, additionalHeaders) {
89
89
  // inject client-level auth
90
- options.authMode = options.authMode || this[__authMode];
91
- options.authToken = options.authToken || this[__authToken];
90
+ const internals = getInternals(this);
91
+ options.authMode = options.authMode || internals.authMode;
92
+ options.authToken = options.authToken || internals.authToken;
92
93
  /**
93
94
  * The correctness of these typings depends on correct string branding or overrides.
94
95
  * Neither of these can actually be validated at runtime. Hence, we don't perform
95
96
  * any validation or type-guarding here.
96
97
  */
97
- const result = GraphQLAPI.graphql(this[__amplify], options, additionalHeaders);
98
+ const result = GraphQLAPI.graphql(
99
+ // TODO: move V6Client back into this package?
100
+ internals.amplify, options, additionalHeaders);
98
101
  return result;
99
102
  }
100
103
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"v6.mjs","sources":["../../../src/internals/v6.ts"],"sourcesContent":["import { GraphQLAPI } from '../GraphQLAPI';\nimport { __amplify, __authMode, __authToken, } 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 // inject client-level auth\n options.authMode = options.authMode || this[__authMode];\n options.authToken = options.authToken || this[__authToken];\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":";;;AAEA;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,IAAI,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC;AAC5D,IAAI,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,IAAI,CAAC,WAAW,CAAC,CAAC;AAC/D;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;;;;"}
1
+ {"version":3,"file":"v6.mjs","sources":["../../../src/internals/v6.ts"],"sourcesContent":["import { GraphQLAPI } from '../GraphQLAPI';\nimport { getInternals, } 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 // inject client-level auth\n const internals = getInternals(this);\n options.authMode = options.authMode || internals.authMode;\n options.authToken = options.authToken || internals.authToken;\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(\n // TODO: move V6Client back into this package?\n internals.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":";;;AAEA;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,IAAI,MAAM,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;AACzC,IAAI,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,SAAS,CAAC,QAAQ,CAAC;AAC9D,IAAI,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,SAAS,CAAC,SAAS,CAAC;AACjE;AACA;AACA;AACA;AACA;AACA,IAAI,MAAM,MAAM,GAAG,UAAU,CAAC,OAAO;AACrC;AACA,IAAI,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,iBAAiB,CAAC,CAAC;AACnD,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;;;;"}
@@ -1,12 +1,12 @@
1
1
  import { AmplifyClassV6, ResourcesConfig } from '@aws-amplify/core';
2
- import { CustomHeaders, CustomMutations, CustomQueries, CustomSubscriptions, EnumTypes, ModelSortDirection, ModelTypes } from '@aws-amplify/data-schema-types';
2
+ import { BaseClient, ClientExtensions, ClientExtensionsSSRCookies, ClientExtensionsSSRRequest, ClientInternals, CustomHeaders, ModelSortDirection } from '@aws-amplify/data-schema/runtime';
3
3
  import { DocumentNode, GraphQLError, Source } from 'graphql';
4
4
  import { Observable } from 'rxjs';
5
5
  import { DocumentType, GraphQLAuthMode } from '@aws-amplify/core/internals/utils';
6
6
  import { AmplifyServer } from '@aws-amplify/core/internals/adapter-core';
7
7
  export { OperationTypeNode } from 'graphql';
8
8
  export { CONTROL_MSG, ConnectionState } from './PubSub';
9
- export { SelectionSet } from '@aws-amplify/data-schema-types';
9
+ export { SelectionSet } from '@aws-amplify/data-schema/runtime';
10
10
  export { CommonPublicClientOptions } from '../internals/types';
11
11
  /**
12
12
  * Loose/Unknown options for raw GraphQLAPICategory `graphql()`.
@@ -272,57 +272,27 @@ export type GeneratedSubscription<InputType, OutputType> = string & {
272
272
  __generatedSubscriptionInput: InputType;
273
273
  __generatedSubscriptionOutput: OutputType;
274
274
  };
275
- type FilteredKeys<T> = {
276
- [P in keyof T]: T[P] extends never ? never : P;
277
- }[keyof T];
278
- type ExcludeNeverFields<O> = {
279
- [K in FilteredKeys<O>]: O[K];
280
- };
281
275
  export declare const __amplify: unique symbol;
282
276
  export declare const __authMode: unique symbol;
283
277
  export declare const __authToken: unique symbol;
284
278
  export declare const __headers: unique symbol;
285
- export type ClientWithModels = V6Client<Record<string, any>> | V6ClientSSRRequest<Record<string, any>> | V6ClientSSRCookies<Record<string, any>>;
286
- export type V6Client<T extends Record<any, any> = never> = ExcludeNeverFields<{
287
- [__amplify]: AmplifyClassV6;
288
- [__authMode]?: GraphQLAuthMode;
289
- [__authToken]?: string;
290
- [__headers]?: CustomHeaders;
279
+ export declare function getInternals(client: BaseClient): ClientInternals;
280
+ export type ClientWithModels = V6Client | V6ClientSSRRequest | V6ClientSSRCookies;
281
+ export type V6Client<T extends Record<any, any> = never> = {
291
282
  graphql: GraphQLMethod;
292
283
  cancel(promise: Promise<any>, message?: string): boolean;
293
284
  isCancelError(error: any): boolean;
294
- models: ModelTypes<T>;
295
- enums: EnumTypes<T>;
296
- queries: CustomQueries<T>;
297
- mutations: CustomMutations<T>;
298
- subscriptions: CustomSubscriptions<T>;
299
- }>;
300
- export type V6ClientSSRRequest<T extends Record<any, any> = never> = ExcludeNeverFields<{
301
- [__amplify]: AmplifyClassV6;
302
- [__authMode]?: GraphQLAuthMode;
303
- [__authToken]?: string;
304
- [__headers]?: CustomHeaders;
285
+ } & ClientExtensions<T>;
286
+ export type V6ClientSSRRequest<T extends Record<any, any> = never> = {
305
287
  graphql: GraphQLMethodSSR;
306
288
  cancel(promise: Promise<any>, message?: string): boolean;
307
289
  isCancelError(error: any): boolean;
308
- models: ModelTypes<T, 'REQUEST'>;
309
- enums: EnumTypes<T>;
310
- queries: CustomQueries<T, 'REQUEST'>;
311
- mutations: CustomMutations<T, 'REQUEST'>;
312
- }>;
313
- export type V6ClientSSRCookies<T extends Record<any, any> = never> = ExcludeNeverFields<{
314
- [__amplify]: AmplifyClassV6;
315
- [__authMode]?: GraphQLAuthMode;
316
- [__authToken]?: string;
317
- [__headers]?: CustomHeaders;
290
+ } & ClientExtensionsSSRRequest<T>;
291
+ export type V6ClientSSRCookies<T extends Record<any, any> = never> = {
318
292
  graphql: GraphQLMethod;
319
293
  cancel(promise: Promise<any>, message?: string): boolean;
320
294
  isCancelError(error: any): boolean;
321
- models: ModelTypes<T, 'COOKIES'>;
322
- enums: EnumTypes<T>;
323
- queries: CustomQueries<T, 'COOKIES'>;
324
- mutations: CustomMutations<T, 'COOKIES'>;
325
- }>;
295
+ } & ClientExtensionsSSRCookies<T>;
326
296
  export type GraphQLMethod = <FALLBACK_TYPES = unknown, TYPED_GQL_STRING extends string = string>(options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING>, additionalHeaders?: CustomHeaders | undefined) => GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
327
297
  export type GraphQLMethodSSR = <FALLBACK_TYPES = unknown, TYPED_GQL_STRING extends string = string>(contextSpec: AmplifyServer.ContextSpec, options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING>, additionalHeaders?: CustomHeaders | undefined) => GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
328
298
  /**
@@ -12,6 +12,15 @@ const __amplify = Symbol('amplify');
12
12
  const __authMode = Symbol('authMode');
13
13
  const __authToken = Symbol('authToken');
14
14
  const __headers = Symbol('headers');
15
+ function getInternals(client) {
16
+ const c = client;
17
+ return {
18
+ amplify: c[__amplify],
19
+ authMode: c[__authMode],
20
+ authToken: c[__authToken],
21
+ headers: c[__headers],
22
+ };
23
+ }
15
24
 
16
- export { GraphQLAuthError, __amplify, __authMode, __authToken, __headers };
25
+ export { GraphQLAuthError, __amplify, __authMode, __authToken, __headers, getInternals };
17
26
  //# sourceMappingURL=index.mjs.map
@@ -1 +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');\nexport const __headers = Symbol('headers');\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,EAAE;AACnC,MAAC,SAAS,GAAG,MAAM,CAAC,SAAS;;;;"}
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');\nexport const __headers = Symbol('headers');\nexport function getInternals(client) {\n const c = client;\n return {\n amplify: c[__amplify],\n authMode: c[__authMode],\n authToken: c[__authToken],\n headers: c[__headers],\n };\n}\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,EAAE;AACnC,MAAC,SAAS,GAAG,MAAM,CAAC,SAAS,EAAE;AACpC,SAAS,YAAY,CAAC,MAAM,EAAE;AACrC,IAAI,MAAM,CAAC,GAAG,MAAM,CAAC;AACrB,IAAI,OAAO;AACX,QAAQ,OAAO,EAAE,CAAC,CAAC,SAAS,CAAC;AAC7B,QAAQ,QAAQ,EAAE,CAAC,CAAC,UAAU,CAAC;AAC/B,QAAQ,SAAS,EAAE,CAAC,CAAC,WAAW,CAAC;AACjC,QAAQ,OAAO,EAAE,CAAC,CAAC,SAAS,CAAC;AAC7B,KAAK,CAAC;AACN;;;;"}
@@ -1,4 +1,2 @@
1
1
  export { resolveConfig } from './resolveConfig';
2
2
  export { resolveLibraryOptions } from './resolveLibraryOptions';
3
- export { resolvePKFields } from './resolvePKFields';
4
- export { findIndexByFields } from './findIndexByFields';
@@ -1,5 +1,3 @@
1
1
  export { resolveConfig } from './resolveConfig.mjs';
2
2
  export { resolveLibraryOptions } from './resolveLibraryOptions.mjs';
3
- export { resolvePKFields } from './resolvePKFields.mjs';
4
- export { findIndexByFields } from './findIndexByFields.mjs';
5
3
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}