@aws-amplify/api-graphql 4.7.15 → 4.7.16-local-stack.00864ae.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 (40) hide show
  1. package/dist/cjs/Providers/constants.js +6 -3
  2. package/dist/cjs/Providers/constants.js.map +1 -1
  3. package/dist/cjs/internals/events/appsyncRequest.js +1 -2
  4. package/dist/cjs/internals/events/appsyncRequest.js.map +1 -1
  5. package/dist/cjs/internals/events/index.js +3 -4
  6. package/dist/cjs/internals/events/index.js.map +1 -1
  7. package/dist/cjs/internals/generateClient.js +1 -2
  8. package/dist/cjs/internals/generateClient.js.map +1 -1
  9. package/dist/cjs/internals/graphqlAuth.js +1 -2
  10. package/dist/cjs/internals/graphqlAuth.js.map +1 -1
  11. package/dist/cjs/internals/graphqlRequest.js +1 -2
  12. package/dist/cjs/internals/graphqlRequest.js.map +1 -1
  13. package/dist/cjs/internals/server/generateClientWithAmplifyInstance.js +1 -2
  14. package/dist/cjs/internals/server/generateClientWithAmplifyInstance.js.map +1 -1
  15. package/dist/cjs/internals/utils/runtimeTypeGuards/isApiGraphQLProviderConfig.js +1 -2
  16. package/dist/cjs/internals/utils/runtimeTypeGuards/isApiGraphQLProviderConfig.js.map +1 -1
  17. package/dist/cjs/internals/utils/runtimeTypeGuards/isConfigureEventWithResourceConfig.js +1 -2
  18. package/dist/cjs/internals/utils/runtimeTypeGuards/isConfigureEventWithResourceConfig.js.map +1 -1
  19. package/dist/cjs/internals/utils/runtimeTypeGuards/isGraphQLResponseWithErrors.js +1 -2
  20. package/dist/cjs/internals/utils/runtimeTypeGuards/isGraphQLResponseWithErrors.js.map +1 -1
  21. package/dist/cjs/internals/v6.js +3 -4
  22. package/dist/cjs/internals/v6.js.map +1 -1
  23. package/dist/cjs/server/generateClient.js +1 -2
  24. package/dist/cjs/server/generateClient.js.map +1 -1
  25. package/dist/cjs/types/PubSub.js +5 -2
  26. package/dist/cjs/types/PubSub.js.map +1 -1
  27. package/dist/cjs/types/index.js +4 -3
  28. package/dist/cjs/types/index.js.map +1 -1
  29. package/dist/cjs/utils/ReconnectionMonitor.js +1 -1
  30. package/dist/cjs/utils/ReconnectionMonitor.js.map +1 -1
  31. package/dist/cjs/utils/errors/assertValidationError.js +1 -2
  32. package/dist/cjs/utils/errors/assertValidationError.js.map +1 -1
  33. package/dist/cjs/utils/errors/repackageAuthError.js +1 -2
  34. package/dist/cjs/utils/errors/repackageAuthError.js.map +1 -1
  35. package/dist/cjs/utils/errors/validation.js +1 -1
  36. package/dist/cjs/utils/errors/validation.js.map +1 -1
  37. package/dist/esm/Providers/AWSWebSocketProvider/appsyncUrl.d.ts +1 -1
  38. package/dist/esm/Providers/constants.d.ts +1 -1
  39. package/dist/esm/utils/resolveLibraryOptions.d.ts +3 -3
  40. package/package.json +4 -9
@@ -13,6 +13,7 @@ exports.NON_RETRYABLE_ERROR_TYPES = [
13
13
  'UnauthorizedException',
14
14
  ];
15
15
  exports.CONNECTION_STATE_CHANGE = 'ConnectionStateChange';
16
+ var MESSAGE_TYPES;
16
17
  (function (MESSAGE_TYPES) {
17
18
  /**
18
19
  * Client -> Server message.
@@ -94,17 +95,19 @@ exports.CONNECTION_STATE_CHANGE = 'ConnectionStateChange';
94
95
  * This is the ack response from AWS AppSync Events to EVENT_STOP message
95
96
  */
96
97
  MESSAGE_TYPES["EVENT_COMPLETE"] = "unsubscribe_success";
97
- })(exports.MESSAGE_TYPES || (exports.MESSAGE_TYPES = {}));
98
+ })(MESSAGE_TYPES || (exports.MESSAGE_TYPES = MESSAGE_TYPES = {}));
99
+ var SUBSCRIPTION_STATUS;
98
100
  (function (SUBSCRIPTION_STATUS) {
99
101
  SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS["PENDING"] = 0] = "PENDING";
100
102
  SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS["CONNECTED"] = 1] = "CONNECTED";
101
103
  SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS["FAILED"] = 2] = "FAILED";
