@netresearch/node-magento-eqp 4.0.3 → 4.0.4

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.
@@ -5,18 +5,11 @@ export declare class AuthenticatedAdapter {
5
5
  protected readonly credentials: {
6
6
  appSecret: string;
7
7
  appId: string;
8
- autoRefresh?: boolean;
9
- tokenTTL?: number;
10
8
  };
11
- protected authenticated: boolean;
12
- mageId?: string;
13
9
  constructor(baseAdapter: Adapter, credentials: {
14
10
  appSecret: string;
15
11
  appId: string;
16
- autoRefresh?: boolean;
17
- tokenTTL?: number;
18
12
  });
19
- protected replaceMageIdInURL(url: string): string;
20
13
  get<T>(url: string, config?: AxiosRequestConfig): Promise<T>;
21
14
  post<T>(url: string, body: unknown, config?: AxiosRequestConfig): Promise<T>;
22
15
  put<T>(url: string, body: unknown, config?: AxiosRequestConfig): Promise<T>;
@@ -27,5 +20,7 @@ export declare class AuthenticatedAdapter {
27
20
  * @see https://developer.magento.com/account/apikeys
28
21
  * @see https://devdocs.magento.com/marketplace/eqp/v1/auth.html#session-token
29
22
  */
30
- protected authenticate(): Promise<void>;
23
+ protected authenticate(): Promise<readonly [string, {
24
+ readonly authorization: `Bearer ${string}`;
25
+ }]>;
31
26
  }
@@ -2,43 +2,41 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AuthenticatedAdapter = void 0;
4
4
  const tslib_1 = require("tslib");
5
+ const replaceMageIdInURL = (url, mageId) => url.replace(/\|MAGE_ID\|/, mageId);
6
+ const addHeaders = (config, headers) => (Object.assign(Object.assign({}, config), { headers: Object.assign(Object.assign({}, config === null || config === void 0 ? void 0 : config.headers), headers) }));
5
7
  class AuthenticatedAdapter {
6
8
  constructor(baseAdapter, credentials) {
7
9
  this.baseAdapter = baseAdapter;
8
10
  this.credentials = credentials;
9
- this.authenticated = false;
10
- }
11
- replaceMageIdInURL(url) {
12
- return url.replace(/\|MAGE_ID\|/, this.mageId);
13
11
  }
14
12
  get(url, config) {
15
13
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
16
- yield this.authenticate();
17
- return this.baseAdapter.get(this.replaceMageIdInURL(url), config);
14
+ const [mageId, headers] = yield this.authenticate();
15
+ return this.baseAdapter.get(replaceMageIdInURL(url, mageId), addHeaders(config, headers));
18
16
  });
19
17
  }
20
18
  post(url, body, config) {
21
19
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
22
- yield this.authenticate();
23
- return this.baseAdapter.post(this.replaceMageIdInURL(url), body, config);
20
+ const [mageId, headers] = yield this.authenticate();
21
+ return this.baseAdapter.post(replaceMageIdInURL(url, mageId), body, addHeaders(config, headers));
24
22
  });
25
23
  }
26
24
  put(url, body, config) {
27
25
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
28
- yield this.authenticate();
29
- return this.baseAdapter.put(this.replaceMageIdInURL(url), body, config);
26
+ const [mageId, headers] = yield this.authenticate();
27
+ return this.baseAdapter.put(replaceMageIdInURL(url, mageId), body, addHeaders(config, headers));
30
28
  });
31
29
  }
32
30
  delete(url, config) {
33
31
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
34
- yield this.authenticate();
35
- return this.baseAdapter.delete(this.replaceMageIdInURL(url), config);
32
+ const [mageId, headers] = yield this.authenticate();
33
+ return this.baseAdapter.delete(replaceMageIdInURL(url, mageId), addHeaders(config, headers));
36
34
  });
37
35
  }
38
36
  getMageId() {
39
37
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
40
- yield this.authenticate();
41
- return this.mageId;
38
+ const [mageId] = yield this.authenticate();
39
+ return mageId;
42
40
  });
43
41
  }
44
42
  /**
@@ -47,25 +45,14 @@ class AuthenticatedAdapter {
47
45
  * @see https://devdocs.magento.com/marketplace/eqp/v1/auth.html#session-token
48
46
  */
