@neocompose/cli 0.36.9 → 0.36.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/neo.mjs CHANGED
@@ -32528,7 +32528,7 @@ function projectSchemaManifest(input, options = {}) {
32528
32528
  manifest.constructors ?? [],
32529
32529
  "ProjectSchemaManifest.constructors"
32530
32530
  );
32531
- const memberById = indexById(members, "ProjectSchemaManifest.members");
32531
+ const memberById2 = indexById(members, "ProjectSchemaManifest.members");
32532
32532
  const schemaClassById = indexById(classes, "ProjectSchemaManifest.classes");
32533
32533
  const interfaceById = indexById(
32534
32534
  interfaces,
@@ -32555,7 +32555,7 @@ function projectSchemaManifest(input, options = {}) {
32555
32555
  const rootMemberIds2 = options.rootMemberIds ?? inferRootMemberIds(members);
32556
32556
  const environment = {
32557
32557
  sourceUri: options.sourceUri ?? defaultSourceUri,
32558
- members: memberById,
32558
+ members: memberById2,
32559
32559
  classes: schemaClassById,
32560
32560
  interfaces: interfaceById,
32561
32561
  enums: indexById(enums, "ProjectSchemaManifest.enums"),
@@ -32765,10 +32765,10 @@ function inferRootMemberIds(members) {
32765
32765
  };
32766
32766
  }
32767
32767
  function effectiveMemberWritability(members, classes, roots) {
32768
- const memberById = /* @__PURE__ */ new Map();
32768
+ const memberById2 = /* @__PURE__ */ new Map();
32769
32769
  for (const member of members) {
32770
32770
  if (typeof member.id === "string") {
32771
- memberById.set(member.id, member);
32771
+ memberById2.set(member.id, member);
32772
32772
  }
32773
32773
  }
32774
32774
  const classById = /* @__PURE__ */ new Map();
@@ -32780,7 +32780,7 @@ function effectiveMemberWritability(members, classes, roots) {
32780
32780
  const declaredStorage = (memberId, seen = /* @__PURE__ */ new Set()) => {
32781
32781
  if (seen.has(memberId)) return null;
32782
32782
  seen.add(memberId);
32783
- const member = memberById.get(memberId);
32783
+ const member = memberById2.get(memberId);
32784
32784
  if (!member) return null;
32785
32785
  if (member.storage === "immutable" || member.storage === "save" || member.storage === "session") {
32786
32786
  return member.storage;
@@ -32849,7 +32849,7 @@ function effectiveMemberWritability(members, classes, roots) {
32849
32849
  if (typeof roots.session === "string") {
32850
32850
  rootStorage.set(roots.session, "session");
32851
32851
  }
32852
- for (const [memberId, member] of memberById) {
32852
+ for (const [memberId, member] of memberById2) {
32853
32853
  const root = rootStorage.get(memberId);
32854
32854
  const declared = declaredStorage(memberId);
32855
32855
  let storage = root ?? declared;
@@ -32866,7 +32866,7 @@ function effectiveMemberWritability(members, classes, roots) {
32866
32866
  let changed = true;
32867
32867
  while (changed) {
32868
32868
  changed = false;
32869
- for (const memberId of memberById.keys()) {
32869
+ for (const memberId of memberById2.keys()) {
32870
32870
  if (anchored.has(memberId)) continue;
32871
32871
  const next = new Set(effective.get(memberId) ?? []);
32872
32872
  for (const parentId of parents.get(memberId) ?? []) {
@@ -35199,6 +35199,19 @@ var init_names = __esm({
35199
35199
  function isObjectRecord2(value) {
35200
35200
  return typeof value === "object" && value !== null && !Array.isArray(value);
35201
35201
  }
35202
+ function effectiveRecordData(record3) {
35203
+ return record3.conflictServerHash !== void 0 && isObjectRecord2(record3.conflictServerData) ? record3.conflictServerData : record3.data;
35204
+ }
35205
+ function loweringBaseRecords(records2) {
35206
+ let normalized = null;
35207
+ for (const [key, record3] of Object.entries(records2)) {
35208
+ const effective = effectiveRecordData(record3);
35209
+ if (effective === record3.data) continue;
35210
+ if (normalized === null) normalized = { ...records2 };
35211
+ normalized[key] = { ...record3, data: effective };
35212
+ }
35213
+ return normalized ?? records2;
35214
+ }
35202
35215
  function splitRecordFields(data, serverOwnedFields) {
35203
35216
  const fileFields = {};
35204
35217
  const volatileValues = {};
@@ -54576,7 +54589,7 @@ function globalId(global, kind) {
54576
54589
  }
54577
54590
  function baseData(state, kind, id2) {
54578
54591
  const entry = state[`${kind}:${id2}`];
54579
- return entry?.conflictServerHash !== void 0 ? entry.conflictServerData : entry?.data;
54592
+ return entry === void 0 ? void 0 : effectiveRecordData(entry);
54580
54593
  }
54581
54594
  function optionalBase(value) {
54582
54595
  return isObjectRecord2(value) ? value : {};
@@ -64258,7 +64271,7 @@ function constructorActionParameterId(constructor2, index) {
64258
64271
  }
64259
64272
  return `__arg_${index}__`;
64260
64273
  }
64261
- function createTypedValueNormalizer(rows, document, childrenByContainerId, parameterTypesForRow, memberById, memberTypeInfo) {
64274
+ function createTypedValueNormalizer(rows, document, childrenByContainerId, parameterTypesForRow, memberById2, memberTypeInfo) {
64262
64275
  const visiting = /* @__PURE__ */ new Set();
64263
64276
  const normalizeLiteral = (value) => {
64264
64277
  if (Array.isArray(value)) return value.map(normalizeLiteral);
@@ -64341,7 +64354,7 @@ function createTypedValueNormalizer(rows, document, childrenByContainerId, param
64341
64354
  const childTypeBySchemaKey = /* @__PURE__ */ new Map();
64342
64355
  for (const entry of merged) {
64343
64356
  if (entry.memberId === null) continue;
64344
- const member = memberById(entry.memberId);
64357
+ const member = memberById2(entry.memberId);
64345
64358
  if (member === void 0) continue;
64346
64359
  const childType = memberTypeInfo(member, env);
64347
64360
  if (childType !== null) {
@@ -72261,7 +72274,7 @@ function buildConstructorInitializerIndexes(vm) {
72261
72274
  declaringClassIdsByMemberId.set(memberId, owners);
72262
72275
  }
72263
72276
  }
72264
- const memberById = new Map(vm.members.map((member) => [member.id, member]));
72277
+ const memberById2 = new Map(vm.members.map((member) => [member.id, member]));
72265
72278
  const containerMemberIdByEntryId = /* @__PURE__ */ new Map();
72266
72279
  for (const member of vm.members) {
72267
72280
  if (isMemberList(member) || isMemberDictionary(member)) {
@@ -72271,7 +72284,7 @@ function buildConstructorInitializerIndexes(vm) {
72271
72284
  return {
72272
72285
  initializerScopeMemberIds,
72273
72286
  declaringClassIdsByMemberId,
72274
- memberById,
72287
+ memberById: memberById2,
72275
72288
  containerMemberIdByEntryId
72276
72289
  };
72277
72290
  }
@@ -79912,7 +79925,7 @@ function baseData2(state, kind, id2) {
79912
79925
  return record3 ? effectiveData(record3) : {};
79913
79926
  }
79914
79927
  function effectiveData(record3) {
79915
- const data = record3.conflictServerHash !== void 0 ? record3.conflictServerData : record3.data;
79928
+ const data = effectiveRecordData(record3);
79916
79929
  return isObjectRecord2(data) ? data : {};
79917
79930
  }
79918
79931
  function requiredDestination(value, owner) {
@@ -81930,7 +81943,7 @@ function variantOwnershipRoots(args) {
81930
81943
  const folderById = new Map(
81931
81944
  (args.variantFolders ?? []).map((folder) => [folder.id, folder])
81932
81945
  );
81933
- const memberById = new Map(
81946
+ const memberById2 = new Map(
81934
81947
  (args.members ?? []).map((member) => [member.id, member])
81935
81948
  );
81936
81949
  const roots = [];
@@ -81971,7 +81984,7 @@ function variantOwnershipRoots(args) {
81971
81984
  })
81972
81985
  );
81973
81986
  const lookupParameterId = variantClass.genericParams?.[1]?.id;
81974
- const lookupCollection = lookupFolder?.binding == null ? void 0 : memberById.get(lookupFolder.binding.collectionMemberId);
81987
+ const lookupCollection = lookupFolder?.binding == null ? void 0 : memberById2.get(lookupFolder.binding.collectionMemberId);
81975
81988
  const lookupBinding = lookupParameterId !== void 0 && isMemberListBase(lookupCollection) ? {
81976
81989
  [lookupParameterId]: {
81977
81990
  kind: "member",
@@ -82113,6 +82126,16 @@ function neoScriptMemberContractProjection(value) {
82113
82126
  defaultPresent: value.defaultValue != null
82114
82127
  };
82115
82128
  }
82129
+ function transactionImpactsAnyOwnerMember(scope, impactedIds) {
82130
+ for (const member of scope.document.members) {
82131
+ if (impactedIds.has(member.id)) return true;
82132
+ }
82133
+ for (const root of scope.roots) {
82134
+ const ownerId = Reflect.get(root.member, "id");
82135
+ if (typeof ownerId === "string" && impactedIds.has(ownerId)) return true;
82136
+ }
82137
+ return false;
82138
+ }
82116
82139
  function collectNeoScriptRecompileTargets(args) {
82117
82140
  if (args.forceRecompile === true) return completeTargets(args.postDocument);
82118
82141
  const explicit = explicitTargetIds(args.changes);
@@ -82176,15 +82199,17 @@ function collectNeoScriptRecompileTargets(args) {
82176
82199
  args.postDocument,
82177
82200
  args.postDocument.variants ?? []
82178
82201
  );
82179
- const ownerByValueId = resolveOwnerMembersForValues(
82180
- scope.document,
82181
- new Set(postValues.map((record3) => record3.id)),
82182
- scope.roots
82183
- );
82184
- for (const [valueId, owner] of ownerByValueId) {
82185
- const ownerId = Reflect.get(owner, "id");
82186
- if (typeof ownerId === "string" && impactedIds.has(ownerId)) {
82187
- valueIds.add(valueId);
82202
+ if (transactionImpactsAnyOwnerMember(scope, impactedIds)) {
82203
+ const ownerByValueId = resolveOwnerMembersForValues(
82204
+ scope.document,
82205
+ new Set(postValues.map((record3) => record3.id)),
82206
+ scope.roots
82207
+ );
82208
+ for (const [valueId, owner] of ownerByValueId) {
82209
+ const ownerId = Reflect.get(owner, "id");
82210
+ if (typeof ownerId === "string" && impactedIds.has(ownerId)) {
82211
+ valueIds.add(valueId);
82212
+ }
82188
82213
  }
82189
82214
  }
82190
82215
  }
@@ -87386,7 +87411,7 @@ function validateCreatedMigrationGraph(args) {
87386
87411
  }
87387
87412
  createdById.set(row.id, row);
87388
87413
  }
87389
- const memberById = new Map(args.members.map((member) => [member.id, member]));
87414
+ const memberById2 = new Map(args.members.map((member) => [member.id, member]));
87390
87415
  const classById = new Map(
87391
87416
  args.classes.map((schemaClass2) => [schemaClass2.id, schemaClass2])
87392
87417
  );
@@ -87485,7 +87510,7 @@ function validateCreatedMigrationGraph(args) {
87485
87510
  );
87486
87511
  }
87487
87512
  const childMemberId = schema.get(schemaKey);
87488
- const childMember = childMemberId === void 0 ? void 0 : memberById.get(childMemberId);
87513
+ const childMember = childMemberId === void 0 ? void 0 : memberById2.get(childMemberId);
87489
87514
  if (childMember === void 0) {
87490
87515
  throw graphError(
87491
87516
  args,
@@ -87501,7 +87526,7 @@ function validateCreatedMigrationGraph(args) {
87501
87526
  return;
87502
87527
  }
87503
87528
  if (member !== void 0 && isMemberListBase(member)) {
87504
- const entryMember = memberById.get(member.entryMemberId);
87529
+ const entryMember = memberById2.get(member.entryMemberId);
87505
87530
  if (entryMember === void 0) {
87506
87531
  throw graphError(
87507
87532
  args,
@@ -87529,7 +87554,7 @@ function validateCreatedMigrationGraph(args) {
87529
87554
  return;
87530
87555
  }
87531
87556
  if (member !== void 0 && isMemberDictionaryBase(member)) {
87532
- const entryMember = memberById.get(member.entryMemberId);
87557
+ const entryMember = memberById2.get(member.entryMemberId);
87533
87558
  if (entryMember === void 0) {
87534
87559
  throw graphError(
87535
87560
  args,
@@ -88564,6 +88589,56 @@ var init_project_version_transaction_types = __esm({
88564
88589
  }
88565
88590
  });
88566
88591
 
88592
+ // ../src/database/project-version-relation-sweep-trigger.ts
88593
+ function stagedChangesAffectClassRelations(current, changes) {
88594
+ const classesById = new Map(
88595
+ (current.classes ?? []).map((schemaClass2) => [schemaClass2.id, schemaClass2])
88596
+ );
88597
+ const valuesById = new Map(
88598
+ (current.values ?? []).map((value) => [value.id, value])
88599
+ );
88600
+ for (const change of changes) {
88601
+ if (change.recordKind === "internal-record-relation") return true;
88602
+ if (change.recordKind === "class") {
88603
+ if (change.operation !== "update") return true;
88604
+ if (change.deleted === true) return true;
88605
+ const before2 = classesById.get(change.recordId);
88606
+ if (before2 === void 0) return true;
88607
+ const after = change.nextData;
88608
+ if (!isPlainRecord(after)) return true;
88609
+ if (before2.extendsClassId !== after.extendsClassId) return true;
88610
+ continue;
88611
+ }
88612
+ if (change.recordKind !== "value") continue;
88613
+ const before = valuesById.get(change.recordId);
88614
+ if (valueCreateCannotAffectClassRelations(change, before)) continue;
88615
+ if (relationEndpointClassId(before) !== relationEndpointClassId(change.nextData)) {
88616
+ return true;
88617
+ }
88618
+ }
88619
+ return false;
88620
+ }
88621
+ function valueCreateCannotAffectClassRelations(change, before) {
88622
+ if (change.operation !== "create") return false;
88623
+ if (change.deleted === true) return false;
88624
+ return before === void 0;
88625
+ }
88626
+ function relationEndpointClassId(record3) {
88627
+ if (!isPlainRecord(record3)) return void 0;
88628
+ if (typeof record3.classId === "string") return record3.classId;
88629
+ if (typeof record3.typeId === "string") return record3.typeId;
88630
+ return void 0;
88631
+ }
88632
+ function isPlainRecord(value) {
88633
+ if (value === null || typeof value !== "object") return false;
88634
+ return !Array.isArray(value);
88635
+ }
88636
+ var init_project_version_relation_sweep_trigger = __esm({
88637
+ "../src/database/project-version-relation-sweep-trigger.ts"() {
88638
+ "use strict";
88639
+ }
88640
+ });
88641
+
88567
88642
  // ../src/database/project-version-transaction-planning.ts
88568
88643
  function variantRootValueId2(data) {
88569
88644
  if (typeof data !== "object" || data === null) return null;
@@ -88585,7 +88660,7 @@ function addProjectVersionTransactionBudgets(left, right) {
88585
88660
  returnBytes: left.returnBytes + right.returnBytes
88586
88661
  };
88587
88662
  }
88588
- var KIB, MIB, PROJECT_TRANSACTION_CHUNK_PAYLOAD_TARGET_BYTES, PROJECT_TRANSACTION_IMMEDIATE_BUDGET, PROJECT_TRANSACTION_WORKER_BUDGET, PROJECT_TRANSACTION_SINGLE_CHANGE_NATIVE_BUDGET, EMPTY_BUDGET, CHUNK_GRAPH_VALIDATION_RESERVE, CHUNK_FIXED_COST, IMMEDIATE_FIXED_COST, WHOLE_GRAPH_VALIDATION_SURCHARGE;
88663
+ var KIB, MIB, PROJECT_TRANSACTION_CHUNK_PAYLOAD_TARGET_BYTES, PROJECT_TRANSACTION_IMMEDIATE_BUDGET, PROJECT_TRANSACTION_WORKER_BUDGET, PROJECT_TRANSACTION_SINGLE_CHANGE_NATIVE_BUDGET, EMPTY_BUDGET, CHUNK_GRAPH_VALIDATION_RESERVE, CHUNK_FIXED_COST, IMMEDIATE_FIXED_COST, WHOLE_GRAPH_VALIDATION_SURCHARGE, CHANGE_BYTES_READ_OVERHEAD, CHANGE_BYTES_WRITTEN_OVERHEAD;
88589
88664
  var init_project_version_transaction_planning = __esm({
88590
88665
  "../src/database/project-version-transaction-planning.ts"() {
88591
88666
  "use strict";
@@ -88599,8 +88674,8 @@ var init_project_version_transaction_planning = __esm({
88599
88674
  bytesWritten: 4 * MIB,
88600
88675
  documentsRead: 4e3,
88601
88676
  documentsWritten: 1400,
88602
- databaseQueries: 420,
88603
- indexRanges: 320,
88677
+ databaseQueries: 800,
88678
+ indexRanges: 800,
88604
88679
  functionsScheduled: 24,
88605
88680
  scheduledFunctionArgsBytes: 64 * KIB,
88606
88681
  returnBytes: 4 * MIB
@@ -88611,8 +88686,8 @@ var init_project_version_transaction_planning = __esm({
88611
88686
  bytesWritten: 4 * MIB,
88612
88687
  documentsRead: 4e3,
88613
88688
  documentsWritten: 900,
88614
- databaseQueries: 420,
88615
- indexRanges: 320,
88689
+ databaseQueries: 700,
88690
+ indexRanges: 700,
88616
88691
  functionsScheduled: 8,
88617
88692
  scheduledFunctionArgsBytes: 32 * KIB,
88618
88693
  returnBytes: 128 * KIB
@@ -88648,9 +88723,9 @@ var init_project_version_transaction_planning = __esm({
88648
88723
  bytesRead: 32 * KIB,
88649
88724
  bytesWritten: 48 * KIB,
88650
88725
  documentsRead: 4,
88651
- documentsWritten: 4,
88652
- databaseQueries: 10,
88653
- indexRanges: 8,
88726
+ documentsWritten: 5,
88727
+ databaseQueries: 97,
88728
+ indexRanges: 105,
88654
88729
  functionsScheduled: 2,
88655
88730
  scheduledFunctionArgsBytes: 2 * KIB,
88656
88731
  returnBytes: 2 * KIB
@@ -88659,21 +88734,23 @@ var init_project_version_transaction_planning = __esm({
88659
88734
  argumentBytes: 2 * KIB,
88660
88735
  bytesRead: 96 * KIB,
88661
88736
  bytesWritten: 64 * KIB,
88662
- documentsRead: 12,
88663
- documentsWritten: 4,
88737
+ documentsRead: 18,
88738
+ documentsWritten: 8,
88664
88739
  databaseQueries: 34,
88665
- indexRanges: 24,
88740
+ indexRanges: 34,
88666
88741
  functionsScheduled: 4,
88667
88742
  scheduledFunctionArgsBytes: 8 * KIB,
88668
88743
  returnBytes: 8 * KIB
88669
88744
  };
88670
88745
  WHOLE_GRAPH_VALIDATION_SURCHARGE = {
88671
88746
  ...EMPTY_BUDGET,
88672
- bytesRead: 512 * KIB,
88673
- documentsRead: 400,
88674
- databaseQueries: 300,
88675
- indexRanges: 200
88747
+ bytesRead: 336 * KIB,
88748
+ documentsRead: 782,
88749
+ databaseQueries: 410,
88750
+ indexRanges: 410
88676
88751
  };
88752
+ CHANGE_BYTES_READ_OVERHEAD = 4 * KIB;
88753
+ CHANGE_BYTES_WRITTEN_OVERHEAD = 4 * KIB;
88677
88754
  }
88678
88755
  });
88679
88756
 
@@ -88701,13 +88778,13 @@ function lookupTargetClassContractViolation(args) {
88701
88778
  }
88702
88779
  return null;
88703
88780
  }
88704
- function lookupEntryClassId(member, memberById) {
88705
- const collection = memberById.get(member.collectionMemberId);
88781
+ function lookupEntryClassId(member, memberById2) {
88782
+ const collection = memberById2.get(member.collectionMemberId);
88706
88783
  if (collection === void 0) return null;
88707
88784
  if (!isMemberListBase(collection) && !isMemberDictionaryBase(collection)) {
88708
88785
  return null;
88709
88786
  }
88710
- const entry = memberById.get(collection.entryMemberId);
88787
+ const entry = memberById2.get(collection.entryMemberId);
88711
88788
  if (entry === void 0) return null;
88712
88789
  return isMemberClassBase(entry) ? entry.classId : null;
88713
88790
  }
@@ -88731,8 +88808,8 @@ function classAssignableToClass(actualClassId, expectedClassId, classById) {
88731
88808
  function classDisplayName(classId, classById) {
88732
88809
  return classById.get(classId)?.name ?? classId;
88733
88810
  }
88734
- function collectionMemberName(member, memberById, classes) {
88735
- const collection = memberById.get(member.collectionMemberId);
88811
+ function collectionMemberName(member, memberById2, classes) {
88812
+ const collection = memberById2.get(member.collectionMemberId);
88736
88813
  if (collection === void 0) return member.collectionMemberId;
88737
88814
  const owner = classes.find(
88738
88815
  (schemaClass2) => Object.values(schemaClass2.schema).includes(member.collectionMemberId)
@@ -90065,11 +90142,16 @@ function prepareServerOwnedSchemaCommit(args) {
90065
90142
  if (listIndexErrors.length > 0) {
90066
90143
  throw new Error(listIndexErrors[0].message);
90067
90144
  }
90068
- validateInternalRecordRelations({
90069
- relations: postDocument.internalRecordRelations ?? [],
90070
- endpoints: collectProjectDocumentRelationEndpoints(postDocument),
90071
- classes: postDocument.classes
90072
- });
90145
+ if (stagedChangesAffectClassRelations(args.document, [
90146
+ ...prepared,
90147
+ ...readOnlyConversionChanges
90148
+ ])) {
90149
+ validateInternalRecordRelations({
90150
+ relations: postDocument.internalRecordRelations ?? [],
90151
+ endpoints: collectProjectDocumentRelationEndpoints(postDocument),
90152
+ classes: postDocument.classes
90153
+ });
90154
+ }
90073
90155
  const accessModifierErrors = validateDocumentAccessModifiers({
90074
90156
  members: postDocument.members,
90075
90157
  classes: postDocument.classes,
@@ -90216,10 +90298,6 @@ function orderVariantRootValuesWithVariants(prepared) {
90216
90298
  return ordered;
90217
90299
  }
90218
90300
  function materializePreparedInstanceInitializers(args) {
90219
- const compiledDocument = applyProjectVersionWriteChanges(
90220
- args.document,
90221
- args.prepared
90222
- );
90223
90301
  const sites = /* @__PURE__ */ new Map();
90224
90302
  for (let index = 0; index < args.prepared.length; index += 1) {
90225
90303
  const change = args.prepared[index];
@@ -90234,6 +90312,10 @@ function materializePreparedInstanceInitializers(args) {
90234
90312
  });
90235
90313
  }
90236
90314
  if (sites.size === 0) return;
90315
+ const compiledDocument = applyProjectVersionWriteChanges(
90316
+ args.document,
90317
+ args.prepared
90318
+ );
90237
90319
  const existingValueById = new Map(
90238
90320
  args.document.values.map((value) => [value.id, value])
90239
90321
  );
@@ -91615,6 +91697,15 @@ function normalizeClientBindingMemberCreates(args) {
91615
91697
  };
91616
91698
  }
91617
91699
  }
91700
+ function stampsAbsentBindingMember(value, existingMemberIds) {
91701
+ const stamp = value.genericBindings;
91702
+ if (stamp === void 0 || stamp === null) return false;
91703
+ for (const bindingMemberId of Object.values(stamp)) {
91704
+ if (typeof bindingMemberId !== "string") continue;
91705
+ if (!existingMemberIds.has(bindingMemberId)) return true;
91706
+ }
91707
+ return false;
91708
+ }
91618
91709
  function materializeVariantChildOverrideBindingMembers(args) {
91619
91710
  normalizeClientBindingMemberCreates(args);
91620
91711
  const postDocument = applyProjectVersionWriteChanges(
@@ -91623,6 +91714,13 @@ function materializeVariantChildOverrideBindingMembers(args) {
91623
91714
  );
91624
91715
  const variants = postDocument.variants ?? [];
91625
91716
  if (variants.length === 0) return;
91717
+ const existingMemberIds = new Set(
91718
+ postDocument.members.map((member) => member.id)
91719
+ );
91720
+ const candidates = postDocument.values.filter(
91721
+ (value) => stampsAbsentBindingMember(value, existingMemberIds)
91722
+ );
91723
+ if (candidates.length === 0) return;
91626
91724
  const graphValueIds = collectVariantGraphValueIds({
91627
91725
  document: postDocument,
91628
91726
  variants,
@@ -91635,11 +91733,8 @@ function materializeVariantChildOverrideBindingMembers(args) {
91635
91733
  schemaClass2.id
91636
91734
  ])
91637
91735
  );
91638
- const existingMemberIds = new Set(
91639
- postDocument.members.map((member) => member.id)
91640
- );
91641
91736
  const minted = /* @__PURE__ */ new Set();
91642
- for (const value of postDocument.values) {
91737
+ for (const value of candidates) {
91643
91738
  if (!graphValueIds.has(value.id)) continue;
91644
91739
  const stamp = value.genericBindings;
91645
91740
  if (stamp === void 0 || stamp === null) continue;
@@ -93330,7 +93425,7 @@ function reconcileVariantConstructorArgs(args) {
93330
93425
  if (variants.length === 0) return;
93331
93426
  const valueById = indexRecordsById(postDocument.values);
93332
93427
  const classById = indexRecordsById(postDocument.classes);
93333
- const memberById = indexRecordsById(postDocument.members);
93428
+ const memberById2 = indexRecordsById(postDocument.members);
93334
93429
  const constructorById = indexRecordsById(postDocument.constructors ?? []);
93335
93430
  const changeIndexByValueId = indexChangesByRecordId(args.prepared, "value");
93336
93431
  let baseHashByValueId = null;
@@ -93362,7 +93457,7 @@ function reconcileVariantConstructorArgs(args) {
93362
93457
  );
93363
93458
  if (schemaKey === void 0) continue;
93364
93459
  const memberId = schemaClass2.schema[schemaKey];
93365
- const member = memberId === void 0 ? void 0 : memberById.get(memberId);
93460
+ const member = memberId === void 0 ? void 0 : memberById2.get(memberId);
93366
93461
  if (member === void 0) continue;
93367
93462
  const childId = root.value[schemaKey];
93368
93463
  if (typeof childId !== "string") continue;
@@ -93492,6 +93587,7 @@ var init_project_version_schema_commit = __esm({
93492
93587
  init_general_function_call_ir_source_recompile();
93493
93588
  init_projectDocumentDialogueMaterialization();
93494
93589
  init_project_version_transaction_types();
93590
+ init_project_version_relation_sweep_trigger();
93495
93591
  init_project_version_transaction_planning();
93496
93592
  init_project_version_static_value_writes();
93497
93593
  init_localizable_member_value_writes();
@@ -93532,7 +93628,7 @@ var init_project_version_schema_commit = __esm({
93532
93628
 
93533
93629
  // ../src/database/project-record-semantics.ts
93534
93630
  function projectRecordSemanticData(value) {
93535
- if (!isPlainRecord(value)) return value;
93631
+ if (!isPlainRecord2(value)) return value;
93536
93632
  const semantic = {};
93537
93633
  for (const [key, child] of Object.entries(value)) {
93538
93634
  if (SERVER_MANAGED_PROJECT_RECORD_FIELDS.has(key)) continue;
@@ -93569,7 +93665,7 @@ function toCanonicalJsonValue2(value) {
93569
93665
  if (Array.isArray(value)) {
93570
93666
  return value.map((item) => toCanonicalJsonValue2(item) ?? null);
93571
93667
  }
93572
- if (!isPlainRecord(value)) {
93668
+ if (!isPlainRecord2(value)) {
93573
93669
  throw new Error("Cannot canonicalize a non-plain object.");
93574
93670
  }
93575
93671
  const canonical = {};
@@ -93583,7 +93679,7 @@ function toCanonicalJsonValue2(value) {
93583
93679
  }
93584
93680
  return canonical;
93585
93681
  }
93586
- function isPlainRecord(value) {
93682
+ function isPlainRecord2(value) {
93587
93683
  if (value === null || typeof value !== "object") return false;
93588
93684
  const prototype = Object.getPrototypeOf(value);
93589
93685
  return prototype === Object.prototype || prototype === null;
@@ -93692,7 +93788,7 @@ function systemProtectedWriteInheritedRecordId(write) {
93692
93788
  if (write.baseData !== void 0) return null;
93693
93789
  if (write.deleted) return null;
93694
93790
  if (!isSystemBearingRecordKind(write.recordKind)) return null;
93695
- if (!isPlainRecord2(write.nextData)) return null;
93791
+ if (!isPlainRecord3(write.nextData)) return null;
93696
93792
  if (readSystemMetadata(write.nextData) === null) return null;
93697
93793
  const extendsMemberId = write.nextData.extendsMemberId;
93698
93794
  if (typeof extendsMemberId !== "string") return null;
@@ -93712,7 +93808,7 @@ function assertSystemProtectedRecordWriteValid(write) {
93712
93808
  assertSystemMetadataUnchanged(write, base);
93713
93809
  }
93714
93810
  function readBaseRecord(write) {
93715
- if (!isPlainRecord2(write.baseData)) return null;
93811
+ if (!isPlainRecord3(write.baseData)) return null;
93716
93812
  return {
93717
93813
  recordKind: write.recordKind,
93718
93814
  data: write.baseData,
@@ -93725,7 +93821,7 @@ function collectSystemBearingBaseRecords(document) {
93725
93821
  const stored = document[collection];
93726
93822
  if (!Array.isArray(stored)) continue;
93727
93823
  for (const record3 of stored) {
93728
- if (!isPlainRecord2(record3)) continue;
93824
+ if (!isPlainRecord3(record3)) continue;
93729
93825
  const id2 = record3.id;
93730
93826
  if (typeof id2 !== "string") continue;
93731
93827
  records2.set(baseKey(recordKind, id2), {
@@ -93739,7 +93835,7 @@ function collectSystemBearingBaseRecords(document) {
93739
93835
  }
93740
93836
  function assertCreateDeclaresNoSystemMetadata(write) {
93741
93837
  if (!isSystemBearingRecordKind(write.recordKind)) return;
93742
- if (!isPlainRecord2(write.nextData)) return;
93838
+ if (!isPlainRecord3(write.nextData)) return;
93743
93839
  const system = readSystemMetadata(write.nextData);
93744
93840
  if (system === null) return;
93745
93841
  if (inheritsLegacyEmittedSystemMetadata(write, system)) return;
@@ -93765,7 +93861,7 @@ function assertProtectedRecordNotEdited(change, base) {
93765
93861
  )) {
93766
93862
  return;
93767
93863
  }
93768
- if (!isPlainRecord2(change.nextData)) return;
93864
+ if (!isPlainRecord3(change.nextData)) return;
93769
93865
  if (authoredFieldsEqual(change.recordKind, base.data, change.nextData)) {
93770
93866
  return;
93771
93867
  }
@@ -93774,7 +93870,7 @@ function assertProtectedRecordNotEdited(change, base) {
93774
93870
  );
93775
93871
  }
93776
93872
  function assertSystemMetadataUnchanged(change, base) {
93777
- if (!isPlainRecord2(change.nextData)) return;
93873
+ if (!isPlainRecord3(change.nextData)) return;
93778
93874
  const next = readSystemMetadata(change.nextData);
93779
93875
  if (systemMetadataEqual(base.system, next)) return;
93780
93876
  throw new Error(
@@ -93822,10 +93918,10 @@ function repointedChildValueIds(document, change) {
93822
93918
  );
93823
93919
  if (baseValue === void 0) return [];
93824
93920
  const before = baseValue.value;
93825
- if (!isPlainRecord2(before)) return [];
93826
- if (!isPlainRecord2(change.nextData)) return [];
93921
+ if (!isPlainRecord3(before)) return [];
93922
+ if (!isPlainRecord3(change.nextData)) return [];
93827
93923
  const after = change.nextData.value;
93828
- if (!isPlainRecord2(after)) return [];
93924
+ if (!isPlainRecord3(after)) return [];
93829
93925
  return Object.entries(before).flatMap(([schemaKey, childValueId]) => {
93830
93926
  if (typeof childValueId !== "string") return [];
93831
93927
  if (after[schemaKey] === childValueId) return [];
@@ -93860,7 +93956,7 @@ function isSystemBearingRecordKind(recordKind) {
93860
93956
  );
93861
93957
  }
93862
93958
  function readSystemMetadata(record3) {
93863
- if (!isPlainRecord2(record3)) return null;
93959
+ if (!isPlainRecord3(record3)) return null;
93864
93960
  const system = record3.system;
93865
93961
  if (!isSystemMetadata(system)) return null;
93866
93962
  return system;
@@ -93879,11 +93975,11 @@ function systemReason(system) {
93879
93975
  return SYSTEM_PROTECTION_RULES[system.kind].serverReason;
93880
93976
  }
93881
93977
  function describeChangedRecord(recordKind, recordId, record3) {
93882
- const name = isPlainRecord2(record3) ? record3.name : void 0;
93978
+ const name = isPlainRecord3(record3) ? record3.name : void 0;
93883
93979
  if (typeof name !== "string") return `Record ${recordKind} "${recordId}"`;
93884
93980
  return `Record ${recordKind} "${name}" (${recordId})`;
93885
93981
  }
93886
- function isPlainRecord2(value) {
93982
+ function isPlainRecord3(value) {
93887
93983
  return typeof value === "object" && value !== null && !Array.isArray(value);
93888
93984
  }
93889
93985
  function baseKey(recordKind, recordId) {
@@ -93997,7 +94093,7 @@ function readWorldReferenceList(args) {
93997
94093
  args.keyCandidates
93998
94094
  );
93999
94095
  if (schemaKey === null) return [];
94000
- if (!isPlainRecord3(args.ownerValue.value)) return [];
94096
+ if (!isPlainRecord4(args.ownerValue.value)) return [];
94001
94097
  const listValueId = args.ownerValue.value[schemaKey];
94002
94098
  if (typeof listValueId !== "string") return [];
94003
94099
  const listValue2 = args.graph.valuesById.get(listValueId);
@@ -94063,18 +94159,18 @@ function worldReferenceClassInherits(graph, classId, ancestorClassId) {
94063
94159
  return false;
94064
94160
  }
94065
94161
  function toWorldReferenceClassRecord(value) {
94066
- if (!isPlainRecord3(value)) return null;
94162
+ if (!isPlainRecord4(value)) return null;
94067
94163
  const id2 = stringField2(value, "id");
94068
94164
  if (id2 === null) return null;
94069
94165
  return {
94070
94166
  id: id2,
94071
94167
  extendsClassId: nullableStringField(value, "extendsClassId"),
94072
94168
  schema: isStringRecord5(value.schema) ? value.schema : void 0,
94073
- system: isPlainRecord3(value.system) ? value.system : null
94169
+ system: isPlainRecord4(value.system) ? value.system : null
94074
94170
  };
94075
94171
  }
94076
94172
  function toWorldReferenceValueRecord(value) {
94077
- if (!isPlainRecord3(value)) return null;
94173
+ if (!isPlainRecord4(value)) return null;
94078
94174
  const id2 = stringField2(value, "id");
94079
94175
  if (id2 === null) return null;
94080
94176
  return {
@@ -94088,10 +94184,10 @@ function worldReferenceValueClassId(value) {
94088
94184
  return typeof value.classId === "string" && value.classId.length > 0 ? value.classId : null;
94089
94185
  }
94090
94186
  function isStringRecord5(value) {
94091
- if (!isPlainRecord3(value)) return false;
94187
+ if (!isPlainRecord4(value)) return false;
94092
94188
  return Object.values(value).every((entry) => typeof entry === "string");
94093
94189
  }
94094
- function isPlainRecord3(value) {
94190
+ function isPlainRecord4(value) {
94095
94191
  return typeof value === "object" && value !== null && !Array.isArray(value);
94096
94192
  }
94097
94193
  function stringField2(value, key) {
@@ -94390,31 +94486,6 @@ function assertStagedInternalRecordRelationsValid(current, projected, changes) {
94390
94486
  classes: projected.classes
94391
94487
  });
94392
94488
  }
94393
- function stagedChangesAffectClassRelations(current, changes) {
94394
- const classesById = new Map(
94395
- current.classes.map((schemaClass2) => [schemaClass2.id, schemaClass2])
94396
- );
94397
- const valuesById = new Map(current.values.map((value) => [value.id, value]));
94398
- for (const change of changes) {
94399
- if (change.recordKind === "internal-record-relation") return true;
94400
- if (change.recordKind === "class") {
94401
- if (change.operation !== "update") return true;
94402
- if (change.deleted === true) return true;
94403
- const before2 = classesById.get(change.recordId);
94404
- if (before2 === void 0) return true;
94405
- const after = change.nextData;
94406
- if (!isPlainRecord4(after)) return true;
94407
- if (before2.extendsClassId !== after.extendsClassId) return true;
94408
- continue;
94409
- }
94410
- if (change.recordKind !== "value") continue;
94411
- const before = valuesById.get(change.recordId);
94412
- if (relationEndpointClassId(before) !== relationEndpointClassId(change.nextData)) {
94413
- return true;
94414
- }
94415
- }
94416
- return false;
94417
- }
94418
94489
  function assertStagedWorldContentLayerBindingsValid(current, projected, changes) {
94419
94490
  if (!stagedChangesRequireWorldLayerBindingValidation(current, changes)) {
94420
94491
  return;
@@ -94461,7 +94532,7 @@ function stagedChangesRequireWorldLayerBindingValidation(current, changes) {
94461
94532
  const before = classesById.get(change.recordId);
94462
94533
  if (before === void 0) return true;
94463
94534
  const after = change.nextData;
94464
- if (!isPlainRecord4(after)) return true;
94535
+ if (!isPlainRecord(after)) return true;
94465
94536
  if (before.extendsClassId !== after.extendsClassId) return true;
94466
94537
  if (before.isAbstract !== after.isAbstract) return true;
94467
94538
  if (!worldClassSystemBlockIsEqual(before.system, after.system)) return true;
@@ -94512,7 +94583,7 @@ function stagedAffectedWorldLayerLinkClassIds(args) {
94512
94583
  change.nextData
94513
94584
  ];
94514
94585
  for (const candidate of candidates) {
94515
- if (!isPlainRecord4(candidate)) continue;
94586
+ if (!isPlainRecord(candidate)) continue;
94516
94587
  const relationKind = candidate.relationKind;
94517
94588
  if (typeof relationKind !== "string") continue;
94518
94589
  if (!isStagedWorldLayerLinkTargetRelationKind(relationKind)) continue;
@@ -94555,21 +94626,11 @@ function worldClassSystemBlockIsEqual(before, after) {
94555
94626
  );
94556
94627
  }
94557
94628
  function hasWorldLayerOverrideMetadata(record3) {
94558
- if (!isPlainRecord4(record3)) return false;
94629
+ if (!isPlainRecord(record3)) return false;
94559
94630
  const value = record3.value;
94560
- if (!isPlainRecord4(value)) return false;
94631
+ if (!isPlainRecord(value)) return false;
94561
94632
  return typeof value.layerOverrideValueId === "string";
94562
94633
  }
94563
- function relationEndpointClassId(record3) {
94564
- if (!isPlainRecord4(record3)) return void 0;
94565
- if (typeof record3.classId === "string") return record3.classId;
94566
- if (typeof record3.typeId === "string") return record3.typeId;
94567
- return void 0;
94568
- }
94569
- function isPlainRecord4(value) {
94570
- if (value === null || typeof value !== "object") return false;
94571
- return !Array.isArray(value);
94572
- }
94573
94634
  function assertStagedProjectInterfaceValid(projected, changes) {
94574
94635
  const relevant = changes.filter(
94575
94636
  (change) => INTERFACE_VALIDATED_RECORD_KINDS.has(change.recordKind)
@@ -94703,7 +94764,7 @@ function candidateActionListenerRowIds(projected, actions) {
94703
94764
  }
94704
94765
  if (actionSchemaKeys.size === 0) return candidates;
94705
94766
  for (const row of projected.values) {
94706
- if (!isPlainRecord4(row.value)) continue;
94767
+ if (!isPlainRecord(row.value)) continue;
94707
94768
  for (const schemaKey of actionSchemaKeys) {
94708
94769
  const childId = row.value[schemaKey];
94709
94770
  if (typeof childId === "string") candidates.add(childId);
@@ -94713,7 +94774,7 @@ function candidateActionListenerRowIds(projected, actions) {
94713
94774
  }
94714
94775
  function storedRowActionListeners(row) {
94715
94776
  const body = row.value;
94716
- if (!isPlainRecord4(body)) return [];
94777
+ if (!isPlainRecord(body)) return [];
94717
94778
  const listeners = body.listeners;
94718
94779
  return Array.isArray(listeners) ? listeners : [];
94719
94780
  }
@@ -94791,7 +94852,7 @@ function authoredActionListeners(action) {
94791
94852
  if (defaultValue === void 0 || defaultValue === null) return [];
94792
94853
  if (!isLiteralValueContent(defaultValue)) return [];
94793
94854
  const body = defaultValue.value;
94794
- if (!isPlainRecord4(body)) return [];
94855
+ if (!isPlainRecord(body)) return [];
94795
94856
  const listeners = body.listeners;
94796
94857
  return Array.isArray(listeners) ? listeners : [];
94797
94858
  }
@@ -95131,7 +95192,7 @@ function candidateVariantRowIds(projected, variantMembers) {
95131
95192
  }
95132
95193
  if (schemaKeys.size === 0) return candidates;
95133
95194
  for (const row of projected.values) {
95134
- if (!isPlainRecord4(row.value)) continue;
95195
+ if (!isPlainRecord(row.value)) continue;
95135
95196
  for (const schemaKey of schemaKeys) {
95136
95197
  const childId = row.value[schemaKey];
95137
95198
  if (typeof childId === "string") candidates.add(childId);
@@ -95168,6 +95229,7 @@ var init_project_version_whole_graph_validation = __esm({
95168
95229
  init_world_system_classes();
95169
95230
  init_project_world_reference_graph();
95170
95231
  init_project_record_semantics();
95232
+ init_project_version_relation_sweep_trigger();
95171
95233
  INTERFACE_VALIDATED_RECORD_KINDS = /* @__PURE__ */ new Set([
95172
95234
  "member",
95173
95235
  "class",
@@ -95187,6 +95249,52 @@ var init_project_version_whole_graph_validation = __esm({
95187
95249
  }
95188
95250
  });
95189
95251
 
95252
+ // src/project-source/value-base-desync.ts
95253
+ function unanchoredValueDeleteIds(args) {
95254
+ const { records: records2, deletedValueIds } = args;
95255
+ if (deletedValueIds.size === 0) return [];
95256
+ const anchored = /* @__PURE__ */ new Set();
95257
+ for (const [key, record3] of Object.entries(records2)) {
95258
+ collectAnchoredMentions(record3.data, key, deletedValueIds, anchored);
95259
+ }
95260
+ const unanchored = [];
95261
+ for (const id2 of deletedValueIds) {
95262
+ if (anchored.has(id2)) continue;
95263
+ const data = records2[recordStateKey("value", id2)]?.data;
95264
+ const containerId = isObjectRecord2(data) ? data.containerId : void 0;
95265
+ if (typeof containerId === "string" && records2[recordStateKey("value", containerId)] !== void 0) {
95266
+ continue;
95267
+ }
95268
+ unanchored.push(id2);
95269
+ }
95270
+ return unanchored;
95271
+ }
95272
+ function collectAnchoredMentions(value, mentioningKey, candidates, anchored) {
95273
+ if (typeof value === "string") {
95274
+ if (!candidates.has(value)) return;
95275
+ if (recordStateKey("value", value) === mentioningKey) return;
95276
+ anchored.add(value);
95277
+ return;
95278
+ }
95279
+ if (Array.isArray(value)) {
95280
+ for (const element of value) {
95281
+ collectAnchoredMentions(element, mentioningKey, candidates, anchored);
95282
+ }
95283
+ return;
95284
+ }
95285
+ if (!isObjectRecord2(value)) return;
95286
+ for (const nested of Object.values(value)) {
95287
+ collectAnchoredMentions(nested, mentioningKey, candidates, anchored);
95288
+ }
95289
+ }
95290
+ var init_value_base_desync = __esm({
95291
+ "src/project-source/value-base-desync.ts"() {
95292
+ "use strict";
95293
+ init_projection();
95294
+ init_workspace();
95295
+ }
95296
+ });
95297
+
95190
95298
  // src/project-source/workspace-status-core.ts
95191
95299
  function listVirtualProjectSourceFilesV4(files) {
95192
95300
  const selected = files.filter((file) => {
@@ -95256,6 +95364,7 @@ function computeWorkspaceStatus(workspace, options) {
95256
95364
  binaryFiles: []
95257
95365
  };
95258
95366
  }
95367
+ const loweringRecords = loweringBaseRecords(workspace.state.records);
95259
95368
  const baseDocuments = schemaBaseDocuments(workspace);
95260
95369
  const staticMemberOwnershipRecoveries = [];
95261
95370
  const baseManifest = baseDocuments.length === 0 ? void 0 : documentsToProjectSchemaManifest(baseDocuments, {
@@ -95323,7 +95432,7 @@ function computeWorkspaceStatus(workspace, options) {
95323
95432
  };
95324
95433
  }
95325
95434
  try {
95326
- validateProjectRootEnvelopeV4(workspace.state.records, analysis);
95435
+ validateProjectRootEnvelopeV4(loweringRecords, analysis);
95327
95436
  } catch (error) {
95328
95437
  const root = analysis.configuration.globals.find(
95329
95438
  (global) => global.type.name === "Root"
@@ -95348,20 +95457,15 @@ function computeWorkspaceStatus(workspace, options) {
95348
95457
  };
95349
95458
  }
95350
95459
  manifest = lowerProjectSchemaV4(baseManifest, analysis, {
95351
- staticValueIdsBySymbol: staticValueIdsBySymbol(workspace.state.records),
95352
- projectFileIdsBySymbol: projectFileIdsBySymbol(
95353
- workspace.state.records,
95354
- analysis
95355
- ),
95356
- rowBackedDefaultMemberIds: rowBackedDefaultMemberIdsV4(
95357
- workspace.state.records
95358
- ),
95460
+ staticValueIdsBySymbol: staticValueIdsBySymbol(loweringRecords),
95461
+ projectFileIdsBySymbol: projectFileIdsBySymbol(loweringRecords, analysis),
95462
+ rowBackedDefaultMemberIds: rowBackedDefaultMemberIdsV4(loweringRecords),
95359
95463
  rootValueTargetsByPath: rootValueTargetsByPath(
95360
- Object.values(workspace.state.records)
95464
+ Object.values(loweringRecords)
95361
95465
  )
95362
95466
  });
95363
95467
  memberDefaults = lowerMemberDefaultSourcesV4(
95364
- workspace.state.records,
95468
+ loweringRecords,
95365
95469
  analysis,
95366
95470
  manifest,
95367
95471
  { registry: valueLowerRegistry }
@@ -95439,7 +95543,7 @@ function computeWorkspaceStatus(workspace, options) {
95439
95543
  );
95440
95544
  }
95441
95545
  const staticValues = lowerStaticValueSourcesV4(
95442
- workspace.state.records,
95546
+ loweringRecords,
95443
95547
  projectAnalysisV4,
95444
95548
  manifest,
95445
95549
  { registry: valueLowerRegistry }
@@ -95450,7 +95554,7 @@ function computeWorkspaceStatus(workspace, options) {
95450
95554
  ]);
95451
95555
  staticMemberValueIds = staticValues.memberValueIds;
95452
95556
  const rootValues = lowerProjectRootSourceV4(
95453
- workspace.state.records,
95557
+ loweringRecords,
95454
95558
  projectAnalysisV4,
95455
95559
  manifest,
95456
95560
  { registry: valueLowerRegistry }
@@ -95458,7 +95562,7 @@ function computeWorkspaceStatus(workspace, options) {
95458
95562
  reportPhase("documents-static-root");
95459
95563
  authoredValueSeeds = new Map([...authoredValueSeeds, ...rootValues.seeds]);
95460
95564
  const rootPathResolutionState = overlayProspectiveSourceRecords(
95461
- workspace.state.records,
95565
+ loweringRecords,
95462
95566
  documents,
95463
95567
  [...staticValues.records, ...memberDefaults.records, ...rootValues.records],
95464
95568
  staticMemberValueIds
@@ -95586,18 +95690,18 @@ function computeWorkspaceStatus(workspace, options) {
95586
95690
  }
95587
95691
  const rootRecords = rootValues.records;
95588
95692
  const variantValues = lowerVariantValueSourcesV4(
95589
- workspace.state.records,
95693
+ loweringRecords,
95590
95694
  manifest,
95591
95695
  variantValueBindingsV4(manifest, projectAnalysisV4),
95592
95696
  { analysis: projectAnalysisV4, registry: valueLowerRegistry }
95593
95697
  );
95594
95698
  const supplementalRecords = options.lowerSupplementalRecords(
95595
- workspace.state.records,
95699
+ loweringRecords,
95596
95700
  projectAnalysisV4,
95597
95701
  options.trustedPendingProjectFiles
95598
95702
  );
95599
95703
  const prospectiveState = overlayProspectiveSourceRecords(
95600
- workspace.state.records,
95704
+ loweringRecords,
95601
95705
  documents,
95602
95706
  [
95603
95707
  ...staticValues.records,
@@ -95746,6 +95850,50 @@ function computeWorkspaceStatus(workspace, options) {
95746
95850
  binaryFiles: []
95747
95851
  };
95748
95852
  }
95853
+ const unanchoredValueDeletes = unanchoredValueDeleteIds({
95854
+ records: workspace.state.records,
95855
+ deletedValueIds
95856
+ });
95857
+ if (unanchoredValueDeletes.length > 0) {
95858
+ const mintedRowCount = valueLowerRegistry.pendingValues.size + authoredValueSeeds.size;
95859
+ const named = unanchoredValueDeletes.slice(0, 3).join(", ");
95860
+ const remainder = Math.max(0, unanchoredValueDeletes.length - 3);
95861
+ const sample = remainder === 0 ? named : `${named}, +${remainder} more`;
95862
+ const deleteFile = changes.find(
95863
+ (change) => change.kind === "delete" && change.recordKind === "value" && change.recordId === unanchoredValueDeletes[0]
95864
+ )?.file;
95865
+ if (mintedRowCount > 0) {
95866
+ parseErrors.push(
95867
+ new SchemaSourceError(
95868
+ `This push would delete ${unanchoredValueDeletes.length} value row(s) no record in the workspace base holds (${sample}) while minting ${mintedRowCount} replacement row(s): the workspace base disagrees with its own file projection \u2014 run "neo pull" before pushing.`,
95869
+ deleteFile ?? "<project>",
95870
+ 1,
95871
+ 1,
95872
+ "value-base-desync"
95873
+ )
95874
+ );
95875
+ return {
95876
+ changes: [],
95877
+ conflictedFiles,
95878
+ parseErrors,
95879
+ parseWarnings,
95880
+ reconstructed: /* @__PURE__ */ new Map(),
95881
+ authoredValueSeeds: /* @__PURE__ */ new Map(),
95882
+ binaryChanges: [],
95883
+ binaryFiles: []
95884
+ };
95885
+ }
95886
+ parseWarnings.push(
95887
+ new SchemaSourceError(
95888
+ `This push deletes ${unanchoredValueDeletes.length} value row(s) no record in the workspace base holds (${sample}): the workspace base disagrees with its own file projection \u2014 run "neo pull" before pushing.`,
95889
+ deleteFile ?? "<project>",
95890
+ 1,
95891
+ 1,
95892
+ "value-base-desync",
95893
+ "warning"
95894
+ )
95895
+ );
95896
+ }
95749
95897
  for (let index = changes.length - 1; index >= 0; index -= 1) {
95750
95898
  const change = changes[index];
95751
95899
  if (change === void 0 || change.kind !== "update") continue;
@@ -96088,7 +96236,7 @@ function replayAnimationDeclarationInitializersV4(records2, document, fallbackDo
96088
96236
  }
96089
96237
  function animationRecordsFromState(records2) {
96090
96238
  return Object.values(records2).flatMap((record3) => {
96091
- const data = record3.conflictServerHash !== void 0 && isObjectRecord2(record3.conflictServerData) ? record3.conflictServerData : record3.data;
96239
+ const data = effectiveRecordData(record3);
96092
96240
  return isObjectRecord2(data) ? [{ recordKind: record3.recordKind, data }] : [];
96093
96241
  });
96094
96242
  }
@@ -96231,7 +96379,7 @@ function recordLabel(data) {
96231
96379
  function prospectiveAnimationRecords(base, reconstructed3, changes, seeds) {
96232
96380
  const prospective = /* @__PURE__ */ new Map();
96233
96381
  for (const [key, state] of Object.entries(base)) {
96234
- const data = state.conflictServerHash !== void 0 && isObjectRecord2(state.conflictServerData) ? state.conflictServerData : state.data;
96382
+ const data = effectiveRecordData(state);
96235
96383
  if (isObjectRecord2(data)) {
96236
96384
  prospective.set(key, { recordKind: state.recordKind, data });
96237
96385
  }
@@ -96363,7 +96511,8 @@ function overlayProspectiveSourceRecords(base, schemaDocuments, authored, static
96363
96511
  for (const record3 of authored) {
96364
96512
  const key = recordStateKey(record3.recordKind, record3.recordId);
96365
96513
  const previous = result[key];
96366
- const previousData = previous?.conflictServerHash !== void 0 && isObjectRecord2(previous.conflictServerData) ? previous.conflictServerData : isObjectRecord2(previous?.data) ? previous.data : {};
96514
+ const effectivePrevious = previous === void 0 ? void 0 : effectiveRecordData(previous);
96515
+ const previousData = isObjectRecord2(effectivePrevious) ? effectivePrevious : {};
96367
96516
  put(record3.recordKind, record3.recordId, {
96368
96517
  ...previousData,
96369
96518
  ...record3.fileFields
@@ -96375,7 +96524,7 @@ function schemaBaseDocuments(workspace) {
96375
96524
  const records2 = [];
96376
96525
  for (const state of Object.values(workspace.state.records)) {
96377
96526
  if (!isSchemaRecordKindV4(state.recordKind)) continue;
96378
- const effectiveBase = state.conflictServerHash !== void 0 && isObjectRecord2(state.conflictServerData) ? state.conflictServerData : state.data;
96527
+ const effectiveBase = effectiveRecordData(state);
96379
96528
  if (!isObjectRecord2(effectiveBase)) {
96380
96529
  throw new Error(
96381
96530
  `Schema base ${state.recordKind}:${state.recordId} must contain an object document. Run \`neo pull --reset\` to repair the workspace state.`
@@ -96516,6 +96665,7 @@ var init_workspace_status_core = __esm({
96516
96665
  init_compile_ns_property();
96517
96666
  init_materialized_construction_cache();
96518
96667
  init_project_version_whole_graph_validation();
96668
+ init_value_base_desync();
96519
96669
  }
96520
96670
  });
96521
96671
 
@@ -98329,6 +98479,7 @@ function buildValueLowerContext(state, manifest, options = {}) {
98329
98479
  parsedInitializers,
98330
98480
  declaredInitializers: indexDeclaredInitializers(options.analysis),
98331
98481
  reconstructed: /* @__PURE__ */ new Map(),
98482
+ retainedReconstructedKeys: /* @__PURE__ */ new Set(),
98332
98483
  pendingValues: registry.pendingValues,
98333
98484
  pendingLocalizedTexts: registry.pendingLocalizedTexts,
98334
98485
  loweredMemberIdByValueId: /* @__PURE__ */ new Map(),
@@ -100803,10 +100954,16 @@ function lowerClassValue(context, member, expression, base, source, outerEnviron
100803
100954
  );
100804
100955
  }
100805
100956
  if (materializedConstruction !== "lower") {
100806
- for (const childId of Object.values(baseBody)) {
100807
- if (typeof childId === "string") {
100808
- retainStoredValueSubgraph(context, childId, source.source, /* @__PURE__ */ new Set());
100809
- }
100957
+ const storedMemberIds = storedClassSchemaMemberIds(context, currentClassId);
100958
+ for (const [schemaKey, childId] of Object.entries(baseBody)) {
100959
+ if (typeof childId !== "string") continue;
100960
+ retainStoredValueSubgraph(
100961
+ context,
100962
+ childId,
100963
+ source.source,
100964
+ /* @__PURE__ */ new Set(),
100965
+ memberById(context, storedMemberIds.get(schemaKey))
100966
+ );
100810
100967
  }
100811
100968
  if (materializedConstruction === "preserve" && isObjectRecord2(base.constructorArgs)) {
100812
100969
  const constructor2 = storedValueConstructor(
@@ -100814,12 +100971,25 @@ function lowerClassValue(context, member, expression, base, source, outerEnviron
100814
100971
  schemaClass2,
100815
100972
  base.constructorArgs
100816
100973
  );
100974
+ const authoredArguments = constructorArgumentExpressions(expression);
100817
100975
  for (let index = 0; index < constructor2.arguments.length; index += 1) {
100818
100976
  const argument2 = constructor2.arguments[index];
100977
+ if (argument2 === void 0) continue;
100819
100978
  const valueId = base.constructorArgs[`__arg_${index}__`];
100820
- if (argument2 !== void 0 && typeof valueId === "string" && constructorArgumentOwnsRow(argument2.type)) {
100821
- retainStoredValueSubgraph(context, valueId, source.source, /* @__PURE__ */ new Set());
100979
+ if (typeof valueId !== "string") continue;
100980
+ if (!constructorArgumentOwnsRow(
100981
+ argument2.type,
100982
+ authoredArguments.get(argument2.name)
100983
+ )) {
100984
+ continue;
100822
100985
  }
100986
+ retainStoredValueSubgraph(
100987
+ context,
100988
+ valueId,
100989
+ source.source,
100990
+ /* @__PURE__ */ new Set(),
100991
+ null
100992
+ );
100823
100993
  }
100824
100994
  }
100825
100995
  }
@@ -100829,45 +100999,106 @@ function lowerClassValue(context, member, expression, base, source, outerEnviron
100829
100999
  ...classId === currentClassId ? {} : { classId }
100830
101000
  };
100831
101001
  }
100832
- function constructorArgumentOwnsRow(type) {
100833
- return type.kind === "class" || type.kind === "interface" || type.kind === "generic" || type.kind === "list" || type.kind === "dictionary";
101002
+ function constructorArgumentOwnsRow(type, authoredArgument) {
101003
+ if (type.kind !== "class" && type.kind !== "interface" && type.kind !== "generic" && type.kind !== "list" && type.kind !== "dictionary") {
101004
+ return false;
101005
+ }
101006
+ return !namesExistingRow(authoredArgument);
101007
+ }
101008
+ function constructorArgumentExpressions(expression) {
101009
+ const byName = /* @__PURE__ */ new Map();
101010
+ const names = expression.argumentNames ?? [];
101011
+ for (const [index, argument2] of expression.args.entries()) {
101012
+ const name = names[index];
101013
+ if (typeof name !== "string") continue;
101014
+ if (byName.has(name)) continue;
101015
+ byName.set(name, argument2);
101016
+ }
101017
+ return byName;
100834
101018
  }
100835
- function retainStoredValueSubgraph(context, valueId, source, visited) {
101019
+ function namesExistingRow(expression) {
101020
+ if (expression === void 0) return false;
101021
+ const unwrapped = annotatedValue(expression).expression;
101022
+ if (unwrapped.kind !== "call") return false;
101023
+ if (unwrapped.callee.kind !== "ident") return false;
101024
+ return unwrapped.callee.name === "Reference";
101025
+ }
101026
+ function memberPointsAtForeignRows(member) {
101027
+ return member.kind === "lookup" || member.kind === "dialogueLookup";
101028
+ }
101029
+ function memberById(context, memberId) {
101030
+ if (memberId === void 0) return null;
101031
+ return context.members.get(memberId) ?? null;
101032
+ }
101033
+ function collectionEntryMember(context, member) {
101034
+ if (member === null) return null;
101035
+ if (member.kind !== "list" && member.kind !== "dictionary") return null;
101036
+ return memberById(context, member.entryMemberId);
101037
+ }
101038
+ function storedRowPlacementMember(context, valueId) {
101039
+ for (const placement of context.valuePlacements.placementsByValueId.get(
101040
+ valueId
101041
+ ) ?? []) {
101042
+ if (placement.containerClassId === null) continue;
101043
+ const memberId = storedClassSchemaMemberIds(
101044
+ context,
101045
+ placement.containerClassId
101046
+ ).get(placement.schemaKey);
101047
+ const member = memberById(context, memberId);
101048
+ if (member !== null) return member;
101049
+ }
101050
+ return null;
101051
+ }
101052
+ function retainStoredValueSubgraph(context, valueId, source, visited, member) {
100836
101053
  if (visited.has(valueId)) return;
100837
101054
  visited.add(valueId);
100838
101055
  const state = context.state[`value:${valueId}`];
100839
101056
  if (state === void 0 || !isObjectRecord2(state.data)) return;
100840
- const key = `value:${valueId}`;
100841
- if (!context.reconstructed.has(key)) {
100842
- addReconstructed(
100843
- context,
100844
- "value",
100845
- valueId,
100846
- valueFileFields(state.data),
100847
- source
100848
- );
100849
- }
100850
- const referenced = /* @__PURE__ */ new Set();
100851
- const collect = (value) => {
101057
+ addReconstructed(
101058
+ context,
101059
+ "value",
101060
+ valueId,
101061
+ valueFileFields(state.data),
101062
+ source,
101063
+ { retained: true }
101064
+ );
101065
+ const owningMember = member ?? storedRowPlacementMember(context, valueId);
101066
+ if (owningMember !== null && memberPointsAtForeignRows(owningMember)) return;
101067
+ const referenced = /* @__PURE__ */ new Map();
101068
+ const add = (id2, childMember) => {
101069
+ if (context.state[`value:${id2}`] === void 0) return;
101070
+ if (referenced.has(id2)) return;
101071
+ referenced.set(id2, childMember);
101072
+ };
101073
+ const collect = (value, childMember) => {
100852
101074
  if (typeof value === "string") {
100853
- if (context.state[`value:${value}`] !== void 0) referenced.add(value);
101075
+ add(value, childMember);
100854
101076
  return;
100855
101077
  }
100856
101078
  if (Array.isArray(value)) {
100857
- for (const entry of value) collect(entry);
101079
+ for (const entry of value) collect(entry, childMember);
100858
101080
  return;
100859
101081
  }
100860
101082
  if (!isObjectRecord2(value)) return;
100861
- for (const entry of Object.values(value)) collect(entry);
101083
+ for (const entry of Object.values(value)) collect(entry, childMember);
100862
101084
  };
100863
- collect(state.data.value);
101085
+ const body = state.data.value;
101086
+ const storedClassId = stringOrNull(state.data.classId);
101087
+ if (isObjectRecord2(body) && storedClassId !== null) {
101088
+ const storedMemberIds = storedClassSchemaMemberIds(context, storedClassId);
101089
+ for (const [schemaKey, child] of Object.entries(body)) {
101090
+ collect(child, memberById(context, storedMemberIds.get(schemaKey)));
101091
+ }
101092
+ } else {
101093
+ collect(body, collectionEntryMember(context, owningMember));
101094
+ }
100864
101095
  for (const childId of context.valuePlacements.valueIdsByContainerId.get(
100865
101096
  valueId
100866
101097
  ) ?? []) {
100867
- referenced.add(childId);
101098
+ add(childId, collectionEntryMember(context, owningMember));
100868
101099
  }
100869
- for (const childId of referenced) {
100870
- retainStoredValueSubgraph(context, childId, source, visited);
101100
+ for (const [childId, childMember] of referenced) {
101101
+ retainStoredValueSubgraph(context, childId, source, visited, childMember);
100871
101102
  }
100872
101103
  }
100873
101104
  function lowerConstructorProjections(context, schemaClass2, expression, base, baseBody, body, source, environment, authoredSlice) {
@@ -102322,7 +102553,7 @@ function dialogueTargetsBySymbol(analysis) {
102322
102553
  }
102323
102554
  function indexSourceStaticTargets(targets, state, analysis, manifest, parsedInitializers) {
102324
102555
  if (!analysis) return;
102325
- const memberById = new Map(
102556
+ const memberById2 = new Map(
102326
102557
  manifest.members.map((member) => [member.id, member])
102327
102558
  );
102328
102559
  for (let pass = 0; pass < 2; pass += 1) {
@@ -102339,7 +102570,7 @@ function indexSourceStaticTargets(targets, state, analysis, manifest, parsedInit
102339
102570
  if (declaration.kind !== "field" || declaration.initializer === null)
102340
102571
  continue;
102341
102572
  const memberId = sourceIdentityId(declaration, "member", symbol);
102342
- if (!memberById.has(memberId)) continue;
102573
+ if (!memberById2.has(memberId)) continue;
102343
102574
  const expression = parseCachedInitializer(
102344
102575
  parsedInitializers,
102345
102576
  declaration.initializer
@@ -102602,21 +102833,30 @@ function annotationId2(annotations) {
102602
102833
  }
102603
102834
  return value.value;
102604
102835
  }
102605
- function addReconstructed(context, recordKind, recordId, fileFields, source) {
102836
+ function addReconstructed(context, recordKind, recordId, fileFields, source, options = {}) {
102606
102837
  const key = `${recordKind}:${recordId}`;
102607
102838
  const existing = context.reconstructed.get(key);
102839
+ const line = source.range.start.line + 1;
102608
102840
  if (existing !== void 0) {
102609
- if (!canonicallyEqual(existing.fileFields, fileFields)) {
102610
- throw new Error(`Source reconstructs ${key} with different content.`);
102841
+ if (options.retained === true) return;
102842
+ if (context.retainedReconstructedKeys.has(key)) {
102843
+ context.retainedReconstructedKeys.delete(key);
102844
+ } else {
102845
+ if (!canonicallyEqual(existing.fileFields, fileFields)) {
102846
+ throw new Error(
102847
+ `Source reconstructs ${key} with different content: ${existing.file}:${existing.line} and ${source.uri}:${line} each lower this record from a different body.`
102848
+ );
102849
+ }
102850
+ return;
102611
102851
  }
102612
- return;
102613
102852
  }
102853
+ if (options.retained === true) context.retainedReconstructedKeys.add(key);
102614
102854
  context.reconstructed.set(key, {
102615
102855
  recordKind,
102616
102856
  recordId,
102617
102857
  fileFields,
102618
102858
  file: source.uri,
102619
- line: source.range.start.line + 1,
102859
+ line,
102620
102860
  sourceSpan: {
102621
102861
  path: source.uri,
102622
102862
  start: source.range.start,
@@ -109601,14 +109841,14 @@ function resolveNSFunctionReceiverValue(thisRef, target, document) {
109601
109841
  }
109602
109842
  function buildRootValue(document) {
109603
109843
  const rootValue = {};
109604
- const memberById = new Map(
109844
+ const memberById2 = new Map(
109605
109845
  document.members.map((entry) => [entry.id, entry])
109606
109846
  );
109607
109847
  const valueById = new Map(document.values.map((entry) => [entry.id, entry]));
109608
109848
  for (const { root, memberId } of projectRootMembersInDisplayOrder(
109609
109849
  document.project
109610
109850
  )) {
109611
- const member = memberById.get(memberId);
109851
+ const member = memberById2.get(memberId);
109612
109852
  const valueId = member !== void 0 && typeof member.valueId === "string" ? member.valueId : null;
109613
109853
  rootValue[root.key] = valueId !== null ? valueById.get(valueId)?.value ?? null : null;
109614
109854
  }
@@ -110328,7 +110568,7 @@ function neoScriptCheckErrorMessage(error) {
110328
110568
  function resolveLocalScriptMember(manifest, memberRef) {
110329
110569
  if (memberRef === null) return null;
110330
110570
  const scripted = manifest.members.filter(isLocalScriptMember);
110331
- const memberById = new Map(scripted.map((member2) => [member2.id, member2]));
110571
+ const memberById2 = new Map(scripted.map((member2) => [member2.id, member2]));
110332
110572
  const separator = memberRef.lastIndexOf(".");
110333
110573
  if (separator > 0 && separator < memberRef.length - 1) {
110334
110574
  const classRef = memberRef.slice(0, separator);
@@ -110351,7 +110591,7 @@ function resolveLocalScriptMember(manifest, memberRef) {
110351
110591
  while (!visited.has(current.id)) {
110352
110592
  visited.add(current.id);
110353
110593
  for (const [schemaKey, memberId] of Object.entries(current.schema)) {
110354
- const member2 = memberById.get(memberId);
110594
+ const member2 = memberById2.get(memberId);
110355
110595
  if (member2 !== void 0 && (schemaKey === memberName || localMemberMatchesMember(member2, memberName))) {
110356
110596
  return { member: member2, receiverClassId: receiver.id };
110357
110597
  }
@@ -112040,10 +112280,20 @@ async function downloadProjectVersionTransactionResult(args) {
112040
112280
  }
112041
112281
  changedRecords.push(...page.changedRecords);
112042
112282
  if (page.isDone) {
112283
+ if (args.status.totalChangeCount === null) {
112284
+ throw new Error(
112285
+ `Project transaction "${args.transactionId}" reported no total change count after committing; its result download cannot be checked for completeness.`
112286
+ );
112287
+ }
112288
+ if (changedRecords.length !== args.status.totalChangeCount) {
112289
+ throw new Error(
112290
+ `Project transaction "${args.transactionId}" committed ${args.status.totalChangeCount} changes but its result download returned ${changedRecords.length}.`
112291
+ );
112292
+ }
112043
112293
  return {
112044
112294
  kind: "committed",
112045
112295
  transactionId: args.transactionId,
112046
- totalChangeCount: args.status.totalChangeCount ?? changedRecords.length,
112296
+ totalChangeCount: args.status.totalChangeCount,
112047
112297
  totalChunkCount: args.status.totalChunkCount ?? 0,
112048
112298
  assignments,
112049
112299
  changedRecords
@@ -114336,7 +114586,7 @@ var init_registry2 = __esm({
114336
114586
  PROJECT_SCHEMA_CONTRACT = Object.freeze({
114337
114587
  formatVersion: 3,
114338
114588
  contractVersion: "3.14",
114339
- cliVersion: "0.36.9",
114589
+ cliVersion: "0.36.11",
114340
114590
  projectFileUploadBatchSize: 32,
114341
114591
  documentRecords: {
114342
114592
  member: {
@@ -118163,7 +118413,7 @@ async function runPendingMigrations(workspace, client, raw, migrations, onlyRef,
118163
118413
  }
118164
118414
  }
118165
118415
  }
118166
- const memberById = new Map(
118416
+ const memberById2 = new Map(
118167
118417
  document.members.map((member) => [member.id, member])
118168
118418
  );
118169
118419
  const valueById = new Map(
@@ -118234,7 +118484,7 @@ async function runPendingMigrations(workspace, client, raw, migrations, onlyRef,
118234
118484
  },
118235
118485
  null
118236
118486
  );
118237
- const instances = targetClassId === null ? [null] : collectClassInstances(document, targetClassId, memberById, valueById);
118487
+ const instances = targetClassId === null ? [null] : collectClassInstances(document, targetClassId, memberById2, valueById);
118238
118488
  let instanceEditCount = 0;
118239
118489
  for (const instance of instances) {
118240
118490
  let result;
@@ -118440,7 +118690,7 @@ async function runPendingMigrations(workspace, client, raw, migrations, onlyRef,
118440
118690
  `Applied ${pending.length} migration(s). Run "neo pull" to refresh the working copy.`
118441
118691
  );
118442
118692
  }
118443
- function collectClassInstances(document, targetClassId, memberById, valueById) {
118693
+ function collectClassInstances(document, targetClassId, memberById2, valueById) {
118444
118694
  const classById = new Map(
118445
118695
  document.classes.map((schemaClass2) => [schemaClass2.id, schemaClass2])
118446
118696
  );
@@ -118449,7 +118699,7 @@ function collectClassInstances(document, targetClassId, memberById, valueById) {
118449
118699
  const walk = (memberId, valueId) => {
118450
118700
  if (typeof valueId !== "string" || seen.has(valueId)) return;
118451
118701
  seen.add(valueId);
118452
- const member = typeof memberId === "string" ? memberById.get(memberId) : void 0;
118702
+ const member = typeof memberId === "string" ? memberById2.get(memberId) : void 0;
118453
118703
  const valueRecord = valueById.get(valueId);
118454
118704
  if (member === void 0 || valueRecord === void 0) return;
118455
118705
  const memberKind = member.kind;
@@ -119673,7 +119923,7 @@ function buildWorld(document, raw) {
119673
119923
  const valueById = new Map(
119674
119924
  document.values.map((value) => [String(value.id), value])
119675
119925
  );
119676
- const memberById = new Map(
119926
+ const memberById2 = new Map(
119677
119927
  document.members.map((member) => [String(member.id), member])
119678
119928
  );
119679
119929
  const saveOwned = /* @__PURE__ */ new Set();
@@ -119691,7 +119941,7 @@ function buildWorld(document, raw) {
119691
119941
  if (visitedPlacements.has(visitKey)) return;
119692
119942
  visitedPlacements.add(visitKey);
119693
119943
  const value = valueById.get(valueId);
119694
- const member = memberById.get(memberId);
119944
+ const member = memberById2.get(memberId);
119695
119945
  if (value === void 0 || member === void 0) return;
119696
119946
  const storage = storageResolver.effectiveStorageForPath(memberPath2);
119697
119947
  if (storage === "save" /* Save */) saveOwned.add(valueId);
@@ -119724,7 +119974,7 @@ function buildWorld(document, raw) {
119724
119974
  for (const { memberId } of projectRootMembersInDisplayOrder(
119725
119975
  document.project
119726
119976
  )) {
119727
- const member = memberById.get(memberId);
119977
+ const member = memberById2.get(memberId);
119728
119978
  if (member !== void 0 && typeof member.valueId === "string") {
119729
119979
  walkOwnedGraph([memberId], member.valueId);
119730
119980
  }
@@ -120652,7 +120902,7 @@ __export(resolve_exports, {
120652
120902
  import { readFileSync as readFileSync19, rmSync as rmSync8, writeFileSync as writeFileSync14 } from "node:fs";
120653
120903
  import { join as join21 } from "node:path";
120654
120904
  function runResolve(workspace, side) {
120655
- const resolvedRecords = acceptSourceEquivalentConflictBases(workspace);
120905
+ const resolvedRecords = adoptServerConflictBases(workspace);
120656
120906
  let resolvedFiles = 0;
120657
120907
  for (const filePath of listProjectSourceFilesV4(workspace.root)) {
120658
120908
  const source = readFileSync19(filePath, "utf8");
@@ -120697,6 +120947,22 @@ function runResolve(workspace, side) {
120697
120947
  `Resolved ${resolvedFiles} source file(s), ${resolvedRecords} record conflict(s), and ${resolvedBinaries} binary file(s) keeping the "${side}" side. Review with "neo diff", then "neo push".`
120698
120948
  );
120699
120949
  }
120950
+ function adoptServerConflictBases(workspace) {
120951
+ let adopted = 0;
120952
+ for (const [key, record3] of Object.entries(workspace.state.records)) {
120953
+ if (typeof record3.conflictServerHash !== "string") continue;
120954
+ const next = {
120955
+ ...record3,
120956
+ contentHash: record3.conflictServerHash,
120957
+ data: record3.conflictServerData
120958
+ };
120959
+ delete next.conflictServerHash;
120960
+ delete next.conflictServerData;
120961
+ workspace.state.records[key] = next;
120962
+ adopted += 1;
120963
+ }
120964
+ return adopted;
120965
+ }
120700
120966
  function resolveMarkers(source, side) {
120701
120967
  const lines = source.split("\n");
120702
120968
  const output = [];
@@ -120743,7 +121009,6 @@ var init_resolve = __esm({
120743
121009
  init_workspace_status();
120744
121010
  init_source_diagnostics();
120745
121011
  init_project_files();
120746
- init_source_record_comparison();
120747
121012
  }
120748
121013
  });
120749
121014
 
@@ -120940,7 +121205,7 @@ There is no --keep-current: preserving current semantic state defines flatten.
120940
121205
  async function main() {
120941
121206
  const args = parseArgs(process.argv.slice(2));
120942
121207
  if (args.command === "--version") {
120943
- console.log("0.36.9");
121208
+ console.log("0.36.11");
120944
121209
  return;
120945
121210
  }
120946
121211
  if (args.command === null || args.command === "help" || args.command === "--help" || args.command === "-h") {