@netresearch/node-magento-eqp 4.1.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/AuthenticatedAdapter.d.ts +5 -5
- package/dist/AuthenticatedAdapter.js.map +1 -1
- package/dist/FetchAdapter.d.ts +12 -0
- package/dist/FetchAdapter.js +74 -0
- package/dist/FetchAdapter.js.map +1 -0
- package/dist/HttpError.d.ts +6 -0
- package/dist/HttpError.js +14 -0
- package/dist/HttpError.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +7 -5
- package/dist/index.js.map +1 -1
- package/dist/types/adapters.d.ts +12 -5
- package/package.json +1 -2
- package/dist/Adapters.d.ts +0 -11
- package/dist/Adapters.js +0 -35
- package/dist/Adapters.js.map +0 -1
package/README.md
CHANGED
|
@@ -74,7 +74,7 @@ const { EQP } = require('@netresearch/node-magento-eqp');
|
|
|
74
74
|
| `environment` | `'production' \| 'sandbox'` | `'production'` | API environment |
|
|
75
75
|
| `autoRefresh` | `boolean` | `false` | _Reserved for future use_ |
|
|
76
76
|
| `expiresIn` | `number` | `360` | _Reserved for future use_ |
|
|
77
|
-
| `adapter` | `Adapter` | `
|
|
77
|
+
| `adapter` | `Adapter` | `FetchAdapter` | Custom HTTP adapter |
|
|
78
78
|
|
|
79
79
|
## API documentation
|
|
80
80
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RequestConfig } from './types/adapters';
|
|
2
2
|
import { Adapter } from './types/adapters';
|
|
3
3
|
export declare class AuthenticatedAdapter {
|
|
4
4
|
protected readonly baseAdapter: Adapter;
|
|
@@ -10,10 +10,10 @@ export declare class AuthenticatedAdapter {
|
|
|
10
10
|
appSecret: string;
|
|
11
11
|
appId: string;
|
|
12
12
|
});
|
|
13
|
-
get<T>(url: string, config?:
|
|
14
|
-
post<T>(url: string, body: unknown, config?:
|
|
15
|
-
put<T>(url: string, body: unknown, config?:
|
|
16
|
-
delete<T>(url: string, config?:
|
|
13
|
+
get<T>(url: string, config?: RequestConfig): Promise<T>;
|
|
14
|
+
post<T>(url: string, body: unknown, config?: RequestConfig): Promise<T>;
|
|
15
|
+
put<T>(url: string, body: unknown, config?: RequestConfig): Promise<T>;
|
|
16
|
+
delete<T>(url: string, config?: RequestConfig): Promise<T>;
|
|
17
17
|
getMageId(): Promise<string>;
|
|
18
18
|
/**
|
|
19
19
|
* Authenticate with the API. You can find the App ID and secret with the next link.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthenticatedAdapter.js","sourceRoot":"","sources":["../src/AuthenticatedAdapter.ts"],"names":[],"mappings":";;;;AAGA,MAAM,kBAAkB,GAAG,CAAC,GAAW,EAAE,MAAc,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;AAC/F,MAAM,UAAU,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"AuthenticatedAdapter.js","sourceRoot":"","sources":["../src/AuthenticatedAdapter.ts"],"names":[],"mappings":";;;;AAGA,MAAM,kBAAkB,GAAG,CAAC,GAAW,EAAE,MAAc,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;AAC/F,MAAM,UAAU,GAAG,CAAC,MAAiC,EAAE,OAA+B,EAAE,EAAE,CAAC,iCAAM,MAAM,KAAE,OAAO,kCAAO,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,OAAO,GAAK,OAAO,KAAK,CAAC;AAExJ,MAAa,oBAAoB;IAChC,YACoB,WAAoB,EACpB,WAGlB;QAJkB,gBAAW,GAAX,WAAW,CAAS;QACpB,gBAAW,GAAX,WAAW,CAG7B;IACC,CAAC;IAEE,GAAG,CAAI,GAAW,EAAE,MAAsB;;YAC/C,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,IAAI,CAAC,YAAY,EAAE,C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EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,CAKnD,oBAAoB,EACpB,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,EAAE,EAC1C;gBACC,IAAI,EAAE;oBACL,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC,KAAK;oBAChC,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC,SAAS;iBACpC;aACD,CACD,CAAC;YAEF,OAAO,CAAC,OAAO,EAAE,EAAE,aAAa,EAAE,UAAU,GAAG,EAAE,EAAE,CAAU,CAAC;QAC/D,CAAC;KAAA;CACD;AA9DD,oDA8DC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Adapter, RequestConfig } from './types/adapters';
|
|
2
|
+
export declare class FetchAdapter implements Adapter {
|
|
3
|
+
protected readonly baseURL: string;
|
|
4
|
+
protected readonly defaultHeaders: Record<string, string>;
|
|
5
|
+
constructor(baseURL: string);
|
|
6
|
+
setHeader(header: string, value: string): void;
|
|
7
|
+
get<T>(url: string, config?: RequestConfig): Promise<T>;
|
|
8
|
+
post<T>(url: string, body: unknown, config?: RequestConfig): Promise<T>;
|
|
9
|
+
put<T>(url: string, body: unknown, config?: RequestConfig): Promise<T>;
|
|
10
|
+
delete<T>(url: string, config?: RequestConfig): Promise<T>;
|
|
11
|
+
protected request<T>(method: string, path: string, body: unknown, config?: RequestConfig): Promise<T>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FetchAdapter = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const HttpError_1 = require("./HttpError");
|
|
6
|
+
class FetchAdapter {
|
|
7
|
+
constructor(baseURL) {
|
|
8
|
+
this.defaultHeaders = {};
|
|
9
|
+
this.baseURL = baseURL;
|
|
10
|
+
}
|
|
11
|
+
setHeader(header, value) {
|
|
12
|
+
this.defaultHeaders[header] = value;
|
|
13
|
+
}
|
|
14
|
+
get(url, config) {
|
|
15
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
return this.request('GET', url, undefined, config);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
post(url, body, config) {
|
|
20
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
return this.request('POST', url, body, config);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
put(url, body, config) {
|
|
25
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
return this.request('PUT', url, body, config);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
delete(url, config) {
|
|
30
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
return this.request('DELETE', url, undefined, config);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
request(method, path, body, config) {
|
|
35
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
let fullURL = this.baseURL + path;
|
|
37
|
+
if (config === null || config === void 0 ? void 0 : config.params) {
|
|
38
|
+
const params = new URLSearchParams();
|
|
39
|
+
for (const [key, value] of Object.entries(config.params)) {
|
|
40
|
+
if (value !== undefined) {
|
|
41
|
+
params.set(key, String(value));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
const qs = params.toString();
|
|
45
|
+
if (qs) {
|
|
46
|
+
fullURL += '?' + qs;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const headers = Object.assign(Object.assign({ 'content-type': 'application/json' }, this.defaultHeaders), config === null || config === void 0 ? void 0 : config.headers);
|
|
50
|
+
if (config === null || config === void 0 ? void 0 : config.auth) {
|
|
51
|
+
const encoded = Buffer.from(`${config.auth.username}:${config.auth.password}`).toString('base64');
|
|
52
|
+
headers['authorization'] = `Basic ${encoded}`;
|
|
53
|
+
}
|
|
54
|
+
const response = yield fetch(fullURL, {
|
|
55
|
+
method,
|
|
56
|
+
headers,
|
|
57
|
+
body: body !== undefined ? JSON.stringify(body) : undefined
|
|
58
|
+
});
|
|
59
|
+
if (!response.ok) {
|
|
60
|
+
let data;
|
|
61
|
+
try {
|
|
62
|
+
data = yield response.json();
|
|
63
|
+
}
|
|
64
|
+
catch (_a) {
|
|
65
|
+
data = yield response.text();
|
|
66
|
+
}
|
|
67
|
+
throw new HttpError_1.HttpError(response.status, response.statusText, data);
|
|
68
|
+
}
|
|
69
|
+
return (yield response.json());
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.FetchAdapter = FetchAdapter;
|
|
74
|
+
//# sourceMappingURL=FetchAdapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FetchAdapter.js","sourceRoot":"","sources":["../src/FetchAdapter.ts"],"names":[],"mappings":";;;;AACA,2CAAwC;AAExC,MAAa,YAAY;IAIxB,YAAY,OAAe;QAFR,mBAAc,GAA2B,EAAE,CAAC;QAG9D,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACxB,CAAC;IAED,SAAS,CAAC,MAAc,EAAE,KAAa;QACtC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC;IACrC,CAAC;IAEK,GAAG,CAAI,GAAW,EAAE,MAAsB;;YAC/C,OAAO,IAAI,CAAC,OAAO,CAAI,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;QACvD,CAAC;KAAA;IAEK,IAAI,CAAI,GAAW,EAAE,IAAa,EAAE,MAAsB;;YAC/D,OAAO,IAAI,CAAC,OAAO,CAAI,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QACnD,CAAC;KAAA;IAEK,GAAG,CAAI,GAAW,EAAE,IAAa,EAAE,MAAsB;;YAC9D,OAAO,IAAI,CAAC,OAAO,CAAI,KAAK,EAAE,GAAG,EAAE,IA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G,OAAO,CAAC,eAAe,CAAC,GAAG,SAAS,OAAO,EAAE,CAAC;YAC/C,CAAC;YAED,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,OAAO,EAAE;gBACrC,MAAM;gBACN,OAAO;gBACP,IAAI,EAAE,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS;aAC3D,CAAC,CAAC;YAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;gBAClB,IAAI,IAAa,CAAC;gBAClB,IAAI,CAAC;oBACJ,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;gBAC9B,CAAC;gBAAC,WAAM,CAAC;oBACR,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;gBAC9B,CAAC;gBACD,MAAM,IAAI,qBAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;YACjE,CAAC;YAED,OAAO,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAM,CAAC;QACrC,CAAC;KAAA;CACD;AAzED,oCAyEC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HttpError = void 0;
|
|
4
|
+
class HttpError extends Error {
|
|
5
|
+
constructor(status, statusText, data) {
|
|
6
|
+
super(`HTTP ${status}: ${statusText}`);
|
|
7
|
+
this.name = 'HttpError';
|
|
8
|
+
this.status = status;
|
|
9
|
+
this.statusText = statusText;
|
|
10
|
+
this.data = data;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.HttpError = HttpError;
|
|
14
|
+
//# sourceMappingURL=HttpError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HttpError.js","sourceRoot":"","sources":["../src/HttpError.ts"],"names":[],"mappings":";;;AAAA,MAAa,SAAU,SAAQ,KAAK;IAKnC,YAAY,MAAc,EAAE,UAAkB,EAAE,IAAa;QAC5D,KAAK,CAAC,QAAQ,MAAM,KAAK,UAAU,EAAE,CAAC,CAAC;QACvC,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IAClB,CAAC;CACD;AAZD,8BAYC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,8 @@ import { PackageService } from './services/PackageService';
|
|
|
6
6
|
import { ReportService } from './services/ReportService';
|
|
7
7
|
import { UserService } from './services/UserService';
|
|
8
8
|
import { EQPOptions } from './types/options';
|
|
9
|
-
export {
|
|
9
|
+
export { FetchAdapter } from './FetchAdapter';
|
|
10
|
+
export { HttpError } from './HttpError';
|
|
10
11
|
export { AuthenticatedAdapter } from './AuthenticatedAdapter';
|
|
11
12
|
export * from './services';
|
|
12
13
|
export * from './types';
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EQP = exports.AuthenticatedAdapter = exports.
|
|
3
|
+
exports.EQP = exports.AuthenticatedAdapter = exports.HttpError = exports.FetchAdapter = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
5
|
+
const FetchAdapter_1 = require("./FetchAdapter");
|
|
6
6
|
const AuthenticatedAdapter_1 = require("./AuthenticatedAdapter");
|
|
7
7
|
const CallbackService_1 = require("./services/CallbackService");
|
|
8
8
|
const FileService_1 = require("./services/FileService");
|
|
@@ -10,8 +10,10 @@ const KeyService_1 = require("./services/KeyService");
|
|
|
10
10
|
const PackageService_1 = require("./services/PackageService");
|
|
11
11
|
const ReportService_1 = require("./services/ReportService");
|
|
12
12
|
const UserService_1 = require("./services/UserService");
|
|
13
|
-
var
|
|
14
|
-
Object.defineProperty(exports, "
|
|
13
|
+
var FetchAdapter_2 = require("./FetchAdapter");
|
|
14
|
+
Object.defineProperty(exports, "FetchAdapter", { enumerable: true, get: function () { return FetchAdapter_2.FetchAdapter; } });
|
|
15
|
+
var HttpError_1 = require("./HttpError");
|
|
16
|
+
Object.defineProperty(exports, "HttpError", { enumerable: true, get: function () { return HttpError_1.HttpError; } });
|
|
15
17
|
var AuthenticatedAdapter_2 = require("./AuthenticatedAdapter");
|
|
16
18
|
Object.defineProperty(exports, "AuthenticatedAdapter", { enumerable: true, get: function () { return AuthenticatedAdapter_2.AuthenticatedAdapter; } });
|
|
17
19
|
tslib_1.__exportStar(require("./services"), exports);
|
|
@@ -27,7 +29,7 @@ class EQP {
|
|
|
27
29
|
constructor(options) {
|
|
28
30
|
var _a, _b;
|
|
29
31
|
(_a = options.environment) !== null && _a !== void 0 ? _a : (options.environment = 'production');
|
|
30
|
-
this.adapter = new AuthenticatedAdapter_1.AuthenticatedAdapter((_b = options.adapter) !== null && _b !== void 0 ? _b : new
|
|
32
|
+
this.adapter = new AuthenticatedAdapter_1.AuthenticatedAdapter((_b = options.adapter) !== null && _b !== void 0 ? _b : new FetchAdapter_1.FetchAdapter(`https://commercedeveloper${options.environment === 'sandbox' ? '-sandbox' : ''}-api.adobe.com/rest/v1`), {
|
|
31
33
|
appId: options.appId,
|
|
32
34
|
appSecret: options.appSecret
|
|
33
35
|
});
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,iDAA8C;AAC9C,iEAA8D;AAC9D,gEAA6D;AAC7D,wDAAqD;AACrD,sDAAmD;AACnD,8DAA2D;AAC3D,4DAAy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/adapters.d.ts
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
export interface RequestConfig {
|
|
2
|
+
auth?: {
|
|
3
|
+
username: string;
|
|
4
|
+
password: string;
|
|
5
|
+
};
|
|
6
|
+
headers?: Record<string, string>;
|
|
7
|
+
params?: Record<string, string | number | boolean | undefined>;
|
|
8
|
+
}
|
|
2
9
|
export interface Adapter {
|
|
3
10
|
setHeader(header: string, value: string): void;
|
|
4
|
-
get<T>(url: string, config?:
|
|
5
|
-
post<T>(url: string, body: unknown, config?:
|
|
6
|
-
put<T>(url: string, body: unknown, config?:
|
|
7
|
-
delete<T>(url: string, config?:
|
|
11
|
+
get<T>(url: string, config?: RequestConfig): Promise<T>;
|
|
12
|
+
post<T>(url: string, body: unknown, config?: RequestConfig): Promise<T>;
|
|
13
|
+
put<T>(url: string, body: unknown, config?: RequestConfig): Promise<T>;
|
|
14
|
+
delete<T>(url: string, config?: RequestConfig): Promise<T>;
|
|
8
15
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netresearch/node-magento-eqp",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "Simple API wrapper around the Magento Marketplace EQP API",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"repository": {
|
|
@@ -32,7 +32,6 @@
|
|
|
32
32
|
"typescript-eslint": "^8.0.0"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"axios": "1.13.5",
|
|
36
35
|
"tslib": "^2.6.0"
|
|
37
36
|
},
|
|
38
37
|
"lint-staged": {
|
package/dist/Adapters.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { AxiosInstance, AxiosRequestConfig } from 'axios';
|
|
2
|
-
import { Adapter } from './types/adapters';
|
|
3
|
-
export declare class AxiosAdapter implements Adapter {
|
|
4
|
-
protected readonly client: AxiosInstance;
|
|
5
|
-
constructor(baseURL: string);
|
|
6
|
-
setHeader(header: string, value: string): void;
|
|
7
|
-
get<T>(url: string, config?: AxiosRequestConfig): Promise<T>;
|
|
8
|
-
post<T>(url: string, body: unknown, config?: AxiosRequestConfig): Promise<T>;
|
|
9
|
-
put<T>(url: string, body: unknown, config?: AxiosRequestConfig): Promise<T>;
|
|
10
|
-
delete<T>(url: string, config?: AxiosRequestConfig): Promise<T>;
|
|
11
|
-
}
|
package/dist/Adapters.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AxiosAdapter = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const axios_1 = tslib_1.__importDefault(require("axios"));
|
|
6
|
-
class AxiosAdapter {
|
|
7
|
-
constructor(baseURL) {
|
|
8
|
-
this.client = axios_1.default.create({ baseURL });
|
|
9
|
-
}
|
|
10
|
-
setHeader(header, value) {
|
|
11
|
-
this.client.defaults.headers.common[header] = value;
|
|
12
|
-
}
|
|
13
|
-
get(url, config) {
|
|
14
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
15
|
-
return (yield this.client.get(url, config)).data;
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
post(url, body, config) {
|
|
19
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
return (yield this.client.post(url, body, config)).data;
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
put(url, body, config) {
|
|
24
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
return (yield this.client.put(url, body, config)).data;
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
delete(url, config) {
|
|
29
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
30
|
-
return (yield this.client.delete(url, config)).data;
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
exports.AxiosAdapter = AxiosAdapter;
|
|
35
|
-
//# sourceMappingURL=Adapters.js.map
|
package/dist/Adapters.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Adapters.js","sourceRoot":"","sources":["../src/Adapters.ts"],"names":[],"mappings":";;;;AAAA,0DAAiE;AAGjE,MAAa,YAAY;IAGxB,YAAY,OAAe;QAC1B,IAAI,CAAC,MAAM,GAAG,eAAK,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;IACzC,CAAC;IAED,SAAS,CAAC,MAAc,EAAE,KAAa;QACtC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC;IACrD,CAAC;IAEK,GAAG,CAAI,GAAW,EAAE,MAA2B;;YACpD,OAAO,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;QAClD,CAAC;KAAA;IAEK,IAAI,CAAI,GAAW,EAAE,IAAa,EAAE,MAA2B;;YACpE,OAAO,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;QACzD,CAAC;KAAA;IAEK,GAAG,CAAI,GAAW,EAAE,IAAa,EAAE,MAA2B;;YACnE,OAAO,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;QACxD,CAAC;KAAA;IAEK,MAAM,CAAI,GAAW,EAAE,MAA2B;;YACvD,OAAO,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;QACrD,CAAC;KAAA;CACD;AA1BD,oCA0BC"}
|