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

@or-sdk/base

Package Overview
Dependencies
Maintainers
2
Versions
335
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@or-sdk/base - npm Package Compare versions

Comparing version 0.15.0 to 0.16.0

20

dist/cjs/Base.js

@@ -59,6 +59,7 @@ "use strict";

function Base(_a) {
var token = _a.token, discoveryUrl = _a.discoveryUrl, serviceKey = _a.serviceKey, requestAccountId = _a.requestAccountId, requestProvidersAccountId = _a.requestProvidersAccountId, feature = _a.feature;
var token = _a.token, discoveryUrl = _a.discoveryUrl, serviceKey = _a.serviceKey, requestAccountId = _a.requestAccountId, requestProvidersAccountId = _a.requestProvidersAccountId, feature = _a.feature, accountId = _a.accountId;
this.discoveryRoute = "api/" + constants_1.VERSION;
this.requestAccountId = false;
this.requestProvidersAccountId = false;
this._isCrossAccount = false;
this._currentAccountId = null;

@@ -72,3 +73,9 @@ this._providersAccountId = null;

this.axios = axios_1.default.create({ paramsSerializer: utils_1.paramsSerializer });
this.requestAccountId = requestAccountId || false;
if (accountId) {
this._currentAccountId = accountId;
this._isCrossAccount = true;
}
else {
this.requestAccountId = requestAccountId || false;
}
this.requestProvidersAccountId = requestProvidersAccountId || false;

@@ -91,2 +98,9 @@ this.feature = feature || null;

});
Object.defineProperty(Base.prototype, "isCrossAccount", {
get: function () {
return this._isCrossAccount;
},
enumerable: false,
configurable: true
});
Base.prototype.init = function () {

@@ -106,3 +120,2 @@ return __awaiter(this, void 0, void 0, function () {

data = (_a.sent()).data;
this._serviceUrl = this.makeApiUrl(data);
if (this.requestAccountId) {

@@ -114,2 +127,3 @@ this._currentAccountId = data.accountId;

}
this._serviceUrl = this.makeApiUrl(data);
this.status = constants_1.SdkStatus.SUCCESS;

@@ -116,0 +130,0 @@ return [3, 3];

2

dist/cjs/utils/makeList.js

@@ -6,3 +6,3 @@ "use strict";

total: rowsArr.length,
rows: rowsArr,
items: rowsArr,
};

@@ -9,0 +9,0 @@ }

@@ -14,6 +14,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

export class Base {
constructor({ token, discoveryUrl, serviceKey, requestAccountId, requestProvidersAccountId, feature }) {
constructor({ token, discoveryUrl, serviceKey, requestAccountId, requestProvidersAccountId, feature, accountId }) {
this.discoveryRoute = `api/${VERSION}`;
this.requestAccountId = false;
this.requestProvidersAccountId = false;
this._isCrossAccount = false;
this._currentAccountId = null;

@@ -27,3 +28,9 @@ this._providersAccountId = null;

this.axios = axios.create({ paramsSerializer });
this.requestAccountId = requestAccountId || false;
if (accountId) {
this._currentAccountId = accountId;
this._isCrossAccount = true;
}
else {
this.requestAccountId = requestAccountId || false;
}
this.requestProvidersAccountId = requestProvidersAccountId || false;

@@ -38,2 +45,5 @@ this.feature = feature || null;

}
get isCrossAccount() {
return this._isCrossAccount;
}
init() {

@@ -47,3 +57,2 @@ return __awaiter(this, void 0, void 0, function* () {

});
this._serviceUrl = this.makeApiUrl(data);
if (this.requestAccountId) {

@@ -55,2 +64,3 @@ this._currentAccountId = data.accountId;

}
this._serviceUrl = this.makeApiUrl(data);
this.status = SdkStatus.SUCCESS;

@@ -57,0 +67,0 @@ }

function makeList(rowsArr) {
return {
total: rowsArr.length,
rows: rowsArr,
items: rowsArr,
};

@@ -6,0 +6,0 @@ }

@@ -12,2 +12,3 @@ import { AxiosRequestHeaders, AxiosError } from 'axios';

private readonly feature;
private readonly _isCrossAccount;
private _currentAccountId;

@@ -17,5 +18,6 @@ private _providersAccountId;

private _serviceUrl;
protected constructor({ token, discoveryUrl, serviceKey, requestAccountId, requestProvidersAccountId, feature }: BaseConfig);
protected constructor({ token, discoveryUrl, serviceKey, requestAccountId, requestProvidersAccountId, feature, accountId }: BaseConfig);
get currentAccountId(): string | null;
get providersAccountId(): string | null;
get isCrossAccount(): boolean;
init(): Promise<void>;

@@ -22,0 +24,0 @@ get serviceUrl(): string;

@@ -8,2 +8,3 @@ import { Method } from 'axios';

feature?: string;
accountId?: string;
requestAccountId?: boolean;

@@ -34,3 +35,3 @@ requestProvidersAccountId?: boolean;

total: number;
rows: T[];
items: T[];
}

@@ -37,0 +38,0 @@ export interface ServiceDiscoveryResponse {

{
"version": "0.15.0",
"version": "0.16.0",
"name": "@or-sdk/base",

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

},
"gitHead": "1753eb9f7f2ef4a939d50851f7f54e1d3cfe36d7"
"gitHead": "f855bf3ee6b361c5831479cee5cde6f7702b6ced"
}

@@ -15,2 +15,3 @@ import axios, { AxiosInstance, AxiosRequestHeaders, AxiosError } from 'axios';

private readonly feature: string | null;
private readonly _isCrossAccount: boolean = false;

@@ -22,3 +23,4 @@ private _currentAccountId: string | null = null;

protected constructor({ token, discoveryUrl, serviceKey, requestAccountId, requestProvidersAccountId, feature }: BaseConfig) {
protected constructor({ token, discoveryUrl, serviceKey, requestAccountId, requestProvidersAccountId, feature, accountId }: BaseConfig) {
this.token = token;

@@ -28,3 +30,8 @@ this.discoveryUrl = discoveryUrl;

this.axios = axios.create({ paramsSerializer });
this.requestAccountId = requestAccountId || false;
if (accountId) {
this._currentAccountId = accountId;
this._isCrossAccount = true;
} else {
this.requestAccountId = requestAccountId || false;
}
this.requestProvidersAccountId = requestProvidersAccountId || false;

@@ -48,2 +55,6 @@ this.feature = feature || null;

public get isCrossAccount(): boolean {
return this._isCrossAccount;
}
async init(): Promise<void> {

@@ -62,4 +73,2 @@ try {

this._serviceUrl = this.makeApiUrl(data);
if (this.requestAccountId) {

@@ -71,2 +80,5 @@ this._currentAccountId = data.accountId;

}
this._serviceUrl = this.makeApiUrl(data);
this.status = SdkStatus.SUCCESS;

@@ -73,0 +85,0 @@ } catch (e) {

@@ -23,2 +23,6 @@ import { Method } from 'axios';

feature?: string;
/**
* Account ID for cross-account requests (super admin only)
*/
accountId?: string;

@@ -63,3 +67,3 @@ /**

total: number;
rows: T[];
items: T[];
}

@@ -66,0 +70,0 @@

@@ -6,3 +6,3 @@ import { List } from '../types';

total: rowsArr.length,
rows: rowsArr,
items: rowsArr,
};

@@ -9,0 +9,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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