@percy/core 1.28.0-beta.1 → 1.28.1-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/api.js CHANGED
@@ -117,10 +117,10 @@ export function createPercyServer(percy, port) {
117
117
  const snapshotPromise = new Promise((resolve, reject) => percy.upload(req.body, {
118
118
  resolve,
119
119
  reject
120
- }));
120
+ }, 'app'));
121
121
  data = await handleSyncJob(snapshotPromise, percy, 'comparison');
122
122
  } else {
123
- let upload = percy.upload(req.body);
123
+ let upload = percy.upload(req.body, null, 'app');
124
124
  if (req.url.searchParams.has('await')) await upload;
125
125
  }
126
126
 
@@ -164,10 +164,10 @@ export function createPercyServer(percy, port) {
164
164
  const snapshotPromise = new Promise((resolve, reject) => percy.upload(comparisonData, {
165
165
  resolve,
166
166
  reject
167
- }));
167
+ }, 'automate'));
168
168
  data = await handleSyncJob(snapshotPromise, percy, 'comparison');
169
169
  } else {
170
- percy.upload(comparisonData);
170
+ percy.upload(comparisonData, null, 'automate');
171
171
  }
172
172
  res.json(200, {
173
173
  success: true,
package/dist/percy.js CHANGED
@@ -333,7 +333,7 @@ export class Percy {
333
333
  }
334
334
 
335
335
  // Uploads one or more snapshots directly to the current Percy build
336
- upload(options, callback = null) {
336
+ upload(options, callback = null, screenshotFlow = null) {
337
337
  if (this.readyState !== 1) {
338
338
  throw new Error('Not running');
339
339
  } else if (Array.isArray(options)) {
@@ -364,6 +364,7 @@ export class Percy {
364
364
  // add client & environment info
365
365
  this.client.addClientInfo(options.clientInfo);
366
366
  this.client.addEnvironmentInfo(options.environmentInfo);
367
+ this.client.screenshotFlow = screenshotFlow;
367
368
 
368
369
  // Sync CLI support, attached resolve, reject promise
369
370
  if (this.syncMode(options)) {
package/dist/snapshot.js CHANGED
@@ -344,6 +344,7 @@ export function createSnapshotsQueue(percy) {
344
344
  // on start, create a new Percy build
345
345
  .handle('start', async () => {
346
346
  try {
347
+ var _data$attributes;
347
348
  build = percy.build = {};
348
349
  let {
349
350
  data
@@ -352,6 +353,7 @@ export function createSnapshotsQueue(percy) {
352
353
  });
353
354
  let url = data.attributes['web-url'];
354
355
  let number = data.attributes['build-number'];
356
+ percy.client.buildType = (_data$attributes = data.attributes) === null || _data$attributes === void 0 ? void 0 : _data$attributes.type;
355
357
  Object.assign(build, {
356
358
  id: data.id,
357
359
  url,
@@ -420,7 +422,11 @@ export function createSnapshotsQueue(percy) {
420
422
  name,
421
423
  meta
422
424
  } = snapshot;
423
-
425
+ if (percy.client.screenshotFlow === 'automate' && percy.client.buildType !== 'automate') {
426
+ throw new Error(`Cannot run automate screenshots in ${percy.client.buildType} project. Please use automate project token`);
427
+ } else if (percy.client.screenshotFlow === 'app' && percy.client.buildType !== 'app') {
428
+ throw new Error(`Cannot run App Percy screenshots in ${percy.client.buildType} project. Please use App Percy project token`);
429
+ }
424
430
  // yield to evaluated snapshot resources
425
431
  snapshot.resources = typeof resources === 'function' ? yield* yieldTo(resources()) : resources;
426
432
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@percy/core",
3
- "version": "1.28.0-beta.1",
3
+ "version": "1.28.1-beta.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -43,11 +43,11 @@
43
43
  "test:types": "tsd"
44
44
  },
45
45
  "dependencies": {
46
- "@percy/client": "1.28.0-beta.1",
47
- "@percy/config": "1.28.0-beta.1",
48
- "@percy/dom": "1.28.0-beta.1",
49
- "@percy/logger": "1.28.0-beta.1",
50
- "@percy/webdriver-utils": "1.28.0-beta.1",
46
+ "@percy/client": "1.28.1-beta.0",
47
+ "@percy/config": "1.28.1-beta.0",
48
+ "@percy/dom": "1.28.1-beta.0",
49
+ "@percy/logger": "1.28.1-beta.0",
50
+ "@percy/webdriver-utils": "1.28.1-beta.0",
51
51
  "content-disposition": "^0.5.4",
52
52
  "cross-spawn": "^7.0.3",
53
53
  "extract-zip": "^2.0.1",
@@ -58,5 +58,5 @@
58
58
  "rimraf": "^3.0.2",
59
59
  "ws": "^8.0.0"
60
60
  },
61
- "gitHead": "726fe9b1688c640a4806623d1d34aaafeb79d8c7"
61
+ "gitHead": "648f81742ebf8c6f29ccdfdff77df124e4e1668d"
62
62
  }