@dataggo/node-akeneo-api 1.0.4 → 1.0.6
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/dist/cjs/endpoints/index.js +5 -1
- package/dist/cjs/endpoints/raw.d.ts +2 -2
- package/dist/cjs/endpoints/raw.js +5 -1
- package/dist/cjs/error-handler.js +5 -1
- package/dist/cjs/http-client.js +5 -3
- package/dist/cjs/index.d.ts +28 -28
- package/dist/cjs/index.js +7 -3
- package/dist/cjs/types.d.ts +29 -29
- package/dist/mjs/endpoints/raw.d.ts +2 -2
- package/dist/mjs/error-handler.js +4 -0
- package/dist/mjs/http-client.js +5 -3
- package/dist/mjs/index.d.ts +28 -28
- package/dist/mjs/types.d.ts +29 -29
- package/package.json +6 -6
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -4,8 +4,8 @@ declare const _default: {
|
|
|
4
4
|
get: (http: AxiosInstance, url: string, config: AxiosRequestConfig) => Promise<ListResponse<any> & {
|
|
5
5
|
_links: any;
|
|
6
6
|
}>;
|
|
7
|
-
getOne: (http: AxiosInstance, url: string, config?: AxiosRequestConfig
|
|
7
|
+
getOne: (http: AxiosInstance, url: string, config?: AxiosRequestConfig) => Promise<any>;
|
|
8
8
|
getAllByPage: (http: AxiosInstance, url: string, { params }: AxiosRequestConfig) => Promise<ListResponse<any>>;
|
|
9
|
-
getAllBySearchAfter: (http: AxiosInstance, url: string, config?: AxiosRequestConfig
|
|
9
|
+
getAllBySearchAfter: (http: AxiosInstance, url: string, config?: AxiosRequestConfig) => Promise<ListResponse<any>>;
|
|
10
10
|
};
|
|
11
11
|
export default _default;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -8,7 +8,11 @@ function errorHandler({ config, response }) {
|
|
|
8
8
|
const errorData = {
|
|
9
9
|
status: response === null || response === void 0 ? void 0 : response.status,
|
|
10
10
|
statusText: response === null || response === void 0 ? void 0 : response.statusText,
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
12
|
+
// @ts-ignore
|
|
11
13
|
message: data && 'message' in data ? data.message : '',
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
15
|
+
// @ts-ignore
|
|
12
16
|
details: data && 'details' in data ? data.details : {},
|
|
13
17
|
request: config
|
|
14
18
|
? {
|
|
@@ -25,7 +29,7 @@ function errorHandler({ config, response }) {
|
|
|
25
29
|
error.message = JSON.stringify(errorData, null, ' ');
|
|
26
30
|
}
|
|
27
31
|
catch (_a) {
|
|
28
|
-
error.message = ramda_1.path(['message'], errorData) || '';
|
|
32
|
+
error.message = (0, ramda_1.path)(['message'], errorData) || '';
|
|
29
33
|
}
|
|
30
34
|
throw error;
|
|
31
35
|
}
|
package/dist/cjs/http-client.js
CHANGED
|
@@ -14,7 +14,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.createAppHttpClient = exports.createConnectionHttpClient = void 0;
|
|
16
16
|
/* eslint-disable no-underscore-dangle */
|
|
17
|
-
const qs_1 = __importDefault(require("qs"));
|
|
18
17
|
const axios_1 = __importDefault(require("axios"));
|
|
19
18
|
const TOKEN_PATH = '/api/oauth/v1/token';
|
|
20
19
|
const defaultConfig = {
|
|
@@ -27,8 +26,7 @@ const defaultConfig = {
|
|
|
27
26
|
proxy: false,
|
|
28
27
|
basePath: '',
|
|
29
28
|
adapter: undefined,
|
|
30
|
-
maxContentLength: 1073741824,
|
|
31
|
-
paramsSerializer: qs_1.default.stringify,
|
|
29
|
+
maxContentLength: 1073741824, // 1GB
|
|
32
30
|
};
|
|
33
31
|
/**
|
|
34
32
|
* Create pre-configured axios instance
|
|
@@ -51,6 +49,8 @@ const createConnectionHttpClient = (options) => {
|
|
|
51
49
|
accessToken = tokenResult.data.access_token;
|
|
52
50
|
return accessToken;
|
|
53
51
|
});
|
|
52
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
53
|
+
// @ts-ignore
|
|
54
54
|
instance.interceptors.request.use((config) => __awaiter(void 0, void 0, void 0, function* () {
|
|
55
55
|
return (Object.assign(Object.assign({}, config), { headers: Object.assign(Object.assign({}, config.headers), { Authorization: `Bearer ${accessToken || (yield refreshAccessToken())}` }) }));
|
|
56
56
|
}));
|
|
@@ -79,6 +79,8 @@ const createAppHttpClient = (options) => {
|
|
|
79
79
|
const { url, accessToken } = options;
|
|
80
80
|
const baseURL = url.replace(/\/+$/, '');
|
|
81
81
|
const instance = axios_1.default.create(Object.assign(Object.assign(Object.assign({}, defaultConfig), (options.axiosOptions || {})), { baseURL }));
|
|
82
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
83
|
+
// @ts-ignore
|
|
82
84
|
instance.interceptors.request.use((config) => __awaiter(void 0, void 0, void 0, function* () {
|
|
83
85
|
return (Object.assign(Object.assign({}, config), { headers: Object.assign(Object.assign({}, config.headers), { Authorization: `Bearer ${accessToken}` }) }));
|
|
84
86
|
}));
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -15,13 +15,13 @@ declare const getHttpClientWithEndpoint: (http: AxiosInstance) => {
|
|
|
15
15
|
with_attribute_options?: boolean | undefined;
|
|
16
16
|
with_quality_scores?: boolean | undefined;
|
|
17
17
|
} | undefined;
|
|
18
|
-
}) => Promise<import("./types").Category<
|
|
18
|
+
}) => Promise<import("./types").Category<import("./types").KeyValueMap>>;
|
|
19
19
|
get: (params: {
|
|
20
20
|
query?: import("./types").CategoryQueryParameters | undefined;
|
|
21
|
-
}) => Promise<import("./types").ListResponse<import("./types").Category<
|
|
21
|
+
}) => Promise<import("./types").ListResponse<import("./types").Category<import("./types").KeyValueMap>>>;
|
|
22
22
|
getAll: (params: {
|
|
23
23
|
query?: import("./types").CategoryQueryParameters | undefined;
|
|
24
|
-
}) => Promise<import("./types").ListResponse<import("./types").Category<
|
|
24
|
+
}) => Promise<import("./types").ListResponse<import("./types").Category<import("./types").KeyValueMap>>>;
|
|
25
25
|
};
|
|
26
26
|
productModel: {
|
|
27
27
|
getOne: (params: {
|
|
@@ -81,7 +81,7 @@ declare const getHttpClientWithEndpoint: (http: AxiosInstance) => {
|
|
|
81
81
|
*
|
|
82
82
|
* @see https://api.akeneo.com/api-reference.html#get_asset_media_files__code
|
|
83
83
|
*/
|
|
84
|
-
get: (code: string) => Promise<import("axios").AxiosResponse<any>>;
|
|
84
|
+
get: (code: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
85
85
|
};
|
|
86
86
|
referenceEntitiesMediaFile: {
|
|
87
87
|
/**
|
|
@@ -106,12 +106,12 @@ declare const getHttpClientWithEndpoint: (http: AxiosInstance) => {
|
|
|
106
106
|
add: ({ code, attribute }: {
|
|
107
107
|
code: string;
|
|
108
108
|
attribute: any;
|
|
109
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
109
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
110
110
|
addOption: ({ attributeCode, code, option, }: {
|
|
111
111
|
attributeCode: string;
|
|
112
112
|
code: string;
|
|
113
113
|
option: any;
|
|
114
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
114
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
115
115
|
};
|
|
116
116
|
referenceEntity: {
|
|
117
117
|
get: (params: {
|
|
@@ -126,7 +126,7 @@ declare const getHttpClientWithEndpoint: (http: AxiosInstance) => {
|
|
|
126
126
|
*/ add: ({ code, body }: {
|
|
127
127
|
code: string;
|
|
128
128
|
body: any;
|
|
129
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
129
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
130
130
|
/**
|
|
131
131
|
* @see https://api.akeneo.com/api-reference.html#patch_reference_entity_attributes__code_
|
|
132
132
|
*/
|
|
@@ -143,14 +143,14 @@ declare const getHttpClientWithEndpoint: (http: AxiosInstance) => {
|
|
|
143
143
|
attributeCode: string;
|
|
144
144
|
code: string;
|
|
145
145
|
option: any;
|
|
146
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
146
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
147
147
|
/**
|
|
148
148
|
* @see https://api.akeneo.com/api-reference.html#patch_reference_entity_records
|
|
149
149
|
*/
|
|
150
150
|
addRecords: ({ referenceEntityCode, records, }: {
|
|
151
151
|
referenceEntityCode: string;
|
|
152
152
|
records: any[];
|
|
153
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
153
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
154
154
|
};
|
|
155
155
|
family: {
|
|
156
156
|
get: (params: {
|
|
@@ -187,13 +187,13 @@ export declare const createClient: (params: ClientParams) => {
|
|
|
187
187
|
with_attribute_options?: boolean | undefined;
|
|
188
188
|
with_quality_scores?: boolean | undefined;
|
|
189
189
|
} | undefined;
|
|
190
|
-
}) => Promise<import("./types").Category<
|
|
190
|
+
}) => Promise<import("./types").Category<import("./types").KeyValueMap>>;
|
|
191
191
|
get: (params: {
|
|
192
192
|
query?: import("./types").CategoryQueryParameters | undefined;
|
|
193
|
-
}) => Promise<import("./types").ListResponse<import("./types").Category<
|
|
193
|
+
}) => Promise<import("./types").ListResponse<import("./types").Category<import("./types").KeyValueMap>>>;
|
|
194
194
|
getAll: (params: {
|
|
195
195
|
query?: import("./types").CategoryQueryParameters | undefined;
|
|
196
|
-
}) => Promise<import("./types").ListResponse<import("./types").Category<
|
|
196
|
+
}) => Promise<import("./types").ListResponse<import("./types").Category<import("./types").KeyValueMap>>>;
|
|
197
197
|
};
|
|
198
198
|
productModel: {
|
|
199
199
|
getOne: (params: {
|
|
@@ -253,7 +253,7 @@ export declare const createClient: (params: ClientParams) => {
|
|
|
253
253
|
*
|
|
254
254
|
* @see https://api.akeneo.com/api-reference.html#get_asset_media_files__code
|
|
255
255
|
*/
|
|
256
|
-
get: (code: string) => Promise<import("axios").AxiosResponse<any>>;
|
|
256
|
+
get: (code: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
257
257
|
};
|
|
258
258
|
referenceEntitiesMediaFile: {
|
|
259
259
|
/**
|
|
@@ -278,12 +278,12 @@ export declare const createClient: (params: ClientParams) => {
|
|
|
278
278
|
add: ({ code, attribute }: {
|
|
279
279
|
code: string;
|
|
280
280
|
attribute: any;
|
|
281
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
281
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
282
282
|
addOption: ({ attributeCode, code, option, }: {
|
|
283
283
|
attributeCode: string;
|
|
284
284
|
code: string;
|
|
285
285
|
option: any;
|
|
286
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
286
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
287
287
|
};
|
|
288
288
|
referenceEntity: {
|
|
289
289
|
get: (params: {
|
|
@@ -298,7 +298,7 @@ export declare const createClient: (params: ClientParams) => {
|
|
|
298
298
|
*/ add: ({ code, body }: {
|
|
299
299
|
code: string;
|
|
300
300
|
body: any;
|
|
301
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
301
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
302
302
|
/**
|
|
303
303
|
* @see https://api.akeneo.com/api-reference.html#patch_reference_entity_attributes__code_
|
|
304
304
|
*/
|
|
@@ -315,14 +315,14 @@ export declare const createClient: (params: ClientParams) => {
|
|
|
315
315
|
attributeCode: string;
|
|
316
316
|
code: string;
|
|
317
317
|
option: any;
|
|
318
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
318
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
319
319
|
/**
|
|
320
320
|
* @see https://api.akeneo.com/api-reference.html#patch_reference_entity_records
|
|
321
321
|
*/
|
|
322
322
|
addRecords: ({ referenceEntityCode, records, }: {
|
|
323
323
|
referenceEntityCode: string;
|
|
324
324
|
records: any[];
|
|
325
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
325
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
326
326
|
};
|
|
327
327
|
family: {
|
|
328
328
|
get: (params: {
|
|
@@ -356,13 +356,13 @@ export declare const createAppClient: (params: AppParams) => {
|
|
|
356
356
|
with_attribute_options?: boolean | undefined;
|
|
357
357
|
with_quality_scores?: boolean | undefined;
|
|
358
358
|
} | undefined;
|
|
359
|
-
}) => Promise<import("./types").Category<
|
|
359
|
+
}) => Promise<import("./types").Category<import("./types").KeyValueMap>>;
|
|
360
360
|
get: (params: {
|
|
361
361
|
query?: import("./types").CategoryQueryParameters | undefined;
|
|
362
|
-
}) => Promise<import("./types").ListResponse<import("./types").Category<
|
|
362
|
+
}) => Promise<import("./types").ListResponse<import("./types").Category<import("./types").KeyValueMap>>>;
|
|
363
363
|
getAll: (params: {
|
|
364
364
|
query?: import("./types").CategoryQueryParameters | undefined;
|
|
365
|
-
}) => Promise<import("./types").ListResponse<import("./types").Category<
|
|
365
|
+
}) => Promise<import("./types").ListResponse<import("./types").Category<import("./types").KeyValueMap>>>;
|
|
366
366
|
};
|
|
367
367
|
productModel: {
|
|
368
368
|
getOne: (params: {
|
|
@@ -422,7 +422,7 @@ export declare const createAppClient: (params: AppParams) => {
|
|
|
422
422
|
*
|
|
423
423
|
* @see https://api.akeneo.com/api-reference.html#get_asset_media_files__code
|
|
424
424
|
*/
|
|
425
|
-
get: (code: string) => Promise<import("axios").AxiosResponse<any>>;
|
|
425
|
+
get: (code: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
426
426
|
};
|
|
427
427
|
referenceEntitiesMediaFile: {
|
|
428
428
|
/**
|
|
@@ -447,12 +447,12 @@ export declare const createAppClient: (params: AppParams) => {
|
|
|
447
447
|
add: ({ code, attribute }: {
|
|
448
448
|
code: string;
|
|
449
449
|
attribute: any;
|
|
450
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
450
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
451
451
|
addOption: ({ attributeCode, code, option, }: {
|
|
452
452
|
attributeCode: string;
|
|
453
453
|
code: string;
|
|
454
454
|
option: any;
|
|
455
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
455
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
456
456
|
};
|
|
457
457
|
referenceEntity: {
|
|
458
458
|
get: (params: {
|
|
@@ -467,7 +467,7 @@ export declare const createAppClient: (params: AppParams) => {
|
|
|
467
467
|
*/ add: ({ code, body }: {
|
|
468
468
|
code: string;
|
|
469
469
|
body: any;
|
|
470
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
470
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
471
471
|
/**
|
|
472
472
|
* @see https://api.akeneo.com/api-reference.html#patch_reference_entity_attributes__code_
|
|
473
473
|
*/
|
|
@@ -484,14 +484,14 @@ export declare const createAppClient: (params: AppParams) => {
|
|
|
484
484
|
attributeCode: string;
|
|
485
485
|
code: string;
|
|
486
486
|
option: any;
|
|
487
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
487
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
488
488
|
/**
|
|
489
489
|
* @see https://api.akeneo.com/api-reference.html#patch_reference_entity_records
|
|
490
490
|
*/
|
|
491
491
|
addRecords: ({ referenceEntityCode, records, }: {
|
|
492
492
|
referenceEntityCode: string;
|
|
493
493
|
records: any[];
|
|
494
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
494
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
495
495
|
};
|
|
496
496
|
family: {
|
|
497
497
|
get: (params: {
|
|
@@ -503,5 +503,5 @@ export declare const createAppClient: (params: AppParams) => {
|
|
|
503
503
|
}) => Promise<import("./types").ListResponse<import("./types").Variant>>;
|
|
504
504
|
};
|
|
505
505
|
};
|
|
506
|
-
export
|
|
506
|
+
export type AkeneoClientAPI = ReturnType<typeof getHttpClientWithEndpoint>;
|
|
507
507
|
export * from './types';
|
package/dist/cjs/index.js
CHANGED
|
@@ -5,7 +5,11 @@
|
|
|
5
5
|
*/
|
|
6
6
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
7
|
if (k2 === undefined) k2 = k;
|
|
8
|
-
Object.
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
9
13
|
}) : (function(o, m, k, k2) {
|
|
10
14
|
if (k2 === undefined) k2 = k;
|
|
11
15
|
o[k2] = m[k];
|
|
@@ -143,7 +147,7 @@ const getHttpClientWithEndpoint = (http) => ({
|
|
|
143
147
|
* ```
|
|
144
148
|
*/
|
|
145
149
|
const createClient = (params) => {
|
|
146
|
-
const http = http_client_1.createConnectionHttpClient(params);
|
|
150
|
+
const http = (0, http_client_1.createConnectionHttpClient)(params);
|
|
147
151
|
return getHttpClientWithEndpoint(http);
|
|
148
152
|
};
|
|
149
153
|
exports.createClient = createClient;
|
|
@@ -159,7 +163,7 @@ exports.createClient = createClient;
|
|
|
159
163
|
* ```
|
|
160
164
|
*/
|
|
161
165
|
const createAppClient = (params) => {
|
|
162
|
-
const http = http_client_1.createAppHttpClient(params);
|
|
166
|
+
const http = (0, http_client_1.createAppHttpClient)(params);
|
|
163
167
|
return getHttpClientWithEndpoint(http);
|
|
164
168
|
};
|
|
165
169
|
exports.createAppClient = createAppClient;
|
package/dist/cjs/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxiosRequestConfig } from 'axios';
|
|
2
|
-
export
|
|
2
|
+
export type AppParams = {
|
|
3
3
|
/**
|
|
4
4
|
* API host
|
|
5
5
|
*/
|
|
@@ -13,7 +13,7 @@ export declare type AppParams = {
|
|
|
13
13
|
*/
|
|
14
14
|
axiosOptions?: AxiosRequestConfig;
|
|
15
15
|
};
|
|
16
|
-
export
|
|
16
|
+
export type ClientParams = {
|
|
17
17
|
/**
|
|
18
18
|
* API host
|
|
19
19
|
*/
|
|
@@ -39,8 +39,8 @@ export declare type ClientParams = {
|
|
|
39
39
|
*/
|
|
40
40
|
axiosOptions?: AxiosRequestConfig;
|
|
41
41
|
};
|
|
42
|
-
export
|
|
43
|
-
export
|
|
42
|
+
export type PaginationType = 'page' | 'search_after';
|
|
43
|
+
export type ProductModelQueryParameters = {
|
|
44
44
|
search?: string;
|
|
45
45
|
scope?: string;
|
|
46
46
|
locales?: string;
|
|
@@ -51,7 +51,7 @@ export declare type ProductModelQueryParameters = {
|
|
|
51
51
|
limit?: number;
|
|
52
52
|
with_count?: boolean;
|
|
53
53
|
};
|
|
54
|
-
export
|
|
54
|
+
export type ProductQueryParameters = {
|
|
55
55
|
search?: string;
|
|
56
56
|
scope?: string;
|
|
57
57
|
locales?: string;
|
|
@@ -64,63 +64,63 @@ export declare type ProductQueryParameters = {
|
|
|
64
64
|
with_attribute_options?: boolean;
|
|
65
65
|
with_quality_scores?: boolean;
|
|
66
66
|
};
|
|
67
|
-
export
|
|
67
|
+
export type CategoryQueryParameters = {
|
|
68
68
|
search?: string;
|
|
69
69
|
page?: number;
|
|
70
70
|
limit?: number;
|
|
71
71
|
with_count?: boolean;
|
|
72
72
|
};
|
|
73
|
-
export
|
|
73
|
+
export type AttributeQueryParameters = {
|
|
74
74
|
search?: string;
|
|
75
75
|
page?: number;
|
|
76
76
|
limit?: number;
|
|
77
77
|
with_count?: boolean;
|
|
78
78
|
};
|
|
79
|
-
export
|
|
79
|
+
export type AttributeOptionQueryParameters = {
|
|
80
80
|
page?: number;
|
|
81
81
|
limit?: number;
|
|
82
82
|
with_count?: boolean;
|
|
83
83
|
};
|
|
84
|
-
export
|
|
84
|
+
export type ReferenceEntityQueryParameters = {
|
|
85
85
|
search?: string;
|
|
86
86
|
page?: number;
|
|
87
87
|
limit?: number;
|
|
88
88
|
with_count?: boolean;
|
|
89
89
|
};
|
|
90
|
-
export
|
|
90
|
+
export type FamilyQueryParameters = {
|
|
91
91
|
search?: string;
|
|
92
92
|
page?: number;
|
|
93
93
|
limit?: number;
|
|
94
94
|
with_count?: boolean;
|
|
95
95
|
};
|
|
96
|
-
export
|
|
96
|
+
export type FamilyVariantQueryParameters = {
|
|
97
97
|
page?: number;
|
|
98
98
|
limit?: number;
|
|
99
99
|
with_count?: boolean;
|
|
100
100
|
};
|
|
101
|
-
export
|
|
101
|
+
export type ReferenceEntityRecordQueryParameters = {
|
|
102
102
|
search_after?: string;
|
|
103
103
|
};
|
|
104
|
-
export
|
|
104
|
+
export type AssetFamilyQueryParameters = {
|
|
105
105
|
search_after?: string;
|
|
106
106
|
};
|
|
107
|
-
export
|
|
107
|
+
export type AssetQueryParameters = {
|
|
108
108
|
search?: string;
|
|
109
109
|
channel?: string;
|
|
110
110
|
locales?: string;
|
|
111
111
|
search_after?: string;
|
|
112
112
|
};
|
|
113
|
-
export
|
|
113
|
+
export type ListResponse<T> = {
|
|
114
114
|
items_count?: number;
|
|
115
115
|
current_page?: number;
|
|
116
116
|
items: T[];
|
|
117
117
|
};
|
|
118
|
-
|
|
118
|
+
type Association = {
|
|
119
119
|
products: string[];
|
|
120
120
|
product_models: string[];
|
|
121
121
|
groups: string[];
|
|
122
122
|
};
|
|
123
|
-
export
|
|
123
|
+
export type ProductModel = {
|
|
124
124
|
code: string;
|
|
125
125
|
family: string;
|
|
126
126
|
family_variant: string;
|
|
@@ -133,7 +133,7 @@ export declare type ProductModel = {
|
|
|
133
133
|
quantified_associations: Record<string, Association>;
|
|
134
134
|
metadata: Record<string, any>;
|
|
135
135
|
};
|
|
136
|
-
export
|
|
136
|
+
export type Product = {
|
|
137
137
|
identifier: string;
|
|
138
138
|
uuid?: string;
|
|
139
139
|
enabled: boolean;
|
|
@@ -148,7 +148,7 @@ export declare type Product = {
|
|
|
148
148
|
quantified_associations: Record<string, Association>;
|
|
149
149
|
metadata: Record<string, any>;
|
|
150
150
|
};
|
|
151
|
-
export
|
|
151
|
+
export type Family = {
|
|
152
152
|
code: string;
|
|
153
153
|
attribute_as_label: string;
|
|
154
154
|
attribute_as_image: string;
|
|
@@ -156,17 +156,17 @@ export declare type Family = {
|
|
|
156
156
|
attribute_requirements: Record<string, any>;
|
|
157
157
|
labels: Record<string, any>;
|
|
158
158
|
};
|
|
159
|
-
|
|
159
|
+
type VariantAttributeSet = {
|
|
160
160
|
level: number;
|
|
161
161
|
attributes: string[];
|
|
162
162
|
axes: string[];
|
|
163
163
|
};
|
|
164
|
-
export
|
|
164
|
+
export type Variant = {
|
|
165
165
|
code: string;
|
|
166
166
|
variant_attribute_sets: VariantAttributeSet[];
|
|
167
167
|
labels: Record<string, any>;
|
|
168
168
|
};
|
|
169
|
-
export
|
|
169
|
+
export type Attribute = {
|
|
170
170
|
code: string;
|
|
171
171
|
type: string;
|
|
172
172
|
labels: Record<string, string>;
|
|
@@ -195,32 +195,32 @@ export declare type Attribute = {
|
|
|
195
195
|
reference_data_name: string;
|
|
196
196
|
default_value: boolean;
|
|
197
197
|
};
|
|
198
|
-
export
|
|
198
|
+
export type AttributeOption = {
|
|
199
199
|
code: string;
|
|
200
200
|
attribute: string;
|
|
201
201
|
sort_order: number;
|
|
202
202
|
labels: Record<string, string>;
|
|
203
203
|
};
|
|
204
|
-
|
|
204
|
+
type ValuesRecord = {
|
|
205
205
|
locale: string;
|
|
206
206
|
channel: string;
|
|
207
207
|
data: string | string[];
|
|
208
208
|
};
|
|
209
209
|
export declare type KeyValueMap = Record<string, any>;
|
|
210
|
-
export
|
|
210
|
+
export type Entity = {
|
|
211
211
|
code: string;
|
|
212
212
|
labels: KeyValueMap;
|
|
213
213
|
};
|
|
214
|
-
export
|
|
214
|
+
export type EntityRecord = {
|
|
215
215
|
code: string;
|
|
216
216
|
values: Record<string, ValuesRecord[]>;
|
|
217
217
|
};
|
|
218
|
-
export
|
|
218
|
+
export type Category<T = KeyValueMap> = {
|
|
219
219
|
code: string;
|
|
220
220
|
parent?: string;
|
|
221
221
|
labels: T;
|
|
222
222
|
};
|
|
223
|
-
export
|
|
223
|
+
export type AssetFamily = {
|
|
224
224
|
code: string;
|
|
225
225
|
labels: Record<string, string>;
|
|
226
226
|
attribute_as_main_media: string;
|
|
@@ -236,7 +236,7 @@ export declare type AssetFamily = {
|
|
|
236
236
|
abort_asset_creation_on_error: boolean;
|
|
237
237
|
};
|
|
238
238
|
};
|
|
239
|
-
export
|
|
239
|
+
export type Asset = {
|
|
240
240
|
code: string;
|
|
241
241
|
values: Record<string, ValuesRecord[]>;
|
|
242
242
|
};
|
|
@@ -4,8 +4,8 @@ declare const _default: {
|
|
|
4
4
|
get: (http: AxiosInstance, url: string, config: AxiosRequestConfig) => Promise<ListResponse<any> & {
|
|
5
5
|
_links: any;
|
|
6
6
|
}>;
|
|
7
|
-
getOne: (http: AxiosInstance, url: string, config?: AxiosRequestConfig
|
|
7
|
+
getOne: (http: AxiosInstance, url: string, config?: AxiosRequestConfig) => Promise<any>;
|
|
8
8
|
getAllByPage: (http: AxiosInstance, url: string, { params }: AxiosRequestConfig) => Promise<ListResponse<any>>;
|
|
9
|
-
getAllBySearchAfter: (http: AxiosInstance, url: string, config?: AxiosRequestConfig
|
|
9
|
+
getAllBySearchAfter: (http: AxiosInstance, url: string, config?: AxiosRequestConfig) => Promise<ListResponse<any>>;
|
|
10
10
|
};
|
|
11
11
|
export default _default;
|
|
@@ -10,7 +10,11 @@ export default function errorHandler({ config, response }) {
|
|
|
10
10
|
const errorData = {
|
|
11
11
|
status: response?.status,
|
|
12
12
|
statusText: response?.statusText,
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
14
|
+
// @ts-ignore
|
|
13
15
|
message: data && 'message' in data ? data.message : '',
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
17
|
+
// @ts-ignore
|
|
14
18
|
details: data && 'details' in data ? data.details : {},
|
|
15
19
|
request: config
|
|
16
20
|
? {
|
package/dist/mjs/http-client.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/* eslint-disable no-underscore-dangle */
|
|
2
|
-
import qs from 'qs';
|
|
3
2
|
import axios from 'axios';
|
|
4
3
|
const TOKEN_PATH = '/api/oauth/v1/token';
|
|
5
4
|
const defaultConfig = {
|
|
@@ -12,8 +11,7 @@ const defaultConfig = {
|
|
|
12
11
|
proxy: false,
|
|
13
12
|
basePath: '',
|
|
14
13
|
adapter: undefined,
|
|
15
|
-
maxContentLength: 1073741824,
|
|
16
|
-
paramsSerializer: qs.stringify,
|
|
14
|
+
maxContentLength: 1073741824, // 1GB
|
|
17
15
|
};
|
|
18
16
|
/**
|
|
19
17
|
* Create pre-configured axios instance
|
|
@@ -40,6 +38,8 @@ export const createConnectionHttpClient = (options) => {
|
|
|
40
38
|
accessToken = tokenResult.data.access_token;
|
|
41
39
|
return accessToken;
|
|
42
40
|
};
|
|
41
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
42
|
+
// @ts-ignore
|
|
43
43
|
instance.interceptors.request.use(async (config) => ({
|
|
44
44
|
...config,
|
|
45
45
|
headers: {
|
|
@@ -75,6 +75,8 @@ export const createAppHttpClient = (options) => {
|
|
|
75
75
|
...(options.axiosOptions || {}),
|
|
76
76
|
baseURL,
|
|
77
77
|
});
|
|
78
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
79
|
+
// @ts-ignore
|
|
78
80
|
instance.interceptors.request.use(async (config) => ({
|
|
79
81
|
...config,
|
|
80
82
|
headers: {
|
package/dist/mjs/index.d.ts
CHANGED
|
@@ -15,13 +15,13 @@ declare const getHttpClientWithEndpoint: (http: AxiosInstance) => {
|
|
|
15
15
|
with_attribute_options?: boolean | undefined;
|
|
16
16
|
with_quality_scores?: boolean | undefined;
|
|
17
17
|
} | undefined;
|
|
18
|
-
}) => Promise<import("./types").Category<
|
|
18
|
+
}) => Promise<import("./types").Category<import("./types").KeyValueMap>>;
|
|
19
19
|
get: (params: {
|
|
20
20
|
query?: import("./types").CategoryQueryParameters | undefined;
|
|
21
|
-
}) => Promise<import("./types").ListResponse<import("./types").Category<
|
|
21
|
+
}) => Promise<import("./types").ListResponse<import("./types").Category<import("./types").KeyValueMap>>>;
|
|
22
22
|
getAll: (params: {
|
|
23
23
|
query?: import("./types").CategoryQueryParameters | undefined;
|
|
24
|
-
}) => Promise<import("./types").ListResponse<import("./types").Category<
|
|
24
|
+
}) => Promise<import("./types").ListResponse<import("./types").Category<import("./types").KeyValueMap>>>;
|
|
25
25
|
};
|
|
26
26
|
productModel: {
|
|
27
27
|
getOne: (params: {
|
|
@@ -81,7 +81,7 @@ declare const getHttpClientWithEndpoint: (http: AxiosInstance) => {
|
|
|
81
81
|
*
|
|
82
82
|
* @see https://api.akeneo.com/api-reference.html#get_asset_media_files__code
|
|
83
83
|
*/
|
|
84
|
-
get: (code: string) => Promise<import("axios").AxiosResponse<any>>;
|
|
84
|
+
get: (code: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
85
85
|
};
|
|
86
86
|
referenceEntitiesMediaFile: {
|
|
87
87
|
/**
|
|
@@ -106,12 +106,12 @@ declare const getHttpClientWithEndpoint: (http: AxiosInstance) => {
|
|
|
106
106
|
add: ({ code, attribute }: {
|
|
107
107
|
code: string;
|
|
108
108
|
attribute: any;
|
|
109
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
109
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
110
110
|
addOption: ({ attributeCode, code, option, }: {
|
|
111
111
|
attributeCode: string;
|
|
112
112
|
code: string;
|
|
113
113
|
option: any;
|
|
114
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
114
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
115
115
|
};
|
|
116
116
|
referenceEntity: {
|
|
117
117
|
get: (params: {
|
|
@@ -126,7 +126,7 @@ declare const getHttpClientWithEndpoint: (http: AxiosInstance) => {
|
|
|
126
126
|
*/ add: ({ code, body }: {
|
|
127
127
|
code: string;
|
|
128
128
|
body: any;
|
|
129
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
129
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
130
130
|
/**
|
|
131
131
|
* @see https://api.akeneo.com/api-reference.html#patch_reference_entity_attributes__code_
|
|
132
132
|
*/
|
|
@@ -143,14 +143,14 @@ declare const getHttpClientWithEndpoint: (http: AxiosInstance) => {
|
|
|
143
143
|
attributeCode: string;
|
|
144
144
|
code: string;
|
|
145
145
|
option: any;
|
|
146
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
146
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
147
147
|
/**
|
|
148
148
|
* @see https://api.akeneo.com/api-reference.html#patch_reference_entity_records
|
|
149
149
|
*/
|
|
150
150
|
addRecords: ({ referenceEntityCode, records, }: {
|
|
151
151
|
referenceEntityCode: string;
|
|
152
152
|
records: any[];
|
|
153
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
153
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
154
154
|
};
|
|
155
155
|
family: {
|
|
156
156
|
get: (params: {
|
|
@@ -187,13 +187,13 @@ export declare const createClient: (params: ClientParams) => {
|
|
|
187
187
|
with_attribute_options?: boolean | undefined;
|
|
188
188
|
with_quality_scores?: boolean | undefined;
|
|
189
189
|
} | undefined;
|
|
190
|
-
}) => Promise<import("./types").Category<
|
|
190
|
+
}) => Promise<import("./types").Category<import("./types").KeyValueMap>>;
|
|
191
191
|
get: (params: {
|
|
192
192
|
query?: import("./types").CategoryQueryParameters | undefined;
|
|
193
|
-
}) => Promise<import("./types").ListResponse<import("./types").Category<
|
|
193
|
+
}) => Promise<import("./types").ListResponse<import("./types").Category<import("./types").KeyValueMap>>>;
|
|
194
194
|
getAll: (params: {
|
|
195
195
|
query?: import("./types").CategoryQueryParameters | undefined;
|
|
196
|
-
}) => Promise<import("./types").ListResponse<import("./types").Category<
|
|
196
|
+
}) => Promise<import("./types").ListResponse<import("./types").Category<import("./types").KeyValueMap>>>;
|
|
197
197
|
};
|
|
198
198
|
productModel: {
|
|
199
199
|
getOne: (params: {
|
|
@@ -253,7 +253,7 @@ export declare const createClient: (params: ClientParams) => {
|
|
|
253
253
|
*
|
|
254
254
|
* @see https://api.akeneo.com/api-reference.html#get_asset_media_files__code
|
|
255
255
|
*/
|
|
256
|
-
get: (code: string) => Promise<import("axios").AxiosResponse<any>>;
|
|
256
|
+
get: (code: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
257
257
|
};
|
|
258
258
|
referenceEntitiesMediaFile: {
|
|
259
259
|
/**
|
|
@@ -278,12 +278,12 @@ export declare const createClient: (params: ClientParams) => {
|
|
|
278
278
|
add: ({ code, attribute }: {
|
|
279
279
|
code: string;
|
|
280
280
|
attribute: any;
|
|
281
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
281
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
282
282
|
addOption: ({ attributeCode, code, option, }: {
|
|
283
283
|
attributeCode: string;
|
|
284
284
|
code: string;
|
|
285
285
|
option: any;
|
|
286
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
286
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
287
287
|
};
|
|
288
288
|
referenceEntity: {
|
|
289
289
|
get: (params: {
|
|
@@ -298,7 +298,7 @@ export declare const createClient: (params: ClientParams) => {
|
|
|
298
298
|
*/ add: ({ code, body }: {
|
|
299
299
|
code: string;
|
|
300
300
|
body: any;
|
|
301
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
301
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
302
302
|
/**
|
|
303
303
|
* @see https://api.akeneo.com/api-reference.html#patch_reference_entity_attributes__code_
|
|
304
304
|
*/
|
|
@@ -315,14 +315,14 @@ export declare const createClient: (params: ClientParams) => {
|
|
|
315
315
|
attributeCode: string;
|
|
316
316
|
code: string;
|
|
317
317
|
option: any;
|
|
318
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
318
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
319
319
|
/**
|
|
320
320
|
* @see https://api.akeneo.com/api-reference.html#patch_reference_entity_records
|
|
321
321
|
*/
|
|
322
322
|
addRecords: ({ referenceEntityCode, records, }: {
|
|
323
323
|
referenceEntityCode: string;
|
|
324
324
|
records: any[];
|
|
325
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
325
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
326
326
|
};
|
|
327
327
|
family: {
|
|
328
328
|
get: (params: {
|
|
@@ -356,13 +356,13 @@ export declare const createAppClient: (params: AppParams) => {
|
|
|
356
356
|
with_attribute_options?: boolean | undefined;
|
|
357
357
|
with_quality_scores?: boolean | undefined;
|
|
358
358
|
} | undefined;
|
|
359
|
-
}) => Promise<import("./types").Category<
|
|
359
|
+
}) => Promise<import("./types").Category<import("./types").KeyValueMap>>;
|
|
360
360
|
get: (params: {
|
|
361
361
|
query?: import("./types").CategoryQueryParameters | undefined;
|
|
362
|
-
}) => Promise<import("./types").ListResponse<import("./types").Category<
|
|
362
|
+
}) => Promise<import("./types").ListResponse<import("./types").Category<import("./types").KeyValueMap>>>;
|
|
363
363
|
getAll: (params: {
|
|
364
364
|
query?: import("./types").CategoryQueryParameters | undefined;
|
|
365
|
-
}) => Promise<import("./types").ListResponse<import("./types").Category<
|
|
365
|
+
}) => Promise<import("./types").ListResponse<import("./types").Category<import("./types").KeyValueMap>>>;
|
|
366
366
|
};
|
|
367
367
|
productModel: {
|
|
368
368
|
getOne: (params: {
|
|
@@ -422,7 +422,7 @@ export declare const createAppClient: (params: AppParams) => {
|
|
|
422
422
|
*
|
|
423
423
|
* @see https://api.akeneo.com/api-reference.html#get_asset_media_files__code
|
|
424
424
|
*/
|
|
425
|
-
get: (code: string) => Promise<import("axios").AxiosResponse<any>>;
|
|
425
|
+
get: (code: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
426
426
|
};
|
|
427
427
|
referenceEntitiesMediaFile: {
|
|
428
428
|
/**
|
|
@@ -447,12 +447,12 @@ export declare const createAppClient: (params: AppParams) => {
|
|
|
447
447
|
add: ({ code, attribute }: {
|
|
448
448
|
code: string;
|
|
449
449
|
attribute: any;
|
|
450
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
450
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
451
451
|
addOption: ({ attributeCode, code, option, }: {
|
|
452
452
|
attributeCode: string;
|
|
453
453
|
code: string;
|
|
454
454
|
option: any;
|
|
455
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
455
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
456
456
|
};
|
|
457
457
|
referenceEntity: {
|
|
458
458
|
get: (params: {
|
|
@@ -467,7 +467,7 @@ export declare const createAppClient: (params: AppParams) => {
|
|
|
467
467
|
*/ add: ({ code, body }: {
|
|
468
468
|
code: string;
|
|
469
469
|
body: any;
|
|
470
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
470
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
471
471
|
/**
|
|
472
472
|
* @see https://api.akeneo.com/api-reference.html#patch_reference_entity_attributes__code_
|
|
473
473
|
*/
|
|
@@ -484,14 +484,14 @@ export declare const createAppClient: (params: AppParams) => {
|
|
|
484
484
|
attributeCode: string;
|
|
485
485
|
code: string;
|
|
486
486
|
option: any;
|
|
487
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
487
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
488
488
|
/**
|
|
489
489
|
* @see https://api.akeneo.com/api-reference.html#patch_reference_entity_records
|
|
490
490
|
*/
|
|
491
491
|
addRecords: ({ referenceEntityCode, records, }: {
|
|
492
492
|
referenceEntityCode: string;
|
|
493
493
|
records: any[];
|
|
494
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
494
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
495
495
|
};
|
|
496
496
|
family: {
|
|
497
497
|
get: (params: {
|
|
@@ -503,5 +503,5 @@ export declare const createAppClient: (params: AppParams) => {
|
|
|
503
503
|
}) => Promise<import("./types").ListResponse<import("./types").Variant>>;
|
|
504
504
|
};
|
|
505
505
|
};
|
|
506
|
-
export
|
|
506
|
+
export type AkeneoClientAPI = ReturnType<typeof getHttpClientWithEndpoint>;
|
|
507
507
|
export * from './types';
|
package/dist/mjs/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxiosRequestConfig } from 'axios';
|
|
2
|
-
export
|
|
2
|
+
export type AppParams = {
|
|
3
3
|
/**
|
|
4
4
|
* API host
|
|
5
5
|
*/
|
|
@@ -13,7 +13,7 @@ export declare type AppParams = {
|
|
|
13
13
|
*/
|
|
14
14
|
axiosOptions?: AxiosRequestConfig;
|
|
15
15
|
};
|
|
16
|
-
export
|
|
16
|
+
export type ClientParams = {
|
|
17
17
|
/**
|
|
18
18
|
* API host
|
|
19
19
|
*/
|
|
@@ -39,8 +39,8 @@ export declare type ClientParams = {
|
|
|
39
39
|
*/
|
|
40
40
|
axiosOptions?: AxiosRequestConfig;
|
|
41
41
|
};
|
|
42
|
-
export
|
|
43
|
-
export
|
|
42
|
+
export type PaginationType = 'page' | 'search_after';
|
|
43
|
+
export type ProductModelQueryParameters = {
|
|
44
44
|
search?: string;
|
|
45
45
|
scope?: string;
|
|
46
46
|
locales?: string;
|
|
@@ -51,7 +51,7 @@ export declare type ProductModelQueryParameters = {
|
|
|
51
51
|
limit?: number;
|
|
52
52
|
with_count?: boolean;
|
|
53
53
|
};
|
|
54
|
-
export
|
|
54
|
+
export type ProductQueryParameters = {
|
|
55
55
|
search?: string;
|
|
56
56
|
scope?: string;
|
|
57
57
|
locales?: string;
|
|
@@ -64,63 +64,63 @@ export declare type ProductQueryParameters = {
|
|
|
64
64
|
with_attribute_options?: boolean;
|
|
65
65
|
with_quality_scores?: boolean;
|
|
66
66
|
};
|
|
67
|
-
export
|
|
67
|
+
export type CategoryQueryParameters = {
|
|
68
68
|
search?: string;
|
|
69
69
|
page?: number;
|
|
70
70
|
limit?: number;
|
|
71
71
|
with_count?: boolean;
|
|
72
72
|
};
|
|
73
|
-
export
|
|
73
|
+
export type AttributeQueryParameters = {
|
|
74
74
|
search?: string;
|
|
75
75
|
page?: number;
|
|
76
76
|
limit?: number;
|
|
77
77
|
with_count?: boolean;
|
|
78
78
|
};
|
|
79
|
-
export
|
|
79
|
+
export type AttributeOptionQueryParameters = {
|
|
80
80
|
page?: number;
|
|
81
81
|
limit?: number;
|
|
82
82
|
with_count?: boolean;
|
|
83
83
|
};
|
|
84
|
-
export
|
|
84
|
+
export type ReferenceEntityQueryParameters = {
|
|
85
85
|
search?: string;
|
|
86
86
|
page?: number;
|
|
87
87
|
limit?: number;
|
|
88
88
|
with_count?: boolean;
|
|
89
89
|
};
|
|
90
|
-
export
|
|
90
|
+
export type FamilyQueryParameters = {
|
|
91
91
|
search?: string;
|
|
92
92
|
page?: number;
|
|
93
93
|
limit?: number;
|
|
94
94
|
with_count?: boolean;
|
|
95
95
|
};
|
|
96
|
-
export
|
|
96
|
+
export type FamilyVariantQueryParameters = {
|
|
97
97
|
page?: number;
|
|
98
98
|
limit?: number;
|
|
99
99
|
with_count?: boolean;
|
|
100
100
|
};
|
|
101
|
-
export
|
|
101
|
+
export type ReferenceEntityRecordQueryParameters = {
|
|
102
102
|
search_after?: string;
|
|
103
103
|
};
|
|
104
|
-
export
|
|
104
|
+
export type AssetFamilyQueryParameters = {
|
|
105
105
|
search_after?: string;
|
|
106
106
|
};
|
|
107
|
-
export
|
|
107
|
+
export type AssetQueryParameters = {
|
|
108
108
|
search?: string;
|
|
109
109
|
channel?: string;
|
|
110
110
|
locales?: string;
|
|
111
111
|
search_after?: string;
|
|
112
112
|
};
|
|
113
|
-
export
|
|
113
|
+
export type ListResponse<T> = {
|
|
114
114
|
items_count?: number;
|
|
115
115
|
current_page?: number;
|
|
116
116
|
items: T[];
|
|
117
117
|
};
|
|
118
|
-
|
|
118
|
+
type Association = {
|
|
119
119
|
products: string[];
|
|
120
120
|
product_models: string[];
|
|
121
121
|
groups: string[];
|
|
122
122
|
};
|
|
123
|
-
export
|
|
123
|
+
export type ProductModel = {
|
|
124
124
|
code: string;
|
|
125
125
|
family: string;
|
|
126
126
|
family_variant: string;
|
|
@@ -133,7 +133,7 @@ export declare type ProductModel = {
|
|
|
133
133
|
quantified_associations: Record<string, Association>;
|
|
134
134
|
metadata: Record<string, any>;
|
|
135
135
|
};
|
|
136
|
-
export
|
|
136
|
+
export type Product = {
|
|
137
137
|
identifier: string;
|
|
138
138
|
uuid?: string;
|
|
139
139
|
enabled: boolean;
|
|
@@ -148,7 +148,7 @@ export declare type Product = {
|
|
|
148
148
|
quantified_associations: Record<string, Association>;
|
|
149
149
|
metadata: Record<string, any>;
|
|
150
150
|
};
|
|
151
|
-
export
|
|
151
|
+
export type Family = {
|
|
152
152
|
code: string;
|
|
153
153
|
attribute_as_label: string;
|
|
154
154
|
attribute_as_image: string;
|
|
@@ -156,17 +156,17 @@ export declare type Family = {
|
|
|
156
156
|
attribute_requirements: Record<string, any>;
|
|
157
157
|
labels: Record<string, any>;
|
|
158
158
|
};
|
|
159
|
-
|
|
159
|
+
type VariantAttributeSet = {
|
|
160
160
|
level: number;
|
|
161
161
|
attributes: string[];
|
|
162
162
|
axes: string[];
|
|
163
163
|
};
|
|
164
|
-
export
|
|
164
|
+
export type Variant = {
|
|
165
165
|
code: string;
|
|
166
166
|
variant_attribute_sets: VariantAttributeSet[];
|
|
167
167
|
labels: Record<string, any>;
|
|
168
168
|
};
|
|
169
|
-
export
|
|
169
|
+
export type Attribute = {
|
|
170
170
|
code: string;
|
|
171
171
|
type: string;
|
|
172
172
|
labels: Record<string, string>;
|
|
@@ -195,32 +195,32 @@ export declare type Attribute = {
|
|
|
195
195
|
reference_data_name: string;
|
|
196
196
|
default_value: boolean;
|
|
197
197
|
};
|
|
198
|
-
export
|
|
198
|
+
export type AttributeOption = {
|
|
199
199
|
code: string;
|
|
200
200
|
attribute: string;
|
|
201
201
|
sort_order: number;
|
|
202
202
|
labels: Record<string, string>;
|
|
203
203
|
};
|
|
204
|
-
|
|
204
|
+
type ValuesRecord = {
|
|
205
205
|
locale: string;
|
|
206
206
|
channel: string;
|
|
207
207
|
data: string | string[];
|
|
208
208
|
};
|
|
209
209
|
export declare type KeyValueMap = Record<string, any>;
|
|
210
|
-
export
|
|
210
|
+
export type Entity = {
|
|
211
211
|
code: string;
|
|
212
212
|
labels: KeyValueMap;
|
|
213
213
|
};
|
|
214
|
-
export
|
|
214
|
+
export type EntityRecord = {
|
|
215
215
|
code: string;
|
|
216
216
|
values: Record<string, ValuesRecord[]>;
|
|
217
217
|
};
|
|
218
|
-
export
|
|
218
|
+
export type Category<T = KeyValueMap> = {
|
|
219
219
|
code: string;
|
|
220
220
|
parent?: string;
|
|
221
221
|
labels: T;
|
|
222
222
|
};
|
|
223
|
-
export
|
|
223
|
+
export type AssetFamily = {
|
|
224
224
|
code: string;
|
|
225
225
|
labels: Record<string, string>;
|
|
226
226
|
attribute_as_main_media: string;
|
|
@@ -236,7 +236,7 @@ export declare type AssetFamily = {
|
|
|
236
236
|
abort_asset_creation_on_error: boolean;
|
|
237
237
|
};
|
|
238
238
|
};
|
|
239
|
-
export
|
|
239
|
+
export type Asset = {
|
|
240
240
|
code: string;
|
|
241
241
|
values: Record<string, ValuesRecord[]>;
|
|
242
242
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dataggo/node-akeneo-api",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "A Node Rest Client for the Akeneo PIM",
|
|
5
5
|
"author": "Constant B <contact@dataggo>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
"watch": "tsc -w -p tsconfig.json && tsc -w -p tsconfig-cjs.json",
|
|
21
21
|
"prepare": "husky install",
|
|
22
22
|
"lint": "eslint src --max-warnings 0",
|
|
23
|
-
"test": "jest",
|
|
23
|
+
"test": "jest --transformIgnorePatterns \"node_modules/(?!axios)/\"",
|
|
24
24
|
"prepublishOnly": "npm run build",
|
|
25
25
|
"publish": "npm publish --access public"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"axios": "^
|
|
28
|
+
"axios": "^1.7.0",
|
|
29
29
|
"qs": "^6.9.6",
|
|
30
30
|
"ramda": "^0.27.1"
|
|
31
31
|
},
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"eslint-plugin-jest": "^24.1.5",
|
|
45
45
|
"eslint-plugin-prettier": "^3.3.1",
|
|
46
46
|
"husky": "^5.1.3",
|
|
47
|
-
"jest": "^
|
|
47
|
+
"jest": "^29.7.0",
|
|
48
48
|
"jest-html-reporters": "^2.1.2",
|
|
49
49
|
"prettier": "^2.2.1",
|
|
50
|
-
"ts-jest": "^
|
|
51
|
-
"typedoc": "^0.
|
|
50
|
+
"ts-jest": "^29.2.4",
|
|
51
|
+
"typedoc": "^0.25.2",
|
|
52
52
|
"typescript": "^4.1.3"
|
|
53
53
|
},
|
|
54
54
|
"jest": {
|