@aws-amplify/api-graphql 4.0.24-unstable.962179b.0 → 4.0.24

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 (50) hide show
  1. package/dist/cjs/internals/APIClient.js +0 -13
  2. package/dist/cjs/internals/APIClient.js.map +1 -1
  3. package/dist/cjs/internals/InternalGraphQLAPI.js +38 -36
  4. package/dist/cjs/internals/InternalGraphQLAPI.js.map +1 -1
  5. package/dist/cjs/utils/errors/index.js +1 -3
  6. package/dist/cjs/utils/errors/index.js.map +1 -1
  7. package/dist/cjs/utils/errors/repackageAuthError.js +6 -6
  8. package/dist/cjs/utils/errors/repackageAuthError.js.map +1 -1
  9. package/dist/cjs/utils/resolveOwnerFields.js +4 -1
  10. package/dist/cjs/utils/resolveOwnerFields.js.map +1 -1
  11. package/dist/esm/internals/APIClient.mjs +0 -13
  12. package/dist/esm/internals/APIClient.mjs.map +1 -1
  13. package/dist/esm/internals/InternalGraphQLAPI.mjs +40 -40
  14. package/dist/esm/internals/InternalGraphQLAPI.mjs.map +1 -1
  15. package/dist/esm/types/index.d.ts +1 -2
  16. package/dist/esm/utils/errors/index.d.ts +0 -1
  17. package/dist/esm/utils/errors/index.mjs +0 -1
  18. package/dist/esm/utils/errors/index.mjs.map +1 -1
  19. package/dist/esm/utils/errors/repackageAuthError.d.ts +7 -3
  20. package/dist/esm/utils/errors/repackageAuthError.mjs +5 -5
  21. package/dist/esm/utils/errors/repackageAuthError.mjs.map +1 -1
  22. package/dist/esm/utils/resolveConfig.mjs +0 -1
  23. package/dist/esm/utils/resolveConfig.mjs.map +1 -1
  24. package/dist/esm/utils/resolveOwnerFields.mjs +4 -1
  25. package/dist/esm/utils/resolveOwnerFields.mjs.map +1 -1
  26. package/package.json +5 -5
  27. package/src/internals/APIClient.ts +0 -19
  28. package/src/internals/InternalGraphQLAPI.ts +56 -50
  29. package/src/types/index.ts +0 -2
  30. package/src/utils/errors/index.ts +0 -1
  31. package/src/utils/errors/repackageAuthError.ts +10 -8
  32. package/src/utils/resolveOwnerFields.ts +4 -1
  33. package/dist/cjs/internals/utils/runtimeTypeGuards/isGraphQLResponseWithErrors.js +0 -15
  34. package/dist/cjs/internals/utils/runtimeTypeGuards/isGraphQLResponseWithErrors.js.map +0 -1
  35. package/dist/cjs/utils/errors/constants.js +0 -47
  36. package/dist/cjs/utils/errors/constants.js.map +0 -1
  37. package/dist/cjs/utils/errors/createGraphQLResultWithError.js +0 -15
  38. package/dist/cjs/utils/errors/createGraphQLResultWithError.js.map +0 -1
  39. package/dist/esm/internals/utils/runtimeTypeGuards/isGraphQLResponseWithErrors.d.ts +0 -2
  40. package/dist/esm/internals/utils/runtimeTypeGuards/isGraphQLResponseWithErrors.mjs +0 -12
  41. package/dist/esm/internals/utils/runtimeTypeGuards/isGraphQLResponseWithErrors.mjs.map +0 -1
  42. package/dist/esm/utils/errors/constants.d.ts +0 -7
  43. package/dist/esm/utils/errors/constants.mjs +0 -46
  44. package/dist/esm/utils/errors/constants.mjs.map +0 -1
  45. package/dist/esm/utils/errors/createGraphQLResultWithError.d.ts +0 -2
  46. package/dist/esm/utils/errors/createGraphQLResultWithError.mjs +0 -13
  47. package/dist/esm/utils/errors/createGraphQLResultWithError.mjs.map +0 -1
  48. package/src/internals/utils/runtimeTypeGuards/isGraphQLResponseWithErrors.ts +0 -15
  49. package/src/utils/errors/constants.ts +0 -56
  50. package/src/utils/errors/createGraphQLResultWithError.ts +0 -15
