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

@xylabs/api

Package Overview
Dependencies
Maintainers
7
Versions
220
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xylabs/api - npm Package Compare versions

Comparing version 2.6.16 to 2.7.0

2

dist/cjs/ApiClient.js

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

constructor(token, stage) {
this.token = token;
this.stage = stage;
this.stage = stage !== null && stage !== void 0 ? stage : ApiStage_1.ApiStage.Prod;

@@ -9,0 +11,0 @@ this.token = token;

18

dist/cjs/ApiEndpoint.js

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

}
get value() {
return this._value;
}
get headers() {

@@ -18,11 +21,2 @@ return this.config.jwtToken ? { Authorization: this.config.jwtToken } : undefined;

}
get value() {
return this._value;
}
get() {
var _a;
return tslib_1.__awaiter(this, void 0, void 0, function* () {
return (_a = this._value) !== null && _a !== void 0 ? _a : (yield this.fetch());
});
}
fetch() {

@@ -40,2 +34,8 @@ return tslib_1.__awaiter(this, void 0, void 0, function* () {

}
get() {
var _a;
return tslib_1.__awaiter(this, void 0, void 0, function* () {
return (_a = this._value) !== null && _a !== void 0 ? _a : (yield this.fetch());
});
}
insert(value) {

@@ -42,0 +42,0 @@ return tslib_1.__awaiter(this, void 0, void 0, function* () {

@@ -27,3 +27,3 @@ {

"character": 2,
"url": "https://github.com/xylabs/sdk-js/blob/5cd9095/packages/api/src/ApiStage.ts#L2"
"url": "https://github.com/xylabs/sdk-js/blob/089a04a/packages/api/src/ApiStage.ts#L2"
}

@@ -47,3 +47,3 @@ ],

"character": 2,
"url": "https://github.com/xylabs/sdk-js/blob/5cd9095/packages/api/src/ApiStage.ts#L3"
"url": "https://github.com/xylabs/sdk-js/blob/089a04a/packages/api/src/ApiStage.ts#L3"
}

@@ -67,3 +67,3 @@ ],

"character": 2,
"url": "https://github.com/xylabs/sdk-js/blob/5cd9095/packages/api/src/ApiStage.ts#L4"
"url": "https://github.com/xylabs/sdk-js/blob/089a04a/packages/api/src/ApiStage.ts#L4"
}

@@ -92,3 +92,3 @@ ],

"character": 5,
"url": "https://github.com/xylabs/sdk-js/blob/5cd9095/packages/api/src/ApiStage.ts#L1"
"url": "https://github.com/xylabs/sdk-js/blob/089a04a/packages/api/src/ApiStage.ts#L1"
}

@@ -119,3 +119,3 @@ ]

"character": 2,
"url": "https://github.com/xylabs/sdk-js/blob/5cd9095/packages/api/src/ApiClient.ts#L4"
"url": "https://github.com/xylabs/sdk-js/blob/089a04a/packages/api/src/ApiClient.ts#L4"
}

@@ -177,3 +177,3 @@ ],

{
"id": 6,
"id": 7,
"name": "stage",

@@ -183,3 +183,4 @@ "kind": 1024,

"flags": {
"isProtected": true
"isProtected": true,
"isOptional": true
},

@@ -189,14 +190,15 @@ "sources": [

"fileName": "ApiClient.ts",
"line": 9,
"character": 12,
"url": "https://github.com/xylabs/sdk-js/blob/5cd9095/packages/api/src/ApiClient.ts#L9"
"line": 4,
"character": 64,
"url": "https://github.com/xylabs/sdk-js/blob/089a04a/packages/api/src/ApiClient.ts#L4"
}
],
"type": {
"type": "intrinsic",
"name": "string"
"type": "reference",
"id": 40,
"name": "ApiStage"
}
},
{
"id": 7,
"id": 6,
"name": "token",

@@ -212,5 +214,5 @@ "kind": 1024,

"fileName": "ApiClient.ts",
"line": 11,
"character": 12,
"url": "https://github.com/xylabs/sdk-js/blob/5cd9095/packages/api/src/ApiClient.ts#L11"
"line": 4,
"character": 31,
"url": "https://github.com/xylabs/sdk-js/blob/089a04a/packages/api/src/ApiClient.ts#L4"
}

