@aws-amplify/api-graphql 4.0.17-unstable.17b685a.0 → 4.0.17-unstable.1fdbb12.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.
@@ -91,7 +91,7 @@ const types_1 = require("../types");
91
91
  * @param additionalHeaders
92
92
  */
93
93
  function graphql(options, additionalHeaders) {
94
- // inject client-level auth
94
+ // inject client-level auth
95
95
  options.authMode = options.authMode || this[types_1.__authMode];
96
96
  options.authToken = options.authToken || this[types_1.__authToken];
97
97
  /**
@@ -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;\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst GraphQLAPI_1 = require(\"../GraphQLAPI\");\nconst types_1 = require(\"../types\");\n/**\n * Invokes graphql operations against a graphql service, providing correct input and\n * output types if Amplify-generated graphql from a recent version of the CLI/codegen\n * are used *or* correct typing is provided via the type argument.\n *\n * Amplify-generated \"branded\" graphql queries will look similar to this:\n *\n * ```ts\n * //\n * // |-- branding\n * // v\n * export const getModel = `...` as GeneratedQuery<\n * \tGetModelQueryVariables,\n * \tGetModelQuery\n * >;\n * ```\n *\n * If this branding is not in your generated graphql, update to a newer version of\n * CLI/codegen and regenerate your graphql using `amplify codegen`.\n *\n * ## Using Amplify-generated graphql\n *\n * ```ts\n * import * as queries from './graphql/queries';\n *\n * //\n * // |-- correctly typed graphql response containing a Widget\n * // v\n * const queryResult = await graphql({\n * \tquery: queries.getWidget,\n * \tvariables: {\n * \t\tid: \"abc\", // <-- type hinted/enforced\n * \t},\n * });\n *\n * //\n * // |-- a correctly typed Widget\n * // v\n * const fetchedWidget = queryResult.data?.getWidget!;\n * ```\n *\n * ## Custom input + result types\n *\n * To provide input types (`variables`) and result types:\n *\n * ```ts\n * type GetById_NameOnly = {\n * \tvariables: {\n * \t\tid: string\n * \t},\n * \tresult: Promise<{\n * \t\tdata: { getWidget: { name: string } }\n * \t}>\n * }\n *\n * //\n * // |-- type is GetById_NameOnly[\"result\"]\n * // v\n * const result = graphql<GetById_NameOnly>({\n * \tquery: \"...\",\n * \tvariables: { id: \"abc\" } // <-- type of GetById_NameOnly[\"variables\"]\n * });\n * ```\n *\n * ## Custom result type only\n *\n * To specify result types only, use a type that is *not* in the `{variables, result}` shape:\n *\n * ```ts\n * type MyResultType = Promise<{\n * \tdata: {\n * \t\tgetWidget: { name: string }\n * \t}\n * }>\n *\n * //\n * // |-- type is MyResultType\n * // v\n * const result = graphql<MyResultType>({query: \"...\"});\n * ```\n *\n * @param options\n * @param additionalHeaders\n */\nfunction graphql(options, additionalHeaders) {\n // inject client-level auth \n options.authMode = options.authMode || this[types_1.__authMode];\n options.authToken = options.authToken || this[types_1.__authToken];\n /**\n * The correctness of these typings depends on correct string branding or overrides.\n * Neither of these can actually be validated at runtime. Hence, we don't perform\n * any validation or type-guarding here.\n */\n const result = GraphQLAPI_1.GraphQLAPI.graphql(this[types_1.__amplify], options, additionalHeaders);\n return result;\n}\nexports.graphql = graphql;\n/**\n * Cancels an inflight request. Only applicable for graphql queries and mutations\n * @param {any} request - request to cancel\n * @returns - A boolean indicating if the request was cancelled\n */\nfunction cancel(promise, message) {\n return GraphQLAPI_1.GraphQLAPI.cancel(promise, message);\n}\nexports.cancel = cancel;\n/**\n * Checks to see if an error thrown is from an api request cancellation\n * @param {any} error - Any error\n * @returns - A boolean indicating if the error was from an api request cancellation\n */\nfunction isCancelError(error) {\n return GraphQLAPI_1.GraphQLAPI.isCancelError(error);\n}\nexports.isCancelError = isCancelError;\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC;AAClE;AACA;AACA,MAAM,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AAC9C,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,OAAO,CAAC,OAAO,EAAE,iBAAiB,EAAE;AAC7C;AACA,IAAI,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AACpE,IAAI,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;AACvE;AACA;AACA;AACA;AACA;AACA,IAAI,MAAM,MAAM,GAAG,YAAY,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,iBAAiB,CAAC,CAAC;AACxG,IAAI,OAAO,MAAM,CAAC;AAClB,CAAC;AACD,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC;AAC1B;AACA;AACA;AACA;AACA;AACA,SAAS,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE;AAClC,IAAI,OAAO,YAAY,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAC5D,CAAC;AACD,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;AACxB;AACA;AACA;AACA;AACA;AACA,SAAS,aAAa,CAAC,KAAK,EAAE;AAC9B,IAAI,OAAO,YAAY,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AACxD,CAAC;AACD,OAAO,CAAC,aAAa,GAAG,aAAa;;"}
1
+ {"version":3,"file":"v6.js","sources":["../../../src/internals/v6.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isCancelError = exports.cancel = exports.graphql = void 0;\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst GraphQLAPI_1 = require(\"../GraphQLAPI\");\nconst types_1 = require(\"../types\");\n/**\n * Invokes graphql operations against a graphql service, providing correct input and\n * output types if Amplify-generated graphql from a recent version of the CLI/codegen\n * are used *or* correct typing is provided via the type argument.\n *\n * Amplify-generated \"branded\" graphql queries will look similar to this:\n *\n * ```ts\n * //\n * // |-- branding\n * // v\n * export const getModel = `...` as GeneratedQuery<\n * \tGetModelQueryVariables,\n * \tGetModelQuery\n * >;\n * ```\n *\n * If this branding is not in your generated graphql, update to a newer version of\n * CLI/codegen and regenerate your graphql using `amplify codegen`.\n *\n * ## Using Amplify-generated graphql\n *\n * ```ts\n * import * as queries from './graphql/queries';\n *\n * //\n * // |-- correctly typed graphql response containing a Widget\n * // v\n * const queryResult = await graphql({\n * \tquery: queries.getWidget,\n * \tvariables: {\n * \t\tid: \"abc\", // <-- type hinted/enforced\n * \t},\n * });\n *\n * //\n * // |-- a correctly typed Widget\n * // v\n * const fetchedWidget = queryResult.data?.getWidget!;\n * ```\n *\n * ## Custom input + result types\n *\n * To provide input types (`variables`) and result types:\n *\n * ```ts\n * type GetById_NameOnly = {\n * \tvariables: {\n * \t\tid: string\n * \t},\n * \tresult: Promise<{\n * \t\tdata: { getWidget: { name: string } }\n * \t}>\n * }\n *\n * //\n * // |-- type is GetById_NameOnly[\"result\"]\n * // v\n * const result = graphql<GetById_NameOnly>({\n * \tquery: \"...\",\n * \tvariables: { id: \"abc\" } // <-- type of GetById_NameOnly[\"variables\"]\n * });\n * ```\n *\n * ## Custom result type only\n *\n * To specify result types only, use a type that is *not* in the `{variables, result}` shape:\n *\n * ```ts\n * type MyResultType = Promise<{\n * \tdata: {\n * \t\tgetWidget: { name: string }\n * \t}\n * }>\n *\n * //\n * // |-- type is MyResultType\n * // v\n * const result = graphql<MyResultType>({query: \"...\"});\n * ```\n *\n * @param options\n * @param additionalHeaders\n */\nfunction graphql(options, additionalHeaders) {\n // inject client-level auth\n options.authMode = options.authMode || this[types_1.__authMode];\n options.authToken = options.authToken || this[types_1.__authToken];\n /**\n * The correctness of these typings depends on correct string branding or overrides.\n * Neither of these can actually be validated at runtime. Hence, we don't perform\n * any validation or type-guarding here.\n */\n const result = GraphQLAPI_1.GraphQLAPI.graphql(this[types_1.__amplify], options, additionalHeaders);\n return result;\n}\nexports.graphql = graphql;\n/**\n * Cancels an inflight request. Only applicable for graphql queries and mutations\n * @param {any} request - request to cancel\n * @returns - A boolean indicating if the request was cancelled\n */\nfunction cancel(promise, message) {\n return GraphQLAPI_1.GraphQLAPI.cancel(promise, message);\n}\nexports.cancel = cancel;\n/**\n * Checks to see if an error thrown is from an api request cancellation\n * @param {any} error - Any error\n * @returns - A boolean indicating if the error was from an api request cancellation\n */\nfunction isCancelError(error) {\n return GraphQLAPI_1.GraphQLAPI.isCancelError(error);\n}\nexports.isCancelError = isCancelError;\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC;AAClE;AACA;AACA,MAAM,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AAC9C,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,OAAO,CAAC,OAAO,EAAE,iBAAiB,EAAE;AAC7C;AACA,IAAI,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AACpE,IAAI,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;AACvE;AACA;AACA;AACA;AACA;AACA,IAAI,MAAM,MAAM,GAAG,YAAY,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,iBAAiB,CAAC,CAAC;AACxG,IAAI,OAAO,MAAM,CAAC;AAClB,CAAC;AACD,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC;AAC1B;AACA;AACA;AACA;AACA;AACA,SAAS,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE;AAClC,IAAI,OAAO,YAAY,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAC5D,CAAC;AACD,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;AACxB;AACA;AACA;AACA;AACA;AACA,SAAS,aAAa,CAAC,KAAK,EAAE;AAC9B,IAAI,OAAO,YAAY,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AACxD,CAAC;AACD,OAAO,CAAC,aAAa,GAAG,aAAa;;"}
@@ -88,7 +88,7 @@ import { __authMode, __authToken, __amplify } from '../types/index.mjs';
88
88
  * @param additionalHeaders
89
89
  */
90
90
  function graphql(options, additionalHeaders) {
91
- // inject client-level auth
91
+ // inject client-level auth
92
92
  options.authMode = options.authMode || this[__authMode];
93
93
  options.authToken = options.authToken || this[__authToken];
94
94
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"v6.mjs","sources":["../../../src/internals/v6.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { GraphQLAPI } from '../GraphQLAPI';\nimport { __amplify, __authMode, __authToken, } from '../types';\n/**\n * Invokes graphql operations against a graphql service, providing correct input and\n * output types if Amplify-generated graphql from a recent version of the CLI/codegen\n * are used *or* correct typing is provided via the type argument.\n *\n * Amplify-generated \"branded\" graphql queries will look similar to this:\n *\n * ```ts\n * //\n * // |-- branding\n * // v\n * export const getModel = `...` as GeneratedQuery<\n * \tGetModelQueryVariables,\n * \tGetModelQuery\n * >;\n * ```\n *\n * If this branding is not in your generated graphql, update to a newer version of\n * CLI/codegen and regenerate your graphql using `amplify codegen`.\n *\n * ## Using Amplify-generated graphql\n *\n * ```ts\n * import * as queries from './graphql/queries';\n *\n * //\n * // |-- correctly typed graphql response containing a Widget\n * // v\n * const queryResult = await graphql({\n * \tquery: queries.getWidget,\n * \tvariables: {\n * \t\tid: \"abc\", // <-- type hinted/enforced\n * \t},\n * });\n *\n * //\n * // |-- a correctly typed Widget\n * // v\n * const fetchedWidget = queryResult.data?.getWidget!;\n * ```\n *\n * ## Custom input + result types\n *\n * To provide input types (`variables`) and result types:\n *\n * ```ts\n * type GetById_NameOnly = {\n * \tvariables: {\n * \t\tid: string\n * \t},\n * \tresult: Promise<{\n * \t\tdata: { getWidget: { name: string } }\n * \t}>\n * }\n *\n * //\n * // |-- type is GetById_NameOnly[\"result\"]\n * // v\n * const result = graphql<GetById_NameOnly>({\n * \tquery: \"...\",\n * \tvariables: { id: \"abc\" } // <-- type of GetById_NameOnly[\"variables\"]\n * });\n * ```\n *\n * ## Custom result type only\n *\n * To specify result types only, use a type that is *not* in the `{variables, result}` shape:\n *\n * ```ts\n * type MyResultType = Promise<{\n * \tdata: {\n * \t\tgetWidget: { name: string }\n * \t}\n * }>\n *\n * //\n * // |-- type is MyResultType\n * // v\n * const result = graphql<MyResultType>({query: \"...\"});\n * ```\n *\n * @param options\n * @param additionalHeaders\n */\nexport function graphql(options, additionalHeaders) {\n // inject client-level auth \n options.authMode = options.authMode || this[__authMode];\n options.authToken = options.authToken || this[__authToken];\n /**\n * The correctness of these typings depends on correct string branding or overrides.\n * Neither of these can actually be validated at runtime. Hence, we don't perform\n * any validation or type-guarding here.\n */\n const result = GraphQLAPI.graphql(this[__amplify], options, additionalHeaders);\n return result;\n}\n/**\n * Cancels an inflight request. Only applicable for graphql queries and mutations\n * @param {any} request - request to cancel\n * @returns - A boolean indicating if the request was cancelled\n */\nexport function cancel(promise, message) {\n return GraphQLAPI.cancel(promise, message);\n}\n/**\n * Checks to see if an error thrown is from an api request cancellation\n * @param {any} error - Any error\n * @returns - A boolean indicating if the error was from an api request cancellation\n */\nexport function isCancelError(error) {\n return GraphQLAPI.isCancelError(error);\n}\n"],"names":[],"mappings":";;;AAAA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,OAAO,CAAC,OAAO,EAAE,iBAAiB,EAAE;AACpD;AACA,IAAI,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC;AAC5D,IAAI,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,IAAI,CAAC,WAAW,CAAC,CAAC;AAC/D;AACA;AACA;AACA;AACA;AACA,IAAI,MAAM,MAAM,GAAG,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,iBAAiB,CAAC,CAAC;AACnF,IAAI,OAAO,MAAM,CAAC;AAClB,CAAC;AACD;AACA;AACA;AACA;AACA;AACO,SAAS,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE;AACzC,IAAI,OAAO,UAAU,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAC/C,CAAC;AACD;AACA;AACA;AACA;AACA;AACO,SAAS,aAAa,CAAC,KAAK,EAAE;AACrC,IAAI,OAAO,UAAU,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AAC3C;;;;"}
1
+ {"version":3,"file":"v6.mjs","sources":["../../../src/internals/v6.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { GraphQLAPI } from '../GraphQLAPI';\nimport { __amplify, __authMode, __authToken, } from '../types';\n/**\n * Invokes graphql operations against a graphql service, providing correct input and\n * output types if Amplify-generated graphql from a recent version of the CLI/codegen\n * are used *or* correct typing is provided via the type argument.\n *\n * Amplify-generated \"branded\" graphql queries will look similar to this:\n *\n * ```ts\n * //\n * // |-- branding\n * // v\n * export const getModel = `...` as GeneratedQuery<\n * \tGetModelQueryVariables,\n * \tGetModelQuery\n * >;\n * ```\n *\n * If this branding is not in your generated graphql, update to a newer version of\n * CLI/codegen and regenerate your graphql using `amplify codegen`.\n *\n * ## Using Amplify-generated graphql\n *\n * ```ts\n * import * as queries from './graphql/queries';\n *\n * //\n * // |-- correctly typed graphql response containing a Widget\n * // v\n * const queryResult = await graphql({\n * \tquery: queries.getWidget,\n * \tvariables: {\n * \t\tid: \"abc\", // <-- type hinted/enforced\n * \t},\n * });\n *\n * //\n * // |-- a correctly typed Widget\n * // v\n * const fetchedWidget = queryResult.data?.getWidget!;\n * ```\n *\n * ## Custom input + result types\n *\n * To provide input types (`variables`) and result types:\n *\n * ```ts\n * type GetById_NameOnly = {\n * \tvariables: {\n * \t\tid: string\n * \t},\n * \tresult: Promise<{\n * \t\tdata: { getWidget: { name: string } }\n * \t}>\n * }\n *\n * //\n * // |-- type is GetById_NameOnly[\"result\"]\n * // v\n * const result = graphql<GetById_NameOnly>({\n * \tquery: \"...\",\n * \tvariables: { id: \"abc\" } // <-- type of GetById_NameOnly[\"variables\"]\n * });\n * ```\n *\n * ## Custom result type only\n *\n * To specify result types only, use a type that is *not* in the `{variables, result}` shape:\n *\n * ```ts\n * type MyResultType = Promise<{\n * \tdata: {\n * \t\tgetWidget: { name: string }\n * \t}\n * }>\n *\n * //\n * // |-- type is MyResultType\n * // v\n * const result = graphql<MyResultType>({query: \"...\"});\n * ```\n *\n * @param options\n * @param additionalHeaders\n */\nexport function graphql(options, additionalHeaders) {\n // inject client-level auth\n options.authMode = options.authMode || this[__authMode];\n options.authToken = options.authToken || this[__authToken];\n /**\n * The correctness of these typings depends on correct string branding or overrides.\n * Neither of these can actually be validated at runtime. Hence, we don't perform\n * any validation or type-guarding here.\n */\n const result = GraphQLAPI.graphql(this[__amplify], options, additionalHeaders);\n return result;\n}\n/**\n * Cancels an inflight request. Only applicable for graphql queries and mutations\n * @param {any} request - request to cancel\n * @returns - A boolean indicating if the request was cancelled\n */\nexport function cancel(promise, message) {\n return GraphQLAPI.cancel(promise, message);\n}\n/**\n * Checks to see if an error thrown is from an api request cancellation\n * @param {any} error - Any error\n * @returns - A boolean indicating if the error was from an api request cancellation\n */\nexport function isCancelError(error) {\n return GraphQLAPI.isCancelError(error);\n}\n"],"names":[],"mappings":";;;AAAA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,OAAO,CAAC,OAAO,EAAE,iBAAiB,EAAE;AACpD;AACA,IAAI,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC;AAC5D,IAAI,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,IAAI,CAAC,WAAW,CAAC,CAAC;AAC/D;AACA;AACA;AACA;AACA;AACA,IAAI,MAAM,MAAM,GAAG,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,iBAAiB,CAAC,CAAC;AACnF,IAAI,OAAO,MAAM,CAAC;AAClB,CAAC;AACD;AACA;AACA;AACA;AACA;AACO,SAAS,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE;AACzC,IAAI,OAAO,UAAU,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAC/C,CAAC;AACD;AACA;AACA;AACA;AACA;AACO,SAAS,aAAa,CAAC,KAAK,EAAE;AACrC,IAAI,OAAO,UAAU,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AAC3C;;;;"}
@@ -4,8 +4,11 @@ import { AmplifyClassV6 } from '@aws-amplify/core';
4
4
  */
5
5
  export declare const resolveLibraryOptions: (amplify: AmplifyClassV6) => {
6
6
  headers: ((options?: {
7
+ /**
8
+ * @internal
9
+ */
7
10
  query?: string | undefined;
8
11
  variables?: Record<string, import("@aws-amplify/core/internals/utils").DocumentType> | undefined;
9
- } | undefined) => Promise<{} | import("@aws-amplify/core/internals/aws-client-utils").Headers>) | undefined;
12
+ } | undefined) => Promise<Record<string, unknown> | import("@aws-amplify/core/internals/aws-client-utils").Headers>) | undefined;
10
13
  withCredentials: boolean | undefined;
11
14
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/api-graphql",
3
- "version": "4.0.17-unstable.17b685a.0+17b685a",
3
+ "version": "4.0.17-unstable.1fdbb12.0+1fdbb12",
4
4
  "description": "Api-graphql category of aws-amplify",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.mjs",
@@ -84,8 +84,8 @@
84
84
  "server"
85
85
  ],
