@neocompose/cli 0.81.0 → 0.81.2
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 +26 -0
- package/dist/neo.mjs +1120 -419
- package/dist/test-worker.mjs +985 -222
- package/package.json +1 -1
- package/skills/neocompose-cli/SKILL.md +1 -1
- package/skills/neocompose-cli/references/animation-and-world-authoring.md +8 -0
- package/skills/neocompose-cli/references/cli-development.md +1 -1
- package/skills/neocompose-cli/references/commands-and-sync.md +3 -2
- package/skills/neocompose-cli/references/declarations-and-construction.md +4 -1
- package/skills/neocompose-cli/references/values-identities-and-references.md +8 -5
package/dist/test-worker.mjs
CHANGED
|
@@ -2339,6 +2339,16 @@ function neoScriptRegistryEntryType(typeName) {
|
|
|
2339
2339
|
}
|
|
2340
2340
|
return REGISTRY_ENTRY_TYPES[typeName] ?? null;
|
|
2341
2341
|
}
|
|
2342
|
+
function typeArgumentArityMessage(typeName, expected, provided) {
|
|
2343
|
+
return `Type '${typeName}' expects ${expected} type argument${expected === 1 ? "" : "s"}, but ${provided} ${provided === 1 ? "was" : "were"} provided.`;
|
|
2344
|
+
}
|
|
2345
|
+
function genericParameterArgumentsMessage(name) {
|
|
2346
|
+
return `Generic parameter '${name}' cannot receive type arguments.`;
|
|
2347
|
+
}
|
|
2348
|
+
var NEOSCRIPT_DELEGATE_MAX_PARAMETERS = 16;
|
|
2349
|
+
function delegateArityMessage(provided) {
|
|
2350
|
+
return `Type 'NeoDelegate' expects a return type followed by up to ${NEOSCRIPT_DELEGATE_MAX_PARAMETERS} parameter types, but ${provided} type arguments were provided.`;
|
|
2351
|
+
}
|
|
2342
2352
|
function neoScriptRegistryReferenceType(entryTypeName) {
|
|
2343
2353
|
for (const definition of Object.values(REGISTRY_ENTRY_TYPES)) {
|
|
2344
2354
|
if (definition.entryType === entryTypeName) return definition.refType;
|
|
@@ -3600,6 +3610,8 @@ function isNSFunctionVariantApply(value) {
|
|
|
3600
3610
|
if (!isNSPointer(info.variantPointer)) return false;
|
|
3601
3611
|
if (info.rowPointer !== void 0 && !isNSPointer(info.rowPointer))
|
|
3602
3612
|
return false;
|
|
3613
|
+
if (info.declarativeReplay !== void 0 && info.declarativeReplay !== true)
|
|
3614
|
+
return false;
|
|
3603
3615
|
return isNSTypeInfoClass(info.schemaClassInfo) && info.schemaClassInfo.required;
|
|
3604
3616
|
}
|
|
3605
3617
|
function isNSFunctionClassConstructor(value) {
|
|
@@ -5284,7 +5296,9 @@ function isLiteralValueContent(value) {
|
|
|
5284
5296
|
for (const field of [
|
|
5285
5297
|
"instanceConstructorId",
|
|
5286
5298
|
"instanceVariantId",
|
|
5287
|
-
"instanceVariantRowValueId"
|
|
5299
|
+
"instanceVariantRowValueId",
|
|
5300
|
+
"instanceAppliedVariantId",
|
|
5301
|
+
"instanceAppliedVariantRowValueId"
|
|
5288
5302
|
]) {
|
|
5289
5303
|
const provenance = getField(value, field);
|
|
5290
5304
|
if (provenance !== void 0 && provenance !== null && (typeof provenance !== "string" || provenance.length === 0)) {
|
|
@@ -5310,6 +5324,9 @@ function isInitValueContent(value) {
|
|
|
5310
5324
|
if (getField(value, "instanceConstructorId") !== void 0) return false;
|
|
5311
5325
|
if (getField(value, "instanceVariantId") !== void 0) return false;
|
|
5312
5326
|
if (getField(value, "instanceVariantRowValueId") !== void 0) return false;
|
|
5327
|
+
if (getField(value, "instanceAppliedVariantId") !== void 0) return false;
|
|
5328
|
+
if (getField(value, "instanceAppliedVariantRowValueId") !== void 0)
|
|
5329
|
+
return false;
|
|
5313
5330
|
const classIdField = getField(value, "classId");
|
|
5314
5331
|
return classIdField === void 0 || classIdField === null;
|
|
5315
5332
|
}
|
|
@@ -6081,6 +6098,8 @@ var LITERAL_INSTANCE_IDENTITY_FIELDS = [
|
|
|
6081
6098
|
"instanceConstructorId",
|
|
6082
6099
|
"instanceVariantId",
|
|
6083
6100
|
"instanceVariantRowValueId",
|
|
6101
|
+
"instanceAppliedVariantId",
|
|
6102
|
+
"instanceAppliedVariantRowValueId",
|
|
6084
6103
|
"genericBindings"
|
|
6085
6104
|
];
|
|
6086
6105
|
function replaceLiteralValueClass(value, classId) {
|
|
@@ -6103,7 +6122,11 @@ function pickInstanceProvenance(source) {
|
|
|
6103
6122
|
...source.constructorArgs === void 0 ? {} : { constructorArgs: source.constructorArgs },
|
|
6104
6123
|
...source.instanceConstructorId === void 0 ? {} : { instanceConstructorId: source.instanceConstructorId },
|
|
6105
6124
|
...source.instanceVariantId === void 0 ? {} : { instanceVariantId: source.instanceVariantId },
|
|
6106
|
-
...source.instanceVariantRowValueId === void 0 ? {} : { instanceVariantRowValueId: source.instanceVariantRowValueId }
|
|
6125
|
+
...source.instanceVariantRowValueId === void 0 ? {} : { instanceVariantRowValueId: source.instanceVariantRowValueId },
|
|
6126
|
+
...source.instanceAppliedVariantId === void 0 ? {} : { instanceAppliedVariantId: source.instanceAppliedVariantId },
|
|
6127
|
+
...source.instanceAppliedVariantRowValueId === void 0 ? {} : {
|
|
6128
|
+
instanceAppliedVariantRowValueId: source.instanceAppliedVariantRowValueId
|
|
6129
|
+
}
|
|
6107
6130
|
};
|
|
6108
6131
|
}
|
|
6109
6132
|
function isVirtualInstanceRootShape(value) {
|
|
@@ -6276,7 +6299,7 @@ function decodeContentField(container, field, scope, children) {
|
|
|
6276
6299
|
)
|
|
6277
6300
|
};
|
|
6278
6301
|
}
|
|
6279
|
-
const decoded =
|
|
6302
|
+
const decoded = /* @__PURE__ */ Object.create(null);
|
|
6280
6303
|
for (const [key, entry] of Object.entries(
|
|
6281
6304
|
container
|
|
6282
6305
|
)) {
|
|
@@ -11533,12 +11556,8 @@ function evaluateLiteralContainer(args) {
|
|
|
11533
11556
|
const literal3 = {
|
|
11534
11557
|
value: evaluated.value,
|
|
11535
11558
|
classId: evaluated.classId,
|
|
11536
|
-
...
|
|
11537
|
-
...evaluated.
|
|
11538
|
-
...evaluated.instanceVariantId === void 0 ? {} : { instanceVariantId: evaluated.instanceVariantId },
|
|
11539
|
-
...evaluated.instanceVariantRowValueId === void 0 ? {} : {
|
|
11540
|
-
instanceVariantRowValueId: evaluated.instanceVariantRowValueId
|
|
11541
|
-
}
|
|
11559
|
+
...pickInstanceProvenance(evaluated),
|
|
11560
|
+
...evaluated.constructorArgs === void 0 ? {} : { constructorArgs: deepClonePlainData(evaluated.constructorArgs) }
|
|
11542
11561
|
};
|
|
11543
11562
|
if (isMemberLookupBase(args.member)) {
|
|
11544
11563
|
if (evaluated.existingValueRow !== void 0) {
|
|
@@ -11871,15 +11890,9 @@ function buildNewValue(projectId, body, timestamp2 = Date.now()) {
|
|
|
11871
11890
|
if (body.constructorArgs !== void 0 && body.constructorArgs !== null) {
|
|
11872
11891
|
props.constructorArgs = deepClonePlainData(body.constructorArgs);
|
|
11873
11892
|
}
|
|
11874
|
-
|
|
11875
|
-
|
|
11876
|
-
|
|
11877
|
-
if (body.instanceVariantId !== void 0) {
|
|
11878
|
-
props.instanceVariantId = body.instanceVariantId;
|
|
11879
|
-
}
|
|
11880
|
-
if (body.instanceVariantRowValueId !== void 0) {
|
|
11881
|
-
props.instanceVariantRowValueId = body.instanceVariantRowValueId;
|
|
11882
|
-
}
|
|
11893
|
+
const { constructorArgs: _constructorArgs, ...provenance } = pickInstanceProvenance(body);
|
|
11894
|
+
void _constructorArgs;
|
|
11895
|
+
Object.assign(props, provenance);
|
|
11883
11896
|
return props;
|
|
11884
11897
|
}
|
|
11885
11898
|
function retargetInitializerRootValueIds(rows, fromValueId, toValueId) {
|
|
@@ -12071,7 +12084,7 @@ function cloneDefaultDictionaryRecord(args) {
|
|
|
12071
12084
|
args.document,
|
|
12072
12085
|
args.member.entryMemberId
|
|
12073
12086
|
);
|
|
12074
|
-
const value =
|
|
12087
|
+
const value = /* @__PURE__ */ Object.create(null);
|
|
12075
12088
|
for (const [key, sourceValueId] of Object.entries(sourceValue)) {
|
|
12076
12089
|
value[key] = cloneDefaultValueForMember({
|
|
12077
12090
|
document: args.document,
|
|
@@ -12348,9 +12361,7 @@ function cloneMemberValueBase(body) {
|
|
|
12348
12361
|
return {
|
|
12349
12362
|
value: deepClonePlainData(body.value),
|
|
12350
12363
|
classId: body.classId,
|
|
12351
|
-
...body
|
|
12352
|
-
...body.instanceVariantId === void 0 ? {} : { instanceVariantId: body.instanceVariantId },
|
|
12353
|
-
...body.instanceVariantRowValueId === void 0 ? {} : { instanceVariantRowValueId: body.instanceVariantRowValueId },
|
|
12364
|
+
...pickInstanceProvenance({ ...body, constructorArgs: void 0 }),
|
|
12354
12365
|
...body.constructorArgs === void 0 || body.constructorArgs === null ? {} : {
|
|
12355
12366
|
constructorArgs: deepClonePlainData(body.constructorArgs)
|
|
12356
12367
|
}
|
|
@@ -13329,7 +13340,7 @@ function toCanonicalJsonValue(value) {
|
|
|
13329
13340
|
});
|
|
13330
13341
|
}
|
|
13331
13342
|
const entries = Object.entries(value).sort(([a], [b]) => a.localeCompare(b));
|
|
13332
|
-
const canonicalObject =
|
|
13343
|
+
const canonicalObject = /* @__PURE__ */ Object.create(null);
|
|
13333
13344
|
for (const [key, entryValue] of entries) {
|
|
13334
13345
|
const canonicalValue = toCanonicalJsonValue(entryValue);
|
|
13335
13346
|
if (canonicalValue === void 0) continue;
|
|
@@ -16971,6 +16982,7 @@ function makeUnindexedEvaluatorLookups(members, storedValues) {
|
|
|
16971
16982
|
hasStoredValueId: (id) => valueById.has(id),
|
|
16972
16983
|
unorderedListEntryIds: (containerValueId) => unorderedListMembership.get(containerValueId) ?? [],
|
|
16973
16984
|
virtualInstanceRowsForValue: () => [],
|
|
16985
|
+
virtualInstanceRootIdForValue: () => null,
|
|
16974
16986
|
rowForValueReference: (value) => valueRefMap.get(value) ?? null
|
|
16975
16987
|
};
|
|
16976
16988
|
}
|
|
@@ -17154,6 +17166,7 @@ function createEvaluatorLookupsBuild(members, storedValues, options = {}) {
|
|
|
17154
17166
|
hasStoredValueId: (id) => valueById.has(id),
|
|
17155
17167
|
unorderedListEntryIds: (containerValueId) => unorderedListMembership.get(containerValueId) ?? [],
|
|
17156
17168
|
virtualInstanceRowsForValue: () => [],
|
|
17169
|
+
virtualInstanceRootIdForValue: () => null,
|
|
17157
17170
|
rowForValueReference: (value) => rowByValueReference.get(value) ?? null,
|
|
17158
17171
|
evaluatorIndexes: indexes3.result,
|
|
17159
17172
|
...options.constructorInitializerDocument === void 0 ? {} : {
|
|
@@ -17271,6 +17284,7 @@ function layerEvaluatorLookups(base, overlay) {
|
|
|
17271
17284
|
hasStoredValueId: (id) => overlay.rows.has(id) || !overlay.hiddenIds.has(id) && (base.hasStoredValueId?.(id) ?? false),
|
|
17272
17285
|
unorderedListEntryIds,
|
|
17273
17286
|
virtualInstanceRowsForValue: () => [],
|
|
17287
|
+
virtualInstanceRootIdForValue: () => null,
|
|
17274
17288
|
rowForValueReference: (value) => evaluatorIndexes2.rowByValueReference.get(value) ?? null,
|
|
17275
17289
|
evaluatorIndexes: evaluatorIndexes2,
|
|
17276
17290
|
constructorInitializerIndexes: constructorInitializerIndexes2
|
|
@@ -17676,13 +17690,15 @@ function bindThisValue(ctx, thisValue) {
|
|
|
17676
17690
|
function observeValueWrite(ctx, row) {
|
|
17677
17691
|
ctx.beforeValueWrite?.(row);
|
|
17678
17692
|
ctx.__getterSubscriptions?.noteValueWrite(row.id);
|
|
17693
|
+
forgetVariantResolutionCopy(ctx, row.id);
|
|
17679
17694
|
}
|
|
17680
17695
|
function assertStoredReplayMutableValue(value, ctx, label, key) {
|
|
17681
|
-
const observesWrites = ctx.beforeValueWrite !== void 0 || ctx.__getterSubscriptions?.empty === false;
|
|
17696
|
+
const observesWrites = ctx.beforeValueWrite !== void 0 || ctx.__getterSubscriptions?.empty === false || hasVariantResolutionCopies(ctx);
|
|
17682
17697
|
if (ctx.storedConstructionReplay !== true && !ctx.assertValueWritable && !observesWrites)
|
|
17683
17698
|
return;
|
|
17684
17699
|
let rowId = findKnownRowIdByValueReference(value, ctx);
|
|
17685
17700
|
if (rowId === null) return;
|
|
17701
|
+
forgetVariantResolutionCopy(ctx, rowId);
|
|
17686
17702
|
const container = ctx.beforeValueWrite && evalValueById(ctx, rowId, ctx.__runtimeSessionValues, ctx.__valueOverlay);
|
|
17687
17703
|
if (container) ctx.beforeValueWrite?.(container);
|
|
17688
17704
|
if (key !== void 0 && value !== null && typeof value === "object") {
|
|
@@ -20004,15 +20020,9 @@ function evalActionListenerInstruction(ins, scope, ctx, options) {
|
|
|
20004
20020
|
}
|
|
20005
20021
|
let destination;
|
|
20006
20022
|
const target = ins.target.pointer;
|
|
20007
|
-
const currentValue = target.type === "keyOf" /* keyOf */ ? evalKeyOf(
|
|
20008
|
-
|
|
20009
|
-
|
|
20010
|
-
ctx,
|
|
20011
|
-
target.optional === true,
|
|
20012
|
-
(resolved) => {
|
|
20013
|
-
destination = resolved;
|
|
20014
|
-
}
|
|
20015
|
-
) : evalPointer(target, scope, ctx);
|
|
20023
|
+
const currentValue = target.type === "keyOf" /* keyOf */ ? evalKeyOf(target, scope, ctx, (resolved) => {
|
|
20024
|
+
destination = resolved;
|
|
20025
|
+
}) : evalPointer(target, scope, ctx);
|
|
20016
20026
|
const current = actionListenersOf(currentValue, () => `'${operator}' target`);
|
|
20017
20027
|
const identity = nsActionListenerIdentity(listener);
|
|
20018
20028
|
const present = current.some(
|
|
@@ -20083,38 +20093,26 @@ function applyOverlayAssignment(target, targetTypeInfo, value, scope, ctx, desti
|
|
|
20083
20093
|
);
|
|
20084
20094
|
}
|
|
20085
20095
|
receiver[index] = referenceValueId;
|
|
20086
|
-
|
|
20096
|
+
recordWrittenEntry(receiver, index, true, ctx);
|
|
20087
20097
|
invalidateEvaluatorIndexes(ctx, receiver);
|
|
20088
20098
|
return;
|
|
20089
20099
|
}
|
|
20090
|
-
if (ctx
|
|
20091
|
-
receiver
|
|
20092
|
-
|
|
20093
|
-
|
|
20094
|
-
|
|
20095
|
-
|
|
20100
|
+
if (collectionReferences(receiver, ctx) === 0 /* RowIds */ && replaceEntryRowValue(
|
|
20101
|
+
receiver,
|
|
20102
|
+
receiver[index],
|
|
20103
|
+
value,
|
|
20104
|
+
targetTypeInfo,
|
|
20105
|
+
ctx
|
|
20106
|
+
))
|
|
20096
20107
|
return;
|
|
20097
|
-
}
|
|
20098
|
-
const existing2 = receiver[index];
|
|
20099
|
-
if (typeof existing2 === "string") {
|
|
20100
|
-
const row = evalValueById(
|
|
20101
|
-
ctx,
|
|
20102
|
-
existing2,
|
|
20103
|
-
ctx.__runtimeSessionValues,
|
|
20104
|
-
ctx.__valueOverlay
|
|
20105
|
-
);
|
|
20106
|
-
if (row !== null) {
|
|
20107
|
-
replaceRowValue(row, value, receiver, ctx);
|
|
20108
|
-
updateUnorderedListProjectionAfterAssignment(row, value, ctx);
|
|
20109
|
-
return;
|
|
20110
|
-
}
|
|
20111
|
-
}
|
|
20112
20108
|
receiver[index] = value;
|
|
20109
|
+
recordWrittenEntry(receiver, index, false, ctx);
|
|
20113
20110
|
invalidateEvaluatorIndexes(ctx, receiver);
|
|
20114
20111
|
return;
|
|
20115
20112
|
}
|
|
20116
20113
|
const object = objectArg(receiver, "Assignment target");
|
|
20117
20114
|
const stringKey = String(key);
|
|
20115
|
+
const field = target.memberId !== void 0;
|
|
20118
20116
|
if (referenceValueId !== null) {
|
|
20119
20117
|
const parentId = findKnownRowIdByValueReference(receiver, ctx);
|
|
20120
20118
|
if (parentId !== null) {
|
|
@@ -20129,26 +20127,41 @@ function applyOverlayAssignment(target, targetTypeInfo, value, scope, ctx, desti
|
|
|
20129
20127
|
);
|
|
20130
20128
|
}
|
|
20131
20129
|
object[stringKey] = referenceValueId;
|
|
20130
|
+
if (!field) recordWrittenEntry(object, stringKey, true, ctx);
|
|
20132
20131
|
invalidateEvaluatorIndexes(ctx, receiver);
|
|
20133
20132
|
return;
|
|
20134
20133
|
}
|
|
20135
|
-
|
|
20136
|
-
|
|
20137
|
-
const row = evalValueById(
|
|
20138
|
-
ctx,
|
|
20139
|
-
existing,
|
|
20140
|
-
ctx.__runtimeSessionValues,
|
|
20141
|
-
ctx.__valueOverlay
|
|
20142
|
-
);
|
|
20143
|
-
if (row !== null) {
|
|
20144
|
-
replaceRowValue(row, value, receiver, ctx);
|
|
20145
|
-
updateUnorderedListProjectionAfterAssignment(row, value, ctx);
|
|
20146
|
-
return;
|
|
20147
|
-
}
|
|
20148
|
-
}
|
|
20134
|
+
if (collectionReferences(object, ctx) === 0 /* RowIds */ && replaceEntryRowValue(object, object[stringKey], value, targetTypeInfo, ctx))
|
|
20135
|
+
return;
|
|
20149
20136
|
object[stringKey] = value;
|
|
20137
|
+
if (!field) recordWrittenEntry(object, stringKey, false, ctx);
|
|
20150
20138
|
invalidateEvaluatorIndexes(ctx, receiver);
|
|
20151
20139
|
}
|
|
20140
|
+
function replaceEntryRowValue(receiver, existing, value, targetTypeInfo, ctx) {
|
|
20141
|
+
if (typeof existing !== "string") return false;
|
|
20142
|
+
const row = evalValueById(
|
|
20143
|
+
ctx,
|
|
20144
|
+
existing,
|
|
20145
|
+
ctx.__runtimeSessionValues,
|
|
20146
|
+
ctx.__valueOverlay
|
|
20147
|
+
);
|
|
20148
|
+
if (row === null) return false;
|
|
20149
|
+
keepAssignedCollectionValues(value, targetTypeInfo, ctx);
|
|
20150
|
+
replaceRowValue(row, value, receiver, ctx);
|
|
20151
|
+
updateUnorderedListProjectionAfterAssignment(row, value, ctx);
|
|
20152
|
+
return true;
|
|
20153
|
+
}
|
|
20154
|
+
function keepAssignedCollectionValues(value, targetTypeInfo, ctx) {
|
|
20155
|
+
const cache = unorderedListProjectionCache(ctx);
|
|
20156
|
+
if (Array.isArray(value) && (targetTypeInfo.type === 6 /* List */ || targetTypeInfo.type === 28 /* Set */)) {
|
|
20157
|
+
if (!cache.referenceEntryIndexesByArray.has(value))
|
|
20158
|
+
cache.referenceEntryIndexesByArray.set(value, /* @__PURE__ */ new Set());
|
|
20159
|
+
return;
|
|
20160
|
+
}
|
|
20161
|
+
if (targetTypeInfo.type === 5 /* Dictionary */ && typeof value === "object" && value !== null && !cache.referenceEntryKeysByRecord.has(value)) {
|
|
20162
|
+
cache.referenceEntryKeysByRecord.set(value, /* @__PURE__ */ new Set());
|
|
20163
|
+
}
|
|
20164
|
+
}
|
|
20152
20165
|
function replaceRowValue(row, value, receiver, ctx) {
|
|
20153
20166
|
const indexes3 = ctx.__indexes;
|
|
20154
20167
|
if (indexes3 === void 0 || ctx.__runtimeSessionValues?.get(row.id) !== row || !indexes3.indexedRowIds.has(row.id)) {
|
|
@@ -20586,9 +20599,11 @@ function evalCollectionMutationInstruction(ins, scope, ctx, options) {
|
|
|
20586
20599
|
);
|
|
20587
20600
|
}
|
|
20588
20601
|
const unorderedEntriesBeforeMutation = unorderedContainerValueId === null || !Array.isArray(targetValue) || ins.mutation === "Add" /* Add */ ? null : [...targetValue];
|
|
20589
|
-
|
|
20602
|
+
const writesEntry = (ins.mutation === "Add" /* Add */ || ins.mutation === "Insert" /* Insert */) && !isLookupSet;
|
|
20603
|
+
let attachedValueId = null;
|
|
20604
|
+
if (writesEntry) {
|
|
20590
20605
|
const attachedValue = isArrayCollection(targetValue) && ins.mutation !== "Insert" /* Insert */ ? args[0] : args[1];
|
|
20591
|
-
|
|
20606
|
+
attachedValueId = findKnownRowIdByValueReference(attachedValue, ctx);
|
|
20592
20607
|
const parentId = findKnownRowIdByValueReference(targetValue, ctx);
|
|
20593
20608
|
if (attachedValueId !== null && parentId !== null) {
|
|
20594
20609
|
ctx.assertCollectionEntryAttachable?.(
|
|
@@ -20625,6 +20640,23 @@ function evalCollectionMutationInstruction(ins, scope, ctx, options) {
|
|
|
20625
20640
|
removedIndex,
|
|
20626
20641
|
ctx
|
|
20627
20642
|
);
|
|
20643
|
+
if (writesEntry && !(targetValue instanceof RuntimeSet)) {
|
|
20644
|
+
const writtenAsRowId = attachedValueId !== null || unorderedContainerValueId !== null;
|
|
20645
|
+
if (Array.isArray(targetValue))
|
|
20646
|
+
recordWrittenEntry(
|
|
20647
|
+
targetValue,
|
|
20648
|
+
removedIndex ?? targetValue.length - 1,
|
|
20649
|
+
writtenAsRowId,
|
|
20650
|
+
ctx
|
|
20651
|
+
);
|
|
20652
|
+
else
|
|
20653
|
+
recordWrittenEntry(
|
|
20654
|
+
objectArg(targetValue, "Dictionary Add target"),
|
|
20655
|
+
String(args[0]),
|
|
20656
|
+
writtenAsRowId,
|
|
20657
|
+
ctx
|
|
20658
|
+
);
|
|
20659
|
+
}
|
|
20628
20660
|
if (unorderedEntriesBeforeMutation !== null && Array.isArray(targetValue)) {
|
|
20629
20661
|
detachRemovedUnorderedScalarEntries(
|
|
20630
20662
|
unorderedEntriesBeforeMutation,
|
|
@@ -20826,9 +20858,10 @@ function runtimeSet(array2, reference, enumEntries, ctx) {
|
|
|
20826
20858
|
const existing = sets.get(array2);
|
|
20827
20859
|
if (existing !== void 0) return existing;
|
|
20828
20860
|
const set = new RuntimeSet(array2, reference, enumEntries);
|
|
20861
|
+
const references = collectionReferences(array2, ctx);
|
|
20829
20862
|
for (let index = 0; index < array2.length; index++) {
|
|
20830
20863
|
const raw = array2[index];
|
|
20831
|
-
const resolves =
|
|
20864
|
+
const resolves = isReferenceEntry(references, index);
|
|
20832
20865
|
const value = resolves ? resolveValueIfId(raw, ctx) : raw;
|
|
20833
20866
|
const key = runtimeSetKey(value, set, ctx);
|
|
20834
20867
|
set.add(key, enumEntries ? key : raw, !enumEntries && resolves);
|
|
@@ -20837,9 +20870,9 @@ function runtimeSet(array2, reference, enumEntries, ctx) {
|
|
|
20837
20870
|
(ctx.__dirtyRuntimeSets ??= /* @__PURE__ */ new Set()).add(set);
|
|
20838
20871
|
return set;
|
|
20839
20872
|
}
|
|
20840
|
-
function storedSetEntryMatch(raw, entryMember, ctx) {
|
|
20873
|
+
function storedSetEntryMatch(raw, reference, entryMember, ctx) {
|
|
20841
20874
|
const byIdentity = entryMember.kind === 7 /* Class */;
|
|
20842
|
-
const row = byIdentity || typeof raw !== "string" ? null : evalValueById(ctx, raw, ctx.__runtimeSessionValues, ctx.__valueOverlay);
|
|
20875
|
+
const row = byIdentity || !reference || typeof raw !== "string" ? null : evalValueById(ctx, raw, ctx.__runtimeSessionValues, ctx.__valueOverlay);
|
|
20843
20876
|
const valueId = byIdentity && typeof raw === "string" ? raw : row?.id ?? null;
|
|
20844
20877
|
const entry = row === null ? { id: "", value: raw } : { id: row.id, value: row.value };
|
|
20845
20878
|
const key = byIdentity ? valueId ?? referenceIdOf(raw, ctx) : setEntryKey(entryMember, entry);
|
|
@@ -20850,8 +20883,14 @@ function storedSetEntries(set, entryMember, ctx) {
|
|
|
20850
20883
|
const existing = indexes3.get(set);
|
|
20851
20884
|
if (existing !== void 0) return existing;
|
|
20852
20885
|
const entries = /* @__PURE__ */ new Map();
|
|
20853
|
-
|
|
20854
|
-
|
|
20886
|
+
const references = collectionReferences(set, ctx);
|
|
20887
|
+
for (let index = 0; index < set.length; index++) {
|
|
20888
|
+
const match = storedSetEntryMatch(
|
|
20889
|
+
set[index],
|
|
20890
|
+
isReferenceEntry(references, index),
|
|
20891
|
+
entryMember,
|
|
20892
|
+
ctx
|
|
20893
|
+
);
|
|
20855
20894
|
if (match !== null && !entries.has(match.key)) {
|
|
20856
20895
|
entries.set(match.key, match);
|
|
20857
20896
|
}
|
|
@@ -20863,7 +20902,13 @@ function syncStoredSetEntries(set, mutation, removed, entryMember, ctx) {
|
|
|
20863
20902
|
const entries = ctx.__setEntryIndexes?.get(set);
|
|
20864
20903
|
if (entries === void 0) return;
|
|
20865
20904
|
if (entryMember !== null && mutation === "Add" /* Add */) {
|
|
20866
|
-
const
|
|
20905
|
+
const index = set.length - 1;
|
|
20906
|
+
const added = storedSetEntryMatch(
|
|
20907
|
+
set[index],
|
|
20908
|
+
isReferenceEntry(collectionReferences(set, ctx), index),
|
|
20909
|
+
entryMember,
|
|
20910
|
+
ctx
|
|
20911
|
+
);
|
|
20867
20912
|
if (added !== null) entries.set(added.key, added);
|
|
20868
20913
|
return;
|
|
20869
20914
|
}
|
|
@@ -20929,6 +20974,7 @@ function applyLocalCollectionMutation(targetValue, mutation, args, ctx, unique =
|
|
|
20929
20974
|
return null;
|
|
20930
20975
|
case "Remove" /* Remove */:
|
|
20931
20976
|
if (Array.isArray(targetValue)) {
|
|
20977
|
+
const references = resolveRemovalEntries ? collectionReferences(targetValue, ctx) : recordedReferenceEntries(targetValue, ctx) ?? 1 /* Values */;
|
|
20932
20978
|
let index = -1;
|
|
20933
20979
|
for (let candidate = 0; candidate < targetValue.length; candidate += 1) {
|
|
20934
20980
|
const entry = targetValue[candidate];
|
|
@@ -20939,9 +20985,8 @@ function applyLocalCollectionMutation(targetValue, mutation, args, ctx, unique =
|
|
|
20939
20985
|
}
|
|
20940
20986
|
continue;
|
|
20941
20987
|
}
|
|
20942
|
-
const referenceEntry = ctx.__unorderedListProjections?.referenceEntryIndexesByArray.get(targetValue)?.has(candidate) === true;
|
|
20943
20988
|
if (jsEqual(
|
|
20944
|
-
|
|
20989
|
+
typeof entry === "string" && isReferenceEntry(references, candidate) ? resolveValueIfId(entry, ctx) : entry,
|
|
20945
20990
|
args[0]
|
|
20946
20991
|
)) {
|
|
20947
20992
|
index = candidate;
|
|
@@ -20974,13 +21019,6 @@ function applyLocalCollectionMutation(targetValue, mutation, args, ctx, unique =
|
|
|
20974
21019
|
return null;
|
|
20975
21020
|
}
|
|
20976
21021
|
}
|
|
20977
|
-
function setCollectionReferenceProvenance(targetValue, index, reference, ctx) {
|
|
20978
|
-
const cache = ctx.__unorderedListProjections;
|
|
20979
|
-
const indexes3 = cache?.referenceEntryIndexesByArray.get(targetValue);
|
|
20980
|
-
if (cache === void 0 || indexes3 === void 0) return;
|
|
20981
|
-
if (reference) indexes3.add(index);
|
|
20982
|
-
else indexes3.delete(index);
|
|
20983
|
-
}
|
|
20984
21022
|
function updateCollectionReferenceProvenance(targetValue, mutation, removedIndex, ctx) {
|
|
20985
21023
|
if (!Array.isArray(targetValue)) return;
|
|
20986
21024
|
const cache = ctx.__unorderedListProjections;
|
|
@@ -21254,7 +21292,7 @@ function evalPointerCore(pointer, scope, ctx, resultUsage = "value") {
|
|
|
21254
21292
|
case "staticMember" /* staticMember */:
|
|
21255
21293
|
return evalStaticMember(pointer.memberId, ctx);
|
|
21256
21294
|
case "keyOf" /* keyOf */:
|
|
21257
|
-
return evalKeyOf(pointer
|
|
21295
|
+
return evalKeyOf(pointer, scope, ctx);
|
|
21258
21296
|
case "operation" /* operation */:
|
|
21259
21297
|
return evalOperation(pointer.operation, scope, ctx);
|
|
21260
21298
|
case "function" /* function */:
|
|
@@ -21904,15 +21942,9 @@ function readActionWithOwner(pointer, scope, ctx) {
|
|
|
21904
21942
|
return { action: evalPointer(pointer, scope, ctx), owner: null };
|
|
21905
21943
|
}
|
|
21906
21944
|
let owner = null;
|
|
21907
|
-
const action = evalKeyOf(
|
|
21908
|
-
|
|
21909
|
-
|
|
21910
|
-
ctx,
|
|
21911
|
-
pointer.optional === true,
|
|
21912
|
-
(destination) => {
|
|
21913
|
-
owner = destination.receiver;
|
|
21914
|
-
}
|
|
21915
|
-
);
|
|
21945
|
+
const action = evalKeyOf(pointer, scope, ctx, (destination) => {
|
|
21946
|
+
owner = destination.receiver;
|
|
21947
|
+
});
|
|
21916
21948
|
return { action, owner };
|
|
21917
21949
|
}
|
|
21918
21950
|
function actionPointerLabel(pointer, ctx) {
|
|
@@ -22830,7 +22862,9 @@ function isRuntimeSpriteValue(value) {
|
|
|
22830
22862
|
const sliceIndex = value.sliceIndex;
|
|
22831
22863
|
return typeof sliceIndex === "number" && Number.isInteger(sliceIndex) && sliceIndex >= 0;
|
|
22832
22864
|
}
|
|
22833
|
-
function evalKeyOf(
|
|
22865
|
+
function evalKeyOf(pointer, scope, ctx, onDestination) {
|
|
22866
|
+
const { keyOf } = pointer;
|
|
22867
|
+
const optional2 = pointer.optional === true;
|
|
22834
22868
|
const receiver = evalPointer(keyOf.pointer, scope, ctx);
|
|
22835
22869
|
if (optional2 && (receiver === null || receiver === void 0)) {
|
|
22836
22870
|
return null;
|
|
@@ -22891,7 +22925,7 @@ function evalKeyOf(keyOf, scope, ctx, optional2 = false, onDestination) {
|
|
|
22891
22925
|
if (dispatched.kind === "ok") return dispatched.value;
|
|
22892
22926
|
if (Object.prototype.hasOwnProperty.call(receiver, k)) {
|
|
22893
22927
|
const at2 = receiver[k];
|
|
22894
|
-
return resolveValueIfId(at2, ctx);
|
|
22928
|
+
return typeof at2 === "string" && (pointer.memberId !== void 0 || isReferenceEntry(collectionReferences(receiver, ctx), k)) ? resolveValueIfId(at2, ctx) : at2;
|
|
22895
22929
|
}
|
|
22896
22930
|
const expanded = virtualExpandedRecordForReceiver(receiver, ctx);
|
|
22897
22931
|
if (expanded !== null && Object.prototype.hasOwnProperty.call(expanded, k)) {
|
|
@@ -23624,7 +23658,7 @@ function evaluateSystemNative(memberId, receiver, args, ctx, typeArguments) {
|
|
|
23624
23658
|
shift,
|
|
23625
23659
|
accepts
|
|
23626
23660
|
);
|
|
23627
|
-
return { handled: true, value };
|
|
23661
|
+
return { handled: true, value: referenceEntryList(value, ctx) };
|
|
23628
23662
|
}
|
|
23629
23663
|
if (memberId === NEO_OBJECT_GRID_MEMBER_IDS.GetTiles) {
|
|
23630
23664
|
const value = index.tiles(
|
|
@@ -23634,7 +23668,7 @@ function evaluateSystemNative(memberId, receiver, args, ctx, typeArguments) {
|
|
|
23634
23668
|
shift,
|
|
23635
23669
|
accepts
|
|
23636
23670
|
);
|
|
23637
|
-
return { handled: true, value };
|
|
23671
|
+
return { handled: true, value: referenceEntryList(value, ctx) };
|
|
23638
23672
|
}
|
|
23639
23673
|
const tile = index.tile(
|
|
23640
23674
|
placement,
|
|
@@ -24256,7 +24290,17 @@ function evalDeclaredListIndex(info, scope, ctx) {
|
|
|
24256
24290
|
collectionIndexes.set(cacheKey, index);
|
|
24257
24291
|
}
|
|
24258
24292
|
if (info.keyPointer === void 0) {
|
|
24259
|
-
|
|
24293
|
+
const view = Object.fromEntries(index);
|
|
24294
|
+
if (info.unique) {
|
|
24295
|
+
unorderedListProjectionCache(ctx).referenceEntryKeysByRecord.set(
|
|
24296
|
+
view,
|
|
24297
|
+
new Set(index.keys())
|
|
24298
|
+
);
|
|
24299
|
+
} else {
|
|
24300
|
+
for (const bucket of index.values())
|
|
24301
|
+
if (Array.isArray(bucket)) referenceEntryList(bucket, ctx);
|
|
24302
|
+
}
|
|
24303
|
+
return view;
|
|
24260
24304
|
}
|
|
24261
24305
|
const key = evalPointer(info.keyPointer, scope, ctx);
|
|
24262
24306
|
if (typeof key !== "string") {
|
|
@@ -24268,7 +24312,12 @@ function evalDeclaredListIndex(info, scope, ctx) {
|
|
|
24268
24312
|
if (info.unique) {
|
|
24269
24313
|
return typeof hit === "string" ? resolveValueIfId(hit, ctx) : null;
|
|
24270
24314
|
}
|
|
24271
|
-
return Array.isArray(hit) ? [...hit] : [];
|
|
24315
|
+
return referenceEntryList(Array.isArray(hit) ? [...hit] : [], ctx);
|
|
24316
|
+
}
|
|
24317
|
+
function referenceEntryList(list, ctx) {
|
|
24318
|
+
const indexes3 = unorderedListProjectionCache(ctx).referenceEntryIndexesByArray;
|
|
24319
|
+
if (!indexes3.has(list)) indexes3.set(list, new Set(list.keys()));
|
|
24320
|
+
return list;
|
|
24272
24321
|
}
|
|
24273
24322
|
function prepareCollectionCallback(callback, parentScope, ctx, isList, returnContract, onPredicateMatch) {
|
|
24274
24323
|
const metrics = ctx.__collectionCallbackPreparationMetrics;
|
|
@@ -24832,7 +24881,7 @@ function evalFunction(fn, scope, ctx) {
|
|
|
24832
24881
|
if (fn.info.reference === true) {
|
|
24833
24882
|
return referenceIndexOf(c, target, ctx) !== null;
|
|
24834
24883
|
}
|
|
24835
|
-
const targetReferenceId = typeof target === "string" ?
|
|
24884
|
+
const targetReferenceId = typeof target === "string" ? null : findKnownRowIdByValueReference(target, ctx);
|
|
24836
24885
|
let containsResolvedEntry = false;
|
|
24837
24886
|
iterateCollection(c, ctx, (entry, _key, valueId) => {
|
|
24838
24887
|
if (valueId !== null && valueId === targetReferenceId || jsEqual(entry, target)) {
|
|
@@ -24853,7 +24902,7 @@ function evalFunction(fn, scope, ctx) {
|
|
|
24853
24902
|
const index = referenceIndexOf(collection, target, ctx);
|
|
24854
24903
|
return index === null ? -1 : numberArg(index, "IndexOf index");
|
|
24855
24904
|
}
|
|
24856
|
-
const targetReferenceId = typeof target === "string" ?
|
|
24905
|
+
const targetReferenceId = typeof target === "string" ? null : findKnownRowIdByValueReference(target, ctx);
|
|
24857
24906
|
let found = -1;
|
|
24858
24907
|
iterateCollection(collection, ctx, (entry, key, valueId) => {
|
|
24859
24908
|
if (valueId !== null && valueId === targetReferenceId || jsEqual(entry, target)) {
|
|
@@ -25996,6 +26045,8 @@ function evaluateDeclaredConstructorArguments(info, record4, scope, ctx) {
|
|
|
25996
26045
|
);
|
|
25997
26046
|
}
|
|
25998
26047
|
const value = byName.get(parameter3.name);
|
|
26048
|
+
if (parameter3.type === 9 /* Lookup */ && Array.isArray(value))
|
|
26049
|
+
return referenceEntryList(value, ctx);
|
|
25999
26050
|
if (typeof value !== "number") return value;
|
|
26000
26051
|
if (parameter3.type === 4 /* Float */) return Math.fround(value);
|
|
26001
26052
|
if (parameter3.type !== 20 /* Decimal */) return value;
|
|
@@ -26490,12 +26541,7 @@ function evaluateInitializerInContext(init, member, ctx, createdValues, argument
|
|
|
26490
26541
|
deleteRuntimeSessionValue(ctx, rootRow.id);
|
|
26491
26542
|
ctx.__executionState?.constructorGroups.delete(rootRow.id);
|
|
26492
26543
|
const constructorArgs = typeof result.value === "object" && result.value !== null ? ctx.__constructedArgumentsByValue.get(result.value) ?? rootRow.constructorArgs ?? void 0 : void 0;
|
|
26493
|
-
const provenance = pickInstanceProvenance({
|
|
26494
|
-
constructorArgs,
|
|
26495
|
-
instanceConstructorId: rootRow.instanceConstructorId,
|
|
26496
|
-
instanceVariantId: rootRow.instanceVariantId,
|
|
26497
|
-
instanceVariantRowValueId: rootRow.instanceVariantRowValueId
|
|
26498
|
-
});
|
|
26544
|
+
const provenance = pickInstanceProvenance({ ...rootRow, constructorArgs });
|
|
26499
26545
|
return {
|
|
26500
26546
|
value: result.value,
|
|
26501
26547
|
classId: rootRow.classId ?? null,
|
|
@@ -27360,7 +27406,7 @@ function evalVariantInitialize(info, scope, ctx) {
|
|
|
27360
27406
|
scope,
|
|
27361
27407
|
ctx
|
|
27362
27408
|
);
|
|
27363
|
-
stampInstanceVariantProvenance(instance, selection, ctx
|
|
27409
|
+
stampInstanceVariantProvenance(instance, selection, ctx);
|
|
27364
27410
|
return instance;
|
|
27365
27411
|
}
|
|
27366
27412
|
const graph = resolveVariantGraph(selection, ctx);
|
|
@@ -27391,12 +27437,16 @@ function evalVariantInitialize(info, scope, ctx) {
|
|
|
27391
27437
|
ctx,
|
|
27392
27438
|
ctx.__variantDeclarativeAnsweredValueIds
|
|
27393
27439
|
);
|
|
27394
|
-
stampInstanceVariantProvenance(instance, selection, ctx
|
|
27440
|
+
stampInstanceVariantProvenance(instance, selection, ctx);
|
|
27395
27441
|
return instance;
|
|
27396
27442
|
} finally {
|
|
27397
27443
|
closeFrame();
|
|
27398
27444
|
}
|
|
27399
27445
|
}
|
|
27446
|
+
function isInsideAnotherExpansion(valueId, ctx) {
|
|
27447
|
+
const ownerRootId = ctx.vm.databaseVM?.virtualInstanceRootIdForValue(valueId) ?? null;
|
|
27448
|
+
return ownerRootId !== null && ownerRootId !== valueId;
|
|
27449
|
+
}
|
|
27400
27450
|
function evalVariantApply(info, scope, ctx) {
|
|
27401
27451
|
const receiver = evalPointer(info.receiverPointer, scope, ctx);
|
|
27402
27452
|
if (receiver === null || receiver === void 0) {
|
|
@@ -27408,12 +27458,12 @@ function evalVariantApply(info, scope, ctx) {
|
|
|
27408
27458
|
evalPointer(info.variantPointer, scope, ctx),
|
|
27409
27459
|
"ToVariant argument"
|
|
27410
27460
|
);
|
|
27411
|
-
|
|
27412
|
-
|
|
27461
|
+
const graph = selection.variantId === null ? null : resolveVariantGraph(selection, ctx);
|
|
27462
|
+
if (info.declarativeReplay === true) {
|
|
27463
|
+
if (graph !== null) applyVariantDeclarativeHalves(receiver, graph, ctx);
|
|
27413
27464
|
return receiver;
|
|
27414
27465
|
}
|
|
27415
|
-
const
|
|
27416
|
-
const rowParameters = resolveVariantRowParameter({
|
|
27466
|
+
const rowParameters = graph === null ? [] : resolveVariantRowParameter({
|
|
27417
27467
|
graph,
|
|
27418
27468
|
selection,
|
|
27419
27469
|
explicitPointer: info.rowPointer,
|
|
@@ -27422,13 +27472,18 @@ function evalVariantApply(info, scope, ctx) {
|
|
|
27422
27472
|
});
|
|
27423
27473
|
const rootRow = trackedRowForValueReference(receiver, ctx);
|
|
27424
27474
|
if (rootRow === null || !isLiteralValueContent(rootRow)) {
|
|
27475
|
+
if (graph === null) return receiver;
|
|
27425
27476
|
throw new NSGetterRuntimeError(
|
|
27426
27477
|
"ToVariant receiver has no addressable instance root."
|
|
27427
27478
|
);
|
|
27428
27479
|
}
|
|
27429
|
-
|
|
27430
|
-
|
|
27431
|
-
|
|
27480
|
+
if (graph === null && typeof rootRow.instanceAppliedVariantId !== "string") {
|
|
27481
|
+
return receiver;
|
|
27482
|
+
}
|
|
27483
|
+
const inPlace = ctx.__runtimeSessionValues?.has(rootRow.id) === true || isInsideAnotherExpansion(rootRow.id, ctx);
|
|
27484
|
+
const priorInstanceRoot = inPlace ? null : deepClonePlainData(rootRow);
|
|
27485
|
+
const applyValue = graph?.root.Apply;
|
|
27486
|
+
if (graph !== null && applyValue !== void 0 && applyValue !== null) {
|
|
27432
27487
|
invokeVariantClosure({
|
|
27433
27488
|
closureValueId: applyValue,
|
|
27434
27489
|
ctx,
|
|
@@ -27438,17 +27493,12 @@ function evalVariantApply(info, scope, ctx) {
|
|
|
27438
27493
|
});
|
|
27439
27494
|
}
|
|
27440
27495
|
if (priorInstanceRoot === null) {
|
|
27441
|
-
|
|
27442
|
-
applyVariantDeclarativeHalves(receiver, graph, ctx);
|
|
27496
|
+
if (graph !== null) applyVariantDeclarativeHalves(receiver, graph, ctx);
|
|
27443
27497
|
return receiver;
|
|
27444
27498
|
}
|
|
27445
27499
|
priorInstanceRoot.value = deepClonePlainData(rootRow.value);
|
|
27446
|
-
const answeredSlots = collectVariantDeclarativeAnsweredSlots(
|
|
27447
|
-
|
|
27448
|
-
graph,
|
|
27449
|
-
ctx
|
|
27450
|
-
);
|
|
27451
|
-
stampInstanceVariantProvenance(receiver, selection, ctx);
|
|
27500
|
+
const answeredSlots = graph === null ? [] : collectVariantDeclarativeAnsweredSlots(receiver, graph, ctx);
|
|
27501
|
+
stampAppliedVariantProvenance(rootRow, receiver, selection, ctx);
|
|
27452
27502
|
const resolver = ctx.vm.databaseVM?.resolveVariantInstanceGraph;
|
|
27453
27503
|
if (resolver === void 0) {
|
|
27454
27504
|
if (answeredSlots.length > 0) {
|
|
@@ -27457,26 +27507,41 @@ function evalVariantApply(info, scope, ctx) {
|
|
|
27457
27507
|
);
|
|
27458
27508
|
}
|
|
27459
27509
|
} else {
|
|
27510
|
+
const overlay = ctx.__valueOverlay;
|
|
27511
|
+
const copies = overlay === void 0 ? void 0 : variantResolutionCopies(overlay);
|
|
27460
27512
|
const resolution = resolver.call(ctx.vm.databaseVM, {
|
|
27461
27513
|
priorInstanceRoot,
|
|
27462
27514
|
nextInstanceRoot: deepClonePlainData(rootRow),
|
|
27463
27515
|
answeredValueIds: [...new Set(answeredSlots.map((slot) => slot.valueId))],
|
|
27464
27516
|
localRows: [
|
|
27465
27517
|
...ctx.__runtimeSessionValues?.values() ?? [],
|
|
27466
|
-
...
|
|
27467
|
-
]
|
|
27518
|
+
...overlay?.values() ?? []
|
|
27519
|
+
],
|
|
27520
|
+
virtualCopyIds: unwrittenVariantResolutionCopyIds(
|
|
27521
|
+
overlay,
|
|
27522
|
+
copies?.byRootId.get(rootRow.id)
|
|
27523
|
+
)
|
|
27468
27524
|
});
|
|
27469
27525
|
for (const valueId of resolution.clearedValueIds) {
|
|
27470
27526
|
const previous = readNeoScriptRuntimeRow(ctx, valueId);
|
|
27471
27527
|
if (previous) observeValueWrite(ctx, previous);
|
|
27472
27528
|
deleteRuntimeSessionValue(ctx, valueId);
|
|
27473
|
-
|
|
27529
|
+
overlay?.delete(valueId);
|
|
27530
|
+
}
|
|
27531
|
+
for (const valueId of copies?.byRootId.get(rootRow.id)?.keys() ?? []) {
|
|
27532
|
+
forgetVariantResolutionCopy(ctx, valueId);
|
|
27474
27533
|
}
|
|
27534
|
+
const virtualValueIds = new Set(resolution.virtualValueIds);
|
|
27475
27535
|
for (const row of resolution.rows) {
|
|
27476
27536
|
if (row.id === rootRow.id) continue;
|
|
27477
27537
|
const previous = readNeoScriptRuntimeRow(ctx, row.id);
|
|
27478
27538
|
if (previous) observeValueWrite(ctx, previous);
|
|
27479
|
-
|
|
27539
|
+
if (overlay === void 0 || copies === void 0) continue;
|
|
27540
|
+
const copy = deepClonePlainData(row);
|
|
27541
|
+
overlay.set(row.id, copy);
|
|
27542
|
+
if (virtualValueIds.has(row.id)) {
|
|
27543
|
+
trackVariantResolutionCopy(copies, rootRow.id, copy);
|
|
27544
|
+
}
|
|
27480
27545
|
}
|
|
27481
27546
|
if (typeof receiver !== "object" || receiver === null || Array.isArray(receiver) || typeof resolution.root.value !== "object" || resolution.root.value === null || Array.isArray(resolution.root.value)) {
|
|
27482
27547
|
throw new NSGetterRuntimeError(
|
|
@@ -27490,14 +27555,70 @@ function evalVariantApply(info, scope, ctx) {
|
|
|
27490
27555
|
}
|
|
27491
27556
|
return receiver;
|
|
27492
27557
|
}
|
|
27493
|
-
|
|
27558
|
+
var variantResolutionCopiesByOverlay = /* @__PURE__ */ new WeakMap();
|
|
27559
|
+
function variantResolutionCopies(overlay) {
|
|
27560
|
+
let copies = variantResolutionCopiesByOverlay.get(overlay);
|
|
27561
|
+
if (copies === void 0) {
|
|
27562
|
+
copies = { byRootId: /* @__PURE__ */ new Map(), rootIdByValueId: /* @__PURE__ */ new Map() };
|
|
27563
|
+
variantResolutionCopiesByOverlay.set(overlay, copies);
|
|
27564
|
+
}
|
|
27565
|
+
return copies;
|
|
27566
|
+
}
|
|
27567
|
+
function hasVariantResolutionCopies(ctx) {
|
|
27568
|
+
const overlay = ctx.__valueOverlay;
|
|
27569
|
+
if (overlay === void 0) return false;
|
|
27570
|
+
const copies = variantResolutionCopiesByOverlay.get(overlay);
|
|
27571
|
+
return copies !== void 0 && copies.rootIdByValueId.size > 0;
|
|
27572
|
+
}
|
|
27573
|
+
function trackVariantResolutionCopy(copies, rootId, copy) {
|
|
27574
|
+
let rootCopies = copies.byRootId.get(rootId);
|
|
27575
|
+
if (rootCopies === void 0) {
|
|
27576
|
+
rootCopies = /* @__PURE__ */ new Map();
|
|
27577
|
+
copies.byRootId.set(rootId, rootCopies);
|
|
27578
|
+
}
|
|
27579
|
+
rootCopies.set(copy.id, copy);
|
|
27580
|
+
copies.rootIdByValueId.set(copy.id, rootId);
|
|
27581
|
+
}
|
|
27582
|
+
function unwrittenVariantResolutionCopyIds(overlay, rootCopies) {
|
|
27583
|
+
if (overlay === void 0 || rootCopies === void 0) return [];
|
|
27584
|
+
const ids = [];
|
|
27585
|
+
for (const [id, copy] of rootCopies) {
|
|
27586
|
+
if (overlay.get(id) === copy) ids.push(id);
|
|
27587
|
+
}
|
|
27588
|
+
return ids;
|
|
27589
|
+
}
|
|
27590
|
+
function forgetVariantResolutionCopy(ctx, valueId) {
|
|
27591
|
+
const overlay = ctx.__valueOverlay;
|
|
27592
|
+
if (overlay === void 0) return;
|
|
27593
|
+
const copies = variantResolutionCopiesByOverlay.get(overlay);
|
|
27594
|
+
const rootId = copies?.rootIdByValueId.get(valueId);
|
|
27595
|
+
if (copies === void 0 || rootId === void 0) return;
|
|
27596
|
+
copies.rootIdByValueId.delete(valueId);
|
|
27597
|
+
copies.byRootId.get(rootId)?.delete(valueId);
|
|
27598
|
+
}
|
|
27599
|
+
function stampInstanceVariantProvenance(instance, selection, ctx) {
|
|
27494
27600
|
const row = trackedRowForValueReference(instance, ctx);
|
|
27495
27601
|
if (row === null || !isLiteralValueContent(row)) return;
|
|
27496
|
-
if (
|
|
27602
|
+
if (row.id === selection.rowValueId) return;
|
|
27497
27603
|
assertStoredReplayMutableValue(instance, ctx, "variant provenance");
|
|
27498
27604
|
row.instanceVariantId = selection.variantId;
|
|
27499
27605
|
row.instanceVariantRowValueId = selection.rowValueId;
|
|
27500
27606
|
}
|
|
27607
|
+
function stampAppliedVariantProvenance(rootRow, instance, selection, ctx) {
|
|
27608
|
+
const applied = typeof rootRow.instanceAppliedVariantId === "string";
|
|
27609
|
+
const variantId = applied ? rootRow.instanceAppliedVariantId : rootRow.instanceVariantId ?? null;
|
|
27610
|
+
const rowValueId = applied ? rootRow.instanceAppliedVariantRowValueId : rootRow.instanceVariantRowValueId;
|
|
27611
|
+
if (variantId === selection.variantId && (rowValueId ?? null) === selection.rowValueId) {
|
|
27612
|
+
return;
|
|
27613
|
+
}
|
|
27614
|
+
assertStoredReplayMutableValue(instance, ctx, "variant provenance");
|
|
27615
|
+
if (!isVirtualInstanceRootShape(rootRow)) {
|
|
27616
|
+
rootRow.instanceConstructorId = null;
|
|
27617
|
+
rootRow.constructorArgs = {};
|
|
27618
|
+
}
|
|
27619
|
+
rootRow.instanceAppliedVariantId = selection.variantId;
|
|
27620
|
+
rootRow.instanceAppliedVariantRowValueId = selection.rowValueId;
|
|
27621
|
+
}
|
|
27501
27622
|
function constructDeclaredClassValue(info, scope, ctx) {
|
|
27502
27623
|
const descriptor = validateClassConstructorDescriptor(info, ctx, false);
|
|
27503
27624
|
const schemaClass2 = descriptor.schemaClass;
|
|
@@ -27580,6 +27701,7 @@ function constructDeclaredClassValueWithinFrame(descriptor, record4, info, scope
|
|
|
27580
27701
|
);
|
|
27581
27702
|
}
|
|
27582
27703
|
const rootRecord = root.value;
|
|
27704
|
+
recordConstructedFieldSchemaKeys(ctx, rootRecord, descriptor);
|
|
27583
27705
|
if (record4 !== null) {
|
|
27584
27706
|
const encoded = {};
|
|
27585
27707
|
for (let index = 0; index < argumentValues.length; index += 1) {
|
|
@@ -27620,7 +27742,6 @@ function constructDeclaredClassValueWithinFrame(descriptor, record4, info, scope
|
|
|
27620
27742
|
}
|
|
27621
27743
|
const argumentsByValue = ctx.__constructedArgumentsByValue ?? (ctx.__constructedArgumentsByValue = /* @__PURE__ */ new WeakMap());
|
|
27622
27744
|
argumentsByValue.set(rootRecord, encoded);
|
|
27623
|
-
recordConstructedFieldSchemaKeys(ctx, rootRecord, descriptor);
|
|
27624
27745
|
root.constructorArgs = deepClonePlainData(encoded);
|
|
27625
27746
|
root.instanceConstructorId = record4.id;
|
|
27626
27747
|
} else {
|
|
@@ -28013,7 +28134,7 @@ function cloneConstructorArgumentGraph(args) {
|
|
|
28013
28134
|
member.classArguments,
|
|
28014
28135
|
args.ctx.vm.classes
|
|
28015
28136
|
);
|
|
28016
|
-
const record4 =
|
|
28137
|
+
const record4 = /* @__PURE__ */ Object.create(null);
|
|
28017
28138
|
clone.value = record4;
|
|
28018
28139
|
const sourceRecord = {
|
|
28019
28140
|
...virtualExpandedRecordForReceiver(source.value, args.ctx),
|
|
@@ -28057,7 +28178,7 @@ function cloneConstructorArgumentGraph(args) {
|
|
|
28057
28178
|
`Constructor import references missing Dictionary entry member '${member.entryMemberId}'.`
|
|
28058
28179
|
);
|
|
28059
28180
|
}
|
|
28060
|
-
const record4 =
|
|
28181
|
+
const record4 = /* @__PURE__ */ Object.create(null);
|
|
28061
28182
|
clone.value = record4;
|
|
28062
28183
|
const entryEnv = envFromStamp(clone.genericBindings);
|
|
28063
28184
|
for (const [key, childId] of Object.entries(source.value)) {
|
|
@@ -28300,7 +28421,7 @@ function materializeConstructorArgumentValue(args) {
|
|
|
28300
28421
|
args.ctx.vm.members
|
|
28301
28422
|
);
|
|
28302
28423
|
const row = registerConstructorArgumentRow(args, {});
|
|
28303
|
-
const record4 =
|
|
28424
|
+
const record4 = /* @__PURE__ */ Object.create(null);
|
|
28304
28425
|
for (const [key, rawEntry] of Object.entries(args.value)) {
|
|
28305
28426
|
const entry = constructorCollectionEntryValue(
|
|
28306
28427
|
rawEntry,
|
|
@@ -28880,14 +29001,10 @@ function collectionLength(c) {
|
|
|
28880
29001
|
}
|
|
28881
29002
|
function snapshotCollectionMembership(collection, ctx) {
|
|
28882
29003
|
const membership = [];
|
|
28883
|
-
const valid = forEachRawCollectionEntry(collection, (entry) => {
|
|
29004
|
+
const valid = forEachRawCollectionEntry(collection, ctx, (entry) => {
|
|
28884
29005
|
membership.push({
|
|
28885
29006
|
raw: entry.raw,
|
|
28886
|
-
resolveAsReference:
|
|
28887
|
-
collection,
|
|
28888
|
-
entry.key,
|
|
28889
|
-
ctx
|
|
28890
|
-
)
|
|
29007
|
+
resolveAsReference: entry.valueId !== null
|
|
28891
29008
|
});
|
|
28892
29009
|
return 0 /* Continue */;
|
|
28893
29010
|
});
|
|
@@ -28896,7 +29013,7 @@ function snapshotCollectionMembership(collection, ctx) {
|
|
|
28896
29013
|
"NeoScript foreach requires a present collection."
|
|
28897
29014
|
);
|
|
28898
29015
|
}
|
|
28899
|
-
function forEachRawCollectionEntry(c, callback) {
|
|
29016
|
+
function forEachRawCollectionEntry(c, ctx, callback) {
|
|
28900
29017
|
if (c instanceof RuntimeSet) {
|
|
28901
29018
|
for (const [key, entry] of c.membership().entries()) {
|
|
28902
29019
|
if (callback({
|
|
@@ -28908,35 +29025,34 @@ function forEachRawCollectionEntry(c, callback) {
|
|
|
28908
29025
|
}
|
|
28909
29026
|
return true;
|
|
28910
29027
|
}
|
|
29028
|
+
if (typeof c !== "object" || c === null) return false;
|
|
29029
|
+
const references = collectionReferences(c, ctx);
|
|
28911
29030
|
if (Array.isArray(c)) {
|
|
28912
29031
|
for (let key = 0; key < c.length; key += 1) {
|
|
28913
29032
|
const raw = c[key];
|
|
28914
29033
|
const control = callback({
|
|
28915
29034
|
raw,
|
|
28916
29035
|
key,
|
|
28917
|
-
valueId: typeof raw === "string" ? raw : null
|
|
29036
|
+
valueId: typeof raw === "string" && isReferenceEntry(references, key) ? raw : null
|
|
28918
29037
|
});
|
|
28919
29038
|
if (control === 1 /* Break */) break;
|
|
28920
29039
|
}
|
|
28921
29040
|
return true;
|
|
28922
29041
|
}
|
|
28923
|
-
|
|
28924
|
-
|
|
28925
|
-
|
|
28926
|
-
|
|
28927
|
-
|
|
28928
|
-
|
|
28929
|
-
|
|
28930
|
-
if (control === 1 /* Break */) break;
|
|
28931
|
-
}
|
|
28932
|
-
return true;
|
|
29042
|
+
for (const [key, raw] of Object.entries(c)) {
|
|
29043
|
+
const control = callback({
|
|
29044
|
+
raw,
|
|
29045
|
+
key,
|
|
29046
|
+
valueId: typeof raw === "string" && isReferenceEntry(references, key) ? raw : null
|
|
29047
|
+
});
|
|
29048
|
+
if (control === 1 /* Break */) break;
|
|
28933
29049
|
}
|
|
28934
|
-
return
|
|
29050
|
+
return true;
|
|
28935
29051
|
}
|
|
28936
29052
|
function collectionEntries(c, ctx) {
|
|
28937
29053
|
const entries = [];
|
|
28938
|
-
forEachRawCollectionEntry(c, ({ raw,
|
|
28939
|
-
entries.push(
|
|
29054
|
+
forEachRawCollectionEntry(c, ctx, ({ raw, valueId }) => {
|
|
29055
|
+
entries.push(valueId === null ? raw : resolveValueIfId(valueId, ctx));
|
|
28940
29056
|
return 0 /* Continue */;
|
|
28941
29057
|
});
|
|
28942
29058
|
return entries;
|
|
@@ -28944,7 +29060,7 @@ function collectionEntries(c, ctx) {
|
|
|
28944
29060
|
function referenceIndexOf(c, target, ctx) {
|
|
28945
29061
|
const targetId = target === null || target === void 0 ? null : referenceIdOf(target, ctx);
|
|
28946
29062
|
let found = null;
|
|
28947
|
-
forEachRawCollectionEntry(c, ({ raw, key }) => {
|
|
29063
|
+
forEachRawCollectionEntry(c, ctx, ({ raw, key }) => {
|
|
28948
29064
|
if (raw === target || targetId !== null && raw !== null && raw !== void 0 && referenceIdOf(raw, ctx) === targetId) {
|
|
28949
29065
|
found = key;
|
|
28950
29066
|
return 1 /* Break */;
|
|
@@ -28954,26 +29070,61 @@ function referenceIndexOf(c, target, ctx) {
|
|
|
28954
29070
|
return found;
|
|
28955
29071
|
}
|
|
28956
29072
|
function iterateCollection(c, ctx, callback) {
|
|
28957
|
-
forEachRawCollectionEntry(
|
|
28958
|
-
|
|
28959
|
-
|
|
28960
|
-
|
|
29073
|
+
forEachRawCollectionEntry(
|
|
29074
|
+
c,
|
|
29075
|
+
ctx,
|
|
29076
|
+
({ raw, key, valueId }) => callback(
|
|
29077
|
+
valueId === null ? raw : resolveValueIfId(valueId, ctx),
|
|
28961
29078
|
key,
|
|
28962
|
-
|
|
28963
|
-
)
|
|
28964
|
-
|
|
29079
|
+
valueId
|
|
29080
|
+
)
|
|
29081
|
+
);
|
|
28965
29082
|
}
|
|
28966
29083
|
function resolveCollectionEntry(collection, raw, key, ctx) {
|
|
28967
|
-
return
|
|
29084
|
+
return typeof raw === "string" && isReferenceEntry(collectionReferences(collection, ctx), key) ? resolveValueIfId(raw, ctx) : raw;
|
|
28968
29085
|
}
|
|
28969
|
-
function
|
|
28970
|
-
|
|
28971
|
-
|
|
28972
|
-
|
|
28973
|
-
|
|
28974
|
-
collection
|
|
28975
|
-
|
|
28976
|
-
|
|
29086
|
+
function recordedReferenceEntries(collection, ctx) {
|
|
29087
|
+
const cache = ctx.__unorderedListProjections;
|
|
29088
|
+
if (Array.isArray(collection))
|
|
29089
|
+
return cache?.referenceEntryIndexesByArray.get(collection);
|
|
29090
|
+
if (typeof collection === "object" && collection !== null)
|
|
29091
|
+
return cache?.referenceEntryKeysByRecord.get(collection);
|
|
29092
|
+
return void 0;
|
|
29093
|
+
}
|
|
29094
|
+
function collectionReferences(collection, ctx) {
|
|
29095
|
+
return recordedReferenceEntries(collection, ctx) ?? (findKnownRowIdByValueReference(collection, ctx) === null ? 1 /* Values */ : 0 /* RowIds */);
|
|
29096
|
+
}
|
|
29097
|
+
function isReferenceEntry(references, key) {
|
|
29098
|
+
if (references === 0 /* RowIds */) return true;
|
|
29099
|
+
if (references === 1 /* Values */) return false;
|
|
29100
|
+
return references.has(key);
|
|
29101
|
+
}
|
|
29102
|
+
function recordWrittenEntry(collection, key, reference, ctx) {
|
|
29103
|
+
const references = collectionReferences(collection, ctx);
|
|
29104
|
+
if (typeof references !== "object") {
|
|
29105
|
+
if (reference === (references === 0 /* RowIds */)) return;
|
|
29106
|
+
const written = Array.isArray(collection) ? collection[Number(key)] : collection[String(key)];
|
|
29107
|
+
if (!reference && typeof written !== "string") return;
|
|
29108
|
+
}
|
|
29109
|
+
const rowIds = references === 0 /* RowIds */;
|
|
29110
|
+
const cache = unorderedListProjectionCache(ctx);
|
|
29111
|
+
if (Array.isArray(collection)) {
|
|
29112
|
+
let indexes3 = cache.referenceEntryIndexesByArray.get(collection);
|
|
29113
|
+
if (indexes3 === void 0) {
|
|
29114
|
+
indexes3 = new Set(rowIds ? collection.keys() : []);
|
|
29115
|
+
cache.referenceEntryIndexesByArray.set(collection, indexes3);
|
|
29116
|
+
}
|
|
29117
|
+
if (reference) indexes3.add(Number(key));
|
|
29118
|
+
else indexes3.delete(Number(key));
|
|
29119
|
+
return;
|
|
29120
|
+
}
|
|
29121
|
+
let keys = cache.referenceEntryKeysByRecord.get(collection);
|
|
29122
|
+
if (keys === void 0) {
|
|
29123
|
+
keys = new Set(rowIds ? Object.keys(collection) : []);
|
|
29124
|
+
cache.referenceEntryKeysByRecord.set(collection, keys);
|
|
29125
|
+
}
|
|
29126
|
+
if (reference) keys.add(String(key));
|
|
29127
|
+
else keys.delete(String(key));
|
|
28977
29128
|
}
|
|
28978
29129
|
|
|
28979
29130
|
// ../packages/neoscript-runtime/src/declaration-default-source.ts
|
|
@@ -32303,12 +32454,7 @@ function materializeInitializerValue(args) {
|
|
|
32303
32454
|
value: evaluated.value,
|
|
32304
32455
|
...evaluated.classId === null ? {} : { classId: evaluated.classId },
|
|
32305
32456
|
...evaluated.genericBindings === void 0 ? {} : { genericBindings: { ...evaluated.genericBindings } },
|
|
32306
|
-
...
|
|
32307
|
-
...evaluated.instanceConstructorId === void 0 ? {} : { instanceConstructorId: evaluated.instanceConstructorId },
|
|
32308
|
-
...evaluated.instanceVariantId === void 0 ? {} : { instanceVariantId: evaluated.instanceVariantId },
|
|
32309
|
-
...evaluated.instanceVariantRowValueId === void 0 ? {} : {
|
|
32310
|
-
instanceVariantRowValueId: evaluated.instanceVariantRowValueId
|
|
32311
|
-
}
|
|
32457
|
+
...deepClonePlainData(pickInstanceProvenance(evaluated))
|
|
32312
32458
|
};
|
|
32313
32459
|
const allCreated = [root, ...createdValues];
|
|
32314
32460
|
if (evaluated.provisionalRootId !== void 0) {
|
|
@@ -32331,7 +32477,8 @@ function materializeInitializerValue(args) {
|
|
|
32331
32477
|
return {
|
|
32332
32478
|
root,
|
|
32333
32479
|
createdValues,
|
|
32334
|
-
pinnedRootSchemaKeys: evaluated.pinnedRootSchemaKeys ?? /* @__PURE__ */ new Set()
|
|
32480
|
+
pinnedRootSchemaKeys: evaluated.pinnedRootSchemaKeys ?? /* @__PURE__ */ new Set(),
|
|
32481
|
+
pinnedSchemaKeysByValueId: evaluated.pinnedSchemaKeysByValueId ?? /* @__PURE__ */ new Map()
|
|
32335
32482
|
};
|
|
32336
32483
|
}
|
|
32337
32484
|
function materializeMemberDefaultValue(args) {
|
|
@@ -32448,7 +32595,12 @@ function materializeMemberDefaultValue(args) {
|
|
|
32448
32595
|
storageKeyDeclarations,
|
|
32449
32596
|
supersededRootId: built.id
|
|
32450
32597
|
});
|
|
32451
|
-
return {
|
|
32598
|
+
return {
|
|
32599
|
+
root,
|
|
32600
|
+
createdValues: interior,
|
|
32601
|
+
pinnedRootSchemaKeys: /* @__PURE__ */ new Set(),
|
|
32602
|
+
pinnedSchemaKeysByValueId: /* @__PURE__ */ new Map()
|
|
32603
|
+
};
|
|
32452
32604
|
}
|
|
32453
32605
|
|
|
32454
32606
|
// ../packages/neoscript-runtime/src/virtual-instance-graph.ts
|
|
@@ -32478,6 +32630,7 @@ function buildVirtualInstanceMaterializedIndex(args) {
|
|
|
32478
32630
|
})
|
|
32479
32631
|
};
|
|
32480
32632
|
}
|
|
32633
|
+
var KEPT_ROW_SAMPLE_LIMIT = 12;
|
|
32481
32634
|
function derivesContentFromMemberDefault(args) {
|
|
32482
32635
|
const member = args.member;
|
|
32483
32636
|
if (!isMemberClassBase(member)) return false;
|
|
@@ -32630,6 +32783,8 @@ function expandStoredInstance(args) {
|
|
|
32630
32783
|
instanceConstructorId: _instanceConstructorId,
|
|
32631
32784
|
instanceVariantId: _instanceVariantId,
|
|
32632
32785
|
instanceVariantRowValueId: _instanceVariantRowValueId,
|
|
32786
|
+
instanceAppliedVariantId: _instanceAppliedVariantId,
|
|
32787
|
+
instanceAppliedVariantRowValueId: _instanceAppliedVariantRowValueId,
|
|
32633
32788
|
...envelope
|
|
32634
32789
|
} = instanceRoot;
|
|
32635
32790
|
void _value;
|
|
@@ -32638,6 +32793,8 @@ function expandStoredInstance(args) {
|
|
|
32638
32793
|
void _instanceConstructorId;
|
|
32639
32794
|
void _instanceVariantId;
|
|
32640
32795
|
void _instanceVariantRowValueId;
|
|
32796
|
+
void _instanceAppliedVariantId;
|
|
32797
|
+
void _instanceAppliedVariantRowValueId;
|
|
32641
32798
|
const closedRootMember = closeClassArgumentsFromRowStamp(
|
|
32642
32799
|
rootMember,
|
|
32643
32800
|
instanceRoot
|
|
@@ -32719,11 +32876,26 @@ function expandStoredInstance(args) {
|
|
|
32719
32876
|
}
|
|
32720
32877
|
};
|
|
32721
32878
|
};
|
|
32722
|
-
const
|
|
32879
|
+
const constructed = derivesContentFromMemberDefault({
|
|
32723
32880
|
member: replayMember,
|
|
32724
32881
|
instanceRoot,
|
|
32725
32882
|
effectiveClassId: classId
|
|
32726
32883
|
}) ? replayDeclaredDefault() : replay([]);
|
|
32884
|
+
const appliedVariantId = instanceRoot.instanceAppliedVariantId;
|
|
32885
|
+
const materialized = typeof appliedVariantId !== "string" ? constructed : trackMaterialization(
|
|
32886
|
+
() => replayAppliedVariant({
|
|
32887
|
+
evaluateInitializer: args.evaluateInitializer,
|
|
32888
|
+
document: args.document,
|
|
32889
|
+
member: replayMember,
|
|
32890
|
+
constructed,
|
|
32891
|
+
classId,
|
|
32892
|
+
variantId: appliedVariantId,
|
|
32893
|
+
variantRowValueId: instanceRoot.instanceAppliedVariantRowValueId ?? null,
|
|
32894
|
+
...readTracking === void 0 ? {} : { readTracking },
|
|
32895
|
+
saveStaticBindings: args.saveStaticBindings,
|
|
32896
|
+
sessionStaticBindings: args.sessionStaticBindings
|
|
32897
|
+
})
|
|
32898
|
+
);
|
|
32727
32899
|
const rows = [materialized.root, ...materialized.createdValues];
|
|
32728
32900
|
assertVirtualExpansionIsLiteral(rows);
|
|
32729
32901
|
return {
|
|
@@ -32732,6 +32904,80 @@ function expandStoredInstance(args) {
|
|
|
32732
32904
|
pinnedRootSchemaKeys: /* @__PURE__ */ new Set()
|
|
32733
32905
|
};
|
|
32734
32906
|
}
|
|
32907
|
+
function replayAppliedVariant(args) {
|
|
32908
|
+
const rootId = args.constructed.root.id;
|
|
32909
|
+
const sessionValues = /* @__PURE__ */ new Map();
|
|
32910
|
+
sessionValues.set(rootId, args.constructed.root);
|
|
32911
|
+
for (const row of args.constructed.createdValues)
|
|
32912
|
+
sessionValues.set(row.id, row);
|
|
32913
|
+
const variant2 = args.document.databaseVM?.variantById?.(args.variantId) ?? args.document.variants?.find((entry) => entry.id === args.variantId);
|
|
32914
|
+
const variantClassId = variant2?.classId ?? args.classId;
|
|
32915
|
+
const schemaClassInfo = {
|
|
32916
|
+
type: 7 /* Class */,
|
|
32917
|
+
required: true,
|
|
32918
|
+
classId: args.classId
|
|
32919
|
+
};
|
|
32920
|
+
args.evaluateInitializer({
|
|
32921
|
+
init: {
|
|
32922
|
+
code: `virtual-applied-variant:${rootId}`,
|
|
32923
|
+
compiled: {
|
|
32924
|
+
compilerRevision: NEOSCRIPT_COMPILER_REVISION,
|
|
32925
|
+
parameters: evaluatorEnvelopeParameters(),
|
|
32926
|
+
instructions: [
|
|
32927
|
+
{
|
|
32928
|
+
type: "return" /* return */,
|
|
32929
|
+
pointer: {
|
|
32930
|
+
type: "function" /* function */,
|
|
32931
|
+
function: {
|
|
32932
|
+
type: "variantApply" /* variantApply */,
|
|
32933
|
+
info: {
|
|
32934
|
+
receiverPointer: {
|
|
32935
|
+
type: "reference" /* reference */,
|
|
32936
|
+
valueId: rootId
|
|
32937
|
+
},
|
|
32938
|
+
variantPointer: {
|
|
32939
|
+
type: "variant" /* variant */,
|
|
32940
|
+
classId: variantClassId,
|
|
32941
|
+
variantId: args.variantId,
|
|
32942
|
+
rowValueId: args.variantRowValueId
|
|
32943
|
+
},
|
|
32944
|
+
schemaClassInfo,
|
|
32945
|
+
declarativeReplay: true
|
|
32946
|
+
}
|
|
32947
|
+
}
|
|
32948
|
+
}
|
|
32949
|
+
}
|
|
32950
|
+
],
|
|
32951
|
+
typeInfo: schemaClassInfo
|
|
32952
|
+
}
|
|
32953
|
+
},
|
|
32954
|
+
member: args.member,
|
|
32955
|
+
document: args.document,
|
|
32956
|
+
createdValues: [],
|
|
32957
|
+
sessionValues,
|
|
32958
|
+
storedConstructionReplay: true,
|
|
32959
|
+
sourceValueId: rootId,
|
|
32960
|
+
...args.readTracking === void 0 ? {} : { readTracking: args.readTracking },
|
|
32961
|
+
saveStaticBindings: args.saveStaticBindings,
|
|
32962
|
+
sessionStaticBindings: args.sessionStaticBindings
|
|
32963
|
+
});
|
|
32964
|
+
const root = sessionValues.get(rootId);
|
|
32965
|
+
if (root === void 0) {
|
|
32966
|
+
throw new Error(
|
|
32967
|
+
`Applied variant "${args.variantId}" replay lost instance root "${rootId}".`
|
|
32968
|
+
);
|
|
32969
|
+
}
|
|
32970
|
+
sessionValues.delete(rootId);
|
|
32971
|
+
return {
|
|
32972
|
+
...args.constructed,
|
|
32973
|
+
root: {
|
|
32974
|
+
...root,
|
|
32975
|
+
instanceAppliedVariantId: args.variantId,
|
|
32976
|
+
instanceAppliedVariantRowValueId: args.variantRowValueId
|
|
32977
|
+
},
|
|
32978
|
+
createdValues: [...sessionValues.values()]
|
|
32979
|
+
};
|
|
32980
|
+
}
|
|
32735
32981
|
function resolveVirtualInstanceGraph(args) {
|
|
32736
32982
|
const expansion = args.expansionIndex ?? indexExpansion(args);
|
|
32737
32983
|
const recorder = args.readRecorder ?? null;
|
|
@@ -33550,6 +33796,11 @@ function expandStoredClassValue(args) {
|
|
|
33550
33796
|
pinnedRootSchemaKeys: /* @__PURE__ */ new Set()
|
|
33551
33797
|
};
|
|
33552
33798
|
}
|
|
33799
|
+
function owningInstanceRootId(graph) {
|
|
33800
|
+
let owner = graph;
|
|
33801
|
+
while (owner?.containingGraph !== void 0) owner = owner.containingGraph;
|
|
33802
|
+
return owner?.instanceRootId ?? null;
|
|
33803
|
+
}
|
|
33553
33804
|
function isStoredClassResolutionRoot(value) {
|
|
33554
33805
|
if (!isLiteralValueContent(value)) return false;
|
|
33555
33806
|
if (isVirtualInstanceRootShape(value)) return true;
|
|
@@ -33639,6 +33890,393 @@ function planVirtualOverrideResets(args) {
|
|
|
33639
33890
|
});
|
|
33640
33891
|
return { deletes, updates };
|
|
33641
33892
|
}
|
|
33893
|
+
function planCollapseVirtualInstance(args) {
|
|
33894
|
+
const protectedIds = args.protectedValueIds ?? /* @__PURE__ */ new Set();
|
|
33895
|
+
const pinnedIds = args.pinnedValueIds ?? /* @__PURE__ */ new Set();
|
|
33896
|
+
const deleteIds = /* @__PURE__ */ new Set();
|
|
33897
|
+
const pairingMismatchIds = /* @__PURE__ */ new Set();
|
|
33898
|
+
const updates = [];
|
|
33899
|
+
const subtreeFacts = /* @__PURE__ */ new Map();
|
|
33900
|
+
const stampsByPath = /* @__PURE__ */ new Map();
|
|
33901
|
+
const reproducibleByPath = /* @__PURE__ */ new Map();
|
|
33902
|
+
const isReproduciblePath = (location) => {
|
|
33903
|
+
const cached = reproducibleByPath.get(location.pathKey);
|
|
33904
|
+
if (cached !== void 0) return cached;
|
|
33905
|
+
reproducibleByPath.set(location.pathKey, false);
|
|
33906
|
+
const reproducible = computeReproduciblePath(location);
|
|
33907
|
+
reproducibleByPath.set(location.pathKey, reproducible);
|
|
33908
|
+
return reproducible;
|
|
33909
|
+
};
|
|
33910
|
+
const nestedRootIds = args.nestedRootValueIds ?? /* @__PURE__ */ new Set();
|
|
33911
|
+
const isNestedRoot = (valueId) => valueId !== args.graph.root.id && nestedRootIds.has(valueId);
|
|
33912
|
+
const ownsChildInterior = (child) => {
|
|
33913
|
+
const stored = child.materializedRow;
|
|
33914
|
+
if (stored === null) return true;
|
|
33915
|
+
if (isNestedRoot(stored.id)) return false;
|
|
33916
|
+
if (!isLiteralValueContent(stored)) return true;
|
|
33917
|
+
const provenance = args.graph.compareCreationProvenance(child);
|
|
33918
|
+
if (!provenance.sameType) return false;
|
|
33919
|
+
if (provenance.sameRecipe) return true;
|
|
33920
|
+
if (typeof stored.instanceConstructorId === "string") return false;
|
|
33921
|
+
if (typeof stored.instanceVariantId === "string") return false;
|
|
33922
|
+
if (typeof stored.instanceAppliedVariantId === "string") return false;
|
|
33923
|
+
const storedArgs = stored.constructorArgs;
|
|
33924
|
+
if (storedArgs != null && Object.keys(storedArgs).length > 0) return false;
|
|
33925
|
+
return !isInitValueContent(child.member.defaultValue);
|
|
33926
|
+
};
|
|
33927
|
+
const valuesById = args.valuesById ?? /* @__PURE__ */ new Map();
|
|
33928
|
+
const frameDerivedLineages = /* @__PURE__ */ new Set();
|
|
33929
|
+
for (const location of args.graph.locationsByPath.values()) {
|
|
33930
|
+
const derived = location.virtualRow.sourceValueId;
|
|
33931
|
+
if (typeof derived === "string") frameDerivedLineages.add(derived);
|
|
33932
|
+
}
|
|
33933
|
+
const ownsLineageByPath = /* @__PURE__ */ new Map();
|
|
33934
|
+
const frameOwnsLineage = (location) => {
|
|
33935
|
+
const cached = ownsLineageByPath.get(location.pathKey);
|
|
33936
|
+
if (cached !== void 0) return cached;
|
|
33937
|
+
ownsLineageByPath.set(location.pathKey, true);
|
|
33938
|
+
let owns = true;
|
|
33939
|
+
let parentPath = parentPathKey(location.pathKey);
|
|
33940
|
+
while (parentPath !== null) {
|
|
33941
|
+
const ancestor = args.graph.locationsByPath.get(parentPath);
|
|
33942
|
+
if (ancestor === void 0) break;
|
|
33943
|
+
const ancestorId = ancestor.materializedRow?.id;
|
|
33944
|
+
if (ancestorId !== void 0 && isNestedRoot(ancestorId)) {
|
|
33945
|
+
owns = false;
|
|
33946
|
+
break;
|
|
33947
|
+
}
|
|
33948
|
+
parentPath = parentPathKey(parentPath);
|
|
33949
|
+
}
|
|
33950
|
+
ownsLineageByPath.set(location.pathKey, owns);
|
|
33951
|
+
return owns;
|
|
33952
|
+
};
|
|
33953
|
+
const isCrossFrameLineageRecord = (location, stored) => {
|
|
33954
|
+
const storedSource = stored.sourceValueId ?? null;
|
|
33955
|
+
if (storedSource === null) return false;
|
|
33956
|
+
if (storedSource === stored.id) return false;
|
|
33957
|
+
if (frameDerivedLineages.has(storedSource)) return false;
|
|
33958
|
+
const named = valuesById.get(storedSource);
|
|
33959
|
+
if (named === void 0) return false;
|
|
33960
|
+
if (!isLiteralValueContent(stored)) return false;
|
|
33961
|
+
if (!isLiteralValueContent(named)) {
|
|
33962
|
+
return args.graph.compareLeafContent(location);
|
|
33963
|
+
}
|
|
33964
|
+
return semanticEqual(
|
|
33965
|
+
normalizeLeafPayload(named, location.member),
|
|
33966
|
+
normalizeLeafPayload(stored, location.member)
|
|
33967
|
+
);
|
|
33968
|
+
};
|
|
33969
|
+
const computeReproduciblePath = (location) => {
|
|
33970
|
+
const segment = location.parentSegment;
|
|
33971
|
+
if (segment === null || location.pathKey === ROOT_PATH) return true;
|
|
33972
|
+
const parentPath = parentPathKey(location.pathKey);
|
|
33973
|
+
if (parentPath === null) return true;
|
|
33974
|
+
const parent = args.graph.locationsByPath.get(parentPath);
|
|
33975
|
+
if (parent === void 0) return false;
|
|
33976
|
+
if (!isReproduciblePath(parent)) return false;
|
|
33977
|
+
if (!isMemberEntryCollectionBase(parent.member)) return true;
|
|
33978
|
+
if (listKindOf(parent.member) !== 1 /* Unordered */) return true;
|
|
33979
|
+
return unorderedEntryMatchedByProvenance(location);
|
|
33980
|
+
};
|
|
33981
|
+
const normalizedStoredRow = (location, stored) => {
|
|
33982
|
+
const cached = stampsByPath.get(location.pathKey);
|
|
33983
|
+
if (cached !== void 0) return withLegacyLineage(stored, cached);
|
|
33984
|
+
const stamp = settleLineage(stored, location.virtualRow, {
|
|
33985
|
+
reproduciblePosition: isReproduciblePath(location),
|
|
33986
|
+
frameOwnsLineage: frameOwnsLineage(location),
|
|
33987
|
+
crossFrameRecord: isCrossFrameLineageRecord(location, stored)
|
|
33988
|
+
});
|
|
33989
|
+
stampsByPath.set(location.pathKey, stamp);
|
|
33990
|
+
return withLegacyLineage(stored, stamp);
|
|
33991
|
+
};
|
|
33992
|
+
const compareSubtree = (location) => {
|
|
33993
|
+
const cached = subtreeFacts.get(location.pathKey);
|
|
33994
|
+
if (cached !== void 0) return cached;
|
|
33995
|
+
const stored = location.materializedRow;
|
|
33996
|
+
if (stored !== null && isInitValueContent(stored)) {
|
|
33997
|
+
const result2 = {
|
|
33998
|
+
defaultEqual: false,
|
|
33999
|
+
contentEqual: false,
|
|
34000
|
+
protected: true
|
|
34001
|
+
};
|
|
34002
|
+
subtreeFacts.set(location.pathKey, result2);
|
|
34003
|
+
return result2;
|
|
34004
|
+
}
|
|
34005
|
+
const real = stored === null ? null : normalizedStoredRow(location, stored);
|
|
34006
|
+
if (real === null) {
|
|
34007
|
+
const result2 = {
|
|
34008
|
+
defaultEqual: true,
|
|
34009
|
+
contentEqual: true,
|
|
34010
|
+
protected: false
|
|
34011
|
+
};
|
|
34012
|
+
subtreeFacts.set(location.pathKey, result2);
|
|
34013
|
+
return result2;
|
|
34014
|
+
}
|
|
34015
|
+
let protectedSubtree = protectedIds.has(real.id) || pinnedIds.has(real.id) || args.removableValueIds !== void 0 && !args.removableValueIds.has(real.id) || location.parentId === args.graph.root.id && location.parentSegment?.kind === "class" && args.graph.pinnedRootSchemaKeys?.has(
|
|
34016
|
+
location.parentSegment.schemaKey
|
|
34017
|
+
) === true;
|
|
34018
|
+
const ownsLineage = frameOwnsLineage(location);
|
|
34019
|
+
const pairingMismatch = provenancePairingDisagrees(
|
|
34020
|
+
real,
|
|
34021
|
+
location.virtualRow,
|
|
34022
|
+
{
|
|
34023
|
+
reproduciblePosition: isReproduciblePath(location),
|
|
34024
|
+
frameOwnsLineage: true,
|
|
34025
|
+
crossFrameRecord: isCrossFrameLineageRecord(location, real)
|
|
34026
|
+
}
|
|
34027
|
+
);
|
|
34028
|
+
let defaultEqual = !pairingMismatch && args.graph.compareCreationProvenance(location).sameRecipe;
|
|
34029
|
+
let contentEqual = true;
|
|
34030
|
+
const storedIsNull = real.value === null;
|
|
34031
|
+
const virtualIsNull = location.virtualRow.value === null;
|
|
34032
|
+
if (storedIsNull || virtualIsNull) {
|
|
34033
|
+
defaultEqual &&= storedIsNull && virtualIsNull;
|
|
34034
|
+
contentEqual &&= storedIsNull && virtualIsNull;
|
|
34035
|
+
} else if (isMemberClassBase(location.member)) {
|
|
34036
|
+
for (const schemaKey of Object.keys(stringRecord(real.value))) {
|
|
34037
|
+
const child = args.graph.locationsByPath.get(
|
|
34038
|
+
appendVirtualValuePath(location.pathKey, {
|
|
34039
|
+
kind: "class",
|
|
34040
|
+
schemaKey
|
|
34041
|
+
})
|
|
34042
|
+
);
|
|
34043
|
+
if (child === void 0) {
|
|
34044
|
+
defaultEqual = false;
|
|
34045
|
+
contentEqual = false;
|
|
34046
|
+
continue;
|
|
34047
|
+
}
|
|
34048
|
+
const facts = compareSubtree(child);
|
|
34049
|
+
defaultEqual &&= facts.defaultEqual;
|
|
34050
|
+
contentEqual &&= facts.contentEqual;
|
|
34051
|
+
protectedSubtree ||= facts.protected;
|
|
34052
|
+
}
|
|
34053
|
+
} else if (isMemberEntryCollectionBase(location.member)) {
|
|
34054
|
+
if (listKindOf(location.member) === 1 /* Unordered */) {
|
|
34055
|
+
protectedSubtree = true;
|
|
34056
|
+
const storedEntries = args.graph.materializedUnorderedEntryIdsByContainerId.get(real.id) ?? [];
|
|
34057
|
+
const virtualEntries = args.graph.expandedChildPathsByParentPath.get(location.pathKey) ?? [];
|
|
34058
|
+
const resolvedEntries = args.graph.childPathsByParentPath.get(location.pathKey) ?? [];
|
|
34059
|
+
const storedIsArray = Array.isArray(real.value);
|
|
34060
|
+
const virtualIsArray = Array.isArray(location.virtualRow.value);
|
|
34061
|
+
const entryCountsAgree = storedEntries.length === virtualEntries.length && resolvedEntries.length === storedEntries.length;
|
|
34062
|
+
defaultEqual &&= storedIsArray;
|
|
34063
|
+
defaultEqual &&= virtualIsArray;
|
|
34064
|
+
defaultEqual &&= entryCountsAgree;
|
|
34065
|
+
contentEqual &&= storedIsArray;
|
|
34066
|
+
contentEqual &&= virtualIsArray;
|
|
34067
|
+
contentEqual &&= entryCountsAgree;
|
|
34068
|
+
const resolvedStoredIds = [];
|
|
34069
|
+
for (const childPath of resolvedEntries) {
|
|
34070
|
+
const child = args.graph.locationsByPath.get(childPath);
|
|
34071
|
+
if (child?.materializedRow === null || child === void 0) {
|
|
34072
|
+
defaultEqual = false;
|
|
34073
|
+
contentEqual = false;
|
|
34074
|
+
continue;
|
|
34075
|
+
}
|
|
34076
|
+
resolvedStoredIds.push(child.materializedRow.id);
|
|
34077
|
+
const facts = compareSubtree(child);
|
|
34078
|
+
defaultEqual &&= facts.defaultEqual;
|
|
34079
|
+
contentEqual &&= facts.contentEqual;
|
|
34080
|
+
}
|
|
34081
|
+
const membershipEqual = semanticEqual(
|
|
34082
|
+
resolvedStoredIds.sort(),
|
|
34083
|
+
[...storedEntries].sort()
|
|
34084
|
+
);
|
|
34085
|
+
defaultEqual &&= membershipEqual;
|
|
34086
|
+
contentEqual &&= membershipEqual;
|
|
34087
|
+
} else {
|
|
34088
|
+
const stored2 = Array.isArray(real.value) ? real.value : null;
|
|
34089
|
+
const virtual = Array.isArray(location.virtualRow.value) ? location.virtualRow.value : null;
|
|
34090
|
+
const bothArrays = stored2 !== null && virtual !== null;
|
|
34091
|
+
const lengthsAgree = stored2?.length === virtual?.length;
|
|
34092
|
+
defaultEqual &&= bothArrays;
|
|
34093
|
+
defaultEqual &&= lengthsAgree;
|
|
34094
|
+
contentEqual &&= bothArrays;
|
|
34095
|
+
contentEqual &&= lengthsAgree;
|
|
34096
|
+
for (let index = 0; index < (stored2?.length ?? 0); index += 1) {
|
|
34097
|
+
if (stored2?.[index] === null && virtual?.[index] === null) continue;
|
|
34098
|
+
const child = args.graph.locationsByPath.get(
|
|
34099
|
+
appendVirtualValuePath(location.pathKey, { kind: "list", index })
|
|
34100
|
+
);
|
|
34101
|
+
if (child === void 0) {
|
|
34102
|
+
defaultEqual = false;
|
|
34103
|
+
contentEqual = false;
|
|
34104
|
+
continue;
|
|
34105
|
+
}
|
|
34106
|
+
const facts = compareSubtree(child);
|
|
34107
|
+
defaultEqual &&= facts.defaultEqual;
|
|
34108
|
+
contentEqual &&= facts.contentEqual;
|
|
34109
|
+
protectedSubtree ||= facts.protected;
|
|
34110
|
+
}
|
|
34111
|
+
}
|
|
34112
|
+
} else if (isMemberDictionaryBase(location.member)) {
|
|
34113
|
+
const stored2 = stringRecord(real.value);
|
|
34114
|
+
const virtual = stringRecord(location.virtualRow.value);
|
|
34115
|
+
const keysEqual = semanticEqual(
|
|
34116
|
+
Object.keys(stored2).sort(),
|
|
34117
|
+
Object.keys(virtual).sort()
|
|
34118
|
+
);
|
|
34119
|
+
defaultEqual &&= keysEqual;
|
|
34120
|
+
contentEqual &&= keysEqual;
|
|
34121
|
+
for (const key of Object.keys(stored2)) {
|
|
34122
|
+
const child = args.graph.locationsByPath.get(
|
|
34123
|
+
appendVirtualValuePath(location.pathKey, { kind: "dictionary", key })
|
|
34124
|
+
);
|
|
34125
|
+
if (child === void 0) {
|
|
34126
|
+
defaultEqual = false;
|
|
34127
|
+
contentEqual = false;
|
|
34128
|
+
continue;
|
|
34129
|
+
}
|
|
34130
|
+
const facts = compareSubtree(child);
|
|
34131
|
+
defaultEqual &&= facts.defaultEqual;
|
|
34132
|
+
contentEqual &&= facts.contentEqual;
|
|
34133
|
+
protectedSubtree ||= facts.protected;
|
|
34134
|
+
}
|
|
34135
|
+
} else {
|
|
34136
|
+
const leafEqual = args.graph.compareLeafContent(location);
|
|
34137
|
+
defaultEqual &&= leafEqual;
|
|
34138
|
+
contentEqual &&= leafEqual;
|
|
34139
|
+
}
|
|
34140
|
+
const result = { defaultEqual, contentEqual, protected: protectedSubtree };
|
|
34141
|
+
if (pairingMismatch && ownsLineage && contentEqual) {
|
|
34142
|
+
pairingMismatchIds.add(real.id);
|
|
34143
|
+
}
|
|
34144
|
+
subtreeFacts.set(location.pathKey, result);
|
|
34145
|
+
return result;
|
|
34146
|
+
};
|
|
34147
|
+
const deleteSubtree = (location) => {
|
|
34148
|
+
const descendants = [];
|
|
34149
|
+
const pending = [location.pathKey];
|
|
34150
|
+
while (pending.length > 0) {
|
|
34151
|
+
const path = pending.pop();
|
|
34152
|
+
if (path === void 0) continue;
|
|
34153
|
+
const candidate = args.graph.locationsByPath.get(path);
|
|
34154
|
+
if (candidate !== void 0) descendants.push(candidate);
|
|
34155
|
+
for (const childPath of args.graph.childPathsByParentPath.get(path) ?? []) {
|
|
34156
|
+
pending.push(childPath);
|
|
34157
|
+
}
|
|
34158
|
+
}
|
|
34159
|
+
descendants.sort(
|
|
34160
|
+
(left, right) => pathDepth(right.pathKey) - pathDepth(left.pathKey)
|
|
34161
|
+
);
|
|
34162
|
+
for (const candidate of descendants) {
|
|
34163
|
+
if (candidate.materializedRow !== null) {
|
|
34164
|
+
deleteIds.add(candidate.materializedRow.id);
|
|
34165
|
+
}
|
|
34166
|
+
}
|
|
34167
|
+
};
|
|
34168
|
+
const sparsifyClass = (location) => {
|
|
34169
|
+
const real = location.materializedRow;
|
|
34170
|
+
if (real === null || isInitValueContent(real) || !isMemberClassBase(location.member))
|
|
34171
|
+
return;
|
|
34172
|
+
const stored = stringRecord(real.value);
|
|
34173
|
+
const next = {};
|
|
34174
|
+
for (const [schemaKey, childId] of Object.entries(stored)) {
|
|
34175
|
+
const child = args.graph.locationsByPath.get(
|
|
34176
|
+
appendVirtualValuePath(location.pathKey, { kind: "class", schemaKey })
|
|
34177
|
+
);
|
|
34178
|
+
if (child === void 0) {
|
|
34179
|
+
next[schemaKey] = childId;
|
|
34180
|
+
continue;
|
|
34181
|
+
}
|
|
34182
|
+
const facts = compareSubtree(child);
|
|
34183
|
+
if (facts.defaultEqual && !facts.protected) {
|
|
34184
|
+
deleteSubtree(child);
|
|
34185
|
+
continue;
|
|
34186
|
+
}
|
|
34187
|
+
next[schemaKey] = child.materializedRow?.id ?? childId;
|
|
34188
|
+
if (!isMemberClassBase(child.member)) continue;
|
|
34189
|
+
if (!ownsChildInterior(child)) continue;
|
|
34190
|
+
sparsifyClass(child);
|
|
34191
|
+
}
|
|
34192
|
+
if (!semanticEqual(stored, next)) {
|
|
34193
|
+
updates.push({ valueId: real.id, value: next });
|
|
34194
|
+
}
|
|
34195
|
+
};
|
|
34196
|
+
const stampSurvivingRow = (valueId, pathKey) => {
|
|
34197
|
+
const stamp = stampsByPath.get(pathKey);
|
|
34198
|
+
if (stamp === void 0) return;
|
|
34199
|
+
if (stampIsEmpty(stamp)) return;
|
|
34200
|
+
const sourceValueId = stamp.clearSourceValueId ? null : stamp.sourceValueId;
|
|
34201
|
+
const existing = updates.find((update) => update.valueId === valueId);
|
|
34202
|
+
if (existing !== void 0) {
|
|
34203
|
+
if (sourceValueId !== null || stamp.clearSourceValueId) {
|
|
34204
|
+
existing.sourceValueId = sourceValueId;
|
|
34205
|
+
}
|
|
34206
|
+
return;
|
|
34207
|
+
}
|
|
34208
|
+
const location = args.graph.locationsById.get(valueId);
|
|
34209
|
+
const stored = location?.materializedRow;
|
|
34210
|
+
if (stored === void 0 || stored === null) return;
|
|
34211
|
+
updates.push({
|
|
34212
|
+
valueId,
|
|
34213
|
+
// Payload untouched: this update exists to carry lineage. The corpus
|
|
34214
|
+
// planner drops a change whose row is byte-identical, so a re-run over an
|
|
34215
|
+
// already-corrected row produces nothing.
|
|
34216
|
+
value: stored.value,
|
|
34217
|
+
...sourceValueId === null && !stamp.clearSourceValueId ? {} : { sourceValueId }
|
|
34218
|
+
});
|
|
34219
|
+
};
|
|
34220
|
+
sparsifyClass(args.graph.root);
|
|
34221
|
+
const deletes = [...deleteIds].sort((left, right) => {
|
|
34222
|
+
const leftLocation = args.graph.locationsById.get(left);
|
|
34223
|
+
const rightLocation = args.graph.locationsById.get(right);
|
|
34224
|
+
return pathDepth(rightLocation?.pathKey ?? ROOT_PATH) - pathDepth(leftLocation?.pathKey ?? ROOT_PATH);
|
|
34225
|
+
});
|
|
34226
|
+
const locatedRows = [];
|
|
34227
|
+
for (const location of args.graph.locationsByPath.values()) {
|
|
34228
|
+
if (location.pathKey === ROOT_PATH) continue;
|
|
34229
|
+
const row = location.materializedRow;
|
|
34230
|
+
if (row === null) continue;
|
|
34231
|
+
locatedRows.push({ id: row.id, pathKey: location.pathKey });
|
|
34232
|
+
}
|
|
34233
|
+
locatedRows.sort((left, right) => left.pathKey.localeCompare(right.pathKey));
|
|
34234
|
+
const materializedNonRoot = [];
|
|
34235
|
+
const seenIds = /* @__PURE__ */ new Set();
|
|
34236
|
+
for (const entry of locatedRows) {
|
|
34237
|
+
if (seenIds.has(entry.id)) continue;
|
|
34238
|
+
seenIds.add(entry.id);
|
|
34239
|
+
materializedNonRoot.push(entry);
|
|
34240
|
+
}
|
|
34241
|
+
const keptRowReasons = /* @__PURE__ */ new Map();
|
|
34242
|
+
const breakdown = { content: 0, provenanceOnly: 0, pinnedOrReference: 0 };
|
|
34243
|
+
const provenanceOnlySampleIds = [];
|
|
34244
|
+
const contentSampleIds = [];
|
|
34245
|
+
let keptReferenceTargetRows = 0;
|
|
34246
|
+
for (const entry of materializedNonRoot) {
|
|
34247
|
+
if (protectedIds.has(entry.id)) keptReferenceTargetRows += 1;
|
|
34248
|
+
if (deleteIds.has(entry.id)) continue;
|
|
34249
|
+
if (args.removableValueIds === void 0)
|
|
34250
|
+
stampSurvivingRow(entry.id, entry.pathKey);
|
|
34251
|
+
const reason = keptRowReason(subtreeFacts.get(entry.pathKey));
|
|
34252
|
+
keptRowReasons.set(entry.id, reason);
|
|
34253
|
+
breakdown[reason] += 1;
|
|
34254
|
+
if (reason === "provenanceOnly" && provenanceOnlySampleIds.length < KEPT_ROW_SAMPLE_LIMIT) {
|
|
34255
|
+
provenanceOnlySampleIds.push(entry.id);
|
|
34256
|
+
}
|
|
34257
|
+
if (reason === "content" && contentSampleIds.length < KEPT_ROW_SAMPLE_LIMIT) {
|
|
34258
|
+
contentSampleIds.push(entry.id);
|
|
34259
|
+
}
|
|
34260
|
+
}
|
|
34261
|
+
return {
|
|
34262
|
+
deletes,
|
|
34263
|
+
updates,
|
|
34264
|
+
deletedDefaultEqualRows: deletes.length,
|
|
34265
|
+
keptOverrideRows: keptRowReasons.size,
|
|
34266
|
+
keptReferenceTargetRows,
|
|
34267
|
+
pairingMismatchValueIds: [...pairingMismatchIds].sort(),
|
|
34268
|
+
keptRowBreakdown: breakdown,
|
|
34269
|
+
provenanceOnlySampleIds,
|
|
34270
|
+
contentSampleIds,
|
|
34271
|
+
keptRowReasons
|
|
34272
|
+
};
|
|
34273
|
+
}
|
|
34274
|
+
function keptRowReason(facts) {
|
|
34275
|
+
if (facts === void 0) return "content";
|
|
34276
|
+
if (!facts.contentEqual) return "content";
|
|
34277
|
+
if (!facts.defaultEqual) return "provenanceOnly";
|
|
34278
|
+
return "pinnedOrReference";
|
|
34279
|
+
}
|
|
33642
34280
|
function closeClassArgumentsFromRowStamp(member, row) {
|
|
33643
34281
|
if (!isMemberClassBase(member)) return member;
|
|
33644
34282
|
const stamp = row.genericBindings;
|
|
@@ -33977,7 +34615,9 @@ function compareContextualCreationProvenance(left, right, context) {
|
|
|
33977
34615
|
constructorArgs: literal3.constructorArgs ?? {},
|
|
33978
34616
|
instanceConstructorId: literal3.instanceConstructorId ?? null,
|
|
33979
34617
|
instanceVariantId: literal3.instanceVariantId ?? null,
|
|
33980
|
-
instanceVariantRowValueId: literal3.instanceVariantRowValueId ?? null
|
|
34618
|
+
instanceVariantRowValueId: literal3.instanceVariantRowValueId ?? null,
|
|
34619
|
+
instanceAppliedVariantId: literal3.instanceAppliedVariantId ?? null,
|
|
34620
|
+
instanceAppliedVariantRowValueId: literal3.instanceAppliedVariantRowValueId ?? null
|
|
33981
34621
|
};
|
|
33982
34622
|
};
|
|
33983
34623
|
return {
|
|
@@ -33988,10 +34628,80 @@ function compareContextualCreationProvenance(left, right, context) {
|
|
|
33988
34628
|
)
|
|
33989
34629
|
};
|
|
33990
34630
|
}
|
|
34631
|
+
var SYNTHETIC_LINEAGE_PREFIXES = ["missing-expansion:", "path:"];
|
|
34632
|
+
function unorderedEntryMatchedByProvenance(location) {
|
|
34633
|
+
const storedSource = location.materializedRow?.sourceValueId ?? null;
|
|
34634
|
+
if (storedSource === null) return false;
|
|
34635
|
+
return storedSource === (location.virtualRow.sourceValueId ?? null);
|
|
34636
|
+
}
|
|
34637
|
+
function adoptableLineage(stored, expanded, reproduciblePosition) {
|
|
34638
|
+
if (!reproduciblePosition) return null;
|
|
34639
|
+
const expandedSource = expanded.sourceValueId ?? null;
|
|
34640
|
+
if (expandedSource === null) return null;
|
|
34641
|
+
if (expandedSource === stored.id) return null;
|
|
34642
|
+
if (SYNTHETIC_LINEAGE_PREFIXES.some(
|
|
34643
|
+
(prefix) => expandedSource.startsWith(prefix)
|
|
34644
|
+
)) {
|
|
34645
|
+
return null;
|
|
34646
|
+
}
|
|
34647
|
+
return expandedSource;
|
|
34648
|
+
}
|
|
34649
|
+
function storedLineageIsMeaningless(materialized, reproduciblePosition) {
|
|
34650
|
+
const storedSource = materialized.sourceValueId ?? null;
|
|
34651
|
+
if (storedSource === null) return false;
|
|
34652
|
+
if (storedSource === materialized.id) return true;
|
|
34653
|
+
return !reproduciblePosition;
|
|
34654
|
+
}
|
|
34655
|
+
function provenancePairingDisagrees(materialized, expanded, frame) {
|
|
34656
|
+
const storedSource = materialized.sourceValueId ?? null;
|
|
34657
|
+
if (storedSource === null) return false;
|
|
34658
|
+
if (!frame.frameOwnsLineage) return false;
|
|
34659
|
+
if (frame.crossFrameRecord) return false;
|
|
34660
|
+
if (storedLineageIsMeaningless(materialized, frame.reproduciblePosition)) {
|
|
34661
|
+
return false;
|
|
34662
|
+
}
|
|
34663
|
+
return storedSource !== (expanded.sourceValueId ?? null);
|
|
34664
|
+
}
|
|
34665
|
+
function settleLineage(stored, expanded, frame) {
|
|
34666
|
+
const nothing = { sourceValueId: null, clearSourceValueId: false };
|
|
34667
|
+
if (!frame.frameOwnsLineage) return nothing;
|
|
34668
|
+
const storedSource = stored.sourceValueId ?? null;
|
|
34669
|
+
const expandedSource = expanded.sourceValueId ?? null;
|
|
34670
|
+
if (storedSource === null) {
|
|
34671
|
+
return {
|
|
34672
|
+
sourceValueId: adoptableLineage(
|
|
34673
|
+
stored,
|
|
34674
|
+
expanded,
|
|
34675
|
+
frame.reproduciblePosition
|
|
34676
|
+
),
|
|
34677
|
+
clearSourceValueId: false
|
|
34678
|
+
};
|
|
34679
|
+
}
|
|
34680
|
+
if (storedSource === expandedSource) return nothing;
|
|
34681
|
+
if (frame.crossFrameRecord && frame.reproduciblePosition) {
|
|
34682
|
+
return expandedSource === null ? { sourceValueId: null, clearSourceValueId: true } : { sourceValueId: expandedSource, clearSourceValueId: false };
|
|
34683
|
+
}
|
|
34684
|
+
if (storedLineageIsMeaningless(stored, frame.reproduciblePosition)) {
|
|
34685
|
+
return { sourceValueId: null, clearSourceValueId: true };
|
|
34686
|
+
}
|
|
34687
|
+
return nothing;
|
|
34688
|
+
}
|
|
33991
34689
|
function readClassId(row) {
|
|
33992
34690
|
const classId = Reflect.get(row, "classId");
|
|
33993
34691
|
return typeof classId === "string" ? classId : null;
|
|
33994
34692
|
}
|
|
34693
|
+
function stampIsEmpty(stamp) {
|
|
34694
|
+
return stamp.sourceValueId === null && !stamp.clearSourceValueId;
|
|
34695
|
+
}
|
|
34696
|
+
function withLegacyLineage(stored, stamp) {
|
|
34697
|
+
if (stampIsEmpty(stamp)) return stored;
|
|
34698
|
+
const next = {
|
|
34699
|
+
...stored,
|
|
34700
|
+
...stamp.sourceValueId === null ? {} : { sourceValueId: stamp.sourceValueId }
|
|
34701
|
+
};
|
|
34702
|
+
if (stamp.clearSourceValueId) delete next.sourceValueId;
|
|
34703
|
+
return next;
|
|
34704
|
+
}
|
|
33995
34705
|
function literalRow(row) {
|
|
33996
34706
|
if (!isLiteralValueContent(row)) {
|
|
33997
34707
|
throw new Error(`Expected literal instance row "${row.id}".`);
|
|
@@ -34207,40 +34917,37 @@ function resolveVariantInstanceGraphForDocument(args) {
|
|
|
34207
34917
|
rootMember,
|
|
34208
34918
|
readRecorder: args.readRecorder
|
|
34209
34919
|
});
|
|
34210
|
-
|
|
34920
|
+
let priorInstanceRoot = args.priorInstanceRoot;
|
|
34921
|
+
let nextInstanceRoot = args.nextInstanceRoot;
|
|
34922
|
+
const resolvePriorGraph = () => resolveVirtualInstanceGraph({
|
|
34211
34923
|
document: document2,
|
|
34212
|
-
instanceRoot:
|
|
34924
|
+
instanceRoot: priorInstanceRoot,
|
|
34213
34925
|
rootMember,
|
|
34214
34926
|
expandedRoot: priorExpanded.root,
|
|
34215
34927
|
expandedRows: priorExpanded.rows,
|
|
34216
34928
|
materializedRows: [...materializedById.values()],
|
|
34217
34929
|
readRecorder: args.readRecorder
|
|
34218
34930
|
});
|
|
34219
|
-
const priorAnsweredIds = [];
|
|
34220
|
-
const incomingAnsweredIds = [];
|
|
34221
|
-
for (const valueId of args.answeredValueIds) {
|
|
34222
|
-
const bucket = priorGraph.locationsById.has(valueId) ? priorAnsweredIds : incomingAnsweredIds;
|
|
34223
|
-
bucket.push(valueId);
|
|
34224
|
-
}
|
|
34225
34931
|
const clearedValueIds = /* @__PURE__ */ new Set();
|
|
34226
|
-
|
|
34227
|
-
const resetAnsweredValues = (graph, valueIds) => {
|
|
34228
|
-
if (valueIds.length === 0) return;
|
|
34229
|
-
const reset = planVirtualOverrideResets({ graph, valueIds });
|
|
34932
|
+
const applyReset = (graph, reset) => {
|
|
34230
34933
|
for (const valueId of reset.deletes) {
|
|
34231
34934
|
clearedValueIds.add(valueId);
|
|
34232
34935
|
materializedById.delete(valueId);
|
|
34233
34936
|
}
|
|
34234
34937
|
for (const update of reset.updates) {
|
|
34235
34938
|
if (update.valueId === nextInstanceRoot.id) {
|
|
34236
|
-
const nextRecord = { ...stringRecord(nextInstanceRoot.value) };
|
|
34237
34939
|
const resetRecord = stringRecord(update.value);
|
|
34238
34940
|
const priorRecord = stringRecord(graph.root.materializedRow?.value);
|
|
34239
|
-
|
|
34240
|
-
|
|
34241
|
-
|
|
34242
|
-
|
|
34243
|
-
|
|
34941
|
+
const withoutReset = (root2) => {
|
|
34942
|
+
const record4 = { ...stringRecord(root2.value) };
|
|
34943
|
+
for (const schemaKey of Object.keys(priorRecord)) {
|
|
34944
|
+
if (!Object.hasOwn(resetRecord, schemaKey))
|
|
34945
|
+
delete record4[schemaKey];
|
|
34946
|
+
}
|
|
34947
|
+
return { ...root2, value: record4 };
|
|
34948
|
+
};
|
|
34949
|
+
priorInstanceRoot = withoutReset(literalRow(priorInstanceRoot));
|
|
34950
|
+
nextInstanceRoot = withoutReset(literalRow(nextInstanceRoot));
|
|
34244
34951
|
}
|
|
34245
34952
|
const existing = materializedById.get(update.valueId);
|
|
34246
34953
|
if (existing !== void 0) {
|
|
@@ -34252,6 +34959,28 @@ function resolveVariantInstanceGraphForDocument(args) {
|
|
|
34252
34959
|
}
|
|
34253
34960
|
materializedById.set(nextInstanceRoot.id, nextInstanceRoot);
|
|
34254
34961
|
};
|
|
34962
|
+
let priorGraph = resolvePriorGraph();
|
|
34963
|
+
if (args.virtualCopyIds !== void 0 && args.virtualCopyIds.length > 0) {
|
|
34964
|
+
const collapse = planCollapseVirtualInstance({
|
|
34965
|
+
graph: priorGraph,
|
|
34966
|
+
removableValueIds: new Set(args.virtualCopyIds)
|
|
34967
|
+
});
|
|
34968
|
+
if (collapse.deletes.length > 0 || collapse.updates.length > 0) {
|
|
34969
|
+
applyReset(priorGraph, collapse);
|
|
34970
|
+
materializedById.set(priorInstanceRoot.id, priorInstanceRoot);
|
|
34971
|
+
priorGraph = resolvePriorGraph();
|
|
34972
|
+
}
|
|
34973
|
+
}
|
|
34974
|
+
const priorAnsweredIds = [];
|
|
34975
|
+
const incomingAnsweredIds = [];
|
|
34976
|
+
for (const valueId of args.answeredValueIds) {
|
|
34977
|
+
const bucket = priorGraph.locationsById.has(valueId) ? priorAnsweredIds : incomingAnsweredIds;
|
|
34978
|
+
bucket.push(valueId);
|
|
34979
|
+
}
|
|
34980
|
+
const resetAnsweredValues = (graph, valueIds) => {
|
|
34981
|
+
if (valueIds.length === 0) return;
|
|
34982
|
+
applyReset(graph, planVirtualOverrideResets({ graph, valueIds }));
|
|
34983
|
+
};
|
|
34255
34984
|
resetAnsweredValues(priorGraph, priorAnsweredIds);
|
|
34256
34985
|
materializedById.set(nextInstanceRoot.id, nextInstanceRoot);
|
|
34257
34986
|
const nextExpanded = expandStoredInstance({
|
|
@@ -34295,10 +35024,15 @@ function resolveVariantInstanceGraphForDocument(args) {
|
|
|
34295
35024
|
`ToVariant failed to resolve instance root '${args.nextInstanceRoot.id}'.`
|
|
34296
35025
|
);
|
|
34297
35026
|
}
|
|
35027
|
+
const virtualValueIds = /* @__PURE__ */ new Set();
|
|
35028
|
+
for (const location of nextGraph.locationsById.values()) {
|
|
35029
|
+
if (location.materializedRow === null) virtualValueIds.add(location.id);
|
|
35030
|
+
}
|
|
34298
35031
|
return {
|
|
34299
35032
|
root,
|
|
34300
35033
|
rows: [...nextGraph.rowsById.values()],
|
|
34301
|
-
clearedValueIds: [...clearedValueIds]
|
|
35034
|
+
clearedValueIds: [...clearedValueIds],
|
|
35035
|
+
virtualValueIds: [...virtualValueIds]
|
|
34302
35036
|
};
|
|
34303
35037
|
}
|
|
34304
35038
|
function variantSwapDeclaredMember(document2, rootValueId) {
|
|
@@ -34685,6 +35419,7 @@ function initializerEvaluatorLookups(document2, readTracking) {
|
|
|
34685
35419
|
return resolved;
|
|
34686
35420
|
},
|
|
34687
35421
|
virtualInstanceRowsForValue: (receiverValueId) => databaseVM.virtualInstanceRowsForValue(receiverValueId),
|
|
35422
|
+
virtualInstanceRootIdForValue: (valueId) => databaseVM.virtualInstanceRootIdForValue(valueId),
|
|
34688
35423
|
...databaseVM.worldGridQueryIndex === void 0 ? {} : { worldGridQueryIndex: () => databaseVM.worldGridQueryIndex() },
|
|
34689
35424
|
rowForValueReference: (value) => databaseVM.rowForValueReference?.(value) ?? null,
|
|
34690
35425
|
resolveVariantInstanceGraph: (args) => {
|
|
@@ -34740,6 +35475,9 @@ function initializerEvaluatorLookups(document2, readTracking) {
|
|
|
34740
35475
|
valueById: (id) => indexedLookups.valueById(id) ?? headlessVirtualResolver.valueById(id),
|
|
34741
35476
|
rowForValueReference: (value) => indexedLookups.rowForValueReference?.(value) ?? headlessVirtualResolver.rowForValueReference(value),
|
|
34742
35477
|
virtualInstanceRowsForValue: (receiverValueId) => headlessVirtualResolver.virtualInstanceRowsForValue(receiverValueId),
|
|
35478
|
+
virtualInstanceRootIdForValue: (valueId) => owningInstanceRootId(
|
|
35479
|
+
headlessVirtualResolver.virtualInstanceGraphForValue(valueId)
|
|
35480
|
+
),
|
|
34743
35481
|
recordVirtualInstanceReads: (reads, read) => headlessVirtualResolver.recordReads(reads, read),
|
|
34744
35482
|
// Headless hosts still evaluate `ToVariant` during
|
|
34745
35483
|
// stored-construction replay — production's variant-constructed
|
|
@@ -34862,6 +35600,7 @@ function evaluateMemberInitializer(args) {
|
|
|
34862
35600
|
);
|
|
34863
35601
|
const compiled = compileMemberInitializer(args, databaseVM);
|
|
34864
35602
|
const ctx = {
|
|
35603
|
+
...args.sessionValues === void 0 ? {} : { __runtimeSessionValues: args.sessionValues },
|
|
34865
35604
|
debugSink: args.document.debugSink,
|
|
34866
35605
|
beforeValueAllocation: args.document.beforeValueAllocation,
|
|
34867
35606
|
listenerDefaultCapture: args.document.listenerDefaultCapture,
|
|
@@ -34932,10 +35671,13 @@ function evaluateMemberInitializer(args) {
|
|
|
34932
35671
|
args.argumentValues ?? [],
|
|
34933
35672
|
{
|
|
34934
35673
|
exportInitializerValues: true,
|
|
34935
|
-
|
|
34936
|
-
|
|
34937
|
-
|
|
34938
|
-
|
|
35674
|
+
// Seeded rows already hold their placement.
|
|
35675
|
+
...args.sessionValues === void 0 ? {
|
|
35676
|
+
initializerResult: {
|
|
35677
|
+
member: args.member,
|
|
35678
|
+
genericEnv: args.genericEnv
|
|
35679
|
+
}
|
|
35680
|
+
} : {}
|
|
34939
35681
|
}
|
|
34940
35682
|
);
|
|
34941
35683
|
} catch (error) {
|
|
@@ -34958,9 +35700,12 @@ function evaluateMemberInitializer(args) {
|
|
|
34958
35700
|
);
|
|
34959
35701
|
}
|
|
34960
35702
|
const rootRow = initializerRootRow(result.value, created);
|
|
35703
|
+
const pinnedSchemaKeysByValueId = /* @__PURE__ */ new Map();
|
|
34961
35704
|
for (const row of created) {
|
|
34962
35705
|
if (row === rootRow) continue;
|
|
34963
35706
|
args.createdValues.push(row);
|
|
35707
|
+
const keys = typeof row.value === "object" && row.value !== null ? ctx.__constructedFieldSchemaKeysByValue?.get(row.value) : void 0;
|
|
35708
|
+
if (keys !== void 0) pinnedSchemaKeysByValueId.set(row.id, keys);
|
|
34964
35709
|
}
|
|
34965
35710
|
if (rootRow === null) return { value: result.value, classId: null };
|
|
34966
35711
|
const constructorArgs = (typeof result.value === "object" && result.value !== null ? ctx.__constructedArgumentsByValue?.get(result.value) : void 0) ?? // An implicit `new()` records its empty args on the row rather than in
|
|
@@ -34968,17 +35713,13 @@ function evaluateMemberInitializer(args) {
|
|
|
34968
35713
|
// origin or the recipe reads as an unrecorded overload.
|
|
34969
35714
|
rootRow.constructorArgs ?? void 0;
|
|
34970
35715
|
const pinnedRootSchemaKeys = typeof result.value === "object" && result.value !== null ? ctx.__constructedFieldSchemaKeysByValue?.get(result.value) : void 0;
|
|
34971
|
-
const provenance = pickInstanceProvenance({
|
|
34972
|
-
constructorArgs,
|
|
34973
|
-
instanceConstructorId: rootRow.instanceConstructorId,
|
|
34974
|
-
instanceVariantId: rootRow.instanceVariantId,
|
|
34975
|
-
instanceVariantRowValueId: rootRow.instanceVariantRowValueId
|
|
34976
|
-
});
|
|
35716
|
+
const provenance = pickInstanceProvenance({ ...rootRow, constructorArgs });
|
|
34977
35717
|
return {
|
|
34978
35718
|
value: result.value,
|
|
34979
35719
|
classId: rootRow.classId ?? null,
|
|
34980
35720
|
...rootRow.genericBindings === void 0 ? {} : { genericBindings: { ...rootRow.genericBindings } },
|
|
34981
35721
|
...pinnedRootSchemaKeys === void 0 ? {} : { pinnedRootSchemaKeys },
|
|
35722
|
+
...pinnedSchemaKeysByValueId.size === 0 ? {} : { pinnedSchemaKeysByValueId },
|
|
34982
35723
|
provisionalRootId: rootRow.id,
|
|
34983
35724
|
...provenance,
|
|
34984
35725
|
...provenance.constructorArgs === void 0 ? {} : {
|
|
@@ -35052,6 +35793,7 @@ function headlessVirtualInstanceLookups(document2, options = {}) {
|
|
|
35052
35793
|
valueById: (id) => indexed.valueById(id) ?? virtual.valueById(id),
|
|
35053
35794
|
rowForValueReference: (value) => indexed.rowForValueReference(value) ?? virtual.rowForValueReference(value),
|
|
35054
35795
|
virtualInstanceRowsForValue: (receiverValueId) => virtual.virtualInstanceRowsForValue(receiverValueId),
|
|
35796
|
+
virtualInstanceRootIdForValue: (valueId) => owningInstanceRootId(virtual.virtualInstanceGraphForValue(valueId)),
|
|
35055
35797
|
// Stored-construction replay evaluates `ToVariant`, and production's
|
|
35056
35798
|
// variant-constructed placements collapse through exactly this path.
|
|
35057
35799
|
resolveVariantInstanceGraph: (args) => resolveVariantInstanceGraphForDocument2({
|
|
@@ -41296,7 +42038,7 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
41296
42038
|
};
|
|
41297
42039
|
}
|
|
41298
42040
|
resolveDictionaryKey(expectedKey, keyAst, scope, pos, requireNonOptional, dictionaryLiteral = false) {
|
|
41299
|
-
const key = this.resolveExpression(keyAst, scope);
|
|
42041
|
+
const key = this.resolveExpression(keyAst, scope, expectedKey);
|
|
41300
42042
|
if (requireNonOptional && isNullable(key.type)) {
|
|
41301
42043
|
throw new CompileError(
|
|
41302
42044
|
`Dictionary keys must be non-optional; got ${this.describe(key.type)}`,
|
|
@@ -42443,13 +43185,12 @@ var StrictNeoScriptResolver = class _StrictNeoScriptResolver {
|
|
|
42443
43185
|
const typeArguments = expression.typeArguments?.map(
|
|
42444
43186
|
(argument2) => this.resolveType(argument2)
|
|
42445
43187
|
);
|
|
42446
|
-
if (typeArguments !== void 0
|
|
42447
|
-
|
|
42448
|
-
|
|
43188
|
+
if (typeArguments !== void 0) {
|
|
43189
|
+
assertTypeArgumentCount(
|
|
43190
|
+
schemaClass2,
|
|
43191
|
+
typeArguments.length,
|
|
42449
43192
|
expression.pos
|
|
42450
43193
|
);
|
|
42451
|
-
}
|
|
42452
|
-
if (typeArguments !== void 0) {
|
|
42453
43194
|
const target = {
|
|
42454
43195
|
kind: "named",
|
|
42455
43196
|
typeId: schemaClass2.id,
|
|
@@ -46776,21 +47517,34 @@ function resolveNeoScriptType(type, context, project) {
|
|
|
46776
47517
|
const declaringType = declaringTypeRef?.kind === "named" ? project.typeById.get(declaringTypeRef.typeId) : void 0;
|
|
46777
47518
|
const byName = (candidate) => candidate.name === type.name;
|
|
46778
47519
|
const typeParameter2 = context.typeParameters?.find(byName) ?? declaringType?.typeParameters?.find(byName);
|
|
47520
|
+
const written = type.typeArguments?.length ?? 0;
|
|
46779
47521
|
if (typeParameter2?.type.kind === "typeParameter") {
|
|
47522
|
+
if (written > 0)
|
|
47523
|
+
throw new CompileError(
|
|
47524
|
+
genericParameterArgumentsMessage(type.name),
|
|
47525
|
+
type.pos
|
|
47526
|
+
);
|
|
46780
47527
|
resolved = typeParameter2.type;
|
|
46781
47528
|
break;
|
|
46782
47529
|
}
|
|
46783
47530
|
const builtin = namedPrimitive(type.name);
|
|
47531
|
+
const registryReference = builtin ? null : neoScriptRegistryReferenceType(type.name);
|
|
47532
|
+
if ((builtin || registryReference) && written > 0)
|
|
47533
|
+
throw new CompileError(
|
|
47534
|
+
typeArgumentArityMessage(type.name, 0, written),
|
|
47535
|
+
type.pos
|
|
47536
|
+
);
|
|
46784
47537
|
if (builtin) {
|
|
46785
47538
|
resolved = { kind: "primitive", name: builtin };
|
|
46786
47539
|
break;
|
|
46787
47540
|
}
|
|
46788
|
-
const registryReference = neoScriptRegistryReferenceType(type.name);
|
|
46789
47541
|
if (registryReference) {
|
|
46790
47542
|
resolved = registryReference;
|
|
46791
47543
|
break;
|
|
46792
47544
|
}
|
|
46793
47545
|
if (type.name === "NeoDelegate") {
|
|
47546
|
+
if (written > NEOSCRIPT_DELEGATE_MAX_PARAMETERS + 1)
|
|
47547
|
+
throw new CompileError(delegateArityMessage(written), type.pos);
|
|
46794
47548
|
const [returnType, ...parameterTypes] = (type.typeArguments ?? []).map(
|
|
46795
47549
|
(argument2) => resolveNeoScriptType(argument2, context, project)
|
|
46796
47550
|
);
|
|
@@ -46808,6 +47562,7 @@ function resolveNeoScriptType(type, context, project) {
|
|
|
46808
47562
|
renamedDialogueTypeMessage(type.name, "value") ?? `Unknown type '${type.name}'`,
|
|
46809
47563
|
type.pos
|
|
46810
47564
|
);
|
|
47565
|
+
if (written > 0) assertTypeArgumentCount(named, written, type.pos);
|
|
46811
47566
|
resolved = {
|
|
46812
47567
|
kind: "named",
|
|
46813
47568
|
typeId: named.id,
|
|
@@ -46876,6 +47631,14 @@ function assertDirectTypeParameterArguments(target, pos, project) {
|
|
|
46876
47631
|
const message = wrappedTypeParameterMessage(target, project);
|
|
46877
47632
|
if (message !== null) throw new CompileError(message, pos);
|
|
46878
47633
|
}
|
|
47634
|
+
function assertTypeArgumentCount(declaring, count, pos) {
|
|
47635
|
+
const expected = declaring.typeParameters?.length ?? 0;
|
|
47636
|
+
if (count === expected) return;
|
|
47637
|
+
throw new CompileError(
|
|
47638
|
+
typeArgumentArityMessage(declaring.name, expected, count),
|
|
47639
|
+
pos
|
|
47640
|
+
);
|
|
47641
|
+
}
|
|
46879
47642
|
function assertTypeArgumentConstraints(declaring, type, pos, project) {
|
|
46880
47643
|
declaring.typeParameters?.forEach((parameter3, index) => {
|
|
46881
47644
|
const argument2 = type.typeArguments?.[index];
|
|
@@ -58796,7 +59559,7 @@ var INITIALIZER_KEY_PLACEHOLDER = new RegExp(
|
|
|
58796
59559
|
|
|
58797
59560
|
// ../packages/manifest/schema-contract/registry.mjs
|
|
58798
59561
|
var PROJECT_SCHEMA_CONTRACT = Object.freeze({
|
|
58799
|
-
cliVersion: "0.81.
|
|
59562
|
+
cliVersion: "0.81.2",
|
|
58800
59563
|
projectFileUploadBatchSize: 32,
|
|
58801
59564
|
documentRecords: {
|
|
58802
59565
|
member: {
|