@neocompose/cli 0.89.6 → 0.89.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/test-worker.mjs
CHANGED
|
@@ -24776,6 +24776,69 @@ function liveListIndexRegistry(ctx) {
|
|
|
24776
24776
|
liveListIndexesByProject.set(projectKey, created);
|
|
24777
24777
|
return created;
|
|
24778
24778
|
}
|
|
24779
|
+
var EvaluatorParentLinks = class {
|
|
24780
|
+
ordinary = /* @__PURE__ */ new Map();
|
|
24781
|
+
buckets = /* @__PURE__ */ new Map();
|
|
24782
|
+
/** Only shared selection targets need direct parent removal. */
|
|
24783
|
+
indexParents(childId) {
|
|
24784
|
+
if (this.buckets.has(childId)) return;
|
|
24785
|
+
const links = this.ordinary.get(childId) ?? [];
|
|
24786
|
+
this.ordinary.delete(childId);
|
|
24787
|
+
this.buckets.set(childId, { links: /* @__PURE__ */ new Set(), byParent: /* @__PURE__ */ new Map() });
|
|
24788
|
+
for (const link of links) this.add(childId, link);
|
|
24789
|
+
}
|
|
24790
|
+
get(childId) {
|
|
24791
|
+
const bucket = this.buckets.get(childId);
|
|
24792
|
+
if (bucket === void 0) return this.ordinary.get(childId);
|
|
24793
|
+
return bucket.snapshot ??= [...bucket.links];
|
|
24794
|
+
}
|
|
24795
|
+
has(childId) {
|
|
24796
|
+
return this.buckets.has(childId) || this.ordinary.has(childId);
|
|
24797
|
+
}
|
|
24798
|
+
add(childId, link) {
|
|
24799
|
+
const bucket = this.buckets.get(childId);
|
|
24800
|
+
if (bucket === void 0) {
|
|
24801
|
+
const links = this.ordinary.get(childId) ?? [];
|
|
24802
|
+
links.push(link);
|
|
24803
|
+
this.ordinary.set(childId, links);
|
|
24804
|
+
return;
|
|
24805
|
+
}
|
|
24806
|
+
bucket.links.add(link);
|
|
24807
|
+
let parent = bucket.byParent.get(link.parentId);
|
|
24808
|
+
if (parent === void 0) {
|
|
24809
|
+
parent = /* @__PURE__ */ new Set();
|
|
24810
|
+
bucket.byParent.set(link.parentId, parent);
|
|
24811
|
+
}
|
|
24812
|
+
parent.add(link);
|
|
24813
|
+
bucket.snapshot = void 0;
|
|
24814
|
+
}
|
|
24815
|
+
remove(childId, parentId, key) {
|
|
24816
|
+
const bucket = this.buckets.get(childId);
|
|
24817
|
+
if (bucket === void 0) {
|
|
24818
|
+
const links = this.ordinary.get(childId)?.filter(
|
|
24819
|
+
(link) => link.parentId !== parentId || key !== void 0 && link.key !== key
|
|
24820
|
+
);
|
|
24821
|
+
if (links === void 0 || links.length === 0)
|
|
24822
|
+
this.ordinary.delete(childId);
|
|
24823
|
+
else this.ordinary.set(childId, links);
|
|
24824
|
+
return;
|
|
24825
|
+
}
|
|
24826
|
+
const parent = bucket.byParent.get(parentId);
|
|
24827
|
+
if (parent === void 0) return;
|
|
24828
|
+
for (const link of parent) {
|
|
24829
|
+
if (key !== void 0 && link.key !== key) continue;
|
|
24830
|
+
bucket.links.delete(link);
|
|
24831
|
+
parent.delete(link);
|
|
24832
|
+
bucket.snapshot = void 0;
|
|
24833
|
+
}
|
|
24834
|
+
if (parent.size === 0) bucket.byParent.delete(parentId);
|
|
24835
|
+
if (bucket.links.size === 0) this.buckets.delete(childId);
|
|
24836
|
+
}
|
|
24837
|
+
delete(childId) {
|
|
24838
|
+
this.ordinary.delete(childId);
|
|
24839
|
+
this.buckets.delete(childId);
|
|
24840
|
+
}
|
|
24841
|
+
};
|
|
24779
24842
|
var evaluatorOwnershipCachesByBase = /* @__PURE__ */ new WeakMap();
|
|
24780
24843
|
function evaluatorOwnershipCachesForBase(base) {
|
|
24781
24844
|
const existing = evaluatorOwnershipCachesByBase.get(base);
|
|
@@ -24791,7 +24854,8 @@ function blankEvaluatorIndexes(memberByValueId) {
|
|
|
24791
24854
|
return {
|
|
24792
24855
|
rowByValueReference: /* @__PURE__ */ new WeakMap(),
|
|
24793
24856
|
memberByValueId,
|
|
24794
|
-
parentLinksByChildId:
|
|
24857
|
+
parentLinksByChildId: new EvaluatorParentLinks(),
|
|
24858
|
+
placementParentLinksByChildId: /* @__PURE__ */ new Map(),
|
|
24795
24859
|
indexedRowIds: /* @__PURE__ */ new Set(),
|
|
24796
24860
|
indexedOverlayValues: /* @__PURE__ */ new Map(),
|
|
24797
24861
|
indexedOverlayRowCount: 0,
|
|
@@ -25030,8 +25094,15 @@ function evaluatorIndexes(ctx) {
|
|
|
25030
25094
|
rowByValueReference: /* @__PURE__ */ new WeakMap(),
|
|
25031
25095
|
baseRowByValueReference: base?.rowByValueReference,
|
|
25032
25096
|
memberByValueId: base?.memberByValueId ?? /* @__PURE__ */ new Map(),
|
|
25033
|
-
parentLinksByChildId:
|
|
25097
|
+
parentLinksByChildId: new EvaluatorParentLinks(),
|
|
25098
|
+
placementParentLinksByChildId: /* @__PURE__ */ new Map(),
|
|
25034
25099
|
baseParentLinksByChildId: base?.parentLinksByChildId,
|
|
25100
|
+
isSelectionRow: (row) => {
|
|
25101
|
+
const member = runtimeCollectionMember(row, ctx);
|
|
25102
|
+
if (member === null || !isMemberLookupBase(member)) return false;
|
|
25103
|
+
const direct = indexes4.memberByValueId.get(row.id);
|
|
25104
|
+
return direct === void 0 || isMemberLookupBase(direct);
|
|
25105
|
+
},
|
|
25035
25106
|
indexedRowIds: /* @__PURE__ */ new Set(),
|
|
25036
25107
|
baseIndexedRowIds: base?.indexedRowIds,
|
|
25037
25108
|
indexedOverlayValues: /* @__PURE__ */ new Map(),
|
|
@@ -25125,7 +25196,13 @@ function indexEvaluatorRow(indexes4, row, allowBaseShadow = false, sharedCachesA
|
|
|
25125
25196
|
visitEvaluatorRecordOwnershipEdges(indexes4, row, (childId, key) => {
|
|
25126
25197
|
indexes4.ownedValueAttachmentsByValueId.delete(childId);
|
|
25127
25198
|
indexes4.constructorOwnershipDirtyValueIds.add(childId);
|
|
25128
|
-
addEvaluatorParentLink(
|
|
25199
|
+
addEvaluatorParentLink(
|
|
25200
|
+
indexes4,
|
|
25201
|
+
childId,
|
|
25202
|
+
row.id,
|
|
25203
|
+
key,
|
|
25204
|
+
indexes4.isSelectionRow?.(row) === true
|
|
25205
|
+
);
|
|
25129
25206
|
});
|
|
25130
25207
|
}
|
|
25131
25208
|
function indexEvaluatorRows(indexes4, rows, allowBaseShadow = false, liveOverlayRowById) {
|
|
@@ -25174,7 +25251,13 @@ function augmentEvaluatorOwnershipEdges(indexes4, row, liveRow) {
|
|
|
25174
25251
|
if (links.some((link) => link.parentId === row.id && link.key === key)) {
|
|
25175
25252
|
return;
|
|
25176
25253
|
}
|
|
25177
|
-
addEvaluatorParentLink(
|
|
25254
|
+
addEvaluatorParentLink(
|
|
25255
|
+
indexes4,
|
|
25256
|
+
childId,
|
|
25257
|
+
row.id,
|
|
25258
|
+
key,
|
|
25259
|
+
indexes4.isSelectionRow?.(row) === true
|
|
25260
|
+
);
|
|
25178
25261
|
indexes4.ownedValueAttachmentsByValueId.delete(childId);
|
|
25179
25262
|
indexes4.constructorOwnershipDirtyValueIds.add(childId);
|
|
25180
25263
|
});
|
|
@@ -25220,12 +25303,11 @@ function unindexEvaluatorRow(indexes4, row, preserveIncomingLinks = false) {
|
|
|
25220
25303
|
indexes4.indexedRowIds.delete(row.id);
|
|
25221
25304
|
indexes4.ownedValueAttachmentsByValueId.delete(row.id);
|
|
25222
25305
|
indexes4.constructorOwnershipDirtyValueIds.delete(row.id);
|
|
25223
|
-
if (!preserveIncomingLinks)
|
|
25224
|
-
|
|
25225
|
-
|
|
25226
|
-
|
|
25227
|
-
|
|
25228
|
-
else indexes4.parentLinksByChildId.set(row.id, retained);
|
|
25306
|
+
if (!preserveIncomingLinks) {
|
|
25307
|
+
indexes4.parentLinksByChildId.delete(row.id);
|
|
25308
|
+
indexes4.placementParentLinksByChildId.delete(row.id);
|
|
25309
|
+
} else if (typeof row.containerId === "string") {
|
|
25310
|
+
removeEvaluatorParentLinks(indexes4, row.id, row.containerId, "");
|
|
25229
25311
|
}
|
|
25230
25312
|
if (typeof row.value === "object" && row.value !== null && indexes4.rowByValueReference.get(row.value) === row) {
|
|
25231
25313
|
indexes4.rowByValueReference.delete(row.value);
|
|
@@ -25242,12 +25324,7 @@ function unindexEvaluatorRow(indexes4, row, preserveIncomingLinks = false) {
|
|
|
25242
25324
|
}
|
|
25243
25325
|
}
|
|
25244
25326
|
visitEvaluatorRecordOwnershipEdges(indexes4, row, (childId) => {
|
|
25245
|
-
|
|
25246
|
-
if (links !== void 0) {
|
|
25247
|
-
const retained = links.filter((link) => link.parentId !== row.id);
|
|
25248
|
-
if (retained.length === 0) indexes4.parentLinksByChildId.delete(childId);
|
|
25249
|
-
else indexes4.parentLinksByChildId.set(childId, retained);
|
|
25250
|
-
}
|
|
25327
|
+
removeEvaluatorParentLinks(indexes4, childId, row.id);
|
|
25251
25328
|
indexes4.ownedValueAttachmentsByValueId.delete(childId);
|
|
25252
25329
|
indexes4.constructorOwnershipDirtyValueIds.add(childId);
|
|
25253
25330
|
});
|
|
@@ -25260,36 +25337,101 @@ function dropReconciledOwnershipRows(indexes4) {
|
|
|
25260
25337
|
indexes4.reconciledOwnershipRows = /* @__PURE__ */ new WeakSet();
|
|
25261
25338
|
indexes4.indexedVirtualRowSets = /* @__PURE__ */ new WeakSet();
|
|
25262
25339
|
}
|
|
25263
|
-
function addEvaluatorParentLink(indexes4, childId, parentId, key) {
|
|
25264
|
-
const
|
|
25265
|
-
|
|
25266
|
-
|
|
25340
|
+
function addEvaluatorParentLink(indexes4, childId, parentId, key, selectionOnly = false) {
|
|
25341
|
+
const placements = indexes4.placementParentLinksByChildId.get(childId);
|
|
25342
|
+
if (selectionOnly) {
|
|
25343
|
+
if (placements === void 0) {
|
|
25344
|
+
indexes4.placementParentLinksByChildId.set(childId, [
|
|
25345
|
+
...indexes4.parentLinksByChildId.get(childId) ?? []
|
|
25346
|
+
]);
|
|
25347
|
+
indexes4.parentLinksByChildId.indexParents(childId);
|
|
25348
|
+
}
|
|
25349
|
+
} else {
|
|
25350
|
+
placements?.push({ parentId, key });
|
|
25351
|
+
}
|
|
25352
|
+
indexes4.parentLinksByChildId.add(childId, { parentId, key });
|
|
25353
|
+
}
|
|
25354
|
+
function removeEvaluatorParentLinks(indexes4, childId, parentId, key) {
|
|
25355
|
+
indexes4.parentLinksByChildId.remove(childId, parentId, key);
|
|
25356
|
+
if (!indexes4.parentLinksByChildId.has(childId)) {
|
|
25357
|
+
indexes4.placementParentLinksByChildId.delete(childId);
|
|
25358
|
+
return;
|
|
25359
|
+
}
|
|
25360
|
+
const placements = indexes4.placementParentLinksByChildId.get(childId);
|
|
25361
|
+
if (placements !== void 0)
|
|
25362
|
+
indexes4.placementParentLinksByChildId.set(
|
|
25363
|
+
childId,
|
|
25364
|
+
placements.filter(
|
|
25365
|
+
(link) => link.parentId !== parentId || key !== void 0 && link.key !== key
|
|
25366
|
+
)
|
|
25367
|
+
);
|
|
25267
25368
|
}
|
|
25268
|
-
function
|
|
25369
|
+
function indexRuntimeCollectionChange(collection, entry, ctx, removedEntries = null, entryKey, change = "entry") {
|
|
25269
25370
|
const indexes4 = ctx.__indexes;
|
|
25270
25371
|
const row = indexes4?.rowByValueReference.get(collection);
|
|
25271
25372
|
if (indexes4 === void 0 || indexes4.invalidated || row === void 0 || ctx.__runtimeSessionValues?.get(row.id) !== row || !indexes4.indexedRowIds.has(row.id))
|
|
25272
25373
|
return false;
|
|
25273
|
-
if (
|
|
25274
|
-
|
|
25275
|
-
|
|
25276
|
-
|
|
25374
|
+
if (removedEntries !== null)
|
|
25375
|
+
for (const removed of removedEntries) {
|
|
25376
|
+
removeEvaluatorParentLinks(indexes4, removed, row.id, entryKey);
|
|
25377
|
+
indexes4.ownedValueAttachmentsByValueId.delete(removed);
|
|
25378
|
+
indexes4.constructorOwnershipDirtyValueIds.add(removed);
|
|
25379
|
+
}
|
|
25380
|
+
const addEdge = (childId, key) => {
|
|
25381
|
+
addEvaluatorParentLink(
|
|
25382
|
+
indexes4,
|
|
25383
|
+
childId,
|
|
25384
|
+
row.id,
|
|
25385
|
+
key,
|
|
25386
|
+
indexes4.isSelectionRow?.(row) === true
|
|
25387
|
+
);
|
|
25388
|
+
indexes4.ownedValueAttachmentsByValueId.delete(childId);
|
|
25389
|
+
indexes4.constructorOwnershipDirtyValueIds.add(childId);
|
|
25390
|
+
};
|
|
25391
|
+
if (typeof entry === "string") addEdge(entry, entryKey ?? "");
|
|
25392
|
+
else if (change === "contents")
|
|
25393
|
+
visitEvaluatorRecordOwnershipEdges(indexes4, row, addEdge);
|
|
25394
|
+
if (typeof entry === "string" || removedEntries !== null && removedEntries.length > 0) {
|
|
25277
25395
|
indexes4.ownershipRootIdsByRowId.clear();
|
|
25278
25396
|
indexes4.ownershipDistancesByRowId.clear();
|
|
25279
25397
|
indexes4.memberByRowId.clear();
|
|
25280
25398
|
}
|
|
25281
|
-
forgetLocalListIndexes(ctx, collection);
|
|
25399
|
+
if (Array.isArray(collection)) forgetLocalListIndexes(ctx, collection);
|
|
25282
25400
|
markOverlayMutated(ctx, collection);
|
|
25283
25401
|
if (ctx.__valueOverlay instanceof LazyValueOverlay)
|
|
25284
25402
|
indexes4.overlayRevision = ctx.__valueOverlay.revision;
|
|
25285
25403
|
return true;
|
|
25286
25404
|
}
|
|
25287
|
-
function
|
|
25405
|
+
function indexRuntimeCollectionEntryWrite(collection, previous, value, key, ctx) {
|
|
25406
|
+
if (!Array.isArray(collection))
|
|
25407
|
+
return indexRuntimeCollectionChange(
|
|
25408
|
+
collection,
|
|
25409
|
+
value,
|
|
25410
|
+
ctx,
|
|
25411
|
+
typeof previous === "string" ? [previous] : [],
|
|
25412
|
+
String(key)
|
|
25413
|
+
);
|
|
25414
|
+
if (typeof previous !== "string" && typeof value !== "string")
|
|
25415
|
+
return indexRuntimeCollectionChange(collection, void 0, ctx);
|
|
25416
|
+
const edges = collection.filter(
|
|
25417
|
+
(entry) => typeof entry === "string"
|
|
25418
|
+
);
|
|
25419
|
+
if (typeof previous === "string") edges.push(previous);
|
|
25420
|
+
return indexRuntimeCollectionChange(
|
|
25421
|
+
collection,
|
|
25422
|
+
void 0,
|
|
25423
|
+
ctx,
|
|
25424
|
+
edges,
|
|
25425
|
+
void 0,
|
|
25426
|
+
"contents"
|
|
25427
|
+
);
|
|
25428
|
+
}
|
|
25429
|
+
function evaluatorParentLinks(indexes4, childId, placementOnly = false) {
|
|
25288
25430
|
const unfilteredBase = indexes4.baseParentLinksByChildId?.get(childId) ?? [];
|
|
25289
25431
|
const base = indexes4.shadowedBaseRowIds.size === 0 ? unfilteredBase : unfilteredBase.filter(
|
|
25290
25432
|
(link) => !indexes4.shadowedBaseRowIds.has(link.parentId)
|
|
25291
25433
|
);
|
|
25292
|
-
const local = indexes4.parentLinksByChildId.get(childId) ?? [];
|
|
25434
|
+
const local = (placementOnly ? indexes4.placementParentLinksByChildId.get(childId) : void 0) ?? indexes4.parentLinksByChildId.get(childId) ?? [];
|
|
25293
25435
|
if (base.length === 0) return local;
|
|
25294
25436
|
if (local.length === 0) return base;
|
|
25295
25437
|
return [...base, ...local];
|
|
@@ -26137,6 +26279,7 @@ function withEvaluationRuntime(ctx, writes) {
|
|
|
26137
26279
|
ctx.__setEntryIndexes ??= /* @__PURE__ */ new WeakMap();
|
|
26138
26280
|
ctx.__runtimeSets ??= /* @__PURE__ */ new WeakMap();
|
|
26139
26281
|
ctx.__collectionElementTypes ??= /* @__PURE__ */ new WeakMap();
|
|
26282
|
+
ctx.__runtimeCollectionMembers ??= /* @__PURE__ */ new WeakMap();
|
|
26140
26283
|
ctx.__dirtyRuntimeSets ??= /* @__PURE__ */ new Set();
|
|
26141
26284
|
ctx.__runtimeClassOverrides ??= /* @__PURE__ */ new Map();
|
|
26142
26285
|
ctx.__getterSubscriptions ??= getterSubscriptionsFor(ctx);
|
|
@@ -26174,6 +26317,7 @@ function withEvaluationRuntime(ctx, writes) {
|
|
|
26174
26317
|
__setEntryIndexes: ctx.__setEntryIndexes ?? /* @__PURE__ */ new WeakMap(),
|
|
26175
26318
|
__runtimeSets: ctx.__runtimeSets ?? /* @__PURE__ */ new WeakMap(),
|
|
26176
26319
|
__collectionElementTypes: ctx.__collectionElementTypes ?? /* @__PURE__ */ new WeakMap(),
|
|
26320
|
+
__runtimeCollectionMembers: ctx.__runtimeCollectionMembers ?? /* @__PURE__ */ new WeakMap(),
|
|
26177
26321
|
__tupleHandleIdentity: ctx.__tupleHandleIdentity ??= new TupleHandleIdentity(),
|
|
26178
26322
|
__dirtyRuntimeSets: ctx.__dirtyRuntimeSets ?? /* @__PURE__ */ new Set(),
|
|
26179
26323
|
__runtimeReferenceRemap: referenceRemap,
|
|
@@ -27733,7 +27877,8 @@ function evalInstructions(instructions, scope, ctx, options) {
|
|
|
27733
27877
|
target.pointer,
|
|
27734
27878
|
scope,
|
|
27735
27879
|
ctx,
|
|
27736
|
-
destination
|
|
27880
|
+
destination,
|
|
27881
|
+
value
|
|
27737
27882
|
);
|
|
27738
27883
|
const through = genericSlotReference(
|
|
27739
27884
|
member,
|
|
@@ -27757,7 +27902,8 @@ function evalInstructions(instructions, scope, ctx, options) {
|
|
|
27757
27902
|
target.pointer,
|
|
27758
27903
|
scope,
|
|
27759
27904
|
ctx,
|
|
27760
|
-
destination
|
|
27905
|
+
destination,
|
|
27906
|
+
value
|
|
27761
27907
|
);
|
|
27762
27908
|
}
|
|
27763
27909
|
if (target.structuredLeafKind !== void 0 && destination !== void 0)
|
|
@@ -27774,6 +27920,11 @@ function evalInstructions(instructions, scope, ctx, options) {
|
|
|
27774
27920
|
ctx
|
|
27775
27921
|
);
|
|
27776
27922
|
const lookupMember = member !== null && isMemberLookup(member) ? member : null;
|
|
27923
|
+
const inlineReferenceValue = lookupMember !== null && target.pointer.type === "keyOf" /* keyOf */ && target.pointer.memberId === void 0 && destination !== void 0 && materializedCollectionEntryId(
|
|
27924
|
+
destination.receiver,
|
|
27925
|
+
destination.key,
|
|
27926
|
+
ctx
|
|
27927
|
+
) === null ? { value } : void 0;
|
|
27777
27928
|
if (lookupMember !== null) {
|
|
27778
27929
|
materializeReferencedSlots(value, ctx);
|
|
27779
27930
|
const holder = destination === void 0 ? null : trackedRowForValueReference(destination.receiver, ctx);
|
|
@@ -27830,7 +27981,8 @@ function evalInstructions(instructions, scope, ctx, options) {
|
|
|
27830
27981
|
value,
|
|
27831
27982
|
scope,
|
|
27832
27983
|
ctx,
|
|
27833
|
-
destination
|
|
27984
|
+
destination,
|
|
27985
|
+
inlineReferenceValue
|
|
27834
27986
|
);
|
|
27835
27987
|
}
|
|
27836
27988
|
const unorderedReplacement = assignedReferenceValueId === null && member !== null && isMemberEntryCollectionBase(member) && listKindOf(member) === 1 /* Unordered */ && Array.isArray(value) ? unorderedReplacementProjection(
|
|
@@ -28495,7 +28647,7 @@ function validateStructuredFieldAssignment(kind, field, value) {
|
|
|
28495
28647
|
{ errorClassId: NEO_ERROR_CLASS_IDS.NeoArgumentError }
|
|
28496
28648
|
);
|
|
28497
28649
|
}
|
|
28498
|
-
function applyOverlayAssignment(target, targetTypeInfo, value, scope, ctx, destination) {
|
|
28650
|
+
function applyOverlayAssignment(target, targetTypeInfo, value, scope, ctx, destination, inlineReferenceValue) {
|
|
28499
28651
|
if (target.type === "staticMember" /* staticMember */) {
|
|
28500
28652
|
if (ctx.storedConstructionReplay === true) {
|
|
28501
28653
|
throw new NSGetterRuntimeError(
|
|
@@ -28527,8 +28679,32 @@ function applyOverlayAssignment(target, targetTypeInfo, value, scope, ctx, desti
|
|
|
28527
28679
|
"assignment target",
|
|
28528
28680
|
reattachesReplaySlot ? void 0 : key
|
|
28529
28681
|
);
|
|
28682
|
+
if (inlineReferenceValue !== void 0) {
|
|
28683
|
+
const entryId = trackInsertedCollection(
|
|
28684
|
+
inlineReferenceValue.value,
|
|
28685
|
+
targetTypeInfo,
|
|
28686
|
+
receiver,
|
|
28687
|
+
ctx
|
|
28688
|
+
);
|
|
28689
|
+
if (entryId !== null) {
|
|
28690
|
+
const collection = Array.isArray(receiver) ? receiver : objectArg(receiver, "Assignment target");
|
|
28691
|
+
const entryKey = typeof key === "number" ? key : String(key);
|
|
28692
|
+
Reflect.set(collection, String(entryKey), entryId);
|
|
28693
|
+
recordWrittenEntry(collection, entryKey, true, ctx);
|
|
28694
|
+
if (!indexRuntimeCollectionChange(
|
|
28695
|
+
collection,
|
|
28696
|
+
entryId,
|
|
28697
|
+
ctx,
|
|
28698
|
+
null,
|
|
28699
|
+
Array.isArray(collection) ? void 0 : String(entryKey)
|
|
28700
|
+
))
|
|
28701
|
+
invalidateEvaluatorIndexes(ctx, receiver);
|
|
28702
|
+
return;
|
|
28703
|
+
}
|
|
28704
|
+
}
|
|
28530
28705
|
if (Array.isArray(receiver)) {
|
|
28531
28706
|
const index = numberArg(key, "List assignment index");
|
|
28707
|
+
const previous2 = receiver[index];
|
|
28532
28708
|
if (referenceValueId !== null) {
|
|
28533
28709
|
const parentId = findKnownRowIdByValueReference(receiver, ctx);
|
|
28534
28710
|
if (parentId !== null) {
|
|
@@ -28552,10 +28728,17 @@ function applyOverlayAssignment(target, targetTypeInfo, value, scope, ctx, desti
|
|
|
28552
28728
|
}
|
|
28553
28729
|
receiver[index] = referenceValueId;
|
|
28554
28730
|
recordWrittenEntry(receiver, index, true, ctx);
|
|
28555
|
-
|
|
28731
|
+
if (!indexRuntimeCollectionEntryWrite(
|
|
28732
|
+
receiver,
|
|
28733
|
+
previous2,
|
|
28734
|
+
referenceValueId,
|
|
28735
|
+
index,
|
|
28736
|
+
ctx
|
|
28737
|
+
))
|
|
28738
|
+
invalidateEvaluatorIndexes(ctx, receiver);
|
|
28556
28739
|
return;
|
|
28557
28740
|
}
|
|
28558
|
-
if (collectionReferences(receiver, ctx)
|
|
28741
|
+
if (isReferenceEntry(collectionReferences(receiver, ctx), index) && replaceEntryRowValue(
|
|
28559
28742
|
receiver,
|
|
28560
28743
|
receiver[index],
|
|
28561
28744
|
value,
|
|
@@ -28565,11 +28748,13 @@ function applyOverlayAssignment(target, targetTypeInfo, value, scope, ctx, desti
|
|
|
28565
28748
|
return;
|
|
28566
28749
|
receiver[index] = value;
|
|
28567
28750
|
recordWrittenEntry(receiver, index, false, ctx);
|
|
28568
|
-
|
|
28751
|
+
if (!indexRuntimeCollectionEntryWrite(receiver, previous2, value, index, ctx))
|
|
28752
|
+
invalidateEvaluatorIndexes(ctx, receiver);
|
|
28569
28753
|
return;
|
|
28570
28754
|
}
|
|
28571
28755
|
const object = objectArg(receiver, "Assignment target");
|
|
28572
28756
|
const stringKey = String(key);
|
|
28757
|
+
const previous = object[stringKey];
|
|
28573
28758
|
const field = target.memberId !== void 0;
|
|
28574
28759
|
if (field && isTypeInfoWithEntries(targetTypeInfo)) {
|
|
28575
28760
|
const slot = collectionSlotRow(target, { receiver, key }, ctx);
|
|
@@ -28602,16 +28787,25 @@ function applyOverlayAssignment(target, targetTypeInfo, value, scope, ctx, desti
|
|
|
28602
28787
|
}
|
|
28603
28788
|
object[stringKey] = referenceValueId;
|
|
28604
28789
|
if (!field) recordWrittenEntry(object, stringKey, true, ctx);
|
|
28605
|
-
|
|
28790
|
+
if (field || !indexRuntimeCollectionEntryWrite(
|
|
28791
|
+
object,
|
|
28792
|
+
previous,
|
|
28793
|
+
referenceValueId,
|
|
28794
|
+
stringKey,
|
|
28795
|
+
ctx
|
|
28796
|
+
))
|
|
28797
|
+
invalidateEvaluatorIndexes(ctx, receiver);
|
|
28606
28798
|
return;
|
|
28607
28799
|
}
|
|
28608
|
-
if (collectionReferences(object, ctx)
|
|
28800
|
+
if (isReferenceEntry(collectionReferences(object, ctx), stringKey) && replaceEntryRowValue(object, object[stringKey], value, targetTypeInfo, ctx))
|
|
28609
28801
|
return;
|
|
28610
28802
|
if (field && (targetTypeInfo.type === 7 /* Class */ || targetTypeInfo.type === 22 /* Interface */))
|
|
28611
28803
|
noteDetachedRow(object[stringKey], value, ctx);
|
|
28612
28804
|
object[stringKey] = value;
|
|
28613
28805
|
if (!field) recordWrittenEntry(object, stringKey, false, ctx);
|
|
28614
|
-
|
|
28806
|
+
const scalarField = (previous == null || typeof previous === "number" || typeof previous === "boolean" || typeof previous === "string") && (value == null || typeof value === "number" || typeof value === "boolean" || typeof value === "string");
|
|
28807
|
+
if (field && !scalarField || !indexRuntimeCollectionEntryWrite(object, previous, value, stringKey, ctx))
|
|
28808
|
+
invalidateEvaluatorIndexes(ctx, receiver);
|
|
28615
28809
|
}
|
|
28616
28810
|
function keptCollectionSlotValue(target, targetTypeInfo, destination, value, ctx) {
|
|
28617
28811
|
const sourceId = findKnownRowIdByValueReference(value, ctx);
|
|
@@ -29542,7 +29736,22 @@ function validateAssignmentTarget(target, scope, ctx, destination) {
|
|
|
29542
29736
|
}
|
|
29543
29737
|
return resolved;
|
|
29544
29738
|
}
|
|
29545
|
-
function
|
|
29739
|
+
function materializedCollectionEntryId(receiver, key, ctx) {
|
|
29740
|
+
if (typeof receiver !== "object" || receiver === null) return null;
|
|
29741
|
+
const entryKey = typeof key === "number" ? key : String(key);
|
|
29742
|
+
if (!Object.prototype.hasOwnProperty.call(receiver, entryKey)) return null;
|
|
29743
|
+
const raw = Reflect.get(receiver, String(entryKey));
|
|
29744
|
+
if (typeof raw !== "string") return null;
|
|
29745
|
+
if (!isReferenceEntry(collectionReferences(receiver, ctx), entryKey))
|
|
29746
|
+
return null;
|
|
29747
|
+
return evalValueById(
|
|
29748
|
+
ctx,
|
|
29749
|
+
raw,
|
|
29750
|
+
ctx.__runtimeSessionValues,
|
|
29751
|
+
ctx.__valueOverlay
|
|
29752
|
+
) === null ? null : raw;
|
|
29753
|
+
}
|
|
29754
|
+
function assignmentTargetMember(target, scope, ctx, destination, value) {
|
|
29546
29755
|
if (target.type === "keyOf" /* keyOf */) {
|
|
29547
29756
|
const receiver = destination === void 0 ? evalPointer(target.keyOf.pointer, scope, ctx) : destination.receiver;
|
|
29548
29757
|
const key = destination === void 0 ? evalPointer(target.keyOf.key, scope, ctx) : destination.key;
|
|
@@ -29552,6 +29761,12 @@ function assignmentTargetMember(target, scope, ctx, destination) {
|
|
|
29552
29761
|
ctx
|
|
29553
29762
|
);
|
|
29554
29763
|
if (runtimeMember2 !== null) return runtimeMember2;
|
|
29764
|
+
const raw = typeof receiver === "object" && receiver !== null ? Reflect.get(receiver, String(key)) : void 0;
|
|
29765
|
+
if (target.memberId === void 0 && typeof receiver === "object" && receiver !== null && (materializedCollectionEntryId(receiver, key, ctx) !== null || typeof raw !== "string" && findKnownRowIdByValueReference(value, ctx) !== null)) {
|
|
29766
|
+
const contract = storedCollectionEntryContract(receiver, ctx);
|
|
29767
|
+
if (contract !== null && isMemberLookupBase(contract.member))
|
|
29768
|
+
return { ...contract.entry, ...contract.member };
|
|
29769
|
+
}
|
|
29555
29770
|
}
|
|
29556
29771
|
if ((target.type === "keyOf" /* keyOf */ || target.type === "staticMember" /* staticMember */) && target.memberId !== void 0) {
|
|
29557
29772
|
const member = evalMemberById(ctx.vm, target.memberId);
|
|
@@ -29824,14 +30039,17 @@ function evalCollectionMutationInstruction(ins, scope, ctx, options) {
|
|
|
29824
30039
|
return;
|
|
29825
30040
|
}
|
|
29826
30041
|
validateCollectionMutation(targetValue, ins.mutation, args);
|
|
30042
|
+
let insertedReferenceRowId = null;
|
|
29827
30043
|
if (!isLookupSet && entryArgumentIndex !== null && (ins.mutation === "Add" /* Add */ || ins.mutation === "Insert" /* Insert */) && findKnownRowIdByValueReference(targetValue, ctx) !== null)
|
|
29828
|
-
trackInsertedCollection(
|
|
30044
|
+
insertedReferenceRowId = trackInsertedCollection(
|
|
29829
30045
|
args[entryArgumentIndex],
|
|
29830
30046
|
collectionEntryWriteType(ins.target.typeInfo, targetValue, ctx),
|
|
29831
30047
|
targetValue,
|
|
29832
30048
|
ctx
|
|
29833
30049
|
);
|
|
29834
30050
|
const overlayArgs = [...args];
|
|
30051
|
+
let removedReferenceRowId = null;
|
|
30052
|
+
let referenceRemoval = false;
|
|
29835
30053
|
if ((ins.mutation === "Add" /* Add */ || ins.mutation === "Remove" /* Remove */) && isArrayCollection(targetValue)) {
|
|
29836
30054
|
if (setMatch !== null) overlayArgs[0] = setMatch.entry;
|
|
29837
30055
|
else if (isLookupSet)
|
|
@@ -29847,12 +30065,32 @@ function evalCollectionMutationInstruction(ins, scope, ctx, options) {
|
|
|
29847
30065
|
} else if (ins.mutation === "Add" /* Add */ && !isArrayCollection(targetValue)) {
|
|
29848
30066
|
overlayArgs[1] = findKnownRowIdByValueReference(args[1], ctx) ?? args[1];
|
|
29849
30067
|
}
|
|
30068
|
+
if (ins.mutation === "Remove" /* Remove */ && Array.isArray(targetValue) && !isLookupSet && setEntryMember === null) {
|
|
30069
|
+
const contract = storedCollectionEntryContract(targetValue, ctx);
|
|
30070
|
+
if (contract !== null && isMemberLookupBase(contract.member)) {
|
|
30071
|
+
referenceRemoval = isMultiSelectionMember(contract.member) !== true;
|
|
30072
|
+
const references = collectionReferences(targetValue, ctx);
|
|
30073
|
+
const index = targetValue.findIndex(
|
|
30074
|
+
(entry, index2) => referenceEqual(
|
|
30075
|
+
isReferenceEntry(references, index2) ? resolveValueIfId(entry, ctx) : entry,
|
|
30076
|
+
args[0],
|
|
30077
|
+
ctx
|
|
30078
|
+
)
|
|
30079
|
+
);
|
|
30080
|
+
if (index >= 0 && typeof targetValue[index] === "string") {
|
|
30081
|
+
removedReferenceRowId = targetValue[index];
|
|
30082
|
+
overlayArgs[0] = removedReferenceRowId;
|
|
30083
|
+
}
|
|
30084
|
+
}
|
|
30085
|
+
}
|
|
30086
|
+
if (insertedReferenceRowId !== null && entryArgumentIndex !== null)
|
|
30087
|
+
overlayArgs[entryArgumentIndex] = insertedReferenceRowId;
|
|
29850
30088
|
const unorderedEntriesBeforeMutation = unorderedContainerValueId === null || !Array.isArray(targetValue) || ins.mutation === "Add" /* Add */ ? null : [...targetValue];
|
|
29851
30089
|
const writesEntry = (ins.mutation === "Add" /* Add */ || ins.mutation === "Insert" /* Insert */) && !isLookupSet;
|
|
29852
30090
|
let attachedValueId = null;
|
|
29853
30091
|
if (writesEntry) {
|
|
29854
30092
|
const attachedValue = isArrayCollection(targetValue) && ins.mutation !== "Insert" /* Insert */ ? args[0] : args[1];
|
|
29855
|
-
attachedValueId = findKnownRowIdByValueReference(attachedValue, ctx);
|
|
30093
|
+
attachedValueId = insertedReferenceRowId ?? findKnownRowIdByValueReference(attachedValue, ctx);
|
|
29856
30094
|
const parentId = findKnownRowIdByValueReference(targetValue, ctx);
|
|
29857
30095
|
if (attachedValueId !== null && parentId !== null) {
|
|
29858
30096
|
assertInterfaceWriteAdmits(
|
|
@@ -29881,14 +30119,51 @@ function evalCollectionMutationInstruction(ins, scope, ctx, options) {
|
|
|
29881
30119
|
);
|
|
29882
30120
|
}
|
|
29883
30121
|
}
|
|
29884
|
-
if (ins.mutation === "Add" /* Add */ && isArrayCollection(targetValue) && unorderedContainerValueId !== null && !isLookupSet && findKnownRowIdByValueReference(args[0], ctx) === null) {
|
|
30122
|
+
if (ins.mutation === "Add" /* Add */ && isArrayCollection(targetValue) && unorderedContainerValueId !== null && !isLookupSet && insertedReferenceRowId === null && findKnownRowIdByValueReference(args[0], ctx) === null) {
|
|
29885
30123
|
overlayArgs[0] = createUnorderedScalarProjectionEntry(
|
|
29886
30124
|
unorderedContainerValueId,
|
|
29887
30125
|
args[0] instanceof NSSlotReference ? [args[0].targetId] : args[0],
|
|
29888
30126
|
ctx
|
|
29889
30127
|
);
|
|
29890
30128
|
}
|
|
29891
|
-
const removableRowIds = isLookupSet
|
|
30129
|
+
const removableRowIds = isLookupSet ? null : removableEntryRowIds(targetValue, ins.mutation, overlayArgs, ctx);
|
|
30130
|
+
let previousEdges = null;
|
|
30131
|
+
if (ins.mutation !== "Add" /* Add */ && ins.mutation !== "Insert" /* Insert */) {
|
|
30132
|
+
const contents = targetValue instanceof RuntimeSet ? targetValue.source : targetValue;
|
|
30133
|
+
const entries = Array.isArray(contents) ? contents : Object.values(objectArg(contents, "collection mutation target"));
|
|
30134
|
+
previousEdges = entries.filter(
|
|
30135
|
+
(entry) => typeof entry === "string"
|
|
30136
|
+
);
|
|
30137
|
+
}
|
|
30138
|
+
const removedMembers = removableRowIds === null ? null : /* @__PURE__ */ new Map();
|
|
30139
|
+
for (const [, id] of removableRowIds ?? []) {
|
|
30140
|
+
if (ins.mutation === "Remove" /* Remove */ && Array.isArray(targetValue) && id !== overlayArgs[0])
|
|
30141
|
+
continue;
|
|
30142
|
+
const row = evalValueById(
|
|
30143
|
+
ctx,
|
|
30144
|
+
id,
|
|
30145
|
+
ctx.__runtimeSessionValues,
|
|
30146
|
+
ctx.__valueOverlay
|
|
30147
|
+
);
|
|
30148
|
+
if (row === null) continue;
|
|
30149
|
+
const placed = memberForValueRow(row, ctx);
|
|
30150
|
+
if (placed === null) continue;
|
|
30151
|
+
const member = {
|
|
30152
|
+
...placed,
|
|
30153
|
+
...substituteMember(placed, rowGenericEnv(row, ctx), ctx.vm.members)
|
|
30154
|
+
};
|
|
30155
|
+
if (isMemberEntryCollectionBase(member) || isMemberDictionaryBase(member))
|
|
30156
|
+
removedMembers?.set(id, {
|
|
30157
|
+
row,
|
|
30158
|
+
contract: {
|
|
30159
|
+
member,
|
|
30160
|
+
members: ctx.vm.members,
|
|
30161
|
+
classes: ctx.vm.classes,
|
|
30162
|
+
bindings: row.genericBindings === void 0 ? void 0 : { ...row.genericBindings }
|
|
30163
|
+
}
|
|
30164
|
+
});
|
|
30165
|
+
}
|
|
30166
|
+
const replacedEntry = writesEntry && dictionary && isPlainRecord(targetValue) ? Reflect.get(targetValue, String(args[0])) : null;
|
|
29892
30167
|
const previousSetSize = targetValue instanceof RuntimeSet ? targetValue.size : null;
|
|
29893
30168
|
const removedIndex = applyLocalCollectionMutation(
|
|
29894
30169
|
targetValue,
|
|
@@ -29897,7 +30172,7 @@ function evalCollectionMutationInstruction(ins, scope, ctx, options) {
|
|
|
29897
30172
|
ctx,
|
|
29898
30173
|
isLookupSet,
|
|
29899
30174
|
ins.reference !== true && ins.mutation === "Remove" /* Remove */ && isArrayCollection(targetValue) && setEntryMember === null && !isLookupSet && findKnownRowIdByValueReference(args[0], ctx) === null,
|
|
29900
|
-
ins.reference === true,
|
|
30175
|
+
ins.reference === true || referenceRemoval || removedReferenceRowId !== null,
|
|
29901
30176
|
setEntryMember === null && decimalEntries
|
|
29902
30177
|
);
|
|
29903
30178
|
updateCollectionReferenceProvenance(
|
|
@@ -29909,8 +30184,12 @@ function evalCollectionMutationInstruction(ins, scope, ctx, options) {
|
|
|
29909
30184
|
if (removableRowIds !== null) {
|
|
29910
30185
|
const key = Array.isArray(targetValue) ? removedIndex : String(args[0]);
|
|
29911
30186
|
for (const [entryKey, rowId] of removableRowIds) {
|
|
29912
|
-
if (ins.mutation === "Clear" /* Clear */ || entryKey === key)
|
|
30187
|
+
if (ins.mutation === "Clear" /* Clear */ || entryKey === key) {
|
|
29913
30188
|
noteDetachedRow(rowId, null, ctx);
|
|
30189
|
+
const known = removedMembers?.get(rowId);
|
|
30190
|
+
if (known !== void 0)
|
|
30191
|
+
ctx.__runtimeCollectionMembers?.set(known.row, known.contract);
|
|
30192
|
+
}
|
|
29914
30193
|
}
|
|
29915
30194
|
}
|
|
29916
30195
|
if (writesEntry && !(targetValue instanceof RuntimeSet)) {
|
|
@@ -29972,7 +30251,7 @@ function evalCollectionMutationInstruction(ins, scope, ctx, options) {
|
|
|
29972
30251
|
targetValue.reference,
|
|
29973
30252
|
ctx
|
|
29974
30253
|
);
|
|
29975
|
-
indexedAppend =
|
|
30254
|
+
indexedAppend = indexRuntimeCollectionChange(
|
|
29976
30255
|
targetValue.source,
|
|
29977
30256
|
overlayArgs[0],
|
|
29978
30257
|
ctx
|
|
@@ -29982,6 +30261,34 @@ function evalCollectionMutationInstruction(ins, scope, ctx, options) {
|
|
|
29982
30261
|
exportRuntimeSetValue(targetValue, ctx);
|
|
29983
30262
|
}
|
|
29984
30263
|
}
|
|
30264
|
+
if (writesEntry && !(targetValue instanceof RuntimeSet)) {
|
|
30265
|
+
if (Array.isArray(targetValue))
|
|
30266
|
+
indexedAppend = indexRuntimeCollectionChange(
|
|
30267
|
+
targetValue,
|
|
30268
|
+
ins.mutation === "Insert" /* Insert */ ? overlayArgs[1] : overlayArgs[0],
|
|
30269
|
+
ctx
|
|
30270
|
+
);
|
|
30271
|
+
else if (dictionary && isPlainRecord(targetValue))
|
|
30272
|
+
indexedAppend = indexRuntimeCollectionChange(
|
|
30273
|
+
targetValue,
|
|
30274
|
+
overlayArgs[1],
|
|
30275
|
+
ctx,
|
|
30276
|
+
typeof replacedEntry === "string" ? [replacedEntry] : [],
|
|
30277
|
+
String(args[0])
|
|
30278
|
+
);
|
|
30279
|
+
}
|
|
30280
|
+
if (previousEdges !== null) {
|
|
30281
|
+
const collection = targetValue instanceof RuntimeSet ? targetValue.source : targetValue;
|
|
30282
|
+
if (Array.isArray(collection) || isPlainRecord(collection))
|
|
30283
|
+
indexedAppend = indexRuntimeCollectionChange(
|
|
30284
|
+
collection,
|
|
30285
|
+
void 0,
|
|
30286
|
+
ctx,
|
|
30287
|
+
previousEdges,
|
|
30288
|
+
void 0,
|
|
30289
|
+
"contents"
|
|
30290
|
+
);
|
|
30291
|
+
}
|
|
29985
30292
|
if (!indexedAppend) invalidateEvaluatorIndexes(ctx, targetValue);
|
|
29986
30293
|
switch (ins.mutation) {
|
|
29987
30294
|
case "Insert" /* Insert */:
|
|
@@ -29990,7 +30297,7 @@ function evalCollectionMutationInstruction(ins, scope, ctx, options) {
|
|
|
29990
30297
|
target: ins.target,
|
|
29991
30298
|
index: numberArg(args[0], "Insert index"),
|
|
29992
30299
|
value: args[1],
|
|
29993
|
-
valueId: findKnownRowIdByValueReference(args[1], ctx) ?? void 0,
|
|
30300
|
+
valueId: insertedReferenceRowId ?? findKnownRowIdByValueReference(args[1], ctx) ?? void 0,
|
|
29994
30301
|
...resolvedDestinationFieldsForContainer(targetValue, ctx)
|
|
29995
30302
|
});
|
|
29996
30303
|
return;
|
|
@@ -30001,7 +30308,7 @@ function evalCollectionMutationInstruction(ins, scope, ctx, options) {
|
|
|
30001
30308
|
target: ins.target,
|
|
30002
30309
|
value: isLookupSet ? overlayArgs[0] : args[0],
|
|
30003
30310
|
...!isLookupSet ? {
|
|
30004
|
-
valueId: unorderedContainerValueId !== null && typeof overlayArgs[0] === "string" ? overlayArgs[0] : findKnownRowIdByValueReference(args[0], ctx) ?? void 0
|
|
30311
|
+
valueId: insertedReferenceRowId ?? (unorderedContainerValueId !== null && typeof overlayArgs[0] === "string" ? overlayArgs[0] : findKnownRowIdByValueReference(args[0], ctx) ?? void 0)
|
|
30005
30312
|
} : {},
|
|
30006
30313
|
...resolvedDestinationFieldsForContainer(targetValue, ctx)
|
|
30007
30314
|
});
|
|
@@ -30012,7 +30319,7 @@ function evalCollectionMutationInstruction(ins, scope, ctx, options) {
|
|
|
30012
30319
|
target: ins.target,
|
|
30013
30320
|
key: String(args[0]),
|
|
30014
30321
|
value: args[1],
|
|
30015
|
-
valueId: findKnownRowIdByValueReference(args[1], ctx) ?? void 0,
|
|
30322
|
+
valueId: insertedReferenceRowId ?? findKnownRowIdByValueReference(args[1], ctx) ?? void 0,
|
|
30016
30323
|
...resolvedDestinationFieldsForContainer(targetValue, ctx)
|
|
30017
30324
|
});
|
|
30018
30325
|
return;
|
|
@@ -30023,7 +30330,7 @@ function evalCollectionMutationInstruction(ins, scope, ctx, options) {
|
|
|
30023
30330
|
target: ins.target,
|
|
30024
30331
|
value: isLookupSet ? overlayArgs[0] : args[0],
|
|
30025
30332
|
...!isLookupSet ? {
|
|
30026
|
-
valueId: setMatch?.valueId ?? findKnownRowIdByValueReference(args[0], ctx) ?? void 0
|
|
30333
|
+
valueId: removedReferenceRowId ?? setMatch?.valueId ?? findKnownRowIdByValueReference(args[0], ctx) ?? void 0
|
|
30027
30334
|
} : {},
|
|
30028
30335
|
...resolvedDestinationFieldsForContainer(targetValue, ctx)
|
|
30029
30336
|
});
|
|
@@ -30119,7 +30426,15 @@ function sortCollectionInPlace(ins, value, scope, ctx, options) {
|
|
|
30119
30426
|
references
|
|
30120
30427
|
);
|
|
30121
30428
|
forgetLocalListIndexes(ctx, list);
|
|
30122
|
-
|
|
30429
|
+
if (!indexRuntimeCollectionChange(
|
|
30430
|
+
list,
|
|
30431
|
+
void 0,
|
|
30432
|
+
ctx,
|
|
30433
|
+
list.filter((entry) => typeof entry === "string"),
|
|
30434
|
+
void 0,
|
|
30435
|
+
"contents"
|
|
30436
|
+
))
|
|
30437
|
+
invalidateEvaluatorIndexes(ctx, list);
|
|
30123
30438
|
if (id !== null)
|
|
30124
30439
|
options.writes.push({
|
|
30125
30440
|
kind: "reorder",
|
|
@@ -30128,18 +30443,36 @@ function sortCollectionInPlace(ins, value, scope, ctx, options) {
|
|
|
30128
30443
|
...resolvedDestinationFieldsForContainer(list, ctx)
|
|
30129
30444
|
});
|
|
30130
30445
|
}
|
|
30131
|
-
function
|
|
30132
|
-
|
|
30133
|
-
return;
|
|
30134
|
-
const parent = trackedRowForValueReference(parentValue, ctx);
|
|
30446
|
+
function storedCollectionEntryContract(collection, ctx) {
|
|
30447
|
+
const parent = trackedRowForValueReference(collection, ctx);
|
|
30135
30448
|
const placement = parent === null ? null : memberForValueRow(parent, ctx);
|
|
30136
|
-
if (parent === null || placement === null) return;
|
|
30449
|
+
if (parent === null || placement === null) return null;
|
|
30137
30450
|
const genericEnv = rowGenericEnv(parent, ctx);
|
|
30138
30451
|
const parentMember = substituteMember(placement, genericEnv, ctx.vm.members);
|
|
30139
|
-
if (!isMemberWithEntries(parentMember)) return;
|
|
30452
|
+
if (!isMemberWithEntries(parentMember)) return null;
|
|
30140
30453
|
const entry = evalMemberById(ctx.vm, parentMember.entryMemberId);
|
|
30141
|
-
if (entry === null) return;
|
|
30142
|
-
|
|
30454
|
+
if (entry === null) return null;
|
|
30455
|
+
return {
|
|
30456
|
+
entry,
|
|
30457
|
+
member: substituteMember(entry, genericEnv, ctx.vm.members),
|
|
30458
|
+
genericEnv
|
|
30459
|
+
};
|
|
30460
|
+
}
|
|
30461
|
+
function trackInsertedCollection(value, type2, parentValue, ctx) {
|
|
30462
|
+
if (value !== null && typeof value !== "object" && type2.type !== 9 /* Lookup */)
|
|
30463
|
+
return null;
|
|
30464
|
+
const contract = storedCollectionEntryContract(parentValue, ctx);
|
|
30465
|
+
if (contract === null) return null;
|
|
30466
|
+
const { entry, member, genericEnv } = contract;
|
|
30467
|
+
const referenceEntry = isMemberLookupBase(member);
|
|
30468
|
+
if (referenceEntry && isMultiSelectionMember(member) !== true) {
|
|
30469
|
+
const target = lookupTargetTypeInfo(member, null, ctx);
|
|
30470
|
+
const localCollection = target.type === 6 /* List */ && Array.isArray(value) || (target.type === 28 /* Set */ || target.type === 9 /* Lookup */) && value instanceof RuntimeSet || target.type === 5 /* Dictionary */ && isPlainRecord(value);
|
|
30471
|
+
if (localCollection && findKnownRowIdByValueReference(value, ctx) === null)
|
|
30472
|
+
return null;
|
|
30473
|
+
}
|
|
30474
|
+
if (!referenceEntry && (!isTypeInfoWithEntries(type2) && type2.type !== 9 /* Lookup */ || value === null || typeof value !== "object" || findKnownRowIdByValueReference(value, ctx) !== null))
|
|
30475
|
+
return null;
|
|
30143
30476
|
const createdValues = [];
|
|
30144
30477
|
const collectionAliases = /* @__PURE__ */ new Map();
|
|
30145
30478
|
const reservations = /* @__PURE__ */ new Map();
|
|
@@ -30154,13 +30487,21 @@ function trackInsertedCollection(value, type2, parentValue, ctx) {
|
|
|
30154
30487
|
storageKeyDeclarations: /* @__PURE__ */ new Map(),
|
|
30155
30488
|
collectionEntriesAreReferences: false,
|
|
30156
30489
|
collectionAliases,
|
|
30157
|
-
attachmentReservations: reservations
|
|
30490
|
+
attachmentReservations: reservations,
|
|
30491
|
+
insertedCollections: /* @__PURE__ */ new Set()
|
|
30158
30492
|
});
|
|
30159
30493
|
row.genericBindings = computeGenericBindingsStamp(
|
|
30160
30494
|
entry,
|
|
30161
30495
|
genericEnv,
|
|
30162
30496
|
ctx.vm.members
|
|
30163
30497
|
);
|
|
30498
|
+
if (referenceEntry)
|
|
30499
|
+
ctx.__runtimeCollectionMembers?.set(row, {
|
|
30500
|
+
member: { ...entry, ...member },
|
|
30501
|
+
members: ctx.vm.members,
|
|
30502
|
+
classes: ctx.vm.classes,
|
|
30503
|
+
bindings: row.genericBindings === void 0 ? void 0 : { ...row.genericBindings }
|
|
30504
|
+
});
|
|
30164
30505
|
for (const [encoded, alias] of collectionAliases) {
|
|
30165
30506
|
retainEncodedCollectionAlias(encoded, alias, ctx);
|
|
30166
30507
|
}
|
|
@@ -30168,6 +30509,7 @@ function trackInsertedCollection(value, type2, parentValue, ctx) {
|
|
|
30168
30509
|
registerRuntimeSessionValue(ctx, created);
|
|
30169
30510
|
if (ctx.__indexes !== void 0)
|
|
30170
30511
|
indexEvaluatorRows(ctx.__indexes, createdValues);
|
|
30512
|
+
return referenceEntry ? row.id : null;
|
|
30171
30513
|
} catch (error) {
|
|
30172
30514
|
for (const created of createdValues)
|
|
30173
30515
|
ctx.__executionState?.constructorGroupDependencies.delete(created.id);
|
|
@@ -30238,7 +30580,7 @@ function storedSetEntryMember(collection, ctx) {
|
|
|
30238
30580
|
}
|
|
30239
30581
|
return substituteMember(
|
|
30240
30582
|
entry,
|
|
30241
|
-
|
|
30583
|
+
rowGenericEnv(container, ctx),
|
|
30242
30584
|
ctx.vm.members
|
|
30243
30585
|
);
|
|
30244
30586
|
}
|
|
@@ -32354,7 +32696,11 @@ function runtimeParentGenericEnv(row, ctx, visited, readRow) {
|
|
|
32354
32696
|
ctx.onUnattributableValueRead?.(
|
|
32355
32697
|
ownershipChainRead("generic-parent-resolution", row.id)
|
|
32356
32698
|
);
|
|
32357
|
-
for (const link of evaluatorParentLinks(
|
|
32699
|
+
for (const link of evaluatorParentLinks(
|
|
32700
|
+
evaluatorIndexes(ctx),
|
|
32701
|
+
row.id,
|
|
32702
|
+
true
|
|
32703
|
+
)) {
|
|
32358
32704
|
const parent = readRow === void 0 ? evalValueById(
|
|
32359
32705
|
ctx,
|
|
32360
32706
|
link.parentId,
|
|
@@ -33486,7 +33832,11 @@ function resolveValueIfId(at2, ctx) {
|
|
|
33486
33832
|
ctx.__valueOverlay
|
|
33487
33833
|
);
|
|
33488
33834
|
if (!row) return at2;
|
|
33489
|
-
const
|
|
33835
|
+
const placed = memberForValueRow(row, ctx);
|
|
33836
|
+
const member = placed?.kind === 21 /* Generic */ ? {
|
|
33837
|
+
...placed,
|
|
33838
|
+
...substituteMember(placed, rowGenericEnv(row, ctx), ctx.vm.members)
|
|
33839
|
+
} : placed;
|
|
33490
33840
|
if (member !== null && isMemberEntryCollectionBase(member) && listKindOf(member) === 1 /* Unordered */ && Array.isArray(row.value)) {
|
|
33491
33841
|
return evaluatorUnorderedListEntryIds(row.id, ctx);
|
|
33492
33842
|
}
|
|
@@ -33829,7 +34179,25 @@ function resolveMemberForValueRow(row, ctx, visited) {
|
|
|
33829
34179
|
const member = memberForCustomSchemaValue(classId, link.key, ctx);
|
|
33830
34180
|
if (member !== null) return member;
|
|
33831
34181
|
}
|
|
33832
|
-
return
|
|
34182
|
+
return runtimeCollectionMember(row, ctx);
|
|
34183
|
+
}
|
|
34184
|
+
function runtimeCollectionMember(row, ctx) {
|
|
34185
|
+
const known = ctx.__runtimeCollectionMembers?.get(row);
|
|
34186
|
+
if (known === void 0) return null;
|
|
34187
|
+
if (known.members !== ctx.vm.members || known.classes !== ctx.vm.classes)
|
|
34188
|
+
return null;
|
|
34189
|
+
const bindings = row.genericBindings;
|
|
34190
|
+
if (Object.keys(bindings ?? {}).length !== Object.keys(known.bindings ?? {}).length)
|
|
34191
|
+
return null;
|
|
34192
|
+
for (const [id, memberId] of Object.entries(known.bindings ?? {}))
|
|
34193
|
+
if (bindings?.[id] !== memberId) return null;
|
|
34194
|
+
if (row.value !== null) {
|
|
34195
|
+
if ((isMemberEntryCollectionBase(known.member) || isMemberLookupBase(known.member)) && !Array.isArray(row.value))
|
|
34196
|
+
return null;
|
|
34197
|
+
if (isMemberDictionaryBase(known.member) && !isPlainRecord(row.value))
|
|
34198
|
+
return null;
|
|
34199
|
+
}
|
|
34200
|
+
return known.member;
|
|
33833
34201
|
}
|
|
33834
34202
|
function* evaluatorParentEdges(row, ctx, indexes4) {
|
|
33835
34203
|
const cache = ctx.__unorderedListProjections;
|
|
@@ -33838,7 +34206,7 @@ function* evaluatorParentEdges(row, ctx, indexes4) {
|
|
|
33838
34206
|
yield { parentId: writtenParentId, key: "" };
|
|
33839
34207
|
}
|
|
33840
34208
|
const written = cache?.writtenContainerIds;
|
|
33841
|
-
for (const link of indexes4.parentLinksByChildId.get(row.id) ?? []) {
|
|
34209
|
+
for (const link of indexes4.placementParentLinksByChildId.get(row.id) ?? indexes4.parentLinksByChildId.get(row.id) ?? []) {
|
|
33842
34210
|
if (written?.has(link.parentId) !== true) yield link;
|
|
33843
34211
|
}
|
|
33844
34212
|
const database = ctx.vm.databaseVM;
|
|
@@ -39427,7 +39795,7 @@ function currentOwnedValueAttachments(valueId, ctx, parentEntries, placingMember
|
|
|
39427
39795
|
ownershipChainRead("owned-value-parents", valueId)
|
|
39428
39796
|
);
|
|
39429
39797
|
const parentIds = new Set(
|
|
39430
|
-
evaluatorParentLinks(indexes4, valueId).map((link) => link.parentId)
|
|
39798
|
+
evaluatorParentLinks(indexes4, valueId, true).map((link) => link.parentId)
|
|
39431
39799
|
);
|
|
39432
39800
|
for (const parentId of parentIds) {
|
|
39433
39801
|
const parent = evalValueById(
|
|
@@ -39837,6 +40205,35 @@ function materializeConstructorArgumentValue(args) {
|
|
|
39837
40205
|
args.destinationName ?? args.member.name,
|
|
39838
40206
|
args.ctx
|
|
39839
40207
|
);
|
|
40208
|
+
if (args.insertedCollections !== void 0 && (isMemberEntryCollectionBase(args.member) || isMemberDictionaryBase(args.member)) && typeof args.value === "object" && args.value !== null) {
|
|
40209
|
+
const tracked = trackedRowForValueReference(args.value, args.ctx);
|
|
40210
|
+
if (tracked !== null) {
|
|
40211
|
+
if (args.owner === void 0)
|
|
40212
|
+
throw new NSGetterRuntimeError(
|
|
40213
|
+
"Inserted collection has no destination."
|
|
40214
|
+
);
|
|
40215
|
+
if (!args.attachmentReservations?.has(tracked.id))
|
|
40216
|
+
args.attachmentReservations?.set(
|
|
40217
|
+
tracked.id,
|
|
40218
|
+
args.ctx.__executionState?.ownedValueAttachments.get(tracked.id)
|
|
40219
|
+
);
|
|
40220
|
+
assertOwnedValueAttachable(
|
|
40221
|
+
tracked.id,
|
|
40222
|
+
args.owner,
|
|
40223
|
+
args.destinationName ?? args.member.name,
|
|
40224
|
+
args.ctx,
|
|
40225
|
+
true,
|
|
40226
|
+
"insert"
|
|
40227
|
+
);
|
|
40228
|
+
return tracked;
|
|
40229
|
+
}
|
|
40230
|
+
const identity2 = args.value instanceof RuntimeSet ? args.value.source : args.value;
|
|
40231
|
+
if (args.insertedCollections.has(identity2))
|
|
40232
|
+
throw new NSGetterRuntimeError(
|
|
40233
|
+
"Inserted collection graph contains a duplicate owned collection. Call Clone() explicitly."
|
|
40234
|
+
);
|
|
40235
|
+
args.insertedCollections.add(identity2);
|
|
40236
|
+
}
|
|
39840
40237
|
const collectionAlias = args.value;
|
|
39841
40238
|
if (args.value instanceof RuntimeSet)
|
|
39842
40239
|
args = {
|
|
@@ -39887,7 +40284,7 @@ function materializeConstructorArgumentValue(args) {
|
|
|
39887
40284
|
args.ctx
|
|
39888
40285
|
)
|
|
39889
40286
|
);
|
|
39890
|
-
if (collectionAlias instanceof RuntimeSet)
|
|
40287
|
+
if (collectionAlias instanceof RuntimeSet && isMultiSelectionMember(args.member) === true)
|
|
39891
40288
|
args.collectionAliases?.set(row, collectionAlias);
|
|
39892
40289
|
return row;
|
|
39893
40290
|
}
|
|
@@ -41536,11 +41933,23 @@ function derivedTupleElementMemberId(parentMemberId, index) {
|
|
|
41536
41933
|
);
|
|
41537
41934
|
}
|
|
41538
41935
|
|
|
41936
|
+
// ../src/models/members/entry-member-id.ts
|
|
41937
|
+
var NEO_ENTRY_MEMBER_NAMESPACE = "4d1c4a2f-1a0f-5f3e-9a5c-2b7d6e8f0c31";
|
|
41938
|
+
function derivedEntryMemberId(declaringMemberId) {
|
|
41939
|
+
return inSystemRecordNamespaceOf(
|
|
41940
|
+
declaringMemberId,
|
|
41941
|
+
v5_default(
|
|
41942
|
+
withoutSystemRecordIdPrefix(declaringMemberId),
|
|
41943
|
+
NEO_ENTRY_MEMBER_NAMESPACE
|
|
41944
|
+
)
|
|
41945
|
+
);
|
|
41946
|
+
}
|
|
41947
|
+
|
|
41539
41948
|
// ../src/database/compiled-construction-types.ts
|
|
41540
41949
|
function compiledConstructionTypeMembers(members2, bodies, projectId) {
|
|
41541
41950
|
const created = [];
|
|
41542
|
-
const
|
|
41543
|
-
let
|
|
41951
|
+
const processedKeys = [];
|
|
41952
|
+
let existingMembers;
|
|
41544
41953
|
const byType = /* @__PURE__ */ new Map();
|
|
41545
41954
|
const key = (type2) => canonicalJsonStringify(type2);
|
|
41546
41955
|
const intern = (type2, slot) => {
|
|
@@ -41553,21 +41962,21 @@ function compiledConstructionTypeMembers(members2, bodies, projectId) {
|
|
|
41553
41962
|
`neo:compiled-construction-type:${projectId}:${cacheKey}`,
|
|
41554
41963
|
v5_default.URL
|
|
41555
41964
|
);
|
|
41556
|
-
|
|
41557
|
-
|
|
41558
|
-
|
|
41559
|
-
return id;
|
|
41560
|
-
}
|
|
41965
|
+
existingMembers ??= new Map(members2.map((member) => [member.id, member]));
|
|
41966
|
+
const storedMember = existingMembers.get(id);
|
|
41967
|
+
const alreadyStored = storedMember !== void 0;
|
|
41561
41968
|
const common = {
|
|
41562
41969
|
id,
|
|
41563
41970
|
projectId,
|
|
41564
41971
|
createdAt: 0,
|
|
41565
41972
|
updatedAt: 0,
|
|
41566
41973
|
name: slot?.name ?? "Type argument",
|
|
41974
|
+
...slot?.format === void 0 ? {} : { format: slot.format },
|
|
41567
41975
|
kind: type2.type,
|
|
41568
41976
|
requirement: type2.required ? 1 /* Required */ : 0 /* Optional */
|
|
41569
41977
|
};
|
|
41570
41978
|
const mark = created.length;
|
|
41979
|
+
const processedMark = processedKeys.length;
|
|
41571
41980
|
const fields = (() => {
|
|
41572
41981
|
if (type2.type === 30 /* Tuple */) {
|
|
41573
41982
|
const elementMemberIds = [];
|
|
@@ -41582,7 +41991,15 @@ function compiledConstructionTypeMembers(members2, bodies, projectId) {
|
|
|
41582
41991
|
return { elementMemberIds };
|
|
41583
41992
|
}
|
|
41584
41993
|
if (type2.type === 6 /* List */ || type2.type === 28 /* Set */ || type2.type === 5 /* Dictionary */) {
|
|
41585
|
-
const
|
|
41994
|
+
const storedEntryId = getField(storedMember, "entryMemberId");
|
|
41995
|
+
const entryMemberId = intern(
|
|
41996
|
+
type2.entryTypeInfo,
|
|
41997
|
+
type2.type === 28 /* Set */ && type2.entryTypeInfo.type === 3 /* String */ ? {
|
|
41998
|
+
id: typeof storedEntryId === "string" ? storedEntryId : derivedEntryMemberId(id),
|
|
41999
|
+
name: "Item",
|
|
42000
|
+
format: 1 /* Plain */
|
|
42001
|
+
} : void 0
|
|
42002
|
+
);
|
|
41586
42003
|
if (entryMemberId === null) return null;
|
|
41587
42004
|
return {
|
|
41588
42005
|
entryMemberId,
|
|
@@ -41614,6 +42031,16 @@ function compiledConstructionTypeMembers(members2, bodies, projectId) {
|
|
|
41614
42031
|
} else if (type2.type === 26 /* NSAction */) {
|
|
41615
42032
|
return { argumentTypes: namedArguments(type2.argumentTypes) };
|
|
41616
42033
|
} else if (type2.type === 29 /* Reference */) {
|
|
42034
|
+
const target = type2.targetTypeInfo;
|
|
42035
|
+
if (target.type === 6 /* List */ || target.type === 5 /* Dictionary */ || target.type === 28 /* Set */) {
|
|
42036
|
+
intern(target);
|
|
42037
|
+
} else if (target.type === 9 /* Lookup */ && target.collectionMemberId === void 0 && target.collectionValueId === void 0 && target.entryTypeInfo.type !== NS_TYPE_UNKNOWN && target.entryTypeInfo.required && SET_ENTRY_MEMBER_KINDS.has(target.entryTypeInfo.type)) {
|
|
42038
|
+
intern({
|
|
42039
|
+
type: 28 /* Set */,
|
|
42040
|
+
required: target.required,
|
|
42041
|
+
entryTypeInfo: target.entryTypeInfo
|
|
42042
|
+
});
|
|
42043
|
+
}
|
|
41617
42044
|
return {
|
|
41618
42045
|
kind: 9 /* Lookup */,
|
|
41619
42046
|
declaredTypeInfo: type2.targetTypeInfo
|
|
@@ -41625,13 +42052,16 @@ function compiledConstructionTypeMembers(members2, bodies, projectId) {
|
|
|
41625
42052
|
}
|
|
41626
42053
|
})();
|
|
41627
42054
|
if (fields === null) {
|
|
41628
|
-
for (const member of created.splice(mark))
|
|
41629
|
-
|
|
41630
|
-
|
|
41631
|
-
|
|
41632
|
-
|
|
41633
|
-
|
|
41634
|
-
|
|
42055
|
+
for (const member of created.splice(mark))
|
|
42056
|
+
existingMembers.delete(member.id);
|
|
42057
|
+
for (const key2 of processedKeys.splice(processedMark)) byType.delete(key2);
|
|
42058
|
+
if (!alreadyStored) return null;
|
|
42059
|
+
} else if (!alreadyStored) {
|
|
42060
|
+
const member = { ...common, ...fields };
|
|
42061
|
+
created.push(member);
|
|
42062
|
+
existingMembers.set(id, member);
|
|
42063
|
+
}
|
|
42064
|
+
processedKeys.push(cacheKey);
|
|
41635
42065
|
byType.set(cacheKey, id);
|
|
41636
42066
|
return id;
|
|
41637
42067
|
};
|