@percy/client 1.32.5 → 1.32.6-beta.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.
Files changed (2) hide show
  1. package/dist/client.js +28 -1
  2. package/package.json +6 -6
package/dist/client.js CHANGED
@@ -12,6 +12,10 @@ const {
12
12
  let pkg = getPackageJSON(import.meta.url);
13
13
  // minimum polling interval milliseconds
14
14
  const MIN_POLLING_INTERVAL = 1_000;
15
+ // Allow-listed drop-in build sources. The API keys drop-in behavior (baseline auto-approval,
16
+ // telemetry) on these; anything else keeps the computed default so a stray env var can't
17
+ // inject an arbitrary source.
18
+ export const DROPIN_BUILD_SOURCES = ['playwright-dropin', 'playwright-dropin-baseline'];
15
19
  const INVALID_TOKEN_ERROR_MESSAGE = 'Unable to retrieve snapshot details with write access token. Kindly use a full access token for retrieving snapshot details with Synchronous CLI.';
16
20
 
17
21
  // Validate ID arguments
@@ -258,10 +262,20 @@ export class PercyClient {
258
262
  // Creates a build with optional build resources. Only one build can be
259
263
  // created at a time per instance so snapshots and build finalization can be
260
264
  // done more seamlessly without manually tracking build ids
265
+ //
266
+ // Drop-in baseline options (Playwright drop-in):
267
+ // source — override the build source with an allow-listed drop-in value.
268
+ // dropinBaselineCandidate — ask the API to treat the build as the project's baseline IF it is
269
+ // the project's first build (the server decides; a no-op on established projects).
270
+ // dropinBaselineSetup — explicit `percy playwright:setup-baseline`: the build IS the baseline
271
+ // regardless of build number (deliberate user-triggered re-baseline).
261
272
  async createBuild({
262
273
  resources = [],
263
274
  projectType,
264
- cliStartTime = null
275
+ cliStartTime = null,
276
+ source: sourceOverride,
277
+ dropinBaselineCandidate,
278
+ dropinBaselineSetup
265
279
  } = {}) {
266
280
  var _this$config$percy2;
267
281
  this.log.debug('Creating a new build...');
@@ -271,7 +285,14 @@ export class PercyClient {
271
285
  source = 'bstack_sdk_created';
272
286
  } else if (process.env.PERCY_AUTO_ENABLED_GROUP_BUILD === 'true') {
273
287
  source = 'auto_enabled_group';
288
+ } else if (DROPIN_BUILD_SOURCES.includes(process.env.PERCY_BUILD_SOURCE)) {
289
+ source = process.env.PERCY_BUILD_SOURCE;
274
290
  }
291
+
292
+ // Allow-listed explicit override (used by the baseline seeding flows).
293
+ if (DROPIN_BUILD_SOURCES.includes(sourceOverride)) source = sourceOverride;
294
+ dropinBaselineCandidate ?? (dropinBaselineCandidate = process.env.PERCY_DROPIN_BASELINE_CANDIDATE === 'true');
295
+ dropinBaselineSetup ?? (dropinBaselineSetup = process.env.PERCY_DROPIN_BASELINE_SETUP === 'true');
275
296
  let tagsArr = tagsList(this.labels);
276
297
 
277
298
  // PER-9724: internal-only priority request. Set by internal product
@@ -304,6 +325,12 @@ export class PercyClient {
304
325
  'skip-base-build': (_this$config$percy2 = this.config.percy) === null || _this$config$percy2 === void 0 ? void 0 : _this$config$percy2.skipBaseBuild,
305
326
  'testhub-build-uuid': this.env.testhubBuildUuid,
306
327
  'testhub-build-run-id': this.env.testhubBuildRunId,
328
+ ...(dropinBaselineCandidate ? {
329
+ 'dropin-baseline-candidate': true
330
+ } : {}),
331
+ ...(dropinBaselineSetup ? {
332
+ 'dropin-baseline-setup': true
333
+ } : {}),
307
334
  ...(visualConfig ? {
308
335
  'visual-config': visualConfig
309
336
  } : {}),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@percy/client",
3
- "version": "1.32.5",
3
+ "version": "1.32.6-beta.1",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "publishConfig": {
11
11
  "access": "public",
12
- "tag": "latest"
12
+ "tag": "beta"
13
13
  },
14
14
  "engines": {
15
15
  "node": ">=14"
@@ -33,11 +33,11 @@
33
33
  "test:coverage": "yarn test --coverage"
34
34
  },
35
35
  "dependencies": {
36
- "@percy/config": "1.32.5",
37
- "@percy/env": "1.32.5",
38
- "@percy/logger": "1.32.5",
36
+ "@percy/config": "1.32.6-beta.1",
37
+ "@percy/env": "1.32.6-beta.1",
38
+ "@percy/logger": "1.32.6-beta.1",
39
39
  "pac-proxy-agent": "^7.0.2",
40
40
  "pako": "^2.1.0"
41
41
  },
42
- "gitHead": "1c83908c5913e3fab1cdd7207db49a2e0c27a3e9"
42
+ "gitHead": "ec8718b71355d501057197c9f5172c99fefc9f03"
43
43
  }