@dataggo/node-akeneo-api 1.0.0 → 1.0.5
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 +177 -19
- 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 +177 -19
- package/dist/mjs/types.d.ts +29 -29
- package/package.json +7 -4
|
@@ -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
|
@@ -4,6 +4,164 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { AxiosInstance } from 'axios';
|
|
6
6
|
import { AppParams, ClientParams } from './types';
|
|
7
|
+
declare const getHttpClientWithEndpoint: (http: AxiosInstance) => {
|
|
8
|
+
raw: {
|
|
9
|
+
http: AxiosInstance;
|
|
10
|
+
};
|
|
11
|
+
category: {
|
|
12
|
+
getOne: (params: {
|
|
13
|
+
code: string;
|
|
14
|
+
query?: {
|
|
15
|
+
with_attribute_options?: boolean | undefined;
|
|
16
|
+
with_quality_scores?: boolean | undefined;
|
|
17
|
+
} | undefined;
|
|
18
|
+
}) => Promise<import("./types").Category<import("./types").KeyValueMap>>;
|
|
19
|
+
get: (params: {
|
|
20
|
+
query?: import("./types").CategoryQueryParameters | undefined;
|
|
21
|
+
}) => Promise<import("./types").ListResponse<import("./types").Category<import("./types").KeyValueMap>>>;
|
|
22
|
+
getAll: (params: {
|
|
23
|
+
query?: import("./types").CategoryQueryParameters | undefined;
|
|
24
|
+
}) => Promise<import("./types").ListResponse<import("./types").Category<import("./types").KeyValueMap>>>;
|
|
25
|
+
};
|
|
26
|
+
productModel: {
|
|
27
|
+
getOne: (params: {
|
|
28
|
+
code: string;
|
|
29
|
+
}) => Promise<import("./types").ProductModel>;
|
|
30
|
+
get: (params: {
|
|
31
|
+
query?: import("./types").ProductModelQueryParameters | undefined;
|
|
32
|
+
}) => Promise<import("./types").ListResponse<import("./types").ProductModel>>;
|
|
33
|
+
getAll: (params: {
|
|
34
|
+
query?: import("./types").ProductModelQueryParameters | undefined;
|
|
35
|
+
}) => Promise<import("./types").ListResponse<import("./types").ProductModel>>;
|
|
36
|
+
};
|
|
37
|
+
product: {
|
|
38
|
+
getOne: (params: {
|
|
39
|
+
code: string;
|
|
40
|
+
query?: {
|
|
41
|
+
with_attribute_options?: boolean | undefined;
|
|
42
|
+
with_quality_scores?: boolean | undefined;
|
|
43
|
+
} | undefined;
|
|
44
|
+
}) => Promise<import("./types").Product>;
|
|
45
|
+
get: (params: {
|
|
46
|
+
query?: import("./types").ProductQueryParameters | undefined;
|
|
47
|
+
}) => Promise<import("./types").ListResponse<import("./types").Product>>;
|
|
48
|
+
getAll: (params: {
|
|
49
|
+
query?: import("./types").ProductQueryParameters | undefined;
|
|
50
|
+
}) => Promise<import("./types").ListResponse<import("./types").Product>>;
|
|
51
|
+
};
|
|
52
|
+
assetFamily: {
|
|
53
|
+
getOne: (params: {
|
|
54
|
+
code: string;
|
|
55
|
+
query?: {
|
|
56
|
+
with_attribute_options?: boolean | undefined;
|
|
57
|
+
with_quality_scores?: boolean | undefined;
|
|
58
|
+
} | undefined;
|
|
59
|
+
}) => Promise<import("./types").AssetFamily>;
|
|
60
|
+
get: (params: {
|
|
61
|
+
query?: import("./types").AssetFamilyQueryParameters | undefined;
|
|
62
|
+
}) => Promise<import("./types").ListResponse<import("./types").AssetFamily>>;
|
|
63
|
+
getAll: (params: {
|
|
64
|
+
query?: import("./types").AssetFamilyQueryParameters | undefined;
|
|
65
|
+
}) => Promise<import("./types").ListResponse<import("./types").AssetFamily>>;
|
|
66
|
+
getAssets: (params: {
|
|
67
|
+
assetFamilyCode: string;
|
|
68
|
+
query?: import("./types").AssetQueryParameters | undefined;
|
|
69
|
+
}) => Promise<import("./types").ListResponse<import("./types").Asset>>;
|
|
70
|
+
getAsset: (params: {
|
|
71
|
+
assetFamilyCode: string;
|
|
72
|
+
code: string;
|
|
73
|
+
}) => Promise<import("./types").Asset>;
|
|
74
|
+
getAssetsAll: (params: {
|
|
75
|
+
assetFamilyCode: string;
|
|
76
|
+
query?: import("./types").AssetQueryParameters | undefined;
|
|
77
|
+
}) => Promise<import("./types").ListResponse<import("./types").Asset>>;
|
|
78
|
+
};
|
|
79
|
+
assetMediaFile: {
|
|
80
|
+
/**
|
|
81
|
+
*
|
|
82
|
+
* @see https://api.akeneo.com/api-reference.html#get_asset_media_files__code
|
|
83
|
+
*/
|
|
84
|
+
get: (code: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
85
|
+
};
|
|
86
|
+
referenceEntitiesMediaFile: {
|
|
87
|
+
/**
|
|
88
|
+
* @see https://api.akeneo.com/api-reference.html#get_reference_entity_media_files__code
|
|
89
|
+
*/
|
|
90
|
+
get: (code: string) => Promise<any>;
|
|
91
|
+
};
|
|
92
|
+
attribute: {
|
|
93
|
+
getOne: (params: {
|
|
94
|
+
code: string;
|
|
95
|
+
}) => Promise<import("./types").Attribute>;
|
|
96
|
+
get: (params: {
|
|
97
|
+
query?: import("./types").AttributeQueryParameters | undefined;
|
|
98
|
+
}) => Promise<import("./types").ListResponse<import("./types").Attribute>>;
|
|
99
|
+
getAll: (params: {
|
|
100
|
+
query?: import("./types").AttributeQueryParameters | undefined;
|
|
101
|
+
}) => Promise<import("./types").ListResponse<import("./types").Attribute>>;
|
|
102
|
+
getOptions: (params: {
|
|
103
|
+
attributeCode: string;
|
|
104
|
+
query?: import("./types").AttributeOptionQueryParameters | undefined;
|
|
105
|
+
}) => Promise<import("./types").ListResponse<import("./types").AttributeOption>>;
|
|
106
|
+
add: ({ code, attribute }: {
|
|
107
|
+
code: string;
|
|
108
|
+
attribute: any;
|
|
109
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
110
|
+
addOption: ({ attributeCode, code, option, }: {
|
|
111
|
+
attributeCode: string;
|
|
112
|
+
code: string;
|
|
113
|
+
option: any;
|
|
114
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
115
|
+
};
|
|
116
|
+
referenceEntity: {
|
|
117
|
+
get: (params: {
|
|
118
|
+
query?: import("./types").ReferenceEntityQueryParameters | undefined;
|
|
119
|
+
}) => Promise<import("./types").ListResponse<import("./types").Entity>>;
|
|
120
|
+
getRecords: (params: {
|
|
121
|
+
referenceEntityCode: string;
|
|
122
|
+
query?: import("./types").ReferenceEntityRecordQueryParameters | undefined;
|
|
123
|
+
}) => Promise<import("./types").ListResponse<import("./types").EntityRecord>>;
|
|
124
|
+
/**
|
|
125
|
+
* @see https://api.akeneo.com/api-reference.html#patch_reference_entity__code_
|
|
126
|
+
*/ add: ({ code, body }: {
|
|
127
|
+
code: string;
|
|
128
|
+
body: any;
|
|
129
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
130
|
+
/**
|
|
131
|
+
* @see https://api.akeneo.com/api-reference.html#patch_reference_entity_attributes__code_
|
|
132
|
+
*/
|
|
133
|
+
addAttribute: ({ referenceEntityCode, code, attribute, }: {
|
|
134
|
+
referenceEntityCode: string;
|
|
135
|
+
code: string;
|
|
136
|
+
attribute: any;
|
|
137
|
+
}) => Promise<void>;
|
|
138
|
+
/**
|
|
139
|
+
* @see https://api.akeneo.com/api-reference.html#patch_reference_entity_attributes__attribute_code__options__code_
|
|
140
|
+
*/
|
|
141
|
+
addAttributeOption: ({ referenceEntityCode, attributeCode, code, option, }: {
|
|
142
|
+
referenceEntityCode: string;
|
|
143
|
+
attributeCode: string;
|
|
144
|
+
code: string;
|
|
145
|
+
option: any;
|
|
146
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
147
|
+
/**
|
|
148
|
+
* @see https://api.akeneo.com/api-reference.html#patch_reference_entity_records
|
|
149
|
+
*/
|
|
150
|
+
addRecords: ({ referenceEntityCode, records, }: {
|
|
151
|
+
referenceEntityCode: string;
|
|
152
|
+
records: any[];
|
|
153
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
154
|
+
};
|
|
155
|
+
family: {
|
|
156
|
+
get: (params: {
|
|
157
|
+
query?: import("./types").FamilyQueryParameters | undefined;
|
|
158
|
+
}) => Promise<import("./types").ListResponse<import("./types").Family>>;
|
|
159
|
+
getVariants: (params: {
|
|
160
|
+
familyCode: string;
|
|
161
|
+
query?: import("./types").FamilyVariantQueryParameters | undefined;
|
|
162
|
+
}) => Promise<import("./types").ListResponse<import("./types").Variant>>;
|
|
163
|
+
};
|
|
164
|
+
};
|
|
7
165
|
/**
|
|
8
166
|
* Create a client instance
|
|
9
167
|
* @param params - Client initialization parameters
|
|
@@ -29,13 +187,13 @@ export declare const createClient: (params: ClientParams) => {
|
|
|
29
187
|
with_attribute_options?: boolean | undefined;
|
|
30
188
|
with_quality_scores?: boolean | undefined;
|
|
31
189
|
} | undefined;
|
|
32
|
-
}) => Promise<import("./types").Category<
|
|
190
|
+
}) => Promise<import("./types").Category<import("./types").KeyValueMap>>;
|
|
33
191
|
get: (params: {
|
|
34
192
|
query?: import("./types").CategoryQueryParameters | undefined;
|
|
35
|
-
}) => Promise<import("./types").ListResponse<import("./types").Category<
|
|
193
|
+
}) => Promise<import("./types").ListResponse<import("./types").Category<import("./types").KeyValueMap>>>;
|
|
36
194
|
getAll: (params: {
|
|
37
195
|
query?: import("./types").CategoryQueryParameters | undefined;
|
|
38
|
-
}) => Promise<import("./types").ListResponse<import("./types").Category<
|
|
196
|
+
}) => Promise<import("./types").ListResponse<import("./types").Category<import("./types").KeyValueMap>>>;
|
|
39
197
|
};
|
|
40
198
|
productModel: {
|
|
41
199
|
getOne: (params: {
|
|
@@ -95,7 +253,7 @@ export declare const createClient: (params: ClientParams) => {
|
|
|
95
253
|
*
|
|
96
254
|
* @see https://api.akeneo.com/api-reference.html#get_asset_media_files__code
|
|
97
255
|
*/
|
|
98
|
-
get: (code: string) => Promise<import("axios").AxiosResponse<any>>;
|
|
256
|
+
get: (code: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
99
257
|
};
|
|
100
258
|
referenceEntitiesMediaFile: {
|
|
101
259
|
/**
|
|
@@ -120,12 +278,12 @@ export declare const createClient: (params: ClientParams) => {
|
|
|
120
278
|
add: ({ code, attribute }: {
|
|
121
279
|
code: string;
|
|
122
280
|
attribute: any;
|
|
123
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
281
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
124
282
|
addOption: ({ attributeCode, code, option, }: {
|
|
125
283
|
attributeCode: string;
|
|
126
284
|
code: string;
|
|
127
285
|
option: any;
|
|
128
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
286
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
129
287
|
};
|
|
130
288
|
referenceEntity: {
|
|
131
289
|
get: (params: {
|
|
@@ -140,7 +298,7 @@ export declare const createClient: (params: ClientParams) => {
|
|
|
140
298
|
*/ add: ({ code, body }: {
|
|
141
299
|
code: string;
|
|
142
300
|
body: any;
|
|
143
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
301
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
144
302
|
/**
|
|
145
303
|
* @see https://api.akeneo.com/api-reference.html#patch_reference_entity_attributes__code_
|
|
146
304
|
*/
|
|
@@ -157,14 +315,14 @@ export declare const createClient: (params: ClientParams) => {
|
|
|
157
315
|
attributeCode: string;
|
|
158
316
|
code: string;
|
|
159
317
|
option: any;
|
|
160
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
318
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
161
319
|
/**
|
|
162
320
|
* @see https://api.akeneo.com/api-reference.html#patch_reference_entity_records
|
|
163
321
|
*/
|
|
164
322
|
addRecords: ({ referenceEntityCode, records, }: {
|
|
165
323
|
referenceEntityCode: string;
|
|
166
324
|
records: any[];
|
|
167
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
325
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
168
326
|
};
|
|
169
327
|
family: {
|
|
170
328
|
get: (params: {
|
|
@@ -198,13 +356,13 @@ export declare const createAppClient: (params: AppParams) => {
|
|
|
198
356
|
with_attribute_options?: boolean | undefined;
|
|
199
357
|
with_quality_scores?: boolean | undefined;
|
|
200
358
|
} | undefined;
|
|
201
|
-
}) => Promise<import("./types").Category<
|
|
359
|
+
}) => Promise<import("./types").Category<import("./types").KeyValueMap>>;
|
|
202
360
|
get: (params: {
|
|
203
361
|
query?: import("./types").CategoryQueryParameters | undefined;
|
|
204
|
-
}) => Promise<import("./types").ListResponse<import("./types").Category<
|
|
362
|
+
}) => Promise<import("./types").ListResponse<import("./types").Category<import("./types").KeyValueMap>>>;
|
|
205
363
|
getAll: (params: {
|
|
206
364
|
query?: import("./types").CategoryQueryParameters | undefined;
|
|
207
|
-
}) => Promise<import("./types").ListResponse<import("./types").Category<
|
|
365
|
+
}) => Promise<import("./types").ListResponse<import("./types").Category<import("./types").KeyValueMap>>>;
|
|
208
366
|
};
|
|
209
367
|
productModel: {
|
|
210
368
|
getOne: (params: {
|
|
@@ -264,7 +422,7 @@ export declare const createAppClient: (params: AppParams) => {
|
|
|
264
422
|
*
|
|
265
423
|
* @see https://api.akeneo.com/api-reference.html#get_asset_media_files__code
|
|
266
424
|
*/
|
|
267
|
-
get: (code: string) => Promise<import("axios").AxiosResponse<any>>;
|
|
425
|
+
get: (code: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
268
426
|
};
|
|
269
427
|
referenceEntitiesMediaFile: {
|
|
270
428
|
/**
|
|
@@ -289,12 +447,12 @@ export declare const createAppClient: (params: AppParams) => {
|
|
|
289
447
|
add: ({ code, attribute }: {
|
|
290
448
|
code: string;
|
|
291
449
|
attribute: any;
|
|
292
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
450
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
293
451
|
addOption: ({ attributeCode, code, option, }: {
|
|
294
452
|
attributeCode: string;
|
|
295
453
|
code: string;
|
|
296
454
|
option: any;
|
|
297
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
455
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
298
456
|
};
|
|
299
457
|
referenceEntity: {
|
|
300
458
|
get: (params: {
|
|
@@ -309,7 +467,7 @@ export declare const createAppClient: (params: AppParams) => {
|
|
|
309
467
|
*/ add: ({ code, body }: {
|
|
310
468
|
code: string;
|
|
311
469
|
body: any;
|
|
312
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
470
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
313
471
|
/**
|
|
314
472
|
* @see https://api.akeneo.com/api-reference.html#patch_reference_entity_attributes__code_
|
|
315
473
|
*/
|
|
@@ -326,14 +484,14 @@ export declare const createAppClient: (params: AppParams) => {
|
|
|
326
484
|
attributeCode: string;
|
|
327
485
|
code: string;
|
|
328
486
|
option: any;
|
|
329
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
487
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
330
488
|
/**
|
|
331
489
|
* @see https://api.akeneo.com/api-reference.html#patch_reference_entity_records
|
|
332
490
|
*/
|
|
333
491
|
addRecords: ({ referenceEntityCode, records, }: {
|
|
334
492
|
referenceEntityCode: string;
|
|
335
493
|
records: any[];
|
|
336
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
494
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
337
495
|
};
|
|
338
496
|
family: {
|
|
339
497
|
get: (params: {
|
|
@@ -345,5 +503,5 @@ export declare const createAppClient: (params: AppParams) => {
|
|
|
345
503
|
}) => Promise<import("./types").ListResponse<import("./types").Variant>>;
|
|
346
504
|
};
|
|
347
505
|
};
|
|
348
|
-
export
|
|
506
|
+
export type AkeneoClientAPI = ReturnType<typeof getHttpClientWithEndpoint>;
|
|
349
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
|
@@ -4,6 +4,164 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { AxiosInstance } from 'axios';
|
|
6
6
|
import { AppParams, ClientParams } from './types';
|
|
7
|
+
declare const getHttpClientWithEndpoint: (http: AxiosInstance) => {
|
|
8
|
+
raw: {
|
|
9
|
+
http: AxiosInstance;
|
|
10
|
+
};
|
|
11
|
+
category: {
|
|
12
|
+
getOne: (params: {
|
|
13
|
+
code: string;
|
|
14
|
+
query?: {
|
|
15
|
+
with_attribute_options?: boolean | undefined;
|
|
16
|
+
with_quality_scores?: boolean | undefined;
|
|
17
|
+
} | undefined;
|
|
18
|
+
}) => Promise<import("./types").Category<import("./types").KeyValueMap>>;
|
|
19
|
+
get: (params: {
|
|
20
|
+
query?: import("./types").CategoryQueryParameters | undefined;
|
|
21
|
+
}) => Promise<import("./types").ListResponse<import("./types").Category<import("./types").KeyValueMap>>>;
|
|
22
|
+
getAll: (params: {
|
|
23
|
+
query?: import("./types").CategoryQueryParameters | undefined;
|
|
24
|
+
}) => Promise<import("./types").ListResponse<import("./types").Category<import("./types").KeyValueMap>>>;
|
|
25
|
+
};
|
|
26
|
+
productModel: {
|
|
27
|
+
getOne: (params: {
|
|
28
|
+
code: string;
|
|
29
|
+
}) => Promise<import("./types").ProductModel>;
|
|
30
|
+
get: (params: {
|
|
31
|
+
query?: import("./types").ProductModelQueryParameters | undefined;
|
|
32
|
+
}) => Promise<import("./types").ListResponse<import("./types").ProductModel>>;
|
|
33
|
+
getAll: (params: {
|
|
34
|
+
query?: import("./types").ProductModelQueryParameters | undefined;
|
|
35
|
+
}) => Promise<import("./types").ListResponse<import("./types").ProductModel>>;
|
|
36
|
+
};
|
|
37
|
+
product: {
|
|
38
|
+
getOne: (params: {
|
|
39
|
+
code: string;
|
|
40
|
+
query?: {
|
|
41
|
+
with_attribute_options?: boolean | undefined;
|
|
42
|
+
with_quality_scores?: boolean | undefined;
|
|
43
|
+
} | undefined;
|
|
44
|
+
}) => Promise<import("./types").Product>;
|
|
45
|
+
get: (params: {
|
|
46
|
+
query?: import("./types").ProductQueryParameters | undefined;
|
|
47
|
+
}) => Promise<import("./types").ListResponse<import("./types").Product>>;
|
|
48
|
+
getAll: (params: {
|
|
49
|
+
query?: import("./types").ProductQueryParameters | undefined;
|
|
50
|
+
}) => Promise<import("./types").ListResponse<import("./types").Product>>;
|
|
51
|
+
};
|
|
52
|
+
assetFamily: {
|
|
53
|
+
getOne: (params: {
|
|
54
|
+
code: string;
|
|
55
|
+
query?: {
|
|
56
|
+
with_attribute_options?: boolean | undefined;
|
|
57
|
+
with_quality_scores?: boolean | undefined;
|
|
58
|
+
} | undefined;
|
|
59
|
+
}) => Promise<import("./types").AssetFamily>;
|
|
60
|
+
get: (params: {
|
|
61
|
+
query?: import("./types").AssetFamilyQueryParameters | undefined;
|
|
62
|
+
}) => Promise<import("./types").ListResponse<import("./types").AssetFamily>>;
|
|
63
|
+
getAll: (params: {
|
|
64
|
+
query?: import("./types").AssetFamilyQueryParameters | undefined;
|
|
65
|
+
}) => Promise<import("./types").ListResponse<import("./types").AssetFamily>>;
|
|
66
|
+
getAssets: (params: {
|
|
67
|
+
assetFamilyCode: string;
|
|
68
|
+
query?: import("./types").AssetQueryParameters | undefined;
|
|
69
|
+
}) => Promise<import("./types").ListResponse<import("./types").Asset>>;
|
|
70
|
+
getAsset: (params: {
|
|
71
|
+
assetFamilyCode: string;
|
|
72
|
+
code: string;
|
|
73
|
+
}) => Promise<import("./types").Asset>;
|
|
74
|
+
getAssetsAll: (params: {
|
|
75
|
+
assetFamilyCode: string;
|
|
76
|
+
query?: import("./types").AssetQueryParameters | undefined;
|
|
77
|
+
}) => Promise<import("./types").ListResponse<import("./types").Asset>>;
|
|
78
|
+
};
|
|
79
|
+
assetMediaFile: {
|
|
80
|
+
/**
|
|
81
|
+
*
|
|
82
|
+
* @see https://api.akeneo.com/api-reference.html#get_asset_media_files__code
|
|
83
|
+
*/
|
|
84
|
+
get: (code: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
85
|
+
};
|
|
86
|
+
referenceEntitiesMediaFile: {
|
|
87
|
+
/**
|
|
88
|
+
* @see https://api.akeneo.com/api-reference.html#get_reference_entity_media_files__code
|
|
89
|
+
*/
|
|
90
|
+
get: (code: string) => Promise<any>;
|
|
91
|
+
};
|
|
92
|
+
attribute: {
|
|
93
|
+
getOne: (params: {
|
|
94
|
+
code: string;
|
|
95
|
+
}) => Promise<import("./types").Attribute>;
|
|
96
|
+
get: (params: {
|
|
97
|
+
query?: import("./types").AttributeQueryParameters | undefined;
|
|
98
|
+
}) => Promise<import("./types").ListResponse<import("./types").Attribute>>;
|
|
99
|
+
getAll: (params: {
|
|
100
|
+
query?: import("./types").AttributeQueryParameters | undefined;
|
|
101
|
+
}) => Promise<import("./types").ListResponse<import("./types").Attribute>>;
|
|
102
|
+
getOptions: (params: {
|
|
103
|
+
attributeCode: string;
|
|
104
|
+
query?: import("./types").AttributeOptionQueryParameters | undefined;
|
|
105
|
+
}) => Promise<import("./types").ListResponse<import("./types").AttributeOption>>;
|
|
106
|
+
add: ({ code, attribute }: {
|
|
107
|
+
code: string;
|
|
108
|
+
attribute: any;
|
|
109
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
110
|
+
addOption: ({ attributeCode, code, option, }: {
|
|
111
|
+
attributeCode: string;
|
|
112
|
+
code: string;
|
|
113
|
+
option: any;
|
|
114
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
115
|
+
};
|
|
116
|
+
referenceEntity: {
|
|
117
|
+
get: (params: {
|
|
118
|
+
query?: import("./types").ReferenceEntityQueryParameters | undefined;
|
|
119
|
+
}) => Promise<import("./types").ListResponse<import("./types").Entity>>;
|
|
120
|
+
getRecords: (params: {
|
|
121
|
+
referenceEntityCode: string;
|
|
122
|
+
query?: import("./types").ReferenceEntityRecordQueryParameters | undefined;
|
|
123
|
+
}) => Promise<import("./types").ListResponse<import("./types").EntityRecord>>;
|
|
124
|
+
/**
|
|
125
|
+
* @see https://api.akeneo.com/api-reference.html#patch_reference_entity__code_
|
|
126
|
+
*/ add: ({ code, body }: {
|
|
127
|
+
code: string;
|
|
128
|
+
body: any;
|
|
129
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
130
|
+
/**
|
|
131
|
+
* @see https://api.akeneo.com/api-reference.html#patch_reference_entity_attributes__code_
|
|
132
|
+
*/
|
|
133
|
+
addAttribute: ({ referenceEntityCode, code, attribute, }: {
|
|
134
|
+
referenceEntityCode: string;
|
|
135
|
+
code: string;
|
|
136
|
+
attribute: any;
|
|
137
|
+
}) => Promise<void>;
|
|
138
|
+
/**
|
|
139
|
+
* @see https://api.akeneo.com/api-reference.html#patch_reference_entity_attributes__attribute_code__options__code_
|
|
140
|
+
*/
|
|
141
|
+
addAttributeOption: ({ referenceEntityCode, attributeCode, code, option, }: {
|
|
142
|
+
referenceEntityCode: string;
|
|
143
|
+
attributeCode: string;
|
|
144
|
+
code: string;
|
|
145
|
+
option: any;
|
|
146
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
147
|
+
/**
|
|
148
|
+
* @see https://api.akeneo.com/api-reference.html#patch_reference_entity_records
|
|
149
|
+
*/
|
|
150
|
+
addRecords: ({ referenceEntityCode, records, }: {
|
|
151
|
+
referenceEntityCode: string;
|
|
152
|
+
records: any[];
|
|
153
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
154
|
+
};
|
|
155
|
+
family: {
|
|
156
|
+
get: (params: {
|
|
157
|
+
query?: import("./types").FamilyQueryParameters | undefined;
|
|
158
|
+
}) => Promise<import("./types").ListResponse<import("./types").Family>>;
|
|
159
|
+
getVariants: (params: {
|
|
160
|
+
familyCode: string;
|
|
161
|
+
query?: import("./types").FamilyVariantQueryParameters | undefined;
|
|
162
|
+
}) => Promise<import("./types").ListResponse<import("./types").Variant>>;
|
|
163
|
+
};
|
|
164
|
+
};
|
|
7
165
|
/**
|
|
8
166
|
* Create a client instance
|
|
9
167
|
* @param params - Client initialization parameters
|
|
@@ -29,13 +187,13 @@ export declare const createClient: (params: ClientParams) => {
|
|
|
29
187
|
with_attribute_options?: boolean | undefined;
|
|
30
188
|
with_quality_scores?: boolean | undefined;
|
|
31
189
|
} | undefined;
|
|
32
|
-
}) => Promise<import("./types").Category<
|
|
190
|
+
}) => Promise<import("./types").Category<import("./types").KeyValueMap>>;
|
|
33
191
|
get: (params: {
|
|
34
192
|
query?: import("./types").CategoryQueryParameters | undefined;
|
|
35
|
-
}) => Promise<import("./types").ListResponse<import("./types").Category<
|
|
193
|
+
}) => Promise<import("./types").ListResponse<import("./types").Category<import("./types").KeyValueMap>>>;
|
|
36
194
|
getAll: (params: {
|
|
37
195
|
query?: import("./types").CategoryQueryParameters | undefined;
|
|
38
|
-
}) => Promise<import("./types").ListResponse<import("./types").Category<
|
|
196
|
+
}) => Promise<import("./types").ListResponse<import("./types").Category<import("./types").KeyValueMap>>>;
|
|
39
197
|
};
|
|
40
198
|
productModel: {
|
|
41
199
|
getOne: (params: {
|
|
@@ -95,7 +253,7 @@ export declare const createClient: (params: ClientParams) => {
|
|
|
95
253
|
*
|
|
96
254
|
* @see https://api.akeneo.com/api-reference.html#get_asset_media_files__code
|
|
97
255
|
*/
|
|
98
|
-
get: (code: string) => Promise<import("axios").AxiosResponse<any>>;
|
|
256
|
+
get: (code: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
99
257
|
};
|
|
100
258
|
referenceEntitiesMediaFile: {
|
|
101
259
|
/**
|
|
@@ -120,12 +278,12 @@ export declare const createClient: (params: ClientParams) => {
|
|
|
120
278
|
add: ({ code, attribute }: {
|
|
121
279
|
code: string;
|
|
122
280
|
attribute: any;
|
|
123
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
281
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
124
282
|
addOption: ({ attributeCode, code, option, }: {
|
|
125
283
|
attributeCode: string;
|
|
126
284
|
code: string;
|
|
127
285
|
option: any;
|
|
128
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
286
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
129
287
|
};
|
|
130
288
|
referenceEntity: {
|
|
131
289
|
get: (params: {
|
|
@@ -140,7 +298,7 @@ export declare const createClient: (params: ClientParams) => {
|
|
|
140
298
|
*/ add: ({ code, body }: {
|
|
141
299
|
code: string;
|
|
142
300
|
body: any;
|
|
143
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
301
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
144
302
|
/**
|
|
145
303
|
* @see https://api.akeneo.com/api-reference.html#patch_reference_entity_attributes__code_
|
|
146
304
|
*/
|
|
@@ -157,14 +315,14 @@ export declare const createClient: (params: ClientParams) => {
|
|
|
157
315
|
attributeCode: string;
|
|
158
316
|
code: string;
|
|
159
317
|
option: any;
|
|
160
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
318
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
161
319
|
/**
|
|
162
320
|
* @see https://api.akeneo.com/api-reference.html#patch_reference_entity_records
|
|
163
321
|
*/
|
|
164
322
|
addRecords: ({ referenceEntityCode, records, }: {
|
|
165
323
|
referenceEntityCode: string;
|
|
166
324
|
records: any[];
|
|
167
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
325
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
168
326
|
};
|
|
169
327
|
family: {
|
|
170
328
|
get: (params: {
|
|
@@ -198,13 +356,13 @@ export declare const createAppClient: (params: AppParams) => {
|
|
|
198
356
|
with_attribute_options?: boolean | undefined;
|
|
199
357
|
with_quality_scores?: boolean | undefined;
|
|
200
358
|
} | undefined;
|
|
201
|
-
}) => Promise<import("./types").Category<
|
|
359
|
+
}) => Promise<import("./types").Category<import("./types").KeyValueMap>>;
|
|
202
360
|
get: (params: {
|
|
203
361
|
query?: import("./types").CategoryQueryParameters | undefined;
|
|
204
|
-
}) => Promise<import("./types").ListResponse<import("./types").Category<
|
|
362
|
+
}) => Promise<import("./types").ListResponse<import("./types").Category<import("./types").KeyValueMap>>>;
|
|
205
363
|
getAll: (params: {
|
|
206
364
|
query?: import("./types").CategoryQueryParameters | undefined;
|
|
207
|
-
}) => Promise<import("./types").ListResponse<import("./types").Category<
|
|
365
|
+
}) => Promise<import("./types").ListResponse<import("./types").Category<import("./types").KeyValueMap>>>;
|
|
208
366
|
};
|
|
209
367
|
productModel: {
|
|
210
368
|
getOne: (params: {
|
|
@@ -264,7 +422,7 @@ export declare const createAppClient: (params: AppParams) => {
|
|
|
264
422
|
*
|
|
265
423
|
* @see https://api.akeneo.com/api-reference.html#get_asset_media_files__code
|
|
266
424
|
*/
|
|
267
|
-
get: (code: string) => Promise<import("axios").AxiosResponse<any>>;
|
|
425
|
+
get: (code: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
268
426
|
};
|
|
269
427
|
referenceEntitiesMediaFile: {
|
|
270
428
|
/**
|
|
@@ -289,12 +447,12 @@ export declare const createAppClient: (params: AppParams) => {
|
|
|
289
447
|
add: ({ code, attribute }: {
|
|
290
448
|
code: string;
|
|
291
449
|
attribute: any;
|
|
292
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
450
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
293
451
|
addOption: ({ attributeCode, code, option, }: {
|
|
294
452
|
attributeCode: string;
|
|
295
453
|
code: string;
|
|
296
454
|
option: any;
|
|
297
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
455
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
298
456
|
};
|
|
299
457
|
referenceEntity: {
|
|
300
458
|
get: (params: {
|
|
@@ -309,7 +467,7 @@ export declare const createAppClient: (params: AppParams) => {
|
|
|
309
467
|
*/ add: ({ code, body }: {
|
|
310
468
|
code: string;
|
|
311
469
|
body: any;
|
|
312
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
470
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
313
471
|
/**
|
|
314
472
|
* @see https://api.akeneo.com/api-reference.html#patch_reference_entity_attributes__code_
|
|
315
473
|
*/
|
|
@@ -326,14 +484,14 @@ export declare const createAppClient: (params: AppParams) => {
|
|
|
326
484
|
attributeCode: string;
|
|
327
485
|
code: string;
|
|
328
486
|
option: any;
|
|
329
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
487
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
330
488
|
/**
|
|
331
489
|
* @see https://api.akeneo.com/api-reference.html#patch_reference_entity_records
|
|
332
490
|
*/
|
|
333
491
|
addRecords: ({ referenceEntityCode, records, }: {
|
|
334
492
|
referenceEntityCode: string;
|
|
335
493
|
records: any[];
|
|
336
|
-
}) => Promise<import("axios").AxiosResponse<any>>;
|
|
494
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
337
495
|
};
|
|
338
496
|
family: {
|
|
339
497
|
get: (params: {
|
|
@@ -345,5 +503,5 @@ export declare const createAppClient: (params: AppParams) => {
|
|
|
345
503
|
}) => Promise<import("./types").ListResponse<import("./types").Variant>>;
|
|
346
504
|
};
|
|
347
505
|
};
|
|
348
|
-
export
|
|
506
|
+
export type AkeneoClientAPI = ReturnType<typeof getHttpClientWithEndpoint>;
|
|
349
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.5",
|
|
4
4
|
"description": "A Node Rest Client for the Akeneo PIM",
|
|
5
5
|
"author": "Constant B <contact@dataggo>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"publish": "npm publish --access public"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"axios": "^
|
|
28
|
+
"axios": "^1.6.0",
|
|
29
29
|
"qs": "^6.9.6",
|
|
30
30
|
"ramda": "^0.27.1"
|
|
31
31
|
},
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"jest-html-reporters": "^2.1.2",
|
|
49
49
|
"prettier": "^2.2.1",
|
|
50
50
|
"ts-jest": "^26.5.2",
|
|
51
|
-
"typedoc": "^0.
|
|
51
|
+
"typedoc": "^0.25.2",
|
|
52
52
|
"typescript": "^4.1.3"
|
|
53
53
|
},
|
|
54
54
|
"jest": {
|
|
@@ -70,6 +70,9 @@
|
|
|
70
70
|
"src/**/*.(t|j)s"
|
|
71
71
|
],
|
|
72
72
|
"coverageDirectory": "coverage",
|
|
73
|
-
"testEnvironment": "node"
|
|
73
|
+
"testEnvironment": "node",
|
|
74
|
+
"moduleNameMapper": {
|
|
75
|
+
"axios": "axios/dist/node/axios.cjs"
|
|
76
|
+
}
|
|
74
77
|
}
|
|
75
78
|
}
|