@aws-amplify/core 6.0.1-console-preview.814dea6.0 → 6.0.1-preview-testing.64b45b1.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.
- package/lib/AwsClients/CognitoIdentity/base.d.ts +12 -4
- package/lib/AwsClients/CognitoIdentity/base.js +1 -0
- package/lib/AwsClients/CognitoIdentity/getCredentialsForIdentity.d.ts +15 -3
- package/lib/AwsClients/CognitoIdentity/getId.d.ts +15 -3
- package/lib/AwsClients/Pinpoint/base.d.ts +10 -2
- package/lib/AwsClients/Pinpoint/getInAppMessages.d.ts +17 -3
- package/lib/AwsClients/Pinpoint/putEvents.d.ts +17 -3
- package/lib/AwsClients/Pinpoint/updateEndpoint.d.ts +17 -3
- package/lib/Platform/version.d.ts +1 -1
- package/lib/Platform/version.js +1 -1
- package/lib/RNComponents/index.js +2 -2
- package/lib/ServiceWorker/ServiceWorker.js +1 -1
- package/lib/Util/JS.d.ts +1 -4
- package/lib/Util/JS.js +4 -11
- package/lib/Util/Reachability.js +0 -3
- package/lib/clients/handlers/authenticated.d.ts +1 -1
- package/lib/clients/handlers/fetch.d.ts +0 -1
- package/lib/clients/handlers/fetch.js +2 -2
- package/lib/clients/handlers/unauthenticated.d.ts +1 -1
- package/lib/clients/internal/composeServiceApi.d.ts +5 -3
- package/lib/clients/types/aws.d.ts +0 -4
- package/lib/clients/types/http.d.ts +8 -0
- package/lib/clients/types/index.d.ts +1 -1
- package/lib/libraryUtils.d.ts +1 -2
- package/lib/libraryUtils.js +3 -6
- package/lib/providers/pinpoint/apis/record.d.ts +2 -2
- package/lib/providers/pinpoint/apis/record.js +3 -3
- package/lib/providers/pinpoint/apis/updateEndpoint.d.ts +2 -2
- package/lib/providers/pinpoint/types/buffer.d.ts +1 -1
- package/lib/providers/pinpoint/types/pinpoint.d.ts +3 -3
- package/lib/singleton/Storage/types.d.ts +5 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib-esm/AwsClients/CognitoIdentity/base.d.ts +12 -4
- package/lib-esm/AwsClients/CognitoIdentity/base.js +1 -0
- package/lib-esm/AwsClients/CognitoIdentity/getCredentialsForIdentity.d.ts +15 -3
- package/lib-esm/AwsClients/CognitoIdentity/getId.d.ts +15 -3
- package/lib-esm/AwsClients/Pinpoint/base.d.ts +10 -2
- package/lib-esm/AwsClients/Pinpoint/getInAppMessages.d.ts +17 -3
- package/lib-esm/AwsClients/Pinpoint/putEvents.d.ts +17 -3
- package/lib-esm/AwsClients/Pinpoint/updateEndpoint.d.ts +17 -3
- package/lib-esm/Platform/version.d.ts +1 -1
- package/lib-esm/Platform/version.js +1 -1
- package/lib-esm/RNComponents/index.js +3 -3
- package/lib-esm/ServiceWorker/ServiceWorker.js +2 -2
- package/lib-esm/Util/JS.d.ts +1 -4
- package/lib-esm/Util/JS.js +2 -9
- package/lib-esm/Util/Reachability.js +1 -4
- package/lib-esm/clients/handlers/authenticated.d.ts +1 -1
- package/lib-esm/clients/handlers/fetch.d.ts +0 -1
- package/lib-esm/clients/handlers/fetch.js +2 -2
- package/lib-esm/clients/handlers/unauthenticated.d.ts +1 -1
- package/lib-esm/clients/internal/composeServiceApi.d.ts +5 -3
- package/lib-esm/clients/types/aws.d.ts +0 -4
- package/lib-esm/clients/types/http.d.ts +8 -0
- package/lib-esm/clients/types/index.d.ts +1 -1
- package/lib-esm/libraryUtils.d.ts +1 -2
- package/lib-esm/libraryUtils.js +1 -2
- package/lib-esm/providers/pinpoint/apis/record.d.ts +2 -2
- package/lib-esm/providers/pinpoint/apis/record.js +3 -3
- package/lib-esm/providers/pinpoint/apis/updateEndpoint.d.ts +2 -2
- package/lib-esm/providers/pinpoint/types/buffer.d.ts +1 -1
- package/lib-esm/providers/pinpoint/types/pinpoint.d.ts +3 -3
- package/lib-esm/singleton/Storage/types.d.ts +5 -0
- package/lib-esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -4
- package/src/AwsClients/CognitoIdentity/base.ts +2 -2
- package/src/AwsClients/Pinpoint/base.ts +2 -6
- package/src/Platform/version.ts +1 -1
- package/src/RNComponents/index.ts +3 -3
- package/src/ServiceWorker/ServiceWorker.ts +2 -2
- package/src/Util/JS.ts +2 -13
- package/src/Util/Reachability.ts +1 -5
- package/src/clients/handlers/authenticated.ts +2 -1
- package/src/clients/handlers/fetch.ts +2 -2
- package/src/clients/handlers/unauthenticated.ts +2 -1
- package/src/clients/internal/composeServiceApi.ts +10 -3
- package/src/clients/types/aws.ts +0 -10
- package/src/clients/types/http.ts +8 -0
- package/src/clients/types/index.ts +0 -1
- package/src/libraryUtils.ts +1 -2
- package/src/providers/pinpoint/apis/record.ts +8 -8
- package/src/providers/pinpoint/apis/updateEndpoint.ts +2 -2
- package/src/providers/pinpoint/types/buffer.ts +1 -1
- package/src/providers/pinpoint/types/pinpoint.ts +8 -7
- package/src/singleton/Storage/types.ts +6 -2
- package/lib/OAuthHelper/FacebookOAuth.d.ts +0 -6
- package/lib/OAuthHelper/FacebookOAuth.js +0 -124
- package/lib/OAuthHelper/GoogleOAuth.d.ts +0 -6
- package/lib/OAuthHelper/GoogleOAuth.js +0 -134
- package/lib/OAuthHelper/index.d.ts +0 -4
- package/lib/OAuthHelper/index.js +0 -9
- package/lib-esm/OAuthHelper/FacebookOAuth.d.ts +0 -6
- package/lib-esm/OAuthHelper/FacebookOAuth.js +0 -121
- package/lib-esm/OAuthHelper/GoogleOAuth.d.ts +0 -6
- package/lib-esm/OAuthHelper/GoogleOAuth.js +0 -131
- package/lib-esm/OAuthHelper/index.d.ts +0 -4
- package/lib-esm/OAuthHelper/index.js +0 -6
- package/src/OAuthHelper/FacebookOAuth.ts +0 -83
- package/src/OAuthHelper/GoogleOAuth.ts +0 -97
- package/src/OAuthHelper/index.ts +0 -7
|
@@ -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:
|
|
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:
|
|
8
|
-
|
|
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:
|
|
8
|
-
|
|
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 {
|
|
1
|
+
import type { EndpointResolverOptions, Headers } from '../../clients/types';
|
|
2
2
|
/**
|
|
3
3
|
* @internal
|
|
4
4
|
*/
|
|
5
|
-
export declare const defaultConfig:
|
|
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:
|
|
8
|
-
|
|
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("@aws-sdk/types/dist-types/credentials").Credentials | (() => Promise<import("@aws-sdk/types/dist-types/credentials").Credentials>);
|
|
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:
|
|
8
|
-
|
|
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("@aws-sdk/types/dist-types/credentials").Credentials | (() => Promise<import("@aws-sdk/types/dist-types/credentials").Credentials>);
|
|
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:
|
|
8
|
-
|
|
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("@aws-sdk/types/dist-types/credentials").Credentials | (() => Promise<import("@aws-sdk/types/dist-types/credentials").Credentials>);
|
|
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-
|
|
1
|
+
export declare const version = "6.0.1-preview-testing.64b45b1.0+64b45b1";
|
package/lib/Platform/version.js
CHANGED
|
@@ -8,9 +8,9 @@ var StorageHelper_1 = require("../StorageHelper");
|
|
|
8
8
|
exports.Linking = {};
|
|
9
9
|
exports.AppState = {
|
|
10
10
|
addEventListener: function (action, handler) { return undefined; },
|
|
11
|
-
currentState: 'active'
|
|
11
|
+
currentState: 'active',
|
|
12
12
|
};
|
|
13
13
|
// if not in react native, just use local storage
|
|
14
|
-
exports.AsyncStorage = (0, JS_1.
|
|
14
|
+
exports.AsyncStorage = (0, JS_1.isBrowser)()
|
|
15
15
|
? new StorageHelper_1.StorageHelper().getStorage()
|
|
16
16
|
: undefined;
|
|
@@ -127,7 +127,7 @@ var ServiceWorkerClass = /** @class */ (function () {
|
|
|
127
127
|
});
|
|
128
128
|
this._publicKey = publicKey;
|
|
129
129
|
return new Promise(function (resolve, reject) {
|
|
130
|
-
if ((0, JS_1.
|
|
130
|
+
if ((0, JS_1.isBrowser)()) {
|
|
131
131
|
(0, AssertError_1.asserts)(_this._registration !== undefined, {
|
|
132
132
|
name: Constants_1.SERVICE_WORKER_EXCEPTION,
|
|
133
133
|
message: 'Service Worker registration is undefined',
|
package/lib/Util/JS.d.ts
CHANGED
|
@@ -6,10 +6,7 @@ export declare const isTextFile: (contentType: string) => boolean;
|
|
|
6
6
|
export declare const generateRandomString: () => string;
|
|
7
7
|
export declare const makeQuerablePromise: (promise: any) => any;
|
|
8
8
|
export declare const isWebWorker: () => boolean;
|
|
9
|
-
export declare const
|
|
10
|
-
isBrowser: boolean;
|
|
11
|
-
isNode: boolean;
|
|
12
|
-
};
|
|
9
|
+
export declare const isBrowser: () => boolean;
|
|
13
10
|
/**
|
|
14
11
|
* transfer the first letter of the keys to lowercase
|
|
15
12
|
* @param {Object} obj - the object need to be transferred
|
package/lib/Util/JS.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.isStrictObject = exports.transferKeyToUpperCase = exports.transferKeyToLowerCase = exports.
|
|
5
|
+
exports.isStrictObject = exports.transferKeyToUpperCase = exports.transferKeyToLowerCase = exports.isBrowser = exports.isWebWorker = exports.makeQuerablePromise = exports.generateRandomString = exports.isTextFile = exports.filenameToContentType = exports.objectLessAttributes = exports.sortByField = exports.isEmpty = void 0;
|
|
6
6
|
var MIME_MAP = [
|
|
7
7
|
{ type: 'text/plain', ext: 'txt' },
|
|
8
8
|
{ type: 'text/html', ext: 'html' },
|
|
@@ -144,17 +144,10 @@ var isWebWorker = function () {
|
|
|
144
144
|
self instanceof selfContext.WorkerGlobalScope);
|
|
145
145
|
};
|
|
146
146
|
exports.isWebWorker = isWebWorker;
|
|
147
|
-
var
|
|
148
|
-
|
|
149
|
-
var isNode = typeof process !== 'undefined' &&
|
|
150
|
-
process.versions != null &&
|
|
151
|
-
process.versions.node != null;
|
|
152
|
-
return {
|
|
153
|
-
isBrowser: isBrowser,
|
|
154
|
-
isNode: isNode,
|
|
155
|
-
};
|
|
147
|
+
var isBrowser = function () {
|
|
148
|
+
return typeof window !== 'undefined' && typeof window.document !== 'undefined';
|
|
156
149
|
};
|
|
157
|
-
exports.
|
|
150
|
+
exports.isBrowser = isBrowser;
|
|
158
151
|
/**
|
|
159
152
|
* transfer the first letter of the keys to lowercase
|
|
160
153
|
* @param {Object} obj - the object need to be transferred
|
package/lib/Util/Reachability.js
CHANGED
|
@@ -22,9 +22,6 @@ var ReachabilityNavigator = /** @class */ (function () {
|
|
|
22
22
|
function ReachabilityNavigator() {
|
|
23
23
|
}
|
|
24
24
|
ReachabilityNavigator.prototype.networkMonitor = function (netInfo) {
|
|
25
|
-
if ((0, JS_1.browserOrNode)().isNode) {
|
|
26
|
-
return zen_observable_ts_1.default.from([{ online: true }]);
|
|
27
|
-
}
|
|
28
25
|
var globalObj = (0, JS_1.isWebWorker)() ? self : window;
|
|
29
26
|
return new zen_observable_ts_1.default(function (observer) {
|
|
30
27
|
observer.next({ online: globalObj.navigator.onLine });
|
|
@@ -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>;
|
|
@@ -50,7 +50,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
50
50
|
};
|
|
51
51
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
52
52
|
exports.fetchTransferHandler = void 0;
|
|
53
|
-
require("isomorphic-unfetch"); // TODO: remove this dependency in v6
|
|
54
53
|
var memoization_1 = require("../utils/memoization");
|
|
55
54
|
var shouldSendBody = function (method) {
|
|
56
55
|
return !['HEAD', 'GET', 'DELETE'].includes(method.toUpperCase());
|
|
@@ -58,7 +57,7 @@ var shouldSendBody = function (method) {
|
|
|
58
57
|
// TODO[AllanZhengYP]: we need to provide isCanceledError utility
|
|
59
58
|
var fetchTransferHandler = function (_a, _b) {
|
|
60
59
|
var url = _a.url, method = _a.method, headers = _a.headers, body = _a.body;
|
|
61
|
-
var abortSignal = _b.abortSignal;
|
|
60
|
+
var abortSignal = _b.abortSignal, cache = _b.cache;
|
|
62
61
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
63
62
|
var resp, e_1, responseHeaders, httpResponse, bodyWithMixin;
|
|
64
63
|
var _c, _d;
|
|
@@ -71,6 +70,7 @@ var fetchTransferHandler = function (_a, _b) {
|
|
|
71
70
|
headers: headers,
|
|
72
71
|
body: shouldSendBody(method) ? body : undefined,
|
|
73
72
|
signal: abortSignal,
|
|
73
|
+
cache: cache,
|
|
74
74
|
})];
|
|
75
75
|
case 1:
|
|
76
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>,
|
|
5
|
-
type OptionalizeKey<
|
|
6
|
-
[
|
|
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;
|
|
@@ -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,
|
|
3
|
+
export { Credentials, EndpointResolverOptions, ErrorParser, ServiceClientOptions, } from './aws';
|
package/lib/libraryUtils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { isBrowser, filenameToContentType, generateRandomString, isEmpty, isStrictObject, isTextFile, isWebWorker, makeQuerablePromise, objectLessAttributes, sortByField, transferKeyToLowerCase, transferKeyToUpperCase, } from './Util/JS';
|
|
2
2
|
export { JWT, StrictUnion, CognitoIdentityPoolConfig, } from './singleton/Auth/types';
|
|
3
3
|
export { decodeJWT, assertTokenProviderConfig, assertIdentityPooIdConfig, assertOAuthConfig, } from './singleton/Auth/utils';
|
|
4
4
|
export { isTokenExpired } from './singleton/Auth';
|
|
@@ -14,7 +14,6 @@ export { ServiceWorker } from './ServiceWorker';
|
|
|
14
14
|
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
15
|
export { asserts } from './Util/errors/AssertError';
|
|
16
16
|
export { invalidParameter, missingConfig, AmplifyError, AmplifyErrorString, } from './Util/Errors';
|
|
17
|
-
export { FacebookOAuth, GoogleOAuth } from './OAuthHelper';
|
|
18
17
|
export { AppState, AsyncStorage, Linking } from './RNComponents';
|
|
19
18
|
export { ErrorParams, AmplifyErrorMap, ServiceError } from './types';
|
|
20
19
|
export { INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER, USER_AGENT_HEADER, } from './Util/Constants';
|
package/lib/libraryUtils.js
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
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.
|
|
6
|
-
exports.AMPLIFY_SYMBOL = exports.fetchAuthSession = exports.USER_AGENT_HEADER = exports.INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER = exports.Linking = exports.AsyncStorage = exports.AppState = exports.
|
|
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;
|
|
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.
|
|
10
10
|
*/
|
|
11
11
|
// JS utilities
|
|
12
12
|
var JS_1 = require("./Util/JS");
|
|
13
|
-
Object.defineProperty(exports, "
|
|
13
|
+
Object.defineProperty(exports, "isBrowser", { enumerable: true, get: function () { return JS_1.isBrowser; } });
|
|
14
14
|
Object.defineProperty(exports, "filenameToContentType", { enumerable: true, get: function () { return JS_1.filenameToContentType; } });
|
|
15
15
|
Object.defineProperty(exports, "generateRandomString", { enumerable: true, get: function () { return JS_1.generateRandomString; } });
|
|
16
16
|
Object.defineProperty(exports, "isEmpty", { enumerable: true, get: function () { return JS_1.isEmpty; } });
|
|
@@ -89,9 +89,6 @@ Object.defineProperty(exports, "invalidParameter", { enumerable: true, get: func
|
|
|
89
89
|
Object.defineProperty(exports, "missingConfig", { enumerable: true, get: function () { return Errors_1.missingConfig; } });
|
|
90
90
|
Object.defineProperty(exports, "AmplifyError", { enumerable: true, get: function () { return Errors_1.AmplifyError; } });
|
|
91
91
|
Object.defineProperty(exports, "AmplifyErrorString", { enumerable: true, get: function () { return Errors_1.AmplifyErrorString; } });
|
|
92
|
-
var OAuthHelper_1 = require("./OAuthHelper");
|
|
93
|
-
Object.defineProperty(exports, "FacebookOAuth", { enumerable: true, get: function () { return OAuthHelper_1.FacebookOAuth; } });
|
|
94
|
-
Object.defineProperty(exports, "GoogleOAuth", { enumerable: true, get: function () { return OAuthHelper_1.GoogleOAuth; } });
|
|
95
92
|
var RNComponents_1 = require("./RNComponents");
|
|
96
93
|
Object.defineProperty(exports, "AppState", { enumerable: true, get: function () { return RNComponents_1.AppState; } });
|
|
97
94
|
Object.defineProperty(exports, "AsyncStorage", { enumerable: true, get: function () { return RNComponents_1.AsyncStorage; } });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PinpointRecordInput } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* @internal
|
|
4
4
|
*/
|
|
5
|
-
export declare const record: ({ appId, category, credentials, event, identityId, region, userAgentValue, }:
|
|
5
|
+
export declare const record: ({ appId, category, credentials, event, identityId, region, userAgentValue, }: PinpointRecordInput) => Promise<void>;
|
|
@@ -71,7 +71,7 @@ var record = function (_a) {
|
|
|
71
71
|
identityId: identityId,
|
|
72
72
|
region: region,
|
|
73
73
|
resendLimit: constants_1.RESEND_LIMIT,
|
|
74
|
-
userAgentValue: userAgentValue
|
|
74
|
+
userAgentValue: userAgentValue,
|
|
75
75
|
});
|
|
76
76
|
if (!!endpointId) return [3 /*break*/, 4];
|
|
77
77
|
return [4 /*yield*/, (0, updateEndpoint_1.updateEndpoint)({
|
|
@@ -92,7 +92,7 @@ var record = function (_a) {
|
|
|
92
92
|
if (!endpointId) {
|
|
93
93
|
throw new libraryUtils_1.AmplifyError({
|
|
94
94
|
name: 'ENDPOINT_NOT_CREATED',
|
|
95
|
-
message: 'Endpoint was not created.'
|
|
95
|
+
message: 'Endpoint was not created.',
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
98
|
// Generate session if required
|
|
@@ -110,7 +110,7 @@ var record = function (_a) {
|
|
|
110
110
|
event: event,
|
|
111
111
|
session: session,
|
|
112
112
|
timestamp: timestampISOString,
|
|
113
|
-
resendLimit: constants_1.RESEND_LIMIT
|
|
113
|
+
resendLimit: constants_1.RESEND_LIMIT,
|
|
114
114
|
});
|
|
115
115
|
return [2 /*return*/];
|
|
116
116
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PinpointUpdateEndpointInput } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* @internal
|
|
4
4
|
*/
|
|
5
|
-
export declare const updateEndpoint: ({ address, appId, category, channelType, credentials, identityId, optOut, region, userId, userProfile, userAgentValue, }:
|
|
5
|
+
export declare const updateEndpoint: ({ address, appId, category, channelType, credentials, identityId, optOut, region, userId, userProfile, userAgentValue, }: PinpointUpdateEndpointInput) => Promise<void>;
|
|
@@ -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,17 +24,17 @@ 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;
|
|
31
31
|
};
|
|
32
|
-
export type
|
|
32
|
+
export type PinpointUpdateEndpointInput = PinpointCommonParameters & PinpointServiceOptions & {
|
|
33
33
|
channelType?: SupportedChannelType;
|
|
34
34
|
userId?: string;
|
|
35
35
|
userProfile?: UserProfile;
|
|
36
36
|
};
|
|
37
|
-
export type
|
|
37
|
+
export type PinpointRecordInput = PinpointCommonParameters & {
|
|
38
38
|
event: PinpointAnalyticsEvent;
|
|
39
39
|
};
|
|
40
40
|
export {};
|