@argos-ci/api-client 0.20.1 → 0.22.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/index.d.mts +83 -19
- package/dist/index.mjs +23 -17
- package/package.json +2 -2
- /package/dist/{chunk-CfYAbeIz.mjs → chunk-D7D4PA-g.mjs} +0 -0
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import * as _$openapi_fetch0 from "openapi-fetch";
|
|
2
|
-
|
|
3
|
-
//#region src/schema.d.ts
|
|
4
1
|
declare namespace schema_d_exports {
|
|
5
2
|
export { $defs, components, operations, paths, webhooks };
|
|
6
3
|
}
|
|
@@ -283,7 +280,11 @@ interface components {
|
|
|
283
280
|
schemas: {
|
|
284
281
|
/** @description SHA1 hash */Sha1Hash: string;
|
|
285
282
|
GitBranch: string; /** @description SHA256 hash */
|
|
286
|
-
Sha256Hash: string;
|
|
283
|
+
Sha256Hash: string; /** @description Screenshot file to upload */
|
|
284
|
+
ScreenshotUploadRequest: {
|
|
285
|
+
key: components["schemas"]["Sha256Hash"]; /** @description Content type of the snapshot file */
|
|
286
|
+
contentType: string;
|
|
287
|
+
};
|
|
287
288
|
/**
|
|
288
289
|
* @description A unique identifier for the build
|
|
289
290
|
* @example 12345
|
|
@@ -352,8 +353,8 @@ interface components {
|
|
|
352
353
|
tags?: string[];
|
|
353
354
|
} | null;
|
|
354
355
|
pwTraceKey?: string | null;
|
|
355
|
-
threshold?: number | null; /** @
|
|
356
|
-
contentType
|
|
356
|
+
threshold?: number | null; /** @description Content type of the snapshot file */
|
|
357
|
+
contentType?: string;
|
|
357
358
|
}; /** @description Build metadata */
|
|
358
359
|
BuildMetadata: {
|
|
359
360
|
/** @description Test suite report */testReport?: {
|
|
@@ -416,7 +417,8 @@ interface components {
|
|
|
416
417
|
};
|
|
417
418
|
gitlab: {
|
|
418
419
|
/** @enum {string} */state: "pending" | "running" | "success" | "failed" | "canceled";
|
|
419
|
-
};
|
|
420
|
+
}; /** Format: uri */
|
|
421
|
+
url: string;
|
|
420
422
|
} | null;
|
|
421
423
|
}; /** @description Git reference */
|
|
422
424
|
BuildGitReference: {
|
|
@@ -621,8 +623,7 @@ interface operations {
|
|
|
621
623
|
content: {
|
|
622
624
|
"application/json": {
|
|
623
625
|
/** @description The commit the build is running on */commit: components["schemas"]["Sha1Hash"]; /** @description The branch the build is running on */
|
|
624
|
-
branch: components["schemas"]["GitBranch"]; /** @description Keys of
|
|
625
|
-
screenshotKeys: components["schemas"]["Sha256Hash"][]; /** @description Keys of Playwright trace files */
|
|
626
|
+
branch: components["schemas"]["GitBranch"]; /** @description Keys of Playwright trace files */
|
|
626
627
|
pwTraceKeys?: components["schemas"]["Sha256Hash"][]; /** @description The name of the build (for multi-build setups) */
|
|
627
628
|
name?: string | null; /** @description Whether to run the build in parallel */
|
|
628
629
|
parallel?: boolean | null; /** @description A unique nonce for the parallel build */
|
|
@@ -645,7 +646,17 @@ interface operations {
|
|
|
645
646
|
* This is useful when a build is created from an incomplete test suite where some tests are skipped.
|
|
646
647
|
*/
|
|
647
648
|
subset?: boolean | null;
|
|
648
|
-
}
|
|
649
|
+
} & ({
|
|
650
|
+
/**
|
|
651
|
+
* @deprecated
|
|
652
|
+
* @description Keys of screenshot files
|
|
653
|
+
*/
|
|
654
|
+
screenshotKeys: components["schemas"]["Sha256Hash"][];
|
|
655
|
+
screenshots?: unknown;
|
|
656
|
+
} | {
|
|
657
|
+
/** @description Screenshot files to upload */screenshots: components["schemas"]["ScreenshotUploadRequest"][];
|
|
658
|
+
screenshotKeys?: unknown;
|
|
659
|
+
});
|
|
649
660
|
};
|
|
650
661
|
};
|
|
651
662
|
responses: {
|
|
@@ -656,14 +667,36 @@ interface operations {
|
|
|
656
667
|
content: {
|
|
657
668
|
"application/json": {
|
|
658
669
|
build: components["schemas"]["Build"];
|
|
659
|
-
screenshots: {
|
|
660
|
-
key: string;
|
|
670
|
+
screenshots: ({
|
|
671
|
+
key: string;
|
|
672
|
+
/**
|
|
673
|
+
* Format: uri
|
|
674
|
+
* @deprecated
|
|
675
|
+
* @description Deprecated. Use postUrl and fields instead.
|
|
676
|
+
*/
|
|
661
677
|
putUrl: string;
|
|
662
|
-
}
|
|
663
|
-
pwTraces: {
|
|
678
|
+
} | {
|
|
664
679
|
key: string; /** Format: uri */
|
|
680
|
+
postUrl: string;
|
|
681
|
+
fields: {
|
|
682
|
+
[key: string]: string;
|
|
683
|
+
};
|
|
684
|
+
})[];
|
|
685
|
+
pwTraces: ({
|
|
686
|
+
key: string;
|
|
687
|
+
/**
|
|
688
|
+
* Format: uri
|
|
689
|
+
* @deprecated
|
|
690
|
+
* @description Deprecated. Use postUrl and fields instead.
|
|
691
|
+
*/
|
|
665
692
|
putUrl: string;
|
|
666
|
-
}
|
|
693
|
+
} | {
|
|
694
|
+
key: string; /** Format: uri */
|
|
695
|
+
postUrl: string;
|
|
696
|
+
fields: {
|
|
697
|
+
[key: string]: string;
|
|
698
|
+
};
|
|
699
|
+
})[];
|
|
667
700
|
};
|
|
668
701
|
};
|
|
669
702
|
}; /** @description Invalid parameters */
|
|
@@ -1184,6 +1217,14 @@ interface operations {
|
|
|
1184
1217
|
content: {
|
|
1185
1218
|
"application/json": components["schemas"]["Error"];
|
|
1186
1219
|
};
|
|
1220
|
+
}; /** @description Not found */
|
|
1221
|
+
404: {
|
|
1222
|
+
headers: {
|
|
1223
|
+
[name: string]: unknown;
|
|
1224
|
+
};
|
|
1225
|
+
content: {
|
|
1226
|
+
"application/json": components["schemas"]["Error"];
|
|
1227
|
+
};
|
|
1187
1228
|
}; /** @description Server error */
|
|
1188
1229
|
500: {
|
|
1189
1230
|
headers: {
|
|
@@ -1192,6 +1233,14 @@ interface operations {
|
|
|
1192
1233
|
content: {
|
|
1193
1234
|
"application/json": components["schemas"]["Error"];
|
|
1194
1235
|
};
|
|
1236
|
+
}; /** @description Service unavailable */
|
|
1237
|
+
503: {
|
|
1238
|
+
headers: {
|
|
1239
|
+
[name: string]: unknown;
|
|
1240
|
+
};
|
|
1241
|
+
content: {
|
|
1242
|
+
"application/json": components["schemas"]["Error"];
|
|
1243
|
+
};
|
|
1195
1244
|
};
|
|
1196
1245
|
};
|
|
1197
1246
|
};
|
|
@@ -1576,10 +1625,17 @@ interface operations {
|
|
|
1576
1625
|
content: {
|
|
1577
1626
|
"application/json": {
|
|
1578
1627
|
/**
|
|
1579
|
-
* @description
|
|
1628
|
+
* @description Review event to apply to the build: "APPROVE", "REJECT" or "COMMENT". Required when `conclusion` is not provided.
|
|
1580
1629
|
* @enum {string}
|
|
1581
1630
|
*/
|
|
1582
|
-
|
|
1631
|
+
event?: "APPROVE" | "REJECT" | "COMMENT";
|
|
1632
|
+
/**
|
|
1633
|
+
* @deprecated
|
|
1634
|
+
* @description Deprecated: use `event` instead. Overall review conclusion for the build: "APPROVE" or "REQUEST_CHANGES".
|
|
1635
|
+
* @enum {string}
|
|
1636
|
+
*/
|
|
1637
|
+
conclusion?: "APPROVE" | "REQUEST_CHANGES"; /** @description Optional comment to attach to the review. Expected as the JSON representation of a rich-text document. */
|
|
1638
|
+
body?: unknown;
|
|
1583
1639
|
/**
|
|
1584
1640
|
* @description Optional per-snapshot review decisions. When omitted, only the build-level review is recorded.
|
|
1585
1641
|
* @default []
|
|
@@ -1603,9 +1659,17 @@ interface operations {
|
|
|
1603
1659
|
content: {
|
|
1604
1660
|
"application/json": {
|
|
1605
1661
|
id: string; /** @enum {string} */
|
|
1606
|
-
state: "approved" | "rejected";
|
|
1662
|
+
state: "approved" | "rejected" | "commented" | "pending";
|
|
1607
1663
|
};
|
|
1608
1664
|
};
|
|
1665
|
+
}; /** @description Invalid parameters */
|
|
1666
|
+
400: {
|
|
1667
|
+
headers: {
|
|
1668
|
+
[name: string]: unknown;
|
|
1669
|
+
};
|
|
1670
|
+
content: {
|
|
1671
|
+
"application/json": components["schemas"]["Error"];
|
|
1672
|
+
};
|
|
1609
1673
|
}; /** @description Unauthorized */
|
|
1610
1674
|
401: {
|
|
1611
1675
|
headers: {
|
|
@@ -1656,7 +1720,7 @@ type ArgosAPIClient = ReturnType<typeof createClient>;
|
|
|
1656
1720
|
declare function createClient(options?: {
|
|
1657
1721
|
baseUrl?: string;
|
|
1658
1722
|
authToken?: string;
|
|
1659
|
-
}):
|
|
1723
|
+
}): import("openapi-fetch").Client<paths, `${string}/${string}`>;
|
|
1660
1724
|
/**
|
|
1661
1725
|
* Handle API errors.
|
|
1662
1726
|
*/
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as __exportAll } from "./chunk-
|
|
1
|
+
import { t as __exportAll } from "./chunk-D7D4PA-g.mjs";
|
|
2
2
|
import createFetchClient from "openapi-fetch";
|
|
3
3
|
import createDebug from "debug";
|
|
4
4
|
import pRetry from "p-retry";
|
|
@@ -14,27 +14,33 @@ var APIError = class extends Error {
|
|
|
14
14
|
async function createRequestFactory(request, timeout) {
|
|
15
15
|
const body = request.body ? await request.arrayBuffer() : void 0;
|
|
16
16
|
const headers = new Headers(request.headers);
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
17
|
+
const requestId = headers.get("x-argos-request-id")?.trim() || globalThis.crypto.randomUUID();
|
|
18
|
+
return (retryAttempt) => {
|
|
19
|
+
const requestHeaders = new Headers(headers);
|
|
20
|
+
requestHeaders.set("x-argos-request-id", requestId);
|
|
21
|
+
requestHeaders.set("x-argos-retry-attempt", String(retryAttempt));
|
|
22
|
+
return new Request(request.url, {
|
|
23
|
+
body,
|
|
24
|
+
cache: request.cache,
|
|
25
|
+
credentials: request.credentials,
|
|
26
|
+
headers: requestHeaders,
|
|
27
|
+
integrity: request.integrity,
|
|
28
|
+
keepalive: request.keepalive,
|
|
29
|
+
method: request.method,
|
|
30
|
+
mode: request.mode,
|
|
31
|
+
redirect: request.redirect,
|
|
32
|
+
referrer: request.referrer,
|
|
33
|
+
referrerPolicy: request.referrerPolicy,
|
|
34
|
+
signal: AbortSignal.any([request.signal, AbortSignal.timeout(timeout)])
|
|
35
|
+
});
|
|
36
|
+
};
|
|
31
37
|
}
|
|
32
38
|
async function apiFetch(input, options = {}) {
|
|
33
39
|
input.signal.throwIfAborted();
|
|
34
40
|
const fetchImpl = options.fetch ?? fetch;
|
|
35
41
|
const createRequest = await createRequestFactory(input, options.timeout ?? DEFAULT_TIMEOUT);
|
|
36
|
-
return pRetry(async () => {
|
|
37
|
-
const response = await fetchImpl(createRequest());
|
|
42
|
+
return pRetry(async (attemptNumber) => {
|
|
43
|
+
const response = await fetchImpl(createRequest(attemptNumber - 1));
|
|
38
44
|
if (response.status >= 500) throw new APIError(`Internal Server Error (${response.status})`);
|
|
39
45
|
return response;
|
|
40
46
|
}, {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@argos-ci/api-client",
|
|
3
3
|
"description": "Argos API Client library.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.22.0",
|
|
5
5
|
"author": "Smooth Code",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"openapi-fetch": "^0.17.0",
|
|
55
55
|
"p-retry": "^8.0.0"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "4d890d5091bd313c327eb4e8c17dc1bee9d48578"
|
|
58
58
|
}
|
|
File without changes
|