@valbuild/shared 0.150.20 → 0.151.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.
Files changed (34) hide show
  1. package/CHANGELOG.md +236 -0
  2. package/client/dist/valbuild-shared-client.cjs.dev.js +1 -1
  3. package/client/dist/valbuild-shared-client.cjs.prod.js +1 -1
  4. package/client/dist/valbuild-shared-client.esm.js +1 -1
  5. package/dist/declarations/src/internal/ApiRoutes.d.ts +253 -2
  6. package/dist/declarations/src/internal/content/applyChain.d.ts +124 -0
  7. package/dist/declarations/src/internal/content/buildRegistry.d.ts +36 -0
  8. package/dist/declarations/src/internal/content/jsonValuesOps.d.ts +110 -0
  9. package/dist/declarations/src/internal/content/moduleStore.d.ts +119 -0
  10. package/dist/declarations/src/internal/content/source.d.ts +71 -0
  11. package/dist/declarations/src/internal/content/version.d.ts +151 -0
  12. package/dist/declarations/src/internal/index.d.ts +8 -1
  13. package/dist/declarations/src/internal/publish/projectSource.d.ts +28 -0
  14. package/dist/declarations/src/internal/search/searchIndex.d.ts +34 -3
  15. package/dist/declarations/src/internal/server/types.d.ts +9 -1
  16. package/dist/declarations/src/internal/valCanvasProtocol.d.ts +46 -0
  17. package/dist/declarations/src/internal/valClientHeader.d.ts +36 -0
  18. package/dist/declarations/src/publish/callJson.d.ts +15 -0
  19. package/dist/declarations/src/publish/jobClient.d.ts +7 -1
  20. package/dist/declarations/src/publish/publishClient.d.ts +2 -14
  21. package/dist/{getSitemapTree-fef55872.esm.js → getSitemapTree-3c1b9e57.esm.js} +18 -2
  22. package/dist/{getSitemapTree-6dfa2f4e.cjs.dev.js → getSitemapTree-59c5ed5d.cjs.dev.js} +18 -2
  23. package/dist/{getSitemapTree-8a04f3cf.cjs.prod.js → getSitemapTree-6b9024d1.cjs.prod.js} +18 -2
  24. package/dist/{protocol-d0efb8cd.cjs.dev.js → projectSource-2a58ef15.cjs.dev.js} +221 -0
  25. package/dist/{protocol-55cfa3cf.esm.js → projectSource-7f0ee83c.esm.js} +216 -1
  26. package/dist/{protocol-b1055ef0.cjs.prod.js → projectSource-ed6aec39.cjs.prod.js} +221 -0
  27. package/internal/dist/valbuild-shared-internal.cjs.dev.js +2387 -189
  28. package/internal/dist/valbuild-shared-internal.cjs.prod.js +2387 -189
  29. package/internal/dist/valbuild-shared-internal.esm.js +2332 -172
  30. package/package.json +3 -3
  31. package/publish/dist/valbuild-shared-publish.cjs.dev.js +48 -155
  32. package/publish/dist/valbuild-shared-publish.cjs.prod.js +48 -155
  33. package/publish/dist/valbuild-shared-publish.esm.js +17 -123
  34. package/dist/declarations/src/internal/server/requestScopedMemo.d.ts +0 -49
@@ -2,112 +2,13 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var projectSource = require('../../dist/projectSource-ed6aec39.cjs.prod.js');
5
6
  var createForOfIteratorHelper = require('../../dist/createForOfIteratorHelper-9ca2078d.cjs.prod.js');
6
7
  var wrapNativeSuper = require('../../dist/wrapNativeSuper-8673414f.cjs.prod.js');
7
- var protocol = require('../../dist/protocol-b1055ef0.cjs.prod.js');
8
8
  var zod = require('zod');
9
9
  var proposalProject = require('../../dist/proposalProject-76caa377.cjs.prod.js');
