@aws-amplify/core 4.6.2-next.32 → 4.6.2-next.36
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/Amplify.d.ts +28 -0
- package/lib/ClientDevice/android.d.ts +5 -0
- package/lib/ClientDevice/android.js +1 -1
- package/lib/ClientDevice/browser.d.ts +25 -0
- package/lib/ClientDevice/browser.js +1 -1
- package/lib/ClientDevice/index.d.ts +23 -0
- package/lib/ClientDevice/index.js +1 -1
- package/lib/ClientDevice/ios.d.ts +7 -0
- package/lib/ClientDevice/ios.js +1 -1
- package/lib/ClientDevice/reactnative.d.ts +7 -0
- package/lib/ClientDevice/reactnative.js +1 -1
- package/lib/Credentials.d.ts +47 -0
- package/lib/Errors.d.ts +2 -0
- package/lib/Errors.js +1 -1
- package/lib/Hub.d.ts +55 -0
- package/lib/Hub.js +1 -1
- package/lib/I18n/I18n.d.ts +59 -0
- package/lib/I18n/I18n.js +1 -1
- package/lib/I18n/index.d.ts +49 -0
- package/lib/I18n/index.js +1 -1
- package/lib/I18n/types.d.ts +3 -0
- package/lib/I18n/types.js +1 -1
- package/lib/JS.d.ts +32 -0
- package/lib/JS.js +1 -1
- package/lib/Logger/ConsoleLogger.d.ts +80 -0
- package/lib/Logger/ConsoleLogger.js +1 -1
- package/lib/Logger/index.d.ts +1 -0
- package/lib/Logger/index.js +4 -3
- package/lib/Logger/index.js.map +1 -1
- package/lib/Logger/logger-interface.d.ts +8 -0
- package/lib/Logger/logger-interface.js +1 -1
- package/lib/OAuthHelper/FacebookOAuth.d.ts +6 -0
- package/lib/OAuthHelper/FacebookOAuth.js +1 -1
- package/lib/OAuthHelper/GoogleOAuth.d.ts +6 -0
- package/lib/OAuthHelper/GoogleOAuth.js +1 -1
- package/lib/OAuthHelper/index.d.ts +4 -0
- package/lib/OAuthHelper/index.js +1 -1
- package/lib/Platform/index.d.ts +7 -0
- package/lib/Platform/index.js +1 -1
- package/lib/Platform/version.d.ts +1 -0
- package/lib/Providers/AWSCloudWatchProvider.d.ts +34 -0
- package/lib/Providers/AWSCloudWatchProvider.js +1 -1
- package/lib/Providers/index.d.ts +1 -0
- package/lib/Providers/index.js +2 -2
- package/lib/Providers/index.js.map +1 -1
- package/lib/RNComponents/index.d.ts +5 -0
- package/lib/RNComponents/index.js +1 -1
- package/lib/RNComponents/reactnative.d.ts +3 -0
- package/lib/RNComponents/reactnative.js +1 -1
- package/lib/ServiceWorker/ServiceWorker.d.ts +68 -0
- package/lib/ServiceWorker/index.d.ts +13 -0
- package/lib/Signer.d.ts +41 -0
- package/lib/Signer.js +1 -1
- package/lib/StorageHelper/index.d.ts +41 -0
- package/lib/StorageHelper/index.js +1 -1
- package/lib/StorageHelper/reactnative.d.ts +13 -0
- package/lib/StorageHelper/reactnative.js +1 -1
- package/lib/UniversalStorage/index.d.ts +23 -0
- package/lib/Util/BackgroundProcessManager.d.ts +204 -0
- package/lib/Util/Constants.d.ts +8 -0
- package/lib/Util/Constants.js +1 -1
- package/lib/Util/DateUtils.d.ts +7 -0
- package/lib/Util/Mutex.d.ts +45 -0
- package/lib/Util/Reachability.d.ts +13 -0
- package/lib/Util/Reachability.native.d.ts +11 -0
- package/lib/Util/Retry.d.ts +21 -0
- package/lib/Util/StringUtils.d.ts +2 -0
- package/lib/Util/index.d.ts +7 -0
- package/lib/Util/index.js +23 -6
- package/lib/Util/index.js.map +1 -1
- package/lib/constants.d.ts +6 -0
- package/lib/constants.js +1 -1
- package/lib/index.d.ts +29 -0
- package/lib/index.js +50 -10
- package/lib/index.js.map +1 -1
- package/lib/parseAWSExports.d.ts +2 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/types.d.ts +46 -0
- package/lib-esm/ClientDevice/android.js +1 -1
- package/lib-esm/ClientDevice/browser.js +1 -1
- package/lib-esm/ClientDevice/index.js +1 -1
- package/lib-esm/ClientDevice/ios.js +1 -1
- package/lib-esm/ClientDevice/reactnative.js +1 -1
- package/lib-esm/Errors.js +1 -1
- package/lib-esm/Hub.js +1 -1
- package/lib-esm/I18n/I18n.js +1 -1
- package/lib-esm/I18n/index.js +1 -1
- package/lib-esm/I18n/types.js +1 -1
- package/lib-esm/JS.js +1 -1
- package/lib-esm/Logger/ConsoleLogger.js +1 -1
- package/lib-esm/Logger/index.d.ts +1 -1
- package/lib-esm/Logger/index.js +2 -2
- package/lib-esm/Logger/index.js.map +1 -1
- package/lib-esm/Logger/logger-interface.js +1 -1
- package/lib-esm/OAuthHelper/FacebookOAuth.js +1 -1
- package/lib-esm/OAuthHelper/GoogleOAuth.js +1 -1
- package/lib-esm/OAuthHelper/index.js +1 -1
- package/lib-esm/Platform/index.js +1 -1
- package/lib-esm/Providers/AWSCloudWatchProvider.js +1 -1
- package/lib-esm/Providers/index.d.ts +1 -1
- package/lib-esm/Providers/index.js +1 -1
- package/lib-esm/Providers/index.js.map +1 -1
- package/lib-esm/RNComponents/index.js +1 -1
- package/lib-esm/RNComponents/reactnative.js +1 -1
- package/lib-esm/Signer.js +1 -1
- package/lib-esm/StorageHelper/index.js +1 -1
- package/lib-esm/StorageHelper/reactnative.js +1 -1
- package/lib-esm/Util/Constants.js +1 -1
- package/lib-esm/Util/index.d.ts +5 -5
- package/lib-esm/Util/index.js +5 -5
- package/lib-esm/Util/index.js.map +1 -1
- package/lib-esm/constants.js +1 -1
- package/lib-esm/index.d.ts +7 -8
- package/lib-esm/index.js +8 -9
- package/lib-esm/index.js.map +1 -1
- package/package.json +4 -3
- package/src/ClientDevice/android.ts +1 -1
- package/src/ClientDevice/browser.ts +1 -1
- package/src/ClientDevice/index.ts +1 -1
- package/src/ClientDevice/ios.ts +1 -1
- package/src/ClientDevice/reactnative.ts +1 -1
- package/src/Errors.ts +1 -1
- package/src/Hub.ts +1 -1
- package/src/I18n/I18n.ts +1 -1
- package/src/I18n/index.ts +1 -1
- package/src/I18n/types.ts +1 -1
- package/src/JS.ts +1 -1
- package/src/Logger/ConsoleLogger.ts +1 -1
- package/src/Logger/index.ts +2 -2
- package/src/Logger/logger-interface.ts +1 -1
- package/src/OAuthHelper/FacebookOAuth.ts +1 -1
- package/src/OAuthHelper/GoogleOAuth.ts +1 -1
- package/src/OAuthHelper/index.ts +1 -1
- package/src/Platform/index.ts +1 -1
- package/src/Providers/AWSCloudWatchProvider.ts +1 -1
- package/src/Providers/index.ts +1 -1
- package/src/RNComponents/index.ts +1 -1
- package/src/RNComponents/reactnative.ts +1 -1
- package/src/Signer.ts +1 -1
- package/src/StorageHelper/index.ts +1 -1
- package/src/StorageHelper/reactnative.ts +1 -1
- package/src/Util/Constants.ts +1 -1
- package/src/Util/index.ts +23 -5
- package/src/constants.ts +1 -1
- package/src/index.ts +46 -9
package/lib/Platform/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
/*
|
|
4
|
-
* Copyright 2017-
|
|
4
|
+
* Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
5
5
|
*
|
|
6
6
|
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
|
|
7
7
|
* the License. A copy of the License is located at
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const version = "4.7.10";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { CreateLogGroupCommandInput, CreateLogGroupCommandOutput, CreateLogStreamCommandInput, CreateLogStreamCommandOutput, DescribeLogGroupsCommandInput, DescribeLogGroupsCommandOutput, DescribeLogStreamsCommandInput, DescribeLogStreamsCommandOutput, GetLogEventsCommandInput, GetLogEventsCommandOutput, InputLogEvent } from '@aws-sdk/client-cloudwatch-logs';
|
|
2
|
+
import { AWSCloudWatchProviderOptions, LoggingProvider } from '../types/types';
|
|
3
|
+
declare class AWSCloudWatchProvider implements LoggingProvider {
|
|
4
|
+
static readonly PROVIDER_NAME = "AWSCloudWatch";
|
|
5
|
+
static readonly CATEGORY = "Logging";
|
|
6
|
+
private _config;
|
|
7
|
+
private _dataTracker;
|
|
8
|
+
private _currentLogBatch;
|
|
9
|
+
private _timer;
|
|
10
|
+
private _nextSequenceToken;
|
|
11
|
+
constructor(config?: AWSCloudWatchProviderOptions);
|
|
12
|
+
getProviderName(): string;
|
|
13
|
+
getCategoryName(): string;
|
|
14
|
+
getLogQueue(): InputLogEvent[];
|
|
15
|
+
configure(config?: AWSCloudWatchProviderOptions): AWSCloudWatchProviderOptions;
|
|
16
|
+
createLogGroup(params: CreateLogGroupCommandInput): Promise<CreateLogGroupCommandOutput>;
|
|
17
|
+
getLogGroups(params: DescribeLogGroupsCommandInput): Promise<DescribeLogGroupsCommandOutput>;
|
|
18
|
+
createLogStream(params: CreateLogStreamCommandInput): Promise<CreateLogStreamCommandOutput>;
|
|
19
|
+
getLogStreams(params: DescribeLogStreamsCommandInput): Promise<DescribeLogStreamsCommandOutput>;
|
|
20
|
+
getLogEvents(params: GetLogEventsCommandInput): Promise<GetLogEventsCommandOutput>;
|
|
21
|
+
pushLogs(logs: InputLogEvent[]): void;
|
|
22
|
+
private _validateLogGroupExistsAndCreate;
|
|
23
|
+
private _validateLogStreamExists;
|
|
24
|
+
private _sendLogEvents;
|
|
25
|
+
private _initCloudWatchLogs;
|
|
26
|
+
private _ensureCredentials;
|
|
27
|
+
private _getNextSequenceToken;
|
|
28
|
+
private _safeUploadLogEvents;
|
|
29
|
+
private _getBufferedBatchOfLogs;
|
|
30
|
+
private _getNewSequenceTokenAndSubmit;
|
|
31
|
+
private _initiateLogPushInterval;
|
|
32
|
+
private _getDocUploadPermissibility;
|
|
33
|
+
}
|
|
34
|
+
export { AWSCloudWatchProvider };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright 2017-
|
|
3
|
+
* Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
|
|
6
6
|
* the License. A copy of the License is located at
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AWSCloudWatchProvider } from './AWSCloudWatchProvider';
|
package/lib/Providers/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var
|
|
4
|
-
|
|
3
|
+
var AWSCloudWatchProvider_1 = require("./AWSCloudWatchProvider");
|
|
4
|
+
exports.AWSCloudWatchProvider = AWSCloudWatchProvider_1.AWSCloudWatchProvider;
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Providers/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Providers/index.ts"],"names":[],"mappings":";;AAAA,iEAAgE;AAAvD,wDAAA,qBAAqB,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright 2017-
|
|
3
|
+
* Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
|
|
6
6
|
* the License. A copy of the License is located at
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright 2017-
|
|
3
|
+
* Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
|
|
6
6
|
* the License. A copy of the License is located at
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provides a means to registering a service worker in the browser
|
|
3
|
+
* and communicating with it via postMessage events.
|
|
4
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/
|
|
5
|
+
*
|
|
6
|
+
* postMessage events are currently not supported in all browsers. See:
|
|
7
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API
|
|
8
|
+
*
|
|
9
|
+
* At the minmum this class will register the service worker and listen
|
|
10
|
+
* and attempt to dispatch messages on state change and record analytics
|
|
11
|
+
* events based on the service worker lifecycle.
|
|
12
|
+
*/
|
|
13
|
+
export declare class ServiceWorkerClass {
|
|
14
|
+
private _serviceWorker;
|
|
15
|
+
private _registration;
|
|
16
|
+
private _publicKey;
|
|
17
|
+
private _subscription;
|
|
18
|
+
private _logger;
|
|
19
|
+
constructor();
|
|
20
|
+
/**
|
|
21
|
+
* Get the currently active service worker
|
|
22
|
+
*/
|
|
23
|
+
get serviceWorker(): ServiceWorker;
|
|
24
|
+
/**
|
|
25
|
+
* Register the service-worker.js file in the browser
|
|
26
|
+
* Make sure the service-worker.js is part of the build
|
|
27
|
+
* for example with Angular, modify the angular-cli.json file
|
|
28
|
+
* and add to "assets" array "service-worker.js"
|
|
29
|
+
* @param {string} - (optional) Service worker file. Defaults to "/service-worker.js"
|
|
30
|
+
* @param {string} - (optional) The service worker scope. Defaults to "/"
|
|
31
|
+
* - API Doc: https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register
|
|
32
|
+
* @returns {Promise}
|
|
33
|
+
* - resolve(ServiceWorkerRegistration)
|
|
34
|
+
* - reject(Error)
|
|
35
|
+
**/
|
|
36
|
+
register(filePath?: string, scope?: string): Promise<unknown>;
|
|
37
|
+
/**
|
|
38
|
+
* Enable web push notifications. If not subscribed, a new subscription will
|
|
39
|
+
* be created and registered.
|
|
40
|
+
* Test Push Server: https://web-push-codelab.glitch.me/
|
|
41
|
+
* Push Server Libraries: https://github.com/web-push-libs/
|
|
42
|
+
* API Doc: https://developers.google.com/web/fundamentals/codelabs/push-notifications/
|
|
43
|
+
* @param publicKey
|
|
44
|
+
* @returns {Promise}
|
|
45
|
+
* - resolve(PushSubscription)
|
|
46
|
+
* - reject(Error)
|
|
47
|
+
*/
|
|
48
|
+
enablePush(publicKey: string): Promise<unknown>;
|
|
49
|
+
/**
|
|
50
|
+
* Convert a base64 encoded string to a Uint8 array for the push server key
|
|
51
|
+
* @param base64String
|
|
52
|
+
*/
|
|
53
|
+
private _urlB64ToUint8Array;
|
|
54
|
+
/**
|
|
55
|
+
* Send a message to the service worker. The service worker needs
|
|
56
|
+
* to implement `self.addEventListener('message') to handle the
|
|
57
|
+
* message. This ***currently*** does not work in Safari or IE.
|
|
58
|
+
* @param {object | string} - An arbitrary JSON object or string message to send to the service worker
|
|
59
|
+
* - see: https://developer.mozilla.org/en-US/docs/Web/API/Transferable
|
|
60
|
+
* @returns {Promise}
|
|
61
|
+
**/
|
|
62
|
+
send(message: object | string): void;
|
|
63
|
+
/**
|
|
64
|
+
* Listen for service worker state change and message events
|
|
65
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/state
|
|
66
|
+
**/
|
|
67
|
+
_setupListeners(): void;
|
|
68
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
|
|
5
|
+
* the License. A copy of the License is located at
|
|
6
|
+
*
|
|
7
|
+
* http://aws.amazon.com/apache2.0/
|
|
8
|
+
*
|
|
9
|
+
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
10
|
+
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
|
|
11
|
+
* and limitations under the License.
|
|
12
|
+
*/
|
|
13
|
+
export { ServiceWorkerClass as ServiceWorker } from './ServiceWorker';
|
package/lib/Signer.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export declare class Signer {
|
|
2
|
+
/**
|
|
3
|
+
* Sign a HTTP request, add 'Authorization' header to request param
|
|
4
|
+
* @method sign
|
|
5
|
+
* @memberof Signer
|
|
6
|
+
* @static
|
|
7
|
+
*
|
|
8
|
+
* @param {object} request - HTTP request object
|
|
9
|
+
<pre>
|
|
10
|
+
request: {
|
|
11
|
+
method: GET | POST | PUT ...
|
|
12
|
+
url: ...,
|
|
13
|
+
headers: {
|
|
14
|
+
header1: ...
|
|
15
|
+
},
|
|
16
|
+
data: data
|
|
17
|
+
}
|
|
18
|
+
</pre>
|
|
19
|
+
* @param {object} access_info - AWS access credential info
|
|
20
|
+
<pre>
|
|
21
|
+
access_info: {
|
|
22
|
+
access_key: ...,
|
|
23
|
+
secret_key: ...,
|
|
24
|
+
session_token: ...
|
|
25
|
+
}
|
|
26
|
+
</pre>
|
|
27
|
+
* @param {object} [service_info] - AWS service type and region, optional,
|
|
28
|
+
* if not provided then parse out from url
|
|
29
|
+
<pre>
|
|
30
|
+
service_info: {
|
|
31
|
+
service: ...,
|
|
32
|
+
region: ...
|
|
33
|
+
}
|
|
34
|
+
</pre>
|
|
35
|
+
*
|
|
36
|
+
* @returns {object} Signed HTTP request
|
|
37
|
+
*/
|
|
38
|
+
static sign(request: any, access_info: any, service_info?: any): any;
|
|
39
|
+
static signUrl(urlToSign: string, accessInfo: any, serviceInfo?: any, expiration?: number): string;
|
|
40
|
+
static signUrl(request: any, accessInfo: any, serviceInfo?: any, expiration?: number): string;
|
|
41
|
+
}
|
package/lib/Signer.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright 2017-
|
|
3
|
+
* Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
|
|
6
6
|
* the License. A copy of the License is located at
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/** @class */
|
|
2
|
+
export declare class MemoryStorage {
|
|
3
|
+
/**
|
|
4
|
+
* This is used to set a specific item in storage
|
|
5
|
+
* @param {string} key - the key for the item
|
|
6
|
+
* @param {object} value - the value
|
|
7
|
+
* @returns {string} value that was set
|
|
8
|
+
*/
|
|
9
|
+
static setItem(key: string, value: any): any;
|
|
10
|
+
/**
|
|
11
|
+
* This is used to get a specific key from storage
|
|
12
|
+
* @param {string} key - the key for the item
|
|
13
|
+
* This is used to clear the storage
|
|
14
|
+
* @returns {string} the data item
|
|
15
|
+
*/
|
|
16
|
+
static getItem(key: string): any;
|
|
17
|
+
/**
|
|
18
|
+
* This is used to remove an item from storage
|
|
19
|
+
* @param {string} key - the key being set
|
|
20
|
+
* @returns {string} value - value that was deleted
|
|
21
|
+
*/
|
|
22
|
+
static removeItem(key: string): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* This is used to clear the storage
|
|
25
|
+
* @returns {string} nothing
|
|
26
|
+
*/
|
|
27
|
+
static clear(): {};
|
|
28
|
+
}
|
|
29
|
+
export declare class StorageHelper {
|
|
30
|
+
private storageWindow;
|
|
31
|
+
/**
|
|
32
|
+
* This is used to get a storage object
|
|
33
|
+
* @returns {object} the storage
|
|
34
|
+
*/
|
|
35
|
+
constructor();
|
|
36
|
+
/**
|
|
37
|
+
* This is used to return the storage
|
|
38
|
+
* @returns {object} the storage
|
|
39
|
+
*/
|
|
40
|
+
getStorage(): any;
|
|
41
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright 2017-
|
|
3
|
+
* Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
|
|
6
6
|
* the License. A copy of the License is located at
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare class StorageHelper {
|
|
2
|
+
private storageWindow;
|
|
3
|
+
/**
|
|
4
|
+
* This is used to get a storage object
|
|
5
|
+
* @returns {object} the storage
|
|
6
|
+
*/
|
|
7
|
+
constructor();
|
|
8
|
+
/**
|
|
9
|
+
* This is used to return the storage
|
|
10
|
+
* @returns {object} the storage
|
|
11
|
+
*/
|
|
12
|
+
getStorage(): any;
|
|
13
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var tslib_1 = require("tslib");
|
|
4
4
|
/*
|
|
5
|
-
* Copyright 2017-
|
|
5
|
+
* Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
6
6
|
*
|
|
7
7
|
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
|
|
8
8
|
* the License. A copy of the License is located at
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import Cookies from 'universal-cookie';
|
|
2
|
+
declare type Store = Record<string, string>;
|
|
3
|
+
declare type Context = {
|
|
4
|
+
req?: any;
|
|
5
|
+
};
|
|
6
|
+
export declare class UniversalStorage implements Storage {
|
|
7
|
+
cookies: Cookies;
|
|
8
|
+
store: Store;
|
|
9
|
+
constructor(context?: Context);
|
|
10
|
+
get length(): number;
|
|
11
|
+
clear(): void;
|
|
12
|
+
getItem(key: keyof Store): string;
|
|
13
|
+
protected getLocalItem(key: keyof Store): string;
|
|
14
|
+
protected getUniversalItem(key: keyof Store): any;
|
|
15
|
+
key(index: number): string;
|
|
16
|
+
removeItem(key: string): void;
|
|
17
|
+
protected removeLocalItem(key: keyof Store): void;
|
|
18
|
+
protected removeUniversalItem(key: keyof Store): void;
|
|
19
|
+
setItem(key: keyof Store, value: string): void;
|
|
20
|
+
protected setLocalItem(key: keyof Store, value: string): void;
|
|
21
|
+
protected setUniversalItem(key: keyof Store, value: string): void;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @private For internal Amplify use.
|
|
3
|
+
*
|
|
4
|
+
* Creates a new scope for promises, observables, and other types of work or
|
|
5
|
+
* processes that may be running in the background. This manager provides
|
|
6
|
+
* an singular entrypoint to request termination and await completion.
|
|
7
|
+
*
|
|
8
|
+
* As work completes on its own prior to close, the manager removes them
|
|
9
|
+
* from the registry to avoid holding references to completed jobs.
|
|
10
|
+
*/
|
|
11
|
+
export declare class BackgroundProcessManager {
|
|
12
|
+
/**
|
|
13
|
+
* A string indicating whether the manager is accepting new work ("Open"),
|
|
14
|
+
* waiting for work to complete ("Closing"), or fully done with all
|
|
15
|
+
* submitted work and *not* accepting new jobs ("Closed").
|
|
16
|
+
*/
|
|
17
|
+
private _state;
|
|
18
|
+
private _closingPromise;
|
|
19
|
+
/**
|
|
20
|
+
* The list of outstanding jobs we'll need to wait for upon `close()`
|
|
21
|
+
*/
|
|
22
|
+
private jobs;
|
|
23
|
+
/**
|
|
24
|
+
* Creates a new manager for promises, observables, and other types
|
|
25
|
+
* of work that may be running in the background. This manager provides
|
|
26
|
+
* a centralized mechanism to request termination and await completion.
|
|
27
|
+
*/
|
|
28
|
+
constructor();
|
|
29
|
+
/**
|
|
30
|
+
* Executes an async `job` function, passing the return value through to
|
|
31
|
+
* the caller, registering it as a running job in the manager. When the
|
|
32
|
+
* manager *closes*, it will `await` the job.
|
|
33
|
+
*
|
|
34
|
+
* @param job The function to execute.
|
|
35
|
+
* @param description Optional description to help identify pending jobs.
|
|
36
|
+
* @returns The return value from the given function.
|
|
37
|
+
*/
|
|
38
|
+
add<T>(job: () => Promise<T>, description?: string): Promise<T>;
|
|
39
|
+
/**
|
|
40
|
+
* Executes an async `job` function, passing the return value through to
|
|
41
|
+
* the caller, registering it as a running job in the manager. When the
|
|
42
|
+
* manager *closes*, it will request termination by resolving the
|
|
43
|
+
* provided `onTerminate` promise. It will then `await` the job, so it is
|
|
44
|
+
* important that the job still `resolve()` or `reject()` when responding
|
|
45
|
+
* to a termination request.
|
|
46
|
+
*
|
|
47
|
+
* @param job The function to execute.
|
|
48
|
+
* @param description Optional description to help identify pending jobs.
|
|
49
|
+
* @returns The return value from the given function.
|
|
50
|
+
*/
|
|
51
|
+
add<T>(job: (onTerminate: Promise<void>) => Promise<T>, description?: string): Promise<T>;
|
|
52
|
+
/**
|
|
53
|
+
* Create a no-op job, registers it with the manager, and returns hooks
|
|
54
|
+
* to the caller to signal the job's completion and respond to termination
|
|
55
|
+
* requests.
|
|
56
|
+
*
|
|
57
|
+
* When the manager closes, the no-op job will be `await`-ed, so its
|
|
58
|
+
* important to always `resolve()` or `reject()` when done responding to an
|
|
59
|
+
* `onTerminate` signal.
|
|
60
|
+
* @param description Optional description to help identify pending jobs.
|
|
61
|
+
* @returns Job promise hooks + onTerminate signaling promise
|
|
62
|
+
*/
|
|
63
|
+
add(description?: string): {
|
|
64
|
+
resolve: (value?: unknown) => void;
|
|
65
|
+
reject: (reason?: any) => void;
|
|
66
|
+
onTerminate: Promise<void>;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Adds another job manager to await on at the time of closing. the inner
|
|
70
|
+
* manager's termination is signaled when this manager's `close()` is
|
|
71
|
+
* called for.
|
|
72
|
+
*
|
|
73
|
+
* @param job The inner job manager to await.
|
|
74
|
+
* @param description Optional description to help identify pending jobs.
|
|
75
|
+
*/
|
|
76
|
+
add(job: BackgroundProcessManager, description?: string): any;
|
|
77
|
+
/**
|
|
78
|
+
* Adds a **cleaner** function that doesn't immediately get executed.
|
|
79
|
+
* Instead, the caller gets a **terminate** function back. The *cleaner* is
|
|
80
|
+
* invoked only once the mananger *closes* or the returned **terminate**
|
|
81
|
+
* function is called.
|
|
82
|
+
*
|
|
83
|
+
* @param clean The cleanup function.
|
|
84
|
+
* @param description Optional description to help identify pending jobs.
|
|
85
|
+
* @returns A terminate function.
|
|
86
|
+
*/
|
|
87
|
+
addCleaner<T>(clean: () => Promise<T>, description?: string): () => Promise<void>;
|
|
88
|
+
private addFunction;
|
|
89
|
+
private addManager;
|
|
90
|
+
/**
|
|
91
|
+
* Creates and registers a fabricated job for processes that need to operate
|
|
92
|
+
* with callbacks/hooks. The returned `resolve` and `reject`
|
|
93
|
+
* functions can be used to signal the job is done successfully or not.
|
|
94
|
+
* The returned `onTerminate` is a promise that will resolve when the
|
|
95
|
+
* manager is requesting the termination of the job.
|
|
96
|
+
*
|
|
97
|
+
* @param description Optional description to help identify pending jobs.
|
|
98
|
+
* @returns `{ resolve, reject, onTerminate }`
|
|
99
|
+
*/
|
|
100
|
+
private addHook;
|
|
101
|
+
/**
|
|
102
|
+
* Adds a Promise based job to the list of jobs for monitoring and listens
|
|
103
|
+
* for either a success or failure, upon which the job is considered "done"
|
|
104
|
+
* and removed from the registry.
|
|
105
|
+
*
|
|
106
|
+
* @param promise A promise that is on its way to being returned to a
|
|
107
|
+
* caller, which needs to be tracked as a background job.
|
|
108
|
+
* @param terminate The termination function to register, which can be
|
|
109
|
+
* invoked to request the job stop.
|
|
110
|
+
* @param description Optional description to help identify pending jobs.
|
|
111
|
+
*/
|
|
112
|
+
private registerPromise;
|
|
113
|
+
/**
|
|
114
|
+
* The number of jobs being waited on.
|
|
115
|
+
*
|
|
116
|
+
* We don't use this for anything. It's just informational for the caller,
|
|
117
|
+
* and can be used in logging and testing.
|
|
118
|
+
*
|
|
119
|
+
* @returns the number of jobs.
|
|
120
|
+
*/
|
|
121
|
+
get length(): number;
|
|
122
|
+
/**
|
|
123
|
+
* The execution state of the manager. One of:
|
|
124
|
+
*
|
|
125
|
+
* 1. "Open" -> Accepting new jobs
|
|
126
|
+
* 1. "Closing" -> Not accepting new work. Waiting for jobs to complete.
|
|
127
|
+
* 1. "Closed" -> Not accepting new work. All submitted jobs are complete.
|
|
128
|
+
*/
|
|
129
|
+
get state(): BackgroundProcessManagerState;
|
|
130
|
+
/**
|
|
131
|
+
* The registered `description` of all still-pending jobs.
|
|
132
|
+
*
|
|
133
|
+
* @returns descriptions as an array.
|
|
134
|
+
*/
|
|
135
|
+
get pending(): string[];
|
|
136
|
+
/**
|
|
137
|
+
* Whether the manager is accepting new jobs.
|
|
138
|
+
*/
|
|
139
|
+
get isOpen(): boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Whether the manager is rejecting new work, but still waiting for
|
|
142
|
+
* submitted work to complete.
|
|
143
|
+
*/
|
|
144
|
+
get isClosing(): boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Whether the manager is rejecting work and done waiting for submitted
|
|
147
|
+
* work to complete.
|
|
148
|
+
*/
|
|
149
|
+
get isClosed(): boolean;
|
|
150
|
+
private closedFailure;
|
|
151
|
+
/**
|
|
152
|
+
* Signals jobs to stop (for those that accept interruptions) and waits
|
|
153
|
+
* for confirmation that jobs have stopped.
|
|
154
|
+
*
|
|
155
|
+
* This immediately puts the manager into a closing state and just begins
|
|
156
|
+
* to reject new work. After all work in the manager is complete, the
|
|
157
|
+
* manager goes into a `Completed` state and `close()` returns.
|
|
158
|
+
*
|
|
159
|
+
* This call is idempotent.
|
|
160
|
+
*
|
|
161
|
+
* If the manager is already closing or closed, `finalCleaup` is not executed.
|
|
162
|
+
*
|
|
163
|
+
* @param onClosed
|
|
164
|
+
* @returns The settled results of each still-running job's promise. If the
|
|
165
|
+
* manager is already closed, this will contain the results as of when the
|
|
166
|
+
* manager's `close()` was called in an `Open` state.
|
|
167
|
+
*/
|
|
168
|
+
close(): Promise<any>;
|
|
169
|
+
/**
|
|
170
|
+
* Signals the manager to start accepting work (again) and returns once
|
|
171
|
+
* the manager is ready to do so.
|
|
172
|
+
*
|
|
173
|
+
* If the state is already `Open`, this call is a no-op.
|
|
174
|
+
*
|
|
175
|
+
* If the state is `Closed`, this call simply updates state and returns.
|
|
176
|
+
*
|
|
177
|
+
* If the state is `Closing`, this call waits for completion before it
|
|
178
|
+
* updates the state and returns.
|
|
179
|
+
*/
|
|
180
|
+
open(): Promise<void>;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
*
|
|
184
|
+
*/
|
|
185
|
+
export declare class BackgroundManagerNotOpenError extends Error {
|
|
186
|
+
constructor(message: string);
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* All possible states a `BackgroundProcessManager` instance can be in.
|
|
190
|
+
*/
|
|
191
|
+
export declare enum BackgroundProcessManagerState {
|
|
192
|
+
/**
|
|
193
|
+
* Accepting new jobs.
|
|
194
|
+
*/
|
|
195
|
+
Open = "Open",
|
|
196
|
+
/**
|
|
197
|
+
* Not accepting new jobs. Waiting for submitted jobs to complete.
|
|
198
|
+
*/
|
|
199
|
+
Closing = "Closing",
|
|
200
|
+
/**
|
|
201
|
+
* Not accepting new jobs. All submitted jobs are complete.
|
|
202
|
+
*/
|
|
203
|
+
Closed = "Closed"
|
|
204
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
declare const AWS_CLOUDWATCH_BASE_BUFFER_SIZE = 26;
|
|
2
|
+
declare const AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE = 1048576;
|
|
3
|
+
declare const AWS_CLOUDWATCH_MAX_EVENT_SIZE = 256000;
|
|
4
|
+
declare const AWS_CLOUDWATCH_CATEGORY = "Logging";
|
|
5
|
+
declare const AWS_CLOUDWATCH_PROVIDER_NAME = "AWSCloudWatch";
|
|
6
|
+
declare const NO_CREDS_ERROR_STRING = "No credentials";
|
|
7
|
+
declare const RETRY_ERROR_CODES: string[];
|
|
8
|
+
export { AWS_CLOUDWATCH_BASE_BUFFER_SIZE, AWS_CLOUDWATCH_CATEGORY, AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE, AWS_CLOUDWATCH_MAX_EVENT_SIZE, AWS_CLOUDWATCH_PROVIDER_NAME, NO_CREDS_ERROR_STRING, RETRY_ERROR_CODES, };
|
package/lib/Util/Constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright 2017-
|
|
3
|
+
* Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
|
|
6
6
|
* the License. A copy of the License is located at
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Date & time utility functions to abstract the `aws-sdk` away from users.
|
|
3
|
+
* (v2 => v3 modularization is a breaking change)
|
|
4
|
+
*
|
|
5
|
+
* @see https://github.com/aws/aws-sdk-js/blob/6edf586dcc1de7fe8fbfbbd9a0d2b1847921e6e1/lib/util.js#L262
|
|
6
|
+
*/
|
|
7
|
+
export declare const DateUtils: any;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2016 Christian Speckner <cnspeckn@googlemail.com>
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in
|
|
14
|
+
* all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
22
|
+
* THE SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
interface MutexInterface {
|
|
25
|
+
acquire(): Promise<MutexInterface.Releaser>;
|
|
26
|
+
runExclusive<T>(callback: MutexInterface.Worker<T>): Promise<T>;
|
|
27
|
+
isLocked(): boolean;
|
|
28
|
+
}
|
|
29
|
+
declare namespace MutexInterface {
|
|
30
|
+
interface Releaser {
|
|
31
|
+
(): void;
|
|
32
|
+
}
|
|
33
|
+
interface Worker<T> {
|
|
34
|
+
(): Promise<T> | T;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
declare class Mutex implements MutexInterface {
|
|
38
|
+
isLocked(): boolean;
|
|
39
|
+
acquire(): Promise<MutexInterface.Releaser>;
|
|
40
|
+
runExclusive<T>(callback: MutexInterface.Worker<T>): Promise<T>;
|
|
41
|
+
private _dispatchNext;
|
|
42
|
+
private _queue;
|
|
43
|
+
private _pending;
|
|
44
|
+
}
|
|
45
|
+
export default Mutex;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import Observable from 'zen-observable-ts';
|
|
2
|
+
declare type NetworkStatus = {
|
|
3
|
+
online: boolean;
|
|
4
|
+
};
|
|
5
|
+
export default class ReachabilityNavigator implements Reachability {
|
|
6
|
+
private static _observers;
|
|
7
|
+
networkMonitor(netInfo?: any): Observable<NetworkStatus>;
|
|
8
|
+
private static _observerOverride;
|
|
9
|
+
}
|
|
10
|
+
interface Reachability {
|
|
11
|
+
networkMonitor(netInfo?: any): Observable<NetworkStatus>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import Observable from 'zen-observable-ts';
|
|
2
|
+
declare type NetworkStatus = {
|
|
3
|
+
online: boolean;
|
|
4
|
+
};
|
|
5
|
+
export default class ReachabilityNavigator implements Reachability {
|
|
6
|
+
networkMonitor(netInfo?: any): Observable<NetworkStatus>;
|
|
7
|
+
}
|
|
8
|
+
interface Reachability {
|
|
9
|
+
networkMonitor(netInfo?: any): Observable<NetworkStatus>;
|
|
10
|
+
}
|
|
11
|
+
export {};
|