namirasoft-core
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -9,4 +9,4 @@ import { AxiosRequestConfig, AxiosResponse } from "axios"; | ||
protected abstract onError(error: Error): void; | ||
private request; | ||
protected get<ResData = any, ReqData = any>(sub: string, query?: { | ||
private _request; | ||
protected _get<ResData = any, ReqData = any>(sub: string, query?: { | ||
[name: string]: ParsedNameValue; | ||
@@ -17,3 +17,3 @@ }, config?: AxiosRequestConfig<ReqData>): Promise<{ | ||
}>; | ||
protected post<ResData = any, ReqData = any>(sub: string, query?: { | ||
protected _post<ResData = any, ReqData = any>(sub: string, query?: { | ||
[name: string]: ParsedNameValue; | ||
@@ -24,3 +24,3 @@ }, data?: ReqData, config?: AxiosRequestConfig<ReqData>, sign_header?: string, sign_key?: string): Promise<{ | ||
}>; | ||
protected put<ResData = any, ReqData = any>(sub: string, query?: { | ||
protected _put<ResData = any, ReqData = any>(sub: string, query?: { | ||
[name: string]: ParsedNameValue; | ||
@@ -31,3 +31,3 @@ }, data?: ReqData, config?: AxiosRequestConfig<ReqData>, sign_header?: string, sign_key?: string): Promise<{ | ||
}>; | ||
protected delete<ResData = any, ReqData = any>(sub: string, query?: { | ||
protected _delete<ResData = any, ReqData = any>(sub: string, query?: { | ||
[name: string]: ParsedNameValue; | ||
@@ -34,0 +34,0 @@ }, config?: AxiosRequestConfig<ReqData>, sign_header?: string, sign_key?: string): Promise<{ |
@@ -25,3 +25,3 @@ "use strict"; | ||
} | ||
request(onRequest, sub, query, data, config, sign_header, sign_key) { | ||
_request(onRequest, sub, query, data, config, sign_header, sign_key) { | ||
var _a; | ||
@@ -54,5 +54,5 @@ return __awaiter(this, void 0, void 0, function* () { | ||
} | ||
get(sub, query, config) { | ||
_get(sub, query, config) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.request((url, _, config) => __awaiter(this, void 0, void 0, function* () { | ||
return yield this._request((url, _, config) => __awaiter(this, void 0, void 0, function* () { | ||
return yield axios_1.default.get(url, config); | ||
@@ -62,5 +62,5 @@ }), sub, query, undefined, config); | ||
} | ||
post(sub, query, data, config, sign_header, sign_key) { | ||
_post(sub, query, data, config, sign_header, sign_key) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.request((url, data, config) => __awaiter(this, void 0, void 0, function* () { | ||
return yield this._request((url, data, config) => __awaiter(this, void 0, void 0, function* () { | ||
return yield axios_1.default.post(url, data, config); | ||
@@ -70,5 +70,5 @@ }), sub, query, data, config, sign_header, sign_key); | ||
} | ||
put(sub, query, data, config, sign_header, sign_key) { | ||
_put(sub, query, data, config, sign_header, sign_key) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.request((url, data, config) => __awaiter(this, void 0, void 0, function* () { | ||
return yield this._request((url, data, config) => __awaiter(this, void 0, void 0, function* () { | ||
return yield axios_1.default.put(url, data, config); | ||
@@ -78,5 +78,5 @@ }), sub, query, data, config, sign_header, sign_key); | ||
} | ||
delete(sub, query, config, sign_header, sign_key) { | ||
_delete(sub, query, config, sign_header, sign_key) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return yield this.request((url, _, config) => __awaiter(this, void 0, void 0, function* () { | ||
return yield this._request((url, _, config) => __awaiter(this, void 0, void 0, function* () { | ||
return yield axios_1.default.delete(url, config); | ||
@@ -83,0 +83,0 @@ }), sub, query, undefined, config, sign_header, sign_key); |
{ | ||
"name": "namirasoft-core", | ||
"version": "1.0.1", | ||
"description": "Namira Software Corporation Base Package", | ||
"version": "1.0.2", | ||
"main": "./dist/index.js", | ||
@@ -6,0 +6,0 @@ "types": "./dist/index.d.ts", |
@@ -17,3 +17,3 @@ import axios, { AxiosRequestConfig, AxiosResponse } from "axios"; | ||
protected abstract onError(error: Error): void; | ||
private async request<ResData = any, ReqData = any>(onRequest: (url: string, data?: any, config?: AxiosRequestConfig<ReqData>) => Promise<AxiosResponse<ResData>>, sub: string, query?: { [name: string]: ParsedNameValue }, data?: ReqData, config?: AxiosRequestConfig<ReqData>, sign_header?: string, sign_key?: string): Promise<{ response: AxiosResponse<ResData>, data: ResData }> | ||
private async _request<ResData = any, ReqData = any>(onRequest: (url: string, data?: any, config?: AxiosRequestConfig<ReqData>) => Promise<AxiosResponse<ResData>>, sub: string, query?: { [name: string]: ParsedNameValue }, data?: ReqData, config?: AxiosRequestConfig<ReqData>, sign_header?: string, sign_key?: string): Promise<{ response: AxiosResponse<ResData>, data: ResData }> | ||
{ | ||
@@ -46,5 +46,5 @@ let url: string = URLOperation.getLink(this.domain, sub, query); | ||
} | ||
protected async get<ResData = any, ReqData = any>(sub: string, query?: { [name: string]: ParsedNameValue }, config?: AxiosRequestConfig<ReqData>): Promise<{ response: AxiosResponse<ResData>, data: ResData }> | ||
protected async _get<ResData = any, ReqData = any>(sub: string, query?: { [name: string]: ParsedNameValue }, config?: AxiosRequestConfig<ReqData>): Promise<{ response: AxiosResponse<ResData>, data: ResData }> | ||
{ | ||
return await this.request(async (url: string, _?: any, config?: AxiosRequestConfig<ReqData>) => | ||
return await this._request(async (url: string, _?: any, config?: AxiosRequestConfig<ReqData>) => | ||
{ | ||
@@ -54,5 +54,5 @@ return await axios.get(url, config); | ||
} | ||
protected async post<ResData = any, ReqData = any>(sub: string, query?: { [name: string]: ParsedNameValue }, data?: ReqData, config?: AxiosRequestConfig<ReqData>, sign_header?: string, sign_key?: string): Promise<{ response: AxiosResponse<ResData>, data: ResData }> | ||
protected async _post<ResData = any, ReqData = any>(sub: string, query?: { [name: string]: ParsedNameValue }, data?: ReqData, config?: AxiosRequestConfig<ReqData>, sign_header?: string, sign_key?: string): Promise<{ response: AxiosResponse<ResData>, data: ResData }> | ||
{ | ||
return await this.request(async (url: string, data: ReqData, config?: AxiosRequestConfig<ReqData>) => | ||
return await this._request(async (url: string, data: ReqData, config?: AxiosRequestConfig<ReqData>) => | ||
{ | ||
@@ -62,5 +62,5 @@ return await axios.post(url, data, config); | ||
} | ||
protected async put<ResData = any, ReqData = any>(sub: string, query?: { [name: string]: ParsedNameValue }, data?: ReqData, config?: AxiosRequestConfig<ReqData>, sign_header?: string, sign_key?: string): Promise<{ response: AxiosResponse<ResData>, data: ResData }> | ||
protected async _put<ResData = any, ReqData = any>(sub: string, query?: { [name: string]: ParsedNameValue }, data?: ReqData, config?: AxiosRequestConfig<ReqData>, sign_header?: string, sign_key?: string): Promise<{ response: AxiosResponse<ResData>, data: ResData }> | ||
{ | ||
return await this.request(async (url: string, data: ReqData, config?: AxiosRequestConfig<ReqData>) => | ||
return await this._request(async (url: string, data: ReqData, config?: AxiosRequestConfig<ReqData>) => | ||
{ | ||
@@ -70,5 +70,5 @@ return await axios.put(url, data, config); | ||
} | ||
protected async delete<ResData = any, ReqData = any>(sub: string, query?: { [name: string]: ParsedNameValue }, config?: AxiosRequestConfig<ReqData>, sign_header?: string, sign_key?: string): Promise<{ response: AxiosResponse<ResData>, data: ResData }> | ||
protected async _delete<ResData = any, ReqData = any>(sub: string, query?: { [name: string]: ParsedNameValue }, config?: AxiosRequestConfig<ReqData>, sign_header?: string, sign_key?: string): Promise<{ response: AxiosResponse<ResData>, data: ResData }> | ||
{ | ||
return await this.request(async (url: string, _?: any, config?: AxiosRequestConfig<ReqData>) => | ||
return await this._request(async (url: string, _?: any, config?: AxiosRequestConfig<ReqData>) => | ||
{ | ||
@@ -75,0 +75,0 @@ return await axios.delete(url, config); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
212369