@percy/client 1.32.2-beta.0 → 1.32.3-beta.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/client.js +1 -53
- package/package.json +5 -5
package/dist/client.js
CHANGED
|
@@ -364,64 +364,12 @@ export class PercyClient {
|
|
|
364
364
|
}
|
|
365
365
|
|
|
366
366
|
// Retrieves snapshot/comparison data by id. Requires a read access token.
|
|
367
|
-
// For `smartsnap_graph`, the API blocks (sync=true) until the graph job
|
|
368
|
-
// finishes and returns the graph payload directly in the response — there
|
|
369
|
-
// is no separate "data" endpoint to fetch after polling.
|
|
370
367
|
async getStatus(type, ids) {
|
|
371
|
-
if (!['snapshot', 'comparison'
|
|
368
|
+
if (!['snapshot', 'comparison'].includes(type)) throw new Error('Invalid type passed');
|
|
372
369
|
this.log.debug(`Getting ${type} status for ids ${ids}`);
|
|
373
370
|
return this.get(`job_status?sync=true&type=${type}&id=${ids.join()}`);
|
|
374
371
|
}
|
|
375
372
|
|
|
376
|
-
// SmartSnap endpoints authenticate against the project attached to the
|
|
377
|
-
// current Percy token (via the Authorization header). `generate-graph`
|
|
378
|
-
// takes a `build_id` (sourced from the bundler-emitted stats file) so
|
|
379
|
-
// multiple concurrent storybook builds for the same project don't share
|
|
380
|
-
// Redis state. `snapshot-name-to-commit` is project-scoped only.
|
|
381
|
-
// Graph status is polled through the shared `getStatus()` helper with
|
|
382
|
-
// type `smartsnap_graph` — the sync response returns the graph payload
|
|
383
|
-
// directly on completion.
|
|
384
|
-
|
|
385
|
-
async getSmartsnapSnapshotNameToCommit() {
|
|
386
|
-
var _this$env$git, _this$env$target, _this$env$git2, _this$env$target2;
|
|
387
|
-
this.log.debug('Smartsnap: looking up baselines...');
|
|
388
|
-
const qs = new URLSearchParams();
|
|
389
|
-
|
|
390
|
-
// Same git/PR context `createBuild` sends — the API uses these to predict
|
|
391
|
-
// the base build that *would* be selected if we called createBuild now,
|
|
392
|
-
// without actually creating one. Any missing field means the API falls
|
|
393
|
-
// back through the same strategy chain it would on real build creation.
|
|
394
|
-
if ((_this$env$git = this.env.git) !== null && _this$env$git !== void 0 && _this$env$git.branch) qs.append('branch', this.env.git.branch);
|
|
395
|
-
if ((_this$env$target = this.env.target) !== null && _this$env$target !== void 0 && _this$env$target.branch) qs.append('target_branch', this.env.target.branch);
|
|
396
|
-
if ((_this$env$git2 = this.env.git) !== null && _this$env$git2 !== void 0 && _this$env$git2.sha) qs.append('commit_sha', this.env.git.sha);
|
|
397
|
-
if ((_this$env$target2 = this.env.target) !== null && _this$env$target2 !== void 0 && _this$env$target2.commit) qs.append('target_commit_sha', this.env.target.commit);
|
|
398
|
-
if (this.env.pullRequest != null) qs.append('pull_request_number', String(this.env.pullRequest));
|
|
399
|
-
if (this.env.partial) qs.append('partial', 'true');
|
|
400
|
-
const query = qs.toString();
|
|
401
|
-
return this.get(query ? `smartsnap/snapshot-name-to-commit?${query}` : 'smartsnap/snapshot-name-to-commit', {
|
|
402
|
-
identifier: 'smartsnap.snapshot_name_to_commit'
|
|
403
|
-
});
|
|
404
|
-
}
|
|
405
|
-
async generateSmartsnapGraph(buildId, {
|
|
406
|
-
files,
|
|
407
|
-
modules,
|
|
408
|
-
storybookPaths,
|
|
409
|
-
affectedNodes,
|
|
410
|
-
affectedFileLocations
|
|
411
|
-
} = {}) {
|
|
412
|
-
this.log.debug(`Smartsnap: enqueueing graph build for build ${buildId}...`);
|
|
413
|
-
return this.post('smartsnap/generate-graph', {
|
|
414
|
-
build_id: buildId,
|
|
415
|
-
files,
|
|
416
|
-
modules,
|
|
417
|
-
storybook_paths: storybookPaths,
|
|
418
|
-
affected_nodes: affectedNodes,
|
|
419
|
-
affected_file_locations: affectedFileLocations
|
|
420
|
-
}, {
|
|
421
|
-
identifier: 'smartsnap.generate_graph'
|
|
422
|
-
});
|
|
423
|
-
}
|
|
424
|
-
|
|
425
373
|
// Returns device details enabled on project associated with given token
|
|
426
374
|
async getDeviceDetails(buildId) {
|
|
427
375
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@percy/client",
|
|
3
|
-
"version": "1.32.
|
|
3
|
+
"version": "1.32.3-beta.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
"test:coverage": "yarn test --coverage"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@percy/config": "1.32.
|
|
37
|
-
"@percy/env": "1.32.
|
|
38
|
-
"@percy/logger": "1.32.
|
|
36
|
+
"@percy/config": "1.32.3-beta.0",
|
|
37
|
+
"@percy/env": "1.32.3-beta.0",
|
|
38
|
+
"@percy/logger": "1.32.3-beta.0",
|
|
39
39
|
"pac-proxy-agent": "^7.0.2",
|
|
40
40
|
"pako": "^2.1.0"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "e8af175695b4afdb78cdd48b67037710f5c8b1c9"
|
|
43
43
|
}
|