@netresearch/node-magento-eqp 4.0.8 → 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 CHANGED
@@ -1,86 +1,93 @@
1
- <h1 align="center">Welcome to node-magento-eqp 👋</h1>
2
- <p>
3
- <a href="https://npmjs.com/package/@netresearch/node-magento-eqp">
4
- <img alt="Version" src="https://img.shields.io/npm/v/@netresearch/node-magento-eqp?style=for-the-badge" />
5
- </a>
1
+ # @netresearch/node-magento-eqp
6
2
 
7
- <a href="https://github.com/netresearch/node-magento-eqp/blob/master/LICENSE" target="_blank">
8
- <img alt="License: MIT" src="https://img.shields.io/npm/l/@netresearch/node-magento-eqp.svg?style=for-the-badge" />
9
- </a>
3
+ [![npm version](https://img.shields.io/npm/v/@netresearch/node-magento-eqp?style=flat-square)](https://www.npmjs.com/package/@netresearch/node-magento-eqp)
4
+ [![CI](https://img.shields.io/github/actions/workflow/status/netresearch/node-magento-eqp/lint.and.build.yml?branch=main&style=flat-square&label=CI)](https://github.com/netresearch/node-magento-eqp/actions/workflows/lint.and.build.yml)
5
+ [![CodeQL](https://img.shields.io/github/actions/workflow/status/netresearch/node-magento-eqp/codeql.yml?branch=main&style=flat-square&label=CodeQL)](https://github.com/netresearch/node-magento-eqp/actions/workflows/codeql.yml)
6
+ [![License: MIT](https://img.shields.io/npm/l/@netresearch/node-magento-eqp?style=flat-square)](https://github.com/netresearch/node-magento-eqp/blob/main/LICENSE)
7
+ [![Node.js](https://img.shields.io/node/v/@netresearch/node-magento-eqp?style=flat-square)](https://nodejs.org)
8
+ [![TypeScript](https://img.shields.io/badge/TypeScript-strict-blue?style=flat-square)](https://www.typescriptlang.org/)
9
+ [![Documentation](https://img.shields.io/badge/docs-TypeDoc-green?style=flat-square)](https://netresearch.github.io/node-magento-eqp)
10
10
 
11
- <a href="https://github.com/netresearch/node-magento-eqp/actions" target="_blank">
12
- <img alt="Build status" src="https://img.shields.io/github/workflow/status/netresearch/node-magento-eqp/%F0%9F%94%8E%20Lint?style=for-the-badge" />
13
- </a>
11
+ TypeScript API wrapper for the [Adobe Commerce Marketplace EQP API](https://developer.adobe.com/commerce/marketplace/guides/eqp/v1/).
14
12
 
15
- <a href="https://netresearch.github.io/node-magento-eqp" target="_blank">
16
- <img alt="Documentation" src="https://img.shields.io/badge/Documentation-available-green.svg?style=for-the-badge">
17
- </a>
13
+ ## Installation
18
14
 
19
- <a href="https://twitter.com/netresearch" target="_blank">
20
- <img alt="Twitter: Netresearch" src="https://img.shields.io/twitter/follow/netresearch?style=for-the-badge" />
21
- </a>
22
- </p>
23
-
24
- > Simple API wrapper around the Magento Marketplace EQP API
25
-
26
- The primary focus of this package is, to provide a simple API wrapper and typings (unfinished) around the [Magento Marketplace EQP API](https://devdocs.magento.com/marketplace/eqp/v1/api.html).
15
+ ```sh
16
+ yarn add @netresearch/node-magento-eqp
17
+ ```
27
18
 
28
- ## Install
19
+ or
29
20
 
30
21
  ```sh
31
- yarn install @netresearch/node-magento-eqp
22
+ npm install @netresearch/node-magento-eqp
32
23
  ```
33
24
 
34
25
  ## Usage
35
26
 
36
- Usage in TypeScript (with ES Modules)
27
+ ### TypeScript (ES Modules)
37
28
 
38
29
  ```typescript
39
- import * as MagentoEQP from '@netresearch/node-magento-eqp';
40
-
41
- const eqp = new MagentoEQP.EQP();
42
-
43
- async function main() {
44
- await eqp.authenticate('APP_ID', 'APP_SECRET');
30
+ import { EQP } from '@netresearch/node-magento-eqp';
45
31
 
46
- const packages = await eqp.getPackages();
32
+ const eqp = new EQP({
33
+ appId: 'YOUR_APP_ID',
34
+ appSecret: 'YOUR_APP_SECRET',
35
+ environment: 'sandbox' // or 'production' (default)
36
+ });
47
37
 
48
- // Do something with the packages
49
- }
50
-
51
- main();
38
+ const packages = await eqp.packageService.getPackages();
52
39
  ```
53
40
 
54
- Usage in JavaScript (with CommonJS)
41
+ ### JavaScript (CommonJS)
55
42
 
56
- ```typescript
57
- const MagentoEQP = require('@netresearch/node-magento-eqp');
43
+ ```javascript
44
+ const { EQP } = require('@netresearch/node-magento-eqp');
58
45
 
59
- const eqp = new MagentoEQP.EQP();
46
+ (async () => {
47
+ const eqp = new EQP({
48
+ appId: 'YOUR_APP_ID',
49
+ appSecret: 'YOUR_APP_SECRET'
50
+ });
60
51
 
61
- async function main() {
62
- await eqp.authenticate('APP_ID', 'APP_SECRET');
52
+ const packages = await eqp.packageService.getPackages();
53
+ console.log(packages);
54
+ })();
55
+ ```
63
56
 
64
- const packages = await eqp.getPackages();
57
+ ### Available services
65
58
 
66
- // Do something with the packages
67
- }
59
+ | Service | Description |
60
+ | ----------------- | ------------------------------------------ |
61
+ | `packageService` | List and retrieve extension/theme packages |
62
+ | `fileService` | File upload metadata |
63
+ | `userService` | User profile management |
64
+ | `keyService` | Magento access keys (M1/M2) |
65
+ | `callbackService` | Webhook registration and event enrichment |
66
+ | `reportService` | Marketplace analytics (experimental) |
68
67
 
69
- main();
70
- ```
68
+ ### Constructor options
69
+
70
+ | Option | Type | Default | Description |
71
+ | ------------- | --------------------------- | -------------- | --------------------------- |
72
+ | `appId` | `string` | _required_ | Your EQP application ID |
73
+ | `appSecret` | `string` | _required_ | Your EQP application secret |
74
+ | `environment` | `'production' \| 'sandbox'` | `'production'` | API environment |
75
+ | `autoRefresh` | `boolean` | `false` | _Reserved for future use_ |
76
+ | `expiresIn` | `number` | `360` | _Reserved for future use_ |
77
+ | `adapter` | `Adapter` | `FetchAdapter` | Custom HTTP adapter |
71
78
 
72
- ## Author
79
+ ## API documentation
73
80
 
74
- 👤 **TheDevMinerTV <tobigames200@gmail.com>**
81
+ Full API documentation is available at [netresearch.github.io/node-magento-eqp](https://netresearch.github.io/node-magento-eqp).
75
82
 
76
- - Github: [@TheDevMinerTV](https://github.com/TheDevMinerTV)
83
+ ## Related packages
77
84
 
78
- ## 🤝 Contributing
85
+ - [`@netresearch/node-red-contrib-magento-eqp`](https://github.com/netresearch/node-red-contrib-magento-eqp) — Node-RED nodes for Magento EQP callbacks
79
86
 
80
- Contributions, issues and feature requests are welcome!<br />Feel free to check [issues page](https://github.com/netresearch/node-magento-eqp/issues). You can also take a look at the [contributing guide](https://github.com/netresearch/node-magento-eqp/blob/master/CONTRIBUTING.md).
87
+ ## Contributing
81
88
 
82
- ## Show your support
89
+ Contributions, issues, and feature requests are welcome. See the [contributing guide](CONTRIBUTING.md) for details.
83
90
 
84
- Give a ⭐️ if this project helped you!
91
+ ## License
85
92
 
86
- ---
93
+ [MIT](LICENSE) - Netresearch DTT GmbH
@@ -1,4 +1,4 @@
1
- import { AxiosRequestConfig } from 'axios';
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?: AxiosRequestConfig): Promise<T>;
14
- post<T>(url: string, body: unknown, config?: AxiosRequestConfig): Promise<T>;
15
- put<T>(url: string, body: unknown, config?: AxiosRequestConfig): Promise<T>;
16
- delete<T>(url: string, config?: AxiosRequestConfig): Promise<T>;
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,CAA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AO,CAAC,CAAC,CAAC;QAC9F,CAAC;KAAA;IAEK,SAAS;;YACd,MAAM,CAAC,MAAM,CAAC,GAAG,MAAM,IAAI,CAAC,YAAY,EAAE,CAAC;YAE3C,OAAO,MAAM,CAAC;QACf,CAAC;KAAA;IAED;;;;OAIG;IACa,YAAY;;YAC3B,MAAM,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
+ //#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AAC;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,6 @@
1
+ export declare class HttpError extends Error {
2
+ readonly status: number;
3
+ readonly statusText: string;
4
+ readonly data: unknown;
5
+ constructor(status: number, statusText: string, data: unknown);
6
+ }
@@ -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 { AxiosAdapter } from './Adapters';
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.AxiosAdapter = void 0;
3
+ exports.EQP = exports.AuthenticatedAdapter = exports.HttpError = exports.FetchAdapter = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const Adapters_1 = require("./Adapters");
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 Adapters_2 = require("./Adapters");
14
- Object.defineProperty(exports, "AxiosAdapter", { enumerable: true, get: function () { return Adapters_2.AxiosAdapter; } });
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 Adapters_1.AxiosAdapter(`https://commercedeveloper${options.environment === 'sandbox' ? '-sandbox' : ''}-api.adobe.com/rest/v1`), {
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,yCAA0C;AAC1C,iEAA8D;AAC9D,gEAA6D;AAC7D,wDAAqD;AACrD,sDAAmD;AACnD,8DAA2D;AAC3D,4DAAyD;AACzD,wDAAqD;AAGrD,uCAA0C;AAAjC,wGAAA,YAAY,OAAA;AACrB,+DAA8D;AAArD,4HAAA,oBAAoB,OAAA;AAC7B,qDAA2B;AAC3B,kDAAwB;AAExB,MAAa,GAAG;IAUf;;;OAGG;IACH,SAAS;QACR,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;IACjC,CAAC;IAED,YAAY,OAAmB;;QAC9B,MAAA,OAAO,CAAC,WAAW,oCAAnB,OAAO,CAAC,WAAW,GAAK,YAAY,EAAC;QAErC,IAAI,CAAC,OAAO,GAAG,IAAI,2CAAoB,CACtC,MAAA,OAAO,CAAC,OAAO,mCAAI,IAAI,uBAAY,CAAC,4BAA4B,OAAO,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,wBAAwB,CAAC,EAC5I;YACC,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,SAAS,EAAE,OAAO,CAAC,SAAS;SAC5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,KAAK,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,wBAAwB,CAAC,EAC5I;YACC,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,SAAS,EAAE,OAAO,CAAC,SAAS;SAC5B,CACD,CAAC;QAEF,IAAI,CAAC,WAAW,GAAG,IAAI,yBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACjD,IAAI,CAAC,WAAW,GAAG,IAAI,yBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACjD,IAAI,CAAC,UAAU,GAAG,IAAI,uBAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC/C,IAAI,CAAC,eAAe,GAAG,IAAI,iCAAe,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC/D,IAAI,CAAC,aAAa,GAAG,IAAI,6BAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACrD,IAAI,CAAC,cAAc,GAAG,IAAI,+BAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACxD,CAAC;CACD;AApCD,kBAoCC;AAED,kBAAe,GAAG,CAAC"}
@@ -1,8 +1,15 @@
1
- import { AxiosRequestConfig } from 'axios';
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?: AxiosRequestConfig): Promise<T>;
5
- post<T>(url: string, body: unknown, config?: AxiosRequestConfig): Promise<T>;
6
- put<T>(url: string, body: unknown, config?: AxiosRequestConfig): Promise<T>;
7
- delete<T>(url: string, config?: AxiosRequestConfig): Promise<T>;
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
  }
@@ -0,0 +1,18 @@
1
+ import eslint from '@eslint/js';
2
+ import tseslint from 'typescript-eslint';
3
+ import eslintConfigPrettier from 'eslint-config-prettier';
4
+
5
+ export default tseslint.config(
6
+ {
7
+ ignores: ['dist/', 'docs/', 'node_modules/'],
8
+ },
9
+ eslint.configs.recommended,
10
+ ...tseslint.configs.recommended,
11
+ eslintConfigPrettier,
12
+ {
13
+ files: ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts'],
14
+ rules: {
15
+ '@typescript-eslint/explicit-member-accessibility': ['error', { accessibility: 'no-public' }],
16
+ },
17
+ },
18
+ );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netresearch/node-magento-eqp",
3
- "version": "4.0.8",
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": {
@@ -15,24 +15,29 @@
15
15
  "build:lib": "tsc",
16
16
  "build:lib:dev": "tsc -w",
17
17
  "build:docs": "typedoc --out docs --entryPoints src/index.ts",
18
- "lint": "eslint src --ext .ts",
19
- "prepack": "yarn build:lib"
18
+ "lint": "eslint src",
19
+ "prepack": "yarn build:lib",
20
+ "prepare": "husky"
20
21
  },
21
22
  "devDependencies": {
22
- "@types/node": "^22.0.0",
23
- "@typescript-eslint/eslint-plugin": "^8.0.0",
24
- "@typescript-eslint/parser": "^8.0.0",
25
- "eslint": "^9.8.0",
23
+ "@eslint/js": "^10.0.0",
24
+ "@types/node": "^24.0.0",
25
+ "eslint": "^10.0.0",
26
26
  "eslint-config-prettier": "^10.0.0",
27
+ "husky": "^9.1.7",
28
+ "lint-staged": "^16.2.7",
27
29
  "prettier": "^3.0.0",
28
- "ts-node": "^10.9.1",
29
30
  "typedoc": "^0.28.0",
30
- "typescript": "^5.1.6"
31
+ "typescript": "^5.1.6",
32
+ "typescript-eslint": "^8.0.0"
31
33
  },
32
34
  "dependencies": {
33
- "axios": "1.12.2",
34
35
  "tslib": "^2.6.0"
35
36
  },
37
+ "lint-staged": {
38
+ "*.{ts,mts,cts,tsx}": "eslint",
39
+ "*.{ts,mts,cts,tsx,js,mjs,json,md,yml,yaml}": "prettier --write"
40
+ },
36
41
  "engines": {
37
42
  "node": ">=20"
38
43
  }
package/renovate.json CHANGED
@@ -1,6 +1,5 @@
1
1
  {
2
2
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
- "extends": [
4
- "config:base"
5
- ]
3
+ "extends": ["config:recommended", ":automergeMinor", ":automergePatch"],
4
+ "platformAutomerge": true
6
5
  }
@@ -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
@@ -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"}