@@ -243,5 +245,5 @@ ],

"fileName": "ApiClient.ts",
"line": 13,
"line": 9,
"character": 11,
"url": "https://github.com/xylabs/sdk-js/blob/5cd9095/packages/api/src/ApiClient.ts#L13"
"url": "https://github.com/xylabs/sdk-js/blob/089a04a/packages/api/src/ApiClient.ts#L9"
}

@@ -274,4 +276,4 @@ ],

"children": [
6,
7
7,
6
]

@@ -291,3 +293,3 @@ },

"character": 15,
"url": "https://github.com/xylabs/sdk-js/blob/5cd9095/packages/api/src/ApiClient.ts#L3"
"url": "https://github.com/xylabs/sdk-js/blob/089a04a/packages/api/src/ApiClient.ts#L3"
}

@@ -312,5 +314,5 @@ ]

"fileName": "ApiEndpoint.ts",
"line": 9,
"line": 10,
"character": 2,
"url": "https://github.com/xylabs/sdk-js/blob/5cd9095/packages/api/src/ApiEndpoint.ts#L9"
"url": "https://github.com/xylabs/sdk-js/blob/089a04a/packages/api/src/ApiEndpoint.ts#L10"
}

@@ -375,3 +377,3 @@ ],

{
"id": 29,
"id": 21,
"name": "_value",

@@ -387,5 +389,5 @@ "kind": 1024,

"fileName": "ApiEndpoint.ts",
"line": 22,
"line": 6,
"character": 10,
"url": "https://github.com/xylabs/sdk-js/blob/5cd9095/packages/api/src/ApiEndpoint.ts#L22"
"url": "https://github.com/xylabs/sdk-js/blob/089a04a/packages/api/src/ApiEndpoint.ts#L6"
}

@@ -400,3 +402,3 @@ ],

{
"id": 21,
"id": 22,
"name": "config",

@@ -411,5 +413,5 @@ "kind": 1024,

"fileName": "ApiEndpoint.ts",
"line": 6,
"line": 7,
"character": 10,
"url": "https://github.com/xylabs/sdk-js/blob/5cd9095/packages/api/src/ApiEndpoint.ts#L6"
"url": "https://github.com/xylabs/sdk-js/blob/089a04a/packages/api/src/ApiEndpoint.ts#L7"
}

@@ -424,3 +426,3 @@ ],

{
"id": 22,
"id": 23,
"name": "path",

@@ -435,5 +437,5 @@ "kind": 1024,

"fileName": "ApiEndpoint.ts",
"line": 7,
"line": 8,
"character": 10,
"url": "https://github.com/xylabs/sdk-js/blob/5cd9095/packages/api/src/ApiEndpoint.ts#L7"
"url": "https://github.com/xylabs/sdk-js/blob/089a04a/packages/api/src/ApiEndpoint.ts#L8"
}

@@ -447,3 +449,3 @@ ],

