@argos-ci/api-client 0.30.0 → 0.31.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/README.md +1 -1
- package/dist/index.d.mts +16 -6
- package/dist/index.mjs +16 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
</a>
|
|
8
8
|
</p>
|
|
9
9
|
|
|
10
|
-
<p align="center"><strong>The open source visual testing platform for AI
|
|
10
|
+
<p align="center"><strong>The open source visual testing platform for teams and AI agents.</strong></p>
|
|
11
11
|
|
|
12
12
|
# Argos API Client
|
|
13
13
|
|
package/dist/index.d.mts
CHANGED
|
@@ -5169,6 +5169,8 @@ interface operations {
|
|
|
5169
5169
|
branch: components["schemas"]["GitBranch"];
|
|
5170
5170
|
/** @description The pull request number */
|
|
5171
5171
|
prNumber?: number | null;
|
|
5172
|
+
/** @description The head commit of the pull request. When `commit` is a merge commit built for the pull request, such as the test-merge commit GitHub Actions checks out, the deployment status is reported on this commit, where the pull request shows it. */
|
|
5173
|
+
prHeadCommit?: components["schemas"]["Sha1Hash"] | null;
|
|
5172
5174
|
/**
|
|
5173
5175
|
* @description The deployment environment. When omitted, it is inferred from `branch`: branches matching the configured production-branch glob are treated as `production`; all others default to `preview`.
|
|
5174
5176
|
* @enum {string}
|
|
@@ -10207,7 +10209,7 @@ interface operations {
|
|
|
10207
10209
|
}
|
|
10208
10210
|
//#endregion
|
|
10209
10211
|
//#region src/fetch.d.ts
|
|
10210
|
-
declare class APIError extends Error {
|
|
10212
|
+
export declare class APIError extends Error {
|
|
10211
10213
|
/**
|
|
10212
10214
|
* HTTP status code of the response that triggered the error, when available.
|
|
10213
10215
|
*/
|
|
@@ -10225,13 +10227,21 @@ declare class APIError extends Error {
|
|
|
10225
10227
|
}
|
|
10226
10228
|
//#endregion
|
|
10227
10229
|
//#region src/index.d.ts
|
|
10228
|
-
type ArgosAPIClient = ReturnType<typeof createClient>;
|
|
10230
|
+
export type ArgosAPIClient = ReturnType<typeof createClient>;
|
|
10231
|
+
/**
|
|
10232
|
+
* A `User-Agent` value, or a resolver for it. The resolver may be async and is
|
|
10233
|
+
* called per request, so a caller that only learns its identity asynchronously
|
|
10234
|
+
* (the CLI detecting the coding agent driving it) does not have to await that
|
|
10235
|
+
* before it can build a client.
|
|
10236
|
+
*/
|
|
10237
|
+
export type UserAgentOption = string | (() => string | undefined | Promise<string | undefined>);
|
|
10229
10238
|
/**
|
|
10230
10239
|
* Create Argos API client.
|
|
10231
10240
|
*/
|
|
10232
|
-
declare function createClient(options?: {
|
|
10241
|
+
export declare function createClient(options?: {
|
|
10233
10242
|
baseUrl?: string;
|
|
10234
10243
|
authToken?: string;
|
|
10244
|
+
userAgent?: UserAgentOption;
|
|
10235
10245
|
}): import("openapi-fetch").Client<paths, `${string}/${string}`>;
|
|
10236
10246
|
/**
|
|
10237
10247
|
* Format an API error into a human-readable message.
|
|
@@ -10243,10 +10253,10 @@ declare function createClient(options?: {
|
|
|
10243
10253
|
* we fall back to the HTTP status and the raw body so the failure stays
|
|
10244
10254
|
* debuggable instead of surfacing an empty message.
|
|
10245
10255
|
*/
|
|
10246
|
-
declare function formatAPIError(error: unknown, response?: Response): string;
|
|
10256
|
+
export declare function formatAPIError(error: unknown, response?: Response): string;
|
|
10247
10257
|
/**
|
|
10248
10258
|
* Handle API errors.
|
|
10249
10259
|
*/
|
|
10250
|
-
declare function throwAPIError(error: unknown, response?: Response): never;
|
|
10260
|
+
export declare function throwAPIError(error: unknown, response?: Response): never;
|
|
10251
10261
|
//#endregion
|
|
10252
|
-
export {
|
|
10262
|
+
export { schema_d_exports as ArgosAPISchema };
|
package/dist/index.mjs
CHANGED
|
@@ -71,14 +71,28 @@ var schema_exports = /* @__PURE__ */ __exportAll({});
|
|
|
71
71
|
//#endregion
|
|
72
72
|
//#region src/index.ts
|
|
73
73
|
/**
|
|
74
|
+
* Wrap {@link apiFetch} so every request carries a `User-Agent`.
|
|
75
|
+
*
|
|
76
|
+
* The header is set on the request openapi-fetch just built for this call — no
|
|
77
|
+
* one else observes it — and `apiFetch` copies the headers before retrying, so
|
|
78
|
+
* every attempt keeps the value.
|
|
79
|
+
*/
|
|
80
|
+
function createUserAgentFetch(userAgent) {
|
|
81
|
+
return async (input, options) => {
|
|
82
|
+
const value = typeof userAgent === "function" ? await userAgent() : userAgent;
|
|
83
|
+
if (value) input.headers.set("user-agent", value);
|
|
84
|
+
return apiFetch(input, options);
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
74
88
|
* Create Argos API client.
|
|
75
89
|
*/
|
|
76
90
|
function createClient(options) {
|
|
77
|
-
const { baseUrl, authToken } = options || {};
|
|
91
|
+
const { baseUrl, authToken, userAgent } = options || {};
|
|
78
92
|
return createFetchClient({
|
|
79
93
|
baseUrl: baseUrl || "https://api.argos-ci.com/v2/",
|
|
80
94
|
headers: { Authorization: authToken ? `Bearer ${authToken}` : void 0 },
|
|
81
|
-
fetch: apiFetch
|
|
95
|
+
fetch: userAgent ? createUserAgentFetch(userAgent) : apiFetch
|
|
82
96
|
});
|
|
83
97
|
}
|
|
84
98
|
/**
|
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.31.1",
|
|
5
5
|
"author": "Smooth Code",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"debug": "^4.4.3",
|
|
54
54
|
"openapi-fetch": "^0.17.0",
|
|
55
|
-
"p-retry": "^8.0.
|
|
55
|
+
"p-retry": "^8.0.1"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "4f0edc08d8549534dd3a682bbe034ebcb604bddf"
|
|
58
58
|
}
|