@@ -1,47 +0,0 @@
1
- 'use strict';
2
-
3
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
- // SPDX-License-Identifier: Apache-2.0
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.NO_ENDPOINT = exports.NO_AUTH_TOKEN_HEADER = exports.NO_SIGNED_IN_USER = exports.NO_VALID_AUTH_TOKEN = exports.NO_VALID_CREDENTIALS = exports.NO_API_KEY = void 0;
7
- const types_1 = require("../../types");
8
- exports.NO_API_KEY = {
9
- name: 'NoApiKey',
10
- // ideal: No API key configured.
11
- message: types_1.GraphQLAuthError.NO_API_KEY,
12
- recoverySuggestion: 'The API request was made with `authMode: "apiKey"` but no API Key was passed into `Amplify.configure()`. Review if your API key is passed into the `Amplify.configure()` function.',
13
- };
14
- exports.NO_VALID_CREDENTIALS = {
15
- name: 'NoCredentials',
16
- // ideal: No auth credentials available.
17
- message: types_1.GraphQLAuthError.NO_CREDENTIALS,
18
- recoverySuggestion: `The API request was made with \`authMode: "iam"\` but no authentication credentials are available.
19
-
20
- If you intended to make a request using an authenticated role, review if your user is signed in before making the request.
21
-
22
- If you intend to make a request using an unauthenticated role or also known as "guest access", verify if "Auth.Cognito.allowGuestAccess" is set to "true" in the \`Amplify.configure()\` function.`,
23
- };
24
- exports.NO_VALID_AUTH_TOKEN = {
25
- name: 'NoValidAuthTokens',
26
- // ideal: No valid JWT auth token provided to make the API request..
27
- message: types_1.GraphQLAuthError.NO_FEDERATED_JWT,
28
- recoverySuggestion: 'If you intended to make an authenticated API request, review if the current user is signed in.',
29
- };
30
- exports.NO_SIGNED_IN_USER = {
31
- name: 'NoSignedUser',
32
- // ideal: Couldn't retrieve authentication credentials to make the API request.
33
- message: types_1.GraphQLAuthError.NO_CURRENT_USER,
34
- recoverySuggestion: 'Review the underlying exception field for more details. If you intended to make an authenticated API request, review if the current user is signed in.',
35
- };
36
- exports.NO_AUTH_TOKEN_HEADER = {
37
- name: 'NoAuthorizationHeader',
38
- // ideal: Authorization header not specified.
39
- message: types_1.GraphQLAuthError.NO_AUTH_TOKEN,
40
- recoverySuggestion: 'The API request was made with `authMode: "lambda"` but no `authToken` is set. Review if a valid authToken is passed into the request options or in the `Amplify.configure()` function.',
41
- };
42
- exports.NO_ENDPOINT = {
43
- name: 'NoEndpoint',
44
- message: 'No GraphQL endpoint configured in `Amplify.configure()`.',
45
- recoverySuggestion: 'Review if the GraphQL API endpoint is set in the `Amplify.configure()` function.',
46
- };
47
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sources":["../../../../src/utils/errors/constants.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.NO_ENDPOINT = exports.NO_AUTH_TOKEN_HEADER = exports.NO_SIGNED_IN_USER = exports.NO_VALID_AUTH_TOKEN = exports.NO_VALID_CREDENTIALS = exports.NO_API_KEY = void 0;\nconst types_1 = require(\"../../types\");\nexports.NO_API_KEY = {\n name: 'NoApiKey',\n // ideal: No API key configured.\n message: types_1.GraphQLAuthError.NO_API_KEY,\n recoverySuggestion: 'The API request was made with `authMode: \"apiKey\"` but no API Key was passed into `Amplify.configure()`. Review if your API key is passed into the `Amplify.configure()` function.',\n};\nexports.NO_VALID_CREDENTIALS = {\n name: 'NoCredentials',\n // ideal: No auth credentials available.\n message: types_1.GraphQLAuthError.NO_CREDENTIALS,\n recoverySuggestion: `The API request was made with \\`authMode: \"iam\"\\` but no authentication credentials are available.\n\nIf you intended to make a request using an authenticated role, review if your user is signed in before making the request.\n\nIf you intend to make a request using an unauthenticated role or also known as \"guest access\", verify if \"Auth.Cognito.allowGuestAccess\" is set to \"true\" in the \\`Amplify.configure()\\` function.`,\n};\nexports.NO_VALID_AUTH_TOKEN = {\n name: 'NoValidAuthTokens',\n // ideal: No valid JWT auth token provided to make the API request..\n message: types_1.GraphQLAuthError.NO_FEDERATED_JWT,\n recoverySuggestion: 'If you intended to make an authenticated API request, review if the current user is signed in.',\n};\nexports.NO_SIGNED_IN_USER = {\n name: 'NoSignedUser',\n // ideal: Couldn't retrieve authentication credentials to make the API request.\n message: types_1.GraphQLAuthError.NO_CURRENT_USER,\n recoverySuggestion: 'Review the underlying exception field for more details. If you intended to make an authenticated API request, review if the current user is signed in.',\n};\nexports.NO_AUTH_TOKEN_HEADER = {\n name: 'NoAuthorizationHeader',\n // ideal: Authorization header not specified.\n message: types_1.GraphQLAuthError.NO_AUTH_TOKEN,\n recoverySuggestion: 'The API request was made with `authMode: \"lambda\"` but no `authToken` is set. Review if a valid authToken is passed into the request options or in the `Amplify.configure()` function.',\n};\nexports.NO_ENDPOINT = {\n name: 'NoEndpoint',\n message: 'No GraphQL endpoint configured in `Amplify.configure()`.',\n recoverySuggestion: 'Review if the GraphQL API endpoint is set in the `Amplify.configure()` function.',\n};\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,WAAW,GAAG,OAAO,CAAC,oBAAoB,GAAG,OAAO,CAAC,iBAAiB,GAAG,OAAO,CAAC,mBAAmB,GAAG,OAAO,CAAC,oBAAoB,GAAG,OAAO,CAAC,UAAU,GAAG,KAAK,CAAC,CAAC;AAC1K,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AACvC,OAAO,CAAC,UAAU,GAAG;AACrB,IAAI,IAAI,EAAE,UAAU;AACpB;AACA,IAAI,OAAO,EAAE,OAAO,CAAC,gBAAgB,CAAC,UAAU;AAChD,IAAI,kBAAkB,EAAE,oLAAoL;AAC5M,CAAC,CAAC;AACF,OAAO,CAAC,oBAAoB,GAAG;AAC/B,IAAI,IAAI,EAAE,eAAe;AACzB;AACA,IAAI,OAAO,EAAE,OAAO,CAAC,gBAAgB,CAAC,cAAc;AACpD,IAAI,kBAAkB,EAAE,CAAC;AACzB;AACA;AACA;AACA,kMAAkM,CAAC;AACnM,CAAC,CAAC;AACF,OAAO,CAAC,mBAAmB,GAAG;AAC9B,IAAI,IAAI,EAAE,mBAAmB;AAC7B;AACA,IAAI,OAAO,EAAE,OAAO,CAAC,gBAAgB,CAAC,gBAAgB;AACtD,IAAI,kBAAkB,EAAE,gGAAgG;AACxH,CAAC,CAAC;AACF,OAAO,CAAC,iBAAiB,GAAG;AAC5B,IAAI,IAAI,EAAE,cAAc;AACxB;AACA,IAAI,OAAO,EAAE,OAAO,CAAC,gBAAgB,CAAC,eAAe;AACrD,IAAI,kBAAkB,EAAE,wJAAwJ;AAChL,CAAC,CAAC;AACF,OAAO,CAAC,oBAAoB,GAAG;AAC/B,IAAI,IAAI,EAAE,uBAAuB;AACjC;AACA,IAAI,OAAO,EAAE,OAAO,CAAC,gBAAgB,CAAC,aAAa;AACnD,IAAI,kBAAkB,EAAE,wLAAwL;AAChN,CAAC,CAAC;AACF,OAAO,CAAC,WAAW,GAAG;AACtB,IAAI,IAAI,EAAE,YAAY;AACtB,IAAI,OAAO,EAAE,0DAA0D;AACvE,IAAI,kBAAkB,EAAE,kFAAkF;AAC1G,CAAC;;"}
@@ -1,15 +0,0 @@
1
- 'use strict';
2
-
3
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
- // SPDX-License-Identifier: Apache-2.0
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.createGraphQLResultWithError = void 0;
7
- const graphql_1 = require("graphql");
8
- const createGraphQLResultWithError = (error) => {
9
- return {
10
- data: {},
11
- errors: [new graphql_1.GraphQLError(error.message, null, null, null, null, error)],
12
- };
13
- };
14
- exports.createGraphQLResultWithError = createGraphQLResultWithError;
15
- //# sourceMappingURL=createGraphQLResultWithError.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createGraphQLResultWithError.js","sources":["../../../../src/utils/errors/createGraphQLResultWithError.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.createGraphQLResultWithError = void 0;\nconst graphql_1 = require(\"graphql\");\nconst createGraphQLResultWithError = (error) => {\n return {\n data: {},\n errors: [new graphql_1.GraphQLError(error.message, null, null, null, null, error)],\n };\n};\nexports.createGraphQLResultWithError = createGraphQLResultWithError;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,4BAA4B,GAAG,KAAK,CAAC,CAAC;AAC9C,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AACrC,MAAM,4BAA4B,GAAG,CAAC,KAAK,KAAK;AAChD,IAAI,OAAO;AACX,QAAQ,IAAI,EAAE,EAAE;AAChB,QAAQ,MAAM,EAAE,CAAC,IAAI,SAAS,CAAC,YAAY,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;AAC1F,KAAK,CAAC;AACN,CAAC,CAAC;AACF,OAAO,CAAC,4BAA4B,GAAG,4BAA4B;;"}
@@ -1,2 +0,0 @@
1
- import { GraphQLResult } from '../../../types';
2
- export declare function isGraphQLResponseWithErrors(response: unknown): response is GraphQLResult;
@@ -1,12 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
- function isGraphQLResponseWithErrors(response) {
4
- if (!response) {
5
- return false;
6
- }
7
- const r = response;
8
- return Array.isArray(r.errors) && r.errors.length > 0;
9
- }
10
-
11
- export { isGraphQLResponseWithErrors };
12
- //# sourceMappingURL=isGraphQLResponseWithErrors.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isGraphQLResponseWithErrors.mjs","sources":["../../../../../src/internals/utils/runtimeTypeGuards/isGraphQLResponseWithErrors.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nexport function 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":"AAAA;AACA;AACO,SAAS,2BAA2B,CAAC,QAAQ,EAAE;AACtD,IAAI,IAAI,CAAC,QAAQ,EAAE;AACnB,QAAQ,OAAO,KAAK,CAAC;AACrB,KAAK;AACL,IAAI,MAAM,CAAC,GAAG,QAAQ,CAAC;AACvB,IAAI,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;AAC1D;;;;"}
@@ -1,7 +0,0 @@
1
- import { AmplifyErrorParams } from '@aws-amplify/core/internals/utils';
2
- export declare const NO_API_KEY: AmplifyErrorParams;
3
- export declare const NO_VALID_CREDENTIALS: AmplifyErrorParams;
4
- export declare const NO_VALID_AUTH_TOKEN: AmplifyErrorParams;
5
- export declare const NO_SIGNED_IN_USER: AmplifyErrorParams;
6
- export declare const NO_AUTH_TOKEN_HEADER: AmplifyErrorParams;
7
- export declare const NO_ENDPOINT: AmplifyErrorParams;
@@ -1,46 +0,0 @@
1
- import { GraphQLAuthError } from '../../types/index.mjs';
2
-
3
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
- // SPDX-License-Identifier: Apache-2.0
5
- const NO_API_KEY = {
6
- name: 'NoApiKey',
7
- // ideal: No API key configured.
8
- message: GraphQLAuthError.NO_API_KEY,
9
- recoverySuggestion: 'The API request was made with `authMode: "apiKey"` but no API Key was passed into `Amplify.configure()`. Review if your API key is passed into the `Amplify.configure()` function.',
10
- };
11
- const NO_VALID_CREDENTIALS = {
12
- name: 'NoCredentials',
13
- // ideal: No auth credentials available.
14
- message: GraphQLAuthError.NO_CREDENTIALS,
15
- recoverySuggestion: `The API request was made with \`authMode: "iam"\` but no authentication credentials are available.
16
-
17
- If you intended to make a request using an authenticated role, review if your user is signed in before making the request.
18
-
19
- If you intend to make a request using an unauthenticated role or also known as "guest access", verify if "Auth.Cognito.allowGuestAccess" is set to "true" in the \`Amplify.configure()\` function.`,
20
- };
21
- const NO_VALID_AUTH_TOKEN = {
22
- name: 'NoValidAuthTokens',
23
- // ideal: No valid JWT auth token provided to make the API request..
24
- message: GraphQLAuthError.NO_FEDERATED_JWT,
25
- recoverySuggestion: 'If you intended to make an authenticated API request, review if the current user is signed in.',
26
- };
27
- const NO_SIGNED_IN_USER = {
28
- name: 'NoSignedUser',
29
- // ideal: Couldn't retrieve authentication credentials to make the API request.
30
- message: GraphQLAuthError.NO_CURRENT_USER,
31
- recoverySuggestion: 'Review the underlying exception field for more details. If you intended to make an authenticated API request, review if the current user is signed in.',
32
- };
33
- const NO_AUTH_TOKEN_HEADER = {
34
- name: 'NoAuthorizationHeader',
35
- // ideal: Authorization header not specified.
36
- message: GraphQLAuthError.NO_AUTH_TOKEN,
37
- recoverySuggestion: 'The API request was made with `authMode: "lambda"` but no `authToken` is set. Review if a valid authToken is passed into the request options or in the `Amplify.configure()` function.',
38
- };
39
- const NO_ENDPOINT = {
40
- name: 'NoEndpoint',
41
- message: 'No GraphQL endpoint configured in `Amplify.configure()`.',
42
- recoverySuggestion: 'Review if the GraphQL API endpoint is set in the `Amplify.configure()` function.',
43
- };
44
-
45
- export { NO_API_KEY, NO_AUTH_TOKEN_HEADER, NO_ENDPOINT, NO_SIGNED_IN_USER, NO_VALID_AUTH_TOKEN, NO_VALID_CREDENTIALS };
46
- //# sourceMappingURL=constants.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.mjs","sources":["../../../../src/utils/errors/constants.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { GraphQLAuthError } from '../../types';\nexport const NO_API_KEY = {\n name: 'NoApiKey',\n // ideal: No API key configured.\n message: GraphQLAuthError.NO_API_KEY,\n recoverySuggestion: 'The API request was made with `authMode: \"apiKey\"` but no API Key was passed into `Amplify.configure()`. Review if your API key is passed into the `Amplify.configure()` function.',\n};\nexport const NO_VALID_CREDENTIALS = {\n name: 'NoCredentials',\n // ideal: No auth credentials available.\n message: GraphQLAuthError.NO_CREDENTIALS,\n recoverySuggestion: `The API request was made with \\`authMode: \"iam\"\\` but no authentication credentials are available.\n\nIf you intended to make a request using an authenticated role, review if your user is signed in before making the request.\n\nIf you intend to make a request using an unauthenticated role or also known as \"guest access\", verify if \"Auth.Cognito.allowGuestAccess\" is set to \"true\" in the \\`Amplify.configure()\\` function.`,\n};\nexport const NO_VALID_AUTH_TOKEN = {\n name: 'NoValidAuthTokens',\n // ideal: No valid JWT auth token provided to make the API request..\n message: GraphQLAuthError.NO_FEDERATED_JWT,\n recoverySuggestion: 'If you intended to make an authenticated API request, review if the current user is signed in.',\n};\nexport const NO_SIGNED_IN_USER = {\n name: 'NoSignedUser',\n // ideal: Couldn't retrieve authentication credentials to make the API request.\n message: GraphQLAuthError.NO_CURRENT_USER,\n recoverySuggestion: 'Review the underlying exception field for more details. If you intended to make an authenticated API request, review if the current user is signed in.',\n};\nexport const NO_AUTH_TOKEN_HEADER = {\n name: 'NoAuthorizationHeader',\n // ideal: Authorization header not specified.\n message: GraphQLAuthError.NO_AUTH_TOKEN,\n recoverySuggestion: 'The API request was made with `authMode: \"lambda\"` but no `authToken` is set. Review if a valid authToken is passed into the request options or in the `Amplify.configure()` function.',\n};\nexport const NO_ENDPOINT = {\n name: 'NoEndpoint',\n message: 'No GraphQL endpoint configured in `Amplify.configure()`.',\n recoverySuggestion: 'Review if the GraphQL API endpoint is set in the `Amplify.configure()` function.',\n};\n"],"names":[],"mappings":";;AAAA;AACA;AAEY,MAAC,UAAU,GAAG;AAC1B,IAAI,IAAI,EAAE,UAAU;AACpB;AACA,IAAI,OAAO,EAAE,gBAAgB,CAAC,UAAU;AACxC,IAAI,kBAAkB,EAAE,oLAAoL;AAC5M,EAAE;AACU,MAAC,oBAAoB,GAAG;AACpC,IAAI,IAAI,EAAE,eAAe;AACzB;AACA,IAAI,OAAO,EAAE,gBAAgB,CAAC,cAAc;AAC5C,IAAI,kBAAkB,EAAE,CAAC;AACzB;AACA;AACA;AACA,kMAAkM,CAAC;AACnM,EAAE;AACU,MAAC,mBAAmB,GAAG;AACnC,IAAI,IAAI,EAAE,mBAAmB;AAC7B;AACA,IAAI,OAAO,EAAE,gBAAgB,CAAC,gBAAgB;AAC9C,IAAI,kBAAkB,EAAE,gGAAgG;AACxH,EAAE;AACU,MAAC,iBAAiB,GAAG;AACjC,IAAI,IAAI,EAAE,cAAc;AACxB;AACA,IAAI,OAAO,EAAE,gBAAgB,CAAC,eAAe;AAC7C,IAAI,kBAAkB,EAAE,wJAAwJ;AAChL,EAAE;AACU,MAAC,oBAAoB,GAAG;AACpC,IAAI,IAAI,EAAE,uBAAuB;AACjC;AACA,IAAI,OAAO,EAAE,gBAAgB,CAAC,aAAa;AAC3C,IAAI,kBAAkB,EAAE,wLAAwL;AAChN,EAAE;AACU,MAAC,WAAW,GAAG;AAC3B,IAAI,IAAI,EAAE,YAAY;AACtB,IAAI,OAAO,EAAE,0DAA0D;AACvE,IAAI,kBAAkB,EAAE,kFAAkF;AAC1G;;;;"}
@@ -1,2 +0,0 @@
1
- import { GraphQLResult } from '../../types';
2
- export declare const createGraphQLResultWithError: <T>(error: Error) => GraphQLResult<T>;
@@ -1,13 +0,0 @@
1
- import { GraphQLError } from 'graphql';
2
-
3
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
- // SPDX-License-Identifier: Apache-2.0
5
- const createGraphQLResultWithError = (error) => {
6
- return {
7
- data: {},
8
- errors: [new GraphQLError(error.message, null, null, null, null, error)],
9
- };
10
- };
11
-
12
- export { createGraphQLResultWithError };
13
- //# sourceMappingURL=createGraphQLResultWithError.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createGraphQLResultWithError.mjs","sources":["../../../../src/utils/errors/createGraphQLResultWithError.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { GraphQLError } from 'graphql';\nexport const createGraphQLResultWithError = (error) => {\n return {\n data: {},\n errors: [new GraphQLError(error.message, null, null, null, null, error)],\n };\n};\n"],"names":[],"mappings":";;AAAA;AACA;AAEY,MAAC,4BAA4B,GAAG,CAAC,KAAK,KAAK;AACvD,IAAI,OAAO;AACX,QAAQ,IAAI,EAAE,EAAE;AAChB,QAAQ,MAAM,EAAE,CAAC,IAAI,YAAY,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;AAChF,KAAK,CAAC;AACN;;;;"}
@@ -1,15 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import { GraphQLResult } from '../../../types';
5
-
6
- export function isGraphQLResponseWithErrors(
7
- response: unknown,
8
- ): response is GraphQLResult {
9
- if (!response) {
10
- return false;
11
- }
12
- const r = response as GraphQLResult;
13
-
14
- return Array.isArray(r.errors) && r.errors.length > 0;
15
- }
@@ -1,56 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import { AmplifyErrorParams } from '@aws-amplify/core/internals/utils';
5
-
6
- import { GraphQLAuthError } from '../../types';
7
-
8
- export const NO_API_KEY: AmplifyErrorParams = {
9
- name: 'NoApiKey',
10
- // ideal: No API key configured.
11
- message: GraphQLAuthError.NO_API_KEY,
12
- recoverySuggestion:
13
- 'The API request was made with `authMode: "apiKey"` but no API Key was passed into `Amplify.configure()`. Review if your API key is passed into the `Amplify.configure()` function.',
14
- };
15
-
16
- export const NO_VALID_CREDENTIALS: AmplifyErrorParams = {
17
- name: 'NoCredentials',
18
- // ideal: No auth credentials available.
19
- message: GraphQLAuthError.NO_CREDENTIALS,
20
- recoverySuggestion: `The API request was made with \`authMode: "iam"\` but no authentication credentials are available.
21
-
22
- If you intended to make a request using an authenticated role, review if your user is signed in before making the request.
23
-
24
- If you intend to make a request using an unauthenticated role or also known as "guest access", verify if "Auth.Cognito.allowGuestAccess" is set to "true" in the \`Amplify.configure()\` function.`,
25
- };
26
-
27
- export const NO_VALID_AUTH_TOKEN: AmplifyErrorParams = {
28
- name: 'NoValidAuthTokens',
29
- // ideal: No valid JWT auth token provided to make the API request..
30
- message: GraphQLAuthError.NO_FEDERATED_JWT,
31
- recoverySuggestion:
32
- 'If you intended to make an authenticated API request, review if the current user is signed in.',
33
- };
34
-
35
- export const NO_SIGNED_IN_USER: AmplifyErrorParams = {
36
- name: 'NoSignedUser',
37
- // ideal: Couldn't retrieve authentication credentials to make the API request.
38
- message: GraphQLAuthError.NO_CURRENT_USER,
39
- recoverySuggestion:
40
- 'Review the underlying exception field for more details. If you intended to make an authenticated API request, review if the current user is signed in.',
41
- };
42
-
43
- export const NO_AUTH_TOKEN_HEADER: AmplifyErrorParams = {
44
- name: 'NoAuthorizationHeader',
45
- // ideal: Authorization header not specified.
46
- message: GraphQLAuthError.NO_AUTH_TOKEN,
47
- recoverySuggestion:
48
- 'The API request was made with `authMode: "lambda"` but no `authToken` is set. Review if a valid authToken is passed into the request options or in the `Amplify.configure()` function.',
49
- };
50
-
51
- export const NO_ENDPOINT: AmplifyErrorParams = {
52
- name: 'NoEndpoint',
53
- message: 'No GraphQL endpoint configured in `Amplify.configure()`.',
54
- recoverySuggestion:
55
- 'Review if the GraphQL API endpoint is set in the `Amplify.configure()` function.',
56
- };
@@ -1,15 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import { GraphQLError } from 'graphql';
5
-
6
- import { GraphQLResult } from '../../types';
7
-
8
- export const createGraphQLResultWithError = <T>(
9
- error: Error,
10
- ): GraphQLResult<T> => {
11
- return {
12
- data: {} as T,
13
- errors: [new GraphQLError(error.message, null, null, null, null, error)],
14
- };
15
- };