{
"id": 23,
"id": 26,
"name": "headers",

@@ -458,9 +460,9 @@ "kind": 262144,

"fileName": "ApiEndpoint.ts",
"line": 14,
"line": 19,
"character": 14,
"url": "https://github.com/xylabs/sdk-js/blob/5cd9095/packages/api/src/ApiEndpoint.ts#L14"
"url": "https://github.com/xylabs/sdk-js/blob/089a04a/packages/api/src/ApiEndpoint.ts#L19"
}
],
"getSignature": {
"id": 24,
"id": 27,
"name": "headers",

@@ -480,3 +482,3 @@ "kind": 524288,

"declaration": {
"id": 25,
"id": 28,
"name": "__type",

@@ -488,3 +490,3 @@ "kind": 65536,

{
"id": 26,
"id": 29,
"name": "Authorization",

@@ -497,5 +499,5 @@ "kind": 1024,

"fileName": "ApiEndpoint.ts",
"line": 15,
"line": 20,
"character": 36,
"url": "https://github.com/xylabs/sdk-js/blob/5cd9095/packages/api/src/ApiEndpoint.ts#L15"
"url": "https://github.com/xylabs/sdk-js/blob/089a04a/packages/api/src/ApiEndpoint.ts#L20"
}

@@ -514,3 +516,3 @@ ],

"children": [
26
29
]

@@ -522,5 +524,5 @@ }

"fileName": "ApiEndpoint.ts",
"line": 15,
"line": 20,
"character": 34,
"url": "https://github.com/xylabs/sdk-js/blob/5cd9095/packages/api/src/ApiEndpoint.ts#L15"
"url": "https://github.com/xylabs/sdk-js/blob/089a04a/packages/api/src/ApiEndpoint.ts#L20"
}

@@ -535,3 +537,3 @@ ]

{
"id": 27,
"id": 30,
"name": "url",

@@ -546,9 +548,9 @@ "kind": 262144,

"fileName": "ApiEndpoint.ts",
"line": 18,
"line": 23,
"character": 14,
"url": "https://github.com/xylabs/sdk-js/blob/5cd9095/packages/api/src/ApiEndpoint.ts#L18"
"url": "https://github.com/xylabs/sdk-js/blob/089a04a/packages/api/src/ApiEndpoint.ts#L23"
}
],
"getSignature": {
"id": 28,
"id": 31,
"name": "url",

@@ -565,3 +567,3 @@ "kind": 524288,

{
"id": 30,
"id": 24,
"name": "value",

@@ -576,9 +578,9 @@ "kind": 262144,

"fileName": "ApiEndpoint.ts",
"line": 24,
"line": 15,
"character": 13,
"url": "https://github.com/xylabs/sdk-js/blob/5cd9095/packages/api/src/ApiEndpoint.ts#L24"
"url": "https://github.com/xylabs/sdk-js/blob/089a04a/packages/api/src/ApiEndpoint.ts#L15"
}
],
"getSignature": {
"id": 31,
"id": 25,
"name": "value",

@@ -605,3 +607,3 @@ "kind": 524288,

{
"id": 34,
"id": 32,
"name": "fetch",

@@ -616,5 +618,5 @@ "kind": 2048,

"fileName": "ApiEndpoint.ts",
"line": 32,
"line": 27,
"character": 15,
"url": "https://github.com/xylabs/sdk-js/blob/5cd9095/packages/api/src/ApiEndpoint.ts#L32"
"url": "https://github.com/xylabs/sdk-js/blob/089a04a/packages/api/src/ApiEndpoint.ts#L27"
}

@@ -624,3 +626,3 @@ ],

{
"id": 35,
"id": 33,
"name": "fetch",

@@ -647,3 +649,3 @@ "kind": 4096,

{
"id": 32,
"id": 34,
"name": "get",

@@ -658,5 +660,5 @@ "kind": 2048,

"fileName": "ApiEndpoint.ts",
"line": 28,
"line": 37,
"character": 15,
"url": "https://github.com/xylabs/sdk-js/blob/5cd9095/packages/api/src/ApiEndpoint.ts#L28"
"url": "https://github.com/xylabs/sdk-js/blob/089a04a/packages/api/src/ApiEndpoint.ts#L37"
}

@@ -666,3 +668,3 @@ ],

{
"id": 33,
"id": 35,
"name": "get",

@@ -717,5 +719,5 @@ "kind": 4096,

"fileName": "ApiEndpoint.ts",
"line": 42,
"line": 41,
"character": 15,
"url": "https://github.com/xylabs/sdk-js/blob/5cd9095/packages/api/src/ApiEndpoint.ts#L42"
"url": "https://github.com/xylabs/sdk-js/blob/089a04a/packages/api/src/ApiEndpoint.ts#L41"
}

