@aws-amplify/api-graphql 4.0.18-unstable.7d95fa1.0 → 4.0.18-unstable.7e4eff3.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 (25) hide show
  1. package/dist/cjs/internals/generateClient.js +7 -0
  2. package/dist/cjs/internals/generateClient.js.map +1 -1
  3. package/dist/cjs/internals/generateCustomOperationsProperty.js +45 -0
  4. package/dist/cjs/internals/generateCustomOperationsProperty.js.map +1 -0
  5. package/dist/cjs/internals/operations/custom.js +289 -0
  6. package/dist/cjs/internals/operations/custom.js.map +1 -0
  7. package/dist/cjs/internals/server/generateClientWithAmplifyInstance.js +11 -1
  8. package/dist/cjs/internals/server/generateClientWithAmplifyInstance.js.map +1 -1
  9. package/dist/esm/internals/generateClient.mjs +7 -0
  10. package/dist/esm/internals/generateClient.mjs.map +1 -1
  11. package/dist/esm/internals/generateCustomOperationsProperty.d.ts +8 -0
  12. package/dist/esm/internals/generateCustomOperationsProperty.mjs +41 -0
  13. package/dist/esm/internals/generateCustomOperationsProperty.mjs.map +1 -0
  14. package/dist/esm/internals/operations/custom.d.ts +60 -0
  15. package/dist/esm/internals/operations/custom.mjs +287 -0
  16. package/dist/esm/internals/operations/custom.mjs.map +1 -0
  17. package/dist/esm/internals/server/generateClientWithAmplifyInstance.mjs +12 -2
  18. package/dist/esm/internals/server/generateClientWithAmplifyInstance.mjs.map +1 -1
  19. package/dist/esm/types/index.d.ts +9 -1
  20. package/package.json +6 -6
  21. package/src/internals/generateClient.ts +25 -1
  22. package/src/internals/generateCustomOperationsProperty.ts +89 -0
  23. package/src/internals/operations/custom.ts +382 -0
  24. package/src/internals/server/generateClientWithAmplifyInstance.ts +20 -1
  25. package/src/types/index.ts +11 -1
@@ -9,6 +9,7 @@ const v6_1 = require("./v6");
9
9
  const generateEnumsProperty_1 = require("./utils/generateEnumsProperty");
10
10
  const generateModelsProperty_1 = require("./utils/generateModelsProperty");
11
11
  const isApiGraphQLProviderConfig_1 = require("./utils/isApiGraphQLProviderConfig");
12
+ const generateCustomOperationsProperty_1 = require("./generateCustomOperationsProperty");
12
13
  const types_1 = require("../types");
13
14
  const isConfigureEventWithResourceConfig_1 = require("./utils/isConfigureEventWithResourceConfig");
