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

@adastradev/tenant-sdk

Package Overview
Dependencies
Maintainers
34
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@adastradev/tenant-sdk - npm Package Compare versions

Comparing version 1.0.0-beta.1 to 1.0.0-beta.1702485065343

16

dist/ApiGatewayClient.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// ignore type checking for private member aws-api-gateway-client for now
// declare function require(name:string): any; // tslint:disable-line
var apigClientFactory = require('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;
// });
var apigClientFactory = require('@adastradev/aws-api-gateway-client').default;
var ApiGatewayClient = /** @class */ (function () {

@@ -37,5 +30,8 @@ function ApiGatewayClient() {

var tokenCreds = credentials;
var headerValue = tokenCreds.idToken.startsWith('Bearer ')
? tokenCreds.idToken
: "Bearer " + tokenCreds.idToken;
additionalParams = {
headers: {
Authorization: 'Bearer ' + tokenCreds.idToken
Authorization: headerValue
}

@@ -51,3 +47,3 @@ };

else {
throw (Error('Unsupported credential type'));
throw Error('Unsupported credential type');
}

@@ -54,0 +50,0 @@ return {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AstraResponse = void 0;
var AstraResponse = /** @class */ (function () {
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
function AstraResponse(data, response) {

@@ -5,0 +7,0 @@ this.data = data;

"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./AstraResponse"));
__export(require("./TenantApi"));
__export(require("./TenantConsumerApi"));
__exportStar(require("./AstraResponse"), exports);
__exportStar(require("./ITenantApiModel"), exports);
__exportStar(require("./TenantApi"), exports);
__exportStar(require("./TenantConsumerApi"), exports);

@@ -7,5 +7,4 @@ import { ApiCredentials } from '@adastradev/serverless-discovery-sdk';

constructor(serviceEndpointUri: string, region: string, credentials: ApiCredentials);
find(tenant_id: any): Promise<AstraResponse<ITenantApiModel>>;
register(tenantName: string): Promise<AstraResponse<ITenantApiModel>>;
private invoke;
find(tenantId: string): Promise<AstraResponse<ITenantApiModel>>;
invoke<T>(params: any, pathTemplate: any, method: any, additionalParams: any, body: any): Promise<AstraResponse<T>>;
}
"use strict";
// tslint:disable:max-line-length
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());

@@ -39,2 +39,3 @@ });

Object.defineProperty(exports, "__esModule", { value: true });
exports.TenantApi = void 0;
var ApiGatewayClient_1 = require("./ApiGatewayClient");

@@ -46,5 +47,7 @@ var AstraResponse_1 = require("./AstraResponse");

}
TenantApi.prototype.find = function (tenant_id) {
var params = {};
var pathTemplate = "/tenant/" + tenant_id;
TenantApi.prototype.find = function (tenantId) {
var params = {
tenant_id: tenantId
};
var pathTemplate = '/tenant/{tenant_id}';
var method = 'GET';

@@ -54,11 +57,6 @@ var body = {};

};
TenantApi.prototype.register = function (tenantName) {
var params = {};
var pathTemplate = '/tenant/register';
var method = 'POST';
var body = { name: tenantName };
return this.invoke(params, pathTemplate, method, this.apigClientConfig.additionalParams, body);
};
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
TenantApi.prototype.invoke = function (params, pathTemplate, method, additionalParams, body) {
var _this = this;
// eslint-disable-next-line no-async-promise-executor
return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {

@@ -65,0 +63,0 @@ var response, error_1;

@@ -7,4 +7,5 @@ import { ApiCredentials } from '@adastradev/serverless-discovery-sdk';

constructor(serviceEndpointUri: string, region: string, credentials: ApiCredentials);
find(tenant_id: any): Promise<AstraResponse<ITenantApiModel>>;
private invoke;
find(tenantId: string): Promise<AstraResponse<ITenantApiModel>>;
register(tenantName: string): Promise<AstraResponse<ITenantApiModel>>;
invoke<T>(params: any, pathTemplate: any, method: any, additionalParams: any, body: any, dataIndex: string): Promise<AstraResponse<T>>;
}
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());

@@ -38,2 +39,3 @@ });

Object.defineProperty(exports, "__esModule", { value: true });
exports.TenantConsumerApi = void 0;
var ApiGatewayClient_1 = require("./ApiGatewayClient");