@@ -771,5 +773,5 @@ ],

"children": [
29,
21,
22
22,
23
]

@@ -780,5 +782,5 @@ },

"children": [
23,
27,
30
26,
30,
24
]

@@ -789,4 +791,4 @@ },

"children": [
32,
34,
32,
36

@@ -801,3 +803,3 @@ ]

"character": 6,
"url": "https://github.com/xylabs/sdk-js/blob/5cd9095/packages/api/src/ApiEndpoint.ts#L5"
"url": "https://github.com/xylabs/sdk-js/blob/089a04a/packages/api/src/ApiEndpoint.ts#L5"
}

@@ -833,3 +835,3 @@ ],

"character": 2,
"url": "https://github.com/xylabs/sdk-js/blob/5cd9095/packages/api/src/ApiConfig.ts#L2"
"url": "https://github.com/xylabs/sdk-js/blob/089a04a/packages/api/src/ApiConfig.ts#L2"
}

@@ -843,3 +845,3 @@ ],

{
"id": 14,
"id": 12,
"name": "apiKey",

@@ -854,5 +856,5 @@ "kind": 1024,

"fileName": "ApiConfig.ts",
"line": 5,
"line": 3,
"character": 2,
"url": "https://github.com/xylabs/sdk-js/blob/5cd9095/packages/api/src/ApiConfig.ts#L5"
"url": "https://github.com/xylabs/sdk-js/blob/089a04a/packages/api/src/ApiConfig.ts#L3"
}

@@ -878,3 +880,3 @@ ],

"character": 2,
"url": "https://github.com/xylabs/sdk-js/blob/5cd9095/packages/api/src/ApiConfig.ts#L4"
"url": "https://github.com/xylabs/sdk-js/blob/089a04a/packages/api/src/ApiConfig.ts#L4"
}

@@ -888,3 +890,3 @@ ],

{
"id": 12,
"id": 14,
"name": "userid",

@@ -899,5 +901,5 @@ "kind": 1024,

"fileName": "ApiConfig.ts",
"line": 3,
"line": 5,
"character": 2,
"url": "https://github.com/xylabs/sdk-js/blob/5cd9095/packages/api/src/ApiConfig.ts#L3"
"url": "https://github.com/xylabs/sdk-js/blob/089a04a/packages/api/src/ApiConfig.ts#L5"
}

@@ -916,5 +918,5 @@ ],

11,
14,
12,
13,
12
14
]

@@ -928,3 +930,3 @@ }

"character": 10,
"url": "https://github.com/xylabs/sdk-js/blob/5cd9095/packages/api/src/ApiConfig.ts#L1"
"url": "https://github.com/xylabs/sdk-js/blob/089a04a/packages/api/src/ApiConfig.ts#L1"
}

@@ -944,3 +946,3 @@ ]

"character": 6,
"url": "https://github.com/xylabs/sdk-js/blob/5cd9095/packages/api/src/getApiStage.ts#L3"
"url": "https://github.com/xylabs/sdk-js/blob/089a04a/packages/api/src/getApiStage.ts#L3"
}

@@ -1008,5 +1010,5 @@ ],