10
10
  require('zod-validation-error');
11
11
 
12
- /*
13
- * The one JSON call the Studio makes through its own origin's publish proxy,
14
- * and the errors it throws. Apart from `publishClient.ts` (which re-exports
15
- * all three) so that a worker can make the same call without importing the
16
- * publish client's parsers, and `@valbuild/shared` with them.
17
- */
18
-
19
- /**
20
- * Who hears of a refusal's body before it is thrown: the Studio's shell, which
21
- * says a refusal of the project's plan with the next step (`planRefusal.ts` in
22
- * `@valbuild/ui`). One listener; setting it again replaces it.
23
- */
24
- var refusalListener = null;
25
- function onPublishRefusal(listener) {
26
- refusalListener = listener;
27
- }
28
-
29
- /** The publish API refused, and said why. */
30
- var StudioPublishError = /*#__PURE__*/function (_Error) {
31
- function StudioPublishError(statusCode, message, body) {
32
- var _this;
33
- wrapNativeSuper._classCallCheck(this, StudioPublishError);
34
- _this = wrapNativeSuper._callSuper(this, StudioPublishError, [message]);
35
- createForOfIteratorHelper._defineProperty(_this, "statusCode", void 0);
36
- createForOfIteratorHelper._defineProperty(_this, "body", void 0);
37
- _this.name = "StudioPublishError";
38
- _this.statusCode = statusCode;
39
- _this.body = body;
40
- return _this;
41
- }
42
- wrapNativeSuper._inherits(StudioPublishError, _Error);
43
- return wrapNativeSuper._createClass(StudioPublishError);
44
- }(/*#__PURE__*/wrapNativeSuper._wrapNativeSuper(Error));
45
-
46
- /**
47
- * Was this a failure that asking again could get past?
48
- *
49
- * No answer at all (the request never got through) and the answers that mean
50
- * "not now" -- a timeout, too many requests, a server or gateway error. Every
51
- * other status is content answering, and the same request gets the same
52
- * answer.
53
- */
54
- function isTransientPublishError(error) {
55
- if (!(error instanceof StudioPublishError)) return true;
56
- return error.statusCode >= 500 || error.statusCode === 408 || error.statusCode === 429;
57
- }
58
-
59
- /**
60
- * One JSON call through this origin, with the session cookie: its body, or a
61
- * `StudioPublishError` carrying the answer's own message.
62
- */
63
- function callJson(_x, _x2, _x3, _x4) {
64
- return _callJson.apply(this, arguments);
65
- }
66
- function _callJson() {
67
- _callJson = createForOfIteratorHelper._asyncToGenerator(/*#__PURE__*/createForOfIteratorHelper._regenerator().m(function _callee(fetchImpl, url, method, body) {
68
- var res, text, parsed, _refusalListener, message;
69
- return createForOfIteratorHelper._regenerator().w(function (_context) {
70
- while (1) switch (_context.n) {
71
- case 0:
72
- _context.n = 1;
73
- return fetchImpl(url, createForOfIteratorHelper._objectSpread2({
74
- method: method,
75
- // The session cookie is the whole credential this end has.
76
- credentials: "same-origin"
77
- }, body === undefined ? {} : {
78
- headers: {
79
- "Content-Type": "application/json"
80
- },
81
- body: JSON.stringify(body)
82
- }));
83
- case 1:
84
- res = _context.v;
85
- _context.n = 2;
86
- return res.text();
87
- case 2:
88
- text = _context.v;
89
- try {
90
- parsed = text === "" ? undefined : JSON.parse(text);
91
- } catch (_unused) {
92
- parsed = undefined;
93
- }
94
- if (res.ok) {
95
- _context.n = 3;
96
- break;
97
- }
98
- // A publish the plan does not allow (a trial's 3 publishes, a trial that
99
- // ended): the shell says it, with the next step. See `planRefusal`.
100
- (_refusalListener = refusalListener) === null || _refusalListener === void 0 || _refusalListener(parsed);
101
- message = createForOfIteratorHelper._typeof(parsed) === "object" && parsed !== null && "message" in parsed && typeof parsed.message === "string" ? parsed.message : "The publish API answered ".concat(res.status, ".");
102
- throw new StudioPublishError(res.status, message, parsed);
103
- case 3:
104
- return _context.a(2, parsed);
105
- }
106
- }, _callee);
107
- }));
108
- return _callJson.apply(this, arguments);
109
- }
110
-
111
12
  /** An artifact the live build has and this publish re-declares by hash. */