86
86
  "dependencies": {
87
- "@aws-amplify/api-rest": "4.0.17-unstable.17b685a.0+17b685a",
88
- "@aws-amplify/core": "6.0.17-unstable.17b685a.0+17b685a",
87
+ "@aws-amplify/api-rest": "4.0.17-unstable.1fdbb12.0+1fdbb12",
88
+ "@aws-amplify/core": "6.0.17-unstable.1fdbb12.0+1fdbb12",
89
89
  "@aws-amplify/data-schema-types": "^0.7.2",
90
90
  "@aws-sdk/types": "3.387.0",
91
91
  "graphql": "15.8.0",
@@ -101,5 +101,5 @@
101
101
  "limit": "91.7 kB"
102
102
  }
103
103
  ],
104
- "gitHead": "17b685a28c4364d8b0b3bc870d7be125f972385f"
104
+ "gitHead": "1fdbb12f85d1a363258c4ebeb5aa7c98ee619e16"
105
105
  }
package/src/GraphQLAPI.ts CHANGED
@@ -10,7 +10,7 @@ import { Observable } from 'rxjs';
10
10
  export const graphqlOperation = (
11
11
  query: any,
12
12
  variables = {},
13
- authToken?: string
13
+ authToken?: string,
14
14
  ) => ({
15
15
  query,
16
16
  variables,
@@ -35,7 +35,7 @@ export class GraphQLAPIClass extends InternalGraphQLAPIClass {
35
35
  graphql<T = any>(
36
36
  amplify: AmplifyClassV6 | (() => Promise<AmplifyClassV6>),
37
37
  options: GraphQLOptions,
38
- additionalHeaders?: CustomHeaders
38
+ additionalHeaders?: CustomHeaders,
39
39
  ): Observable<GraphQLResult<T>> | Promise<GraphQLResult<T>> {
40
40
  return super.graphql(amplify, options, additionalHeaders, {
41
41
  category: Category.API,
@@ -158,7 +158,7 @@ export class AWSAppSyncRealTimeProvider {
158
158
  ) {
159
159
  this.reconnectionMonitor.record(ReconnectEvent.HALT_RECONNECT);
160
160
  }
161
- }
161
+ },
162
162
  );
163
163
  }
164
164
 
@@ -191,7 +191,7 @@ export class AWSAppSyncRealTimeProvider {
191
191
 
192
192
  subscribe(
193
193
  options?: AWSAppSyncRealTimeProviderOptions,
194
- customUserAgentDetails?: CustomUserAgentDetails
194
+ customUserAgentDetails?: CustomUserAgentDetails,
195
195
  ): Observable<Record<string, unknown>> {
196
196
  const {
197
197
  appSyncGraphqlEndpoint,
@@ -211,7 +211,7 @@ export class AWSAppSyncRealTimeProvider {
211
211
  errors: [
212
212
  {
213
213
  ...new GraphQLError(
214
- `Subscribe only available for AWS AppSync endpoint`
214
+ `Subscribe only available for AWS AppSync endpoint`,
215
215
  ),
216
216
  },
217
217
  ],
@@ -242,7 +242,7 @@ export class AWSAppSyncRealTimeProvider {
242
242
  customUserAgentDetails,
243
243
  }).catch<any>(err => {
244
244
  logger.debug(
245
- `${CONTROL_MSG.REALTIME_SUBSCRIPTION_INIT_ERROR}: ${err}`
245
+ `${CONTROL_MSG.REALTIME_SUBSCRIPTION_INIT_ERROR}: ${err}`,
246
246
  );
247
247
 
248
248
  this.connectionStateMonitor.record(CONNECTION_CHANGE.CLOSED);
@@ -428,13 +428,13 @@ export class AWSAppSyncRealTimeProvider {
428
428
  private _logStartSubscriptionError(
429
429
  subscriptionId: string,
430
430
  observer: PubSubContentObserver,
431
- err: { message?: string }
431
+ err: { message?: string },
432
432
  ) {
433
433
  logger.debug({ err });
434
434
  const message = String(err.message ?? '');
435
435
  // Resolving to give the state observer time to propogate the update
436
436
  Promise.resolve(
437
- this.connectionStateMonitor.record(CONNECTION_CHANGE.CLOSED)
437
+ this.connectionStateMonitor.record(CONNECTION_CHANGE.CLOSED),
438
438
  );
439
439
 
440
440
  // Capture the error only when the network didn't cause disruption
@@ -447,7 +447,7 @@ export class AWSAppSyncRealTimeProvider {
447
447
  errors: [
448
448
  {
449
449
  ...new GraphQLError(
450
- `${CONTROL_MSG.CONNECTION_FAILED}: ${message}`
450
+ `${CONTROL_MSG.CONNECTION_FAILED}: ${message}`,
451
451
  ),
452
452
  },
453
453
  ],
@@ -558,7 +558,7 @@ export class AWSAppSyncRealTimeProvider {
558
558
  return;
559
559
  }
560
560
  logger.debug(
561
- `subscription message from AWS AppSync RealTime: ${message.data}`
561
+ `subscription message from AWS AppSync RealTime: ${message.data}`,
562
562
  );
563
563
  const {
564
564
  id = '',
@@ -587,7 +587,7 @@ export class AWSAppSyncRealTimeProvider {
587
587
 
588
588
  if (type === MESSAGE_TYPES.GQL_START_ACK) {
589
589
  logger.debug(
590
- `subscription ready for ${JSON.stringify({ query, variables })}`
590
+ `subscription ready for ${JSON.stringify({ query, variables })}`,
591
591
  );
592
592
  if (typeof subscriptionReadyCallback === 'function') {
593
593
  subscriptionReadyCallback();
@@ -611,7 +611,7 @@ export class AWSAppSyncRealTimeProvider {
611
611
  });
612
612
  }
613
613
  this.connectionStateMonitor.record(
614
- CONNECTION_CHANGE.CONNECTION_ESTABLISHED
614
+ CONNECTION_CHANGE.CONNECTION_ESTABLISHED,
615
615
  );
616
616
 
617
617
  return;
@@ -623,7 +623,7 @@ export class AWSAppSyncRealTimeProvider {
623
623
  clearTimeout(this.keepAliveAlertTimeoutId);
624
624
  this.keepAliveTimeoutId = setTimeout(
625
625
  () => this._errorDisconnect(CONTROL_MSG.TIMEOUT_DISCONNECT),
626
- this.keepAliveTimeout
626
+ this.keepAliveTimeout,
627
627
  );
628
628
  this.keepAliveAlertTimeoutId = setTimeout(() => {
629
629
  this.connectionStateMonitor.record(CONNECTION_CHANGE.KEEP_ALIVE_MISSED);
@@ -646,14 +646,14 @@ export class AWSAppSyncRealTimeProvider {
646
646
  });
647
647
 
648
648
  logger.debug(
649
- `${CONTROL_MSG.CONNECTION_FAILED}: ${JSON.stringify(payload)}`
649
+ `${CONTROL_MSG.CONNECTION_FAILED}: ${JSON.stringify(payload)}`,
650
650
  );
651
651
 
652
652
  observer.error({
653
653
  errors: [
654
654
  {
655
655
  ...new GraphQLError(
656
- `${CONTROL_MSG.CONNECTION_FAILED}: ${JSON.stringify(payload)}`
656
+ `${CONTROL_MSG.CONNECTION_FAILED}: ${JSON.stringify(payload)}`,
657
657
  ),
658
658
  },
659
659
  ],
@@ -697,7 +697,7 @@ export class AWSAppSyncRealTimeProvider {
697
697
  this.connectionStateMonitor.record(CONNECTION_CHANGE.CLOSED);
698
698
  logger.debug(
699
699
  'timeoutStartSubscription',
700
- JSON.stringify({ query, variables })
700
+ JSON.stringify({ query, variables }),
701
701
  );
702
702
  }
703
703
  }
@@ -785,7 +785,7 @@ export class AWSAppSyncRealTimeProvider {
785
785
  await jitteredExponentialRetry(
786
786
  this._initializeHandshake.bind(this),
787
787
  [awsRealTimeUrl],
788
- MAX_DELAY_MS
788
+ MAX_DELAY_MS,
789
789
  );
790
790
  }
791
791
 
@@ -827,7 +827,7 @@ export class AWSAppSyncRealTimeProvider {
827
827
  return;
828
828
  }
829
829
  logger.debug(
830
- `subscription message from AWS AppSyncRealTime: ${message.data} `
830
+ `subscription message from AWS AppSyncRealTime: ${message.data} `,
831
831
  );
832
832
  const data = JSON.parse(message.data) as ParsedMessagePayload;
833
833
  const {
@@ -874,12 +874,12 @@ export class AWSAppSyncRealTimeProvider {
874
874
  const checkAckOk = (ackOk: boolean) => {
875
875
  if (!ackOk) {
876
876
  this.connectionStateMonitor.record(
877
- CONNECTION_CHANGE.CONNECTION_FAILED
877
+ CONNECTION_CHANGE.CONNECTION_FAILED,
878
878
  );
879
879
  rej(
880
880
  new Error(
881
- `Connection timeout: ack from AWSAppSyncRealTime was not received after ${CONNECTION_INIT_TIMEOUT} ms`
882
- )
881
+ `Connection timeout: ack from AWSAppSyncRealTime was not received after ${CONNECTION_INIT_TIMEOUT} ms`,
882
+ ),
883
883
  );
884
884
  }
885
885
  };
@@ -1010,7 +1010,7 @@ export class AWSAppSyncRealTimeProvider {
1010
1010
  credentials: creds!,
1011
1011
  signingRegion: endpointInfo.region!,
1012
1012
  signingService: endpointInfo.service,
1013
- }
1013
+ },
1014
1014
  );
1015
1015
  return signed_params.headers;
1016
1016
  }
@@ -611,10 +611,10 @@ export function generateGraphQLDocument(
611
611
  return acc;
612
612
  },
613
613
  {},
614
- )
614
+ )
615
615
  : {
616
616
  [primaryKeyFieldName]: `${fields[primaryKeyFieldName].type}!`,
617
- });
617
+ });
618
618
  graphQLSelectionSet ?? (graphQLSelectionSet = selectionSetFields);
619
619
  case 'LIST':
620
620
  graphQLArguments ??
@@ -658,13 +658,13 @@ export function generateGraphQLDocument(
658
658
  graphQLArguments
659
659
  ? `(${Object.entries(graphQLArguments).map(
660
660
  ([fieldName, type]) => `\$${fieldName}: ${type}`,
661
- )})`
661
+ )})`
662
662
  : ''
663
663
  } { ${graphQLFieldName}${
664
664
  graphQLArguments
665
665
  ? `(${Object.keys(graphQLArguments).map(
666
666
  fieldName => `${fieldName}: \$${fieldName}`,
667
- )})`
667
+ )})`
668
668
  : ''
669
669
  } { ${graphQLSelectionSet} } }`;
670
670
 
@@ -714,7 +714,7 @@ export function buildGraphQLVariables(
714
714
 
715
715
  return !isReadOnly;
716
716
  }),
717
- )
717
+ )
718
718
  : {},
719
719
  };
720
720
  break;
@@ -730,7 +730,7 @@ export function buildGraphQLVariables(
730
730
  return acc;
731
731
  },
732
732
  {},
733
- )
733
+ )
734
734
  : { [primaryKeyFieldName]: arg[primaryKeyFieldName] };
735
735
  }
736
736
 
@@ -306,7 +306,7 @@ export class InternalGraphQLAPIClass {
306
306
  amplify,
307
307
  authMode!,
308
308
  additionalCustomHeaders,
309
- )
309
+ )
310
310
  : {})) ||
311
311
  {}),
312
312
  // Custom headers included in Amplify configuration options:
@@ -30,12 +30,12 @@ export function getFactory(
30
30
  modelIntrospection: ModelIntrospectionSchema,
31
31
  model: SchemaModel,
32
32
  operation: ModelOperation,
33
- useContext = false
33
+ useContext = false,
34
34
  ) {
35
35
  const getWithContext = async (
36
36
  contextSpec: AmplifyServer.ContextSpec & GraphQLOptionsV6<unknown, string>,
37
37
  arg?: any,
38
- options?: any
38
+ options?: any,
39
39
  ) => {
40
40
  return _get(
41
41
  client,
@@ -44,7 +44,7 @@ export function getFactory(
44
44
  arg,
45
45
  options,
46
46
  operation,
47
- contextSpec
47
+ contextSpec,
48
48
  );
49
49
  };
50
50
 
@@ -62,7 +62,7 @@ async function _get(
62
62
  arg: QueryArgs,
63
63
  options: AuthModeParams & ListArgs,
64
64
  operation: ModelOperation,
65
- context?: AmplifyServer.ContextSpec
65
+ context?: AmplifyServer.ContextSpec,
66
66
  ) {
67
67
  const { name } = model;
68
68
 
@@ -70,13 +70,13 @@ async function _get(
70
70
  modelIntrospection.models,
71
71
  name,
72
72
  operation,
73
- options
73
+ options,
74
74
  );
75
75
  const variables = buildGraphQLVariables(
76
76
  model,
77
77
  operation,
78
78
  arg,
79
- modelIntrospection
79
+ modelIntrospection,
80
80
  );
81
81
 
82
82
  try {
@@ -92,16 +92,16 @@ async function _get(
92
92
  query,
93
93
  variables,
94
94
  },
95
- headers
96
- )) as GraphQLResult<any>)
95
+ headers,
96
+ )) as GraphQLResult<any>)
97
97
  : ((await (client as V6Client<Record<string, any>>).graphql(
98
98
  {
99
99
  ...auth,
100
100
  query,
101
101
  variables,
102
102
  },
103
- headers
104
- )) as GraphQLResult<any>);
103
+ headers,
104
+ )) as GraphQLResult<any>);
105
105
 
106
106
  // flatten response
107
107
  if (data) {
@@ -119,7 +119,7 @@ async function _get(
119
119
  modelIntrospection,
120
120
  auth.authMode,
121
121
  auth.authToken,
122
- !!context
122
+ !!context,
123
123
  );
124
124
 
125
125
  return { data: initialized, extensions };
@@ -26,11 +26,11 @@ export function listFactory(
26
26
  client: ClientWithModels,
27
27
  modelIntrospection: ModelIntrospectionSchema,
28
28
  model: SchemaModel,
29
- context = false
29
+ context = false,
30
30
  ) {
31
31
  const listWithContext = async (
32
32
  contextSpec: AmplifyServer.ContextSpec,
33
- args?: ListArgs
33
+ args?: ListArgs,
34
34
  ) => {
35
35
  return _list(client, modelIntrospection, model, args, contextSpec);
36
36
  };
@@ -47,7 +47,7 @@ async function _list(
47
47
  modelIntrospection: ModelIntrospectionSchema,
48
48
  model: SchemaModel,
49
49
  args?: ListArgs & AuthModeParams,
50
- contextSpec?: AmplifyServer.ContextSpec
50
+ contextSpec?: AmplifyServer.ContextSpec,
51
51
  ) {
52
52
  const { name } = model;
53
53
 
@@ -55,13 +55,13 @@ async function _list(
55
55
  modelIntrospection.models,
56
56
  name,
57
57
  'LIST',
58
- args
58
+ args,
59
59
  );
60
60
  const variables = buildGraphQLVariables(
61
61
  model,
62
62
  'LIST',
63
63
  args,
64
- modelIntrospection
64
+ modelIntrospection,
65
65
  );
66
66
 
67
67
  try {
@@ -77,16 +77,16 @@ async function _list(
77
77
  query,
78
78
  variables,
79
79
  },
80
- headers
81
- )) as GraphQLResult<any>)
80
+ headers,
81
+ )) as GraphQLResult<any>)
82
82
  : ((await (client as V6Client<Record<string, any>>).graphql(
83
83
  {
84
84
  ...auth,
85
85
  query,
86
86
  variables,
87
87
  },
88
- headers
89
- )) as GraphQLResult<any>);
88
+ headers,
89
+ )) as GraphQLResult<any>);
90
90
 
91
91
  // flatten response
92
92
  if (data !== undefined) {
@@ -110,7 +110,7 @@ async function _list(
110
110
  modelIntrospection,
111
111
  auth.authMode,
112
112
  auth.authToken,
113
- !!contextSpec
113
+ !!contextSpec,
114
114
  );
115
115
 
116
116
  return {
@@ -20,7 +20,7 @@ export function subscriptionFactory(
20
20
  client: any,
21
21
  modelIntrospection: ModelIntrospectionSchema,
22
22
  model: SchemaModel,
23
- operation: ModelOperation
23
+ operation: ModelOperation,
24
24
  ) {
25
25
  const { name } = model as any;
26
26
 
@@ -28,13 +28,13 @@ export function subscriptionFactory(
28
28
  const query = generateGraphQLDocument(
29
29
  modelIntrospection.models,
30
30
  name,
31
- operation
31
+ operation,
32
32
  );
33
33
  const variables = buildGraphQLVariables(
34
34
  model,
35
35
  operation,
36
36
  args,
37
- modelIntrospection
37
+ modelIntrospection,
38
38
  );
39
39
 
40
40
  const auth = authModeParams(client, args);
@@ -47,7 +47,7 @@ export function subscriptionFactory(
47
47
  query,
48
48
  variables,
49
49
  },
50
- headers
50
+ headers,
51
51
  ) as GraphqlSubscriptionResult<object>;
52
52
 
53
53
  return observable.pipe(
@@ -60,10 +60,10 @@ export function subscriptionFactory(
60
60
  [data],
61
61
  modelIntrospection,
62
62
  auth.authMode,
63
- auth.authToken
63
+ auth.authToken,
64
64
  );
65
65
  return initialized;
66
- })
66
+ }),
67
67
  );
68
68
  };
69
69
 
@@ -30,7 +30,7 @@ export function generateClientWithAmplifyInstance<
30
30
  | V6ClientSSRRequest<T>
31
31
  | V6ClientSSRCookies<T> = V6ClientSSRCookies<T>,
32
32
  >(
33
- params: ServerClientGenerationParams & CommonPublicClientOptions
33
+ params: ServerClientGenerationParams & CommonPublicClientOptions,
34
34
  ): ClientType {
35
35
  const client = {
36
36
  [__amplify]: params.amplify,
@@ -101,12 +101,12 @@ export function graphql<
101
101
  >(
102
102
  this: V6Client,
103
103
  options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING>,
104
- additionalHeaders?: CustomHeaders
104
+ additionalHeaders?: CustomHeaders,
105
105
  ): GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING> {
106
- // inject client-level auth
106
+ // inject client-level auth
107
107
  options.authMode = options.authMode || this[__authMode];
108
108
  options.authToken = options.authToken || this[__authToken];
109
-
109
+
110
110
  /**
111
111
  * The correctness of these typings depends on correct string branding or overrides.
112
112
  * Neither of these can actually be validated at runtime. Hence, we don't perform
@@ -115,7 +115,7 @@ export function graphql<
115
115
  const result = GraphQLAPI.graphql(
116
116
  this[__amplify],
117
117
  options,
118
- additionalHeaders
118
+ additionalHeaders,
119
119
  );
120
120
  return result as any;
121
121
  }
@@ -128,7 +128,7 @@ export function graphql<
128
128
  export function cancel(
129
129
  this: V6Client,
130
130
  promise: Promise<any>,
131
- message?: string
131
+ message?: string,
132
132
  ): boolean {
133
133
  return GraphQLAPI.cancel(promise, message);
134
134
  }
@@ -52,13 +52,13 @@ export function generateClient<T extends Record<any, any> = never>({
52
52
  const wrappedGraphql = (
53
53
  contextSpec: AmplifyServer.ContextSpec,
54
54
  options: GraphQLOptionsV6,
55
- additionalHeaders?: CustomHeaders
55
+ additionalHeaders?: CustomHeaders,
56
56
  ) => {
57
57
  const amplifyInstance = getAmplifyServerContext(contextSpec).amplify;
58
58
  return prevGraphql.call(
59
59
  { [__amplify]: amplifyInstance },
60
60
  options,
61
- additionalHeaders as any
61
+ additionalHeaders as any,
62
62
  );
63
63
  };
64
64
 
@@ -1,7 +1,11 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import { AmplifyClassV6, ResourcesConfig } from '@aws-amplify/core';
4
- import { ModelTypes, CustomHeaders, EnumTypes } from '@aws-amplify/data-schema-types';
4
+ import {
5
+ ModelTypes,
6
+ CustomHeaders,
7
+ EnumTypes,
8
+ } from '@aws-amplify/data-schema-types';
5
9
  import { Source, DocumentNode, GraphQLError } from 'graphql';
6
10
  export { OperationTypeNode } from 'graphql';
7
11
  import { Observable } from 'rxjs';
@@ -72,7 +76,7 @@ export type GraphQLSubscription<T> = T & {
72
76
  export type GraphQLReturnType<T> = T extends {}
73
77
  ? {
74
78
  [K in keyof T]?: GraphQLReturnType<T[K]>;
75
- }
79
+ }
76
80
  : T;
77
81
 
78
82
  /**
@@ -93,13 +97,14 @@ type PagedList<T, TYPENAME> = {
93
97
  * array, this will only be the case when we also have errors,
94
98
  * which will then be *thrown*.
95
99
  */
96
- type WithListsFixed<T> = T extends PagedList<infer IT, infer NAME>
97
- ? PagedList<Exclude<IT, null | undefined>, NAME>
98
- : T extends {}
99
- ? {
100
- [K in keyof T]: WithListsFixed<T[K]>;
101
- }
102
- : T;
100
+ type WithListsFixed<T> =
101
+ T extends PagedList<infer IT, infer NAME>
102
+ ? PagedList<Exclude<IT, null | undefined>, NAME>
103
+ : T extends {}
104
+ ? {
105
+ [K in keyof T]: WithListsFixed<T[K]>;
106
+ }
107
+ : T;
103
108
 
104
109
  /**
105
110
  * Returns an updated response type to always return a value.
@@ -115,14 +120,12 @@ type NeverEmpty<T> = {
115
120
  * If empty members are present, there will also be errors present,
116
121
  * and the response will instead be *thrown*.
117
122
  */
118
- type FixedQueryResult<T> = Exclude<
119
- T[keyof T],
120
- null | undefined
121
- > extends PagedList<any, any>
122
- ? {
123
- [K in keyof T]-?: WithListsFixed<Exclude<T[K], null | undefined>>;
124
- }
125
- : T;
123
+ type FixedQueryResult<T> =
124
+ Exclude<T[keyof T], null | undefined> extends PagedList<any, any>
125
+ ? {
126
+ [K in keyof T]-?: WithListsFixed<Exclude<T[K], null | undefined>>;
127
+ }
128
+ : T;
126
129
 
127
130
  /**
128
131
  * The return value from a `graphql({query})` call when `query` is a subscription.
@@ -181,7 +184,7 @@ export interface AWSAppSyncRealTimeProviderOptions {
181
184
 
182
185
  export type AWSAppSyncRealTimeProvider = {
183
186
  subscribe(
184
- options?: AWSAppSyncRealTimeProviderOptions
187
+ options?: AWSAppSyncRealTimeProviderOptions,
185
188
  ): Observable<Record<string, unknown>>;
186
189
  };
187
190
 
@@ -235,15 +238,16 @@ export type UnknownGraphQLResponse =
235
238
  export type GraphQLVariablesV6<
236
239
  FALLBACK_TYPES = unknown,
237
240
  TYPED_GQL_STRING extends string = string,
238
- > = TYPED_GQL_STRING extends GeneratedQuery<infer IN, any>
239
- ? IN
240
- : TYPED_GQL_STRING extends GeneratedMutation<infer IN, any>
241
- ? IN
242
- : TYPED_GQL_STRING extends GeneratedSubscription<infer IN, any>
243
- ? IN
244
- : FALLBACK_TYPES extends GraphQLOperationType<infer IN, any>
245
- ? IN
246
- : any;
241
+ > =
242
+ TYPED_GQL_STRING extends GeneratedQuery<infer IN, any>
243
+ ? IN
244
+ : TYPED_GQL_STRING extends GeneratedMutation<infer IN, any>
245
+ ? IN
246
+ : TYPED_GQL_STRING extends GeneratedSubscription<infer IN, any>
247
+ ? IN
248
+ : FALLBACK_TYPES extends GraphQLOperationType<infer IN, any>
249
+ ? IN
250
+ : any;
247
251
 
248
252
  /**
249
253
  * The expected return type with respect to the given `FALLBACK_TYPE`
@@ -252,22 +256,23 @@ export type GraphQLVariablesV6<
252
256
  export type GraphQLResponseV6<
253
257
  FALLBACK_TYPE = unknown,
254
258
  TYPED_GQL_STRING extends string = string,
255
- > = TYPED_GQL_STRING extends GeneratedQuery<infer IN, infer QUERY_OUT>
256
- ? Promise<GraphQLResult<FixedQueryResult<QUERY_OUT>>>
257
- : TYPED_GQL_STRING extends GeneratedMutation<infer IN, infer MUTATION_OUT>
258
- ? Promise<GraphQLResult<NeverEmpty<MUTATION_OUT>>>
259
- : TYPED_GQL_STRING extends GeneratedSubscription<infer IN, infer SUB_OUT>
260
- ? GraphqlSubscriptionResult<NeverEmpty<SUB_OUT>>
261
- : FALLBACK_TYPE extends GraphQLQuery<infer T>
262
- ? Promise<GraphQLResult<FALLBACK_TYPE>>
263
- : FALLBACK_TYPE extends GraphQLSubscription<infer T>
264
- ? GraphqlSubscriptionResult<FALLBACK_TYPE>
265
- : FALLBACK_TYPE extends GraphQLOperationType<
266
- infer IN,
267
- infer CUSTOM_OUT
268
- >
269
- ? CUSTOM_OUT
270
- : UnknownGraphQLResponse;
259
+ > =
260
+ TYPED_GQL_STRING extends GeneratedQuery<infer IN, infer QUERY_OUT>
261
+ ? Promise<GraphQLResult<FixedQueryResult<QUERY_OUT>>>
262
+ : TYPED_GQL_STRING extends GeneratedMutation<infer IN, infer MUTATION_OUT>
263
+ ? Promise<GraphQLResult<NeverEmpty<MUTATION_OUT>>>
264
+ : TYPED_GQL_STRING extends GeneratedSubscription<infer IN, infer SUB_OUT>
265
+ ? GraphqlSubscriptionResult<NeverEmpty<SUB_OUT>>
266
+ : FALLBACK_TYPE extends GraphQLQuery<infer T>
267
+ ? Promise<GraphQLResult<FALLBACK_TYPE>>
268
+ : FALLBACK_TYPE extends GraphQLSubscription<infer T>
269
+ ? GraphqlSubscriptionResult<FALLBACK_TYPE>
270
+ : FALLBACK_TYPE extends GraphQLOperationType<
271
+ infer IN,
272
+ infer CUSTOM_OUT
273
+ >
274
+ ? CUSTOM_OUT
275
+ : UnknownGraphQLResponse;
271
276
 
272
277
  /**
273
278
  * The shape customers can use to provide `T` to `graphql<T>()` to specify both
@@ -414,7 +419,7 @@ export type GraphQLMethod = <
414
419
  TYPED_GQL_STRING extends string = string,
415
420
  >(
416
421
  options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING>,
417
- additionalHeaders?: CustomHeaders | undefined
422
+ additionalHeaders?: CustomHeaders | undefined,
418
423
  ) => GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
419
424
 
420
425
  export type GraphQLMethodSSR = <
@@ -423,7 +428,7 @@ export type GraphQLMethodSSR = <
423
428
  >(
424
429
  contextSpec: AmplifyServer.ContextSpec,
425
430
  options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING>,
426
- additionalHeaders?: CustomHeaders | undefined
431
+ additionalHeaders?: CustomHeaders | undefined,
427
432
  ) => GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
428
433
 
429
434
  /**
@@ -69,10 +69,10 @@ export class ConnectionStateMonitor {
69
69
  this._initialNetworkStateSubscription = ReachabilityMonitor().subscribe(
70
70
  ({ online }) => {
71
71
  this.record(
72
- online ? CONNECTION_CHANGE.ONLINE : CONNECTION_CHANGE.OFFLINE
72
+ online ? CONNECTION_CHANGE.ONLINE : CONNECTION_CHANGE.OFFLINE,
73
73
  );
74
74
  this._initialNetworkStateSubscription?.unsubscribe();
75
- }
75
+ },
76
76
  );
77
77
 
78
78
  this._linkedConnectionStateObservable =
@@ -94,9 +94,9 @@ export class ConnectionStateMonitor {
94
94
  this._networkMonitoringSubscription = ReachabilityMonitor().subscribe(
95
95
  ({ online }) => {
96
96
  this.record(
97
- online ? CONNECTION_CHANGE.ONLINE : CONNECTION_CHANGE.OFFLINE
97
+ online ? CONNECTION_CHANGE.ONLINE : CONNECTION_CHANGE.OFFLINE,
98
98
  );
99
- }
99
+ },
100
100
  );
101
101
  }
102
102
  }
@@ -126,14 +126,14 @@ export class ConnectionStateMonitor {
126
126
  .pipe(
127
127
  map(value => {
128
128
  return this.connectionStatesTranslator(value);
129
- })
129
+ }),
130
130
  )
131
131
  .pipe(
132
132
  filter(current => {
133
133
  const toInclude = current !== previous;
134
134
  previous = current;
135
135
  return toInclude;
136
- })
136
+ }),
137
137
  );
138
138
  }
139
139
 
@@ -9,7 +9,7 @@ import { APIValidationErrorCode, validationErrorMap } from './validation';
9
9
  */
10
10
  export function assertValidationError(
11
11
  assertion: boolean,
12
- name: APIValidationErrorCode
12
+ name: APIValidationErrorCode,
13
13
  ): asserts assertion {
14
14
  const { message, recoverySuggestion } = validationErrorMap[name];
15
15
 
@@ -11,16 +11,16 @@
11
11
  export function findIndexByFields<T>(
12
12
  needle: T,
13
13
  haystack: T[],
14
- keyFields: Array<keyof T>
14
+ keyFields: Array<keyof T>,
15
15
  ): number {
16
16
  const searchObject = Object.fromEntries(
17
- keyFields.map(fieldName => [fieldName, needle[fieldName]])
17
+ keyFields.map(fieldName => [fieldName, needle[fieldName]]),
18
18
  );
19
19
 
20
20
  for (let i = 0; i < haystack.length; i++) {
21
21
  if (
22
22
  Object.keys(searchObject).every(
23
- k => searchObject[k] === (haystack[i] as any)[k]
23
+ k => searchObject[k] === (haystack[i] as any)[k],
24
24
  )
25
25
  ) {
26
26
  return i;
@@ -14,7 +14,7 @@ export const resolveConfig = (amplify: AmplifyClassV6) => {
14
14
 
15
15
  if (!config.API?.GraphQL) {
16
16
  logger.warn(
17
- 'The API configuration is missing. This is likely due to Amplify.configure() not being called prior to generateClient().'
17
+ 'The API configuration is missing. This is likely due to Amplify.configure() not being called prior to generateClient().',
18
18
  );
19
19
  }
20
20
 
@@ -31,7 +31,7 @@ export const resolveConfig = (amplify: AmplifyClassV6) => {
31
31
  // assertValidationError(!!endpoint, APIValidationErrorCode.NoEndpoint);
32
32
  assertValidationError(
33
33
  !(!customEndpoint && customEndpointRegion),
34
- APIValidationErrorCode.NoCustomEndpoint
34
+ APIValidationErrorCode.NoCustomEndpoint,
35
35
  );
36
36
 
37
37
  return {
@@ -56,7 +56,7 @@ function isAuthAttribute(attribute: any): attribute is AuthAttribute {
56
56
  if (typeof attribute?.properties === 'object') {
57
57
  if (Array.isArray(attribute?.properties?.rules)) {
58
58
  return (attribute?.properties?.rules as Array<any>).every(
59
- rule => !!rule.allow
59
+ rule => !!rule.allow,
60
60
  );
61
61
  }
62
62
  }