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.29.2-beta.2354.0 to 0.29.2-beta.2355.0

26

dist/cjs/Base.js

@@ -54,2 +54,3 @@ "use strict";

exports.Base = void 0;
var path_1 = require("path");
var axios_1 = __importDefault(require("axios"));

@@ -285,7 +286,7 @@ var utils_1 = require("./utils");

conf = {
url: "".concat(this._serviceUrl, "/").concat(this.normalizeRoute(params.route)),
url: this.getUrl(params),
method: params.method || 'GET',
data: params.data,
params: params.params,
headers: __assign(__assign({}, this.getHeaders()), params.customHeaders),
headers: __assign(__assign({}, this.getHeaders()), params.customHeaders ? params.customHeaders : {}),
signal: params.signal,

@@ -335,7 +336,7 @@ };

return [4 /*yield*/, this.axios({
url: "".concat(params.url || this._serviceUrl, "/").concat(this.normalizeRoute(params.route)),
url: this.getUrl(params),
method: params.method || 'GET',
data: params.data,
params: query,
headers: __assign(__assign({}, this.getHeaders()), params.customHeaders),
headers: __assign(__assign({}, this.getHeaders()), params.customHeaders ? params.customHeaders : {}),
signal: params.signal,

@@ -353,3 +354,3 @@ }).catch(function (e) {

/**
* Normalize route ro remove splace from param
* Normalize route ro remove spaces from param
* ```typescript

@@ -363,2 +364,17 @@ * const result = await instance.normalizeRoute('/route');

};
/**
* Normalize URL for API request
* @param {CalApiParams} params request params
* @returns {string} normalized URL
* @ignore
*/
Base.prototype.getUrl = function (params) {
if (params.url)
return params.url;
if (!this.serviceUrl)
throw new Error('serviceUrl is not defined');
var url = new URL(this.serviceUrl);
url.pathname = (0, path_1.join)(url.pathname, (0, utils_1.normalizeRoute)(params.route));
return url.toString();
};
return Base;

@@ -365,0 +381,0 @@ }());

@@ -10,2 +10,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

};
import { join } from 'path';
import axios from 'axios';

@@ -183,7 +184,7 @@ import { normalizeRoute, normalizeUrl, paramsSerializer, parseAxiosError } from './utils';

const conf = {
url: `${this._serviceUrl}/${this.normalizeRoute(params.route)}`,
url: this.getUrl(params),
method: params.method || 'GET',
data: params.data,
params: params.params,
headers: Object.assign(Object.assign({}, this.getHeaders()), params.customHeaders),
headers: Object.assign(Object.assign({}, this.getHeaders()), params.customHeaders ? params.customHeaders : {}),
signal: params.signal,

@@ -222,7 +223,7 @@ };

const { data } = yield this.axios({
url: `${params.url || this._serviceUrl}/${this.normalizeRoute(params.route)}`,
url: this.getUrl(params),
method: params.method || 'GET',
data: params.data,
params: query,
headers: Object.assign(Object.assign({}, this.getHeaders()), params.customHeaders),
headers: Object.assign(Object.assign({}, this.getHeaders()), params.customHeaders ? params.customHeaders : {}),
signal: params.signal,

@@ -236,3 +237,3 @@ }).catch(e => {

/**
* Normalize route ro remove splace from param
* Normalize route ro remove spaces from param
* ```typescript

@@ -246,3 +247,18 @@ * const result = await instance.normalizeRoute('/route');

}
/**
* Normalize URL for API request
* @param {CalApiParams} params request params
* @returns {string} normalized URL
* @ignore
*/
getUrl(params) {
if (params.url)
return params.url;
if (!this.serviceUrl)
throw new Error('serviceUrl is not defined');
const url = new URL(this.serviceUrl);
url.pathname = join(url.pathname, normalizeRoute(params.route));
return url.toString();
}
}
//# sourceMappingURL=Base.js.map

@@ -87,3 +87,3 @@ import { RawAxiosRequestHeaders, AxiosError } from 'axios';

/**
* Normalize route ro remove splace from param
* Normalize route ro remove spaces from param
* ```typescript

@@ -95,3 +95,10 @@ * const result = await instance.normalizeRoute('/route');

protected normalizeRoute(data: string): string;
/**
* Normalize URL for API request
* @param {CalApiParams} params request params
* @returns {string} normalized URL
* @ignore
*/
protected getUrl(params: CalApiParams): string;
}
//# sourceMappingURL=Base.d.ts.map

2

package.json
{
"name": "@or-sdk/base",
"version": "0.29.2-beta.2354.0",
"version": "0.29.2-beta.2355.0",
"main": "dist/cjs/index.js",

@@ -5,0 +5,0 @@ "module": "dist/esm/index.js",

@@ -0,1 +1,2 @@

import { join } from 'path';
import axios, { AxiosInstance, RawAxiosRequestHeaders, AxiosRequestConfig, AxiosError } from 'axios';

@@ -223,3 +224,3 @@ import { BaseConfig, CalApiParams, MakeApiUrlData, ServiceDiscoveryResponse } from './types';

const conf: AxiosRequestConfig = {
url: `${this._serviceUrl}/${this.normalizeRoute(params.route)}`,
url: this.getUrl(params),
method: params.method || 'GET',

@@ -230,3 +231,3 @@ data: params.data,

...this.getHeaders(),
...params.customHeaders,
... params.customHeaders ? params.customHeaders : {},
},

@@ -264,3 +265,3 @@ signal: params.signal,

const { data } = await this.axios({
url: `${params.url || this._serviceUrl}/${this.normalizeRoute(params.route)}`,
url: this.getUrl(params),
method: params.method || 'GET',

@@ -271,3 +272,3 @@ data: params.data,

...this.getHeaders(),
...params.customHeaders,
...params.customHeaders ? params.customHeaders : {},
},

@@ -283,3 +284,3 @@ signal: params.signal,

/**
* Normalize route ro remove splace from param
* Normalize route ro remove spaces from param
* ```typescript

@@ -290,5 +291,22 @@ * const result = await instance.normalizeRoute('/route');

*/
protected normalizeRoute(data: string) {
protected normalizeRoute(data: string): string {
return normalizeRoute(data);
}
/**
* Normalize URL for API request
* @param {CalApiParams} params request params
* @returns {string} normalized URL
* @ignore
*/
protected getUrl(params: CalApiParams): string {
if (params.url) return params.url;
if (!this.serviceUrl) throw new Error('serviceUrl is not defined');
const url = new URL(this.serviceUrl);
url.pathname = join(url.pathname, normalizeRoute(params.route));
return url.toString();
}
}

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