@argos-ci/core 6.8.4 → 6.8.6

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 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-native engineering teams.</strong></p>
10
+ <p align="center"><strong>The open source visual testing platform for teams and AI agents.</strong></p>
11
11
 
12
12
  # Argos Node.js SDK
13
13
 
package/dist/index.d.mts CHANGED
@@ -2,8 +2,8 @@ import { ArgosAPISchema } from "@argos-ci/api-client";
2
2
  import { ScreenshotMetadata } from "@argos-ci/util";
3
3
  //#region src/config.d.ts
4
4
  /** Argos API used unless one is named explicitly or by `ARGOS_API_BASE_URL`. */
5
- declare const DEFAULT_API_BASE_URL = "https://api.argos-ci.com/v2/";
6
- interface Config {
5
+ export declare const DEFAULT_API_BASE_URL = "https://api.argos-ci.com/v2/";
6
+ export interface Config {
7
7
  /**
8
8
  * Base URL of the Argos API.
9
9
  * Use this to target a self-hosted installation.
@@ -138,7 +138,7 @@ interface Config {
138
138
  /**
139
139
  * Options that change how the configuration is read, as opposed to what is in it.
140
140
  */
141
- type ReadConfigOptions = {
141
+ export type ReadConfigOptions = {
142
142
  /**
143
143
  * Require a branch and a commit, which every build-shaped command needs to
144
144
  * describe what it is reporting on.
@@ -150,8 +150,8 @@ type ReadConfigOptions = {
150
150
  */
151
151
  requireGitContext?: boolean;
152
152
  };
153
- declare function readConfig(options?: Partial<Config>, { requireGitContext }?: ReadConfigOptions): Promise<Config>;
154
- declare function getConfigFromOptions({ parallel, ...options }: Omit<Partial<Config>, "parallel"> & {
153
+ export declare function readConfig(options?: Partial<Config>, { requireGitContext }?: ReadConfigOptions): Promise<Config>;
154
+ export declare function getConfigFromOptions({ parallel, ...options }: Omit<Partial<Config>, "parallel"> & {
155
155
  parallel?: {
156
156
  /** Unique build ID for this parallel build */
157
157
  nonce: string;
@@ -163,7 +163,7 @@ declare function getConfigFromOptions({ parallel, ...options }: Omit<Partial<Con
163
163
  }, readOptions?: ReadConfigOptions): Promise<Config>;
164
164
  //#endregion
165
165
  //#region src/deploy.d.ts
166
- interface DeployParameters {
166
+ export interface DeployParameters {
167
167
  /**
168
168
  * Directory containing the static files to deploy.
169
169
  */
@@ -197,7 +197,7 @@ interface DeployParameters {
197
197
  /**
198
198
  * Deploy a static site (e.g. Storybook) to Argos.
199
199
  */
200
- declare function deploy(params: DeployParameters): Promise<{
200
+ export declare function deploy(params: DeployParameters): Promise<{
201
201
  id: string;
202
202
  status: "pending" | "ready" | "error";
203
203
  environment: "preview" | "production";
@@ -208,7 +208,7 @@ declare function deploy(params: DeployParameters): Promise<{
208
208
  }>;
209
209
  //#endregion
210
210
  //#region src/finalize.d.ts
211
- type FinalizeParameters = {
211
+ export type FinalizeParameters = {
212
212
  /**
213
213
  * Base URL of the Argos API.
214
214
  */
@@ -234,7 +234,7 @@ type FinalizeParameters = {
234
234
  buildName?: string;
235
235
  };
236
236
  type Build = ArgosAPISchema.components["schemas"]["Build"];
237
- type FinalizeResult = {
237
+ export type FinalizeResult = {
238
238
  /**
239
239
  * Parallel builds finalized by this call.
240
240
  */
@@ -248,15 +248,15 @@ type FinalizeResult = {
248
248
  /**
249
249
  * Finalize pending builds.
250
250
  */
251
- declare function finalize(params: FinalizeParameters): Promise<FinalizeResult>;
251
+ export declare function finalize(params: FinalizeParameters): Promise<FinalizeResult>;
252
252
  //#endregion
253
253
  //#region src/media.d.ts
254
- type Media = ArgosAPISchema.components["schemas"]["Media"];
254
+ export type Media = ArgosAPISchema.components["schemas"]["Media"];
255
255
  /** Which half of a before/after pair a media is. */
256
- type MediaState = NonNullable<Media["state"]>;
256
+ export type MediaState = NonNullable<Media["state"]>;
257
257
  /** Who can open a media's share page. */
258
- type MediaVisibility = Media["visibility"];
259
- interface UploadMediaParameters {
258
+ export type MediaVisibility = Media["visibility"];
259
+ export interface UploadMediaParameters {
260
260
  /**
261
261
  * Paths of the files to upload.
262
262
  */
@@ -323,17 +323,17 @@ interface UploadMediaParameters {
323
323
  * Argos stores the bytes as given and serves them from its image CDN, so a media
324
324
  * is ready the moment the upload finishes — there is no processing to wait on.
325
325
  */
326
- declare function uploadMedia(params: UploadMediaParameters): Promise<Media[]>;
326
+ export declare function uploadMedia(params: UploadMediaParameters): Promise<Media[]>;
327
327
  //#endregion
328
328
  //#region src/mime-type.d.ts
329
329
  /**
330
330
  * Get the mime type of a snapshot file based on its extension.
331
331
  */
332
- declare function getSnapshotMimeType(filepath: string): string;
332
+ export declare function getSnapshotMimeType(filepath: string): string;
333
333
  //#endregion
334
334
  //#region src/upload.d.ts
335
335
  type BuildMetadata = ArgosAPISchema.components["schemas"]["BuildMetadata"];
336
- interface UploadParameters {
336
+ export interface UploadParameters {
337
337
  /**
338
338
  * Globs that match image file paths to upload.
339
339
  */
@@ -453,7 +453,7 @@ interface Screenshot {
453
453
  /**
454
454
  * Upload screenshots to Argos.
455
455
  */
456
- declare function upload(params: UploadParameters): Promise<{
456
+ export declare function upload(params: UploadParameters): Promise<{
457
457
  build: ArgosAPISchema.components["schemas"]["Build"];
458
458
  screenshots: Screenshot[];
459
459
  }>;
@@ -463,8 +463,7 @@ type SkipParameters = Pick<UploadParameters, "apiBaseUrl" | "commit" | "branch"
463
463
  /**
464
464
  * Mark a build as skipped.
465
465
  */
466
- declare function skip(params: SkipParameters): Promise<{
466
+ export declare function skip(params: SkipParameters): Promise<{
467
467
  build: ArgosAPISchema.components["schemas"]["Build"];
468
468
  }>;
469
- //#endregion
470
- export { Config, DEFAULT_API_BASE_URL, DeployParameters, FinalizeParameters, FinalizeResult, Media, MediaState, MediaVisibility, ReadConfigOptions, UploadMediaParameters, UploadParameters, deploy, finalize, getConfigFromOptions, getSnapshotMimeType, readConfig, skip, upload, uploadMedia };
469
+ //#endregion
package/dist/index.mjs CHANGED
@@ -17,6 +17,24 @@ import tmp from "tmp";
17
17
  //#region src/debug.ts
18
18
  const KEY = "@argos-ci/core";
19
19
  const debug = createDebug(KEY);
20
+ /**
21
+ * Leading characters of a token kept in the debug output: enough to tell two
22
+ * tokens apart, far too few to use.
23
+ */
24
+ const TOKEN_PREVIEW_LENGTH = 6;
25
+ /**
26
+ * Show which token is in play without publishing it.
27
+ *
28
+ * Debug output is the documented way to report an upload problem: it gets
29
+ * pasted into public issues and written to CI logs, which are world-readable on
30
+ * public repositories, so a token printed in full is a published token
31
+ * (GHSA-28pg-v3hp-9g7f). The first few characters answer "is that the token I
32
+ * think it is?" and are useless to anyone else.
33
+ */
34
+ function maskToken(token) {
35
+ if (!token) return token;
36
+ return `${token.slice(0, TOKEN_PREVIEW_LENGTH)}…`;
37
+ }
20
38
  const isDebugEnabled = createDebug.enabled(KEY);
21
39
  const debugTime = (arg) => {
22
40
  if (isDebugEnabled) console.time(arg);
@@ -958,7 +976,7 @@ function listAncestorCommits(input) {
958
976
  */
959
977
  async function getCiEnvironment() {
960
978
  const context = createContext();
961
- debug("Detecting CI environment", context);
979
+ debug("Detecting CI environment");
962
980
  const service = getCiService(context);
963
981
  if (service) {
964
982
  debug("Internal service matched", service.name);
@@ -971,6 +989,7 @@ async function getCiEnvironment() {
971
989
  debug("CI environment", ciEnvironment);
972
990
  return ciEnvironment;
973
991
  }
992
+ debug("No CI service matched");
974
993
  return null;
975
994
  }
976
995
  //#endregion
@@ -1460,7 +1479,7 @@ async function exchangeGitHubActionsTokenlessToken(args) {
1460
1479
  */
1461
1480
  async function resolveArgosToken(config) {
1462
1481
  if (config.token) {
1463
- debug("Authenticated with ARGOS_TOKEN.");
1482
+ debug(`Authenticated with ARGOS_TOKEN (${maskToken(config.token)}).`);
1464
1483
  return config.token;
1465
1484
  }
1466
1485
  if (isGitHubActionsOidcAvailable()) {
@@ -1528,6 +1547,7 @@ async function deploy(params) {
1528
1547
  commit: config.commit ?? null,
1529
1548
  branch: config.branch ?? null,
1530
1549
  prNumber: config.prNumber ?? null,
1550
+ prHeadCommit: config.mergeQueuePrNumbers ? null : config.prHeadCommit,
1531
1551
  environment: params.environment,
1532
1552
  files: files.map(({ path, hash, size, contentType }) => ({
1533
1553
  path,
@@ -2211,7 +2231,8 @@ const PLAYWRIGHT_TRACE_CONTENT_TYPE = "application/zip";
2211
2231
  * Upload screenshots to Argos.
2212
2232
  */
2213
2233
  async function upload(params) {
2214
- debug("Starting upload with params", params);
2234
+ const { token: _paramsToken, ...debugParams } = params;
2235
+ debug("Starting upload with params", debugParams);
2215
2236
  const [config, argosSdk] = await Promise.all([getConfigFromOptions(params), getArgosCoreSDKIdentifier()]);
2216
2237
  const authToken = await resolveArgosToken(config);
2217
2238
  const apiClient = createClient({
@@ -2227,7 +2248,8 @@ async function upload(params) {
2227
2248
  }
2228
2249
  const previewUrlFormatter = params.previewUrl ?? (config.previewBaseUrl ? { baseUrl: config.previewBaseUrl } : void 0);
2229
2250
  const globs = params.files ?? ["**/*.{png,jpg,jpeg}"];
2230
- debug("Using config and files", config, globs);
2251
+ const { token: _configToken, ...debugConfig } = config;
2252
+ debug("Using config and files", debugConfig, globs);
2231
2253
  const files = await discoverSnapshots(globs, {
2232
2254
  root: params.root,
2233
2255
  ignore: params.ignore
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@argos-ci/core",
3
3
  "description": "Node.js SDK for visual testing with Argos.",
4
- "version": "6.8.4",
4
+ "version": "6.8.6",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {
@@ -39,14 +39,14 @@
39
39
  "access": "public"
40
40
  },
41
41
  "dependencies": {
42
- "@argos-ci/api-client": "0.31.0",
43
- "@argos-ci/util": "4.2.0",
42
+ "@argos-ci/api-client": "0.31.1",
43
+ "@argos-ci/util": "4.2.1",
44
44
  "convict": "^6.2.5",
45
45
  "debug": "^4.4.3",
46
46
  "fast-glob": "^3.3.3",
47
47
  "mime-types": "^3.0.2",
48
- "p-retry": "^8.0.0",
49
- "sharp": "^0.35.3",
48
+ "p-retry": "^8.0.1",
49
+ "sharp": "^0.35.5",
50
50
  "tmp": "^0.2.7"
51
51
  },
52
52
  "devDependencies": {
@@ -68,5 +68,5 @@
68
68
  "lint": "eslint .",
69
69
  "test": "vitest"
70
70
  },
71
- "gitHead": "212ed2c37ce532dd32c87ac685b55e2ab6e154c4"
71
+ "gitHead": "4f0edc08d8549534dd3a682bbe034ebcb604bddf"
72
72
  }