@aws-amplify/core 6.0.1-console-preview.7739091.0 → 6.0.1-console-preview.4432977.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/lib/AwsClients/CognitoIdentity/base.d.ts +12 -4
  2. package/lib/AwsClients/CognitoIdentity/base.js +1 -0
  3. package/lib/AwsClients/CognitoIdentity/getCredentialsForIdentity.d.ts +15 -3
  4. package/lib/AwsClients/CognitoIdentity/getId.d.ts +15 -3
  5. package/lib/AwsClients/Pinpoint/base.d.ts +10 -2
  6. package/lib/AwsClients/Pinpoint/getInAppMessages.d.ts +17 -3
  7. package/lib/AwsClients/Pinpoint/putEvents.d.ts +17 -3
  8. package/lib/AwsClients/Pinpoint/updateEndpoint.d.ts +17 -3
  9. package/lib/Platform/version.d.ts +1 -1
  10. package/lib/Platform/version.js +1 -1
  11. package/lib/clients/handlers/authenticated.d.ts +1 -1
  12. package/lib/clients/handlers/fetch.js +2 -1
  13. package/lib/clients/handlers/unauthenticated.d.ts +1 -1
  14. package/lib/clients/internal/composeServiceApi.d.ts +5 -3
  15. package/lib/clients/types/aws.d.ts +1 -5
  16. package/lib/clients/types/http.d.ts +8 -0
  17. package/lib/clients/types/index.d.ts +1 -1
  18. package/lib/index.d.ts +0 -1
  19. package/lib/index.js +1 -3
  20. package/lib/libraryUtils.d.ts +4 -2
  21. package/lib/libraryUtils.js +4 -6
  22. package/lib/providers/pinpoint/types/buffer.d.ts +1 -1
  23. package/lib/providers/pinpoint/types/pinpoint.d.ts +1 -1
  24. package/lib/providers/pinpoint/utils/PinpointEventBuffer.js +7 -5
  25. package/lib/providers/pinpoint/utils/isAppInForeground.d.ts +1 -0
  26. package/lib/{RNComponents → providers/pinpoint/utils}/isAppInForeground.js +1 -4
  27. package/lib/providers/pinpoint/utils/isAppInForeground.native.d.ts +1 -0
  28. package/lib/providers/pinpoint/utils/isAppInForeground.native.js +9 -0
  29. package/lib/singleton/API/types.d.ts +5 -4
  30. package/lib/singleton/Amplify.d.ts +2 -2
  31. package/lib/singleton/Amplify.js +9 -1
  32. package/lib/singleton/Auth/index.d.ts +2 -1
  33. package/lib/singleton/Auth/index.js +22 -12
  34. package/lib/singleton/Auth/types.d.ts +1 -1
  35. package/lib/singleton/Auth/utils/index.js +3 -3
  36. package/lib/singleton/types.d.ts +6 -0
  37. package/lib/tsconfig.tsbuildinfo +1 -1
  38. package/lib-esm/AwsClients/CognitoIdentity/base.d.ts +12 -4
  39. package/lib-esm/AwsClients/CognitoIdentity/base.js +1 -0
  40. package/lib-esm/AwsClients/CognitoIdentity/getCredentialsForIdentity.d.ts +15 -3
  41. package/lib-esm/AwsClients/CognitoIdentity/getId.d.ts +15 -3
  42. package/lib-esm/AwsClients/Pinpoint/base.d.ts +10 -2
  43. package/lib-esm/AwsClients/Pinpoint/getInAppMessages.d.ts +17 -3
  44. package/lib-esm/AwsClients/Pinpoint/putEvents.d.ts +17 -3
  45. package/lib-esm/AwsClients/Pinpoint/updateEndpoint.d.ts +17 -3
  46. package/lib-esm/Platform/version.d.ts +1 -1
  47. package/lib-esm/Platform/version.js +1 -1
  48. package/lib-esm/clients/handlers/authenticated.d.ts +1 -1
  49. package/lib-esm/clients/handlers/fetch.js +2 -1
  50. package/lib-esm/clients/handlers/unauthenticated.d.ts +1 -1
  51. package/lib-esm/clients/internal/composeServiceApi.d.ts +5 -3
  52. package/lib-esm/clients/types/aws.d.ts +1 -5
  53. package/lib-esm/clients/types/http.d.ts +8 -0
  54. package/lib-esm/clients/types/index.d.ts +1 -1
  55. package/lib-esm/index.d.ts +0 -1
  56. package/lib-esm/index.js +0 -1
  57. package/lib-esm/libraryUtils.d.ts +4 -2
  58. package/lib-esm/libraryUtils.js +1 -1
  59. package/lib-esm/providers/pinpoint/types/buffer.d.ts +1 -1
  60. package/lib-esm/providers/pinpoint/types/pinpoint.d.ts +1 -1
  61. package/lib-esm/providers/pinpoint/utils/PinpointEventBuffer.js +7 -5
  62. package/lib-esm/providers/pinpoint/utils/isAppInForeground.js +3 -0
  63. package/lib-esm/providers/pinpoint/utils/isAppInForeground.native.js +5 -0
  64. package/lib-esm/singleton/API/types.d.ts +5 -4
  65. package/lib-esm/singleton/Amplify.d.ts +2 -2
  66. package/lib-esm/singleton/Amplify.js +9 -1
  67. package/lib-esm/singleton/Auth/index.d.ts +2 -1
  68. package/lib-esm/singleton/Auth/index.js +22 -12
  69. package/lib-esm/singleton/Auth/types.d.ts +1 -1
  70. package/lib-esm/singleton/Auth/utils/index.js +3 -3
  71. package/lib-esm/singleton/types.d.ts +6 -0
  72. package/lib-esm/tsconfig.tsbuildinfo +1 -1
  73. package/package.json +2 -3
  74. package/src/AwsClients/CognitoIdentity/base.ts +2 -2
  75. package/src/AwsClients/Pinpoint/base.ts +2 -6
  76. package/src/Platform/version.ts +1 -1
  77. package/src/clients/handlers/authenticated.ts +2 -1
  78. package/src/clients/handlers/fetch.ts +2 -1
  79. package/src/clients/handlers/unauthenticated.ts +2 -1
  80. package/src/clients/internal/composeServiceApi.ts +10 -3
  81. package/src/clients/types/aws.ts +4 -11
  82. package/src/clients/types/http.ts +8 -0
  83. package/src/clients/types/index.ts +0 -1
  84. package/src/index.ts +0 -2
  85. package/src/libraryUtils.ts +4 -2
  86. package/src/providers/pinpoint/types/buffer.ts +1 -1
  87. package/src/providers/pinpoint/types/pinpoint.ts +1 -1
  88. package/src/providers/pinpoint/utils/PinpointEventBuffer.ts +16 -12
  89. package/src/providers/pinpoint/utils/isAppInForeground.native.ts +7 -0
  90. package/src/providers/pinpoint/utils/isAppInForeground.ts +4 -0
  91. package/src/singleton/API/types.ts +11 -4
  92. package/src/singleton/Amplify.ts +12 -3
  93. package/src/singleton/Auth/index.ts +9 -2
  94. package/src/singleton/Auth/types.ts +1 -1
  95. package/src/singleton/Auth/utils/index.ts +3 -3
  96. package/src/singleton/types.ts +7 -0
  97. package/lib/RNComponents/index.d.ts +0 -6
  98. package/lib/RNComponents/index.js +0 -16
  99. package/lib/RNComponents/reactnative.d.ts +0 -3
  100. package/lib/RNComponents/reactnative.js +0 -14
  101. package/lib-esm/RNComponents/index.d.ts +0 -6
  102. package/lib-esm/RNComponents/index.js +0 -13
  103. package/lib-esm/RNComponents/isAppInForeground.js +0 -6
  104. package/lib-esm/RNComponents/reactnative.d.ts +0 -3
  105. package/lib-esm/RNComponents/reactnative.js +0 -6
  106. package/src/RNComponents/index.ts +0 -16
  107. package/src/RNComponents/isAppInForeground.ts +0 -8
  108. package/src/RNComponents/reactnative.ts +0 -6
  109. /package/lib-esm/{RNComponents → providers/pinpoint/utils}/isAppInForeground.d.ts +0 -0
  110. /package/{lib/RNComponents/isAppInForeground.d.ts → lib-esm/providers/pinpoint/utils/isAppInForeground.native.d.ts} +0 -0
