@neocompose/cli 0.49.0 → 0.50.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/neo.mjs +694 -188
- package/package.json +1 -1
- package/skills/neocompose-cli/SKILL.md +1 -1
- package/skills/neocompose-cli/references/animation-and-world-authoring.md +23 -0
- package/skills/neocompose-cli/references/cli-development.md +1 -1
- package/skills/neocompose-cli/references/commands-and-sync.md +4 -0
package/dist/neo.mjs
CHANGED
|
@@ -10166,6 +10166,14 @@ var init_strict_resolver = __esm({
|
|
|
10166
10166
|
);
|
|
10167
10167
|
}
|
|
10168
10168
|
case "annotated":
|
|
10169
|
+
if (expression.annotations.some(
|
|
10170
|
+
(annotation2) => annotation2.name === "tile"
|
|
10171
|
+
)) {
|
|
10172
|
+
throw new CompileError(
|
|
10173
|
+
"@tile is only supported on persisted literal placements, not executable NeoScript constructions.",
|
|
10174
|
+
expression.pos
|
|
10175
|
+
);
|
|
10176
|
+
}
|
|
10169
10177
|
return this.resolveExpression(expression.expression, scope, expected);
|
|
10170
10178
|
case "binary":
|
|
10171
10179
|
return this.resolveBinary(expression, scope);
|
|
@@ -14498,8 +14506,12 @@ function compileNeoScriptStrict(document, context, options = {}) {
|
|
|
14498
14506
|
};
|
|
14499
14507
|
}
|
|
14500
14508
|
}
|
|
14501
|
-
function assertNeoScriptCompiles(document, context) {
|
|
14502
|
-
const result = compileNeoScriptStrict(
|
|
14509
|
+
function assertNeoScriptCompiles(document, context, projectIndex) {
|
|
14510
|
+
const result = compileNeoScriptStrict(
|
|
14511
|
+
document,
|
|
14512
|
+
context,
|
|
14513
|
+
projectIndex === void 0 ? {} : { projectIndex }
|
|
14514
|
+
);
|
|
14503
14515
|
const diagnostic = result.diagnostics[0];
|
|
14504
14516
|
if (diagnostic) {
|
|
14505
14517
|
throw new CompileError(diagnostic.message, {
|
|
@@ -14578,8 +14590,8 @@ function attachDependencyManifest(compiled, syntax, project, context) {
|
|
|
14578
14590
|
recordIds.add(alias.valueId);
|
|
14579
14591
|
collectDependencyIds(alias.type, null, recordIds);
|
|
14580
14592
|
}
|
|
14581
|
-
const typeNames = [...
|
|
14582
|
-
(name) =>
|
|
14593
|
+
const typeNames = [...identifiers].filter(
|
|
14594
|
+
(name) => project.typeByName.has(name)
|
|
14583
14595
|
);
|
|
14584
14596
|
return {
|
|
14585
14597
|
...compiled,
|
|
@@ -17880,6 +17892,55 @@ var init_project_source_registry = __esm({
|
|
|
17880
17892
|
}
|
|
17881
17893
|
});
|
|
17882
17894
|
|
|
17895
|
+
// ../packages/neoscript-language/src/project-source-tile.ts
|
|
17896
|
+
function tileAssetAnnotation(expression) {
|
|
17897
|
+
if (expression.kind !== "annotated") return null;
|
|
17898
|
+
const annotations = expression.annotations.filter(
|
|
17899
|
+
(entry) => entry.name === "tile"
|
|
17900
|
+
);
|
|
17901
|
+
const annotation2 = annotations[0];
|
|
17902
|
+
if (annotation2 === void 0) return null;
|
|
17903
|
+
if (annotations.length > 1) {
|
|
17904
|
+
throw new CompileError(
|
|
17905
|
+
"A placement can have only one @tile annotation.",
|
|
17906
|
+
annotations[1].pos
|
|
17907
|
+
);
|
|
17908
|
+
}
|
|
17909
|
+
if (expression.expression.kind !== "new") {
|
|
17910
|
+
throw new CompileError(
|
|
17911
|
+
"@tile requires a NeoTileInstance construction.",
|
|
17912
|
+
annotation2.pos
|
|
17913
|
+
);
|
|
17914
|
+
}
|
|
17915
|
+
if (annotation2.args.length !== 1) {
|
|
17916
|
+
throw new CompileError(
|
|
17917
|
+
"@tile requires exactly one tile class: @tile(VoidTile) or @tile(asset: VoidTile).",
|
|
17918
|
+
annotation2.pos
|
|
17919
|
+
);
|
|
17920
|
+
}
|
|
17921
|
+
const name = annotation2.argumentNames?.[0];
|
|
17922
|
+
if (name != null && name !== "asset") {
|
|
17923
|
+
throw new CompileError(
|
|
17924
|
+
`@tile has no '${name}' option. Use 'asset'.`,
|
|
17925
|
+
annotation2.pos
|
|
17926
|
+
);
|
|
17927
|
+
}
|
|
17928
|
+
const asset = annotation2.args[0];
|
|
17929
|
+
if (asset.kind !== "ident") {
|
|
17930
|
+
throw new CompileError(
|
|
17931
|
+
"@tile asset must name a concrete tile class.",
|
|
17932
|
+
asset.pos
|
|
17933
|
+
);
|
|
17934
|
+
}
|
|
17935
|
+
return asset.name;
|
|
17936
|
+
}
|
|
17937
|
+
var init_project_source_tile = __esm({
|
|
17938
|
+
"../packages/neoscript-language/src/project-source-tile.ts"() {
|
|
17939
|
+
"use strict";
|
|
17940
|
+
init_strict_compile_error();
|
|
17941
|
+
}
|
|
17942
|
+
});
|
|
17943
|
+
|
|
17883
17944
|
// ../packages/neoscript-language/src/project-schema-contract.generated.ts
|
|
17884
17945
|
var PROJECT_FILE_UPLOAD_BATCH_SIZE, NEO_PROJECT_SOURCE_RECORD_CONTRACT;
|
|
17885
17946
|
var init_project_schema_contract_generated = __esm({
|
|
@@ -22911,7 +22972,48 @@ function validateExpression(expression, expected, scope, environment, uri, range
|
|
|
22911
22972
|
return;
|
|
22912
22973
|
}
|
|
22913
22974
|
if (expression.kind === "annotated") {
|
|
22975
|
+
const assetName = tileAssetAnnotation(expression);
|
|
22976
|
+
if (assetName !== null) {
|
|
22977
|
+
const constructed = expression.expression;
|
|
22978
|
+
const className = constructed.kind === "new" ? constructed.className ?? expected?.name : void 0;
|
|
22979
|
+
const asset = environment.types.get(assetName);
|
|
22980
|
+
if (!className || !classExtends(className, "NeoTileInstance", environment, /* @__PURE__ */ new Set())) {
|
|
22981
|
+
pushDiagnostic(
|
|
22982
|
+
diagnostics,
|
|
22983
|
+
uri,
|
|
22984
|
+
range2,
|
|
22985
|
+
"invalid-tile-placement",
|
|
22986
|
+
"@tile requires a NeoTileInstance construction."
|
|
22987
|
+
);
|
|
22988
|
+
}
|
|
22989
|
+
if (!asset || !classExtends(assetName, "NeoTile", environment, /* @__PURE__ */ new Set())) {
|
|
22990
|
+
pushDiagnostic(
|
|
22991
|
+
diagnostics,
|
|
22992
|
+
uri,
|
|
22993
|
+
range2,
|
|
22994
|
+
"invalid-tile-asset",
|
|
22995
|
+
`@tile asset '${assetName}' must name a tile class.`
|
|
22996
|
+
);
|
|
22997
|
+
} else if (asset.modifiers.includes("abstract")) {
|
|
22998
|
+
pushDiagnostic(
|
|
22999
|
+
diagnostics,
|
|
23000
|
+
uri,
|
|
23001
|
+
range2,
|
|
23002
|
+
"invalid-tile-asset",
|
|
23003
|
+
`@tile asset '${assetName}' must be a concrete tile class.`
|
|
23004
|
+
);
|
|
23005
|
+
} else if (asset.genericParameters.length > 0) {
|
|
23006
|
+
pushDiagnostic(
|
|
23007
|
+
diagnostics,
|
|
23008
|
+
uri,
|
|
23009
|
+
range2,
|
|
23010
|
+
"invalid-tile-asset",
|
|
23011
|
+
`@tile asset '${assetName}' must be a non-generic tile class.`
|
|
23012
|
+
);
|
|
23013
|
+
}
|
|
23014
|
+
}
|
|
22914
23015
|
for (const annotation2 of expression.annotations) {
|
|
23016
|
+
if (annotation2.name === "tile") continue;
|
|
22915
23017
|
validateInlineAnnotation(
|
|
22916
23018
|
annotation2,
|
|
22917
23019
|
environment,
|
|
@@ -23444,7 +23546,7 @@ function validateInlineAnnotation(annotation2, environment, uri, range2, diagnos
|
|
|
23444
23546
|
uri,
|
|
23445
23547
|
range2,
|
|
23446
23548
|
"invalid-inline-annotation",
|
|
23447
|
-
`Only @id
|
|
23549
|
+
`Only @id and @tile are valid on an inline persisted value; got @${annotation2.name}.`
|
|
23448
23550
|
);
|
|
23449
23551
|
return;
|
|
23450
23552
|
}
|
|
@@ -24011,6 +24113,7 @@ var init_project_source_semantics = __esm({
|
|
|
24011
24113
|
"../packages/neoscript-language/src/project-source-semantics.ts"() {
|
|
24012
24114
|
"use strict";
|
|
24013
24115
|
init_project_local_values();
|
|
24116
|
+
init_project_source_tile();
|
|
24014
24117
|
init_language_spec();
|
|
24015
24118
|
init_project_schema_contract_generated();
|
|
24016
24119
|
init_strict_compile_error();
|
|
@@ -27739,6 +27842,28 @@ function projectCompletions(analysis, document, position) {
|
|
|
27739
27842
|
items: [...script.items, variantScopeInBody]
|
|
27740
27843
|
};
|
|
27741
27844
|
}
|
|
27845
|
+
const tileCall = activeTileAnnotation(document, position);
|
|
27846
|
+
if (tileCall) {
|
|
27847
|
+
const items = analysis.symbols.filter(
|
|
27848
|
+
(symbol) => symbol.kind === "class" && projectTypeNameAssignable(analysis, symbol.name, "NeoTile")
|
|
27849
|
+
).filter((symbol) => {
|
|
27850
|
+
const declaration = analysis.documents.get(symbol.location.uri)?.declarations.find(
|
|
27851
|
+
(entry) => entry.kind === "class" && entry.name === symbol.name
|
|
27852
|
+
);
|
|
27853
|
+
return declaration?.kind === "class" && !declaration.modifiers.includes("abstract") && declaration.genericParameters.length === 0;
|
|
27854
|
+
}).map((symbol) => ({
|
|
27855
|
+
label: symbol.name,
|
|
27856
|
+
kind: "class",
|
|
27857
|
+
insertText: symbol.name
|
|
27858
|
+
}));
|
|
27859
|
+
if (!tileCall.named)
|
|
27860
|
+
items.unshift({
|
|
27861
|
+
label: "asset",
|
|
27862
|
+
kind: "property",
|
|
27863
|
+
insertText: "asset: "
|
|
27864
|
+
});
|
|
27865
|
+
return { isIncomplete: false, items };
|
|
27866
|
+
}
|
|
27742
27867
|
const annotations = projectAnnotationCompletions(
|
|
27743
27868
|
analysis,
|
|
27744
27869
|
document,
|
|
@@ -27864,12 +27989,32 @@ function projectCompletions(analysis, document, position) {
|
|
|
27864
27989
|
}
|
|
27865
27990
|
return projectFallbackCompletions(analysis, document, position);
|
|
27866
27991
|
}
|
|
27992
|
+
function isTileAssetToken(tokens, index) {
|
|
27993
|
+
const open = tokens[index - 1]?.text === ":" && tokens[index - 2]?.text === "asset" ? index - 3 : index - 1;
|
|
27994
|
+
return tokens[index + 1]?.text !== ":" && tokens[open]?.text === "(" && tokens[open - 1]?.text === "tile" && tokens[open - 2]?.text === "@";
|
|
27995
|
+
}
|
|
27996
|
+
function activeTileAnnotation(document, position) {
|
|
27997
|
+
const tokens = projectTokens(document);
|
|
27998
|
+
const open = activeCallOpenIndex(tokens, position);
|
|
27999
|
+
if (tokens[open - 1]?.text !== "tile" || tokens[open - 2]?.text !== "@")
|
|
28000
|
+
return null;
|
|
28001
|
+
const before = tokens.slice(open + 1).filter((token) => positionCompare2(token.range.start, position) < 0);
|
|
28002
|
+
if (before.some((token) => token.text === ",")) return null;
|
|
28003
|
+
const named = before.some((token) => token.text === ":");
|
|
28004
|
+
return { named };
|
|
28005
|
+
}
|
|
27867
28006
|
function projectAnnotationCompletions(analysis, document, position) {
|
|
27868
28007
|
const source = new SourceText(document.text);
|
|
27869
28008
|
const offset = source.offsetAt(position);
|
|
27870
28009
|
const word = projectWordRange(document.text, offset);
|
|
27871
28010
|
if (document.text[word.start - 1] !== "@") return null;
|
|
27872
|
-
if (initializerRootAt(analysis, document, position))
|
|
28011
|
+
if (initializerRootAt(analysis, document, position)) {
|
|
28012
|
+
return ["id", "tile"].map((name) => ({
|
|
28013
|
+
label: `@${name}`,
|
|
28014
|
+
kind: "snippet",
|
|
28015
|
+
insertText: name
|
|
28016
|
+
}));
|
|
28017
|
+
}
|
|
27873
28018
|
const names = projectAnnotationNamesAt(analysis, document, position);
|
|
27874
28019
|
return names.map((name) => ({
|
|
27875
28020
|
label: `@${name}`,
|
|
@@ -29307,7 +29452,7 @@ function indexedProjectSymbolAt(analysis, document, position, index) {
|
|
|
29307
29452
|
);
|
|
29308
29453
|
const source = analysis.documents.get(document.uri);
|
|
29309
29454
|
const typePosition = source && sourceTypeAt(source, token.range.start);
|
|
29310
|
-
if (typePosition || sourceTokens[tokenIndex - 1]?.text === "new") {
|
|
29455
|
+
if (typePosition || sourceTokens[tokenIndex - 1]?.text === "new" || isTileAssetToken(sourceTokens, tokenIndex)) {
|
|
29311
29456
|
const types = candidates.filter(
|
|
29312
29457
|
(symbol) => symbol.kind === "class" || symbol.kind === "interface" || symbol.kind === "enum" || symbol.kind === "genericParameter"
|
|
29313
29458
|
);
|
|
@@ -29547,6 +29692,8 @@ function annotationSignatureParameters(name) {
|
|
|
29547
29692
|
switch (name) {
|
|
29548
29693
|
case "id":
|
|
29549
29694
|
return ["string id"];
|
|
29695
|
+
case "tile":
|
|
29696
|
+
return ["NeoTile class asset"];
|
|
29550
29697
|
case "settings":
|
|
29551
29698
|
return ["named settings"];
|
|
29552
29699
|
case "storage":
|
|
@@ -33361,6 +33508,7 @@ var init_service = __esm({
|
|
|
33361
33508
|
init_test_prelude();
|
|
33362
33509
|
LanguageService = class {
|
|
33363
33510
|
documents = /* @__PURE__ */ new Map();
|
|
33511
|
+
specSnapshots = /* @__PURE__ */ new Set();
|
|
33364
33512
|
projectGeneration = 0;
|
|
33365
33513
|
cachedProjectAnalysis;
|
|
33366
33514
|
openDocument(document, context) {
|
|
@@ -33370,6 +33518,7 @@ var init_service = __esm({
|
|
|
33370
33518
|
);
|
|
33371
33519
|
}
|
|
33372
33520
|
const previous = this.documents.get(document.uri);
|
|
33521
|
+
if (previous) this.specSnapshots.delete(previous);
|
|
33373
33522
|
this.documents.set(document.uri, {
|
|
33374
33523
|
document,
|
|
33375
33524
|
context,
|
|
@@ -33395,6 +33544,7 @@ var init_service = __esm({
|
|
|
33395
33544
|
state.document = document;
|
|
33396
33545
|
const previousProjectIndex = state.snapshot?.project;
|
|
33397
33546
|
state.snapshot = void 0;
|
|
33547
|
+
this.specSnapshots.delete(state);
|
|
33398
33548
|
if (!isProjectDocument(document, state.context) && state.context.projectSourceKind !== "spec") {
|
|
33399
33549
|
state.snapshot = createSnapshot(
|
|
33400
33550
|
document,
|
|
@@ -33426,6 +33576,7 @@ var init_service = __esm({
|
|
|
33426
33576
|
}
|
|
33427
33577
|
state.context = context;
|
|
33428
33578
|
state.contextKey = contextKey;
|
|
33579
|
+
this.specSnapshots.delete(state);
|
|
33429
33580
|
state.snapshot = isProjectDocument(state.document, context) || context.projectSourceKind === "spec" ? void 0 : createSnapshot(state.document, context);
|
|
33430
33581
|
state.validationGeneration++;
|
|
33431
33582
|
if (isProjectDocument(state.document, context))
|
|
@@ -33434,9 +33585,11 @@ var init_service = __esm({
|
|
|
33434
33585
|
closeDocument(uri) {
|
|
33435
33586
|
const state = this.documents.get(uri);
|
|
33436
33587
|
this.documents.delete(uri);
|
|
33588
|
+
if (state) this.specSnapshots.delete(state);
|
|
33437
33589
|
if (state && isProjectDocument(state.document, state.context)) {
|
|
33438
33590
|
this.invalidateProjectAnalysis();
|
|
33439
33591
|
}
|
|
33592
|
+
if (this.documents.size === 0) this.cachedProjectAnalysis = void 0;
|
|
33440
33593
|
}
|
|
33441
33594
|
hasDocument(uri) {
|
|
33442
33595
|
return this.documents.has(uri);
|
|
@@ -33674,7 +33827,8 @@ var init_service = __esm({
|
|
|
33674
33827
|
kind: document.languageId === "neoflow" ? "flow" : context.kind === "migration" ? "migration" : "definition",
|
|
33675
33828
|
text: document.text
|
|
33676
33829
|
} : null
|
|
33677
|
-
).filter((input) => input !== null)
|
|
33830
|
+
).filter((input) => input !== null),
|
|
33831
|
+
this.cachedProjectAnalysis?.analysis.documents
|
|
33678
33832
|
);
|
|
33679
33833
|
this.cachedProjectAnalysis = {
|
|
33680
33834
|
generation: this.projectGeneration,
|
|
@@ -33684,11 +33838,8 @@ var init_service = __esm({
|
|
|
33684
33838
|
}
|
|
33685
33839
|
invalidateProjectAnalysis() {
|
|
33686
33840
|
this.projectGeneration++;
|
|
33687
|
-
this.
|
|
33688
|
-
|
|
33689
|
-
if (state.context.projectSourceKind === "spec")
|
|
33690
|
-
state.snapshot = void 0;
|
|
33691
|
-
}
|
|
33841
|
+
for (const state of this.specSnapshots) state.snapshot = void 0;
|
|
33842
|
+
this.specSnapshots.clear();
|
|
33692
33843
|
}
|
|
33693
33844
|
projectReferences(document, position, includeDeclaration) {
|
|
33694
33845
|
const token = projectTokenAt(document, position);
|
|
@@ -33740,6 +33891,8 @@ var init_service = __esm({
|
|
|
33740
33891
|
project: this.projectAnalysis().project
|
|
33741
33892
|
}) : state.context
|
|
33742
33893
|
);
|
|
33894
|
+
if (state.context.projectSourceKind === "spec")
|
|
33895
|
+
this.specSnapshots.add(state);
|
|
33743
33896
|
return state.snapshot;
|
|
33744
33897
|
}
|
|
33745
33898
|
requireState(uri) {
|
|
@@ -34012,6 +34165,7 @@ var init_src = __esm({
|
|
|
34012
34165
|
init_project_source_construction_quick_fixes();
|
|
34013
34166
|
init_project_source_manifest();
|
|
34014
34167
|
init_project_source_variants();
|
|
34168
|
+
init_project_source_tile();
|
|
34015
34169
|
init_project_source_parameter_defaults();
|
|
34016
34170
|
init_project_source_settlement();
|
|
34017
34171
|
init_project_source_parser();
|
|
@@ -44182,36 +44336,36 @@ var MemberKind;
|
|
|
44182
44336
|
var init_member_kind_enum = __esm({
|
|
44183
44337
|
"../src/models/members/member-kind-enum.ts"() {
|
|
44184
44338
|
"use strict";
|
|
44185
|
-
MemberKind = /* @__PURE__ */ ((
|
|
44186
|
-
|
|
44187
|
-
|
|
44188
|
-
|
|
44189
|
-
|
|
44190
|
-
|
|
44191
|
-
|
|
44192
|
-
|
|
44193
|
-
|
|
44194
|
-
|
|
44195
|
-
|
|
44196
|
-
|
|
44197
|
-
|
|
44198
|
-
|
|
44199
|
-
|
|
44200
|
-
|
|
44201
|
-
|
|
44202
|
-
|
|
44203
|
-
|
|
44204
|
-
|
|
44205
|
-
|
|
44206
|
-
|
|
44207
|
-
|
|
44208
|
-
|
|
44209
|
-
|
|
44210
|
-
|
|
44211
|
-
|
|
44212
|
-
|
|
44213
|
-
|
|
44214
|
-
return
|
|
44339
|
+
MemberKind = /* @__PURE__ */ ((MemberKind16) => {
|
|
44340
|
+
MemberKind16[MemberKind16["Null"] = 0] = "Null";
|
|
44341
|
+
MemberKind16[MemberKind16["Bool"] = 1] = "Bool";
|
|
44342
|
+
MemberKind16[MemberKind16["Int"] = 2] = "Int";
|
|
44343
|
+
MemberKind16[MemberKind16["String"] = 3] = "String";
|
|
44344
|
+
MemberKind16[MemberKind16["Float"] = 4] = "Float";
|
|
44345
|
+
MemberKind16[MemberKind16["Dictionary"] = 5] = "Dictionary";
|
|
44346
|
+
MemberKind16[MemberKind16["List"] = 6] = "List";
|
|
44347
|
+
MemberKind16[MemberKind16["Class"] = 7] = "Class";
|
|
44348
|
+
MemberKind16[MemberKind16["Enum"] = 8] = "Enum";
|
|
44349
|
+
MemberKind16[MemberKind16["Lookup"] = 9] = "Lookup";
|
|
44350
|
+
MemberKind16[MemberKind16["NSProperty"] = 10] = "NSProperty";
|
|
44351
|
+
MemberKind16[MemberKind16["Sprite"] = 11] = "Sprite";
|
|
44352
|
+
MemberKind16[MemberKind16["Audio"] = 12] = "Audio";
|
|
44353
|
+
MemberKind16[MemberKind16["Function"] = 13] = "Function";
|
|
44354
|
+
MemberKind16[MemberKind16["Vector2"] = 14] = "Vector2";
|
|
44355
|
+
MemberKind16[MemberKind16["Vector2Int"] = 15] = "Vector2Int";
|
|
44356
|
+
MemberKind16[MemberKind16["Vector3"] = 16] = "Vector3";
|
|
44357
|
+
MemberKind16[MemberKind16["Vector3Int"] = 17] = "Vector3Int";
|
|
44358
|
+
MemberKind16[MemberKind16["DialogueLookup"] = 18] = "DialogueLookup";
|
|
44359
|
+
MemberKind16[MemberKind16["Color"] = 19] = "Color";
|
|
44360
|
+
MemberKind16[MemberKind16["Decimal"] = 20] = "Decimal";
|
|
44361
|
+
MemberKind16[MemberKind16["Generic"] = 21] = "Generic";
|
|
44362
|
+
MemberKind16[MemberKind16["Interface"] = 22] = "Interface";
|
|
44363
|
+
MemberKind16[MemberKind16["NSFunction"] = 23] = "NSFunction";
|
|
44364
|
+
MemberKind16[MemberKind16["FunctionRef"] = 24] = "FunctionRef";
|
|
44365
|
+
MemberKind16[MemberKind16["NSDelegate"] = 25] = "NSDelegate";
|
|
44366
|
+
MemberKind16[MemberKind16["NSAction"] = 26] = "NSAction";
|
|
44367
|
+
MemberKind16[MemberKind16["Variant"] = 27] = "Variant";
|
|
44368
|
+
return MemberKind16;
|
|
44215
44369
|
})(MemberKind || {});
|
|
44216
44370
|
}
|
|
44217
44371
|
});
|
|
@@ -52159,6 +52313,18 @@ function constructionMembers(classId, context) {
|
|
|
52159
52313
|
}
|
|
52160
52314
|
return result;
|
|
52161
52315
|
}
|
|
52316
|
+
function createMemberDefaultConstructionChecker(document) {
|
|
52317
|
+
const context = contextFor(document);
|
|
52318
|
+
return (member, genericEnv = /* @__PURE__ */ new Map()) => {
|
|
52319
|
+
const previousEnv = context.env;
|
|
52320
|
+
context.env = genericEnv;
|
|
52321
|
+
try {
|
|
52322
|
+
return defaultSettlesConstruction(member, context, /* @__PURE__ */ new Set());
|
|
52323
|
+
} finally {
|
|
52324
|
+
context.env = previousEnv;
|
|
52325
|
+
}
|
|
52326
|
+
};
|
|
52327
|
+
}
|
|
52162
52328
|
function storedValueSettlesConstruction(member, sourceValue, document, genericEnv) {
|
|
52163
52329
|
return valueSettlesConstruction(
|
|
52164
52330
|
member,
|
|
@@ -53360,18 +53526,27 @@ function storedLeafExpectation(kind) {
|
|
|
53360
53526
|
return "canonical decimal string";
|
|
53361
53527
|
}
|
|
53362
53528
|
function* storedValueChildReferences(args) {
|
|
53529
|
+
for (const child of storedValueChildEntries(args)) {
|
|
53530
|
+
if (typeof child.value !== "string") continue;
|
|
53531
|
+
yield {
|
|
53532
|
+
memberId: child.memberId,
|
|
53533
|
+
valueId: child.value,
|
|
53534
|
+
pathSuffix: child.pathSuffix
|
|
53535
|
+
};
|
|
53536
|
+
}
|
|
53537
|
+
}
|
|
53538
|
+
function* storedValueChildEntries(args) {
|
|
53363
53539
|
const entryMemberId = args.member.entryMemberId;
|
|
53364
53540
|
if (args.member.kind === 6 /* List */ && typeof entryMemberId === "string") {
|
|
53365
53541
|
const ids = args.member.listKind === 1 /* Unordered */ && args.unorderedValueIds !== void 0 ? args.unorderedValueIds : Array.isArray(args.body) ? args.body : [];
|
|
53366
53542
|
let pathIndex = 0;
|
|
53367
53543
|
for (const valueId of ids) {
|
|
53368
|
-
if (typeof valueId !== "string") continue;
|
|
53369
53544
|
yield {
|
|
53370
53545
|
memberId: entryMemberId,
|
|
53371
|
-
valueId,
|
|
53546
|
+
value: valueId,
|
|
53372
53547
|
pathSuffix: `[${pathIndex}]`
|
|
53373
53548
|
};
|
|
53374
|
-
pathIndex++;
|
|
53549
|
+
if (typeof valueId === "string") pathIndex++;
|
|
53375
53550
|
}
|
|
53376
53551
|
return;
|
|
53377
53552
|
}
|
|
@@ -53380,16 +53555,14 @@ function* storedValueChildReferences(args) {
|
|
|
53380
53555
|
for (const key in body) {
|
|
53381
53556
|
if (!Object.hasOwn(body, key)) continue;
|
|
53382
53557
|
const valueId = body[key];
|
|
53383
|
-
|
|
53384
|
-
yield { memberId: entryMemberId, valueId, pathSuffix: `.${key}` };
|
|
53558
|
+
yield { memberId: entryMemberId, value: valueId, pathSuffix: `.${key}` };
|
|
53385
53559
|
}
|
|
53386
53560
|
return;
|
|
53387
53561
|
}
|
|
53388
53562
|
if (args.member.kind === 7 /* Class */ && body !== null) {
|
|
53389
53563
|
for (const { schemaKey, memberId } of args.classFields ?? []) {
|
|
53390
53564
|
const valueId = body[schemaKey];
|
|
53391
|
-
|
|
53392
|
-
yield { memberId, valueId, pathSuffix: `.${schemaKey}` };
|
|
53565
|
+
yield { memberId, value: valueId, pathSuffix: `.${schemaKey}` };
|
|
53393
53566
|
}
|
|
53394
53567
|
}
|
|
53395
53568
|
}
|
|
@@ -53450,7 +53623,8 @@ function createDefaultValueResolutionCache() {
|
|
|
53450
53623
|
materializationPlanByClassAndEnvironment: /* @__PURE__ */ new Map(),
|
|
53451
53624
|
resolvedMemberById: /* @__PURE__ */ new Map(),
|
|
53452
53625
|
storedSchemaByClassId: /* @__PURE__ */ new Map(),
|
|
53453
|
-
validatedInitializerContainers: /* @__PURE__ */ new WeakSet()
|
|
53626
|
+
validatedInitializerContainers: /* @__PURE__ */ new WeakSet(),
|
|
53627
|
+
memberDefaultConstructionChecker: null
|
|
53454
53628
|
};
|
|
53455
53629
|
}
|
|
53456
53630
|
function withIndexedDefaultValueDocument(document, options = {}) {
|
|
@@ -53504,6 +53678,13 @@ function withIndexedDefaultValueDocument(document, options = {}) {
|
|
|
53504
53678
|
cache.validatedInitializerContainers.add(value);
|
|
53505
53679
|
return true;
|
|
53506
53680
|
},
|
|
53681
|
+
memberDefaultSettlesConstruction: (member, environment) => {
|
|
53682
|
+
cache.memberDefaultConstructionChecker ??= createMemberDefaultConstructionChecker({
|
|
53683
|
+
...document,
|
|
53684
|
+
constructors: document.constructors ?? []
|
|
53685
|
+
});
|
|
53686
|
+
return cache.memberDefaultConstructionChecker(member, environment);
|
|
53687
|
+
},
|
|
53507
53688
|
createValueRow: options.createValueRow ?? document.createValueRow
|
|
53508
53689
|
};
|
|
53509
53690
|
indexed.storedInstanceMaterializationPlan = (classId, environment) => {
|
|
@@ -53549,6 +53730,10 @@ function directScalarDefaultBody(document, member) {
|
|
|
53549
53730
|
return { value: body.value, classId: body.classId };
|
|
53550
53731
|
}
|
|
53551
53732
|
function buildDefaultClassMaterializationPlan(document, classId, instanceEnv) {
|
|
53733
|
+
const settlesConstruction = document.memberDefaultSettlesConstruction ?? createMemberDefaultConstructionChecker({
|
|
53734
|
+
...document,
|
|
53735
|
+
constructors: document.constructors ?? []
|
|
53736
|
+
});
|
|
53552
53737
|
const merged = document.storedInstanceSchema?.(classId) ?? mergeStoredInstanceSchema(classId, document.classes, document.members);
|
|
53553
53738
|
return merged.flatMap((entry) => {
|
|
53554
53739
|
if (entry.memberId === null) return [];
|
|
@@ -53564,6 +53749,7 @@ function buildDefaultClassMaterializationPlan(document, classId, instanceEnv) {
|
|
|
53564
53749
|
{
|
|
53565
53750
|
schemaKey: entry.schemaKey,
|
|
53566
53751
|
member,
|
|
53752
|
+
defaultSettlesConstruction: settlesConstruction(member, instanceEnv),
|
|
53567
53753
|
directScalarBody: directScalarDefaultBody(document, member)
|
|
53568
53754
|
}
|
|
53569
53755
|
];
|
|
@@ -53772,6 +53958,7 @@ function buildDefaultMemberValue(args) {
|
|
|
53772
53958
|
for (const {
|
|
53773
53959
|
schemaKey,
|
|
53774
53960
|
member: resolvedChildMember,
|
|
53961
|
+
defaultSettlesConstruction: defaultSettlesConstruction2,
|
|
53775
53962
|
directScalarBody
|
|
53776
53963
|
} of member.payload === 1 /* Partial */ ? [] : materializationPlan) {
|
|
53777
53964
|
if (storageKeyReferencesParentClass(
|
|
@@ -53787,6 +53974,7 @@ function buildDefaultMemberValue(args) {
|
|
|
53787
53974
|
args.constructorRoot,
|
|
53788
53975
|
schemaKey,
|
|
53789
53976
|
resolvedChildMember,
|
|
53977
|
+
defaultSettlesConstruction2,
|
|
53790
53978
|
documentHasInitValueContent(
|
|
53791
53979
|
args.document,
|
|
53792
53980
|
resolvedChildMember.defaultValue
|
|
@@ -53794,7 +53982,7 @@ function buildDefaultMemberValue(args) {
|
|
|
53794
53982
|
)) {
|
|
53795
53983
|
continue;
|
|
53796
53984
|
}
|
|
53797
|
-
if (isRequiredMember2(resolvedChildMember) &&
|
|
53985
|
+
if (isRequiredMember2(resolvedChildMember) && !defaultSettlesConstruction2 && !(isMemberClassBase(resolvedChildMember) && resolvedChildMember.payload === 1 /* Partial */)) {
|
|
53798
53986
|
if (args.constructorRoot?.runsMemberInitializers === true) continue;
|
|
53799
53987
|
if (args.constructorRoot?.omitMissingRequired === true) continue;
|
|
53800
53988
|
throw new Error(
|
|
@@ -53804,6 +53992,7 @@ function buildDefaultMemberValue(args) {
|
|
|
53804
53992
|
if (!shouldMaterializeChildDefaultForRoot(
|
|
53805
53993
|
args.constructorRoot,
|
|
53806
53994
|
resolvedChildMember,
|
|
53995
|
+
defaultSettlesConstruction2,
|
|
53807
53996
|
documentHasInitValueContent(
|
|
53808
53997
|
args.document,
|
|
53809
53998
|
resolvedChildMember.defaultValue
|
|
@@ -54309,18 +54498,18 @@ function shouldMaterializeConstructorChildDefault(member, isInitializer = isInit
|
|
|
54309
54498
|
if (!isRequiredMember2(member)) return false;
|
|
54310
54499
|
return shouldMaterializeChildDefault(member);
|
|
54311
54500
|
}
|
|
54312
|
-
function skipProvidedConstructorSchemaKey(constructorRoot, schemaKey, member, isInitializer = isInitValueContent(member.defaultValue)) {
|
|
54501
|
+
function skipProvidedConstructorSchemaKey(constructorRoot, schemaKey, member, defaultSettlesConstruction2, isInitializer = isInitValueContent(member.defaultValue)) {
|
|
54313
54502
|
if (constructorRoot === void 0) return false;
|
|
54314
54503
|
if (!constructorRoot.providedSchemaKeys.has(schemaKey)) return false;
|
|
54315
54504
|
if (constructorRoot.runsMemberInitializers !== true) {
|
|
54316
54505
|
return !isInitializer;
|
|
54317
54506
|
}
|
|
54318
|
-
return
|
|
54507
|
+
return !isInitializer && !defaultSettlesConstruction2;
|
|
54319
54508
|
}
|
|
54320
|
-
function shouldMaterializeChildDefaultForRoot(constructorRoot, member, isInitializer = isInitValueContent(member.defaultValue)) {
|
|
54509
|
+
function shouldMaterializeChildDefaultForRoot(constructorRoot, member, defaultSettlesConstruction2, isInitializer = isInitValueContent(member.defaultValue)) {
|
|
54321
54510
|
if (constructorRoot === void 0)
|
|
54322
54511
|
return shouldMaterializeChildDefault(member);
|
|
54323
|
-
if (constructorRoot.omitMissingRequired === true &&
|
|
54512
|
+
if (constructorRoot.omitMissingRequired === true && !defaultSettlesConstruction2) {
|
|
54324
54513
|
return false;
|
|
54325
54514
|
}
|
|
54326
54515
|
if (constructorRoot.runsMemberInitializers === true) {
|
|
@@ -67987,25 +68176,31 @@ function clearNeoScriptBodyCompileCache() {
|
|
|
67987
68176
|
neoScriptBodyCompileCache.clear();
|
|
67988
68177
|
}
|
|
67989
68178
|
function createNeoScriptCompilationProject(ctx) {
|
|
67990
|
-
const
|
|
67991
|
-
const
|
|
67992
|
-
|
|
67993
|
-
vm: {
|
|
67994
|
-
project: ctx.project,
|
|
67995
|
-
projectFiles: [...ctx.projectFiles ?? []],
|
|
67996
|
-
members,
|
|
67997
|
-
classes: [...ctx.classes],
|
|
67998
|
-
enums: [...ctx.enums],
|
|
67999
|
-
interfaces: [...ctx.interfaces ?? []],
|
|
68000
|
-
databaseVM: {
|
|
68001
|
-
memberById: (id2) => membersById.get(id2) ?? null
|
|
68002
|
-
}
|
|
68003
|
-
},
|
|
68179
|
+
const vm = createAnalyzerProject(ctx);
|
|
68180
|
+
const project = createNeoScriptProject({
|
|
68181
|
+
vm,
|
|
68004
68182
|
thisClass: null,
|
|
68005
68183
|
...ctx.constructors ? { constructors: ctx.constructors } : {},
|
|
68006
68184
|
...ctx.variants ? { variants: ctx.variants } : {},
|
|
68007
68185
|
...ctx.variantFolders ? { variantFolders: ctx.variantFolders } : {}
|
|
68008
68186
|
});
|
|
68187
|
+
analyzerProjects.set(project, vm);
|
|
68188
|
+
return project;
|
|
68189
|
+
}
|
|
68190
|
+
function createAnalyzerProject(ctx) {
|
|
68191
|
+
const members = [...ctx.members];
|
|
68192
|
+
const membersById = new Map(members.map((member) => [member.id, member]));
|
|
68193
|
+
return {
|
|
68194
|
+
project: ctx.project,
|
|
68195
|
+
projectFiles: [...ctx.projectFiles ?? []],
|
|
68196
|
+
members,
|
|
68197
|
+
classes: [...ctx.classes],
|
|
68198
|
+
enums: [...ctx.enums],
|
|
68199
|
+
interfaces: [...ctx.interfaces ?? []],
|
|
68200
|
+
databaseVM: {
|
|
68201
|
+
memberById: (id2) => membersById.get(id2) ?? null
|
|
68202
|
+
}
|
|
68203
|
+
};
|
|
68009
68204
|
}
|
|
68010
68205
|
function compileNSGetter(code, ctx) {
|
|
68011
68206
|
return compileStrict(
|
|
@@ -68139,7 +68334,8 @@ function compileStrict(code, context) {
|
|
|
68139
68334
|
version: 1,
|
|
68140
68335
|
text: code
|
|
68141
68336
|
},
|
|
68142
|
-
context
|
|
68337
|
+
context,
|
|
68338
|
+
compilationProjectIndex(context.project)
|
|
68143
68339
|
);
|
|
68144
68340
|
if ("getter" in compiled) {
|
|
68145
68341
|
throw new Error(
|
|
@@ -68161,21 +68357,17 @@ function compilationProjectIdentity(project) {
|
|
|
68161
68357
|
neoScriptProjectIdentityCache.set(project, identity2);
|
|
68162
68358
|
return identity2;
|
|
68163
68359
|
}
|
|
68360
|
+
function compilationProjectIndex(project) {
|
|
68361
|
+
const cached = neoScriptProjectIndexes.get(project);
|
|
68362
|
+
if (cached !== void 0) return cached;
|
|
68363
|
+
const index = createProjectIndex(project);
|
|
68364
|
+
neoScriptProjectIndexes.set(project, index);
|
|
68365
|
+
return index;
|
|
68366
|
+
}
|
|
68164
68367
|
function createContext(ctx, options) {
|
|
68165
|
-
const
|
|
68166
|
-
const membersById = new Map(members.map((member) => [member.id, member]));
|
|
68368
|
+
const prepared = ctx.compilationProject === void 0 ? void 0 : analyzerProjects.get(ctx.compilationProject);
|
|
68167
68369
|
const analyzer = {
|
|
68168
|
-
vm:
|
|
68169
|
-
project: ctx.project,
|
|
68170
|
-
projectFiles: [...ctx.projectFiles ?? []],
|
|
68171
|
-
members,
|
|
68172
|
-
classes: [...ctx.classes],
|
|
68173
|
-
enums: [...ctx.enums],
|
|
68174
|
-
interfaces: [...ctx.interfaces ?? []],
|
|
68175
|
-
databaseVM: {
|
|
68176
|
-
memberById: (id2) => membersById.get(id2) ?? null
|
|
68177
|
-
}
|
|
68178
|
-
},
|
|
68370
|
+
vm: prepared ?? createAnalyzerProject(ctx),
|
|
68179
68371
|
thisClass: ctx.thisClass,
|
|
68180
68372
|
...ctx.valueAliases ? { valueAliases: ctx.valueAliases } : {},
|
|
68181
68373
|
...ctx.constructors ? { constructors: ctx.constructors } : {},
|
|
@@ -68202,7 +68394,7 @@ function createContext(ctx, options) {
|
|
|
68202
68394
|
staticMember: ctx.staticMember === true
|
|
68203
68395
|
};
|
|
68204
68396
|
}
|
|
68205
|
-
var NEOSCRIPT_BODY_COMPILE_CACHE_LIMIT, neoScriptBodyCompileCache, neoScriptProjectIdentityCache, nextNeoScriptProjectIdentity;
|
|
68397
|
+
var NEOSCRIPT_BODY_COMPILE_CACHE_LIMIT, neoScriptBodyCompileCache, neoScriptProjectIdentityCache, neoScriptProjectIndexes, analyzerProjects, nextNeoScriptProjectIdentity;
|
|
68206
68398
|
var init_compile = __esm({
|
|
68207
68399
|
"../src/database/neoscript/compile.ts"() {
|
|
68208
68400
|
"use strict";
|
|
@@ -68211,6 +68403,8 @@ var init_compile = __esm({
|
|
|
68211
68403
|
NEOSCRIPT_BODY_COMPILE_CACHE_LIMIT = 1024;
|
|
68212
68404
|
neoScriptBodyCompileCache = /* @__PURE__ */ new Map();
|
|
68213
68405
|
neoScriptProjectIdentityCache = /* @__PURE__ */ new WeakMap();
|
|
68406
|
+
neoScriptProjectIndexes = /* @__PURE__ */ new WeakMap();
|
|
68407
|
+
analyzerProjects = /* @__PURE__ */ new WeakMap();
|
|
68214
68408
|
nextNeoScriptProjectIdentity = 1;
|
|
68215
68409
|
}
|
|
68216
68410
|
});
|
|
@@ -84081,6 +84275,108 @@ var init_project_record_migrations = __esm({
|
|
|
84081
84275
|
}
|
|
84082
84276
|
});
|
|
84083
84277
|
|
|
84278
|
+
// ../src/database/member-default-reference-ids.ts
|
|
84279
|
+
async function loadMemberDefaultValueClosure(args) {
|
|
84280
|
+
const classes = args.classes.filter(isNeoSchemaClass);
|
|
84281
|
+
const members = args.members.filter(isAnyMember);
|
|
84282
|
+
const index = projectSchemaIndexFor({ classes, members });
|
|
84283
|
+
const classSchemas = /* @__PURE__ */ new Map();
|
|
84284
|
+
const defaultEnvironments = /* @__PURE__ */ new Map();
|
|
84285
|
+
const defaultEnvironment = (classId) => {
|
|
84286
|
+
let env = defaultEnvironments.get(classId);
|
|
84287
|
+
if (env === void 0) {
|
|
84288
|
+
env = resolveInstanceEnv(classId, void 0, classes);
|
|
84289
|
+
defaultEnvironments.set(classId, env);
|
|
84290
|
+
}
|
|
84291
|
+
return env;
|
|
84292
|
+
};
|
|
84293
|
+
const pending = [];
|
|
84294
|
+
const visited = /* @__PURE__ */ new Set();
|
|
84295
|
+
const closure = /* @__PURE__ */ new Map();
|
|
84296
|
+
const visit = (rawMember, source, ambientEnv) => {
|
|
84297
|
+
if (!isLiteralValueContent(source)) return;
|
|
84298
|
+
if (typeof source.value !== "object" || source.value === null || Object.keys(source.value).length === 0)
|
|
84299
|
+
return;
|
|
84300
|
+
const stamp = "genericBindings" in source ? source.genericBindings : void 0;
|
|
84301
|
+
const withStamp = (base) => {
|
|
84302
|
+
if (typeof stamp !== "object" || stamp === null) return base;
|
|
84303
|
+
const stamped = new Map(base);
|
|
84304
|
+
for (const [parameterId, memberId] of Object.entries(stamp)) {
|
|
84305
|
+
if (typeof memberId === "string")
|
|
84306
|
+
stamped.set(parameterId, { kind: "member", memberId });
|
|
84307
|
+
}
|
|
84308
|
+
return stamped;
|
|
84309
|
+
};
|
|
84310
|
+
let env = withStamp(ambientEnv);
|
|
84311
|
+
const member = substituteMember(rawMember, env, members);
|
|
84312
|
+
let classFields;
|
|
84313
|
+
if (isMemberClassBase(member)) {
|
|
84314
|
+
const classId = source.classId ?? member.classId;
|
|
84315
|
+
classFields = classSchemas.get(classId);
|
|
84316
|
+
if (classFields === void 0) {
|
|
84317
|
+
classFields = mergeStoredInstanceSchema(classId, classes, members);
|
|
84318
|
+
classSchemas.set(classId, classFields);
|
|
84319
|
+
}
|
|
84320
|
+
env = withStamp(
|
|
84321
|
+
member.classArguments == null ? defaultEnvironment(classId) : resolveInstanceEnv(classId, member.classArguments, classes)
|
|
84322
|
+
);
|
|
84323
|
+
}
|
|
84324
|
+
for (const child of storedValueChildEntries({
|
|
84325
|
+
member,
|
|
84326
|
+
body: source.value,
|
|
84327
|
+
classFields
|
|
84328
|
+
})) {
|
|
84329
|
+
const childMember = index.member(child.memberId);
|
|
84330
|
+
if (childMember === void 0) continue;
|
|
84331
|
+
if (typeof child.value === "string")
|
|
84332
|
+
pending.push({ id: child.value, member: childMember, env });
|
|
84333
|
+
else if (isPackedValueEnvelope(child.value))
|
|
84334
|
+
visit(childMember, child.value["~packed"], env);
|
|
84335
|
+
}
|
|
84336
|
+
};
|
|
84337
|
+
for (const member of members) {
|
|
84338
|
+
if (member.defaultValue === void 0) continue;
|
|
84339
|
+
const placement = index.firstSchemaPlacement(member.id);
|
|
84340
|
+
const env = placement === null ? /* @__PURE__ */ new Map() : defaultEnvironment(placement.ownerClass.id);
|
|
84341
|
+
visit(member, member.defaultValue, env);
|
|
84342
|
+
}
|
|
84343
|
+
while (pending.length > 0) {
|
|
84344
|
+
const missing = [];
|
|
84345
|
+
while (pending.length > 0 && missing.length < 128) {
|
|
84346
|
+
const item = pending.pop();
|
|
84347
|
+
if (visited.has(item.id)) continue;
|
|
84348
|
+
visited.add(item.id);
|
|
84349
|
+
const row = args.valuesById.get(item.id);
|
|
84350
|
+
if (row === void 0) missing.push(item);
|
|
84351
|
+
else {
|
|
84352
|
+
closure.set(item.id, row);
|
|
84353
|
+
visit(item.member, args.data(row), item.env);
|
|
84354
|
+
}
|
|
84355
|
+
}
|
|
84356
|
+
if (missing.length === 0) continue;
|
|
84357
|
+
const loaded = await args.loadValues(missing.map((item) => item.id));
|
|
84358
|
+
for (const item of missing) {
|
|
84359
|
+
const row = loaded.get(item.id);
|
|
84360
|
+
if (row === void 0) continue;
|
|
84361
|
+
closure.set(item.id, row);
|
|
84362
|
+
visit(item.member, args.data(row), item.env);
|
|
84363
|
+
}
|
|
84364
|
+
}
|
|
84365
|
+
return closure;
|
|
84366
|
+
}
|
|
84367
|
+
var init_member_default_reference_ids = __esm({
|
|
84368
|
+
"../src/database/member-default-reference-ids.ts"() {
|
|
84369
|
+
"use strict";
|
|
84370
|
+
init_classes();
|
|
84371
|
+
init_inheritance();
|
|
84372
|
+
init_generics();
|
|
84373
|
+
init_members();
|
|
84374
|
+
init_packed_value_encoding();
|
|
84375
|
+
init_stored_value_shape();
|
|
84376
|
+
init_project_schema_index();
|
|
84377
|
+
}
|
|
84378
|
+
});
|
|
84379
|
+
|
|
84084
84380
|
// ../src/database/project-document-read.ts
|
|
84085
84381
|
var project_document_read_exports = {};
|
|
84086
84382
|
__export(project_document_read_exports, {
|
|
@@ -84090,6 +84386,7 @@ __export(project_document_read_exports, {
|
|
|
84090
84386
|
fetchProjectDocumentRawChunked: () => fetchProjectDocumentRawChunked,
|
|
84091
84387
|
fetchProjectDocumentRawChunkedOnce: () => fetchProjectDocumentRawChunkedOnce,
|
|
84092
84388
|
fetchProjectDocumentSnapshots: () => fetchProjectDocumentSnapshots,
|
|
84389
|
+
fetchProjectDocumentValueRecords: () => fetchProjectDocumentValueRecords,
|
|
84093
84390
|
readArrayField: () => readArrayField,
|
|
84094
84391
|
readProjectDocument: () => readProjectDocument,
|
|
84095
84392
|
readProjectDocumentContentHashHeads: () => readProjectDocumentContentHashHeads,
|
|
@@ -84167,7 +84464,8 @@ async function fetchProjectDocumentRawChunkedOnce(runner, options = {}) {
|
|
|
84167
84464
|
const pageResult = await runner.fetchManifestPage(
|
|
84168
84465
|
{ numItems: DOCUMENT_MANIFEST_PAGE_SIZE, cursor: null },
|
|
84169
84466
|
mapKey,
|
|
84170
|
-
readBase
|
|
84467
|
+
readBase,
|
|
84468
|
+
"omit"
|
|
84171
84469
|
);
|
|
84172
84470
|
if (pageResult === null) {
|
|
84173
84471
|
throw new Error(
|
|
@@ -84179,8 +84477,34 @@ async function fetchProjectDocumentRawChunkedOnce(runner, options = {}) {
|
|
|
84179
84477
|
await rememberRecords(page.records);
|
|
84180
84478
|
await fetchRemainingPages(mapKey, page.continueCursor);
|
|
84181
84479
|
}
|
|
84182
|
-
const records2 = [...recordsByKey.values()];
|
|
84183
84480
|
const snapshotsById = await snapshots.finish();
|
|
84481
|
+
if (options.mapKeys !== void 0 && !options.mapKeys.includes("all")) {
|
|
84482
|
+
const members = [];
|
|
84483
|
+
const classes = [];
|
|
84484
|
+
const valuesById = /* @__PURE__ */ new Map();
|
|
84485
|
+
for (const snapshot of snapshotsById.values()) {
|
|
84486
|
+
if (snapshot.recordKind === "member") members.push(snapshot.data);
|
|
84487
|
+
if (snapshot.recordKind === "class") classes.push(snapshot.data);
|
|
84488
|
+
if (snapshot.recordKind === "value")
|
|
84489
|
+
valuesById.set(snapshot.recordId, snapshot);
|
|
84490
|
+
}
|
|
84491
|
+
const defaults = await loadMemberDefaultValueClosure({
|
|
84492
|
+
classes,
|
|
84493
|
+
members,
|
|
84494
|
+
valuesById,
|
|
84495
|
+
data: (snapshot) => snapshot.data,
|
|
84496
|
+
loadValues: (ids) => fetchProjectDocumentValueRecords(runner, ids, readBase)
|
|
84497
|
+
});
|
|
84498
|
+
for (const snapshot of defaults.values()) {
|
|
84499
|
+
snapshotsById.set(snapshot.id, snapshot);
|
|
84500
|
+
recordsByKey.set(`value ${snapshot.recordId}`, {
|
|
84501
|
+
recordKind: "value",
|
|
84502
|
+
recordId: snapshot.recordId,
|
|
84503
|
+
snapshotId: snapshot.id
|
|
84504
|
+
});
|
|
84505
|
+
}
|
|
84506
|
+
}
|
|
84507
|
+
const records2 = [...recordsByKey.values()];
|
|
84184
84508
|
await runner.validateReadBase(readBase);
|
|
84185
84509
|
return assembleProjectDocumentRaw({
|
|
84186
84510
|
version: metadata.version,
|
|
@@ -84207,47 +84531,95 @@ async function fetchProjectDocumentPartitionRecords(runner, mapKey, readBase) {
|
|
|
84207
84531
|
);
|
|
84208
84532
|
}
|
|
84209
84533
|
const recordsByKey = /* @__PURE__ */ new Map();
|
|
84534
|
+
const snapshots = createProjectDocumentSnapshotLoader(
|
|
84535
|
+
(ids) => fetchScopedSnapshotBatch(runner, ids, readBase)
|
|
84536
|
+
);
|
|
84537
|
+
try {
|
|
84538
|
+
let cursor = null;
|
|
84539
|
+
do {
|
|
84540
|
+
const pageResult = await runner.fetchManifestPage(
|
|
84541
|
+
{ numItems: DOCUMENT_MANIFEST_PAGE_SIZE, cursor },
|
|
84542
|
+
mapKey,
|
|
84543
|
+
readBase,
|
|
84544
|
+
"omit"
|
|
84545
|
+
);
|
|
84546
|
+
if (pageResult === null) {
|
|
84547
|
+
throw new Error(
|
|
84548
|
+
`Convex project document manifest returned null for partition "${mapKey}".`
|
|
84549
|
+
);
|
|
84550
|
+
}
|
|
84551
|
+
const page = readProjectDocumentManifestPage(pageResult);
|
|
84552
|
+
assertProjectReadBase(readBase, page.readBase);
|
|
84553
|
+
for (const record4 of page.records) {
|
|
84554
|
+
recordsByKey.set(`${record4.recordKind} ${record4.recordId}`, record4);
|
|
84555
|
+
}
|
|
84556
|
+
await snapshots.enqueue(page.records.map((record4) => record4.snapshotId));
|
|
84557
|
+
cursor = page.continueCursor;
|
|
84558
|
+
} while (cursor !== null);
|
|
84559
|
+
const snapshotsById = await snapshots.finish();
|
|
84560
|
+
await runner.validateReadBase(readBase);
|
|
84561
|
+
return [...recordsByKey.values()].map((record4) => {
|
|
84562
|
+
const snapshot = snapshotsById.get(record4.snapshotId);
|
|
84563
|
+
if (snapshot === void 0) {
|
|
84564
|
+
throw new Error(
|
|
84565
|
+
`Partition "${mapKey}" snapshot "${record4.snapshotId}" referenced by the manifest was not returned by any snapshot batch.`
|
|
84566
|
+
);
|
|
84567
|
+
}
|
|
84568
|
+
return {
|
|
84569
|
+
recordKind: record4.recordKind,
|
|
84570
|
+
recordId: record4.recordId,
|
|
84571
|
+
deleted: false,
|
|
84572
|
+
data: snapshot.data,
|
|
84573
|
+
contentHash: snapshot.contentHash
|
|
84574
|
+
};
|
|
84575
|
+
});
|
|
84576
|
+
} finally {
|
|
84577
|
+
await snapshots.stop();
|
|
84578
|
+
}
|
|
84579
|
+
}
|
|
84580
|
+
async function fetchProjectDocumentValueRecords(runner, valueIds, readBase) {
|
|
84581
|
+
if (runner.fetchValueHeadsPage === void 0) {
|
|
84582
|
+
throw new Error(
|
|
84583
|
+
"Partition-scoped document reads require a value-head reader for member defaults."
|
|
84584
|
+
);
|
|
84585
|
+
}
|
|
84586
|
+
const values = /* @__PURE__ */ new Map();
|
|
84210
84587
|
let cursor = null;
|
|
84211
84588
|
do {
|
|
84212
|
-
const
|
|
84213
|
-
|
|
84214
|
-
|
|
84215
|
-
|
|
84216
|
-
);
|
|
84217
|
-
if (
|
|
84589
|
+
const page = await runner.fetchValueHeadsPage(valueIds, cursor, readBase);
|
|
84590
|
+
if (!isObject4(page)) throw new Error("Value-head page must be an object.");
|
|
84591
|
+
const revision = readProjectDocumentRevisionMarker({
|
|
84592
|
+
documentRevision: page.documentRevision
|
|
84593
|
+
});
|
|
84594
|
+
if (revision === null)
|
|
84595
|
+
throw new Error("Value-head page has no document revision.");
|
|
84596
|
+
assertProjectReadBase(readBase, revision.readBase);
|
|
84597
|
+
if (!Array.isArray(page.snapshotIds) || !page.snapshotIds.every((id2) => typeof id2 === "string"))
|
|
84218
84598
|
throw new Error(
|
|
84219
|
-
|
|
84599
|
+
"Value-head page snapshotIds must be an array of strings."
|
|
84220
84600
|
);
|
|
84221
|
-
|
|
84222
|
-
const page = readProjectDocumentManifestPage(pageResult);
|
|
84223
|
-
assertProjectReadBase(readBase, page.readBase);
|
|
84224
|
-
for (const record4 of page.records) {
|
|
84225
|
-
recordsByKey.set(`${record4.recordKind} ${record4.recordId}`, record4);
|
|
84226
|
-
}
|
|
84227
|
-
cursor = page.continueCursor;
|
|
84228
|
-
} while (cursor !== null);
|
|
84229
|
-
const records2 = [...recordsByKey.values()];
|
|
84230
|
-
const snapshotIds = [...new Set(records2.map((record4) => record4.snapshotId))];
|
|
84231
|
-
const snapshotsById = await fetchProjectDocumentSnapshots(
|
|
84232
|
-
(ids) => fetchScopedSnapshotBatch(runner, ids, readBase),
|
|
84233
|
-
snapshotIds
|
|
84234
|
-
);
|
|
84235
|
-
await runner.validateReadBase(readBase);
|
|
84236
|
-
return records2.map((record4) => {
|
|
84237
|
-
const snapshot = snapshotsById.get(record4.snapshotId);
|
|
84238
|
-
if (snapshot === void 0) {
|
|
84601
|
+
if (page.continueCursor !== null && typeof page.continueCursor !== "string")
|
|
84239
84602
|
throw new Error(
|
|
84240
|
-
|
|
84603
|
+
"Value-head page continueCursor must be a string or null."
|
|
84241
84604
|
);
|
|
84605
|
+
const loaded = await fetchProjectDocumentSnapshots(
|
|
84606
|
+
(ids) => fetchScopedSnapshotBatch(runner, ids, readBase),
|
|
84607
|
+
page.snapshotIds
|
|
84608
|
+
);
|
|
84609
|
+
for (const snapshot of loaded.values()) {
|
|
84610
|
+
if (snapshot.recordKind !== "value")
|
|
84611
|
+
throw new Error("Value-head page returned a non-value snapshot.");
|
|
84612
|
+
if (snapshot.deleted)
|
|
84613
|
+
throw new Error("Value-head page returned a deleted snapshot.");
|
|
84614
|
+
if (!valueIds.includes(snapshot.recordId))
|
|
84615
|
+
throw new Error(
|
|
84616
|
+
`Value-head page returned unrequested value "${snapshot.recordId}".`
|
|
84617
|
+
);
|
|
84618
|
+
values.set(snapshot.recordId, snapshot);
|
|
84242
84619
|
}
|
|
84243
|
-
|
|
84244
|
-
|
|
84245
|
-
|
|
84246
|
-
deleted: false,
|
|
84247
|
-
data: snapshot.data,
|
|
84248
|
-
contentHash: snapshot.contentHash
|
|
84249
|
-
};
|
|
84250
|
-
});
|
|
84620
|
+
cursor = page.continueCursor;
|
|
84621
|
+
} while (cursor !== null);
|
|
84622
|
+
return values;
|
|
84251
84623
|
}
|
|
84252
84624
|
function assertProjectReadBase(expected, actual) {
|
|
84253
84625
|
if (!projectReadBasesMatch(expected, actual))
|
|
@@ -84817,8 +85189,9 @@ var init_project_document_read = __esm({
|
|
|
84817
85189
|
init_projectDocumentDialogueMaterialization();
|
|
84818
85190
|
init_projectRecordBuckets();
|
|
84819
85191
|
init_project_record_migrations();
|
|
85192
|
+
init_member_default_reference_ids();
|
|
84820
85193
|
DOCUMENT_MANIFEST_PAGE_SIZE = 2048;
|
|
84821
|
-
DOCUMENT_SNAPSHOT_FETCH_CHUNK_SIZE =
|
|
85194
|
+
DOCUMENT_SNAPSHOT_FETCH_CHUNK_SIZE = 128;
|
|
84822
85195
|
DOCUMENT_SNAPSHOT_FETCH_CONCURRENCY = 4;
|
|
84823
85196
|
}
|
|
84824
85197
|
});
|
|
@@ -113956,7 +114329,18 @@ function animationConstructorProjectionTargetValueIds(context, classId, value) {
|
|
|
113956
114329
|
}
|
|
113957
114330
|
return targetIds;
|
|
113958
114331
|
}
|
|
113959
|
-
function
|
|
114332
|
+
function isTileInstanceClass(classId, classes) {
|
|
114333
|
+
const visited = /* @__PURE__ */ new Set();
|
|
114334
|
+
while (typeof classId === "string" && !visited.has(classId)) {
|
|
114335
|
+
visited.add(classId);
|
|
114336
|
+
const schemaClass2 = classes.get(classId);
|
|
114337
|
+
if (isObjectRecord2(schemaClass2?.system) && schemaClass2.system.worldKind === "tileInstance")
|
|
114338
|
+
return true;
|
|
114339
|
+
classId = schemaClass2?.extendsClassId;
|
|
114340
|
+
}
|
|
114341
|
+
return false;
|
|
114342
|
+
}
|
|
114343
|
+
function rowBackedDefaultBody(member, isPulledValueRow, classes) {
|
|
113960
114344
|
if (member.modifier === 3) return null;
|
|
113961
114345
|
const defaultValue = member.defaultValue;
|
|
113962
114346
|
if (!isObjectRecord2(defaultValue)) return null;
|
|
@@ -113965,7 +114349,10 @@ function rowBackedDefaultBody(member, isPulledValueRow) {
|
|
|
113965
114349
|
(child) => typeof child === "string" && isPulledValueRow(child)
|
|
113966
114350
|
);
|
|
113967
114351
|
if (member.kind === MEMBER_KIND_CLASS2 && isObjectRecord2(body)) {
|
|
113968
|
-
const children =
|
|
114352
|
+
const children = isTileInstanceClass(
|
|
114353
|
+
defaultValue.classId ?? member.classId,
|
|
114354
|
+
classes
|
|
114355
|
+
) ? Object.entries(body).filter(([key]) => key !== "assetClassId" && key !== "variantId").map(([, value]) => value) : Object.values(body);
|
|
113969
114356
|
return referencesRows(children) ? { kind: "class", body } : null;
|
|
113970
114357
|
}
|
|
113971
114358
|
if (member.kind === MEMBER_KIND_LIST2 && member.listKind !== "unordered" && Array.isArray(body)) {
|
|
@@ -113981,15 +114368,18 @@ function rowBackedDefaultBody(member, isPulledValueRow) {
|
|
|
113981
114368
|
}
|
|
113982
114369
|
function rowBackedDefaultMemberIdsV4(state) {
|
|
113983
114370
|
const values = /* @__PURE__ */ new Set();
|
|
114371
|
+
const classes = /* @__PURE__ */ new Map();
|
|
113984
114372
|
for (const record4 of Object.values(state)) {
|
|
113985
114373
|
if (record4.recordKind === "value") values.add(record4.recordId);
|
|
114374
|
+
if (record4.recordKind === "class" && isObjectRecord2(record4.data))
|
|
114375
|
+
classes.set(record4.recordId, record4.data);
|
|
113986
114376
|
}
|
|
113987
114377
|
const result = /* @__PURE__ */ new Set();
|
|
113988
114378
|
for (const record4 of Object.values(state)) {
|
|
113989
114379
|
if (record4.recordKind !== "member" || !isObjectRecord2(record4.data)) {
|
|
113990
114380
|
continue;
|
|
113991
114381
|
}
|
|
113992
|
-
if (rowBackedDefaultBody(record4.data, (id2) => values.has(id2)) !== null) {
|
|
114382
|
+
if (rowBackedDefaultBody(record4.data, (id2) => values.has(id2), classes) !== null) {
|
|
113993
114383
|
result.add(record4.recordId);
|
|
113994
114384
|
}
|
|
113995
114385
|
}
|
|
@@ -114023,7 +114413,11 @@ function emitMemberDefaultSourcesV4(records2, manifest) {
|
|
|
114023
114413
|
context.localizedTextIds.clear();
|
|
114024
114414
|
continue;
|
|
114025
114415
|
}
|
|
114026
|
-
const backed = rowBackedDefaultBody(
|
|
114416
|
+
const backed = rowBackedDefaultBody(
|
|
114417
|
+
member,
|
|
114418
|
+
(id2) => context.values.has(id2),
|
|
114419
|
+
context.manifestClasses
|
|
114420
|
+
);
|
|
114027
114421
|
if (backed === null) continue;
|
|
114028
114422
|
const visited = /* @__PURE__ */ new Set();
|
|
114029
114423
|
const environment = declaringClassGenericEnvironment(context, member);
|
|
@@ -114750,7 +115144,11 @@ function lowerMemberDefaultSourcesV4(state, analysis, manifest, options = {}) {
|
|
|
114750
115144
|
});
|
|
114751
115145
|
continue;
|
|
114752
115146
|
}
|
|
114753
|
-
const backed = baseData3 === null || requiresEvaluation ? null : rowBackedDefaultBody(
|
|
115147
|
+
const backed = baseData3 === null || requiresEvaluation ? null : rowBackedDefaultBody(
|
|
115148
|
+
baseData3,
|
|
115149
|
+
(id2) => pulledValueIds.has(id2),
|
|
115150
|
+
context.classes
|
|
115151
|
+
);
|
|
114754
115152
|
if (backed !== null && baseData3 !== null) {
|
|
114755
115153
|
const existingReconstructedKeys = new Set(context.reconstructed.keys());
|
|
114756
115154
|
const existingPendingValueIds = new Set(context.pendingValues.keys());
|
|
@@ -115349,9 +115747,11 @@ function classGenericEnvironment(context, classId) {
|
|
|
115349
115747
|
function lowerRowBackedDefault(context, member, backed, baseData3, binding) {
|
|
115350
115748
|
const baseDefault = isObjectRecord2(baseData3.defaultValue) ? baseData3.defaultValue : {};
|
|
115351
115749
|
const storedClassId = stringOrNull2(baseDefault.classId);
|
|
115352
|
-
const
|
|
115353
|
-
|
|
115354
|
-
|
|
115750
|
+
const sourceExpression = parseCachedInitializer(
|
|
115751
|
+
context.parsedInitializers,
|
|
115752
|
+
binding.initializer
|
|
115753
|
+
);
|
|
115754
|
+
const expression = annotatedValue(sourceExpression).expression;
|
|
115355
115755
|
const bindingEnvironment = bindingGenericEnvironment(context, binding);
|
|
115356
115756
|
if (member.kind === "class" && backed.kind === "class") {
|
|
115357
115757
|
if (expression.kind === "litNull") {
|
|
@@ -115390,6 +115790,21 @@ function lowerRowBackedDefault(context, member, backed, baseData3, binding) {
|
|
|
115390
115790
|
);
|
|
115391
115791
|
const baseBody = backed.body;
|
|
115392
115792
|
const body = {};
|
|
115793
|
+
if (isTileInstanceClass(classId, context.classes) && isObjectRecord2(baseBody)) {
|
|
115794
|
+
for (const key of ["assetClassId", "assetValueId", "variantId"]) {
|
|
115795
|
+
if (baseBody[key] !== void 0) body[key] = baseBody[key];
|
|
115796
|
+
}
|
|
115797
|
+
if (typeof body.assetValueId === "string") {
|
|
115798
|
+
retainStoredValueSubgraph(
|
|
115799
|
+
context,
|
|
115800
|
+
body.assetValueId,
|
|
115801
|
+
binding.source,
|
|
115802
|
+
/* @__PURE__ */ new Set(),
|
|
115803
|
+
null,
|
|
115804
|
+
environment
|
|
115805
|
+
);
|
|
115806
|
+
}
|
|
115807
|
+
}
|
|
115393
115808
|
lowerConstructorProjections(
|
|
115394
115809
|
context,
|
|
115395
115810
|
schemaClass2,
|
|
@@ -115449,7 +115864,10 @@ function lowerRowBackedDefault(context, member, backed, baseData3, binding) {
|
|
|
115449
115864
|
);
|
|
115450
115865
|
}
|
|
115451
115866
|
return {
|
|
115452
|
-
value:
|
|
115867
|
+
value: applyTileAnnotation(context, sourceExpression, {
|
|
115868
|
+
classId,
|
|
115869
|
+
value: body
|
|
115870
|
+
}).value,
|
|
115453
115871
|
classId: classId === currentClassId ? storedClassId : classId
|
|
115454
115872
|
};
|
|
115455
115873
|
}
|
|
@@ -115815,7 +116233,6 @@ function preserveReboundValue(context, currentValueId, nextValueId, binding) {
|
|
|
115815
116233
|
);
|
|
115816
116234
|
}
|
|
115817
116235
|
function lowerStaticSeed(context, member, sourceExpression, source, valueId) {
|
|
115818
|
-
const expression = annotatedValue(sourceExpression).expression;
|
|
115819
116236
|
const rows = /* @__PURE__ */ new Map();
|
|
115820
116237
|
const localizedTexts = /* @__PURE__ */ new Map();
|
|
115821
116238
|
const existingBindingMemberIds = new Set(
|
|
@@ -115826,7 +116243,7 @@ function lowerStaticSeed(context, member, sourceExpression, source, valueId) {
|
|
|
115826
116243
|
const root = lowerSeedRow(
|
|
115827
116244
|
context,
|
|
115828
116245
|
member,
|
|
115829
|
-
|
|
116246
|
+
sourceExpression,
|
|
115830
116247
|
source,
|
|
115831
116248
|
valueId,
|
|
115832
116249
|
source.label,
|
|
@@ -115880,7 +116297,8 @@ function lowerSeedRow(context, member, sourceExpression, source, valueId, path,
|
|
|
115880
116297
|
localizedTexts,
|
|
115881
116298
|
containerId,
|
|
115882
116299
|
inheritedEnvironment,
|
|
115883
|
-
authoredSlice
|
|
116300
|
+
authoredSlice,
|
|
116301
|
+
sourceExpression
|
|
115884
116302
|
);
|
|
115885
116303
|
}
|
|
115886
116304
|
if (!isStoredCallableLiteral(resolvedMember.kind, expression) && memberInitializerRequiresEvaluation(
|
|
@@ -115889,6 +116307,11 @@ function lowerSeedRow(context, member, sourceExpression, source, valueId, path,
|
|
|
115889
116307
|
expression,
|
|
115890
116308
|
source
|
|
115891
116309
|
)) {
|
|
116310
|
+
if (tileAssetAnnotation(sourceExpression) !== null) {
|
|
116311
|
+
throw new Error(
|
|
116312
|
+
"@tile requires a literal placement construction. Construct NeoTileInstance directly and assign its members in the initializer."
|
|
116313
|
+
);
|
|
116314
|
+
}
|
|
115892
116315
|
const unattachedId = annotated.id === null ? unattachedAuthoredRowId(authoredSlice) : null;
|
|
115893
116316
|
if (unattachedId !== null) {
|
|
115894
116317
|
throw new Error(
|
|
@@ -116204,6 +116627,10 @@ function lowerSeedRow(context, member, sourceExpression, source, valueId, path,
|
|
|
116204
116627
|
value = lowered.value;
|
|
116205
116628
|
classId = typeof lowered.classId === "string" ? lowered.classId : null;
|
|
116206
116629
|
}
|
|
116630
|
+
value = applyTileAnnotation(context, sourceExpression, {
|
|
116631
|
+
classId,
|
|
116632
|
+
value
|
|
116633
|
+
}).value;
|
|
116207
116634
|
const row = {
|
|
116208
116635
|
nodeType: "literal",
|
|
116209
116636
|
id: valueId,
|
|
@@ -116288,7 +116715,7 @@ function structurallyConstructedClassId(context, member, expression) {
|
|
|
116288
116715
|
if (expression.args.length === 0) return null;
|
|
116289
116716
|
return effective.id;
|
|
116290
116717
|
}
|
|
116291
|
-
function lowerStructuralConstructionRow(context, member, expression, source, valueId, path, rows, localizedTexts, containerId, inheritedEnvironment, authoredSlice) {
|
|
116718
|
+
function lowerStructuralConstructionRow(context, member, expression, source, valueId, path, rows, localizedTexts, containerId, inheritedEnvironment, authoredSlice, annotatedExpression = expression) {
|
|
116292
116719
|
const effectiveClass = constructedClass(
|
|
116293
116720
|
context,
|
|
116294
116721
|
member,
|
|
@@ -116416,7 +116843,10 @@ function lowerStructuralConstructionRow(context, member, expression, source, val
|
|
|
116416
116843
|
nodeType: "literal",
|
|
116417
116844
|
id: valueId,
|
|
116418
116845
|
memberId: member.id,
|
|
116419
|
-
value,
|
|
116846
|
+
value: applyTileAnnotation(context, annotatedExpression, {
|
|
116847
|
+
classId: effectiveClass.id,
|
|
116848
|
+
value
|
|
116849
|
+
}).value,
|
|
116420
116850
|
classId: effectiveClass.id,
|
|
116421
116851
|
constructorArgs,
|
|
116422
116852
|
// Provenance is stamped explicitly on every construction this lowerer
|
|
@@ -116617,7 +117047,13 @@ function lowerValueRow(context, member, sourceExpression, expectedValueId, sourc
|
|
|
116617
117047
|
authoredSlice,
|
|
116618
117048
|
projectedConstructionEditable ? "reproject" : "preserve"
|
|
116619
117049
|
);
|
|
116620
|
-
addReconstructed(
|
|
117050
|
+
addReconstructed(
|
|
117051
|
+
context,
|
|
117052
|
+
"value",
|
|
117053
|
+
expectedValueId,
|
|
117054
|
+
applyTileAnnotation(context, sourceExpression, value2),
|
|
117055
|
+
source.source
|
|
117056
|
+
);
|
|
116621
117057
|
return expectedValueId;
|
|
116622
117058
|
}
|
|
116623
117059
|
const literalFields = valueFileFields(base);
|
|
@@ -116641,7 +117077,13 @@ function lowerValueRow(context, member, sourceExpression, expectedValueId, sourc
|
|
|
116641
117077
|
environment,
|
|
116642
117078
|
authoredSlice
|
|
116643
117079
|
);
|
|
116644
|
-
addReconstructed(
|
|
117080
|
+
addReconstructed(
|
|
117081
|
+
context,
|
|
117082
|
+
"value",
|
|
117083
|
+
expectedValueId,
|
|
117084
|
+
applyTileAnnotation(context, sourceExpression, value),
|
|
117085
|
+
source.source
|
|
117086
|
+
);
|
|
116645
117087
|
return expectedValueId;
|
|
116646
117088
|
}
|
|
116647
117089
|
function lowerValueBody(context, member, expression, base, source, environment, authoredSlice) {
|
|
@@ -118894,6 +119336,38 @@ function memberPath(expression) {
|
|
|
118894
119336
|
const receiver = memberPath(expression.receiver);
|
|
118895
119337
|
return receiver === null ? null : `${receiver}.${expression.name}`;
|
|
118896
119338
|
}
|
|
119339
|
+
function applyTileAnnotation(context, expression, value) {
|
|
119340
|
+
const assetName = tileAssetAnnotation(expression);
|
|
119341
|
+
if (assetName === null) return value;
|
|
119342
|
+
const instanceBase = requiredClassByName(context, "NeoTileInstance");
|
|
119343
|
+
if (typeof value.classId !== "string" || !classAssignableToClass2(context, value.classId, instanceBase.id)) {
|
|
119344
|
+
throw new Error("@tile requires a NeoTileInstance construction.");
|
|
119345
|
+
}
|
|
119346
|
+
const asset = requiredClassByName(context, assetName);
|
|
119347
|
+
const tileBase = requiredClassByName(context, "NeoTile");
|
|
119348
|
+
if (!classAssignableToClass2(context, asset.id, tileBase.id)) {
|
|
119349
|
+
throw new Error(`@tile asset '${assetName}' must name a tile class.`);
|
|
119350
|
+
}
|
|
119351
|
+
if (asset.declarationModifier === "abstract") {
|
|
119352
|
+
throw new Error(
|
|
119353
|
+
`@tile asset '${assetName}' must be a concrete tile class.`
|
|
119354
|
+
);
|
|
119355
|
+
}
|
|
119356
|
+
if (asset.genericParameters.length > 0) {
|
|
119357
|
+
throw new Error(
|
|
119358
|
+
`@tile asset '${assetName}' must be a non-generic tile class.`
|
|
119359
|
+
);
|
|
119360
|
+
}
|
|
119361
|
+
if (!isObjectRecord2(value.value))
|
|
119362
|
+
throw new Error("@tile requires a stored placement body.");
|
|
119363
|
+
const body = value.value;
|
|
119364
|
+
if (body.assetClassId !== asset.id && (body.assetValueId !== void 0 || body.variantId !== void 0)) {
|
|
119365
|
+
throw new Error(
|
|
119366
|
+
"Cannot change a tile asset while the placement has overrides or a variant. Recreate the placement to select a different tile."
|
|
119367
|
+
);
|
|
119368
|
+
}
|
|
119369
|
+
return { ...value, value: { ...body, assetClassId: asset.id } };
|
|
119370
|
+
}
|
|
118897
119371
|
function annotatedValue(expression) {
|
|
118898
119372
|
if (expression.kind !== "annotated") return { expression, id: null };
|
|
118899
119373
|
const id2 = annotationId2(expression.annotations);
|
|
@@ -119135,6 +119609,27 @@ function emitValueBody(context, member, value, visited, targetTyped, environment
|
|
|
119135
119609
|
);
|
|
119136
119610
|
}
|
|
119137
119611
|
function classValue(context, member, value, visited, targetTyped, outerEnvironment) {
|
|
119612
|
+
const source = classValueBody(
|
|
119613
|
+
context,
|
|
119614
|
+
member,
|
|
119615
|
+
value,
|
|
119616
|
+
visited,
|
|
119617
|
+
targetTyped,
|
|
119618
|
+
outerEnvironment
|
|
119619
|
+
);
|
|
119620
|
+
const assetId = isObjectRecord2(value.value) ? value.value.assetClassId : void 0;
|
|
119621
|
+
if (typeof assetId !== "string") return source;
|
|
119622
|
+
const classId = stringOrNull2(value.classId) ?? stringField3(member, "classId");
|
|
119623
|
+
if (!isTileInstanceClass(classId, context.manifestClasses)) return source;
|
|
119624
|
+
const asset = context.manifestClasses.get(assetId);
|
|
119625
|
+
if (asset === void 0)
|
|
119626
|
+
throw new Error(
|
|
119627
|
+
`Tile placement ${String(value.id)} references unknown asset class ${assetId}.`
|
|
119628
|
+
);
|
|
119629
|
+
return `@tile(${asset.name})
|
|
119630
|
+
${source}`;
|
|
119631
|
+
}
|
|
119632
|
+
function classValueBody(context, member, value, visited, targetTyped, outerEnvironment) {
|
|
119138
119633
|
if (value.value === null) return "null";
|
|
119139
119634
|
const partial = member.payload === 1 /* Partial */;
|
|
119140
119635
|
const classId = stringOrNull2(value.classId) ?? stringField3(member, "classId");
|
|
@@ -129444,12 +129939,10 @@ ${blockingErrors.map((error) => ` ${error.message}`).join("\n")}`
|
|
|
129444
129939
|
return await buildPostPushCompileSchema(workspace, status);
|
|
129445
129940
|
})() : null;
|
|
129446
129941
|
const bodySourceLocator = createNeoScriptBodySourceLocator(workspace, status);
|
|
129447
|
-
|
|
129448
|
-
|
|
129449
|
-
|
|
129450
|
-
|
|
129451
|
-
});
|
|
129452
|
-
}
|
|
129942
|
+
const compileContext = compileSchema === null ? null : prepareCompleteNeoScriptBodyChanges(workspace, status, compileSchema, {
|
|
129943
|
+
completeSweep: options.forceRecompile === true,
|
|
129944
|
+
bodySourceLocator
|
|
129945
|
+
});
|
|
129453
129946
|
const now = Date.now();
|
|
129454
129947
|
for (const change of status.changes) {
|
|
129455
129948
|
if (change.nextData === void 0) continue;
|
|
@@ -129457,26 +129950,12 @@ ${blockingErrors.map((error) => ` ${error.message}`).join("\n")}`
|
|
|
129457
129950
|
change.nextData = {
|
|
129458
129951
|
...change.nextData,
|
|
129459
129952
|
action: compileMigrationAction(
|
|
129460
|
-
|
|
129953
|
+
compileContext,
|
|
129461
129954
|
change.nextData,
|
|
129462
129955
|
bodySourceLocator
|
|
129463
129956
|
)
|
|
129464
129957
|
};
|
|
129465
129958
|
}
|
|
129466
|
-
if (change.recordKind === "member" && change.nextData.kind === 10) {
|
|
129467
|
-
change.nextData = compileNSPropertyChange(
|
|
129468
|
-
compileSchema,
|
|
129469
|
-
change.nextData,
|
|
129470
|
-
bodySourceLocator
|
|
129471
|
-
);
|
|
129472
|
-
}
|
|
129473
|
-
if (change.recordKind === "member" && change.nextData.kind === 23) {
|
|
129474
|
-
change.nextData = compileNSFunctionChange(
|
|
129475
|
-
compileSchema,
|
|
129476
|
-
change.nextData,
|
|
129477
|
-
bodySourceLocator
|
|
129478
|
-
);
|
|
129479
|
-
}
|
|
129480
129959
|
if (change.kind === "create") {
|
|
129481
129960
|
change.nextData = {
|
|
129482
129961
|
...change.nextData,
|
|
@@ -131315,8 +131794,8 @@ async function buildPostPushCompileSchema(workspace, status) {
|
|
|
131315
131794
|
variantFolders: [...bucket("variant-folder").values()]
|
|
131316
131795
|
};
|
|
131317
131796
|
}
|
|
131318
|
-
function
|
|
131319
|
-
|
|
131797
|
+
function createPostPushCompileContext(schema) {
|
|
131798
|
+
const project = {
|
|
131320
131799
|
project: schema.project,
|
|
131321
131800
|
projectFiles: schema.projectFiles,
|
|
131322
131801
|
members: schema.members,
|
|
@@ -131327,24 +131806,50 @@ function postPushCompilerProject(schema) {
|
|
|
131327
131806
|
variants: schema.variants,
|
|
131328
131807
|
variantFolders: schema.variantFolders
|
|
131329
131808
|
};
|
|
131809
|
+
const membersById = /* @__PURE__ */ new Map();
|
|
131810
|
+
const classesById = /* @__PURE__ */ new Map();
|
|
131811
|
+
const ownersByMemberId = /* @__PURE__ */ new Map();
|
|
131812
|
+
for (const member of schema.members) {
|
|
131813
|
+
if (typeof member.id !== "string") continue;
|
|
131814
|
+
if (!membersById.has(member.id)) membersById.set(member.id, member);
|
|
131815
|
+
}
|
|
131816
|
+
for (const schemaClass2 of schema.classes) {
|
|
131817
|
+
if (typeof schemaClass2.id === "string" && !classesById.has(schemaClass2.id)) {
|
|
131818
|
+
classesById.set(schemaClass2.id, schemaClass2);
|
|
131819
|
+
}
|
|
131820
|
+
if (!isObjectRecord2(schemaClass2.schema)) continue;
|
|
131821
|
+
for (const memberId of Object.values(schemaClass2.schema)) {
|
|
131822
|
+
if (typeof memberId !== "string") continue;
|
|
131823
|
+
if (!ownersByMemberId.has(memberId))
|
|
131824
|
+
ownersByMemberId.set(memberId, schemaClass2);
|
|
131825
|
+
}
|
|
131826
|
+
}
|
|
131827
|
+
let compilationProject;
|
|
131828
|
+
return {
|
|
131829
|
+
membersById,
|
|
131830
|
+
classesById,
|
|
131831
|
+
ownersByMemberId,
|
|
131832
|
+
project() {
|
|
131833
|
+
compilationProject ??= createNeoScriptCompilationProject2(project);
|
|
131834
|
+
return { ...project, compilationProject };
|
|
131835
|
+
}
|
|
131836
|
+
};
|
|
131330
131837
|
}
|
|
131331
|
-
function containingClass(
|
|
131332
|
-
|
|
131333
|
-
|
|
131334
|
-
return isObjectRecord2(classSchema) && Object.values(classSchema).includes(memberId);
|
|
131335
|
-
}) ?? null;
|
|
131838
|
+
function containingClass(context, memberId) {
|
|
131839
|
+
if (typeof memberId !== "string") return null;
|
|
131840
|
+
return context.ownersByMemberId.get(memberId) ?? null;
|
|
131336
131841
|
}
|
|
131337
131842
|
function bodyOwnerName(thisClass) {
|
|
131338
131843
|
if (thisClass === null) return null;
|
|
131339
131844
|
if (typeof thisClass.name !== "string") return null;
|
|
131340
131845
|
return thisClass.name;
|
|
131341
131846
|
}
|
|
131342
|
-
function compileNSPropertyChange(
|
|
131847
|
+
function compileNSPropertyChange(context, memberData, locator) {
|
|
131343
131848
|
const memberId = memberData.id;
|
|
131344
|
-
const thisClass = containingClass(
|
|
131849
|
+
const thisClass = containingClass(context, memberId);
|
|
131345
131850
|
const returnTypeInfo = resolveNSPropertyReturnTypeInfo2(
|
|
131346
131851
|
memberData,
|
|
131347
|
-
|
|
131852
|
+
context.membersById
|
|
131348
131853
|
);
|
|
131349
131854
|
const bodyIdentity = {
|
|
131350
131855
|
recordKind: "member",
|
|
@@ -131357,7 +131862,7 @@ function compileNSPropertyChange(schema, memberData, locator) {
|
|
|
131357
131862
|
const code = memberData.code;
|
|
131358
131863
|
next.getter = compileNeoScriptBodyOrThrow(
|
|
131359
131864
|
() => compileNSGetter2(code, {
|
|
131360
|
-
...
|
|
131865
|
+
...context.project(),
|
|
131361
131866
|
thisClass,
|
|
131362
131867
|
returnTypeInfo,
|
|
131363
131868
|
dialogueContext: null,
|
|
@@ -131374,7 +131879,7 @@ function compileNSPropertyChange(schema, memberData, locator) {
|
|
|
131374
131879
|
const setterCode = memberData.setterCode;
|
|
131375
131880
|
next.setter = compileNeoScriptBodyOrThrow(
|
|
131376
131881
|
() => compileNSSetter2(setterCode, {
|
|
131377
|
-
...
|
|
131882
|
+
...context.project(),
|
|
131378
131883
|
thisClass,
|
|
131379
131884
|
valueTypeInfo: returnTypeInfo,
|
|
131380
131885
|
implicitMemberAccess: true,
|
|
@@ -131388,18 +131893,18 @@ function compileNSPropertyChange(schema, memberData, locator) {
|
|
|
131388
131893
|
}
|
|
131389
131894
|
return next;
|
|
131390
131895
|
}
|
|
131391
|
-
function compileNSFunctionChange(
|
|
131896
|
+
function compileNSFunctionChange(context, memberData, locator) {
|
|
131392
131897
|
const next = { ...memberData };
|
|
131393
131898
|
if (typeof memberData.code !== "string") {
|
|
131394
131899
|
delete next.action;
|
|
131395
131900
|
return next;
|
|
131396
131901
|
}
|
|
131397
131902
|
const code = memberData.code;
|
|
131398
|
-
const contract = resolveNSFunctionContract(memberData,
|
|
131399
|
-
const thisClass = containingClass(
|
|
131903
|
+
const contract = resolveNSFunctionContract(memberData, context.membersById);
|
|
131904
|
+
const thisClass = containingClass(context, memberData.id);
|
|
131400
131905
|
next.action = compileNeoScriptBodyOrThrow(
|
|
131401
131906
|
() => compileNSFunction2(code, {
|
|
131402
|
-
...
|
|
131907
|
+
...context.project(),
|
|
131403
131908
|
thisClass,
|
|
131404
131909
|
returnTypeInfo: contract.returnTypeInfo,
|
|
131405
131910
|
argumentTypes: contract.argumentTypes,
|
|
@@ -131422,6 +131927,7 @@ function compileNSFunctionChange(schema, memberData, locator) {
|
|
|
131422
131927
|
}
|
|
131423
131928
|
function prepareCompleteNeoScriptBodyChanges(workspace, status, schema, options = {}) {
|
|
131424
131929
|
const completeSweep = options.completeSweep ?? false;
|
|
131930
|
+
const context = createPostPushCompileContext(schema);
|
|
131425
131931
|
const locator = options.bodySourceLocator ?? createNeoScriptBodySourceLocator(workspace, status);
|
|
131426
131932
|
const changesById = new Map(
|
|
131427
131933
|
status.changes.filter((change) => change.recordKind === "member").map((change) => [change.recordId, change])
|
|
@@ -131432,10 +131938,10 @@ function prepareCompleteNeoScriptBodyChanges(workspace, status, schema, options
|
|
|
131432
131938
|
return member;
|
|
131433
131939
|
}
|
|
131434
131940
|
if (member.kind === 10 /* NSProperty */) {
|
|
131435
|
-
return compileNSPropertyChange(
|
|
131941
|
+
return compileNSPropertyChange(context, member, locator);
|
|
131436
131942
|
}
|
|
131437
131943
|
if (member.kind === 23 /* NSFunction */) {
|
|
131438
|
-
return compileNSFunctionChange(
|
|
131944
|
+
return compileNSFunctionChange(context, member, locator);
|
|
131439
131945
|
}
|
|
131440
131946
|
return member;
|
|
131441
131947
|
});
|
|
@@ -131485,6 +131991,7 @@ function prepareCompleteNeoScriptBodyChanges(workspace, status, schema, options
|
|
|
131485
131991
|
status.changes.push(cascadeChange);
|
|
131486
131992
|
changesById.set(compiled.id, cascadeChange);
|
|
131487
131993
|
}
|
|
131994
|
+
return context;
|
|
131488
131995
|
}
|
|
131489
131996
|
function mergeCompiledNeoScriptBody(persisted, compiled) {
|
|
131490
131997
|
const next = { ...persisted };
|
|
@@ -131681,7 +132188,7 @@ function resolveNSPropertyReturnTypeInfo2(member, members) {
|
|
|
131681
132188
|
);
|
|
131682
132189
|
}
|
|
131683
132190
|
visited.add(parentId);
|
|
131684
|
-
current = members.
|
|
132191
|
+
current = members.get(parentId);
|
|
131685
132192
|
}
|
|
131686
132193
|
throw new Error(
|
|
131687
132194
|
`Cannot compile NeoScript property "${String(member.id)}": its returnTypeInfo could not be resolved from the base chain.`
|
|
@@ -131708,7 +132215,7 @@ function resolveNSFunctionContract(member, members) {
|
|
|
131708
132215
|
);
|
|
131709
132216
|
}
|
|
131710
132217
|
visited.add(parentId);
|
|
131711
|
-
current = members.
|
|
132218
|
+
current = members.get(parentId);
|
|
131712
132219
|
if (current === void 0) {
|
|
131713
132220
|
throw new Error(
|
|
131714
132221
|
`Cannot compile NeoScript function "${String(member.id)}": missing parent member "${parentId}".`
|
|
@@ -131726,15 +132233,13 @@ function resolveNSFunctionContract(member, members) {
|
|
|
131726
132233
|
deferred: dispatch === 1
|
|
131727
132234
|
};
|
|
131728
132235
|
}
|
|
131729
|
-
function compileMigrationAction(
|
|
132236
|
+
function compileMigrationAction(context, migrationData, locator) {
|
|
131730
132237
|
const targetClassId = migrationData.targetClassId;
|
|
131731
|
-
const thisClass = typeof targetClassId === "string" ?
|
|
131732
|
-
(schemaClass2) => schemaClass2.id === targetClassId
|
|
131733
|
-
) ?? null : null;
|
|
132238
|
+
const thisClass = typeof targetClassId === "string" ? context.classesById.get(targetClassId) ?? null : null;
|
|
131734
132239
|
const code = String(migrationData.code);
|
|
131735
132240
|
return compileNeoScriptBodyOrThrow(
|
|
131736
132241
|
() => compileNSVoidBody2(code, {
|
|
131737
|
-
...
|
|
132242
|
+
...context.project(),
|
|
131738
132243
|
thisClass,
|
|
131739
132244
|
dialogueContext: null,
|
|
131740
132245
|
migrationContext: true
|
|
@@ -131750,7 +132255,7 @@ function compileMigrationAction(schema, migrationData, locator) {
|
|
|
131750
132255
|
locator
|
|
131751
132256
|
);
|
|
131752
132257
|
}
|
|
131753
|
-
var compileNSVoidBody2, compileNSFunction2, compileNSGetter2, compileNSSetter2, ProjectTransactionInterruptedError, ProjectTransactionFailedError, PROJECT_TRANSACTION_POLL_DELAYS_MS, LocalCandidateArtifactError, SERVER_MINTED_PUSH_RECORD_KINDS;
|
|
132258
|
+
var compileNSVoidBody2, compileNSFunction2, compileNSGetter2, compileNSSetter2, createNeoScriptCompilationProject2, ProjectTransactionInterruptedError, ProjectTransactionFailedError, PROJECT_TRANSACTION_POLL_DELAYS_MS, LocalCandidateArtifactError, SERVER_MINTED_PUSH_RECORD_KINDS;
|
|
131754
132259
|
var init_push = __esm({
|
|
131755
132260
|
"src/commands/push.ts"() {
|
|
131756
132261
|
"use strict";
|
|
@@ -131796,7 +132301,8 @@ var init_push = __esm({
|
|
|
131796
132301
|
compileNSVoidBody: compileNSVoidBody2,
|
|
131797
132302
|
compileNSFunction: compileNSFunction2,
|
|
131798
132303
|
compileNSGetter: compileNSGetter2,
|
|
131799
|
-
compileNSSetter: compileNSSetter2
|
|
132304
|
+
compileNSSetter: compileNSSetter2,
|
|
132305
|
+
createNeoScriptCompilationProject: createNeoScriptCompilationProject2
|
|
131800
132306
|
} = compiler_adapter_exports);
|
|
131801
132307
|
ProjectTransactionInterruptedError = class extends Error {
|
|
131802
132308
|
constructor(transactionId) {
|
|
@@ -131846,7 +132352,7 @@ var init_registry2 = __esm({
|
|
|
131846
132352
|
"schema-contract/registry.mjs"() {
|
|
131847
132353
|
"use strict";
|
|
131848
132354
|
PROJECT_SCHEMA_CONTRACT = Object.freeze({
|
|
131849
|
-
cliVersion: "0.
|
|
132355
|
+
cliVersion: "0.50.1",
|
|
131850
132356
|
projectFileUploadBatchSize: 32,
|
|
131851
132357
|
documentRecords: {
|
|
131852
132358
|
member: {
|
|
@@ -138896,7 +139402,7 @@ There is no --keep-current: preserving current semantic state defines flatten.
|
|
|
138896
139402
|
async function main() {
|
|
138897
139403
|
const args = parseArgs(process.argv.slice(2));
|
|
138898
139404
|
if (args.command === "--version") {
|
|
138899
|
-
console.log("0.
|
|
139405
|
+
console.log("0.50.1");
|
|
138900
139406
|
return;
|
|
138901
139407
|
}
|
|
138902
139408
|
if (args.command === null || args.command === "help" || args.command === "--help" || args.command === "-h") {
|