@neocompose/cli 0.40.0 → 0.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/neo.mjs
CHANGED
|
@@ -19441,7 +19441,7 @@ var init_project_schema_contract_generated = __esm({
|
|
|
19441
19441
|
"../packages/neoscript-language/src/project-schema-contract.generated.ts"() {
|
|
19442
19442
|
"use strict";
|
|
19443
19443
|
PROJECT_SCHEMA_MANIFEST_FORMAT_VERSION = 4;
|
|
19444
|
-
PROJECT_SCHEMA_MANIFEST_CONTRACT_VERSION = "4.
|
|
19444
|
+
PROJECT_SCHEMA_MANIFEST_CONTRACT_VERSION = "4.1";
|
|
19445
19445
|
PROJECT_FILE_UPLOAD_BATCH_SIZE = 32;
|
|
19446
19446
|
NEO_PROJECT_SOURCE_RECORD_CONTRACT = {
|
|
19447
19447
|
"recordFields": {
|
|
@@ -19459,6 +19459,7 @@ var init_project_schema_contract_generated = __esm({
|
|
|
19459
19459
|
"system",
|
|
19460
19460
|
"storage",
|
|
19461
19461
|
"storageKey",
|
|
19462
|
+
"distribution",
|
|
19462
19463
|
"minValue",
|
|
19463
19464
|
"maxValue",
|
|
19464
19465
|
"decimalPoints",
|
|
@@ -19657,6 +19658,10 @@ var init_project_schema_contract_generated = __esm({
|
|
|
19657
19658
|
"Visible",
|
|
19658
19659
|
"Hidden"
|
|
19659
19660
|
],
|
|
19661
|
+
"NeoSubtreeDistribution": [
|
|
19662
|
+
"Sparse",
|
|
19663
|
+
"Packed"
|
|
19664
|
+
],
|
|
19660
19665
|
"NeoStringFormat": [
|
|
19661
19666
|
"Localized",
|
|
19662
19667
|
"Plain"
|
|
@@ -23829,6 +23834,7 @@ function fieldsForAnnotation(name, context, environment) {
|
|
|
23829
23834
|
}
|
|
23830
23835
|
if (name === "settings") return settingsFields(context);
|
|
23831
23836
|
if (name === "storage") return storageFields(context);
|
|
23837
|
+
if (name === "distribution") return distributionFields(context);
|
|
23832
23838
|
if (name === "relations") return relationFields(context, environment);
|
|
23833
23839
|
if (name === "system") {
|
|
23834
23840
|
return context.kind === "class" || context.kind === "schema" || context.kind === "member" ? markerFields("NeoSystemAttribute") : null;
|
|
@@ -23901,6 +23907,12 @@ function settingsFields(context) {
|
|
|
23901
23907
|
)
|
|
23902
23908
|
);
|
|
23903
23909
|
}
|
|
23910
|
+
function distributionFields(context) {
|
|
23911
|
+
if (context.kind === "member" || context.kind === "type") {
|
|
23912
|
+
return [{ name: "kind", type: "NeoSubtreeDistribution" }];
|
|
23913
|
+
}
|
|
23914
|
+
return null;
|
|
23915
|
+
}
|
|
23904
23916
|
function storageFields(context) {
|
|
23905
23917
|
if (context.kind === "class") {
|
|
23906
23918
|
return [{ name: "allowed", type: "NeoAllowedStorage" }];
|
|
@@ -29447,7 +29459,7 @@ function projectDeclarationAnnotationNames(declaration) {
|
|
|
29447
29459
|
];
|
|
29448
29460
|
}
|
|
29449
29461
|
function projectMemberAnnotationNames(member) {
|
|
29450
|
-
const names = ["id", "settings", "storage"];
|
|
29462
|
+
const names = ["id", "settings", "storage", "distribution"];
|
|
29451
29463
|
if (member?.type.name === "List") names.push("index", "column");
|
|
29452
29464
|
return names;
|
|
29453
29465
|
}
|
|
@@ -31044,6 +31056,8 @@ function annotationSignatureParameters(name) {
|
|
|
31044
31056
|
return ["named settings"];
|
|
31045
31057
|
case "storage":
|
|
31046
31058
|
return ["StorageKind allowed"];
|
|
31059
|
+
case "distribution":
|
|
31060
|
+
return ["NeoSubtreeDistribution kind"];
|
|
31047
31061
|
case "relations":
|
|
31048
31062
|
return ["relation descriptors"];
|
|
31049
31063
|
case "incomplete":
|
|
@@ -35728,6 +35742,7 @@ var init_document_contracts = __esm({
|
|
|
35728
35742
|
"system",
|
|
35729
35743
|
"storage",
|
|
35730
35744
|
"storageKey",
|
|
35745
|
+
"distribution",
|
|
35731
35746
|
"minValue",
|
|
35732
35747
|
"maxValue",
|
|
35733
35748
|
"decimalPoints",
|
|
@@ -37029,6 +37044,11 @@ function memberFromDocument(record3, members, owners, classNames, context) {
|
|
|
37029
37044
|
// user-authored unless its own document explicitly marks it as system.
|
|
37030
37045
|
system: systemFromDocument(data.system, record3, "system"),
|
|
37031
37046
|
storage: normalizedStorage(field("storage", null), record3),
|
|
37047
|
+
// Read from the row's own document rather than through `field(...)`: an
|
|
37048
|
+
// override that declares no distribution inherits, and resolving the
|
|
37049
|
+
// chain here would emit the ancestor's explicit choice back into the
|
|
37050
|
+
// override's source as phantom drift (P76 §2).
|
|
37051
|
+
distribution: normalizedDistribution(data.distribution, record3),
|
|
37032
37052
|
storageKey: normalizedStorageKey(field("storageKey", null), record3)
|
|
37033
37053
|
};
|
|
37034
37054
|
const primitiveKind = SIMPLE_MEMBER_KIND_BY_KIND.get(kind);
|
|
@@ -37378,6 +37398,9 @@ function memberToDocumentFields(member, baseData3) {
|
|
|
37378
37398
|
} else if (isOverride && baseData3?.storage === 0) {
|
|
37379
37399
|
fields.storage = 0;
|
|
37380
37400
|
}
|
|
37401
|
+
if (member.distribution !== null) {
|
|
37402
|
+
fields.distribution = MEMBER_DISTRIBUTION.indexOf(member.distribution);
|
|
37403
|
+
}
|
|
37381
37404
|
if (member.storageKey !== null) fields.storageKey = member.storageKey;
|
|
37382
37405
|
if (member.kind === "int" || member.kind === "float") {
|
|
37383
37406
|
if (member.min !== null) fields.minValue = member.min;
|
|
@@ -38134,6 +38157,10 @@ function normalizedStorage(value, record3) {
|
|
|
38134
38157
|
const storage = ordinalValue(value ?? 0, MEMBER_STORAGE, record3, "storage");
|
|
38135
38158
|
return storage === "inherit" ? null : storage;
|
|
38136
38159
|
}
|
|
38160
|
+
function normalizedDistribution(value, record3) {
|
|
38161
|
+
if (value === void 0 || value === null) return null;
|
|
38162
|
+
return ordinalValue(value, MEMBER_DISTRIBUTION, record3, "distribution");
|
|
38163
|
+
}
|
|
38137
38164
|
function normalizedStorageKey(value, record3) {
|
|
38138
38165
|
if (value === void 0 || value === null || value === "") {
|
|
38139
38166
|
return null;
|
|
@@ -38258,7 +38285,7 @@ function invalidDocument(record3, path, message) {
|
|
|
38258
38285
|
`${record3.recordKind}:${record3.recordId}.${path} ${message}.`
|
|
38259
38286
|
);
|
|
38260
38287
|
}
|
|
38261
|
-
var MEMBER_KIND, MEMBER_MODIFIERS, MEMBER_ACCESS, MEMBER_STORAGE, STRING_FORMAT, MEMBER_SEARCH_BY, MEMBER_SELECTION, FUNCTION_DISPATCH, FUNCTION_BODY, MEMBER_PAYLOAD, DICTIONARY_KEY, LIST_KIND, LIST_INDEX, COLUMN_VISIBILITY, COLUMN_PIN, COLUMN_OVERFLOW, GENERIC_BINDING, TYPE_KIND_BY_MEMBER_KIND, SIMPLE_MEMBER_KIND_BY_KIND, MEMBER_KIND_BY_KIND, TYPE_MEMBER_KIND_BY_KIND, MEMBER_IDENTITY_FIELDS, INHERITED_MEMBER_ORDINAL_FIELDS, CHAIN_RESOLVED_OPTIONAL_MEMBER_FIELDS;
|
|
38288
|
+
var MEMBER_KIND, MEMBER_MODIFIERS, MEMBER_ACCESS, MEMBER_STORAGE, MEMBER_DISTRIBUTION, STRING_FORMAT, MEMBER_SEARCH_BY, MEMBER_SELECTION, FUNCTION_DISPATCH, FUNCTION_BODY, MEMBER_PAYLOAD, DICTIONARY_KEY, LIST_KIND, LIST_INDEX, COLUMN_VISIBILITY, COLUMN_PIN, COLUMN_OVERFLOW, GENERIC_BINDING, TYPE_KIND_BY_MEMBER_KIND, SIMPLE_MEMBER_KIND_BY_KIND, MEMBER_KIND_BY_KIND, TYPE_MEMBER_KIND_BY_KIND, MEMBER_IDENTITY_FIELDS, INHERITED_MEMBER_ORDINAL_FIELDS, CHAIN_RESOLVED_OPTIONAL_MEMBER_FIELDS;
|
|
38262
38289
|
var init_codecs = __esm({
|
|
38263
38290
|
"src/project-manifest/record-adapters/codecs.ts"() {
|
|
38264
38291
|
"use strict";
|
|
@@ -38297,6 +38324,7 @@ var init_codecs = __esm({
|
|
|
38297
38324
|
MEMBER_MODIFIERS = ["virtual", "sealed", "abstract", "static"];
|
|
38298
38325
|
MEMBER_ACCESS = ["public", "protected", "private"];
|
|
38299
38326
|
MEMBER_STORAGE = ["inherit", "immutable", "save", "session"];
|
|
38327
|
+
MEMBER_DISTRIBUTION = ["sparse", "packed"];
|
|
38300
38328
|
STRING_FORMAT = ["localized", "plain"];
|
|
38301
38329
|
MEMBER_SEARCH_BY = ["none", "memberKey"];
|
|
38302
38330
|
MEMBER_SELECTION = ["single", "multi"];
|
|
@@ -40675,6 +40703,13 @@ function assertMember2(value, path) {
|
|
|
40675
40703
|
}
|
|
40676
40704
|
assertSystem(member.system, `${path}.system`);
|
|
40677
40705
|
nullableStorage(member.storage, `${path}.storage`);
|
|
40706
|
+
nullableDistribution(member.distribution, `${path}.distribution`);
|
|
40707
|
+
if (member.distribution !== null && (member.kind === "computed" || member.kind === "function" || member.kind === "scriptFunction")) {
|
|
40708
|
+
invalid(
|
|
40709
|
+
`${path}.distribution`,
|
|
40710
|
+
"a value-less member has no stored value to distribute."
|
|
40711
|
+
);
|
|
40712
|
+
}
|
|
40678
40713
|
nullableNonEmptyString(member.storageKey, `${path}.storageKey`);
|
|
40679
40714
|
if (member.isReadOnly === true) {
|
|
40680
40715
|
if (owner.kind !== "classMember" && owner.kind !== "sharedClassMember") {
|
|
@@ -40738,6 +40773,12 @@ function assertMember2(value, path) {
|
|
|
40738
40773
|
);
|
|
40739
40774
|
arrayOf(member.indexes, `${path}.indexes`, assertListIndex);
|
|
40740
40775
|
arrayOf(member.columns, `${path}.columns`, assertListColumn);
|
|
40776
|
+
if (member.distribution === "packed" && member.listKind === "unordered") {
|
|
40777
|
+
invalid(
|
|
40778
|
+
`${path}.distribution`,
|
|
40779
|
+
"cannot be packed while listKind is unordered: an unordered list's membership is the set of live rows carrying its id, so its entries occupy no position inside a parent row to be packed into."
|
|
40780
|
+
);
|
|
40781
|
+
}
|
|
40741
40782
|
if (member.isReadOnly === true && Array.isArray(member.indexes) && member.indexes.length > 0) {
|
|
40742
40783
|
invalid(`${path}.indexes`, "must be empty on a read-only member.");
|
|
40743
40784
|
}
|
|
@@ -41823,6 +41864,10 @@ function nullableStorage(value, path) {
|
|
|
41823
41864
|
if (value === null) return;
|
|
41824
41865
|
stringIn(value, /* @__PURE__ */ new Set(["immutable", "save", "session"]), path);
|
|
41825
41866
|
}
|
|
41867
|
+
function nullableDistribution(value, path) {
|
|
41868
|
+
if (value === null) return;
|
|
41869
|
+
stringIn(value, /* @__PURE__ */ new Set(["sparse", "packed"]), path);
|
|
41870
|
+
}
|
|
41826
41871
|
function stringIn(value, allowed, path) {
|
|
41827
41872
|
const result = stringAt(value, path);
|
|
41828
41873
|
if (!allowed.has(result)) {
|
|
@@ -42065,7 +42110,8 @@ var init_validate = __esm({
|
|
|
42065
42110
|
"overrideOf",
|
|
42066
42111
|
"system",
|
|
42067
42112
|
"storage",
|
|
42068
|
-
"storageKey"
|
|
42113
|
+
"storageKey",
|
|
42114
|
+
"distribution"
|
|
42069
42115
|
];
|
|
42070
42116
|
MEMBER_KEYS_BY_KIND = {
|
|
42071
42117
|
null: [],
|
|
@@ -42669,6 +42715,148 @@ var init_member_storage = __esm({
|
|
|
42669
42715
|
}
|
|
42670
42716
|
});
|
|
42671
42717
|
|
|
42718
|
+
// ../src/models/members/member-kind-enum.ts
|
|
42719
|
+
var MemberKind;
|
|
42720
|
+
var init_member_kind_enum = __esm({
|
|
42721
|
+
"../src/models/members/member-kind-enum.ts"() {
|
|
42722
|
+
"use strict";
|
|
42723
|
+
MemberKind = /* @__PURE__ */ ((MemberKind16) => {
|
|
42724
|
+
MemberKind16[MemberKind16["Null"] = 0] = "Null";
|
|
42725
|
+
MemberKind16[MemberKind16["Bool"] = 1] = "Bool";
|
|
42726
|
+
MemberKind16[MemberKind16["Int"] = 2] = "Int";
|
|
42727
|
+
MemberKind16[MemberKind16["String"] = 3] = "String";
|
|
42728
|
+
MemberKind16[MemberKind16["Float"] = 4] = "Float";
|
|
42729
|
+
MemberKind16[MemberKind16["Dictionary"] = 5] = "Dictionary";
|
|
42730
|
+
MemberKind16[MemberKind16["List"] = 6] = "List";
|
|
42731
|
+
MemberKind16[MemberKind16["Class"] = 7] = "Class";
|
|
42732
|
+
MemberKind16[MemberKind16["Enum"] = 8] = "Enum";
|
|
42733
|
+
MemberKind16[MemberKind16["Lookup"] = 9] = "Lookup";
|
|
42734
|
+
MemberKind16[MemberKind16["NSProperty"] = 10] = "NSProperty";
|
|
42735
|
+
MemberKind16[MemberKind16["Sprite"] = 11] = "Sprite";
|
|
42736
|
+
MemberKind16[MemberKind16["Audio"] = 12] = "Audio";
|
|
42737
|
+
MemberKind16[MemberKind16["Function"] = 13] = "Function";
|
|
42738
|
+
MemberKind16[MemberKind16["Vector2"] = 14] = "Vector2";
|
|
42739
|
+
MemberKind16[MemberKind16["Vector2Int"] = 15] = "Vector2Int";
|
|
42740
|
+
MemberKind16[MemberKind16["Vector3"] = 16] = "Vector3";
|
|
42741
|
+
MemberKind16[MemberKind16["Vector3Int"] = 17] = "Vector3Int";
|
|
42742
|
+
MemberKind16[MemberKind16["DialogueLookup"] = 18] = "DialogueLookup";
|
|
42743
|
+
MemberKind16[MemberKind16["Color"] = 19] = "Color";
|
|
42744
|
+
MemberKind16[MemberKind16["Decimal"] = 20] = "Decimal";
|
|
42745
|
+
MemberKind16[MemberKind16["Generic"] = 21] = "Generic";
|
|
42746
|
+
MemberKind16[MemberKind16["Interface"] = 22] = "Interface";
|
|
42747
|
+
MemberKind16[MemberKind16["NSFunction"] = 23] = "NSFunction";
|
|
42748
|
+
MemberKind16[MemberKind16["FunctionRef"] = 24] = "FunctionRef";
|
|
42749
|
+
MemberKind16[MemberKind16["NSDelegate"] = 25] = "NSDelegate";
|
|
42750
|
+
MemberKind16[MemberKind16["NSAction"] = 26] = "NSAction";
|
|
42751
|
+
MemberKind16[MemberKind16["Variant"] = 27] = "Variant";
|
|
42752
|
+
return MemberKind16;
|
|
42753
|
+
})(MemberKind || {});
|
|
42754
|
+
}
|
|
42755
|
+
});
|
|
42756
|
+
|
|
42757
|
+
// ../src/models/members/member-subtree-distribution.ts
|
|
42758
|
+
function isNeoSubtreeDistributionKind(value) {
|
|
42759
|
+
return value === 0 /* Sparse */ || value === 1 /* Packed */;
|
|
42760
|
+
}
|
|
42761
|
+
function sparse(growth) {
|
|
42762
|
+
return { distribution: 0 /* Sparse */, growth };
|
|
42763
|
+
}
|
|
42764
|
+
function resolveAutomatic(kind, settings) {
|
|
42765
|
+
const rule = AUTOMATIC_MEMBER_DISTRIBUTION[kind];
|
|
42766
|
+
if (rule === 1 /* Packed */) return PACKED;
|
|
42767
|
+
if (rule === "valueLess") return void 0;
|
|
42768
|
+
if (rule === "openSlot") {
|
|
42769
|
+
throw new Error(
|
|
42770
|
+
`automaticMemberDistribution: MemberKind.Generic has no automatic distribution. Substitute the concrete binding member first and pass its kind and settings.`
|
|
42771
|
+
);
|
|
42772
|
+
}
|
|
42773
|
+
if (rule === "stringFormat") {
|
|
42774
|
+
return settings.format === 1 /* Plain */ ? sparse("unboundedText") : PACKED;
|
|
42775
|
+
}
|
|
42776
|
+
if (rule === "selectionCardinality") {
|
|
42777
|
+
return settings.selection === 1 /* Multi */ ? sparse("selectionCount") : PACKED;
|
|
42778
|
+
}
|
|
42779
|
+
return sparse(rule.sparse);
|
|
42780
|
+
}
|
|
42781
|
+
function automaticMemberDistribution(kind, settings) {
|
|
42782
|
+
return resolveAutomatic(kind, settings)?.distribution;
|
|
42783
|
+
}
|
|
42784
|
+
function memberKindSupportsDistribution(kind) {
|
|
42785
|
+
return AUTOMATIC_MEMBER_DISTRIBUTION[kind] !== "valueLess";
|
|
42786
|
+
}
|
|
42787
|
+
var AUTOMATIC_MEMBER_DISTRIBUTION, PACKED;
|
|
42788
|
+
var init_member_subtree_distribution = __esm({
|
|
42789
|
+
"../src/models/members/member-subtree-distribution.ts"() {
|
|
42790
|
+
"use strict";
|
|
42791
|
+
init_member_kind_enum();
|
|
42792
|
+
AUTOMATIC_MEMBER_DISTRIBUTION = {
|
|
42793
|
+
/** A stored null has no growth axis. */
|
|
42794
|
+
[0 /* Null */]: 1 /* Packed */,
|
|
42795
|
+
/** Fixed scalar. */
|
|
42796
|
+
[1 /* Bool */]: 1 /* Packed */,
|
|
42797
|
+
/** Fixed scalar. */
|
|
42798
|
+
[2 /* Int */]: 1 /* Packed */,
|
|
42799
|
+
/**
|
|
42800
|
+
* A localized value stores one localized-text id; plain text is unbounded.
|
|
42801
|
+
* The per-locale bodies stay on their own records under either arm.
|
|
42802
|
+
*/
|
|
42803
|
+
[3 /* String */]: "stringFormat",
|
|
42804
|
+
/** Fixed scalar. */
|
|
42805
|
+
[4 /* Float */]: 1 /* Packed */,
|
|
42806
|
+
/** Entry count grows with content. */
|
|
42807
|
+
[5 /* Dictionary */]: { sparse: "entryCount" },
|
|
42808
|
+
/** Entry count grows with content. */
|
|
42809
|
+
[6 /* List */]: { sparse: "entryCount" },
|
|
42810
|
+
/** Schema and authored child count can grow. */
|
|
42811
|
+
[7 /* Class */]: { sparse: "authoredChildren" },
|
|
42812
|
+
/** The enum declaration bounds the selected option ids; enum edits recheck encoded size. */
|
|
42813
|
+
[8 /* Enum */]: 1 /* Packed */,
|
|
42814
|
+
/** Single selection stores at most one value id; multi-selection follows collection size. */
|
|
42815
|
+
[9 /* Lookup */]: "selectionCardinality",
|
|
42816
|
+
/** Computed property, no stored value. */
|
|
42817
|
+
[10 /* NSProperty */]: "valueLess",
|
|
42818
|
+
/** Fixed `fileId` and `sliceIndex` shape. */
|
|
42819
|
+
[11 /* Sprite */]: 1 /* Packed */,
|
|
42820
|
+
/** Fixed one-file-id shape. */
|
|
42821
|
+
[12 /* Audio */]: 1 /* Packed */,
|
|
42822
|
+
/** Declaration only, no stored value. */
|
|
42823
|
+
[13 /* Function */]: "valueLess",
|
|
42824
|
+
/** Fixed two-number shape. */
|
|
42825
|
+
[14 /* Vector2 */]: 1 /* Packed */,
|
|
42826
|
+
/** Fixed two-integer shape. */
|
|
42827
|
+
[15 /* Vector2Int */]: 1 /* Packed */,
|
|
42828
|
+
/** Fixed three-number shape. */
|
|
42829
|
+
[16 /* Vector3 */]: 1 /* Packed */,
|
|
42830
|
+
/** Fixed three-integer shape. */
|
|
42831
|
+
[17 /* Vector3Int */]: 1 /* Packed */,
|
|
42832
|
+
/** Single selection stores at most one dialogue id. */
|
|
42833
|
+
[18 /* DialogueLookup */]: "selectionCardinality",
|
|
42834
|
+
/** Fixed four-channel shape. */
|
|
42835
|
+
[19 /* Color */]: 1 /* Packed */,
|
|
42836
|
+
/** Exact decimals are arbitrary-length strings. */
|
|
42837
|
+
[20 /* Decimal */]: { sparse: "unboundedText" },
|
|
42838
|
+
/** The open slot has no automatic shape; an explicit member-chain choice still wins. */
|
|
42839
|
+
[21 /* Generic */]: "openSlot",
|
|
42840
|
+
/** Type information only; not a persistable member record kind. */
|
|
42841
|
+
[22 /* Interface */]: "valueLess",
|
|
42842
|
+
/** Declaration only, no stored value. */
|
|
42843
|
+
[23 /* NSFunction */]: "valueLess",
|
|
42844
|
+
/** Fixed one-member-id shape. */
|
|
42845
|
+
[24 /* FunctionRef */]: 1 /* Packed */,
|
|
42846
|
+
/** A closure can carry unbounded code and captures. */
|
|
42847
|
+
[25 /* NSDelegate */]: { sparse: "closureBody" },
|
|
42848
|
+
/** Listener count grows with content. */
|
|
42849
|
+
[26 /* NSAction */]: { sparse: "listenerCount" },
|
|
42850
|
+
/** Fixed class, variant, and optional bound-row ids. */
|
|
42851
|
+
[27 /* Variant */]: 1 /* Packed */
|
|
42852
|
+
};
|
|
42853
|
+
PACKED = {
|
|
42854
|
+
distribution: 1 /* Packed */,
|
|
42855
|
+
growth: null
|
|
42856
|
+
};
|
|
42857
|
+
}
|
|
42858
|
+
});
|
|
42859
|
+
|
|
42672
42860
|
// ../src/models/core/world-system-kinds.generated.ts
|
|
42673
42861
|
function isNeoWorldSystemClassKind(value) {
|
|
42674
42862
|
if (typeof value !== "string") return false;
|
|
@@ -44435,45 +44623,6 @@ var init_classes = __esm({
|
|
|
44435
44623
|
}
|
|
44436
44624
|
});
|
|
44437
44625
|
|
|
44438
|
-
// ../src/models/members/member-kind-enum.ts
|
|
44439
|
-
var MemberKind;
|
|
44440
|
-
var init_member_kind_enum = __esm({
|
|
44441
|
-
"../src/models/members/member-kind-enum.ts"() {
|
|
44442
|
-
"use strict";
|
|
44443
|
-
MemberKind = /* @__PURE__ */ ((MemberKind16) => {
|
|
44444
|
-
MemberKind16[MemberKind16["Null"] = 0] = "Null";
|
|
44445
|
-
MemberKind16[MemberKind16["Bool"] = 1] = "Bool";
|
|
44446
|
-
MemberKind16[MemberKind16["Int"] = 2] = "Int";
|
|
44447
|
-
MemberKind16[MemberKind16["String"] = 3] = "String";
|
|
44448
|
-
MemberKind16[MemberKind16["Float"] = 4] = "Float";
|
|
44449
|
-
MemberKind16[MemberKind16["Dictionary"] = 5] = "Dictionary";
|
|
44450
|
-
MemberKind16[MemberKind16["List"] = 6] = "List";
|
|
44451
|
-
MemberKind16[MemberKind16["Class"] = 7] = "Class";
|
|
44452
|
-
MemberKind16[MemberKind16["Enum"] = 8] = "Enum";
|
|
44453
|
-
MemberKind16[MemberKind16["Lookup"] = 9] = "Lookup";
|
|
44454
|
-
MemberKind16[MemberKind16["NSProperty"] = 10] = "NSProperty";
|
|
44455
|
-
MemberKind16[MemberKind16["Sprite"] = 11] = "Sprite";
|
|
44456
|
-
MemberKind16[MemberKind16["Audio"] = 12] = "Audio";
|
|
44457
|
-
MemberKind16[MemberKind16["Function"] = 13] = "Function";
|
|
44458
|
-
MemberKind16[MemberKind16["Vector2"] = 14] = "Vector2";
|
|
44459
|
-
MemberKind16[MemberKind16["Vector2Int"] = 15] = "Vector2Int";
|
|
44460
|
-
MemberKind16[MemberKind16["Vector3"] = 16] = "Vector3";
|
|
44461
|
-
MemberKind16[MemberKind16["Vector3Int"] = 17] = "Vector3Int";
|
|
44462
|
-
MemberKind16[MemberKind16["DialogueLookup"] = 18] = "DialogueLookup";
|
|
44463
|
-
MemberKind16[MemberKind16["Color"] = 19] = "Color";
|
|
44464
|
-
MemberKind16[MemberKind16["Decimal"] = 20] = "Decimal";
|
|
44465
|
-
MemberKind16[MemberKind16["Generic"] = 21] = "Generic";
|
|
44466
|
-
MemberKind16[MemberKind16["Interface"] = 22] = "Interface";
|
|
44467
|
-
MemberKind16[MemberKind16["NSFunction"] = 23] = "NSFunction";
|
|
44468
|
-
MemberKind16[MemberKind16["FunctionRef"] = 24] = "FunctionRef";
|
|
44469
|
-
MemberKind16[MemberKind16["NSDelegate"] = 25] = "NSDelegate";
|
|
44470
|
-
MemberKind16[MemberKind16["NSAction"] = 26] = "NSAction";
|
|
44471
|
-
MemberKind16[MemberKind16["Variant"] = 27] = "Variant";
|
|
44472
|
-
return MemberKind16;
|
|
44473
|
-
})(MemberKind || {});
|
|
44474
|
-
}
|
|
44475
|
-
});
|
|
44476
|
-
|
|
44477
44626
|
// ../src/models/members/structured-leaf-fields.ts
|
|
44478
44627
|
function isStructuredLeafKind(kind) {
|
|
44479
44628
|
return Object.prototype.hasOwnProperty.call(STRUCTURED_LEAF_FIELDS, kind);
|
|
@@ -45322,6 +45471,12 @@ function hasValidStorageField(v, allowNull) {
|
|
|
45322
45471
|
if (typeof v.kind !== "number") return false;
|
|
45323
45472
|
return memberKindSupportsStorage(v.kind);
|
|
45324
45473
|
}
|
|
45474
|
+
function hasValidDistributionField(v) {
|
|
45475
|
+
if (v.distribution === void 0) return true;
|
|
45476
|
+
if (!isNeoSubtreeDistributionKind(v.distribution)) return false;
|
|
45477
|
+
if (typeof v.kind !== "number") return false;
|
|
45478
|
+
return memberKindSupportsDistribution(v.kind);
|
|
45479
|
+
}
|
|
45325
45480
|
function isMemberBase(value) {
|
|
45326
45481
|
const v = value;
|
|
45327
45482
|
if (v?.kind === 22 /* Interface */) return false;
|
|
@@ -45345,6 +45500,7 @@ function isMemberBase(value) {
|
|
|
45345
45500
|
return false;
|
|
45346
45501
|
}
|
|
45347
45502
|
if (!hasValidStorageField(v, true)) return false;
|
|
45503
|
+
if (!hasValidDistributionField(v)) return false;
|
|
45348
45504
|
const storageKey = getField(value, "storageKey");
|
|
45349
45505
|
if (storageKey !== void 0 && storageKey !== null && typeof storageKey !== "string")
|
|
45350
45506
|
return false;
|
|
@@ -45443,6 +45599,7 @@ function isMemberOverrideBase(value) {
|
|
|
45443
45599
|
return false;
|
|
45444
45600
|
}
|
|
45445
45601
|
if (!hasValidStorageField(v, false)) return false;
|
|
45602
|
+
if (!hasValidDistributionField(v)) return false;
|
|
45446
45603
|
if (v.defaultValue !== void 0 && v.defaultValue !== null && !isMemberValueBase(v.defaultValue)) {
|
|
45447
45604
|
return false;
|
|
45448
45605
|
}
|
|
@@ -45686,6 +45843,7 @@ var init_member_kinds = __esm({
|
|
|
45686
45843
|
init_classes();
|
|
45687
45844
|
init_member_kind_enum();
|
|
45688
45845
|
init_member_storage();
|
|
45846
|
+
init_member_subtree_distribution();
|
|
45689
45847
|
init_structured_leaf_fields();
|
|
45690
45848
|
init_member_kind_enum();
|
|
45691
45849
|
FunctionArgumentReservedNames = /* @__PURE__ */ new Set([
|
|
@@ -46280,6 +46438,7 @@ var init_world_system_classes_generated = __esm({
|
|
|
46280
46438
|
"../src/models/classes/world-system-classes.generated.ts"() {
|
|
46281
46439
|
"use strict";
|
|
46282
46440
|
init_member_storage();
|
|
46441
|
+
init_member_subtree_distribution();
|
|
46283
46442
|
init_classes();
|
|
46284
46443
|
init_member_kinds();
|
|
46285
46444
|
WORLD_GRID_CHILDREN_MEMBER_ID = "system_98578ba3-a70e-4397-9283-996a898d44c8";
|
|
@@ -46373,6 +46532,7 @@ var init_world_system_classes_generated = __esm({
|
|
|
46373
46532
|
memberKind: "string",
|
|
46374
46533
|
defaultValue: "",
|
|
46375
46534
|
format: 1 /* Plain */,
|
|
46535
|
+
distribution: 1 /* Packed */,
|
|
46376
46536
|
requirement: 1 /* Required */,
|
|
46377
46537
|
schemaKey: "Name"
|
|
46378
46538
|
}
|
|
@@ -46389,6 +46549,7 @@ var init_world_system_classes_generated = __esm({
|
|
|
46389
46549
|
memberKind: "string",
|
|
46390
46550
|
defaultValue: "",
|
|
46391
46551
|
format: 1 /* Plain */,
|
|
46552
|
+
distribution: 1 /* Packed */,
|
|
46392
46553
|
requirement: 1 /* Required */,
|
|
46393
46554
|
schemaKey: "Name"
|
|
46394
46555
|
},
|
|
@@ -46421,6 +46582,7 @@ var init_world_system_classes_generated = __esm({
|
|
|
46421
46582
|
memberKind: "string",
|
|
46422
46583
|
defaultValue: "",
|
|
46423
46584
|
format: 1 /* Plain */,
|
|
46585
|
+
distribution: 1 /* Packed */,
|
|
46424
46586
|
requirement: 1 /* Required */,
|
|
46425
46587
|
schemaKey: "Name"
|
|
46426
46588
|
},
|
|
@@ -46453,6 +46615,7 @@ var init_world_system_classes_generated = __esm({
|
|
|
46453
46615
|
memberKind: "string",
|
|
46454
46616
|
defaultValue: "",
|
|
46455
46617
|
format: 1 /* Plain */,
|
|
46618
|
+
distribution: 1 /* Packed */,
|
|
46456
46619
|
requirement: 1 /* Required */,
|
|
46457
46620
|
schemaKey: "Name"
|
|
46458
46621
|
},
|
|
@@ -46483,6 +46646,7 @@ var init_world_system_classes_generated = __esm({
|
|
|
46483
46646
|
memberKind: "string",
|
|
46484
46647
|
defaultValue: "",
|
|
46485
46648
|
format: 1 /* Plain */,
|
|
46649
|
+
distribution: 1 /* Packed */,
|
|
46486
46650
|
requirement: 1 /* Required */,
|
|
46487
46651
|
schemaKey: "Name"
|
|
46488
46652
|
},
|
|
@@ -46570,6 +46734,7 @@ var init_world_system_classes_generated = __esm({
|
|
|
46570
46734
|
memberKind: "string",
|
|
46571
46735
|
defaultValue: "",
|
|
46572
46736
|
format: 1 /* Plain */,
|
|
46737
|
+
distribution: 1 /* Packed */,
|
|
46573
46738
|
requirement: 1 /* Required */,
|
|
46574
46739
|
schemaKey: "Name"
|
|
46575
46740
|
},
|
|
@@ -47332,6 +47497,7 @@ var init_world_system_classes_generated = __esm({
|
|
|
47332
47497
|
memberKind: "string",
|
|
47333
47498
|
defaultInitializerCode: "clipKey",
|
|
47334
47499
|
format: 1 /* Plain */,
|
|
47500
|
+
distribution: 1 /* Packed */,
|
|
47335
47501
|
requirement: 1 /* Required */,
|
|
47336
47502
|
schemaKey: "ClipKey"
|
|
47337
47503
|
}
|
|
@@ -48172,6 +48338,11 @@ function substituteMember(member, env, members, preResolvedMember) {
|
|
|
48172
48338
|
} else {
|
|
48173
48339
|
delete substituted.storageKey;
|
|
48174
48340
|
}
|
|
48341
|
+
if (resolved.distribution !== void 0) {
|
|
48342
|
+
substituted.distribution = resolved.distribution;
|
|
48343
|
+
} else {
|
|
48344
|
+
delete substituted.distribution;
|
|
48345
|
+
}
|
|
48175
48346
|
if (resolved.modifier !== void 0) {
|
|
48176
48347
|
substituted.modifier = resolved.modifier;
|
|
48177
48348
|
} else {
|
|
@@ -48719,10 +48890,31 @@ function pickInstanceProvenance(source) {
|
|
|
48719
48890
|
...source.instanceVariantRowValueId === void 0 ? {} : { instanceVariantRowValueId: source.instanceVariantRowValueId }
|
|
48720
48891
|
};
|
|
48721
48892
|
}
|
|
48893
|
+
function canonicalInstanceProvenanceViolation(value) {
|
|
48894
|
+
const constructorArgs = "constructorArgs" in value ? value.constructorArgs : void 0;
|
|
48895
|
+
const constructorId = "instanceConstructorId" in value ? value.instanceConstructorId : void 0;
|
|
48896
|
+
const variantId = "instanceVariantId" in value ? value.instanceVariantId : void 0;
|
|
48897
|
+
if (constructorArgs !== void 0 && constructorId === void 0 && typeof variantId !== "string") {
|
|
48898
|
+
return "constructor-args-without-stamp";
|
|
48899
|
+
}
|
|
48900
|
+
if (typeof constructorId === "string" && constructorArgs === void 0) {
|
|
48901
|
+
return "named-constructor-without-args";
|
|
48902
|
+
}
|
|
48903
|
+
if (constructorId === null && constructorArgs !== void 0 && typeof constructorArgs === "object" && constructorArgs !== null && !Array.isArray(constructorArgs) && Object.keys(constructorArgs).length > 0) {
|
|
48904
|
+
return "implicit-constructor-with-args";
|
|
48905
|
+
}
|
|
48906
|
+
if ("instanceVariantRowValueId" in value && typeof value.instanceVariantRowValueId === "string" && typeof variantId !== "string") {
|
|
48907
|
+
return "variant-row-without-variant";
|
|
48908
|
+
}
|
|
48909
|
+
return null;
|
|
48910
|
+
}
|
|
48722
48911
|
function isVirtualInstanceRootShape(value) {
|
|
48723
48912
|
if (value.instanceConstructorId !== void 0) return true;
|
|
48724
48913
|
return typeof value.instanceVariantId === "string";
|
|
48725
48914
|
}
|
|
48915
|
+
function isCollapseStampedInstanceRoot(value) {
|
|
48916
|
+
return isLiteralValueContent(value) && isVirtualInstanceRootShape(value);
|
|
48917
|
+
}
|
|
48726
48918
|
function carriesCompleteConstructionRecipe(value) {
|
|
48727
48919
|
if (!isVirtualInstanceRootShape(value)) return false;
|
|
48728
48920
|
if (value.instanceConstructorId === null) return true;
|
|
@@ -49359,6 +49551,463 @@ var init_read_only_members = __esm({
|
|
|
49359
49551
|
}
|
|
49360
49552
|
});
|
|
49361
49553
|
|
|
49554
|
+
// ../src/models/members/member-value-id.ts
|
|
49555
|
+
function derivedMemberValueId(memberId) {
|
|
49556
|
+
return inSystemRecordNamespaceOf(
|
|
49557
|
+
memberId,
|
|
49558
|
+
v5_default(withoutSystemRecordIdPrefix(memberId), NEO_MEMBER_VALUE_NAMESPACE)
|
|
49559
|
+
);
|
|
49560
|
+
}
|
|
49561
|
+
function virtualValueId(instanceRootId, sourceIdentity3) {
|
|
49562
|
+
return inSystemRecordNamespaceOf(
|
|
49563
|
+
instanceRootId,
|
|
49564
|
+
v5_default(
|
|
49565
|
+
`${withoutSystemRecordIdPrefix(instanceRootId)}:${sourceIdentity3}`,
|
|
49566
|
+
NEO_VIRTUAL_VALUE_NAMESPACE
|
|
49567
|
+
)
|
|
49568
|
+
);
|
|
49569
|
+
}
|
|
49570
|
+
function pendingVirtualValueId(pendingInstanceRootId, sourceIdentity3) {
|
|
49571
|
+
return `${PENDING_VIRTUAL_VALUE_PREFIX}${encodeURIComponent(pendingInstanceRootId)}:${encodeURIComponent(sourceIdentity3)}`;
|
|
49572
|
+
}
|
|
49573
|
+
function pendingVirtualValueIdentity(token) {
|
|
49574
|
+
if (!token.startsWith(PENDING_VIRTUAL_VALUE_PREFIX)) return null;
|
|
49575
|
+
const payload = token.slice(PENDING_VIRTUAL_VALUE_PREFIX.length);
|
|
49576
|
+
const separator = payload.indexOf(":");
|
|
49577
|
+
if (separator < 0) return null;
|
|
49578
|
+
return {
|
|
49579
|
+
instanceRootId: decodeURIComponent(payload.slice(0, separator)),
|
|
49580
|
+
sourceIdentity: decodeURIComponent(payload.slice(separator + 1))
|
|
49581
|
+
};
|
|
49582
|
+
}
|
|
49583
|
+
function pendingMemberValueId(pendingMemberId) {
|
|
49584
|
+
return `${PENDING_MEMBER_VALUE_PREFIX}${encodeURIComponent(pendingMemberId)}`;
|
|
49585
|
+
}
|
|
49586
|
+
function pendingMemberValueMemberId(token) {
|
|
49587
|
+
if (!token.startsWith(PENDING_MEMBER_VALUE_PREFIX)) return null;
|
|
49588
|
+
return decodeURIComponent(token.slice(PENDING_MEMBER_VALUE_PREFIX.length));
|
|
49589
|
+
}
|
|
49590
|
+
var NEO_MEMBER_VALUE_NAMESPACE, NEO_VIRTUAL_VALUE_NAMESPACE, PENDING_VIRTUAL_VALUE_PREFIX, PENDING_MEMBER_VALUE_PREFIX;
|
|
49591
|
+
var init_member_value_id = __esm({
|
|
49592
|
+
"../src/models/members/member-value-id.ts"() {
|
|
49593
|
+
"use strict";
|
|
49594
|
+
init_dist_node();
|
|
49595
|
+
init_system_record_id();
|
|
49596
|
+
NEO_MEMBER_VALUE_NAMESPACE = "7f2b9c14-58d6-5a07-b3e1-4c9d0a6f8b25";
|
|
49597
|
+
NEO_VIRTUAL_VALUE_NAMESPACE = "3e8ca0b3-e3f1-5d5f-bf2f-6ab5ee3896d0";
|
|
49598
|
+
PENDING_VIRTUAL_VALUE_PREFIX = "__pending__:virtual-value:";
|
|
49599
|
+
PENDING_MEMBER_VALUE_PREFIX = "__pending__:member-value:";
|
|
49600
|
+
}
|
|
49601
|
+
});
|
|
49602
|
+
|
|
49603
|
+
// ../src/models/members/packed-value-encoding.ts
|
|
49604
|
+
function isPackedValueEnvelope(value) {
|
|
49605
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
49606
|
+
return false;
|
|
49607
|
+
}
|
|
49608
|
+
return Object.hasOwn(value, PACKED_VALUE_ENTRY_KEY);
|
|
49609
|
+
}
|
|
49610
|
+
function rowCarriesPackedValueContent(content) {
|
|
49611
|
+
if (containerHoldsPackedEntry(content.value)) return true;
|
|
49612
|
+
return containerHoldsPackedEntry(content.constructorArgs);
|
|
49613
|
+
}
|
|
49614
|
+
function expandPackedValueRows(rows) {
|
|
49615
|
+
let firstPacked = -1;
|
|
49616
|
+
for (let index = 0; index < rows.length; index += 1) {
|
|
49617
|
+
const row = rows[index];
|
|
49618
|
+
if (row === void 0 || !rowCarriesPackedValueContent(row)) continue;
|
|
49619
|
+
firstPacked = index;
|
|
49620
|
+
break;
|
|
49621
|
+
}
|
|
49622
|
+
if (firstPacked < 0) return rows;
|
|
49623
|
+
const expanded = rows.slice(0, firstPacked);
|
|
49624
|
+
for (let index = firstPacked; index < rows.length; index += 1) {
|
|
49625
|
+
const row = rows[index];
|
|
49626
|
+
if (row === void 0) continue;
|
|
49627
|
+
const decoded = decodePackedValueRow(row);
|
|
49628
|
+
expanded.push(decoded.row, ...decoded.children);
|
|
49629
|
+
}
|
|
49630
|
+
return expanded;
|
|
49631
|
+
}
|
|
49632
|
+
function expandPackedDocumentValues(document) {
|
|
49633
|
+
const stored = document.values;
|
|
49634
|
+
const expanded = expandPackedValueRows(stored);
|
|
49635
|
+
if (expanded === stored) return document;
|
|
49636
|
+
return { ...document, values: expanded };
|
|
49637
|
+
}
|
|
49638
|
+
function decodePackedValueRow(row) {
|
|
49639
|
+
if (!rowCarriesPackedValueContent(row)) {
|
|
49640
|
+
return { row, children: NO_CHILDREN, packedChildIdsByParentId: NO_EDGES };
|
|
49641
|
+
}
|
|
49642
|
+
const state = {
|
|
49643
|
+
edges: /* @__PURE__ */ new Map(),
|
|
49644
|
+
seenIds: /* @__PURE__ */ new Set([row.id]),
|
|
49645
|
+
projectId: row.projectId,
|
|
49646
|
+
mapKey: row.mapKey
|
|
49647
|
+
};
|
|
49648
|
+
const children = [];
|
|
49649
|
+
const scope = {
|
|
49650
|
+
state,
|
|
49651
|
+
ownerId: row.id,
|
|
49652
|
+
ownerLabel: `value "${row.id}"`,
|
|
49653
|
+
constructionRootId: isCollapseStampedInstanceRoot(row) ? row.id : null
|
|
49654
|
+
};
|
|
49655
|
+
const value = decodeContentField(row.value, "value", scope, children);
|
|
49656
|
+
const constructorArgs = decodeContentField(
|
|
49657
|
+
isLiteralValueContent(row) ? row.constructorArgs : void 0,
|
|
49658
|
+
"constructorArgs",
|
|
49659
|
+
scope,
|
|
49660
|
+
children
|
|
49661
|
+
);
|
|
49662
|
+
return {
|
|
49663
|
+
row: withDecodedContent(row, value, constructorArgs),
|
|
49664
|
+
children,
|
|
49665
|
+
packedChildIdsByParentId: state.edges
|
|
49666
|
+
};
|
|
49667
|
+
}
|
|
49668
|
+
function encodePackedValueRow(args) {
|
|
49669
|
+
const scope = {
|
|
49670
|
+
parent: args.parent,
|
|
49671
|
+
rowsById: args.rowsById,
|
|
49672
|
+
packedChildIdsByParentId: args.packedChildIdsByParentId,
|
|
49673
|
+
ownerId: args.parent.id,
|
|
49674
|
+
ownerLabel: `value "${args.parent.id}"`,
|
|
49675
|
+
constructionRootId: isCollapseStampedInstanceRoot(args.parent) ? args.parent.id : null
|
|
49676
|
+
};
|
|
49677
|
+
const pending = pendingPackedChildIds(scope);
|
|
49678
|
+
if (pending === null) return args.parent;
|
|
49679
|
+
const value = encodeContentField(args.parent.value, pending, scope);
|
|
49680
|
+
const constructorArgs = encodeContentField(
|
|
49681
|
+
isLiteralValueContent(args.parent) ? args.parent.constructorArgs : void 0,
|
|
49682
|
+
pending,
|
|
49683
|
+
scope
|
|
49684
|
+
);
|
|
49685
|
+
assertEveryChildPlaced(pending, scope);
|
|
49686
|
+
return withDecodedContent(args.parent, value, constructorArgs);
|
|
49687
|
+
}
|
|
49688
|
+
function canonicalPackedChildId(args) {
|
|
49689
|
+
if (args.constructionRootId === null) return null;
|
|
49690
|
+
if (typeof args.sourceValueId !== "string") return null;
|
|
49691
|
+
if (args.sourceValueId.length === 0) return null;
|
|
49692
|
+
return virtualValueId(args.constructionRootId, args.sourceValueId);
|
|
49693
|
+
}
|
|
49694
|
+
function decodeContentField(container, field, scope, children) {
|
|
49695
|
+
if (!containerHoldsPackedEntry(container)) return null;
|
|
49696
|
+
if (Array.isArray(container)) {
|
|
49697
|
+
return {
|
|
49698
|
+
content: container.map(
|
|
49699
|
+
(entry, index) => isPackedValueEnvelope(entry) ? decodeEnvelope(entry, `${field}[${index}]`, scope, children) : entry
|
|
49700
|
+
)
|
|
49701
|
+
};
|
|
49702
|
+
}
|
|
49703
|
+
const decoded = {};
|
|
49704
|
+
for (const [key, entry] of Object.entries(
|
|
49705
|
+
container
|
|
49706
|
+
)) {
|
|
49707
|
+
decoded[key] = isPackedValueEnvelope(entry) ? decodeEnvelope(
|
|
49708
|
+
entry,
|
|
49709
|
+
`${field}[${JSON.stringify(key)}]`,
|
|
49710
|
+
scope,
|
|
49711
|
+
children
|
|
49712
|
+
) : entry;
|
|
49713
|
+
}
|
|
49714
|
+
return { content: decoded };
|
|
49715
|
+
}
|
|
49716
|
+
function decodeEnvelope(envelope, position, scope, children) {
|
|
49717
|
+
const label = `Packed value entry at ${scope.ownerLabel}.${position}`;
|
|
49718
|
+
const entry = envelope[PACKED_VALUE_ENTRY_KEY];
|
|
49719
|
+
assertDecodableEntry(entry, label);
|
|
49720
|
+
const id2 = packedEntryLogicalId(entry, label, scope.constructionRootId);
|
|
49721
|
+
if (scope.state.seenIds.has(id2)) {
|
|
49722
|
+
throw new PackedValueEncodingError(
|
|
49723
|
+
`${label} resolves to id "${id2}", which another row in the same packed payload already claims.`
|
|
49724
|
+
);
|
|
49725
|
+
}
|
|
49726
|
+
scope.state.seenIds.add(id2);
|
|
49727
|
+
registerEdge(scope.state.edges, scope.ownerId, id2);
|
|
49728
|
+
const childScope = {
|
|
49729
|
+
state: scope.state,
|
|
49730
|
+
ownerId: id2,
|
|
49731
|
+
ownerLabel: `packed value "${id2}"`,
|
|
49732
|
+
constructionRootId: isCollapseStampedInstanceRoot(entry) ? id2 : scope.constructionRootId
|
|
49733
|
+
};
|
|
49734
|
+
const nested = [];
|
|
49735
|
+
children.push(logicalChildRow(entry, id2, childScope, nested));
|
|
49736
|
+
children.push(...nested);
|
|
49737
|
+
return id2;
|
|
49738
|
+
}
|
|
49739
|
+
function logicalChildRow(entry, id2, scope, children) {
|
|
49740
|
+
const rowFields = {
|
|
49741
|
+
id: id2,
|
|
49742
|
+
projectId: scope.state.projectId,
|
|
49743
|
+
createdAt: entry.createdAt,
|
|
49744
|
+
updatedAt: entry.updatedAt,
|
|
49745
|
+
...scope.state.mapKey === void 0 ? {} : { mapKey: scope.state.mapKey },
|
|
49746
|
+
...entry.genericBindings === void 0 ? {} : { genericBindings: entry.genericBindings },
|
|
49747
|
+
...entry.sourceValueId === void 0 ? {} : { sourceValueId: entry.sourceValueId }
|
|
49748
|
+
};
|
|
49749
|
+
if (isInitValueContent(entry)) return { ...rowFields, init: entry.init };
|
|
49750
|
+
const value = decodeContentField(entry.value, "value", scope, children);
|
|
49751
|
+
const constructorArgs = decodeContentField(
|
|
49752
|
+
entry.constructorArgs,
|
|
49753
|
+
"constructorArgs",
|
|
49754
|
+
scope,
|
|
49755
|
+
children
|
|
49756
|
+
);
|
|
49757
|
+
return {
|
|
49758
|
+
...rowFields,
|
|
49759
|
+
...literalContent(entry, value, constructorArgs)
|
|
49760
|
+
};
|
|
49761
|
+
}
|
|
49762
|
+
function packedEntryLogicalId(entry, label, constructionRootId) {
|
|
49763
|
+
const canonical = canonicalPackedChildId({
|
|
49764
|
+
constructionRootId,
|
|
49765
|
+
sourceValueId: entry.sourceValueId
|
|
49766
|
+
});
|
|
49767
|
+
const stored = entry.id;
|
|
49768
|
+
if (stored === void 0) {
|
|
49769
|
+
if (canonical === null) {
|
|
49770
|
+
throw new PackedValueEncodingError(
|
|
49771
|
+
`${label} stores no "id" and its position derives none: only a deterministic child of an enclosing construction root, stamped with a "sourceValueId", may omit its logical id.`
|
|
49772
|
+
);
|
|
49773
|
+
}
|
|
49774
|
+
return canonical;
|
|
49775
|
+
}
|
|
49776
|
+
if (typeof stored !== "string" || stored.length === 0) {
|
|
49777
|
+
throw new PackedValueEncodingError(
|
|
49778
|
+
`${label} stores an "id" that is not a non-empty string.`
|
|
49779
|
+
);
|
|
49780
|
+
}
|
|
49781
|
+
if (stored === canonical) {
|
|
49782
|
+
throw new PackedValueEncodingError(
|
|
49783
|
+
`${label} stores id "${stored}", which its position already derives; a derivable id must be omitted rather than repeated.`
|
|
49784
|
+
);
|
|
49785
|
+
}
|
|
49786
|
+
return stored;
|
|
49787
|
+
}
|
|
49788
|
+
function assertDecodableEntry(entry, label) {
|
|
49789
|
+
if (typeof entry !== "object" || entry === null || Array.isArray(entry)) {
|
|
49790
|
+
throw new PackedValueEncodingError(`${label} is not an object.`);
|
|
49791
|
+
}
|
|
49792
|
+
for (const field of PACKED_ENTRY_FORBIDDEN_FIELDS) {
|
|
49793
|
+
if (!Object.hasOwn(entry, field)) continue;
|
|
49794
|
+
throw new PackedValueEncodingError(
|
|
49795
|
+
`${label} stores "${field}", which decoding derives from its owning row.`
|
|
49796
|
+
);
|
|
49797
|
+
}
|
|
49798
|
+
if (!("createdAt" in entry) || typeof entry.createdAt !== "number") {
|
|
49799
|
+
throw new PackedValueEncodingError(
|
|
49800
|
+
`${label} stores no numeric "createdAt".`
|
|
49801
|
+
);
|
|
49802
|
+
}
|
|
49803
|
+
if (!("updatedAt" in entry) || typeof entry.updatedAt !== "number") {
|
|
49804
|
+
throw new PackedValueEncodingError(
|
|
49805
|
+
`${label} stores no numeric "updatedAt".`
|
|
49806
|
+
);
|
|
49807
|
+
}
|
|
49808
|
+
const hasValue = Object.hasOwn(entry, "value");
|
|
49809
|
+
const hasInit = Object.hasOwn(entry, "init");
|
|
49810
|
+
if (hasValue && hasInit) {
|
|
49811
|
+
throw new PackedValueEncodingError(
|
|
49812
|
+
`${label} stores both "value" and "init"; a value container holds exactly one.`
|
|
49813
|
+
);
|
|
49814
|
+
}
|
|
49815
|
+
if (!hasValue && !hasInit) {
|
|
49816
|
+
throw new PackedValueEncodingError(
|
|
49817
|
+
`${label} stores neither "value" nor "init"; a value container holds exactly one.`
|
|
49818
|
+
);
|
|
49819
|
+
}
|
|
49820
|
+
if (hasInit && !isInitValueContent(entry)) {
|
|
49821
|
+
throw new PackedValueEncodingError(
|
|
49822
|
+
`${label} stores an "init" that is not a valid initializer body.`
|
|
49823
|
+
);
|
|
49824
|
+
}
|
|
49825
|
+
if (hasValue && !isLiteralValueContent(entry)) {
|
|
49826
|
+
throw new PackedValueEncodingError(
|
|
49827
|
+
`${label} stores a "value" whose class or construction stamp is malformed.`
|
|
49828
|
+
);
|
|
49829
|
+
}
|
|
49830
|
+
}
|
|
49831
|
+
function pendingPackedChildIds(scope) {
|
|
49832
|
+
const childIds = scope.packedChildIdsByParentId.get(scope.ownerId);
|
|
49833
|
+
if (childIds === void 0 || childIds.length === 0) return null;
|
|
49834
|
+
return new Set(childIds);
|
|
49835
|
+
}
|
|
49836
|
+
function assertEveryChildPlaced(pending, scope) {
|
|
49837
|
+
if (pending.size === 0) return;
|
|
49838
|
+
const [missing] = [...pending];
|
|
49839
|
+
throw new PackedValueEncodingError(
|
|
49840
|
+
`Cannot pack child "${missing}" into ${scope.ownerLabel}: no stored position of that row holds its id.`
|
|
49841
|
+
);
|
|
49842
|
+
}
|
|
49843
|
+
function encodeContentField(container, pending, scope) {
|
|
49844
|
+
if (Array.isArray(container)) {
|
|
49845
|
+
let changed2 = false;
|
|
49846
|
+
const encoded2 = container.map((entry, index) => {
|
|
49847
|
+
if (typeof entry !== "string" || !pending.has(entry)) return entry;
|
|
49848
|
+
changed2 = true;
|
|
49849
|
+
return encodeEnvelope(entry, `[${index}]`, pending, scope);
|
|
49850
|
+
});
|
|
49851
|
+
return changed2 ? { content: encoded2 } : null;
|
|
49852
|
+
}
|
|
49853
|
+
if (typeof container !== "object" || container === null) return null;
|
|
49854
|
+
let changed = false;
|
|
49855
|
+
const encoded = {};
|
|
49856
|
+
for (const [key, entry] of Object.entries(
|
|
49857
|
+
container
|
|
49858
|
+
)) {
|
|
49859
|
+
if (typeof entry !== "string" || !pending.has(entry)) {
|
|
49860
|
+
encoded[key] = entry;
|
|
49861
|
+
continue;
|
|
49862
|
+
}
|
|
49863
|
+
changed = true;
|
|
49864
|
+
encoded[key] = encodeEnvelope(
|
|
49865
|
+
entry,
|
|
49866
|
+
`[${JSON.stringify(key)}]`,
|
|
49867
|
+
pending,
|
|
49868
|
+
scope
|
|
49869
|
+
);
|
|
49870
|
+
}
|
|
49871
|
+
return changed ? { content: encoded } : null;
|
|
49872
|
+
}
|
|
49873
|
+
function encodeEnvelope(childId, position, pending, scope) {
|
|
49874
|
+
pending.delete(childId);
|
|
49875
|
+
const child = scope.rowsById.get(childId);
|
|
49876
|
+
if (child === void 0) {
|
|
49877
|
+
throw new PackedValueEncodingError(
|
|
49878
|
+
`Cannot pack child "${childId}" into ${scope.ownerLabel}: its logical row was not supplied.`
|
|
49879
|
+
);
|
|
49880
|
+
}
|
|
49881
|
+
if (child.projectId !== scope.parent.projectId) {
|
|
49882
|
+
throw new PackedValueEncodingError(
|
|
49883
|
+
`Cannot pack child "${childId}" into ${scope.ownerLabel}: it belongs to project "${child.projectId}" rather than "${scope.parent.projectId}".`
|
|
49884
|
+
);
|
|
49885
|
+
}
|
|
49886
|
+
if (child.containerId !== void 0) {
|
|
49887
|
+
throw new PackedValueEncodingError(
|
|
49888
|
+
`Cannot pack child "${childId}" into ${scope.ownerLabel}: it is an entry of unordered list "${child.containerId}", whose membership is the set of live rows and cannot survive without one.`
|
|
49889
|
+
);
|
|
49890
|
+
}
|
|
49891
|
+
if (child.mapKey !== scope.parent.mapKey) {
|
|
49892
|
+
throw new PackedValueEncodingError(
|
|
49893
|
+
`Cannot pack child "${childId}" into ${scope.ownerLabel}: it is stamped for storage partition "${child.mapKey ?? "main"}" rather than its parent's "${scope.parent.mapKey ?? "main"}".`
|
|
49894
|
+
);
|
|
49895
|
+
}
|
|
49896
|
+
const childScope = {
|
|
49897
|
+
...scope,
|
|
49898
|
+
ownerId: childId,
|
|
49899
|
+
ownerLabel: `packed value "${childId}"`,
|
|
49900
|
+
constructionRootId: isCollapseStampedInstanceRoot(child) ? childId : scope.constructionRootId
|
|
49901
|
+
};
|
|
49902
|
+
const childPending = pendingPackedChildIds(childScope);
|
|
49903
|
+
const canonical = canonicalPackedChildId({
|
|
49904
|
+
constructionRootId: scope.constructionRootId,
|
|
49905
|
+
sourceValueId: child.sourceValueId
|
|
49906
|
+
});
|
|
49907
|
+
const storedId = canonical === childId ? void 0 : childId;
|
|
49908
|
+
if (childPending === null)
|
|
49909
|
+
return {
|
|
49910
|
+
[PACKED_VALUE_ENTRY_KEY]: packedEntry(child, null, null, storedId)
|
|
49911
|
+
};
|
|
49912
|
+
const value = encodeContentField(child.value, childPending, childScope);
|
|
49913
|
+
const constructorArgs = encodeContentField(
|
|
49914
|
+
isLiteralValueContent(child) ? child.constructorArgs : void 0,
|
|
49915
|
+
childPending,
|
|
49916
|
+
childScope
|
|
49917
|
+
);
|
|
49918
|
+
assertEveryChildPlaced(childPending, childScope);
|
|
49919
|
+
return {
|
|
49920
|
+
[PACKED_VALUE_ENTRY_KEY]: packedEntry(
|
|
49921
|
+
child,
|
|
49922
|
+
value,
|
|
49923
|
+
constructorArgs,
|
|
49924
|
+
storedId
|
|
49925
|
+
)
|
|
49926
|
+
};
|
|
49927
|
+
}
|
|
49928
|
+
function packedEntry(child, value, constructorArgs, storedId) {
|
|
49929
|
+
const identity2 = storedId === void 0 ? {} : { id: storedId };
|
|
49930
|
+
const trailer = {
|
|
49931
|
+
...child.genericBindings === void 0 ? {} : { genericBindings: child.genericBindings },
|
|
49932
|
+
...child.sourceValueId === void 0 ? {} : { sourceValueId: child.sourceValueId },
|
|
49933
|
+
createdAt: child.createdAt,
|
|
49934
|
+
updatedAt: child.updatedAt
|
|
49935
|
+
};
|
|
49936
|
+
if (isInitValueContent(child)) {
|
|
49937
|
+
return { ...identity2, init: child.init, ...trailer };
|
|
49938
|
+
}
|
|
49939
|
+
return {
|
|
49940
|
+
...identity2,
|
|
49941
|
+
...literalContent(child, value, constructorArgs),
|
|
49942
|
+
...trailer
|
|
49943
|
+
};
|
|
49944
|
+
}
|
|
49945
|
+
function literalContent(content, value, constructorArgs) {
|
|
49946
|
+
if (!isLiteralValueContent(content)) {
|
|
49947
|
+
throw new PackedValueEncodingError(
|
|
49948
|
+
`Value container has no literal "value" to encode.`
|
|
49949
|
+
);
|
|
49950
|
+
}
|
|
49951
|
+
const provenance = pickInstanceProvenance(content);
|
|
49952
|
+
return {
|
|
49953
|
+
value: value === null ? content.value : value.content,
|
|
49954
|
+
...Object.hasOwn(content, "classId") ? { classId: content.classId } : {},
|
|
49955
|
+
...provenance,
|
|
49956
|
+
...constructorArgs === null ? {} : { constructorArgs: asConstructorArgs(constructorArgs.content) }
|
|
49957
|
+
};
|
|
49958
|
+
}
|
|
49959
|
+
function withDecodedContent(row, value, constructorArgs) {
|
|
49960
|
+
if (value === null && constructorArgs === null) return row;
|
|
49961
|
+
return { ...row, ...literalContent(row, value, constructorArgs) };
|
|
49962
|
+
}
|
|
49963
|
+
function asConstructorArgs(content) {
|
|
49964
|
+
if (content === null) return null;
|
|
49965
|
+
if (typeof content !== "object" || Array.isArray(content)) {
|
|
49966
|
+
throw new PackedValueEncodingError(
|
|
49967
|
+
`Value container stores "constructorArgs" that is not a record.`
|
|
49968
|
+
);
|
|
49969
|
+
}
|
|
49970
|
+
return content;
|
|
49971
|
+
}
|
|
49972
|
+
function containerHoldsPackedEntry(container) {
|
|
49973
|
+
if (Array.isArray(container)) {
|
|
49974
|
+
return container.some((entry) => isPackedValueEnvelope(entry));
|
|
49975
|
+
}
|
|
49976
|
+
if (typeof container !== "object" || container === null) return false;
|
|
49977
|
+
for (const entry of Object.values(container)) {
|
|
49978
|
+
if (isPackedValueEnvelope(entry)) return true;
|
|
49979
|
+
}
|
|
49980
|
+
return false;
|
|
49981
|
+
}
|
|
49982
|
+
function registerEdge(edges, ownerId, childId) {
|
|
49983
|
+
const existing = edges.get(ownerId);
|
|
49984
|
+
if (existing === void 0) edges.set(ownerId, [childId]);
|
|
49985
|
+
else existing.push(childId);
|
|
49986
|
+
}
|
|
49987
|
+
var PACKED_VALUE_ENTRY_KEY, PackedValueEncodingError, NO_CHILDREN, NO_EDGES, PACKED_ENTRY_FORBIDDEN_FIELDS;
|
|
49988
|
+
var init_packed_value_encoding = __esm({
|
|
49989
|
+
"../src/models/members/packed-value-encoding.ts"() {
|
|
49990
|
+
"use strict";
|
|
49991
|
+
init_instance_provenance();
|
|
49992
|
+
init_member_kinds();
|
|
49993
|
+
init_member_value_id();
|
|
49994
|
+
PACKED_VALUE_ENTRY_KEY = "~packed";
|
|
49995
|
+
PackedValueEncodingError = class extends Error {
|
|
49996
|
+
constructor(message) {
|
|
49997
|
+
super(message);
|
|
49998
|
+
this.name = "PackedValueEncodingError";
|
|
49999
|
+
}
|
|
50000
|
+
};
|
|
50001
|
+
NO_CHILDREN = [];
|
|
50002
|
+
NO_EDGES = /* @__PURE__ */ new Map();
|
|
50003
|
+
PACKED_ENTRY_FORBIDDEN_FIELDS = [
|
|
50004
|
+
"projectId",
|
|
50005
|
+
"containerId",
|
|
50006
|
+
"mapKey"
|
|
50007
|
+
];
|
|
50008
|
+
}
|
|
50009
|
+
});
|
|
50010
|
+
|
|
49362
50011
|
// ../src/models/members/member-kinds-db-response.ts
|
|
49363
50012
|
var init_member_kinds_db_response = __esm({
|
|
49364
50013
|
"../src/models/members/member-kinds-db-response.ts"() {
|
|
@@ -51808,6 +52457,45 @@ var init_enum_reference_sites = __esm({
|
|
|
51808
52457
|
}
|
|
51809
52458
|
});
|
|
51810
52459
|
|
|
52460
|
+
// ../src/models/members/effective-distribution.ts
|
|
52461
|
+
function declaredMemberDistribution(memberId, members) {
|
|
52462
|
+
return walkExtendsMemberChain(memberId, members, (a) => {
|
|
52463
|
+
const distribution = a.distribution;
|
|
52464
|
+
return isNeoSubtreeDistributionKind(distribution) ? distribution : void 0;
|
|
52465
|
+
});
|
|
52466
|
+
}
|
|
52467
|
+
function concreteMember(member, members, env) {
|
|
52468
|
+
const resolved = resolveMember2(member, members);
|
|
52469
|
+
if (env === void 0) return resolved;
|
|
52470
|
+
return substituteMember(member, env, members, resolved);
|
|
52471
|
+
}
|
|
52472
|
+
function distributionSettings(concrete) {
|
|
52473
|
+
return {
|
|
52474
|
+
format: isLocalizedStringMember(concrete) ? 0 /* Localized */ : 1 /* Plain */,
|
|
52475
|
+
selection: isMultiSelectionMember(concrete) ? 1 /* Multi */ : 0 /* Single */
|
|
52476
|
+
};
|
|
52477
|
+
}
|
|
52478
|
+
function effectiveMemberDistribution(member, members, env) {
|
|
52479
|
+
const concrete = concreteMember(member, members, env);
|
|
52480
|
+
if (isNeoSubtreeDistributionKind(concrete.distribution)) {
|
|
52481
|
+
return concrete.distribution;
|
|
52482
|
+
}
|
|
52483
|
+
if (concrete.kind === 21 /* Generic */) return void 0;
|
|
52484
|
+
return automaticMemberDistribution(
|
|
52485
|
+
concrete.kind,
|
|
52486
|
+
distributionSettings(concrete)
|
|
52487
|
+
);
|
|
52488
|
+
}
|
|
52489
|
+
var init_effective_distribution = __esm({
|
|
52490
|
+
"../src/models/members/effective-distribution.ts"() {
|
|
52491
|
+
"use strict";
|
|
52492
|
+
init_member_kinds();
|
|
52493
|
+
init_member_subtree_distribution();
|
|
52494
|
+
init_inheritance();
|
|
52495
|
+
init_generics();
|
|
52496
|
+
}
|
|
52497
|
+
});
|
|
52498
|
+
|
|
51811
52499
|
// ../src/models/members/list-indexes.ts
|
|
51812
52500
|
function validateListIndexDefinitions(ctx, listMember) {
|
|
51813
52501
|
const errors = [];
|
|
@@ -51945,11 +52633,30 @@ function resolveListIndexDefinitions(ctx, listMember) {
|
|
|
51945
52633
|
};
|
|
51946
52634
|
});
|
|
51947
52635
|
}
|
|
52636
|
+
function validateListDistribution(ctx, member) {
|
|
52637
|
+
if (declaredMemberDistribution(member.id, ctx.members) !== 1 /* Packed */) {
|
|
52638
|
+
return [];
|
|
52639
|
+
}
|
|
52640
|
+
try {
|
|
52641
|
+
const resolved = resolveMember2(member, ctx.members);
|
|
52642
|
+
if (!isMemberListBase(resolved)) return [];
|
|
52643
|
+
if (listKindOf(resolved) !== 1 /* Unordered */) return [];
|
|
52644
|
+
} catch {
|
|
52645
|
+
return [];
|
|
52646
|
+
}
|
|
52647
|
+
return [
|
|
52648
|
+
{
|
|
52649
|
+
memberId: member.id,
|
|
52650
|
+
message: `List "${member.name}" (${member.id}) cannot select a packed distribution while its listKind is unordered: an unordered list's membership is the set of live rows carrying its id, so its entries occupy no position inside a parent row to be packed into.`
|
|
52651
|
+
}
|
|
52652
|
+
];
|
|
52653
|
+
}
|
|
51948
52654
|
function validateDocumentListIndexes(ctx) {
|
|
51949
52655
|
const errors = [];
|
|
51950
52656
|
for (const member of ctx.members) {
|
|
51951
52657
|
if (member.kind !== 6 /* List */) continue;
|
|
51952
52658
|
errors.push(...validateListIndexDefinitions(ctx, member));
|
|
52659
|
+
errors.push(...validateListDistribution(ctx, member));
|
|
51953
52660
|
if (!isMemberOverrideMarker(member)) continue;
|
|
51954
52661
|
if (getField(member, "indexes") !== void 0) {
|
|
51955
52662
|
errors.push({
|
|
@@ -52073,6 +52780,8 @@ var init_list_indexes = __esm({
|
|
|
52073
52780
|
"../src/models/members/list-indexes.ts"() {
|
|
52074
52781
|
"use strict";
|
|
52075
52782
|
init_member_kinds();
|
|
52783
|
+
init_effective_distribution();
|
|
52784
|
+
init_member_subtree_distribution();
|
|
52076
52785
|
init_core();
|
|
52077
52786
|
init_generics();
|
|
52078
52787
|
init_inheritance();
|
|
@@ -52469,7 +53178,7 @@ function isStringArray(value) {
|
|
|
52469
53178
|
if (!Array.isArray(value)) return false;
|
|
52470
53179
|
return value.every(isString);
|
|
52471
53180
|
}
|
|
52472
|
-
var ProjectVersionBumpKind, ProjectRecordKind, ProjectVersionTransactionOperation;
|
|
53181
|
+
var ProjectVersionBumpKind, ProjectRecordKind, ProjectVersionTransactionOperation, ProjectVersionRecordOperation;
|
|
52473
53182
|
var init_project_version_types = __esm({
|
|
52474
53183
|
"../src/models/project/project-version-types.ts"() {
|
|
52475
53184
|
"use strict";
|
|
@@ -52517,6 +53226,11 @@ var init_project_version_types = __esm({
|
|
|
52517
53226
|
CompactBaseline: "compact-baseline",
|
|
52518
53227
|
Migration: "migration"
|
|
52519
53228
|
};
|
|
53229
|
+
ProjectVersionRecordOperation = {
|
|
53230
|
+
Create: "create",
|
|
53231
|
+
Update: "update",
|
|
53232
|
+
Delete: "delete"
|
|
53233
|
+
};
|
|
52520
53234
|
}
|
|
52521
53235
|
});
|
|
52522
53236
|
|
|
@@ -52562,63 +53276,16 @@ var init_delete_member_response = __esm({
|
|
|
52562
53276
|
}
|
|
52563
53277
|
});
|
|
52564
53278
|
|
|
52565
|
-
// ../src/models/members/member-value-id.ts
|
|
52566
|
-
function derivedMemberValueId(memberId) {
|
|
52567
|
-
return inSystemRecordNamespaceOf(
|
|
52568
|
-
memberId,
|
|
52569
|
-
v5_default(withoutSystemRecordIdPrefix(memberId), NEO_MEMBER_VALUE_NAMESPACE)
|
|
52570
|
-
);
|
|
52571
|
-
}
|
|
52572
|
-
function virtualValueId(instanceRootId, sourceIdentity3) {
|
|
52573
|
-
return inSystemRecordNamespaceOf(
|
|
52574
|
-
instanceRootId,
|
|
52575
|
-
v5_default(
|
|
52576
|
-
`${withoutSystemRecordIdPrefix(instanceRootId)}:${sourceIdentity3}`,
|
|
52577
|
-
NEO_VIRTUAL_VALUE_NAMESPACE
|
|
52578
|
-
)
|
|
52579
|
-
);
|
|
52580
|
-
}
|
|
52581
|
-
function pendingVirtualValueId(pendingInstanceRootId, sourceIdentity3) {
|
|
52582
|
-
return `${PENDING_VIRTUAL_VALUE_PREFIX}${encodeURIComponent(pendingInstanceRootId)}:${encodeURIComponent(sourceIdentity3)}`;
|
|
52583
|
-
}
|
|
52584
|
-
function pendingVirtualValueIdentity(token) {
|
|
52585
|
-
if (!token.startsWith(PENDING_VIRTUAL_VALUE_PREFIX)) return null;
|
|
52586
|
-
const payload = token.slice(PENDING_VIRTUAL_VALUE_PREFIX.length);
|
|
52587
|
-
const separator = payload.indexOf(":");
|
|
52588
|
-
if (separator < 0) return null;
|
|
52589
|
-
return {
|
|
52590
|
-
instanceRootId: decodeURIComponent(payload.slice(0, separator)),
|
|
52591
|
-
sourceIdentity: decodeURIComponent(payload.slice(separator + 1))
|
|
52592
|
-
};
|
|
52593
|
-
}
|
|
52594
|
-
function pendingMemberValueId(pendingMemberId) {
|
|
52595
|
-
return `${PENDING_MEMBER_VALUE_PREFIX}${encodeURIComponent(pendingMemberId)}`;
|
|
52596
|
-
}
|
|
52597
|
-
function pendingMemberValueMemberId(token) {
|
|
52598
|
-
if (!token.startsWith(PENDING_MEMBER_VALUE_PREFIX)) return null;
|
|
52599
|
-
return decodeURIComponent(token.slice(PENDING_MEMBER_VALUE_PREFIX.length));
|
|
52600
|
-
}
|
|
52601
|
-
var NEO_MEMBER_VALUE_NAMESPACE, NEO_VIRTUAL_VALUE_NAMESPACE, PENDING_VIRTUAL_VALUE_PREFIX, PENDING_MEMBER_VALUE_PREFIX;
|
|
52602
|
-
var init_member_value_id = __esm({
|
|
52603
|
-
"../src/models/members/member-value-id.ts"() {
|
|
52604
|
-
"use strict";
|
|
52605
|
-
init_dist_node();
|
|
52606
|
-
init_system_record_id();
|
|
52607
|
-
NEO_MEMBER_VALUE_NAMESPACE = "7f2b9c14-58d6-5a07-b3e1-4c9d0a6f8b25";
|
|
52608
|
-
NEO_VIRTUAL_VALUE_NAMESPACE = "3e8ca0b3-e3f1-5d5f-bf2f-6ab5ee3896d0";
|
|
52609
|
-
PENDING_VIRTUAL_VALUE_PREFIX = "__pending__:virtual-value:";
|
|
52610
|
-
PENDING_MEMBER_VALUE_PREFIX = "__pending__:member-value:";
|
|
52611
|
-
}
|
|
52612
|
-
});
|
|
52613
|
-
|
|
52614
53279
|
// ../src/models/members/index.ts
|
|
52615
53280
|
var init_members = __esm({
|
|
52616
53281
|
"../src/models/members/index.ts"() {
|
|
52617
53282
|
"use strict";
|
|
52618
53283
|
init_member_storage();
|
|
53284
|
+
init_member_subtree_distribution();
|
|
52619
53285
|
init_read_only_members();
|
|
52620
53286
|
init_member_kinds();
|
|
52621
53287
|
init_structured_leaf_fields();
|
|
53288
|
+
init_packed_value_encoding();
|
|
52622
53289
|
init_member_kinds_db_response();
|
|
52623
53290
|
init_unordered_list_membership();
|
|
52624
53291
|
init_storage_partitions();
|
|
@@ -52626,6 +53293,7 @@ var init_members = __esm({
|
|
|
52626
53293
|
init_enum_reference_sites();
|
|
52627
53294
|
init_list_indexes();
|
|
52628
53295
|
init_effective_storage();
|
|
53296
|
+
init_effective_distribution();
|
|
52629
53297
|
init_effective_member_docs();
|
|
52630
53298
|
init_value_responses();
|
|
52631
53299
|
init_edit_member_props();
|
|
@@ -53422,6 +54090,10 @@ function emitMember(context, member, enclosingClassId) {
|
|
|
53422
54090
|
...member.storageKey ? [`key: ${quote(member.storageKey)}`] : []
|
|
53423
54091
|
].join(", ")})`
|
|
53424
54092
|
] : [],
|
|
54093
|
+
// Only an explicitly stored field is emitted. The automatic result of
|
|
54094
|
+
// P76 §1 is never materialized into source, so a member that omits the
|
|
54095
|
+
// annotation round-trips as an omission.
|
|
54096
|
+
...member.distribution ? [`@distribution(kind: .${enumCase(member.distribution)})`] : [],
|
|
53425
54097
|
...memberSettings(context, member),
|
|
53426
54098
|
...listAnnotations(member),
|
|
53427
54099
|
...member.system ? [systemAnnotation2(member.system)] : []
|
|
@@ -58633,6 +59305,7 @@ var init_dialogue_sources = __esm({
|
|
|
58633
59305
|
"use strict";
|
|
58634
59306
|
init_src();
|
|
58635
59307
|
init_dialogue();
|
|
59308
|
+
init_members();
|
|
58636
59309
|
init_projection();
|
|
58637
59310
|
init_member_records();
|
|
58638
59311
|
init_neoscript_source_rewrite();
|
|
@@ -58668,6 +59341,16 @@ var init_dialogue_sources = __esm({
|
|
|
58668
59341
|
else if (record3.recordKind === "localized-text")
|
|
58669
59342
|
this.localizedTexts.set(record3.recordId, recordData2(record3));
|
|
58670
59343
|
}
|
|
59344
|
+
const physicalValues = [
|
|
59345
|
+
...this.values.values()
|
|
59346
|
+
];
|
|
59347
|
+
const logicalValues = expandPackedValueRows(physicalValues);
|
|
59348
|
+
if (logicalValues !== physicalValues) {
|
|
59349
|
+
for (const row of logicalValues) {
|
|
59350
|
+
const id2 = optionalString2(row.id);
|
|
59351
|
+
if (id2) this.values.set(id2, row);
|
|
59352
|
+
}
|
|
59353
|
+
}
|
|
58671
59354
|
const localization = records2.find(
|
|
58672
59355
|
(record3) => record3.recordKind === "localization-config"
|
|
58673
59356
|
);
|
|
@@ -60416,6 +61099,7 @@ function projectSchemaJsonValue(value) {
|
|
|
60416
61099
|
}
|
|
60417
61100
|
function memberCommon(context, ownerClass, declaration, id2, owner, base) {
|
|
60418
61101
|
const storage = annotation(declaration.annotations, "storage");
|
|
61102
|
+
const distribution = annotation(declaration.annotations, "distribution");
|
|
60419
61103
|
const inheritedId = declaration.modifiers.includes("override") || declaration.modifiers.includes("sealed") ? inheritedMemberId(context, ownerClass, declaration.name) : null;
|
|
60420
61104
|
return {
|
|
60421
61105
|
id: id2,
|
|
@@ -60440,9 +61124,30 @@ function memberCommon(context, ownerClass, declaration, id2, owner, base) {
|
|
|
60440
61124
|
overrideOf: inheritedId,
|
|
60441
61125
|
system: systemMetadata(declaration.annotations),
|
|
60442
61126
|
storage: storage ? storageValue(storage, "allowed") : declaration.modifiers.includes("readonly") ? base !== void 0 ? base.storage : inheritedId !== null && resolvedMemberStorage(context, inheritedId) === "immutable" ? "immutable" : null : null,
|
|
61127
|
+
distribution: distribution ? distributionValue(distribution, ownerClass, declaration) : null,
|
|
60443
61128
|
storageKey: storage ? stringArgument(storage, "key") : null
|
|
60444
61129
|
};
|
|
60445
61130
|
}
|
|
61131
|
+
function distributionValue(value, ownerClass, declaration) {
|
|
61132
|
+
const site = `${ownerClass.name}.${declaration.name}`;
|
|
61133
|
+
if (declaration.kind !== "field") {
|
|
61134
|
+
throw new Error(
|
|
61135
|
+
`@distribution on ${site} is not allowed: a ${declaration.kind} owns no stored value to distribute.`
|
|
61136
|
+
);
|
|
61137
|
+
}
|
|
61138
|
+
const kind = contextualEnumArgument(value, "kind");
|
|
61139
|
+
if (kind === null) {
|
|
61140
|
+
throw new Error(
|
|
61141
|
+
`@distribution on ${site} requires a kind argument, such as @distribution(kind: .Packed).`
|
|
61142
|
+
);
|
|
61143
|
+
}
|
|
61144
|
+
const normalized = kind.toLowerCase();
|
|
61145
|
+
if (normalized === "sparse") return "sparse";
|
|
61146
|
+
if (normalized === "packed") return "packed";
|
|
61147
|
+
throw new Error(
|
|
61148
|
+
`@distribution on ${site} has unknown kind ".${kind}". Valid kinds are .Sparse and .Packed.`
|
|
61149
|
+
);
|
|
61150
|
+
}
|
|
60446
61151
|
function resolvedMemberStorage(context, memberId, visited = /* @__PURE__ */ new Set()) {
|
|
60447
61152
|
if (visited.has(memberId)) return null;
|
|
60448
61153
|
visited.add(memberId);
|
|
@@ -63179,9 +63884,39 @@ var init_constructor_parameter_settlement = __esm({
|
|
|
63179
63884
|
});
|
|
63180
63885
|
|
|
63181
63886
|
// src/project-source/stored-value-placements.ts
|
|
63887
|
+
function storedValueRowsByIdV4(records2) {
|
|
63888
|
+
const stored = /* @__PURE__ */ new Map();
|
|
63889
|
+
let packed = false;
|
|
63890
|
+
for (const record3 of records2) {
|
|
63891
|
+
if (record3.deleted === true) continue;
|
|
63892
|
+
if (record3.recordKind !== "value") continue;
|
|
63893
|
+
if (!isObjectRecord2(record3.data)) continue;
|
|
63894
|
+
stored.set(record3.recordId, record3.data);
|
|
63895
|
+
packed ||= rowCarriesPackedValueContent(record3.data);
|
|
63896
|
+
}
|
|
63897
|
+
if (!packed) return stored;
|
|
63898
|
+
const logical = /* @__PURE__ */ new Map();
|
|
63899
|
+
for (const [valueId, row] of stored) {
|
|
63900
|
+
if (!rowCarriesPackedValueContent(row)) {
|
|
63901
|
+
logical.set(valueId, row);
|
|
63902
|
+
continue;
|
|
63903
|
+
}
|
|
63904
|
+
if (!isMemberValue(row)) {
|
|
63905
|
+
throw new PackedValueEncodingError(
|
|
63906
|
+
`Stored value row "${valueId}" packs a child but is not a well-formed value row, so its packed payload cannot be expanded.`
|
|
63907
|
+
);
|
|
63908
|
+
}
|
|
63909
|
+
const decoded = decodePackedValueRow(row);
|
|
63910
|
+
logical.set(valueId, { ...decoded.row });
|
|
63911
|
+
for (const child of decoded.children) {
|
|
63912
|
+
logical.set(child.id, { ...child });
|
|
63913
|
+
}
|
|
63914
|
+
}
|
|
63915
|
+
return logical;
|
|
63916
|
+
}
|
|
63182
63917
|
function buildStoredValuePlacementIndexV4(records2) {
|
|
63183
63918
|
const live = [...records2].filter((record3) => record3.deleted !== true);
|
|
63184
|
-
const values =
|
|
63919
|
+
const values = storedValueRowsByIdV4(live);
|
|
63185
63920
|
const classes = [];
|
|
63186
63921
|
const members = [];
|
|
63187
63922
|
const memberDataById = /* @__PURE__ */ new Map();
|
|
@@ -63189,9 +63924,8 @@ function buildStoredValuePlacementIndexV4(records2) {
|
|
|
63189
63924
|
const variantTargetClassByRootValueId = /* @__PURE__ */ new Map();
|
|
63190
63925
|
for (const record3 of live) {
|
|
63191
63926
|
if (!isObjectRecord2(record3.data)) continue;
|
|
63192
|
-
if (record3.recordKind === "value")
|
|
63193
|
-
|
|
63194
|
-
} else if (record3.recordKind === "class") {
|
|
63927
|
+
if (record3.recordKind === "value") continue;
|
|
63928
|
+
if (record3.recordKind === "class") {
|
|
63195
63929
|
classes.push({
|
|
63196
63930
|
id: record3.recordId,
|
|
63197
63931
|
...isStringRecord3(record3.data.schema) ? { schema: record3.data.schema } : {},
|
|
@@ -63399,11 +64133,7 @@ function rootValuePathsByValueId(records2, storedPlacements) {
|
|
|
63399
64133
|
function rootValueTargetsByPath(records2, storedPlacements) {
|
|
63400
64134
|
const allRecords = [...records2];
|
|
63401
64135
|
const paths = rootValuePathsByValueId(allRecords, storedPlacements);
|
|
63402
|
-
const values =
|
|
63403
|
-
allRecords.flatMap(
|
|
63404
|
-
(record3) => !record3.deleted && record3.recordKind === "value" && isObjectRecord3(record3.data) ? [[record3.recordId, record3.data]] : []
|
|
63405
|
-
)
|
|
63406
|
-
);
|
|
64136
|
+
const values = storedValueRowsByIdV4(allRecords);
|
|
63407
64137
|
const targets = /* @__PURE__ */ new Map();
|
|
63408
64138
|
for (const [valueId, path] of paths) {
|
|
63409
64139
|
const classId = values.get(valueId)?.classId;
|
|
@@ -66387,6 +67117,186 @@ function resolveOwnerMembersForValues(document, targetValueIds, additionalRoots,
|
|
|
66387
67117
|
}
|
|
66388
67118
|
return resolved;
|
|
66389
67119
|
}
|
|
67120
|
+
function isStringListValue(value) {
|
|
67121
|
+
if (!Array.isArray(value)) return false;
|
|
67122
|
+
return value.every((entry) => typeof entry === "string");
|
|
67123
|
+
}
|
|
67124
|
+
function findOwningMembersForValues(document, valueIds, additionalRoots, traversalExtension) {
|
|
67125
|
+
const owners = /* @__PURE__ */ new Map();
|
|
67126
|
+
if (valueIds.size === 0) return owners;
|
|
67127
|
+
const membersById2 = new Map(
|
|
67128
|
+
document.members.map((member) => [member.id, member])
|
|
67129
|
+
);
|
|
67130
|
+
const valuesById = new Map(document.values.map((value) => [value.id, value]));
|
|
67131
|
+
const rowsByContainerId = /* @__PURE__ */ new Map();
|
|
67132
|
+
for (const value of document.values) {
|
|
67133
|
+
if (typeof value.containerId !== "string") continue;
|
|
67134
|
+
const rows = rowsByContainerId.get(value.containerId);
|
|
67135
|
+
if (rows === void 0) {
|
|
67136
|
+
rowsByContainerId.set(value.containerId, [value]);
|
|
67137
|
+
} else {
|
|
67138
|
+
rows.push(value);
|
|
67139
|
+
}
|
|
67140
|
+
}
|
|
67141
|
+
const queue = [];
|
|
67142
|
+
const enqueueClassInstanceChildren = (args) => {
|
|
67143
|
+
const merged = mergeStoredInstanceSchema(
|
|
67144
|
+
args.effectiveClassId,
|
|
67145
|
+
document.classes,
|
|
67146
|
+
document.members
|
|
67147
|
+
);
|
|
67148
|
+
const env = resolveInstanceEnv(
|
|
67149
|
+
args.effectiveClassId,
|
|
67150
|
+
args.member.classArguments,
|
|
67151
|
+
document.classes
|
|
67152
|
+
);
|
|
67153
|
+
for (const entry of merged) {
|
|
67154
|
+
const childValueId = args.record[entry.schemaKey];
|
|
67155
|
+
if (childValueId === void 0) continue;
|
|
67156
|
+
const childMember = membersById2.get(entry.memberId);
|
|
67157
|
+
if (childMember === void 0) continue;
|
|
67158
|
+
queue.push({
|
|
67159
|
+
member: substituteMember(childMember, env, document.members),
|
|
67160
|
+
memberRecordId: childMember.id,
|
|
67161
|
+
id: childValueId,
|
|
67162
|
+
parentValueId: args.parentValueId,
|
|
67163
|
+
// Descending through `Overrides` opens an override graph, and every
|
|
67164
|
+
// row below it stays inside one (D10).
|
|
67165
|
+
insideAnimationOverrideGraph: args.insideAnimationOverrideGraph || entersAnimationOverrideGraph(childMember.id)
|
|
67166
|
+
});
|
|
67167
|
+
}
|
|
67168
|
+
};
|
|
67169
|
+
for (const root of additionalRoots ?? []) {
|
|
67170
|
+
const memberRecordId = getField(root.member, "id");
|
|
67171
|
+
queue.push({
|
|
67172
|
+
member: root.member,
|
|
67173
|
+
memberRecordId: typeof memberRecordId === "string" ? memberRecordId : `semantic:${root.valueId}`,
|
|
67174
|
+
id: root.valueId,
|
|
67175
|
+
insideAnimationOverrideGraph: root.position.insideAnimationOverrideGraph,
|
|
67176
|
+
// A caller-supplied root is a root: it is reached from the caller's own
|
|
67177
|
+
// context, not from a parent row this walk visited.
|
|
67178
|
+
parentValueId: null
|
|
67179
|
+
});
|
|
67180
|
+
}
|
|
67181
|
+
for (const member of document.members) {
|
|
67182
|
+
if (member.valueId !== void 0) {
|
|
67183
|
+
queue.push({
|
|
67184
|
+
member,
|
|
67185
|
+
memberRecordId: member.id,
|
|
67186
|
+
id: member.valueId,
|
|
67187
|
+
// A member-rooted row has no ancestry to have descended through (D10).
|
|
67188
|
+
insideAnimationOverrideGraph: false,
|
|
67189
|
+
parentValueId: null
|
|
67190
|
+
});
|
|
67191
|
+
}
|
|
67192
|
+
const defaultValue = member.defaultValue;
|
|
67193
|
+
if (defaultValue == null) continue;
|
|
67194
|
+
if (!isMemberClassBase(member)) continue;
|
|
67195
|
+
if (!isRecordValue(defaultValue.value)) continue;
|
|
67196
|
+
enqueueClassInstanceChildren({
|
|
67197
|
+
member,
|
|
67198
|
+
record: defaultValue.value,
|
|
67199
|
+
effectiveClassId: defaultValue.classId ?? member.classId,
|
|
67200
|
+
// A declaration default is never itself an override graph (D10).
|
|
67201
|
+
insideAnimationOverrideGraph: false,
|
|
67202
|
+
// The default graph hangs off the MEMBER record, so its children have no
|
|
67203
|
+
// owning value row (P76: they stay physically sparse).
|
|
67204
|
+
parentValueId: null
|
|
67205
|
+
});
|
|
67206
|
+
}
|
|
67207
|
+
const visited = /* @__PURE__ */ new Set();
|
|
67208
|
+
for (let cursor = 0; cursor < queue.length; cursor += 1) {
|
|
67209
|
+
const current = queue[cursor];
|
|
67210
|
+
if (current === void 0) continue;
|
|
67211
|
+
const visitKey = `${current.memberRecordId}:${current.id}`;
|
|
67212
|
+
if (visited.has(visitKey)) continue;
|
|
67213
|
+
visited.add(visitKey);
|
|
67214
|
+
const placement = {
|
|
67215
|
+
member: current.member,
|
|
67216
|
+
position: {
|
|
67217
|
+
insideAnimationOverrideGraph: current.insideAnimationOverrideGraph
|
|
67218
|
+
},
|
|
67219
|
+
parentValueId: current.parentValueId
|
|
67220
|
+
};
|
|
67221
|
+
if (valueIds.has(current.id) && !owners.has(current.id)) {
|
|
67222
|
+
owners.set(current.id, placement);
|
|
67223
|
+
if (owners.size === valueIds.size) return owners;
|
|
67224
|
+
}
|
|
67225
|
+
for (const root of traversalExtension?.({
|
|
67226
|
+
valueId: current.id,
|
|
67227
|
+
placement
|
|
67228
|
+
}) ?? []) {
|
|
67229
|
+
const memberRecordId = getField(root.member, "id");
|
|
67230
|
+
queue.push({
|
|
67231
|
+
member: root.member,
|
|
67232
|
+
memberRecordId: typeof memberRecordId === "string" ? memberRecordId : `semantic:${root.valueId}`,
|
|
67233
|
+
id: root.valueId,
|
|
67234
|
+
insideAnimationOverrideGraph: root.position.insideAnimationOverrideGraph,
|
|
67235
|
+
// A semantic root discovered from this visit is a child of this row —
|
|
67236
|
+
// a settled constructor argument is owned by the row that constructed
|
|
67237
|
+
// it, exactly as a body field is.
|
|
67238
|
+
parentValueId: current.id
|
|
67239
|
+
});
|
|
67240
|
+
}
|
|
67241
|
+
const storedValue = valuesById.get(current.id);
|
|
67242
|
+
if (storedValue === void 0) continue;
|
|
67243
|
+
if (isMemberClassBase(current.member)) {
|
|
67244
|
+
if (!isRecordValue(storedValue.value)) continue;
|
|
67245
|
+
enqueueClassInstanceChildren({
|
|
67246
|
+
member: current.member,
|
|
67247
|
+
record: storedValue.value,
|
|
67248
|
+
effectiveClassId: storedValue.classId ?? current.member.classId,
|
|
67249
|
+
insideAnimationOverrideGraph: current.insideAnimationOverrideGraph,
|
|
67250
|
+
parentValueId: storedValue.id
|
|
67251
|
+
});
|
|
67252
|
+
continue;
|
|
67253
|
+
}
|
|
67254
|
+
if (isMemberDictionaryBase(current.member)) {
|
|
67255
|
+
if (!isRecordValue(storedValue.value)) continue;
|
|
67256
|
+
const entryMemberRecord = membersById2.get(current.member.entryMemberId);
|
|
67257
|
+
if (entryMemberRecord === void 0) continue;
|
|
67258
|
+
const entryMember = substituteMember(
|
|
67259
|
+
entryMemberRecord,
|
|
67260
|
+
envFromStamp(storedValue.genericBindings),
|
|
67261
|
+
document.members
|
|
67262
|
+
);
|
|
67263
|
+
for (const childValueId of Object.values(storedValue.value)) {
|
|
67264
|
+
queue.push({
|
|
67265
|
+
member: entryMember,
|
|
67266
|
+
memberRecordId: entryMemberRecord.id,
|
|
67267
|
+
id: childValueId,
|
|
67268
|
+
// An entry inherits its collection's position: a Dictionary is not
|
|
67269
|
+
// itself a way into an override graph.
|
|
67270
|
+
insideAnimationOverrideGraph: current.insideAnimationOverrideGraph,
|
|
67271
|
+
parentValueId: storedValue.id
|
|
67272
|
+
});
|
|
67273
|
+
}
|
|
67274
|
+
continue;
|
|
67275
|
+
}
|
|
67276
|
+
if (isMemberListBase(current.member)) {
|
|
67277
|
+
const entryMemberRecord = membersById2.get(current.member.entryMemberId);
|
|
67278
|
+
if (entryMemberRecord === void 0) continue;
|
|
67279
|
+
const entryMember = substituteMember(
|
|
67280
|
+
entryMemberRecord,
|
|
67281
|
+
envFromStamp(storedValue.genericBindings),
|
|
67282
|
+
document.members
|
|
67283
|
+
);
|
|
67284
|
+
const childValueIds = listKindOf(current.member) === 1 /* Unordered */ ? (rowsByContainerId.get(storedValue.id) ?? []).map((row) => row.id) : isStringListValue(storedValue.value) ? storedValue.value : [];
|
|
67285
|
+
for (const childValueId of childValueIds) {
|
|
67286
|
+
queue.push({
|
|
67287
|
+
member: entryMember,
|
|
67288
|
+
memberRecordId: entryMemberRecord.id,
|
|
67289
|
+
id: childValueId,
|
|
67290
|
+
// An entry inherits its collection's position: a List is not itself
|
|
67291
|
+
// a way into an override graph.
|
|
67292
|
+
insideAnimationOverrideGraph: current.insideAnimationOverrideGraph,
|
|
67293
|
+
parentValueId: storedValue.id
|
|
67294
|
+
});
|
|
67295
|
+
}
|
|
67296
|
+
}
|
|
67297
|
+
}
|
|
67298
|
+
return owners;
|
|
67299
|
+
}
|
|
66390
67300
|
var init_value_row_owner_members = __esm({
|
|
66391
67301
|
"../src/database/value-row-owner-members.ts"() {
|
|
66392
67302
|
"use strict";
|
|
@@ -66488,6 +67398,59 @@ function resolveSemanticOwnerMembersForValues(document, targetValueIds, addition
|
|
|
66488
67398
|
}
|
|
66489
67399
|
return result;
|
|
66490
67400
|
}
|
|
67401
|
+
function findSemanticOwnerPlacementsForValues(document, targetValueIds, additionalRoots) {
|
|
67402
|
+
const result = /* @__PURE__ */ new Map();
|
|
67403
|
+
if (targetValueIds.size === 0) return result;
|
|
67404
|
+
const directPlacements = findOwningMembersForValues(
|
|
67405
|
+
document,
|
|
67406
|
+
targetValueIds,
|
|
67407
|
+
additionalRoots
|
|
67408
|
+
);
|
|
67409
|
+
if (directPlacements.size === targetValueIds.size) return directPlacements;
|
|
67410
|
+
const graph = new MaterializedValueGraphContext(document);
|
|
67411
|
+
const allValueIds = new Set(graph.valuesById.keys());
|
|
67412
|
+
const semanticRootIds = /* @__PURE__ */ new Set();
|
|
67413
|
+
const bodyPlacements = findOwningMembersForValues(
|
|
67414
|
+
document,
|
|
67415
|
+
allValueIds,
|
|
67416
|
+
additionalRoots
|
|
67417
|
+
);
|
|
67418
|
+
const placements = findOwningMembersForValues(
|
|
67419
|
+
document,
|
|
67420
|
+
allValueIds,
|
|
67421
|
+
additionalRoots,
|
|
67422
|
+
({ valueId: ownerValueId, placement: ownerPlacement }) => {
|
|
67423
|
+
const roots = [];
|
|
67424
|
+
for (const edge of graph.edgesByOwnerValueId.get(ownerValueId) ?? []) {
|
|
67425
|
+
if (graph.referenceCountByTargetValueId.get(edge.targetValueId) !== 1) {
|
|
67426
|
+
continue;
|
|
67427
|
+
}
|
|
67428
|
+
if (bodyPlacements.has(edge.targetValueId)) continue;
|
|
67429
|
+
if (semanticRootIds.has(edge.targetValueId)) continue;
|
|
67430
|
+
const member = graph.constructorArgumentOwnerMember(edge);
|
|
67431
|
+
if (member === void 0) continue;
|
|
67432
|
+
const memberId = getField(member, "id");
|
|
67433
|
+
semanticRootIds.add(edge.targetValueId);
|
|
67434
|
+
roots.push({
|
|
67435
|
+
member,
|
|
67436
|
+
valueId: edge.targetValueId,
|
|
67437
|
+
position: {
|
|
67438
|
+
insideAnimationOverrideGraph: ownerPlacement.position.insideAnimationOverrideGraph || typeof memberId === "string" && entersAnimationOverrideGraph(memberId)
|
|
67439
|
+
}
|
|
67440
|
+
});
|
|
67441
|
+
}
|
|
67442
|
+
return roots;
|
|
67443
|
+
}
|
|
67444
|
+
);
|
|
67445
|
+
for (const [valueId, placement] of bodyPlacements) {
|
|
67446
|
+
placements.set(valueId, placement);
|
|
67447
|
+
}
|
|
67448
|
+
for (const valueId of targetValueIds) {
|
|
67449
|
+
const placement = placements.get(valueId);
|
|
67450
|
+
if (placement !== void 0) result.set(valueId, placement);
|
|
67451
|
+
}
|
|
67452
|
+
return result;
|
|
67453
|
+
}
|
|
66491
67454
|
function createTypedValueNormalizer(rows, document, childrenByContainerId, parameterTypesForRow, memberById2, memberTypeInfo, genericEnvironmentForRow) {
|
|
66492
67455
|
const visiting = /* @__PURE__ */ new Set();
|
|
66493
67456
|
const normalizeLiteral = (value) => {
|
|
@@ -68320,7 +69283,8 @@ var init_project2 = __esm({
|
|
|
68320
69283
|
function isCatchableNeoScriptRuntimeError(error) {
|
|
68321
69284
|
return error instanceof NSGetterRuntimeError && !(error instanceof UncompiledInitializerRuntimeError) && !(error instanceof NonCatchableNSGetterRuntimeError);
|
|
68322
69285
|
}
|
|
68323
|
-
function makeEvaluatorLookups(members,
|
|
69286
|
+
function makeEvaluatorLookups(members, storedValues, options = {}) {
|
|
69287
|
+
const values = expandPackedValueRows(storedValues);
|
|
68324
69288
|
const attrMap = /* @__PURE__ */ new Map();
|
|
68325
69289
|
for (const a of members) attrMap.set(a.id, a);
|
|
68326
69290
|
const valMap = /* @__PURE__ */ new Map();
|
|
@@ -77156,6 +78120,7 @@ var init_evaluateNSGetter = __esm({
|
|
|
77156
78120
|
init_src();
|
|
77157
78121
|
init_decimal();
|
|
77158
78122
|
init_members();
|
|
78123
|
+
init_packed_value_encoding();
|
|
77159
78124
|
init_core();
|
|
77160
78125
|
init_member_storage_key();
|
|
77161
78126
|
init_project2();
|
|
@@ -78091,12 +79056,6 @@ function resolveVirtualInstanceGraph(args) {
|
|
|
78091
79056
|
};
|
|
78092
79057
|
rowsById.set(effectiveId, effective);
|
|
78093
79058
|
locationsById.set(effectiveId, location3);
|
|
78094
|
-
if (effectiveId !== indexed.virtualId) {
|
|
78095
|
-
locationsById.set(indexed.virtualId, {
|
|
78096
|
-
...location3,
|
|
78097
|
-
id: indexed.virtualId
|
|
78098
|
-
});
|
|
78099
|
-
}
|
|
78100
79059
|
locationsByPath.set(pathKey, location3);
|
|
78101
79060
|
visiting.delete(pathKey);
|
|
78102
79061
|
return location3;
|
|
@@ -78150,10 +79109,9 @@ function reportFrameResolutionDisagreement(args) {
|
|
|
78150
79109
|
);
|
|
78151
79110
|
}
|
|
78152
79111
|
function resolvedStoredInstanceRows(args) {
|
|
78153
|
-
const
|
|
78154
|
-
const
|
|
78155
|
-
|
|
78156
|
-
});
|
|
79112
|
+
const document = expandPackedDocumentValues(args.document);
|
|
79113
|
+
const rows = new Map(document.values.map((row) => [row.id, row]));
|
|
79114
|
+
const materializedIndex = buildVirtualInstanceMaterializedIndex({ document });
|
|
78157
79115
|
const queue = [{ root: args.instanceRoot, member: args.rootMember }];
|
|
78158
79116
|
const resolvedRootIds = /* @__PURE__ */ new Set();
|
|
78159
79117
|
const resolvedFrameByValueId = /* @__PURE__ */ new Map();
|
|
@@ -78162,12 +79120,12 @@ function resolvedStoredInstanceRows(args) {
|
|
|
78162
79120
|
if (next === void 0 || resolvedRootIds.has(next.root.id)) continue;
|
|
78163
79121
|
resolvedRootIds.add(next.root.id);
|
|
78164
79122
|
const expanded = expandStoredInstance({
|
|
78165
|
-
document
|
|
79123
|
+
document,
|
|
78166
79124
|
instanceRoot: next.root,
|
|
78167
79125
|
rootMember: next.member
|
|
78168
79126
|
});
|
|
78169
79127
|
const graph = resolveVirtualInstanceGraph({
|
|
78170
|
-
document
|
|
79128
|
+
document,
|
|
78171
79129
|
instanceRoot: next.root,
|
|
78172
79130
|
rootMember: next.member,
|
|
78173
79131
|
expandedRoot: expanded.root,
|
|
@@ -79699,6 +80657,7 @@ var init_virtual_instance_values = __esm({
|
|
|
79699
80657
|
init_classes();
|
|
79700
80658
|
init_members();
|
|
79701
80659
|
init_member_value_id();
|
|
80660
|
+
init_packed_value_encoding();
|
|
79702
80661
|
init_stored_value_placement_index();
|
|
79703
80662
|
init_instance_provenance();
|
|
79704
80663
|
init_unordered_list_membership();
|
|
@@ -80432,6 +81391,16 @@ var init_projectRecordBuckets = __esm({
|
|
|
80432
81391
|
});
|
|
80433
81392
|
|
|
80434
81393
|
// ../src/database/project-record-migrations.ts
|
|
81394
|
+
function migrateValueDataV1ToV2(data) {
|
|
81395
|
+
if (typeof data !== "object" || data === null) return data;
|
|
81396
|
+
const value = Reflect.get(data, "value");
|
|
81397
|
+
if (typeof value !== "object" || value === null) return data;
|
|
81398
|
+
if (!Object.hasOwn(value, PACKED_VALUE_ENTRY_KEY)) return data;
|
|
81399
|
+
const id2 = Reflect.get(data, "id");
|
|
81400
|
+
throw new Error(
|
|
81401
|
+
`Value "${typeof id2 === "string" ? id2 : "<unknown>"}" is stamped data schema version 1 but its body already carries a "${PACKED_VALUE_ENTRY_KEY}" envelope; only version 2 may pack a subtree.`
|
|
81402
|
+
);
|
|
81403
|
+
}
|
|
80435
81404
|
function migrateProjectRecordData(args) {
|
|
80436
81405
|
const currentVersion = CURRENT_PROJECT_RECORD_DATA_SCHEMA_VERSION[args.recordKind];
|
|
80437
81406
|
if (args.dataSchemaVersion > currentVersion) {
|
|
@@ -80455,11 +81424,26 @@ var CURRENT_PROJECT_RECORD_DATA_SCHEMA_VERSION, PROJECT_RECORD_DATA_MIGRATIONS;
|
|
|
80455
81424
|
var init_project_record_migrations = __esm({
|
|
80456
81425
|
"../src/database/project-record-migrations.ts"() {
|
|
80457
81426
|
"use strict";
|
|
81427
|
+
init_packed_value_encoding();
|
|
80458
81428
|
init_project2();
|
|
80459
81429
|
CURRENT_PROJECT_RECORD_DATA_SCHEMA_VERSION = {
|
|
80460
81430
|
[ProjectRecordKind.Project]: 1,
|
|
80461
81431
|
[ProjectRecordKind.Member]: 6,
|
|
80462
|
-
|
|
81432
|
+
/**
|
|
81433
|
+
* 2 — P76 §3.1. A value body may carry `~packed` envelopes, so a v1 reader
|
|
81434
|
+
* would hand a packed child's envelope to an evaluator as if it were the
|
|
81435
|
+
* child's value, and an external reader has to fail closed on v2 (spec
|
|
81436
|
+
* §"Goals": "old readers fail closed").
|
|
81437
|
+
*
|
|
81438
|
+
* The 1 -> 2 rung below is load-bearing rather than optional. The P76
|
|
81439
|
+
* migrations are themselves ordinary writers: they read a value's base
|
|
81440
|
+
* record through {@link migrateProjectRecordData} before they can write it.
|
|
81441
|
+
* Bumping this with an empty ladder makes every stored v1 value unreadable
|
|
81442
|
+
* by the very sweep that is supposed to advance it, which is circular. The
|
|
81443
|
+
* rung breaks that circle, and retires with the migration once the corpus
|
|
81444
|
+
* carries no v1 value.
|
|
81445
|
+
*/
|
|
81446
|
+
[ProjectRecordKind.Value]: 2,
|
|
80463
81447
|
[ProjectRecordKind.Class]: 2,
|
|
80464
81448
|
[ProjectRecordKind.Constructor]: 1,
|
|
80465
81449
|
[ProjectRecordKind.Variant]: 1,
|
|
@@ -80482,7 +81466,7 @@ var init_project_record_migrations = __esm({
|
|
|
80482
81466
|
PROJECT_RECORD_DATA_MIGRATIONS = {
|
|
80483
81467
|
[ProjectRecordKind.Project]: {},
|
|
80484
81468
|
[ProjectRecordKind.Member]: {},
|
|
80485
|
-
[ProjectRecordKind.Value]: {},
|
|
81469
|
+
[ProjectRecordKind.Value]: { 1: migrateValueDataV1ToV2 },
|
|
80486
81470
|
[ProjectRecordKind.Class]: {},
|
|
80487
81471
|
[ProjectRecordKind.Constructor]: {},
|
|
80488
81472
|
[ProjectRecordKind.Variant]: {},
|
|
@@ -80511,7 +81495,9 @@ __export(project_document_read_exports, {
|
|
|
80511
81495
|
DOCUMENT_MANIFEST_PAGE_SIZE: () => DOCUMENT_MANIFEST_PAGE_SIZE,
|
|
80512
81496
|
DOCUMENT_SNAPSHOT_FETCH_CHUNK_SIZE: () => DOCUMENT_SNAPSHOT_FETCH_CHUNK_SIZE,
|
|
80513
81497
|
DOCUMENT_SNAPSHOT_FETCH_CONCURRENCY: () => DOCUMENT_SNAPSHOT_FETCH_CONCURRENCY,
|
|
81498
|
+
appendProjectRecordToBuckets: () => appendProjectRecordToBuckets,
|
|
80514
81499
|
assembleProjectDocumentRaw: () => assembleProjectDocumentRaw,
|
|
81500
|
+
emptyProjectRecordBuckets: () => emptyProjectRecordBuckets,
|
|
80515
81501
|
fetchProjectDocumentPartitionRecords: () => fetchProjectDocumentPartitionRecords,
|
|
80516
81502
|
fetchProjectDocumentRawChunked: () => fetchProjectDocumentRawChunked,
|
|
80517
81503
|
fetchProjectDocumentSnapshots: () => fetchProjectDocumentSnapshots,
|
|
@@ -80522,7 +81508,8 @@ __export(project_document_read_exports, {
|
|
|
80522
81508
|
readProjectDocumentContentHashHeads: () => readProjectDocumentContentHashHeads,
|
|
80523
81509
|
readProjectDocumentManifestPageRecords: () => readProjectDocumentManifestPageRecords,
|
|
80524
81510
|
readProjectDocumentManifestRecords: () => readProjectDocumentManifestRecords,
|
|
80525
|
-
readProjectDocumentRevisionMarker: () => readProjectDocumentRevisionMarker
|
|
81511
|
+
readProjectDocumentRevisionMarker: () => readProjectDocumentRevisionMarker,
|
|
81512
|
+
readStoredMembersField: () => readStoredMembersField
|
|
80526
81513
|
});
|
|
80527
81514
|
async function fetchProjectDocumentRawChunked(runner, options = {}) {
|
|
80528
81515
|
const mapKeys = options.mapKeys ?? [
|
|
@@ -80847,29 +81834,7 @@ function readProjectDocumentSnapshotBatch(value, requestedIds) {
|
|
|
80847
81834
|
});
|
|
80848
81835
|
}
|
|
80849
81836
|
function assembleProjectDocumentRaw(args) {
|
|
80850
|
-
const buckets =
|
|
80851
|
-
project: null,
|
|
80852
|
-
members: [],
|
|
80853
|
-
classes: [],
|
|
80854
|
-
constructors: [],
|
|
80855
|
-
variants: [],
|
|
80856
|
-
variantFolders: [],
|
|
80857
|
-
internalRecordRelations: [],
|
|
80858
|
-
values: [],
|
|
80859
|
-
enums: [],
|
|
80860
|
-
interfaces: [],
|
|
80861
|
-
dialogueRecords: [],
|
|
80862
|
-
dialogueNodes: [],
|
|
80863
|
-
dialogueGroups: [],
|
|
80864
|
-
priorityGroups: [],
|
|
80865
|
-
projectFiles: [],
|
|
80866
|
-
textureTemplates: [],
|
|
80867
|
-
audioClipTemplates: [],
|
|
80868
|
-
localizationConfig: null,
|
|
80869
|
-
localizationStatuses: [],
|
|
80870
|
-
localizedTexts: [],
|
|
80871
|
-
migrations: []
|
|
80872
|
-
};
|
|
81837
|
+
const buckets = emptyProjectRecordBuckets();
|
|
80873
81838
|
const contentHashHeads = [];
|
|
80874
81839
|
const sortedRecords = [...args.records].sort((left, right) => {
|
|
80875
81840
|
const kind = left.recordKind.localeCompare(right.recordKind);
|
|
@@ -80898,7 +81863,7 @@ function assembleProjectDocumentRaw(args) {
|
|
|
80898
81863
|
`Convex project document manifest references deleted snapshot "${snapshot.id}" for live record "${record3.recordId}".`
|
|
80899
81864
|
);
|
|
80900
81865
|
}
|
|
80901
|
-
|
|
81866
|
+
appendProjectRecordToBuckets(buckets, record3.recordKind, snapshot.data);
|
|
80902
81867
|
contentHashHeads.push({
|
|
80903
81868
|
recordKind: record3.recordKind,
|
|
80904
81869
|
recordId: record3.recordId,
|
|
@@ -80944,7 +81909,32 @@ function assembleProjectDocumentRaw(args) {
|
|
|
80944
81909
|
}
|
|
80945
81910
|
return document;
|
|
80946
81911
|
}
|
|
80947
|
-
function
|
|
81912
|
+
function emptyProjectRecordBuckets() {
|
|
81913
|
+
return {
|
|
81914
|
+
project: null,
|
|
81915
|
+
members: [],
|
|
81916
|
+
classes: [],
|
|
81917
|
+
constructors: [],
|
|
81918
|
+
variants: [],
|
|
81919
|
+
variantFolders: [],
|
|
81920
|
+
internalRecordRelations: [],
|
|
81921
|
+
values: [],
|
|
81922
|
+
enums: [],
|
|
81923
|
+
interfaces: [],
|
|
81924
|
+
dialogueRecords: [],
|
|
81925
|
+
dialogueNodes: [],
|
|
81926
|
+
dialogueGroups: [],
|
|
81927
|
+
priorityGroups: [],
|
|
81928
|
+
projectFiles: [],
|
|
81929
|
+
textureTemplates: [],
|
|
81930
|
+
audioClipTemplates: [],
|
|
81931
|
+
localizationConfig: null,
|
|
81932
|
+
localizationStatuses: [],
|
|
81933
|
+
localizedTexts: [],
|
|
81934
|
+
migrations: []
|
|
81935
|
+
};
|
|
81936
|
+
}
|
|
81937
|
+
function appendProjectRecordToBuckets(buckets, recordKind, data) {
|
|
80948
81938
|
const bucket = PROJECT_RECORD_BUCKETS[recordKind];
|
|
80949
81939
|
if (bucket === "project") {
|
|
80950
81940
|
if (buckets.project !== null) {
|
|
@@ -80966,6 +81956,11 @@ function appendBucketRecord(buckets, recordKind, data) {
|
|
|
80966
81956
|
}
|
|
80967
81957
|
buckets[bucket].push(data);
|
|
80968
81958
|
}
|
|
81959
|
+
function projectDocumentValueBuckets(rows) {
|
|
81960
|
+
const expanded = expandPackedValueRows(rows);
|
|
81961
|
+
if (expanded === rows) return { values: rows };
|
|
81962
|
+
return { values: [...expanded], physicalValues: rows };
|
|
81963
|
+
}
|
|
80969
81964
|
function readProjectDocument(value, options = {}) {
|
|
80970
81965
|
if (!isObject4(value)) {
|
|
80971
81966
|
throw new Error("Convex project document query returned a non-object.");
|
|
@@ -80975,6 +81970,9 @@ function readProjectDocument(value, options = {}) {
|
|
|
80975
81970
|
"localizationConfig",
|
|
80976
81971
|
isProjectLocalizationConfig
|
|
80977
81972
|
) : readField(value, "localizationConfig", isProjectLocalizationConfig);
|
|
81973
|
+
const valueBuckets = projectDocumentValueBuckets(
|
|
81974
|
+
readArrayField(value, "values", isMemberValue)
|
|
81975
|
+
);
|
|
80978
81976
|
return {
|
|
80979
81977
|
version: readField(value, "version", isProjectVersion),
|
|
80980
81978
|
versions: readArrayField(value, "versions", isProjectVersion),
|
|
@@ -80990,12 +81988,8 @@ function readProjectDocument(value, options = {}) {
|
|
|
80990
81988
|
isProjectReleaseChannel
|
|
80991
81989
|
),
|
|
80992
81990
|
project: readField(value, "project", isProject),
|
|
80993
|
-
|
|
80994
|
-
// storage union at this wire boundary while preserving the document's
|
|
80995
|
-
// member collection type.
|
|
80996
|
-
members: readArrayField(
|
|
81991
|
+
members: readStoredMembersField(
|
|
80997
81992
|
value,
|
|
80998
|
-
"members",
|
|
80999
81993
|
options.members === "authored-or-compiled" ? isAnyMemberAuthoredOrCompiled : isAnyMember
|
|
81000
81994
|
),
|
|
81001
81995
|
classes: readArrayField(value, "classes", isNeoSchemaClass),
|
|
@@ -81015,7 +82009,13 @@ function readProjectDocument(value, options = {}) {
|
|
|
81015
82009
|
"internalRecordRelations",
|
|
81016
82010
|
isInternalRecordRelation
|
|
81017
82011
|
),
|
|
81018
|
-
|
|
82012
|
+
// P76: a document is a READ model, so its `values` bucket is the logical
|
|
82013
|
+
// row set — packed parents holding plain child-id strings, packed children
|
|
82014
|
+
// as rows of their own. The physical form stays in the record stream this
|
|
82015
|
+
// document was built from, which is what the CLI's merge base and CAS
|
|
82016
|
+
// compare; nothing round-trips a document bucket back into storage.
|
|
82017
|
+
values: valueBuckets.values,
|
|
82018
|
+
...valueBuckets.physicalValues === void 0 ? {} : { physicalValues: valueBuckets.physicalValues },
|
|
81019
82019
|
enums: readArrayField(
|
|
81020
82020
|
value,
|
|
81021
82021
|
"enums",
|
|
@@ -81110,6 +82110,13 @@ function readOptionalArrayField(source, key, isValid) {
|
|
|
81110
82110
|
if (!Object.prototype.hasOwnProperty.call(source, key)) return [];
|
|
81111
82111
|
return readArrayField(source, key, isValid);
|
|
81112
82112
|
}
|
|
82113
|
+
function readStoredMembersField(source, isValid = isAnyMember) {
|
|
82114
|
+
return readArrayField(
|
|
82115
|
+
source,
|
|
82116
|
+
"members",
|
|
82117
|
+
isValid
|
|
82118
|
+
);
|
|
82119
|
+
}
|
|
81113
82120
|
function isObject4(value) {
|
|
81114
82121
|
if (typeof value !== "object") return false;
|
|
81115
82122
|
return value !== null;
|
|
@@ -81136,6 +82143,7 @@ var init_project_document_read = __esm({
|
|
|
81136
82143
|
"use strict";
|
|
81137
82144
|
init_project2();
|
|
81138
82145
|
init_members();
|
|
82146
|
+
init_packed_value_encoding();
|
|
81139
82147
|
init_classes();
|
|
81140
82148
|
init_constructors2();
|
|
81141
82149
|
init_variants2();
|
|
@@ -86547,322 +87555,53 @@ var init_animation_clips = __esm({
|
|
|
86547
87555
|
}
|
|
86548
87556
|
});
|
|
86549
87557
|
|
|
86550
|
-
// ../src/database/
|
|
86551
|
-
function
|
|
86552
|
-
|
|
86553
|
-
const values = document.values;
|
|
86554
|
-
const indexed = makeEvaluatorLookups(
|
|
86555
|
-
members,
|
|
86556
|
-
values,
|
|
86557
|
-
options.includeValueGraphIndexes === true ? {
|
|
86558
|
-
includeValueGraphIndexes: true,
|
|
86559
|
-
constructorInitializerDocument: {
|
|
86560
|
-
classes: document.classes,
|
|
86561
|
-
members,
|
|
86562
|
-
values
|
|
86563
|
-
}
|
|
86564
|
-
} : {}
|
|
86565
|
-
);
|
|
86566
|
-
const virtual = createHeadlessVirtualInstanceResolver({
|
|
86567
|
-
document: {
|
|
86568
|
-
...document,
|
|
86569
|
-
...options.initializerCompiler === void 0 ? {} : { initializerCompiler: options.initializerCompiler }
|
|
86570
|
-
},
|
|
86571
|
-
// A thunk: the resolver resolves nested reads through the lookups being
|
|
86572
|
-
// built around it.
|
|
86573
|
-
resolverLookups: () => lookups
|
|
86574
|
-
});
|
|
86575
|
-
const lookups = {
|
|
86576
|
-
...indexed,
|
|
86577
|
-
// Raw first, then virtual: a materialized row always wins over the
|
|
86578
|
-
// expansion that would otherwise answer for it.
|
|
86579
|
-
valueById: (id2) => indexed.valueById(id2) ?? virtual.valueById(id2),
|
|
86580
|
-
rowForValueReference: (value) => indexed.rowForValueReference(value) ?? virtual.rowForValueReference(value),
|
|
86581
|
-
virtualInstanceRowsForValue: (receiverValueId) => virtual.virtualInstanceRowsForValue(receiverValueId),
|
|
86582
|
-
// Stored-construction replay evaluates `ToVariant`, and production's
|
|
86583
|
-
// variant-constructed placements collapse through exactly this path.
|
|
86584
|
-
resolveVariantInstanceGraph: (args) => resolveVariantInstanceGraphForDocument({
|
|
86585
|
-
document,
|
|
86586
|
-
resolverLookups: lookups,
|
|
86587
|
-
...args
|
|
86588
|
-
}),
|
|
86589
|
-
// A write to a virtual key must MATERIALIZE it (a pin row at the
|
|
86590
|
-
// deterministic virtual id plus the sparse spine); the planner needs the
|
|
86591
|
-
// owning graph, not just its rows.
|
|
86592
|
-
virtualInstanceGraphForValue: (valueId) => virtual.virtualInstanceGraphForValue(valueId)
|
|
86593
|
-
};
|
|
86594
|
-
return lookups;
|
|
86595
|
-
}
|
|
86596
|
-
var init_headless_virtual_instance_lookups = __esm({
|
|
86597
|
-
"../src/database/headless-virtual-instance-lookups.ts"() {
|
|
86598
|
-
"use strict";
|
|
86599
|
-
init_virtual_instance_values();
|
|
86600
|
-
init_neoscript_evaluator();
|
|
86601
|
-
}
|
|
86602
|
-
});
|
|
86603
|
-
|
|
86604
|
-
// src/evaluator-lookups.ts
|
|
86605
|
-
function cliEvaluatorLookups(document, options = {}) {
|
|
86606
|
-
return cliEvaluatorRuntime(document, options).databaseVM;
|
|
86607
|
-
}
|
|
86608
|
-
function cliEvaluatorRuntime(document, options = {}) {
|
|
86609
|
-
const initializerCompiler = isPulledInitializerCompilationDocumentV4(document) ? pulledInitializerCompilerV4(document) : void 0;
|
|
86610
|
-
const databaseVM = headlessVirtualInstanceLookups(document, {
|
|
86611
|
-
...options,
|
|
86612
|
-
...initializerCompiler === void 0 ? {} : { initializerCompiler }
|
|
86613
|
-
});
|
|
86614
|
-
return {
|
|
86615
|
-
databaseVM,
|
|
86616
|
-
...initializerCompiler === void 0 ? {} : { initializerCompiler }
|
|
86617
|
-
};
|
|
86618
|
-
}
|
|
86619
|
-
function cliEvaluatorReceiverValue(lookups, valueId) {
|
|
86620
|
-
if (typeof valueId !== "string") return null;
|
|
86621
|
-
return lookups.valueById(valueId)?.value ?? null;
|
|
87558
|
+
// ../src/database/canonical-json.ts
|
|
87559
|
+
function canonicalJsonStringify(value) {
|
|
87560
|
+
return JSON.stringify(toCanonicalJsonValue(value));
|
|
86622
87561
|
}
|
|
86623
|
-
|
|
86624
|
-
|
|
86625
|
-
"use strict";
|
|
86626
|
-
init_headless_virtual_instance_lookups();
|
|
86627
|
-
init_initializer_replay();
|
|
86628
|
-
}
|
|
86629
|
-
});
|
|
86630
|
-
|
|
86631
|
-
// src/project-source/materialized-construction-cache.ts
|
|
86632
|
-
import { mkdirSync as mkdirSync3, readFileSync as readFileSync3, renameSync, writeFileSync as writeFileSync3 } from "node:fs";
|
|
86633
|
-
import { createHash as createHash3 } from "node:crypto";
|
|
86634
|
-
import { dirname as dirname2, join as join3 } from "node:path";
|
|
86635
|
-
function createMaterializedConstructionExpressionsV1(args) {
|
|
86636
|
-
const warm = args.useBuildCaches ? readMaterializedConstructionBuildCacheV2(args.root, args.state) : null;
|
|
86637
|
-
const emitted = /* @__PURE__ */ new Map();
|
|
86638
|
-
const overrideKeys = /* @__PURE__ */ new Map();
|
|
86639
|
-
let emitters;
|
|
86640
|
-
return {
|
|
86641
|
-
get(valueId) {
|
|
86642
|
-
const cached = warm?.expressions.get(valueId);
|
|
86643
|
-
if (cached !== void 0) return cached;
|
|
86644
|
-
if (emitted.has(valueId)) return emitted.get(valueId);
|
|
86645
|
-
emitters ??= storedConstructionEmitters(args.state, args.manifest);
|
|
86646
|
-
const expression = emitters.construction(valueId);
|
|
86647
|
-
emitted.set(valueId, expression);
|
|
86648
|
-
return expression;
|
|
86649
|
-
},
|
|
86650
|
-
overrideSchemaKeys(valueId) {
|
|
86651
|
-
const cached = warm?.overrideKeys.get(valueId);
|
|
86652
|
-
if (cached !== void 0) return cached;
|
|
86653
|
-
if (overrideKeys.has(valueId)) return overrideKeys.get(valueId);
|
|
86654
|
-
emitters ??= storedConstructionEmitters(args.state, args.manifest);
|
|
86655
|
-
const keys = emitters.overrideSchemaKeys(valueId);
|
|
86656
|
-
overrideKeys.set(valueId, keys);
|
|
86657
|
-
return keys;
|
|
86658
|
-
}
|
|
86659
|
-
};
|
|
87562
|
+
function canonicallyEqual2(left, right) {
|
|
87563
|
+
return canonicalJsonStringify(left) === canonicalJsonStringify(right);
|
|
86660
87564
|
}
|
|
86661
|
-
function
|
|
86662
|
-
|
|
86663
|
-
|
|
86664
|
-
|
|
86665
|
-
|
|
86666
|
-
|
|
86667
|
-
|
|
86668
|
-
|
|
86669
|
-
|
|
86670
|
-
data: record3.data
|
|
86671
|
-
});
|
|
86672
|
-
if (record3.recordKind !== "value") continue;
|
|
86673
|
-
if (!isObjectRecord2(record3.data)) continue;
|
|
86674
|
-
if (!isObjectRecord2(record3.data.value)) continue;
|
|
86675
|
-
const constructorArgs = record3.data.constructorArgs;
|
|
86676
|
-
const hasInstanceProvenance = carriesStoredInstanceProvenance(record3.data);
|
|
86677
|
-
if (constructorArgs !== void 0 && constructorArgs !== null && !hasInstanceProvenance) {
|
|
86678
|
-
continue;
|
|
86679
|
-
}
|
|
86680
|
-
candidateRoots.add(record3.recordId);
|
|
86681
|
-
}
|
|
86682
|
-
const document = readPulledProjectDocumentV4(records2);
|
|
86683
|
-
const owners = resolveOwnerMembersForValues(document, candidateRoots);
|
|
86684
|
-
const storedPlacements = buildStoredValuePlacementIndexV4(records2.values());
|
|
86685
|
-
const membersById2 = new Map(
|
|
86686
|
-
document.members.map((member) => [member.id, member])
|
|
86687
|
-
);
|
|
86688
|
-
for (const valueId of candidateRoots) {
|
|
86689
|
-
if (owners.has(valueId)) continue;
|
|
86690
|
-
const memberId = storedPlacements.placementByChildValueId.get(valueId)?.memberId;
|
|
86691
|
-
const member = memberId === null || memberId === void 0 ? void 0 : membersById2.get(memberId);
|
|
86692
|
-
if (member !== void 0) owners.set(valueId, member);
|
|
86693
|
-
}
|
|
86694
|
-
const probe = createStoredConstructionProbeV4(records2, manifest);
|
|
86695
|
-
let parents;
|
|
86696
|
-
const parentByChildId = () => parents ??= storedValueParentIndex(records2, storedPlacements);
|
|
86697
|
-
const root = (valueId) => {
|
|
86698
|
-
const member = owners.get(valueId);
|
|
86699
|
-
return member === void 0 ? void 0 : {
|
|
86700
|
-
member,
|
|
86701
|
-
valueId
|
|
86702
|
-
};
|
|
86703
|
-
};
|
|
86704
|
-
const probedRootIds = /* @__PURE__ */ new Set();
|
|
86705
|
-
const probeRootOnce = (rootValueId, ownedRoot) => {
|
|
86706
|
-
if (probedRootIds.has(rootValueId)) {
|
|
86707
|
-
return /* @__PURE__ */ new Set();
|
|
86708
|
-
}
|
|
86709
|
-
probedRootIds.add(rootValueId);
|
|
86710
|
-
return probe.overrideKeys(ownedRoot);
|
|
86711
|
-
};
|
|
86712
|
-
return {
|
|
86713
|
-
construction(valueId) {
|
|
86714
|
-
const ownedRoot = root(valueId);
|
|
86715
|
-
if (ownedRoot === void 0) return void 0;
|
|
86716
|
-
return probe.construction(ownedRoot);
|
|
86717
|
-
},
|
|
86718
|
-
overrideSchemaKeys(valueId) {
|
|
86719
|
-
const recorded = probe.overrideKeysOf(valueId);
|
|
86720
|
-
if (recorded !== void 0) return recorded;
|
|
86721
|
-
const ownedRoot = root(valueId);
|
|
86722
|
-
if (ownedRoot !== void 0) return probeRootOnce(valueId, ownedRoot);
|
|
86723
|
-
const ancestor = nearestOwnedAncestor(valueId, parentByChildId(), owners);
|
|
86724
|
-
if (ancestor === null) return void 0;
|
|
86725
|
-
const ancestorRoot = root(ancestor);
|
|
86726
|
-
if (ancestorRoot === void 0) return void 0;
|
|
86727
|
-
if (probedRootIds.has(ancestor)) return void 0;
|
|
86728
|
-
probeRootOnce(ancestor, ancestorRoot);
|
|
86729
|
-
return probe.overrideKeysOf(valueId);
|
|
87565
|
+
function toCanonicalJsonValue(value) {
|
|
87566
|
+
if (value === null) return null;
|
|
87567
|
+
if (value === void 0) return void 0;
|
|
87568
|
+
if (value instanceof Date) return value.toISOString();
|
|
87569
|
+
if (typeof value === "string") return value;
|
|
87570
|
+
if (typeof value === "boolean") return value;
|
|
87571
|
+
if (typeof value === "number") {
|
|
87572
|
+
if (!Number.isFinite(value)) {
|
|
87573
|
+
throw new Error("Cannot canonicalize a non-finite number.");
|
|
86730
87574
|
}
|
|
86731
|
-
|
|
86732
|
-
}
|
|
86733
|
-
function storedValueParentIndex(records2, placements) {
|
|
86734
|
-
const parents = /* @__PURE__ */ new Map();
|
|
86735
|
-
const valueIds = /* @__PURE__ */ new Set();
|
|
86736
|
-
for (const record3 of records2.values()) {
|
|
86737
|
-
if (record3.recordKind === "value") valueIds.add(record3.recordId);
|
|
87575
|
+
return value;
|
|
86738
87576
|
}
|
|
86739
|
-
|
|
86740
|
-
|
|
86741
|
-
if (!isObjectRecord2(record3.data)) continue;
|
|
86742
|
-
const containerId = record3.data.containerId;
|
|
86743
|
-
if (typeof containerId === "string" && valueIds.has(containerId)) {
|
|
86744
|
-
parents.set(record3.recordId, containerId);
|
|
86745
|
-
}
|
|
86746
|
-
const body = record3.data.value;
|
|
86747
|
-
if (Array.isArray(body)) {
|
|
86748
|
-
for (const entry of body) {
|
|
86749
|
-
if (typeof entry === "string" && valueIds.has(entry)) {
|
|
86750
|
-
parents.set(entry, record3.recordId);
|
|
86751
|
-
}
|
|
86752
|
-
}
|
|
86753
|
-
continue;
|
|
86754
|
-
}
|
|
86755
|
-
if (!isObjectRecord2(body)) continue;
|
|
86756
|
-
for (const child of Object.values(body)) {
|
|
86757
|
-
if (typeof child === "string" && valueIds.has(child)) {
|
|
86758
|
-
parents.set(child, record3.recordId);
|
|
86759
|
-
}
|
|
86760
|
-
}
|
|
87577
|
+
if (typeof value === "bigint") {
|
|
87578
|
+
throw new Error("Cannot canonicalize bigint values.");
|
|
86761
87579
|
}
|
|
86762
|
-
|
|
86763
|
-
|
|
86764
|
-
if (!parents.has(edge.childValueId)) {
|
|
86765
|
-
parents.set(edge.childValueId, edge.parentValueId);
|
|
86766
|
-
}
|
|
87580
|
+
if (typeof value === "symbol") {
|
|
87581
|
+
throw new Error("Cannot canonicalize symbol values.");
|
|
86767
87582
|
}
|
|
86768
|
-
|
|
86769
|
-
|
|
86770
|
-
function nearestOwnedAncestor(valueId, parents, owners) {
|
|
86771
|
-
const seen = /* @__PURE__ */ new Set([valueId]);
|
|
86772
|
-
let cursor = parents.get(valueId);
|
|
86773
|
-
while (cursor !== void 0 && !seen.has(cursor)) {
|
|
86774
|
-
if (owners.has(cursor)) return cursor;
|
|
86775
|
-
seen.add(cursor);
|
|
86776
|
-
cursor = parents.get(cursor);
|
|
87583
|
+
if (typeof value === "function") {
|
|
87584
|
+
throw new Error("Cannot canonicalize function values.");
|
|
86777
87585
|
}
|
|
86778
|
-
|
|
86779
|
-
|
|
86780
|
-
|
|
86781
|
-
|
|
86782
|
-
|
|
86783
|
-
|
|
86784
|
-
try {
|
|
86785
|
-
const parsed = JSON.parse(
|
|
86786
|
-
readFileSync3(
|
|
86787
|
-
join3(root, MATERIALIZED_CONSTRUCTION_BUILD_CACHE_PATH),
|
|
86788
|
-
"utf8"
|
|
86789
|
-
)
|
|
86790
|
-
);
|
|
86791
|
-
if (parsed === null || typeof parsed !== "object") return null;
|
|
86792
|
-
const cache = parsed;
|
|
86793
|
-
if (cache.revision !== MATERIALIZED_CONSTRUCTION_BUILD_CACHE_REVISION || cache.stateFingerprint !== materializedConstructionStateFingerprint(state) || cache.expressions === null || typeof cache.expressions !== "object" || Array.isArray(cache.expressions)) {
|
|
86794
|
-
return null;
|
|
86795
|
-
}
|
|
86796
|
-
const expressions = /* @__PURE__ */ new Map();
|
|
86797
|
-
for (const [valueId, expression] of Object.entries(cache.expressions)) {
|
|
86798
|
-
if (typeof expression !== "string") return null;
|
|
86799
|
-
expressions.set(valueId, expression);
|
|
86800
|
-
}
|
|
86801
|
-
const overrideKeys = /* @__PURE__ */ new Map();
|
|
86802
|
-
if (cache.overrideKeys !== void 0) {
|
|
86803
|
-
if (cache.overrideKeys === null || typeof cache.overrideKeys !== "object" || Array.isArray(cache.overrideKeys)) {
|
|
86804
|
-
return null;
|
|
86805
|
-
}
|
|
86806
|
-
for (const [valueId, keys] of Object.entries(cache.overrideKeys)) {
|
|
86807
|
-
if (!Array.isArray(keys) || keys.some((key) => typeof key !== "string")) {
|
|
86808
|
-
return null;
|
|
86809
|
-
}
|
|
86810
|
-
overrideKeys.set(valueId, new Set(keys));
|
|
86811
|
-
}
|
|
86812
|
-
}
|
|
86813
|
-
return { expressions, overrideKeys };
|
|
86814
|
-
} catch {
|
|
86815
|
-
return null;
|
|
87586
|
+
if (Array.isArray(value)) {
|
|
87587
|
+
return value.map((item) => {
|
|
87588
|
+
const canonicalItem = toCanonicalJsonValue(item);
|
|
87589
|
+
if (canonicalItem === void 0) return null;
|
|
87590
|
+
return canonicalItem;
|
|
87591
|
+
});
|
|
86816
87592
|
}
|
|
86817
|
-
|
|
86818
|
-
|
|
86819
|
-
const
|
|
86820
|
-
|
|
86821
|
-
|
|
86822
|
-
|
|
86823
|
-
temporary,
|
|
86824
|
-
`${JSON.stringify({
|
|
86825
|
-
revision: MATERIALIZED_CONSTRUCTION_BUILD_CACHE_REVISION,
|
|
86826
|
-
stateFingerprint: materializedConstructionStateFingerprint(state),
|
|
86827
|
-
expressions: Object.fromEntries(
|
|
86828
|
-
[...cache.expressions].sort(
|
|
86829
|
-
([left], [right]) => left.localeCompare(right)
|
|
86830
|
-
)
|
|
86831
|
-
),
|
|
86832
|
-
overrideKeys: Object.fromEntries(
|
|
86833
|
-
[...cache.overrideKeys ?? /* @__PURE__ */ new Map()].sort(([left], [right]) => left.localeCompare(right)).map(([valueId, keys]) => [valueId, [...keys].sort()])
|
|
86834
|
-
)
|
|
86835
|
-
})}
|
|
86836
|
-
`,
|
|
86837
|
-
"utf8"
|
|
86838
|
-
);
|
|
86839
|
-
renameSync(temporary, file);
|
|
86840
|
-
}
|
|
86841
|
-
function materializedConstructionStateFingerprint(state) {
|
|
86842
|
-
const hash = createHash3("sha256");
|
|
86843
|
-
hash.update(String(MATERIALIZED_CONSTRUCTION_BUILD_CACHE_REVISION));
|
|
86844
|
-
for (const [key, record3] of Object.entries(state.records).sort(
|
|
86845
|
-
([left], [right]) => left.localeCompare(right)
|
|
86846
|
-
)) {
|
|
86847
|
-
hash.update("\0");
|
|
86848
|
-
hash.update(key);
|
|
86849
|
-
hash.update("\0");
|
|
86850
|
-
hash.update(record3.contentHash);
|
|
87593
|
+
const entries = Object.entries(value).sort(([a], [b]) => a.localeCompare(b));
|
|
87594
|
+
const canonicalObject = {};
|
|
87595
|
+
for (const [key, entryValue] of entries) {
|
|
87596
|
+
const canonicalValue = toCanonicalJsonValue(entryValue);
|
|
87597
|
+
if (canonicalValue === void 0) continue;
|
|
87598
|
+
canonicalObject[key] = canonicalValue;
|
|
86851
87599
|
}
|
|
86852
|
-
return
|
|
87600
|
+
return canonicalObject;
|
|
86853
87601
|
}
|
|
86854
|
-
var
|
|
86855
|
-
|
|
86856
|
-
"src/project-source/materialized-construction-cache.ts"() {
|
|
87602
|
+
var init_canonical_json = __esm({
|
|
87603
|
+
"../src/database/canonical-json.ts"() {
|
|
86857
87604
|
"use strict";
|
|
86858
|
-
init_projection();
|
|
86859
|
-
init_initializer_replay();
|
|
86860
|
-
init_value_row_owner_members();
|
|
86861
|
-
init_instance_provenance();
|
|
86862
|
-
init_value_sources();
|
|
86863
|
-
init_stored_value_placements();
|
|
86864
|
-
MATERIALIZED_CONSTRUCTION_BUILD_CACHE_PATH = ".neo/build/materialized-constructions-v1.json";
|
|
86865
|
-
MATERIALIZED_CONSTRUCTION_BUILD_CACHE_REVISION = 2;
|
|
86866
87605
|
}
|
|
86867
87606
|
});
|
|
86868
87607
|
|
|
@@ -87049,6 +87788,22 @@ function collectVariantGraphValueIds(args) {
|
|
|
87049
87788
|
}
|
|
87050
87789
|
return collected;
|
|
87051
87790
|
}
|
|
87791
|
+
function withVariantPlacementRoots(document) {
|
|
87792
|
+
const variants = document.variants ?? [];
|
|
87793
|
+
if (variants.length === 0) {
|
|
87794
|
+
return { document, roots: NO_PLACEMENT_ROOTS };
|
|
87795
|
+
}
|
|
87796
|
+
const scope = withVariantOwnershipRoots(document, variants);
|
|
87797
|
+
return {
|
|
87798
|
+
document: scope.document,
|
|
87799
|
+
roots: scope.roots.map((root) => ({
|
|
87800
|
+
member: root.member,
|
|
87801
|
+
valueId: root.valueId,
|
|
87802
|
+
position: VARIANT_ROOT_POSITION
|
|
87803
|
+
}))
|
|
87804
|
+
};
|
|
87805
|
+
}
|
|
87806
|
+
var NO_PLACEMENT_ROOTS, VARIANT_ROOT_POSITION;
|
|
87052
87807
|
var init_variant_value_graph = __esm({
|
|
87053
87808
|
"../src/database/variant-value-graph.ts"() {
|
|
87054
87809
|
"use strict";
|
|
@@ -87056,56 +87811,958 @@ var init_variant_value_graph = __esm({
|
|
|
87056
87811
|
init_classes();
|
|
87057
87812
|
init_core();
|
|
87058
87813
|
init_constructor_argument_ownership();
|
|
87814
|
+
NO_PLACEMENT_ROOTS = [];
|
|
87815
|
+
VARIANT_ROOT_POSITION = {
|
|
87816
|
+
insideAnimationOverrideGraph: false
|
|
87817
|
+
};
|
|
87059
87818
|
}
|
|
87060
87819
|
});
|
|
87061
87820
|
|
|
87062
|
-
// ../src/database/
|
|
87063
|
-
function
|
|
87064
|
-
|
|
87821
|
+
// ../src/database/project-version-intents.ts
|
|
87822
|
+
function createProjectVersionIntent(type, details) {
|
|
87823
|
+
if (details === void 0) {
|
|
87824
|
+
return {
|
|
87825
|
+
type,
|
|
87826
|
+
schemaVersion: PROJECT_VERSION_INTENT_SCHEMA_VERSION
|
|
87827
|
+
};
|
|
87828
|
+
}
|
|
87829
|
+
return {
|
|
87830
|
+
type,
|
|
87831
|
+
schemaVersion: PROJECT_VERSION_INTENT_SCHEMA_VERSION,
|
|
87832
|
+
details
|
|
87833
|
+
};
|
|
87065
87834
|
}
|
|
87066
|
-
function
|
|
87835
|
+
function isKnownProjectVersionIntentType(value) {
|
|
87836
|
+
return Object.values(ProjectVersionIntentType).includes(
|
|
87837
|
+
value
|
|
87838
|
+
);
|
|
87839
|
+
}
|
|
87840
|
+
var ProjectVersionIntentType, PROJECT_VERSION_INTENT_SCHEMA_VERSION;
|
|
87841
|
+
var init_project_version_intents = __esm({
|
|
87842
|
+
"../src/database/project-version-intents.ts"() {
|
|
87843
|
+
"use strict";
|
|
87844
|
+
ProjectVersionIntentType = {
|
|
87845
|
+
ProjectCreate: "project.create",
|
|
87846
|
+
ProjectUpdate: "project.update",
|
|
87847
|
+
MemberCreate: "member.create",
|
|
87848
|
+
MemberUpdate: "member.update",
|
|
87849
|
+
MemberRename: "member.rename",
|
|
87850
|
+
MemberSetValue: "member.set-value",
|
|
87851
|
+
MemberClearValue: "member.clear-value",
|
|
87852
|
+
MemberDelete: "member.delete",
|
|
87853
|
+
ClassCreate: "class.create",
|
|
87854
|
+
ClassUpdate: "class.update",
|
|
87855
|
+
ClassDelete: "class.delete",
|
|
87856
|
+
ClassAddSchemaEntry: "class.add-schema-entry",
|
|
87857
|
+
ConstructorCreate: "constructor.create",
|
|
87858
|
+
ConstructorUpdate: "constructor.update",
|
|
87859
|
+
ConstructorDelete: "constructor.delete",
|
|
87860
|
+
VariantCreate: "variant.create",
|
|
87861
|
+
VariantUpdate: "variant.update",
|
|
87862
|
+
VariantDelete: "variant.delete",
|
|
87863
|
+
VariantFolderCreate: "variant-folder.create",
|
|
87864
|
+
VariantFolderUpdate: "variant-folder.update",
|
|
87865
|
+
VariantFolderDelete: "variant-folder.delete",
|
|
87866
|
+
InternalRecordRelationCreate: "internal-record-relation.create",
|
|
87867
|
+
InternalRecordRelationUpdate: "internal-record-relation.update",
|
|
87868
|
+
InternalRecordRelationDelete: "internal-record-relation.delete",
|
|
87869
|
+
EnumCreate: "enum.create",
|
|
87870
|
+
EnumUpdate: "enum.update",
|
|
87871
|
+
EnumDelete: "enum.delete",
|
|
87872
|
+
InterfaceCreate: "interface.create",
|
|
87873
|
+
InterfaceUpdate: "interface.update",
|
|
87874
|
+
InterfaceDelete: "interface.delete",
|
|
87875
|
+
EnumOptionRename: "enum-option.rename",
|
|
87876
|
+
EnumOptionDelete: "enum-option.delete",
|
|
87877
|
+
ValueCreate: "value.create",
|
|
87878
|
+
ValueUpdate: "value.update",
|
|
87879
|
+
/** P76 §3: a row rewritten only because its member's distribution moved. */
|
|
87880
|
+
ValueRedistribute: "value.redistribute",
|
|
87881
|
+
ValueDelete: "value.delete",
|
|
87882
|
+
ValueEntryRenameKey: "value-entry.rename-key",
|
|
87883
|
+
DialogueCreate: "dialogue.create",
|
|
87884
|
+
DialogueUpdate: "dialogue.update",
|
|
87885
|
+
DialogueDelete: "dialogue.delete",
|
|
87886
|
+
DialogueNodeCreate: "dialogue-node.create",
|
|
87887
|
+
DialogueNodeUpdate: "dialogue-node.update",
|
|
87888
|
+
DialogueNodeDelete: "dialogue-node.delete",
|
|
87889
|
+
DialogueGroupCreate: "dialogue-group.create",
|
|
87890
|
+
DialogueGroupUpdate: "dialogue-group.update",
|
|
87891
|
+
DialogueGroupDelete: "dialogue-group.delete",
|
|
87892
|
+
PriorityGroupCreate: "priority-group.create",
|
|
87893
|
+
PriorityGroupUpdate: "priority-group.update",
|
|
87894
|
+
PriorityGroupDelete: "priority-group.delete",
|
|
87895
|
+
ProjectFileCreate: "project-file.create",
|
|
87896
|
+
ProjectFileUpdate: "project-file.update",
|
|
87897
|
+
ProjectFileDelete: "project-file.delete",
|
|
87898
|
+
UnityTextureTemplateCreate: "unity-texture-template.create",
|
|
87899
|
+
UnityTextureTemplateUpdate: "unity-texture-template.update",
|
|
87900
|
+
UnityTextureTemplateDelete: "unity-texture-template.delete",
|
|
87901
|
+
UnityAudioClipTemplateCreate: "unity-audio-clip-template.create",
|
|
87902
|
+
UnityAudioClipTemplateUpdate: "unity-audio-clip-template.update",
|
|
87903
|
+
UnityAudioClipTemplateDelete: "unity-audio-clip-template.delete",
|
|
87904
|
+
LocalizationConfigCreate: "localization-config.create",
|
|
87905
|
+
LocalizationConfigUpdate: "localization-config.update",
|
|
87906
|
+
LocalizationStatusCreate: "localization-status.create",
|
|
87907
|
+
LocalizationStatusUpdate: "localization-status.update",
|
|
87908
|
+
LocalizationStatusDelete: "localization-status.delete",
|
|
87909
|
+
LocalizedTextCreate: "localized-text.create",
|
|
87910
|
+
LocalizedTextUpdate: "localized-text.update",
|
|
87911
|
+
LocalizedTextDelete: "localized-text.delete",
|
|
87912
|
+
MigrationCreate: "migration.create",
|
|
87913
|
+
MigrationUpdate: "migration.update",
|
|
87914
|
+
MigrationDelete: "migration.delete"
|
|
87915
|
+
};
|
|
87916
|
+
PROJECT_VERSION_INTENT_SCHEMA_VERSION = 1;
|
|
87917
|
+
}
|
|
87918
|
+
});
|
|
87919
|
+
|
|
87920
|
+
// ../src/database/packed-value-write-fold.ts
|
|
87921
|
+
function schemaPacksAnyMember(members) {
|
|
87922
|
+
const cached = packedSchemaCache.get(members);
|
|
87923
|
+
if (cached !== void 0) return cached;
|
|
87924
|
+
let packs = false;
|
|
87925
|
+
for (const member of members) {
|
|
87926
|
+
if (effectiveMemberDistribution(member, members) !== 1 /* Packed */) {
|
|
87927
|
+
continue;
|
|
87928
|
+
}
|
|
87929
|
+
packs = true;
|
|
87930
|
+
break;
|
|
87931
|
+
}
|
|
87932
|
+
packedSchemaCache.set(members, packs);
|
|
87933
|
+
return packs;
|
|
87934
|
+
}
|
|
87935
|
+
function packableParentValueId(args) {
|
|
87936
|
+
if (args.placement.parentValueId === null) return null;
|
|
87937
|
+
if (args.row.containerId !== void 0) return null;
|
|
87938
|
+
if (args.parentRow === void 0) return null;
|
|
87939
|
+
if (args.parentRow.mapKey !== args.row.mapKey) return null;
|
|
87940
|
+
return args.placement.parentValueId;
|
|
87941
|
+
}
|
|
87942
|
+
function packedChildPlacement(args) {
|
|
87943
|
+
const placement = args.placement;
|
|
87944
|
+
if (placement === void 0) return null;
|
|
87945
|
+
const parentValueId = packableParentValueId({ ...args, placement });
|
|
87946
|
+
if (parentValueId === null) return null;
|
|
87947
|
+
if (effectiveMemberDistribution(placement.member, args.members) !== 1 /* Packed */) {
|
|
87948
|
+
return null;
|
|
87949
|
+
}
|
|
87950
|
+
return parentValueId;
|
|
87951
|
+
}
|
|
87952
|
+
function foldPackedValueRows(args) {
|
|
87953
|
+
const expanded = args.residency === void 0 ? expandWithResidency(args.rows) : { ...args.residency, logicalRows: args.rows };
|
|
87954
|
+
if (expanded.rootByPackedId.size === 0 && !schemaPacksAnyMember(args.document.members)) {
|
|
87955
|
+
return { rows: args.rows, rootByFoldedId: NO_FOLDED_IDS };
|
|
87956
|
+
}
|
|
87957
|
+
const rowsById = /* @__PURE__ */ new Map();
|
|
87958
|
+
for (const row of expanded.logicalRows) rowsById.set(row.id, row);
|
|
87959
|
+
const scope = withVariantPlacementRoots({
|
|
87960
|
+
...args.document,
|
|
87961
|
+
values: [...expanded.logicalRows]
|
|
87962
|
+
});
|
|
87963
|
+
const placements = findSemanticOwnerPlacementsForValues(
|
|
87964
|
+
scope.document,
|
|
87965
|
+
new Set(rowsById.keys()),
|
|
87966
|
+
scope.roots
|
|
87967
|
+
);
|
|
87968
|
+
const parentByPackedId = /* @__PURE__ */ new Map();
|
|
87969
|
+
for (const row of expanded.logicalRows) {
|
|
87970
|
+
const placement = placements.get(row.id);
|
|
87971
|
+
const parentValueId = packedChildPlacement({
|
|
87972
|
+
row,
|
|
87973
|
+
placement,
|
|
87974
|
+
parentRow: placement?.parentValueId == null ? void 0 : rowsById.get(placement.parentValueId),
|
|
87975
|
+
members: args.document.members
|
|
87976
|
+
});
|
|
87977
|
+
if (parentValueId !== null) {
|
|
87978
|
+
parentByPackedId.set(row.id, parentValueId);
|
|
87979
|
+
continue;
|
|
87980
|
+
}
|
|
87981
|
+
const residentParent = expanded.parentByPackedId.get(row.id);
|
|
87982
|
+
if (residentParent === void 0) continue;
|
|
87983
|
+
const residentParentRow = rowsById.get(residentParent);
|
|
87984
|
+
if (residentParentRow === void 0) continue;
|
|
87985
|
+
if (!rowNamesChild(residentParentRow, row.id)) continue;
|
|
87986
|
+
parentByPackedId.set(row.id, residentParent);
|
|
87987
|
+
}
|
|
87988
|
+
if (parentByPackedId.size === 0) {
|
|
87989
|
+
return { rows: args.rows, rootByFoldedId: NO_FOLDED_IDS };
|
|
87990
|
+
}
|
|
87991
|
+
const rootByFoldedId = /* @__PURE__ */ new Map();
|
|
87992
|
+
const packedChildIdsByParentId = /* @__PURE__ */ new Map();
|
|
87993
|
+
for (const [childId, parentId] of parentByPackedId) {
|
|
87994
|
+
const siblings = packedChildIdsByParentId.get(parentId);
|
|
87995
|
+
if (siblings === void 0) {
|
|
87996
|
+
packedChildIdsByParentId.set(parentId, [childId]);
|
|
87997
|
+
} else {
|
|
87998
|
+
siblings.push(childId);
|
|
87999
|
+
}
|
|
88000
|
+
rootByFoldedId.set(childId, distributionRootOf(childId, parentByPackedId));
|
|
88001
|
+
}
|
|
88002
|
+
const encodeRootIds = args.encodeOnlyRootIds?.(rootByFoldedId);
|
|
88003
|
+
const rows = [];
|
|
88004
|
+
for (const row of expanded.logicalRows) {
|
|
88005
|
+
if (parentByPackedId.has(row.id)) continue;
|
|
88006
|
+
if (!packedChildIdsByParentId.has(row.id)) {
|
|
88007
|
+
rows.push(row);
|
|
88008
|
+
continue;
|
|
88009
|
+
}
|
|
88010
|
+
if (encodeRootIds !== void 0 && !encodeRootIds.has(row.id)) {
|
|
88011
|
+
rows.push(row);
|
|
88012
|
+
continue;
|
|
88013
|
+
}
|
|
88014
|
+
rows.push(
|
|
88015
|
+
encodePackedValueRow({ parent: row, rowsById, packedChildIdsByParentId })
|
|
88016
|
+
);
|
|
88017
|
+
}
|
|
88018
|
+
return { rows, rootByFoldedId };
|
|
88019
|
+
}
|
|
88020
|
+
function distributionRootOf(childId, parentByPackedId) {
|
|
88021
|
+
let current = childId;
|
|
88022
|
+
for (let step = 0; step < PACKED_ANCESTOR_LIMIT; step += 1) {
|
|
88023
|
+
const parent = parentByPackedId.get(current);
|
|
88024
|
+
if (parent === void 0) return current;
|
|
88025
|
+
current = parent;
|
|
88026
|
+
}
|
|
88027
|
+
throw new PackedValueEncodingError(
|
|
88028
|
+
`Packed value "${childId}" has more than ${PACKED_ANCESTOR_LIMIT} packed ancestors, so its distribution root cannot be resolved.`
|
|
88029
|
+
);
|
|
88030
|
+
}
|
|
88031
|
+
function expandWithResidency(rows) {
|
|
88032
|
+
let firstPacked = -1;
|
|
88033
|
+
for (let index = 0; index < rows.length; index += 1) {
|
|
88034
|
+
const row = rows[index];
|
|
88035
|
+
if (row === void 0 || !rowCarriesPackedValueContent(row)) continue;
|
|
88036
|
+
firstPacked = index;
|
|
88037
|
+
break;
|
|
88038
|
+
}
|
|
88039
|
+
if (firstPacked < 0) {
|
|
88040
|
+
return {
|
|
88041
|
+
logicalRows: rows,
|
|
88042
|
+
parentByPackedId: NO_RESIDENCY,
|
|
88043
|
+
rootByPackedId: NO_RESIDENCY
|
|
88044
|
+
};
|
|
88045
|
+
}
|
|
88046
|
+
const logicalRows = rows.slice(0, firstPacked);
|
|
88047
|
+
const parentByPackedId = /* @__PURE__ */ new Map();
|
|
88048
|
+
const rootByPackedId = /* @__PURE__ */ new Map();
|
|
88049
|
+
for (let index = firstPacked; index < rows.length; index += 1) {
|
|
88050
|
+
const row = rows[index];
|
|
88051
|
+
if (row === void 0) continue;
|
|
88052
|
+
const decoded = decodePackedValueRow(row);
|
|
88053
|
+
logicalRows.push(decoded.row, ...decoded.children);
|
|
88054
|
+
for (const [parentId, childIds] of decoded.packedChildIdsByParentId) {
|
|
88055
|
+
for (const childId of childIds) {
|
|
88056
|
+
parentByPackedId.set(childId, parentId);
|
|
88057
|
+
rootByPackedId.set(childId, row.id);
|
|
88058
|
+
}
|
|
88059
|
+
}
|
|
88060
|
+
}
|
|
88061
|
+
return { logicalRows, parentByPackedId, rootByPackedId };
|
|
88062
|
+
}
|
|
88063
|
+
function foldPackedValueWriteChanges(args) {
|
|
88064
|
+
const valueChangesById = collectValueChanges(args.changes);
|
|
88065
|
+
if (valueChangesById.size === 0) return args.changes;
|
|
88066
|
+
const base = expandWithResidency(args.document.values);
|
|
88067
|
+
if (base.rootByPackedId.size === 0 && !schemaPacksAnyMember(args.document.members)) {
|
|
88068
|
+
return args.changes;
|
|
88069
|
+
}
|
|
88070
|
+
const basePhysicalById = /* @__PURE__ */ new Map();
|
|
88071
|
+
for (const row of args.document.values) basePhysicalById.set(row.id, row);
|
|
88072
|
+
const postLogicalById = /* @__PURE__ */ new Map();
|
|
88073
|
+
for (const row of base.logicalRows) postLogicalById.set(row.id, row);
|
|
88074
|
+
applyValueChanges(postLogicalById, valueChangesById);
|
|
88075
|
+
const parentByPackedId = new Map(base.parentByPackedId);
|
|
88076
|
+
const rootByPackedId = new Map(base.rootByPackedId);
|
|
88077
|
+
decodePhysicalPostRows({
|
|
88078
|
+
post: postLogicalById,
|
|
88079
|
+
valueChangesById,
|
|
88080
|
+
parentByPackedId,
|
|
88081
|
+
rootByPackedId
|
|
88082
|
+
});
|
|
88083
|
+
releaseRedistributedResidency({
|
|
88084
|
+
valueChangesById,
|
|
88085
|
+
parentByPackedId,
|
|
88086
|
+
rootByPackedId
|
|
88087
|
+
});
|
|
88088
|
+
const baseRootOf = (id2) => base.rootByPackedId.get(id2);
|
|
88089
|
+
const fold = foldPackedValueRows({
|
|
88090
|
+
rows: [...postLogicalById.values()],
|
|
88091
|
+
document: args.document,
|
|
88092
|
+
residency: { parentByPackedId, rootByPackedId },
|
|
88093
|
+
encodeOnlyRootIds: touchedRootIds(valueChangesById, baseRootOf)
|
|
88094
|
+
});
|
|
88095
|
+
return emitFoldedValueChanges({
|
|
88096
|
+
changes: args.changes,
|
|
88097
|
+
valueChangesById,
|
|
88098
|
+
fold,
|
|
88099
|
+
basePhysicalOf: (id2) => basePhysicalById.get(id2),
|
|
88100
|
+
baseRootOf
|
|
88101
|
+
});
|
|
88102
|
+
}
|
|
88103
|
+
function namedIds(container) {
|
|
88104
|
+
if (typeof container !== "object" || container === null) return [];
|
|
88105
|
+
const entries = Array.isArray(container) ? container : Object.values(container);
|
|
88106
|
+
const ids = [];
|
|
88107
|
+
for (const entry of entries) {
|
|
88108
|
+
if (typeof entry === "string") ids.push(entry);
|
|
88109
|
+
}
|
|
88110
|
+
return ids;
|
|
88111
|
+
}
|
|
88112
|
+
function collectValueChanges(changes) {
|
|
88113
|
+
const valueChangesById = /* @__PURE__ */ new Map();
|
|
88114
|
+
for (const change of changes) {
|
|
88115
|
+
if (change.recordKind !== ProjectRecordKind.Value) continue;
|
|
88116
|
+
valueChangesById.set(change.recordId, change);
|
|
88117
|
+
}
|
|
88118
|
+
return valueChangesById;
|
|
88119
|
+
}
|
|
88120
|
+
function applyValueChanges(rowsById, valueChangesById) {
|
|
88121
|
+
for (const change of valueChangesById.values()) {
|
|
88122
|
+
if (change.deleted === true) {
|
|
88123
|
+
rowsById.delete(change.recordId);
|
|
88124
|
+
continue;
|
|
88125
|
+
}
|
|
88126
|
+
if (!isMemberValue(change.nextData)) {
|
|
88127
|
+
throw new Error(
|
|
88128
|
+
`Value "${change.recordId}" cannot be prepared for packed storage because its change carries no value row.`
|
|
88129
|
+
);
|
|
88130
|
+
}
|
|
88131
|
+
rowsById.set(change.recordId, change.nextData);
|
|
88132
|
+
}
|
|
88133
|
+
}
|
|
88134
|
+
function decodePhysicalPostRows(args) {
|
|
88135
|
+
for (const change of args.valueChangesById.values()) {
|
|
88136
|
+
if (change.deleted === true) continue;
|
|
88137
|
+
const row = args.post.get(change.recordId);
|
|
88138
|
+
if (row === void 0 || !rowCarriesPackedValueContent(row)) continue;
|
|
88139
|
+
const decoded = decodePackedValueRow(row);
|
|
88140
|
+
args.post.set(decoded.row.id, decoded.row);
|
|
88141
|
+
for (const child of decoded.children) {
|
|
88142
|
+
if (args.valueChangesById.has(child.id)) continue;
|
|
88143
|
+
args.post.set(child.id, child);
|
|
88144
|
+
}
|
|
88145
|
+
for (const [parentId, childIds] of decoded.packedChildIdsByParentId) {
|
|
88146
|
+
for (const childId of childIds) {
|
|
88147
|
+
args.parentByPackedId.set(childId, parentId);
|
|
88148
|
+
args.rootByPackedId.set(childId, row.id);
|
|
88149
|
+
}
|
|
88150
|
+
}
|
|
88151
|
+
}
|
|
88152
|
+
}
|
|
88153
|
+
function releaseRedistributedResidency(args) {
|
|
88154
|
+
for (const change of args.valueChangesById.values()) {
|
|
88155
|
+
if (change.intent.type !== ProjectVersionIntentType.ValueRedistribute) {
|
|
88156
|
+
continue;
|
|
88157
|
+
}
|
|
88158
|
+
args.parentByPackedId.delete(change.recordId);
|
|
88159
|
+
args.rootByPackedId.delete(change.recordId);
|
|
88160
|
+
}
|
|
88161
|
+
}
|
|
88162
|
+
function rowNamesChild(parent, childId) {
|
|
88163
|
+
if (namedIds(parent.value).includes(childId)) return true;
|
|
88164
|
+
if (!isLiteralValueContent(parent)) return false;
|
|
88165
|
+
return namedIds(parent.constructorArgs).includes(childId);
|
|
88166
|
+
}
|
|
88167
|
+
function touchedRootIds(valueChangesById, baseRootOf) {
|
|
88168
|
+
return (rootByFoldedId) => {
|
|
88169
|
+
const ids = /* @__PURE__ */ new Set();
|
|
88170
|
+
for (const valueId of valueChangesById.keys()) {
|
|
88171
|
+
ids.add(valueId);
|
|
88172
|
+
const foldedRoot = rootByFoldedId.get(valueId);
|
|
88173
|
+
if (foldedRoot !== void 0) ids.add(foldedRoot);
|
|
88174
|
+
const baseRoot = baseRootOf(valueId);
|
|
88175
|
+
if (baseRoot !== void 0) ids.add(baseRoot);
|
|
88176
|
+
}
|
|
88177
|
+
return ids;
|
|
88178
|
+
};
|
|
88179
|
+
}
|
|
88180
|
+
function emitFoldedValueChanges(args) {
|
|
88181
|
+
const { valueChangesById, fold } = args;
|
|
88182
|
+
const postPhysicalById = /* @__PURE__ */ new Map();
|
|
88183
|
+
for (const row of fold.rows) postPhysicalById.set(row.id, row);
|
|
88184
|
+
const originByPhysicalId = /* @__PURE__ */ new Map();
|
|
88185
|
+
const remember = (physicalId, origin) => {
|
|
88186
|
+
if (physicalId === void 0) return;
|
|
88187
|
+
if (originByPhysicalId.has(physicalId)) return;
|
|
88188
|
+
originByPhysicalId.set(physicalId, origin);
|
|
88189
|
+
};
|
|
88190
|
+
for (const [valueId, change] of valueChangesById) remember(valueId, change);
|
|
88191
|
+
for (const [valueId, change] of valueChangesById) {
|
|
88192
|
+
remember(fold.rootByFoldedId.get(valueId), change);
|
|
88193
|
+
remember(args.baseRootOf(valueId), change);
|
|
88194
|
+
}
|
|
88195
|
+
const folded = [];
|
|
88196
|
+
const emittedIds = /* @__PURE__ */ new Set();
|
|
88197
|
+
const emit = (change) => {
|
|
88198
|
+
if (emittedIds.has(change.recordId)) return;
|
|
88199
|
+
emittedIds.add(change.recordId);
|
|
88200
|
+
folded.push(change);
|
|
88201
|
+
};
|
|
88202
|
+
const removeRecord = (recordId, origin) => {
|
|
88203
|
+
emit({
|
|
88204
|
+
...carriedChangeFields(origin, recordId),
|
|
88205
|
+
recordKind: ProjectRecordKind.Value,
|
|
88206
|
+
recordId,
|
|
88207
|
+
operation: ProjectVersionRecordOperation.Delete,
|
|
88208
|
+
deleted: true
|
|
88209
|
+
});
|
|
88210
|
+
};
|
|
88211
|
+
const emitPhysical = (physicalId, origin, requested) => {
|
|
88212
|
+
const next = postPhysicalById.get(physicalId);
|
|
88213
|
+
const storedBase = args.basePhysicalOf(physicalId);
|
|
88214
|
+
if (next === void 0) {
|
|
88215
|
+
if (storedBase === void 0) return;
|
|
88216
|
+
removeRecord(physicalId, origin);
|
|
88217
|
+
return;
|
|
88218
|
+
}
|
|
88219
|
+
if (!requested && storedBase !== void 0 && rowsAreIdentical(storedBase, next)) {
|
|
88220
|
+
return;
|
|
88221
|
+
}
|
|
88222
|
+
emit({
|
|
88223
|
+
...carriedChangeFields(origin, physicalId),
|
|
88224
|
+
recordKind: ProjectRecordKind.Value,
|
|
88225
|
+
recordId: physicalId,
|
|
88226
|
+
operation: storedBase === void 0 ? ProjectVersionRecordOperation.Create : ProjectVersionRecordOperation.Update,
|
|
88227
|
+
deleted: false,
|
|
88228
|
+
nextData: next
|
|
88229
|
+
});
|
|
88230
|
+
};
|
|
88231
|
+
for (const change of args.changes) {
|
|
88232
|
+
if (change.recordKind !== ProjectRecordKind.Value) {
|
|
88233
|
+
folded.push(change);
|
|
88234
|
+
continue;
|
|
88235
|
+
}
|
|
88236
|
+
const physicalId = postPhysicalById.has(change.recordId) || args.basePhysicalOf(change.recordId) !== void 0 ? change.recordId : fold.rootByFoldedId.get(change.recordId);
|
|
88237
|
+
if (physicalId === void 0) continue;
|
|
88238
|
+
const origin = originByPhysicalId.get(physicalId) ?? change;
|
|
88239
|
+
emitPhysical(physicalId, origin, origin.recordId === physicalId);
|
|
88240
|
+
}
|
|
88241
|
+
for (const [physicalId, origin] of originByPhysicalId) {
|
|
88242
|
+
if (emittedIds.has(physicalId)) continue;
|
|
88243
|
+
emitPhysical(physicalId, origin, false);
|
|
88244
|
+
}
|
|
88245
|
+
for (const [foldedId, rootId] of fold.rootByFoldedId) {
|
|
88246
|
+
if (args.basePhysicalOf(foldedId) === void 0) continue;
|
|
88247
|
+
const origin = originByPhysicalId.get(rootId);
|
|
88248
|
+
if (origin === void 0) continue;
|
|
88249
|
+
removeRecord(foldedId, origin);
|
|
88250
|
+
}
|
|
88251
|
+
return folded;
|
|
88252
|
+
}
|
|
88253
|
+
function carriedChangeFields(origin, physicalId) {
|
|
88254
|
+
if (origin.recordId === physicalId) {
|
|
88255
|
+
const {
|
|
88256
|
+
nextData: _nextData,
|
|
88257
|
+
recordKind: _recordKind,
|
|
88258
|
+
recordId: _recordId,
|
|
88259
|
+
operation: _operation,
|
|
88260
|
+
deleted: _deleted,
|
|
88261
|
+
...carried
|
|
88262
|
+
} = origin;
|
|
88263
|
+
return carried;
|
|
88264
|
+
}
|
|
88265
|
+
return { intent: origin.intent };
|
|
88266
|
+
}
|
|
88267
|
+
function rowsAreIdentical(left, right) {
|
|
88268
|
+
if (left === right) return true;
|
|
87067
88269
|
return canonicalJsonStringify(left) === canonicalJsonStringify(right);
|
|
87068
88270
|
}
|
|
87069
|
-
function
|
|
87070
|
-
|
|
87071
|
-
|
|
87072
|
-
|
|
87073
|
-
|
|
87074
|
-
|
|
87075
|
-
|
|
87076
|
-
if (!
|
|
87077
|
-
|
|
88271
|
+
function expandPackedValueWriteChanges(args) {
|
|
88272
|
+
const decodedByValueId = /* @__PURE__ */ new Map();
|
|
88273
|
+
const directValueIds = /* @__PURE__ */ new Set();
|
|
88274
|
+
for (const change of args.changes) {
|
|
88275
|
+
if (change.recordKind !== ProjectRecordKind.Value) continue;
|
|
88276
|
+
if (isDeleteChange(change)) continue;
|
|
88277
|
+
directValueIds.add(change.recordId);
|
|
88278
|
+
if (!isMemberValue(change.nextData)) continue;
|
|
88279
|
+
if (!rowCarriesPackedValueContent(change.nextData)) continue;
|
|
88280
|
+
decodedByValueId.set(
|
|
88281
|
+
change.recordId,
|
|
88282
|
+
decodePackedValueRow(change.nextData)
|
|
88283
|
+
);
|
|
88284
|
+
}
|
|
88285
|
+
if (decodedByValueId.size === 0) return args.changes;
|
|
88286
|
+
const packedChildIds = /* @__PURE__ */ new Set();
|
|
88287
|
+
for (const decoded of decodedByValueId.values()) {
|
|
88288
|
+
for (const child of decoded.children) packedChildIds.add(child.id);
|
|
88289
|
+
}
|
|
88290
|
+
const baseValueIds = /* @__PURE__ */ new Set();
|
|
88291
|
+
for (const row of args.baseValues) baseValueIds.add(row.id);
|
|
88292
|
+
const expanded = [];
|
|
88293
|
+
for (const change of args.changes) {
|
|
88294
|
+
if (change.recordKind !== ProjectRecordKind.Value) {
|
|
88295
|
+
expanded.push(change);
|
|
88296
|
+
continue;
|
|
88297
|
+
}
|
|
88298
|
+
if (isDeleteChange(change) && packedChildIds.has(change.recordId)) continue;
|
|
88299
|
+
const decoded = decodedByValueId.get(change.recordId);
|
|
88300
|
+
if (decoded === void 0) {
|
|
88301
|
+
expanded.push(change);
|
|
88302
|
+
continue;
|
|
88303
|
+
}
|
|
88304
|
+
expanded.push({ ...change, nextData: decoded.row });
|
|
88305
|
+
for (const child of decoded.children) {
|
|
88306
|
+
if (directValueIds.has(child.id)) continue;
|
|
88307
|
+
expanded.push({
|
|
88308
|
+
intent: change.intent,
|
|
88309
|
+
recordKind: ProjectRecordKind.Value,
|
|
88310
|
+
recordId: child.id,
|
|
88311
|
+
operation: baseValueIds.has(child.id) ? ProjectVersionRecordOperation.Update : ProjectVersionRecordOperation.Create,
|
|
88312
|
+
deleted: false,
|
|
88313
|
+
nextData: child
|
|
88314
|
+
});
|
|
87078
88315
|
}
|
|
87079
|
-
return value;
|
|
87080
88316
|
}
|
|
87081
|
-
|
|
87082
|
-
|
|
88317
|
+
return expanded;
|
|
88318
|
+
}
|
|
88319
|
+
function isDeleteChange(change) {
|
|
88320
|
+
if (change.operation === ProjectVersionRecordOperation.Delete) return true;
|
|
88321
|
+
return change.deleted === true;
|
|
88322
|
+
}
|
|
88323
|
+
var NO_FOLDED_IDS, PACKED_ANCESTOR_LIMIT, packedSchemaCache, NO_RESIDENCY;
|
|
88324
|
+
var init_packed_value_write_fold = __esm({
|
|
88325
|
+
"../src/database/packed-value-write-fold.ts"() {
|
|
88326
|
+
"use strict";
|
|
88327
|
+
init_project2();
|
|
88328
|
+
init_member_kinds();
|
|
88329
|
+
init_effective_distribution();
|
|
88330
|
+
init_member_subtree_distribution();
|
|
88331
|
+
init_packed_value_encoding();
|
|
88332
|
+
init_canonical_json();
|
|
88333
|
+
init_constructor_argument_ownership();
|
|
88334
|
+
init_variant_value_graph();
|
|
88335
|
+
init_project_version_intents();
|
|
88336
|
+
NO_FOLDED_IDS = /* @__PURE__ */ new Map();
|
|
88337
|
+
PACKED_ANCESTOR_LIMIT = 512;
|
|
88338
|
+
packedSchemaCache = /* @__PURE__ */ new WeakMap();
|
|
88339
|
+
NO_RESIDENCY = /* @__PURE__ */ new Map();
|
|
87083
88340
|
}
|
|
87084
|
-
|
|
87085
|
-
|
|
88341
|
+
});
|
|
88342
|
+
|
|
88343
|
+
// src/project-source/packed-value-parity.ts
|
|
88344
|
+
function logicalValueBaseRecordsV4(records2) {
|
|
88345
|
+
let expanded = null;
|
|
88346
|
+
for (const [key, record3] of Object.entries(records2)) {
|
|
88347
|
+
if (record3.recordKind !== "value") continue;
|
|
88348
|
+
if (!isObjectRecord2(record3.data)) continue;
|
|
88349
|
+
if (!rowCarriesPackedValueContent(record3.data)) continue;
|
|
88350
|
+
if (!isMemberValue(record3.data)) {
|
|
88351
|
+
throw new PackedValueEncodingError(
|
|
88352
|
+
`Workspace base row "${key}" packs a child but is not a well-formed value row, so its packed payload cannot be expanded.`
|
|
88353
|
+
);
|
|
88354
|
+
}
|
|
88355
|
+
const decoded = decodePackedValueRow(record3.data);
|
|
88356
|
+
expanded ??= { ...records2 };
|
|
88357
|
+
expanded[key] = { ...record3, data: decoded.row };
|
|
88358
|
+
for (const child of decoded.children) {
|
|
88359
|
+
expanded[`value:${child.id}`] = {
|
|
88360
|
+
recordKind: "value",
|
|
88361
|
+
recordId: child.id,
|
|
88362
|
+
contentHash: record3.contentHash,
|
|
88363
|
+
...record3.file === void 0 ? {} : { file: record3.file },
|
|
88364
|
+
data: child
|
|
88365
|
+
};
|
|
88366
|
+
}
|
|
87086
88367
|
}
|
|
87087
|
-
|
|
87088
|
-
|
|
88368
|
+
return expanded ?? records2;
|
|
88369
|
+
}
|
|
88370
|
+
function foldCandidateValueRowsV4(args) {
|
|
88371
|
+
if (args.candidates.size === 0) return EMPTY_FOLD;
|
|
88372
|
+
const rows = [];
|
|
88373
|
+
const inputById = /* @__PURE__ */ new Map();
|
|
88374
|
+
for (const [valueId, body] of args.candidates) {
|
|
88375
|
+
const row = completeCandidateRow(valueId, body, args.base, args.projectId);
|
|
88376
|
+
if (row === null) return EMPTY_FOLD;
|
|
88377
|
+
rows.push(row);
|
|
88378
|
+
inputById.set(valueId, row);
|
|
88379
|
+
}
|
|
88380
|
+
const fold = foldPackedValueRows({ rows, document: args.schema });
|
|
88381
|
+
if (fold.rootByFoldedId.size === 0) return EMPTY_FOLD;
|
|
88382
|
+
const adoptedRootIds = /* @__PURE__ */ new Set();
|
|
88383
|
+
for (const [childId, rootId] of fold.rootByFoldedId) {
|
|
88384
|
+
if (adoptedRootIds.has(rootId)) continue;
|
|
88385
|
+
if (!args.touchedValueIds.has(childId) && !args.touchedValueIds.has(rootId))
|
|
88386
|
+
continue;
|
|
88387
|
+
adoptedRootIds.add(rootId);
|
|
87089
88388
|
}
|
|
87090
|
-
if (
|
|
87091
|
-
|
|
87092
|
-
|
|
87093
|
-
|
|
87094
|
-
|
|
88389
|
+
if (adoptedRootIds.size === 0) return EMPTY_FOLD;
|
|
88390
|
+
const foldedValueIds = /* @__PURE__ */ new Set();
|
|
88391
|
+
for (const [childId, rootId] of fold.rootByFoldedId) {
|
|
88392
|
+
if (adoptedRootIds.has(rootId)) foldedValueIds.add(childId);
|
|
88393
|
+
}
|
|
88394
|
+
const bodyByValueId = /* @__PURE__ */ new Map();
|
|
88395
|
+
for (const row of fold.rows) {
|
|
88396
|
+
if (!adoptedRootIds.has(row.id)) continue;
|
|
88397
|
+
if (row === inputById.get(row.id)) continue;
|
|
88398
|
+
const candidate = args.candidates.get(row.id);
|
|
88399
|
+
if (candidate === void 0) {
|
|
88400
|
+
throw new PackedValueEncodingError(
|
|
88401
|
+
`Packed fold produced a physical row for "${row.id}", which is not a candidate value row of this push.`
|
|
88402
|
+
);
|
|
88403
|
+
}
|
|
88404
|
+
bodyByValueId.set(row.id, storedContentApplied(candidate, row));
|
|
88405
|
+
}
|
|
88406
|
+
return { bodyByValueId, foldedValueIds };
|
|
88407
|
+
}
|
|
88408
|
+
function completeCandidateRow(valueId, body, base, projectId) {
|
|
88409
|
+
if (isMemberValue(body)) return body;
|
|
88410
|
+
const stored = base[`value:${valueId}`]?.data;
|
|
88411
|
+
const envelope = isObjectRecord2(stored) ? stored : void 0;
|
|
88412
|
+
const completed = { ...body, id: valueId };
|
|
88413
|
+
if (typeof completed.projectId !== "string") {
|
|
88414
|
+
completed.projectId = projectId;
|
|
88415
|
+
}
|
|
88416
|
+
if (!isEpochMillis(completed.createdAt)) {
|
|
88417
|
+
completed.createdAt = isEpochMillis(envelope?.createdAt) ? envelope.createdAt : 0;
|
|
88418
|
+
}
|
|
88419
|
+
if (!isEpochMillis(completed.updatedAt)) {
|
|
88420
|
+
completed.updatedAt = isEpochMillis(envelope?.updatedAt) ? envelope.updatedAt : 0;
|
|
88421
|
+
}
|
|
88422
|
+
return isMemberValue(completed) ? completed : null;
|
|
88423
|
+
}
|
|
88424
|
+
function storedContentApplied(candidate, row) {
|
|
88425
|
+
if (!isLiteralValueContent(row)) {
|
|
88426
|
+
throw new PackedValueEncodingError(
|
|
88427
|
+
`Packed fold rewrote value "${row.id}", which stores an initializer rather than a literal body.`
|
|
88428
|
+
);
|
|
88429
|
+
}
|
|
88430
|
+
const applied = { ...candidate, value: row.value };
|
|
88431
|
+
if (Object.hasOwn(row, "constructorArgs")) {
|
|
88432
|
+
applied.constructorArgs = row.constructorArgs;
|
|
88433
|
+
} else {
|
|
88434
|
+
delete applied.constructorArgs;
|
|
88435
|
+
}
|
|
88436
|
+
return applied;
|
|
88437
|
+
}
|
|
88438
|
+
var EMPTY_FOLD;
|
|
88439
|
+
var init_packed_value_parity = __esm({
|
|
88440
|
+
"src/project-source/packed-value-parity.ts"() {
|
|
88441
|
+
"use strict";
|
|
88442
|
+
init_core();
|
|
88443
|
+
init_members();
|
|
88444
|
+
init_packed_value_write_fold();
|
|
88445
|
+
init_projection();
|
|
88446
|
+
EMPTY_FOLD = {
|
|
88447
|
+
bodyByValueId: /* @__PURE__ */ new Map(),
|
|
88448
|
+
foldedValueIds: /* @__PURE__ */ new Set()
|
|
88449
|
+
};
|
|
88450
|
+
}
|
|
88451
|
+
});
|
|
88452
|
+
|
|
88453
|
+
// ../src/database/headless-virtual-instance-lookups.ts
|
|
88454
|
+
function headlessVirtualInstanceLookups(document, options = {}) {
|
|
88455
|
+
const members = document.members;
|
|
88456
|
+
const expandedDocument = expandPackedDocumentValues(document);
|
|
88457
|
+
const values = expandedDocument.values;
|
|
88458
|
+
const indexed = makeEvaluatorLookups(
|
|
88459
|
+
members,
|
|
88460
|
+
values,
|
|
88461
|
+
options.includeValueGraphIndexes === true ? {
|
|
88462
|
+
includeValueGraphIndexes: true,
|
|
88463
|
+
constructorInitializerDocument: {
|
|
88464
|
+
classes: document.classes,
|
|
88465
|
+
members,
|
|
88466
|
+
values
|
|
88467
|
+
}
|
|
88468
|
+
} : {}
|
|
88469
|
+
);
|
|
88470
|
+
const virtual = createHeadlessVirtualInstanceResolver({
|
|
88471
|
+
document: {
|
|
88472
|
+
...expandedDocument,
|
|
88473
|
+
...options.initializerCompiler === void 0 ? {} : { initializerCompiler: options.initializerCompiler }
|
|
88474
|
+
},
|
|
88475
|
+
// A thunk: the resolver resolves nested reads through the lookups being
|
|
88476
|
+
// built around it.
|
|
88477
|
+
resolverLookups: () => lookups
|
|
88478
|
+
});
|
|
88479
|
+
const lookups = {
|
|
88480
|
+
...indexed,
|
|
88481
|
+
// Raw first, then virtual: a materialized row always wins over the
|
|
88482
|
+
// expansion that would otherwise answer for it.
|
|
88483
|
+
valueById: (id2) => indexed.valueById(id2) ?? virtual.valueById(id2),
|
|
88484
|
+
rowForValueReference: (value) => indexed.rowForValueReference(value) ?? virtual.rowForValueReference(value),
|
|
88485
|
+
virtualInstanceRowsForValue: (receiverValueId) => virtual.virtualInstanceRowsForValue(receiverValueId),
|
|
88486
|
+
// Stored-construction replay evaluates `ToVariant`, and production's
|
|
88487
|
+
// variant-constructed placements collapse through exactly this path.
|
|
88488
|
+
resolveVariantInstanceGraph: (args) => resolveVariantInstanceGraphForDocument({
|
|
88489
|
+
document,
|
|
88490
|
+
resolverLookups: lookups,
|
|
88491
|
+
...args
|
|
88492
|
+
}),
|
|
88493
|
+
// A write to a virtual key must MATERIALIZE it (a pin row at the
|
|
88494
|
+
// deterministic virtual id plus the sparse spine); the planner needs the
|
|
88495
|
+
// owning graph, not just its rows.
|
|
88496
|
+
virtualInstanceGraphForValue: (valueId) => virtual.virtualInstanceGraphForValue(valueId)
|
|
88497
|
+
};
|
|
88498
|
+
return lookups;
|
|
88499
|
+
}
|
|
88500
|
+
var init_headless_virtual_instance_lookups = __esm({
|
|
88501
|
+
"../src/database/headless-virtual-instance-lookups.ts"() {
|
|
88502
|
+
"use strict";
|
|
88503
|
+
init_virtual_instance_values();
|
|
88504
|
+
init_packed_value_encoding();
|
|
88505
|
+
init_neoscript_evaluator();
|
|
88506
|
+
}
|
|
88507
|
+
});
|
|
88508
|
+
|
|
88509
|
+
// src/evaluator-lookups.ts
|
|
88510
|
+
function cliEvaluatorLookups(document, options = {}) {
|
|
88511
|
+
return cliEvaluatorRuntime(document, options).databaseVM;
|
|
88512
|
+
}
|
|
88513
|
+
function cliEvaluatorRuntime(document, options = {}) {
|
|
88514
|
+
const initializerCompiler = isPulledInitializerCompilationDocumentV4(document) ? pulledInitializerCompilerV4(document) : void 0;
|
|
88515
|
+
const databaseVM = headlessVirtualInstanceLookups(document, {
|
|
88516
|
+
...options,
|
|
88517
|
+
...initializerCompiler === void 0 ? {} : { initializerCompiler }
|
|
88518
|
+
});
|
|
88519
|
+
return {
|
|
88520
|
+
databaseVM,
|
|
88521
|
+
...initializerCompiler === void 0 ? {} : { initializerCompiler }
|
|
88522
|
+
};
|
|
88523
|
+
}
|
|
88524
|
+
function cliEvaluatorReceiverValue(lookups, valueId) {
|
|
88525
|
+
if (typeof valueId !== "string") return null;
|
|
88526
|
+
return lookups.valueById(valueId)?.value ?? null;
|
|
88527
|
+
}
|
|
88528
|
+
var init_evaluator_lookups = __esm({
|
|
88529
|
+
"src/evaluator-lookups.ts"() {
|
|
88530
|
+
"use strict";
|
|
88531
|
+
init_headless_virtual_instance_lookups();
|
|
88532
|
+
init_initializer_replay();
|
|
88533
|
+
}
|
|
88534
|
+
});
|
|
88535
|
+
|
|
88536
|
+
// src/project-source/materialized-construction-cache.ts
|
|
88537
|
+
import { mkdirSync as mkdirSync3, readFileSync as readFileSync3, renameSync, writeFileSync as writeFileSync3 } from "node:fs";
|
|
88538
|
+
import { createHash as createHash3 } from "node:crypto";
|
|
88539
|
+
import { dirname as dirname2, join as join3 } from "node:path";
|
|
88540
|
+
function createMaterializedConstructionExpressionsV1(args) {
|
|
88541
|
+
const warm = args.useBuildCaches ? readMaterializedConstructionBuildCacheV2(args.root, args.state) : null;
|
|
88542
|
+
const emitted = /* @__PURE__ */ new Map();
|
|
88543
|
+
const overrideKeys = /* @__PURE__ */ new Map();
|
|
88544
|
+
let emitters;
|
|
88545
|
+
return {
|
|
88546
|
+
get(valueId) {
|
|
88547
|
+
const cached = warm?.expressions.get(valueId);
|
|
88548
|
+
if (cached !== void 0) return cached;
|
|
88549
|
+
if (emitted.has(valueId)) return emitted.get(valueId);
|
|
88550
|
+
emitters ??= storedConstructionEmitters(args.state, args.manifest);
|
|
88551
|
+
const expression = emitters.construction(valueId);
|
|
88552
|
+
emitted.set(valueId, expression);
|
|
88553
|
+
return expression;
|
|
88554
|
+
},
|
|
88555
|
+
overrideSchemaKeys(valueId) {
|
|
88556
|
+
const cached = warm?.overrideKeys.get(valueId);
|
|
88557
|
+
if (cached !== void 0) return cached;
|
|
88558
|
+
if (overrideKeys.has(valueId)) return overrideKeys.get(valueId);
|
|
88559
|
+
emitters ??= storedConstructionEmitters(args.state, args.manifest);
|
|
88560
|
+
const keys = emitters.overrideSchemaKeys(valueId);
|
|
88561
|
+
overrideKeys.set(valueId, keys);
|
|
88562
|
+
return keys;
|
|
88563
|
+
}
|
|
88564
|
+
};
|
|
88565
|
+
}
|
|
88566
|
+
function storedConstructionEmitters(state, manifest) {
|
|
88567
|
+
const records2 = /* @__PURE__ */ new Map();
|
|
88568
|
+
const candidateRoots = /* @__PURE__ */ new Set();
|
|
88569
|
+
for (const record3 of Object.values(state.records)) {
|
|
88570
|
+
records2.set(`${record3.recordKind}:${record3.recordId}`, {
|
|
88571
|
+
recordKind: record3.recordKind,
|
|
88572
|
+
recordId: record3.recordId,
|
|
88573
|
+
contentHash: record3.contentHash,
|
|
88574
|
+
deleted: false,
|
|
88575
|
+
data: record3.data
|
|
87095
88576
|
});
|
|
88577
|
+
if (record3.recordKind !== "value") continue;
|
|
88578
|
+
if (!isObjectRecord2(record3.data)) continue;
|
|
88579
|
+
if (!isObjectRecord2(record3.data.value)) continue;
|
|
88580
|
+
const constructorArgs = record3.data.constructorArgs;
|
|
88581
|
+
const hasInstanceProvenance = carriesStoredInstanceProvenance(record3.data);
|
|
88582
|
+
if (constructorArgs !== void 0 && constructorArgs !== null && !hasInstanceProvenance) {
|
|
88583
|
+
continue;
|
|
88584
|
+
}
|
|
88585
|
+
candidateRoots.add(record3.recordId);
|
|
87096
88586
|
}
|
|
87097
|
-
const
|
|
87098
|
-
const
|
|
87099
|
-
|
|
87100
|
-
|
|
87101
|
-
|
|
87102
|
-
|
|
88587
|
+
const document = readPulledProjectDocumentV4(records2);
|
|
88588
|
+
const owners = resolveOwnerMembersForValues(document, candidateRoots);
|
|
88589
|
+
const storedPlacements = buildStoredValuePlacementIndexV4(records2.values());
|
|
88590
|
+
const membersById2 = new Map(
|
|
88591
|
+
document.members.map((member) => [member.id, member])
|
|
88592
|
+
);
|
|
88593
|
+
for (const valueId of candidateRoots) {
|
|
88594
|
+
if (owners.has(valueId)) continue;
|
|
88595
|
+
const memberId = storedPlacements.placementByChildValueId.get(valueId)?.memberId;
|
|
88596
|
+
const member = memberId === null || memberId === void 0 ? void 0 : membersById2.get(memberId);
|
|
88597
|
+
if (member !== void 0) owners.set(valueId, member);
|
|
87103
88598
|
}
|
|
87104
|
-
|
|
88599
|
+
const probe = createStoredConstructionProbeV4(records2, manifest);
|
|
88600
|
+
let parents;
|
|
88601
|
+
const parentByChildId = () => parents ??= storedValueParentIndex(records2, storedPlacements);
|
|
88602
|
+
const root = (valueId) => {
|
|
88603
|
+
const member = owners.get(valueId);
|
|
88604
|
+
return member === void 0 ? void 0 : {
|
|
88605
|
+
member,
|
|
88606
|
+
valueId
|
|
88607
|
+
};
|
|
88608
|
+
};
|
|
88609
|
+
const probedRootIds = /* @__PURE__ */ new Set();
|
|
88610
|
+
const probeRootOnce = (rootValueId, ownedRoot) => {
|
|
88611
|
+
if (probedRootIds.has(rootValueId)) {
|
|
88612
|
+
return /* @__PURE__ */ new Set();
|
|
88613
|
+
}
|
|
88614
|
+
probedRootIds.add(rootValueId);
|
|
88615
|
+
return probe.overrideKeys(ownedRoot);
|
|
88616
|
+
};
|
|
88617
|
+
return {
|
|
88618
|
+
construction(valueId) {
|
|
88619
|
+
const ownedRoot = root(valueId);
|
|
88620
|
+
if (ownedRoot === void 0) return void 0;
|
|
88621
|
+
return probe.construction(ownedRoot);
|
|
88622
|
+
},
|
|
88623
|
+
overrideSchemaKeys(valueId) {
|
|
88624
|
+
const recorded = probe.overrideKeysOf(valueId);
|
|
88625
|
+
if (recorded !== void 0) return recorded;
|
|
88626
|
+
const ownedRoot = root(valueId);
|
|
88627
|
+
if (ownedRoot !== void 0) return probeRootOnce(valueId, ownedRoot);
|
|
88628
|
+
const ancestor = nearestOwnedAncestor(valueId, parentByChildId(), owners);
|
|
88629
|
+
if (ancestor === null) return void 0;
|
|
88630
|
+
const ancestorRoot = root(ancestor);
|
|
88631
|
+
if (ancestorRoot === void 0) return void 0;
|
|
88632
|
+
if (probedRootIds.has(ancestor)) return void 0;
|
|
88633
|
+
probeRootOnce(ancestor, ancestorRoot);
|
|
88634
|
+
return probe.overrideKeysOf(valueId);
|
|
88635
|
+
}
|
|
88636
|
+
};
|
|
87105
88637
|
}
|
|
87106
|
-
|
|
87107
|
-
|
|
88638
|
+
function storedValueParentIndex(records2, placements) {
|
|
88639
|
+
const parents = /* @__PURE__ */ new Map();
|
|
88640
|
+
const values = storedValueRowsByIdV4(records2.values());
|
|
88641
|
+
for (const [valueId, data] of values) {
|
|
88642
|
+
const containerId = data.containerId;
|
|
88643
|
+
if (typeof containerId === "string" && values.has(containerId)) {
|
|
88644
|
+
parents.set(valueId, containerId);
|
|
88645
|
+
}
|
|
88646
|
+
const body = data.value;
|
|
88647
|
+
if (Array.isArray(body)) {
|
|
88648
|
+
for (const entry of body) {
|
|
88649
|
+
if (typeof entry === "string" && values.has(entry)) {
|
|
88650
|
+
parents.set(entry, valueId);
|
|
88651
|
+
}
|
|
88652
|
+
}
|
|
88653
|
+
continue;
|
|
88654
|
+
}
|
|
88655
|
+
if (!isObjectRecord2(body)) continue;
|
|
88656
|
+
for (const child of Object.values(body)) {
|
|
88657
|
+
if (typeof child === "string" && values.has(child)) {
|
|
88658
|
+
parents.set(child, valueId);
|
|
88659
|
+
}
|
|
88660
|
+
}
|
|
88661
|
+
}
|
|
88662
|
+
for (const edge of placements.placementByChildValueId.values()) {
|
|
88663
|
+
if (edge.source !== "constructor") continue;
|
|
88664
|
+
if (!parents.has(edge.childValueId)) {
|
|
88665
|
+
parents.set(edge.childValueId, edge.parentValueId);
|
|
88666
|
+
}
|
|
88667
|
+
}
|
|
88668
|
+
return parents;
|
|
88669
|
+
}
|
|
88670
|
+
function nearestOwnedAncestor(valueId, parents, owners) {
|
|
88671
|
+
const seen = /* @__PURE__ */ new Set([valueId]);
|
|
88672
|
+
let cursor = parents.get(valueId);
|
|
88673
|
+
while (cursor !== void 0 && !seen.has(cursor)) {
|
|
88674
|
+
if (owners.has(cursor)) return cursor;
|
|
88675
|
+
seen.add(cursor);
|
|
88676
|
+
cursor = parents.get(cursor);
|
|
88677
|
+
}
|
|
88678
|
+
return null;
|
|
88679
|
+
}
|
|
88680
|
+
function carriesStoredInstanceProvenance(value) {
|
|
88681
|
+
return isVirtualInstanceRootShape(value);
|
|
88682
|
+
}
|
|
88683
|
+
function readMaterializedConstructionBuildCacheV2(root, state) {
|
|
88684
|
+
try {
|
|
88685
|
+
const parsed = JSON.parse(
|
|
88686
|
+
readFileSync3(
|
|
88687
|
+
join3(root, MATERIALIZED_CONSTRUCTION_BUILD_CACHE_PATH),
|
|
88688
|
+
"utf8"
|
|
88689
|
+
)
|
|
88690
|
+
);
|
|
88691
|
+
if (parsed === null || typeof parsed !== "object") return null;
|
|
88692
|
+
const cache = parsed;
|
|
88693
|
+
if (cache.revision !== MATERIALIZED_CONSTRUCTION_BUILD_CACHE_REVISION || cache.stateFingerprint !== materializedConstructionStateFingerprint(state) || cache.expressions === null || typeof cache.expressions !== "object" || Array.isArray(cache.expressions)) {
|
|
88694
|
+
return null;
|
|
88695
|
+
}
|
|
88696
|
+
const expressions = /* @__PURE__ */ new Map();
|
|
88697
|
+
for (const [valueId, expression] of Object.entries(cache.expressions)) {
|
|
88698
|
+
if (typeof expression !== "string") return null;
|
|
88699
|
+
expressions.set(valueId, expression);
|
|
88700
|
+
}
|
|
88701
|
+
const overrideKeys = /* @__PURE__ */ new Map();
|
|
88702
|
+
if (cache.overrideKeys !== void 0) {
|
|
88703
|
+
if (cache.overrideKeys === null || typeof cache.overrideKeys !== "object" || Array.isArray(cache.overrideKeys)) {
|
|
88704
|
+
return null;
|
|
88705
|
+
}
|
|
88706
|
+
for (const [valueId, keys] of Object.entries(cache.overrideKeys)) {
|
|
88707
|
+
if (!Array.isArray(keys) || keys.some((key) => typeof key !== "string")) {
|
|
88708
|
+
return null;
|
|
88709
|
+
}
|
|
88710
|
+
overrideKeys.set(valueId, new Set(keys));
|
|
88711
|
+
}
|
|
88712
|
+
}
|
|
88713
|
+
return { expressions, overrideKeys };
|
|
88714
|
+
} catch {
|
|
88715
|
+
return null;
|
|
88716
|
+
}
|
|
88717
|
+
}
|
|
88718
|
+
function writeMaterializedConstructionBuildCacheV2(root, state, cache) {
|
|
88719
|
+
const file = join3(root, MATERIALIZED_CONSTRUCTION_BUILD_CACHE_PATH);
|
|
88720
|
+
mkdirSync3(dirname2(file), { recursive: true });
|
|
88721
|
+
const temporary = `${file}.${process.pid}.tmp`;
|
|
88722
|
+
writeFileSync3(
|
|
88723
|
+
temporary,
|
|
88724
|
+
`${JSON.stringify({
|
|
88725
|
+
revision: MATERIALIZED_CONSTRUCTION_BUILD_CACHE_REVISION,
|
|
88726
|
+
stateFingerprint: materializedConstructionStateFingerprint(state),
|
|
88727
|
+
expressions: Object.fromEntries(
|
|
88728
|
+
[...cache.expressions].sort(
|
|
88729
|
+
([left], [right]) => left.localeCompare(right)
|
|
88730
|
+
)
|
|
88731
|
+
),
|
|
88732
|
+
overrideKeys: Object.fromEntries(
|
|
88733
|
+
[...cache.overrideKeys ?? /* @__PURE__ */ new Map()].sort(([left], [right]) => left.localeCompare(right)).map(([valueId, keys]) => [valueId, [...keys].sort()])
|
|
88734
|
+
)
|
|
88735
|
+
})}
|
|
88736
|
+
`,
|
|
88737
|
+
"utf8"
|
|
88738
|
+
);
|
|
88739
|
+
renameSync(temporary, file);
|
|
88740
|
+
}
|
|
88741
|
+
function materializedConstructionStateFingerprint(state) {
|
|
88742
|
+
const hash = createHash3("sha256");
|
|
88743
|
+
hash.update(String(MATERIALIZED_CONSTRUCTION_BUILD_CACHE_REVISION));
|
|
88744
|
+
for (const [key, record3] of Object.entries(state.records).sort(
|
|
88745
|
+
([left], [right]) => left.localeCompare(right)
|
|
88746
|
+
)) {
|
|
88747
|
+
hash.update("\0");
|
|
88748
|
+
hash.update(key);
|
|
88749
|
+
hash.update("\0");
|
|
88750
|
+
hash.update(record3.contentHash);
|
|
88751
|
+
}
|
|
88752
|
+
return hash.digest("hex");
|
|
88753
|
+
}
|
|
88754
|
+
var MATERIALIZED_CONSTRUCTION_BUILD_CACHE_PATH, MATERIALIZED_CONSTRUCTION_BUILD_CACHE_REVISION;
|
|
88755
|
+
var init_materialized_construction_cache = __esm({
|
|
88756
|
+
"src/project-source/materialized-construction-cache.ts"() {
|
|
87108
88757
|
"use strict";
|
|
88758
|
+
init_projection();
|
|
88759
|
+
init_initializer_replay();
|
|
88760
|
+
init_value_row_owner_members();
|
|
88761
|
+
init_instance_provenance();
|
|
88762
|
+
init_value_sources();
|
|
88763
|
+
init_stored_value_placements();
|
|
88764
|
+
MATERIALIZED_CONSTRUCTION_BUILD_CACHE_PATH = ".neo/build/materialized-constructions-v1.json";
|
|
88765
|
+
MATERIALIZED_CONSTRUCTION_BUILD_CACHE_REVISION = 2;
|
|
87109
88766
|
}
|
|
87110
88767
|
});
|
|
87111
88768
|
|
|
@@ -87444,7 +89101,10 @@ function generatedConstructorMemberContractChanged(current, next) {
|
|
|
87444
89101
|
"indexes",
|
|
87445
89102
|
"setter",
|
|
87446
89103
|
"setterCode",
|
|
87447
|
-
"storage"
|
|
89104
|
+
"storage",
|
|
89105
|
+
// Where a value physically lives does not change the generated
|
|
89106
|
+
// constructor's parameter contract (P76 §1).
|
|
89107
|
+
"distribution"
|
|
87448
89108
|
]);
|
|
87449
89109
|
const project = (value) => ({
|
|
87450
89110
|
...withoutFields(value, ignored),
|
|
@@ -88268,7 +89928,9 @@ function valueRowsFromWorkspace(workspace) {
|
|
|
88268
89928
|
`Workspace contains invalid value row "${record3.recordId}".`
|
|
88269
89929
|
);
|
|
88270
89930
|
}
|
|
88271
|
-
|
|
89931
|
+
const decoded = decodePackedValueRow(record3.data);
|
|
89932
|
+
rows.set(record3.recordId, decoded.row);
|
|
89933
|
+
for (const child of decoded.children) rows.set(child.id, child);
|
|
88272
89934
|
}
|
|
88273
89935
|
return rows;
|
|
88274
89936
|
}
|
|
@@ -88361,7 +90023,7 @@ function materializeInitializersLocallyV4(args) {
|
|
|
88361
90023
|
}
|
|
88362
90024
|
return [row];
|
|
88363
90025
|
});
|
|
88364
|
-
const
|
|
90026
|
+
const sparse2 = sparsifyConstructedInstance({
|
|
88365
90027
|
document,
|
|
88366
90028
|
rootMember: rootOwner,
|
|
88367
90029
|
constructed: {
|
|
@@ -88379,12 +90041,12 @@ function materializeInitializersLocallyV4(args) {
|
|
|
88379
90041
|
virtualValueIdForSource: (instanceRootId, sourceIdentity3) => isPendingId(instanceRootId) ? pendingVirtualValueId(instanceRootId, sourceIdentity3) : virtualValueId(instanceRootId, sourceIdentity3)
|
|
88380
90042
|
});
|
|
88381
90043
|
const evaluatedSparse = new Map(
|
|
88382
|
-
[
|
|
90044
|
+
[sparse2.root, ...sparse2.createdChildren].map((row) => [row.id, row])
|
|
88383
90045
|
);
|
|
88384
|
-
const root =
|
|
88385
|
-
const createdIds =
|
|
90046
|
+
const root = sparse2.root;
|
|
90047
|
+
const createdIds = sparse2.createdChildren.map((row) => row.id);
|
|
88386
90048
|
const replacements = /* @__PURE__ */ new Map();
|
|
88387
|
-
const evaluatedRows = [root, ...
|
|
90049
|
+
const evaluatedRows = [root, ...sparse2.createdChildren];
|
|
88388
90050
|
const valuesById = new Map(
|
|
88389
90051
|
document.values.map((row) => [row.id, row])
|
|
88390
90052
|
);
|
|
@@ -88590,103 +90252,6 @@ var init_local_initializer_materialization = __esm({
|
|
|
88590
90252
|
}
|
|
88591
90253
|
});
|
|
88592
90254
|
|
|
88593
|
-
// ../src/database/project-version-intents.ts
|
|
88594
|
-
function createProjectVersionIntent(type, details) {
|
|
88595
|
-
if (details === void 0) {
|
|
88596
|
-
return {
|
|
88597
|
-
type,
|
|
88598
|
-
schemaVersion: PROJECT_VERSION_INTENT_SCHEMA_VERSION
|
|
88599
|
-
};
|
|
88600
|
-
}
|
|
88601
|
-
return {
|
|
88602
|
-
type,
|
|
88603
|
-
schemaVersion: PROJECT_VERSION_INTENT_SCHEMA_VERSION,
|
|
88604
|
-
details
|
|
88605
|
-
};
|
|
88606
|
-
}
|
|
88607
|
-
function isKnownProjectVersionIntentType(value) {
|
|
88608
|
-
return Object.values(ProjectVersionIntentType).includes(
|
|
88609
|
-
value
|
|
88610
|
-
);
|
|
88611
|
-
}
|
|
88612
|
-
var ProjectVersionIntentType, PROJECT_VERSION_INTENT_SCHEMA_VERSION;
|
|
88613
|
-
var init_project_version_intents = __esm({
|
|
88614
|
-
"../src/database/project-version-intents.ts"() {
|
|
88615
|
-
"use strict";
|
|
88616
|
-
ProjectVersionIntentType = {
|
|
88617
|
-
ProjectCreate: "project.create",
|
|
88618
|
-
ProjectUpdate: "project.update",
|
|
88619
|
-
MemberCreate: "member.create",
|
|
88620
|
-
MemberUpdate: "member.update",
|
|
88621
|
-
MemberRename: "member.rename",
|
|
88622
|
-
MemberSetValue: "member.set-value",
|
|
88623
|
-
MemberClearValue: "member.clear-value",
|
|
88624
|
-
MemberDelete: "member.delete",
|
|
88625
|
-
ClassCreate: "class.create",
|
|
88626
|
-
ClassUpdate: "class.update",
|
|
88627
|
-
ClassDelete: "class.delete",
|
|
88628
|
-
ClassAddSchemaEntry: "class.add-schema-entry",
|
|
88629
|
-
ConstructorCreate: "constructor.create",
|
|
88630
|
-
ConstructorUpdate: "constructor.update",
|
|
88631
|
-
ConstructorDelete: "constructor.delete",
|
|
88632
|
-
VariantCreate: "variant.create",
|
|
88633
|
-
VariantUpdate: "variant.update",
|
|
88634
|
-
VariantDelete: "variant.delete",
|
|
88635
|
-
VariantFolderCreate: "variant-folder.create",
|
|
88636
|
-
VariantFolderUpdate: "variant-folder.update",
|
|
88637
|
-
VariantFolderDelete: "variant-folder.delete",
|
|
88638
|
-
InternalRecordRelationCreate: "internal-record-relation.create",
|
|
88639
|
-
InternalRecordRelationUpdate: "internal-record-relation.update",
|
|
88640
|
-
InternalRecordRelationDelete: "internal-record-relation.delete",
|
|
88641
|
-
EnumCreate: "enum.create",
|
|
88642
|
-
EnumUpdate: "enum.update",
|
|
88643
|
-
EnumDelete: "enum.delete",
|
|
88644
|
-
InterfaceCreate: "interface.create",
|
|
88645
|
-
InterfaceUpdate: "interface.update",
|
|
88646
|
-
InterfaceDelete: "interface.delete",
|
|
88647
|
-
EnumOptionRename: "enum-option.rename",
|
|
88648
|
-
EnumOptionDelete: "enum-option.delete",
|
|
88649
|
-
ValueCreate: "value.create",
|
|
88650
|
-
ValueUpdate: "value.update",
|
|
88651
|
-
ValueDelete: "value.delete",
|
|
88652
|
-
ValueEntryRenameKey: "value-entry.rename-key",
|
|
88653
|
-
DialogueCreate: "dialogue.create",
|
|
88654
|
-
DialogueUpdate: "dialogue.update",
|
|
88655
|
-
DialogueDelete: "dialogue.delete",
|
|
88656
|
-
DialogueNodeCreate: "dialogue-node.create",
|
|
88657
|
-
DialogueNodeUpdate: "dialogue-node.update",
|
|
88658
|
-
DialogueNodeDelete: "dialogue-node.delete",
|
|
88659
|
-
DialogueGroupCreate: "dialogue-group.create",
|
|
88660
|
-
DialogueGroupUpdate: "dialogue-group.update",
|
|
88661
|
-
DialogueGroupDelete: "dialogue-group.delete",
|
|
88662
|
-
PriorityGroupCreate: "priority-group.create",
|
|
88663
|
-
PriorityGroupUpdate: "priority-group.update",
|
|
88664
|
-
PriorityGroupDelete: "priority-group.delete",
|
|
88665
|
-
ProjectFileCreate: "project-file.create",
|
|
88666
|
-
ProjectFileUpdate: "project-file.update",
|
|
88667
|
-
ProjectFileDelete: "project-file.delete",
|
|
88668
|
-
UnityTextureTemplateCreate: "unity-texture-template.create",
|
|
88669
|
-
UnityTextureTemplateUpdate: "unity-texture-template.update",
|
|
88670
|
-
UnityTextureTemplateDelete: "unity-texture-template.delete",
|
|
88671
|
-
UnityAudioClipTemplateCreate: "unity-audio-clip-template.create",
|
|
88672
|
-
UnityAudioClipTemplateUpdate: "unity-audio-clip-template.update",
|
|
88673
|
-
UnityAudioClipTemplateDelete: "unity-audio-clip-template.delete",
|
|
88674
|
-
LocalizationConfigCreate: "localization-config.create",
|
|
88675
|
-
LocalizationConfigUpdate: "localization-config.update",
|
|
88676
|
-
LocalizationStatusCreate: "localization-status.create",
|
|
88677
|
-
LocalizationStatusUpdate: "localization-status.update",
|
|
88678
|
-
LocalizationStatusDelete: "localization-status.delete",
|
|
88679
|
-
LocalizedTextCreate: "localized-text.create",
|
|
88680
|
-
LocalizedTextUpdate: "localized-text.update",
|
|
88681
|
-
LocalizedTextDelete: "localized-text.delete",
|
|
88682
|
-
MigrationCreate: "migration.create",
|
|
88683
|
-
MigrationUpdate: "migration.update",
|
|
88684
|
-
MigrationDelete: "migration.delete"
|
|
88685
|
-
};
|
|
88686
|
-
PROJECT_VERSION_INTENT_SCHEMA_VERSION = 1;
|
|
88687
|
-
}
|
|
88688
|
-
});
|
|
88689
|
-
|
|
88690
90255
|
// src/commands/push-change-intent.ts
|
|
88691
90256
|
function createNeoCliPushIntent(change) {
|
|
88692
90257
|
const intentType = `${change.recordKind}.${change.kind}`;
|
|
@@ -93514,6 +95079,7 @@ var init_project_migration_runner = __esm({
|
|
|
93514
95079
|
init_compiler_adapter();
|
|
93515
95080
|
init_neoscript_evaluator();
|
|
93516
95081
|
init_members();
|
|
95082
|
+
init_packed_value_encoding();
|
|
93517
95083
|
init_project_root_members();
|
|
93518
95084
|
init_virtual_instance_values();
|
|
93519
95085
|
init_project_version_intents();
|
|
@@ -95691,7 +97257,9 @@ function materializeLocalizableStringWriteChanges(args) {
|
|
|
95691
97257
|
...change,
|
|
95692
97258
|
nextData: { ...change.nextData, value: textId }
|
|
95693
97259
|
};
|
|
95694
|
-
changes.
|
|
97260
|
+
changes.splice(
|
|
97261
|
+
index + 1,
|
|
97262
|
+
0,
|
|
95695
97263
|
localizedTextCreateChange({
|
|
95696
97264
|
textId,
|
|
95697
97265
|
literal: literal2,
|
|
@@ -96233,12 +97801,87 @@ function prepareServerOwnedSchemaCommit(args) {
|
|
|
96233
97801
|
document: committedDocument,
|
|
96234
97802
|
prepared
|
|
96235
97803
|
});
|
|
96236
|
-
|
|
96237
|
-
|
|
96238
|
-
|
|
96239
|
-
|
|
97804
|
+
const physical = foldPreparedPackedValueWrites({
|
|
97805
|
+
prepared,
|
|
97806
|
+
document: args.document,
|
|
97807
|
+
committedDocument
|
|
97808
|
+
});
|
|
97809
|
+
attachPreparedValuePlacements(physical, committedDocument);
|
|
97810
|
+
attachPreparedConstructorAggregateEdges(physical, committedDocument);
|
|
97811
|
+
return orderLocalizedTextWritesBesideLinks(
|
|
97812
|
+
orderVariantRootValuesWithVariants(
|
|
97813
|
+
orderDeclaredMemberCreatesFirst(physical, postDocument)
|
|
97814
|
+
)
|
|
96240
97815
|
);
|
|
96241
97816
|
}
|
|
97817
|
+
function orderLocalizedTextWritesBesideLinks(prepared) {
|
|
97818
|
+
const indexByLinkKey = /* @__PURE__ */ new Map();
|
|
97819
|
+
prepared.forEach((change, index) => {
|
|
97820
|
+
if (change.operation === "delete") return;
|
|
97821
|
+
if (change.recordKind !== "value" && change.recordKind !== "dialogue" && change.recordKind !== "dialogue-node") {
|
|
97822
|
+
return;
|
|
97823
|
+
}
|
|
97824
|
+
indexByLinkKey.set(`${change.recordKind}:${change.recordId}`, index);
|
|
97825
|
+
});
|
|
97826
|
+
if (indexByLinkKey.size === 0) return [...prepared];
|
|
97827
|
+
const followersByIndex = /* @__PURE__ */ new Map();
|
|
97828
|
+
const moved = /* @__PURE__ */ new Set();
|
|
97829
|
+
prepared.forEach((change, index) => {
|
|
97830
|
+
if (change.recordKind !== "localized-text") return;
|
|
97831
|
+
if (change.operation === "delete") return;
|
|
97832
|
+
let anchor = -1;
|
|
97833
|
+
for (const link of localizedTextLinkKeys(change.nextData)) {
|
|
97834
|
+
const linked = indexByLinkKey.get(link);
|
|
97835
|
+
if (linked !== void 0 && linked > anchor) anchor = linked;
|
|
97836
|
+
}
|
|
97837
|
+
if (anchor < 0) return;
|
|
97838
|
+
const followers = followersByIndex.get(anchor) ?? [];
|
|
97839
|
+
followers.push(change);
|
|
97840
|
+
followersByIndex.set(anchor, followers);
|
|
97841
|
+
moved.add(index);
|
|
97842
|
+
});
|
|
97843
|
+
if (moved.size === 0) return [...prepared];
|
|
97844
|
+
const ordered = [];
|
|
97845
|
+
prepared.forEach((change, index) => {
|
|
97846
|
+
if (moved.has(index)) return;
|
|
97847
|
+
ordered.push(change);
|
|
97848
|
+
const followers = followersByIndex.get(index);
|
|
97849
|
+
if (followers !== void 0) ordered.push(...followers);
|
|
97850
|
+
});
|
|
97851
|
+
return ordered;
|
|
97852
|
+
}
|
|
97853
|
+
function localizedTextLinkKeys(nextData) {
|
|
97854
|
+
const links = nextData?.links;
|
|
97855
|
+
if (!Array.isArray(links)) return [];
|
|
97856
|
+
const keys = [];
|
|
97857
|
+
for (const link of links) {
|
|
97858
|
+
if (typeof link !== "object" || link === null) continue;
|
|
97859
|
+
const { recordKind, recordId } = link;
|
|
97860
|
+
if (typeof recordKind !== "string" || typeof recordId !== "string") {
|
|
97861
|
+
continue;
|
|
97862
|
+
}
|
|
97863
|
+
keys.push(`${recordKind}:${recordId}`);
|
|
97864
|
+
}
|
|
97865
|
+
return keys;
|
|
97866
|
+
}
|
|
97867
|
+
function foldPreparedPackedValueWrites(args) {
|
|
97868
|
+
if (args.document.physicalValues === void 0) return args.prepared;
|
|
97869
|
+
const folded = foldPackedValueWriteChanges({
|
|
97870
|
+
changes: args.prepared,
|
|
97871
|
+
document: {
|
|
97872
|
+
classes: args.committedDocument.classes,
|
|
97873
|
+
members: args.committedDocument.members,
|
|
97874
|
+
constructors: args.committedDocument.constructors,
|
|
97875
|
+
// P67 §2.2. Post-transaction variants, so a variant this transaction
|
|
97876
|
+
// creates places the graph it creates with it.
|
|
97877
|
+
variants: args.committedDocument.variants,
|
|
97878
|
+
variantFolders: args.committedDocument.variantFolders,
|
|
97879
|
+
values: args.document.physicalValues
|
|
97880
|
+
}
|
|
97881
|
+
});
|
|
97882
|
+
if (folded === args.prepared) return args.prepared;
|
|
97883
|
+
return [...folded];
|
|
97884
|
+
}
|
|
96242
97885
|
function attachPreparedValuePlacements(prepared, document) {
|
|
96243
97886
|
const creates = prepared.filter(
|
|
96244
97887
|
(change) => change.recordKind === "value" && change.operation === "create"
|
|
@@ -96449,7 +98092,7 @@ function materializePreparedInstanceInitializers(args) {
|
|
|
96449
98092
|
constructionBaselineReplay: true,
|
|
96450
98093
|
storedConstructionReplay: true
|
|
96451
98094
|
});
|
|
96452
|
-
const
|
|
98095
|
+
const sparse2 = sparsifyConstructedInstance({
|
|
96453
98096
|
document: materializationScope.document,
|
|
96454
98097
|
rootMember: member,
|
|
96455
98098
|
constructed: {
|
|
@@ -96469,9 +98112,9 @@ function materializePreparedInstanceInitializers(args) {
|
|
|
96469
98112
|
if (original === void 0) continue;
|
|
96470
98113
|
args.prepared[site.index] = {
|
|
96471
98114
|
...original,
|
|
96472
|
-
nextData:
|
|
98115
|
+
nextData: sparse2.root
|
|
96473
98116
|
};
|
|
96474
|
-
for (const created of
|
|
98117
|
+
for (const created of sparse2.createdChildren) {
|
|
96475
98118
|
const existing = existingValueById.get(created.id);
|
|
96476
98119
|
if (existing !== void 0) {
|
|
96477
98120
|
if (materializedValueRowsEqual(existing, created)) continue;
|
|
@@ -99848,6 +101491,7 @@ var init_project_version_schema_commit = __esm({
|
|
|
99848
101491
|
init_localizable_member_value_writes();
|
|
99849
101492
|
init_value_row_owner_members();
|
|
99850
101493
|
init_init_backed_value_materialization();
|
|
101494
|
+
init_packed_value_write_fold();
|
|
99851
101495
|
init_constructor_argument_ownership();
|
|
99852
101496
|
init_constructors2();
|
|
99853
101497
|
init_dialogue_node_index();
|
|
@@ -100514,38 +102158,28 @@ function assertProjectVersionWholeGraphWritesValid(args) {
|
|
|
100514
102158
|
`Project version transaction operation "${args.operation}" is not a known operation.`
|
|
100515
102159
|
);
|
|
100516
102160
|
}
|
|
100517
|
-
const
|
|
100518
|
-
args.
|
|
100519
|
-
args.
|
|
100520
|
-
);
|
|
100521
|
-
assertNoValueDematerialization({
|
|
100522
|
-
document: args.document,
|
|
100523
|
-
changes: args.changes
|
|
102161
|
+
const changes = expandPackedValueWriteChanges({
|
|
102162
|
+
changes: args.changes,
|
|
102163
|
+
baseValues: args.document.values
|
|
100524
102164
|
});
|
|
100525
|
-
|
|
100526
|
-
|
|
100527
|
-
|
|
100528
|
-
|
|
100529
|
-
|
|
100530
|
-
|
|
100531
|
-
|
|
100532
|
-
|
|
100533
|
-
|
|
100534
|
-
|
|
100535
|
-
|
|
100536
|
-
);
|
|
100537
|
-
assertStagedWorldContentLayerBindingsValid(
|
|
100538
|
-
args.document,
|
|
100539
|
-
projected,
|
|
100540
|
-
args.changes
|
|
100541
|
-
);
|
|
102165
|
+
const projected = applyProjectVersionWriteChanges(args.document, changes);
|
|
102166
|
+
assertNoValueDematerialization({ document: args.document, changes });
|
|
102167
|
+
assertStagedUnorderedContainmentValid(args.document, projected, changes);
|
|
102168
|
+
assertStagedSchemaIdentifiersValid(projected, changes);
|
|
102169
|
+
assertStagedActionListenersValid(projected, changes);
|
|
102170
|
+
assertStagedVariantMemberValuesValid(projected, changes);
|
|
102171
|
+
assertStagedUnitySingletonValid(projected, changes);
|
|
102172
|
+
assertStagedProjectInterfaceValid(projected, changes);
|
|
102173
|
+
assertStagedTileGridReferencesValid(args.document, projected, changes);
|
|
102174
|
+
assertStagedInternalRecordRelationsValid(args.document, projected, changes);
|
|
102175
|
+
assertStagedWorldContentLayerBindingsValid(args.document, projected, changes);
|
|
100542
102176
|
assertAnimationClipDocumentValid(
|
|
100543
102177
|
materializeDeclarationInitializersForAnimationValidation(projected)
|
|
100544
102178
|
);
|
|
100545
102179
|
if (args.operation === void 0 || !isSystemOwnedProjectVersionOperation(args.operation)) {
|
|
100546
102180
|
assertProjectVersionSystemProtectedWritesValid({
|
|
100547
102181
|
document: args.document,
|
|
100548
|
-
changes
|
|
102182
|
+
changes
|
|
100549
102183
|
});
|
|
100550
102184
|
}
|
|
100551
102185
|
}
|
|
@@ -100569,12 +102203,17 @@ function assertStagedUnorderedContainmentValid(current, projected, changes) {
|
|
|
100569
102203
|
const after = projectedValues.get(change.recordId);
|
|
100570
102204
|
const beforeContainerId = typeof before?.containerId === "string" ? before.containerId : null;
|
|
100571
102205
|
const afterContainerId = typeof after?.containerId === "string" ? after.containerId : null;
|
|
100572
|
-
if (before !== void 0 && after !== void 0 && beforeContainerId !== afterContainerId
|
|
102206
|
+
if (before !== void 0 && after !== void 0 && beforeContainerId !== afterContainerId && !isStagedContainerRename(
|
|
102207
|
+
currentValues,
|
|
102208
|
+
projectedValues,
|
|
102209
|
+
beforeContainerId,
|
|
102210
|
+
afterContainerId
|
|
102211
|
+
)) {
|
|
100573
102212
|
throw new Error(
|
|
100574
|
-
`Value "${change.recordId}" cannot change containerId from ${beforeContainerId === null ? "unset" : `"${beforeContainerId}"`} to ${afterContainerId === null ? "unset" : `"${afterContainerId}"`}: unordered-list membership is stamped at creation and immutable (move
|
|
102213
|
+
`Value "${change.recordId}" cannot change containerId from ${beforeContainerId === null ? "unset" : `"${beforeContainerId}"`} to ${afterContainerId === null ? "unset" : `"${afterContainerId}"`}: unordered-list membership is stamped at creation and immutable (a move is refused; a rename must delete the old container and create the new one in the same transaction).`
|
|
100575
102214
|
);
|
|
100576
102215
|
}
|
|
100577
|
-
if (
|
|
102216
|
+
if (afterContainerId !== null && afterContainerId !== beforeContainerId) {
|
|
100578
102217
|
if (afterContainerId === change.recordId) {
|
|
100579
102218
|
throw new Error(
|
|
100580
102219
|
`Value "${change.recordId}" cannot declare itself as its own containerId.`
|
|
@@ -100608,6 +102247,14 @@ function assertStagedUnorderedContainmentValid(current, projected, changes) {
|
|
|
100608
102247
|
}
|
|
100609
102248
|
}
|
|
100610
102249
|
}
|
|
102250
|
+
function isStagedContainerRename(currentValues, projectedValues, fromContainerId, toContainerId) {
|
|
102251
|
+
if (fromContainerId === null) return false;
|
|
102252
|
+
if (toContainerId === null) return false;
|
|
102253
|
+
if (!currentValues.has(fromContainerId)) return false;
|
|
102254
|
+
if (projectedValues.has(fromContainerId)) return false;
|
|
102255
|
+
if (currentValues.has(toContainerId)) return false;
|
|
102256
|
+
return projectedValues.has(toContainerId);
|
|
102257
|
+
}
|
|
100611
102258
|
function assertNoValueDematerialization(args) {
|
|
100612
102259
|
const updates = args.changes.filter(
|
|
100613
102260
|
(change) => change.recordKind === "value" && change.operation === "update" && change.deleted !== true
|
|
@@ -101609,6 +103256,7 @@ var init_project_version_whole_graph_validation = __esm({
|
|
|
101609
103256
|
init_animation_clips();
|
|
101610
103257
|
init_projectInterfaceValidation();
|
|
101611
103258
|
init_project_schema_identifier_validation();
|
|
103259
|
+
init_packed_value_write_fold();
|
|
101612
103260
|
init_project_version_schema_commit();
|
|
101613
103261
|
init_project_version_system_protection_writes();
|
|
101614
103262
|
init_reserved_record_id_validation();
|
|
@@ -101783,7 +103431,9 @@ function computeWorkspaceStatus(workspace, options) {
|
|
|
101783
103431
|
binaryFiles: []
|
|
101784
103432
|
};
|
|
101785
103433
|
}
|
|
101786
|
-
const loweringRecords =
|
|
103434
|
+
const loweringRecords = logicalValueBaseRecordsV4(
|
|
103435
|
+
loweringBaseRecords(workspace.state.records)
|
|
103436
|
+
);
|
|
101787
103437
|
const baseDocuments = schemaBaseDocuments(workspace);
|
|
101788
103438
|
const staticMemberOwnershipRecoveries = [];
|
|
101789
103439
|
const baseManifest = baseDocuments.length === 0 ? void 0 : documentsToProjectSchemaManifest(baseDocuments, {
|
|
@@ -102180,12 +103830,15 @@ function computeWorkspaceStatus(workspace, options) {
|
|
|
102180
103830
|
}
|
|
102181
103831
|
continue;
|
|
102182
103832
|
}
|
|
102183
|
-
const baseState = workspace.state.records[key];
|
|
102184
103833
|
const schemaDocument = documentsByKey.get(key);
|
|
102185
|
-
const reconstructedData = schemaDocument === void 0 ? mergeMigrationServerFields(
|
|
103834
|
+
const reconstructedData = schemaDocument === void 0 ? mergeMigrationServerFields(
|
|
103835
|
+
record3.fileFields,
|
|
103836
|
+
loweringRecords[key]?.data
|
|
103837
|
+
) : schemaDocument.data;
|
|
102186
103838
|
const staticValueId = record3.recordKind === "member" ? staticMemberValueIds.get(record3.recordId) : void 0;
|
|
102187
103839
|
const fullData = staticValueId === void 0 ? reconstructedData : { ...reconstructedData, valueId: staticValueId };
|
|
102188
103840
|
reconstructed3.set(key, { ...record3, fullData });
|
|
103841
|
+
const baseState = workspace.state.records[key];
|
|
102189
103842
|
if (baseState === void 0 || isPendingId(record3.recordId)) {
|
|
102190
103843
|
changes.push({
|
|
102191
103844
|
kind: "create",
|
|
@@ -102326,6 +103979,18 @@ function computeWorkspaceStatus(workspace, options) {
|
|
|
102326
103979
|
changes.splice(index, 1);
|
|
102327
103980
|
}
|
|
102328
103981
|
}
|
|
103982
|
+
applyPackedValueFoldV4({
|
|
103983
|
+
workspace,
|
|
103984
|
+
loweringRecords,
|
|
103985
|
+
schema: packedFoldSchemaV4(
|
|
103986
|
+
documents,
|
|
103987
|
+
loweringRecords,
|
|
103988
|
+
workspace.config.projectId
|
|
103989
|
+
),
|
|
103990
|
+
reconstructed: reconstructed3,
|
|
103991
|
+
changes
|
|
103992
|
+
});
|
|
103993
|
+
reportPhase("packed-value-fold");
|
|
102329
103994
|
for (const change of changes) {
|
|
102330
103995
|
if (change.recordKind !== "value" || change.kind !== "update") continue;
|
|
102331
103996
|
const refusal = valueDematerializationRefusal({
|
|
@@ -102741,7 +104406,7 @@ function prospectiveAnimationDocumentV4(records2) {
|
|
|
102741
104406
|
}
|
|
102742
104407
|
if (project === void 0) return null;
|
|
102743
104408
|
const classIdByName = new Map(classes.map((value) => [value.name, value.id]));
|
|
102744
|
-
const validationValues = values.map((value) => {
|
|
104409
|
+
const validationValues = expandPackedValueRows(values).map((value) => {
|
|
102745
104410
|
if (typeof value.classId === "string") return value;
|
|
102746
104411
|
const authoredInit = Reflect.get(value, "init");
|
|
102747
104412
|
const init = isObjectRecord2(authoredInit) ? authoredInit : null;
|
|
@@ -102795,6 +104460,154 @@ function expandProspectiveAnimationInstances(document) {
|
|
|
102795
104460
|
}
|
|
102796
104461
|
return [...byId.values()];
|
|
102797
104462
|
}
|
|
104463
|
+
function applyPackedValueFoldV4(args) {
|
|
104464
|
+
const candidates = /* @__PURE__ */ new Map();
|
|
104465
|
+
const touchedValueIds = /* @__PURE__ */ new Set();
|
|
104466
|
+
for (const [key, record3] of args.reconstructed) {
|
|
104467
|
+
if (record3.recordKind !== "value") continue;
|
|
104468
|
+
candidates.set(record3.recordId, record3.fullData);
|
|
104469
|
+
const logicalBase = args.loweringRecords[key];
|
|
104470
|
+
const physicalBase = args.workspace.state.records[key];
|
|
104471
|
+
if (logicalBase === void 0 || physicalBase === void 0 || physicalBase.conflictServerHash !== void 0 || isPendingId(record3.recordId) || !recordsSemanticallyEqual("value", record3.fullData, logicalBase.data)) {
|
|
104472
|
+
touchedValueIds.add(record3.recordId);
|
|
104473
|
+
}
|
|
104474
|
+
}
|
|
104475
|
+
const fold = foldCandidateValueRowsV4({
|
|
104476
|
+
candidates,
|
|
104477
|
+
base: args.loweringRecords,
|
|
104478
|
+
touchedValueIds,
|
|
104479
|
+
projectId: args.workspace.config.projectId,
|
|
104480
|
+
schema: args.schema
|
|
104481
|
+
});
|
|
104482
|
+
if (fold.foldedValueIds.size === 0) return;
|
|
104483
|
+
const changeForValue = (valueId, nextData) => {
|
|
104484
|
+
const key = recordStateKey("value", valueId);
|
|
104485
|
+
const file = args.reconstructed.get(key)?.file ?? null;
|
|
104486
|
+
const base = args.workspace.state.records[key];
|
|
104487
|
+
if (base === void 0 || isPendingId(valueId)) {
|
|
104488
|
+
return {
|
|
104489
|
+
kind: "create",
|
|
104490
|
+
recordKind: "value",
|
|
104491
|
+
recordId: valueId,
|
|
104492
|
+
file,
|
|
104493
|
+
nextData
|
|
104494
|
+
};
|
|
104495
|
+
}
|
|
104496
|
+
if (base.conflictServerHash === void 0 && recordsSemanticallyEqual("value", nextData, base.data)) {
|
|
104497
|
+
return null;
|
|
104498
|
+
}
|
|
104499
|
+
return recordUpsertChange({
|
|
104500
|
+
base,
|
|
104501
|
+
recordKind: "value",
|
|
104502
|
+
recordId: valueId,
|
|
104503
|
+
file,
|
|
104504
|
+
nextData
|
|
104505
|
+
});
|
|
104506
|
+
};
|
|
104507
|
+
const rewritten = [];
|
|
104508
|
+
const rebuiltRootIds = /* @__PURE__ */ new Set();
|
|
104509
|
+
const deletedValueIds = /* @__PURE__ */ new Set();
|
|
104510
|
+
for (const change of args.changes) {
|
|
104511
|
+
if (change.recordKind !== "value") {
|
|
104512
|
+
rewritten.push(change);
|
|
104513
|
+
continue;
|
|
104514
|
+
}
|
|
104515
|
+
if (change.kind === "delete") {
|
|
104516
|
+
deletedValueIds.add(change.recordId);
|
|
104517
|
+
rewritten.push(change);
|
|
104518
|
+
continue;
|
|
104519
|
+
}
|
|
104520
|
+
if (fold.foldedValueIds.has(change.recordId)) continue;
|
|
104521
|
+
const packedBody = fold.bodyByValueId.get(change.recordId);
|
|
104522
|
+
if (packedBody === void 0) {
|
|
104523
|
+
rewritten.push(change);
|
|
104524
|
+
continue;
|
|
104525
|
+
}
|
|
104526
|
+
rebuiltRootIds.add(change.recordId);
|
|
104527
|
+
const rebuilt = changeForValue(change.recordId, packedBody);
|
|
104528
|
+
if (rebuilt !== null) rewritten.push(rebuilt);
|
|
104529
|
+
}
|
|
104530
|
+
for (const [rootId, packedBody] of fold.bodyByValueId) {
|
|
104531
|
+
if (rebuiltRootIds.has(rootId)) continue;
|
|
104532
|
+
const rebuilt = changeForValue(rootId, packedBody);
|
|
104533
|
+
if (rebuilt !== null) rewritten.push(rebuilt);
|
|
104534
|
+
}
|
|
104535
|
+
for (const valueId of fold.foldedValueIds) {
|
|
104536
|
+
if (deletedValueIds.has(valueId)) continue;
|
|
104537
|
+
const key = recordStateKey("value", valueId);
|
|
104538
|
+
const base = args.workspace.state.records[key];
|
|
104539
|
+
if (base === void 0) continue;
|
|
104540
|
+
rewritten.push({
|
|
104541
|
+
kind: "delete",
|
|
104542
|
+
recordKind: "value",
|
|
104543
|
+
recordId: valueId,
|
|
104544
|
+
file: base.file ?? args.reconstructed.get(key)?.file ?? null,
|
|
104545
|
+
baseData: base.data,
|
|
104546
|
+
baseContentHash: base.contentHash,
|
|
104547
|
+
casBaseHash: base.conflictServerHash ?? base.contentHash
|
|
104548
|
+
});
|
|
104549
|
+
}
|
|
104550
|
+
args.changes.length = 0;
|
|
104551
|
+
args.changes.push(...rewritten);
|
|
104552
|
+
for (const valueId of fold.foldedValueIds) {
|
|
104553
|
+
args.reconstructed.delete(recordStateKey("value", valueId));
|
|
104554
|
+
}
|
|
104555
|
+
for (const [rootId, packedBody] of fold.bodyByValueId) {
|
|
104556
|
+
const key = recordStateKey("value", rootId);
|
|
104557
|
+
const record3 = args.reconstructed.get(key);
|
|
104558
|
+
if (record3 === void 0) continue;
|
|
104559
|
+
args.reconstructed.set(key, { ...record3, fullData: packedBody });
|
|
104560
|
+
}
|
|
104561
|
+
}
|
|
104562
|
+
function packedFoldSchemaV4(documents, base, projectId) {
|
|
104563
|
+
const seedEnvelope = { projectId, createdAt: 0, updatedAt: 0 };
|
|
104564
|
+
const completed = /* @__PURE__ */ new Map();
|
|
104565
|
+
for (const document of documents) {
|
|
104566
|
+
if (!isObjectRecord2(document.data)) continue;
|
|
104567
|
+
const key = recordStateKey(document.recordKind, document.recordId);
|
|
104568
|
+
const data = { ...document.data };
|
|
104569
|
+
const envelope = {
|
|
104570
|
+
...seedEnvelope,
|
|
104571
|
+
...serverEnvelope(base[key]?.data)
|
|
104572
|
+
};
|
|
104573
|
+
for (const [field, value] of Object.entries(envelope)) {
|
|
104574
|
+
if (data[field] === void 0) data[field] = value;
|
|
104575
|
+
}
|
|
104576
|
+
completed.set(key, data);
|
|
104577
|
+
}
|
|
104578
|
+
const memberRecords = /* @__PURE__ */ new Map();
|
|
104579
|
+
for (const document of documents) {
|
|
104580
|
+
if (document.recordKind !== "member") continue;
|
|
104581
|
+
const data = completed.get(recordStateKey("member", document.recordId));
|
|
104582
|
+
if (data !== void 0) memberRecords.set(document.recordId, data);
|
|
104583
|
+
}
|
|
104584
|
+
const classes = [];
|
|
104585
|
+
const members = [];
|
|
104586
|
+
const constructors = [];
|
|
104587
|
+
const variants = [];
|
|
104588
|
+
const variantFolders = [];
|
|
104589
|
+
for (const document of documents) {
|
|
104590
|
+
const data = completed.get(
|
|
104591
|
+
recordStateKey(document.recordKind, document.recordId)
|
|
104592
|
+
);
|
|
104593
|
+
if (data === void 0) continue;
|
|
104594
|
+
if (document.recordKind === "class") {
|
|
104595
|
+
if (isNeoSchemaClass(data)) classes.push(data);
|
|
104596
|
+
} else if (document.recordKind === "member") {
|
|
104597
|
+
const member = hydrateProspectiveMemberOverride(data, memberRecords);
|
|
104598
|
+
if (isMember(member)) members.push(member);
|
|
104599
|
+
} else if (document.recordKind === "constructor") {
|
|
104600
|
+
if (isNeoClassConstructor(data) || isUncompiledNeoClassConstructor(data)) {
|
|
104601
|
+
constructors.push(data);
|
|
104602
|
+
}
|
|
104603
|
+
} else if (document.recordKind === "variant") {
|
|
104604
|
+
if (isNeoClassVariant(data)) variants.push(data);
|
|
104605
|
+
} else if (document.recordKind === "variant-folder") {
|
|
104606
|
+
if (isNeoClassVariantFolder(data)) variantFolders.push(data);
|
|
104607
|
+
}
|
|
104608
|
+
}
|
|
104609
|
+
return { classes, members, constructors, variants, variantFolders };
|
|
104610
|
+
}
|
|
102798
104611
|
function hydrateProspectiveMemberOverride(data, members) {
|
|
102799
104612
|
if (typeof data.extendsMemberId !== "string") {
|
|
102800
104613
|
return data;
|
|
@@ -102805,6 +104618,7 @@ function hydrateProspectiveMemberOverride(data, members) {
|
|
|
102805
104618
|
"modifier",
|
|
102806
104619
|
"storage",
|
|
102807
104620
|
"storageKey",
|
|
104621
|
+
"distribution",
|
|
102808
104622
|
"minValue",
|
|
102809
104623
|
"maxValue",
|
|
102810
104624
|
"decimalPoints",
|
|
@@ -103166,6 +104980,9 @@ var init_workspace_status_core = __esm({
|
|
|
103166
104980
|
init_classes();
|
|
103167
104981
|
init_members();
|
|
103168
104982
|
init_value_row_owner_members();
|
|
104983
|
+
init_constructors2();
|
|
104984
|
+
init_packed_value_parity();
|
|
104985
|
+
init_variants2();
|
|
103169
104986
|
init_project2();
|
|
103170
104987
|
init_project_version_types();
|
|
103171
104988
|
init_instance_provenance();
|
|
@@ -104573,7 +106390,7 @@ function buildValueEmitContext(records2, manifest) {
|
|
|
104573
106390
|
})
|
|
104574
106391
|
);
|
|
104575
106392
|
const classes = dataById(records2, "class");
|
|
104576
|
-
const values =
|
|
106393
|
+
const values = storedValueRowsByIdV4(records2.values());
|
|
104577
106394
|
const enums = dataById(records2, "enum");
|
|
104578
106395
|
const localizedTexts = dataById(records2, "localized-text");
|
|
104579
106396
|
const dialogues = dataById(records2, "dialogue");
|
|
@@ -105678,6 +107495,7 @@ function variantRootMember(context, binding) {
|
|
|
105678
107495
|
overrideOf: null,
|
|
105679
107496
|
system: null,
|
|
105680
107497
|
storage: "immutable",
|
|
107498
|
+
distribution: null,
|
|
105681
107499
|
storageKey: null
|
|
105682
107500
|
};
|
|
105683
107501
|
}
|
|
@@ -112834,6 +114652,16 @@ function listNeoWorkspaceFilesV1(root) {
|
|
|
112834
114652
|
function listProjectSourceFilesV4(root) {
|
|
112835
114653
|
return listNeoWorkspaceFilesV1(root).production;
|
|
112836
114654
|
}
|
|
114655
|
+
function requiredProjectSourceKindV4(path) {
|
|
114656
|
+
const kind = neoProjectSourceKind(path);
|
|
114657
|
+
if (kind === null) {
|
|
114658
|
+
throw new Error(`"${path}" is not a Neo project source path.`);
|
|
114659
|
+
}
|
|
114660
|
+
if (!isNeoProjectProductionSourceKind(kind)) {
|
|
114661
|
+
throw new Error(`"${path}" is test-only source, not production source.`);
|
|
114662
|
+
}
|
|
114663
|
+
return kind;
|
|
114664
|
+
}
|
|
112837
114665
|
function listProjectTestFilesV1(root) {
|
|
112838
114666
|
return listNeoWorkspaceFilesV1(root).specs;
|
|
112839
114667
|
}
|
|
@@ -114822,20 +116650,20 @@ async function finishFormat4Pull(args) {
|
|
|
114822
116650
|
...[...conflictPaths].filter((path) => serverByPath.has(path)),
|
|
114823
116651
|
...authoredLocalConflictKeysByPath.keys()
|
|
114824
116652
|
]);
|
|
116653
|
+
const localRecordFiles = declaringSourcePathsV4(localResult);
|
|
114825
116654
|
const rewritePaths = projectSourcePathsRequiringRewriteV4({
|
|
114826
116655
|
destructive,
|
|
114827
116656
|
localStatus,
|
|
114828
116657
|
plans,
|
|
114829
|
-
localRecordFiles
|
|
114830
|
-
serverRecordFiles: serverResult
|
|
116658
|
+
localRecordFiles,
|
|
116659
|
+
serverRecordFiles: serverResult === null ? /* @__PURE__ */ new Map() : declaringSourcePathsV4(serverResult),
|
|
114831
116660
|
previousRecords: workspace.state.records,
|
|
114832
116661
|
conflictPaths,
|
|
114833
116662
|
emittedPaths,
|
|
114834
116663
|
mainLocale: workspaceMainLocale(workspace.state.records)
|
|
114835
116664
|
});
|
|
114836
116665
|
for (const key of regeneratedRecordKeys) {
|
|
114837
|
-
const path
|
|
114838
|
-
if (path !== void 0) rewritePaths.add(path);
|
|
116666
|
+
for (const path of localRecordFiles.get(key) ?? []) rewritePaths.add(path);
|
|
114839
116667
|
}
|
|
114840
116668
|
const resolveSourcePath = createWorkspaceSourcePathResolver(workspace.root);
|
|
114841
116669
|
let written = 0;
|
|
@@ -115132,14 +116960,30 @@ function cursorsEqual(left, right) {
|
|
|
115132
116960
|
(transactionId, index) => transactionId === right.transactionIds[index]
|
|
115133
116961
|
);
|
|
115134
116962
|
}
|
|
116963
|
+
function declaringSourcePathsV4(emission) {
|
|
116964
|
+
const paths = /* @__PURE__ */ new Map();
|
|
116965
|
+
const add = (key, path) => {
|
|
116966
|
+
const existing = paths.get(key);
|
|
116967
|
+
if (existing === void 0) {
|
|
116968
|
+
paths.set(key, [path]);
|
|
116969
|
+
return;
|
|
116970
|
+
}
|
|
116971
|
+
if (!existing.includes(path)) existing.push(path);
|
|
116972
|
+
};
|
|
116973
|
+
for (const file of emission.files) {
|
|
116974
|
+
for (const key of file.recordKeys) add(key, file.path);
|
|
116975
|
+
}
|
|
116976
|
+
for (const [key, path] of emission.recordFiles) add(key, path);
|
|
116977
|
+
return paths;
|
|
116978
|
+
}
|
|
115135
116979
|
function projectSourcePathsRequiringRewriteV4(args) {
|
|
115136
116980
|
if (args.destructive || args.localStatus === null) {
|
|
115137
116981
|
return new Set(args.emittedPaths);
|
|
115138
116982
|
}
|
|
115139
116983
|
const result = new Set(args.conflictPaths);
|
|
115140
116984
|
for (const [key, plan] of args.plans) {
|
|
115141
|
-
const
|
|
115142
|
-
if (
|
|
116985
|
+
const paths = args.localRecordFiles.get(key) ?? args.serverRecordFiles.get(key);
|
|
116986
|
+
if (paths === void 0) continue;
|
|
115143
116987
|
const local = args.localStatus.reconstructed.get(key)?.fullData;
|
|
115144
116988
|
const kind = args.previousRecords[key]?.recordKind ?? key.split(":", 1)[0] ?? "";
|
|
115145
116989
|
if (plan.emitData === void 0 ? local !== void 0 : local === void 0 || !sourceAuthoredRecordsSemanticallyEqual(
|
|
@@ -115148,7 +116992,7 @@ function projectSourcePathsRequiringRewriteV4(args) {
|
|
|
115148
116992
|
local,
|
|
115149
116993
|
args.mainLocale
|
|
115150
116994
|
)) {
|
|
115151
|
-
result.add(path);
|
|
116995
|
+
for (const path of paths) result.add(path);
|
|
115152
116996
|
}
|
|
115153
116997
|
}
|
|
115154
116998
|
for (const [key, previous] of Object.entries(args.previousRecords)) {
|
|
@@ -116169,12 +118013,9 @@ function childStorageKeyDeclaration(args) {
|
|
|
116169
118013
|
}
|
|
116170
118014
|
function collectValueRows(records2) {
|
|
116171
118015
|
const values = /* @__PURE__ */ new Map();
|
|
116172
|
-
for (const
|
|
116173
|
-
|
|
116174
|
-
|
|
116175
|
-
if (!isObjectRecord2(data)) continue;
|
|
116176
|
-
values.set(record3.recordId, {
|
|
116177
|
-
id: record3.recordId,
|
|
118016
|
+
for (const [valueId, data] of storedValueRowsByIdV4(Object.values(records2))) {
|
|
118017
|
+
values.set(valueId, {
|
|
118018
|
+
id: valueId,
|
|
116178
118019
|
classId: typeof data.classId === "string" ? data.classId : null,
|
|
116179
118020
|
mapKey: typeof data.mapKey === "string" ? data.mapKey : null,
|
|
116180
118021
|
containerId: typeof data.containerId === "string" ? data.containerId : null,
|
|
@@ -119153,6 +120994,49 @@ var init_project_file_push = __esm({
|
|
|
119153
120994
|
}
|
|
119154
120995
|
});
|
|
119155
120996
|
|
|
120997
|
+
// ../src/database/packed-value-record-validation.ts
|
|
120998
|
+
function packedValueRecordViolation(row) {
|
|
120999
|
+
if (!rowCarriesPackedValueContent(row)) return null;
|
|
121000
|
+
let decoded;
|
|
121001
|
+
try {
|
|
121002
|
+
decoded = decodePackedValueRow(row);
|
|
121003
|
+
} catch (error) {
|
|
121004
|
+
if (error instanceof PackedValueEncodingError) return error.message;
|
|
121005
|
+
throw error;
|
|
121006
|
+
}
|
|
121007
|
+
const rootViolation = decodedRowViolation(
|
|
121008
|
+
decoded.row,
|
|
121009
|
+
`distribution root "${decoded.row.id}"`
|
|
121010
|
+
);
|
|
121011
|
+
if (rootViolation !== null) return rootViolation;
|
|
121012
|
+
for (const child of decoded.children) {
|
|
121013
|
+
const childViolation = decodedRowViolation(
|
|
121014
|
+
child,
|
|
121015
|
+
`packed child "${child.id}"`
|
|
121016
|
+
);
|
|
121017
|
+
if (childViolation !== null) return childViolation;
|
|
121018
|
+
}
|
|
121019
|
+
return null;
|
|
121020
|
+
}
|
|
121021
|
+
function decodedRowViolation(row, label) {
|
|
121022
|
+
if (!isMemberValue(row)) {
|
|
121023
|
+
return `Decoded ${label} is not a valid value row.`;
|
|
121024
|
+
}
|
|
121025
|
+
const provenance = canonicalInstanceProvenanceViolation(row);
|
|
121026
|
+
if (provenance !== null) {
|
|
121027
|
+
return `Decoded ${label} violates canonical instance provenance: ${provenance}.`;
|
|
121028
|
+
}
|
|
121029
|
+
return null;
|
|
121030
|
+
}
|
|
121031
|
+
var init_packed_value_record_validation = __esm({
|
|
121032
|
+
"../src/database/packed-value-record-validation.ts"() {
|
|
121033
|
+
"use strict";
|
|
121034
|
+
init_instance_provenance();
|
|
121035
|
+
init_member_kinds();
|
|
121036
|
+
init_packed_value_encoding();
|
|
121037
|
+
}
|
|
121038
|
+
});
|
|
121039
|
+
|
|
119156
121040
|
// ../src/models/project-file-authoring-identifiers.ts
|
|
119157
121041
|
function isValidProjectFileAuthoringIdentifier(value) {
|
|
119158
121042
|
return isValidProjectSourceIdentifier(value);
|
|
@@ -119191,7 +121075,13 @@ function validateProjectRecordByKind(recordKind, data, options = {}) {
|
|
|
119191
121075
|
if (memberGuard(data)) return;
|
|
119192
121076
|
}
|
|
119193
121077
|
if (recordKind === ProjectRecordKind.Value) {
|
|
119194
|
-
if (isMemberValue(data))
|
|
121078
|
+
if (isMemberValue(data)) {
|
|
121079
|
+
const packedViolation = packedValueRecordViolation(data);
|
|
121080
|
+
if (packedViolation === null) return;
|
|
121081
|
+
throw new Error(
|
|
121082
|
+
`Value "${data.id}" carries an invalid packed subtree: ${packedViolation}`
|
|
121083
|
+
);
|
|
121084
|
+
}
|
|
119195
121085
|
}
|
|
119196
121086
|
if (recordKind === ProjectRecordKind.Class) {
|
|
119197
121087
|
if (isNeoSchemaClass(data)) return;
|
|
@@ -119271,6 +121161,7 @@ var init_project_version_validation = __esm({
|
|
|
119271
121161
|
init_classes();
|
|
119272
121162
|
init_constructors2();
|
|
119273
121163
|
init_inheritance();
|
|
121164
|
+
init_packed_value_record_validation();
|
|
119274
121165
|
init_generics();
|
|
119275
121166
|
init_enum2();
|
|
119276
121167
|
init_interfaces();
|
|
@@ -122295,8 +124186,8 @@ var init_registry2 = __esm({
|
|
|
122295
124186
|
"use strict";
|
|
122296
124187
|
PROJECT_SCHEMA_CONTRACT = Object.freeze({
|
|
122297
124188
|
formatVersion: 4,
|
|
122298
|
-
contractVersion: "4.
|
|
122299
|
-
cliVersion: "0.
|
|
124189
|
+
contractVersion: "4.1",
|
|
124190
|
+
cliVersion: "0.42.0",
|
|
122300
124191
|
projectFileUploadBatchSize: 32,
|
|
122301
124192
|
documentRecords: {
|
|
122302
124193
|
member: {
|
|
@@ -122314,6 +124205,11 @@ var init_registry2 = __esm({
|
|
|
122314
124205
|
"system",
|
|
122315
124206
|
"storage",
|
|
122316
124207
|
"storageKey",
|
|
124208
|
+
// Deliberately carries no normalization rule (P76 §1): absence is the
|
|
124209
|
+
// canonical automatic setting and explicit ordinal 0 is an explicit
|
|
124210
|
+
// `.Sparse`, so `absentMeansDefault` would collapse the two states
|
|
124211
|
+
// that the whole contract exists to keep apart.
|
|
124212
|
+
"distribution",
|
|
122317
124213
|
"minValue",
|
|
122318
124214
|
"maxValue",
|
|
122319
124215
|
"decimalPoints",
|
|
@@ -122638,6 +124534,7 @@ var init_registry2 = __esm({
|
|
|
122638
124534
|
NeoListKind: ["Ordered", "Unordered"],
|
|
122639
124535
|
NeoDictionaryKeyKind: ["String", "Enum"],
|
|
122640
124536
|
NeoClassVisibility: ["Visible", "Hidden"],
|
|
124537
|
+
NeoSubtreeDistribution: ["Sparse", "Packed"],
|
|
122641
124538
|
NeoStringFormat: ["Localized", "Plain"],
|
|
122642
124539
|
NeoMemberSearchBy: ["None", "MemberKey"],
|
|
122643
124540
|
NeoListIndexKind: ["Bucket", "Unique"],
|
|
@@ -125521,7 +127418,7 @@ function inspectSourceContract(workspace) {
|
|
|
125521
127418
|
try {
|
|
125522
127419
|
const inputs = files.map((file, index) => ({
|
|
125523
127420
|
uri: relativeFiles[index],
|
|
125524
|
-
kind:
|
|
127421
|
+
kind: requiredProjectSourceKindV4(relativeFiles[index]),
|
|
125525
127422
|
text: readFileSync17(file, "utf8")
|
|
125526
127423
|
}));
|
|
125527
127424
|
const analysis = compileNeoProjectSources(inputs);
|
|
@@ -125642,13 +127539,6 @@ function inspectTrackedBinary(root, record3, errors) {
|
|
|
125642
127539
|
errors.push(`Tracked project file ${path} is not readable.`);
|
|
125643
127540
|
}
|
|
125644
127541
|
}
|
|
125645
|
-
function requiredSourceKind(path) {
|
|
125646
|
-
const kind = neoProjectSourceKind(path);
|
|
125647
|
-
if (kind !== null && isNeoProjectProductionSourceKind(kind)) return kind;
|
|
125648
|
-
throw new Error(
|
|
125649
|
-
`Unsupported Neo project source path ${JSON.stringify(path)}.`
|
|
125650
|
-
);
|
|
125651
|
-
}
|
|
125652
127542
|
function errorDiagnostics(diagnostics) {
|
|
125653
127543
|
return diagnostics.filter(
|
|
125654
127544
|
(diagnostic) => diagnostic.severity === "error" && !isPullRecoveryDiagnosticCode(diagnostic.code)
|
|
@@ -129117,7 +131007,7 @@ There is no --keep-current: preserving current semantic state defines flatten.
|
|
|
129117
131007
|
async function main() {
|
|
129118
131008
|
const args = parseArgs(process.argv.slice(2));
|
|
129119
131009
|
if (args.command === "--version") {
|
|
129120
|
-
console.log("0.
|
|
131010
|
+
console.log("0.42.0");
|
|
129121
131011
|
return;
|
|
129122
131012
|
}
|
|
129123
131013
|
if (args.command === null || args.command === "help" || args.command === "--help" || args.command === "-h") {
|
|
@@ -129234,7 +131124,7 @@ async function main() {
|
|
|
129234
131124
|
const sub = args.positional[0];
|
|
129235
131125
|
if (sub === void 0) {
|
|
129236
131126
|
throw new Error(
|
|
129237
|
-
"neo migrate requires a subcommand: new | list | check | run."
|
|
131127
|
+
"neo migrate requires a subcommand: new | list | check | run | prune."
|
|
129238
131128
|
);
|
|
129239
131129
|
}
|
|
129240
131130
|
const { runMigrate: runMigrate2 } = await Promise.resolve().then(() => (init_migrate(), migrate_exports));
|