102
- })(exports.SUBSCRIPTION_STATUS || (exports.SUBSCRIPTION_STATUS = {}));
104
+ })(SUBSCRIPTION_STATUS || (exports.SUBSCRIPTION_STATUS = SUBSCRIPTION_STATUS = {}));
105
+ var SOCKET_STATUS;
103
106
  (function (SOCKET_STATUS) {
104
107
  SOCKET_STATUS[SOCKET_STATUS["CLOSED"] = 0] = "CLOSED";
105
108
  SOCKET_STATUS[SOCKET_STATUS["READY"] = 1] = "READY";
106
109
  SOCKET_STATUS[SOCKET_STATUS["CONNECTING"] = 2] = "CONNECTING";
107
- })(exports.SOCKET_STATUS || (exports.SOCKET_STATUS = {}));
110
+ })(SOCKET_STATUS || (exports.SOCKET_STATUS = SOCKET_STATUS = {}));
108
111
  exports.AWS_APPSYNC_REALTIME_HEADERS = {
109
112
  accept: 'application/json, text/javascript',
110
113
  'content-encoding': 'amz-1.0',
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sources":["../../../src/Providers/constants.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.RECONNECT_INTERVAL = exports.RECONNECT_DELAY = exports.DEFAULT_KEEP_ALIVE_ALERT_TIMEOUT = exports.DEFAULT_KEEP_ALIVE_HEARTBEAT_TIMEOUT = exports.DEFAULT_KEEP_ALIVE_TIMEOUT = exports.START_ACK_TIMEOUT = exports.CONNECTION_INIT_TIMEOUT = exports.AWS_APPSYNC_REALTIME_HEADERS = exports.SOCKET_STATUS = exports.SUBSCRIPTION_STATUS = exports.MESSAGE_TYPES = exports.CONNECTION_STATE_CHANGE = exports.NON_RETRYABLE_ERROR_TYPES = exports.NON_RETRYABLE_CODES = exports.MAX_DELAY_MS = exports.AMPLIFY_SYMBOL = void 0;\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nvar utils_1 = require(\"@aws-amplify/core/internals/utils\");\nObject.defineProperty(exports, \"AMPLIFY_SYMBOL\", { enumerable: true, get: function () { return utils_1.AMPLIFY_SYMBOL; } });\nexports.MAX_DELAY_MS = 5000;\nexports.NON_RETRYABLE_CODES = [400, 401, 403];\nexports.NON_RETRYABLE_ERROR_TYPES = [\n 'BadRequestException',\n 'UnauthorizedException',\n];\nexports.CONNECTION_STATE_CHANGE = 'ConnectionStateChange';\nvar MESSAGE_TYPES;\n(function (MESSAGE_TYPES) {\n /**\n * Client -> Server message.\n * This message type is the first message after handshake and this will initialize AWS AppSync RealTime communication\n */\n MESSAGE_TYPES[\"GQL_CONNECTION_INIT\"] = \"connection_init\";\n /**\n * Server -> Client message\n * This message type is in case there is an issue with AWS AppSync RealTime when establishing connection\n */\n MESSAGE_TYPES[\"GQL_CONNECTION_ERROR\"] = \"connection_error\";\n /**\n * Server -> Client message.\n * This message type is for the ack response from AWS AppSync RealTime for GQL_CONNECTION_INIT message\n */\n MESSAGE_TYPES[\"GQL_CONNECTION_ACK\"] = \"connection_ack\";\n /**\n * Client -> Server message.\n * This message type is for register subscriptions with AWS AppSync RealTime\n */\n MESSAGE_TYPES[\"GQL_START\"] = \"start\";\n /**\n * Server -> Client message.\n * This message type is for the ack response from AWS AppSync RealTime for GQL_START message\n */\n MESSAGE_TYPES[\"GQL_START_ACK\"] = \"start_ack\";\n /**\n * Server -> Client message.\n * This message type is for subscription message from AWS AppSync RealTime or Events\n */\n MESSAGE_TYPES[\"DATA\"] = \"data\";\n /**\n * Server -> Client message.\n * This message type helps the client to know is still receiving messages from AWS AppSync RealTime\n */\n MESSAGE_TYPES[\"GQL_CONNECTION_KEEP_ALIVE\"] = \"ka\";\n /**\n * Client -> Server message.\n * This message type is for unregister subscriptions with AWS AppSync RealTime\n */\n MESSAGE_TYPES[\"GQL_STOP\"] = \"stop\";\n /**\n * Server -> Client message.\n * This message type is for the ack response from AWS AppSync RealTime for GQL_STOP message\n */\n MESSAGE_TYPES[\"GQL_COMPLETE\"] = \"complete\";\n /**\n * Server -> Client message.\n * This message type is for sending error messages from AWS AppSync RealTime to the client\n */\n MESSAGE_TYPES[\"GQL_ERROR\"] = \"error\";\n /**\n * Client -> Server message.\n * This message type is for registering subscriptions with Events\n */\n MESSAGE_TYPES[\"EVENT_SUBSCRIBE\"] = \"subscribe\";\n /**\n * Client -> Server message.\n * This message type is for publishing a message with Events\n */\n MESSAGE_TYPES[\"EVENT_PUBLISH\"] = \"publish\";\n /**\n * Server -> Client message.\n * Server acknowledges successful subscription\n */\n MESSAGE_TYPES[\"EVENT_SUBSCRIBE_ACK\"] = \"subscribe_success\";\n /**\n * Server -> Client message.\n * Server acknowledges successful publish\n */\n MESSAGE_TYPES[\"EVENT_PUBLISH_ACK\"] = \"publish_success\";\n /**\n * Client -> Server message.\n * This message type is for unregister subscriptions with AWS AppSync RealTime\n */\n MESSAGE_TYPES[\"EVENT_STOP\"] = \"unsubscribe\";\n /**\n * Server -> Client message.\n * This is the ack response from AWS AppSync Events to EVENT_STOP message\n */\n MESSAGE_TYPES[\"EVENT_COMPLETE\"] = \"unsubscribe_success\";\n})(MESSAGE_TYPES = exports.MESSAGE_TYPES || (exports.MESSAGE_TYPES = {}));\nvar SUBSCRIPTION_STATUS;\n(function (SUBSCRIPTION_STATUS) {\n SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS[\"PENDING\"] = 0] = \"PENDING\";\n SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS[\"CONNECTED\"] = 1] = \"CONNECTED\";\n SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS[\"FAILED\"] = 2] = \"FAILED\";\n})(SUBSCRIPTION_STATUS = exports.SUBSCRIPTION_STATUS || (exports.SUBSCRIPTION_STATUS = {}));\nvar SOCKET_STATUS;\n(function (SOCKET_STATUS) {\n SOCKET_STATUS[SOCKET_STATUS[\"CLOSED\"] = 0] = \"CLOSED\";\n SOCKET_STATUS[SOCKET_STATUS[\"READY\"] = 1] = \"READY\";\n SOCKET_STATUS[SOCKET_STATUS[\"CONNECTING\"] = 2] = \"CONNECTING\";\n})(SOCKET_STATUS = exports.SOCKET_STATUS || (exports.SOCKET_STATUS = {}));\nexports.AWS_APPSYNC_REALTIME_HEADERS = {\n accept: 'application/json, text/javascript',\n 'content-encoding': 'amz-1.0',\n 'content-type': 'application/json; charset=UTF-8',\n};\n/**\n * Time in milleseconds to wait for GQL_CONNECTION_INIT message\n */\nexports.CONNECTION_INIT_TIMEOUT = 15000;\n/**\n * Time in milleseconds to wait for GQL_START_ACK message\n */\nexports.START_ACK_TIMEOUT = 15000;\n/**\n * Default Time in milleseconds to wait for GQL_CONNECTION_KEEP_ALIVE message\n */\nexports.DEFAULT_KEEP_ALIVE_TIMEOUT = 5 * 60 * 1000;\n/**\n * Default Time in milleseconds between monitoring checks of keep alive status\n */\nexports.DEFAULT_KEEP_ALIVE_HEARTBEAT_TIMEOUT = 5 * 1000;\n/**\n * Default Time in milleseconds to alert for missed GQL_CONNECTION_KEEP_ALIVE message\n */\nexports.DEFAULT_KEEP_ALIVE_ALERT_TIMEOUT = 65 * 1000;\n/**\n * Default delay time in milleseconds between when reconnect is triggered vs when it is attempted\n */\nexports.RECONNECT_DELAY = 5 * 1000;\n/**\n * Default interval time in milleseconds between when reconnect is re-attempted\n */\nexports.RECONNECT_INTERVAL = 60 * 1000;\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,kBAAkB,GAAG,OAAO,CAAC,eAAe,GAAG,OAAO,CAAC,gCAAgC,GAAG,OAAO,CAAC,oCAAoC,GAAG,OAAO,CAAC,0BAA0B,GAAG,OAAO,CAAC,iBAAiB,GAAG,OAAO,CAAC,uBAAuB,GAAG,OAAO,CAAC,4BAA4B,GAAG,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,mBAAmB,GAAG,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,uBAAuB,GAAG,OAAO,CAAC,yBAAyB,GAAG,OAAO,CAAC,m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CAAC,aAAa,GAAG,EAAE,CAAC,CAAC;AACzE,OAAO,CAAC,4BAA4B,GAAG;AACvC,IAAI,MAAM,EAAE,mCAAmC;AAC/C,IAAI,kBAAkB,EAAE,SAAS;AACjC,IAAI,cAAc,EAAE,iCAAiC;AACrD,CAAC;AACD;AACA;AACA;AACA,OAAO,CAAC,uBAAuB,GAAG,KAAK;AACvC;AACA;AACA;AACA,OAAO,CAAC,iBAAiB,GAAG,KAAK;AACjC;AACA;AACA;AACA,OAAO,CAAC,0BAA0B,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI;AAClD;AACA;AACA;AACA,OAAO,CAAC,oCAAoC,GAAG,CAAC,GAAG,IAAI;AACvD;AACA;AACA;AACA,OAAO,CAAC,gCAAgC,GAAG,EAAE,GAAG,IAAI;AACpD;AACA;AACA;AACA,OAAO,CAAC,eAAe,GAAG,CAAC,GAAG,IAAI;AAClC;AACA;AACA;AACA,OAAO,CAAC,kBAAkB,GAAG,EAAE,GAAG,IAAI;;"}
1
+ {"version":3,"file":"constants.js","sources":["../../../src/Providers/constants.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.RECONNECT_INTERVAL = exports.RECONNECT_DELAY = exports.DEFAULT_KEEP_ALIVE_ALERT_TIMEOUT = exports.DEFAULT_KEEP_ALIVE_HEARTBEAT_TIMEOUT = exports.DEFAULT_KEEP_ALIVE_TIMEOUT = exports.START_ACK_TIMEOUT = exports.CONNECTION_INIT_TIMEOUT = exports.AWS_APPSYNC_REALTIME_HEADERS = exports.SOCKET_STATUS = exports.SUBSCRIPTION_STATUS = exports.MESSAGE_TYPES = exports.CONNECTION_STATE_CHANGE = exports.NON_RETRYABLE_ERROR_TYPES = exports.NON_RETRYABLE_CODES = exports.MAX_DELAY_MS = exports.AMPLIFY_SYMBOL = void 0;\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nvar utils_1 = require(\"@aws-amplify/core/internals/utils\");\nObject.defineProperty(exports, \"AMPLIFY_SYMBOL\", { enumerable: true, get: function () { return utils_1.AMPLIFY_SYMBOL; } });\nexports.MAX_DELAY_MS = 5000;\nexports.NON_RETRYABLE_CODES = [400, 401, 403];\nexports.NON_RETRYABLE_ERROR_TYPES = [\n 'BadRequestException',\n 'UnauthorizedException',\n];\nexports.CONNECTION_STATE_CHANGE = 'ConnectionStateChange';\nvar MESSAGE_TYPES;\n(function (MESSAGE_TYPES) {\n /**\n * Client -> Server message.\n * This message type is the first message after handshake and this will initialize AWS AppSync RealTime communication\n */\n MESSAGE_TYPES[\"GQL_CONNECTION_INIT\"] = \"connection_init\";\n /**\n * Server -> Client message\n * This message type is in case there is an issue with AWS AppSync RealTime when establishing connection\n */\n MESSAGE_TYPES[\"GQL_CONNECTION_ERROR\"] = \"connection_error\";\n /**\n * Server -> Client message.\n * This message type is for the ack response from AWS AppSync RealTime for GQL_CONNECTION_INIT message\n */\n MESSAGE_TYPES[\"GQL_CONNECTION_ACK\"] = \"connection_ack\";\n /**\n * Client -> Server message.\n * This message type is for register subscriptions with AWS AppSync RealTime\n */\n MESSAGE_TYPES[\"GQL_START\"] = \"start\";\n /**\n * Server -> Client message.\n * This message type is for the ack response from AWS AppSync RealTime for GQL_START message\n */\n MESSAGE_TYPES[\"GQL_START_ACK\"] = \"start_ack\";\n /**\n * Server -> Client message.\n * This message type is for subscription message from AWS AppSync RealTime or Events\n */\n MESSAGE_TYPES[\"DATA\"] = \"data\";\n /**\n * Server -> Client message.\n * This message type helps the client to know is still receiving messages from AWS AppSync RealTime\n */\n MESSAGE_TYPES[\"GQL_CONNECTION_KEEP_ALIVE\"] = \"ka\";\n /**\n * Client -> Server message.\n * This message type is for unregister subscriptions with AWS AppSync RealTime\n */\n MESSAGE_TYPES[\"GQL_STOP\"] = \"stop\";\n /**\n * Server -> Client message.\n * This message type is for the ack response from AWS AppSync RealTime for GQL_STOP message\n */\n MESSAGE_TYPES[\"GQL_COMPLETE\"] = \"complete\";\n /**\n * Server -> Client message.\n * This message type is for sending error messages from AWS AppSync RealTime to the client\n */\n MESSAGE_TYPES[\"GQL_ERROR\"] = \"error\";\n /**\n * Client -> Server message.\n * This message type is for registering subscriptions with Events\n */\n MESSAGE_TYPES[\"EVENT_SUBSCRIBE\"] = \"subscribe\";\n /**\n * Client -> Server message.\n * This message type is for publishing a message with Events\n */\n MESSAGE_TYPES[\"EVENT_PUBLISH\"] = \"publish\";\n /**\n * Server -> Client message.\n * Server acknowledges successful subscription\n */\n MESSAGE_TYPES[\"EVENT_SUBSCRIBE_ACK\"] = \"subscribe_success\";\n /**\n * Server -> Client message.\n * Server acknowledges successful publish\n */\n MESSAGE_TYPES[\"EVENT_PUBLISH_ACK\"] = \"publish_success\";\n /**\n * Client -> Server message.\n * This message type is for unregister subscriptions with AWS AppSync RealTime\n */\n MESSAGE_TYPES[\"EVENT_STOP\"] = \"unsubscribe\";\n /**\n * Server -> Client message.\n * This is the ack response from AWS AppSync Events to EVENT_STOP message\n */\n MESSAGE_TYPES[\"EVENT_COMPLETE\"] = \"unsubscribe_success\";\n})(MESSAGE_TYPES || (exports.MESSAGE_TYPES = MESSAGE_TYPES = {}));\nvar SUBSCRIPTION_STATUS;\n(function (SUBSCRIPTION_STATUS) {\n SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS[\"PENDING\"] = 0] = \"PENDING\";\n SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS[\"CONNECTED\"] = 1] = \"CONNECTED\";\n SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS[\"FAILED\"] = 2] = \"FAILED\";\n})(SUBSCRIPTION_STATUS || (exports.SUBSCRIPTION_STATUS = SUBSCRIPTION_STATUS = {}));\nvar SOCKET_STATUS;\n(function (SOCKET_STATUS) {\n SOCKET_STATUS[SOCKET_STATUS[\"CLOSED\"] = 0] = \"CLOSED\";\n SOCKET_STATUS[SOCKET_STATUS[\"READY\"] = 1] = \"READY\";\n SOCKET_STATUS[SOCKET_STATUS[\"CONNECTING\"] = 2] = \"CONNECTING\";\n})(SOCKET_STATUS || (exports.SOCKET_STATUS = SOCKET_STATUS = {}));\nexports.AWS_APPSYNC_REALTIME_HEADERS = {\n accept: 'application/json, text/javascript',\n 'content-encoding': 'amz-1.0',\n 'content-type': 'application/json; charset=UTF-8',\n};\n/**\n * Time in milleseconds to wait for GQL_CONNECTION_INIT message\n */\nexports.CONNECTION_INIT_TIMEOUT = 15000;\n/**\n * Time in milleseconds to wait for GQL_START_ACK message\n */\nexports.START_ACK_TIMEOUT = 15000;\n/**\n * Default Time in milleseconds to wait for GQL_CONNECTION_KEEP_ALIVE message\n */\nexports.DEFAULT_KEEP_ALIVE_TIMEOUT = 5 * 60 * 1000;\n/**\n * Default Time in milleseconds between monitoring checks of keep alive status\n */\nexports.DEFAULT_KEEP_ALIVE_HEARTBEAT_TIMEOUT = 5 * 1000;\n/**\n * Default Time in milleseconds to alert for missed GQL_CONNECTION_KEEP_ALIVE message\n */\nexports.DEFAULT_KEEP_ALIVE_ALERT_TIMEOUT = 65 * 1000;\n/**\n * Default delay time in milleseconds between when reconnect is triggered vs when it is attempted\n */\nexports.RECONNECT_DELAY = 5 * 1000;\n/**\n * Default interval time in milleseconds between when reconnect is re-attempted\n */\nexports.RECONNECT_INTERVAL = 60 * 1000;\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,kBAAkB,GAAG,OAAO,CAAC,eAAe,GAAG,OAAO,CAAC,gCAAgC,GAAG,OAAO,CAAC,oCAAoC,GAAG,OAAO,CAAC,0BAA0B,GAAG,OAAO,CAAC,iBAAiB,GAAG,OAAO,CAAC,uBAAuB,GAAG,OAAO,CAAC,4BAA4B,GAAG,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,mBAAmB,GAAG,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,uBAAuB,G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CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,GAAG,YAAY;AACjE,CAAC,EAAE,aAAa,KAAK,OAAO,CAAC,aAAa,GAAG,aAAa,GAAG,EAAE,CAAC,CAAC;AACjE,OAAO,CAAC,4BAA4B,GAAG;AACvC,IAAI,MAAM,EAAE,mCAAmC;AAC/C,IAAI,kBAAkB,EAAE,SAAS;AACjC,IAAI,cAAc,EAAE,iCAAiC;AACrD,CAAC;AACD;AACA;AACA;AACA,OAAO,CAAC,uBAAuB,GAAG,KAAK;AACvC;AACA;AACA;AACA,OAAO,CAAC,iBAAiB,GAAG,KAAK;AACjC;AACA;AACA;AACA,OAAO,CAAC,0BAA0B,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI;AAClD;AACA;AACA;AACA,OAAO,CAAC,oCAAoC,GAAG,CAAC,GAAG,IAAI;AACvD;AACA;AACA;AACA,OAAO,CAAC,gCAAgC,GAAG,EAAE,GAAG,IAAI;AACpD;AACA;AACA;AACA,OAAO,CAAC,eAAe,GAAG,CAAC,GAAG,IAAI;AAClC;AACA;AACA;AACA,OAAO,CAAC,kBAAkB,GAAG,EAAE,GAAG,IAAI;;"}
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.appsyncRequest = void 0;
4
+ exports.appsyncRequest = appsyncRequest;
5
5
  const utils_1 = require("@aws-amplify/core/internals/utils");
6
6
  const internals_1 = require("@aws-amplify/api-rest/internals");
7
7
  const utils_2 = require("../../utils");
@@ -46,7 +46,6 @@ async function appsyncRequest(amplify, options, additionalHeaders = {}, abortCon
46
46
  }
47
47
  return response;
48
48
  }
49
- exports.appsyncRequest = appsyncRequest;
50
49
  /**
51
50
  * Computes all the necessary HTTP headers for the request based on:
52
51
  * 1. Operation-level header options
@@ -1 +1 @@
1
- {"version":3,"file":"appsyncRequest.js","sources":["../../../../src/internals/events/appsyncRequest.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.appsyncRequest = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst internals_1 = require(\"@aws-amplify/api-rest/internals\");\nconst utils_2 = require(\"../../utils\");\nconst repackageAuthError_1 = require(\"../../utils/errors/repackageAuthError\");\nconst graphqlAuth_1 = require(\"../graphqlAuth\");\nconst isGraphQLResponseWithErrors_1 = require(\"../utils/runtimeTypeGuards/isGraphQLResponseWithErrors\");\nconst USER_AGENT_HEADER = 'x-amz-user-agent';\n// This is effectively a copy of InternalGraphQLAPI.ts._graphql(...)\n// Our existing unit tests are tightly coupled to the implementation, so i was unable to refactor\n// and extend _graphql() without having to change a bunch of tests as well... which in turn reduces confidence\n// that this feature will _not affect_ GQL behavior.\nasync function appsyncRequest(amplify, options, additionalHeaders = {}, abortController, customUserAgentDetails) {\n const { region, appSyncGraphqlEndpoint: endpoint, authenticationType: authMode, query, variables, } = options;\n if (!endpoint) {\n throw new Error('No endpoint');\n }\n const { withCredentials } = (0, utils_2.resolveLibraryOptions)(amplify);\n const headers = await requestHeaders(amplify, options, additionalHeaders, customUserAgentDetails);\n const body = {\n channel: query,\n events: variables,\n };\n const signingServiceInfo = ['apiKey', 'none'].includes(authMode)\n ? undefined\n : {\n service: 'appsync',\n region,\n };\n const { body: responseBody } = await (0, internals_1.post)(amplify, {\n url: new utils_1.AmplifyUrl(endpoint),\n options: {\n headers,\n body,\n signingServiceInfo,\n withCredentials,\n },\n abortController,\n });\n const response = await responseBody.json();\n if ((0, isGraphQLResponseWithErrors_1.isGraphQLResponseWithErrors)(response)) {\n throw (0, repackageAuthError_1.repackageUnauthorizedError)(response);\n }\n return response;\n}\nexports.appsyncRequest = appsyncRequest;\n/**\n * Computes all the necessary HTTP headers for the request based on:\n * 1. Operation-level header options\n * 2. Amplify.configure custom headers\n * 3. AuthZ headers for explicit auth mode specified for operation ?? default auth mode in config\n *\n * @returns HTTP request headers key/value\n */\nasync function requestHeaders(amplify, options, additionalHeaders, customUserAgentDetails) {\n const { apiKey, appSyncGraphqlEndpoint: endpoint, authenticationType: authMode, query, variables, authToken, } = options;\n const { headers: customHeadersFn } = (0, utils_2.resolveLibraryOptions)(amplify);\n let additionalCustomHeaders;\n if (typeof additionalHeaders === 'function') {\n const requestOptions = {\n method: 'POST',\n url: new utils_1.AmplifyUrl(endpoint).toString(),\n queryString: query,\n };\n additionalCustomHeaders = await additionalHeaders(requestOptions);\n }\n else {\n additionalCustomHeaders = additionalHeaders;\n }\n // if an authorization header is set, have the operation-level authToken take precedence\n if (authToken) {\n additionalCustomHeaders = {\n ...additionalCustomHeaders,\n Authorization: authToken,\n };\n }\n const authHeaders = await (0, graphqlAuth_1.headerBasedAuth)(amplify, authMode, apiKey, additionalCustomHeaders);\n const customHeaders = customHeadersFn &&\n (await customHeadersFn({\n query,\n variables: variables,\n }));\n const headers = {\n ...authHeaders,\n // Custom headers included in Amplify configuration options:\n ...customHeaders,\n // Custom headers from individual requests or API client configuration:\n ...additionalCustomHeaders,\n // User agent headers:\n [USER_AGENT_HEADER]: (0, utils_1.getAmplifyUserAgent)(customUserAgentDetails),\n };\n return headers;\n}\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,cAAc,GAAG,MAAM;AAC/B,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,WAAW,GAAG,OAAO,CAAC,iCAAiC,CAAC;AAC9D,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC;AACtC,MAAM,oBAAoB,GAAG,OAAO,CAAC,uCAAuC,CAAC;AAC7E,MAAM,aAAa,GAAG,OAAO,CAAC,gBAAgB,CAAC;AAC/C,MAAM,6BAA6B,GAAG,OAAO,CAAC,wDAAwD,CAAC;AACvG,MAAM,iBAAiB,GAAG,kBAAkB;AAC5C;AACA;AACA;AACA;AACA,eAAe,cAAc,CAA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,SAAS;AAChC,SAAS,CAAC,CAAC;AACX,IAAI,MAAM,OAAO,GAAG;AACpB,QAAQ,GAAG,WAAW;AACtB;AACA,QAAQ,GAAG,aAAa;AACxB;AACA,QAAQ,GAAG,uBAAuB;AAClC;AACA,QAAQ,CAAC,iBAAiB,GAAG,IAAI,OAAO,CAAC,mBAAmB,EAAE,sBAAsB,CAAC;AACrF,KAAK;AACL,IAAI,OAAO,OAAO;AAClB;;"}
1
+ {"version":3,"file":"appsyncRequest.js","sources":["../../../../src/internals/events/appsyncRequest.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.appsyncRequest = appsyncRequest;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst internals_1 = require(\"@aws-amplify/api-rest/internals\");\nconst utils_2 = require(\"../../utils\");\nconst repackageAuthError_1 = require(\"../../utils/errors/repackageAuthError\");\nconst graphqlAuth_1 = require(\"../graphqlAuth\");\nconst isGraphQLResponseWithErrors_1 = require(\"../utils/runtimeTypeGuards/isGraphQLResponseWithErrors\");\nconst USER_AGENT_HEADER = 'x-amz-user-agent';\n// This is effectively a copy of InternalGraphQLAPI.ts._graphql(...)\n// Our existing unit tests are tightly coupled to the implementation, so i was unable to refactor\n// and extend _graphql() without having to change a bunch of tests as well... which in turn reduces confidence\n// that this feature will _not affect_ GQL behavior.\nasync function appsyncRequest(amplify, options, additionalHeaders = {}, abortController, customUserAgentDetails) {\n const { region, appSyncGraphqlEndpoint: endpoint, authenticationType: authMode, query, variables, } = options;\n if (!endpoint) {\n throw new Error('No endpoint');\n }\n const { withCredentials } = (0, utils_2.resolveLibraryOptions)(amplify);\n const headers = await requestHeaders(amplify, options, additionalHeaders, customUserAgentDetails);\n const body = {\n channel: query,\n events: variables,\n };\n const signingServiceInfo = ['apiKey', 'none'].includes(authMode)\n ? undefined\n : {\n service: 'appsync',\n region,\n };\n const { body: responseBody } = await (0, internals_1.post)(amplify, {\n url: new utils_1.AmplifyUrl(endpoint),\n options: {\n headers,\n body,\n signingServiceInfo,\n withCredentials,\n },\n abortController,\n });\n const response = await responseBody.json();\n if ((0, isGraphQLResponseWithErrors_1.isGraphQLResponseWithErrors)(response)) {\n throw (0, repackageAuthError_1.repackageUnauthorizedError)(response);\n }\n return response;\n}\n/**\n * Computes all the necessary HTTP headers for the request based on:\n * 1. Operation-level header options\n * 2. Amplify.configure custom headers\n * 3. AuthZ headers for explicit auth mode specified for operation ?? default auth mode in config\n *\n * @returns HTTP request headers key/value\n */\nasync function requestHeaders(amplify, options, additionalHeaders, customUserAgentDetails) {\n const { apiKey, appSyncGraphqlEndpoint: endpoint, authenticationType: authMode, query, variables, authToken, } = options;\n const { headers: customHeadersFn } = (0, utils_2.resolveLibraryOptions)(amplify);\n let additionalCustomHeaders;\n if (typeof additionalHeaders === 'function') {\n const requestOptions = {\n method: 'POST',\n url: new utils_1.AmplifyUrl(endpoint).toString(),\n queryString: query,\n };\n additionalCustomHeaders = await additionalHeaders(requestOptions);\n }\n else {\n additionalCustomHeaders = additionalHeaders;\n }\n // if an authorization header is set, have the operation-level authToken take precedence\n if (authToken) {\n additionalCustomHeaders = {\n ...additionalCustomHeaders,\n Authorization: authToken,\n };\n }\n const authHeaders = await (0, graphqlAuth_1.headerBasedAuth)(amplify, authMode, apiKey, additionalCustomHeaders);\n const customHeaders = customHeadersFn &&\n (await customHeadersFn({\n query,\n variables: variables,\n }));\n const headers = {\n ...authHeaders,\n // Custom headers included in Amplify configuration options:\n ...customHeaders,\n // Custom headers from individual requests or API client configuration:\n ...additionalCustomHeaders,\n // User agent headers:\n [USER_AGENT_HEADER]: (0, utils_1.getAmplifyUserAgent)(customUserAgentDetails),\n };\n return headers;\n}\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,cAAc,GAAG,cAAc;AACvC,MAAM,OAAO,GAAG,OAAO,C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QAAQ,uBAAuB,GAAG;AAClC,YAAY,GAAG,uBAAuB;AACtC,YAAY,aAAa,EAAE,SAAS;AACpC,SAAS;AACT;AACA,IAAI,MAAM,WAAW,GAAG,MAAM,IAAI,aAAa,CAAC,eAAe,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,uBAAuB,CAAC;AACpH,IAAI,MAAM,aAAa,GAAG,eAAe;AACzC,SAAS,MAAM,eAAe,CAAC;AAC/B,YAAY,KAAK;AACjB,YAAY,SAAS,EAAE,SAAS;AAChC,SAAS,CAAC,CAAC;AACX,IAAI,MAAM,OAAO,GAAG;AACpB,QAAQ,GAAG,WAAW;AACtB;AACA,QAAQ,GAAG,aAAa;AACxB;AACA,QAAQ,GAAG,uBAAuB;AAClC;AACA,QAAQ,CAAC,iBAAiB,GAAG,IAAI,OAAO,CAAC,mBAAmB,EAAE,sBAAsB,CAAC;AACrF,KAAK;AACL,IAAI,OAAO,OAAO;AAClB;;"}
@@ -3,7 +3,9 @@
3
3
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
4
  // SPDX-License-Identifier: Apache-2.0
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.closeAll = exports.post = exports.connect = void 0;
6
+ exports.connect = connect;
7
+ exports.post = post;
8
+ exports.closeAll = closeAll;
7
9
  const core_1 = require("@aws-amplify/core");
8
10
  const utils_1 = require("@aws-amplify/core/internals/utils");
9
11
  const AWSAppSyncEventsProvider_1 = require("../../Providers/AWSAppSyncEventsProvider");
@@ -84,7 +86,6 @@ async function connect(channel, options) {
84
86
  publish: pub,
85
87
  };
86
88
  }
87
- exports.connect = connect;
88
89
  /**
89
90
  * @experimental API may change in future versions
90
91
  *
@@ -124,7 +125,6 @@ async function post(channel, event, options) {
124
125
  return res.failed;
125
126
  }
126
127
  }
127
- exports.post = post;
128
128
  /**
129
129
  * @experimental API may change in future versions
130
130
  *
@@ -139,5 +139,4 @@ exports.post = post;
139
139
  async function closeAll() {
140
140
  await AWSAppSyncEventsProvider_1.AppSyncEventProvider.close();
141
141
  }
142
- exports.closeAll = closeAll;
143
142
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/internals/events/index.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.closeAll = exports.post = exports.connect = void 0;\nconst core_1 = require(\"@aws-amplify/core\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst AWSAppSyncEventsProvider_1 = require(\"../../Providers/AWSAppSyncEventsProvider\");\nconst appsyncRequest_1 = require(\"./appsyncRequest\");\nconst utils_2 = require(\"./utils\");\n// Keeps a list of open channels in the websocket\nconst openChannels = new Set();\n/**\n * @experimental API may change in future versions\n *\n * Establish a WebSocket connection to an Events channel\n *\n * @example\n * const channel = await events.connect(\"default/channel\")\n *\n * channel.subscribe({\n * next: (data) => { console.log(data) },\n * error: (err) => { console.error(err) },\n * })\n *\n * @example // authMode override\n * const channel = await events.connect(\"default/channel\", { authMode: \"userPool\" })\n *\n * @param channel - channel path; `<namespace>/<channel>`\n * @param options - request overrides: `authMode`, `authToken`\n *\n */\nasync function connect(channel, options) {\n const providerOptions = (0, utils_2.configure)();\n providerOptions.authenticationType = (0, utils_2.normalizeAuth)(options?.authMode, providerOptions.authenticationType);\n providerOptions.apiKey = options?.apiKey || providerOptions.apiKey;\n providerOptions.authToken = options?.authToken || providerOptions.authToken;\n await AWSAppSyncEventsProvider_1.AppSyncEventProvider.connect(providerOptions);\n const channelId = (0, utils_1.amplifyUuid)();\n openChannels.add(channelId);\n let _subscription;\n const sub = (observer, subOptions) => {\n if (!openChannels.has(channelId)) {\n throw new Error('Channel is closed');\n }\n const subscribeOptions = { ...providerOptions, query: channel };\n subscribeOptions.authenticationType = (0, utils_2.normalizeAuth)(subOptions?.authMode, subscribeOptions.authenticationType);\n subscribeOptions.apiKey = subOptions?.apiKey || subscribeOptions.apiKey;\n subscribeOptions.authToken =\n subOptions?.authToken || subscribeOptions.authToken;\n _subscription = AWSAppSyncEventsProvider_1.AppSyncEventProvider\n .subscribe(subscribeOptions)\n .subscribe(observer);\n return _subscription;\n };\n const pub = async (event, pubOptions) => {\n if (!openChannels.has(channelId)) {\n throw new Error('Channel is closed');\n }\n const publishOptions = {\n ...providerOptions,\n query: channel,\n variables: event,\n };\n publishOptions.authenticationType = (0, utils_2.normalizeAuth)(pubOptions?.authMode, publishOptions.authenticationType);\n publishOptions.apiKey = pubOptions?.apiKey || publishOptions.apiKey;\n publishOptions.authToken =\n pubOptions?.authToken || publishOptions.authToken;\n return AWSAppSyncEventsProvider_1.AppSyncEventProvider.publish(publishOptions);\n };\n const close = async () => {\n _subscription && _subscription.unsubscribe();\n openChannels.delete(channelId);\n setTimeout(() => {\n if (openChannels.size === 0) {\n AWSAppSyncEventsProvider_1.AppSyncEventProvider.closeIfNoActiveSubscription();\n }\n }, 1000);\n };\n return {\n subscribe: sub,\n close,\n publish: pub,\n };\n}\nexports.connect = connect;\n/**\n * @experimental API may change in future versions\n *\n * Publish events to a channel via HTTP request\n *\n * @example\n * await events.post(\"default/channel\", { some: \"event\" })\n *\n * @example // event batching\n * await events.post(\"default/channel\", [{ some: \"event\" }, { some: \"event2\" }])\n *\n * @example // authMode override\n * await events.post(\"default/channel\", { some: \"event\" }, { authMode: \"userPool\" })\n *\n * @param channel - channel path; `<namespace>/<channel>`\n * @param event - JSON-serializable value or an array of values\n * @param options - request overrides: `authMode`, `authToken`\n *\n * @returns void on success\n * @throws on error\n */\nasync function post(channel, event, options) {\n const providerOptions = (0, utils_2.configure)();\n providerOptions.authenticationType = (0, utils_2.normalizeAuth)(options?.authMode, providerOptions.authenticationType);\n providerOptions.apiKey = options?.apiKey || providerOptions.apiKey;\n providerOptions.authToken = options?.authToken || providerOptions.authToken;\n // trailing slash required in publish\n const normalizedChannelName = channel[0] === '/' ? channel : `/${channel}`;\n const publishOptions = {\n ...providerOptions,\n query: normalizedChannelName,\n variables: (0, utils_2.serializeEvents)(event),\n };\n const abortController = new AbortController();\n const res = await (0, appsyncRequest_1.appsyncRequest)(core_1.Amplify, publishOptions, {}, abortController);\n if (res.failed?.length > 0) {\n return res.failed;\n }\n}\nexports.post = post;\n/**\n * @experimental API may change in future versions\n *\n * Close WebSocket connection, disconnect listeners and reconnect observers\n *\n * @example\n * await events.closeAll()\n *\n * @returns void on success\n * @throws on error\n */\nasync function closeAll() {\n await AWSAppSyncEventsProvider_1.AppSyncEventProvider.close();\n}\nexports.closeAll = closeAll;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,OAAO,GAAG,MAAM;AAC1D,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAC3C,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,0BAA0B,GAAG,OAAO,CAAC,0CAA0C,CAAC;AACtF,MAAM,gBAAgB,GAAG,OAAO,CAAC,kBAAkB,CAAC;AACpD,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC;AAClC;AACA,MAAM,YAAY,GAAG,IAAI,GAAG,EAAE;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE;AACzC,IAAI,MAAM,eAAe,GAAG,IAAI,OAAO,CAAC,SAAS,GAAG;AACpD,IAAI,eAAe,CAAC,kBAAkB,GAAG,IAAI,OAAO,CAAC,aAAa,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,CAAC,kBAAkB,CAAC;AAC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;AACpD,IAAI,eAAe,CAAC,kBAAkB,GAAG,IAAI,OAAO,CAAC,aAAa,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,CAAC,kBAAkB,CAAC;AAC1H,IAAI,eAAe,CAAC,MAAM,GAAG,OAAO,EAAE,MAAM,IAAI,eAAe,CAAC,MAAM;AACtE,IAAI,eAAe,CAAC,SAAS,GAAG,OAAO,EAAE,SAAS,IAAI,eAAe,CAAC,SAAS;AAC/E;AACA,IAAI,MAAM,qBAAqB,GAAG,OAAO,CAAC,CAAC,CAAC,KAAK,GAAG,GAAG,OAAO,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;AAC9E,IAAI,MAAM,cAAc,GAAG;AAC3B,QAAQ,GAAG,eAAe;AAC1B,QAAQ,KAAK,EAAE,qBAAqB;AACpC,QAAQ,SAAS,EAAE,IAAI,OAAO,CAAC,eAAe,EAAE,KAAK,CAAC;AACtD,KAAK;AACL,IAAI,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE;AACjD,IAAI,MAAM,GAAG,GAAG,MAAM,IAAI,gBAAgB,CAAC,cAAc,EAAE,MAAM,CAAC,OAAO,EAAE,cAAc,EAAE,EAAE,EAAE,eAAe,CAAC;AAC/G,IAAI,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,EAAE;AAChC,QAAQ,OAAO,GAAG,CAAC,MAAM;AACzB;AACA;AACA,OAAO,CAAC,IAAI,GAAG,IAAI;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ,GAAG;AAC1B,IAAI,MAAM,0BAA0B,CAAC,oBAAoB,CAAC,KAAK,EAAE;AACjE;AACA,OAAO,CAAC,QAAQ,GAAG,QAAQ;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/internals/events/index.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.connect = connect;\nexports.post = post;\nexports.closeAll = closeAll;\nconst core_1 = require(\"@aws-amplify/core\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst AWSAppSyncEventsProvider_1 = require(\"../../Providers/AWSAppSyncEventsProvider\");\nconst appsyncRequest_1 = require(\"./appsyncRequest\");\nconst utils_2 = require(\"./utils\");\n// Keeps a list of open channels in the websocket\nconst openChannels = new Set();\n/**\n * @experimental API may change in future versions\n *\n * Establish a WebSocket connection to an Events channel\n *\n * @example\n * const channel = await events.connect(\"default/channel\")\n *\n * channel.subscribe({\n * next: (data) => { console.log(data) },\n * error: (err) => { console.error(err) },\n * })\n *\n * @example // authMode override\n * const channel = await events.connect(\"default/channel\", { authMode: \"userPool\" })\n *\n * @param channel - channel path; `<namespace>/<channel>`\n * @param options - request overrides: `authMode`, `authToken`\n *\n */\nasync function connect(channel, options) {\n const providerOptions = (0, utils_2.configure)();\n providerOptions.authenticationType = (0, utils_2.normalizeAuth)(options?.authMode, providerOptions.authenticationType);\n providerOptions.apiKey = options?.apiKey || providerOptions.apiKey;\n providerOptions.authToken = options?.authToken || providerOptions.authToken;\n await AWSAppSyncEventsProvider_1.AppSyncEventProvider.connect(providerOptions);\n const channelId = (0, utils_1.amplifyUuid)();\n openChannels.add(channelId);\n let _subscription;\n const sub = (observer, subOptions) => {\n if (!openChannels.has(channelId)) {\n throw new Error('Channel is closed');\n }\n const subscribeOptions = { ...providerOptions, query: channel };\n subscribeOptions.authenticationType = (0, utils_2.normalizeAuth)(subOptions?.authMode, subscribeOptions.authenticationType);\n subscribeOptions.apiKey = subOptions?.apiKey || subscribeOptions.apiKey;\n subscribeOptions.authToken =\n subOptions?.authToken || subscribeOptions.authToken;\n _subscription = AWSAppSyncEventsProvider_1.AppSyncEventProvider\n .subscribe(subscribeOptions)\n .subscribe(observer);\n return _subscription;\n };\n const pub = async (event, pubOptions) => {\n if (!openChannels.has(channelId)) {\n throw new Error('Channel is closed');\n }\n const publishOptions = {\n ...providerOptions,\n query: channel,\n variables: event,\n };\n publishOptions.authenticationType = (0, utils_2.normalizeAuth)(pubOptions?.authMode, publishOptions.authenticationType);\n publishOptions.apiKey = pubOptions?.apiKey || publishOptions.apiKey;\n publishOptions.authToken =\n pubOptions?.authToken || publishOptions.authToken;\n return AWSAppSyncEventsProvider_1.AppSyncEventProvider.publish(publishOptions);\n };\n const close = async () => {\n _subscription && _subscription.unsubscribe();\n openChannels.delete(channelId);\n setTimeout(() => {\n if (openChannels.size === 0) {\n AWSAppSyncEventsProvider_1.AppSyncEventProvider.closeIfNoActiveSubscription();\n }\n }, 1000);\n };\n return {\n subscribe: sub,\n close,\n publish: pub,\n };\n}\n/**\n * @experimental API may change in future versions\n *\n * Publish events to a channel via HTTP request\n *\n * @example\n * await events.post(\"default/channel\", { some: \"event\" })\n *\n * @example // event batching\n * await events.post(\"default/channel\", [{ some: \"event\" }, { some: \"event2\" }])\n *\n * @example // authMode override\n * await events.post(\"default/channel\", { some: \"event\" }, { authMode: \"userPool\" })\n *\n * @param channel - channel path; `<namespace>/<channel>`\n * @param event - JSON-serializable value or an array of values\n * @param options - request overrides: `authMode`, `authToken`\n *\n * @returns void on success\n * @throws on error\n */\nasync function post(channel, event, options) {\n const providerOptions = (0, utils_2.configure)();\n providerOptions.authenticationType = (0, utils_2.normalizeAuth)(options?.authMode, providerOptions.authenticationType);\n providerOptions.apiKey = options?.apiKey || providerOptions.apiKey;\n providerOptions.authToken = options?.authToken || providerOptions.authToken;\n // trailing slash required in publish\n const normalizedChannelName = channel[0] === '/' ? channel : `/${channel}`;\n const publishOptions = {\n ...providerOptions,\n query: normalizedChannelName,\n variables: (0, utils_2.serializeEvents)(event),\n };\n const abortController = new AbortController();\n const res = await (0, appsyncRequest_1.appsyncRequest)(core_1.Amplify, publishOptions, {}, abortController);\n if (res.failed?.length > 0) {\n return res.failed;\n }\n}\n/**\n * @experimental API may change in future versions\n *\n * Close WebSocket connection, disconnect listeners and reconnect observers\n *\n * @example\n * await events.closeAll()\n *\n * @returns void on success\n * @throws on error\n */\nasync function closeAll() {\n await AWSAppSyncEventsProvider_1.AppSyncEventProvider.close();\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,OAAO,GAAG,OAAO;AACzB,OAAO,CAAC,IAAI,GAAG,IAAI;AACnB,OAAO,CAAC,QAAQ,GAAG,QAAQ;AAC3B,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAC3C,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,0BAA0B,GAAG,OAAO,CAAC,0CAA0C,CAAC;AACtF,MAAM,gBAAgB,GAAG,OAAO,CAAC,kBAAkB,CAAC;AACpD,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC;AAClC;AACA,MAAM,YAAY,GAAG,IAAI,GAAG,EAAE;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE;AACzC,IAAI,MAAM,eAAe,GAAG,IAAI,OAAO,CAAC,SAAS,GAAG;AACpD,IAAI,eAAe,CAAC,kBAAkB,GAAG,IAAI,OAAO,CAAC,aAAa,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,CAAC,kBAAkB,CAAC;AAC1H,IAAI,eAAe,CAAC,MAAM,GAAG,OAAO,EAAE,MAAM,IAAI,eAAe,CAAC,MAAM;AACtE,IAAI,eAAe,CAAC,SAAS,GAAG,OAAO,EAAE,SAAS,IAAI,eAAe,CAAC,SAAS;AAC/E,IAAI,MAAM,0BAA0B,CAAC,oBAAoB,CAAC,OAAO,CAAC,eAAe,CAAC;AAClF,IAAI,MAAM,SAAS,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AACA,IAAI,MAAM,qBAAqB,GAAG,OAAO,CAAC,CAAC,CAAC,KAAK,GAAG,GAAG,OAAO,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;AAC9E,IAAI,MAAM,cAAc,GAAG;AAC3B,QAAQ,GAAG,eAAe;AAC1B,QAAQ,KAAK,EAAE,qBAAqB;AACpC,QAAQ,SAAS,EAAE,IAAI,OAAO,CAAC,eAAe,EAAE,KAAK,CAAC;AACtD,KAAK;AACL,IAAI,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE;AACjD,IAAI,MAAM,GAAG,GAAG,MAAM,IAAI,gBAAgB,CAAC,cAAc,EAAE,MAAM,CAAC,OAAO,EAAE,cAAc,EAAE,EAAE,EAAE,eAAe,CAAC;AAC/G,IAAI,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,EAAE;AAChC,QAAQ,OAAO,GAAG,CAAC,MAAM;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ,GAAG;AAC1B,IAAI,MAAM,0BAA0B,CAAC,oBAAoB,CAAC,KAAK,EAAE;AACjE;;"}
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.generateClient = void 0;
4
+ exports.generateClient = generateClient;
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");
@@ -67,7 +67,6 @@ function generateClient(params) {
67
67
  }
68
68
  return client;
69
69
  }
70
- exports.generateClient = generateClient;
71
70
  const generateModelsPropertyOnAmplifyConfigure = (clientRef) => {
72
71
  core_1.Hub.listen('core', coreEvent => {
73
72
  if (!(0, isConfigureEventWithResourceConfig_1.isConfigureEventWithResourceConfig)(coreEvent.payload)) {
@@ -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 runtime_1 = require(\"@aws-amplify/data-schema/runtime\");\nconst types_1 = require(\"../types\");\nconst isApiGraphQLProviderConfig_1 = require(\"./utils/runtimeTypeGuards/isApiGraphQLProviderConfig\");\nconst isConfigureEventWithResourceConfig_1 = require(\"./utils/runtimeTypeGuards/isConfigureEventWithResourceConfig\");\nconst v6_1 = require(\"./v6\");\n/**\n * @private\n *\n * Creates a client that can be used to make GraphQL requests, using a provided `AmplifyClassV6`\n * compatible context object for config and auth fetching.\n *\n * @param params\n * @returns\n */\nfunction generateClient(params) {\n const client = {\n [types_1.__amplify]: params.amplify,\n [types_1.__authMode]: params.authMode,\n [types_1.__authToken]: params.authToken,\n [types_1.__apiKey]: 'apiKey' in params ? params.apiKey : undefined,\n [types_1.__endpoint]: 'endpoint' in params ? params.endpoint : undefined,\n [types_1.__headers]: params.headers,\n graphql: v6_1.graphql,\n cancel: v6_1.cancel,\n isCancelError: v6_1.isCancelError,\n models: emptyProperty,\n enums: emptyProperty,\n queries: emptyProperty,\n mutations: emptyProperty,\n subscriptions: emptyProperty,\n };\n const apiGraphqlConfig = params.amplify.getConfig().API?.GraphQL;\n if (client[types_1.__endpoint]) {\n if (!client[types_1.__authMode]) {\n throw new Error('generateClient() requires an explicit `authMode` when `endpoint` is provided.');\n }\n if (client[types_1.__authMode] === 'apiKey' && !client[types_1.__apiKey]) {\n throw new Error(\"generateClient() requires an explicit `apiKey` when `endpoint` is provided and `authMode = 'apiKey'`.\");\n }\n }\n if (!client[types_1.__endpoint]) {\n if ((0, isApiGraphQLProviderConfig_1.isApiGraphQLConfig)(apiGraphqlConfig)) {\n (0, runtime_1.addSchemaToClient)(client, apiGraphqlConfig, types_1.getInternals);\n }\n else {\n // This happens when the `Amplify.configure()` call gets evaluated after the `generateClient()` call.\n //\n // Cause: when the `generateClient()` and the `Amplify.configure()` calls are located in\n // different source files, script bundlers may randomly arrange their orders in the production\n // bundle.\n //\n // With the current implementation, the `client.models` instance created by `generateClient()`\n // will be rebuilt on every `Amplify.configure()` call that's provided with a valid GraphQL\n // provider configuration.\n //\n // TODO: revisit, and reverify this approach when enabling multiple clients for multi-endpoints\n // configuration.\n generateModelsPropertyOnAmplifyConfigure(client);\n }\n }\n return client;\n}\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;AAC7D,OAAO,CAAC,cAAc,GAAG,MAAM;AAC/B;AACA;AACA,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAC3C,MAAM,SAAS,GAAG,OAAO,CAAC,kCAAkC,CAAC;AAC7D,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC;AACnC,MAAM,4BAA4B,GAAG,OAAO,CAAC,sDAAsD,CAAC;AACpG,MAAM,oCAAoC,GAAG,OAAO,CAAC,8DAA8D,CAAC;AACpH,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC;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../src/internals/generateClient.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.generateClient = generateClient;\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst core_1 = require(\"@aws-amplify/core\");\nconst runtime_1 = require(\"@aws-amplify/data-schema/runtime\");\nconst types_1 = require(\"../types\");\nconst isApiGraphQLProviderConfig_1 = require(\"./utils/runtimeTypeGuards/isApiGraphQLProviderConfig\");\nconst isConfigureEventWithResourceConfig_1 = require(\"./utils/runtimeTypeGuards/isConfigureEventWithResourceConfig\");\nconst v6_1 = require(\"./v6\");\n/**\n * @private\n *\n * Creates a client that can be used to make GraphQL requests, using a provided `AmplifyClassV6`\n * compatible context object for config and auth fetching.\n *\n * @param params\n * @returns\n */\nfunction generateClient(params) {\n const client = {\n [types_1.__amplify]: params.amplify,\n [types_1.__authMode]: params.authMode,\n [types_1.__authToken]: params.authToken,\n [types_1.__apiKey]: 'apiKey' in params ? params.apiKey : undefined,\n [types_1.__endpoint]: 'endpoint' in params ? params.endpoint : undefined,\n [types_1.__headers]: params.headers,\n graphql: v6_1.graphql,\n cancel: v6_1.cancel,\n isCancelError: v6_1.isCancelError,\n models: emptyProperty,\n enums: emptyProperty,\n queries: emptyProperty,\n mutations: emptyProperty,\n subscriptions: emptyProperty,\n };\n const apiGraphqlConfig = params.amplify.getConfig().API?.GraphQL;\n if (client[types_1.__endpoint]) {\n if (!client[types_1.__authMode]) {\n throw new Error('generateClient() requires an explicit `authMode` when `endpoint` is provided.');\n }\n if (client[types_1.__authMode] === 'apiKey' && !client[types_1.__apiKey]) {\n throw new Error(\"generateClient() requires an explicit `apiKey` when `endpoint` is provided and `authMode = 'apiKey'`.\");\n }\n }\n if (!client[types_1.__endpoint]) {\n if ((0, isApiGraphQLProviderConfig_1.isApiGraphQLConfig)(apiGraphqlConfig)) {\n (0, runtime_1.addSchemaToClient)(client, apiGraphqlConfig, types_1.getInternals);\n }\n else {\n // This happens when the `Amplify.configure()` call gets evaluated after the `generateClient()` call.\n //\n // Cause: when the `generateClient()` and the `Amplify.configure()` calls are located in\n // different source files, script bundlers may randomly arrange their orders in the production\n // bundle.\n //\n // With the current implementation, the `client.models` instance created by `generateClient()`\n // will be rebuilt on every `Amplify.configure()` call that's provided with a valid GraphQL\n // provider configuration.\n //\n // TODO: revisit, and reverify this approach when enabling multiple clients for multi-endpoints\n // configuration.\n generateModelsPropertyOnAmplifyConfigure(client);\n }\n }\n return client;\n}\nconst generateModelsPropertyOnAmplifyConfigure = (clientRef) => {\n core_1.Hub.listen('core', coreEvent => {\n if (!(0, isConfigureEventWithResourceConfig_1.isConfigureEventWithResourceConfig)(coreEvent.payload)) {\n return;\n }\n const apiGraphQLConfig = coreEvent.payload.data.API?.GraphQL;\n if ((0, isApiGraphQLProviderConfig_1.isApiGraphQLConfig)(apiGraphQLConfig)) {\n (0, runtime_1.addSchemaToClient)(clientRef, apiGraphQLConfig, types_1.getInternals);\n }\n });\n};\nconst emptyProperty = new Proxy({}, {\n get() {\n throw new Error('Client could not be generated. This is likely due to `Amplify.configure()` not being called prior to `generateClient()` or because the configuration passed to `Amplify.configure()` is missing GraphQL provider configuration.');\n },\n});\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,cAAc,GAAG,cAAc;AACvC;AACA;AACA,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAC3C,MAAM,SAAS,GAAG,OAAO,CAAC,kCAAkC,CAAC;AAC7D,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC;AACnC,MAAM,4BAA4B,GAAG,OAAO,CAAC,sDAAsD,CAAC;AACpG,MAAM,oCAAoC,GAAG,OAAO,CAAC,8DAA8D,CAAC;AACpH,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC;AAC5B;AAC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License-Identifier: Apache-2.0
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.headerBasedAuth = void 0;
6
+ exports.headerBasedAuth = headerBasedAuth;
7
7
  const errors_1 = require("../utils/errors");
8
8
  const constants_1 = require("../utils/errors/constants");
9
9
  async function headerBasedAuth(amplify, authMode, apiKey, additionalHeaders = {}) {
@@ -60,5 +60,4 @@ async function headerBasedAuth(amplify, authMode, apiKey, additionalHeaders = {}
60
60
  }
61
61
  return headers;
62
62
  }
63
- exports.headerBasedAuth = headerBasedAuth;
64
63
  //# sourceMappingURL=graphqlAuth.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"graphqlAuth.js","sources":["../../../src/internals/graphqlAuth.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.headerBasedAuth = void 0;\nconst errors_1 = require(\"../utils/errors\");\nconst constants_1 = require(\"../utils/errors/constants\");\nasync function headerBasedAuth(amplify, authMode, apiKey, additionalHeaders = {}) {\n let headers = {};\n switch (authMode) {\n case 'apiKey':\n if (!apiKey) {\n throw new errors_1.GraphQLApiError(constants_1.NO_API_KEY);\n }\n headers = {\n 'X-Api-Key': apiKey,\n };\n break;\n case 'iam': {\n const session = await amplify.Auth.fetchAuthSession();\n if (session.credentials === undefined) {\n throw new errors_1.GraphQLApiError(constants_1.NO_VALID_CREDENTIALS);\n }\n break;\n }\n case 'oidc':\n case 'userPool': {\n let token;\n try {\n token = (await amplify.Auth.fetchAuthSession()).tokens?.accessToken.toString();\n }\n catch (e) {\n // fetchAuthSession failed\n throw new errors_1.GraphQLApiError({\n ...constants_1.NO_SIGNED_IN_USER,\n underlyingError: e,\n });\n }\n // `fetchAuthSession()` succeeded but didn't return `tokens`.\n // This may happen when unauthenticated access is enabled and there is\n // no user signed in.\n if (!token) {\n throw new errors_1.GraphQLApiError(constants_1.NO_VALID_AUTH_TOKEN);\n }\n headers = {\n Authorization: token,\n };\n break;\n }\n case 'lambda':\n if (typeof additionalHeaders === 'object' &&\n !additionalHeaders.Authorization) {\n throw new errors_1.GraphQLApiError(constants_1.NO_AUTH_TOKEN_HEADER);\n }\n headers = {\n Authorization: additionalHeaders.Authorization,\n };\n break;\n case 'none':\n break;\n default:\n break;\n }\n return headers;\n}\nexports.headerBasedAuth = headerBasedAuth;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,eAAe,GAAG,MAAM;AAChC,MAAM,QAAQ,GAAG,OAAO,CAAC,iBAAiB,CAAC;AAC3C,MAAM,WAAW,GAAG,OAAO,CAAC,2BAA2B,CAAC;AACxD,eAAe,eAAe,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,iBAAiB,GAAG,EAAE,EAAE;AAClF,IAAI,IAAI,OAAO,GAAG,EAAE;AACpB,IAAI,QAAQ,QAAQ;AACpB,QAAQ,KAAK,QAAQ;AACrB,YAAY,IAAI,CAAC,MAAM,EAAE;AACzB,gBAAgB,MAAM,IAAI,QAAQ,CAAC,eAAe,CAAC,WAAW,CAAC,UAAU,CAAC;AAC1E;AACA,YAAY,OAAO,GAAG;AACtB,gBAAgB,WAAW,EAAE,MAAM;AACnC,aAAa;AACb,YAAY;AACZ,QAAQ,KAAK,KAAK,EAAE;AACpB,YAAY,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE;AACjE,YAAY,IAAI,OAAO,CAAC,WAAW,KAAK,SAAS,EAAE;AACnD,gBAAgB,MAAM,IAAI,QAAQ,CAAC,eAAe,CAAC,WAAW,CAAC,oBAAoB,CAAC;AACpF;AACA,YAAY;AACZ;AACA,QAAQ,KAAK,MAAM;AACnB,QAAQ,KAAK,UAAU,EAAE;AACzB,YAAY,IAAI,KAAK;AACrB,YAAY,IAAI;AAChB,gBAAgB,KAAK,GAAG,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAE,MAAM,EAAE,WAAW,CAAC,QAAQ,EAAE;AAC9F;AACA,YAAY,OAAO,CAAC,EAAE;AACtB;AACA,gBAAgB,MAAM,IAAI,QAAQ,CAAC,eAAe,CAAC;AACnD,oBAAoB,GAAG,WAAW,CAAC,iBAAiB;AACpD,oBAAoB,eAAe,EAAE,CAAC;AACtC,iBAAiB,CAAC;AAClB;AACA;AACA;AACA;AACA,YAAY,IAAI,CAAC,KAAK,EAAE;AACxB,gBAAgB,MAAM,IAAI,QAAQ,CAAC,eAAe,CAAC,WAAW,CAAC,mBAAmB,CAAC;AACnF;AACA,YAAY,OAAO,GAAG;AACtB,gBAAgB,aAAa,EAAE,KAAK;AACpC,aAAa;AACb,YAAY;AACZ;AACA,QAAQ,KAAK,QAAQ;AACrB,YAAY,IAAI,OAAO,iBAAiB,KAAK,QAAQ;AACrD,gBAAgB,CAAC,iBAAiB,CAAC,aAAa,EAAE;AAClD,gBAAgB,MAAM,IAAI,QAAQ,CAAC,eAAe,CAAC,WAAW,CAAC,oBAAoB,CAAC;AACpF;AACA,YAAY,OAAO,GAAG;AACtB,gBAAgB,aAAa,EAAE,iBAAiB,CAAC,aAAa;AAC9D,aAAa;AACb,YAAY;AAKZ;AACA,IAAI,OAAO,OAAO;AAClB;AACA,OAAO,CAAC,eAAe,GAAG,eAAe;;"}
1
+ {"version":3,"file":"graphqlAuth.js","sources":["../../../src/internals/graphqlAuth.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.headerBasedAuth = headerBasedAuth;\nconst errors_1 = require(\"../utils/errors\");\nconst constants_1 = require(\"../utils/errors/constants\");\nasync function headerBasedAuth(amplify, authMode, apiKey, additionalHeaders = {}) {\n let headers = {};\n switch (authMode) {\n case 'apiKey':\n if (!apiKey) {\n throw new errors_1.GraphQLApiError(constants_1.NO_API_KEY);\n }\n headers = {\n 'X-Api-Key': apiKey,\n };\n break;\n case 'iam': {\n const session = await amplify.Auth.fetchAuthSession();\n if (session.credentials === undefined) {\n throw new errors_1.GraphQLApiError(constants_1.NO_VALID_CREDENTIALS);\n }\n break;\n }\n case 'oidc':\n case 'userPool': {\n let token;\n try {\n token = (await amplify.Auth.fetchAuthSession()).tokens?.accessToken.toString();\n }\n catch (e) {\n // fetchAuthSession failed\n throw new errors_1.GraphQLApiError({\n ...constants_1.NO_SIGNED_IN_USER,\n underlyingError: e,\n });\n }\n // `fetchAuthSession()` succeeded but didn't return `tokens`.\n // This may happen when unauthenticated access is enabled and there is\n // no user signed in.\n if (!token) {\n throw new errors_1.GraphQLApiError(constants_1.NO_VALID_AUTH_TOKEN);\n }\n headers = {\n Authorization: token,\n };\n break;\n }\n case 'lambda':\n if (typeof additionalHeaders === 'object' &&\n !additionalHeaders.Authorization) {\n throw new errors_1.GraphQLApiError(constants_1.NO_AUTH_TOKEN_HEADER);\n }\n headers = {\n Authorization: additionalHeaders.Authorization,\n };\n break;\n case 'none':\n break;\n default:\n break;\n }\n return headers;\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,eAAe,GAAG,eAAe;AACzC,MAAM,QAAQ,GAAG,OAAO,CAAC,iBAAiB,CAAC;AAC3C,MAAM,WAAW,GAAG,OAAO,CAAC,2BAA2B,CAAC;AACxD,eAAe,eAAe,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,iBAAiB,GAAG,EAAE,EAAE;AAClF,IAAI,IAAI,OAAO,GAAG,EAAE;AACpB,IAAI,QAAQ,QAAQ;AACpB,QAAQ,KAAK,QAAQ;AACrB,YAAY,IAAI,CAAC,MA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AW,CAAC,oBAAoB,CAAC;AACpF;AACA,YAAY,OAAO,GAAG;AACtB,gBAAgB,aAAa,EAAE,iBAAiB,CAAC,aAAa;AAC9D,aAAa;AACb,YAAY;AAKZ;AACA,IAAI,OAAO,OAAO;AAClB;;"}
@@ -3,7 +3,7 @@
3
3
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
4
  // SPDX-License-Identifier: Apache-2.0
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.graphqlRequest = void 0;
6
+ exports.graphqlRequest = graphqlRequest;
7
7
  const utils_1 = require("@aws-amplify/core/internals/utils");
8
8
  const internals_1 = require("@aws-amplify/api-rest/internals");
9
9
  async function graphqlRequest(amplify, url, options, abortController, _post) {
@@ -16,5 +16,4 @@ async function graphqlRequest(amplify, url, options, abortController, _post) {
16
16
  const response = await responseBody.json();
17
17
  return response;
18
18
  }
19
- exports.graphqlRequest = graphqlRequest;
20
19
  //# sourceMappingURL=graphqlRequest.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"graphqlRequest.js","sources":["../../../src/internals/graphqlRequest.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.graphqlRequest = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst internals_1 = require(\"@aws-amplify/api-rest/internals\");\nasync function graphqlRequest(amplify, url, options, abortController, _post) {\n const p = _post ?? internals_1.post;\n const { body: responseBody } = await p(amplify, {\n url: new utils_1.AmplifyUrl(url),\n options,\n abortController,\n });\n const response = await responseBody.json();\n return response;\n}\nexports.graphqlRequest = graphqlRequest;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,cAAc,GAAG,MAAM;AAC/B,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,WAAW,GAAG,OAAO,CAAC,iCAAiC,CAAC;AAC9D,eAAe,cAAc,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE;AAC7E,IAAI,MAAM,CAAC,GAAG,KAAK,IAAI,WAAW,CAAC,IAAI;AACvC,IAAI,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,MAAM,CAAC,CAAC,OAAO,EAAE;AACpD,QAAQ,GAAG,EAAE,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC;AACxC,QAAQ,OAAO;AACf,QAAQ,eAAe;AACvB,KAAK,CAAC;AACN,IAAI,MAAM,QAAQ,GAAG,MAAM,YAAY,CAAC,IAAI,EAAE;AAC9C,IAAI,OAAO,QAAQ;AACnB;AACA,OAAO,CAAC,cAAc,GAAG,cAAc;;"}
1
+ {"version":3,"file":"graphqlRequest.js","sources":["../../../src/internals/graphqlRequest.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.graphqlRequest = graphqlRequest;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst internals_1 = require(\"@aws-amplify/api-rest/internals\");\nasync function graphqlRequest(amplify, url, options, abortController, _post) {\n const p = _post ?? internals_1.post;\n const { body: responseBody } = await p(amplify, {\n url: new utils_1.AmplifyUrl(url),\n options,\n abortController,\n });\n const response = await responseBody.json();\n return response;\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,cAAc,GAAG,cAAc;AACvC,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,WAAW,GAAG,OAAO,CAAC,iCAAiC,CAAC;AAC9D,eAAe,cAAc,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE;AAC7E,IAAI,MAAM,CAAC,GAAG,KAAK,IAAI,WAAW,CAAC,IAAI;AACvC,IAAI,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,MAAM,CAAC,CAAC,OAAO,EAAE;AACpD,QAAQ,GAAG,EAAE,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC;AACxC,QAAQ,OAAO;AACf,QAAQ,eAAe;AACvB,KAAK,CAAC;AACN,IAAI,MAAM,QAAQ,GAAG,MAAM,YAAY,CAAC,IAAI,EAAE;AAC9C,IAAI,OAAO,QAAQ;AACnB;;"}
@@ -3,7 +3,7 @@
3
3
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
4
  // SPDX-License-Identifier: Apache-2.0
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.generateClientWithAmplifyInstance = void 0;
6
+ exports.generateClientWithAmplifyInstance = generateClientWithAmplifyInstance;
7
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");
@@ -45,5 +45,4 @@ function generateClientWithAmplifyInstance(params) {
45
45
  }
46
46
  return client;
47
47
  }
48
- exports.generateClientWithAmplifyInstance = generateClientWithAmplifyInstance;
49
48
  //# sourceMappingURL=generateClientWithAmplifyInstance.js.map
@@ -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 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.__apiKey]: 'apiKey' in params ? params.apiKey : undefined,\n [types_1.__endpoint]: 'endpoint' in params ? params.endpoint : undefined,\n [types_1.__headers]: params.headers,\n graphql: __1.graphql,\n cancel: __1.cancel,\n isCancelError: __1.isCancelError,\n };\n const apiGraphqlConfig = params.config?.API?.GraphQL;\n if (client[types_1.__endpoint]) {\n if (!client[types_1.__authMode]) {\n throw new Error('generateClient() requires an explicit `authMode` when `endpoint` is provided.');\n }\n if (client[types_1.__authMode] === 'apiKey' && !client[types_1.__apiKey]) {\n throw new Error(\"generateClient() requires an explicit `apiKey` when `endpoint` is provided and `authMode = 'apiKey'`.\");\n }\n }\n if (!client[types_1.__endpoint] && (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;AAC7D,OAAO,CAAC,iCAAiC,GAAG,MAAM;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,kCAAkC,CAAC;AAC7D,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC;AACtC,MAAM,4BAA4B,GAAG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ACA;AACA,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,IAAI,4BAA4B,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,EAAE;AAC/G,QAAQ,IAAI,SAAS,CAAC,6BAA6B,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC;AAC1F;AACA,IAAI,OAAO,MAAM;AACjB;AACA,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 = generateClientWithAmplifyInstance;\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.__apiKey]: 'apiKey' in params ? params.apiKey : undefined,\n [types_1.__endpoint]: 'endpoint' in params ? params.endpoint : undefined,\n [types_1.__headers]: params.headers,\n graphql: __1.graphql,\n cancel: __1.cancel,\n isCancelError: __1.isCancelError,\n };\n const apiGraphqlConfig = params.config?.API?.GraphQL;\n if (client[types_1.__endpoint]) {\n if (!client[types_1.__authMode]) {\n throw new Error('generateClient() requires an explicit `authMode` when `endpoint` is provided.');\n }\n if (client[types_1.__authMode] === 'apiKey' && !client[types_1.__apiKey]) {\n throw new Error(\"generateClient() requires an explicit `apiKey` when `endpoint` is provided and `authMode = 'apiKey'`.\");\n }\n }\n if (!client[types_1.__endpoint] && (0, isApiGraphQLProviderConfig_1.isApiGraphQLConfig)(apiGraphqlConfig)) {\n (0, runtime_1.addSchemaToClientWithInstance)(client, params, types_1.getInternals);\n }\n return client;\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,iCAAiC,GAAG,iCAAiC;AAC7E,MAAM,SAAS,GAAG,OAAO,CAAC,kCAAkC,CAAC;AAC7D,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC;AACtC,MAAM,4BAA4B,GAAG,OAAO,CAAC,uDAAuD,CAAC;AACrG,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;AACzB;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,QAAQ,GAAG,QAAQ,IAAI,MAAM,GAAG,MAAM,CAAC,MAAM,GAAG,SAAS;AAC1E,QAAQ,CAAC,OAAO,CAAC,UAAU,GAAG,UAAU,IAAI,MAAM,GAAG,MAAM,CAAC,QAAQ,GAAG,SAAS;AAChF,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;AACL,IAAI,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO;AACxD,IAAI,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;AACpC,QAAQ,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;AACzC,YAAY,MAAM,IAAI,KAAK,CAAC,+EAA+E,CAAC;AAC5G;AACA,QAAQ,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;AAClF,YAAY,MAAM,IAAI,KAAK,CAAC,uGAAuG,CAAC;AACpI;AACA;AACA,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,IAAI,4BAA4B,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,EAAE;AAC/G,QAAQ,IAAI,SAAS,CAAC,6BAA6B,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC;AAC1F;AACA,IAAI,OAAO,MAAM;AACjB;;"}
@@ -3,9 +3,8 @@
3
3
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
4
  // SPDX-License-Identifier: Apache-2.0
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.isApiGraphQLConfig = void 0;
6
+ exports.isApiGraphQLConfig = isApiGraphQLConfig;
7
7
  function isApiGraphQLConfig(apiGraphQLConfig) {
8
8
  return apiGraphQLConfig !== undefined;
9
9
  }
10
- exports.isApiGraphQLConfig = isApiGraphQLConfig;
11
10
  //# sourceMappingURL=isApiGraphQLProviderConfig.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"isApiGraphQLProviderConfig.js","sources":["../../../../../src/internals/utils/runtimeTypeGuards/isApiGraphQLProviderConfig.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.isApiGraphQLConfig = void 0;\nfunction isApiGraphQLConfig(apiGraphQLConfig) {\n return apiGraphQLConfig !== undefined;\n}\nexports.isApiGraphQLConfig = isApiGraphQLConfig;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,kBAAkB,GAAG,MAAM;AACnC,SAAS,kBAAkB,CAAC,gBAAgB,EAAE;AAC9C,IAAI,OAAO,gBAAgB,KAAK,SAAS;AACzC;AACA,OAAO,CAAC,kBAAkB,GAAG,kBAAkB;;"}
1
+ {"version":3,"file":"isApiGraphQLProviderConfig.js","sources":["../../../../../src/internals/utils/runtimeTypeGuards/isApiGraphQLProviderConfig.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.isApiGraphQLConfig = isApiGraphQLConfig;\nfunction isApiGraphQLConfig(apiGraphQLConfig) {\n return apiGraphQLConfig !== undefined;\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,kBAAkB,GAAG,kBAAkB;AAC/C,SAAS,kBAAkB,CAAC,gBAAgB,EAAE;AAC9C,IAAI,OAAO,gBAAgB,KAAK,SAAS;AACzC;;"}
@@ -3,9 +3,8 @@
3
3
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
4
  // SPDX-License-Identifier: Apache-2.0
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.isConfigureEventWithResourceConfig = void 0;
6
+ exports.isConfigureEventWithResourceConfig = isConfigureEventWithResourceConfig;
7
7
  function isConfigureEventWithResourceConfig(payload) {
8
8
  return payload.event === 'configure';
9
9
  }
10
- exports.isConfigureEventWithResourceConfig = isConfigureEventWithResourceConfig;
11
10
  //# sourceMappingURL=isConfigureEventWithResourceConfig.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"isConfigureEventWithResourceConfig.js","sources":["../../../../../src/internals/utils/runtimeTypeGuards/isConfigureEventWithResourceConfig.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.isConfigureEventWithResourceConfig = void 0;\nfunction isConfigureEventWithResourceConfig(payload) {\n return payload.event === 'configure';\n}\nexports.isConfigureEventWithResourceConfig = isConfigureEventWithResourceConfig;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,kCAAkC,GAAG,MAAM;AACnD,SAAS,kCAAkC,CAAC,OAAO,EAAE;AACrD,IAAI,OAAO,OAAO,CAAC,KAAK,KAAK,WAAW;AACxC;AACA,OAAO,CAAC,kCAAkC,GAAG,kCAAkC;;"}
1
+ {"version":3,"file":"isConfigureEventWithResourceConfig.js","sources":["../../../../../src/internals/utils/runtimeTypeGuards/isConfigureEventWithResourceConfig.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.isConfigureEventWithResourceConfig = isConfigureEventWithResourceConfig;\nfunction isConfigureEventWithResourceConfig(payload) {\n return payload.event === 'configure';\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,kCAAkC,GAAG,kCAAkC;AAC/E,SAAS,kCAAkC,CAAC,OAAO,EAAE;AACrD,IAAI,OAAO,OAAO,CAAC,KAAK,KAAK,WAAW;AACxC;;"}
@@ -3,7 +3,7 @@
3
3
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
4
  // SPDX-License-Identifier: Apache-2.0
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.isGraphQLResponseWithErrors = void 0;
6
+ exports.isGraphQLResponseWithErrors = isGraphQLResponseWithErrors;
7
7
  function isGraphQLResponseWithErrors(response) {
8
8
  if (!response) {
9
9
  return false;
@@ -11,5 +11,4 @@ function isGraphQLResponseWithErrors(response) {
11
11
  const r = response;
12
12
  return Array.isArray(r.errors) && r.errors.length > 0;
13
13
  }
14
- exports.isGraphQLResponseWithErrors = isGraphQLResponseWithErrors;
15
14
  //# sourceMappingURL=isGraphQLResponseWithErrors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"isGraphQLResponseWithErrors.js","sources":["../../../../../src/internals/utils/runtimeTypeGuards/isGraphQLResponseWithErrors.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.isGraphQLResponseWithErrors = void 0;\nfunction isGraphQLResponseWithErrors(response) {\n if (!response) {\n return false;\n }\n const r = response;\n return Array.isArray(r.errors) && r.errors.length > 0;\n}\nexports.isGraphQLResponseWithErrors = isGraphQLResponseWithErrors;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,2BAA2B,GAAG,MAAM;AAC5C,SAAS,2BAA2B,CAAC,QAAQ,EAAE;AAC/C,IAAI,IAAI,CAAC,QAAQ,EAAE;AACnB,QAAQ,OAAO,KAAK;AACpB;AACA,IAAI,MAAM,CAAC,GAAG,QAAQ;AACtB,IAAI,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;AACzD;AACA,OAAO,CAAC,2BAA2B,GAAG,2BAA2B;;"}
1
+ {"version":3,"file":"isGraphQLResponseWithErrors.js","sources":["../../../../../src/internals/utils/runtimeTypeGuards/isGraphQLResponseWithErrors.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.isGraphQLResponseWithErrors = isGraphQLResponseWithErrors;\nfunction isGraphQLResponseWithErrors(response) {\n if (!response) {\n return false;\n }\n const r = response;\n return Array.isArray(r.errors) && r.errors.length > 0;\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,2BAA2B,GAAG,2BAA2B;AACjE,SAAS,2BAA2B,CAAC,QAAQ,EAAE;AAC/C,IAAI,IAAI,CAAC,QAAQ,EAAE;AACnB,QAAQ,OAAO,KAAK;AACpB;AACA,IAAI,MAAM,CAAC,GAAG,QAAQ;AACtB,IAAI,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;AACzD;;"}
@@ -1,7 +1,9 @@
1
1
  'use strict';
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.isCancelError = exports.cancel = exports.graphql = void 0;
4
+ exports.graphql = graphql;
5
+ exports.cancel = cancel;
6
+ exports.isCancelError = isCancelError;
5
7
  const GraphQLAPI_1 = require("../GraphQLAPI");
6
8
  const types_1 = require("../types");
7
9
  /**
@@ -134,7 +136,6 @@ function graphql(options, additionalHeaders) {
134
136
  }, headers);
135
137
  return result;
136
138
  }
137
- exports.graphql = graphql;
138
139
  /**
139
140
  * Cancels an inflight request. Only applicable for graphql queries and mutations
140
141
  * @param {any} request - request to cancel
@@ -143,7 +144,6 @@ exports.graphql = graphql;
143
144
  function cancel(promise, message) {
144
145
  return GraphQLAPI_1.GraphQLAPI.cancel(promise, message);
145
146
  }
146
- exports.cancel = cancel;
147
147
  /**
148
148
  * Checks to see if an error thrown is from an api request cancellation
149
149
  * @param {any} error - Any error
@@ -152,5 +152,4 @@ exports.cancel = cancel;
152
152
  function isCancelError(error) {
153
153
  return GraphQLAPI_1.GraphQLAPI.isCancelError(error);
154
154
  }
155
- exports.isCancelError = isCancelError;
156
155
  //# sourceMappingURL=v6.js.map
@@ -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 const internals = (0, types_1.getInternals)(this);\n /**\n * The custom `endpoint` specific to the client\n */\n const clientEndpoint = internals.endpoint;\n /**\n * The `authMode` specific to the client.\n */\n const clientAuthMode = internals.authMode;\n /**\n * The `apiKey` specific to the client.\n */\n const clientApiKey = internals.apiKey;\n /**\n * The most specific `authMode` wins. Setting an `endpoint` value without also\n * setting an `authMode` value is invalid. This helps to prevent customers apps\n * from unexpectedly sending auth details to endpoints the auth details do not\n * belong to.\n *\n * This is especially pronounced for `apiKey`. When both an `endpoint` *and*\n * `authMode: 'apiKey'` are provided, an explicit `apiKey` override is required\n * to prevent inadvertent sending of an API's `apiKey` to an endpoint is does\n * not belong to.\n */\n options.authMode = options.authMode || clientAuthMode;\n options.apiKey = options.apiKey ?? clientApiKey;\n options.authToken = options.authToken || internals.authToken;\n if (clientEndpoint && options.authMode === 'apiKey' && !options.apiKey) {\n throw new Error(\"graphql() requires an explicit `apiKey` for a custom `endpoint` when `authMode = 'apiKey'`.\");\n }\n const headers = additionalHeaders || internals.headers;\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, {\n ...options,\n endpoint: clientEndpoint,\n }, headers);\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;AAC7D,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,MAAM;AACjE,MAAM,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC;AAC7C,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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AO,EAAE;AAClC,IAAI,OAAO,YAAY,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC;AAC3D;AACA,OAAO,CAAC,MAAM,GAAG,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA,SAAS,aAAa,CAAC,KAAK,EAAE;AAC9B,IAAI,OAAO,YAAY,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,CAAC;AACvD;AACA,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.graphql = graphql;\nexports.cancel = cancel;\nexports.isCancelError = isCancelError;\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 /**\n * The custom `endpoint` specific to the client\n */\n const clientEndpoint = internals.endpoint;\n /**\n * The `authMode` specific to the client.\n */\n const clientAuthMode = internals.authMode;\n /**\n * The `apiKey` specific to the client.\n */\n const clientApiKey = internals.apiKey;\n /**\n * The most specific `authMode` wins. Setting an `endpoint` value without also\n * setting an `authMode` value is invalid. This helps to prevent customers apps\n * from unexpectedly sending auth details to endpoints the auth details do not\n * belong to.\n *\n * This is especially pronounced for `apiKey`. When both an `endpoint` *and*\n * `authMode: 'apiKey'` are provided, an explicit `apiKey` override is required\n * to prevent inadvertent sending of an API's `apiKey` to an endpoint is does\n * not belong to.\n */\n options.authMode = options.authMode || clientAuthMode;\n options.apiKey = options.apiKey ?? clientApiKey;\n options.authToken = options.authToken || internals.authToken;\n if (clientEndpoint && options.authMode === 'apiKey' && !options.apiKey) {\n throw new Error(\"graphql() requires an explicit `apiKey` for a custom `endpoint` when `authMode = 'apiKey'`.\");\n }\n const headers = additionalHeaders || internals.headers;\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, {\n ...options,\n endpoint: clientEndpoint,\n }, headers);\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 */\nfunction cancel(promise, message) {\n return GraphQLAPI_1.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 */\nfunction isCancelError(error) {\n return GraphQLAPI_1.GraphQLAPI.isCancelError(error);\n}\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,OAAO,GAAG,OAAO;AACzB,OAAO,CAAC,MAAM,GAAG,MAAM;AACvB,OAAO,CAAC,aAAa,GAAG,aAAa;AACrC,MAAM,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC;AAC7C,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;AACrD;AACA;AACA;AACA,IAAI,MAAM,cAAc,GAAG,SAAS,CAAC,QAAQ;AAC7C;AACA;A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
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.generateClient = void 0;
6
+ exports.generateClient = generateClient;
7
7
  const adapter_core_1 = require("@aws-amplify/core/internals/adapter-core");
8
8
  const server_1 = require("../internals/server");
9
9
  const types_1 = require("../types");
@@ -39,5 +39,4 @@ function generateClient(options) {
39
39
  client.graphql = wrappedGraphql;
40
40
  return client;
41
41
  }
42
- exports.generateClient = generateClient;
43
42
  //# sourceMappingURL=generateClient.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"generateClient.js","sources":["../../../src/server/generateClient.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.generateClient = void 0;\nconst adapter_core_1 = require(\"@aws-amplify/core/internals/adapter-core\");\nconst server_1 = require(\"../internals/server\");\nconst types_1 = require(\"../types\");\n/**\n * Generates an GraphQL API client that works with Amplify server context.\n *\n * @example\n * import config from './amplifyconfiguration.json';\n * import { listPosts } from './graphql/queries';\n *\n * const client = generateServerClient({ config });\n *\n * const result = await runWithAmplifyServerContext({\n * nextServerContext: { request, response },\n * operation: (contextSpec) => client.graphql(contextSpec, {\n * query: listPosts,\n * }),\n * });\n */\nfunction generateClient(options) {\n // passing `null` instance because each (future model) method must retrieve a valid instance\n // from server context\n const client = (0, server_1.generateClientWithAmplifyInstance)({\n amplify: null,\n ...options,\n });\n // TODO: improve this and the next type\n const prevGraphql = client.graphql;\n const wrappedGraphql = (contextSpec, innerOptions, additionalHeaders) => {\n const amplifyInstance = (0, adapter_core_1.getAmplifyServerContext)(contextSpec).amplify;\n return prevGraphql.call({ [types_1.__amplify]: amplifyInstance }, innerOptions, additionalHeaders);\n };\n client.graphql = wrappedGraphql;\n return client;\n}\nexports.generateClient = generateClient;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,cAAc,GAAG,MAAM;AAC/B,MAAM,cAAc,GAAG,OAAO,CAAC,0CAA0C,CAAC;AAC1E,MAAM,QAAQ,GAAG,OAAO,CAAC,qBAAqB,CAAC;AAC/C,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,cAAc,CAAC,OAAO,EAAE;AACjC;AACA;AACA,IAAI,MAAM,MAAM,GAAG,IAAI,QAAQ,CAAC,iCAAiC,EAAE;AACnE,QAAQ,OAAO,EAAE,IAAI;AACrB,QAAQ,GAAG,OAAO;AAClB,KAAK,CAAC;AACN;AACA,IAAI,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO;AACtC,IAAI,MAAM,cAAc,GAAG,CAAC,WAAW,EAAE,YAAY,EAAE,iBAAiB,KAAK;AAC7E,QAAQ,MAAM,eAAe,GAAG,IAAI,cAAc,CAAC,uBAAuB,EAAE,WAAW,CAAC,CAAC,OAAO;AAChG,QAAQ,OAAO,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,SAAS,GAAG,eAAe,EAAE,EAAE,YAAY,EAAE,iBAAiB,CAAC;AAC1G,KAAK;AACL,IAAI,MAAM,CAAC,OAAO,GAAG,cAAc;AACnC,IAAI,OAAO,MAAM;AACjB;AACA,OAAO,CAAC,cAAc,GAAG,cAAc;;"}
1
+ {"version":3,"file":"generateClient.js","sources":["../../../src/server/generateClient.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.generateClient = generateClient;\nconst adapter_core_1 = require(\"@aws-amplify/core/internals/adapter-core\");\nconst server_1 = require(\"../internals/server\");\nconst types_1 = require(\"../types\");\n/**\n * Generates an GraphQL API client that works with Amplify server context.\n *\n * @example\n * import config from './amplifyconfiguration.json';\n * import { listPosts } from './graphql/queries';\n *\n * const client = generateServerClient({ config });\n *\n * const result = await runWithAmplifyServerContext({\n * nextServerContext: { request, response },\n * operation: (contextSpec) => client.graphql(contextSpec, {\n * query: listPosts,\n * }),\n * });\n */\nfunction generateClient(options) {\n // passing `null` instance because each (future model) method must retrieve a valid instance\n // from server context\n const client = (0, server_1.generateClientWithAmplifyInstance)({\n amplify: null,\n ...options,\n });\n // TODO: improve this and the next type\n const prevGraphql = client.graphql;\n const wrappedGraphql = (contextSpec, innerOptions, additionalHeaders) => {\n const amplifyInstance = (0, adapter_core_1.getAmplifyServerContext)(contextSpec).amplify;\n return prevGraphql.call({ [types_1.__amplify]: amplifyInstance }, innerOptions, additionalHeaders);\n };\n client.graphql = wrappedGraphql;\n return client;\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,cAAc,GAAG,cAAc;AACvC,MAAM,cAAc,GAAG,OAAO,CAAC,0CAA0C,CAAC;AAC1E,MAAM,QAAQ,GAAG,OAAO,CAAC,qBAAqB,CAAC;AAC/C,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,cAAc,CAAC,OAAO,EAAE;AACjC;AACA;AACA,IAAI,MAAM,MAAM,GAAG,IAAI,QAAQ,CAAC,iCAAiC,EAAE;AACnE,QAAQ,OAAO,EAAE,IAAI;AACrB,QAAQ,GAAG,OAAO;AAClB,KAAK,CAAC;AACN;AACA,IAAI,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO;AACtC,IAAI,MAAM,cAAc,GAAG,CAAC,WAAW,EAAE,YAAY,EAAE,iBAAiB,KAAK;AAC7E,QAAQ,MAAM,eAAe,GAAG,IAAI,cAAc,CAAC,uBAAuB,EAAE,WAAW,CAAC,CAAC,OAAO;AAChG,QAAQ,OAAO,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,SAAS,GAAG,eAAe,EAAE,EAAE,YAAY,EAAE,iBAAiB,CAAC;AAC1G,KAAK;AACL,IAAI,MAAM,CAAC,OAAO,GAAG,cAAc;AACnC,IAAI,OAAO,MAAM;AACjB;;"}
@@ -2,13 +2,16 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.ConnectionState = exports.CONTROL_MSG = void 0;
5
+ var CONTROL_MSG;
5
6
  (function (CONTROL_MSG) {
6
7
  CONTROL_MSG["CONNECTION_CLOSED"] = "Connection closed";
7
8
  CONTROL_MSG["CONNECTION_FAILED"] = "Connection failed";
8
9
  CONTROL_MSG["REALTIME_SUBSCRIPTION_INIT_ERROR"] = "AppSync Realtime subscription init error";
9
10
  CONTROL_MSG["SUBSCRIPTION_ACK"] = "Subscription ack";
10
11
  CONTROL_MSG["TIMEOUT_DISCONNECT"] = "Timeout disconnect";
11
- })(exports.CONTROL_MSG || (exports.CONTROL_MSG = {}));
12
+ })(CONTROL_MSG || (exports.CONTROL_MSG = CONTROL_MSG = {}));
13
+ /** @enum {string} */
14
+ var ConnectionState;
12
15
  (function (ConnectionState) {
13
16
  /*
14
17
  * The connection is alive and healthy
@@ -42,5 +45,5 @@ exports.ConnectionState = exports.CONTROL_MSG = void 0;
42
45
  * The connection is alive, but a keep alive message has been missed
43
46
  */
44
47
  ConnectionState["ConnectedPendingKeepAlive"] = "ConnectedPendingKeepAlive";
45
- })(exports.ConnectionState || (exports.ConnectionState = {}));
48
+ })(ConnectionState || (exports.ConnectionState = ConnectionState = {}));
46
49
  //# sourceMappingURL=PubSub.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PubSub.js","sources":["../../../src/types/PubSub.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ConnectionState = exports.CONTROL_MSG = void 0;\nvar CONTROL_MSG;\n(function (CONTROL_MSG) {\n CONTROL_MSG[\"CONNECTION_CLOSED\"] = \"Connection closed\";\n CONTROL_MSG[\"CONNECTION_FAILED\"] = \"Connection failed\";\n CONTROL_MSG[\"REALTIME_SUBSCRIPTION_INIT_ERROR\"] = \"AppSync Realtime subscription init error\";\n CONTROL_MSG[\"SUBSCRIPTION_ACK\"] = \"Subscription ack\";\n CONTROL_MSG[\"TIMEOUT_DISCONNECT\"] = \"Timeout disconnect\";\n})(CONTROL_MSG = exports.CONTROL_MSG || (exports.CONTROL_MSG = {}));\n/** @enum {string} */\nvar ConnectionState;\n(function (ConnectionState) {\n /*\n * The connection is alive and healthy\n */\n ConnectionState[\"Connected\"] = \"Connected\";\n /*\n * The connection is alive, but the connection is offline\n */\n ConnectionState[\"ConnectedPendingNetwork\"] = \"ConnectedPendingNetwork\";\n /*\n * The connection has been disconnected while in use\n */\n ConnectionState[\"ConnectionDisrupted\"] = \"ConnectionDisrupted\";\n /*\n * The connection has been disconnected and the network is offline\n */\n ConnectionState[\"ConnectionDisruptedPendingNetwork\"] = \"ConnectionDisruptedPendingNetwork\";\n /*\n * The connection is in the process of connecting\n */\n ConnectionState[\"Connecting\"] = \"Connecting\";\n /*\n * The connection is not in use and is being disconnected\n */\n ConnectionState[\"ConnectedPendingDisconnect\"] = \"ConnectedPendingDisconnect\";\n /*\n * The connection is not in use and has been disconnected\n */\n ConnectionState[\"Disconnected\"] = \"Disconnected\";\n /*\n * The connection is alive, but a keep alive message has been missed\n */\n ConnectionState[\"ConnectedPendingKeepAlive\"] = \"ConnectedPendingKeepAlive\";\n})(ConnectionState = exports.ConnectionState || (exports.ConnectionState = {}));\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,eAAe,GAAG,OAAO,CAAC,WAAW,GAAG,MAAM;AAEtD,CAAC,UAAU,WAAW,EAAE;AACxB,IAAI,WAAW,CAAC,mBAAmB,CAAC,GAAG,mBAAmB;AAC1D,IAAI,WAAW,CAAC,mBAAmB,CAAC,GAAG,mBAAmB;AAC1D,IAAI,WAAW,CAAC,kCAAkC,CAAC,GAAG,0CAA0C;AAChG,IAAI,WAAW,CAAC,kBAAkB,CAAC,GAAG,kBAAkB;AACxD,IAAI,WAAW,CAAC,oBAAoB,CAAC,GAAG,oBAAoB;AAC5D,CAAC,EAAgB,OAAO,CAAC,WAAW,KAAK,OAAO,CAAC,WAAW,GAAG,EAAE,CAAC,CAAC;AAGnE,CAAC,UAAU,eAAe,EAAE;AAC5B;AACA;AACA;AACA,IAAI,eAAe,CAAC,WAAW,CAAC,GAAG,WAAW;AAC9C;AACA;AACA;AACA,IAAI,eAAe,CAAC,yBAAyB,CAAC,GAAG,yBAAyB;AAC1E;AACA;AACA;AACA,IAAI,eAAe,CAAC,qBAAqB,CAAC,GAAG,qBAAqB;AAClE;AACA;AACA;AACA,IAAI,eAAe,CAAC,mCAAmC,CAAC,GAAG,mCAAmC;AAC9F;AACA;AACA;AACA,IAAI,eAAe,CAAC,YAAY,CAAC,GAAG,YAAY;AAChD;AACA;AACA;AACA,IAAI,eAAe,CAAC,4BAA4B,CAAC,GAAG,4BAA4B;AAChF;AACA;AACA;AACA,IAAI,eAAe,CAAC,cAAc,CAAC,GAAG,cAAc;AACpD;AACA;AACA;AACA,IAAI,eAAe,CAAC,2BAA2B,CAAC,GAAG,2BAA2B;AAC9E,CAAC,EAAoB,OAAO,CAAC,eAAe,KAAK,OAAO,CAAC,eAAe,GAAG,EAAE,CAAC,CAAC;;"}
1
+ {"version":3,"file":"PubSub.js","sources":["../../../src/types/PubSub.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ConnectionState = exports.CONTROL_MSG = void 0;\nvar CONTROL_MSG;\n(function (CONTROL_MSG) {\n CONTROL_MSG[\"CONNECTION_CLOSED\"] = \"Connection closed\";\n CONTROL_MSG[\"CONNECTION_FAILED\"] = \"Connection failed\";\n CONTROL_MSG[\"REALTIME_SUBSCRIPTION_INIT_ERROR\"] = \"AppSync Realtime subscription init error\";\n CONTROL_MSG[\"SUBSCRIPTION_ACK\"] = \"Subscription ack\";\n CONTROL_MSG[\"TIMEOUT_DISCONNECT\"] = \"Timeout disconnect\";\n})(CONTROL_MSG || (exports.CONTROL_MSG = CONTROL_MSG = {}));\n/** @enum {string} */\nvar ConnectionState;\n(function (ConnectionState) {\n /*\n * The connection is alive and healthy\n */\n ConnectionState[\"Connected\"] = \"Connected\";\n /*\n * The connection is alive, but the connection is offline\n */\n ConnectionState[\"ConnectedPendingNetwork\"] = \"ConnectedPendingNetwork\";\n /*\n * The connection has been disconnected while in use\n */\n ConnectionState[\"ConnectionDisrupted\"] = \"ConnectionDisrupted\";\n /*\n * The connection has been disconnected and the network is offline\n */\n ConnectionState[\"ConnectionDisruptedPendingNetwork\"] = \"ConnectionDisruptedPendingNetwork\";\n /*\n * The connection is in the process of connecting\n */\n ConnectionState[\"Connecting\"] = \"Connecting\";\n /*\n * The connection is not in use and is being disconnected\n */\n ConnectionState[\"ConnectedPendingDisconnect\"] = \"ConnectedPendingDisconnect\";\n /*\n * The connection is not in use and has been disconnected\n */\n ConnectionState[\"Disconnected\"] = \"Disconnected\";\n /*\n * The connection is alive, but a keep alive message has been missed\n */\n ConnectionState[\"ConnectedPendingKeepAlive\"] = \"ConnectedPendingKeepAlive\";\n})(ConnectionState || (exports.ConnectionState = ConnectionState = {}));\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,eAAe,GAAG,OAAO,CAAC,WAAW,GAAG,MAAM;AACtD,IAAI,WAAW;AACf,CAAC,UAAU,WAAW,EAAE;AACxB,IAAI,WAAW,CAAC,mBAAmB,CAAC,GAAG,mBAAmB;AAC1D,IAAI,WAAW,CAAC,mBAAmB,CAAC,GAAG,mBAAmB;AAC1D,IAAI,WAAW,CAAC,kCAAkC,CAAC,GAAG,0CAA0C;AAChG,IAAI,WAAW,CAAC,kBAAkB,CAAC,GAAG,kBAAkB;AACxD,IAAI,WAAW,CAAC,oBAAoB,CAAC,GAAG,oBAAoB;AAC5D,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,WAAW,GAAG,WAAW,GAAG,EAAE,CAAC,CAAC;AAC3D;AACA,IAAI,eAAe;AACnB,CAAC,UAAU,eAAe,EAAE;AAC5B;AACA;AACA;AACA,IAAI,eAAe,CAAC,WAAW,CAAC,GAAG,WAAW;AAC9C;AACA;AACA;AACA,IAAI,eAAe,CAAC,yBAAyB,CAAC,GAAG,yBAAyB;AAC1E;AACA;AACA;AACA,IAAI,eAAe,CAAC,qBAAqB,CAAC,GAAG,qBAAqB;AAClE;AACA;AACA;AACA,IAAI,eAAe,CAAC,mCAAmC,CAAC,GAAG,mCAAmC;AAC9F;AACA;AACA;AACA,IAAI,eAAe,CAAC,YAAY,CAAC,GAAG,YAAY;AAChD;AACA;AACA;AACA,IAAI,eAAe,CAAC,4BAA4B,CAAC,GAAG,4BAA4B;AAChF;AACA;AACA;AACA,IAAI,eAAe,CAAC,cAAc,CAAC,GAAG,cAAc;AACpD;AACA;AACA;AACA,IAAI,eAAe,CAAC,2BAA2B,CAAC,GAAG,2BAA2B;AAC9E,CAAC,EAAE,eAAe,KAAK,OAAO,CAAC,eAAe,GAAG,eAAe,GAAG,EAAE,CAAC,CAAC;;"}
@@ -1,17 +1,19 @@
1
1
  'use strict';
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.getInternals = exports.__endpoint = exports.__headers = exports.__apiKey = exports.__authToken = exports.__authMode = exports.__amplify = exports.GraphQLAuthError = exports.ConnectionState = exports.CONTROL_MSG = void 0;
4
+ exports.__endpoint = exports.__headers = exports.__apiKey = exports.__authToken = exports.__authMode = exports.__amplify = exports.GraphQLAuthError = exports.ConnectionState = exports.CONTROL_MSG = void 0;
5
+ exports.getInternals = getInternals;
5
6
  var PubSub_1 = require("./PubSub");
6
7
  Object.defineProperty(exports, "CONTROL_MSG", { enumerable: true, get: function () { return PubSub_1.CONTROL_MSG; } });
7
8
  Object.defineProperty(exports, "ConnectionState", { enumerable: true, get: function () { return PubSub_1.ConnectionState; } });
9
+ var GraphQLAuthError;
8
10
  (function (GraphQLAuthError) {
9
11
  GraphQLAuthError["NO_API_KEY"] = "No api-key configured";
10
12
  GraphQLAuthError["NO_CURRENT_USER"] = "No current user";
11
13
  GraphQLAuthError["NO_CREDENTIALS"] = "No credentials";
12
14
  GraphQLAuthError["NO_FEDERATED_JWT"] = "No federated jwt";
13
15
  GraphQLAuthError["NO_AUTH_TOKEN"] = "No auth token specified";
14
- })(exports.GraphQLAuthError || (exports.GraphQLAuthError = {}));
16
+ })(GraphQLAuthError || (exports.GraphQLAuthError = GraphQLAuthError = {}));
15
17
  exports.__amplify = Symbol('amplify');
16
18
  exports.__authMode = Symbol('authMode');
17
19
  exports.__authToken = Symbol('authToken');
@@ -29,5 +31,4 @@ function getInternals(client) {
29
31
  headers: c[exports.__headers],
30
32
  };
31
33
  }
32
- exports.getInternals = getInternals;
33
34
  //# 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.getInternals = exports.__endpoint = exports.__headers = exports.__apiKey = 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.__apiKey = Symbol('apiKey');\nexports.__headers = Symbol('headers');\nexports.__endpoint = Symbol('endpoint');\nfunction getInternals(client) {\n const c = client;\n return {\n amplify: c[exports.__amplify],\n apiKey: c[exports.__apiKey],\n authMode: c[exports.__authMode],\n authToken: c[exports.__authToken],\n endpoint: c[exports.__endpoint],\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;AAC7D,OAAO,CAAC,YAAY,GAAG,OAAO,CAAC,UAAU,GAAG,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,QAAQ,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,MAAM;AACnO,IAAI,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;AAClC,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;AACtH,MAAM,CA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EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;AACvC,QAAQ,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;AACrC,KAAK;AACL;AACA,OAAO,CAAC,YAAY,GAAG,YAAY;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/types/index.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.__endpoint = exports.__headers = exports.__apiKey = exports.__authToken = exports.__authMode = exports.__amplify = exports.GraphQLAuthError = exports.ConnectionState = exports.CONTROL_MSG = void 0;\nexports.getInternals = getInternals;\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 = GraphQLAuthError = {}));\nexports.__amplify = Symbol('amplify');\nexports.__authMode = Symbol('authMode');\nexports.__authToken = Symbol('authToken');\nexports.__apiKey = Symbol('apiKey');\nexports.__headers = Symbol('headers');\nexports.__endpoint = Symbol('endpoint');\nfunction getInternals(client) {\n const c = client;\n return {\n amplify: c[exports.__amplify],\n apiKey: c[exports.__apiKey],\n authMode: c[exports.__authMode],\n authToken: c[exports.__authToken],\n endpoint: c[exports.__endpoint],\n headers: c[exports.__headers],\n };\n}\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE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AAM,CAAC,WAAW,CAAC;AACzC,OAAO,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;AACnC,OAAO,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;AACrC,OAAO,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;AACvC,SAAS,YAAY,CAAC,MAAM,EAAE;AAC9B,IAAI,MAAM,CAAC,GAAG,MAAM;AACpB,IAAI,OAAO;AACX,QAAQ,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;AACrC,QAAQ,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;AACnC,QAAQ,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;AACvC,QAAQ,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC;AACzC,QAAQ,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;AACvC,QAAQ,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;AACrC,KAAK;AACL;;"}
@@ -7,7 +7,7 @@ var ReconnectEvent;
7
7
  (function (ReconnectEvent) {
8
8
  ReconnectEvent["START_RECONNECT"] = "START_RECONNECT";
9
9
  ReconnectEvent["HALT_RECONNECT"] = "HALT_RECONNECT";
10
- })(ReconnectEvent = exports.ReconnectEvent || (exports.ReconnectEvent = {}));
10
+ })(ReconnectEvent || (exports.ReconnectEvent = ReconnectEvent = {}));
11
11
  /**
12
12
  * Captures the reconnect event logic used to determine when to reconnect to PubSub providers.
13
13
  * Reconnect attempts are delayed by 5 seconds to let the interface settle.
@@ -1 +1 @@
1
- {"version":3,"file":"ReconnectionMonitor.js","sources":["../../../src/utils/ReconnectionMonitor.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ReconnectionMonitor = exports.ReconnectEvent = void 0;\nconst constants_1 = require(\"../Providers/constants\");\nvar ReconnectEvent;\n(function (ReconnectEvent) {\n ReconnectEvent[\"START_RECONNECT\"] = \"START_RECONNECT\";\n ReconnectEvent[\"HALT_RECONNECT\"] = \"HALT_RECONNECT\";\n})(ReconnectEvent = exports.ReconnectEvent || (exports.ReconnectEvent = {}));\n/**\n * Captures the reconnect event logic used to determine when to reconnect to PubSub providers.\n * Reconnect attempts are delayed by 5 seconds to let the interface settle.\n * Attempting to reconnect only once creates unrecoverable states when the network state isn't\n * supported by the browser, so this keeps retrying every minute until halted.\n */\nclass ReconnectionMonitor {\n constructor() {\n this.reconnectObservers = [];\n }\n /**\n * Add reconnect observer to the list of observers to alert on reconnect\n */\n addObserver(reconnectObserver) {\n this.reconnectObservers.push(reconnectObserver);\n }\n /**\n * Given a reconnect event, start the appropriate behavior\n */\n record(event) {\n if (event === ReconnectEvent.START_RECONNECT) {\n // If the reconnection hasn't been started\n if (this.reconnectSetTimeoutId === undefined &&\n this.reconnectIntervalId === undefined) {\n this.reconnectSetTimeoutId = setTimeout(() => {\n // Reconnect now\n this._triggerReconnect();\n // Retry reconnect every periodically until it works\n this.reconnectIntervalId = setInterval(() => {\n this._triggerReconnect();\n }, constants_1.RECONNECT_INTERVAL);\n }, constants_1.RECONNECT_DELAY);\n }\n }\n if (event === ReconnectEvent.HALT_RECONNECT) {\n if (this.reconnectIntervalId) {\n clearInterval(this.reconnectIntervalId);\n this.reconnectIntervalId = undefined;\n }\n if (this.reconnectSetTimeoutId) {\n clearTimeout(this.reconnectSetTimeoutId);\n this.reconnectSetTimeoutId = undefined;\n }\n }\n }\n /**\n * Complete all reconnect observers\n */\n close() {\n this.reconnectObservers.forEach(reconnectObserver => {\n reconnectObserver.complete?.();\n });\n }\n _triggerReconnect() {\n this.reconnectObservers.forEach(reconnectObserver => {\n reconnectObserver.next?.();\n });\n }\n}\nexports.ReconnectionMonitor = ReconnectionMonitor;\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IA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Y,IAAI,IAAI,CAAC,mBAAmB,EAAE;AAC1C,gBAAgB,aAAa,CAAC,IAAI,CAAC,mBAAmB,CAAC;AACvD,gBAAgB,IAAI,CAAC,mBAAmB,GAAG,SAAS;AACpD;AACA,YAAY,IAAI,IAAI,CAAC,qBAAqB,EAAE;AAC5C,gBAAgB,YAAY,CAAC,IAAI,CAAC,qBAAqB,CAAC;AACxD,gBAAgB,IAAI,CAAC,qBAAqB,GAAG,SAAS;AACtD;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,KAAK,GAAG;AACZ,QAAQ,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,iBAAiB,IAAI;AAC7D,YAAY,iBAAiB,CAAC,QAAQ,IAAI;AAC1C,SAAS,CAAC;AACV;AACA,IAAI,iBAAiB,GAAG;AACxB,QAAQ,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,iBAAiB,IAAI;AAC7D,YAAY,iBAAiB,CAAC,IAAI,IAAI;AACtC,SAAS,CAAC;AACV;AACA;AACA,OAAO,CAAC,mBAAmB,GAAG,mBAAmB;;"}
1
+ {"version":3,"file":"ReconnectionMonitor.js","sources":["../../../src/utils/ReconnectionMonitor.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ReconnectionMonitor = exports.ReconnectEvent = void 0;\nconst constants_1 = require(\"../Providers/constants\");\nvar ReconnectEvent;\n(function (ReconnectEvent) {\n ReconnectEvent[\"START_RECONNECT\"] = \"START_RECONNECT\";\n ReconnectEvent[\"HALT_RECONNECT\"] = \"HALT_RECONNECT\";\n})(ReconnectEvent || (exports.ReconnectEvent = ReconnectEvent = {}));\n/**\n * Captures the reconnect event logic used to determine when to reconnect to PubSub providers.\n * Reconnect attempts are delayed by 5 seconds to let the interface settle.\n * Attempting to reconnect only once creates unrecoverable states when the network state isn't\n * supported by the browser, so this keeps retrying every minute until halted.\n */\nclass ReconnectionMonitor {\n constructor() {\n this.reconnectObservers = [];\n }\n /**\n * Add reconnect observer to the list of observers to alert on reconnect\n */\n addObserver(reconnectObserver) {\n this.reconnectObservers.push(reconnectObserver);\n }\n /**\n * Given a reconnect event, start the appropriate behavior\n */\n record(event) {\n if (event === ReconnectEvent.START_RECONNECT) {\n // If the reconnection hasn't been started\n if (this.reconnectSetTimeoutId === undefined &&\n this.reconnectIntervalId === undefined) {\n this.reconnectSetTimeoutId = setTimeout(() => {\n // Reconnect now\n this._triggerReconnect();\n // Retry reconnect every periodically until it works\n this.reconnectIntervalId = setInterval(() => {\n this._triggerReconnect();\n }, constants_1.RECONNECT_INTERVAL);\n }, constants_1.RECONNECT_DELAY);\n }\n }\n if (event === ReconnectEvent.HALT_RECONNECT) {\n if (this.reconnectIntervalId) {\n clearInterval(this.reconnectIntervalId);\n this.reconnectIntervalId = undefined;\n }\n if (this.reconnectSetTimeoutId) {\n clearTimeout(this.reconnectSetTimeoutId);\n this.reconnectSetTimeoutId = undefined;\n }\n }\n }\n /**\n * Complete all reconnect observers\n */\n close() {\n this.reconnectObservers.forEach(reconnectObserver => {\n reconnectObserver.complete?.();\n });\n }\n _triggerReconnect() {\n this.reconnectObservers.forEach(reconnectObserver => {\n reconnectObserver.next?.();\n });\n }\n}\nexports.ReconnectionMonitor = ReconnectionMonitor;\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,mBAAmB,GAAG,OAAO,CAAC,cAAc,GAAG,MAAM;AAC7D,MAAM,WAAW,GAAG,OAAO,CAAC,wBAAwB,CAAC;AACrD,IAAI,cAAc;AAClB,CAAC,UAAU,cAAc,EAAE;AAC3B,IAAI,cAAc,CAAC,iBAAiB,CAAC,GAAG,iBAAiB;AACzD,IAAI,cAAc,CAAC,gBAAgB,CAAC,GAAG,gBAAgB;AACvD,CAAC,EAAE,cAAc,KAAK,OAAO,CAAC,cAAc,GAAG,cAAc,GAAG,EAA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kB,CAAC,OAAO,CAAC,iBAAiB,IAAI;AAC7D,YAAY,iBAAiB,CAAC,QAAQ,IAAI;AAC1C,SAAS,CAAC;AACV;AACA,IAAI,iBAAiB,GAAG;AACxB,QAAQ,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,iBAAiB,IAAI;AAC7D,YAAY,iBAAiB,CAAC,IAAI,IAAI;AACtC,SAAS,CAAC;AACV;AACA;AACA,OAAO,CAAC,mBAAmB,GAAG,mBAAmB;;"}
@@ -3,7 +3,7 @@
3
3
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
4
  // SPDX-License-Identifier: Apache-2.0
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.assertValidationError = void 0;
6
+ exports.assertValidationError = assertValidationError;
7
7
  const GraphQLApiError_1 = require("./GraphQLApiError");
8
8
  const validation_1 = require("./validation");
9
9
  /**
@@ -15,5 +15,4 @@ function assertValidationError(assertion, name) {
15
15
  throw new GraphQLApiError_1.GraphQLApiError({ name, message, recoverySuggestion });
16
16
  }
17
17
  }
18
- exports.assertValidationError = assertValidationError;
19
18
  //# sourceMappingURL=assertValidationError.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"assertValidationError.js","sources":["../../../../src/utils/errors/assertValidationError.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.assertValidationError = void 0;\nconst GraphQLApiError_1 = require(\"./GraphQLApiError\");\nconst validation_1 = require(\"./validation\");\n/**\n * @internal\n */\nfunction assertValidationError(assertion, name) {\n const { message, recoverySuggestion } = validation_1.validationErrorMap[name];\n if (!assertion) {\n throw new GraphQLApiError_1.GraphQLApiError({ name, message, recoverySuggestion });\n }\n}\nexports.assertValidationError = assertValidationError;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,qBAAqB,GAAG,MAAM;AACtC,MAAM,iBAAiB,GAAG,OAAO,CAAC,mBAAmB,CAAC;AACtD,MAAM,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC;AAC5C;AACA;AACA;AACA,SAAS,qBAAqB,CAAC,SAAS,EAAE,IAAI,EAAE;AAChD,IAAI,MAAM,EAAE,OAAO,EAAE,kBAAkB,EAAE,GAAG,YAAY,CAAC,kBAAkB,CAAC,IAAI,CAAC;AACjF,IAAI,IAAI,CAAC,SAAS,EAAE;AACpB,QAAQ,MAAM,IAAI,iBAAiB,CAAC,eAAe,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAC1F;AACA;AACA,OAAO,CAAC,qBAAqB,GAAG,qBAAqB;;"}
1
+ {"version":3,"file":"assertValidationError.js","sources":["../../../../src/utils/errors/assertValidationError.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.assertValidationError = assertValidationError;\nconst GraphQLApiError_1 = require(\"./GraphQLApiError\");\nconst validation_1 = require(\"./validation\");\n/**\n * @internal\n */\nfunction assertValidationError(assertion, name) {\n const { message, recoverySuggestion } = validation_1.validationErrorMap[name];\n if (!assertion) {\n throw new GraphQLApiError_1.GraphQLApiError({ name, message, recoverySuggestion });\n }\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,qBAAqB,GAAG,qBAAqB;AACrD,MAAM,iBAAiB,GAAG,OAAO,CAAC,mBAAmB,CAAC;AACtD,MAAM,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC;AAC5C;AACA;AACA;AACA,SAAS,qBAAqB,CAAC,SAAS,EAAE,IAAI,EAAE;AAChD,IAAI,MAAM,EAAE,OAAO,EAAE,kBAAkB,EAAE,GAAG,YAAY,CAAC,kBAAkB,CAAC,IAAI,CAAC;AACjF,IAAI,IAAI,CAAC,SAAS,EAAE;AACpB,QAAQ,MAAM,IAAI,iBAAiB,CAAC,eAAe,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAC1F;AACA;;"}
@@ -3,7 +3,7 @@
3
3
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
4
  // SPDX-License-Identifier: Apache-2.0
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.repackageUnauthorizedError = void 0;
6
+ exports.repackageUnauthorizedError = repackageUnauthorizedError;
7
7
  /**
8
8
  * Checks to see if the given response or subscription message contains an
9
9
  * Unauthorized error. If it does, it changes the error message to include instructions
@@ -23,7 +23,6 @@ function repackageUnauthorizedError(content) {
23
23
  }
24
24
  return content;
25
25
  }
26
- exports.repackageUnauthorizedError = repackageUnauthorizedError;
27
26
  function isUnauthorizedError(error) {
28
27
  // Error pattern corresponding to appsync calls
29
28
  if (error?.originalError?.name?.startsWith('UnauthorizedException')) {
@@ -1 +1 @@
1
- {"version":3,"file":"repackageAuthError.js","sources":["../../../../src/utils/errors/repackageAuthError.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.repackageUnauthorizedError = void 0;\n/**\n * Checks to see if the given response or subscription message contains an\n * Unauthorized error. If it does, it changes the error message to include instructions\n * for the app developer.\n */\nfunction repackageUnauthorizedError(content) {\n if (content.errors && Array.isArray(content.errors)) {\n content.errors.forEach(e => {\n if (isUnauthorizedError(e)) {\n e.message = 'Unauthorized';\n e.recoverySuggestion =\n `If you're calling an Amplify-generated API, make sure ` +\n `to set the \"authMode\" in generateClient({ authMode: '...' }) to the backend authorization ` +\n `rule's auth provider ('apiKey', 'userPool', 'iam', 'oidc', 'lambda')`;\n }\n });\n }\n return content;\n}\nexports.repackageUnauthorizedError = repackageUnauthorizedError;\nfunction isUnauthorizedError(error) {\n // Error pattern corresponding to appsync calls\n if (error?.originalError?.name?.startsWith('UnauthorizedException')) {\n return true;\n }\n // Error pattern corresponding to appsync subscriptions\n if (error.message?.startsWith('Connection failed:') &&\n error.message?.includes('Permission denied')) {\n return true;\n }\n return false;\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,0BAA0B,GAAG,MAAM;AAC3C;AACA;AACA;AACA;AACA;AACA,SAAS,0BAA0B,CAAC,OAAO,EAAE;AAC7C,IAAI,IAAI,OAAO,CAAC,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;AACzD,QAAQ,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI;AACpC,YAAY,IAAI,mBAAmB,CAAC,CAAC,CAAC,EAAE;AACxC,gBAAgB,CAAC,CAAC,OAAO,GAAG,cAAc;AAC1C,gBAAgB,CAAC,CAAC,kBAAkB;AACpC,oBAAoB,CAAC,sDAAsD,CAAC;AAC5E,wBAAwB,CAAC,0FAA0F,CAAC;AACpH,wBAAwB,CAAC,oEAAoE,CAAC;AAC9F;AACA,SAAS,CAAC;AACV;AACA,IAAI,OAAO,OAAO;AAClB;AACA,OAAO,CAAC,0BAA0B,GAAG,0BAA0B;AAC/D,SAAS,mBAAmB,CAAC,KAAK,EAAE;AACpC;AACA,IAAI,IAAI,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,UAAU,CAAC,uBAAuB,CAAC,EAAE;AACzE,QAAQ,OAAO,IAAI;AACnB;AACA;AACA,IAAI,IAAI,KAAK,CAAC,OAAO,EAAE,UAAU,CAAC,oBAAoB,CAAC;AACvD,QAAQ,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC,mBAAmB,CAAC,EAAE;AACtD,QAAQ,OAAO,IAAI;AACnB;AACA,IAAI,OAAO,KAAK;AAChB;;"}
1
+ {"version":3,"file":"repackageAuthError.js","sources":["../../../../src/utils/errors/repackageAuthError.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.repackageUnauthorizedError = repackageUnauthorizedError;\n/**\n * Checks to see if the given response or subscription message contains an\n * Unauthorized error. If it does, it changes the error message to include instructions\n * for the app developer.\n */\nfunction repackageUnauthorizedError(content) {\n if (content.errors && Array.isArray(content.errors)) {\n content.errors.forEach(e => {\n if (isUnauthorizedError(e)) {\n e.message = 'Unauthorized';\n e.recoverySuggestion =\n `If you're calling an Amplify-generated API, make sure ` +\n `to set the \"authMode\" in generateClient({ authMode: '...' }) to the backend authorization ` +\n `rule's auth provider ('apiKey', 'userPool', 'iam', 'oidc', 'lambda')`;\n }\n });\n }\n return content;\n}\nfunction isUnauthorizedError(error) {\n // Error pattern corresponding to appsync calls\n if (error?.originalError?.name?.startsWith('UnauthorizedException')) {\n return true;\n }\n // Error pattern corresponding to appsync subscriptions\n if (error.message?.startsWith('Connection failed:') &&\n error.message?.includes('Permission denied')) {\n return true;\n }\n return false;\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,0BAA0B,GAAG,0BAA0B;AAC/D;AACA;AACA;AACA;AACA;AACA,SAAS,0BAA0B,CAAC,OAAO,EAAE;AAC7C,IAAI,IAAI,OAAO,CAAC,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;AACzD,QAAQ,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI;AACpC,YAAY,IAAI,mBAAmB,CAAC,CAAC,CAAC,EAAE;AACxC,gBAAgB,CAAC,CAAC,OAAO,GAAG,cAAc;AAC1C,gBAAgB,CAAC,CAAC,kBAAkB;AACpC,oBAAoB,CAAC,sDAAsD,CAAC;AAC5E,wBAAwB,CAAC,0FAA0F,CAAC;AACpH,wBAAwB,CAAC,oEAAoE,CAAC;AAC9F;AACA,SAAS,CAAC;AACV;AACA,IAAI,OAAO,OAAO;AAClB;AACA,SAAS,mBAAmB,CAAC,KAAK,EAAE;AACpC;AACA,IAAI,IAAI,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,UAAU,CAAC,uBAAuB,CAAC,EAAE;AACzE,QAAQ,OAAO,IAAI;AACnB;AACA;AACA,IAAI,IAAI,KAAK,CAAC,OAAO,EAAE,UAAU,CAAC,oBAAoB,CAAC;AACvD,QAAQ,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC,mBAAmB,CAAC,EAAE;AACtD,QAAQ,OAAO,IAAI;AACnB;AACA,IAAI,OAAO,KAAK;AAChB;;"}
@@ -9,7 +9,7 @@ var APIValidationErrorCode;
9
9
  APIValidationErrorCode["NoAuthSession"] = "NoAuthSession";
10
10
  APIValidationErrorCode["NoRegion"] = "NoRegion";
11
11
  APIValidationErrorCode["NoCustomEndpoint"] = "NoCustomEndpoint";
12
- })(APIValidationErrorCode = exports.APIValidationErrorCode || (exports.APIValidationErrorCode = {}));
12
+ })(APIValidationErrorCode || (exports.APIValidationErrorCode = APIValidationErrorCode = {}));
13
13
  exports.validationErrorMap = {
14
14
  [APIValidationErrorCode.NoAuthSession]: {
15
15
  message: 'Auth session should not be empty.',
@@ -1 +1 @@
1
- {"version":3,"file":"validation.js","sources":["../../../../src/utils/errors/validation.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.validationErrorMap = exports.APIValidationErrorCode = void 0;\nvar APIValidationErrorCode;\n(function (APIValidationErrorCode) {\n APIValidationErrorCode[\"NoAuthSession\"] = \"NoAuthSession\";\n APIValidationErrorCode[\"NoRegion\"] = \"NoRegion\";\n APIValidationErrorCode[\"NoCustomEndpoint\"] = \"NoCustomEndpoint\";\n})(APIValidationErrorCode = exports.APIValidationErrorCode || (exports.APIValidationErrorCode = {}));\nexports.validationErrorMap = {\n [APIValidationErrorCode.NoAuthSession]: {\n message: 'Auth session should not be empty.',\n },\n // TODO: re-enable when working in all test environments:\n // [APIValidationErrorCode.NoEndpoint]: {\n // \tmessage: 'Missing endpoint',\n // },\n [APIValidationErrorCode.NoRegion]: {\n message: 'Missing region.',\n },\n [APIValidationErrorCode.NoCustomEndpoint]: {\n message: 'Custom endpoint region is present without custom endpoint.',\n },\n};\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,kBAAkB,GAAG,OAAO,CAAC,sBAAsB,GAAG,MAAM;AACpE,IAAI,sBAAsB;AAC1B,CAAC,UAAU,sBAAsB,EAAE;AACnC,IAAI,sBAAsB,CAAC,eAAe,CAAC,GAAG,eAAe;AAC7D,IAAI,sBAAsB,CAAC,UAAU,CAAC,GAAG,UAAU;AACnD,IAAI,sBAAsB,CAAC,kBAAkB,CAAC,GAAG,kBAAkB;AACnE,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,sBAAsB,KAAK,OAAO,CAAC,sBAAsB,GAAG,EAAE,CAAC,CAAC;AACpG,OAAO,CAAC,kBAAkB,GAAG;AAC7B,IAAI,CAAC,sBAAsB,CAAC,aAAa,GAAG;AAC5C,QAAQ,OAAO,EAAE,mCAAmC;AACpD,KAAK;AACL;AACA;AACA;AACA;AACA,IAAI,CAAC,sBAAsB,CAAC,QAAQ,GAAG;AACvC,QAAQ,OAAO,EAAE,iBAAiB;AAClC,KAAK;AACL,IAAI,CAAC,sBAAsB,CAAC,gBAAgB,GAAG;AAC/C,QAAQ,OAAO,EAAE,4DAA4D;AAC7E,KAAK;AACL,CAAC;;"}
1
+ {"version":3,"file":"validation.js","sources":["../../../../src/utils/errors/validation.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.validationErrorMap = exports.APIValidationErrorCode = void 0;\nvar APIValidationErrorCode;\n(function (APIValidationErrorCode) {\n APIValidationErrorCode[\"NoAuthSession\"] = \"NoAuthSession\";\n APIValidationErrorCode[\"NoRegion\"] = \"NoRegion\";\n APIValidationErrorCode[\"NoCustomEndpoint\"] = \"NoCustomEndpoint\";\n})(APIValidationErrorCode || (exports.APIValidationErrorCode = APIValidationErrorCode = {}));\nexports.validationErrorMap = {\n [APIValidationErrorCode.NoAuthSession]: {\n message: 'Auth session should not be empty.',\n },\n // TODO: re-enable when working in all test environments:\n // [APIValidationErrorCode.NoEndpoint]: {\n // \tmessage: 'Missing endpoint',\n // },\n [APIValidationErrorCode.NoRegion]: {\n message: 'Missing region.',\n },\n [APIValidationErrorCode.NoCustomEndpoint]: {\n message: 'Custom endpoint region is present without custom endpoint.',\n },\n};\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,kBAAkB,GAAG,OAAO,CAAC,sBAAsB,GAAG,MAAM;AACpE,IAAI,sBAAsB;AAC1B,CAAC,UAAU,sBAAsB,EAAE;AACnC,IAAI,sBAAsB,CAAC,eAAe,CAAC,GAAG,eAAe;AAC7D,IAAI,sBAAsB,CAAC,UAAU,CAAC,GAAG,UAAU;AACnD,IAAI,sBAAsB,CAAC,kBAAkB,CAAC,GAAG,kBAAkB;AACnE,CAAC,EAAE,sBAAsB,KAAK,OAAO,CAAC,sBAAsB,GAAG,sBAAsB,GAAG,EAAE,CAAC,CAAC;AAC5F,OAAO,CAAC,kBAAkB,GAAG;AAC7B,IAAI,CAAC,sBAAsB,CAAC,aAAa,GAAG;AAC5C,QAAQ,OAAO,EAAE,mCAAmC;AACpD,KAAK;AACL;AACA;AACA;AACA;AACA,IAAI,CAAC,sBAAsB,CAAC,QAAQ,GAAG;AACvC,QAAQ,OAAO,EAAE,iBAAiB;AAClC,KAAK;AACL,IAAI,CAAC,sBAAsB,CAAC,gBAAgB,GAAG;AAC/C,QAAQ,OAAO,EAAE,4DAA4D;AAC7E,KAAK;AACL,CAAC;;"}
@@ -6,7 +6,7 @@ export declare const getRealtimeEndpointUrl: (appSyncGraphqlEndpoint: string | u
6
6
  * @param headers - http headers
7
7
  * @returns uri-encoded query parameters derived from custom headers
8
8
  */
9
- export declare const queryParamsFromCustomHeaders: (headers?: AWSAppSyncRealTimeProviderOptions['additionalCustomHeaders']) => URLSearchParams;
9
+ export declare const queryParamsFromCustomHeaders: (headers?: AWSAppSyncRealTimeProviderOptions["additionalCustomHeaders"]) => URLSearchParams;
10
10
  /**
11
11
  * Normalizes AppSync realtime endpoint URL
12
12
  *
@@ -53,7 +53,7 @@ export declare enum MESSAGE_TYPES {
53
53
  * Server -> Client message.
54
54
  * This message type is for sending error messages from AWS AppSync RealTime to the client
55
55
  */
56
- GQL_ERROR = "error",
56
+ GQL_ERROR = "error",// Server -> Client
57
57
  /**
58
58
  * Client -> Server message.
59
59
  * This message type is for registering subscriptions with Events
@@ -4,8 +4,8 @@ import { AmplifyClassV6 } from '@aws-amplify/core';
4
4
  */
5
5
  export declare const resolveLibraryOptions: (amplify: AmplifyClassV6) => {
6
6
  headers: ((options?: {
7
- query?: string | undefined;
8
- variables?: Record<string, import("@aws-amplify/core/internals/utils").DocumentType> | undefined;
9
- } | undefined) => Promise<Record<string, unknown> | import("@aws-amplify/core/internals/aws-client-utils").Headers>) | undefined;
7
+ query?: string;
8
+ variables?: Record<string, import("@aws-amplify/core/internals/utils").DocumentType>;
9
+ }) => Promise<import("@aws-amplify/core/internals/aws-client-utils").Headers | Record<string, unknown>>) | undefined;
10
10
  withCredentials: boolean | undefined;
11
11
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/api-graphql",
3
- "version": "4.7.15",
3
+ "version": "4.7.16-local-stack.00864ae.0+00864ae",
4
4
  "description": "Api-graphql category of aws-amplify",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.mjs",
@@ -71,11 +71,6 @@
71
71
  "url": "https://github.com/aws/aws-amplify/issues"
72
72
  },
73
73
  "homepage": "https://aws-amplify.github.io/",
74
- "devDependencies": {
75
- "@rollup/plugin-typescript": "11.1.5",
76
- "rollup": "^4.9.6",
77
- "typescript": "5.0.2"
78
- },
79
74
  "files": [
80
75
  "dist/cjs",
81
76
  "dist/esm",
@@ -84,8 +79,8 @@
84
79
  "server"
85
80
  ],
86
81
  "dependencies": {
87
- "@aws-amplify/api-rest": "4.1.4",
88
- "@aws-amplify/core": "6.11.4",
82
+ "@aws-amplify/api-rest": "4.1.5-local-stack.00864ae.0+00864ae",
83
+ "@aws-amplify/core": "6.11.5-local-stack.00864ae.0+00864ae",
89
84
  "@aws-amplify/data-schema": "^1.7.0",
90
85
  "@aws-sdk/types": "3.387.0",
91
86
  "graphql": "15.8.0",
@@ -101,5 +96,5 @@
101
96
  "limit": "91.7 kB"
102
97
  }
103
98
  ],
104
- "gitHead": "f2ac9929610f7f878f124083ceaf03465113cd44"
99
+ "gitHead": "00864aec571d0509655eea0673e896d69d434972"
105
100
  }