Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@adastradev/user-management-sdk

Package Overview
Dependencies
Maintainers
39
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@adastradev/user-management-sdk - npm Package Compare versions

Comparing version 4.0.0-beta.1677171773821 to 4.0.0-beta.1677173473687

91

dist/CognitoUserPoolLocatorUserManagementByTenantId.js

@@ -41,3 +41,4 @@ "use strict";

var UserManagementApi_1 = require("./UserManagementApi");
// import Logger from '@adastradev/astra-logger';
var astra_logger_1 = require("@adastradev/astra-logger");
var AWS = require("aws-sdk");
/**

@@ -53,45 +54,47 @@ * Locates a cognito user pool appropriate for a given tenantId via REST lookup against the

return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
// const { accessKeyId, secretAccessKey, sessionToken, expired, expireTime, needsRefresh } =
// await AWS.config.credentialProvider.resolvePromise();
// Logger.debug(
// `automation: resolved IAM credentials, expireTime: ${expireTime} expired: ${expired} needsRefresh: ${needsRefresh()}`
// );
// const adminCredentials: IAMCredentialsWithSession = {
// type: 'IAM',
// accessKeyId,
// secretAccessKey,
// sessionToken
// };
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, { type: 'IAM' });
_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))];
var _a, accessKeyId, secretAccessKey, sessionToken, expired, expireTime, needsRefresh, adminCredentials;
return __generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, AWS.config.credentialProvider.resolvePromise()];
case 1:
_a = _b.sent(), accessKeyId = _a.accessKeyId, secretAccessKey = _a.secretAccessKey, sessionToken = _a.sessionToken, expired = _a.expired, expireTime = _a.expireTime, needsRefresh = _a.needsRefresh;
astra_logger_1.default.debug("automation: resolved IAM credentials, expireTime: " + expireTime + " expired: " + expired + " needsRefresh: " + needsRefresh());
adminCredentials = {
accessKeyId: accessKeyId,
secretAccessKey: secretAccessKey,
sessionToken: sessionToken,
type: 'IAM'
};
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))];
}
});

@@ -98,0 +101,0 @@ });

@@ -1,6 +0,9 @@

import { ApiCredentials } from '@adastradev/serverless-discovery-sdk';
import { ApiCredentials, IAMCredentials } from '@adastradev/serverless-discovery-sdk';
export interface IAMCredentialsWithSession extends IAMCredentials {
sessionToken: string;
}
export declare class UserManagementApi {
private apigClient;
private additionalParams;
constructor(serviceEndpointUri: string, region: string, credentials: ApiCredentials, apigClient?: any);
constructor(serviceEndpointUri: string, region: string, credentials: ApiCredentials | IAMCredentialsWithSession, apigClient?: any);
createUserPool(tenantId: string): any;

@@ -7,0 +10,0 @@ deleteUserPool(id: string): any;

@@ -7,11 +7,2 @@ "use strict";

var apigClientFactory = require('@adastradev/aws-api-gateway-client').default; // tslint:disable-line
// interceptor logging for Authorization headers
// axios.interceptors.request.use(function(config) {
// var authorizationHeader = config.headers['Authorization'];
// console.log('Authorization header: ' + authorizationHeader);
// return config;
// });
// export interface IAMCredentialsWithSession extends IAMCredentials {
// sessionToken: string;
// }
var UserManagementApi = /** @class */ (function () {

@@ -18,0 +9,0 @@ function UserManagementApi(serviceEndpointUri, region, credentials, apigClient) {

{
"name": "@adastradev/user-management-sdk",
"version": "4.0.0-beta.1677171773821",
"version": "4.0.0-beta.1677173473687",
"description": "Astra user management SDK for JavaScript in the browser and Node.js",

@@ -47,3 +47,3 @@ "main": "dist/index.js",

"@types/sinon": "^7.5.2",
"aws-sdk": "^2.896.0",
"aws-sdk": "^2.1321.0",
"chai": "^4.3.4",

@@ -50,0 +50,0 @@ "chai-as-promised": "^7.1.1",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc