@floless/app 0.137.0 → 0.137.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.
- package/dist/floless-server.cjs +92 -39
- package/package.json +1 -1
package/dist/floless-server.cjs
CHANGED
|
@@ -55058,7 +55058,7 @@ function appVersion() {
|
|
|
55058
55058
|
return resolveVersion({
|
|
55059
55059
|
isSea: isSea2(),
|
|
55060
55060
|
sqVersionXml: readSqVersionXml(),
|
|
55061
|
-
define: true ? "0.137.
|
|
55061
|
+
define: true ? "0.137.1" : void 0,
|
|
55062
55062
|
pkgVersion: readPkgVersion()
|
|
55063
55063
|
});
|
|
55064
55064
|
}
|
|
@@ -55074,7 +55074,7 @@ function resolveChannel(s) {
|
|
|
55074
55074
|
function appChannel() {
|
|
55075
55075
|
return resolveChannel({
|
|
55076
55076
|
isSea: isSea2(),
|
|
55077
|
-
define: true ? "0.137.
|
|
55077
|
+
define: true ? "0.137.1" : void 0,
|
|
55078
55078
|
// argv[1] is the entry the runtime actually loaded (…/dist/floless-server.cjs), which is what
|
|
55079
55079
|
// carries the npx cache prefix. Absent under the SEA exe, which never reaches the npx branch.
|
|
55080
55080
|
modulePath: process.argv[1]
|
|
@@ -58906,14 +58906,49 @@ function normalisePlanViewIds(doc) {
|
|
|
58906
58906
|
plans: model.plans.map((raw) => needsId(raw) ? { ...raw, id: raw.sheet } : raw)
|
|
58907
58907
|
};
|
|
58908
58908
|
}
|
|
58909
|
+
var hasDerivedId = (plan) => {
|
|
58910
|
+
if (!plan || typeof plan !== "object" || Array.isArray(plan)) return false;
|
|
58911
|
+
const row = plan;
|
|
58912
|
+
return typeof row.sheet === "string" && row.sheet.trim() !== "" && row.id === row.sheet;
|
|
58913
|
+
};
|
|
58914
|
+
function stripDerivedPlanViewIds(doc) {
|
|
58915
|
+
const model = doc;
|
|
58916
|
+
if (!model || typeof model !== "object" || !Array.isArray(model.plans)) return doc;
|
|
58917
|
+
if (typeof model.type === "string" && !model.type.startsWith("steel.model/")) return doc;
|
|
58918
|
+
if (!model.plans.some(hasDerivedId)) return doc;
|
|
58919
|
+
return {
|
|
58920
|
+
...model,
|
|
58921
|
+
plans: model.plans.map((raw) => {
|
|
58922
|
+
if (!hasDerivedId(raw)) return raw;
|
|
58923
|
+
const { id: _derived, ...rest } = raw;
|
|
58924
|
+
return rest;
|
|
58925
|
+
})
|
|
58926
|
+
};
|
|
58927
|
+
}
|
|
58909
58928
|
|
|
58910
58929
|
// project-contract-hash.ts
|
|
58911
58930
|
function contractHash(contract) {
|
|
58912
58931
|
return hashOf(contract);
|
|
58913
58932
|
}
|
|
58914
|
-
function
|
|
58933
|
+
function contractIdentityHash(contract) {
|
|
58934
|
+
return hashOf(stripDerivedPlanViewIds(contract));
|
|
58935
|
+
}
|
|
58936
|
+
function supersededContractIdentityHash(contract) {
|
|
58915
58937
|
return hashOf(normalisePlanViewIds(contract));
|
|
58916
58938
|
}
|
|
58939
|
+
function comparableContractHash(contract) {
|
|
58940
|
+
return contractIdentityHash(contract);
|
|
58941
|
+
}
|
|
58942
|
+
function etagsOf(doc) {
|
|
58943
|
+
if (doc == null) return { current: null, superseded: null };
|
|
58944
|
+
const current = `"${contractIdentityHash(doc)}"`;
|
|
58945
|
+
const superseded = `"${supersededContractIdentityHash(doc)}"`;
|
|
58946
|
+
return { current, superseded: superseded === current ? null : superseded };
|
|
58947
|
+
}
|
|
58948
|
+
function recordedEtagNamesContract(recorded, etags) {
|
|
58949
|
+
if (!recorded) return false;
|
|
58950
|
+
return recorded === etags.current || etags.superseded !== null && recorded === etags.superseded;
|
|
58951
|
+
}
|
|
58917
58952
|
|
|
58918
58953
|
// connection-review-transition.ts
|
|
58919
58954
|
var ConnectionReviewTransitionError = class extends Error {
|
|
@@ -65286,7 +65321,8 @@ var import_node_os24 = require("node:os");
|
|
|
65286
65321
|
// contract-publication.ts
|
|
65287
65322
|
var import_node_fs36 = require("node:fs");
|
|
65288
65323
|
var publicationPath = (path) => `${path}.publication.json`;
|
|
65289
|
-
var tagOf = (contract) => `"${
|
|
65324
|
+
var tagOf = (contract) => `"${contractIdentityHash(contract)}"`;
|
|
65325
|
+
var supersededTagOf = (contract) => `"${supersededContractIdentityHash(contract)}"`;
|
|
65290
65326
|
function valid(value) {
|
|
65291
65327
|
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
65292
65328
|
const row = value;
|
|
@@ -65321,6 +65357,10 @@ function publicationForSnapshot(contractFile, contract) {
|
|
|
65321
65357
|
const etag = tagOf(contract);
|
|
65322
65358
|
const previous = readStored(contractFile);
|
|
65323
65359
|
if (previous?.etag === etag) return { etag, storeRevision: previous.storeRevision };
|
|
65360
|
+
if (previous && previous.etag === supersededTagOf(contract)) {
|
|
65361
|
+
persist(contractFile, { version: 1, etag, storeRevision: previous.storeRevision });
|
|
65362
|
+
return { etag, storeRevision: previous.storeRevision };
|
|
65363
|
+
}
|
|
65324
65364
|
const storeRevision = previous ? previous.storeRevision + 1 : 0;
|
|
65325
65365
|
if (!Number.isSafeInteger(storeRevision)) throw new Error("working-contract storeRevision is exhausted");
|
|
65326
65366
|
persist(contractFile, { version: 1, etag, storeRevision });
|
|
@@ -72274,7 +72314,7 @@ async function runNativeInitialRead(opts) {
|
|
|
72274
72314
|
if (!current || declaredTypeOf(current) !== STEEL_V2 || declaredTypeOf(opts.candidate) !== STEEL_V2) throw new ContractTransactionError(`the first read requires a saved ${STEEL_V2} Drawing Filter shell and candidate`, "contract-type-unsupported");
|
|
72275
72315
|
if (!isExactFilterCheckpointShell(current)) throw new ContractTransactionError("the first read requires the exact zero-model Drawing Filter checkpoint shell", "filter-checkpoint-not-empty");
|
|
72276
72316
|
if (listVersions(opts.projectId).length) throw new ContractTransactionError("the initial read requires empty project history", "history-already-exists");
|
|
72277
|
-
if (
|
|
72317
|
+
if (!recordedEtagNamesContract(opts.filterSavedEtag, etagsOf(current))) throw new ContractTransactionError("the Drawing Filter changed after it was saved", "filter-changed");
|
|
72278
72318
|
const candidate = opts.candidate;
|
|
72279
72319
|
const shell = current;
|
|
72280
72320
|
const checked = validateSteelFilter(candidate, opts.source?.files.map((file) => file.sha256.toLowerCase()));
|
|
@@ -72367,7 +72407,7 @@ async function runNativeRevisionRead(opts) {
|
|
|
72367
72407
|
if (!current || declaredTypeOf(current) !== STEEL_V2 || declaredTypeOf(opts.candidate) !== STEEL_V2) {
|
|
72368
72408
|
throw new ContractTransactionError(`a revision read requires an existing ${STEEL_V2} model and a ${STEEL_V2} candidate`, "contract-type-unsupported");
|
|
72369
72409
|
}
|
|
72370
|
-
if (
|
|
72410
|
+
if (!recordedEtagNamesContract(opts.expectedEtag, etagsOf(current))) {
|
|
72371
72411
|
throw new ContractTransactionError("the model changed while this revision was being confirmed", "contract-changed");
|
|
72372
72412
|
}
|
|
72373
72413
|
if (opts.source?.readAudit) {
|
|
@@ -72753,12 +72793,18 @@ function acceptedContractIdentity(appId, projectId) {
|
|
|
72753
72793
|
ctxFor({ appId, projectId, operation: "read" }, cached.contractType)
|
|
72754
72794
|
);
|
|
72755
72795
|
}
|
|
72756
|
-
return {
|
|
72796
|
+
return {
|
|
72797
|
+
contractType: cached.contractType,
|
|
72798
|
+
contractEtag: cached.contractEtag,
|
|
72799
|
+
contractEtagSuperseded: cached.contractEtagSuperseded
|
|
72800
|
+
};
|
|
72757
72801
|
}
|
|
72758
72802
|
const contract = readAcceptedForRequest(appId, projectId, "read");
|
|
72803
|
+
const tags = etagsOf(contract);
|
|
72759
72804
|
const identity = {
|
|
72760
72805
|
contractType: contract == null ? void 0 : declaredTypeOf(contract),
|
|
72761
|
-
contractEtag:
|
|
72806
|
+
contractEtag: tags.current,
|
|
72807
|
+
contractEtagSuperseded: tags.superseded
|
|
72762
72808
|
};
|
|
72763
72809
|
const after = signature();
|
|
72764
72810
|
if (before === after) {
|
|
@@ -72767,14 +72813,17 @@ function acceptedContractIdentity(appId, projectId) {
|
|
|
72767
72813
|
return identity;
|
|
72768
72814
|
}
|
|
72769
72815
|
}
|
|
72770
|
-
return { contractType: void 0, contractEtag: null };
|
|
72816
|
+
return { contractType: void 0, contractEtag: null, contractEtagSuperseded: null };
|
|
72771
72817
|
}
|
|
72772
72818
|
function etagOf(doc) {
|
|
72773
|
-
return doc == null ? null : `"${
|
|
72819
|
+
return doc == null ? null : `"${contractIdentityHash(doc)}"`;
|
|
72774
72820
|
}
|
|
72775
72821
|
function storeEtag(appId, projectId) {
|
|
72776
72822
|
return etagOf(readContract(appId, projectId));
|
|
72777
72823
|
}
|
|
72824
|
+
function storeEtags(appId, projectId) {
|
|
72825
|
+
return etagsOf(readContract(appId, projectId));
|
|
72826
|
+
}
|
|
72778
72827
|
function storedContractBytesExist(appId, projectId) {
|
|
72779
72828
|
return (0, import_node_fs41.existsSync)(contractPath(appId, projectId));
|
|
72780
72829
|
}
|
|
@@ -72832,7 +72881,7 @@ async function writeContractChecked(appId, doc, projectId, origin) {
|
|
|
72832
72881
|
return withLifecycleLock(kind, key2, () => {
|
|
72833
72882
|
assertServable(projectId);
|
|
72834
72883
|
const current = readContract(appId, projectId);
|
|
72835
|
-
const
|
|
72884
|
+
const currentTags = etagsOf(current);
|
|
72836
72885
|
if (pre.ifNoneMatch === "*" && current != null) {
|
|
72837
72886
|
throw new PreconditionFailedError(
|
|
72838
72887
|
"this store already holds a contract \u2014 GET it and send `If-Match: <the ETag>` as the only precondition to replace it"
|
|
@@ -72844,7 +72893,7 @@ async function writeContractChecked(appId, doc, projectId, origin) {
|
|
|
72844
72893
|
"this store holds no contract to replace \u2014 send `If-None-Match: *` as the only precondition to create one"
|
|
72845
72894
|
);
|
|
72846
72895
|
}
|
|
72847
|
-
if (pre.ifMatch !== "*" && pre.ifMatch
|
|
72896
|
+
if (pre.ifMatch !== "*" && !recordedEtagNamesContract(pre.ifMatch, currentTags)) {
|
|
72848
72897
|
throw new PreconditionFailedError(
|
|
72849
72898
|
"the contract changed since you last read it \u2014 GET it again, re-apply your edit to that document, and write with the new `If-Match: <the ETag>`"
|
|
72850
72899
|
);
|
|
@@ -76409,21 +76458,24 @@ function steelExclusionPreflight(ledger, filter) {
|
|
|
76409
76458
|
}
|
|
76410
76459
|
|
|
76411
76460
|
// revision-request-view.ts
|
|
76412
|
-
function
|
|
76413
|
-
return
|
|
76461
|
+
function contractEtagsOf(facts) {
|
|
76462
|
+
return { current: facts?.contractEtag ?? null, superseded: facts?.contractEtagSuperseded ?? null };
|
|
76414
76463
|
}
|
|
76415
|
-
function
|
|
76416
|
-
return request.
|
|
76464
|
+
function filterCheckpointMatchesCurrent(request, current) {
|
|
76465
|
+
return request.type === "revision-read" && request.settledVersion === void 0 && request.prepassReady === true && request.filterSaved === true && typeof request.filterSavedEtag === "string" && request.filterSavedEtag.length > 0 && recordedEtagNamesContract(request.filterSavedEtag, current);
|
|
76466
|
+
}
|
|
76467
|
+
function filterCheckpointIsCurrent(request, current) {
|
|
76468
|
+
return request.status === "pending" && filterCheckpointMatchesCurrent(request, current);
|
|
76417
76469
|
}
|
|
76418
76470
|
function acceptedContractFacts(appId, projectId) {
|
|
76419
76471
|
try {
|
|
76420
76472
|
return acceptedContractIdentity(appId, projectId);
|
|
76421
76473
|
} catch {
|
|
76422
|
-
return { contractType: void 0, contractEtag: null };
|
|
76474
|
+
return { contractType: void 0, contractEtag: null, contractEtagSuperseded: null };
|
|
76423
76475
|
}
|
|
76424
76476
|
}
|
|
76425
|
-
function
|
|
76426
|
-
return acceptedContractFacts(appId, projectId)
|
|
76477
|
+
function acceptedContractEtags(appId, projectId) {
|
|
76478
|
+
return contractEtagsOf(acceptedContractFacts(appId, projectId));
|
|
76427
76479
|
}
|
|
76428
76480
|
function revisionRequestStageId(request) {
|
|
76429
76481
|
if (request.type !== "revision-read" || request.status !== "staged" || !request.project) return void 0;
|
|
@@ -76436,7 +76488,10 @@ function revisionRequestStageId(request) {
|
|
|
76436
76488
|
function revisionRequestViewFields(request, memo = {}) {
|
|
76437
76489
|
const discard = request.type === "revision-read" && request.status === "staged" ? revisionDiscardPolicyFor(request) : void 0;
|
|
76438
76490
|
const contractFacts = request.type === "revision-read" && request.appId && request.project ? (memo.contractFacts ?? acceptedContractFacts)(request.appId, request.project) : void 0;
|
|
76491
|
+
const etags = contractEtagsOf(contractFacts);
|
|
76492
|
+
const canonicalCheckpointEtag = request.type === "revision-read" && request.appId && request.project && filterCheckpointMatchesCurrent(request, etags) && etags.current ? etags.current : void 0;
|
|
76439
76493
|
return {
|
|
76494
|
+
...canonicalCheckpointEtag ? { filterSavedEtag: canonicalCheckpointEtag } : {},
|
|
76440
76495
|
appTemplateId: request.appId ? (memo.templateId ?? resolveTemplateId)(request.appId) : void 0,
|
|
76441
76496
|
nativeSteelReady: request.type === "revision-read" && request.appId && request.project ? (() => {
|
|
76442
76497
|
const project = getProject(request.project);
|
|
@@ -76448,10 +76503,7 @@ function revisionRequestViewFields(request, memo = {}) {
|
|
|
76448
76503
|
canDiscardRevision: discard?.canClear,
|
|
76449
76504
|
discardWhy: discard?.clearWhy,
|
|
76450
76505
|
discardState: discard?.clearState,
|
|
76451
|
-
filterCheckpointCurrent: request.type === "revision-read" && request.appId && request.project ? filterCheckpointIsCurrent(
|
|
76452
|
-
request,
|
|
76453
|
-
contractFacts?.contractEtag ?? null
|
|
76454
|
-
) : void 0
|
|
76506
|
+
filterCheckpointCurrent: request.type === "revision-read" && request.appId && request.project ? filterCheckpointIsCurrent(request, etags) : void 0
|
|
76455
76507
|
};
|
|
76456
76508
|
}
|
|
76457
76509
|
function enrichedRevisionRequestView(request, extra, memo = {}) {
|
|
@@ -76673,7 +76725,7 @@ function loadAuthoritativeSteelAuditState(project, requestId, attestation, allow
|
|
|
76673
76725
|
})) throw new SteelAuditStateError("steel-source-manifest-changed", "the verified project source bytes no longer match the manifest");
|
|
76674
76726
|
const parsedAttestation = parseSteelReadAttestation(attestation);
|
|
76675
76727
|
const current = readAcceptedForRequest(project.app, project.id, "read");
|
|
76676
|
-
if (!filterCheckpointMatchesCurrent(request,
|
|
76728
|
+
if (!filterCheckpointMatchesCurrent(request, etagsOf(current))) {
|
|
76677
76729
|
throw new SteelAuditStateError("steel-filter-save-missing", "the request has no current exact Filter Save checkpoint");
|
|
76678
76730
|
}
|
|
76679
76731
|
return {
|
|
@@ -76763,7 +76815,7 @@ async function stageForReview(reply, project, requestId, candidate, filterSavedE
|
|
|
76763
76815
|
}
|
|
76764
76816
|
const candidateDoc = candidate;
|
|
76765
76817
|
const currentDoc = current;
|
|
76766
|
-
if (!filterSavedEtag
|
|
76818
|
+
if (!recordedEtagNamesContract(filterSavedEtag, etagsOf(current))) {
|
|
76767
76819
|
return reply.status(409).send({ ok: false, code: "filter-save-changed", error: "the model changed after the Drawing Filter was saved \xE2\u20AC\u201D reload and save it again" });
|
|
76768
76820
|
}
|
|
76769
76821
|
if (contractHash(currentDoc.filter) !== contractHash(candidateDoc.filter)) {
|
|
@@ -77664,8 +77716,8 @@ function registerRevisionRoutes(app, deps = {}) {
|
|
|
77664
77716
|
async (req, reply) => withLifecycleLock("project", req.params.id, async () => {
|
|
77665
77717
|
const project = getProject(req.params.id);
|
|
77666
77718
|
const request = getRequest(req.params.reqId);
|
|
77667
|
-
const
|
|
77668
|
-
if (!project || !request || request.type !== "revision-read" || request.project !== project.id || !filterCheckpointIsCurrent(request,
|
|
77719
|
+
const currentEtags = project ? acceptedContractEtags(project.app, project.id) : { current: null, superseded: null };
|
|
77720
|
+
if (!project || !request || request.type !== "revision-read" || request.project !== project.id || !filterCheckpointIsCurrent(request, currentEtags)) {
|
|
77669
77721
|
return reply.status(404).send({ ok: false, error: "unknown active drawing read" });
|
|
77670
77722
|
}
|
|
77671
77723
|
let progress;
|
|
@@ -77707,9 +77759,11 @@ function registerRevisionRoutes(app, deps = {}) {
|
|
|
77707
77759
|
if (!project || !request || request.type !== "revision-read" || request.project !== project.id || request.status !== "pending" || request.settledVersion !== void 0) {
|
|
77708
77760
|
return reply.status(404).send({ ok: false, error: "unknown pending revision request" });
|
|
77709
77761
|
}
|
|
77710
|
-
const
|
|
77762
|
+
const supplied = typeof req.body?.etag === "string" ? req.body.etag : "";
|
|
77711
77763
|
const current = readAcceptedForRequest(project.app, project.id, "read");
|
|
77712
|
-
|
|
77764
|
+
const currentTags = etagsOf(current);
|
|
77765
|
+
if (!request.prepassReady || !recordedEtagNamesContract(supplied, currentTags) || !hasSteelFilterCheckpoint(current)) return reply.status(409).send({ ok: false, error: "save the populated Steel Filter that this request pre-read before continuing" });
|
|
77766
|
+
const etag = currentTags.current;
|
|
77713
77767
|
if (req.body?.layerSignOff !== void 0) {
|
|
77714
77768
|
return reply.status(400).send({
|
|
77715
77769
|
ok: false,
|
|
@@ -78007,15 +78061,15 @@ function registerRevisionRoutes(app, deps = {}) {
|
|
|
78007
78061
|
error: "resume this read with If-Match set to the ETag recorded by the Steel Filter Save"
|
|
78008
78062
|
});
|
|
78009
78063
|
}
|
|
78010
|
-
|
|
78064
|
+
const liveTags = etagsOf(readAcceptedForRequest(project.app, project.id, "read"));
|
|
78065
|
+
if (!recordedEtagNamesContract(request.filterSavedEtag, liveTags)) {
|
|
78011
78066
|
return reply.status(412).send({
|
|
78012
78067
|
ok: false,
|
|
78013
78068
|
code: "filter-save-changed",
|
|
78014
78069
|
error: "the Steel Filter contract changed after Save \u2014 re-read it before committing this revision"
|
|
78015
78070
|
});
|
|
78016
78071
|
}
|
|
78017
|
-
|
|
78018
|
-
if (!liveEtag || !ifMatchTags.includes(liveEtag)) {
|
|
78072
|
+
if (!ifMatchTags.some((tag) => recordedEtagNamesContract(tag, liveTags))) {
|
|
78019
78073
|
return reply.status(412).send({ ok: false, code: "filter-save-changed", error: "the contract changed after Steel Filter Save \u2014 re-read it before committing this revision" });
|
|
78020
78074
|
}
|
|
78021
78075
|
}
|
|
@@ -78032,7 +78086,7 @@ function registerRevisionRoutes(app, deps = {}) {
|
|
|
78032
78086
|
}
|
|
78033
78087
|
const appTemplateId = resolveTemplateId(project.app);
|
|
78034
78088
|
const candidateType = declaredTypeOf(req.body.contract);
|
|
78035
|
-
if (appTemplateId === "steel-model" && !filterCheckpointMatchesCurrent(request,
|
|
78089
|
+
if (appTemplateId === "steel-model" && !filterCheckpointMatchesCurrent(request, etagsOf(currentForEvidence))) {
|
|
78036
78090
|
return reply.status(409).send({
|
|
78037
78091
|
ok: false,
|
|
78038
78092
|
error: "complete this request's Steel Filter pre-read, then review and Save the Filter before committing the read"
|
|
@@ -79020,7 +79074,7 @@ async function applyReviewVerb(verb, projectId, jointId, expected, ifMatch) {
|
|
|
79020
79074
|
if (!ifMatch) {
|
|
79021
79075
|
throw new PreconditionRequiredError("marking a connection reviewed requires If-Match \u2014 the model generation you looked at");
|
|
79022
79076
|
}
|
|
79023
|
-
if (ifMatch
|
|
79077
|
+
if (!recordedEtagNamesContract(ifMatch, etagsOf(model))) {
|
|
79024
79078
|
throw new ConnectionCommandError(
|
|
79025
79079
|
"the model changed while you were looking at this connection \u2014 reload and check it again before marking it reviewed",
|
|
79026
79080
|
"contract-changed",
|
|
@@ -86906,8 +86960,7 @@ function captureExportSource(projectId, selector = { kind: "latest-approved" },
|
|
|
86906
86960
|
contract = readAcceptedForRequest(project.app, projectId, "read");
|
|
86907
86961
|
if (contract == null) throw new Error("working copy is unavailable");
|
|
86908
86962
|
const manifest = readWorkingRevisionManifest(project);
|
|
86909
|
-
|
|
86910
|
-
if (selector.expectedEtag && selector.expectedEtag !== actualEtag) throw new Error("working copy changed; reload before exporting");
|
|
86963
|
+
if (selector.expectedEtag && !recordedEtagNamesContract(selector.expectedEtag, etagsOf(contract))) throw new Error("working copy changed; reload before exporting");
|
|
86911
86964
|
if (selector.expectedEpoch !== void 0 && selector.expectedEpoch !== manifest?.epoch) throw new Error("working revision changed; reload before exporting");
|
|
86912
86965
|
kind = "working";
|
|
86913
86966
|
sourceRef = manifest?.revisionId ?? hashOf(contract).slice(0, 12);
|
|
@@ -100272,12 +100325,12 @@ async function startServer() {
|
|
|
100272
100325
|
}
|
|
100273
100326
|
const current = readAcceptedForRequest(project.app, project.id, "read");
|
|
100274
100327
|
if (current == null) return reply.status(409).send({ ok: false, error: "the current working copy is unreadable" });
|
|
100275
|
-
const
|
|
100328
|
+
const actualEtags = storeEtags(project.app, project.id);
|
|
100276
100329
|
const suppliedEpoch = req.body && Object.prototype.hasOwnProperty.call(req.body, "expectedEpoch") ? req.body.expectedEpoch : void 0;
|
|
100277
100330
|
if (typeof req.body?.expectedEtag !== "string" || suppliedEpoch !== null && (!Number.isInteger(Number(suppliedEpoch)) || Number(suppliedEpoch) < 0)) {
|
|
100278
100331
|
return reply.status(428).send({ ok: false, error: "Reload History and send the working ETag and revision epoch." });
|
|
100279
100332
|
}
|
|
100280
|
-
if (req.body.expectedEtag
|
|
100333
|
+
if (!recordedEtagNamesContract(req.body.expectedEtag, actualEtags)) {
|
|
100281
100334
|
return reply.status(409).send({ ok: false, error: "The working copy changed. Reload History before starting." });
|
|
100282
100335
|
}
|
|
100283
100336
|
const observedManifest = readWorkingRevisionManifest(project);
|
|
@@ -100351,7 +100404,7 @@ async function startServer() {
|
|
|
100351
100404
|
if (typeof req.body?.expectedEtag !== "string" || suppliedEpoch !== null && (!Number.isInteger(Number(suppliedEpoch)) || Number(suppliedEpoch) < 0)) {
|
|
100352
100405
|
return reply.status(428).send({ ok: false, error: "Reload Saved work and send the working ETag and revision epoch." });
|
|
100353
100406
|
}
|
|
100354
|
-
if (req.body.expectedEtag
|
|
100407
|
+
if (!recordedEtagNamesContract(req.body.expectedEtag, storeEtags(project.app, project.id))) return reply.status(409).send({ ok: false, error: "The working copy changed. Reload Saved work." });
|
|
100355
100408
|
const observedManifest = readWorkingRevisionManifest(project);
|
|
100356
100409
|
if ((observedManifest?.epoch ?? null) !== (suppliedEpoch === null ? null : Number(suppliedEpoch))) return reply.status(409).send({ ok: false, error: "The working revision changed. Reload Saved work." });
|
|
100357
100410
|
const publicationIdentity = saved.publicationIdentity;
|