14
15
  /**
@@ -31,11 +32,15 @@ function generateClient(params) {
31
32
  isCancelError: v6_1.isCancelError,
32
33
  models: emptyProperty,
33
34
  enums: emptyProperty,
35
+ queries: emptyProperty,
36
+ mutations: emptyProperty,
34
37
  };
35
38
  const apiGraphqlConfig = params.amplify.getConfig().API?.GraphQL;
36
39
  if ((0, isApiGraphQLProviderConfig_1.isApiGraphQLConfig)(apiGraphqlConfig)) {
37
40
  client.models = (0, generateModelsProperty_1.generateModelsProperty)(client, apiGraphqlConfig);
38
41
  client.enums = (0, generateEnumsProperty_1.generateEnumsProperty)(apiGraphqlConfig);
42
+ client.queries = (0, generateCustomOperationsProperty_1.generateCustomQueriesProperty)(client, apiGraphqlConfig);
43
+ client.mutations = (0, generateCustomOperationsProperty_1.generateCustomMutationsProperty)(client, apiGraphqlConfig);
39
44
  }
40
45
  else {
41
46
  // This happens when the `Amplify.configure()` call gets evaluated after the `generateClient()` call.
@@ -64,6 +69,8 @@ const generateModelsPropertyOnAmplifyConfigure = (clientRef) => {
64
69
  if ((0, isApiGraphQLProviderConfig_1.isApiGraphQLConfig)(apiGraphQLConfig)) {
65
70
  clientRef.models = (0, generateModelsProperty_1.generateModelsProperty)(clientRef, apiGraphQLConfig);
66
71
  clientRef.enums = (0, generateEnumsProperty_1.generateEnumsProperty)(apiGraphQLConfig);
72
+ clientRef.queries = (0, generateCustomOperationsProperty_1.generateCustomQueriesProperty)(clientRef, apiGraphQLConfig);
73
+ clientRef.mutations = (0, generateCustomOperationsProperty_1.generateCustomMutationsProperty)(clientRef, apiGraphQLConfig);
67
74
  }
68
75
  });
69
76
  };
@@ -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 v6_1 = require(\"./v6\");\nconst generateEnumsProperty_1 = require(\"./utils/generateEnumsProperty\");\nconst generateModelsProperty_1 = require(\"./utils/generateModelsProperty\");\nconst isApiGraphQLProviderConfig_1 = require(\"./utils/isApiGraphQLProviderConfig\");\nconst types_1 = require(\"../types\");\nconst isConfigureEventWithResourceConfig_1 = require(\"./utils/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 };\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 }\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 }\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,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC7B,MAAM,uBAAuB,GAAG,OAAO,CAAC,+BAA+B,CAAC,CAAC;AACzE,MAAM,wBAAwB,GAAG,OAAO,CAAC,gCAAgC,CAAC,CAAC;AAC3E,MAAM,4BAA4B,GAAG,OAAO,CAAC,oCAAoC,CAAC,CAAC;AACnF,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACpC,MAAM,oCAAoC,GAAG,OAAO,CAAC,4CAA4C,CAAC,CAAC;AACnG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,cAAc,CAAC,MAAM,EAAE;AAChC,IAAI,MAAM,MAAM,GAAG;AACnB,QAAQ,CAAC,OAAO,CAAC,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AAC9G,YAAY,OAAO;AACnB,SAAS;AACT,QAAQ,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,SAAS,CAAC,MAAM,GAAG,IAAI,wBAAwB,CAAC,sBAAsB,EAAE,SAAS,EAAE,gBAAgB,CAAC,CAAC;AACjH,YAAY,SAAS,CAAC,KAAK,GAAG,IAAI,uBAAuB,CAAC,qBAAqB,EAAE,gBAAgB,CAAC,CAAC;AACnG,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.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 v6_1 = require(\"./v6\");\nconst generateEnumsProperty_1 = require(\"./utils/generateEnumsProperty\");\nconst generateModelsProperty_1 = require(\"./utils/generateModelsProperty\");\nconst isApiGraphQLProviderConfig_1 = require(\"./utils/isApiGraphQLProviderConfig\");\nconst generateCustomOperationsProperty_1 = require(\"./generateCustomOperationsProperty\");\nconst types_1 = require(\"../types\");\nconst isConfigureEventWithResourceConfig_1 = require(\"./utils/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 };\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 }\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 }\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,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC7B,MAAM,uBAAuB,GAAG,OAAO,CAAC,+BAA+B,CAAC,CAAC;AACzE,MAAM,wBAAwB,GAAG,OAAO,CAAC,gCAAgC,CAAC,CAAC;AAC3E,MAAM,4BAA4B,GAAG,OAAO,CAAC,oCAAoC,CAAC,CAAC;AACnF,MAAM,kCAAkC,GAAG,OAAO,CAAC,oCAAoC,CAAC,CAAC;AACzF,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACpC,MAAM,oCAAoC,GAAG,OAAO,CAAC,4CAA4C,CAAC,CAAC;AACnG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,cAAc,CAAC,MAAM,EAAE;AAChC,IAAI,MAAM,MAAM,GAAG;AACnB,QAAQ,CAAC,OAAO,CAAC,SAAS,GAAG,MAAM,CAAC,OAAO;AAC3C,QAAQ,CAAC,OAAO,CAAC,UAAU,GAAG,MAAM,CAAC,QAAQ;AAC7C,QAAQ,CAAC,OAAO,CAAC,WAAW,GAAG,MAAM,CAAC,SAAS;A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,MAAM,EAAE,SAAS,IAAI;AAC3C,QAAQ,IAAI,CAAC,IAAI,oCAAoC,CAAC,kCAAkC,EAAE,SAAS,CAAC,OAAO,CAAC,EAAE;AAC9G,YAAY,OAAO;AACnB,SAAS;AACT,QAAQ,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,SAAS,CAAC,MAAM,GAAG,IAAI,wBAAwB,CAAC,sBAAsB,EAAE,SAAS,EAAE,gBAAgB,CAAC,CAAC;AACjH,YAAY,SAAS,CAAC,KAAK,GAAG,IAAI,uBAAuB,CAAC,qBAAqB,EAAE,gBAAgB,CAAC,CAAC;AACnG,YAAY,SAAS,CAAC,OAAO,GAAG,IAAI,kCAAkC,CAAC,6BAA6B,EAAE,SAAS,EAAE,gBAAgB,CAAC,CAAC;AACnI,YAAY,SAAS,CAAC,SAAS,GAAG,IAAI,kCAAkC,CAAC,+BAA+B,EAAE,SAAS,EAAE,gBAAgB,CAAC,CAAC;AACvI,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;;"}
@@ -0,0 +1,45 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.generateCustomQueriesProperty = exports.generateCustomMutationsProperty = exports.generateCustomOperationsProperty = void 0;
5
+ const types_1 = require("../types");
6
+ const custom_1 = require("./operations/custom");
7
+ const operationTypeMap = {
8
+ queries: 'query',
9
+ mutations: 'mutation',
10
+ };
11
+ function generateCustomOperationsProperty(client, config, operationsType) {
12
+ // some bundlers end up with `Amplify.configure` being called *after* generate client.
13
+ // if that occurs, we need to *not error* while we wait. handling for late configuration
14
+ // occurs in `generateClient()`. we do not need to subscribe to Hub events here.
15
+ if (!config) {
16
+ return {};
17
+ }
18
+ const modelIntrospection = config.modelIntrospection;
19
+ // model intro schema might be absent if there's not actually a configured GraphQL API
20
+ if (!modelIntrospection) {
21
+ return {};
22
+ }
23
+ // custom operations will be absent from model intro schema if no custom ops
24
+ // are present on the source schema.
25
+ const operations = modelIntrospection[operationsType];
26
+ if (!operations) {
27
+ return {};
28
+ }
29
+ const ops = {};
30
+ const useContext = client[types_1.__amplify] === null;
31
+ for (const operation of Object.values(operations)) {
32
+ ops[operation.name] = (0, custom_1.customOpFactory)(client, modelIntrospection, operationTypeMap[operationsType], operation, useContext);
33
+ }
34
+ return ops;
35
+ }
36
+ exports.generateCustomOperationsProperty = generateCustomOperationsProperty;
37
+ function generateCustomMutationsProperty(client, config) {
38
+ return generateCustomOperationsProperty(client, config, 'mutations');
39
+ }
40
+ exports.generateCustomMutationsProperty = generateCustomMutationsProperty;
41
+ function generateCustomQueriesProperty(client, config) {
42
+ return generateCustomOperationsProperty(client, config, 'queries');
43
+ }
44
+ exports.generateCustomQueriesProperty = generateCustomQueriesProperty;
45
+ //# sourceMappingURL=generateCustomOperationsProperty.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateCustomOperationsProperty.js","sources":["../../../src/internals/generateCustomOperationsProperty.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.generateCustomQueriesProperty = exports.generateCustomMutationsProperty = exports.generateCustomOperationsProperty = void 0;\nconst types_1 = require(\"../types\");\nconst custom_1 = require(\"./operations/custom\");\nconst operationTypeMap = {\n queries: 'query',\n mutations: 'mutation',\n};\nfunction generateCustomOperationsProperty(client, config, operationsType) {\n // some bundlers end up with `Amplify.configure` being called *after* generate client.\n // if that occurs, we need to *not error* while we wait. handling for late configuration\n // occurs in `generateClient()`. we do not need to subscribe to Hub events here.\n if (!config) {\n return {};\n }\n const modelIntrospection = config.modelIntrospection;\n // model intro schema might be absent if there's not actually a configured GraphQL API\n if (!modelIntrospection) {\n return {};\n }\n // custom operations will be absent from model intro schema if no custom ops\n // are present on the source schema.\n const operations = modelIntrospection[operationsType];\n if (!operations) {\n return {};\n }\n const ops = {};\n const useContext = client[types_1.__amplify] === null;\n for (const operation of Object.values(operations)) {\n ops[operation.name] = (0, custom_1.customOpFactory)(client, modelIntrospection, operationTypeMap[operationsType], operation, useContext);\n }\n return ops;\n}\nexports.generateCustomOperationsProperty = generateCustomOperationsProperty;\nfunction generateCustomMutationsProperty(client, config) {\n return generateCustomOperationsProperty(client, config, 'mutations');\n}\nexports.generateCustomMutationsProperty = generateCustomMutationsProperty;\nfunction generateCustomQueriesProperty(client, config) {\n return generateCustomOperationsProperty(client, config, 'queries');\n}\nexports.generateCustomQueriesProperty = generateCustomQueriesProperty;\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,6BAA6B,GAAG,OAAO,CAAC,+BAA+B,GAAG,OAAO,CAAC,gCAAgC,GAAG,KAAK,CAAC,CAAC;AACpI,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACpC,MAAM,QAAQ,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAChD,MAAM,gBAAgB,GAAG;AACzB,IAAI,OAAO,EAAE,OAAO;AACpB,IAAI,SAAS,EAAE,UAAU;AACzB,CAAC,CAAC;AACF,SAAS,gCAAgC,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE;AAC1E;AACA;AACA;AACA,IAAI,IAAI,CAAC,MAAM,EAAE;AACjB,QAAQ,OAAO,EAAE,CAAC;AAClB,KAAK;AACL,IAAI,MAAM,kBAAkB,GAAG,MAAM,CAAC,kBAAkB,CAAC;AACzD;AACA,IAAI,IAAI,CAAC,kBAAkB,EAAE;AAC7B,QAAQ,OAAO,EAAE,CAAC;AAClB,KAAK;AACL;AACA;AACA,IAAI,MAAM,UAAU,GAAG,kBAAkB,CAAC,cAAc,CAAC,CAAC;AAC1D,IAAI,IAAI,CAAC,UAAU,EAAE;AACrB,QAAQ,OAAO,EAAE,CAAC;AAClB,KAAK;AACL,IAAI,MAAM,GAAG,GAAG,EAAE,CAAC;AACnB,IAAI,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC;AAC1D,IAAI,KAAK,MAAM,SAAS,IAAI,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE;AACvD,QAAQ,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,IAAI,QAAQ,CAAC,eAAe,EAAE,MAAM,EAAE,kBAAkB,EAAE,gBAAgB,CAAC,cAAc,CAAC,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;AACjJ,KAAK;AACL,IAAI,OAAO,GAAG,CAAC;AACf,CAAC;AACD,OAAO,CAAC,gCAAgC,GAAG,gCAAgC,CAAC;AAC5E,SAAS,+BAA+B,CAAC,MAAM,EAAE,MAAM,EAAE;AACzD,IAAI,OAAO,gCAAgC,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;AACzE,CAAC;AACD,OAAO,CAAC,+BAA+B,GAAG,+BAA+B,CAAC;AAC1E,SAAS,6BAA6B,CAAC,MAAM,EAAE,MAAM,EAAE;AACvD,IAAI,OAAO,gCAAgC,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;AACvE,CAAC;AACD,OAAO,CAAC,6BAA6B,GAAG,6BAA6B;;"}
@@ -0,0 +1,289 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.customOpFactory = void 0;
5
+ const APIClient_1 = require("../APIClient");
6
+ /**
7
+ * Builds an operation function, embedded with all client and context data, that
8
+ * can be attached to a client as a custom query or mutation.
9
+ *
10
+ * If we have this source schema:
11
+ *
12
+ * ```typescript
13
+ * a.schema({
14
+ * echo: a.query()
15
+ * .arguments({input: a.string().required()})
16
+ * .returns(a.string())
17
+ * })
18
+ * ```
19
+ *
20
+ * Our model intro schema will contain an entry like this:
21
+ *
22
+ * ```ts
23
+ * {
24
+ * queries: {
25
+ * echo: {
26
+ * name: "echo",
27
+ * isArray: false,
28
+ * type: 'String',
29
+ * isRequired: false,
30
+ * arguments: {
31
+ * input: {
32
+ * name: 'input',
33
+ * isArray: false,
34
+ * type: String,
35
+ * isRequired: true
36
+ * }
37
+ * }
38
+ * }
39
+ * }
40
+ * }
41
+ * ```
42
+ *
43
+ * The `echo` object is used to build the `echo' method that goes here:
44
+ *
45
+ * ```typescript
46
+ * const client = generateClent()
47
+ * const { data } = await client.queries.echo({input: 'a string'});
48
+ * // ^
49
+ * // |
50
+ * // +-- This one right here.
51
+ * //
52
+ * ```
53
+ *
54
+ *
55
+ * @param client The client to run graphql queries through.
56
+ * @param modelIntrospection The model introspection schema the op comes from.
57
+ * @param operationType The broad category of graphql operation.
58
+ * @param operation The operation definition from the introspection schema.
59
+ * @param useContext Whether the function needs to accept an SSR context.
60
+ * @returns The operation function to attach to query, mutations, etc.
61
+ */
62
+ function customOpFactory(client, modelIntrospection, operationType, operation, useContext) {
63
+ const opWithContext = async (contextSpec, arg, options) => {
64
+ return _op(client, modelIntrospection, operationType, operation, arg, options, contextSpec);
65
+ };
66
+ const op = async (arg, options) => {
67
+ return _op(client, modelIntrospection, operationType, operation, arg, options);
68
+ };
69
+ return useContext ? opWithContext : op;
70
+ }
71
+ exports.customOpFactory = customOpFactory;
72
+ /**
73
+ * Runtime test and type guard to check whether `o[field]` is a `String`.
74
+ *
75
+ * ```typescript
76
+ * if (hasStringField(o, 'prop')) {
77
+ * const s = o.prop;
78
+ * // ^? const s: string
79
+ * }
80
+ * ```
81
+ *
82
+ * @param o Object to inspect
83
+ * @param field Field to look for
84
+ * @returns Boolean: `true` if the `o[field]` is a `string`
85
+ */
86
+ function hasStringField(o, field) {
87
+ return typeof o[field] === 'string';
88
+ }
89
+ /**
90
+ * Generates "outer" arguments string for a custom operation. For example,
91
+ * in this operation:
92
+ *
93
+ * ```graphql
94
+ * query MyQuery(InputString: String!) {
95
+ * echoString(InputString: $InputString)
96
+ * }
97
+ * ```
98
+ *
99
+ * This function returns the top/outer level arguments as a string:
100
+ *
101
+ * ```json
102
+ * "InputString: String!"
103
+ * ```
104
+ *
105
+ * @param operation Operation object from model introspection schema.
106
+ * @returns "outer" arguments string
107
+ */
108
+ function outerArguments(operation) {
109
+ const args = Object.entries(operation.arguments)
110
+ .map(([k, v]) => {
111
+ const baseType = v.type + (v.isRequired ? '!' : '');
112
+ const finalType = v.isArray
113
+ ? `[${baseType}]${v.isArrayNullable ? '' : '!'}`
114
+ : baseType;
115
+ return `$${k}: ${finalType}`;
116
+ })
117
+ .join(', ');
118
+ return args.length > 0 ? `(${args})` : '';
119
+ }
120
+ /**
121
+ * Generates "inner" arguments string for a custom operation. For example,
122
+ * in this operation:
123
+ *
124
+ * ```graphql
125
+ * query MyQuery(InputString: String!) {
126
+ * echoString(InputString: $InputString)
127
+ * }
128
+ * ```
129
+ *
130
+ * This function returns the inner arguments as a string:
131
+ *
132
+ * ```json
133
+ * "InputString: $InputString"
134
+ * ```
135
+ *
136
+ * @param operation Operation object from model introspection schema.
137
+ * @returns "outer" arguments string
138
+ */
139
+ function innerArguments(operation) {
140
+ const args = Object.entries(operation.arguments)
141
+ .map(([k, v]) => `${k}: $${k}`)
142
+ .join(', ');
143
+ return args.length > 0 ? `(${args})` : '';
144
+ }
145
+ /**
146
+ * Accepts a Model or NonModel from generated introspection schema and
147
+ * generates the selection set string.
148
+ *
149
+ * @param nonModel Model or nonModel object from introspection schema.
150
+ * @returns String selection set.
151
+ */
152
+ function modelishTypeSelectionSet(nonModel) {
153
+ return Object.values(nonModel.fields)
154
+ .filter(field => hasStringField(field, 'type') ||
155
+ hasStringField(field.type, 'nonModel') ||
156
+ hasStringField(field.type, 'enum'))
157
+ .map(field => field.name)
158
+ .join(' ');
159
+ }
160
+ /**
161
+ * Generates the selection set string for a custom operation. This is slightly
162
+ * different than the selection set generation for models. If the custom op returns
163
+ * a primitive or enum types, it doen't require a selection set at all.
164
+ *
165
+ * E.g., the graphql might look like this:
166
+ *
167
+ * ```graphql
168
+ * query MyQuery {
169
+ * echoString(inputString: "whatever")
170
+ * }
171
+ * # ^
172
+ * # |
173
+ * # +-- no selection set
174
+ * ```
175
+ *
176
+ * Non-primitive return type selection set generation will be similar to other
177
+ * model operations.
178
+ *
179
+ * @param modelIntrospection The full code-generated introspection schema.
180
+ * @param operation The operation object from the schema.
181
+ * @returns The selection set as a string.
182
+ */
183
+ function operationSelectionSet(modelIntrospection, operation) {
184
+ if (hasStringField(operation, 'type') ||
185
+ hasStringField(operation.type, 'enum')) {
186
+ return '';
187
+ }
188
+ else if (hasStringField(operation.type, 'nonModel')) {
189
+ const model = modelIntrospection.nonModels[operation.type.nonModel];
190
+ return `{${modelishTypeSelectionSet(model)}}`;
191
+ }
192
+ else if (hasStringField(operation.type, 'model')) {
193
+ const nonModel = modelIntrospection.models[operation.type.model];
194
+ return `{${modelishTypeSelectionSet(nonModel)}}`;
195
+ }
196
+ else {
197
+ return '';
198
+ }
199
+ }
200
+ /**
201
+ * Maps an arguments objec to graphql variables, removing superfluous args and
202
+ * screaming loudly when required args are missing.
203
+ *
204
+ * @param operation The operation to construct graphql request variables for.
205
+ * @param args The arguments to map variables from.
206
+ * @returns The graphql variables object.
207
+ */
208
+ function operationVariables(operation, args = {}) {
209
+ const variables = {};
210
+ for (const argDef of Object.values(operation.arguments)) {
211
+ if (typeof args[argDef.name] !== 'undefined') {
212
+ variables[argDef.name] = args[argDef.name];
213
+ }
214
+ else if (argDef.isRequired) {
215
+ // At this point, the variable is both required and missing: We don't need
216
+ // to continue. The operation is expected to fail.
217
+ throw new Error(`${operation.name} requires arguments '${argDef.name}'`);
218
+ }
219
+ }
220
+ return variables;
221
+ }
222
+ /**
223
+ * Executes an operation from the given model intro schema against a client, returning
224
+ * a fully instantiated model when relevant.
225
+ *
226
+ * @param client The client to operate `graphql()` calls through.
227
+ * @param modelIntrospection The model intro schema to construct requests from.
228
+ * @param operationType The high level graphql operation type.
229
+ * @param operation The specific operation name, args, return type details.
230
+ * @param args The arguments to provide to the operation as variables.
231
+ * @param options Request options like headers, etc.
232
+ * @param context SSR context if relevant.
233
+ * @returns Result from the graphql request, model-instantiated when relevant.
234
+ */
235
+ async function _op(client, modelIntrospection, operationType, operation, args, options, context) {
236
+ const { name: operationName } = operation;
237
+ const auth = (0, APIClient_1.authModeParams)(client, options);
238
+ const headers = (0, APIClient_1.getCustomHeaders)(client, options?.headers);
239
+ const outerArgsString = outerArguments(operation);
240
+ const innerArgsString = innerArguments(operation);
241
+ const selectionSet = operationSelectionSet(modelIntrospection, operation);
242
+ const returnTypeModelName = hasStringField(operation.type, 'model')
243
+ ? operation.type.model
244
+ : undefined;
245
+ const query = `
246
+ ${operationType.toLocaleLowerCase()}${outerArgsString} {
247
+ ${operationName}${innerArgsString} ${selectionSet}
248
+ }
249
+ `;
250
+ const variables = operationVariables(operation, args);
251
+ try {
252
+ const { data, extensions } = context
253
+ ? (await client.graphql(context, {
254
+ ...auth,
255
+ query,
256
+ variables,
257
+ }, headers))
258
+ : (await client.graphql({
259
+ ...auth,
260
+ query,
261
+ variables,
262
+ }, headers));
263
+ // flatten response
264
+ if (data) {
265
+ const [key] = Object.keys(data);
266
+ const flattenedResult = (0, APIClient_1.flattenItems)(data)[key];
267
+ // TODO: custom selection set. current selection set is default selection set only
268
+ // custom selection set requires data-schema-type + runtime updates above.
269
+ const [initialized] = returnTypeModelName
270
+ ? (0, APIClient_1.initializeModel)(client, returnTypeModelName, [flattenedResult], modelIntrospection, auth.authMode, auth.authToken, !!context)
271
+ : [flattenedResult];
272
+ return { data: initialized, extensions };
273
+ }
274
+ else {
275
+ return { data: null, extensions };
276
+ }
277
+ }
278
+ catch (error) {
279
+ if (error.errors) {
280
+ // graphql errors pass through
281
+ return error;
282
+ }
283
+ else {
284
+ // non-graphql errors re re-thrown
285
+ throw error;
286
+ }
287
+ }
288
+ }
289
+ //# sourceMappingURL=custom.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom.js","sources":["../../../../src/internals/operations/custom.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.customOpFactory = void 0;\nconst APIClient_1 = require(\"../APIClient\");\n/**\n * Builds an operation function, embedded with all client and context data, that\n * can be attached to a client as a custom query or mutation.\n *\n * If we have this source schema:\n *\n * ```typescript\n * a.schema({\n * echo: a.query()\n * .arguments({input: a.string().required()})\n * .returns(a.string())\n * })\n * ```\n *\n * Our model intro schema will contain an entry like this:\n *\n * ```ts\n * {\n * queries: {\n * echo: {\n * name: \"echo\",\n * isArray: false,\n * type: 'String',\n * isRequired: false,\n * arguments: {\n * input: {\n * name: 'input',\n * isArray: false,\n * type: String,\n * isRequired: true\n * }\n * }\n * }\n * }\n * }\n * ```\n *\n * The `echo` object is used to build the `echo' method that goes here:\n *\n * ```typescript\n * const client = generateClent()\n * const { data } = await client.queries.echo({input: 'a string'});\n * // ^\n * // |\n * // +-- This one right here.\n * //\n * ```\n *\n *\n * @param client The client to run graphql queries through.\n * @param modelIntrospection The model introspection schema the op comes from.\n * @param operationType The broad category of graphql operation.\n * @param operation The operation definition from the introspection schema.\n * @param useContext Whether the function needs to accept an SSR context.\n * @returns The operation function to attach to query, mutations, etc.\n */\nfunction customOpFactory(client, modelIntrospection, operationType, operation, useContext) {\n const opWithContext = async (contextSpec, arg, options) => {\n return _op(client, modelIntrospection, operationType, operation, arg, options, contextSpec);\n };\n const op = async (arg, options) => {\n return _op(client, modelIntrospection, operationType, operation, arg, options);\n };\n return useContext ? opWithContext : op;\n}\nexports.customOpFactory = customOpFactory;\n/**\n * Runtime test and type guard to check whether `o[field]` is a `String`.\n *\n * ```typescript\n * if (hasStringField(o, 'prop')) {\n * const s = o.prop;\n * // ^? const s: string\n * }\n * ```\n *\n * @param o Object to inspect\n * @param field Field to look for\n * @returns Boolean: `true` if the `o[field]` is a `string`\n */\nfunction hasStringField(o, field) {\n return typeof o[field] === 'string';\n}\n/**\n * Generates \"outer\" arguments string for a custom operation. For example,\n * in this operation:\n *\n * ```graphql\n * query MyQuery(InputString: String!) {\n * echoString(InputString: $InputString)\n * }\n * ```\n *\n * This function returns the top/outer level arguments as a string:\n *\n * ```json\n * \"InputString: String!\"\n * ```\n *\n * @param operation Operation object from model introspection schema.\n * @returns \"outer\" arguments string\n */\nfunction outerArguments(operation) {\n const args = Object.entries(operation.arguments)\n .map(([k, v]) => {\n const baseType = v.type + (v.isRequired ? '!' : '');\n const finalType = v.isArray\n ? `[${baseType}]${v.isArrayNullable ? '' : '!'}`\n : baseType;\n return `$${k}: ${finalType}`;\n })\n .join(', ');\n return args.length > 0 ? `(${args})` : '';\n}\n/**\n * Generates \"inner\" arguments string for a custom operation. For example,\n * in this operation:\n *\n * ```graphql\n * query MyQuery(InputString: String!) {\n * echoString(InputString: $InputString)\n * }\n * ```\n *\n * This function returns the inner arguments as a string:\n *\n * ```json\n * \"InputString: $InputString\"\n * ```\n *\n * @param operation Operation object from model introspection schema.\n * @returns \"outer\" arguments string\n */\nfunction innerArguments(operation) {\n const args = Object.entries(operation.arguments)\n .map(([k, v]) => `${k}: $${k}`)\n .join(', ');\n return args.length > 0 ? `(${args})` : '';\n}\n/**\n * Accepts a Model or NonModel from generated introspection schema and\n * generates the selection set string.\n *\n * @param nonModel Model or nonModel object from introspection schema.\n * @returns String selection set.\n */\nfunction modelishTypeSelectionSet(nonModel) {\n return Object.values(nonModel.fields)\n .filter(field => hasStringField(field, 'type') ||\n hasStringField(field.type, 'nonModel') ||\n hasStringField(field.type, 'enum'))\n .map(field => field.name)\n .join(' ');\n}\n/**\n * Generates the selection set string for a custom operation. This is slightly\n * different than the selection set generation for models. If the custom op returns\n * a primitive or enum types, it doen't require a selection set at all.\n *\n * E.g., the graphql might look like this:\n *\n * ```graphql\n * query MyQuery {\n * echoString(inputString: \"whatever\")\n * }\n * # ^\n * # |\n * # +-- no selection set\n * ```\n *\n * Non-primitive return type selection set generation will be similar to other\n * model operations.\n *\n * @param modelIntrospection The full code-generated introspection schema.\n * @param operation The operation object from the schema.\n * @returns The selection set as a string.\n */\nfunction operationSelectionSet(modelIntrospection, operation) {\n if (hasStringField(operation, 'type') ||\n hasStringField(operation.type, 'enum')) {\n return '';\n }\n else if (hasStringField(operation.type, 'nonModel')) {\n const model = modelIntrospection.nonModels[operation.type.nonModel];\n return `{${modelishTypeSelectionSet(model)}}`;\n }\n else if (hasStringField(operation.type, 'model')) {\n const nonModel = modelIntrospection.models[operation.type.model];\n return `{${modelishTypeSelectionSet(nonModel)}}`;\n }\n else {\n return '';\n }\n}\n/**\n * Maps an arguments objec to graphql variables, removing superfluous args and\n * screaming loudly when required args are missing.\n *\n * @param operation The operation to construct graphql request variables for.\n * @param args The arguments to map variables from.\n * @returns The graphql variables object.\n */\nfunction operationVariables(operation, args = {}) {\n const variables = {};\n for (const argDef of Object.values(operation.arguments)) {\n if (typeof args[argDef.name] !== 'undefined') {\n variables[argDef.name] = args[argDef.name];\n }\n else if (argDef.isRequired) {\n // At this point, the variable is both required and missing: We don't need\n // to continue. The operation is expected to fail.\n throw new Error(`${operation.name} requires arguments '${argDef.name}'`);\n }\n }\n return variables;\n}\n/**\n * Executes an operation from the given model intro schema against a client, returning\n * a fully instantiated model when relevant.\n *\n * @param client The client to operate `graphql()` calls through.\n * @param modelIntrospection The model intro schema to construct requests from.\n * @param operationType The high level graphql operation type.\n * @param operation The specific operation name, args, return type details.\n * @param args The arguments to provide to the operation as variables.\n * @param options Request options like headers, etc.\n * @param context SSR context if relevant.\n * @returns Result from the graphql request, model-instantiated when relevant.\n */\nasync function _op(client, modelIntrospection, operationType, operation, args, options, context) {\n const { name: operationName } = operation;\n const auth = (0, APIClient_1.authModeParams)(client, options);\n const headers = (0, APIClient_1.getCustomHeaders)(client, options?.headers);\n const outerArgsString = outerArguments(operation);\n const innerArgsString = innerArguments(operation);\n const selectionSet = operationSelectionSet(modelIntrospection, operation);\n const returnTypeModelName = hasStringField(operation.type, 'model')\n ? operation.type.model\n : undefined;\n const query = `\n\t\t${operationType.toLocaleLowerCase()}${outerArgsString} {\n\t\t\t${operationName}${innerArgsString} ${selectionSet}\n\t\t}\n\t`;\n const variables = operationVariables(operation, args);\n try {\n const { data, extensions } = context\n ? (await client.graphql(context, {\n ...auth,\n query,\n variables,\n }, headers))\n : (await client.graphql({\n ...auth,\n query,\n variables,\n }, headers));\n // flatten response\n if (data) {\n const [key] = Object.keys(data);\n const flattenedResult = (0, APIClient_1.flattenItems)(data)[key];\n // TODO: custom selection set. current selection set is default selection set only\n // custom selection set requires data-schema-type + runtime updates above.\n const [initialized] = returnTypeModelName\n ? (0, APIClient_1.initializeModel)(client, returnTypeModelName, [flattenedResult], modelIntrospection, auth.authMode, auth.authToken, !!context)\n : [flattenedResult];\n return { data: initialized, extensions };\n }\n else {\n return { data: null, extensions };\n }\n }\n catch (error) {\n if (error.errors) {\n // graphql errors pass through\n return error;\n }\n else {\n // non-graphql errors re re-thrown\n throw error;\n }\n }\n}\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,eAAe,GAAG,KAAK,CAAC,CAAC;AACjC,MAAM,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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S,EAAE,CAAC,CAAC,OAAO,CAAC;AAChK,kBAAkB,CAAC,eAAe,CAAC,CAAC;AACpC,YAAY,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC;AACrD,SAAS;AACT,aAAa;AACb,YAAY,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;AAC9C,SAAS;AACT,KAAK;AACL,IAAI,OAAO,KAAK,EAAE;AAClB,QAAQ,IAAI,KAAK,CAAC,MAAM,EAAE;AAC1B;AACA,YAAY,OAAO,KAAK,CAAC;AACzB,SAAS;AACT,aAAa;AACb;AACA,YAAY,MAAM,KAAK,CAAC;AACxB,SAAS;AACT,KAAK;AACL;;"}
@@ -7,6 +7,9 @@ exports.generateClientWithAmplifyInstance = void 0;
7
7
  const __1 = require("..");
