@aws-sdk/credential-provider-cognito-identity 3.490.0 → 3.496.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/dist-cjs/CognitoProviderParameters.js +1 -2
- package/dist-cjs/InMemoryStorage.js +1 -21
- package/dist-cjs/IndexedDbStorage.js +1 -71
- package/dist-cjs/Logins.js +1 -2
- package/dist-cjs/Storage.js +1 -2
- package/dist-cjs/fromCognitoIdentity.js +1 -32
- package/dist-cjs/fromCognitoIdentityPool.js +1 -42
- package/dist-cjs/index.js +256 -8
- package/dist-cjs/localStorage.js +1 -16
- package/dist-cjs/resolveLogins.js +1 -19
- package/package.json +6 -6
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
module.exports = require("./index.js");
|
|
@@ -1,21 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InMemoryStorage = void 0;
|
|
4
|
-
class InMemoryStorage {
|
|
5
|
-
constructor(store = {}) {
|
|
6
|
-
this.store = store;
|
|
7
|
-
}
|
|
8
|
-
getItem(key) {
|
|
9
|
-
if (key in this.store) {
|
|
10
|
-
return this.store[key];
|
|
11
|
-
}
|
|
12
|
-
return null;
|
|
13
|
-
}
|
|
14
|
-
removeItem(key) {
|
|
15
|
-
delete this.store[key];
|
|
16
|
-
}
|
|
17
|
-
setItem(key, value) {
|
|
18
|
-
this.store[key] = value;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
exports.InMemoryStorage = InMemoryStorage;
|
|
1
|
+
module.exports = require("./index.js");
|
|
@@ -1,71 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IndexedDbStorage = void 0;
|
|
4
|
-
const STORE_NAME = "IdentityIds";
|
|
5
|
-
class IndexedDbStorage {
|
|
6
|
-
constructor(dbName = "aws:cognito-identity-ids") {
|
|
7
|
-
this.dbName = dbName;
|
|
8
|
-
}
|
|
9
|
-
getItem(key) {
|
|
10
|
-
return this.withObjectStore("readonly", (store) => {
|
|
11
|
-
const req = store.get(key);
|
|
12
|
-
return new Promise((resolve) => {
|
|
13
|
-
req.onerror = () => resolve(null);
|
|
14
|
-
req.onsuccess = () => resolve(req.result ? req.result.value : null);
|
|
15
|
-
});
|
|
16
|
-
}).catch(() => null);
|
|
17
|
-
}
|
|
18
|
-
removeItem(key) {
|
|
19
|
-
return this.withObjectStore("readwrite", (store) => {
|
|
20
|
-
const req = store.delete(key);
|
|
21
|
-
return new Promise((resolve, reject) => {
|
|
22
|
-
req.onerror = () => reject(req.error);
|
|
23
|
-
req.onsuccess = () => resolve();
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
setItem(id, value) {
|
|
28
|
-
return this.withObjectStore("readwrite", (store) => {
|
|
29
|
-
const req = store.put({ id, value });
|
|
30
|
-
return new Promise((resolve, reject) => {
|
|
31
|
-
req.onerror = () => reject(req.error);
|
|
32
|
-
req.onsuccess = () => resolve();
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
getDb() {
|
|
37
|
-
const openDbRequest = self.indexedDB.open(this.dbName, 1);
|
|
38
|
-
return new Promise((resolve, reject) => {
|
|
39
|
-
openDbRequest.onsuccess = () => {
|
|
40
|
-
resolve(openDbRequest.result);
|
|
41
|
-
};
|
|
42
|
-
openDbRequest.onerror = () => {
|
|
43
|
-
reject(openDbRequest.error);
|
|
44
|
-
};
|
|
45
|
-
openDbRequest.onblocked = () => {
|
|
46
|
-
reject(new Error("Unable to access DB"));
|
|
47
|
-
};
|
|
48
|
-
openDbRequest.onupgradeneeded = () => {
|
|
49
|
-
const db = openDbRequest.result;
|
|
50
|
-
db.onerror = () => {
|
|
51
|
-
reject(new Error("Failed to create object store"));
|
|
52
|
-
};
|
|
53
|
-
db.createObjectStore(STORE_NAME, { keyPath: "id" });
|
|
54
|
-
};
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
withObjectStore(mode, action) {
|
|
58
|
-
return this.getDb().then((db) => {
|
|
59
|
-
const tx = db.transaction(STORE_NAME, mode);
|
|
60
|
-
tx.oncomplete = () => db.close();
|
|
61
|
-
return new Promise((resolve, reject) => {
|
|
62
|
-
tx.onerror = () => reject(tx.error);
|
|
63
|
-
resolve(action(tx.objectStore(STORE_NAME)));
|
|
64
|
-
}).catch((err) => {
|
|
65
|
-
db.close();
|
|
66
|
-
throw err;
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
exports.IndexedDbStorage = IndexedDbStorage;
|
|
1
|
+
module.exports = require("./index.js");
|
package/dist-cjs/Logins.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
module.exports = require("./index.js");
|
package/dist-cjs/Storage.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
module.exports = require("./index.js");
|
|
@@ -1,32 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fromCognitoIdentity = void 0;
|
|
4
|
-
const client_cognito_identity_1 = require("@aws-sdk/client-cognito-identity");
|
|
5
|
-
const property_provider_1 = require("@smithy/property-provider");
|
|
6
|
-
const resolveLogins_1 = require("./resolveLogins");
|
|
7
|
-
function fromCognitoIdentity(parameters) {
|
|
8
|
-
return async () => {
|
|
9
|
-
const { Credentials: { AccessKeyId = throwOnMissingAccessKeyId(), Expiration, SecretKey = throwOnMissingSecretKey(), SessionToken, } = throwOnMissingCredentials(), } = await parameters.client.send(new client_cognito_identity_1.GetCredentialsForIdentityCommand({
|
|
10
|
-
CustomRoleArn: parameters.customRoleArn,
|
|
11
|
-
IdentityId: parameters.identityId,
|
|
12
|
-
Logins: parameters.logins ? await (0, resolveLogins_1.resolveLogins)(parameters.logins) : undefined,
|
|
13
|
-
}));
|
|
14
|
-
return {
|
|
15
|
-
identityId: parameters.identityId,
|
|
16
|
-
accessKeyId: AccessKeyId,
|
|
17
|
-
secretAccessKey: SecretKey,
|
|
18
|
-
sessionToken: SessionToken,
|
|
19
|
-
expiration: Expiration,
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
exports.fromCognitoIdentity = fromCognitoIdentity;
|
|
24
|
-
function throwOnMissingAccessKeyId() {
|
|
25
|
-
throw new property_provider_1.CredentialsProviderError("Response from Amazon Cognito contained no access key ID");
|
|
26
|
-
}
|
|
27
|
-
function throwOnMissingCredentials() {
|
|
28
|
-
throw new property_provider_1.CredentialsProviderError("Response from Amazon Cognito contained no credentials");
|
|
29
|
-
}
|
|
30
|
-
function throwOnMissingSecretKey() {
|
|
31
|
-
throw new property_provider_1.CredentialsProviderError("Response from Amazon Cognito contained no secret key");
|
|
32
|
-
}
|
|
1
|
+
module.exports = require("./index.js");
|
|
@@ -1,42 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fromCognitoIdentityPool = void 0;
|
|
4
|
-
const client_cognito_identity_1 = require("@aws-sdk/client-cognito-identity");
|
|
5
|
-
const property_provider_1 = require("@smithy/property-provider");
|
|
6
|
-
const fromCognitoIdentity_1 = require("./fromCognitoIdentity");
|
|
7
|
-
const localStorage_1 = require("./localStorage");
|
|
8
|
-
const resolveLogins_1 = require("./resolveLogins");
|
|
9
|
-
function fromCognitoIdentityPool({ accountId, cache = (0, localStorage_1.localStorage)(), client, customRoleArn, identityPoolId, logins, userIdentifier = !logins || Object.keys(logins).length === 0 ? "ANONYMOUS" : undefined, }) {
|
|
10
|
-
const cacheKey = userIdentifier ? `aws:cognito-identity-credentials:${identityPoolId}:${userIdentifier}` : undefined;
|
|
11
|
-
let provider = async () => {
|
|
12
|
-
let identityId = cacheKey && (await cache.getItem(cacheKey));
|
|
13
|
-
if (!identityId) {
|
|
14
|
-
const { IdentityId = throwOnMissingId() } = await client.send(new client_cognito_identity_1.GetIdCommand({
|
|
15
|
-
AccountId: accountId,
|
|
16
|
-
IdentityPoolId: identityPoolId,
|
|
17
|
-
Logins: logins ? await (0, resolveLogins_1.resolveLogins)(logins) : undefined,
|
|
18
|
-
}));
|
|
19
|
-
identityId = IdentityId;
|
|
20
|
-
if (cacheKey) {
|
|
21
|
-
Promise.resolve(cache.setItem(cacheKey, identityId)).catch(() => { });
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
provider = (0, fromCognitoIdentity_1.fromCognitoIdentity)({
|
|
25
|
-
client,
|
|
26
|
-
customRoleArn,
|
|
27
|
-
logins,
|
|
28
|
-
identityId,
|
|
29
|
-
});
|
|
30
|
-
return provider();
|
|
31
|
-
};
|
|
32
|
-
return () => provider().catch(async (err) => {
|
|
33
|
-
if (cacheKey) {
|
|
34
|
-
Promise.resolve(cache.removeItem(cacheKey)).catch(() => { });
|
|
35
|
-
}
|
|
36
|
-
throw err;
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
exports.fromCognitoIdentityPool = fromCognitoIdentityPool;
|
|
40
|
-
function throwOnMissingId() {
|
|
41
|
-
throw new property_provider_1.CredentialsProviderError("Response from Amazon Cognito contained no identity ID");
|
|
42
|
-
}
|
|
1
|
+
module.exports = require("./index.js");
|
package/dist-cjs/index.js
CHANGED
|
@@ -1,8 +1,256 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
fromCognitoIdentity: () => fromCognitoIdentity,
|
|
24
|
+
fromCognitoIdentityPool: () => fromCognitoIdentityPool
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(src_exports);
|
|
27
|
+
|
|
28
|
+
// src/fromCognitoIdentity.ts
|
|
29
|
+
var import_client_cognito_identity = require("@aws-sdk/client-cognito-identity");
|
|
30
|
+
var import_property_provider = require("@smithy/property-provider");
|
|
31
|
+
|
|
32
|
+
// src/resolveLogins.ts
|
|
33
|
+
function resolveLogins(logins) {
|
|
34
|
+
return Promise.all(
|
|
35
|
+
Object.keys(logins).reduce((arr, name) => {
|
|
36
|
+
const tokenOrProvider = logins[name];
|
|
37
|
+
if (typeof tokenOrProvider === "string") {
|
|
38
|
+
arr.push([name, tokenOrProvider]);
|
|
39
|
+
} else {
|
|
40
|
+
arr.push(tokenOrProvider().then((token) => [name, token]));
|
|
41
|
+
}
|
|
42
|
+
return arr;
|
|
43
|
+
}, [])
|
|
44
|
+
).then(
|
|
45
|
+
(resolvedPairs) => resolvedPairs.reduce((logins2, [key, value]) => {
|
|
46
|
+
logins2[key] = value;
|
|
47
|
+
return logins2;
|
|
48
|
+
}, {})
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
__name(resolveLogins, "resolveLogins");
|
|
52
|
+
|
|
53
|
+
// src/fromCognitoIdentity.ts
|
|
54
|
+
function fromCognitoIdentity(parameters) {
|
|
55
|
+
return async () => {
|
|
56
|
+
const {
|
|
57
|
+
Credentials: {
|
|
58
|
+
AccessKeyId = throwOnMissingAccessKeyId(),
|
|
59
|
+
Expiration,
|
|
60
|
+
SecretKey = throwOnMissingSecretKey(),
|
|
61
|
+
SessionToken
|
|
62
|
+
} = throwOnMissingCredentials()
|
|
63
|
+
} = await parameters.client.send(
|
|
64
|
+
new import_client_cognito_identity.GetCredentialsForIdentityCommand({
|
|
65
|
+
CustomRoleArn: parameters.customRoleArn,
|
|
66
|
+
IdentityId: parameters.identityId,
|
|
67
|
+
Logins: parameters.logins ? await resolveLogins(parameters.logins) : void 0
|
|
68
|
+
})
|
|
69
|
+
);
|
|
70
|
+
return {
|
|
71
|
+
identityId: parameters.identityId,
|
|
72
|
+
accessKeyId: AccessKeyId,
|
|
73
|
+
secretAccessKey: SecretKey,
|
|
74
|
+
sessionToken: SessionToken,
|
|
75
|
+
expiration: Expiration
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
__name(fromCognitoIdentity, "fromCognitoIdentity");
|
|
80
|
+
function throwOnMissingAccessKeyId() {
|
|
81
|
+
throw new import_property_provider.CredentialsProviderError("Response from Amazon Cognito contained no access key ID");
|
|
82
|
+
}
|
|
83
|
+
__name(throwOnMissingAccessKeyId, "throwOnMissingAccessKeyId");
|
|
84
|
+
function throwOnMissingCredentials() {
|
|
85
|
+
throw new import_property_provider.CredentialsProviderError("Response from Amazon Cognito contained no credentials");
|
|
86
|
+
}
|
|
87
|
+
__name(throwOnMissingCredentials, "throwOnMissingCredentials");
|
|
88
|
+
function throwOnMissingSecretKey() {
|
|
89
|
+
throw new import_property_provider.CredentialsProviderError("Response from Amazon Cognito contained no secret key");
|
|
90
|
+
}
|
|
91
|
+
__name(throwOnMissingSecretKey, "throwOnMissingSecretKey");
|
|
92
|
+
|
|
93
|
+
// src/fromCognitoIdentityPool.ts
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
// src/IndexedDbStorage.ts
|
|
98
|
+
var STORE_NAME = "IdentityIds";
|
|
99
|
+
var _IndexedDbStorage = class _IndexedDbStorage {
|
|
100
|
+
constructor(dbName = "aws:cognito-identity-ids") {
|
|
101
|
+
this.dbName = dbName;
|
|
102
|
+
}
|
|
103
|
+
getItem(key) {
|
|
104
|
+
return this.withObjectStore("readonly", (store) => {
|
|
105
|
+
const req = store.get(key);
|
|
106
|
+
return new Promise((resolve) => {
|
|
107
|
+
req.onerror = () => resolve(null);
|
|
108
|
+
req.onsuccess = () => resolve(req.result ? req.result.value : null);
|
|
109
|
+
});
|
|
110
|
+
}).catch(() => null);
|
|
111
|
+
}
|
|
112
|
+
removeItem(key) {
|
|
113
|
+
return this.withObjectStore("readwrite", (store) => {
|
|
114
|
+
const req = store.delete(key);
|
|
115
|
+
return new Promise((resolve, reject) => {
|
|
116
|
+
req.onerror = () => reject(req.error);
|
|
117
|
+
req.onsuccess = () => resolve();
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
setItem(id, value) {
|
|
122
|
+
return this.withObjectStore("readwrite", (store) => {
|
|
123
|
+
const req = store.put({ id, value });
|
|
124
|
+
return new Promise((resolve, reject) => {
|
|
125
|
+
req.onerror = () => reject(req.error);
|
|
126
|
+
req.onsuccess = () => resolve();
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
getDb() {
|
|
131
|
+
const openDbRequest = self.indexedDB.open(this.dbName, 1);
|
|
132
|
+
return new Promise((resolve, reject) => {
|
|
133
|
+
openDbRequest.onsuccess = () => {
|
|
134
|
+
resolve(openDbRequest.result);
|
|
135
|
+
};
|
|
136
|
+
openDbRequest.onerror = () => {
|
|
137
|
+
reject(openDbRequest.error);
|
|
138
|
+
};
|
|
139
|
+
openDbRequest.onblocked = () => {
|
|
140
|
+
reject(new Error("Unable to access DB"));
|
|
141
|
+
};
|
|
142
|
+
openDbRequest.onupgradeneeded = () => {
|
|
143
|
+
const db = openDbRequest.result;
|
|
144
|
+
db.onerror = () => {
|
|
145
|
+
reject(new Error("Failed to create object store"));
|
|
146
|
+
};
|
|
147
|
+
db.createObjectStore(STORE_NAME, { keyPath: "id" });
|
|
148
|
+
};
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
withObjectStore(mode, action) {
|
|
152
|
+
return this.getDb().then((db) => {
|
|
153
|
+
const tx = db.transaction(STORE_NAME, mode);
|
|
154
|
+
tx.oncomplete = () => db.close();
|
|
155
|
+
return new Promise((resolve, reject) => {
|
|
156
|
+
tx.onerror = () => reject(tx.error);
|
|
157
|
+
resolve(action(tx.objectStore(STORE_NAME)));
|
|
158
|
+
}).catch((err) => {
|
|
159
|
+
db.close();
|
|
160
|
+
throw err;
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
__name(_IndexedDbStorage, "IndexedDbStorage");
|
|
166
|
+
var IndexedDbStorage = _IndexedDbStorage;
|
|
167
|
+
|
|
168
|
+
// src/InMemoryStorage.ts
|
|
169
|
+
var _InMemoryStorage = class _InMemoryStorage {
|
|
170
|
+
constructor(store = {}) {
|
|
171
|
+
this.store = store;
|
|
172
|
+
}
|
|
173
|
+
getItem(key) {
|
|
174
|
+
if (key in this.store) {
|
|
175
|
+
return this.store[key];
|
|
176
|
+
}
|
|
177
|
+
return null;
|
|
178
|
+
}
|
|
179
|
+
removeItem(key) {
|
|
180
|
+
delete this.store[key];
|
|
181
|
+
}
|
|
182
|
+
setItem(key, value) {
|
|
183
|
+
this.store[key] = value;
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
__name(_InMemoryStorage, "InMemoryStorage");
|
|
187
|
+
var InMemoryStorage = _InMemoryStorage;
|
|
188
|
+
|
|
189
|
+
// src/localStorage.ts
|
|
190
|
+
var inMemoryStorage = new InMemoryStorage();
|
|
191
|
+
function localStorage() {
|
|
192
|
+
if (typeof self === "object" && self.indexedDB) {
|
|
193
|
+
return new IndexedDbStorage();
|
|
194
|
+
}
|
|
195
|
+
if (typeof window === "object" && window.localStorage) {
|
|
196
|
+
return window.localStorage;
|
|
197
|
+
}
|
|
198
|
+
return inMemoryStorage;
|
|
199
|
+
}
|
|
200
|
+
__name(localStorage, "localStorage");
|
|
201
|
+
|
|
202
|
+
// src/fromCognitoIdentityPool.ts
|
|
203
|
+
function fromCognitoIdentityPool({
|
|
204
|
+
accountId,
|
|
205
|
+
cache = localStorage(),
|
|
206
|
+
client,
|
|
207
|
+
customRoleArn,
|
|
208
|
+
identityPoolId,
|
|
209
|
+
logins,
|
|
210
|
+
userIdentifier = !logins || Object.keys(logins).length === 0 ? "ANONYMOUS" : void 0
|
|
211
|
+
}) {
|
|
212
|
+
const cacheKey = userIdentifier ? `aws:cognito-identity-credentials:${identityPoolId}:${userIdentifier}` : void 0;
|
|
213
|
+
let provider = /* @__PURE__ */ __name(async () => {
|
|
214
|
+
let identityId = cacheKey && await cache.getItem(cacheKey);
|
|
215
|
+
if (!identityId) {
|
|
216
|
+
const { IdentityId = throwOnMissingId() } = await client.send(
|
|
217
|
+
new import_client_cognito_identity.GetIdCommand({
|
|
218
|
+
AccountId: accountId,
|
|
219
|
+
IdentityPoolId: identityPoolId,
|
|
220
|
+
Logins: logins ? await resolveLogins(logins) : void 0
|
|
221
|
+
})
|
|
222
|
+
);
|
|
223
|
+
identityId = IdentityId;
|
|
224
|
+
if (cacheKey) {
|
|
225
|
+
Promise.resolve(cache.setItem(cacheKey, identityId)).catch(() => {
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
provider = fromCognitoIdentity({
|
|
230
|
+
client,
|
|
231
|
+
customRoleArn,
|
|
232
|
+
logins,
|
|
233
|
+
identityId
|
|
234
|
+
});
|
|
235
|
+
return provider();
|
|
236
|
+
}, "provider");
|
|
237
|
+
return () => provider().catch(async (err) => {
|
|
238
|
+
if (cacheKey) {
|
|
239
|
+
Promise.resolve(cache.removeItem(cacheKey)).catch(() => {
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
throw err;
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
__name(fromCognitoIdentityPool, "fromCognitoIdentityPool");
|
|
246
|
+
function throwOnMissingId() {
|
|
247
|
+
throw new import_property_provider.CredentialsProviderError("Response from Amazon Cognito contained no identity ID");
|
|
248
|
+
}
|
|
249
|
+
__name(throwOnMissingId, "throwOnMissingId");
|
|
250
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
251
|
+
|
|
252
|
+
0 && (module.exports = {
|
|
253
|
+
fromCognitoIdentity,
|
|
254
|
+
fromCognitoIdentityPool
|
|
255
|
+
});
|
|
256
|
+
|
package/dist-cjs/localStorage.js
CHANGED
|
@@ -1,16 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.localStorage = void 0;
|
|
4
|
-
const IndexedDbStorage_1 = require("./IndexedDbStorage");
|
|
5
|
-
const InMemoryStorage_1 = require("./InMemoryStorage");
|
|
6
|
-
const inMemoryStorage = new InMemoryStorage_1.InMemoryStorage();
|
|
7
|
-
function localStorage() {
|
|
8
|
-
if (typeof self === "object" && self.indexedDB) {
|
|
9
|
-
return new IndexedDbStorage_1.IndexedDbStorage();
|
|
10
|
-
}
|
|
11
|
-
if (typeof window === "object" && window.localStorage) {
|
|
12
|
-
return window.localStorage;
|
|
13
|
-
}
|
|
14
|
-
return inMemoryStorage;
|
|
15
|
-
}
|
|
16
|
-
exports.localStorage = localStorage;
|
|
1
|
+
module.exports = require("./index.js");
|
|
@@ -1,19 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolveLogins = void 0;
|
|
4
|
-
function resolveLogins(logins) {
|
|
5
|
-
return Promise.all(Object.keys(logins).reduce((arr, name) => {
|
|
6
|
-
const tokenOrProvider = logins[name];
|
|
7
|
-
if (typeof tokenOrProvider === "string") {
|
|
8
|
-
arr.push([name, tokenOrProvider]);
|
|
9
|
-
}
|
|
10
|
-
else {
|
|
11
|
-
arr.push(tokenOrProvider().then((token) => [name, token]));
|
|
12
|
-
}
|
|
13
|
-
return arr;
|
|
14
|
-
}, [])).then((resolvedPairs) => resolvedPairs.reduce((logins, [key, value]) => {
|
|
15
|
-
logins[key] = value;
|
|
16
|
-
return logins;
|
|
17
|
-
}, {}));
|
|
18
|
-
}
|
|
19
|
-
exports.resolveLogins = resolveLogins;
|
|
1
|
+
module.exports = require("./index.js");
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/credential-provider-cognito-identity",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.496.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
|
|
6
|
-
"build:cjs": "
|
|
6
|
+
"build:cjs": "node ../../scripts/compilation/inline credential-provider-cognito-identity",
|
|
7
7
|
"build:es": "tsc -p tsconfig.es.json",
|
|
8
8
|
"build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build",
|
|
9
9
|
"build:types": "tsc -p tsconfig.types.json",
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
},
|
|
22
22
|
"license": "Apache-2.0",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@aws-sdk/client-cognito-identity": "3.
|
|
25
|
-
"@aws-sdk/types": "3.
|
|
26
|
-
"@smithy/property-provider": "^2.
|
|
27
|
-
"@smithy/types": "^2.
|
|
24
|
+
"@aws-sdk/client-cognito-identity": "3.496.0",
|
|
25
|
+
"@aws-sdk/types": "3.496.0",
|
|
26
|
+
"@smithy/property-provider": "^2.1.1",
|
|
27
|
+
"@smithy/types": "^2.9.1",
|
|
28
28
|
"tslib": "^2.5.0"
|
|
29
29
|
},
|
|
30
30
|
"engines": {
|