@aws-amplify/core 6.0.1-console-preview.047a1dd.0 → 6.0.1-next.3e9fc9c.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/Cache/Utils/CacheUtils.js +4 -2
- package/lib/Platform/version.d.ts +1 -1
- package/lib/Platform/version.js +1 -1
- package/lib/RNComponents/index.d.ts +6 -0
- package/lib/RNComponents/index.js +16 -0
- package/lib/{providers/pinpoint/utils → RNComponents}/isAppInForeground.js +4 -1
- package/lib/RNComponents/reactnative.d.ts +3 -0
- package/lib/RNComponents/reactnative.js +14 -0
- package/lib/{storage/CookieStorage.d.ts → StorageHelper/cookieStorage.d.ts} +3 -4
- package/lib/{storage/CookieStorage.js → StorageHelper/cookieStorage.js} +83 -35
- package/lib/StorageHelper/inMemoryStorage.d.ts +10 -0
- package/lib/StorageHelper/inMemoryStorage.js +82 -0
- package/lib/StorageHelper/index.d.ts +45 -0
- package/lib/StorageHelper/index.js +83 -0
- package/lib/{storage/DefaultStorage.native.d.ts → StorageHelper/localStorage.d.ts} +6 -7
- package/lib/{storage/KeyValueStorage.js → StorageHelper/localStorage.js} +15 -13
- package/lib/StorageHelper/reactnative.d.ts +83 -0
- package/lib/StorageHelper/reactnative.js +250 -0
- package/lib/{storage/KeyValueStorage.d.ts → StorageHelper/sessionStorage.d.ts} +4 -5
- package/lib/{storage/DefaultStorage.native.js → StorageHelper/sessionStorage.js} +43 -46
- package/lib/index.d.ts +1 -1
- package/lib/index.js +8 -6
- package/lib/libraryUtils.d.ts +1 -0
- package/lib/libraryUtils.js +5 -1
- package/lib/parseAWSExports.js +1 -20
- package/lib/providers/pinpoint/utils/PinpointEventBuffer.js +5 -7
- package/lib/singleton/types.d.ts +1 -4
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/storage.d.ts +0 -3
- package/lib-esm/Cache/Utils/CacheUtils.js +4 -2
- package/lib-esm/Platform/version.d.ts +1 -1
- package/lib-esm/Platform/version.js +1 -1
- package/lib-esm/RNComponents/index.d.ts +6 -0
- package/lib-esm/RNComponents/index.js +13 -0
- package/lib-esm/RNComponents/isAppInForeground.js +6 -0
- package/lib-esm/RNComponents/reactnative.d.ts +3 -0
- package/lib-esm/RNComponents/reactnative.js +6 -0
- package/lib-esm/{storage/CookieStorage.d.ts → StorageHelper/cookieStorage.d.ts} +3 -4
- package/lib-esm/{storage/CookieStorage.js → StorageHelper/cookieStorage.js} +61 -36
- package/lib-esm/StorageHelper/inMemoryStorage.d.ts +10 -0
- package/lib-esm/StorageHelper/inMemoryStorage.js +79 -0
- package/lib-esm/StorageHelper/index.d.ts +45 -0
- package/lib-esm/StorageHelper/index.js +76 -0
- package/lib-esm/{storage/DefaultStorage.native.d.ts → StorageHelper/localStorage.d.ts} +6 -7
- package/lib-esm/{storage/KeyValueStorage.js → StorageHelper/localStorage.js} +14 -12
- package/lib-esm/StorageHelper/reactnative.d.ts +83 -0
- package/lib-esm/StorageHelper/reactnative.js +244 -0
- package/lib-esm/{storage/KeyValueStorage.d.ts → StorageHelper/sessionStorage.d.ts} +4 -5
- package/lib-esm/{storage/DefaultStorage.native.js → StorageHelper/sessionStorage.js} +42 -45
- package/lib-esm/index.d.ts +1 -1
- package/lib-esm/index.js +1 -1
- package/lib-esm/libraryUtils.d.ts +1 -0
- package/lib-esm/libraryUtils.js +1 -0
- package/lib-esm/parseAWSExports.js +1 -20
- package/lib-esm/providers/pinpoint/utils/PinpointEventBuffer.js +5 -7
- package/lib-esm/singleton/types.d.ts +1 -4
- package/lib-esm/tsconfig.tsbuildinfo +1 -1
- package/lib-esm/types/storage.d.ts +0 -3
- package/package.json +4 -3
- package/src/Cache/Utils/CacheUtils.ts +4 -2
- package/src/Platform/version.ts +1 -1
- package/src/RNComponents/index.ts +16 -0
- package/src/RNComponents/isAppInForeground.ts +8 -0
- package/src/RNComponents/reactnative.ts +6 -0
- package/src/StorageHelper/cookieStorage.ts +99 -0
- package/src/StorageHelper/inMemoryStorage.ts +32 -0
- package/src/StorageHelper/index.ts +78 -0
- package/src/StorageHelper/localStorage.ts +60 -0
- package/src/StorageHelper/reactnative.ts +182 -0
- package/src/{storage/KeyValueStorage.ts → StorageHelper/sessionStorage.ts} +13 -10
- package/src/index.ts +6 -4
- package/src/libraryUtils.ts +1 -0
- package/src/parseAWSExports.ts +0 -26
- package/src/providers/pinpoint/utils/PinpointEventBuffer.ts +12 -16
- package/src/singleton/types.ts +1 -4
- package/src/types/storage.ts +0 -4
- package/lib/providers/pinpoint/utils/isAppInForeground.native.d.ts +0 -1
- package/lib/providers/pinpoint/utils/isAppInForeground.native.js +0 -9
- package/lib/singleton/API/types.d.ts +0 -34
- package/lib/singleton/API/types.js +0 -2
- package/lib/storage/CookieStorage.native.d.ts +0 -7
- package/lib/storage/CookieStorage.native.js +0 -32
- package/lib/storage/DefaultStorage.d.ts +0 -7
- package/lib/storage/DefaultStorage.js +0 -33
- package/lib/storage/InMemoryStorage.d.ts +0 -12
- package/lib/storage/InMemoryStorage.js +0 -41
- package/lib/storage/SessionStorage.d.ts +0 -7
- package/lib/storage/SessionStorage.js +0 -33
- package/lib/storage/index.d.ts +0 -7
- package/lib/storage/index.js +0 -14
- package/lib/storage/utils.d.ts +0 -10
- package/lib/storage/utils.js +0 -26
- package/lib-esm/providers/pinpoint/utils/isAppInForeground.js +0 -3
- package/lib-esm/providers/pinpoint/utils/isAppInForeground.native.d.ts +0 -1
- package/lib-esm/providers/pinpoint/utils/isAppInForeground.native.js +0 -5
- package/lib-esm/singleton/API/types.d.ts +0 -34
- package/lib-esm/singleton/API/types.js +0 -1
- package/lib-esm/storage/CookieStorage.native.d.ts +0 -7
- package/lib-esm/storage/CookieStorage.native.js +0 -29
- package/lib-esm/storage/DefaultStorage.d.ts +0 -7
- package/lib-esm/storage/DefaultStorage.js +0 -30
- package/lib-esm/storage/InMemoryStorage.d.ts +0 -12
- package/lib-esm/storage/InMemoryStorage.js +0 -38
- package/lib-esm/storage/SessionStorage.d.ts +0 -7
- package/lib-esm/storage/SessionStorage.js +0 -30
- package/lib-esm/storage/index.d.ts +0 -7
- package/lib-esm/storage/index.js +0 -10
- package/lib-esm/storage/utils.d.ts +0 -10
- package/lib-esm/storage/utils.js +0 -21
- package/src/providers/pinpoint/utils/isAppInForeground.native.ts +0 -7
- package/src/providers/pinpoint/utils/isAppInForeground.ts +0 -4
- package/src/singleton/API/types.ts +0 -31
- package/src/storage/CookieStorage.native.ts +0 -13
- package/src/storage/CookieStorage.ts +0 -72
- package/src/storage/DefaultStorage.native.ts +0 -78
- package/src/storage/DefaultStorage.ts +0 -14
- package/src/storage/InMemoryStorage.ts +0 -36
- package/src/storage/SessionStorage.ts +0 -14
- package/src/storage/index.ts +0 -13
- package/src/storage/utils.ts +0 -22
- /package/lib/{providers/pinpoint/utils → RNComponents}/isAppInForeground.d.ts +0 -0
- /package/lib-esm/{providers/pinpoint/utils → RNComponents}/isAppInForeground.d.ts +0 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { KeyValueStorageInterface } from '../types';
|
|
2
|
+
/** @class */
|
|
3
|
+
declare class MemoryStorage {
|
|
4
|
+
static syncPromise: Promise<void> | null;
|
|
5
|
+
/**
|
|
6
|
+
* This is used to set a specific item in storage
|
|
7
|
+
* @param {string} key - the key for the item
|
|
8
|
+
* @param {object} value - the value
|
|
9
|
+
* @returns {string} value that was set
|
|
10
|
+
*/
|
|
11
|
+
static setItem(key: string, value: string): string | null | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* This is used to get a specific key from storage
|
|
14
|
+
* @param {string} key - the key for the item
|
|
15
|
+
* This is used to clear the storage
|
|
16
|
+
* @returns {string} the data item
|
|
17
|
+
*/
|
|
18
|
+
static getItem(key: string): string | null | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* This is used to remove an item from storage
|
|
21
|
+
* @param {string} key - the key being set
|
|
22
|
+
* @returns {string} value - value that was deleted
|
|
23
|
+
*/
|
|
24
|
+
static removeItem(key: string): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* This is used to clear the storage
|
|
27
|
+
* @returns {string} nothing
|
|
28
|
+
*/
|
|
29
|
+
static clear(): Record<string, string | null>;
|
|
30
|
+
/**
|
|
31
|
+
* Will sync the MemoryStorage data from AsyncStorage to storageWindow MemoryStorage
|
|
32
|
+
* @returns {void}
|
|
33
|
+
*/
|
|
34
|
+
static sync(): Promise<void>;
|
|
35
|
+
}
|
|
36
|
+
export declare class StorageHelper {
|
|
37
|
+
private storageWindow;
|
|
38
|
+
/**
|
|
39
|
+
* This is used to get a storage object
|
|
40
|
+
* @returns {object} the storage
|
|
41
|
+
*/
|
|
42
|
+
constructor();
|
|
43
|
+
/**
|
|
44
|
+
* This is used to return the storage
|
|
45
|
+
* @returns {object} the storage
|
|
46
|
+
*/
|
|
47
|
+
getStorage(): typeof MemoryStorage;
|
|
48
|
+
}
|
|
49
|
+
declare class AsyncStorageClass implements KeyValueStorageInterface {
|
|
50
|
+
syncPromise: Promise<void> | null;
|
|
51
|
+
/**
|
|
52
|
+
* This is used to set a specific item in storage
|
|
53
|
+
* @param {string} key - the key for the item
|
|
54
|
+
* @param {object} value - the value
|
|
55
|
+
* @returns {string} value that was set
|
|
56
|
+
*/
|
|
57
|
+
setItem(key: string, value: string): Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* This is used to get a specific key from storage
|
|
60
|
+
* @param {string} key - the key for the item
|
|
61
|
+
* This is used to clear the storage
|
|
62
|
+
* @returns {string} the data item
|
|
63
|
+
*/
|
|
64
|
+
getItem(key: string): Promise<string | null>;
|
|
65
|
+
/**
|
|
66
|
+
* This is used to remove an item from storage
|
|
67
|
+
* @param {string} key - the key being set
|
|
68
|
+
* @returns {string} value - value that was deleted
|
|
69
|
+
*/
|
|
70
|
+
removeItem(key: string): Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* This is used to clear the storage
|
|
73
|
+
* @returns {string} nothing
|
|
74
|
+
*/
|
|
75
|
+
clear(): Promise<void>;
|
|
76
|
+
/**
|
|
77
|
+
* Will sync the MemoryStorage data from AsyncStorage to storageWindow MemoryStorage
|
|
78
|
+
* @returns {void}
|
|
79
|
+
*/
|
|
80
|
+
sync(): Promise<void>;
|
|
81
|
+
}
|
|
82
|
+
export declare const AsyncStorageKeyValue: AsyncStorageClass;
|
|
83
|
+
export {};
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.AsyncStorageKeyValue = exports.StorageHelper = void 0;
|
|
43
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
44
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
45
|
+
var async_storage_1 = __importDefault(require("@react-native-async-storage/async-storage"));
|
|
46
|
+
var MEMORY_KEY_PREFIX = '@MemoryStorage:';
|
|
47
|
+
var dataMemory = {};
|
|
48
|
+
/** @class */
|
|
49
|
+
var MemoryStorage = /** @class */ (function () {
|
|
50
|
+
function MemoryStorage() {
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* This is used to set a specific item in storage
|
|
54
|
+
* @param {string} key - the key for the item
|
|
55
|
+
* @param {object} value - the value
|
|
56
|
+
* @returns {string} value that was set
|
|
57
|
+
*/
|
|
58
|
+
MemoryStorage.setItem = function (key, value) {
|
|
59
|
+
if (value) {
|
|
60
|
+
async_storage_1.default.setItem(MEMORY_KEY_PREFIX + key, value);
|
|
61
|
+
dataMemory[key] = value;
|
|
62
|
+
return dataMemory[key];
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* This is used to get a specific key from storage
|
|
67
|
+
* @param {string} key - the key for the item
|
|
68
|
+
* This is used to clear the storage
|
|
69
|
+
* @returns {string} the data item
|
|
70
|
+
*/
|
|
71
|
+
MemoryStorage.getItem = function (key) {
|
|
72
|
+
return Object.prototype.hasOwnProperty.call(dataMemory, key)
|
|
73
|
+
? dataMemory[key]
|
|
74
|
+
: undefined;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* This is used to remove an item from storage
|
|
78
|
+
* @param {string} key - the key being set
|
|
79
|
+
* @returns {string} value - value that was deleted
|
|
80
|
+
*/
|
|
81
|
+
MemoryStorage.removeItem = function (key) {
|
|
82
|
+
async_storage_1.default.removeItem(MEMORY_KEY_PREFIX + key);
|
|
83
|
+
return delete dataMemory[key];
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* This is used to clear the storage
|
|
87
|
+
* @returns {string} nothing
|
|
88
|
+
*/
|
|
89
|
+
MemoryStorage.clear = function () {
|
|
90
|
+
dataMemory = {};
|
|
91
|
+
return dataMemory;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Will sync the MemoryStorage data from AsyncStorage to storageWindow MemoryStorage
|
|
95
|
+
* @returns {void}
|
|
96
|
+
*/
|
|
97
|
+
MemoryStorage.sync = function () {
|
|
98
|
+
if (!MemoryStorage.syncPromise) {
|
|
99
|
+
MemoryStorage.syncPromise = new Promise(function (res, rej) {
|
|
100
|
+
async_storage_1.default.getAllKeys(function (errKeys, keys) {
|
|
101
|
+
var _a;
|
|
102
|
+
if (errKeys)
|
|
103
|
+
rej(errKeys);
|
|
104
|
+
var memoryKeys = (_a = keys === null || keys === void 0 ? void 0 : keys.filter(function (key) { return key.startsWith(MEMORY_KEY_PREFIX); })) !== null && _a !== void 0 ? _a : [];
|
|
105
|
+
async_storage_1.default.multiGet(memoryKeys, function (err, stores) {
|
|
106
|
+
if (err)
|
|
107
|
+
rej(err);
|
|
108
|
+
stores &&
|
|
109
|
+
stores.map(function (result, index, store) {
|
|
110
|
+
var key = store[index][0];
|
|
111
|
+
var value = store[index][1];
|
|
112
|
+
var memoryKey = key.replace(MEMORY_KEY_PREFIX, '');
|
|
113
|
+
dataMemory[memoryKey] = value;
|
|
114
|
+
});
|
|
115
|
+
res();
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
return MemoryStorage.syncPromise;
|
|
121
|
+
};
|
|
122
|
+
MemoryStorage.syncPromise = null;
|
|
123
|
+
return MemoryStorage;
|
|
124
|
+
}());
|
|
125
|
+
var StorageHelper = /** @class */ (function () {
|
|
126
|
+
/**
|
|
127
|
+
* This is used to get a storage object
|
|
128
|
+
* @returns {object} the storage
|
|
129
|
+
*/
|
|
130
|
+
function StorageHelper() {
|
|
131
|
+
this.storageWindow = MemoryStorage;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* This is used to return the storage
|
|
135
|
+
* @returns {object} the storage
|
|
136
|
+
*/
|
|
137
|
+
StorageHelper.prototype.getStorage = function () {
|
|
138
|
+
return this.storageWindow;
|
|
139
|
+
};
|
|
140
|
+
return StorageHelper;
|
|
141
|
+
}());
|
|
142
|
+
exports.StorageHelper = StorageHelper;
|
|
143
|
+
var AsyncStorageClass = /** @class */ (function () {
|
|
144
|
+
function AsyncStorageClass() {
|
|
145
|
+
this.syncPromise = null;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* This is used to set a specific item in storage
|
|
149
|
+
* @param {string} key - the key for the item
|
|
150
|
+
* @param {object} value - the value
|
|
151
|
+
* @returns {string} value that was set
|
|
152
|
+
*/
|
|
153
|
+
AsyncStorageClass.prototype.setItem = function (key, value) {
|
|
154
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
155
|
+
return __generator(this, function (_a) {
|
|
156
|
+
switch (_a.label) {
|
|
157
|
+
case 0:
|
|
158
|
+
if (!value) return [3 /*break*/, 2];
|
|
159
|
+
return [4 /*yield*/, async_storage_1.default.setItem(MEMORY_KEY_PREFIX + key, value)];
|
|
160
|
+
case 1:
|
|
161
|
+
_a.sent();
|
|
162
|
+
dataMemory[key] = value;
|
|
163
|
+
_a.label = 2;
|
|
164
|
+
case 2: return [2 /*return*/];
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
};
|
|
169
|
+
/**
|
|
170
|
+
* This is used to get a specific key from storage
|
|
171
|
+
* @param {string} key - the key for the item
|
|
172
|
+
* This is used to clear the storage
|
|
173
|
+
* @returns {string} the data item
|
|
174
|
+
*/
|
|
175
|
+
AsyncStorageClass.prototype.getItem = function (key) {
|
|
176
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
177
|
+
return __generator(this, function (_a) {
|
|
178
|
+
return [2 /*return*/, Object.prototype.hasOwnProperty.call(dataMemory, key)
|
|
179
|
+
? dataMemory[key]
|
|
180
|
+
: null];
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* This is used to remove an item from storage
|
|
186
|
+
* @param {string} key - the key being set
|
|
187
|
+
* @returns {string} value - value that was deleted
|
|
188
|
+
*/
|
|
189
|
+
AsyncStorageClass.prototype.removeItem = function (key) {
|
|
190
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
191
|
+
return __generator(this, function (_a) {
|
|
192
|
+
switch (_a.label) {
|
|
193
|
+
case 0: return [4 /*yield*/, async_storage_1.default.removeItem(MEMORY_KEY_PREFIX + key)];
|
|
194
|
+
case 1:
|
|
195
|
+
_a.sent();
|
|
196
|
+
delete dataMemory[key];
|
|
197
|
+
return [2 /*return*/];
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
};
|
|
202
|
+
/**
|
|
203
|
+
* This is used to clear the storage
|
|
204
|
+
* @returns {string} nothing
|
|
205
|
+
*/
|
|
206
|
+
AsyncStorageClass.prototype.clear = function () {
|
|
207
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
208
|
+
return __generator(this, function (_a) {
|
|
209
|
+
dataMemory = {};
|
|
210
|
+
return [2 /*return*/];
|
|
211
|
+
});
|
|
212
|
+
});
|
|
213
|
+
};
|
|
214
|
+
/**
|
|
215
|
+
* Will sync the MemoryStorage data from AsyncStorage to storageWindow MemoryStorage
|
|
216
|
+
* @returns {void}
|
|
217
|
+
*/
|
|
218
|
+
AsyncStorageClass.prototype.sync = function () {
|
|
219
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
220
|
+
return __generator(this, function (_a) {
|
|
221
|
+
if (!this.syncPromise) {
|
|
222
|
+
this.syncPromise = new Promise(function (res, rej) {
|
|
223
|
+
async_storage_1.default.getAllKeys(function (errKeys, keys) {
|
|
224
|
+
var _a;
|
|
225
|
+
if (errKeys)
|
|
226
|
+
rej(errKeys);
|
|
227
|
+
var memoryKeys = (_a = keys === null || keys === void 0 ? void 0 : keys.filter(function (key) { return key.startsWith(MEMORY_KEY_PREFIX); })) !== null && _a !== void 0 ? _a : [];
|
|
228
|
+
async_storage_1.default.multiGet(memoryKeys, function (err, stores) {
|
|
229
|
+
if (err)
|
|
230
|
+
rej(err);
|
|
231
|
+
stores &&
|
|
232
|
+
stores.map(function (result, index, store) {
|
|
233
|
+
var key = store[index][0];
|
|
234
|
+
var value = store[index][1];
|
|
235
|
+
var memoryKey = key.replace(MEMORY_KEY_PREFIX, '');
|
|
236
|
+
dataMemory[memoryKey] = value;
|
|
237
|
+
});
|
|
238
|
+
res();
|
|
239
|
+
});
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
return [2 /*return*/];
|
|
244
|
+
});
|
|
245
|
+
});
|
|
246
|
+
};
|
|
247
|
+
return AsyncStorageClass;
|
|
248
|
+
}());
|
|
249
|
+
// TODO: Add this to the react-native Amplify package.
|
|
250
|
+
exports.AsyncStorageKeyValue = new AsyncStorageClass();
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { KeyValueStorageInterface } from '../types';
|
|
2
|
-
|
|
3
|
-
* @internal
|
|
4
|
-
*/
|
|
5
|
-
export declare class KeyValueStorage implements KeyValueStorageInterface {
|
|
2
|
+
declare class SessionStorageClass implements KeyValueStorageInterface {
|
|
6
3
|
storage?: Storage;
|
|
7
|
-
constructor(
|
|
4
|
+
constructor();
|
|
8
5
|
/**
|
|
9
6
|
* This is used to set a specific item in storage
|
|
10
7
|
* @param {string} key - the key for the item
|
|
@@ -31,3 +28,5 @@ export declare class KeyValueStorage implements KeyValueStorageInterface {
|
|
|
31
28
|
*/
|
|
32
29
|
clear(): Promise<void>;
|
|
33
30
|
}
|
|
31
|
+
export declare const SessionStorage: SessionStorageClass;
|
|
32
|
+
export {};
|
|
@@ -38,15 +38,16 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
-
exports.
|
|
42
|
-
var
|
|
43
|
-
var
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
41
|
+
exports.SessionStorage = void 0;
|
|
42
|
+
var Errors_1 = require("../Util/Errors");
|
|
43
|
+
var SessionStorageClass = /** @class */ (function () {
|
|
44
|
+
function SessionStorageClass() {
|
|
45
|
+
if (typeof window !== undefined) {
|
|
46
|
+
try {
|
|
47
|
+
this.storage = window === null || window === void 0 ? void 0 : window.sessionStorage;
|
|
48
|
+
}
|
|
49
|
+
catch (error) { }
|
|
50
|
+
}
|
|
50
51
|
}
|
|
51
52
|
/**
|
|
52
53
|
* This is used to set a specific item in storage
|
|
@@ -54,9 +55,15 @@ var DefaultStorage = /** @class */ (function () {
|
|
|
54
55
|
* @param {object} value - the value
|
|
55
56
|
* @returns {string} value that was set
|
|
56
57
|
*/
|
|
57
|
-
|
|
58
|
-
this
|
|
59
|
-
|
|
58
|
+
SessionStorageClass.prototype.setItem = function (key, value) {
|
|
59
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
60
|
+
return __generator(this, function (_a) {
|
|
61
|
+
if (!this.storage)
|
|
62
|
+
throw Errors_1.PlatformNotSupportedError;
|
|
63
|
+
this.storage.setItem(key, value);
|
|
64
|
+
return [2 /*return*/];
|
|
65
|
+
});
|
|
66
|
+
});
|
|
60
67
|
};
|
|
61
68
|
/**
|
|
62
69
|
* This is used to get a specific key from storage
|
|
@@ -64,54 +71,44 @@ var DefaultStorage = /** @class */ (function () {
|
|
|
64
71
|
* This is used to clear the storage
|
|
65
72
|
* @returns {string} the data item
|
|
66
73
|
*/
|
|
67
|
-
|
|
68
|
-
this
|
|
69
|
-
|
|
74
|
+
SessionStorageClass.prototype.getItem = function (key) {
|
|
75
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
76
|
+
return __generator(this, function (_a) {
|
|
77
|
+
if (!this.storage)
|
|
78
|
+
throw Errors_1.PlatformNotSupportedError;
|
|
79
|
+
return [2 /*return*/, this.storage.getItem(key)];
|
|
80
|
+
});
|
|
81
|
+
});
|
|
70
82
|
};
|
|
71
83
|
/**
|
|
72
84
|
* This is used to remove an item from storage
|
|
73
85
|
* @param {string} key - the key being set
|
|
74
86
|
* @returns {string} value - value that was deleted
|
|
75
87
|
*/
|
|
76
|
-
|
|
77
|
-
this
|
|
78
|
-
|
|
88
|
+
SessionStorageClass.prototype.removeItem = function (key) {
|
|
89
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
90
|
+
return __generator(this, function (_a) {
|
|
91
|
+
if (!this.storage)
|
|
92
|
+
throw Errors_1.PlatformNotSupportedError;
|
|
93
|
+
this.storage.removeItem(key);
|
|
94
|
+
return [2 /*return*/];
|
|
95
|
+
});
|
|
96
|
+
});
|
|
79
97
|
};
|
|
80
98
|
/**
|
|
81
99
|
* This is used to clear the storage
|
|
82
100
|
* @returns {string} nothing
|
|
83
101
|
*/
|
|
84
|
-
|
|
102
|
+
SessionStorageClass.prototype.clear = function () {
|
|
85
103
|
return __awaiter(this, void 0, void 0, function () {
|
|
86
|
-
var allKeys;
|
|
87
104
|
return __generator(this, function (_a) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
case 1:
|
|
93
|
-
allKeys = _a.sent();
|
|
94
|
-
return [2 /*return*/, this.asyncStorage.multiRemove(allKeys.filter(function (key) { return key.startsWith(MEMORY_KEY_PREFIX); }))];
|
|
95
|
-
}
|
|
105
|
+
if (!this.storage)
|
|
106
|
+
throw Errors_1.PlatformNotSupportedError;
|
|
107
|
+
this.storage.clear();
|
|
108
|
+
return [2 /*return*/];
|
|
96
109
|
});
|
|
97
110
|
});
|
|
98
111
|
};
|
|
99
|
-
|
|
100
|
-
if (!!asyncStorage) {
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
try {
|
|
104
|
-
this.asyncStorage = require(ASYNC_STORAGE_MODULE)
|
|
105
|
-
.default;
|
|
106
|
-
}
|
|
107
|
-
catch (err) {
|
|
108
|
-
throw new libraryUtils_1.AmplifyError({
|
|
109
|
-
name: 'NativeModuleException',
|
|
110
|
-
message: "Unable to find ".concat(ASYNC_STORAGE_MODULE),
|
|
111
|
-
recoverySuggestion: "Make sure to install ".concat(ASYNC_STORAGE_MODULE),
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
return DefaultStorage;
|
|
112
|
+
return SessionStorageClass;
|
|
116
113
|
}());
|
|
117
|
-
exports.
|
|
114
|
+
exports.SessionStorage = new SessionStorageClass();
|
package/lib/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export { AuthConfig, AuthUserPoolConfig, AuthUserPoolAndIdentityPoolConfig, Stor
|
|
|
5
5
|
export { Amplify, fetchAuthSession, AmplifyClass as AmplifyClassV6, clearCredentials, } from './singleton';
|
|
6
6
|
export { getCredentialsForIdentity, getId, GetCredentialsForIdentityInput, GetCredentialsForIdentityOutput, } from './AwsClients/CognitoIdentity';
|
|
7
7
|
export { UserProfile } from './types';
|
|
8
|
-
export {
|
|
8
|
+
export { StorageHelper, MemoryStorage, LocalStorage, CookieStorage, SessionStorage, MemoryKeyValueStorage, } from './StorageHelper';
|
|
9
9
|
export { KeyValueStorageInterface } from './types';
|
|
10
10
|
import { BrowserStorageCache } from './Cache/BrowserStorageCache';
|
|
11
11
|
export { InMemoryCache } from './Cache/InMemoryCache';
|
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.I18n = exports.Cache = exports.BrowserStorageCache = exports.InMemoryCache = exports.
|
|
5
|
+
exports.I18n = exports.Cache = exports.BrowserStorageCache = exports.InMemoryCache = exports.MemoryKeyValueStorage = exports.SessionStorage = exports.CookieStorage = exports.LocalStorage = exports.MemoryStorage = exports.StorageHelper = 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
|
*/
|
|
@@ -19,11 +19,13 @@ var CognitoIdentity_1 = require("./AwsClients/CognitoIdentity");
|
|
|
19
19
|
Object.defineProperty(exports, "getCredentialsForIdentity", { enumerable: true, get: function () { return CognitoIdentity_1.getCredentialsForIdentity; } });
|
|
20
20
|
Object.defineProperty(exports, "getId", { enumerable: true, get: function () { return CognitoIdentity_1.getId; } });
|
|
21
21
|
// Storage helpers
|
|
22
|
-
var
|
|
23
|
-
Object.defineProperty(exports, "
|
|
24
|
-
Object.defineProperty(exports, "
|
|
25
|
-
Object.defineProperty(exports, "
|
|
26
|
-
Object.defineProperty(exports, "
|
|
22
|
+
var StorageHelper_1 = require("./StorageHelper");
|
|
23
|
+
Object.defineProperty(exports, "StorageHelper", { enumerable: true, get: function () { return StorageHelper_1.StorageHelper; } });
|
|
24
|
+
Object.defineProperty(exports, "MemoryStorage", { enumerable: true, get: function () { return StorageHelper_1.MemoryStorage; } });
|
|
25
|
+
Object.defineProperty(exports, "LocalStorage", { enumerable: true, get: function () { return StorageHelper_1.LocalStorage; } });
|
|
26
|
+
Object.defineProperty(exports, "CookieStorage", { enumerable: true, get: function () { return StorageHelper_1.CookieStorage; } });
|
|
27
|
+
Object.defineProperty(exports, "SessionStorage", { enumerable: true, get: function () { return StorageHelper_1.SessionStorage; } });
|
|
28
|
+
Object.defineProperty(exports, "MemoryKeyValueStorage", { enumerable: true, get: function () { return StorageHelper_1.MemoryKeyValueStorage; } });
|
|
27
29
|
// Cache exports
|
|
28
30
|
var BrowserStorageCache_1 = require("./Cache/BrowserStorageCache");
|
|
29
31
|
Object.defineProperty(exports, "BrowserStorageCache", { enumerable: true, get: function () { return BrowserStorageCache_1.BrowserStorageCache; } });
|
package/lib/libraryUtils.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export { ServiceWorker } from './ServiceWorker';
|
|
|
16
16
|
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';
|
|
17
17
|
export { asserts } from './Util/errors/AssertError';
|
|
18
18
|
export { invalidParameter, missingConfig, AmplifyError, AmplifyErrorString, } from './Util/Errors';
|
|
19
|
+
export { AppState, AsyncStorage, Linking } from './RNComponents';
|
|
19
20
|
export { ErrorParams, AmplifyErrorMap, ServiceError } from './types';
|
|
20
21
|
export { INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER, USER_AGENT_HEADER, } from './Util/Constants';
|
|
21
22
|
export { fetchAuthSession } from './singleton/apis/internal/fetchAuthSession';
|
package/lib/libraryUtils.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
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;
|
|
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 = 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.
|
|
@@ -91,6 +91,10 @@ Object.defineProperty(exports, "invalidParameter", { enumerable: true, get: func
|
|
|
91
91
|
Object.defineProperty(exports, "missingConfig", { enumerable: true, get: function () { return Errors_1.missingConfig; } });
|
|
92
92
|
Object.defineProperty(exports, "AmplifyError", { enumerable: true, get: function () { return Errors_1.AmplifyError; } });
|
|
93
93
|
Object.defineProperty(exports, "AmplifyErrorString", { enumerable: true, get: function () { return Errors_1.AmplifyErrorString; } });
|
|
94
|
+
var RNComponents_1 = require("./RNComponents");
|
|
95
|
+
Object.defineProperty(exports, "AppState", { enumerable: true, get: function () { return RNComponents_1.AppState; } });
|
|
96
|
+
Object.defineProperty(exports, "AsyncStorage", { enumerable: true, get: function () { return RNComponents_1.AsyncStorage; } });
|
|
97
|
+
Object.defineProperty(exports, "Linking", { enumerable: true, get: function () { return RNComponents_1.Linking; } });
|
|
94
98
|
var Constants_1 = require("./Util/Constants");
|
|
95
99
|
Object.defineProperty(exports, "INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER", { enumerable: true, get: function () { return Constants_1.INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER; } });
|
|
96
100
|
Object.defineProperty(exports, "USER_AGENT_HEADER", { enumerable: true, get: function () { return Constants_1.USER_AGENT_HEADER; } });
|
package/lib/parseAWSExports.js
CHANGED
|
@@ -12,11 +12,6 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.parseAWSExports = void 0;
|
|
15
|
-
var authTypeMapping = {
|
|
16
|
-
API_KEY: 'apiKey',
|
|
17
|
-
AWS_IAM: 'iam',
|
|
18
|
-
AMAZON_COGNITO_USER_POOLS: 'jwt',
|
|
19
|
-
};
|
|
20
15
|
/**
|
|
21
16
|
* This utility converts the `aws-exports.js` file generated by the Amplify CLI into a {@link ResourcesConfig} object
|
|
22
17
|
* consumable by Amplify.
|
|
@@ -27,7 +22,7 @@ var authTypeMapping = {
|
|
|
27
22
|
*/
|
|
28
23
|
var parseAWSExports = function (config) {
|
|
29
24
|
if (config === void 0) { config = {}; }
|
|
30
|
-
var
|
|
25
|
+
var aws_cognito_identity_pool_id = config.aws_cognito_identity_pool_id, aws_cognito_sign_up_verification_method = config.aws_cognito_sign_up_verification_method, aws_mandatory_sign_in = config.aws_mandatory_sign_in, aws_mobile_analytics_app_id = config.aws_mobile_analytics_app_id, aws_mobile_analytics_app_region = config.aws_mobile_analytics_app_region, aws_user_files_s3_bucket = config.aws_user_files_s3_bucket, aws_user_files_s3_bucket_region = config.aws_user_files_s3_bucket_region, aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing = config.aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing, aws_user_pools_id = config.aws_user_pools_id, aws_user_pools_web_client_id = config.aws_user_pools_web_client_id, geo = config.geo, oauth = config.oauth;
|
|
31
26
|
var amplifyConfig = {};
|
|
32
27
|
// Analytics
|
|
33
28
|
if (aws_mobile_analytics_app_id) {
|
|
@@ -38,20 +33,6 @@ var parseAWSExports = function (config) {
|
|
|
38
33
|
},
|
|
39
34
|
};
|
|
40
35
|
}
|
|
41
|
-
// TODO: Need to support all API configurations
|
|
42
|
-
// API
|
|
43
|
-
if (aws_appsync_graphqlEndpoint) {
|
|
44
|
-
amplifyConfig.API = {
|
|
45
|
-
AppSync: {
|
|
46
|
-
defaultAuthMode: {
|
|
47
|
-
type: authTypeMapping[aws_appsync_authenticationType],
|
|
48
|
-
apiKey: aws_appsync_apiKey,
|
|
49
|
-
},
|
|
50
|
-
endpoint: aws_appsync_graphqlEndpoint,
|
|
51
|
-
region: aws_appsync_region,
|
|
52
|
-
},
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
36
|
// Auth
|
|
56
37
|
if (aws_cognito_identity_pool_id || aws_user_pools_id) {
|
|
57
38
|
amplifyConfig.Auth = {
|
|
@@ -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("
|
|
80
|
+
var isAppInForeground_1 = require("../../../RNComponents/isAppInForeground");
|
|
81
81
|
var logger = new Logger_1.ConsoleLogger('PinpointEventBuffer');
|
|
82
82
|
var RETRYABLE_CODES = [429, 500];
|
|
83
83
|
var ACCEPTED_CODES = [202];
|
|
@@ -94,9 +94,7 @@ 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.', {
|
|
98
|
-
eventId: event.eventId,
|
|
99
|
-
});
|
|
97
|
+
logger.debug('Exceeded Pinpoint event buffer limits, event dropped.', { eventId: event.eventId });
|
|
100
98
|
return;
|
|
101
99
|
}
|
|
102
100
|
this._buffer.push((_a = {}, _a[event.eventId] = event, _a));
|
|
@@ -235,7 +233,7 @@ var PinpointEventBuffer = /** @class */ (function () {
|
|
|
235
233
|
logger.warn('Pinpoint event failed to send.', {
|
|
236
234
|
eventId: eventId,
|
|
237
235
|
name: name,
|
|
238
|
-
message: Message
|
|
236
|
+
message: Message
|
|
239
237
|
});
|
|
240
238
|
});
|
|
241
239
|
});
|
|
@@ -255,14 +253,14 @@ var PinpointEventBuffer = /** @class */ (function () {
|
|
|
255
253
|
logger.debug('Resending event.', {
|
|
256
254
|
eventId: eventId,
|
|
257
255
|
name: name,
|
|
258
|
-
remainingAttempts: bufferedEvent.resendLimit
|
|
256
|
+
remainingAttempts: bufferedEvent.resendLimit
|
|
259
257
|
});
|
|
260
258
|
eligibleEvents.push((_a = {}, _a[eventId] = bufferedEvent, _a));
|
|
261
259
|
return;
|
|
262
260
|
}
|
|
263
261
|
logger.debug('No retry attempts remaining for event.', {
|
|
264
262
|
eventId: eventId,
|
|
265
|
-
name: name
|
|
263
|
+
name: name
|
|
266
264
|
});
|
|
267
265
|
});
|
|
268
266
|
// add the events to the front of the buffer
|
package/lib/singleton/types.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { APIConfig, LibraryAPIOptions } from './API/types';
|
|
2
1
|
import { AnalyticsConfig } from './Analytics/types';
|
|
3
2
|
import { AuthConfig, LibraryAuthOptions, AuthUserPoolConfig, AuthIdentityPoolConfig, AuthUserPoolAndIdentityPoolConfig, GetCredentialsOptions, CognitoIdentityPoolConfig } from './Auth/types';
|
|
4
3
|
import { LibraryStorageOptions, StorageAccessLevel, StorageConfig } from './Storage/types';
|
|
@@ -9,15 +8,13 @@ export type LegacyConfig = {
|
|
|
9
8
|
aws_project_region?: string;
|
|
10
9
|
};
|
|
11
10
|
export type ResourcesConfig = {
|
|
12
|
-
API?: APIConfig;
|
|
13
11
|
Analytics?: AnalyticsConfig;
|
|
14
12
|
Auth?: AuthConfig;
|
|
15
13
|
Storage?: StorageConfig;
|
|
16
14
|
};
|
|
17
15
|
export type LibraryOptions = {
|
|
18
|
-
API?: LibraryAPIOptions;
|
|
19
16
|
Auth?: LibraryAuthOptions;
|
|
20
17
|
Storage?: LibraryStorageOptions;
|
|
21
18
|
ssr?: boolean;
|
|
22
19
|
};
|
|
23
|
-
export {
|
|
20
|
+
export { AuthConfig, AuthUserPoolConfig, AuthIdentityPoolConfig, AuthUserPoolAndIdentityPoolConfig, GetCredentialsOptions, StorageAccessLevel, StorageConfig, AnalyticsConfig, CognitoIdentityPoolConfig, };
|