@coveo/platform-client 42.2.0 → 42.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/handlers/ResponseHandlers.js +14 -2
- package/dist/cjs/handlers/ResponseHandlers.js.map +1 -1
- package/dist/esm/handlers/ResponseHandlers.js +12 -1
- package/dist/esm/handlers/ResponseHandlers.js.map +1 -1
- package/dist/types/handlers/ResponseHandlers.d.ts +7 -0
- package/dist/types/resources/IPXInterfaces/IPXInterface.model.d.ts +16 -0
- package/package.json +10 -10
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ResponseHandlers = exports.defaultResponseHandlers = void 0;
|
|
3
|
+
exports.CoveoPlatformClientError = exports.ResponseHandlers = exports.defaultResponseHandlers = void 0;
|
|
4
4
|
const noContent = {
|
|
5
5
|
canProcess: (response) => response.status === 204,
|
|
6
6
|
process: async () => ({}),
|
|
@@ -16,10 +16,22 @@ const successBlob = {
|
|
|
16
16
|
const error = {
|
|
17
17
|
canProcess: () => true,
|
|
18
18
|
process: async (response) => {
|
|
19
|
-
|
|
19
|
+
const responseJson = await response.json();
|
|
20
|
+
const platformError = new CoveoPlatformClientError();
|
|
21
|
+
Object.assign(platformError, responseJson);
|
|
22
|
+
platformError.xRequestId = response.headers.get('X-Request-ID') ?? 'unknown';
|
|
23
|
+
throw platformError;
|
|
20
24
|
},
|
|
21
25
|
};
|
|
22
26
|
exports.defaultResponseHandlers = [noContent, success, error];
|
|
23
27
|
exports.ResponseHandlers = { noContent, success, successBlob, error };
|
|
24
28
|
exports.default = (response, handlers = exports.defaultResponseHandlers) => handlers.filter((handler) => handler.canProcess(response))[0].process(response);
|
|
29
|
+
class CoveoPlatformClientError extends Error {
|
|
30
|
+
/**
|
|
31
|
+
* The HTTP X-Request-ID request header is an optional and unofficial HTTP header, used to trace individual HTTP requests from the client to the server and back again.
|
|
32
|
+
* It allows the client and server to correlate each HTTP request.
|
|
33
|
+
*/
|
|
34
|
+
xRequestId;
|
|
35
|
+
}
|
|
36
|
+
exports.CoveoPlatformClientError = CoveoPlatformClientError;
|
|
25
37
|
//# sourceMappingURL=ResponseHandlers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResponseHandlers.js","sourceRoot":"","sources":["../../../src/handlers/ResponseHandlers.ts"],"names":[],"mappings":";;;AAEA,MAAM,SAAS,GAAoB;IAC/B,UAAU,EAAE,CAAC,QAAkB,EAAW,EAAE,CAAC,QAAQ,CAAC,MAAM,KAAK,GAAG;IACpE,OAAO,EAAE,KAAK,IAAmB,EAAE,CAAC,CAAC,EAAQ,CAAA;CAChD,CAAC;AAEF,MAAM,OAAO,GAAoB;IAC7B,UAAU,EAAE,CAAC,QAAkB,EAAW,EAAE,CAAC,QAAQ,CAAC,EAAE;IACxD,OAAO,EAAE,KAAK,EAAK,QAAkB,EAAc,EAAE,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE;CAC9E,CAAC;AAEF,MAAM,WAAW,GAAoB;IACjC,UAAU,EAAE,CAAC,QAAkB,EAAW,EAAE,CAAC,QAAQ,CAAC,EAAE;IACxD,OAAO,EAAE,KAAK,EAAK,QAAkB,EAAc,EAAE,CAAC,MAAO,QAAQ,CAAC,IAAI,EAAU;CACvF,CAAC;AAEF,MAAM,KAAK,GAAoB;IAC3B,UAAU,EAAE,GAAG,EAAE,CAAC,IAAI;IACtB,OAAO,EAAE,KAAK,EAAK,QAAkB,EAAc,EAAE;QACjD,MAAM,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"ResponseHandlers.js","sourceRoot":"","sources":["../../../src/handlers/ResponseHandlers.ts"],"names":[],"mappings":";;;AAEA,MAAM,SAAS,GAAoB;IAC/B,UAAU,EAAE,CAAC,QAAkB,EAAW,EAAE,CAAC,QAAQ,CAAC,MAAM,KAAK,GAAG;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C,CAAC,CAAC,CAAC,CAAC,OAAO,CAAI,QAAQ,CAAC,CAAC;AAEvF,MAAa,wBAAyB,SAAQ,KAAK;IAC/C;;;OAGG;IACH,UAAU,CAAS;CACtB;AAND,4DAMC"}
|
|
@@ -13,10 +13,21 @@ const successBlob = {
|
|
|
13
13
|
const error = {
|
|
14
14
|
canProcess: () => true,
|
|
15
15
|
process: async (response) => {
|
|
16
|
-
|
|
16
|
+
const responseJson = await response.json();
|
|
17
|
+
const platformError = new CoveoPlatformClientError();
|
|
18
|
+
Object.assign(platformError, responseJson);
|
|
19
|
+
platformError.xRequestId = response.headers.get('X-Request-ID') ?? 'unknown';
|
|
20
|
+
throw platformError;
|
|
17
21
|
},
|
|
18
22
|
};
|
|
19
23
|
export const defaultResponseHandlers = [noContent, success, error];
|
|
20
24
|
export const ResponseHandlers = { noContent, success, successBlob, error };
|
|
21
25
|
export default (response, handlers = defaultResponseHandlers) => handlers.filter((handler) => handler.canProcess(response))[0].process(response);
|
|
26
|
+
export class CoveoPlatformClientError extends Error {
|
|
27
|
+
/**
|
|
28
|
+
* The HTTP X-Request-ID request header is an optional and unofficial HTTP header, used to trace individual HTTP requests from the client to the server and back again.
|
|
29
|
+
* It allows the client and server to correlate each HTTP request.
|
|
30
|
+
*/
|
|
31
|
+
xRequestId;
|
|
32
|
+
}
|
|
22
33
|
//# sourceMappingURL=ResponseHandlers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResponseHandlers.js","sourceRoot":"","sources":["../../../src/handlers/ResponseHandlers.ts"],"names":[],"mappings":"AAEA,MAAM,SAAS,GAAoB;IAC/B,UAAU,EAAE,CAAC,QAAkB,EAAW,EAAE,CAAC,QAAQ,CAAC,MAAM,KAAK,GAAG;IACpE,OAAO,EAAE,KAAK,IAAmB,EAAE,CAAC,CAAC,EAAQ,CAAA;CAChD,CAAC;AAEF,MAAM,OAAO,GAAoB;IAC7B,UAAU,EAAE,CAAC,QAAkB,EAAW,EAAE,CA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KAAK,EAAK,QAAkB,EAAc,EAAE;QACjD,MAAM,YAAY,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QAC3C,MAAM,aAAa,GAAG,IAAI,wBAAwB,EAAE,CAAC;QACrD,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC;QAC3C,aAAa,CAAC,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,SAAS,CAAC;QAC7E,MAAM,aAAa,CAAC;IACxB,CAAC;CACJ,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,SAAS,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AACnE,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAC,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAC,CAAC;AAEzE,eAAe,CAAI,QAAkB,EAAE,QAAQ,GAAG,uBAAuB,EAAE,EAAE,CACzE,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAI,QAAQ,CAAC,CAAC;AAEvF,MAAM,OAAO,wBAAyB,SAAQ,KAAK;IAC/C;;;OAGG;IACH,UAAU,CAAS;CACtB"}
|
|
@@ -8,3 +8,10 @@ export declare const ResponseHandlers: {
|
|
|
8
8
|
};
|
|
9
9
|
declare const _default: <T>(response: Response, handlers?: ResponseHandler[]) => Promise<T>;
|
|
10
10
|
export default _default;
|
|
11
|
+
export declare class CoveoPlatformClientError extends Error {
|
|
12
|
+
/**
|
|
13
|
+
* The HTTP X-Request-ID request header is an optional and unofficial HTTP header, used to trace individual HTTP requests from the client to the server and back again.
|
|
14
|
+
* It allows the client and server to correlate each HTTP request.
|
|
15
|
+
*/
|
|
16
|
+
xRequestId: string;
|
|
17
|
+
}
|
|
@@ -143,4 +143,20 @@ export interface IPXInterfaceConfiguration extends HostedInterfaceConfiguration
|
|
|
143
143
|
* The style configuration.
|
|
144
144
|
*/
|
|
145
145
|
style: IPXStyle;
|
|
146
|
+
/**
|
|
147
|
+
* The date of creation of the interface
|
|
148
|
+
*/
|
|
149
|
+
created: string;
|
|
150
|
+
/**
|
|
151
|
+
* The original author of the interface
|
|
152
|
+
*/
|
|
153
|
+
createdBy: string;
|
|
154
|
+
/**
|
|
155
|
+
* The date of the interface's latest update
|
|
156
|
+
*/
|
|
157
|
+
updated: string;
|
|
158
|
+
/**
|
|
159
|
+
* The author of the interface's latest update
|
|
160
|
+
*/
|
|
161
|
+
updatedBy: string;
|
|
146
162
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coveo/platform-client",
|
|
3
|
-
"version": "42.
|
|
3
|
+
"version": "42.4.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -34,23 +34,23 @@
|
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@commitlint/cli": "17.4.4",
|
|
36
36
|
"@commitlint/config-conventional": "17.4.4",
|
|
37
|
-
"@types/jest": "29.4.
|
|
38
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
39
|
-
"@typescript-eslint/parser": "5.
|
|
37
|
+
"@types/jest": "29.4.4",
|
|
38
|
+
"@typescript-eslint/eslint-plugin": "5.55.0",
|
|
39
|
+
"@typescript-eslint/parser": "5.55.0",
|
|
40
40
|
"abortcontroller-polyfill": "1.7.5",
|
|
41
41
|
"cz-conventional-changelog": "3.3.0",
|
|
42
|
-
"eslint": "8.
|
|
43
|
-
"eslint-config-prettier": "8.
|
|
42
|
+
"eslint": "8.36.0",
|
|
43
|
+
"eslint-config-prettier": "8.7.0",
|
|
44
44
|
"eslint-config-typescript": "3.0.0",
|
|
45
45
|
"eslint-plugin-jest": "27.2.1",
|
|
46
46
|
"eslint-plugin-prettier": "4.2.1",
|
|
47
47
|
"husky": "8.0.3",
|
|
48
|
-
"jest": "29.
|
|
48
|
+
"jest": "29.5.0",
|
|
49
49
|
"jest-fetch-mock": "3.0.3",
|
|
50
|
-
"jest-runner-eslint": "
|
|
51
|
-
"lint-staged": "13.
|
|
50
|
+
"jest-runner-eslint": "2.0.0",
|
|
51
|
+
"lint-staged": "13.2.0",
|
|
52
52
|
"prettier": "2.8.4",
|
|
53
|
-
"semantic-release": "20.1.
|
|
53
|
+
"semantic-release": "20.1.1",
|
|
54
54
|
"ts-jest": "29.0.5",
|
|
55
55
|
"tsjs": "4.2.1",
|
|
56
56
|
"tslib": "2.5.0",
|