8
8
  const generateModelsProperty_1 = require("./generateModelsProperty");
9
9
  const types_1 = require("../../types");
10
+ const isApiGraphQLProviderConfig_1 = require("../utils/isApiGraphQLProviderConfig");
11
+ const generateEnumsProperty_1 = require("../utils/generateEnumsProperty");
12
+ const generateCustomOperationsProperty_1 = require("../generateCustomOperationsProperty");
10
13
  /**
11
14
  * @private
12
15
  *
@@ -23,11 +26,18 @@ function generateClientWithAmplifyInstance(params) {
23
26
  [types_1.__amplify]: params.amplify,
24
27
  [types_1.__authMode]: params.authMode,
25
28
  [types_1.__authToken]: params.authToken,
29
+ [types_1.__headers]: params.headers,
26
30
  graphql: __1.graphql,
27
31
  cancel: __1.cancel,
28
32
  isCancelError: __1.isCancelError,
29
33
  };
30
- client.models = (0, generateModelsProperty_1.generateModelsProperty)(client, params);
34
+ const apiGraphqlConfig = params.config?.API?.GraphQL;
35
+ 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);
40
+ }
31
41
  return client;
32
42
  }
33
43
  exports.generateClientWithAmplifyInstance = generateClientWithAmplifyInstance;
@@ -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 generateModelsProperty_1 = require(\"./generateModelsProperty\");\nconst types_1 = require(\"../../types\");\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 graphql: __1.graphql,\n cancel: __1.cancel,\n isCancelError: __1.isCancelError,\n };\n client.models = (0, generateModelsProperty_1.generateModelsProperty)(client, params);\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,wBAAwB,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;AACrE,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AACvC;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,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,CAAC,MAAM,GAAG,IAAI,wBAAwB,CAAC,sBAAsB,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AACzF,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 __1 = require(\"..\");\nconst generateModelsProperty_1 = require(\"./generateModelsProperty\");\nconst types_1 = require(\"../../types\");\nconst isApiGraphQLProviderConfig_1 = require(\"../utils/isApiGraphQLProviderConfig\");\nconst generateEnumsProperty_1 = require(\"../utils/generateEnumsProperty\");\nconst generateCustomOperationsProperty_1 = require(\"../generateCustomOperationsProperty\");\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,wBAAwB,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;AACrE,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AACvC,MAAM,4BAA4B,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC;AACpF,MAAM,uBAAuB,GAAG,OAAO,CAAC,gCAAgC,CAAC,CAAC;AAC1E,MAAM,kCAAkC,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC;AAC1F;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;;"}
@@ -3,6 +3,7 @@ import { graphql, cancel, isCancelError } from './v6.mjs';
3
3
  import { generateEnumsProperty } from './utils/generateEnumsProperty.mjs';
4
4
  import { generateModelsProperty } from './utils/generateModelsProperty.mjs';
5
5
  import { isApiGraphQLConfig } from './utils/isApiGraphQLProviderConfig.mjs';
6
+ import { generateCustomQueriesProperty, generateCustomMutationsProperty } from './generateCustomOperationsProperty.mjs';
6
7
  import { __amplify, __authMode, __authToken, __headers } from '../types/index.mjs';
7
8
  import { isConfigureEventWithResourceConfig } from './utils/isConfigureEventWithResourceConfig.mjs';
8
9
 
@@ -28,11 +29,15 @@ function generateClient(params) {
28
29
  isCancelError,
29
30
  models: emptyProperty,
30
31
  enums: emptyProperty,
32
+ queries: emptyProperty,
33
+ mutations: emptyProperty,
31
34
  };
32
35
  const apiGraphqlConfig = params.amplify.getConfig().API?.GraphQL;
33
36
  if (isApiGraphQLConfig(apiGraphqlConfig)) {
34
37
  client.models = generateModelsProperty(client, apiGraphqlConfig);
35
38
  client.enums = generateEnumsProperty(apiGraphqlConfig);
39
+ client.queries = generateCustomQueriesProperty(client, apiGraphqlConfig);
40
+ client.mutations = generateCustomMutationsProperty(client, apiGraphqlConfig);
36
41
  }
37
42
  else {
38
43
  // This happens when the `Amplify.configure()` call gets evaluated after the `generateClient()` call.
@@ -60,6 +65,8 @@ const generateModelsPropertyOnAmplifyConfigure = (clientRef) => {
60
65
  if (isApiGraphQLConfig(apiGraphQLConfig)) {
61
66
  clientRef.models = generateModelsProperty(clientRef, apiGraphQLConfig);
62
67
  clientRef.enums = generateEnumsProperty(apiGraphQLConfig);
68
+ clientRef.queries = generateCustomQueriesProperty(clientRef, apiGraphQLConfig);
69
+ clientRef.mutations = generateCustomMutationsProperty(clientRef, apiGraphQLConfig);
63
70
  }
64
71
  });
65
72
  };
@@ -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 { graphql, cancel, isCancelError } from './v6';\nimport { generateEnumsProperty } from './utils/generateEnumsProperty';\nimport { generateModelsProperty } from './utils/generateModelsProperty';\nimport { isApiGraphQLConfig } from './utils/isApiGraphQLProviderConfig';\nimport { __amplify, __authMode, __authToken, __headers, } from '../types';\nimport { isConfigureEventWithResourceConfig } from './utils/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 };\n const apiGraphqlConfig = params.amplify.getConfig().API?.GraphQL;\n if (isApiGraphQLConfig(apiGraphqlConfig)) {\n client.models = generateModelsProperty(client, apiGraphqlConfig);\n client.enums = generateEnumsProperty(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 }\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;AAQA;AACA;A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AAI,kBAAkB,CAAC,gBAAgB,CAAC,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,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 { graphql, cancel, isCancelError } from './v6';\nimport { generateEnumsProperty } from './utils/generateEnumsProperty';\nimport { generateModelsProperty } from './utils/generateModelsProperty';\nimport { isApiGraphQLConfig } from './utils/isApiGraphQLProviderConfig';\nimport { generateCustomQueriesProperty, generateCustomMutationsProperty, } from './generateCustomOperationsProperty';\nimport { __amplify, __authMode, __authToken, __headers, } from '../types';\nimport { isConfigureEventWithResourceConfig } from './utils/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 };\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 }\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 }\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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AI,kBAAkB,CAAC,gBAAgB,CAAC,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,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;;;;"}
@@ -0,0 +1,8 @@
1
+ import { CustomQueries, CustomMutations } from '@aws-amplify/data-schema-types';
2
+ import { V6Client } from '../types';
3
+ import { GraphQLProviderConfig } from '@aws-amplify/core/internals/utils';
4
+ type OpTypes = 'queries' | 'mutations';
5
+ export declare function generateCustomOperationsProperty<T extends Record<any, any>, OpType extends OpTypes>(client: V6Client<Record<string, any>>, config: GraphQLProviderConfig['GraphQL'], operationsType: OpType): OpType extends 'queries' ? CustomQueries<T> : CustomMutations<T>;
6
+ export declare function generateCustomMutationsProperty<T extends Record<any, any>>(client: V6Client<Record<string, any>>, config: GraphQLProviderConfig['GraphQL']): CustomMutations<T>;
7
+ export declare function generateCustomQueriesProperty<T extends Record<any, any>>(client: V6Client<Record<string, any>>, config: GraphQLProviderConfig['GraphQL']): CustomQueries<T>;
8
+ export {};
@@ -0,0 +1,41 @@
1
+ import { __amplify } from '../types/index.mjs';
2
+ import { customOpFactory } from './operations/custom.mjs';
3
+
4
+ const operationTypeMap = {
5
+ queries: 'query',
6
+ mutations: 'mutation',
7
+ };
8
+ function generateCustomOperationsProperty(client, config, operationsType) {
9
+ // some bundlers end up with `Amplify.configure` being called *after* generate client.
10
+ // if that occurs, we need to *not error* while we wait. handling for late configuration
11
+ // occurs in `generateClient()`. we do not need to subscribe to Hub events here.
12
+ if (!config) {
13
+ return {};
14
+ }
15
+ const modelIntrospection = config.modelIntrospection;
16
+ // model intro schema might be absent if there's not actually a configured GraphQL API
17
+ if (!modelIntrospection) {
18
+ return {};
19
+ }
20
+ // custom operations will be absent from model intro schema if no custom ops
21
+ // are present on the source schema.
22
+ const operations = modelIntrospection[operationsType];
23
+ if (!operations) {
24
+ return {};
25
+ }
26
+ const ops = {};
27
+ const useContext = client[__amplify] === null;
28
+ for (const operation of Object.values(operations)) {
29
+ ops[operation.name] = customOpFactory(client, modelIntrospection, operationTypeMap[operationsType], operation, useContext);
30
+ }
31
+ return ops;
32
+ }
33
+ function generateCustomMutationsProperty(client, config) {
34
+ return generateCustomOperationsProperty(client, config, 'mutations');
35
+ }
36
+ function generateCustomQueriesProperty(client, config) {
37
+ return generateCustomOperationsProperty(client, config, 'queries');
38
+ }
39
+
40
+ export { generateCustomMutationsProperty, generateCustomOperationsProperty, generateCustomQueriesProperty };
41
+ //# sourceMappingURL=generateCustomOperationsProperty.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateCustomOperationsProperty.mjs","sources":["../../../src/internals/generateCustomOperationsProperty.ts"],"sourcesContent":["import { __amplify } from '../types';\nimport { customOpFactory } from './operations/custom';\nconst operationTypeMap = {\n queries: 'query',\n mutations: 'mutation',\n};\nexport function generateCustomOperationsProperty(client, config, operationsType) {\n // some bundlers end up with `Amplify.configure` being called *after* generate client.\n // if that occurs, we need to *not error* while we wait. handling for late configuration\n // occurs in `generateClient()`. we do not need to subscribe to Hub events here.\n if (!config) {\n return {};\n }\n const modelIntrospection = config.modelIntrospection;\n // model intro schema might be absent if there's not actually a configured GraphQL API\n if (!modelIntrospection) {\n return {};\n }\n // custom operations will be absent from model intro schema if no custom ops\n // are present on the source schema.\n const operations = modelIntrospection[operationsType];\n if (!operations) {\n return {};\n }\n const ops = {};\n const useContext = client[__amplify] === null;\n for (const operation of Object.values(operations)) {\n ops[operation.name] = customOpFactory(client, modelIntrospection, operationTypeMap[operationsType], operation, useContext);\n }\n return ops;\n}\nexport function generateCustomMutationsProperty(client, config) {\n return generateCustomOperationsProperty(client, config, 'mutations');\n}\nexport function generateCustomQueriesProperty(client, config) {\n return generateCustomOperationsProperty(client, config, 'queries');\n}\n"],"names":[],"mappings":";;;AAEA,MAAM,gBAAgB,GAAG;AACzB,IAAI,OAAO,EAAE,OAAO;AACpB,IAAI,SAAS,EAAE,UAAU;AACzB,CAAC,CAAC;AACK,SAAS,gCAAgC,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE;AACjF;AACA;AACA;AACA,IAAI,IAAI,CAAC,MAAM,EAAE;AACjB,QAAQ,OAAO,EAAE,CAAC;AAClB,KAAK;AACL,IAAI,MAAM,kBAAkB,GAAG,MAAM,CAAC,kBAAkB,CAAC;AACzD;AACA,IAAI,IAAI,CAAC,kBAAkB,EAAE;AAC7B,QAAQ,OAAO,EAAE,CAAC;AAClB,KAAK;AACL;AACA;AACA,IAAI,MAAM,UAAU,GAAG,kBAAkB,CAAC,cAAc,CAAC,CAAC;AAC1D,IAAI,IAAI,CAAC,UAAU,EAAE;AACrB,QAAQ,OAAO,EAAE,CAAC;AAClB,KAAK;AACL,IAAI,MAAM,GAAG,GAAG,EAAE,CAAC;AACnB,IAAI,MAAM,UAAU,GAAG,MAAM,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC;AAClD,IAAI,KAAK,MAAM,SAAS,IAAI,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE;AACvD,QAAQ,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,MAAM,EAAE,kBAAkB,EAAE,gBAAgB,CAAC,cAAc,CAAC,EAAE,SAAS,EAAE,UAAU,CAAC,CA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