112
13
 
113
14
  /** See {@link StudioPublishClient.publicFiles}. */
@@ -145,26 +46,16 @@ var StudioUploadError = /*#__PURE__*/function (_Error) {
145
46
  function isExpiredSlot(error) {
146
47
  return error instanceof StudioUploadError && error.statusCode === 403;
147
48
  }
148
-
149
- /**
150
- * Where content's publish API is reached: through Val's proxy on this origin
151
- * (`api`, the Studio), or directly (`publishApi`, `<content>/v1`: home's
152
- * upgrade page, whose `fetchImpl` adds the project token).
153
- */
154
-
155
- function publishApiOf(at) {
156
- return "publishApi" in at ? at.publishApi.replace(/\/+$/, "") : "".concat(at.api.replace(/\/+$/, ""), "/publish-api");
157
- }
158
49
  function createStudioPublishClient(options) {
159
50
  var _options$fetchImpl;
160
51
  var fetchImpl = (_options$fetchImpl = options.fetchImpl) !== null && _options$fetchImpl !== void 0 ? _options$fetchImpl : fetch;
161
- var proxy = publishApiOf(options);
52
+ var proxy = projectSource.publishApiOf(options);
162
53
  var call = function call(path, method, body) {
163
- return callJson(fetchImpl, "".concat(proxy).concat(path), method, body);
54
+ return projectSource.callJson(fetchImpl, "".concat(proxy).concat(path), method, body);
164
55
  };
165
56
  var source = null;
166
57
  var readSource = function readSource() {
167
- return source !== null && source !== void 0 ? source : source = call("/project-source", "GET").then(protocol.parseProjectSource);
58
+ return source !== null && source !== void 0 ? source : source = call("/project-source", "GET").then(projectSource.parseProjectSource);
168
59
  };
169
60
  return {
170
61
  buildTarget: function () {
@@ -173,7 +64,7 @@ function createStudioPublishClient(options) {
173
64
  return createForOfIteratorHelper._regenerator().w(function (_context) {
174
65
  while (1) switch (_context.n) {
175
66
  case 0:
176
- _t = protocol.parseBuildTarget;
67
+ _t = projectSource.parseBuildTarget;
177
68
  _context.n = 1;
178
69
  return call("/build-target", "GET");
179
70
  case 1:
@@ -246,7 +137,7 @@ function createStudioPublishClient(options) {
246
137
  return createForOfIteratorHelper._regenerator().w(function (_context4) {
247
138
  while (1) switch (_context4.n) {
248
139
  case 0:
249
- _t2 = protocol.parseDeclare;
140
+ _t2 = projectSource.parseDeclare;
250
141
  _context4.n = 1;
251
142
  return call("/publish", "POST", body);
252
143
  case 1:
@@ -265,7 +156,7 @@ function createStudioPublishClient(options) {
265
156
  return createForOfIteratorHelper._regenerator().w(function (_context5) {
266
157
  while (1) switch (_context5.n) {
267
158
  case 0:
268
- _t3 = protocol.parseArtifacts;
159
+ _t3 = projectSource.parseArtifacts;
269
160
  _context5.n = 1;
270
161
  return call(publishStep(publishId, "artifacts"), "POST");
271
162
  case 1:
@@ -284,7 +175,7 @@ function createStudioPublishClient(options) {
284
175
  return createForOfIteratorHelper._regenerator().w(function (_context6) {
285
176
  while (1) switch (_context6.n) {
286
177
  case 0:
287
- _t4 = protocol.parseVerify;
178
+ _t4 = projectSource.parseVerify;
288
179
  _context6.n = 1;
289
180
  return call(publishStep(publishId, "verify"), "POST");
290
181
  case 1:
@@ -303,7 +194,7 @@ function createStudioPublishClient(options) {
303
194
  return createForOfIteratorHelper._regenerator().w(function (_context7) {
304
195
  while (1) switch (_context7.n) {
305
196
  case 0:
306
- _t5 = protocol.parsePromote;
197
+ _t5 = projectSource.parsePromote;
307
198
  _context7.n = 1;
308
199
  return call(publishStep(publishId, "promote"), "POST");
309
200
  case 1:
@@ -322,7 +213,7 @@ function createStudioPublishClient(options) {
322
213
  return createForOfIteratorHelper._regenerator().w(function (_context8) {
323
214
  while (1) switch (_context8.n) {
324
215
  case 0:
325
- _t6 = protocol.parseStatus;
216
+ _t6 = projectSource.parseStatus;
326
217
  _context8.n = 1;
327
218
  return call(publishStep(publishId), "GET");
328
219
  case 1:
@@ -626,13 +517,13 @@ function _runStudioPublish() {
626
517
  return _context.a(2, {
627
518
  status: "failed",
628
519
  publishId: publishId,
629
- message: _t3 instanceof StudioPublishError || _t3 instanceof Error ? _t3.message : String(_t3),
520
+ message: _t3 instanceof projectSource.StudioPublishError || _t3 instanceof Error ? _t3.message : String(_t3),
630
521
  /*
631
522
  * Content refuses with `{ statusCode, message, details }`, and the
632
523
  * publish routes put EVERY problem in `details`. Without them the editor
633
524
  * reads "This publish cannot be declared" and nothing about why.
634
525
  */
635
- problems: _t3 instanceof StudioPublishError ? problemsOf(_t3.body) : []
526
+ problems: _t3 instanceof projectSource.StudioPublishError ? problemsOf(_t3.body) : []
636
527
  });
637
528
  }
638
529
  }, _callee, null, [[8, 10], [6, 14, 15, 16], [1, 30]]);
@@ -640,7 +531,7 @@ function _runStudioPublish() {
640
531
  return _runStudioPublish.apply(this, arguments);
641
532
  }
642
533
  var problemsOf = function problemsOf(body) {
643
- return createForOfIteratorHelper._typeof(body) === "object" && body !== null && "details" in body ? protocol.parseProblems(body.details) : [];
534
+ return createForOfIteratorHelper._typeof(body) === "object" && body !== null && "details" in body ? projectSource.parseProblems(body.details) : [];
644
535
  };
645
536
 
646
537
  /**
@@ -1546,10 +1437,10 @@ var _excluded = ["buildable"];
1546
1437
  function createStudioJobClient(options) {
1547
1438
  var _options$fetchImpl;
1548
1439
  var fetchImpl = (_options$fetchImpl = options.fetchImpl) !== null && _options$fetchImpl !== void 0 ? _options$fetchImpl : fetch;
1549
- var publishApi = publishApiOf(options);
1440
+ var publishApi = projectSource.publishApiOf(options);
1550
1441
  var proposalsApi = "proposalsApi" in options ? options.proposalsApi.replace(/\/+$/, "") : "".concat(options.api.replace(/\/+$/, ""), "/proposals-api");
1551
1442
  var proxy = function proxy(path, method, body) {
1552
- return callJson(fetchImpl, "".concat(publishApi).concat(path), method, body);
1443
+ return projectSource.callJson(fetchImpl, "".concat(publishApi).concat(path), method, body);
1553
1444
  };
1554
1445
  var job = function job(jobId, step) {
1555
1446
  return "/publish-jobs/".concat(encodeURIComponent(jobId), "/").concat(step);
@@ -1561,7 +1452,7 @@ function createStudioJobClient(options) {
1561
1452
  return createForOfIteratorHelper._regenerator().w(function (_context) {
1562
1453
  while (1) switch (_context.n) {
1563
1454
  case 0:
1564
- _t = protocol.parsePress;
1455
+ _t = projectSource.parsePress;
1565
1456
  _context.n = 1;
1566
1457
  return proxy("/publish-requests", "POST", {
1567
1458
  requestId: requestId,
@@ -1578,25 +1469,27 @@ function createStudioJobClient(options) {
1578
1469
  return press;
1579
1470
  }(),
1580
1471
  pressMerge: function () {
1581
- var _pressMerge = createForOfIteratorHelper._asyncToGenerator(/*#__PURE__*/createForOfIteratorHelper._regenerator().m(function _callee2(proposal, requestId, tab, anyway) {
1472
+ var _pressMerge = createForOfIteratorHelper._asyncToGenerator(/*#__PURE__*/createForOfIteratorHelper._regenerator().m(function _callee2(proposal, requestId, tab, anyway, commitMessage) {
1582
1473
  var _t2;
1583
1474
  return createForOfIteratorHelper._regenerator().w(function (_context2) {
1584
1475
  while (1) switch (_context2.n) {
1585
1476
  case 0:
1586
- _t2 = protocol.parsePress;
1477
+ _t2 = projectSource.parsePress;
1587
1478
  _context2.n = 1;
1588
- return callJson(fetchImpl, "".concat(proposalsApi, "/").concat(encodeURIComponent(proposal), "/merge"), "POST", createForOfIteratorHelper._objectSpread2({
1479
+ return projectSource.callJson(fetchImpl, "".concat(proposalsApi, "/").concat(encodeURIComponent(proposal), "/merge"), "POST", createForOfIteratorHelper._objectSpread2(createForOfIteratorHelper._objectSpread2({
1589
1480
  requestId: requestId,
1590
1481
  tab: tab
1591
1482
  }, anyway !== undefined && anyway.length > 0 ? {
1592
1483
  anyway: anyway
1484
+ } : {}), commitMessage !== undefined && commitMessage.trim() !== "" ? {
1485
+ commitMessage: commitMessage
1593
1486
  } : {}));
1594
1487
  case 1:
1595
1488
  return _context2.a(2, _t2(_context2.v, "POST /v1/proposals/{name}/merge"));
1596
1489
  }
1597
1490
  }, _callee2);
1598
1491
  }));
1599
- function pressMerge(_x3, _x4, _x5, _x6) {
1492
+ function pressMerge(_x3, _x4, _x5, _x6, _x7) {
1600
1493
  return _pressMerge.apply(this, arguments);
1601
1494
  }
1602
1495
  return pressMerge;
@@ -1607,7 +1500,7 @@ function createStudioJobClient(options) {
1607
1500
  return createForOfIteratorHelper._regenerator().w(function (_context3) {
1608
1501
  while (1) switch (_context3.n) {
1609
1502
  case 0:
1610
- _t3 = protocol.parsePress;
1503
+ _t3 = projectSource.parsePress;
1611
1504
  _context3.n = 1;
1612
1505
  return proxy("/publish-requests/try-again", "POST", {
1613
1506
  requestId: requestId,
@@ -1618,7 +1511,7 @@ function createStudioJobClient(options) {
1618
1511
  }
1619
1512
  }, _callee3);
1620
1513
  }));
1621
- function tryAgain(_x7, _x8) {
1514
+ function tryAgain(_x8, _x9) {
1622
1515
  return _tryAgain.apply(this, arguments);
1623
1516
  }
1624
1517
  return tryAgain;
@@ -1629,7 +1522,7 @@ function createStudioJobClient(options) {
1629
1522
  return createForOfIteratorHelper._regenerator().w(function (_context4) {
1630
1523
  while (1) switch (_context4.n) {
1631
1524
  case 0:
1632
- _t4 = protocol.parseRequestStatus;
1525
+ _t4 = projectSource.parseRequestStatus;
1633
1526
  _context4.n = 1;
1634
1527
  return proxy("/publish-requests/".concat(encodeURIComponent(requestId)), "GET");
1635
1528
  case 1:
@@ -1637,7 +1530,7 @@ function createStudioJobClient(options) {
1637
1530
  }
1638
1531
  }, _callee4);
1639
1532
  }));
1640
- function requestStatus(_x9) {
1533
+ function requestStatus(_x0) {
1641
1534
  return _requestStatus.apply(this, arguments);
1642
1535
  }
1643
1536
  return requestStatus;
@@ -1648,7 +1541,7 @@ function createStudioJobClient(options) {
1648
1541
  return createForOfIteratorHelper._regenerator().w(function (_context5) {
1649
1542
  while (1) switch (_context5.n) {
1650
1543
  case 0:
1651
- _t5 = protocol.parseJob;
1544
+ _t5 = projectSource.parseJob;
1652
1545
  _context5.n = 1;
1653
1546
  return proxy("/publish-jobs/next", "POST", {
1654
1547
  tab: tab
@@ -1658,7 +1551,7 @@ function createStudioJobClient(options) {
1658
1551
  }
1659
1552
  }, _callee5);
1660
1553
  }));
1661
- function next(_x0) {
1554
+ function next(_x1) {
1662
1555
  return _next.apply(this, arguments);
1663
1556
  }
1664
1557
  return next;
@@ -1688,7 +1581,7 @@ function createStudioJobClient(options) {
1688
1581
  branch: null,
1689
1582
  buildable: true
1690
1583
  }, merged.target !== undefined ? {
1691
- target: protocol.parseBuildTarget(merged.target)
1584
+ target: projectSource.parseBuildTarget(merged.target)
1692
1585
  } : {}));
1693
1586
  case 2:
1694
1587
  if ("api" in options) {
@@ -1698,7 +1591,7 @@ function createStudioJobClient(options) {
1698
1591
  throw new Error("Only a merge's job can be run here: a site change's job needs the Studio.");
1699
1592
  case 3:
1700
1593
  _context6.n = 4;
1701
- return callJson(fetchImpl, "".concat(options.api.replace(/\/+$/, ""), "/publish-job-prepare"), "POST", {
1594
+ return projectSource.callJson(fetchImpl, "".concat(options.api.replace(/\/+$/, ""), "/publish-job-prepare"), "POST", {
1702
1595
  jobId: tabJob.id,
1703
1596
  tab: tab,
1704
1597
  patchIds: tabJob.patches
@@ -1709,7 +1602,7 @@ function createStudioJobClient(options) {
1709
1602
  }
1710
1603
  }, _callee6);
1711
1604
  }));
1712
- function prepare(_x1, _x10) {
1605
+ function prepare(_x10, _x11) {
1713
1606
  return _prepare.apply(this, arguments);
1714
1607
  }
1715
1608
  return prepare;
@@ -1720,7 +1613,7 @@ function createStudioJobClient(options) {
1720
1613
  return createForOfIteratorHelper._regenerator().w(function (_context7) {
1721
1614
  while (1) switch (_context7.n) {
1722
1615
  case 0:
1723
- _t7 = protocol.parseJob;
1616
+ _t7 = projectSource.parseJob;
1724
1617
  _context7.n = 1;
1725
1618
  return proxy(job(jobId, "steps"), "POST", body);
1726
1619
  case 1:
@@ -1728,7 +1621,7 @@ function createStudioJobClient(options) {
1728
1621
  }
1729
1622
  }, _callee7);
1730
1623
  }));
1731
- function step(_x11, _x12) {
1624
+ function step(_x12, _x13) {
1732
1625
  return _step.apply(this, arguments);
1733
1626
  }
1734
1627
  return step;
@@ -1739,7 +1632,7 @@ function createStudioJobClient(options) {
1739
1632
  return createForOfIteratorHelper._regenerator().w(function (_context8) {
1740
1633
  while (1) switch (_context8.n) {
1741
1634
  case 0:
1742
- _t8 = protocol.parseRenew;
1635
+ _t8 = projectSource.parseRenew;
1743
1636
  _context8.n = 1;
1744
1637
  return proxy(job(jobId, "renew"), "POST", {
1745
1638
  tab: tab
@@ -1749,7 +1642,7 @@ function createStudioJobClient(options) {
1749
1642
  }
1750
1643
  }, _callee8);
1751
1644
  }));
1752
- function renew(_x13, _x14) {
1645
+ function renew(_x14, _x15) {
1753
1646
  return _renew.apply(this, arguments);
1754
1647
  }
1755
1648
  return renew;
@@ -1760,7 +1653,7 @@ function createStudioJobClient(options) {
1760
1653
  return createForOfIteratorHelper._regenerator().w(function (_context9) {
1761
1654
  while (1) switch (_context9.n) {
1762
1655
  case 0:
1763
- _t9 = protocol.parseCancel;
1656
+ _t9 = projectSource.parseCancel;
1764
1657
  _context9.n = 1;
1765
1658
  return proxy(job(jobId, "cancel"), "POST", {});
1766
1659
  case 1:
@@ -1768,7 +1661,7 @@ function createStudioJobClient(options) {
1768
1661
  }
1769
1662
  }, _callee9);
1770
1663
  }));
1771
- function cancel(_x15) {
1664
+ function cancel(_x16) {
1772
1665
  return _cancel.apply(this, arguments);
1773
1666
  }
1774
1667
  return cancel;
@@ -1779,7 +1672,7 @@ function createStudioJobClient(options) {
1779
1672
  return createForOfIteratorHelper._regenerator().w(function (_context0) {
1780
1673
  while (1) switch (_context0.n) {
1781
1674
  case 0:
1782
- _t0 = protocol.parseDiscard;
1675
+ _t0 = projectSource.parseDiscard;
1783
1676
  _context0.n = 1;
1784
1677
  return proxy(job(jobId, "discard"), "POST", {});
1785
1678
  case 1:
@@ -1787,7 +1680,7 @@ function createStudioJobClient(options) {
1787
1680
  }
1788
1681
  }, _callee0);
1789
1682
  }));
1790
- function discard(_x16) {
1683
+ function discard(_x17) {
1791
1684
  return _discard.apply(this, arguments);
1792
1685
  }
1793
1686
  return discard;
@@ -1798,7 +1691,7 @@ function createStudioJobClient(options) {
1798
1691
  return createForOfIteratorHelper._regenerator().w(function (_context1) {
1799
1692
  while (1) switch (_context1.n) {
1800
1693
  case 0:
1801
- _t1 = protocol.parseNewestCiRun;
1694
+ _t1 = projectSource.parseNewestCiRun;
1802
1695
  _context1.n = 1;
1803
1696
  return proxy("/ci-runs/newest", "GET");
1804
1697
  case 1:
@@ -1851,12 +1744,12 @@ var preparedJob = zod.z.object({
1851
1744
  buildable: zod.z["boolean"]().optional()
1852
1745
  });
1853
1746
  function parsePreparedJob(body) {
1854
- var job = protocol.parseJob(body, "POST /api/val/publish-job-prepare").job;
1747
+ var job = projectSource.parseJob(body, "POST /api/val/publish-job-prepare").job;
1855
1748
  var parsed = preparedJob.safeParse(body);
1856
1749
  if (!parsed.success) throw new Error("The server's publish prepare answered with something this Studio cannot read.");
1857
1750
  var _parsed$data = parsed.data,
1858
1751
  buildable = _parsed$data.buildable,
1859
- rest = protocol._objectWithoutProperties(_parsed$data, _excluded);
1752
+ rest = projectSource._objectWithoutProperties(_parsed$data, _excluded);
1860
1753
  return createForOfIteratorHelper._objectSpread2(createForOfIteratorHelper._objectSpread2({
1861
1754
  job: job
1862
1755
  }, rest), {}, {
@@ -1926,7 +1819,7 @@ function _runStudioJob() {
1926
1819
  * reached it, so the tab reports it.
1927
1820
  */
1928
1821
  message = messageOf$1(_t);
1929
- if (_t instanceof StudioPublishError && _t.statusCode === 502) {
1822
+ if (_t instanceof projectSource.StudioPublishError && _t.statusCode === 502) {
1930
1823
  _context.n = 5;
1931
1824
  break;
1932
1825
  }
@@ -3030,6 +2923,11 @@ function contentTypeOf(name) {
3030
2923
  return (_CONTENT_TYPES$extens = CONTENT_TYPES[extension]) !== null && _CONTENT_TYPES$extens !== void 0 ? _CONTENT_TYPES$extens : "application/octet-stream";
3031
2924
  }
3032
2925
 
2926
+ exports.StudioPublishError = projectSource.StudioPublishError;
2927
+ exports.callJson = projectSource.callJson;
2928
+ exports.isTransientPublishError = projectSource.isTransientPublishError;
2929
+ exports.onPublishRefusal = projectSource.onPublishRefusal;
2930
+ exports.publishApiOf = projectSource.publishApiOf;
3033
2931
  exports.proposalProject = proposalProject.proposalProject;
3034
2932
  exports.BUILD_CANCELLED_MESSAGE = BUILD_CANCELLED_MESSAGE;
3035
2933
  exports.DEPLOY_STOPPED_MESSAGE = DEPLOY_STOPPED_MESSAGE;
@@ -3042,24 +2940,19 @@ exports.SERVE_POLL_MS = SERVE_POLL_MS;
3042
2940
  exports.SERVE_WAIT_MS = SERVE_WAIT_MS;
3043
2941
  exports.STUDIO_OUT_OF_DATE = STUDIO_OUT_OF_DATE;
3044
2942
  exports.STUDIO_OUT_OF_DATE_MESSAGE = STUDIO_OUT_OF_DATE_MESSAGE;
3045
- exports.StudioPublishError = StudioPublishError;
3046
2943
  exports.StudioUploadError = StudioUploadError;
3047
2944
  exports.buildProposal = buildProposal;
3048
2945
  exports.buildProposalOnServer = buildProposalOnServer;
3049
2946
  exports.buildQuickPreview = buildQuickPreview;
3050
- exports.callJson = callJson;
3051
2947
  exports.carriedInto = carriedInto;
3052
2948
  exports.clientFilesOf = clientFilesOf;
3053
2949
  exports.createStudioJobClient = createStudioJobClient;
3054
2950
  exports.createStudioPublishClient = createStudioPublishClient;
3055
2951
  exports.isExpiredSlot = isExpiredSlot;
3056
2952
  exports.isMergeChange = isMergeChange;
3057
- exports.isTransientPublishError = isTransientPublishError;
3058
2953
  exports.layerMoved = layerMoved;
3059
2954
  exports.loadedLayer = loadedLayer;
3060
2955
  exports.markStudioOutOfDate = markStudioOutOfDate;
3061
- exports.onPublishRefusal = onPublishRefusal;
3062
- exports.publishApiOf = publishApiOf;
3063
2956
  exports.readLiveLayer = readLiveLayer;
3064
2957
  exports.rememberLoadedLayer = rememberLoadedLayer;
3065
2958
  exports.resetLoadedLayerForTests = resetLoadedLayerForTests;