@@ -45,11 +47,23 @@ var AstraResponse_1 = require("./AstraResponse");

}
TenantConsumerApi.prototype.find = function (tenant_id) {
var params = {};
var pathTemplate = "/consumer/tenant/" + tenant_id;
TenantConsumerApi.prototype.find = function (tenantId) {
var params = {
tenant_id: tenantId
};
var pathTemplate = '/consumer/tenant/{tenant_id}';
var method = 'GET';
var body = {};
return this.invoke(params, pathTemplate, method, this.apigClientConfig.additionalParams, body);
// NOTE: this currently unwraps the data from inside a 'tenant' key in the JSON, but it should probably be fixed on the tenant service
return this.invoke(params, pathTemplate, method, this.apigClientConfig.additionalParams, body, 'tenant');
};
TenantConsumerApi.prototype.invoke = function (params, pathTemplate, method, additionalParams, body) {
TenantConsumerApi.prototype.register = function (tenantName) {
var params = {};
var pathTemplate = '/tenant/register';
var method = 'POST';
var body = { name: tenantName };
return this.invoke(params, pathTemplate, method, this.apigClientConfig.additionalParams, body, null);
};
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
TenantConsumerApi.prototype.invoke = function (params, pathTemplate, method, additionalParams, body, dataIndex) {
var _this = this;
// eslint-disable-next-line no-async-promise-executor
return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {

@@ -64,9 +78,12 @@ var response, error_1;

response = _a.sent();
resolve(new AstraResponse_1.AstraResponse(response.data, response));
return [3 /*break*/, 3];
return [2 /*return*/, resolve(dataIndex === undefined
? new AstraResponse_1.AstraResponse(response.data, response)
: new AstraResponse_1.AstraResponse(response.data[dataIndex], response))];
case 2:
error_1 = _a.sent();
// TODO: translate relevant axios information from error.response that isn't currently included in error.message
reject(error_1);
return [3 /*break*/, 3];
// Include additional detail for axios errors
if (error_1.response !== undefined && error_1.response.data !== undefined) {
error_1.message = "Axios Error: " + error_1.message + ". Response: " + JSON.stringify(error_1.response.data);
}
return [2 /*return*/, reject(error_1)];
case 3: return [2 /*return*/];

@@ -73,0 +90,0 @@ }

{
"name": "@adastradev/tenant-sdk",
"version": "1.0.0-beta.1",
"version": "1.0.0-beta.1702485065343",
"description": "Astra Tenant SDK for JavaScript in the browser and Node.js",

@@ -8,5 +8,9 @@ "main": "dist/index.js",

"build": "./node_modules/.bin/tsc",
"test": "mocha -r ts-node/register test/unit/**/*.spec.ts",
"system-test": "mocha -r ts-node/register test/system/**/*.spec.ts",
"lint": "tslint {source,test}/**/*.ts"
"test": "jest unit integration --coverage",
"test:unit": "jest unit",
"test:codecov": "codecov",
"lint": "eslint source test",
"coverage": "codecov",
"snykprotect": "snyk protect",
"snyktest": "snyk test --severity-threshold=medium"
},

@@ -27,20 +31,30 @@ "repository": {

"homepage": "https://github.com/adastradev/tenant-sdk-js#readme",
"files": [
"/dist"
],
"dependencies": {
"@adastradev/serverless-discovery-sdk": "0.0.7",
"aws-api-gateway-client": "git+https://github.com/aregier/aws-api-gateway-client.git#issue/67",
"axios": "^0.19.0-beta.1"
"@adastradev/aws-api-gateway-client": "^1.0.8-beta.1701803578025",
"@adastradev/serverless-discovery-sdk": "^2.3.5-beta.1701797296823",
"axios": "^1.6.2"
},
"devDependencies": {
"@types/chai": "^4.1.7",
"@types/mocha": "^5.2.5",
"@types/node": "^10.12.6",
"chai": "^4.2.0",
"@adastradev/eslint-config-adastra": "^0.1.3",
"@types/jest": "^26.0.19",
"@types/node": "^14.0.1",
"ci-publish": "^1.3.1",
"mocha": "^5.2.0",
"sinon": "^7.1.1",
"ts-node": "^7.0.1",
"ts-sinon": "^1.0.12",
"tslint": "^5.11.0",
"typescript": "^3.1.6"
"codecov": "^3.8.0",
"eslint": "^7.15.0",
"eslint-config-prettier": "^7.0.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-prettier": "^3.3.0",
"jest": "^26.6.3",
"nyc": "^15.1.0",
"prettier": "^2.2.1",
"sinon": "^9.0.2",
"snyk": "^1.737.0",
"ts-jest": "^26.4.4",
"ts-node": "^8.10.1",
"ts-sinon": "^1.2.0",
"typescript": "^3.9.2"
}
}
# tenant-sdk-js
Astra tenant SDK for JavaScript in the browser and Node.js
### Code coverage ###
[![codecov](https://codecov.io/bb/adastradev/tenant-sdk-js/branch/master/graph/badge.svg?token=MJbaQDfhqB)](https://codecov.io/bb/adastradev/tenant-sdk-js)
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