@neocompose/cli 0.58.3 → 0.59.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/neo.mjs
CHANGED
|
@@ -6424,10 +6424,10 @@ var init_strict_resolver = __esm({
|
|
|
6424
6424
|
this.project = projectIndex ?? createProjectIndex(context.project);
|
|
6425
6425
|
this.source = syntax?.source.text;
|
|
6426
6426
|
this.sourceTokens = syntax?.roots;
|
|
6427
|
-
const
|
|
6427
|
+
const unknown = { kind: "primitive", name: "unknown" };
|
|
6428
6428
|
this.thisVariable = variable(
|
|
6429
6429
|
"__this__",
|
|
6430
|
-
context.thisClass ??
|
|
6430
|
+
context.thisClass ?? unknown,
|
|
6431
6431
|
void 0,
|
|
6432
6432
|
this.project
|
|
6433
6433
|
);
|
|
@@ -6436,7 +6436,7 @@ var init_strict_resolver = __esm({
|
|
|
6436
6436
|
);
|
|
6437
6437
|
this.rootVariable = variable(
|
|
6438
6438
|
"__root__",
|
|
6439
|
-
rootSymbol?.type ??
|
|
6439
|
+
rootSymbol?.type ?? unknown,
|
|
6440
6440
|
void 0,
|
|
6441
6441
|
this.project
|
|
6442
6442
|
);
|
|
@@ -34352,13 +34352,13 @@ function spellingQuickFixes(document, diagnostic) {
|
|
|
34352
34352
|
}
|
|
34353
34353
|
function diagnosticMisspelling(diagnostic) {
|
|
34354
34354
|
if (/to initialize\b/.test(diagnostic.message)) return null;
|
|
34355
|
-
const
|
|
34355
|
+
const unknown = /Unknown (identifier|function) '([^']+)'/.exec(
|
|
34356
34356
|
diagnostic.message
|
|
34357
34357
|
);
|
|
34358
|
-
if (
|
|
34358
|
+
if (unknown?.[2]) {
|
|
34359
34359
|
return {
|
|
34360
|
-
name:
|
|
34361
|
-
kind:
|
|
34360
|
+
name: unknown[2],
|
|
34361
|
+
kind: unknown[1] === "function" ? "callable" : "value"
|
|
34362
34362
|
};
|
|
34363
34363
|
}
|
|
34364
34364
|
const member = /has no (?:static )?(?:callable )?member '([^']+)'/.exec(
|
|
@@ -35759,10 +35759,10 @@ function optionalTestConfig(value) {
|
|
|
35759
35759
|
"maxWorkers",
|
|
35760
35760
|
"forbidOnly"
|
|
35761
35761
|
]);
|
|
35762
|
-
const
|
|
35763
|
-
if (
|
|
35762
|
+
const unknown = Object.keys(config).find((key) => !allowed.has(key));
|
|
35763
|
+
if (unknown !== void 0) {
|
|
35764
35764
|
throw new Error(
|
|
35765
|
-
`"${NEO_CONFIG_FILE}" field "test.${
|
|
35765
|
+
`"${NEO_CONFIG_FILE}" field "test.${unknown}" is not recognized.`
|
|
35766
35766
|
);
|
|
35767
35767
|
}
|
|
35768
35768
|
const stringArray2 = (field) => {
|
|
@@ -41696,6 +41696,50 @@ var init_record_adapters = __esm({
|
|
|
41696
41696
|
}
|
|
41697
41697
|
});
|
|
41698
41698
|
|
|
41699
|
+
// ../packages/manifest/src/value-graph.ts
|
|
41700
|
+
function encodeStoredValueNode(node) {
|
|
41701
|
+
if (node.nodeType === "initializer") return { init: { code: node.code } };
|
|
41702
|
+
return {
|
|
41703
|
+
value: node.value,
|
|
41704
|
+
classId: node.classId,
|
|
41705
|
+
...node.constructorArgs === void 0 ? {} : { constructorArgs: node.constructorArgs },
|
|
41706
|
+
...node.instanceConstructorId === void 0 ? {} : { instanceConstructorId: node.instanceConstructorId },
|
|
41707
|
+
...node.instanceVariantId === void 0 ? {} : { instanceVariantId: node.instanceVariantId },
|
|
41708
|
+
...node.instanceVariantRowValueId === void 0 ? {} : { instanceVariantRowValueId: node.instanceVariantRowValueId }
|
|
41709
|
+
};
|
|
41710
|
+
}
|
|
41711
|
+
function encodeStoredValueRowFields(row) {
|
|
41712
|
+
return {
|
|
41713
|
+
...encodeStoredValueNode(row),
|
|
41714
|
+
...row.containerId === void 0 ? {} : { containerId: row.containerId },
|
|
41715
|
+
...row.genericBindings === void 0 ? {} : { genericBindings: row.genericBindings },
|
|
41716
|
+
...row.sourceValueId === void 0 ? {} : { sourceValueId: row.sourceValueId }
|
|
41717
|
+
};
|
|
41718
|
+
}
|
|
41719
|
+
function canonicalInstanceProvenanceViolation(value) {
|
|
41720
|
+
const constructorArgs = "constructorArgs" in value ? value.constructorArgs : void 0;
|
|
41721
|
+
const constructorId = "instanceConstructorId" in value ? value.instanceConstructorId : void 0;
|
|
41722
|
+
const variantId = "instanceVariantId" in value ? value.instanceVariantId : void 0;
|
|
41723
|
+
if (constructorArgs !== void 0 && constructorId === void 0 && typeof variantId !== "string") {
|
|
41724
|
+
return "constructor-args-without-stamp";
|
|
41725
|
+
}
|
|
41726
|
+
if (typeof constructorId === "string" && constructorArgs === void 0) {
|
|
41727
|
+
return "named-constructor-without-args";
|
|
41728
|
+
}
|
|
41729
|
+
if (constructorId === null && constructorArgs !== void 0 && typeof constructorArgs === "object" && constructorArgs !== null && !Array.isArray(constructorArgs) && Object.keys(constructorArgs).length > 0) {
|
|
41730
|
+
return "implicit-constructor-with-args";
|
|
41731
|
+
}
|
|
41732
|
+
if ("instanceVariantRowValueId" in value && typeof value.instanceVariantRowValueId === "string" && typeof variantId !== "string") {
|
|
41733
|
+
return "variant-row-without-variant";
|
|
41734
|
+
}
|
|
41735
|
+
return null;
|
|
41736
|
+
}
|
|
41737
|
+
var init_value_graph = __esm({
|
|
41738
|
+
"../packages/manifest/src/value-graph.ts"() {
|
|
41739
|
+
"use strict";
|
|
41740
|
+
}
|
|
41741
|
+
});
|
|
41742
|
+
|
|
41699
41743
|
// node_modules/valibot/dist/index.mjs
|
|
41700
41744
|
// @__NO_SIDE_EFFECTS__
|
|
41701
41745
|
function getGlobalConfig(config$1) {
|
|
@@ -42408,23 +42452,6 @@ function union(options, message$1) {
|
|
|
42408
42452
|
};
|
|
42409
42453
|
}
|
|
42410
42454
|
// @__NO_SIDE_EFFECTS__
|
|
42411
|
-
function unknown() {
|
|
42412
|
-
return {
|
|
42413
|
-
kind: "schema",
|
|
42414
|
-
type: "unknown",
|
|
42415
|
-
reference: unknown,
|
|
42416
|
-
expects: "unknown",
|
|
42417
|
-
async: false,
|
|
42418
|
-
get "~standard"() {
|
|
42419
|
-
return /* @__PURE__ */ _getStandardProps(this);
|
|
42420
|
-
},
|
|
42421
|
-
"~run"(dataset) {
|
|
42422
|
-
dataset.typed = true;
|
|
42423
|
-
return dataset;
|
|
42424
|
-
}
|
|
42425
|
-
};
|
|
42426
|
-
}
|
|
42427
|
-
// @__NO_SIDE_EFFECTS__
|
|
42428
42455
|
function variant(key, options, message$1) {
|
|
42429
42456
|
return {
|
|
42430
42457
|
kind: "schema",
|
|
@@ -42539,108 +42566,6 @@ var init_dist = __esm({
|
|
|
42539
42566
|
}
|
|
42540
42567
|
});
|
|
42541
42568
|
|
|
42542
|
-
// ../packages/manifest/src/value-graph.ts
|
|
42543
|
-
function encodeStoredValueNode(node) {
|
|
42544
|
-
if (node.nodeType === "initializer") return { init: { code: node.code } };
|
|
42545
|
-
return {
|
|
42546
|
-
value: node.value,
|
|
42547
|
-
classId: node.classId,
|
|
42548
|
-
...node.constructorArgs === void 0 ? {} : { constructorArgs: node.constructorArgs },
|
|
42549
|
-
...node.instanceConstructorId === void 0 ? {} : { instanceConstructorId: node.instanceConstructorId },
|
|
42550
|
-
...node.instanceVariantId === void 0 ? {} : { instanceVariantId: node.instanceVariantId },
|
|
42551
|
-
...node.instanceVariantRowValueId === void 0 ? {} : { instanceVariantRowValueId: node.instanceVariantRowValueId }
|
|
42552
|
-
};
|
|
42553
|
-
}
|
|
42554
|
-
function encodeStoredValueRowFields(row) {
|
|
42555
|
-
return {
|
|
42556
|
-
...encodeStoredValueNode(row),
|
|
42557
|
-
...row.containerId === void 0 ? {} : { containerId: row.containerId },
|
|
42558
|
-
...row.genericBindings === void 0 ? {} : { genericBindings: row.genericBindings },
|
|
42559
|
-
...row.sourceValueId === void 0 ? {} : { sourceValueId: row.sourceValueId }
|
|
42560
|
-
};
|
|
42561
|
-
}
|
|
42562
|
-
function canonicalInstanceProvenanceViolation(value) {
|
|
42563
|
-
const constructorArgs = "constructorArgs" in value ? value.constructorArgs : void 0;
|
|
42564
|
-
const constructorId = "instanceConstructorId" in value ? value.instanceConstructorId : void 0;
|
|
42565
|
-
const variantId = "instanceVariantId" in value ? value.instanceVariantId : void 0;
|
|
42566
|
-
if (constructorArgs !== void 0 && constructorId === void 0 && typeof variantId !== "string") {
|
|
42567
|
-
return "constructor-args-without-stamp";
|
|
42568
|
-
}
|
|
42569
|
-
if (typeof constructorId === "string" && constructorArgs === void 0) {
|
|
42570
|
-
return "named-constructor-without-args";
|
|
42571
|
-
}
|
|
42572
|
-
if (constructorId === null && constructorArgs !== void 0 && typeof constructorArgs === "object" && constructorArgs !== null && !Array.isArray(constructorArgs) && Object.keys(constructorArgs).length > 0) {
|
|
42573
|
-
return "implicit-constructor-with-args";
|
|
42574
|
-
}
|
|
42575
|
-
if ("instanceVariantRowValueId" in value && typeof value.instanceVariantRowValueId === "string" && typeof variantId !== "string") {
|
|
42576
|
-
return "variant-row-without-variant";
|
|
42577
|
-
}
|
|
42578
|
-
return null;
|
|
42579
|
-
}
|
|
42580
|
-
var nonEmptyString, nullableId, optionalNullableId, stringMap, unknownMap, instanceProvenanceEntries, literalValueNodeEntries, initializerValueNodeEntries, literalValueNodeSchema, initializerValueNodeSchema, valueRowEntries, AuthoredValueRowSchema, valueSeedEntries, AuthoredValueSeedSchema, BindingMemberSchema, LocalizedTextSchema;
|
|
42581
|
-
var init_value_graph = __esm({
|
|
42582
|
-
"../packages/manifest/src/value-graph.ts"() {
|
|
42583
|
-
"use strict";
|
|
42584
|
-
init_dist();
|
|
42585
|
-
nonEmptyString = pipe(string3(), nonEmpty());
|
|
42586
|
-
nullableId = nullable(nonEmptyString);
|
|
42587
|
-
optionalNullableId = optional(nullableId);
|
|
42588
|
-
stringMap = record3(string3(), nonEmptyString);
|
|
42589
|
-
unknownMap = record3(string3(), unknown());
|
|
42590
|
-
instanceProvenanceEntries = {
|
|
42591
|
-
constructorArgs: optional(unknownMap),
|
|
42592
|
-
instanceConstructorId: optionalNullableId,
|
|
42593
|
-
instanceVariantId: optionalNullableId,
|
|
42594
|
-
instanceVariantRowValueId: optionalNullableId
|
|
42595
|
-
};
|
|
42596
|
-
literalValueNodeEntries = {
|
|
42597
|
-
nodeType: literal2("literal"),
|
|
42598
|
-
value: unknown(),
|
|
42599
|
-
classId: nullable(string3()),
|
|
42600
|
-
...instanceProvenanceEntries
|
|
42601
|
-
};
|
|
42602
|
-
initializerValueNodeEntries = {
|
|
42603
|
-
nodeType: literal2("initializer"),
|
|
42604
|
-
code: nonEmptyString
|
|
42605
|
-
};
|
|
42606
|
-
literalValueNodeSchema = strictObject(literalValueNodeEntries);
|
|
42607
|
-
initializerValueNodeSchema = strictObject(
|
|
42608
|
-
initializerValueNodeEntries
|
|
42609
|
-
);
|
|
42610
|
-
valueRowEntries = {
|
|
42611
|
-
id: nonEmptyString,
|
|
42612
|
-
memberId: nonEmptyString,
|
|
42613
|
-
containerId: optional(string3()),
|
|
42614
|
-
genericBindings: optional(stringMap),
|
|
42615
|
-
sourceValueId: optional(nonEmptyString)
|
|
42616
|
-
};
|
|
42617
|
-
AuthoredValueRowSchema = variant("nodeType", [
|
|
42618
|
-
strictObject({ ...valueRowEntries, ...literalValueNodeEntries }),
|
|
42619
|
-
strictObject({ ...valueRowEntries, ...initializerValueNodeEntries })
|
|
42620
|
-
]);
|
|
42621
|
-
valueSeedEntries = {
|
|
42622
|
-
memberId: nonEmptyString,
|
|
42623
|
-
valueId: optional(nonEmptyString),
|
|
42624
|
-
values: optional(unknown()),
|
|
42625
|
-
bindingMembers: optional(unknown()),
|
|
42626
|
-
localizedTexts: optional(unknown())
|
|
42627
|
-
};
|
|
42628
|
-
AuthoredValueSeedSchema = variant("nodeType", [
|
|
42629
|
-
strictObject({ ...valueSeedEntries, ...literalValueNodeEntries }),
|
|
42630
|
-
strictObject({ ...valueSeedEntries, ...initializerValueNodeEntries })
|
|
42631
|
-
]);
|
|
42632
|
-
BindingMemberSchema = strictObject({
|
|
42633
|
-
id: nonEmptyString,
|
|
42634
|
-
classId: nonEmptyString
|
|
42635
|
-
});
|
|
42636
|
-
LocalizedTextSchema = strictObject({
|
|
42637
|
-
id: nonEmptyString,
|
|
42638
|
-
valueId: nonEmptyString,
|
|
42639
|
-
value: string3()
|
|
42640
|
-
});
|
|
42641
|
-
}
|
|
42642
|
-
});
|
|
42643
|
-
|
|
42644
42569
|
// ../packages/manifest/src/schema-member.ts
|
|
42645
42570
|
function jsonValueIssue(value, depth, path) {
|
|
42646
42571
|
if (depth > 64) {
|
|
@@ -42728,34 +42653,34 @@ function schemaTypeOptionsAtDepth(depth) {
|
|
|
42728
42653
|
nullable: boolean2()
|
|
42729
42654
|
}),
|
|
42730
42655
|
nullableTypeSchema("class", {
|
|
42731
|
-
classId:
|
|
42732
|
-
classArguments: record3(
|
|
42656
|
+
classId: nonEmptyString,
|
|
42657
|
+
classArguments: record3(nonEmptyString, schemaTypeAtDepth(depth + 1))
|
|
42733
42658
|
}),
|
|
42734
42659
|
nullableTypeSchema("interface", {
|
|
42735
|
-
interfaceId:
|
|
42660
|
+
interfaceId: nonEmptyString
|
|
42736
42661
|
}),
|
|
42737
42662
|
nullableTypeSchema("generic", {
|
|
42738
|
-
ownerClassId:
|
|
42739
|
-
genericParamId:
|
|
42663
|
+
ownerClassId: nonEmptyString,
|
|
42664
|
+
genericParamId: nonEmptyString
|
|
42740
42665
|
}),
|
|
42741
42666
|
nullableTypeSchema("enum", {
|
|
42742
|
-
enumId:
|
|
42667
|
+
enumId: nonEmptyString
|
|
42743
42668
|
}),
|
|
42744
42669
|
nullableTypeSchema("list", {
|
|
42745
42670
|
entryType: schemaTypeAtDepth(depth + 1),
|
|
42746
|
-
listMemberId:
|
|
42671
|
+
listMemberId: nullableId,
|
|
42747
42672
|
readOnly: boolean2()
|
|
42748
42673
|
}),
|
|
42749
42674
|
nullableTypeSchema("dictionary", {
|
|
42750
42675
|
entryType: schemaTypeAtDepth(depth + 1),
|
|
42751
|
-
keyEnumId:
|
|
42676
|
+
keyEnumId: nullableId,
|
|
42752
42677
|
readOnly: boolean2()
|
|
42753
42678
|
}),
|
|
42754
42679
|
pipe(
|
|
42755
42680
|
nullableTypeSchema("lookup", {
|
|
42756
42681
|
entryType: schemaTypeAtDepth(depth + 1),
|
|
42757
|
-
collectionMemberId: exactOptional(
|
|
42758
|
-
collectionValueId: exactOptional(
|
|
42682
|
+
collectionMemberId: exactOptional(nonEmptyString),
|
|
42683
|
+
collectionValueId: exactOptional(nullableId)
|
|
42759
42684
|
}),
|
|
42760
42685
|
check(
|
|
42761
42686
|
(type) => type.collectionValueId == null || type.collectionMemberId !== void 0,
|
|
@@ -42968,14 +42893,14 @@ function assertMemberInvariants(member, path) {
|
|
|
42968
42893
|
fail2("script", "is required for a concrete scripted member.");
|
|
42969
42894
|
}
|
|
42970
42895
|
}
|
|
42971
|
-
var
|
|
42896
|
+
var nonEmptyString, nullableString2, nullableId, finiteNumber, nullableNumber, nullableInteger, jsonValueSchema, schemaSourcePositionSchema, schemaSourceSpanSchema, schemaSourceSymbolKinds, schemaSourceIdentitySchema, memberSourceIdentitySchema, systemProtectionKindSchema, worldSystemClassKindSchema, schemaSystemMetadataSchema, schemaGenericBindingSchema, schemaGenericBindingRecordSchema, genericConstraintSchema, schemaGenericParameterSchema, primitiveTypeKinds, schemaTypeCache, returnTypeCache, schemaTypeSchema, schemaFunctionReturnTypeSchema, schemaParameterDefaultSchema, schemaFunctionArgumentSchema, memberOwnerSchema, schemaDefaultValueSchema, propertyScriptSchema, functionScriptSchema, commonMemberEntries, schemaMemberCommonSchema, simpleMemberSchemas, dictionaryKeySchema, schemaListIndexSchema, schemaListColumnSchema, callableEntries, schemaMemberSchema, SchemaMemberContractError;
|
|
42972
42897
|
var init_schema_member = __esm({
|
|
42973
42898
|
"../packages/manifest/src/schema-member.ts"() {
|
|
42974
42899
|
"use strict";
|
|
42975
42900
|
init_dist();
|
|
42976
|
-
|
|
42901
|
+
nonEmptyString = pipe(string3(), nonEmpty());
|
|
42977
42902
|
nullableString2 = nullable(string3());
|
|
42978
|
-
|
|
42903
|
+
nullableId = nullable(nonEmptyString);
|
|
42979
42904
|
finiteNumber = pipe(number(), finite());
|
|
42980
42905
|
nullableNumber = nullable(finiteNumber);
|
|
42981
42906
|
nullableInteger = nullable(
|
|
@@ -42994,7 +42919,7 @@ var init_schema_member = __esm({
|
|
|
42994
42919
|
});
|
|
42995
42920
|
schemaSourceSpanSchema = pipe(
|
|
42996
42921
|
strictObject({
|
|
42997
|
-
path:
|
|
42922
|
+
path: nonEmptyString,
|
|
42998
42923
|
start: schemaSourcePositionSchema,
|
|
42999
42924
|
end: schemaSourcePositionSchema
|
|
43000
42925
|
}),
|
|
@@ -43041,13 +42966,13 @@ var init_schema_member = __esm({
|
|
|
43041
42966
|
"variantFolder"
|
|
43042
42967
|
];
|
|
43043
42968
|
schemaSourceIdentitySchema = strictObject({
|
|
43044
|
-
symbolId:
|
|
42969
|
+
symbolId: nonEmptyString,
|
|
43045
42970
|
kind: picklist(schemaSourceSymbolKinds),
|
|
43046
42971
|
span: schemaSourceSpanSchema,
|
|
43047
42972
|
selectionSpan: schemaSourceSpanSchema
|
|
43048
42973
|
});
|
|
43049
42974
|
memberSourceIdentitySchema = strictObject({
|
|
43050
|
-
symbolId:
|
|
42975
|
+
symbolId: nonEmptyString,
|
|
43051
42976
|
kind: literal2("member"),
|
|
43052
42977
|
span: schemaSourceSpanSchema,
|
|
43053
42978
|
selectionSpan: schemaSourceSpanSchema
|
|
@@ -43102,25 +43027,25 @@ var init_schema_member = __esm({
|
|
|
43102
43027
|
schemaGenericBindingSchema = variant("kind", [
|
|
43103
43028
|
strictObject({
|
|
43104
43029
|
kind: literal2("generic"),
|
|
43105
|
-
genericParamId:
|
|
43030
|
+
genericParamId: nonEmptyString
|
|
43106
43031
|
}),
|
|
43107
|
-
strictObject({ kind: literal2("member"), memberId:
|
|
43032
|
+
strictObject({ kind: literal2("member"), memberId: nonEmptyString })
|
|
43108
43033
|
]);
|
|
43109
43034
|
schemaGenericBindingRecordSchema = record3(
|
|
43110
|
-
|
|
43035
|
+
nonEmptyString,
|
|
43111
43036
|
schemaGenericBindingSchema
|
|
43112
43037
|
);
|
|
43113
43038
|
genericConstraintSchema = variant("kind", [
|
|
43114
43039
|
strictObject({
|
|
43115
43040
|
kind: literal2("class"),
|
|
43116
|
-
classId:
|
|
43041
|
+
classId: nonEmptyString,
|
|
43117
43042
|
classArguments: optional(nullable(schemaGenericBindingRecordSchema))
|
|
43118
43043
|
}),
|
|
43119
|
-
strictObject({ kind: literal2("enum"), enumId:
|
|
43044
|
+
strictObject({ kind: literal2("enum"), enumId: nonEmptyString })
|
|
43120
43045
|
]);
|
|
43121
43046
|
schemaGenericParameterSchema = strictObject({
|
|
43122
|
-
id:
|
|
43123
|
-
name:
|
|
43047
|
+
id: nonEmptyString,
|
|
43048
|
+
name: nonEmptyString,
|
|
43124
43049
|
constraint: nullable(genericConstraintSchema),
|
|
43125
43050
|
source: schemaSourceSpanSchema,
|
|
43126
43051
|
selectionSpan: schemaSourceSpanSchema
|
|
@@ -43150,7 +43075,7 @@ var init_schema_member = __esm({
|
|
|
43150
43075
|
source: schemaSourceSpanSchema
|
|
43151
43076
|
});
|
|
43152
43077
|
schemaFunctionArgumentSchema = strictObject({
|
|
43153
|
-
name:
|
|
43078
|
+
name: nonEmptyString,
|
|
43154
43079
|
type: schemaTypeSchema,
|
|
43155
43080
|
default: nullable(schemaParameterDefaultSchema),
|
|
43156
43081
|
source: schemaSourceSpanSchema,
|
|
@@ -43159,41 +43084,41 @@ var init_schema_member = __esm({
|
|
|
43159
43084
|
memberOwnerSchema = variant("kind", [
|
|
43160
43085
|
strictObject({
|
|
43161
43086
|
kind: literal2("classMember"),
|
|
43162
|
-
classId:
|
|
43163
|
-
schemaKey:
|
|
43087
|
+
classId: nonEmptyString,
|
|
43088
|
+
schemaKey: nonEmptyString
|
|
43164
43089
|
}),
|
|
43165
43090
|
strictObject({
|
|
43166
43091
|
kind: literal2("sharedClassMember"),
|
|
43167
43092
|
members: pipe(
|
|
43168
43093
|
array2(
|
|
43169
|
-
strictObject({ classId:
|
|
43094
|
+
strictObject({ classId: nonEmptyString, schemaKey: nonEmptyString })
|
|
43170
43095
|
),
|
|
43171
43096
|
minLength(2, "Must contain at least two shared declarations.")
|
|
43172
43097
|
)
|
|
43173
43098
|
}),
|
|
43174
43099
|
strictObject({
|
|
43175
43100
|
kind: literal2("collectionEntry"),
|
|
43176
|
-
parentMemberId:
|
|
43101
|
+
parentMemberId: nonEmptyString
|
|
43177
43102
|
}),
|
|
43178
43103
|
strictObject({
|
|
43179
43104
|
kind: literal2("sharedCollectionEntry"),
|
|
43180
43105
|
parentMemberIds: pipe(
|
|
43181
|
-
array2(
|
|
43106
|
+
array2(nonEmptyString),
|
|
43182
43107
|
minLength(2, "Must contain at least two shared collections.")
|
|
43183
43108
|
)
|
|
43184
43109
|
}),
|
|
43185
43110
|
strictObject({
|
|
43186
43111
|
kind: literal2("genericArgument"),
|
|
43187
|
-
parentRecordId:
|
|
43188
|
-
genericParamId:
|
|
43112
|
+
parentRecordId: nonEmptyString,
|
|
43113
|
+
genericParamId: nonEmptyString
|
|
43189
43114
|
}),
|
|
43190
43115
|
strictObject({
|
|
43191
43116
|
kind: literal2("sharedGenericArgument"),
|
|
43192
43117
|
bindings: pipe(
|
|
43193
43118
|
array2(
|
|
43194
43119
|
strictObject({
|
|
43195
|
-
parentRecordId:
|
|
43196
|
-
genericParamId:
|
|
43120
|
+
parentRecordId: nonEmptyString,
|
|
43121
|
+
genericParamId: nonEmptyString
|
|
43197
43122
|
})
|
|
43198
43123
|
),
|
|
43199
43124
|
minLength(2, "Must contain at least two shared bindings.")
|
|
@@ -43202,17 +43127,17 @@ var init_schema_member = __esm({
|
|
|
43202
43127
|
strictObject({ kind: literal2("loose") })
|
|
43203
43128
|
]);
|
|
43204
43129
|
schemaDefaultValueSchema = union([
|
|
43205
|
-
strictObject({ serverValueId:
|
|
43206
|
-
strictObject({ init: strictObject({ code:
|
|
43207
|
-
strictObject({ value: jsonValueSchema, classId:
|
|
43130
|
+
strictObject({ serverValueId: nonEmptyString }),
|
|
43131
|
+
strictObject({ init: strictObject({ code: nonEmptyString }) }),
|
|
43132
|
+
strictObject({ value: jsonValueSchema, classId: nullableId })
|
|
43208
43133
|
]);
|
|
43209
43134
|
propertyScriptSchema = pipe(
|
|
43210
43135
|
strictObject({
|
|
43211
43136
|
kind: literal2("property"),
|
|
43212
|
-
path:
|
|
43137
|
+
path: nonEmptyString,
|
|
43213
43138
|
sourceText: string3(),
|
|
43214
43139
|
source: schemaSourceSpanSchema,
|
|
43215
|
-
getterSource:
|
|
43140
|
+
getterSource: nonEmptyString,
|
|
43216
43141
|
setterSource: nullableString2
|
|
43217
43142
|
}),
|
|
43218
43143
|
forward(
|
|
@@ -43226,7 +43151,7 @@ var init_schema_member = __esm({
|
|
|
43226
43151
|
functionScriptSchema = pipe(
|
|
43227
43152
|
strictObject({
|
|
43228
43153
|
kind: literal2("function"),
|
|
43229
|
-
path:
|
|
43154
|
+
path: nonEmptyString,
|
|
43230
43155
|
sourceText: string3(),
|
|
43231
43156
|
source: schemaSourceSpanSchema
|
|
43232
43157
|
}),
|
|
@@ -43239,10 +43164,10 @@ var init_schema_member = __esm({
|
|
|
43239
43164
|
)
|
|
43240
43165
|
);
|
|
43241
43166
|
commonMemberEntries = {
|
|
43242
|
-
id:
|
|
43167
|
+
id: nonEmptyString,
|
|
43243
43168
|
source: memberSourceIdentitySchema,
|
|
43244
43169
|
owner: memberOwnerSchema,
|
|
43245
|
-
name:
|
|
43170
|
+
name: nonEmptyString,
|
|
43246
43171
|
docsText: optional(string3()),
|
|
43247
43172
|
isReadOnly: boolean2(),
|
|
43248
43173
|
accessModifier: picklist(["public", "protected", "private"]),
|
|
@@ -43257,11 +43182,11 @@ var init_schema_member = __esm({
|
|
|
43257
43182
|
]),
|
|
43258
43183
|
required: boolean2(),
|
|
43259
43184
|
defaultValue: nullable(schemaDefaultValueSchema),
|
|
43260
|
-
overrideOf:
|
|
43185
|
+
overrideOf: nullableId,
|
|
43261
43186
|
system: nullable(schemaSystemMetadataSchema),
|
|
43262
43187
|
storage: nullable(picklist(["immutable", "save", "session", "writable"])),
|
|
43263
43188
|
distribution: nullable(picklist(["sparse", "packed"])),
|
|
43264
|
-
storageKey:
|
|
43189
|
+
storageKey: nullableId
|
|
43265
43190
|
};
|
|
43266
43191
|
schemaMemberCommonSchema = strictObject(commonMemberEntries);
|
|
43267
43192
|
simpleMemberSchemas = [
|
|
@@ -43276,14 +43201,14 @@ var init_schema_member = __esm({
|
|
|
43276
43201
|
];
|
|
43277
43202
|
dictionaryKeySchema = variant("kind", [
|
|
43278
43203
|
strictObject({ kind: literal2("string") }),
|
|
43279
|
-
strictObject({ kind: literal2("enum"), enumId:
|
|
43204
|
+
strictObject({ kind: literal2("enum"), enumId: nonEmptyString })
|
|
43280
43205
|
]);
|
|
43281
43206
|
schemaListIndexSchema = strictObject({
|
|
43282
|
-
schemaKey:
|
|
43207
|
+
schemaKey: nonEmptyString,
|
|
43283
43208
|
unique: boolean2()
|
|
43284
43209
|
});
|
|
43285
43210
|
schemaListColumnSchema = strictObject({
|
|
43286
|
-
memberKey:
|
|
43211
|
+
memberKey: nonEmptyString,
|
|
43287
43212
|
width: nullableNumber,
|
|
43288
43213
|
hidden: boolean2(),
|
|
43289
43214
|
frozen: boolean2(),
|
|
@@ -43314,33 +43239,33 @@ var init_schema_member = __esm({
|
|
|
43314
43239
|
decimalPoints: nullableInteger
|
|
43315
43240
|
}),
|
|
43316
43241
|
memberSchema("dictionary", {
|
|
43317
|
-
entryMemberId:
|
|
43242
|
+
entryMemberId: nonEmptyString,
|
|
43318
43243
|
key: dictionaryKeySchema
|
|
43319
43244
|
}),
|
|
43320
43245
|
memberSchema("list", {
|
|
43321
|
-
entryMemberId:
|
|
43246
|
+
entryMemberId: nonEmptyString,
|
|
43322
43247
|
listKind: picklist(["ordered", "unordered"]),
|
|
43323
43248
|
indexes: array2(schemaListIndexSchema),
|
|
43324
43249
|
columns: array2(schemaListColumnSchema)
|
|
43325
43250
|
}),
|
|
43326
43251
|
memberSchema("class", {
|
|
43327
|
-
classId:
|
|
43252
|
+
classId: nonEmptyString,
|
|
43328
43253
|
partial: optional(boolean2()),
|
|
43329
|
-
schemaKeyOrder: nullable(array2(
|
|
43254
|
+
schemaKeyOrder: nullable(array2(nonEmptyString)),
|
|
43330
43255
|
classArguments: schemaGenericBindingRecordSchema
|
|
43331
43256
|
}),
|
|
43332
43257
|
memberSchema("enum", {
|
|
43333
|
-
enumId:
|
|
43258
|
+
enumId: nonEmptyString,
|
|
43334
43259
|
multiselect: boolean2()
|
|
43335
43260
|
}),
|
|
43336
43261
|
memberSchema("lookup", {
|
|
43337
|
-
collectionMemberId:
|
|
43338
|
-
collectionValueId:
|
|
43262
|
+
collectionMemberId: nonEmptyString,
|
|
43263
|
+
collectionValueId: nullableId,
|
|
43339
43264
|
multiselect: boolean2(),
|
|
43340
43265
|
declaredType: nullable(schemaTypeSchema)
|
|
43341
43266
|
}),
|
|
43342
43267
|
memberSchema("dialogueLookup", {
|
|
43343
|
-
dialogueGroupId:
|
|
43268
|
+
dialogueGroupId: nullableId,
|
|
43344
43269
|
multiselect: boolean2()
|
|
43345
43270
|
}),
|
|
43346
43271
|
memberSchema("computed", {
|
|
@@ -43348,10 +43273,10 @@ var init_schema_member = __esm({
|
|
|
43348
43273
|
script: nullable(propertyScriptSchema)
|
|
43349
43274
|
}),
|
|
43350
43275
|
memberSchema("sprite", {
|
|
43351
|
-
templateId:
|
|
43276
|
+
templateId: nullableId
|
|
43352
43277
|
}),
|
|
43353
43278
|
memberSchema("audio", {
|
|
43354
|
-
templateId:
|
|
43279
|
+
templateId: nullableId
|
|
43355
43280
|
}),
|
|
43356
43281
|
memberSchema("function", {
|
|
43357
43282
|
...callableEntries,
|
|
@@ -43382,7 +43307,7 @@ var init_schema_member = __esm({
|
|
|
43382
43307
|
valueType: nullable(schemaTypeSchema)
|
|
43383
43308
|
}),
|
|
43384
43309
|
memberSchema("generic", {
|
|
43385
|
-
genericParamId:
|
|
43310
|
+
genericParamId: nonEmptyString,
|
|
43386
43311
|
partial: optional(boolean2())
|
|
43387
43312
|
})
|
|
43388
43313
|
]);
|
|
@@ -43441,7 +43366,7 @@ function assertProjectSchemaManifest(value) {
|
|
|
43441
43366
|
"localizationStatuses",
|
|
43442
43367
|
"internalRecordRelations"
|
|
43443
43368
|
]);
|
|
43444
|
-
|
|
43369
|
+
nonEmptyString2(manifest.namespace, "$.namespace");
|
|
43445
43370
|
arrayOf(manifest.classes, "$.classes", assertNeoSchemaClass);
|
|
43446
43371
|
arrayOf(manifest.constructors, "$.constructors", assertConstructor2);
|
|
43447
43372
|
arrayOf(manifest.variants, "$.variants", assertVariant);
|
|
@@ -43515,7 +43440,7 @@ function assertConstructorInvariants(manifest) {
|
|
|
43515
43440
|
const requiredConstructorId2 = schemaClass2.requiredConstructorId;
|
|
43516
43441
|
if (requiredConstructorId2 === void 0) return;
|
|
43517
43442
|
const path = `$.classes[${index}].requiredConstructorId`;
|
|
43518
|
-
|
|
43443
|
+
nonEmptyString2(requiredConstructorId2, path);
|
|
43519
43444
|
const id2 = String(requiredConstructorId2);
|
|
43520
43445
|
if (listedIds.has(id2)) {
|
|
43521
43446
|
invalid(path, `constructor ${JSON.stringify(id2)} is already owned.`);
|
|
@@ -43551,7 +43476,7 @@ function assertConstructorInvariants(manifest) {
|
|
|
43551
43476
|
schemaClass2.constructorIds,
|
|
43552
43477
|
`$.classes[${index}].constructorIds`
|
|
43553
43478
|
).map((entry, entryIndex) => {
|
|
43554
|
-
|
|
43479
|
+
nonEmptyString2(
|
|
43555
43480
|
entry,
|
|
43556
43481
|
`$.classes[${index}].constructorIds[${entryIndex}]`
|
|
43557
43482
|
);
|
|
@@ -43593,7 +43518,7 @@ function assertConstructor2(value, path) {
|
|
|
43593
43518
|
);
|
|
43594
43519
|
assertIdentity2(declared, path, "constructor");
|
|
43595
43520
|
assertOptionalDocsText2(declared.docsText, `${path}.docsText`);
|
|
43596
|
-
|
|
43521
|
+
nonEmptyString2(declared.classId, `${path}.classId`);
|
|
43597
43522
|
arrayOf(declared.arguments, `${path}.arguments`, assertFunctionArgument);
|
|
43598
43523
|
if (declared.code !== null && typeof declared.code !== "string") {
|
|
43599
43524
|
invalid(
|
|
@@ -43639,11 +43564,11 @@ function assertVariant(value, path) {
|
|
|
43639
43564
|
"valueId"
|
|
43640
43565
|
]);
|
|
43641
43566
|
assertIdentity2(variant2, path, "variant");
|
|
43642
|
-
|
|
43643
|
-
|
|
43644
|
-
|
|
43567
|
+
nonEmptyString2(variant2.classId, `${path}.classId`);
|
|
43568
|
+
nonEmptyString2(variant2.name, `${path}.name`);
|
|
43569
|
+
nonEmptyString2(variant2.valueId, `${path}.valueId`);
|
|
43645
43570
|
if (variant2.folderId === null) return;
|
|
43646
|
-
|
|
43571
|
+
nonEmptyString2(variant2.folderId, `${path}.folderId`);
|
|
43647
43572
|
}
|
|
43648
43573
|
function assertVariantFolder(value, path) {
|
|
43649
43574
|
const folder = objectAt(value, path, [
|
|
@@ -43654,30 +43579,30 @@ function assertVariantFolder(value, path) {
|
|
|
43654
43579
|
"binding"
|
|
43655
43580
|
]);
|
|
43656
43581
|
assertIdentity2(folder, path, "variantFolder");
|
|
43657
|
-
|
|
43582
|
+
nonEmptyString2(folder.classId, `${path}.classId`);
|
|
43658
43583
|
if (typeof folder.path !== "string")
|
|
43659
43584
|
invalid(`${path}.path`, "must be a string.");
|
|
43660
43585
|
if (folder.binding === null) {
|
|
43661
|
-
|
|
43586
|
+
nonEmptyString2(folder.path, `${path}.path`);
|
|
43662
43587
|
return;
|
|
43663
43588
|
}
|
|
43664
43589
|
const binding = objectAt(folder.binding, `${path}.binding`, [
|
|
43665
43590
|
"collectionMemberId",
|
|
43666
43591
|
"collectionValueId"
|
|
43667
43592
|
]);
|
|
43668
|
-
|
|
43593
|
+
nonEmptyString2(
|
|
43669
43594
|
binding.collectionMemberId,
|
|
43670
43595
|
`${path}.binding.collectionMemberId`
|
|
43671
43596
|
);
|
|
43672
|
-
|
|
43597
|
+
nonEmptyString2(
|
|
43673
43598
|
binding.collectionValueId,
|
|
43674
43599
|
`${path}.binding.collectionValueId`
|
|
43675
43600
|
);
|
|
43676
43601
|
}
|
|
43677
43602
|
function assertConstructorBaseArgument(value, path) {
|
|
43678
43603
|
const argument2 = objectAt(value, path, ["name", "code"]);
|
|
43679
|
-
|
|
43680
|
-
|
|
43604
|
+
nonEmptyString2(argument2.name, `${path}.name`);
|
|
43605
|
+
nonEmptyString2(argument2.code, `${path}.code`);
|
|
43681
43606
|
}
|
|
43682
43607
|
function assertInternalRecordRelation(value, path) {
|
|
43683
43608
|
const relation = objectAt(value, path, [
|
|
@@ -43690,13 +43615,13 @@ function assertInternalRecordRelation(value, path) {
|
|
|
43690
43615
|
"targetRecordId",
|
|
43691
43616
|
"order"
|
|
43692
43617
|
]);
|
|
43693
|
-
|
|
43618
|
+
nonEmptyString2(relation.id, `${path}.id`);
|
|
43694
43619
|
assertSourceIdentity(relation.source, `${path}.source`);
|
|
43695
|
-
|
|
43620
|
+
nonEmptyString2(relation.relationKind, `${path}.relationKind`);
|
|
43696
43621
|
projectRecordKind2(relation.sourceRecordKind, `${path}.sourceRecordKind`);
|
|
43697
|
-
|
|
43622
|
+
nonEmptyString2(relation.sourceRecordId, `${path}.sourceRecordId`);
|
|
43698
43623
|
projectRecordKind2(relation.targetRecordKind, `${path}.targetRecordKind`);
|
|
43699
|
-
|
|
43624
|
+
nonEmptyString2(relation.targetRecordId, `${path}.targetRecordId`);
|
|
43700
43625
|
if (relation.order !== null && (typeof relation.order !== "number" || !Number.isInteger(relation.order) || relation.order < 0)) {
|
|
43701
43626
|
invalid(`${path}.order`, "expected null or a non-negative integer.");
|
|
43702
43627
|
}
|
|
@@ -44002,8 +43927,8 @@ function assertStaticMemberInvariants(manifest) {
|
|
|
44002
43927
|
`static member ${JSON.stringify(memberName)} (${memberId}) has owner kind ${JSON.stringify(ownerKind)}; expected exactly one direct Class owner.`
|
|
44003
43928
|
);
|
|
44004
43929
|
}
|
|
44005
|
-
const ownerClassId =
|
|
44006
|
-
const schemaKey =
|
|
43930
|
+
const ownerClassId = nonEmptyString2(owner.classId, `${path}.owner.classId`);
|
|
43931
|
+
const schemaKey = nonEmptyString2(
|
|
44007
43932
|
owner.schemaKey,
|
|
44008
43933
|
`${path}.owner.schemaKey`
|
|
44009
43934
|
);
|
|
@@ -44201,7 +44126,7 @@ function assertStaticMemberInvariants(manifest) {
|
|
|
44201
44126
|
}
|
|
44202
44127
|
}
|
|
44203
44128
|
function assertIdentity2(value, path, expectedKind) {
|
|
44204
|
-
|
|
44129
|
+
nonEmptyString2(value.id, `${path}.id`);
|
|
44205
44130
|
assertSourceIdentity(value.source, `${path}.source`, expectedKind);
|
|
44206
44131
|
}
|
|
44207
44132
|
function assertSourceIdentity(value, path, expectedKind) {
|
|
@@ -44247,7 +44172,7 @@ function assertNeoSchemaClass(value, path) {
|
|
|
44247
44172
|
]
|
|
44248
44173
|
);
|
|
44249
44174
|
assertIdentity2(type, path, "class");
|
|
44250
|
-
|
|
44175
|
+
nonEmptyString2(type.name, `${path}.name`);
|
|
44251
44176
|
assertOptionalDocsText2(type.docsText, `${path}.docsText`);
|
|
44252
44177
|
stringIn(
|
|
44253
44178
|
type.declarationModifier,
|
|
@@ -44275,7 +44200,7 @@ function assertNeoSchemaClass(value, path) {
|
|
|
44275
44200
|
);
|
|
44276
44201
|
nullableNonEmptyString(type.targetMemberId, `${path}.targetMemberId`);
|
|
44277
44202
|
if (type.requiredConstructorId !== void 0) {
|
|
44278
|
-
|
|
44203
|
+
nonEmptyString2(type.requiredConstructorId, `${path}.requiredConstructorId`);
|
|
44279
44204
|
}
|
|
44280
44205
|
}
|
|
44281
44206
|
function assertGenericParameter(value, path) {
|
|
@@ -44309,7 +44234,7 @@ function assertInterface(value, path) {
|
|
|
44309
44234
|
["docsText"]
|
|
44310
44235
|
);
|
|
44311
44236
|
assertIdentity2(neoInterface, path, "interface");
|
|
44312
|
-
|
|
44237
|
+
nonEmptyString2(neoInterface.name, `${path}.name`);
|
|
44313
44238
|
assertOptionalDocsText2(neoInterface.docsText, `${path}.docsText`);
|
|
44314
44239
|
arrayOf(neoInterface.members, `${path}.members`, assertInterfaceMember);
|
|
44315
44240
|
stringArray(neoInterface.extendsInterfaceIds, `${path}.extendsInterfaceIds`);
|
|
@@ -44324,8 +44249,8 @@ function assertInterfaceMember(value, path) {
|
|
|
44324
44249
|
["id", "kind", "name", "type", "settable", "accessModifier", "source"],
|
|
44325
44250
|
["docsText"]
|
|
44326
44251
|
);
|
|
44327
|
-
|
|
44328
|
-
|
|
44252
|
+
nonEmptyString2(member.id, `${path}.id`);
|
|
44253
|
+
nonEmptyString2(member.name, `${path}.name`);
|
|
44329
44254
|
assertOptionalDocsText2(member.docsText, `${path}.docsText`);
|
|
44330
44255
|
assertType2(member.type, `${path}.type`);
|
|
44331
44256
|
booleanAt(member.settable, `${path}.settable`);
|
|
@@ -44349,8 +44274,8 @@ function assertInterfaceMember(value, path) {
|
|
|
44349
44274
|
],
|
|
44350
44275
|
["docsText"]
|
|
44351
44276
|
);
|
|
44352
|
-
|
|
44353
|
-
|
|
44277
|
+
nonEmptyString2(member.id, `${path}.id`);
|
|
44278
|
+
nonEmptyString2(member.name, `${path}.name`);
|
|
44354
44279
|
assertOptionalDocsText2(member.docsText, `${path}.docsText`);
|
|
44355
44280
|
assertFunctionSignature(member, path);
|
|
44356
44281
|
assertInterfaceMemberAccessModifier(member.accessModifier, path);
|
|
@@ -44370,7 +44295,7 @@ function assertEnum2(value, path) {
|
|
|
44370
44295
|
["docsText"]
|
|
44371
44296
|
);
|
|
44372
44297
|
assertIdentity2(neoEnum, path, "enum");
|
|
44373
|
-
|
|
44298
|
+
nonEmptyString2(neoEnum.name, `${path}.name`);
|
|
44374
44299
|
assertOptionalDocsText2(neoEnum.docsText, `${path}.docsText`);
|
|
44375
44300
|
arrayOf(neoEnum.options, `${path}.options`, assertEnumOption);
|
|
44376
44301
|
assertSystem(neoEnum.system, `${path}.system`);
|
|
@@ -44378,7 +44303,7 @@ function assertEnum2(value, path) {
|
|
|
44378
44303
|
const options = requireArray(neoEnum.options, `${path}.options`);
|
|
44379
44304
|
options.forEach((entry, index) => {
|
|
44380
44305
|
const option = requireRecord(entry, `${path}.options[${index}]`);
|
|
44381
|
-
const key =
|
|
44306
|
+
const key = nonEmptyString2(option.key, `${path}.options[${index}].key`);
|
|
44382
44307
|
if (seen.has(key))
|
|
44383
44308
|
invalid(`${path}.options[${index}].key`, "is duplicated.");
|
|
44384
44309
|
seen.add(key);
|
|
@@ -44391,9 +44316,9 @@ function assertEnumOption(value, path) {
|
|
|
44391
44316
|
["id", "name", "key", "text", "source"],
|
|
44392
44317
|
["docsText"]
|
|
44393
44318
|
);
|
|
44394
|
-
|
|
44395
|
-
|
|
44396
|
-
|
|
44319
|
+
nonEmptyString2(option.id, `${path}.id`);
|
|
44320
|
+
nonEmptyString2(option.name, `${path}.name`);
|
|
44321
|
+
nonEmptyString2(option.key, `${path}.key`);
|
|
44397
44322
|
stringAt(option.text, `${path}.text`);
|
|
44398
44323
|
assertOptionalDocsText2(option.docsText, `${path}.docsText`);
|
|
44399
44324
|
assertSourceIdentity(option.source, `${path}.source`, "enumOption");
|
|
@@ -44439,7 +44364,7 @@ function assertTextureTemplate(value, path) {
|
|
|
44439
44364
|
"swizzle"
|
|
44440
44365
|
]);
|
|
44441
44366
|
assertIdentity2(texture, path, "textureTemplate");
|
|
44442
|
-
|
|
44367
|
+
nonEmptyString2(texture.name, `${path}.name`);
|
|
44443
44368
|
exactValue(texture.type, "texture-2d", `${path}.type`);
|
|
44444
44369
|
stringIn(texture.textureType, TEXTURE_TYPES, `${path}.textureType`);
|
|
44445
44370
|
exactValue(texture.textureShape, "2d", `${path}.textureShape`);
|
|
@@ -44684,7 +44609,7 @@ function assertAudioTemplate(value, path) {
|
|
|
44684
44609
|
"preloadAudioData"
|
|
44685
44610
|
]);
|
|
44686
44611
|
assertIdentity2(audio, path, "audioTemplate");
|
|
44687
|
-
|
|
44612
|
+
nonEmptyString2(audio.name, `${path}.name`);
|
|
44688
44613
|
for (const field of [
|
|
44689
44614
|
"forceToMono",
|
|
44690
44615
|
"normalize",
|
|
@@ -44726,14 +44651,14 @@ function assertLocalization(value, path) {
|
|
|
44726
44651
|
"mainLocaleDefaultStatusId"
|
|
44727
44652
|
]);
|
|
44728
44653
|
assertIdentity2(localization, path, "localization");
|
|
44729
|
-
|
|
44654
|
+
nonEmptyString2(localization.mainLocale, `${path}.mainLocale`);
|
|
44730
44655
|
arrayOf(
|
|
44731
44656
|
localization.supportedLocales,
|
|
44732
44657
|
`${path}.supportedLocales`,
|
|
44733
44658
|
assertLocale
|
|
44734
44659
|
);
|
|
44735
44660
|
stringArray(localization.sortedStatusIds, `${path}.sortedStatusIds`);
|
|
44736
|
-
|
|
44661
|
+
nonEmptyString2(
|
|
44737
44662
|
localization.mainLocaleDefaultStatusId,
|
|
44738
44663
|
`${path}.mainLocaleDefaultStatusId`
|
|
44739
44664
|
);
|
|
@@ -44754,8 +44679,8 @@ function assertLocalizationStatus(value, path) {
|
|
|
44754
44679
|
"system"
|
|
44755
44680
|
]);
|
|
44756
44681
|
assertIdentity2(status, path, "localizationStatus");
|
|
44757
|
-
|
|
44758
|
-
|
|
44682
|
+
nonEmptyString2(status.slug, `${path}.slug`);
|
|
44683
|
+
nonEmptyString2(status.name, `${path}.name`);
|
|
44759
44684
|
nullableString3(status.description, `${path}.description`);
|
|
44760
44685
|
nullableString3(status.color, `${path}.color`);
|
|
44761
44686
|
nullableString3(status.emoji, `${path}.emoji`);
|
|
@@ -44781,7 +44706,7 @@ function assertLocale(value, path) {
|
|
|
44781
44706
|
"sortOrder",
|
|
44782
44707
|
"archivedAt"
|
|
44783
44708
|
]);
|
|
44784
|
-
|
|
44709
|
+
nonEmptyString2(locale.locale, `${path}.locale`);
|
|
44785
44710
|
nullableNonEmptyString(locale.sourceLocale, `${path}.sourceLocale`);
|
|
44786
44711
|
nullableString3(locale.name, `${path}.name`);
|
|
44787
44712
|
finiteNumber2(locale.sortOrder, `${path}.sortOrder`);
|
|
@@ -44846,7 +44771,7 @@ function requireArray(value, path) {
|
|
|
44846
44771
|
}
|
|
44847
44772
|
function stringArray(value, path) {
|
|
44848
44773
|
arrayOf(value, path, (entry, entryPath) => {
|
|
44849
|
-
|
|
44774
|
+
nonEmptyString2(entry, entryPath);
|
|
44850
44775
|
});
|
|
44851
44776
|
}
|
|
44852
44777
|
function nullableStringArray(value, path) {
|
|
@@ -44856,8 +44781,8 @@ function nullableStringArray(value, path) {
|
|
|
44856
44781
|
function stringRecord(value, path) {
|
|
44857
44782
|
const record6 = requireRecord(value, path);
|
|
44858
44783
|
for (const [key, entry] of Object.entries(record6)) {
|
|
44859
|
-
|
|
44860
|
-
|
|
44784
|
+
nonEmptyString2(key, `${path} key`);
|
|
44785
|
+
nonEmptyString2(entry, `${path}.${key}`);
|
|
44861
44786
|
}
|
|
44862
44787
|
}
|
|
44863
44788
|
function uniqueIds(value, path) {
|
|
@@ -44865,7 +44790,7 @@ function uniqueIds(value, path) {
|
|
|
44865
44790
|
const seen = /* @__PURE__ */ new Set();
|
|
44866
44791
|
records2.forEach((entry, index) => {
|
|
44867
44792
|
const record6 = requireRecord(entry, `${path}[${index}]`);
|
|
44868
|
-
const id2 =
|
|
44793
|
+
const id2 = nonEmptyString2(record6.id, `${path}[${index}].id`);
|
|
44869
44794
|
if (seen.has(id2))
|
|
44870
44795
|
invalid(`${path}[${index}].id`, `duplicates id ${JSON.stringify(id2)}.`);
|
|
44871
44796
|
seen.add(id2);
|
|
@@ -44875,7 +44800,7 @@ function nullableObject(value, path, assertion) {
|
|
|
44875
44800
|
if (value === null) return;
|
|
44876
44801
|
assertion(value, path);
|
|
44877
44802
|
}
|
|
44878
|
-
function
|
|
44803
|
+
function nonEmptyString2(value, path) {
|
|
44879
44804
|
const result = stringAt(value, path);
|
|
44880
44805
|
if (result.length === 0) invalid(path, "must not be empty.");
|
|
44881
44806
|
return result;
|
|
@@ -44901,7 +44826,7 @@ function nullableString3(value, path) {
|
|
|
44901
44826
|
}
|
|
44902
44827
|
function nullableNonEmptyString(value, path) {
|
|
44903
44828
|
if (value === null) return;
|
|
44904
|
-
|
|
44829
|
+
nonEmptyString2(value, path);
|
|
44905
44830
|
}
|
|
44906
44831
|
function finiteNumber2(value, path) {
|
|
44907
44832
|
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
@@ -57976,12 +57901,12 @@ function lowerStructuredLeafComponents(kind, label, expression, lowering) {
|
|
|
57976
57901
|
function structuredLeafPartialAssignments(kind, label, value, emit) {
|
|
57977
57902
|
const stored = value[STRUCTURED_LEAF_PARTIAL_KEY];
|
|
57978
57903
|
const declared = structuredLeafFields(kind);
|
|
57979
|
-
const
|
|
57904
|
+
const unknown = Object.keys(stored).find(
|
|
57980
57905
|
(key) => !declared.some((entry) => entry.key === key)
|
|
57981
57906
|
);
|
|
57982
|
-
if (
|
|
57907
|
+
if (unknown !== void 0) {
|
|
57983
57908
|
throw new Error(
|
|
57984
|
-
`${label} stores unknown field ${JSON.stringify(
|
|
57909
|
+
`${label} stores unknown field ${JSON.stringify(unknown)}. ${structuredLeafTypeName(kind)} accepts ${structuredLeafFieldNames(kind).join(", ")}.`
|
|
57985
57910
|
);
|
|
57986
57911
|
}
|
|
57987
57912
|
const assignments = [];
|
|
@@ -88667,6 +88592,97 @@ function relationEndpointClassId(record6) {
|
|
|
88667
88592
|
if (typeof record6.classId === "string") return record6.classId;
|
|
88668
88593
|
return void 0;
|
|
88669
88594
|
}
|
|
88595
|
+
function relationOrderMaintenanceNoopIds(currentRelations, changes) {
|
|
88596
|
+
const currentById = new Map(
|
|
88597
|
+
currentRelations.map((relation) => [relation.id, relation])
|
|
88598
|
+
);
|
|
88599
|
+
const currentByGroup = /* @__PURE__ */ new Map();
|
|
88600
|
+
for (const relation of currentRelations) {
|
|
88601
|
+
const group = relationOrderGroupKey(relation);
|
|
88602
|
+
const grouped = currentByGroup.get(group) ?? /* @__PURE__ */ new Map();
|
|
88603
|
+
grouped.set(relation.id, relation);
|
|
88604
|
+
currentByGroup.set(group, grouped);
|
|
88605
|
+
}
|
|
88606
|
+
const changesByGroup = /* @__PURE__ */ new Map();
|
|
88607
|
+
const candidatesByGroup = /* @__PURE__ */ new Map();
|
|
88608
|
+
for (const change of changes) {
|
|
88609
|
+
const before = currentById.get(change.recordId);
|
|
88610
|
+
const groups = /* @__PURE__ */ new Set();
|
|
88611
|
+
if (before !== void 0) groups.add(relationOrderGroupKey(before));
|
|
88612
|
+
if (change.deleted !== true && change.operation !== "delete" && isInternalRecordRelation(change.nextData)) {
|
|
88613
|
+
groups.add(relationOrderGroupKey(change.nextData));
|
|
88614
|
+
}
|
|
88615
|
+
for (const group of groups) {
|
|
88616
|
+
const grouped = changesByGroup.get(group) ?? [];
|
|
88617
|
+
grouped.push(change);
|
|
88618
|
+
changesByGroup.set(group, grouped);
|
|
88619
|
+
}
|
|
88620
|
+
if (relationOrderOnlyChangeIsCandidate(before, change)) {
|
|
88621
|
+
const group = relationOrderGroupKey(change.nextData);
|
|
88622
|
+
const candidates = candidatesByGroup.get(group) ?? [];
|
|
88623
|
+
candidates.push(change);
|
|
88624
|
+
candidatesByGroup.set(group, candidates);
|
|
88625
|
+
}
|
|
88626
|
+
}
|
|
88627
|
+
const noops = /* @__PURE__ */ new Set();
|
|
88628
|
+
for (const [group, candidates] of candidatesByGroup) {
|
|
88629
|
+
const groupChanges = changesByGroup.get(group) ?? [];
|
|
88630
|
+
const candidateSet = new Set(candidates);
|
|
88631
|
+
if (groupChanges.some((change) => !candidateSet.has(change))) continue;
|
|
88632
|
+
const current = currentByGroup.get(group) ?? /* @__PURE__ */ new Map();
|
|
88633
|
+
const projected = new Map(current);
|
|
88634
|
+
for (const change of groupChanges) {
|
|
88635
|
+
const before = currentById.get(change.recordId);
|
|
88636
|
+
if (before !== void 0 && relationOrderGroupKey(before) === group) {
|
|
88637
|
+
projected.delete(before.id);
|
|
88638
|
+
}
|
|
88639
|
+
if (change.deleted !== true && change.operation !== "delete" && isInternalRecordRelation(change.nextData) && relationOrderGroupKey(change.nextData) === group) {
|
|
88640
|
+
projected.set(change.nextData.id, change.nextData);
|
|
88641
|
+
}
|
|
88642
|
+
}
|
|
88643
|
+
if (!sameRelationIdSequence(current.values(), projected.values())) continue;
|
|
88644
|
+
for (const candidate of candidates) noops.add(candidate.recordId);
|
|
88645
|
+
}
|
|
88646
|
+
return noops;
|
|
88647
|
+
}
|
|
88648
|
+
function relationOrderOnlyChangeIsCandidate(before, change) {
|
|
88649
|
+
if (change.recordKind !== "internal-record-relation") return false;
|
|
88650
|
+
if (change.operation !== "update" || change.deleted === true) return false;
|
|
88651
|
+
if (before === void 0 || !isInternalRecordRelation(change.nextData)) {
|
|
88652
|
+
return false;
|
|
88653
|
+
}
|
|
88654
|
+
const nextRelation = change.nextData;
|
|
88655
|
+
const contract = INTERNAL_RECORD_RELATION_KIND_CONTRACTS.find(
|
|
88656
|
+
(candidate) => candidate.relationKind === nextRelation.relationKind
|
|
88657
|
+
);
|
|
88658
|
+
if (contract?.merge !== "ordered-union") return false;
|
|
88659
|
+
return projectRecordDataIsSemanticallyEqual(
|
|
88660
|
+
relationWithoutOrderKey(before),
|
|
88661
|
+
relationWithoutOrderKey(nextRelation)
|
|
88662
|
+
);
|
|
88663
|
+
}
|
|
88664
|
+
function relationWithoutOrderKey(value) {
|
|
88665
|
+
const semantic = projectRecordSemanticData(value);
|
|
88666
|
+
if (!isPlainRecord3(semantic)) return semantic;
|
|
88667
|
+
const result = { ...semantic };
|
|
88668
|
+
delete result.orderKey;
|
|
88669
|
+
return result;
|
|
88670
|
+
}
|
|
88671
|
+
function relationOrderGroupKey(relation) {
|
|
88672
|
+
return [
|
|
88673
|
+
relation.relationKind,
|
|
88674
|
+
relation.sourceRecordKind,
|
|
88675
|
+
relation.sourceRecordId
|
|
88676
|
+
].join("\0");
|
|
88677
|
+
}
|
|
88678
|
+
function sameRelationIdSequence(left, right) {
|
|
88679
|
+
const sequence = (relations) => [...relations].sort(
|
|
88680
|
+
(a, b) => (a.orderKey ?? "").localeCompare(b.orderKey ?? "") || a.id.localeCompare(b.id)
|
|
88681
|
+
).map((relation) => relation.id);
|
|
88682
|
+
const leftIds = sequence(left);
|
|
88683
|
+
const rightIds = sequence(right);
|
|
88684
|
+
return leftIds.length === rightIds.length && leftIds.every((relationId, index) => relationId === rightIds[index]);
|
|
88685
|
+
}
|
|
88670
88686
|
function isPlainRecord3(value) {
|
|
88671
88687
|
if (value === null || typeof value !== "object") return false;
|
|
88672
88688
|
return !Array.isArray(value);
|
|
@@ -97620,6 +97636,47 @@ function orderLocalizedTextWritesBesideLinks(prepared) {
|
|
|
97620
97636
|
});
|
|
97621
97637
|
return ordered;
|
|
97622
97638
|
}
|
|
97639
|
+
function projectVersionBasePayloadBytes(document, changes) {
|
|
97640
|
+
const targets = /* @__PURE__ */ new Map();
|
|
97641
|
+
for (const change of changes) {
|
|
97642
|
+
if (change.operation === "create") continue;
|
|
97643
|
+
const bucket = PROJECT_RECORD_BUCKETS[change.recordKind];
|
|
97644
|
+
let ids = targets.get(bucket);
|
|
97645
|
+
if (ids === void 0) {
|
|
97646
|
+
ids = /* @__PURE__ */ new Set();
|
|
97647
|
+
targets.set(bucket, ids);
|
|
97648
|
+
}
|
|
97649
|
+
ids.add(change.recordId);
|
|
97650
|
+
}
|
|
97651
|
+
const sizes = /* @__PURE__ */ new Map();
|
|
97652
|
+
const raw = {
|
|
97653
|
+
...document,
|
|
97654
|
+
values: document.physicalValues ?? document.values
|
|
97655
|
+
};
|
|
97656
|
+
const encoder = new TextEncoder();
|
|
97657
|
+
for (const [bucket, ids] of targets) {
|
|
97658
|
+
const value = raw[bucket];
|
|
97659
|
+
if (value == null) continue;
|
|
97660
|
+
const rows = Array.isArray(value) ? value : [value];
|
|
97661
|
+
for (const row of rows) {
|
|
97662
|
+
if (typeof row !== "object" || row === null || !("id" in row) || typeof row.id !== "string")
|
|
97663
|
+
throw new Error("Transaction base record has no ID in " + bucket);
|
|
97664
|
+
if (ids.has(row.id))
|
|
97665
|
+
sizes.set(
|
|
97666
|
+
JSON.stringify([bucket, row.id]),
|
|
97667
|
+
encoder.encode(canonicalJsonStringify(row)).byteLength
|
|
97668
|
+
);
|
|
97669
|
+
}
|
|
97670
|
+
}
|
|
97671
|
+
return changes.map(
|
|
97672
|
+
(change) => sizes.get(
|
|
97673
|
+
JSON.stringify([
|
|
97674
|
+
PROJECT_RECORD_BUCKETS[change.recordKind],
|
|
97675
|
+
change.recordId
|
|
97676
|
+
])
|
|
97677
|
+
) ?? 0
|
|
97678
|
+
);
|
|
97679
|
+
}
|
|
97623
97680
|
function addProjectVersionTransactionBudgets(left, right) {
|
|
97624
97681
|
return {
|
|
97625
97682
|
argumentBytes: left.argumentBytes + right.argumentBytes,
|
|
@@ -98491,13 +98548,6 @@ function* prepareServerOwnedSchemaCommitPasses(args) {
|
|
|
98491
98548
|
prepared,
|
|
98492
98549
|
contentHashHeads: args.contentHashHeads
|
|
98493
98550
|
});
|
|
98494
|
-
if (args.initializerMaterialization !== void 0) {
|
|
98495
|
-
reconcileInitializerMaterializationTransport({
|
|
98496
|
-
prepared,
|
|
98497
|
-
transport: args.initializerMaterialization,
|
|
98498
|
-
document: applyProjectVersionWriteChanges(args.document, prepared)
|
|
98499
|
-
});
|
|
98500
|
-
}
|
|
98501
98551
|
drainConstructedGraphValidations({
|
|
98502
98552
|
document: args.document,
|
|
98503
98553
|
prepared,
|
|
@@ -98966,156 +99016,6 @@ function replayedCreationDataMatches(args) {
|
|
|
98966
99016
|
}
|
|
98967
99017
|
return true;
|
|
98968
99018
|
}
|
|
98969
|
-
function reconcileInitializerMaterializationTransport(args) {
|
|
98970
|
-
const roots = new Map(
|
|
98971
|
-
args.transport.roots.map((root) => [root.sourceValueId, root])
|
|
98972
|
-
);
|
|
98973
|
-
if (roots.size !== args.transport.roots.length) {
|
|
98974
|
-
throw new Error(
|
|
98975
|
-
"Initializer materialization transport contains duplicate source roots."
|
|
98976
|
-
);
|
|
98977
|
-
}
|
|
98978
|
-
const serverCreatedByRoot = /* @__PURE__ */ new Map();
|
|
98979
|
-
for (const change of args.prepared) {
|
|
98980
|
-
if (change.recordKind !== "value" || change.operation === "delete" || change.nextData === void 0) {
|
|
98981
|
-
continue;
|
|
98982
|
-
}
|
|
98983
|
-
const details = change.intent.details;
|
|
98984
|
-
if (typeof details !== "object" || details === null || Reflect.get(details, "source") !== "server-initializer-materialization") {
|
|
98985
|
-
continue;
|
|
98986
|
-
}
|
|
98987
|
-
const sourceValueId = Reflect.get(details, "sourceValueId");
|
|
98988
|
-
if (typeof sourceValueId !== "string") continue;
|
|
98989
|
-
const grouped = serverCreatedByRoot.get(sourceValueId) ?? [];
|
|
98990
|
-
grouped.push(change);
|
|
98991
|
-
serverCreatedByRoot.set(sourceValueId, grouped);
|
|
98992
|
-
}
|
|
98993
|
-
const serverRootIds = new Set(serverCreatedByRoot.keys());
|
|
98994
|
-
for (const sourceValueId of roots.keys()) serverRootIds.add(sourceValueId);
|
|
98995
|
-
const preparedValueChangeById = /* @__PURE__ */ new Map();
|
|
98996
|
-
for (const change of args.prepared) {
|
|
98997
|
-
if (change.recordKind !== "value") continue;
|
|
98998
|
-
if (change.operation === "delete") continue;
|
|
98999
|
-
if (change.nextData !== void 0)
|
|
99000
|
-
preparedValueChangeById.set(change.recordId, change);
|
|
99001
|
-
}
|
|
99002
|
-
const allServerIds = /* @__PURE__ */ new Set();
|
|
99003
|
-
for (const sourceValueId of serverRootIds) {
|
|
99004
|
-
allServerIds.add(sourceValueId);
|
|
99005
|
-
for (const change of serverCreatedByRoot.get(sourceValueId) ?? []) {
|
|
99006
|
-
allServerIds.add(change.recordId);
|
|
99007
|
-
}
|
|
99008
|
-
}
|
|
99009
|
-
const graph = createVariantMaterializedValueGraphContext(
|
|
99010
|
-
args.document,
|
|
99011
|
-
args.document.variants ?? []
|
|
99012
|
-
);
|
|
99013
|
-
const serverOwners = graph.ownersForValues(allServerIds);
|
|
99014
|
-
const effectiveValues = new EffectiveValueReader(args.document);
|
|
99015
|
-
for (const sourceValueId of serverRootIds) {
|
|
99016
|
-
const local = roots.get(sourceValueId);
|
|
99017
|
-
const rootChange = preparedValueChangeById.get(sourceValueId);
|
|
99018
|
-
if (local === void 0)
|
|
99019
|
-
throw new Error(
|
|
99020
|
-
`Initializer materialization parity failed for value "${sourceValueId}": client root is missing.`
|
|
99021
|
-
);
|
|
99022
|
-
if (rootChange === void 0)
|
|
99023
|
-
throw new Error(
|
|
99024
|
-
`Initializer materialization parity failed for value "${sourceValueId}": server root is missing.`
|
|
99025
|
-
);
|
|
99026
|
-
if (local.rows.length === 0)
|
|
99027
|
-
throw new Error(
|
|
99028
|
-
`Initializer materialization transport for value "${sourceValueId}" has no rows.`
|
|
99029
|
-
);
|
|
99030
|
-
if (local.rows[0]?.id !== sourceValueId) {
|
|
99031
|
-
throw new Error(
|
|
99032
|
-
`Initializer materialization transport for value "${sourceValueId}" must be root-first.`
|
|
99033
|
-
);
|
|
99034
|
-
}
|
|
99035
|
-
const serverChanges = [
|
|
99036
|
-
rootChange,
|
|
99037
|
-
...serverCreatedByRoot.get(sourceValueId) ?? []
|
|
99038
|
-
];
|
|
99039
|
-
if (serverChanges.length !== local.rows.length) {
|
|
99040
|
-
throw new Error(
|
|
99041
|
-
`Initializer materialization parity failed for value "${sourceValueId}": client produced ${local.rows.length} rows and server produced ${serverChanges.length}.`
|
|
99042
|
-
);
|
|
99043
|
-
}
|
|
99044
|
-
const identities = /* @__PURE__ */ new Set();
|
|
99045
|
-
const serverIdToAssigned = /* @__PURE__ */ new Map();
|
|
99046
|
-
for (let index = 0; index < local.rows.length; index += 1) {
|
|
99047
|
-
const id2 = local.rows[index].id;
|
|
99048
|
-
if (typeof id2 !== "string")
|
|
99049
|
-
throw new Error(
|
|
99050
|
-
`Initializer materialization transport for value "${sourceValueId}" contains an invalid row id at index ${index}.`
|
|
99051
|
-
);
|
|
99052
|
-
if (identities.has(id2))
|
|
99053
|
-
throw new Error(
|
|
99054
|
-
`Initializer materialization transport for value "${sourceValueId}" contains duplicate row id "${id2}".`
|
|
99055
|
-
);
|
|
99056
|
-
identities.add(id2);
|
|
99057
|
-
serverIdToAssigned.set(serverChanges[index].recordId, id2);
|
|
99058
|
-
}
|
|
99059
|
-
const rootRow = graph.valuesById.get(sourceValueId);
|
|
99060
|
-
const owner = effectiveValues.memberForValue(sourceValueId);
|
|
99061
|
-
if (rootRow === void 0)
|
|
99062
|
-
throw new Error(
|
|
99063
|
-
`Initializer parity root "${sourceValueId}" has no value row.`
|
|
99064
|
-
);
|
|
99065
|
-
if (owner === void 0)
|
|
99066
|
-
throw new Error(
|
|
99067
|
-
`Initializer parity root "${sourceValueId}" has no member placement.`
|
|
99068
|
-
);
|
|
99069
|
-
const env = graph.genericEnvironmentForRow(rootRow, owner);
|
|
99070
|
-
const type = graph.typeInfoForMember(owner, env);
|
|
99071
|
-
if (type === null)
|
|
99072
|
-
throw new Error(
|
|
99073
|
-
`Initializer parity root "${sourceValueId}" has no concrete type.`
|
|
99074
|
-
);
|
|
99075
|
-
const assignedServerRows = [];
|
|
99076
|
-
const serverRowsById = /* @__PURE__ */ new Map();
|
|
99077
|
-
for (const change of serverChanges) {
|
|
99078
|
-
if (!isMemberValue(change.nextData))
|
|
99079
|
-
throw new Error(
|
|
99080
|
-
`Initializer materialization server row "${change.recordId}" is invalid.`
|
|
99081
|
-
);
|
|
99082
|
-
const row = graph.rewriteReferences({
|
|
99083
|
-
row: change.nextData,
|
|
99084
|
-
replacements: serverIdToAssigned,
|
|
99085
|
-
ownerValueId: change.recordId,
|
|
99086
|
-
owner: serverOwners.get(change.recordId)
|
|
99087
|
-
});
|
|
99088
|
-
assignedServerRows.push(row);
|
|
99089
|
-
serverRowsById.set(row.id, row);
|
|
99090
|
-
}
|
|
99091
|
-
const normalizedServer = effectiveValues.withRowOverrides(serverRowsById).normalizeTypedRow(sourceValueId, type, owner, env, identities);
|
|
99092
|
-
const localRows = /* @__PURE__ */ new Map();
|
|
99093
|
-
for (const row of local.rows) {
|
|
99094
|
-
if (!isMemberValue(row))
|
|
99095
|
-
throw new Error(
|
|
99096
|
-
`Initializer materialization transport for value "${sourceValueId}" contains an invalid value row.`
|
|
99097
|
-
);
|
|
99098
|
-
localRows.set(row.id, row);
|
|
99099
|
-
}
|
|
99100
|
-
const normalizedLocal = effectiveValues.withRowOverrides(localRows).normalizeTypedRow(sourceValueId, type, owner, env, identities);
|
|
99101
|
-
if (!effectiveValuesEqual(normalizedServer, normalizedLocal)) {
|
|
99102
|
-
throw new Error(
|
|
99103
|
-
`Initializer materialization parity failed for value "${sourceValueId}": CLI and server graphs differ.`
|
|
99104
|
-
);
|
|
99105
|
-
}
|
|
99106
|
-
for (const [index, change] of serverChanges.entries()) {
|
|
99107
|
-
const assignedRow = assignedServerRows[index];
|
|
99108
|
-
change.recordId = assignedRow.id;
|
|
99109
|
-
change.nextData = assignedRow;
|
|
99110
|
-
}
|
|
99111
|
-
roots.delete(sourceValueId);
|
|
99112
|
-
}
|
|
99113
|
-
if (roots.size > 0) {
|
|
99114
|
-
throw new Error(
|
|
99115
|
-
`Initializer materialization transport names roots the server did not materialize: ${[...roots.keys()].join(", ")}.`
|
|
99116
|
-
);
|
|
99117
|
-
}
|
|
99118
|
-
}
|
|
99119
99019
|
function constructorArgumentsSemanticallyEqual(args) {
|
|
99120
99020
|
const current = args.currentReader;
|
|
99121
99021
|
const replayRows = /* @__PURE__ */ new Map([
|
|
@@ -99873,9 +99773,9 @@ function materializeAuthoredValueSeeds(args) {
|
|
|
99873
99773
|
member: materializationMember,
|
|
99874
99774
|
// P61 must leave a computed static root as an init-backed prepared
|
|
99875
99775
|
// row until `materializePreparedInstanceInitializers` runs. The
|
|
99876
|
-
// default builder evaluates it immediately, which bypasses
|
|
99877
|
-
//
|
|
99878
|
-
//
|
|
99776
|
+
// default builder evaluates it immediately, which bypasses the
|
|
99777
|
+
// initializer-materialization grouping for evaluator-created
|
|
99778
|
+
// interior rows.
|
|
99879
99779
|
seed: { ...seed, values: seed.values ?? [] }
|
|
99880
99780
|
});
|
|
99881
99781
|
const { createdValues, localizedTexts, storageKeyDeclarations, rootValue } = materialized;
|
|
@@ -113037,12 +112937,12 @@ function lowerGenericRelations(context, analysis) {
|
|
|
113037
112937
|
);
|
|
113038
112938
|
}
|
|
113039
112939
|
const args = expressionArguments(expression);
|
|
113040
|
-
const
|
|
112940
|
+
const unknown = [...args.keys()].find(
|
|
113041
112941
|
(name) => !["kind", "source", "target", "order"].includes(name)
|
|
113042
112942
|
);
|
|
113043
|
-
if (
|
|
112943
|
+
if (unknown !== void 0) {
|
|
113044
112944
|
throw new Error(
|
|
113045
|
-
`ProjectRelations[${index}] has unknown argument ${JSON.stringify(
|
|
112945
|
+
`ProjectRelations[${index}] has unknown argument ${JSON.stringify(unknown)}.`
|
|
113046
112946
|
);
|
|
113047
112947
|
}
|
|
113048
112948
|
const kind = args.get("kind");
|
|
@@ -117585,7 +117485,7 @@ function materializeInitializersLocallyV4(args) {
|
|
|
117585
117485
|
},
|
|
117586
117486
|
// §4: a call-site field is an explicit override even when it equals the
|
|
117587
117487
|
// class default, so the evaluated construction's own field list is what
|
|
117588
|
-
// pins rows against collapse.
|
|
117488
|
+
// pins rows against collapse. Push preparation pins the same set.
|
|
117589
117489
|
pinnedRootSchemaKeys,
|
|
117590
117490
|
virtualValueIdForSource: (instanceRootId, sourceIdentity3) => isPendingId(instanceRootId) || hasPendingVirtualSourceIdentity(sourceIdentity3) ? pendingVirtualValueId(instanceRootId, sourceIdentity3) : virtualValueId(instanceRootId, sourceIdentity3)
|
|
117591
117491
|
});
|
|
@@ -117902,6 +117802,25 @@ function compareWorkspacePaths(left, right) {
|
|
|
117902
117802
|
if (left > right) return 1;
|
|
117903
117803
|
return 0;
|
|
117904
117804
|
}
|
|
117805
|
+
function materializeWorkspaceStatusInitializers(workspace, status, forceRecompile) {
|
|
117806
|
+
return materializeInitializersLocallyV4({
|
|
117807
|
+
workspace,
|
|
117808
|
+
forceRecompile,
|
|
117809
|
+
changes: status.changes.map((change) => ({
|
|
117810
|
+
recordKind: change.recordKind,
|
|
117811
|
+
recordId: change.recordId,
|
|
117812
|
+
operation: change.kind,
|
|
117813
|
+
nextData: change.kind === "delete" ? void 0 : change.nextData,
|
|
117814
|
+
deleted: change.kind === "delete" ? true : void 0,
|
|
117815
|
+
intent: createNeoCliPushIntent(change),
|
|
117816
|
+
expectedBaseContentHash: change.kind === "create" ? null : change.casBaseHash ?? null
|
|
117817
|
+
})),
|
|
117818
|
+
authoredValueSeeds: Array.from(
|
|
117819
|
+
status.authoredValueSeeds,
|
|
117820
|
+
([memberId, seed]) => ({ memberId, ...seed })
|
|
117821
|
+
)
|
|
117822
|
+
});
|
|
117823
|
+
}
|
|
117905
117824
|
function computeWorkspaceStatus(workspace, options) {
|
|
117906
117825
|
let phaseStarted = performance.now();
|
|
117907
117826
|
options.onPhase?.("Reading project schema\u2026");
|
|
@@ -118649,39 +118568,25 @@ function computeWorkspaceStatus(workspace, options) {
|
|
|
118649
118568
|
)
|
|
118650
118569
|
);
|
|
118651
118570
|
}
|
|
118652
|
-
|
|
118653
|
-
|
|
118654
|
-
|
|
118655
|
-
|
|
118656
|
-
|
|
118657
|
-
|
|
118658
|
-
|
|
118659
|
-
|
|
118660
|
-
|
|
118661
|
-
|
|
118662
|
-
|
|
118663
|
-
|
|
118664
|
-
|
|
118665
|
-
|
|
118666
|
-
|
|
118667
|
-
|
|
118668
|
-
|
|
118669
|
-
|
|
118670
|
-
...seed
|
|
118671
|
-
})
|
|
118672
|
-
)
|
|
118673
|
-
});
|
|
118674
|
-
} catch (error) {
|
|
118675
|
-
parseErrors.push(
|
|
118676
|
-
new SchemaSourceError(
|
|
118677
|
-
error instanceof Error ? error.message : String(error),
|
|
118678
|
-
"<initializer-materialization>",
|
|
118679
|
-
1,
|
|
118680
|
-
1
|
|
118681
|
-
)
|
|
118682
|
-
);
|
|
118571
|
+
if (options.skipInitializerMaterialization !== true) {
|
|
118572
|
+
try {
|
|
118573
|
+
materializeWorkspaceStatusInitializers(
|
|
118574
|
+
workspace,
|
|
118575
|
+
{ changes, authoredValueSeeds },
|
|
118576
|
+
options.forceRecompile
|
|
118577
|
+
);
|
|
118578
|
+
} catch (error) {
|
|
118579
|
+
parseErrors.push(
|
|
118580
|
+
new SchemaSourceError(
|
|
118581
|
+
error instanceof Error ? error.message : String(error),
|
|
118582
|
+
"<initializer-materialization>",
|
|
118583
|
+
1,
|
|
118584
|
+
1
|
|
118585
|
+
)
|
|
118586
|
+
);
|
|
118587
|
+
}
|
|
118588
|
+
reportPhase("initializer-materialization");
|
|
118683
118589
|
}
|
|
118684
|
-
reportPhase("initializer-materialization");
|
|
118685
118590
|
return {
|
|
118686
118591
|
...projectAnalysisV4 === null ? {} : {
|
|
118687
118592
|
sourceSnapshot: {
|
|
@@ -118697,7 +118602,6 @@ function computeWorkspaceStatus(workspace, options) {
|
|
|
118697
118602
|
reconstructed: reconstructed3,
|
|
118698
118603
|
authoredValueSeeds,
|
|
118699
118604
|
pendingValueIdentitySites: valueLowerRegistry.pendingValueIdentitySites,
|
|
118700
|
-
localInitializerMaterialization,
|
|
118701
118605
|
binaryChanges,
|
|
118702
118606
|
binaryFiles,
|
|
118703
118607
|
initConversions: collectInitDefaultConversions(
|
|
@@ -119779,6 +119683,7 @@ function verifyProjectSourceCommitAgainstStateV4(args) {
|
|
|
119779
119683
|
const status = computeWorkspaceStatus(workspace, {
|
|
119780
119684
|
forceRecompile: args.forceRecompile,
|
|
119781
119685
|
skipProjectBinaryInspection: true,
|
|
119686
|
+
skipInitializerMaterialization: true,
|
|
119782
119687
|
useBuildCaches: false,
|
|
119783
119688
|
writeProjectAnalysisCache: () => void 0,
|
|
119784
119689
|
trustedPendingProjectFiles,
|
|
@@ -119824,9 +119729,6 @@ function verifyProjectSourceCommitAgainstStateV4(args) {
|
|
|
119824
119729
|
...rewrite(seed)
|
|
119825
119730
|
})
|
|
119826
119731
|
);
|
|
119827
|
-
const expectedInitializerMaterialization = rewrite(
|
|
119828
|
-
status.localInitializerMaterialization ?? { roots: [] }
|
|
119829
|
-
);
|
|
119830
119732
|
for (const pendingId2 of assignments.keys()) {
|
|
119831
119733
|
if (!usedAssignments.has(pendingId2)) {
|
|
119832
119734
|
throw new ProjectSourceCommitVerificationError(
|
|
@@ -119845,10 +119747,6 @@ function verifyProjectSourceCommitAgainstStateV4(args) {
|
|
|
119845
119747
|
});
|
|
119846
119748
|
compareChanges(expectedChanges, verifiableChanges);
|
|
119847
119749
|
compareSeeds(expectedSeeds, args.authoredValueSeeds);
|
|
119848
|
-
compareInitializerMaterialization(
|
|
119849
|
-
expectedInitializerMaterialization,
|
|
119850
|
-
args.initializerMaterialization ?? { roots: [] }
|
|
119851
|
-
);
|
|
119852
119750
|
}
|
|
119853
119751
|
function isDerivedOnlyRefresh(change, stateRecords) {
|
|
119854
119752
|
if (change.operation !== "update") return false;
|
|
@@ -120242,33 +120140,6 @@ function compareSeeds(expected, received) {
|
|
|
120242
120140
|
);
|
|
120243
120141
|
}
|
|
120244
120142
|
}
|
|
120245
|
-
function compareInitializerMaterialization(expected, received) {
|
|
120246
|
-
const normalize = (transport) => ({
|
|
120247
|
-
roots: transport.roots.map((root) => ({
|
|
120248
|
-
sourceValueId: root.sourceValueId,
|
|
120249
|
-
rows: [...root.rows].map((row) => {
|
|
120250
|
-
const normalized = { ...row };
|
|
120251
|
-
delete normalized.createdAt;
|
|
120252
|
-
delete normalized.updatedAt;
|
|
120253
|
-
return normalized;
|
|
120254
|
-
}).sort(
|
|
120255
|
-
(left, right) => String(left.id ?? "").localeCompare(String(right.id ?? ""))
|
|
120256
|
-
)
|
|
120257
|
-
})).sort(
|
|
120258
|
-
(left, right) => left.sourceValueId.localeCompare(right.sourceValueId)
|
|
120259
|
-
)
|
|
120260
|
-
});
|
|
120261
|
-
const normalizedExpected = normalize(expected);
|
|
120262
|
-
const normalizedReceived = normalize(received);
|
|
120263
|
-
if (canonicalStringify(normalizedExpected) !== canonicalStringify(normalizedReceived)) {
|
|
120264
|
-
const difference = firstDifference(normalizedExpected, normalizedReceived);
|
|
120265
|
-
const rootIndex = difference === null ? null : /^\$\.roots\[(\d+)\]/u.exec(difference.path)?.[1];
|
|
120266
|
-
const sourceValueId = rootIndex === null || rootIndex === void 0 ? void 0 : normalizedExpected.roots[Number(rootIndex)]?.sourceValueId;
|
|
120267
|
-
throw new ProjectSourceCommitVerificationError(
|
|
120268
|
-
`Source commit initializer materialization does not match trusted evaluation${difference === null ? "." : `${sourceValueId === void 0 ? "" : ` for root ${JSON.stringify(sourceValueId)}`} at ${difference.path}: trusted ${formatDifferenceValue(difference.trusted)}, submitted ${formatDifferenceValue(difference.submitted)}.`}`
|
|
120269
|
-
);
|
|
120270
|
-
}
|
|
120271
|
-
}
|
|
120272
120143
|
function normalizeSeedForComparison(seed) {
|
|
120273
120144
|
const normalized = { ...seed };
|
|
120274
120145
|
if (seed.values !== void 0) {
|
|
@@ -120376,7 +120247,7 @@ var init_trusted_commit_verification = __esm({
|
|
|
120376
120247
|
});
|
|
120377
120248
|
|
|
120378
120249
|
// src/project-source/server-preparation-preflight.ts
|
|
120379
|
-
function
|
|
120250
|
+
function prepareClientPush(args) {
|
|
120380
120251
|
for (const change of args.changes) {
|
|
120381
120252
|
if (change.recordKind !== "value" || change.operation !== "update") {
|
|
120382
120253
|
continue;
|
|
@@ -120388,14 +120259,40 @@ function assertServerPreparationSucceeds(args) {
|
|
|
120388
120259
|
});
|
|
120389
120260
|
if (refusal !== null) throw new ServerPreparationPreflightError(refusal);
|
|
120390
120261
|
}
|
|
120262
|
+
const base = readPulledPreparationBase(args);
|
|
120263
|
+
let prepared;
|
|
120391
120264
|
try {
|
|
120392
|
-
|
|
120393
|
-
...args,
|
|
120394
|
-
initializerMaterialization: args.localInitializerMaterialization
|
|
120395
|
-
});
|
|
120265
|
+
prepared = prepareAgainstPulledBase(args, base);
|
|
120396
120266
|
} catch (error) {
|
|
120397
120267
|
throw locateBodyCompileFailure(error, args.sourceByRecord);
|
|
120398
120268
|
}
|
|
120269
|
+
const relationOrderNoopIds = relationOrderMaintenanceNoopIds(
|
|
120270
|
+
base.document.internalRecordRelations ?? [],
|
|
120271
|
+
prepared
|
|
120272
|
+
);
|
|
120273
|
+
const changes = [];
|
|
120274
|
+
for (const change of prepared) {
|
|
120275
|
+
if (change.recordKind === "internal-record-relation" && relationOrderNoopIds.has(change.recordId)) {
|
|
120276
|
+
continue;
|
|
120277
|
+
}
|
|
120278
|
+
changes.push({
|
|
120279
|
+
...change,
|
|
120280
|
+
expectedBaseContentHash: change.expectedBaseContentHash === void 0 ? pulledCasBaseHash(
|
|
120281
|
+
change,
|
|
120282
|
+
args.workspace.state.records[`${change.recordKind}:${change.recordId}`]
|
|
120283
|
+
) : change.expectedBaseContentHash
|
|
120284
|
+
});
|
|
120285
|
+
}
|
|
120286
|
+
return {
|
|
120287
|
+
changes,
|
|
120288
|
+
basePayloadBytes: projectVersionBasePayloadBytes(base.document, changes)
|
|
120289
|
+
};
|
|
120290
|
+
}
|
|
120291
|
+
function pulledCasBaseHash(change, record6) {
|
|
120292
|
+
if (change.operation === "create") return null;
|
|
120293
|
+
if (record6 === void 0) return null;
|
|
120294
|
+
if (record6.conflictServerHash !== void 0) return record6.conflictServerHash;
|
|
120295
|
+
return record6.contentHash;
|
|
120399
120296
|
}
|
|
120400
120297
|
function assertDerivedEdgeCompatibility(workspace) {
|
|
120401
120298
|
const localVersion = PROJECT_SNAPSHOT_DERIVED_EDGE_EXTRACTOR_VERSION;
|
|
@@ -120460,15 +120357,22 @@ function prepareWithScopedSafetyValve(args) {
|
|
|
120460
120357
|
args.validate(full);
|
|
120461
120358
|
return full;
|
|
120462
120359
|
}
|
|
120463
|
-
function
|
|
120360
|
+
function readPulledPreparationBase(args) {
|
|
120464
120361
|
const serverTimestamp = args.serverTimestamp ?? Date.now();
|
|
120465
120362
|
const rawDocument = pulledProjectDocumentRaw(args.workspace);
|
|
120466
|
-
|
|
120467
|
-
|
|
120468
|
-
|
|
120363
|
+
return {
|
|
120364
|
+
rawDocument,
|
|
120365
|
+
document: withReplayValueIdFactory(
|
|
120366
|
+
withStoredValueBase(readProjectDocument(rawDocument)),
|
|
120367
|
+
args.createValueId,
|
|
120368
|
+
serverTimestamp
|
|
120369
|
+
),
|
|
120370
|
+
contentHashHeads: readProjectDocumentContentHashHeads(rawDocument),
|
|
120469
120371
|
serverTimestamp
|
|
120470
|
-
|
|
120471
|
-
|
|
120372
|
+
};
|
|
120373
|
+
}
|
|
120374
|
+
function prepareAgainstPulledBase(args, base) {
|
|
120375
|
+
const { rawDocument, document, contentHashHeads, serverTimestamp } = base;
|
|
120472
120376
|
const changes = args.changes.map((change) => ({
|
|
120473
120377
|
...change,
|
|
120474
120378
|
recordKind: narrowRecordKind(
|
|
@@ -120520,7 +120424,6 @@ function prepareServerPreparationChanges(args) {
|
|
|
120520
120424
|
contentHashHeads,
|
|
120521
120425
|
changes: trustedChanges,
|
|
120522
120426
|
authoredValueSeeds: args.authoredValueSeeds,
|
|
120523
|
-
initializerMaterialization: args.initializerMaterialization,
|
|
120524
120427
|
// A CLI push is always a trusted-source commit, so the server always
|
|
120525
120428
|
// expands read-only source conversions for it.
|
|
120526
120429
|
expandReadOnlySourceConversions: true,
|
|
@@ -120886,6 +120789,8 @@ var init_server_preparation_preflight = __esm({
|
|
|
120886
120789
|
init_project_document_read();
|
|
120887
120790
|
init_project_snapshot_derived_edges();
|
|
120888
120791
|
init_project_version_schema_commit();
|
|
120792
|
+
init_project_version_relation_sweep_trigger();
|
|
120793
|
+
init_project_version_transaction_planning();
|
|
120889
120794
|
init_project_version_whole_graph_validation();
|
|
120890
120795
|
init_project_world_placement_bindings();
|
|
120891
120796
|
init_build_default_member_value();
|
|
@@ -130626,18 +130531,28 @@ async function createConvexPushConnection(workspace) {
|
|
|
130626
130531
|
const bytes = Buffer2.from(json);
|
|
130627
130532
|
if (bytes.byteLength > SCHEMA_COMMIT_HTTP_MAX_DECODED_BYTES)
|
|
130628
130533
|
throw new NeoApiError(
|
|
130629
|
-
|
|
130534
|
+
`Schema commit is ${bytes.byteLength} bytes decoded; the limit is ${SCHEMA_COMMIT_HTTP_MAX_DECODED_BYTES}.`,
|
|
130630
130535
|
413,
|
|
130631
|
-
{
|
|
130536
|
+
{
|
|
130537
|
+
error: "schema-commit-too-large",
|
|
130538
|
+
measure: "decoded",
|
|
130539
|
+
bytes: bytes.byteLength,
|
|
130540
|
+
limitBytes: SCHEMA_COMMIT_HTTP_MAX_DECODED_BYTES
|
|
130541
|
+
}
|
|
130632
130542
|
);
|
|
130633
130543
|
const compressed = bytes.byteLength >= 1024 ? gzipSync(bytes) : bytes;
|
|
130634
130544
|
const gzip = compressed.byteLength < bytes.byteLength;
|
|
130635
130545
|
const payload = gzip ? compressed : bytes;
|
|
130636
130546
|
if (payload.byteLength > SCHEMA_COMMIT_HTTP_MAX_BYTES)
|
|
130637
130547
|
throw new NeoApiError(
|
|
130638
|
-
|
|
130548
|
+
`Schema commit is ${payload.byteLength} bytes encoded; the limit is ${SCHEMA_COMMIT_HTTP_MAX_BYTES}.`,
|
|
130639
130549
|
413,
|
|
130640
|
-
{
|
|
130550
|
+
{
|
|
130551
|
+
error: "schema-commit-too-large",
|
|
130552
|
+
measure: "encoded",
|
|
130553
|
+
bytes: payload.byteLength,
|
|
130554
|
+
limitBytes: SCHEMA_COMMIT_HTTP_MAX_BYTES
|
|
130555
|
+
}
|
|
130641
130556
|
);
|
|
130642
130557
|
const client = new NeoApiClient(siteUrl, await tokenCache.getToken());
|
|
130643
130558
|
const path = `${SCHEMA_COMMIT_HTTP_PATH}?${new URLSearchParams({ projectId: workspace.config.projectId, versionId: workspace.config.versionId })}`;
|
|
@@ -131239,9 +131154,286 @@ var init_concurrency = __esm({
|
|
|
131239
131154
|
}
|
|
131240
131155
|
});
|
|
131241
131156
|
|
|
131157
|
+
// src/project-source/project-file-pull.ts
|
|
131158
|
+
import {
|
|
131159
|
+
existsSync as existsSync8,
|
|
131160
|
+
mkdtempSync,
|
|
131161
|
+
readFileSync as readFileSync11,
|
|
131162
|
+
rmSync as rmSync5,
|
|
131163
|
+
writeFileSync as writeFileSync8
|
|
131164
|
+
} from "node:fs";
|
|
131165
|
+
import { tmpdir } from "node:os";
|
|
131166
|
+
import { join as join9 } from "node:path";
|
|
131167
|
+
async function pullProjectBinariesV4(args) {
|
|
131168
|
+
const resolvePath = createWorkspaceSourcePathResolver(args.workspace.root);
|
|
131169
|
+
const plans = /* @__PURE__ */ new Map();
|
|
131170
|
+
const downloads = [];
|
|
131171
|
+
const localById = new Map(
|
|
131172
|
+
(args.localBinaries ?? []).map((binary) => [binary.fileId, binary])
|
|
131173
|
+
);
|
|
131174
|
+
const states = /* @__PURE__ */ new Map();
|
|
131175
|
+
const conflicts = [];
|
|
131176
|
+
let downloaded = 0;
|
|
131177
|
+
let conflicted = 0;
|
|
131178
|
+
for (const record6 of args.document.records.values()) {
|
|
131179
|
+
if (record6.deleted || record6.recordKind !== "project-file") continue;
|
|
131180
|
+
if (!isObjectRecord2(record6.data)) {
|
|
131181
|
+
throw new Error(`project-file:${record6.recordId} must be an object.`);
|
|
131182
|
+
}
|
|
131183
|
+
if (record6.data.status !== "uploaded") continue;
|
|
131184
|
+
const existing = plans.get(record6.recordId);
|
|
131185
|
+
if (existing !== void 0) {
|
|
131186
|
+
if (existing.contentHash !== record6.contentHash)
|
|
131187
|
+
throw new Error(
|
|
131188
|
+
`Project file ${record6.recordId} appears with conflicting content hashes in the pulled document.`
|
|
131189
|
+
);
|
|
131190
|
+
continue;
|
|
131191
|
+
}
|
|
131192
|
+
const key = `project-file:${record6.recordId}`;
|
|
131193
|
+
const previous = args.previousRecords[key];
|
|
131194
|
+
const localStatus = localById.get(record6.recordId);
|
|
131195
|
+
const declarationPresent = args.destructive === true || args.localBinaries === void 0 || previous === void 0 || localStatus !== void 0;
|
|
131196
|
+
const path = localStatus?.path ?? previous?.projectBinary?.path ?? canonicalProjectBinaryPathV42(record6.data);
|
|
131197
|
+
const absolute = resolvePath(path);
|
|
131198
|
+
const localDigest = existsSync8(absolute) ? sha256File(absolute) : null;
|
|
131199
|
+
const baseDigest = previous?.projectBinary?.sha256 ?? readSha256(previous?.data) ?? null;
|
|
131200
|
+
const remoteDigest = requiredSha256(
|
|
131201
|
+
record6.data,
|
|
131202
|
+
`project-file:${record6.recordId} metadata`
|
|
131203
|
+
);
|
|
131204
|
+
let action = planBinaryMergeV4({
|
|
131205
|
+
baseDigest,
|
|
131206
|
+
localDigest,
|
|
131207
|
+
remoteDigest,
|
|
131208
|
+
declarationPresent,
|
|
131209
|
+
hadLocalBytes: previous?.projectBinary !== void 0
|
|
131210
|
+
});
|
|
131211
|
+
if (args.destructive === true) {
|
|
131212
|
+
action = localDigest === remoteDigest ? "unchanged" : "download";
|
|
131213
|
+
}
|
|
131214
|
+
const plan = {
|
|
131215
|
+
key,
|
|
131216
|
+
fileId: record6.recordId,
|
|
131217
|
+
contentHash: record6.contentHash,
|
|
131218
|
+
data: record6.data,
|
|
131219
|
+
previous,
|
|
131220
|
+
path,
|
|
131221
|
+
baseDigest,
|
|
131222
|
+
remoteDigest,
|
|
131223
|
+
action
|
|
131224
|
+
};
|
|
131225
|
+
plans.set(record6.recordId, plan);
|
|
131226
|
+
if (action === "download" || action === "conflict") downloads.push(plan);
|
|
131227
|
+
}
|
|
131228
|
+
let stagingDirectory;
|
|
131229
|
+
try {
|
|
131230
|
+
const stagedPaths = /* @__PURE__ */ new Map();
|
|
131231
|
+
if (downloads.length > 0) {
|
|
131232
|
+
stagingDirectory = mkdtempSync(join9(tmpdir(), "neo-pull-files-"));
|
|
131233
|
+
const directory = stagingDirectory;
|
|
131234
|
+
const client = args.client ?? NeoApiClient.forBaseUrl(args.workspace.config.apiBaseUrl);
|
|
131235
|
+
await mapWithConcurrency(
|
|
131236
|
+
downloads,
|
|
131237
|
+
DOWNLOAD_CONCURRENCY,
|
|
131238
|
+
async (plan, index) => {
|
|
131239
|
+
const response = await download(
|
|
131240
|
+
plan.data,
|
|
131241
|
+
plan.fileId,
|
|
131242
|
+
client,
|
|
131243
|
+
args.workspace
|
|
131244
|
+
);
|
|
131245
|
+
if (response.sha256 !== plan.remoteDigest) {
|
|
131246
|
+
throw new Error(
|
|
131247
|
+
`Project file ${plan.fileId} content changed while pull was in progress (${plan.remoteDigest} -> ${response.sha256}). Pull again against a stable version head.`
|
|
131248
|
+
);
|
|
131249
|
+
}
|
|
131250
|
+
const stagedPath = join9(directory, String(index));
|
|
131251
|
+
writeFileSync8(stagedPath, response.bytes);
|
|
131252
|
+
stagedPaths.set(plan.fileId, stagedPath);
|
|
131253
|
+
}
|
|
131254
|
+
);
|
|
131255
|
+
}
|
|
131256
|
+
for (const plan of plans.values()) {
|
|
131257
|
+
const {
|
|
131258
|
+
key,
|
|
131259
|
+
fileId,
|
|
131260
|
+
data,
|
|
131261
|
+
previous,
|
|
131262
|
+
path,
|
|
131263
|
+
baseDigest,
|
|
131264
|
+
remoteDigest,
|
|
131265
|
+
action
|
|
131266
|
+
} = plan;
|
|
131267
|
+
const absolute = resolvePath(path);
|
|
131268
|
+
const stagedPath = stagedPaths.get(fileId);
|
|
131269
|
+
const remoteBytes = stagedPath === void 0 ? null : readFileSync11(stagedPath);
|
|
131270
|
+
if (action === "download") {
|
|
131271
|
+
if (remoteBytes === null) {
|
|
131272
|
+
throw new Error(
|
|
131273
|
+
`Project file ${fileId} download plan has no verified remote bytes.`
|
|
131274
|
+
);
|
|
131275
|
+
}
|
|
131276
|
+
writeVerifiedBinaryDownloadV4(absolute, remoteBytes, remoteDigest);
|
|
131277
|
+
downloaded += 1;
|
|
131278
|
+
states.set(key, binaryState(path, remoteDigest, data));
|
|
131279
|
+
continue;
|
|
131280
|
+
}
|
|
131281
|
+
if (action === "conflict") {
|
|
131282
|
+
if (remoteBytes === null) {
|
|
131283
|
+
throw new Error(
|
|
131284
|
+
`Project file ${fileId} conflict plan has no verified remote bytes.`
|
|
131285
|
+
);
|
|
131286
|
+
}
|
|
131287
|
+
const artifactPath = writeBinaryConflictArtifactV4(
|
|
131288
|
+
args.workspace.root,
|
|
131289
|
+
fileId,
|
|
131290
|
+
fileName(data),
|
|
131291
|
+
remoteBytes,
|
|
131292
|
+
remoteDigest
|
|
131293
|
+
);
|
|
131294
|
+
const state = binaryState(path, baseDigest, data);
|
|
131295
|
+
states.set(key, {
|
|
131296
|
+
...state,
|
|
131297
|
+
conflict: {
|
|
131298
|
+
action: "conflict",
|
|
131299
|
+
remoteSha256: remoteDigest,
|
|
131300
|
+
artifactPath
|
|
131301
|
+
}
|
|
131302
|
+
});
|
|
131303
|
+
conflicts.push(path);
|
|
131304
|
+
conflicted += 1;
|
|
131305
|
+
continue;
|
|
131306
|
+
}
|
|
131307
|
+
if (action === "converged" || action === "unchanged") {
|
|
131308
|
+
states.set(key, binaryState(path, remoteDigest, data));
|
|
131309
|
+
removePreviousConflict(args.workspace.root, previous?.projectBinary);
|
|
131310
|
+
continue;
|
|
131311
|
+
}
|
|
131312
|
+
states.set(key, binaryState(path, baseDigest, data));
|
|
131313
|
+
}
|
|
131314
|
+
for (const [key, previous] of Object.entries(args.previousRecords)) {
|
|
131315
|
+
if (previous.recordKind !== "project-file") continue;
|
|
131316
|
+
if (args.document.records.has(key)) continue;
|
|
131317
|
+
const localStatus = localById.get(previous.recordId);
|
|
131318
|
+
const path = localStatus?.path ?? previous.projectBinary?.path ?? canonicalProjectBinaryPathV42(previous.data);
|
|
131319
|
+
const absolute = resolvePath(path);
|
|
131320
|
+
const localDigest = existsSync8(absolute) ? sha256File(absolute) : null;
|
|
131321
|
+
const baseDigest = previous.projectBinary?.sha256 ?? readSha256(previous.data) ?? null;
|
|
131322
|
+
const action = planBinaryMergeV4({
|
|
131323
|
+
baseDigest,
|
|
131324
|
+
localDigest,
|
|
131325
|
+
remoteDigest: null,
|
|
131326
|
+
declarationPresent: localStatus !== void 0,
|
|
131327
|
+
hadLocalBytes: previous.projectBinary !== void 0
|
|
131328
|
+
});
|
|
131329
|
+
if (action === "delete-modify") {
|
|
131330
|
+
const data = isObjectRecord2(previous.data) ? previous.data : {};
|
|
131331
|
+
states.set(key, {
|
|
131332
|
+
...binaryState(path, baseDigest, data),
|
|
131333
|
+
conflict: {
|
|
131334
|
+
action: "delete-modify",
|
|
131335
|
+
remoteSha256: null
|
|
131336
|
+
}
|
|
131337
|
+
});
|
|
131338
|
+
conflicts.push(path);
|
|
131339
|
+
conflicted += 1;
|
|
131340
|
+
continue;
|
|
131341
|
+
}
|
|
131342
|
+
rmSync5(absolute, { force: true });
|
|
131343
|
+
removePreviousConflict(args.workspace.root, previous.projectBinary);
|
|
131344
|
+
}
|
|
131345
|
+
return { states, downloaded, conflicted, conflicts };
|
|
131346
|
+
} finally {
|
|
131347
|
+
if (stagingDirectory !== void 0)
|
|
131348
|
+
rmSync5(stagingDirectory, { recursive: true, force: true });
|
|
131349
|
+
}
|
|
131350
|
+
}
|
|
131351
|
+
async function download(data, fileId, client, workspace) {
|
|
131352
|
+
const version = typeof data.storageETag === "string" ? `?v=${encodeURIComponent(data.storageETag)}` : "";
|
|
131353
|
+
const path = `/api/projects/${workspace.config.projectId}/versions/${workspace.config.versionId}/files/${fileId}/content${version}`;
|
|
131354
|
+
const response = await client.getBytes(path);
|
|
131355
|
+
const computed = sha256Bytes(response.bytes);
|
|
131356
|
+
const metadataDigest = requiredSha256(
|
|
131357
|
+
data,
|
|
131358
|
+
`project-file:${fileId} metadata`
|
|
131359
|
+
);
|
|
131360
|
+
const headerDigest = normalizeSha256V4(
|
|
131361
|
+
response.contentSha256,
|
|
131362
|
+
`download response for project file ${fileId}`
|
|
131363
|
+
);
|
|
131364
|
+
if (headerDigest !== null && metadataDigest !== headerDigest) {
|
|
131365
|
+
throw new Error(
|
|
131366
|
+
`Project file ${fileId} metadata SHA-256 ${metadataDigest} did not match authenticated content response ${headerDigest}.`
|
|
131367
|
+
);
|
|
131368
|
+
}
|
|
131369
|
+
if (computed !== metadataDigest) {
|
|
131370
|
+
throw new Error(
|
|
131371
|
+
`Downloaded project file ${fileId} SHA-256 ${computed} did not match expected ${metadataDigest}.`
|
|
131372
|
+
);
|
|
131373
|
+
}
|
|
131374
|
+
if (typeof data.byteLength === "number" && response.bytes.byteLength !== data.byteLength) {
|
|
131375
|
+
throw new Error(
|
|
131376
|
+
`Downloaded project file ${fileId} has ${response.bytes.byteLength} bytes; metadata requires ${data.byteLength}.`
|
|
131377
|
+
);
|
|
131378
|
+
}
|
|
131379
|
+
if (typeof data.mimeType === "string" && response.contentType !== null && response.contentType !== data.mimeType) {
|
|
131380
|
+
throw new Error(
|
|
131381
|
+
`Downloaded project file ${fileId} content type ${response.contentType} did not match metadata ${data.mimeType}.`
|
|
131382
|
+
);
|
|
131383
|
+
}
|
|
131384
|
+
return { bytes: response.bytes, sha256: computed };
|
|
131385
|
+
}
|
|
131386
|
+
function committedProjectBinaryStateV4(previous, data) {
|
|
131387
|
+
return isObjectRecord2(data) ? binaryState(previous.path, readSha256(data), data) : previous;
|
|
131388
|
+
}
|
|
131389
|
+
function binaryState(path, sha256, data) {
|
|
131390
|
+
return {
|
|
131391
|
+
path,
|
|
131392
|
+
sha256,
|
|
131393
|
+
byteLength: typeof data.byteLength === "number" ? data.byteLength : 0,
|
|
131394
|
+
mimeType: typeof data.mimeType === "string" ? data.mimeType : "application/octet-stream"
|
|
131395
|
+
};
|
|
131396
|
+
}
|
|
131397
|
+
function readSha256(data) {
|
|
131398
|
+
if (!isObjectRecord2(data)) return null;
|
|
131399
|
+
return normalizeSha256V4(data.contentSha256, "project file metadata");
|
|
131400
|
+
}
|
|
131401
|
+
function requiredSha256(data, source) {
|
|
131402
|
+
if (!isObjectRecord2(data)) {
|
|
131403
|
+
throw new Error(`${source} must be an object.`);
|
|
131404
|
+
}
|
|
131405
|
+
const digest = normalizeSha256V4(data.contentSha256, source);
|
|
131406
|
+
if (digest === null) {
|
|
131407
|
+
throw new Error(`${source} is missing required contentSha256.`);
|
|
131408
|
+
}
|
|
131409
|
+
return digest;
|
|
131410
|
+
}
|
|
131411
|
+
function fileName(data) {
|
|
131412
|
+
if (typeof data.name !== "string") {
|
|
131413
|
+
throw new Error("Project file metadata has no filename.");
|
|
131414
|
+
}
|
|
131415
|
+
return data.name;
|
|
131416
|
+
}
|
|
131417
|
+
function removePreviousConflict(root, state) {
|
|
131418
|
+
if (state?.conflict?.artifactPath === void 0) return;
|
|
131419
|
+
rmSync5(join9(root, state.conflict.artifactPath), { force: true });
|
|
131420
|
+
}
|
|
131421
|
+
var DOWNLOAD_CONCURRENCY;
|
|
131422
|
+
var init_project_file_pull = __esm({
|
|
131423
|
+
"src/project-source/project-file-pull.ts"() {
|
|
131424
|
+
"use strict";
|
|
131425
|
+
init_workspace_source_path();
|
|
131426
|
+
init_concurrency();
|
|
131427
|
+
init_http();
|
|
131428
|
+
init_projection();
|
|
131429
|
+
init_project_files();
|
|
131430
|
+
DOWNLOAD_CONCURRENCY = 8;
|
|
131431
|
+
}
|
|
131432
|
+
});
|
|
131433
|
+
|
|
131242
131434
|
// src/project-source/project-file-push.ts
|
|
131243
|
-
import { basename as basename2, join as
|
|
131244
|
-
import { readFileSync as
|
|
131435
|
+
import { basename as basename2, join as join10 } from "node:path";
|
|
131436
|
+
import { readFileSync as readFileSync12 } from "node:fs";
|
|
131245
131437
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
131246
131438
|
async function cleanupRejectedProjectFilePushesV4(args) {
|
|
131247
131439
|
if (args.stagedUploadSessionId === null) return;
|
|
@@ -131297,8 +131489,8 @@ function prepareProjectFilePushesV4(args) {
|
|
|
131297
131489
|
`Project file ${recordId} has upload bytes but its source change has no record data.`
|
|
131298
131490
|
);
|
|
131299
131491
|
}
|
|
131300
|
-
const absolute =
|
|
131301
|
-
const bytes = new Uint8Array(
|
|
131492
|
+
const absolute = join10(args.workspace.root, binary.path);
|
|
131493
|
+
const bytes = new Uint8Array(readFileSync12(absolute));
|
|
131302
131494
|
const digest = sha256Bytes(bytes);
|
|
131303
131495
|
if (binary.localSha256 !== null && digest !== binary.localSha256) {
|
|
131304
131496
|
throw new Error(
|
|
@@ -131914,8 +132106,8 @@ var init_project_version_validation = __esm({
|
|
|
131914
132106
|
});
|
|
131915
132107
|
|
|
131916
132108
|
// src/commands/push-body-diagnostics.ts
|
|
131917
|
-
import { existsSync as
|
|
131918
|
-
import { join as
|
|
132109
|
+
import { existsSync as existsSync9, readFileSync as readFileSync13 } from "node:fs";
|
|
132110
|
+
import { join as join11 } from "node:path";
|
|
131919
132111
|
function createNeoScriptBodySourceLocator(workspace, status) {
|
|
131920
132112
|
const textByFile = /* @__PURE__ */ new Map();
|
|
131921
132113
|
return {
|
|
@@ -131937,8 +132129,8 @@ function createNeoScriptBodySourceLocator(workspace, status) {
|
|
|
131937
132129
|
textOf(file) {
|
|
131938
132130
|
const cached = textByFile.get(file);
|
|
131939
132131
|
if (cached !== void 0) return cached;
|
|
131940
|
-
const path =
|
|
131941
|
-
const text =
|
|
132132
|
+
const path = join11(workspace.root, file);
|
|
132133
|
+
const text = existsSync9(path) ? readFileSync13(path, "utf8") : null;
|
|
131942
132134
|
textByFile.set(file, text);
|
|
131943
132135
|
return text;
|
|
131944
132136
|
}
|
|
@@ -132096,14 +132288,14 @@ __export(push_exports, {
|
|
|
132096
132288
|
import { createHash as createHash10, randomUUID as randomUUID5 } from "node:crypto";
|
|
132097
132289
|
import {
|
|
132098
132290
|
mkdirSync as mkdirSync8,
|
|
132099
|
-
writeFileSync as
|
|
132100
|
-
rmSync as
|
|
132101
|
-
existsSync as
|
|
132102
|
-
readFileSync as
|
|
132291
|
+
writeFileSync as writeFileSync9,
|
|
132292
|
+
rmSync as rmSync6,
|
|
132293
|
+
existsSync as existsSync10,
|
|
132294
|
+
readFileSync as readFileSync14,
|
|
132103
132295
|
statSync
|
|
132104
132296
|
} from "node:fs";
|
|
132105
|
-
import { join as
|
|
132106
|
-
function assignPendingIds(changes, authoredValueSeeds, reconstructed3
|
|
132297
|
+
import { join as join12, relative as relative6, sep as sep6 } from "node:path";
|
|
132298
|
+
function assignPendingIds(changes, authoredValueSeeds, reconstructed3) {
|
|
132107
132299
|
const assigned = /* @__PURE__ */ new Map();
|
|
132108
132300
|
const assign = (pendingId2) => {
|
|
132109
132301
|
const existing = assigned.get(pendingId2);
|
|
@@ -132178,9 +132370,6 @@ function assignPendingIds(changes, authoredValueSeeds, reconstructed3, localInit
|
|
|
132178
132370
|
collect(record6.fullData);
|
|
132179
132371
|
}
|
|
132180
132372
|
}
|
|
132181
|
-
if (localInitializerMaterialization !== void 0) {
|
|
132182
|
-
collect(localInitializerMaterialization);
|
|
132183
|
-
}
|
|
132184
132373
|
const rewriteString = createIdentityRewriter(assigned);
|
|
132185
132374
|
const rewrite = (value) => {
|
|
132186
132375
|
if (assigned.size === 0) return value;
|
|
@@ -132290,16 +132479,7 @@ function assignPendingIds(changes, authoredValueSeeds, reconstructed3, localInit
|
|
|
132290
132479
|
reconstructed3.set(key, record6);
|
|
132291
132480
|
}
|
|
132292
132481
|
}
|
|
132293
|
-
|
|
132294
|
-
localInitializerMaterialization
|
|
132295
|
-
);
|
|
132296
|
-
return {
|
|
132297
|
-
assigned,
|
|
132298
|
-
authoredValueSeeds: rewrittenSeeds,
|
|
132299
|
-
...rewrittenLocalInitializerMaterialization === void 0 ? {} : {
|
|
132300
|
-
localInitializerMaterialization: rewrittenLocalInitializerMaterialization
|
|
132301
|
-
}
|
|
132302
|
-
};
|
|
132482
|
+
return { assigned, authoredValueSeeds: rewrittenSeeds };
|
|
132303
132483
|
}
|
|
132304
132484
|
function pendingInterfaceMemberSymbolOwner(value) {
|
|
132305
132485
|
const marker = ":member:";
|
|
@@ -132315,11 +132495,14 @@ function pendingInterfaceMemberSymbolOwner(value) {
|
|
|
132315
132495
|
}
|
|
132316
132496
|
async function commitProjectVersionChanges(args) {
|
|
132317
132497
|
const { workspace } = args;
|
|
132318
|
-
const body = {
|
|
132498
|
+
const body = clientPreparedCommitBody({
|
|
132499
|
+
workspace,
|
|
132319
132500
|
operation: args.operation,
|
|
132320
|
-
|
|
132321
|
-
|
|
132322
|
-
|
|
132501
|
+
prepared: prepareClientPush({
|
|
132502
|
+
workspace,
|
|
132503
|
+
changes: args.changes,
|
|
132504
|
+
authoredValueSeeds: []
|
|
132505
|
+
}),
|
|
132323
132506
|
stagedFiles: [],
|
|
132324
132507
|
stagedUploadSessionId: null,
|
|
132325
132508
|
// The asynchronous path keys reconnects on this identity; the rows name
|
|
@@ -132330,11 +132513,8 @@ async function commitProjectVersionChanges(args) {
|
|
|
132330
132513
|
)
|
|
132331
132514
|
).digest("hex"),
|
|
132332
132515
|
pendingIdAssignments: {},
|
|
132333
|
-
summary: args.summary
|
|
132334
|
-
|
|
132335
|
-
derivedEdgeExtractorVersion: PROJECT_SNAPSHOT_DERIVED_EDGE_EXTRACTOR_VERSION,
|
|
132336
|
-
forceRecompile: false
|
|
132337
|
-
};
|
|
132516
|
+
summary: args.summary
|
|
132517
|
+
});
|
|
132338
132518
|
const reporter = createPushProgressReporter(args.json, args.progressLabel);
|
|
132339
132519
|
reporter.report({
|
|
132340
132520
|
type: "project-transaction-progress",
|
|
@@ -132349,19 +132529,7 @@ async function commitProjectVersionChanges(args) {
|
|
|
132349
132529
|
});
|
|
132350
132530
|
try {
|
|
132351
132531
|
const connection = await createConvexPushConnection(workspace);
|
|
132352
|
-
|
|
132353
|
-
try {
|
|
132354
|
-
response = await connection.submit(body, false);
|
|
132355
|
-
} catch (error) {
|
|
132356
|
-
if (!(error instanceof NeoApiError) || error.status !== 413 || !isObjectRecord2(error.body) || error.body.error !== "schema-commit-route-required")
|
|
132357
|
-
throw error;
|
|
132358
|
-
response = await NeoApiClient.forBaseUrl(
|
|
132359
|
-
workspace.config.apiBaseUrl
|
|
132360
|
-
).post(
|
|
132361
|
-
`/api/projects/${workspace.config.projectId}/versions/${workspace.config.versionId}/schema/commit`,
|
|
132362
|
-
body
|
|
132363
|
-
);
|
|
132364
|
-
}
|
|
132532
|
+
const response = await connection.submit(body, false);
|
|
132365
132533
|
const accepted = readAcceptedProjectVersionCommitResponse(response);
|
|
132366
132534
|
if (accepted === null) {
|
|
132367
132535
|
if (!isObjectRecord2(response) || typeof response.kind !== "string") {
|
|
@@ -132388,6 +132556,23 @@ async function commitProjectVersionChanges(args) {
|
|
|
132388
132556
|
reporter.stop();
|
|
132389
132557
|
}
|
|
132390
132558
|
}
|
|
132559
|
+
function clientPreparedCommitBody(args) {
|
|
132560
|
+
return {
|
|
132561
|
+
operation: args.operation,
|
|
132562
|
+
changes: args.prepared.changes,
|
|
132563
|
+
basePayloadBytes: args.prepared.basePayloadBytes,
|
|
132564
|
+
stagedFiles: args.stagedFiles,
|
|
132565
|
+
stagedUploadSessionId: args.stagedUploadSessionId,
|
|
132566
|
+
sourceHash: args.sourceHash,
|
|
132567
|
+
pendingIdAssignments: args.pendingIdAssignments,
|
|
132568
|
+
summary: args.summary,
|
|
132569
|
+
// P43 §4. Preparation ran against the pulled snapshot, so the server
|
|
132570
|
+
// refuses the push unless that snapshot is still the project head.
|
|
132571
|
+
headTransactionHash: args.workspace.state.headTransactionHash ?? null,
|
|
132572
|
+
derivedEdgeExtractorVersion: PROJECT_SNAPSHOT_DERIVED_EDGE_EXTRACTOR_VERSION,
|
|
132573
|
+
compilerRevision: NEOSCRIPT_COMPILER_REVISION
|
|
132574
|
+
};
|
|
132575
|
+
}
|
|
132391
132576
|
function readAcceptedProjectVersionCommitResponse(value) {
|
|
132392
132577
|
if (!isObjectRecord2(value) || value.kind !== "accepted") return null;
|
|
132393
132578
|
if (typeof value.transactionId !== "string") {
|
|
@@ -132929,7 +133114,8 @@ async function preparePushStatus(workspace, options, onPhase = () => void 0) {
|
|
|
132929
133114
|
onPhase("Analyzing working copy\u2026");
|
|
132930
133115
|
const status = computeWorkspaceStatus2(workspace, {
|
|
132931
133116
|
onPhase,
|
|
132932
|
-
forceRecompile: options.forceRecompile
|
|
133117
|
+
forceRecompile: options.forceRecompile,
|
|
133118
|
+
skipInitializerMaterialization: true
|
|
132933
133119
|
});
|
|
132934
133120
|
if (status.conflictedFiles.length > 0) {
|
|
132935
133121
|
throw new Error(
|
|
@@ -132967,11 +133153,6 @@ ${blockingErrors.map((error) => ` ${error.message}`).join("\n")}`
|
|
|
132967
133153
|
}
|
|
132968
133154
|
const blockedConversions = describeBlockingInitConversions(initConversions);
|
|
132969
133155
|
if (blockedConversions !== null) throw new Error(blockedConversions);
|
|
132970
|
-
if (!options.acceptBump && (workspace.state.headTransactionHash === void 0 || workspace.state.headTransactionHash === null)) {
|
|
132971
|
-
throw new Error(
|
|
132972
|
-
'This workspace has no recorded project head, so a push cannot be proven to be a fast-forward. Run "neo pull" first, or re-run with "neo push --accept-bump" to force the write.'
|
|
132973
|
-
);
|
|
132974
|
-
}
|
|
132975
133156
|
prepareNSPropertySetterChanges(workspace, status);
|
|
132976
133157
|
prepareNSFunctionBodyChanges(workspace, status);
|
|
132977
133158
|
const needsNeoScriptCompilation = status.changes.some(
|
|
@@ -133080,7 +133261,7 @@ async function runPush(workspace, options, preparationOverride) {
|
|
|
133080
133261
|
);
|
|
133081
133262
|
}
|
|
133082
133263
|
if (options.noVerify !== true) {
|
|
133083
|
-
const preparedBuildDir = configuredHook === void 0 ? void 0 :
|
|
133264
|
+
const preparedBuildDir = configuredHook === void 0 ? void 0 : join12(
|
|
133084
133265
|
workspace.root,
|
|
133085
133266
|
".neo",
|
|
133086
133267
|
"test-build",
|
|
@@ -133096,8 +133277,8 @@ async function runPush(workspace, options, preparationOverride) {
|
|
|
133096
133277
|
}
|
|
133097
133278
|
const documentJson = JSON.stringify(candidate.document);
|
|
133098
133279
|
mkdirSync8(preparedBuildDir, { recursive: true });
|
|
133099
|
-
|
|
133100
|
-
|
|
133280
|
+
writeFileSync9(
|
|
133281
|
+
join12(preparedBuildDir, "candidate.json"),
|
|
133101
133282
|
`${JSON.stringify({
|
|
133102
133283
|
version: 1,
|
|
133103
133284
|
projectFingerprint: `sha256:${preparedLocal.source.sourceHash}`,
|
|
@@ -133119,7 +133300,7 @@ async function runPush(workspace, options, preparationOverride) {
|
|
|
133119
133300
|
});
|
|
133120
133301
|
} finally {
|
|
133121
133302
|
if (preparedBuildDir !== void 0) {
|
|
133122
|
-
|
|
133303
|
+
rmSync6(preparedBuildDir, { recursive: true, force: true });
|
|
133123
133304
|
}
|
|
133124
133305
|
}
|
|
133125
133306
|
} else {
|
|
@@ -133250,41 +133431,24 @@ async function runPush(workspace, options, preparationOverride) {
|
|
|
133250
133431
|
pendingAssignment,
|
|
133251
133432
|
transactionOperation,
|
|
133252
133433
|
client,
|
|
133253
|
-
|
|
133254
|
-
transportSeeds,
|
|
133434
|
+
clientPrepared,
|
|
133255
133435
|
stagedUploadSessionId
|
|
133256
133436
|
} = preparedPush;
|
|
133257
133437
|
const { stagedFiles } = preparedPush;
|
|
133258
133438
|
let pushConnection;
|
|
133259
133439
|
const commit = async (force) => {
|
|
133260
|
-
const body = {
|
|
133440
|
+
const body = clientPreparedCommitBody({
|
|
133441
|
+
workspace,
|
|
133261
133442
|
operation: transactionOperation,
|
|
133262
|
-
|
|
133263
|
-
authoredValueSeeds: transportSeeds,
|
|
133264
|
-
initializerMaterialization: pendingAssignment.localInitializerMaterialization ?? { roots: [] },
|
|
133443
|
+
prepared: clientPrepared,
|
|
133265
133444
|
stagedFiles,
|
|
133266
133445
|
stagedUploadSessionId,
|
|
133267
133446
|
sourceHash: source.sourceHash,
|
|
133268
133447
|
pendingIdAssignments: Object.fromEntries(pendingAssignment.assigned),
|
|
133269
|
-
summary: options.summary ?? "neo push"
|
|
133270
|
-
|
|
133271
|
-
// the server rejects a push whose base is not the project head.
|
|
133272
|
-
headTransactionHash: workspace.state.headTransactionHash ?? null,
|
|
133273
|
-
derivedEdgeExtractorVersion: PROJECT_SNAPSHOT_DERIVED_EDGE_EXTRACTOR_VERSION,
|
|
133274
|
-
forceRecompile: options.forceRecompile === true
|
|
133275
|
-
};
|
|
133448
|
+
summary: options.summary ?? "neo push"
|
|
133449
|
+
});
|
|
133276
133450
|
pushConnection ??= await createConvexPushConnection(workspace);
|
|
133277
|
-
|
|
133278
|
-
return await pushConnection.submit(body, force);
|
|
133279
|
-
} catch (error) {
|
|
133280
|
-
if (!(error instanceof NeoApiError) || error.status !== 413 || !isObjectRecord2(error.body) || error.body.error !== "schema-commit-route-required")
|
|
133281
|
-
throw error;
|
|
133282
|
-
}
|
|
133283
|
-
return await client.post(
|
|
133284
|
-
`/api/projects/${workspace.config.projectId}/versions/${workspace.config.versionId}/schema/commit`,
|
|
133285
|
-
body,
|
|
133286
|
-
force ? { "x-neo-force-project-version-write": "true" } : void 0
|
|
133287
|
-
);
|
|
133451
|
+
return await pushConnection.submit(body, force);
|
|
133288
133452
|
};
|
|
133289
133453
|
const finishCommitResponse = async (response, reporter) => {
|
|
133290
133454
|
let accepted;
|
|
@@ -133322,7 +133486,7 @@ async function runPush(workspace, options, preparationOverride) {
|
|
|
133322
133486
|
errorMessage: null
|
|
133323
133487
|
});
|
|
133324
133488
|
reporter.stop();
|
|
133325
|
-
|
|
133489
|
+
reportDerivedChanges(
|
|
133326
133490
|
committedChangeCount,
|
|
133327
133491
|
status.changes.length,
|
|
133328
133492
|
options.json === true
|
|
@@ -133410,7 +133574,7 @@ async function runPush(workspace, options, preparationOverride) {
|
|
|
133410
133574
|
errorMessage: null
|
|
133411
133575
|
});
|
|
133412
133576
|
reporter.stop();
|
|
133413
|
-
|
|
133577
|
+
reportDerivedChanges(
|
|
133414
133578
|
completed.totalChangeCount,
|
|
133415
133579
|
status.changes.length,
|
|
133416
133580
|
options.json === true
|
|
@@ -133512,7 +133676,7 @@ async function runPush(workspace, options, preparationOverride) {
|
|
|
133512
133676
|
await finishCommitResponse(result, progress);
|
|
133513
133677
|
}
|
|
133514
133678
|
function isDefinitiveSchemaCommitRejection(error) {
|
|
133515
|
-
return error.status === 400 || error.status === 401 || error.status === 403 || error.status === 404 || error.status === 409;
|
|
133679
|
+
return error.status === 400 || error.status === 401 || error.status === 403 || error.status === 404 || error.status === 409 || error.status === 413;
|
|
133516
133680
|
}
|
|
133517
133681
|
async function prepareLocalPushArtifactsV4(workspace, status, onPhase = () => void 0, options = {
|
|
133518
133682
|
fullValidation: true,
|
|
@@ -133531,22 +133695,11 @@ async function prepareLocalPushArtifactsV4(workspace, status, onPhase = () => vo
|
|
|
133531
133695
|
status,
|
|
133532
133696
|
status.authoredValueSeeds
|
|
133533
133697
|
) : null;
|
|
133534
|
-
const pendingTransportChanges = transportChangesForStatus(status);
|
|
133535
|
-
const pendingTransportSeeds = [...status.authoredValueSeeds].map(
|
|
133536
|
-
([memberId, seed]) => ({ memberId, ...seed })
|
|
133537
|
-
);
|
|
133538
|
-
const localInitializerMaterialization = status.localInitializerMaterialization ?? materializeInitializersLocallyV4({
|
|
133539
|
-
workspace,
|
|
133540
|
-
changes: pendingTransportChanges,
|
|
133541
|
-
authoredValueSeeds: pendingTransportSeeds,
|
|
133542
|
-
forceRecompile: options.forceRecompile
|
|
133543
|
-
});
|
|
133544
133698
|
onPhase("Assigning pending value identities\u2026");
|
|
133545
133699
|
const pendingAssignment = assignPendingIds(
|
|
133546
133700
|
status.changes,
|
|
133547
133701
|
status.authoredValueSeeds,
|
|
133548
|
-
status.reconstructed
|
|
133549
|
-
localInitializerMaterialization
|
|
133702
|
+
status.reconstructed
|
|
133550
133703
|
);
|
|
133551
133704
|
const operations = new Set(status.changes.map((change) => change.kind));
|
|
133552
133705
|
const transactionOperation = operations.size === 1 ? status.changes[0].kind : "update";
|
|
@@ -133560,11 +133713,11 @@ async function prepareLocalPushArtifactsV4(workspace, status, onPhase = () => vo
|
|
|
133560
133713
|
binaryChanges: status.binaryChanges ?? [],
|
|
133561
133714
|
assignedIds: pendingAssignment.assigned
|
|
133562
133715
|
});
|
|
133716
|
+
const stagedRecordIds = new Set(preparedFiles.map((file) => file.recordId));
|
|
133563
133717
|
assertPushedRecordsPassDomainGuards(
|
|
133564
133718
|
status.changes,
|
|
133565
133719
|
localizedTextCreateEnvelopeConfig2(workspace, status.changes)
|
|
133566
133720
|
);
|
|
133567
|
-
let preparedChanges = null;
|
|
133568
133721
|
if (verificationSource !== null) {
|
|
133569
133722
|
onPhase("Verifying the assigned-id source rewrite\u2026");
|
|
133570
133723
|
materializeAssignedSchemaIdsInAuthoredSource(
|
|
@@ -133581,36 +133734,47 @@ async function prepareLocalPushArtifactsV4(workspace, status, onPhase = () => vo
|
|
|
133581
133734
|
files: verificationSource.files,
|
|
133582
133735
|
changes: transportChanges,
|
|
133583
133736
|
authoredValueSeeds: transportSeeds,
|
|
133584
|
-
initializerMaterialization: pendingAssignment.localInitializerMaterialization ?? { roots: [] },
|
|
133585
133737
|
forceRecompile: options.forceRecompile,
|
|
133586
133738
|
pendingIdAssignments: Object.fromEntries(pendingAssignment.assigned),
|
|
133587
133739
|
stagedFiles: preparedFiles
|
|
133588
133740
|
});
|
|
133589
|
-
|
|
133590
|
-
|
|
133591
|
-
)
|
|
133592
|
-
|
|
133741
|
+
}
|
|
133742
|
+
onPhase(
|
|
133743
|
+
`Preparing ${transportChanges.length.toLocaleString("en-US")} change(s)\u2026`
|
|
133744
|
+
);
|
|
133745
|
+
const finishPreparation = startPerformanceSpan("client-preparation");
|
|
133746
|
+
let prepared;
|
|
133747
|
+
try {
|
|
133748
|
+
prepared = prepareClientPush({
|
|
133593
133749
|
workspace,
|
|
133594
133750
|
changes: completeLocallyStagedProjectFileChanges({
|
|
133595
133751
|
projectId: workspace.config.projectId,
|
|
133596
133752
|
changes: transportChanges,
|
|
133597
|
-
stagedRecordIds
|
|
133753
|
+
stagedRecordIds
|
|
133598
133754
|
}),
|
|
133599
133755
|
authoredValueSeeds: transportSeeds,
|
|
133600
133756
|
sourceByRecord: status.reconstructed,
|
|
133601
|
-
localInitializerMaterialization: pendingAssignment.localInitializerMaterialization,
|
|
133602
133757
|
forceRecompile: options.forceRecompile
|
|
133603
133758
|
});
|
|
133759
|
+
} finally {
|
|
133760
|
+
finishPreparation();
|
|
133604
133761
|
}
|
|
133605
133762
|
return {
|
|
133606
133763
|
source,
|
|
133607
133764
|
submittedStatus,
|
|
133608
133765
|
pendingAssignment,
|
|
133609
133766
|
transactionOperation,
|
|
133610
|
-
transportChanges,
|
|
133611
|
-
transportSeeds,
|
|
133612
133767
|
preparedFiles,
|
|
133613
|
-
|
|
133768
|
+
/** The prepared graph with local stand-ins for staged file storage. */
|
|
133769
|
+
preparedChanges: prepared.changes,
|
|
133770
|
+
clientPrepared: {
|
|
133771
|
+
changes: restoreStagedProjectFileStorage(
|
|
133772
|
+
prepared.changes,
|
|
133773
|
+
transportChanges,
|
|
133774
|
+
stagedRecordIds
|
|
133775
|
+
),
|
|
133776
|
+
basePayloadBytes: prepared.basePayloadBytes
|
|
133777
|
+
}
|
|
133614
133778
|
};
|
|
133615
133779
|
}
|
|
133616
133780
|
async function prepareLocalCandidateV4(workspace, options = {}) {
|
|
@@ -133735,14 +133899,50 @@ function completeLocallyStagedProjectFileChanges(args) {
|
|
|
133735
133899
|
...change.nextData,
|
|
133736
133900
|
id: change.recordId,
|
|
133737
133901
|
projectId: args.projectId,
|
|
133738
|
-
|
|
133739
|
-
storageKey: `local-candidate/${change.recordId}`,
|
|
133740
|
-
storageETag: "local-candidate"
|
|
133902
|
+
...localStagedProjectFileStorage(change.recordId)
|
|
133741
133903
|
}
|
|
133742
133904
|
};
|
|
133743
133905
|
return completed;
|
|
133744
133906
|
});
|
|
133745
133907
|
}
|
|
133908
|
+
function localStagedProjectFileStorage(recordId) {
|
|
133909
|
+
return {
|
|
133910
|
+
status: "uploaded",
|
|
133911
|
+
storageKey: `local-candidate/${recordId}`,
|
|
133912
|
+
storageETag: "local-candidate"
|
|
133913
|
+
};
|
|
133914
|
+
}
|
|
133915
|
+
function restoreStagedProjectFileStorage(prepared, transportChanges, stagedRecordIds) {
|
|
133916
|
+
if (stagedRecordIds.size === 0) return prepared;
|
|
133917
|
+
const authoredById = /* @__PURE__ */ new Map();
|
|
133918
|
+
for (const change of transportChanges) {
|
|
133919
|
+
if (!stagedRecordIds.has(change.recordId)) continue;
|
|
133920
|
+
if (change.nextData === void 0) {
|
|
133921
|
+
throw new Error(
|
|
133922
|
+
`Staged project file ${change.recordId} has no local source record.`
|
|
133923
|
+
);
|
|
133924
|
+
}
|
|
133925
|
+
authoredById.set(change.recordId, change.nextData);
|
|
133926
|
+
}
|
|
133927
|
+
return prepared.map((change) => {
|
|
133928
|
+
if (change.recordKind !== "project-file") return change;
|
|
133929
|
+
const authored = authoredById.get(change.recordId);
|
|
133930
|
+
if (authored === void 0) return change;
|
|
133931
|
+
if (!isObjectRecord2(change.nextData)) {
|
|
133932
|
+
throw new Error(
|
|
133933
|
+
`Prepared staged project file ${change.recordId} has no record data.`
|
|
133934
|
+
);
|
|
133935
|
+
}
|
|
133936
|
+
const nextData = { ...change.nextData };
|
|
133937
|
+
for (const field of Object.keys(
|
|
133938
|
+
localStagedProjectFileStorage(change.recordId)
|
|
133939
|
+
)) {
|
|
133940
|
+
if (authored[field] === void 0) delete nextData[field];
|
|
133941
|
+
else nextData[field] = authored[field];
|
|
133942
|
+
}
|
|
133943
|
+
return { ...change, nextData };
|
|
133944
|
+
});
|
|
133945
|
+
}
|
|
133746
133946
|
function transportChangesForStatus(status) {
|
|
133747
133947
|
return status.changes.map((change) => ({
|
|
133748
133948
|
recordKind: change.recordKind,
|
|
@@ -134107,6 +134307,12 @@ function reportPushRejection(status, body) {
|
|
|
134107
134307
|
);
|
|
134108
134308
|
return;
|
|
134109
134309
|
}
|
|
134310
|
+
if (isObjectRecord2(body) && body.error === "schema-commit-too-large") {
|
|
134311
|
+
console.error(
|
|
134312
|
+
typeof body.bytes === "number" && typeof body.limitBytes === "number" ? `Push rejected: the prepared commit is ${body.bytes.toLocaleString("en-US")} bytes ${String(body.measure)}, over the ${body.limitBytes.toLocaleString("en-US")}-byte limit.` : "Push rejected: the prepared commit is over the server's body limit."
|
|
134313
|
+
);
|
|
134314
|
+
return;
|
|
134315
|
+
}
|
|
134110
134316
|
console.error(`Push rejected (${status}): ${JSON.stringify(body)}`);
|
|
134111
134317
|
}
|
|
134112
134318
|
function applyCommittedHeadTransactionHash(workspace, result) {
|
|
@@ -134142,11 +134348,11 @@ function immediateCommittedChangeCount(result) {
|
|
|
134142
134348
|
}
|
|
134143
134349
|
return result.changedRecords.length;
|
|
134144
134350
|
}
|
|
134145
|
-
function
|
|
134351
|
+
function reportDerivedChanges(totalChangeCount, authoredChangeCount, json) {
|
|
134146
134352
|
if (json || totalChangeCount <= authoredChangeCount) return;
|
|
134147
134353
|
console.log(
|
|
134148
134354
|
color.dim(
|
|
134149
|
-
`
|
|
134355
|
+
`Push preparation added ${totalChangeCount - authoredChangeCount} derived record change(s) (${totalChangeCount} total).`
|
|
134150
134356
|
)
|
|
134151
134357
|
);
|
|
134152
134358
|
}
|
|
@@ -134324,7 +134530,7 @@ function statusForPushResult(workspace, submitted) {
|
|
|
134324
134530
|
const input = snapshot.inputs[index];
|
|
134325
134531
|
if (input?.uri !== relative6(workspace.root, path).split(sep6).join("/"))
|
|
134326
134532
|
return computeWorkspaceStatus2(workspace);
|
|
134327
|
-
if (input.text !==
|
|
134533
|
+
if (input.text !== readFileSync14(path, "utf8"))
|
|
134328
134534
|
return computeWorkspaceStatus2(workspace);
|
|
134329
134535
|
}
|
|
134330
134536
|
const binaries = inspectProjectBinaryStatusV4(
|
|
@@ -134493,13 +134699,14 @@ function foldChangedRecords(previous, changedRecords) {
|
|
|
134493
134699
|
`Changed record "${key}" response is missing its snapshot content hash.`
|
|
134494
134700
|
);
|
|
134495
134701
|
}
|
|
134702
|
+
const projectBinary = records2[key]?.projectBinary;
|
|
134496
134703
|
records2[key] = {
|
|
134497
134704
|
recordKind,
|
|
134498
134705
|
recordId,
|
|
134499
134706
|
contentHash: snapshot.contentHash,
|
|
134500
134707
|
data: changed.data,
|
|
134501
134708
|
file: records2[key]?.file,
|
|
134502
|
-
projectBinary:
|
|
134709
|
+
projectBinary: projectBinary && committedProjectBinaryStateV4(projectBinary, changed.data)
|
|
134503
134710
|
};
|
|
134504
134711
|
}
|
|
134505
134712
|
return records2;
|
|
@@ -134530,8 +134737,8 @@ function authoredMemberFormsByFile(root, alternates) {
|
|
|
134530
134737
|
for (const alternate of alternates) {
|
|
134531
134738
|
let existing = contents.get(alternate.path);
|
|
134532
134739
|
if (existing === void 0) {
|
|
134533
|
-
const absolute =
|
|
134534
|
-
existing =
|
|
134740
|
+
const absolute = join12(root, alternate.path);
|
|
134741
|
+
existing = existsSync10(absolute) ? readFileSync14(absolute, "utf8") : null;
|
|
134535
134742
|
contents.set(alternate.path, existing);
|
|
134536
134743
|
}
|
|
134537
134744
|
if (existing === null || !existing.includes(alternate.block)) continue;
|
|
@@ -134640,7 +134847,7 @@ function rewriteFilesFromState(workspace, records2 = new Map(
|
|
|
134640
134847
|
];
|
|
134641
134848
|
for (const path of previousPaths) {
|
|
134642
134849
|
const absolute = resolveSourcePath(path);
|
|
134643
|
-
if (!
|
|
134850
|
+
if (!existsSync10(absolute) || emittedEntries.has(fileSystemEntryKey(absolute)))
|
|
134644
134851
|
continue;
|
|
134645
134852
|
output.set(normalizeWorkspaceSourcePath(path), null);
|
|
134646
134853
|
}
|
|
@@ -134648,7 +134855,7 @@ function rewriteFilesFromState(workspace, records2 = new Map(
|
|
|
134648
134855
|
const absolute = resolveSourcePath(path);
|
|
134649
134856
|
return {
|
|
134650
134857
|
path,
|
|
134651
|
-
before:
|
|
134858
|
+
before: existsSync10(absolute) ? readFileSync14(absolute, "utf8") : null,
|
|
134652
134859
|
after
|
|
134653
134860
|
};
|
|
134654
134861
|
});
|
|
@@ -134700,7 +134907,7 @@ function materializeAssignedSchemaIdsInAuthoredSource(workspace, replacements, p
|
|
|
134700
134907
|
if (pendingIdsByUri.size === 0) return /* @__PURE__ */ new Map();
|
|
134701
134908
|
const inputs = options.sourceSnapshot?.inputs ?? listProjectSourceFilesV4(workspace.root).map((absolutePath) => {
|
|
134702
134909
|
const uri = relative6(workspace.root, absolutePath).split(sep6).join("/");
|
|
134703
|
-
const text =
|
|
134910
|
+
const text = readFileSync14(absolutePath, "utf8");
|
|
134704
134911
|
const kind = neoProjectSourceKind(uri, text);
|
|
134705
134912
|
if (kind === null || !isNeoProjectProductionSourceKind(kind)) {
|
|
134706
134913
|
throw new Error(
|
|
@@ -135504,6 +135711,7 @@ var init_push = __esm({
|
|
|
135504
135711
|
init_project_documents();
|
|
135505
135712
|
init_project_document_cache();
|
|
135506
135713
|
init_project_files();
|
|
135714
|
+
init_project_file_pull();
|
|
135507
135715
|
init_workspace_status();
|
|
135508
135716
|
init_lower_support();
|
|
135509
135717
|
init_init_conversion();
|
|
@@ -135514,7 +135722,6 @@ var init_push = __esm({
|
|
|
135514
135722
|
init_project_file_push();
|
|
135515
135723
|
init_trusted_commit_verification();
|
|
135516
135724
|
init_server_preparation_preflight();
|
|
135517
|
-
init_local_initializer_materialization();
|
|
135518
135725
|
init_initializer_replay();
|
|
135519
135726
|
init_project_version_validation();
|
|
135520
135727
|
init_project2();
|
|
@@ -136262,13 +136469,13 @@ var init_source_record_comparison = __esm({
|
|
|
136262
136469
|
|
|
136263
136470
|
// src/project-source/reset.ts
|
|
136264
136471
|
import {
|
|
136265
|
-
existsSync as
|
|
136472
|
+
existsSync as existsSync11,
|
|
136266
136473
|
mkdirSync as mkdirSync9,
|
|
136267
|
-
readFileSync as
|
|
136268
|
-
rmSync as
|
|
136269
|
-
writeFileSync as
|
|
136474
|
+
readFileSync as readFileSync15,
|
|
136475
|
+
rmSync as rmSync7,
|
|
136476
|
+
writeFileSync as writeFileSync10
|
|
136270
136477
|
} from "node:fs";
|
|
136271
|
-
import { dirname as dirname8, join as
|
|
136478
|
+
import { dirname as dirname8, join as join13, relative as relative7, sep as sep7 } from "node:path";
|
|
136272
136479
|
function prepareWorkspaceResetV4(workspace, document, options = {}) {
|
|
136273
136480
|
const emissionRecords = options.regenerateSourceNames ? regenerateDialogueSourceNamesV4(document.records) : document.records;
|
|
136274
136481
|
const layoutWorkspace = workspaceForSourceLayoutV4(workspace, document);
|
|
@@ -136298,21 +136505,21 @@ function resetWorkspaceToProjectSourcesV4(workspace, document, options = {}) {
|
|
|
136298
136505
|
}
|
|
136299
136506
|
for (const file of emitted.files) obsolete.delete(file.path);
|
|
136300
136507
|
for (const path of obsolete) {
|
|
136301
|
-
|
|
136508
|
+
rmSync7(resolveSourcePath(path), { force: true });
|
|
136302
136509
|
}
|
|
136303
136510
|
for (const file of LEGACY_ROOT_FILES) {
|
|
136304
|
-
|
|
136511
|
+
rmSync7(join13(workspace.root, file), { force: true });
|
|
136305
136512
|
}
|
|
136306
136513
|
for (const privatePath of LEGACY_PRIVATE_PATHS) {
|
|
136307
|
-
|
|
136514
|
+
rmSync7(join13(workspace.root, privatePath), { recursive: true, force: true });
|
|
136308
136515
|
}
|
|
136309
136516
|
for (const file of emitted.files) {
|
|
136310
136517
|
const absolute = resolveSourcePath(file.path);
|
|
136311
136518
|
mkdirSync9(dirname8(absolute), { recursive: true });
|
|
136312
|
-
if (
|
|
136519
|
+
if (existsSync11(absolute) && readFileSync15(absolute, "utf8") === file.content) {
|
|
136313
136520
|
continue;
|
|
136314
136521
|
}
|
|
136315
|
-
|
|
136522
|
+
writeFileSync10(absolute, file.content, "utf8");
|
|
136316
136523
|
}
|
|
136317
136524
|
writeProjectSourceAnalysisCacheV4(workspace.root, emitted.analysis);
|
|
136318
136525
|
const records2 = {};
|
|
@@ -136353,7 +136560,7 @@ function trackedProductionSourcesBeforeReset(workspace, resolveSourcePath) {
|
|
|
136353
136560
|
continue;
|
|
136354
136561
|
}
|
|
136355
136562
|
const absolute = resolveSourcePath(path);
|
|
136356
|
-
if (
|
|
136563
|
+
if (existsSync11(absolute)) paths.add(path);
|
|
136357
136564
|
}
|
|
136358
136565
|
return paths;
|
|
136359
136566
|
}
|
|
@@ -136397,280 +136604,6 @@ var init_reset = __esm({
|
|
|
136397
136604
|
}
|
|
136398
136605
|
});
|
|
136399
136606
|
|
|
136400
|
-
// src/project-source/project-file-pull.ts
|
|
136401
|
-
import {
|
|
136402
|
-
existsSync as existsSync11,
|
|
136403
|
-
mkdtempSync,
|
|
136404
|
-
readFileSync as readFileSync15,
|
|
136405
|
-
rmSync as rmSync7,
|
|
136406
|
-
writeFileSync as writeFileSync10
|
|
136407
|
-
} from "node:fs";
|
|
136408
|
-
import { tmpdir } from "node:os";
|
|
136409
|
-
import { join as join13 } from "node:path";
|
|
136410
|
-
async function pullProjectBinariesV4(args) {
|
|
136411
|
-
const resolvePath = createWorkspaceSourcePathResolver(args.workspace.root);
|
|
136412
|
-
const plans = /* @__PURE__ */ new Map();
|
|
136413
|
-
const downloads = [];
|
|
136414
|
-
const localById = new Map(
|
|
136415
|
-
(args.localBinaries ?? []).map((binary) => [binary.fileId, binary])
|
|
136416
|
-
);
|
|
136417
|
-
const states = /* @__PURE__ */ new Map();
|
|
136418
|
-
const conflicts = [];
|
|
136419
|
-
let downloaded = 0;
|
|
136420
|
-
let conflicted = 0;
|
|
136421
|
-
for (const record6 of args.document.records.values()) {
|
|
136422
|
-
if (record6.deleted || record6.recordKind !== "project-file") continue;
|
|
136423
|
-
if (!isObjectRecord2(record6.data)) {
|
|
136424
|
-
throw new Error(`project-file:${record6.recordId} must be an object.`);
|
|
136425
|
-
}
|
|
136426
|
-
if (record6.data.status !== "uploaded") continue;
|
|
136427
|
-
const existing = plans.get(record6.recordId);
|
|
136428
|
-
if (existing !== void 0) {
|
|
136429
|
-
if (existing.contentHash !== record6.contentHash)
|
|
136430
|
-
throw new Error(
|
|
136431
|
-
`Project file ${record6.recordId} appears with conflicting content hashes in the pulled document.`
|
|
136432
|
-
);
|
|
136433
|
-
continue;
|
|
136434
|
-
}
|
|
136435
|
-
const key = `project-file:${record6.recordId}`;
|
|
136436
|
-
const previous = args.previousRecords[key];
|
|
136437
|
-
const localStatus = localById.get(record6.recordId);
|
|
136438
|
-
const declarationPresent = args.destructive === true || args.localBinaries === void 0 || previous === void 0 || localStatus !== void 0;
|
|
136439
|
-
const path = localStatus?.path ?? previous?.projectBinary?.path ?? canonicalProjectBinaryPathV42(record6.data);
|
|
136440
|
-
const absolute = resolvePath(path);
|
|
136441
|
-
const localDigest = existsSync11(absolute) ? sha256File(absolute) : null;
|
|
136442
|
-
const baseDigest = previous?.projectBinary?.sha256 ?? readSha256(previous?.data) ?? null;
|
|
136443
|
-
const remoteDigest = requiredSha256(
|
|
136444
|
-
record6.data,
|
|
136445
|
-
`project-file:${record6.recordId} metadata`
|
|
136446
|
-
);
|
|
136447
|
-
let action = planBinaryMergeV4({
|
|
136448
|
-
baseDigest,
|
|
136449
|
-
localDigest,
|
|
136450
|
-
remoteDigest,
|
|
136451
|
-
declarationPresent,
|
|
136452
|
-
hadLocalBytes: previous?.projectBinary !== void 0
|
|
136453
|
-
});
|
|
136454
|
-
if (args.destructive === true) {
|
|
136455
|
-
action = localDigest === remoteDigest ? "unchanged" : "download";
|
|
136456
|
-
}
|
|
136457
|
-
const plan = {
|
|
136458
|
-
key,
|
|
136459
|
-
fileId: record6.recordId,
|
|
136460
|
-
contentHash: record6.contentHash,
|
|
136461
|
-
data: record6.data,
|
|
136462
|
-
previous,
|
|
136463
|
-
path,
|
|
136464
|
-
baseDigest,
|
|
136465
|
-
remoteDigest,
|
|
136466
|
-
action
|
|
136467
|
-
};
|
|
136468
|
-
plans.set(record6.recordId, plan);
|
|
136469
|
-
if (action === "download" || action === "conflict") downloads.push(plan);
|
|
136470
|
-
}
|
|
136471
|
-
let stagingDirectory;
|
|
136472
|
-
try {
|
|
136473
|
-
const stagedPaths = /* @__PURE__ */ new Map();
|
|
136474
|
-
if (downloads.length > 0) {
|
|
136475
|
-
stagingDirectory = mkdtempSync(join13(tmpdir(), "neo-pull-files-"));
|
|
136476
|
-
const directory = stagingDirectory;
|
|
136477
|
-
const client = args.client ?? NeoApiClient.forBaseUrl(args.workspace.config.apiBaseUrl);
|
|
136478
|
-
await mapWithConcurrency(
|
|
136479
|
-
downloads,
|
|
136480
|
-
DOWNLOAD_CONCURRENCY,
|
|
136481
|
-
async (plan, index) => {
|
|
136482
|
-
const response = await download(
|
|
136483
|
-
plan.data,
|
|
136484
|
-
plan.fileId,
|
|
136485
|
-
client,
|
|
136486
|
-
args.workspace
|
|
136487
|
-
);
|
|
136488
|
-
if (response.sha256 !== plan.remoteDigest) {
|
|
136489
|
-
throw new Error(
|
|
136490
|
-
`Project file ${plan.fileId} content changed while pull was in progress (${plan.remoteDigest} -> ${response.sha256}). Pull again against a stable version head.`
|
|
136491
|
-
);
|
|
136492
|
-
}
|
|
136493
|
-
const stagedPath = join13(directory, String(index));
|
|
136494
|
-
writeFileSync10(stagedPath, response.bytes);
|
|
136495
|
-
stagedPaths.set(plan.fileId, stagedPath);
|
|
136496
|
-
}
|
|
136497
|
-
);
|
|
136498
|
-
}
|
|
136499
|
-
for (const plan of plans.values()) {
|
|
136500
|
-
const {
|
|
136501
|
-
key,
|
|
136502
|
-
fileId,
|
|
136503
|
-
data,
|
|
136504
|
-
previous,
|
|
136505
|
-
path,
|
|
136506
|
-
baseDigest,
|
|
136507
|
-
remoteDigest,
|
|
136508
|
-
action
|
|
136509
|
-
} = plan;
|
|
136510
|
-
const absolute = resolvePath(path);
|
|
136511
|
-
const stagedPath = stagedPaths.get(fileId);
|
|
136512
|
-
const remoteBytes = stagedPath === void 0 ? null : readFileSync15(stagedPath);
|
|
136513
|
-
if (action === "download") {
|
|
136514
|
-
if (remoteBytes === null) {
|
|
136515
|
-
throw new Error(
|
|
136516
|
-
`Project file ${fileId} download plan has no verified remote bytes.`
|
|
136517
|
-
);
|
|
136518
|
-
}
|
|
136519
|
-
writeVerifiedBinaryDownloadV4(absolute, remoteBytes, remoteDigest);
|
|
136520
|
-
downloaded += 1;
|
|
136521
|
-
states.set(key, binaryState(path, remoteDigest, data));
|
|
136522
|
-
continue;
|
|
136523
|
-
}
|
|
136524
|
-
if (action === "conflict") {
|
|
136525
|
-
if (remoteBytes === null) {
|
|
136526
|
-
throw new Error(
|
|
136527
|
-
`Project file ${fileId} conflict plan has no verified remote bytes.`
|
|
136528
|
-
);
|
|
136529
|
-
}
|
|
136530
|
-
const artifactPath = writeBinaryConflictArtifactV4(
|
|
136531
|
-
args.workspace.root,
|
|
136532
|
-
fileId,
|
|
136533
|
-
fileName(data),
|
|
136534
|
-
remoteBytes,
|
|
136535
|
-
remoteDigest
|
|
136536
|
-
);
|
|
136537
|
-
const state = binaryState(path, baseDigest, data);
|
|
136538
|
-
states.set(key, {
|
|
136539
|
-
...state,
|
|
136540
|
-
conflict: {
|
|
136541
|
-
action: "conflict",
|
|
136542
|
-
remoteSha256: remoteDigest,
|
|
136543
|
-
artifactPath
|
|
136544
|
-
}
|
|
136545
|
-
});
|
|
136546
|
-
conflicts.push(path);
|
|
136547
|
-
conflicted += 1;
|
|
136548
|
-
continue;
|
|
136549
|
-
}
|
|
136550
|
-
if (action === "converged" || action === "unchanged") {
|
|
136551
|
-
states.set(key, binaryState(path, remoteDigest, data));
|
|
136552
|
-
removePreviousConflict(args.workspace.root, previous?.projectBinary);
|
|
136553
|
-
continue;
|
|
136554
|
-
}
|
|
136555
|
-
states.set(key, binaryState(path, baseDigest, data));
|
|
136556
|
-
}
|
|
136557
|
-
for (const [key, previous] of Object.entries(args.previousRecords)) {
|
|
136558
|
-
if (previous.recordKind !== "project-file") continue;
|
|
136559
|
-
if (args.document.records.has(key)) continue;
|
|
136560
|
-
const localStatus = localById.get(previous.recordId);
|
|
136561
|
-
const path = localStatus?.path ?? previous.projectBinary?.path ?? canonicalProjectBinaryPathV42(previous.data);
|
|
136562
|
-
const absolute = resolvePath(path);
|
|
136563
|
-
const localDigest = existsSync11(absolute) ? sha256File(absolute) : null;
|
|
136564
|
-
const baseDigest = previous.projectBinary?.sha256 ?? readSha256(previous.data) ?? null;
|
|
136565
|
-
const action = planBinaryMergeV4({
|
|
136566
|
-
baseDigest,
|
|
136567
|
-
localDigest,
|
|
136568
|
-
remoteDigest: null,
|
|
136569
|
-
declarationPresent: localStatus !== void 0,
|
|
136570
|
-
hadLocalBytes: previous.projectBinary !== void 0
|
|
136571
|
-
});
|
|
136572
|
-
if (action === "delete-modify") {
|
|
136573
|
-
const data = isObjectRecord2(previous.data) ? previous.data : {};
|
|
136574
|
-
states.set(key, {
|
|
136575
|
-
...binaryState(path, baseDigest, data),
|
|
136576
|
-
conflict: {
|
|
136577
|
-
action: "delete-modify",
|
|
136578
|
-
remoteSha256: null
|
|
136579
|
-
}
|
|
136580
|
-
});
|
|
136581
|
-
conflicts.push(path);
|
|
136582
|
-
conflicted += 1;
|
|
136583
|
-
continue;
|
|
136584
|
-
}
|
|
136585
|
-
rmSync7(absolute, { force: true });
|
|
136586
|
-
removePreviousConflict(args.workspace.root, previous.projectBinary);
|
|
136587
|
-
}
|
|
136588
|
-
return { states, downloaded, conflicted, conflicts };
|
|
136589
|
-
} finally {
|
|
136590
|
-
if (stagingDirectory !== void 0)
|
|
136591
|
-
rmSync7(stagingDirectory, { recursive: true, force: true });
|
|
136592
|
-
}
|
|
136593
|
-
}
|
|
136594
|
-
async function download(data, fileId, client, workspace) {
|
|
136595
|
-
const version = typeof data.storageETag === "string" ? `?v=${encodeURIComponent(data.storageETag)}` : "";
|
|
136596
|
-
const path = `/api/projects/${workspace.config.projectId}/versions/${workspace.config.versionId}/files/${fileId}/content${version}`;
|
|
136597
|
-
const response = await client.getBytes(path);
|
|
136598
|
-
const computed = sha256Bytes(response.bytes);
|
|
136599
|
-
const metadataDigest = requiredSha256(
|
|
136600
|
-
data,
|
|
136601
|
-
`project-file:${fileId} metadata`
|
|
136602
|
-
);
|
|
136603
|
-
const headerDigest = normalizeSha256V4(
|
|
136604
|
-
response.contentSha256,
|
|
136605
|
-
`download response for project file ${fileId}`
|
|
136606
|
-
);
|
|
136607
|
-
if (headerDigest !== null && metadataDigest !== headerDigest) {
|
|
136608
|
-
throw new Error(
|
|
136609
|
-
`Project file ${fileId} metadata SHA-256 ${metadataDigest} did not match authenticated content response ${headerDigest}.`
|
|
136610
|
-
);
|
|
136611
|
-
}
|
|
136612
|
-
if (computed !== metadataDigest) {
|
|
136613
|
-
throw new Error(
|
|
136614
|
-
`Downloaded project file ${fileId} SHA-256 ${computed} did not match expected ${metadataDigest}.`
|
|
136615
|
-
);
|
|
136616
|
-
}
|
|
136617
|
-
if (typeof data.byteLength === "number" && response.bytes.byteLength !== data.byteLength) {
|
|
136618
|
-
throw new Error(
|
|
136619
|
-
`Downloaded project file ${fileId} has ${response.bytes.byteLength} bytes; metadata requires ${data.byteLength}.`
|
|
136620
|
-
);
|
|
136621
|
-
}
|
|
136622
|
-
if (typeof data.mimeType === "string" && response.contentType !== null && response.contentType !== data.mimeType) {
|
|
136623
|
-
throw new Error(
|
|
136624
|
-
`Downloaded project file ${fileId} content type ${response.contentType} did not match metadata ${data.mimeType}.`
|
|
136625
|
-
);
|
|
136626
|
-
}
|
|
136627
|
-
return { bytes: response.bytes, sha256: computed };
|
|
136628
|
-
}
|
|
136629
|
-
function binaryState(path, sha256, data) {
|
|
136630
|
-
return {
|
|
136631
|
-
path,
|
|
136632
|
-
sha256,
|
|
136633
|
-
byteLength: typeof data.byteLength === "number" ? data.byteLength : 0,
|
|
136634
|
-
mimeType: typeof data.mimeType === "string" ? data.mimeType : "application/octet-stream"
|
|
136635
|
-
};
|
|
136636
|
-
}
|
|
136637
|
-
function readSha256(data) {
|
|
136638
|
-
if (!isObjectRecord2(data)) return null;
|
|
136639
|
-
return normalizeSha256V4(data.contentSha256, "project file metadata");
|
|
136640
|
-
}
|
|
136641
|
-
function requiredSha256(data, source) {
|
|
136642
|
-
if (!isObjectRecord2(data)) {
|
|
136643
|
-
throw new Error(`${source} must be an object.`);
|
|
136644
|
-
}
|
|
136645
|
-
const digest = normalizeSha256V4(data.contentSha256, source);
|
|
136646
|
-
if (digest === null) {
|
|
136647
|
-
throw new Error(`${source} is missing required contentSha256.`);
|
|
136648
|
-
}
|
|
136649
|
-
return digest;
|
|
136650
|
-
}
|
|
136651
|
-
function fileName(data) {
|
|
136652
|
-
if (typeof data.name !== "string") {
|
|
136653
|
-
throw new Error("Project file metadata has no filename.");
|
|
136654
|
-
}
|
|
136655
|
-
return data.name;
|
|
136656
|
-
}
|
|
136657
|
-
function removePreviousConflict(root, state) {
|
|
136658
|
-
if (state?.conflict?.artifactPath === void 0) return;
|
|
136659
|
-
rmSync7(join13(root, state.conflict.artifactPath), { force: true });
|
|
136660
|
-
}
|
|
136661
|
-
var DOWNLOAD_CONCURRENCY;
|
|
136662
|
-
var init_project_file_pull = __esm({
|
|
136663
|
-
"src/project-source/project-file-pull.ts"() {
|
|
136664
|
-
"use strict";
|
|
136665
|
-
init_workspace_source_path();
|
|
136666
|
-
init_concurrency();
|
|
136667
|
-
init_http();
|
|
136668
|
-
init_projection();
|
|
136669
|
-
init_project_files();
|
|
136670
|
-
DOWNLOAD_CONCURRENCY = 8;
|
|
136671
|
-
}
|
|
136672
|
-
});
|
|
136673
|
-
|
|
136674
136607
|
// src/project-source/static-value-seed-records.ts
|
|
136675
136608
|
function staticValueSeedEmitRecords(status, present, projectId, mainLocale) {
|
|
136676
136609
|
const records2 = /* @__PURE__ */ new Map();
|
|
@@ -140824,7 +140757,7 @@ var init_registry2 = __esm({
|
|
|
140824
140757
|
"schema-contract/registry.mjs"() {
|
|
140825
140758
|
"use strict";
|
|
140826
140759
|
PROJECT_SCHEMA_CONTRACT = Object.freeze({
|
|
140827
|
-
cliVersion: "0.
|
|
140760
|
+
cliVersion: "0.59.1",
|
|
140828
140761
|
projectFileUploadBatchSize: 32,
|
|
140829
140762
|
documentRecords: {
|
|
140830
140763
|
member: {
|
|
@@ -148539,7 +148472,7 @@ ${h("Usage")}
|
|
|
148539
148472
|
|
|
148540
148473
|
${h("Flags")}
|
|
148541
148474
|
--dry-run ${d("Preview the change set; commit nothing.")}
|
|
148542
|
-
--force-recompile ${d("Exhaustively recompile every stored NeoScript body
|
|
148475
|
+
--force-recompile ${d("Exhaustively recompile every stored NeoScript body during push preparation (parity/recovery; slower, and may surface unrelated invalid bodies).")}
|
|
148543
148476
|
--summary <text> ${d("Attach a summary message to the transaction.")}
|
|
148544
148477
|
--accept-bump ${d("Accept a server-required version bump instead of aborting.")}
|
|
148545
148478
|
--json ${d("Emit machine-readable plan and transaction progress events.")}
|
|
@@ -148645,7 +148578,7 @@ There is no --keep-current: preserving current semantic state defines flatten.
|
|
|
148645
148578
|
async function main() {
|
|
148646
148579
|
const args = parseArgs(process.argv.slice(2));
|
|
148647
148580
|
if (args.command === "--version") {
|
|
148648
|
-
console.log("0.
|
|
148581
|
+
console.log("0.59.1");
|
|
148649
148582
|
return;
|
|
148650
148583
|
}
|
|
148651
148584
|
if (args.command === null || args.command === "help" || args.command === "--help" || args.command === "-h") {
|