@@ -1,16 +1,24 @@
1
- import { Endpoint, Headers, HttpRequest, HttpResponse } from '../../clients';
2
- import { DefaultConfigOptions } from '../../clients/types';
1
+ import { Endpoint, EndpointResolverOptions, Headers, HttpRequest, HttpResponse } from '../../clients';
3
2
  /**
4
3
  * A Cognito Identity-specific transfer handler that does NOT sign requests, and
5
4
  * disables caching.
6
5
  *
7
6
  * @internal
8
7
  */
9
- export declare const cognitoIdentityTransferHandler: (request: HttpRequest, options: import("../../clients").UserAgentOptions & import("../../clients").RetryOptions<HttpResponse>) => Promise<HttpResponse>;
8
+ export declare const cognitoIdentityTransferHandler: (request: HttpRequest, options: import("../../clients").UserAgentOptions & import("../../clients").RetryOptions<HttpResponse> & import("../../clients").HttpTransferOptions) => Promise<HttpResponse>;
10
9
  /**
11
10
  * @internal
12
11
  */
13
- export declare const defaultConfig: DefaultConfigOptions;
12
+ export declare const defaultConfig: {
13
+ service: string;
14
+ endpointResolver: ({ region }: EndpointResolverOptions) => {
15
+ url: URL;
16
+ };
17
+ retryDecider: (response?: HttpResponse | undefined, error?: unknown) => Promise<boolean>;
18
+ computeDelay: (attempt: number) => number;
19
+ userAgentValue: string;
20
+ cache: string;
21
+ };
14
22
  /**
15
23
  * @internal
16
24
  */
@@ -86,6 +86,7 @@ exports.defaultConfig = {
86
86
  retryDecider: (0, retry_1.getRetryDecider)(clients_1.parseJsonError),
87
87
  computeDelay: retry_1.jitteredBackoff,
88
88
  userAgentValue: (0, Platform_1.getAmplifyUserAgent)(),
89
+ cache: 'no-store',
89
90
  };