49
47
  authenticate() {
50
- var _a;
51
48
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
52
- this.mageId = undefined;
53
- const { expires_in, mage_id, ust } = yield this.baseAdapter.post('/app/session/token', { grant_type: 'session', expires_in: (_a = this.credentials.tokenTTL) !== null && _a !== void 0 ? _a : 7200 }, {
49
+ const { mage_id, ust } = yield this.baseAdapter.post('/app/session/token', { grant_type: 'session', expires_in: 360 }, {
54
50
  auth: {
55
51
  username: this.credentials.appId,
56
52
  password: this.credentials.appSecret
57
53
  }
58
54
  });
59
- this.mageId = mage_id;
60
- this.baseAdapter.setHeader('Authorization', `Bearer ${ust}`);
61
- if (this.credentials.autoRefresh) {
62
- // Re-run this function 5 seconds before the token expires
63
- setTimeout(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
64
- this.authenticated = false;
65
- yield this.authenticate();
66
- }), expires_in * 1000 - 5);
67
- }
68
- this.authenticated = true;
55
+ return [mage_id, { authorization: `Bearer ${ust}` }];
69
56
  });
70
57
  }
71
58
  }
@@ -1 +1 @@
1
- {"version":3,"file":"AuthenticatedAdapter.js","sourceRoot":"","sources":["../src/AuthenticatedAdapter.ts"],"names":[],"mappings":";;;;AAGA,MAAa,oBAAoB;IAIhC,YACoB,WAAoB,EACpB,WAKlB;QANkB,gBAAW,GAAX,WAAW,CAAS;QACpB,gBAAW,GAAX,WAAW,CAK7B;QAVQ,kBAAa,GAAG,KAAK,CAAC;IAW7B,CAAC;IAEM,kBAAkB,CAAC,GAAW;QACvC,OAAO,GAAG,CAAC,OAAO,CAAC,aAAa,EAAE,IAAI,CAAC,MAAgB,CAAC,CAAC;IAC1D,CAAC;IAEK,GAAG,CAAI,GAAW,EAAE,MAA2B;;YACpD,MAAM,IAAI,CAAC,YAAY,EAAE,CAAC;YAE1B,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;QACnE,CAAC;KAAA;IAEK,IAAI,CAAI,GAAW,EAAE,IAAa,EAAE,MAA2B;;YACpE,MAAM,IAAI,CAAC,YAAY,EAAE,CAAC;YAE1B,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CA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D,CAAC;YAEF,OAAO,CAAC,OAAO,EAAE,EAAE,aAAa,EAAE,UAAU,GAAG,EAAE,EAAE,CAAU,CAAC;QAC/D,CAAC;KAAA;CACD;AA9DD,oDA8DC"}
package/dist/index.d.ts CHANGED
@@ -18,8 +18,11 @@ export declare class EQP {
18
18
  readonly callbackService: CallbackService;
19
19
  readonly reportService: ReportService;
20
20
  readonly packageService: PackageService;
21
- /** The authenticated user's Magento ID */
22
- get mageId(): string | undefined;
21
+ /**
22
+ * Fetch the user's Mage ID
23
+ * @see https://developer.adobe.com/commerce/marketplace/guides/eqp/v1/auth/#authentication-and-authorization-flow
24
+ */
25
+ getMageId(): Promise<string>;
23
26
  constructor(options: EQPOptions);
24
27
  }
25
28
  export default EQP;
