@aws-amplify/core 6.12.3 → 6.12.4-unstable.b29d394.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.
@@ -3,5 +3,5 @@
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.version = void 0;
5
5
  // generated by genversion
6
- exports.version = '6.15.3';
6
+ exports.version = '6.15.4-unstable.b29d394.0+b29d394';
7
7
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sources":["../../../src/Platform/version.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.version = void 0;\n// generated by genversion\nexports.version = '6.15.3';\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,OAAO,GAAG,MAAM;AACxB;AACA,OAAO,CAAC,OAAO,GAAG,QAAQ;;"}
1
+ {"version":3,"file":"version.js","sources":["../../../src/Platform/version.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.version = void 0;\n// generated by genversion\nexports.version = '6.15.4-unstable.b29d394.0+b29d394';\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,OAAO,GAAG,MAAM;AACxB;AACA,OAAO,CAAC,OAAO,GAAG,mCAAmC;;"}
@@ -7,7 +7,7 @@ exports.fetchTransferHandler = void 0;
7
7
  const errors_1 = require("../../errors");
8
8
  const memoization_1 = require("../utils/memoization");
9
9
  const types_1 = require("../../types");
10
- const shouldSendBody = (method) => !['HEAD', 'GET', 'DELETE'].includes(method.toUpperCase());
10
+ const shouldSendBody = (method) => !['HEAD', 'GET'].includes(method.toUpperCase());
11
11
  // TODO[AllanZhengYP]: we need to provide isCanceledError utility
12
12
  const fetchTransferHandler = async ({ url, method, headers, body }, { abortSignal, cache, withCrossDomainCredentials }) => {
13
13
  let resp;
@@ -1 +1 @@
1
- {"version":3,"file":"fetch.js","sources":["../../../../src/clients/handlers/fetch.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.fetchTransferHandler = void 0;\nconst errors_1 = require(\"../../errors\");\nconst memoization_1 = require(\"../utils/memoization\");\nconst types_1 = require(\"../../types\");\nconst shouldSendBody = (method) => !['HEAD', 'GET', 'DELETE'].includes(method.toUpperCase());\n// TODO[AllanZhengYP]: we need to provide isCanceledError utility\nconst fetchTransferHandler = async ({ url, method, headers, body }, { abortSignal, cache, withCrossDomainCredentials }) => {\n let resp;\n try {\n resp = await fetch(url, {\n method,\n headers,\n body: shouldSendBody(method) ? body : undefined,\n signal: abortSignal,\n cache,\n credentials: withCrossDomainCredentials ? 'include' : 'same-origin',\n });\n }\n catch (e) {\n if (e instanceof TypeError) {\n throw new errors_1.AmplifyError({\n name: types_1.AmplifyErrorCode.NetworkError,\n message: 'A network error has occurred.',\n underlyingError: e,\n });\n }\n throw e;\n }\n const responseHeaders = {};\n resp.headers?.forEach((value, key) => {\n responseHeaders[key.toLowerCase()] = value;\n });\n const httpResponse = {\n statusCode: resp.status,\n headers: responseHeaders,\n body: null,\n };\n // resp.body is a ReadableStream according to Fetch API spec, but React Native\n // does not implement it.\n const bodyWithMixin = Object.assign(resp.body ?? {}, {\n text: (0, memoization_1.withMemoization)(() => resp.text()),\n blob: (0, memoization_1.withMemoization)(() => resp.blob()),\n json: (0, memoization_1.withMemoization)(() => resp.json()),\n });\n return {\n ...httpResponse,\n body: bodyWithMixin,\n };\n};\nexports.fetchTransferHandler = fetchTransferHandler;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,C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I,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AAC1C,QAAQ,eAAe,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,GAAG,KAAK;AAClD,KAAK,CAAC;AACN,IAAI,MAAM,YAAY,GAAG;AACzB,QAAQ,UAAU,EAAE,IAAI,CAAC,MAAM;AAC/B,QAAQ,OAAO,EAAE,eAAe;AAChC,QAAQ,IAAI,EAAE,IAAI;AAClB,KAAK;AACL;AACA;AACA,IAAI,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,EAAE;AACzD,QAAQ,IAAI,EAAE,IAAI,aAAa,CAAC,eAAe,EAAE,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;AACnE,QAAQ,IAAI,EAAE,IAAI,aAAa,CAAC,eAAe,EAAE,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;AACnE,QAAQ,IAAI,EAAE,IAAI,aAAa,CAAC,eAAe,EAAE,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;AACnE,KAAK,CAAC;AACN,IAAI,OAAO;AACX,QAAQ,GAAG,YAAY;AACvB,QAAQ,IAAI,EAAE,aAAa;AAC3B,KAAK;AACL,CAAC;AACD,OAAO,CAAC,oBAAoB,GAAG,oBAAoB;;"}
1
+ {"version":3,"file":"fetch.js","sources":["../../../../src/clients/handlers/fetch.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.fetchTransferHandler = void 0;\nconst errors_1 = require(\"../../errors\");\nconst memoization_1 = require(\"../utils/memoization\");\nconst types_1 = require(\"../../types\");\nconst shouldSendBody = (method) => !['HEAD', 'GET'].includes(method.toUpperCase());\n// TODO[AllanZhengYP]: we need to provide isCanceledError utility\nconst fetchTransferHandler = async ({ url, method, headers, body }, { abortSignal, cache, withCrossDomainCredentials }) => {\n let resp;\n try {\n resp = await fetch(url, {\n method,\n headers,\n body: shouldSendBody(method) ? body : undefined,\n signal: abortSignal,\n cache,\n credentials: withCrossDomainCredentials ? 'include' : 'same-origin',\n });\n }\n catch (e) {\n if (e instanceof TypeError) {\n throw new errors_1.AmplifyError({\n name: types_1.AmplifyErrorCode.NetworkError,\n message: 'A network error has occurred.',\n underlyingError: e,\n });\n }\n throw e;\n }\n const responseHeaders = {};\n resp.headers?.forEach((value, key) => {\n responseHeaders[key.toLowerCase()] = value;\n });\n const httpResponse = {\n statusCode: resp.status,\n headers: responseHeaders,\n body: null,\n };\n // resp.body is a ReadableStream according to Fetch API spec, but React Native\n // does not implement it.\n const bodyWithMixin = Object.assign(resp.body ?? {}, {\n text: (0, memoization_1.withMemoization)(() => resp.text()),\n blob: (0, memoization_1.withMemoization)(() => resp.blob()),\n json: (0, memoization_1.withMemoization)(() => resp.json()),\n });\n return {\n ...httpResponse,\n body: bodyWithMixin,\n };\n};\nexports.fetchTransferHandler = fetchTransferHandler;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,oBAAoB,GAAG,MAAM;AACrC,MAAM,QAAQ,GAAG,OAAO,CAAC,cAAc,CAAC;AACxC,MAAM,aAAa,GAAG,OAAO,CAAC,sBAAsB,CAAC;AACrD,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC;AACtC,MAAM,cAAc,GAAG,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;AAClF;AACA,MAAM,oBAAoB,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,0BAA0B,EAAE,KAAK;AA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AM,IAAI,CAAC,IAAI,EAAE,CAAC;AACnE,QAAQ,IAAI,EAAE,IAAI,aAAa,CAAC,eAAe,EAAE,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;AACnE,KAAK,CAAC;AACN,IAAI,OAAO;AACX,QAAQ,GAAG,YAAY;AACvB,QAAQ,IAAI,EAAE,aAAa;AAC3B,KAAK;AACL,CAAC;AACD,OAAO,CAAC,oBAAoB,GAAG,oBAAoB;;"}
@@ -30,8 +30,8 @@ class AuthClass {
30
30
  }
31
31
  /**
32
32
  * Fetch the auth tokens, and the temporary AWS credentials and identity if they are configured. By default it
33
- * does not refresh the auth tokens or credentials if they are loaded in storage already. You can force a refresh
34
- * with `{ forceRefresh: true }` input.
33
+ * will automatically refresh expired auth tokens if a valid refresh token is present. You can force a refresh
34
+ * of non-expired tokens with `{ forceRefresh: true }` input.
35
35
  *
36
36
  * @param options - Options configuring the fetch behavior.
37
37
  *
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/singleton/Auth/index.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.AuthClass = void 0;\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst Logger_1 = require(\"../../Logger\");\nconst logger = new Logger_1.ConsoleLogger('Auth');\nclass AuthClass {\n /**\n * Configure Auth category\n *\n * @internal\n *\n * @param authResourcesConfig - Resources configurations required by Auth providers.\n * @param authOptions - Client options used by library\n *\n * @returns void\n */\n configure(authResourcesConfig, authOptions) {\n this.authConfig = authResourcesConfig;\n this.authOptions = authOptions;\n if (authResourcesConfig && authResourcesConfig.Cognito?.userPoolEndpoint) {\n logger.warn(getCustomEndpointWarningMessage('Amazon Cognito User Pool'));\n }\n if (authResourcesConfig &&\n authResourcesConfig.Cognito?.identityPoolEndpoint) {\n logger.warn(getCustomEndpointWarningMessage('Amazon Cognito Identity Pool'));\n }\n }\n /**\n * Fetch the auth tokens, and the temporary AWS credentials and identity if they are configured. By default it\n * does not refresh the auth tokens or credentials if they are loaded in storage already. You can force a refresh\n * with `{ forceRefresh: true }` input.\n *\n * @param options - Options configuring the fetch behavior.\n *\n * @returns Promise of current auth session {@link AuthSession}.\n */\n async fetchAuthSession(options = {}) {\n let credentialsAndIdentityId;\n let userSub;\n // Get tokens will throw if session cannot be refreshed (network or service error) or return null if not available\n const tokens = await this.getTokens(options);\n if (tokens) {\n userSub = tokens.accessToken?.payload?.sub;\n // getCredentialsAndIdentityId will throw if cannot get credentials (network or service error)\n credentialsAndIdentityId =\n await this.authOptions?.credentialsProvider?.getCredentialsAndIdentityId({\n authConfig: this.authConfig,\n tokens,\n authenticated: true,\n forceRefresh: options.forceRefresh,\n });\n }\n else {\n // getCredentialsAndIdentityId will throw if cannot get credentials (network or service error)\n credentialsAndIdentityId =\n await this.authOptions?.credentialsProvider?.getCredentialsAndIdentityId({\n authConfig: this.authConfig,\n authenticated: false,\n forceRefresh: options.forceRefresh,\n });\n }\n return {\n tokens,\n credentials: credentialsAndIdentityId?.credentials,\n identityId: credentialsAndIdentityId?.identityId,\n userSub,\n };\n }\n async clearCredentials() {\n await this.authOptions?.credentialsProvider?.clearCredentialsAndIdentityId();\n }\n async getTokens(options) {\n return ((await this.authOptions?.tokenProvider?.getTokens(options)) ?? undefined);\n }\n}\nexports.AuthClass = AuthClass;\nconst getCustomEndpointWarningMessage = (target) => `You are using a custom Amazon ${target} endpoint, ensure the endpoint is correct.`;\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,SAAS,GAAG,MAAM;AAC1B;AACA;AACA,MAAM,QAAQ,GAAG,OAAO,CAAC,cAAc,CAAC;AACxC,MAAM,MAAM,GAAG,IAAI,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC;AACjD,MAAM,SAAS,CAAC;AAChB;AACA;A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AC,UAAU;AAC/C,oBAAoB,aAAa,EAAE,KAAK;AACxC,oBAAoB,YAAY,EAAE,OAAO,CAAC,YAAY;AACtD,iBAAiB,CAAC;AAClB;AACA,QAAQ,OAAO;AACf,YAAY,MAAM;AAClB,YAAY,WAAW,EAAE,wBAAwB,EAAE,WAAW;AAC9D,YAAY,UAAU,EAAE,wBAAwB,EAAE,UAAU;AAC5D,YAAY,OAAO;AACnB,SAAS;AACT;AACA,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,MAAM,IAAI,CAAC,WAAW,EAAE,mBAAmB,EAAE,6BAA6B,EAAE;AACpF;AACA,IAAI,MAAM,SAAS,CAAC,OAAO,EAAE;AAC7B,QAAQ,QAAQ,CAAC,MAAM,IAAI,CAAC,WAAW,EAAE,aAAa,EAAE,SAAS,CAAC,OAAO,CAAC,KAAK,SAAS;AACxF;AACA;AACA,OAAO,CAAC,SAAS,GAAG,SAAS;AAC7B,MAAM,+BAA+B,GAAG,CAAC,MAAM,KAAK,CAAC,8BAA8B,EAAE,MAAM,CAAC,0CAA0C,CAAC;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/singleton/Auth/index.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.AuthClass = void 0;\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst Logger_1 = require(\"../../Logger\");\nconst logger = new Logger_1.ConsoleLogger('Auth');\nclass AuthClass {\n /**\n * Configure Auth category\n *\n * @internal\n *\n * @param authResourcesConfig - Resources configurations required by Auth providers.\n * @param authOptions - Client options used by library\n *\n * @returns void\n */\n configure(authResourcesConfig, authOptions) {\n this.authConfig = authResourcesConfig;\n this.authOptions = authOptions;\n if (authResourcesConfig && authResourcesConfig.Cognito?.userPoolEndpoint) {\n logger.warn(getCustomEndpointWarningMessage('Amazon Cognito User Pool'));\n }\n if (authResourcesConfig &&\n authResourcesConfig.Cognito?.identityPoolEndpoint) {\n logger.warn(getCustomEndpointWarningMessage('Amazon Cognito Identity Pool'));\n }\n }\n /**\n * Fetch the auth tokens, and the temporary AWS credentials and identity if they are configured. By default it\n * will automatically refresh expired auth tokens if a valid refresh token is present. You can force a refresh\n * of non-expired tokens with `{ forceRefresh: true }` input.\n *\n * @param options - Options configuring the fetch behavior.\n *\n * @returns Promise of current auth session {@link AuthSession}.\n */\n async fetchAuthSession(options = {}) {\n let credentialsAndIdentityId;\n let userSub;\n // Get tokens will throw if session cannot be refreshed (network or service error) or return null if not available\n const tokens = await this.getTokens(options);\n if (tokens) {\n userSub = tokens.accessToken?.payload?.sub;\n // getCredentialsAndIdentityId will throw if cannot get credentials (network or service error)\n credentialsAndIdentityId =\n await this.authOptions?.credentialsProvider?.getCredentialsAndIdentityId({\n authConfig: this.authConfig,\n tokens,\n authenticated: true,\n forceRefresh: options.forceRefresh,\n });\n }\n else {\n // getCredentialsAndIdentityId will throw if cannot get credentials (network or service error)\n credentialsAndIdentityId =\n await this.authOptions?.credentialsProvider?.getCredentialsAndIdentityId({\n authConfig: this.authConfig,\n authenticated: false,\n forceRefresh: options.forceRefresh,\n });\n }\n return {\n tokens,\n credentials: credentialsAndIdentityId?.credentials,\n identityId: credentialsAndIdentityId?.identityId,\n userSub,\n };\n }\n async clearCredentials() {\n await this.authOptions?.credentialsProvider?.clearCredentialsAndIdentityId();\n }\n async getTokens(options) {\n return ((await this.authOptions?.tokenProvider?.getTokens(options)) ?? undefined);\n }\n}\nexports.AuthClass = AuthClass;\nconst getCustomEndpointWarningMessage = (target) => `You are using a custom Amazon ${target} endpoint, ensure the endpoint is correct.`;\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,SAAS,GAAG,MAAM;AAC1B;AACA;AACA,MAAM,QAAQ,GAAG,OAAO,CAAC,cAAc,CAAC;AACxC,MAAM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AAM,IAAI,CAAC,WAAW,EAAE,mBAAmB,EAAE,2BAA2B,CAAC;AACzF,oBAAoB,UAAU,EAAE,IAAI,CAAC,UAAU;AAC/C,oBAAoB,aAAa,EAAE,KAAK;AACxC,oBAAoB,YAAY,EAAE,OAAO,CAAC,YAAY;AACtD,iBAAiB,CAAC;AAClB;AACA,QAAQ,OAAO;AACf,YAAY,MAAM;AAClB,YAAY,WAAW,EAAE,wBAAwB,EAAE,WAAW;AAC9D,YAAY,UAAU,EAAE,wBAAwB,EAAE,UAAU;AAC5D,YAAY,OAAO;AACnB,SAAS;AACT;AACA,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,MAAM,IAAI,CAAC,WAAW,EAAE,mBAAmB,EAAE,6BAA6B,EAAE;AACpF;AACA,IAAI,MAAM,SAAS,CAAC,OAAO,EAAE;AAC7B,QAAQ,QAAQ,CAAC,MAAM,IAAI,CAAC,WAAW,EAAE,aAAa,EAAE,SAAS,CAAC,OAAO,CAAC,KAAK,SAAS;AACxF;AACA;AACA,OAAO,CAAC,SAAS,GAAG,SAAS;AAC7B,MAAM,+BAA+B,GAAG,CAAC,MAAM,KAAK,CAAC,8BAA8B,EAAE,MAAM,CAAC,0CAA0C,CAAC;;"}
@@ -8,8 +8,8 @@ const Amplify_1 = require("../Amplify");
8
8
  const fetchAuthSession_1 = require("./internal/fetchAuthSession");
9
9
  /**
10
10
  * Fetch the auth session including the tokens and credentials if they are available. By default it
11
- * does not refresh the auth tokens or credentials if they are loaded in storage already. You can force a refresh
12
- * with `{ forceRefresh: true }` input.
11
+ * will automatically refresh expired auth tokens if a valid refresh token is present. You can force a refresh
12
+ * of non-expired tokens with `{ forceRefresh: true }` input.
13
13
  *
14
14
  * @param options - Options configuring the fetch behavior.
15
15
  * @throws {@link AuthError} - Throws error when session information cannot be refreshed.
@@ -1 +1 @@
1
- {"version":3,"file":"fetchAuthSession.js","sources":["../../../../src/singleton/apis/fetchAuthSession.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.fetchAuthSession = void 0;\nconst Amplify_1 = require(\"../Amplify\");\nconst fetchAuthSession_1 = require(\"./internal/fetchAuthSession\");\n/**\n * Fetch the auth session including the tokens and credentials if they are available. By default it\n * does not refresh the auth tokens or credentials if they are loaded in storage already. You can force a refresh\n * with `{ forceRefresh: true }` input.\n *\n * @param options - Options configuring the fetch behavior.\n * @throws {@link AuthError} - Throws error when session information cannot be refreshed.\n * @returns Promise<AuthSession>\n */\nconst fetchAuthSession = (options) => {\n return (0, fetchAuthSession_1.fetchAuthSession)(Amplify_1.Amplify, options);\n};\nexports.fetchAuthSession = fetchAuthSession;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,gBAAgB,GAAG,MAAM;AACjC,MAAM,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC;AACvC,MAAM,kBAAkB,GAAG,OAAO,CAAC,6BAA6B,CAAC;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,gBAAgB,GAAG,CAAC,OAAO,KAAK;AACtC,IAAI,OAAO,IAAI,kBAAkB,CAAC,gBAAgB,EAAE,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC;AAC/E,CAAC;AACD,OAAO,CAAC,gBAAgB,GAAG,gBAAgB;;"}
1
+ {"version":3,"file":"fetchAuthSession.js","sources":["../../../../src/singleton/apis/fetchAuthSession.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.fetchAuthSession = void 0;\nconst Amplify_1 = require(\"../Amplify\");\nconst fetchAuthSession_1 = require(\"./internal/fetchAuthSession\");\n/**\n * Fetch the auth session including the tokens and credentials if they are available. By default it\n * will automatically refresh expired auth tokens if a valid refresh token is present. You can force a refresh\n * of non-expired tokens with `{ forceRefresh: true }` input.\n *\n * @param options - Options configuring the fetch behavior.\n * @throws {@link AuthError} - Throws error when session information cannot be refreshed.\n * @returns Promise<AuthSession>\n */\nconst fetchAuthSession = (options) => {\n return (0, fetchAuthSession_1.fetchAuthSession)(Amplify_1.Amplify, options);\n};\nexports.fetchAuthSession = fetchAuthSession;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,gBAAgB,GAAG,MAAM;AACjC,MAAM,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC;AACvC,MAAM,kBAAkB,GAAG,OAAO,CAAC,6BAA6B,CAAC;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,gBAAgB,GAAG,CAAC,OAAO,KAAK;AACtC,IAAI,OAAO,IAAI,kBAAkB,CAAC,gBAAgB,EAAE,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC;AAC/E,CAAC;AACD,OAAO,CAAC,gBAAgB,GAAG,gBAAgB;;"}
@@ -1 +1 @@
1
- export declare const version = "6.15.3";
1
+ export declare const version = "6.15.4-unstable.b29d394.0+b29d394";
@@ -1,5 +1,5 @@
1
1
  // generated by genversion
2
- const version = '6.15.3';
2
+ const version = '6.15.4-unstable.b29d394.0+b29d394';
3
3
 
4
4
  export { version };
5
5
  //# sourceMappingURL=version.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.mjs","sources":["../../../src/Platform/version.ts"],"sourcesContent":["// generated by genversion\nexport const version = '6.15.3';\n"],"names":[],"mappings":"AAAA;AACY,MAAC,OAAO,GAAG;;;;"}
1
+ {"version":3,"file":"version.mjs","sources":["../../../src/Platform/version.ts"],"sourcesContent":["// generated by genversion\nexport const version = '6.15.4-unstable.b29d394.0+b29d394';\n"],"names":[],"mappings":"AAAA;AACY,MAAC,OAAO,GAAG;;;;"}
@@ -5,7 +5,7 @@ import { withMemoization } from '../utils/memoization.mjs';
5
5
 
6
6
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
7
7
  // SPDX-License-Identifier: Apache-2.0
8
- const shouldSendBody = (method) => !['HEAD', 'GET', 'DELETE'].includes(method.toUpperCase());
8
+ const shouldSendBody = (method) => !['HEAD', 'GET'].includes(method.toUpperCase());
9
9
  // TODO[AllanZhengYP]: we need to provide isCanceledError utility
10
10
  const fetchTransferHandler = async ({ url, method, headers, body }, { abortSignal, cache, withCrossDomainCredentials }) => {
11
11
  let resp;
@@ -1 +1 @@
1
- {"version":3,"file":"fetch.mjs","sources":["../../../../src/clients/handlers/fetch.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AmplifyError } from '../../errors';\nimport { withMemoization } from '../utils/memoization';\nimport { AmplifyErrorCode } from '../../types';\nconst shouldSendBody = (method) => !['HEAD', 'GET', 'DELETE'].includes(method.toUpperCase());\n// TODO[AllanZhengYP]: we need to provide isCanceledError utility\nexport const fetchTransferHandler = async ({ url, method, headers, body }, { abortSignal, cache, withCrossDomainCredentials }) => {\n let resp;\n try {\n resp = await fetch(url, {\n method,\n headers,\n body: shouldSendBody(method) ? body : undefined,\n signal: abortSignal,\n cache,\n credentials: withCrossDomainCredentials ? 'include' : 'same-origin',\n });\n }\n catch (e) {\n if (e instanceof TypeError) {\n throw new AmplifyError({\n name: AmplifyErrorCode.NetworkError,\n message: 'A network error has occurred.',\n underlyingError: e,\n });\n }\n throw e;\n }\n const responseHeaders = {};\n resp.headers?.forEach((value, key) => {\n responseHeaders[key.toLowerCase()] = value;\n });\n const httpResponse = {\n statusCode: resp.status,\n headers: responseHeaders,\n body: null,\n };\n // resp.body is a ReadableStream according to Fetch API spec, but React Native\n // does not implement it.\n const bodyWithMixin = Object.assign(resp.body ?? {}, {\n text: withMemoization(() => resp.text()),\n blob: withMemoization(() => resp.blob()),\n json: withMemoization(() => resp.json()),\n });\n return {\n ...httpResponse,\n body: bodyWithMixin,\n };\n};\n"],"names":[],"mappings":";;;;;AAAA;AACA;AAIA,MAAM,cAAc,GAAG,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;AAC5F;AACY,MAAC,oBAAoB,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,0BAA0B,EAAE,KAAK;AAClI,IAAI,IAAI,IAAI;AACZ,IAAI,IAAI;AACR,QAAQ,IAAI,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;AAChC,YAAY,MAAM;AAClB,YAAY,OAAO;AACnB,YAAY,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,SAAS;AAC3D,YAAY,MAAM,EAAE,WAAW;AAC/B,YAAY,KAAK;AACjB,YAAY,WAAW,EAAE,0BAA0B,GAAG,SAAS,GAAG,aAAa;AAC/E,SAAS,CAAC;AACV;AACA,IAAI,OAAO,CAAC,EAAE;AACd,QAAQ,IAAI,CAAC,YAAY,SAAS,EAAE;AACpC,YAAY,MAAM,IAAI,YAAY,CAAC;AACnC,gBAAgB,IAAI,EAAE,gBAAgB,CAAC,YAAY;AACnD,gBAAgB,OAAO,EAAE,+BAA+B;AACxD,gBAAgB,eAAe,EAAE,CAAC;AAClC,aAAa,CAAC;AACd;AACA,QAAQ,MAAM,CAAC;AACf;AACA,IAAI,MAAM,eAAe,GAAG,EAAE;AAC9B,IAAI,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AAC1C,QAAQ,eAAe,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,GAAG,KAAK;AAClD,KAAK,CAAC;AACN,IAAI,MAAM,YAAY,GAAG;AACzB,QAAQ,UAAU,EAAE,IAAI,CAAC,MAAM;AAC/B,QAAQ,OAAO,EAAE,eAAe;AAChC,QAAQ,IAAI,EAAE,IAAI;AAClB,KAAK;AACL;AACA;AACA,IAAI,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,EAAE;AACzD,QAAQ,IAAI,EAAE,eAAe,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;AAChD,QAAQ,IAAI,EAAE,eAAe,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;AAChD,QAAQ,IAAI,EAAE,eAAe,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;AAChD,KAAK,CAAC;AACN,IAAI,OAAO;AACX,QAAQ,GAAG,YAAY;AACvB,QAAQ,IAAI,EAAE,aAAa;AAC3B,KAAK;AACL;;;;"}
1
+ {"version":3,"file":"fetch.mjs","sources":["../../../../src/clients/handlers/fetch.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AmplifyError } from '../../errors';\nimport { withMemoization } from '../utils/memoization';\nimport { AmplifyErrorCode } from '../../types';\nconst shouldSendBody = (method) => !['HEAD', 'GET'].includes(method.toUpperCase());\n// TODO[AllanZhengYP]: we need to provide isCanceledError utility\nexport const fetchTransferHandler = async ({ url, method, headers, body }, { abortSignal, cache, withCrossDomainCredentials }) => {\n let resp;\n try {\n resp = await fetch(url, {\n method,\n headers,\n body: shouldSendBody(method) ? body : undefined,\n signal: abortSignal,\n cache,\n credentials: withCrossDomainCredentials ? 'include' : 'same-origin',\n });\n }\n catch (e) {\n if (e instanceof TypeError) {\n throw new AmplifyError({\n name: AmplifyErrorCode.NetworkError,\n message: 'A network error has occurred.',\n underlyingError: e,\n });\n }\n throw e;\n }\n const responseHeaders = {};\n resp.headers?.forEach((value, key) => {\n responseHeaders[key.toLowerCase()] = value;\n });\n const httpResponse = {\n statusCode: resp.status,\n headers: responseHeaders,\n body: null,\n };\n // resp.body is a ReadableStream according to Fetch API spec, but React Native\n // does not implement it.\n const bodyWithMixin = Object.assign(resp.body ?? {}, {\n text: withMemoization(() => resp.text()),\n blob: withMemoization(() => resp.blob()),\n json: withMemoization(() => resp.json()),\n });\n return {\n ...httpResponse,\n body: bodyWithMixin,\n };\n};\n"],"names":[],"mappings":";;;;;AAAA;AACA;AAIA,MAAM,cAAc,GAAG,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;AAClF;AACY,MAAC,oBAAoB,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,0BAA0B,EAAE,KAAK;AAClI,IAAI,IAAI,IAAI;AACZ,IAAI,IAAI;AACR,QAAQ,IAAI,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;AAChC,YAAY,MAAM;AAClB,YAAY,OAAO;AACnB,YAAY,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,SAAS;AAC3D,YAAY,MAAM,EAAE,WAAW;AAC/B,YAAY,KAAK;AACjB,YAAY,WAAW,EAAE,0BAA0B,GAAG,SAAS,GAAG,aAAa;AAC/E,SAAS,CAAC;AACV;AACA,IAAI,OAAO,CAAC,EAAE;AACd,QAAQ,IAAI,CAAC,YAAY,SAAS,EAAE;AACpC,YAAY,MAAM,IAAI,YAAY,CAAC;AACnC,gBAAgB,IAAI,EAAE,gBAAgB,CAAC,YAAY;AACnD,gBAAgB,OAAO,EAAE,+BAA+B;AACxD,gBAAgB,eAAe,EAAE,CAAC;AAClC,aAAa,CAAC;AACd;AACA,QAAQ,MAAM,CAAC;AACf;AACA,IAAI,MAAM,eAAe,GAAG,EAAE;AAC9B,IAAI,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AAC1C,QAAQ,eAAe,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,GAAG,KAAK;AAClD,KAAK,CAAC;AACN,IAAI,MAAM,YAAY,GAAG;AACzB,QAAQ,UAAU,EAAE,IAAI,CAAC,MAAM;AAC/B,QAAQ,OAAO,EAAE,eAAe;AAChC,QAAQ,IAAI,EAAE,IAAI;AAClB,KAAK;AACL;AACA;AACA,IAAI,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,EAAE;AACzD,QAAQ,IAAI,EAAE,eAAe,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;AAChD,QAAQ,IAAI,EAAE,eAAe,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;AAChD,QAAQ,IAAI,EAAE,eAAe,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;AAChD,KAAK,CAAC;AACN,IAAI,OAAO;AACX,QAAQ,GAAG,YAAY;AACvB,QAAQ,IAAI,EAAE,aAAa;AAC3B,KAAK;AACL;;;;"}
@@ -15,8 +15,8 @@ export declare class AuthClass {
15
15
  configure(authResourcesConfig: AuthConfig, authOptions?: LibraryAuthOptions): void;
16
16
  /**
17
17
  * Fetch the auth tokens, and the temporary AWS credentials and identity if they are configured. By default it
18
- * does not refresh the auth tokens or credentials if they are loaded in storage already. You can force a refresh
19
- * with `{ forceRefresh: true }` input.
18
+ * will automatically refresh expired auth tokens if a valid refresh token is present. You can force a refresh
19
+ * of non-expired tokens with `{ forceRefresh: true }` input.
20
20
  *
21
21
  * @param options - Options configuring the fetch behavior.
22
22
  *
@@ -27,8 +27,8 @@ class AuthClass {
27
27
  }
28
28
  /**
29
29
  * Fetch the auth tokens, and the temporary AWS credentials and identity if they are configured. By default it
30
- * does not refresh the auth tokens or credentials if they are loaded in storage already. You can force a refresh
31
- * with `{ forceRefresh: true }` input.
30
+ * will automatically refresh expired auth tokens if a valid refresh token is present. You can force a refresh
31
+ * of non-expired tokens with `{ forceRefresh: true }` input.
32
32
  *
33
33
  * @param options - Options configuring the fetch behavior.
34
34
  *
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../../../src/singleton/Auth/index.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ConsoleLogger } from '../../Logger';\nconst logger = new ConsoleLogger('Auth');\nexport class AuthClass {\n /**\n * Configure Auth category\n *\n * @internal\n *\n * @param authResourcesConfig - Resources configurations required by Auth providers.\n * @param authOptions - Client options used by library\n *\n * @returns void\n */\n configure(authResourcesConfig, authOptions) {\n this.authConfig = authResourcesConfig;\n this.authOptions = authOptions;\n if (authResourcesConfig && authResourcesConfig.Cognito?.userPoolEndpoint) {\n logger.warn(getCustomEndpointWarningMessage('Amazon Cognito User Pool'));\n }\n if (authResourcesConfig &&\n authResourcesConfig.Cognito?.identityPoolEndpoint) {\n logger.warn(getCustomEndpointWarningMessage('Amazon Cognito Identity Pool'));\n }\n }\n /**\n * Fetch the auth tokens, and the temporary AWS credentials and identity if they are configured. By default it\n * does not refresh the auth tokens or credentials if they are loaded in storage already. You can force a refresh\n * with `{ forceRefresh: true }` input.\n *\n * @param options - Options configuring the fetch behavior.\n *\n * @returns Promise of current auth session {@link AuthSession}.\n */\n async fetchAuthSession(options = {}) {\n let credentialsAndIdentityId;\n let userSub;\n // Get tokens will throw if session cannot be refreshed (network or service error) or return null if not available\n const tokens = await this.getTokens(options);\n if (tokens) {\n userSub = tokens.accessToken?.payload?.sub;\n // getCredentialsAndIdentityId will throw if cannot get credentials (network or service error)\n credentialsAndIdentityId =\n await this.authOptions?.credentialsProvider?.getCredentialsAndIdentityId({\n authConfig: this.authConfig,\n tokens,\n authenticated: true,\n forceRefresh: options.forceRefresh,\n });\n }\n else {\n // getCredentialsAndIdentityId will throw if cannot get credentials (network or service error)\n credentialsAndIdentityId =\n await this.authOptions?.credentialsProvider?.getCredentialsAndIdentityId({\n authConfig: this.authConfig,\n authenticated: false,\n forceRefresh: options.forceRefresh,\n });\n }\n return {\n tokens,\n credentials: credentialsAndIdentityId?.credentials,\n identityId: credentialsAndIdentityId?.identityId,\n userSub,\n };\n }\n async clearCredentials() {\n await this.authOptions?.credentialsProvider?.clearCredentialsAndIdentityId();\n }\n async getTokens(options) {\n return ((await this.authOptions?.tokenProvider?.getTokens(options)) ?? undefined);\n }\n}\nconst getCustomEndpointWarningMessage = (target) => `You are using a custom Amazon ${target} endpoint, ensure the endpoint is correct.`;\n"],"names":[],"mappings":";;AAAA;AACA;AAEA,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,MAAM,CAAC;AACjC,MAAM,SAAS,CAAC;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,mBAAmB,EAAE,WAAW,EAAE;AAChD,QAAQ,IAAI,CAAC,UAAU,GAAG,mBAAmB;AAC7C,QAAQ,IAAI,CAAC,WAAW,GAAG,WAAW;AACtC,QAAQ,IAAI,mBAAmB,IAAI,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,EAAE;AAClF,YAAY,MAAM,CAAC,IAAI,CAAC,+BAA+B,CAAC,0BAA0B,CAAC,CAAC;AACpF;AACA,QAAQ,IAAI,mBAAmB;AAC/B,YAAY,mBAAmB,CAAC,OAAO,EAAE,oBAAoB,EAAE;AAC/D,YAAY,MAAM,CAAC,IAAI,CAAC,+BAA+B,CAAC,8BAA8B,CAAC,CAAC;AACxF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,MAAM,gBAAgB,CAAC,OAAO,GAAG,EAAE,EAAE;AACzC,QAAQ,IAAI,wBAAwB;AACpC,QAAQ,IAAI,OAAO;AACn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"version":3,"file":"index.mjs","sources":["../../../../src/singleton/Auth/index.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ConsoleLogger } from '../../Logger';\nconst logger = new ConsoleLogger('Auth');\nexport class AuthClass {\n /**\n * Configure Auth category\n *\n * @internal\n *\n * @param authResourcesConfig - Resources configurations required by Auth providers.\n * @param authOptions - Client options used by library\n *\n * @returns void\n */\n configure(authResourcesConfig, authOptions) {\n this.authConfig = authResourcesConfig;\n this.authOptions = authOptions;\n if (authResourcesConfig && authResourcesConfig.Cognito?.userPoolEndpoint) {\n logger.warn(getCustomEndpointWarningMessage('Amazon Cognito User Pool'));\n }\n if (authResourcesConfig &&\n authResourcesConfig.Cognito?.identityPoolEndpoint) {\n logger.warn(getCustomEndpointWarningMessage('Amazon Cognito Identity Pool'));\n }\n }\n /**\n * Fetch the auth tokens, and the temporary AWS credentials and identity if they are configured. By default it\n * will automatically refresh expired auth tokens if a valid refresh token is present. You can force a refresh\n * of non-expired tokens with `{ forceRefresh: true }` input.\n *\n * @param options - Options configuring the fetch behavior.\n *\n * @returns Promise of current auth session {@link AuthSession}.\n */\n async fetchAuthSession(options = {}) {\n let credentialsAndIdentityId;\n let userSub;\n // Get tokens will throw if session cannot be refreshed (network or service error) or return null if not available\n const tokens = await this.getTokens(options);\n if (tokens) {\n userSub = tokens.accessToken?.payload?.sub;\n // getCredentialsAndIdentityId will throw if cannot get credentials (network or service error)\n credentialsAndIdentityId =\n await this.authOptions?.credentialsProvider?.getCredentialsAndIdentityId({\n authConfig: this.authConfig,\n tokens,\n authenticated: true,\n forceRefresh: options.forceRefresh,\n });\n }\n else {\n // getCredentialsAndIdentityId will throw if cannot get credentials (network or service error)\n credentialsAndIdentityId =\n await this.authOptions?.credentialsProvider?.getCredentialsAndIdentityId({\n authConfig: this.authConfig,\n authenticated: false,\n forceRefresh: options.forceRefresh,\n });\n }\n return {\n tokens,\n credentials: credentialsAndIdentityId?.credentials,\n identityId: credentialsAndIdentityId?.identityId,\n userSub,\n };\n }\n async clearCredentials() {\n await this.authOptions?.credentialsProvider?.clearCredentialsAndIdentityId();\n }\n async getTokens(options) {\n return ((await this.authOptions?.tokenProvider?.getTokens(options)) ?? undefined);\n }\n}\nconst getCustomEndpointWarningMessage = (target) => `You are using a custom Amazon ${target} endpoint, ensure the endpoint is correct.`;\n"],"names":[],"mappings":";;AAAA;AACA;AAEA,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,MAAM,CAAC;AACjC,MAAM,SAAS,CAAC;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,mBAAmB,EAAE,WAAW,EAAE;AAChD,QAAQ,IAAI,CAAC,UAAU,GAAG,mBAAmB;AAC7C,QAAQ,IAAI,CAAC,WAAW,GAAG,WAAW;AACtC,QAAQ,IAAI,mBAAmB,IAAI,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,EAAE;AAClF,YAAY,MAAM,CAAC,IAAI,CAAC,+BAA+B,CAAC,0BAA0B,CAAC,CAAC;AACpF;AACA,QAAQ,IAAI,mBAAmB;AAC/B,YAAY,mBAAmB,CAAC,OAAO,EAAE,oBAAoB,EAAE;AAC/D,YAAY,MAAM,CAAC,IAAI,CAAC,+BAA+B,CAAC,8BAA8B,CAAC,CAAC;AACxF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,MAAM,gBAAgB,CAAC,OAAO,GAAG,EAAE,EAAE;AACzC,QAAQ,IAAI,wBAAwB;AACpC,QAAQ,IAAI,OAAO;AACnB;AACA,QAAQ,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;AACpD,QAAQ,IAAI,MAAM,EAAE;AACpB,YAAY,OAAO,GAAG,MAAM,CAAC,WAAW,EAAE,OAAO,EAAE,GAAG;AACtD;AACA,YAAY,wBAAwB;AACpC,gBAAgB,MAAM,IAAI,CAAC,WAAW,EAAE,mBAAmB,EAAE,2BAA2B,CAAC;AACzF,oBAAoB,UAAU,EAAE,IAAI,CAAC,UAAU;AAC/C,oBAAoB,MAAM;AAC1B,oBAAoB,aAAa,EAAE,IAAI;AACvC,oBAAoB,YAAY,EAAE,OAAO,CAAC,YAAY;AACtD,iBAAiB,CAAC;AAClB;AACA,aAAa;AACb;AACA,YAAY,wBAAwB;AACpC,gBAAgB,MAAM,IAAI,CAAC,WAAW,EAAE,mBAAmB,EAAE,2BAA2B,CAAC;AACzF,oBAAoB,UAAU,EAAE,IAAI,CAAC,UAAU;AAC/C,oBAAoB,aAAa,EAAE,KAAK;AACxC,oBAAoB,YAAY,EAAE,OAAO,CAAC,YAAY;AACtD,iBAAiB,CAAC;AAClB;AACA,QAAQ,OAAO;AACf,YAAY,MAAM;AAClB,YAAY,WAAW,EAAE,wBAAwB,EAAE,WAAW;AAC9D,YAAY,UAAU,EAAE,wBAAwB,EAAE,UAAU;AAC5D,YAAY,OAAO;AACnB,SAAS;AACT;AACA,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,MAAM,IAAI,CAAC,WAAW,EAAE,mBAAmB,EAAE,6BAA6B,EAAE;AACpF;AACA,IAAI,MAAM,SAAS,CAAC,OAAO,EAAE;AAC7B,QAAQ,QAAQ,CAAC,MAAM,IAAI,CAAC,WAAW,EAAE,aAAa,EAAE,SAAS,CAAC,OAAO,CAAC,KAAK,SAAS;AACxF;AACA;AACA,MAAM,+BAA+B,GAAG,CAAC,MAAM,KAAK,CAAC,8BAA8B,EAAE,MAAM,CAAC,0CAA0C,CAAC;;;;"}
@@ -1,8 +1,8 @@
1
1
  import { AuthSession, FetchAuthSessionOptions } from '../Auth/types';
2
2
  /**
3
3
  * Fetch the auth session including the tokens and credentials if they are available. By default it
4
- * does not refresh the auth tokens or credentials if they are loaded in storage already. You can force a refresh
5
- * with `{ forceRefresh: true }` input.
4
+ * will automatically refresh expired auth tokens if a valid refresh token is present. You can force a refresh
5
+ * of non-expired tokens with `{ forceRefresh: true }` input.
6
6
  *
7
7
  * @param options - Options configuring the fetch behavior.
8
8
  * @throws {@link AuthError} - Throws error when session information cannot be refreshed.
@@ -5,8 +5,8 @@ import { fetchAuthSession as fetchAuthSession$1 } from './internal/fetchAuthSess
5
5
  // SPDX-License-Identifier: Apache-2.0
6
6
  /**
7
7
  * Fetch the auth session including the tokens and credentials if they are available. By default it
8
- * does not refresh the auth tokens or credentials if they are loaded in storage already. You can force a refresh
9
- * with `{ forceRefresh: true }` input.
8
+ * will automatically refresh expired auth tokens if a valid refresh token is present. You can force a refresh
9
+ * of non-expired tokens with `{ forceRefresh: true }` input.
10
10
  *
11
11
  * @param options - Options configuring the fetch behavior.
12
12
  * @throws {@link AuthError} - Throws error when session information cannot be refreshed.
@@ -1 +1 @@
1
- {"version":3,"file":"fetchAuthSession.mjs","sources":["../../../../src/singleton/apis/fetchAuthSession.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Amplify } from '../Amplify';\nimport { fetchAuthSession as fetchAuthSessionInternal } from './internal/fetchAuthSession';\n/**\n * Fetch the auth session including the tokens and credentials if they are available. By default it\n * does not refresh the auth tokens or credentials if they are loaded in storage already. You can force a refresh\n * with `{ forceRefresh: true }` input.\n *\n * @param options - Options configuring the fetch behavior.\n * @throws {@link AuthError} - Throws error when session information cannot be refreshed.\n * @returns Promise<AuthSession>\n */\nexport const fetchAuthSession = (options) => {\n return fetchAuthSessionInternal(Amplify, options);\n};\n"],"names":["fetchAuthSessionInternal"],"mappings":";;;AAAA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,gBAAgB,GAAG,CAAC,OAAO,KAAK;AAC7C,IAAI,OAAOA,kBAAwB,CAAC,OAAO,EAAE,OAAO,CAAC;AACrD;;;;"}
1
+ {"version":3,"file":"fetchAuthSession.mjs","sources":["../../../../src/singleton/apis/fetchAuthSession.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Amplify } from '../Amplify';\nimport { fetchAuthSession as fetchAuthSessionInternal } from './internal/fetchAuthSession';\n/**\n * Fetch the auth session including the tokens and credentials if they are available. By default it\n * will automatically refresh expired auth tokens if a valid refresh token is present. You can force a refresh\n * of non-expired tokens with `{ forceRefresh: true }` input.\n *\n * @param options - Options configuring the fetch behavior.\n * @throws {@link AuthError} - Throws error when session information cannot be refreshed.\n * @returns Promise<AuthSession>\n */\nexport const fetchAuthSession = (options) => {\n return fetchAuthSessionInternal(Amplify, options);\n};\n"],"names":["fetchAuthSessionInternal"],"mappings":";;;AAAA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,gBAAgB,GAAG,CAAC,OAAO,KAAK;AAC7C,IAAI,OAAOA,kBAAwB,CAAC,OAAO,EAAE,OAAO,CAAC;AACrD;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/core",
3
- "version": "6.12.3",
3
+ "version": "6.12.4-unstable.b29d394.0+b29d394",
4
4
  "description": "Core category of aws-amplify",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.mjs",
@@ -60,7 +60,7 @@
60
60
  "uuid": "^11.0.0"
61
61
  },
62
62
  "devDependencies": {
63
- "@aws-amplify/react-native": "1.1.10",
63
+ "@aws-amplify/react-native": "1.1.11-unstable.b29d394.0+b29d394",
64
64
  "@types/js-cookie": "3.0.2",
65
65
  "genversion": "^2.2.0"
66
66
  },
@@ -191,5 +191,5 @@
191
191
  ]
192
192
  }
193
193
  },
194
- "gitHead": "f2a10cf2825ed2984e596f1ee7771b30cf61101e"
194
+ "gitHead": "b29d394cb53e5ed80c465136c010bc8c84636bf4"
195
195
  }
@@ -1,2 +1,2 @@
1
1
  // generated by genversion
2
- export const version = '6.15.3';
2
+ export const version = '6.15.4-unstable.b29d394.0+b29d394';
@@ -8,7 +8,7 @@ import { withMemoization } from '../utils/memoization';
8
8
  import { AmplifyErrorCode } from '../../types';
9
9
 
10
10
  const shouldSendBody = (method: string) =>
11
- !['HEAD', 'GET', 'DELETE'].includes(method.toUpperCase());
11
+ !['HEAD', 'GET'].includes(method.toUpperCase());
12
12
 
13
13
  // TODO[AllanZhengYP]: we need to provide isCanceledError utility
14
14
  export const fetchTransferHandler: TransferHandler<
@@ -49,8 +49,8 @@ export class AuthClass {
49
49
 
50
50
  /**
51
51
  * Fetch the auth tokens, and the temporary AWS credentials and identity if they are configured. By default it
52
- * does not refresh the auth tokens or credentials if they are loaded in storage already. You can force a refresh
53
- * with `{ forceRefresh: true }` input.
52
+ * will automatically refresh expired auth tokens if a valid refresh token is present. You can force a refresh
53
+ * of non-expired tokens with `{ forceRefresh: true }` input.
54
54
  *
55
55
  * @param options - Options configuring the fetch behavior.
56
56
  *
@@ -8,8 +8,8 @@ import { fetchAuthSession as fetchAuthSessionInternal } from './internal/fetchAu
8
8
 
9
9
  /**
10
10
  * Fetch the auth session including the tokens and credentials if they are available. By default it
11
- * does not refresh the auth tokens or credentials if they are loaded in storage already. You can force a refresh
12
- * with `{ forceRefresh: true }` input.
11
+ * will automatically refresh expired auth tokens if a valid refresh token is present. You can force a refresh
12
+ * of non-expired tokens with `{ forceRefresh: true }` input.
13
13
  *
14
14
  * @param options - Options configuring the fetch behavior.
15
15
  * @throws {@link AuthError} - Throws error when session information cannot be refreshed.