@adastradev/user-management-sdk
Advanced tools
Comparing version 4.0.0-beta.1677698882938 to 4.0.0-beta.1677872425873
@@ -0,1 +1,2 @@ | ||
import { IAMCredentialsWithSession } from './UserManagementApi'; | ||
import { ICognitoUserPoolApiModel } from './ICognitoUserPoolApiModel'; | ||
@@ -11,2 +12,3 @@ import { ICognitoUserPoolLocatorByTenantId } from './ICognitoUserPoolLocatorByTenantId'; | ||
getPoolForTenantId(tenantId: string): Promise<ICognitoUserPoolApiModel>; | ||
getAdminCredentials(): Promise<IAMCredentialsWithSession>; | ||
} |
@@ -53,2 +53,41 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, new Promise( | ||
// tslint:disable-next-line:ter-prefer-arrow-callback | ||
function (resolve, reject) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var adminCredentials, api, response, result, error_1; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.getAdminCredentials()]; | ||
case 1: | ||
adminCredentials = _a.sent(); | ||
api = new UserManagementApi_1.UserManagementApi(process.env.USER_MANAGEMENT_URI, this.region, adminCredentials); | ||
_a.label = 2; | ||
case 2: | ||
_a.trys.push([2, 4, , 5]); | ||
return [4 /*yield*/, api.getUserPool(tenantId)]; | ||
case 3: | ||
response = _a.sent(); | ||
result = { | ||
ClientId: response.data.cognito_app_client_id, | ||
IdentityPoolId: response.data.cognito_identity_pool_id, | ||
UserPoolId: response.data.cognito_user_pool_id | ||
}; | ||
resolve(result); | ||
return [3 /*break*/, 5]; | ||
case 4: | ||
error_1 = _a.sent(); | ||
reject(error_1); | ||
return [3 /*break*/, 5]; | ||
case 5: return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
}.bind(this))]; | ||
}); | ||
}); | ||
}; | ||
CognitoUserPoolLocatorUserManagementByTenantId.prototype.getAdminCredentials = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _a, accessKeyId, secretAccessKey, sessionToken, expired, expireTime, needsRefresh, adminCredentials; | ||
@@ -67,33 +106,3 @@ return __generator(this, function (_b) { | ||
}; | ||
return [2 /*return*/, new Promise( | ||
// tslint:disable-next-line:ter-prefer-arrow-callback | ||
function (resolve, reject) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var api, response, result, error_1; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
api = new UserManagementApi_1.UserManagementApi(process.env.USER_MANAGEMENT_URI, this.region, adminCredentials); | ||
_a.label = 1; | ||
case 1: | ||
_a.trys.push([1, 3, , 4]); | ||
return [4 /*yield*/, api.getUserPool(tenantId)]; | ||
case 2: | ||
response = _a.sent(); | ||
result = { | ||
ClientId: response.data.cognito_app_client_id, | ||
IdentityPoolId: response.data.cognito_identity_pool_id, | ||
UserPoolId: response.data.cognito_user_pool_id | ||
}; | ||
resolve(result); | ||
return [3 /*break*/, 4]; | ||
case 3: | ||
error_1 = _a.sent(); | ||
reject(error_1); | ||
return [3 /*break*/, 4]; | ||
case 4: return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
}.bind(this))]; | ||
return [2 /*return*/, adminCredentials]; | ||
} | ||
@@ -100,0 +109,0 @@ }); |
{ | ||
"name": "@adastradev/user-management-sdk", | ||
"version": "4.0.0-beta.1677698882938", | ||
"version": "4.0.0-beta.1677872425873", | ||
"description": "Astra user management SDK for JavaScript in the browser and Node.js", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
62419
817