@valbuild/shared 0.146.0 → 0.146.4
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/CHANGELOG.md +38 -0
- package/client/dist/valbuild-shared-client.cjs.dev.js +1 -1
- package/client/dist/valbuild-shared-client.cjs.prod.js +1 -1
- package/client/dist/valbuild-shared-client.esm.js +1 -1
- package/dist/declarations/src/internal/ApiRoutes.d.ts +57 -0
- package/dist/declarations/src/internal/index.d.ts +1 -0
- package/dist/declarations/src/internal/patchSets/selectionClosure.d.ts +23 -0
- package/dist/declarations/src/internal/publish/contentApi.d.ts +10 -0
- package/dist/declarations/src/internal/resolveSchemaSourceFixes.d.ts +3 -2
- package/dist/declarations/src/internal/valCanvasProtocol.d.ts +14 -5
- package/dist/{getSitemapTree-0ed3deac.cjs.prod.js → getSitemapTree-95b00d3f.cjs.dev.js} +22 -4
- package/dist/{getSitemapTree-c732e09a.cjs.dev.js → getSitemapTree-b8dce0e2.cjs.prod.js} +22 -4
- package/dist/{getSitemapTree-6fcdf745.esm.js → getSitemapTree-e65acefe.esm.js} +22 -4
- package/internal/dist/valbuild-shared-internal.cjs.dev.js +234 -6
- package/internal/dist/valbuild-shared-internal.cjs.prod.js +234 -6
- package/internal/dist/valbuild-shared-internal.esm.js +234 -8
- package/package.json +2 -2
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var getSitemapTree = require('../../dist/getSitemapTree-
|
|
5
|
+
var getSitemapTree = require('../../dist/getSitemapTree-95b00d3f.cjs.dev.js');
|
|
6
6
|
var core = require('@valbuild/core');
|
|
7
7
|
var zod = require('zod');
|
|
8
8
|
var zodValidationError = require('zod-validation-error');
|
|
@@ -1618,7 +1618,7 @@ var ValConfig = zod.z.object({
|
|
|
1618
1618
|
gitCommit: zod.z.string().optional(),
|
|
1619
1619
|
gitBranch: zod.z.string().optional()
|
|
1620
1620
|
});
|
|
1621
|
-
var ValidationFixZ = zod.z.union([zod.z.literal("image:add-metadata"), zod.z.literal("image:check-metadata"), zod.z.literal("image:check-remote"), zod.z.literal("image:upload-remote"), zod.z.literal("image:download-remote"), zod.z.literal("images:check-remote"), zod.z.literal("images:upload-remote"), zod.z.literal("file:add-metadata"), zod.z.literal("video:add-metadata"), zod.z.literal("video:upload-remote"), zod.z.literal("video:download-remote"), zod.z.literal("videos:add-metadata"), zod.z.literal("videos:check-remote"), zod.z.literal("videos:upload-remote"), zod.z.literal("file:check-metadata"), zod.z.literal("file:check-remote"), zod.z.literal("file:upload-remote"), zod.z.literal("file:download-remote"), zod.z.literal("files:check-remote"), zod.z.literal("files:upload-remote"), zod.z.literal("keyof:check-keys"), zod.z.literal("router:check-route"), zod.z.literal("locale:check-locale"), zod.z.literal("record:fill-keys"), zod.z.literal("images:check-unique-folder"), zod.z.literal("files:check-unique-folder"), zod.z.literal("images:check-all-files"), zod.z.literal("files:check-all-files"), zod.z.literal("videos:check-unique-folder"), zod.z.literal("videos:check-all-files"), zod.z.literal("jsonValues:extract-entry"), zod.z.literal("view:check-module")]);
|
|
1621
|
+
var ValidationFixZ = zod.z.union([zod.z.literal("image:add-metadata"), zod.z.literal("image:check-metadata"), zod.z.literal("image:check-remote"), zod.z.literal("image:upload-remote"), zod.z.literal("image:download-remote"), zod.z.literal("images:check-remote"), zod.z.literal("images:upload-remote"), zod.z.literal("file:add-metadata"), zod.z.literal("video:add-metadata"), zod.z.literal("video:upload-remote"), zod.z.literal("video:download-remote"), zod.z.literal("videos:add-metadata"), zod.z.literal("videos:check-remote"), zod.z.literal("videos:upload-remote"), zod.z.literal("file:check-metadata"), zod.z.literal("file:check-remote"), zod.z.literal("file:upload-remote"), zod.z.literal("file:download-remote"), zod.z.literal("files:check-remote"), zod.z.literal("files:upload-remote"), zod.z.literal("keyof:check-keys"), zod.z.literal("image:check-gallery"), zod.z.literal("file:check-gallery"), zod.z.literal("video:check-gallery"), zod.z.literal("router:check-route"), zod.z.literal("locale:check-locale"), zod.z.literal("record:fill-keys"), zod.z.literal("images:check-unique-folder"), zod.z.literal("files:check-unique-folder"), zod.z.literal("images:check-all-files"), zod.z.literal("files:check-all-files"), zod.z.literal("videos:check-unique-folder"), zod.z.literal("videos:check-all-files"), zod.z.literal("jsonValues:extract-entry"), zod.z.literal("view:check-module")]);
|
|
1622
1622
|
var ValidationError = zod.z.object({
|
|
1623
1623
|
message: zod.z.string(),
|
|
1624
1624
|
value: zod.z.unknown().optional(),
|
|
@@ -2871,6 +2871,66 @@ var Api = {
|
|
|
2871
2871
|
})])
|
|
2872
2872
|
}
|
|
2873
2873
|
},
|
|
2874
|
+
/**
|
|
2875
|
+
* Publish selected (`docs/plans/remove-patch-groups.md`, Phase 4), its first
|
|
2876
|
+
* half, on the site's own server: the changes picked in Review, already
|
|
2877
|
+
* closed into whole patch sets (`selectionClosure`), moved into a proposal
|
|
2878
|
+
* of kind `publish` and saved there -- prepared over the site's head, which
|
|
2879
|
+
* the proposal is based on, so a publish landing in between is refused
|
|
2880
|
+
* rather than reverted. The second half is that proposal's Publish, pressed
|
|
2881
|
+
* as any proposal's is (`publishProposal`); this server answers its checks
|
|
2882
|
+
* and press with what the merge moves, as the proposal's own address would.
|
|
2883
|
+
*/
|
|
2884
|
+
"/publish-selected": {
|
|
2885
|
+
POST: {
|
|
2886
|
+
req: {
|
|
2887
|
+
body: zod.z.object({
|
|
2888
|
+
/** The changes to publish, whole patch sets, in any order: a move keeps the chain's. */
|
|
2889
|
+
patchIds: zod.z.array(PatchId).min(1),
|
|
2890
|
+
/** What the merged proposal is listed as. */
|
|
2891
|
+
displayName: zod.z.string().min(1).max(200),
|
|
2892
|
+
/** The press's own id: the same press sent again is the same proposal. */
|
|
2893
|
+
requestId: zod.z.string().regex(/^[A-Za-z0-9_-]{1,100}$/)
|
|
2894
|
+
}),
|
|
2895
|
+
cookies: {
|
|
2896
|
+
val_session: zod.z.string().optional()
|
|
2897
|
+
}
|
|
2898
|
+
},
|
|
2899
|
+
res: zod.z.union([unauthorizedResponse, zod.z.object({
|
|
2900
|
+
status: zod.z.literal(400),
|
|
2901
|
+
json: GenericError
|
|
2902
|
+
}),
|
|
2903
|
+
/**
|
|
2904
|
+
* Refused: the site moved (`headMoved`: pressing again prepares over
|
|
2905
|
+
* the new head), a change went, or this deployment cannot.
|
|
2906
|
+
*/
|
|
2907
|
+
zod.z.object({
|
|
2908
|
+
status: zod.z.literal(409),
|
|
2909
|
+
json: GenericError.extend({
|
|
2910
|
+
headMoved: zod.z.literal(true).optional()
|
|
2911
|
+
})
|
|
2912
|
+
}), zod.z.object({
|
|
2913
|
+
status: zod.z.literal(500),
|
|
2914
|
+
json: GenericError
|
|
2915
|
+
}),
|
|
2916
|
+
/**
|
|
2917
|
+
* The proposal was made and its changes moved into it, and the save
|
|
2918
|
+
* there failed: they are safe in it, which `proposal` names.
|
|
2919
|
+
*/
|
|
2920
|
+
zod.z.object({
|
|
2921
|
+
status: zod.z.literal(502),
|
|
2922
|
+
json: GenericError.extend({
|
|
2923
|
+
proposal: zod.z.string()
|
|
2924
|
+
})
|
|
2925
|
+
}), zod.z.object({
|
|
2926
|
+
status: zod.z.literal(200),
|
|
2927
|
+
json: zod.z.object({
|
|
2928
|
+
/** The proposal to publish next. */
|
|
2929
|
+
proposal: zod.z.string()
|
|
2930
|
+
})
|
|
2931
|
+
})])
|
|
2932
|
+
}
|
|
2933
|
+
},
|
|
2874
2934
|
"/save": {
|
|
2875
2935
|
POST: {
|
|
2876
2936
|
req: {
|
|
@@ -4790,7 +4850,7 @@ function declaredLocales(snapshot) {
|
|
|
4790
4850
|
* these has to resolve all of them, and the two that leaked did so by adding a
|
|
4791
4851
|
* fix here and not to a condition somewhere else.
|
|
4792
4852
|
*/
|
|
4793
|
-
var SCHEMA_SOURCE_FIXES = ["keyof:check-keys", "router:check-route", "locale:check-locale", "record:fill-keys"];
|
|
4853
|
+
var SCHEMA_SOURCE_FIXES = ["keyof:check-keys", "image:check-gallery", "file:check-gallery", "video:check-gallery", "router:check-route", "locale:check-locale", "record:fill-keys"];
|
|
4794
4854
|
|
|
4795
4855
|
/** Whether an error is a marker only the whole project can answer. */
|
|
4796
4856
|
function isSchemaSourceFixError(error) {
|
|
@@ -4801,8 +4861,9 @@ function isSchemaSourceFixError(error) {
|
|
|
4801
4861
|
}
|
|
4802
4862
|
|
|
4803
4863
|
/**
|
|
4804
|
-
* The record a `keyof:check-keys` error resolves against
|
|
4805
|
-
*
|
|
4864
|
+
* The record a `keyof:check-keys` error resolves against -- or a gallery
|
|
4865
|
+
* marker's (`image:check-gallery` and the rest): its gallery module -- or null
|
|
4866
|
+
* for any other error, including a malformed marker, which
|
|
4806
4867
|
* {@link resolveSchemaSourceFixForError} reports and this has nothing to say
|
|
4807
4868
|
* about.
|
|
4808
4869
|
*
|
|
@@ -4812,6 +4873,12 @@ function isSchemaSourceFixError(error) {
|
|
|
4812
4873
|
*/
|
|
4813
4874
|
function keyOfRecordPath(error) {
|
|
4814
4875
|
var _error$fixes2;
|
|
4876
|
+
// A gallery-backed field's marker reads its gallery the same way: the
|
|
4877
|
+
// record whose keys say whether the field's path is there.
|
|
4878
|
+
var gallery = core.Internal.media.galleryMarkerOf(error);
|
|
4879
|
+
if (gallery !== null) {
|
|
4880
|
+
return gallery.gallery;
|
|
4881
|
+
}
|
|
4815
4882
|
if (!((_error$fixes2 = error.fixes) !== null && _error$fixes2 !== void 0 ? _error$fixes2 : []).includes("keyof:check-keys")) {
|
|
4816
4883
|
return null;
|
|
4817
4884
|
}
|
|
@@ -4833,6 +4900,37 @@ function keyOfRecordPath(error) {
|
|
|
4833
4900
|
function resolveSchemaSourceFixForError(error, snapshot) {
|
|
4834
4901
|
var _error$fixes3;
|
|
4835
4902
|
var fixes = (_error$fixes3 = error.fixes) !== null && _error$fixes3 !== void 0 ? _error$fixes3 : [];
|
|
4903
|
+
var gallery = core.Internal.media.galleryMarkerOf(error);
|
|
4904
|
+
if (gallery !== null) {
|
|
4905
|
+
// The gallery as it is now -- with what a pending change, a save in a
|
|
4906
|
+
// proposal or a content-only publish added -- not as the schema was built.
|
|
4907
|
+
var entries = getKeyOfRecordAt(gallery.gallery, snapshot).source;
|
|
4908
|
+
var has = getSitemapTree._typeof(entries) === "object" && entries !== null && !Array.isArray(entries) && core.Internal.media.galleryKeyOf(gallery.path, function (key) {
|
|
4909
|
+
return key in entries;
|
|
4910
|
+
}) !== null;
|
|
4911
|
+
if (has) {
|
|
4912
|
+
return {
|
|
4913
|
+
status: "resolved"
|
|
4914
|
+
};
|
|
4915
|
+
}
|
|
4916
|
+
return {
|
|
4917
|
+
status: "remaining",
|
|
4918
|
+
error: getSitemapTree._objectSpread2(getSitemapTree._objectSpread2({}, error), {}, {
|
|
4919
|
+
value: gallery.source,
|
|
4920
|
+
fixes: undefined
|
|
4921
|
+
})
|
|
4922
|
+
};
|
|
4923
|
+
}
|
|
4924
|
+
if (fixes.includes("image:check-gallery") || fixes.includes("file:check-gallery") || fixes.includes("video:check-gallery")) {
|
|
4925
|
+
return {
|
|
4926
|
+
status: "remaining",
|
|
4927
|
+
error: getSitemapTree._objectSpread2(getSitemapTree._objectSpread2({}, error), {}, {
|
|
4928
|
+
message: "".concat(error.message, " The gallery could not be read from this error. ").concat(TYPE_ERROR_MESSAGE),
|
|
4929
|
+
typeError: true,
|
|
4930
|
+
fixes: undefined
|
|
4931
|
+
})
|
|
4932
|
+
};
|
|
4933
|
+
}
|
|
4836
4934
|
if (fixes.includes("keyof:check-keys")) {
|
|
4837
4935
|
if (!error.value) {
|
|
4838
4936
|
return {
|
|
@@ -6124,6 +6222,9 @@ function isSkippableFixCode(fix) {
|
|
|
6124
6222
|
// also took them off the publish gate, so a broken key published unseen.
|
|
6125
6223
|
return false;
|
|
6126
6224
|
case "keyof:check-keys":
|
|
6225
|
+
case "image:check-gallery":
|
|
6226
|
+
case "file:check-gallery":
|
|
6227
|
+
case "video:check-gallery":
|
|
6127
6228
|
case "router:check-route":
|
|
6128
6229
|
case "locale:check-locale":
|
|
6129
6230
|
case "record:fill-keys":
|
|
@@ -7757,7 +7858,12 @@ var requestStatus = zod.z.union([zod.z.object({
|
|
|
7757
7858
|
kind: zod.z.literal("failed"),
|
|
7758
7859
|
message: zod.z.string(),
|
|
7759
7860
|
actions: zod.z.array(zod.z["enum"](["try-again", "discard", "re-run-build"])),
|
|
7760
|
-
job: zod.z.string()
|
|
7861
|
+
job: zod.z.string(),
|
|
7862
|
+
movedTo: zod.z.object({
|
|
7863
|
+
proposal: zod.z.string(),
|
|
7864
|
+
displayName: zod.z.string(),
|
|
7865
|
+
changes: zod.z.number()
|
|
7866
|
+
}).optional()
|
|
7761
7867
|
}), zod.z.object({
|
|
7762
7868
|
kind: zod.z.literal("cancelled")
|
|
7763
7869
|
}), zod.z.object({
|
|
@@ -8276,6 +8382,126 @@ var PatchSets = /*#__PURE__*/function () {
|
|
|
8276
8382
|
}]);
|
|
8277
8383
|
}();
|
|
8278
8384
|
|
|
8385
|
+
/**
|
|
8386
|
+
* Patch sets that share a change become one: a change is never split.
|
|
8387
|
+
*
|
|
8388
|
+
* Shared by the two places that move changes between branches a whole set at
|
|
8389
|
+
* a time -- the merge moving the site's conflicting pending changes
|
|
8390
|
+
* (`changesToMove` in `@valbuild/server`) and Publish selected
|
|
8391
|
+
* ({@link selectionClosure}) -- so that they agree on what "a whole set" is.
|
|
8392
|
+
*/
|
|
8393
|
+
function joinSharedChanges(sets) {
|
|
8394
|
+
var groups = [];
|
|
8395
|
+
var _iterator = getSitemapTree._createForOfIteratorHelper(sets),
|
|
8396
|
+
_step;
|
|
8397
|
+
try {
|
|
8398
|
+
var _loop = function _loop() {
|
|
8399
|
+
var set = _step.value;
|
|
8400
|
+
var joined = new Set(set);
|
|
8401
|
+
var _iterator2 = getSitemapTree._createForOfIteratorHelper(groups.filter(function (g) {
|
|
8402
|
+
return set.some(function (id) {
|
|
8403
|
+
return g.has(id);
|
|
8404
|
+
});
|
|
8405
|
+
})),
|
|
8406
|
+
_step2;
|
|
8407
|
+
try {
|
|
8408
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
8409
|
+
var group = _step2.value;
|
|
8410
|
+
var _iterator3 = getSitemapTree._createForOfIteratorHelper(group),
|
|
8411
|
+
_step3;
|
|
8412
|
+
try {
|
|
8413
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
8414
|
+
var id = _step3.value;
|
|
8415
|
+
joined.add(id);
|
|
8416
|
+
}
|
|
8417
|
+
} catch (err) {
|
|
8418
|
+
_iterator3.e(err);
|
|
8419
|
+
} finally {
|
|
8420
|
+
_iterator3.f();
|
|
8421
|
+
}
|
|
8422
|
+
groups.splice(groups.indexOf(group), 1);
|
|
8423
|
+
}
|
|
8424
|
+
} catch (err) {
|
|
8425
|
+
_iterator2.e(err);
|
|
8426
|
+
} finally {
|
|
8427
|
+
_iterator2.f();
|
|
8428
|
+
}
|
|
8429
|
+
groups.push(joined);
|
|
8430
|
+
};
|
|
8431
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
8432
|
+
_loop();
|
|
8433
|
+
}
|
|
8434
|
+
} catch (err) {
|
|
8435
|
+
_iterator.e(err);
|
|
8436
|
+
} finally {
|
|
8437
|
+
_iterator.f();
|
|
8438
|
+
}
|
|
8439
|
+
return groups;
|
|
8440
|
+
}
|
|
8441
|
+
|
|
8442
|
+
/**
|
|
8443
|
+
* What publishing `selected` publishes: every change in every patch set a
|
|
8444
|
+
* selected change is in, sets that share a change joined
|
|
8445
|
+
* (valbuild/val `docs/plans/remove-patch-groups.md`, Phase 4, rule 2).
|
|
8446
|
+
*
|
|
8447
|
+
* A patch set is changes that do not apply without each other, so a selection
|
|
8448
|
+
* of part of one cannot be published on its own. What it pulls in is someone
|
|
8449
|
+
* else's as often as not; the caller says whose, before anything moves.
|
|
8450
|
+
*
|
|
8451
|
+
* In the order of `patchIds` -- the chain's -- with nothing that is not in it.
|
|
8452
|
+
*/
|
|
8453
|
+
function selectionClosure(patchSets, selected, patchIds) {
|
|
8454
|
+
var wanted = new Set(selected);
|
|
8455
|
+
var closed = new Set();
|
|
8456
|
+
var _iterator4 = getSitemapTree._createForOfIteratorHelper(joinSharedChanges(patchSets.map(function (set) {
|
|
8457
|
+
return set.patches.map(function (patch) {
|
|
8458
|
+
return patch.patchId;
|
|
8459
|
+
});
|
|
8460
|
+
}))),
|
|
8461
|
+
_step4;
|
|
8462
|
+
try {
|
|
8463
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
8464
|
+
var group = _step4.value;
|
|
8465
|
+
if (_toConsumableArray(group).some(function (id) {
|
|
8466
|
+
return wanted.has(id);
|
|
8467
|
+
})) {
|
|
8468
|
+
var _iterator6 = getSitemapTree._createForOfIteratorHelper(group),
|
|
8469
|
+
_step6;
|
|
8470
|
+
try {
|
|
8471
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
8472
|
+
var id = _step6.value;
|
|
8473
|
+
closed.add(id);
|
|
8474
|
+
}
|
|
8475
|
+
} catch (err) {
|
|
8476
|
+
_iterator6.e(err);
|
|
8477
|
+
} finally {
|
|
8478
|
+
_iterator6.f();
|
|
8479
|
+
}
|
|
8480
|
+
}
|
|
8481
|
+
}
|
|
8482
|
+
// A selected change no patch set knows of is its own set.
|
|
8483
|
+
} catch (err) {
|
|
8484
|
+
_iterator4.e(err);
|
|
8485
|
+
} finally {
|
|
8486
|
+
_iterator4.f();
|
|
8487
|
+
}
|
|
8488
|
+
var _iterator5 = getSitemapTree._createForOfIteratorHelper(wanted),
|
|
8489
|
+
_step5;
|
|
8490
|
+
try {
|
|
8491
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
8492
|
+
var _id = _step5.value;
|
|
8493
|
+
closed.add(_id);
|
|
8494
|
+
}
|
|
8495
|
+
} catch (err) {
|
|
8496
|
+
_iterator5.e(err);
|
|
8497
|
+
} finally {
|
|
8498
|
+
_iterator5.f();
|
|
8499
|
+
}
|
|
8500
|
+
return patchIds.filter(function (id) {
|
|
8501
|
+
return closed.has(id);
|
|
8502
|
+
});
|
|
8503
|
+
}
|
|
8504
|
+
|
|
8279
8505
|
/**
|
|
8280
8506
|
* Update from the site, for a proposal with code (valbuild/home
|
|
8281
8507
|
* `docs/hosted-publishing.md` step 8.2, slice 1b): what content hands over,
|
|
@@ -8486,6 +8712,7 @@ exports.isMimeTypeAccepted = isMimeTypeAccepted;
|
|
|
8486
8712
|
exports.isRemoteSchema = isRemoteSchema;
|
|
8487
8713
|
exports.isSchemaSourceFixError = isSchemaSourceFixError;
|
|
8488
8714
|
exports.isSkippedSource = isSkippedSource;
|
|
8715
|
+
exports.joinSharedChanges = joinSharedChanges;
|
|
8489
8716
|
exports.keyOfRecordPath = keyOfRecordPath;
|
|
8490
8717
|
exports.levenshtein = levenshtein;
|
|
8491
8718
|
exports.localeAt = localeAt;
|
|
@@ -8523,6 +8750,7 @@ exports.richTextToRemirror = richTextToRemirror;
|
|
|
8523
8750
|
exports.safeParsePatch = safeParsePatch;
|
|
8524
8751
|
exports.schemaErrorsOf = schemaErrorsOf;
|
|
8525
8752
|
exports.schemaTypesOfPath = schemaTypesOfPath;
|
|
8753
|
+
exports.selectionClosure = selectionClosure;
|
|
8526
8754
|
exports.sideFiles = sideFiles;
|
|
8527
8755
|
exports.sideSource = sideSource;
|
|
8528
8756
|
exports.sourcePathOfChild = sourcePathOfChild;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var getSitemapTree = require('../../dist/getSitemapTree-
|
|
5
|
+
var getSitemapTree = require('../../dist/getSitemapTree-b8dce0e2.cjs.prod.js');
|
|
6
6
|
var core = require('@valbuild/core');
|
|
7
7
|
var zod = require('zod');
|
|
8
8
|
var zodValidationError = require('zod-validation-error');
|
|
@@ -1618,7 +1618,7 @@ var ValConfig = zod.z.object({
|
|
|
1618
1618
|
gitCommit: zod.z.string().optional(),
|
|
1619
1619
|
gitBranch: zod.z.string().optional()
|
|
1620
1620
|
});
|
|
1621
|
-
var ValidationFixZ = zod.z.union([zod.z.literal("image:add-metadata"), zod.z.literal("image:check-metadata"), zod.z.literal("image:check-remote"), zod.z.literal("image:upload-remote"), zod.z.literal("image:download-remote"), zod.z.literal("images:check-remote"), zod.z.literal("images:upload-remote"), zod.z.literal("file:add-metadata"), zod.z.literal("video:add-metadata"), zod.z.literal("video:upload-remote"), zod.z.literal("video:download-remote"), zod.z.literal("videos:add-metadata"), zod.z.literal("videos:check-remote"), zod.z.literal("videos:upload-remote"), zod.z.literal("file:check-metadata"), zod.z.literal("file:check-remote"), zod.z.literal("file:upload-remote"), zod.z.literal("file:download-remote"), zod.z.literal("files:check-remote"), zod.z.literal("files:upload-remote"), zod.z.literal("keyof:check-keys"), zod.z.literal("router:check-route"), zod.z.literal("locale:check-locale"), zod.z.literal("record:fill-keys"), zod.z.literal("images:check-unique-folder"), zod.z.literal("files:check-unique-folder"), zod.z.literal("images:check-all-files"), zod.z.literal("files:check-all-files"), zod.z.literal("videos:check-unique-folder"), zod.z.literal("videos:check-all-files"), zod.z.literal("jsonValues:extract-entry"), zod.z.literal("view:check-module")]);
|
|
1621
|
+
var ValidationFixZ = zod.z.union([zod.z.literal("image:add-metadata"), zod.z.literal("image:check-metadata"), zod.z.literal("image:check-remote"), zod.z.literal("image:upload-remote"), zod.z.literal("image:download-remote"), zod.z.literal("images:check-remote"), zod.z.literal("images:upload-remote"), zod.z.literal("file:add-metadata"), zod.z.literal("video:add-metadata"), zod.z.literal("video:upload-remote"), zod.z.literal("video:download-remote"), zod.z.literal("videos:add-metadata"), zod.z.literal("videos:check-remote"), zod.z.literal("videos:upload-remote"), zod.z.literal("file:check-metadata"), zod.z.literal("file:check-remote"), zod.z.literal("file:upload-remote"), zod.z.literal("file:download-remote"), zod.z.literal("files:check-remote"), zod.z.literal("files:upload-remote"), zod.z.literal("keyof:check-keys"), zod.z.literal("image:check-gallery"), zod.z.literal("file:check-gallery"), zod.z.literal("video:check-gallery"), zod.z.literal("router:check-route"), zod.z.literal("locale:check-locale"), zod.z.literal("record:fill-keys"), zod.z.literal("images:check-unique-folder"), zod.z.literal("files:check-unique-folder"), zod.z.literal("images:check-all-files"), zod.z.literal("files:check-all-files"), zod.z.literal("videos:check-unique-folder"), zod.z.literal("videos:check-all-files"), zod.z.literal("jsonValues:extract-entry"), zod.z.literal("view:check-module")]);
|
|
1622
1622
|
var ValidationError = zod.z.object({
|
|
1623
1623
|
message: zod.z.string(),
|
|
1624
1624
|
value: zod.z.unknown().optional(),
|
|
@@ -2871,6 +2871,66 @@ var Api = {
|
|
|
2871
2871
|
})])
|
|
2872
2872
|
}
|
|
2873
2873
|
},
|
|
2874
|
+
/**
|
|
2875
|
+
* Publish selected (`docs/plans/remove-patch-groups.md`, Phase 4), its first
|
|
2876
|
+
* half, on the site's own server: the changes picked in Review, already
|
|
2877
|
+
* closed into whole patch sets (`selectionClosure`), moved into a proposal
|
|
2878
|
+
* of kind `publish` and saved there -- prepared over the site's head, which
|
|
2879
|
+
* the proposal is based on, so a publish landing in between is refused
|
|
2880
|
+
* rather than reverted. The second half is that proposal's Publish, pressed
|
|
2881
|
+
* as any proposal's is (`publishProposal`); this server answers its checks
|
|
2882
|
+
* and press with what the merge moves, as the proposal's own address would.
|
|
2883
|
+
*/
|
|
2884
|
+
"/publish-selected": {
|
|
2885
|
+
POST: {
|
|
2886
|
+
req: {
|
|
2887
|
+
body: zod.z.object({
|
|
2888
|
+
/** The changes to publish, whole patch sets, in any order: a move keeps the chain's. */
|
|
2889
|
+
patchIds: zod.z.array(PatchId).min(1),
|
|
2890
|
+
/** What the merged proposal is listed as. */
|
|
2891
|
+
displayName: zod.z.string().min(1).max(200),
|
|
2892
|
+
/** The press's own id: the same press sent again is the same proposal. */
|
|
2893
|
+
requestId: zod.z.string().regex(/^[A-Za-z0-9_-]{1,100}$/)
|
|
2894
|
+
}),
|
|
2895
|
+
cookies: {
|
|
2896
|
+
val_session: zod.z.string().optional()
|
|
2897
|
+
}
|
|
2898
|
+
},
|
|
2899
|
+
res: zod.z.union([unauthorizedResponse, zod.z.object({
|
|
2900
|
+
status: zod.z.literal(400),
|
|
2901
|
+
json: GenericError
|
|
2902
|
+
}),
|
|
2903
|
+
/**
|
|
2904
|
+
* Refused: the site moved (`headMoved`: pressing again prepares over
|
|
2905
|
+
* the new head), a change went, or this deployment cannot.
|
|
2906
|
+
*/
|
|
2907
|
+
zod.z.object({
|
|
2908
|
+
status: zod.z.literal(409),
|
|
2909
|
+
json: GenericError.extend({
|
|
2910
|
+
headMoved: zod.z.literal(true).optional()
|
|
2911
|
+
})
|
|
2912
|
+
}), zod.z.object({
|
|
2913
|
+
status: zod.z.literal(500),
|
|
2914
|
+
json: GenericError
|
|
2915
|
+
}),
|
|
2916
|
+
/**
|
|
2917
|
+
* The proposal was made and its changes moved into it, and the save
|
|
2918
|
+
* there failed: they are safe in it, which `proposal` names.
|
|
2919
|
+
*/
|
|
2920
|
+
zod.z.object({
|
|
2921
|
+
status: zod.z.literal(502),
|
|
2922
|
+
json: GenericError.extend({
|
|
2923
|
+
proposal: zod.z.string()
|
|
2924
|
+
})
|
|
2925
|
+
}), zod.z.object({
|
|
2926
|
+
status: zod.z.literal(200),
|
|
2927
|
+
json: zod.z.object({
|
|
2928
|
+
/** The proposal to publish next. */
|
|
2929
|
+
proposal: zod.z.string()
|
|
2930
|
+
})
|
|
2931
|
+
})])
|
|
2932
|
+
}
|
|
2933
|
+
},
|
|
2874
2934
|
"/save": {
|
|
2875
2935
|
POST: {
|
|
2876
2936
|
req: {
|
|
@@ -4790,7 +4850,7 @@ function declaredLocales(snapshot) {
|
|
|
4790
4850
|
* these has to resolve all of them, and the two that leaked did so by adding a
|
|
4791
4851
|
* fix here and not to a condition somewhere else.
|
|
4792
4852
|
*/
|
|
4793
|
-
var SCHEMA_SOURCE_FIXES = ["keyof:check-keys", "router:check-route", "locale:check-locale", "record:fill-keys"];
|
|
4853
|
+
var SCHEMA_SOURCE_FIXES = ["keyof:check-keys", "image:check-gallery", "file:check-gallery", "video:check-gallery", "router:check-route", "locale:check-locale", "record:fill-keys"];
|
|
4794
4854
|
|
|
4795
4855
|
/** Whether an error is a marker only the whole project can answer. */
|
|
4796
4856
|
function isSchemaSourceFixError(error) {
|
|
@@ -4801,8 +4861,9 @@ function isSchemaSourceFixError(error) {
|
|
|
4801
4861
|
}
|
|
4802
4862
|
|
|
4803
4863
|
/**
|
|
4804
|
-
* The record a `keyof:check-keys` error resolves against
|
|
4805
|
-
*
|
|
4864
|
+
* The record a `keyof:check-keys` error resolves against -- or a gallery
|
|
4865
|
+
* marker's (`image:check-gallery` and the rest): its gallery module -- or null
|
|
4866
|
+
* for any other error, including a malformed marker, which
|
|
4806
4867
|
* {@link resolveSchemaSourceFixForError} reports and this has nothing to say
|
|
4807
4868
|
* about.
|
|
4808
4869
|
*
|
|
@@ -4812,6 +4873,12 @@ function isSchemaSourceFixError(error) {
|
|
|
4812
4873
|
*/
|
|
4813
4874
|
function keyOfRecordPath(error) {
|
|
4814
4875
|
var _error$fixes2;
|
|
4876
|
+
// A gallery-backed field's marker reads its gallery the same way: the
|
|
4877
|
+
// record whose keys say whether the field's path is there.
|
|
4878
|
+
var gallery = core.Internal.media.galleryMarkerOf(error);
|
|
4879
|
+
if (gallery !== null) {
|
|
4880
|
+
return gallery.gallery;
|
|
4881
|
+
}
|
|
4815
4882
|
if (!((_error$fixes2 = error.fixes) !== null && _error$fixes2 !== void 0 ? _error$fixes2 : []).includes("keyof:check-keys")) {
|
|
4816
4883
|
return null;
|
|
4817
4884
|
}
|
|
@@ -4833,6 +4900,37 @@ function keyOfRecordPath(error) {
|
|
|
4833
4900
|
function resolveSchemaSourceFixForError(error, snapshot) {
|
|
4834
4901
|
var _error$fixes3;
|
|
4835
4902
|
var fixes = (_error$fixes3 = error.fixes) !== null && _error$fixes3 !== void 0 ? _error$fixes3 : [];
|
|
4903
|
+
var gallery = core.Internal.media.galleryMarkerOf(error);
|
|
4904
|
+
if (gallery !== null) {
|
|
4905
|
+
// The gallery as it is now -- with what a pending change, a save in a
|
|
4906
|
+
// proposal or a content-only publish added -- not as the schema was built.
|
|
4907
|
+
var entries = getKeyOfRecordAt(gallery.gallery, snapshot).source;
|
|
4908
|
+
var has = getSitemapTree._typeof(entries) === "object" && entries !== null && !Array.isArray(entries) && core.Internal.media.galleryKeyOf(gallery.path, function (key) {
|
|
4909
|
+
return key in entries;
|
|
4910
|
+
}) !== null;
|
|
4911
|
+
if (has) {
|
|
4912
|
+
return {
|
|
4913
|
+
status: "resolved"
|
|
4914
|
+
};
|
|
4915
|
+
}
|
|
4916
|
+
return {
|
|
4917
|
+
status: "remaining",
|
|
4918
|
+
error: getSitemapTree._objectSpread2(getSitemapTree._objectSpread2({}, error), {}, {
|
|
4919
|
+
value: gallery.source,
|
|
4920
|
+
fixes: undefined
|
|
4921
|
+
})
|
|
4922
|
+
};
|
|
4923
|
+
}
|
|
4924
|
+
if (fixes.includes("image:check-gallery") || fixes.includes("file:check-gallery") || fixes.includes("video:check-gallery")) {
|
|
4925
|
+
return {
|
|
4926
|
+
status: "remaining",
|
|
4927
|
+
error: getSitemapTree._objectSpread2(getSitemapTree._objectSpread2({}, error), {}, {
|
|
4928
|
+
message: "".concat(error.message, " The gallery could not be read from this error. ").concat(TYPE_ERROR_MESSAGE),
|
|
4929
|
+
typeError: true,
|
|
4930
|
+
fixes: undefined
|
|
4931
|
+
})
|
|
4932
|
+
};
|
|
4933
|
+
}
|
|
4836
4934
|
if (fixes.includes("keyof:check-keys")) {
|
|
4837
4935
|
if (!error.value) {
|
|
4838
4936
|
return {
|
|
@@ -6124,6 +6222,9 @@ function isSkippableFixCode(fix) {
|
|
|
6124
6222
|
// also took them off the publish gate, so a broken key published unseen.
|
|
6125
6223
|
return false;
|
|
6126
6224
|
case "keyof:check-keys":
|
|
6225
|
+
case "image:check-gallery":
|
|
6226
|
+
case "file:check-gallery":
|
|
6227
|
+
case "video:check-gallery":
|
|
6127
6228
|
case "router:check-route":
|
|
6128
6229
|
case "locale:check-locale":
|
|
6129
6230
|
case "record:fill-keys":
|
|
@@ -7757,7 +7858,12 @@ var requestStatus = zod.z.union([zod.z.object({
|
|
|
7757
7858
|
kind: zod.z.literal("failed"),
|
|
7758
7859
|
message: zod.z.string(),
|
|
7759
7860
|
actions: zod.z.array(zod.z["enum"](["try-again", "discard", "re-run-build"])),
|
|
7760
|
-
job: zod.z.string()
|
|
7861
|
+
job: zod.z.string(),
|
|
7862
|
+
movedTo: zod.z.object({
|
|
7863
|
+
proposal: zod.z.string(),
|
|
7864
|
+
displayName: zod.z.string(),
|
|
7865
|
+
changes: zod.z.number()
|
|
7866
|
+
}).optional()
|
|
7761
7867
|
}), zod.z.object({
|
|
7762
7868
|
kind: zod.z.literal("cancelled")
|
|
7763
7869
|
}), zod.z.object({
|
|
@@ -8276,6 +8382,126 @@ var PatchSets = /*#__PURE__*/function () {
|
|
|
8276
8382
|
}]);
|
|
8277
8383
|
}();
|
|
8278
8384
|
|
|
8385
|
+
/**
|
|
8386
|
+
* Patch sets that share a change become one: a change is never split.
|
|
8387
|
+
*
|
|
8388
|
+
* Shared by the two places that move changes between branches a whole set at
|
|
8389
|
+
* a time -- the merge moving the site's conflicting pending changes
|
|
8390
|
+
* (`changesToMove` in `@valbuild/server`) and Publish selected
|
|
8391
|
+
* ({@link selectionClosure}) -- so that they agree on what "a whole set" is.
|
|
8392
|
+
*/
|
|
8393
|
+
function joinSharedChanges(sets) {
|
|
8394
|
+
var groups = [];
|
|
8395
|
+
var _iterator = getSitemapTree._createForOfIteratorHelper(sets),
|
|
8396
|
+
_step;
|
|
8397
|
+
try {
|
|
8398
|
+
var _loop = function _loop() {
|
|
8399
|
+
var set = _step.value;
|
|
8400
|
+
var joined = new Set(set);
|
|
8401
|
+
var _iterator2 = getSitemapTree._createForOfIteratorHelper(groups.filter(function (g) {
|
|
8402
|
+
return set.some(function (id) {
|
|
8403
|
+
return g.has(id);
|
|
8404
|
+
});
|
|
8405
|
+
})),
|
|
8406
|
+
_step2;
|
|
8407
|
+
try {
|
|
8408
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
8409
|
+
var group = _step2.value;
|
|
8410
|
+
var _iterator3 = getSitemapTree._createForOfIteratorHelper(group),
|
|
8411
|
+
_step3;
|
|
8412
|
+
try {
|
|
8413
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
8414
|
+
var id = _step3.value;
|
|
8415
|
+
joined.add(id);
|
|
8416
|
+
}
|
|
8417
|
+
} catch (err) {
|
|
8418
|
+
_iterator3.e(err);
|
|
8419
|
+
} finally {
|
|
8420
|
+
_iterator3.f();
|
|
8421
|
+
}
|
|
8422
|
+
groups.splice(groups.indexOf(group), 1);
|
|
8423
|
+
}
|
|
8424
|
+
} catch (err) {
|
|
8425
|
+
_iterator2.e(err);
|
|
8426
|
+
} finally {
|
|
8427
|
+
_iterator2.f();
|
|
8428
|
+
}
|
|
8429
|
+
groups.push(joined);
|
|
8430
|
+
};
|
|
8431
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
8432
|
+
_loop();
|
|
8433
|
+
}
|
|
8434
|
+
} catch (err) {
|
|
8435
|
+
_iterator.e(err);
|
|
8436
|
+
} finally {
|
|
8437
|
+
_iterator.f();
|
|
8438
|
+
}
|
|
8439
|
+
return groups;
|
|
8440
|
+
}
|
|
8441
|
+
|
|
8442
|
+
/**
|
|
8443
|
+
* What publishing `selected` publishes: every change in every patch set a
|
|
8444
|
+
* selected change is in, sets that share a change joined
|
|
8445
|
+
* (valbuild/val `docs/plans/remove-patch-groups.md`, Phase 4, rule 2).
|
|
8446
|
+
*
|
|
8447
|
+
* A patch set is changes that do not apply without each other, so a selection
|
|
8448
|
+
* of part of one cannot be published on its own. What it pulls in is someone
|
|
8449
|
+
* else's as often as not; the caller says whose, before anything moves.
|
|
8450
|
+
*
|
|
8451
|
+
* In the order of `patchIds` -- the chain's -- with nothing that is not in it.
|
|
8452
|
+
*/
|
|
8453
|
+
function selectionClosure(patchSets, selected, patchIds) {
|
|
8454
|
+
var wanted = new Set(selected);
|
|
8455
|
+
var closed = new Set();
|
|
8456
|
+
var _iterator4 = getSitemapTree._createForOfIteratorHelper(joinSharedChanges(patchSets.map(function (set) {
|
|
8457
|
+
return set.patches.map(function (patch) {
|
|
8458
|
+
return patch.patchId;
|
|
8459
|
+
});
|
|
8460
|
+
}))),
|
|
8461
|
+
_step4;
|
|
8462
|
+
try {
|
|
8463
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
8464
|
+
var group = _step4.value;
|
|
8465
|
+
if (_toConsumableArray(group).some(function (id) {
|
|
8466
|
+
return wanted.has(id);
|
|
8467
|
+
})) {
|
|
8468
|
+
var _iterator6 = getSitemapTree._createForOfIteratorHelper(group),
|
|
8469
|
+
_step6;
|
|
8470
|
+
try {
|
|
8471
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
8472
|
+
var id = _step6.value;
|
|
8473
|
+
closed.add(id);
|
|
8474
|
+
}
|
|
8475
|
+
} catch (err) {
|
|
8476
|
+
_iterator6.e(err);
|
|
8477
|
+
} finally {
|
|
8478
|
+
_iterator6.f();
|
|
8479
|
+
}
|
|
8480
|
+
}
|
|
8481
|
+
}
|
|
8482
|
+
// A selected change no patch set knows of is its own set.
|
|
8483
|
+
} catch (err) {
|
|
8484
|
+
_iterator4.e(err);
|
|
8485
|
+
} finally {
|
|
8486
|
+
_iterator4.f();
|
|
8487
|
+
}
|
|
8488
|
+
var _iterator5 = getSitemapTree._createForOfIteratorHelper(wanted),
|
|
8489
|
+
_step5;
|
|
8490
|
+
try {
|
|
8491
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
8492
|
+
var _id = _step5.value;
|
|
8493
|
+
closed.add(_id);
|
|
8494
|
+
}
|
|
8495
|
+
} catch (err) {
|
|
8496
|
+
_iterator5.e(err);
|
|
8497
|
+
} finally {
|
|
8498
|
+
_iterator5.f();
|
|
8499
|
+
}
|
|
8500
|
+
return patchIds.filter(function (id) {
|
|
8501
|
+
return closed.has(id);
|
|
8502
|
+
});
|
|
8503
|
+
}
|
|
8504
|
+
|
|
8279
8505
|
/**
|
|
8280
8506
|
* Update from the site, for a proposal with code (valbuild/home
|
|
8281
8507
|
* `docs/hosted-publishing.md` step 8.2, slice 1b): what content hands over,
|
|
@@ -8486,6 +8712,7 @@ exports.isMimeTypeAccepted = isMimeTypeAccepted;
|
|
|
8486
8712
|
exports.isRemoteSchema = isRemoteSchema;
|
|
8487
8713
|
exports.isSchemaSourceFixError = isSchemaSourceFixError;
|
|
8488
8714
|
exports.isSkippedSource = isSkippedSource;
|
|
8715
|
+
exports.joinSharedChanges = joinSharedChanges;
|
|
8489
8716
|
exports.keyOfRecordPath = keyOfRecordPath;
|
|
8490
8717
|
exports.levenshtein = levenshtein;
|
|
8491
8718
|
exports.localeAt = localeAt;
|
|
@@ -8523,6 +8750,7 @@ exports.richTextToRemirror = richTextToRemirror;
|
|
|
8523
8750
|
exports.safeParsePatch = safeParsePatch;
|
|
8524
8751
|
exports.schemaErrorsOf = schemaErrorsOf;
|
|
8525
8752
|
exports.schemaTypesOfPath = schemaTypesOfPath;
|
|
8753
|
+
exports.selectionClosure = selectionClosure;
|
|
8526
8754
|
exports.sideFiles = sideFiles;
|
|
8527
8755
|
exports.sideSource = sideSource;
|
|
8528
8756
|
exports.sourcePathOfChild = sourcePathOfChild;
|