90
91
  (0, detectFramework_1.observeFrameworkChanges)(function () {
91
92
  exports.defaultConfig.userAgentValue = (0, Platform_1.getAmplifyUserAgent)();
@@ -1,9 +1,21 @@
1
- import { HttpResponse } from '../../clients';
1
+ import { Endpoint, HttpResponse } from '../../clients';
2
2
  import type { GetCredentialsForIdentityCommandInput as GetCredentialsForIdentityInput, GetCredentialsForIdentityCommandOutput as GetCredentialsForIdentityOutput } from './types';
3
3
  export type { GetCredentialsForIdentityInput, GetCredentialsForIdentityOutput };
4
4
  /**
5
5
  * @internal
6
6
  */
7
- export declare const getCredentialsForIdentity: (config: Omit<import("../../clients").UserAgentOptions & import("../../clients").RetryOptions<HttpResponse> & import("../../clients").ServiceClientOptions & Partial<Record<string, unknown> & import("../../clients").ServiceClientOptions> & import("../../clients").EndpointResolverOptions, string> & {
8
- [x: string]: unknown;
7
+ export declare const getCredentialsForIdentity: (config: {
8
+ service?: string | undefined;
9
+ endpointResolver?: (((options: import("../../clients").EndpointResolverOptions, input?: any) => Endpoint) & (({ region }: import("../../clients").EndpointResolverOptions) => {
10
+ url: URL;
11
+ })) | undefined;
12
+ retryDecider?: (((response?: HttpResponse | undefined, error?: unknown) => Promise<boolean>) & ((response?: HttpResponse | undefined, error?: unknown) => Promise<boolean>)) | undefined;
13
+ computeDelay?: ((attempt: number) => number) | undefined;
14
+ userAgentValue?: string | undefined;
15
+ cache?: "default" | "force-cache" | "no-cache" | "no-store" | "only-if-cached" | "reload" | undefined;
16
+ } & {
17
+ region: string;
18
+ abortSignal?: AbortSignal | undefined;
19
+ maxAttempts?: number | undefined;
20
+ userAgentHeader?: string | undefined;
9
21
  }, input: GetCredentialsForIdentityInput) => Promise<GetCredentialsForIdentityOutput>;
@@ -1,9 +1,21 @@
1
- import { HttpResponse } from '../../clients';
1
+ import { Endpoint, HttpResponse } from '../../clients';
2
2
  import { GetIdCommandInput as GetIdInput, GetIdCommandOutput as GetIdOutput } from './types';
3
3
  export type { GetIdInput, GetIdOutput };
4
4
  /**
5
5
  * @internal
6
6
  */
7
- export declare const getId: (config: Omit<import("../../clients").UserAgentOptions & import("../../clients").RetryOptions<HttpResponse> & import("../../clients").ServiceClientOptions & Partial<Record<string, unknown> & import("../../clients").ServiceClientOptions> & import("../../clients").EndpointResolverOptions, string> & {
8
- [x: string]: unknown;
7
+ export declare const getId: (config: {
8
+ service?: string | undefined;
9
+ endpointResolver?: (((options: import("../../clients").EndpointResolverOptions, input?: any) => Endpoint) & (({ region }: import("../../clients").EndpointResolverOptions) => {
10
+ url: URL;
11
+ })) | undefined;
12
+ retryDecider?: (((response?: HttpResponse | undefined, error?: unknown) => Promise<boolean>) & ((response?: HttpResponse | undefined, error?: unknown) => Promise<boolean>)) | undefined;
13
+ computeDelay?: ((attempt: number) => number) | undefined;
14
+ userAgentValue?: string | undefined;
15
+ cache?: "default" | "force-cache" | "no-cache" | "no-store" | "only-if-cached" | "reload" | undefined;
16
+ } & {
17
+ region: string;
18
+ abortSignal?: AbortSignal | undefined;
19
+ maxAttempts?: number | undefined;
20
+ userAgentHeader?: string | undefined;
9
21
  }, input: GetIdInput) => Promise<GetIdOutput>;
@@ -1,8 +1,16 @@
1
- import type { DefaultConfigOptions, Headers } from '../../clients/types';
1
+ import type { EndpointResolverOptions, Headers } from '../../clients/types';
2
2
  /**
3
3
  * @internal
4
4
  */
5
- export declare const defaultConfig: DefaultConfigOptions;
5
+ export declare const defaultConfig: {
6
+ service: string;
7
+ endpointResolver: ({ region }: EndpointResolverOptions) => {
8
+ url: URL;
9
+ };
10
+ retryDecider: (response?: import("../../clients/types").HttpResponse | undefined, error?: unknown) => Promise<boolean>;
11
+ computeDelay: (attempt: number) => number;
12
+ userAgentValue: string;
13
+ };
6
14
  /**
7
15
  * @internal
8
16
  */
@@ -1,9 +1,23 @@
1
- import { HttpResponse } from '../../clients/types';
1
+ import { Endpoint, HttpResponse } from '../../clients/types';
2
2
  import type { GetInAppMessagesCommandInput as GetInAppMessagesInput, GetInAppMessagesCommandOutput as GetInAppMessagesOutput } from './types';
3
3
  export type { GetInAppMessagesInput, GetInAppMessagesOutput };
4
4
  /**
5
5
  * @internal
6
6
  */
7
- export declare const getInAppMessages: (config: Omit<import("../../clients").UserAgentOptions & import("../../clients").RetryOptions<HttpResponse> & import("../../clients").SigningOptions & import("../../clients/types").ServiceClientOptions & Partial<Record<string, unknown> & import("../../clients/types").ServiceClientOptions> & import("../../clients/types").EndpointResolverOptions, string> & {
8
- [x: string]: unknown;
7
+ export declare const getInAppMessages: (config: {
8
+ service?: string | undefined;
9
+ endpointResolver?: (((options: import("../../clients/types").EndpointResolverOptions, input?: any) => Endpoint) & (({ region }: import("../../clients/types").EndpointResolverOptions) => {
10
+ url: URL;
11
+ })) | undefined;
12
+ retryDecider?: (((response?: HttpResponse | undefined, error?: unknown) => Promise<boolean>) & ((response?: HttpResponse | undefined, error?: unknown) => Promise<boolean>)) | undefined;
13
+ computeDelay?: ((attempt: number) => number) | undefined;
14
+ userAgentValue?: string | undefined;
15
+ } & {
16
+ uriEscapePath?: boolean | undefined;
17
+ credentials: import("@smithy/types/dist-types/identity/awsCredentialIdentity").AwsCredentialIdentity | (() => Promise<import("@smithy/types/dist-types/identity/awsCredentialIdentity").AwsCredentialIdentity>);
18
+ region: string;
19
+ abortSignal?: AbortSignal | undefined;
20
+ cache?: RequestCache | undefined;
21
+ maxAttempts?: number | undefined;
22
+ userAgentHeader?: string | undefined;
9
23
  }, input: GetInAppMessagesInput) => Promise<GetInAppMessagesOutput>;
@@ -1,9 +1,23 @@
1
- import { HttpResponse } from '../../clients/types';
1
+ import { Endpoint, HttpResponse } from '../../clients/types';
2
2
  import type { PutEventsCommandInput as PutEventsInput, PutEventsCommandOutput as PutEventsOutput } from './types';
3
3
  export type { PutEventsInput, PutEventsOutput };
4
4
  /**
5
5
  * @internal
6
6
  */
7
- export declare const putEvents: (config: Omit<import("../../clients").UserAgentOptions & import("../../clients").RetryOptions<HttpResponse> & import("../../clients").SigningOptions & import("../../clients/types").ServiceClientOptions & Partial<Record<string, unknown> & import("../../clients/types").ServiceClientOptions> & import("../../clients/types").EndpointResolverOptions, string> & {
8
- [x: string]: unknown;
7
+ export declare const putEvents: (config: {
8
+ service?: string | undefined;
9
+ endpointResolver?: (((options: import("../../clients/types").EndpointResolverOptions, input?: any) => Endpoint) & (({ region }: import("../../clients/types").EndpointResolverOptions) => {
10
+ url: URL;
11
+ })) | undefined;
12
+ retryDecider?: (((response?: HttpResponse | undefined, error?: unknown) => Promise<boolean>) & ((response?: HttpResponse | undefined, error?: unknown) => Promise<boolean>)) | undefined;
13
+ computeDelay?: ((attempt: number) => number) | undefined;
14
+ userAgentValue?: string | undefined;
15
+ } & {
16
+ uriEscapePath?: boolean | undefined;
17
+ credentials: import("@smithy/types/dist-types/identity/awsCredentialIdentity").AwsCredentialIdentity | (() => Promise<import("@smithy/types/dist-types/identity/awsCredentialIdentity").AwsCredentialIdentity>);
18
+ region: string;
19
+ abortSignal?: AbortSignal | undefined;
20
+ cache?: RequestCache | undefined;
21
+ maxAttempts?: number | undefined;
22
+ userAgentHeader?: string | undefined;
9
23
  }, input: PutEventsInput) => Promise<PutEventsOutput>;
@@ -1,9 +1,23 @@
1
- import { HttpResponse } from '../../clients/types';
1
+ import { Endpoint, HttpResponse } from '../../clients/types';
2
2
  import type { UpdateEndpointCommandInput as UpdateEndpointInput, UpdateEndpointCommandOutput as UpdateEndpointOutput } from './types';
3
3
  export type { UpdateEndpointInput, UpdateEndpointOutput };
4
4
  /**
5
5
  * @internal
6
6
  */
7
- export declare const updateEndpoint: (config: Omit<import("../../clients").UserAgentOptions & import("../../clients").RetryOptions<HttpResponse> & import("../../clients").SigningOptions & import("../../clients/types").ServiceClientOptions & Partial<Record<string, unknown> & import("../../clients/types").ServiceClientOptions> & import("../../clients/types").EndpointResolverOptions, string> & {
8
- [x: string]: unknown;
7
+ export declare const updateEndpoint: (config: {
8
+ service?: string | undefined;
9
+ endpointResolver?: (((options: import("../../clients/types").EndpointResolverOptions, input?: any) => Endpoint) & (({ region }: import("../../clients/types").EndpointResolverOptions) => {
10
+ url: URL;
11
+ })) | undefined;
12
+ retryDecider?: (((response?: HttpResponse | undefined, error?: unknown) => Promise<boolean>) & ((response?: HttpResponse | undefined, error?: unknown) => Promise<boolean>)) | undefined;
13
+ computeDelay?: ((attempt: number) => number) | undefined;
14
+ userAgentValue?: string | undefined;
15
+ } & {
16
+ uriEscapePath?: boolean | undefined;
17
+ credentials: import("@smithy/types/dist-types/identity/awsCredentialIdentity").AwsCredentialIdentity | (() => Promise<import("@smithy/types/dist-types/identity/awsCredentialIdentity").AwsCredentialIdentity>);
18
+ region: string;
19
+ abortSignal?: AbortSignal | undefined;
20
+ cache?: RequestCache | undefined;
21
+ maxAttempts?: number | undefined;
22
+ userAgentHeader?: string | undefined;
9
23
  }, input: UpdateEndpointInput) => Promise<UpdateEndpointOutput>;
@@ -1 +1 @@
1
- export declare const version = "6.0.1-console-preview.7739091.0+7739091";
1
+ export declare const version = "6.0.1-console-preview.4432977.0+4432977";
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = void 0;
4
4
  // generated by genversion
5
- exports.version = '6.0.1-console-preview.7739091.0+7739091';
5
+ exports.version = '6.0.1-console-preview.4432977.0+4432977';
@@ -2,4 +2,4 @@ import { RetryOptions } from '../middleware/retry';
2
2
  import { SigningOptions } from '../middleware/signing';
3
3
  import { UserAgentOptions } from '../middleware/userAgent';
4
4
  import { HttpRequest, HttpResponse } from '../types';
5
- export declare const authenticatedHandler: (request: HttpRequest, options: UserAgentOptions & RetryOptions<HttpResponse> & SigningOptions) => Promise<HttpResponse>;
5
+ export declare const authenticatedHandler: (request: HttpRequest, options: UserAgentOptions & RetryOptions<HttpResponse> & SigningOptions & import("../types").HttpTransferOptions) => Promise<HttpResponse>;
@@ -57,7 +57,7 @@ var shouldSendBody = function (method) {
57
57
  // TODO[AllanZhengYP]: we need to provide isCanceledError utility
58
58
  var fetchTransferHandler = function (_a, _b) {
59
59
  var url = _a.url, method = _a.method, headers = _a.headers, body = _a.body;
60
- var abortSignal = _b.abortSignal;
60
+ var abortSignal = _b.abortSignal, cache = _b.cache;
61
61
  return __awaiter(void 0, void 0, void 0, function () {
62
62
  var resp, e_1, responseHeaders, httpResponse, bodyWithMixin;
63
63
  var _c, _d;
@@ -70,6 +70,7 @@ var fetchTransferHandler = function (_a, _b) {
70
70
  headers: headers,
71
71
  body: shouldSendBody(method) ? body : undefined,
72
72
  signal: abortSignal,
73
+ cache: cache,
73
74
  })];
74
75
  case 1:
75
76
  resp = _e.sent();
@@ -1,4 +1,4 @@
1
1
  import { RetryOptions } from '../middleware/retry';
2
2
  import { UserAgentOptions } from '../middleware/userAgent';
3
3
  import { HttpRequest, HttpResponse } from '../types';
4
- export declare const unauthenticatedHandler: (request: HttpRequest, options: UserAgentOptions & RetryOptions<HttpResponse>) => Promise<HttpResponse>;
4
+ export declare const unauthenticatedHandler: (request: HttpRequest, options: UserAgentOptions & RetryOptions<HttpResponse> & import("../types").HttpTransferOptions) => Promise<HttpResponse>;
@@ -1,9 +1,11 @@
1
1
  import { ServiceClientOptions } from '../types/aws';
2
2
  import { TransferHandler, Endpoint } from '../types/core';
3
3
  import { HttpRequest, HttpResponse } from '../types/http';
4
- export declare const composeServiceApi: <TransferHandlerOptions, Input, Output, DefaultConfig>(transferHandler: TransferHandler<HttpRequest, HttpResponse, TransferHandlerOptions>, serializer: (input: Input, endpoint: Endpoint) => Promise<HttpRequest> | HttpRequest, deserializer: (output: HttpResponse) => Promise<Output>, defaultConfig: Partial<DefaultConfig>) => (config: OptionalizeKey<TransferHandlerOptions & ServiceClientOptions & Partial<DefaultConfig> & InferEndpointResolverOptionType<DefaultConfig>, keyof DefaultConfig>, input: Input) => Promise<Output>;
5
- type OptionalizeKey<T, K extends keyof T> = Omit<T, K> & {
6
- [P in K & keyof T]?: T[P];
4
+ export declare const composeServiceApi: <TransferHandlerOptions, Input, Output, DefaultConfig>(transferHandler: TransferHandler<HttpRequest, HttpResponse, TransferHandlerOptions>, serializer: (input: Input, endpoint: Endpoint) => Promise<HttpRequest> | HttpRequest, deserializer: (output: HttpResponse) => Promise<Output>, defaultConfig: Partial<DefaultConfig>) => (config: OptionalizeKey<TransferHandlerOptions & ServiceClientOptions & Partial<DefaultConfig> & InferEndpointResolverOptionType<DefaultConfig>, DefaultConfig>, input: Input) => Promise<Output>;
5
+ type OptionalizeKey<InputType, InputDefaultsType> = {
6
+ [KeyWithDefaultValue in keyof InputDefaultsType]?: KeyWithDefaultValue extends keyof InputType ? InputType[KeyWithDefaultValue] : never;
7
+ } & {
8
+ [KeyWithoutDefaultValue in keyof Omit<InputType, keyof InputDefaultsType>]: InputType[KeyWithoutDefaultValue];
7
9
  };
8
10
  type InferEndpointResolverOptionType<T> = T extends {
9
11
  endpointResolver: (options: infer EndpointOptions) => any;
@@ -1,7 +1,7 @@
1
1
  import { MetadataBearer } from '@aws-sdk/types';
2
2
  import { Endpoint } from './core';
3
3
  import { HttpResponse } from './http';
4
- export type { Credentials, MetadataBearer } from '@aws-sdk/types';
4
+ export type { AwsCredentialIdentity as Credentials, MetadataBearer, } from '@aws-sdk/types';
5
5
  export type SourceData = string | ArrayBuffer | ArrayBufferView;
6
6
  /**
7
7
  * Basic option type for endpoint resolvers. It contains region only.
@@ -18,7 +18,3 @@ export interface ServiceClientOptions {
18
18
  * This function is protocol-specific (e.g. JSON, XML, etc.)
19
19
  */
20
20
  export type ErrorParser = (response?: HttpResponse) => Promise<(Error & MetadataBearer) | undefined>;
21
- /**
22
- * Default config options for the `composeServiceApi`.
23
- */
24
- export type DefaultConfigOptions<TransferHandlerOptions extends Record<string, unknown> = Record<string, unknown>> = Partial<TransferHandlerOptions & ServiceClientOptions>;
@@ -26,5 +26,13 @@ export interface HttpResponse extends Response {
26
26
  }
27
27
  export interface HttpTransferOptions {
28
28
  abortSignal?: AbortSignal;
29
+ /**
30
+ * Cache mode for the request. Note that this is only effective when the underlying HTTP handler is fetch.
31
+ * For XHR handler, or Node.js `"http(s)"` module or running on React Native, this option is ignored.
32
+ * Instead, you can configure the `Cache-Control` headers to achieve similar effects.
33
+ * @default 'default'
34
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Request/cache}
35
+ */
36
+ cache?: RequestCache;
29
37
  }
30
38
  export type HttpTransferHandler = TransferHandler<HttpRequest, HttpResponse, HttpTransferOptions>;
@@ -1,3 +1,3 @@
1
1
  export { Middleware, MiddlewareHandler, Request, Response, TransferHandler, Endpoint, } from './core';
2
2
  export { Headers, HttpRequest, HttpResponse, HttpTransferHandler, HttpTransferOptions, ResponseBodyMixin, } from './http';
3
- export { Credentials, EndpointResolverOptions, ErrorParser, ServiceClientOptions, DefaultConfigOptions, } from './aws';
3
+ export { Credentials, EndpointResolverOptions, ErrorParser, ServiceClientOptions, } from './aws';
package/lib/index.d.ts CHANGED
@@ -12,4 +12,3 @@ export { InMemoryCache } from './Cache/InMemoryCache';
12
12
  export { BrowserStorageCache };
13
13
  export { BrowserStorageCache as Cache };
14
14
  export { I18n } from './I18n';
15
- export { parseAWSExports } from './parseAWSExports';
package/lib/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.parseAWSExports = exports.I18n = exports.Cache = exports.BrowserStorageCache = exports.InMemoryCache = exports.sharedInMemoryStorage = exports.sessionStorage = exports.defaultStorage = exports.CookieStorage = exports.getId = exports.getCredentialsForIdentity = exports.clearCredentials = exports.AmplifyClassV6 = exports.fetchAuthSession = exports.Amplify = exports.Hub = void 0;
5
+ exports.I18n = exports.Cache = exports.BrowserStorageCache = exports.InMemoryCache = exports.sharedInMemoryStorage = exports.sessionStorage = exports.defaultStorage = exports.CookieStorage = exports.getId = exports.getCredentialsForIdentity = exports.clearCredentials = exports.AmplifyClassV6 = exports.fetchAuthSession = exports.Amplify = exports.Hub = void 0;
6
6
  /*
7
7
  This file maps top-level exports from `@aws-amplify/core`. These are intended to be potentially customer-facing exports.
8
8
  */
@@ -33,5 +33,3 @@ Object.defineProperty(exports, "InMemoryCache", { enumerable: true, get: functio
33
33
  // Internationalization utilities
34
34
  var I18n_1 = require("./I18n");
35
35
  Object.defineProperty(exports, "I18n", { enumerable: true, get: function () { return I18n_1.I18n; } });
36
- var parseAWSExports_1 = require("./parseAWSExports");
37
- Object.defineProperty(exports, "parseAWSExports", { enumerable: true, get: function () { return parseAWSExports_1.parseAWSExports; } });
@@ -1,7 +1,10 @@
1
1
  export { isBrowser, filenameToContentType, generateRandomString, isEmpty, isStrictObject, isTextFile, isWebWorker, makeQuerablePromise, objectLessAttributes, sortByField, transferKeyToLowerCase, transferKeyToUpperCase, } from './Util/JS';
2
- export { JWT, StrictUnion, CognitoIdentityPoolConfig, } from './singleton/Auth/types';
2
+ export { parseAWSExports } from './parseAWSExports';
3
+ export { LegacyConfig } from './singleton/types';
4
+ export { JWT, StrictUnion, CognitoIdentityPoolConfig, JwtPayload, } from './singleton/Auth/types';
3
5
  export { decodeJWT, assertTokenProviderConfig, assertIdentityPooIdConfig, assertOAuthConfig, } from './singleton/Auth/utils';
4
6
  export { isTokenExpired } from './singleton/Auth';
7
+ export { GraphQLAuthModeKeys } from './singleton/API/types';
5
8
  export { Signer } from './Signer';
6
9
  export { ConsoleLogger, ConsoleLogger as Logger } from './Logger';
7
10
  export { ClientDevice } from './ClientDevice';
@@ -14,7 +17,6 @@ export { ServiceWorker } from './ServiceWorker';
14
17
  export { AWS_CLOUDWATCH_CATEGORY, BackgroundManagerNotOpenError, BackgroundProcessManager, BackgroundProcessManagerState, DateUtils, Mutex, NO_CREDS_ERROR_STRING, NonRetryableError, RETRY_ERROR_CODES, Reachability, isNonRetryableError, jitteredBackoff, jitteredExponentialRetry, retry, urlSafeDecode, urlSafeEncode, } from './Util';
15
18
  export { asserts } from './Util/errors/AssertError';
16
19
  export { invalidParameter, missingConfig, AmplifyError, AmplifyErrorString, } from './Util/Errors';
17
- export { AppState, AsyncStorage, Linking } from './RNComponents';
18
20
  export { ErrorParams, AmplifyErrorMap, ServiceError } from './types';
19
21
  export { INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER, USER_AGENT_HEADER, } from './Util/Constants';
20
22
  export { fetchAuthSession } from './singleton/apis/internal/fetchAuthSession';
@@ -2,8 +2,8 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.isNonRetryableError = exports.Reachability = exports.RETRY_ERROR_CODES = exports.NonRetryableError = exports.NO_CREDS_ERROR_STRING = exports.Mutex = exports.DateUtils = exports.BackgroundProcessManagerState = exports.BackgroundProcessManager = exports.BackgroundManagerNotOpenError = exports.AWS_CLOUDWATCH_CATEGORY = exports.ServiceWorker = exports.Constants = exports.StorageAction = exports.PushNotificationAction = exports.PubSubAction = exports.PredictionsAction = exports.InAppMessagingAction = exports.InteractionsAction = exports.GeoAction = exports.Framework = exports.DataStoreAction = exports.Category = exports.AnalyticsAction = exports.AuthAction = exports.ApiAction = exports.getAmplifyUserAgent = exports.getAmplifyUserAgentObject = exports.Platform = exports.ClientDevice = exports.Logger = exports.ConsoleLogger = exports.Signer = exports.isTokenExpired = exports.assertOAuthConfig = exports.assertIdentityPooIdConfig = exports.assertTokenProviderConfig = exports.decodeJWT = exports.transferKeyToUpperCase = exports.transferKeyToLowerCase = exports.sortByField = exports.objectLessAttributes = exports.makeQuerablePromise = exports.isWebWorker = exports.isTextFile = exports.isStrictObject = exports.isEmpty = exports.generateRandomString = exports.filenameToContentType = exports.isBrowser = void 0;
6
- exports.AMPLIFY_SYMBOL = exports.fetchAuthSession = exports.USER_AGENT_HEADER = exports.INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER = exports.Linking = exports.AsyncStorage = exports.AppState = exports.AmplifyErrorString = exports.AmplifyError = exports.missingConfig = exports.invalidParameter = exports.asserts = exports.urlSafeEncode = exports.urlSafeDecode = exports.retry = exports.jitteredExponentialRetry = exports.jitteredBackoff = void 0;
5
+ exports.Reachability = exports.RETRY_ERROR_CODES = exports.NonRetryableError = exports.NO_CREDS_ERROR_STRING = exports.Mutex = exports.DateUtils = exports.BackgroundProcessManagerState = exports.BackgroundProcessManager = exports.BackgroundManagerNotOpenError = exports.AWS_CLOUDWATCH_CATEGORY = exports.ServiceWorker = exports.Constants = exports.StorageAction = exports.PushNotificationAction = exports.PubSubAction = exports.PredictionsAction = exports.InAppMessagingAction = exports.InteractionsAction = exports.GeoAction = exports.Framework = exports.DataStoreAction = exports.Category = exports.AnalyticsAction = exports.AuthAction = exports.ApiAction = exports.getAmplifyUserAgent = exports.getAmplifyUserAgentObject = exports.Platform = exports.ClientDevice = exports.Logger = exports.ConsoleLogger = exports.Signer = exports.isTokenExpired = exports.assertOAuthConfig = exports.assertIdentityPooIdConfig = exports.assertTokenProviderConfig = exports.decodeJWT = exports.parseAWSExports = exports.transferKeyToUpperCase = exports.transferKeyToLowerCase = exports.sortByField = exports.objectLessAttributes = exports.makeQuerablePromise = exports.isWebWorker = exports.isTextFile = exports.isStrictObject = exports.isEmpty = exports.generateRandomString = exports.filenameToContentType = exports.isBrowser = void 0;
6
+ exports.AMPLIFY_SYMBOL = exports.fetchAuthSession = exports.USER_AGENT_HEADER = exports.INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER = exports.AmplifyErrorString = exports.AmplifyError = exports.missingConfig = exports.invalidParameter = exports.asserts = exports.urlSafeEncode = exports.urlSafeDecode = exports.retry = exports.jitteredExponentialRetry = exports.jitteredBackoff = exports.isNonRetryableError = void 0;
7
7
  /*
8
8
  This file maps top-level exports from `@aws-amplify/core/internals/utils`. These are intended to be internal
9
9
  utils for use throughout the library.
@@ -22,6 +22,8 @@ Object.defineProperty(exports, "objectLessAttributes", { enumerable: true, get:
22
22
  Object.defineProperty(exports, "sortByField", { enumerable: true, get: function () { return JS_1.sortByField; } });
23
23
  Object.defineProperty(exports, "transferKeyToLowerCase", { enumerable: true, get: function () { return JS_1.transferKeyToLowerCase; } });
24
24
  Object.defineProperty(exports, "transferKeyToUpperCase", { enumerable: true, get: function () { return JS_1.transferKeyToUpperCase; } });
25
+ var parseAWSExports_1 = require("./parseAWSExports");
26
+ Object.defineProperty(exports, "parseAWSExports", { enumerable: true, get: function () { return parseAWSExports_1.parseAWSExports; } });
25
27
  // Auth utilities
26
28
  var utils_1 = require("./singleton/Auth/utils");
27
29
  Object.defineProperty(exports, "decodeJWT", { enumerable: true, get: function () { return utils_1.decodeJWT; } });
@@ -89,10 +91,6 @@ Object.defineProperty(exports, "invalidParameter", { enumerable: true, get: func
89
91
  Object.defineProperty(exports, "missingConfig", { enumerable: true, get: function () { return Errors_1.missingConfig; } });
90
92
  Object.defineProperty(exports, "AmplifyError", { enumerable: true, get: function () { return Errors_1.AmplifyError; } });
91
93
  Object.defineProperty(exports, "AmplifyErrorString", { enumerable: true, get: function () { return Errors_1.AmplifyErrorString; } });
92
- var RNComponents_1 = require("./RNComponents");
93
- Object.defineProperty(exports, "AppState", { enumerable: true, get: function () { return RNComponents_1.AppState; } });
94
- Object.defineProperty(exports, "AsyncStorage", { enumerable: true, get: function () { return RNComponents_1.AsyncStorage; } });
95
- Object.defineProperty(exports, "Linking", { enumerable: true, get: function () { return RNComponents_1.Linking; } });
96
94
  var Constants_1 = require("./Util/Constants");
97
95
  Object.defineProperty(exports, "INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER", { enumerable: true, get: function () { return Constants_1.INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER; } });
98
96
  Object.defineProperty(exports, "USER_AGENT_HEADER", { enumerable: true, get: function () { return Constants_1.USER_AGENT_HEADER; } });
@@ -3,7 +3,7 @@ import { PinpointAnalyticsEvent, PinpointSession } from './pinpoint';
3
3
  export type EventBufferConfig = {
4
4
  appId: string;
5
5
  bufferSize: number;
6
- credentials: AuthSession['credentials'];
6
+ credentials: Required<AuthSession>['credentials'];
7
7
  identityId: AuthSession['identityId'];
8
8
  flushInterval: number;
9
9
  flushSize: number;
@@ -24,7 +24,7 @@ export type PinpointAnalyticsEvent = {
24
24
  type PinpointCommonParameters = {
25
25
  appId: string;
26
26
  category: SupportedCategory;
27
- credentials: AuthSession['credentials'];
27
+ credentials: Required<AuthSession>['credentials'];
28
28
  identityId?: AuthSession['identityId'];
29
29
  region: string;
30
30
  userAgentValue?: string;
@@ -77,7 +77,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
77
77
  exports.PinpointEventBuffer = void 0;
78
78
  var Logger_1 = require("../../../Logger");
79
79
  var Pinpoint_1 = require("../../../AwsClients/Pinpoint");
80
- var isAppInForeground_1 = require("../../../RNComponents/isAppInForeground");
80
+ var isAppInForeground_1 = require("./isAppInForeground");
81
81
  var logger = new Logger_1.ConsoleLogger('PinpointEventBuffer');
82
82
  var RETRYABLE_CODES = [429, 500];
83
83
  var ACCEPTED_CODES = [202];
@@ -94,7 +94,9 @@ var PinpointEventBuffer = /** @class */ (function () {
94
94
  PinpointEventBuffer.prototype.push = function (event) {
95
95
  var _a;
96
96
  if (this._buffer.length >= this._config.bufferSize) {
97
- logger.debug('Exceeded Pinpoint event buffer limits, event dropped.', { eventId: event.eventId });
97
+ logger.debug('Exceeded Pinpoint event buffer limits, event dropped.', {
98
+ eventId: event.eventId,
99
+ });
98
100
  return;
99
101
  }
100
102
  this._buffer.push((_a = {}, _a[event.eventId] = event, _a));
@@ -233,7 +235,7 @@ var PinpointEventBuffer = /** @class */ (function () {
233
235
  logger.warn('Pinpoint event failed to send.', {
234
236
  eventId: eventId,
235
237
  name: name,
236
- message: Message
238
+ message: Message,
237
239
  });
238
240
  });
239
241
  });
@@ -253,14 +255,14 @@ var PinpointEventBuffer = /** @class */ (function () {
253
255
  logger.debug('Resending event.', {
254
256
  eventId: eventId,
255
257
  name: name,
256
- remainingAttempts: bufferedEvent.resendLimit
258
+ remainingAttempts: bufferedEvent.resendLimit,
257
259
  });
258
260
  eligibleEvents.push((_a = {}, _a[eventId] = bufferedEvent, _a));
259
261
  return;
260
262
  }
261
263
  logger.debug('No retry attempts remaining for event.', {
262
264
  eventId: eventId,
263
- name: name
265
+ name: name,
264
266
  });
265
267
  });
266
268
  // add the events to the front of the buffer
@@ -0,0 +1 @@
1
+ export declare const isAppInForeground: () => boolean;
@@ -3,8 +3,5 @@
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.isAppInForeground = void 0;
6
- var _1 = require(".");
7
- var isAppInForeground = function () {
8
- return _1.AppState.currentState === 'active';
9
- };
6
+ var isAppInForeground = function () { return true; };
10
7
  exports.isAppInForeground = isAppInForeground;
@@ -0,0 +1 @@
1
+ export declare const isAppInForeground: () => boolean;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.isAppInForeground = void 0;
6
+ // @ts-ignore: missing type definition
7
+ var react_native_1 = require("react-native");
8
+ var isAppInForeground = function () { return react_native_1.AppState.currentState === 'active'; };
9
+ exports.isAppInForeground = isAppInForeground;
@@ -13,9 +13,9 @@ export type LibraryAPIOptions = {
13
13
  };
14
14
  export type APIConfig = {
15
15
  AppSync?: {
16
- defaultAuthMode?: GraphQLAuthMode;
17
- region?: string;
18
- endpoint?: string;
16
+ defaultAuthMode: GraphQLAuthMode;
17
+ region: string;
18
+ endpoint: string;
19
19
  modelIntrospectionSchema?: any;
20
20
  };
21
21
  };
@@ -24,7 +24,7 @@ export type GraphQLAuthMode = {
24
24
  apiKey: string;
25
25
  } | {
26
26
  type: 'jwt';
27
- token: 'id' | 'access';
27
+ token?: 'id' | 'access';
28
28
  } | {
29
29
  type: 'iam';
30
30
  } | {
@@ -32,3 +32,4 @@ export type GraphQLAuthMode = {
32
32
  } | {
33
33
  type: 'custom';
34
34
  };
35
+ export type GraphQLAuthModeKeys = 'apiKey' | 'jwt' | 'iam' | 'lambda' | 'custom';
@@ -1,5 +1,5 @@
1
1
  import { AuthClass } from './Auth';
2
- import { LibraryOptions, ResourcesConfig } from './types';
2
+ import { LegacyConfig, LibraryOptions, ResourcesConfig } from './types';
3
3
  export declare class AmplifyClass {
4
4
  resourcesConfig: ResourcesConfig;
5
5
  libraryOptions: LibraryOptions;
@@ -19,7 +19,7 @@ export declare class AmplifyClass {
19
19
  * @param resourceConfig - Back-end resource configuration. Typically provided via the `aws-exports.js` file.
20
20
  * @param libraryOptions - Additional options for customizing the behavior of the library.
21
21
  */
22
- configure(resourcesConfig: ResourcesConfig, libraryOptions?: LibraryOptions): void;
22
+ configure(resourcesConfig: ResourcesConfig | LegacyConfig, libraryOptions?: LibraryOptions): void;
23
23
  /**
24
24
  * Provides access to the current back-end resource configuration for the Library.
25
25
  *
@@ -27,6 +27,7 @@ exports.Amplify = exports.AmplifyClass = void 0;
27
27
  // SPDX-License-Identifier: Apache-2.0
28
28
  var Auth_1 = require("./Auth");
29
29
  var Hub_1 = require("../Hub");
30
+ var parseAWSExports_1 = require("../parseAWSExports");
30
31
  // TODO(v6): add default AuthTokenStore for each platform
31
32
  var AmplifyClass = /** @class */ (function () {
32
33
  function AmplifyClass() {
@@ -46,7 +47,14 @@ var AmplifyClass = /** @class */ (function () {
46
47
  */
47
48
  AmplifyClass.prototype.configure = function (resourcesConfig, libraryOptions) {
48
49
  if (libraryOptions === void 0) { libraryOptions = {}; }
49
- this.resourcesConfig = mergeResourceConfig(this.resourcesConfig, resourcesConfig);
50
+ var resolvedResourceConfig;
51
+ if (Object.keys(resourcesConfig).some(function (key) { return key.startsWith('aws_'); })) {
52
+ resolvedResourceConfig = (0, parseAWSExports_1.parseAWSExports)(resourcesConfig);
53
+ }
54
+ else {
55
+ resolvedResourceConfig = resourcesConfig;
56
+ }
57
+ this.resourcesConfig = mergeResourceConfig(this.resourcesConfig, resolvedResourceConfig);
50
58
  this.libraryOptions = mergeLibraryOptions(this.libraryOptions, libraryOptions);
51
59
  this.Auth.configure(this.resourcesConfig.Auth, this.libraryOptions.Auth);
52
60
  Hub_1.Hub.dispatch('core', {
@@ -1,4 +1,4 @@
1
- import { AuthConfig, AuthSession, FetchAuthSessionOptions, LibraryAuthOptions } from './types';
1
+ import { AuthConfig, AuthSession, AuthTokens, FetchAuthSessionOptions, LibraryAuthOptions } from './types';
2
2
  export declare function isTokenExpired({ expiresAt, clockDrift, }: {
3
3
  expiresAt: number;
4
4
  clockDrift: number;
@@ -20,4 +20,5 @@ export declare class AuthClass {
20
20
  configure(authResourcesConfig: AuthConfig, authOptions?: LibraryAuthOptions): void;
21
21
  fetchAuthSession(options?: FetchAuthSessionOptions): Promise<AuthSession>;
22
22
  clearCredentials(): Promise<void>;
23
+ getTokens(options: FetchAuthSessionOptions): Promise<AuthTokens | undefined>;
23
24
  }