package/dist/index.js CHANGED
@@ -17,17 +17,19 @@ Object.defineProperty(exports, "AuthenticatedAdapter", { enumerable: true, get:
17
17
  tslib_1.__exportStar(require("./services"), exports);
18
18
  tslib_1.__exportStar(require("./types"), exports);
19
19
  class EQP {
20
- /** The authenticated user's Magento ID */
21
- get mageId() {
22
- return this.adapter.mageId;
20
+ /**
21
+ * Fetch the user's Mage ID
22
+ * @see https://developer.adobe.com/commerce/marketplace/guides/eqp/v1/auth/#authentication-and-authorization-flow
23
+ */
24
+ getMageId() {
25
+ return this.adapter.getMageId();
23
26
  }
24
27
  constructor(options) {
25
- var _a, _b, _c;
26
- this.adapter = new AuthenticatedAdapter_1.AuthenticatedAdapter((_a = options.adapter) !== null && _a !== void 0 ? _a : new Adapters_1.AxiosAdapter(`https://developer${((_b = options.environment) !== null && _b !== void 0 ? _b : 'production') === 'staging' ? '-stg' : ''}-api.magento.com/rest/v1`), {
28
+ var _a, _b;
29
+ (_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`), {
27
31
  appId: options.appId,
28
- appSecret: options.appSecret,
29
- autoRefresh: (_c = options.autoRefresh) !== null && _c !== void 0 ? _c : false,
30
- tokenTTL: options.expiresIn
32
+ appSecret: options.appSecret
31
33
  });
32
34
  this.fileService = new FileService_1.FileService(this.adapter);
33
35
  this.userService = new UserService_1.UserService(this.adapter);
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,0CAA0C;IAC1C,IAAI,MAAM;QACT,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;IAC5B,CAAC;IAED,YAAY,OAAmB;;QAC9B,IAAI,CAAC,OAAO,GAAG,IAAI,2CAAoB,CACtC,MAAA,OAAO,CAAC,OAAO,mCACd,IAAI,uBAAY,CAAC,oBAAoB,CAAC,MAAA,OAAO,CAAC,WAAW,mCAAI,YAAY,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,0BAA0B,CAAC,EAClI;YACC,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,WAAW,EAAE,MAAA,OAAO,CAAC,WAAW,mCAAI,KAAK;YACzC,QAAQ,EAAE,OAAO,CAAC,SAAS;SAC3B,CACD,CAAC;QAEF,IAAI,CAAC,WAAW,GAAG,IAAI,yBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACjD,IAAI,CAAC,WAAW,GAAG,IAAI,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AAC;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,5 +1,5 @@
1
1
  import { Adapter } from './adapters';
2
- export type Environment = 'staging' | 'production';
2
+ export type Environment = 'sandbox' | 'production';
3
3
  export interface EQPOptions {
4
4
  environment?: Environment;
5
5
  autoRefresh?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netresearch/node-magento-eqp",
3
- "version": "4.0.3",
3
+ "version": "4.0.4",
4
4
  "description": "Simple API wrapper around the Magento Marketplace EQP API",
5
5
  "main": "dist/index.js",
6
6
  "repository": {
@@ -8,28 +8,23 @@
8
8
  "url": "https://github.com/netresearch/node-magento-eqp.git"
9
9
  },
10
10
  "types": "dist/index.d.ts",
11
- "author": "TheDevMinerTV <tobigames200@gmail.com>",
11
+ "author": "DevMiner <devminer@devminer.xyz>",
12
12
  "license": "MIT",
13
13
  "scripts": {
14
14
  "build": "yarn build:lib && yarn build:docs",
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 tests --ext .ts",
19
- "prepack": "yarn build:lib",
20
- "test": "jest"
18
+ "lint": "eslint src --ext .ts",
19
+ "prepack": "yarn build:lib"
21
20
  },
22
21
  "devDependencies": {
23
- "@types/jest": "^29.5.3",
24
22
  "@types/node": "^8.10.66",
25
23
  "@typescript-eslint/eslint-plugin": "^6.1.0",
26
24
  "@typescript-eslint/parser": "^6.1.0",
27
- "axios-mock-adapter": "^1.21.5",
28
25
  "eslint": "^8.45.0",
29
26
  "eslint-config-prettier": "^9.0.0",
30
- "jest": "^29.6.1",
31
27
  "prettier": "^3.0.0",
32
- "ts-jest": "^29.1.1",
33
28
  "ts-node": "^10.9.1",
34
29
  "typedoc": "^0.25.0",
35
30
  "typescript": "^5.1.6"
package/jest.config.ts DELETED
@@ -1,186 +0,0 @@
1
- /*
2
- * For a detailed explanation regarding each configuration property and type check, visit:
3
- * https://jestjs.io/docs/en/configuration.html
4
- */
5
-
6
- export default {
7
- // All imported modules in your tests should be mocked automatically
8
- // automock: false,
9
-
10
- // Stop running tests after `n` failures
11
- // bail: 0,
12
-
13
- // The directory where Jest should store its cached dependency information
14
- // cacheDirectory: "/tmp/jest_rs",
15
-
16
- // Automatically clear mock calls and instances between every test
17
- // clearMocks: false,
18
-
19
- // Indicates whether the coverage information should be collected while executing the test
20
- collectCoverage: true,
21
-
22
- // An array of glob patterns indicating a set of files for which coverage information should be collected
23
- // collectCoverageFrom: undefined,
24
-
25
- // The directory where Jest should output its coverage files
26
- coverageDirectory: "coverage",
27
-
28
- // An array of regexp pattern strings used to skip coverage collection
29
- coveragePathIgnorePatterns: ["/node_modules/"],
30
-
31
- // Indicates which provider should be used to instrument code for coverage
32
- coverageProvider: "v8",
33
-
34
- // A list of reporter names that Jest uses when writing coverage reports
35
- // coverageReporters: [
36
- // "json",
37
- // "text",
38
- // "lcov",
39
- // "clover"
40
- // ],
41
-
42
- // An object that configures minimum threshold enforcement for coverage results
43
- // coverageThreshold: undefined,
44
-
45
- // A path to a custom dependency extractor
46
- // dependencyExtractor: undefined,
47
-
48
- // Make calling deprecated APIs throw helpful error messages
49
- // errorOnDeprecated: false,
50
-
51
- // Force coverage collection from ignored files using an array of glob patterns
52
- // forceCoverageMatch: [],
53
-
54
- // A path to a module which exports an async function that is triggered once before all test suites
55
- // globalSetup: undefined,
56
-
57
- // A path to a module which exports an async function that is triggered once after all test suites
58
- // globalTeardown: undefined,
59
-
60
- // A set of global variables that need to be available in all test environments
61
- // globals: {},
62
-
63
- // The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
64
- // maxWorkers: "50%",
65
-
66
- // An array of directory names to be searched recursively up from the requiring module's location
67
- moduleDirectories: ["node_modules"],
68
-
69
- // An array of file extensions your modules use
70
- moduleFileExtensions: [
71
- "js",
72
- // "json",
73
- // "jsx",
74
- "ts",
75
- // "tsx",
76
- // "node"
77
- ],
78
-
79
- // A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
80
- // moduleNameMapper: {},
81
-
82
- // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
83
- // modulePathIgnorePatterns: [],
84
-
85
- // Activates notifications for test results
86
- // notify: false,
87
-
88
- // An enum that specifies notification mode. Requires { notify: true }
89
- // notifyMode: "failure-change",
90
-
91
- // A preset that is used as a base for Jest's configuration
92
- preset: "ts-jest",
93
-
94
- // Run tests from one or more projects
95
- // projects: undefined,
96
-
97
- // Use this configuration option to add custom reporters to Jest
98
- // reporters: undefined,
99
-
100
- // Automatically reset mock state between every test
101
- // resetMocks: false,
102
-
103
- // Reset the module registry before running each individual test
104
- // resetModules: false,
105
-
106
- // A path to a custom resolver
107
- // resolver: undefined,
108
-
109
- // Automatically restore mock state between every test
110
- // restoreMocks: false,
111
-
112
- // The root directory that Jest should scan for tests and modules within
113
- // rootDir: undefined,
114
-
115
- // A list of paths to directories that Jest should use to search for files in
116
- roots: ["<rootDir>/src/", "<rootDir>/tests/"],
117
-
118
- // Allows you to use a custom runner instead of Jest's default test runner
119
- // runner: "jest-runner",
120
-
121
- // The paths to modules that run some code to configure or set up the testing environment before each test
122
- // setupFiles: [],
123
-
124
- // A list of paths to modules that run some code to configure or set up the testing framework before each test
125
- // setupFilesAfterEnv: [],
126
-
127
- // The number of seconds after which a test is considered as slow and reported as such in the results.
128
- // slowTestThreshold: 5,
129
-
130
- // A list of paths to snapshot serializer modules Jest should use for snapshot testing
131
- // snapshotSerializers: [],
132
-
133
- // The test environment that will be used for testing
134
- testEnvironment: "node",
135
-
136
- // Options that will be passed to the testEnvironment
137
- // testEnvironmentOptions: {},
138
-
139
- // Adds a location field to test results
140
- // testLocationInResults: false,
141
-
142
- // The glob patterns Jest uses to detect test files
143
- // testMatch: [
144
- // "**/__tests__/**/*.[jt]s?(x)",
145
- // "**/?(*.)+(spec|test).[tj]s?(x)"
146
- // ],
147
-
148
- // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
149
- testPathIgnorePatterns: ["/node_modules/"],
150
-
151
- // The regexp pattern or array of patterns that Jest uses to detect test files
152
- // testRegex: [],
153
-
154
- // This option allows the use of a custom results processor
155
- // testResultsProcessor: undefined,
156
-
157
- // This option allows use of a custom test runner
158
- // testRunner: "jasmine2",
159
-
160
- // This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
161
- // testURL: "http://localhost",
162
-
163
- // Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
164
- // timers: "real",
165
-
166
- // A map from regular expressions to paths to transformers
167
- // transform: undefined,
168
-
169
- // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
170
- // transformIgnorePatterns: [
171
- // "/node_modules/",
172
- // "\\.pnp\\.[^\\/]+$"
173
- // ],
174
-
175
- // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
176
- // unmockedModulePathPatterns: undefined,
177
-
178
- // Indicates whether each individual test should be reported during the run
179
- // verbose: undefined,
180
-
181
- // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
182
- // watchPathIgnorePatterns: [],
183
-
184
- // Whether to use watchman for file crawling
185
- // watchman: true,
186
- };