New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@elevenback/mdb-client

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@elevenback/mdb-client - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

rome.json

8

dist/cjs/index.d.ts
type Options = {
apiOrigin: string;
apiOrigin?: string;
token: string;
};
declare class APIClient {
private apiOrigin;
constructor(options?: Options);
private token;
constructor(options: Options);
getAtomValue(atomId: string): Promise<string>;
updateAtomValue(atomId: string, value: string): Promise<void>;
}
declare function initMDBClient(options?: Options): APIClient;
declare function initMDBClient(options: Options): APIClient;
export default initMDBClient;

@@ -10,8 +10,16 @@ "use strict";

this.apiOrigin = 'https://api.example.com';
this.token = '';
if (options === null || options === void 0 ? void 0 : options.apiOrigin) {
this.apiOrigin = options.apiOrigin;
}
if (!options.token) {
this.token = options.token;
}
}
async getAtomValue(atomId) {
const { data: { value } } = await axios_1.default.get(`${this.apiOrigin}/atom/${atomId}`);
const { data: { value }, } = await axios_1.default.get(`${this.apiOrigin}/atom/${atomId}`, {
headers: {
Authorization: `Bearer ${this.token}`,
},
});
return value;

@@ -22,2 +30,6 @@ }

value,
}, {
headers: {
Authorization: `Bearer ${this.token}`,
},
});

@@ -24,0 +36,0 @@ return;

type Options = {
apiOrigin: string;
apiOrigin?: string;
token: string;
};
declare class APIClient {
private apiOrigin;
constructor(options?: Options);
private token;
constructor(options: Options);
getAtomValue(atomId: string): Promise<string>;
updateAtomValue(atomId: string, value: string): Promise<void>;
}
declare function initMDBClient(options?: Options): APIClient;
declare function initMDBClient(options: Options): APIClient;
export default initMDBClient;

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

this.apiOrigin = 'https://api.example.com';
this.token = '';
if (options === null || options === void 0 ? void 0 : options.apiOrigin) {
this.apiOrigin = options.apiOrigin;
}
if (!options.token) {
this.token = options.token;
}
}
getAtomValue(atomId) {
return __awaiter(this, void 0, void 0, function* () {
const { data: { value } } = yield axios.get(`${this.apiOrigin}/atom/${atomId}`);
const { data: { value }, } = yield axios.get(`${this.apiOrigin}/atom/${atomId}`, {
headers: {
Authorization: `Bearer ${this.token}`,
},
});
return value;

@@ -29,2 +37,6 @@ });

value,
}, {
headers: {
Authorization: `Bearer ${this.token}`,
},
});

@@ -31,0 +43,0 @@ return;

{
"name": "@elevenback/mdb-client",
"version": "0.1.1",
"version": "0.2.0",
"main": "./dist/cjs/index.js",

@@ -10,6 +10,8 @@ "module": "./dist/esm/index.js",

"build:cjs": "tsc -p tsconfig.cjs.json",
"build:esm": "tsc"
"build:esm": "tsc",
"format": "rome format ./src/ --write"
},
"dependencies": {
"axios": "^1.3.5"
"axios": "^1.3.5",
"rome": "^0.10.1"
},

@@ -16,0 +18,0 @@ "devDependencies": {

import axios from 'axios';
type Options = {
apiOrigin: string;
}
apiOrigin?: string;
token: string;
};
class APIClient {
private apiOrigin: string = 'https://api.example.com';
constructor(options?: Options) {
private token: string = '';
constructor(options: Options) {
if (options?.apiOrigin) {
this.apiOrigin = options.apiOrigin;
}
if (!options.token) {
this.token = options.token;
}
}
async getAtomValue(atomId: string) {
const { data: { value } } = await axios.get<{ value: string }>(`${this.apiOrigin}/atom/${atomId}`);
const {
data: { value },
} = await axios.get<{ value: string }>(`${this.apiOrigin}/atom/${atomId}`, {
headers: {
Authorization: `Bearer ${this.token}`,
},
});
return value;

@@ -21,5 +32,13 @@ }

async updateAtomValue(atomId: string, value: string): Promise<void> {
await axios.put<undefined>(`${this.apiOrigin}/atom/${atomId}`, {
value,
});
await axios.put<undefined>(
`${this.apiOrigin}/atom/${atomId}`,
{
value,
},
{
headers: {
Authorization: `Bearer ${this.token}`,
},
},
);
return;

@@ -29,3 +48,3 @@ }

function initMDBClient(options?: Options) {
function initMDBClient(options: Options) {
return new APIClient(options);

@@ -32,0 +51,0 @@ }

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