@argos-ci/api-client 0.5.0 → 0.5.1
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/index.d.ts +6 -2
- package/dist/index.mjs +8 -6
- package/package.json +4 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { FetchResponse } from "openapi-fetch";
|
|
2
1
|
/**
|
|
3
2
|
* This file was auto-generated by openapi-typescript.
|
|
4
3
|
* Do not make direct changes to the file.
|
|
@@ -1159,5 +1158,10 @@ declare class APIError extends Error {
|
|
|
1159
1158
|
/**
|
|
1160
1159
|
* Handle API errors.
|
|
1161
1160
|
*/
|
|
1162
|
-
declare function throwAPIError(
|
|
1161
|
+
declare function throwAPIError(error: {
|
|
1162
|
+
error: string;
|
|
1163
|
+
details: {
|
|
1164
|
+
message: string;
|
|
1165
|
+
}[];
|
|
1166
|
+
}): never;
|
|
1163
1167
|
export { ArgosAPISchema, ArgosAPIClient, createClient, APIError, throwAPIError };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import createFetchClient from 'openapi-fetch';
|
|
2
|
+
import createDebug from 'debug';
|
|
3
|
+
|
|
4
|
+
const KEY = "@argos-ci/api-client";
|
|
5
|
+
const debug = createDebug(KEY);
|
|
2
6
|
|
|
3
7
|
var schema = /*#__PURE__*/Object.freeze({
|
|
4
8
|
__proto__: null
|
|
@@ -22,12 +26,10 @@ class APIError extends Error {
|
|
|
22
26
|
}
|
|
23
27
|
/**
|
|
24
28
|
* Handle API errors.
|
|
25
|
-
*/ function throwAPIError(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
throw new APIError(`API error: ${response.status} ${response.statusText}`);
|
|
29
|
+
*/ function throwAPIError(error) {
|
|
30
|
+
debug("API error", error);
|
|
31
|
+
const detailMessage = error.details.map((detail)=>detail.message).join(", ");
|
|
32
|
+
throw new APIError(`${error.error}: ${detailMessage}`);
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
export { APIError, schema as ArgosAPISchema, createClient, throwAPIError };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@argos-ci/api-client",
|
|
3
3
|
"description": "Argos API client.",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.1",
|
|
5
5
|
"author": "Smooth Code",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -42,11 +42,13 @@
|
|
|
42
42
|
"build": "rollup -c"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
+
"@types/debug": "^4.1.12",
|
|
45
46
|
"@types/node": "^18.19.44",
|
|
46
47
|
"openapi-typescript": "^7.3.0"
|
|
47
48
|
},
|
|
48
49
|
"dependencies": {
|
|
50
|
+
"debug": "^4.3.6",
|
|
49
51
|
"openapi-fetch": "^0.11.1"
|
|
50
52
|
},
|
|
51
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "0e6df5391e875daba1da61fac33ca1c215db4bc2"
|
|
52
54
|
}
|