"character": 0,
"url": "https://github.com/xylabs/sdk-js/blob/5cd9095/packages/api/src/index.ts#L1"
"url": "https://github.com/xylabs/sdk-js/blob/089a04a/packages/api/src/index.ts#L1"
}
]
}
import { ApiStage } from './ApiStage';
class ApiClient {
token;
stage;
constructor(token, stage) {
this.token = token;
this.stage = stage;
this.stage = stage ?? ApiStage.Prod;
this.token = token;
}
stage;
token;
}
export { ApiClient };
//# sourceMappingURL=ApiClient.js.map
import axios from 'axios';
class ApiEndpoint {
_value;
config;

@@ -9,2 +10,5 @@ path;

}
get value() {
return this._value;
}
get headers() {

@@ -16,9 +20,2 @@ return this.config.jwtToken ? { Authorization: this.config.jwtToken } : undefined;

}
_value;
get value() {
return this._value;
}
async get() {
return this._value ?? (await this.fetch());
}
async fetch() {

@@ -34,2 +31,5 @@ const response = await axios.get(this.url, { headers: this.headers });

}
async get() {
return this._value ?? (await this.fetch());
}
async insert(value) {

@@ -36,0 +36,0 @@ const response = await axios.post(this.url, value, { headers: this.headers });

import { ApiStage } from './ApiStage';
declare abstract class ApiClient {
constructor(token?: string | null, stage?: ApiStage);
protected stage: string;
protected token?: string | null;
protected token?: string | null | undefined;
protected stage?: ApiStage | undefined;
constructor(token?: string | null | undefined, stage?: ApiStage | undefined);
abstract endPoint(): string;

@@ -7,0 +7,0 @@ }

interface ApiConfig {
apiDomain: string;
apiKey?: string;
jwtToken?: string;
userid?: string;
jwtToken?: string;
apiKey?: string;
}
export type { ApiConfig };
//# sourceMappingURL=ApiConfig.d.ts.map
import { ApiConfig } from './ApiConfig';
declare class ApiEndpoint<T> {
private _value?;
private config;
private path;
constructor(config: ApiConfig, path: string);
get value(): T | undefined;
private get headers();
private get url();
private _value?;
get value(): T | undefined;
fetch(): Promise<T>;
get(): Promise<T | NonNullable<T>>;
fetch(): Promise<T>;
insert(value: T): Promise<T>;

@@ -13,0 +13,0 @@ }

@@ -47,8 +47,8 @@ {

"dependencies": {
"axios": "^1.2.3"
"axios": "^1.3.2"
},
"devDependencies": {
"@xylabs/eslint-config": "2.12.23",
"@xylabs/ts-scripts-yarn3": "^2.12.23",
"eslint": "^8.32.0"
"@xylabs/eslint-config": "2.13.11",
"@xylabs/ts-scripts-yarn3": "^2.13.11",
"eslint": "^8.33.0"
},

@@ -63,4 +63,4 @@ "publishConfig": {

"sideEffects": false,
"version": "2.6.16",
"version": "2.7.0",
"packageManager": "yarn@3.3.1"
}
import { ApiStage } from './ApiStage'
abstract class ApiClient {
public constructor(token?: string | null, stage?: ApiStage) {
public constructor(protected token?: string | null, protected stage?: ApiStage) {
this.stage = stage ?? ApiStage.Prod

@@ -9,6 +9,2 @@ this.token = token

protected stage: string
protected token?: string | null
abstract endPoint(): string

@@ -15,0 +11,0 @@ }

interface ApiConfig {
apiDomain: string
apiKey?: string
jwtToken?: string
userid?: string
jwtToken?: string
apiKey?: string
}
export type { ApiConfig }

@@ -6,2 +6,3 @@ import axios from 'axios'

class ApiEndpoint<T> {
private _value?: T
private config: ApiConfig

@@ -15,2 +16,6 @@ private path: string

public get value() {
return this._value
}
private get headers() {

@@ -24,12 +29,2 @@ return this.config.jwtToken ? { Authorization: this.config.jwtToken } : undefined

private _value?: T
public get value() {
return this._value
}
public async get() {
return this._value ?? (await this.fetch())
}
public async fetch() {

@@ -45,2 +40,6 @@ const response = await axios.get<T>(this.url, { headers: this.headers })

public async get() {
return this._value ?? (await this.fetch())
}
public async insert(value: T) {

@@ -47,0 +46,0 @@ const response = await axios.post<T>(this.url, value, { headers: this.headers })

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

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