@neocompose/cli 0.58.2 → 0.59.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/neo.mjs CHANGED
@@ -6424,10 +6424,10 @@ var init_strict_resolver = __esm({
6424
6424
  this.project = projectIndex ?? createProjectIndex(context.project);
6425
6425
  this.source = syntax?.source.text;
6426
6426
  this.sourceTokens = syntax?.roots;
6427
- const unknown2 = { kind: "primitive", name: "unknown" };
6427
+ const unknown = { kind: "primitive", name: "unknown" };
6428
6428
  this.thisVariable = variable(
6429
6429
  "__this__",
6430
- context.thisClass ?? unknown2,
6430
+ context.thisClass ?? unknown,
6431
6431
  void 0,
6432
6432
  this.project
6433
6433
  );
@@ -6436,7 +6436,7 @@ var init_strict_resolver = __esm({
6436
6436
  );
6437
6437
  this.rootVariable = variable(
6438
6438
  "__root__",
6439
- rootSymbol?.type ?? unknown2,
6439
+ rootSymbol?.type ?? unknown,
6440
6440
  void 0,
6441
6441
  this.project
6442
6442
  );
@@ -34352,13 +34352,13 @@ function spellingQuickFixes(document, diagnostic) {
34352
34352
  }
34353
34353
  function diagnosticMisspelling(diagnostic) {
34354
34354
  if (/to initialize\b/.test(diagnostic.message)) return null;
34355
- const unknown2 = /Unknown (identifier|function) '([^']+)'/.exec(
34355
+ const unknown = /Unknown (identifier|function) '([^']+)'/.exec(
34356
34356
  diagnostic.message
34357
34357
  );
34358
- if (unknown2?.[2]) {
34358
+ if (unknown?.[2]) {
34359
34359
  return {
34360
- name: unknown2[2],
34361
- kind: unknown2[1] === "function" ? "callable" : "value"
34360
+ name: unknown[2],
34361
+ kind: unknown[1] === "function" ? "callable" : "value"
34362
34362
  };
34363
34363
  }
34364
34364
  const member = /has no (?:static )?(?:callable )?member '([^']+)'/.exec(
@@ -35759,10 +35759,10 @@ function optionalTestConfig(value) {
35759
35759
  "maxWorkers",
35760
35760
  "forbidOnly"
35761
35761
  ]);
35762
- const unknown2 = Object.keys(config).find((key) => !allowed.has(key));
35763
- if (unknown2 !== void 0) {
35762
+ const unknown = Object.keys(config).find((key) => !allowed.has(key));
35763
+ if (unknown !== void 0) {
35764
35764
  throw new Error(
35765
- `"${NEO_CONFIG_FILE}" field "test.${unknown2}" is not recognized.`
35765
+ `"${NEO_CONFIG_FILE}" field "test.${unknown}" is not recognized.`
35766
35766
  );
35767
35767
  }
35768
35768
  const stringArray2 = (field) => {
@@ -41696,6 +41696,50 @@ var init_record_adapters = __esm({
41696
41696
  }
41697
41697
  });
41698
41698
 
41699
+ // ../packages/manifest/src/value-graph.ts
41700
+ function encodeStoredValueNode(node) {
41701
+ if (node.nodeType === "initializer") return { init: { code: node.code } };
41702
+ return {
41703
+ value: node.value,
41704
+ classId: node.classId,
41705
+ ...node.constructorArgs === void 0 ? {} : { constructorArgs: node.constructorArgs },
41706
+ ...node.instanceConstructorId === void 0 ? {} : { instanceConstructorId: node.instanceConstructorId },
41707
+ ...node.instanceVariantId === void 0 ? {} : { instanceVariantId: node.instanceVariantId },
41708
+ ...node.instanceVariantRowValueId === void 0 ? {} : { instanceVariantRowValueId: node.instanceVariantRowValueId }
41709
+ };
41710
+ }
41711
+ function encodeStoredValueRowFields(row) {
41712
+ return {
41713
+ ...encodeStoredValueNode(row),
41714
+ ...row.containerId === void 0 ? {} : { containerId: row.containerId },
41715
+ ...row.genericBindings === void 0 ? {} : { genericBindings: row.genericBindings },
41716
+ ...row.sourceValueId === void 0 ? {} : { sourceValueId: row.sourceValueId }
41717
+ };
41718
+ }
41719
+ function canonicalInstanceProvenanceViolation(value) {
41720
+ const constructorArgs = "constructorArgs" in value ? value.constructorArgs : void 0;
41721
+ const constructorId = "instanceConstructorId" in value ? value.instanceConstructorId : void 0;
41722
+ const variantId = "instanceVariantId" in value ? value.instanceVariantId : void 0;
41723
+ if (constructorArgs !== void 0 && constructorId === void 0 && typeof variantId !== "string") {
41724
+ return "constructor-args-without-stamp";
41725
+ }
41726
+ if (typeof constructorId === "string" && constructorArgs === void 0) {
41727
+ return "named-constructor-without-args";
41728
+ }
41729
+ if (constructorId === null && constructorArgs !== void 0 && typeof constructorArgs === "object" && constructorArgs !== null && !Array.isArray(constructorArgs) && Object.keys(constructorArgs).length > 0) {
41730
+ return "implicit-constructor-with-args";
41731
+ }
41732
+ if ("instanceVariantRowValueId" in value && typeof value.instanceVariantRowValueId === "string" && typeof variantId !== "string") {
41733
+ return "variant-row-without-variant";
41734
+ }
41735
+ return null;
41736
+ }
41737
+ var init_value_graph = __esm({
41738
+ "../packages/manifest/src/value-graph.ts"() {
41739
+ "use strict";
41740
+ }
41741
+ });
41742
+
41699
41743
  // node_modules/valibot/dist/index.mjs
41700
41744
  // @__NO_SIDE_EFFECTS__
41701
41745
  function getGlobalConfig(config$1) {
@@ -42408,23 +42452,6 @@ function union(options, message$1) {
42408
42452
  };
42409
42453
  }
42410
42454
  // @__NO_SIDE_EFFECTS__
42411
- function unknown() {
42412
- return {
42413
- kind: "schema",
42414
- type: "unknown",
42415
- reference: unknown,
42416
- expects: "unknown",
42417
- async: false,
42418
- get "~standard"() {
42419
- return /* @__PURE__ */ _getStandardProps(this);
42420
- },
42421
- "~run"(dataset) {
42422
- dataset.typed = true;
42423
- return dataset;
42424
- }
42425
- };
42426
- }
42427
- // @__NO_SIDE_EFFECTS__
42428
42455
  function variant(key, options, message$1) {
42429
42456
  return {
42430
42457
  kind: "schema",
@@ -42539,108 +42566,6 @@ var init_dist = __esm({
42539
42566
  }
42540
42567
  });
42541
42568
 
42542
- // ../packages/manifest/src/value-graph.ts
42543
- function encodeStoredValueNode(node) {
42544
- if (node.nodeType === "initializer") return { init: { code: node.code } };
42545
- return {
42546
- value: node.value,
42547
- classId: node.classId,
42548
- ...node.constructorArgs === void 0 ? {} : { constructorArgs: node.constructorArgs },
42549
- ...node.instanceConstructorId === void 0 ? {} : { instanceConstructorId: node.instanceConstructorId },
42550
- ...node.instanceVariantId === void 0 ? {} : { instanceVariantId: node.instanceVariantId },
42551
- ...node.instanceVariantRowValueId === void 0 ? {} : { instanceVariantRowValueId: node.instanceVariantRowValueId }
42552
- };
42553
- }
42554
- function encodeStoredValueRowFields(row) {
42555
- return {
42556
- ...encodeStoredValueNode(row),
42557
- ...row.containerId === void 0 ? {} : { containerId: row.containerId },
42558
- ...row.genericBindings === void 0 ? {} : { genericBindings: row.genericBindings },
42559
- ...row.sourceValueId === void 0 ? {} : { sourceValueId: row.sourceValueId }
42560
- };
42561
- }
42562
- function canonicalInstanceProvenanceViolation(value) {
42563
- const constructorArgs = "constructorArgs" in value ? value.constructorArgs : void 0;
42564
- const constructorId = "instanceConstructorId" in value ? value.instanceConstructorId : void 0;
42565
- const variantId = "instanceVariantId" in value ? value.instanceVariantId : void 0;
42566
- if (constructorArgs !== void 0 && constructorId === void 0 && typeof variantId !== "string") {
42567
- return "constructor-args-without-stamp";
42568
- }
42569
- if (typeof constructorId === "string" && constructorArgs === void 0) {
42570
- return "named-constructor-without-args";
42571
- }
42572
- if (constructorId === null && constructorArgs !== void 0 && typeof constructorArgs === "object" && constructorArgs !== null && !Array.isArray(constructorArgs) && Object.keys(constructorArgs).length > 0) {
42573
- return "implicit-constructor-with-args";
42574
- }
42575
- if ("instanceVariantRowValueId" in value && typeof value.instanceVariantRowValueId === "string" && typeof variantId !== "string") {
42576
- return "variant-row-without-variant";
42577
- }
42578
- return null;
42579
- }
42580
- var nonEmptyString, nullableId, optionalNullableId, stringMap, unknownMap, instanceProvenanceEntries, literalValueNodeEntries, initializerValueNodeEntries, literalValueNodeSchema, initializerValueNodeSchema, valueRowEntries, AuthoredValueRowSchema, valueSeedEntries, AuthoredValueSeedSchema, BindingMemberSchema, LocalizedTextSchema;
42581
- var init_value_graph = __esm({
42582
- "../packages/manifest/src/value-graph.ts"() {
42583
- "use strict";
42584
- init_dist();
42585
- nonEmptyString = pipe(string3(), nonEmpty());
42586
- nullableId = nullable(nonEmptyString);
42587
- optionalNullableId = optional(nullableId);
42588
- stringMap = record3(string3(), nonEmptyString);
42589
- unknownMap = record3(string3(), unknown());
42590
- instanceProvenanceEntries = {
42591
- constructorArgs: optional(unknownMap),
42592
- instanceConstructorId: optionalNullableId,
42593
- instanceVariantId: optionalNullableId,
42594
- instanceVariantRowValueId: optionalNullableId
42595
- };
42596
- literalValueNodeEntries = {
42597
- nodeType: literal2("literal"),
42598
- value: unknown(),
42599
- classId: nullable(string3()),
42600
- ...instanceProvenanceEntries
42601
- };
42602
- initializerValueNodeEntries = {
42603
- nodeType: literal2("initializer"),
42604
- code: nonEmptyString
42605
- };
42606
- literalValueNodeSchema = strictObject(literalValueNodeEntries);
42607
- initializerValueNodeSchema = strictObject(
42608
- initializerValueNodeEntries
42609
- );
42610
- valueRowEntries = {
42611
- id: nonEmptyString,
42612
- memberId: nonEmptyString,
42613
- containerId: optional(string3()),
42614
- genericBindings: optional(stringMap),
42615
- sourceValueId: optional(nonEmptyString)
42616
- };
42617
- AuthoredValueRowSchema = variant("nodeType", [
42618
- strictObject({ ...valueRowEntries, ...literalValueNodeEntries }),
42619
- strictObject({ ...valueRowEntries, ...initializerValueNodeEntries })
42620
- ]);
42621
- valueSeedEntries = {
42622
- memberId: nonEmptyString,
42623
- valueId: optional(nonEmptyString),
42624
- values: optional(unknown()),
42625
- bindingMembers: optional(unknown()),
42626
- localizedTexts: optional(unknown())
42627
- };
42628
- AuthoredValueSeedSchema = variant("nodeType", [
42629
- strictObject({ ...valueSeedEntries, ...literalValueNodeEntries }),
42630
- strictObject({ ...valueSeedEntries, ...initializerValueNodeEntries })
42631
- ]);
42632
- BindingMemberSchema = strictObject({
42633
- id: nonEmptyString,
42634
- classId: nonEmptyString
42635
- });
42636
- LocalizedTextSchema = strictObject({
42637
- id: nonEmptyString,
42638
- valueId: nonEmptyString,
42639
- value: string3()
42640
- });
42641
- }
42642
- });
42643
-
42644
42569
  // ../packages/manifest/src/schema-member.ts
42645
42570
  function jsonValueIssue(value, depth, path) {
42646
42571
  if (depth > 64) {
@@ -42728,34 +42653,34 @@ function schemaTypeOptionsAtDepth(depth) {
42728
42653
  nullable: boolean2()
42729
42654
  }),
42730
42655
  nullableTypeSchema("class", {
42731
- classId: nonEmptyString2,
42732
- classArguments: record3(nonEmptyString2, schemaTypeAtDepth(depth + 1))
42656
+ classId: nonEmptyString,
42657
+ classArguments: record3(nonEmptyString, schemaTypeAtDepth(depth + 1))
42733
42658
  }),
42734
42659
  nullableTypeSchema("interface", {
42735
- interfaceId: nonEmptyString2
42660
+ interfaceId: nonEmptyString
42736
42661
  }),
42737
42662
  nullableTypeSchema("generic", {
42738
- ownerClassId: nonEmptyString2,
42739
- genericParamId: nonEmptyString2
42663
+ ownerClassId: nonEmptyString,
42664
+ genericParamId: nonEmptyString
42740
42665
  }),
42741
42666
  nullableTypeSchema("enum", {
42742
- enumId: nonEmptyString2
42667
+ enumId: nonEmptyString
42743
42668
  }),
42744
42669
  nullableTypeSchema("list", {
42745
42670
  entryType: schemaTypeAtDepth(depth + 1),
42746
- listMemberId: nullableId2,
42671
+ listMemberId: nullableId,
42747
42672
  readOnly: boolean2()
42748
42673
  }),
42749
42674
  nullableTypeSchema("dictionary", {
42750
42675
  entryType: schemaTypeAtDepth(depth + 1),
42751
- keyEnumId: nullableId2,
42676
+ keyEnumId: nullableId,
42752
42677
  readOnly: boolean2()
42753
42678
  }),
42754
42679
  pipe(
42755
42680
  nullableTypeSchema("lookup", {
42756
42681
  entryType: schemaTypeAtDepth(depth + 1),
42757
- collectionMemberId: exactOptional(nonEmptyString2),
42758
- collectionValueId: exactOptional(nullableId2)
42682
+ collectionMemberId: exactOptional(nonEmptyString),
42683
+ collectionValueId: exactOptional(nullableId)
42759
42684
  }),
42760
42685
  check(
42761
42686
  (type) => type.collectionValueId == null || type.collectionMemberId !== void 0,
@@ -42968,14 +42893,14 @@ function assertMemberInvariants(member, path) {
42968
42893
  fail2("script", "is required for a concrete scripted member.");
42969
42894
  }
42970
42895
  }
42971
- var nonEmptyString2, nullableString2, nullableId2, finiteNumber, nullableNumber, nullableInteger, jsonValueSchema, schemaSourcePositionSchema, schemaSourceSpanSchema, schemaSourceSymbolKinds, schemaSourceIdentitySchema, memberSourceIdentitySchema, systemProtectionKindSchema, worldSystemClassKindSchema, schemaSystemMetadataSchema, schemaGenericBindingSchema, schemaGenericBindingRecordSchema, genericConstraintSchema, schemaGenericParameterSchema, primitiveTypeKinds, schemaTypeCache, returnTypeCache, schemaTypeSchema, schemaFunctionReturnTypeSchema, schemaParameterDefaultSchema, schemaFunctionArgumentSchema, memberOwnerSchema, schemaDefaultValueSchema, propertyScriptSchema, functionScriptSchema, commonMemberEntries, schemaMemberCommonSchema, simpleMemberSchemas, dictionaryKeySchema, schemaListIndexSchema, schemaListColumnSchema, callableEntries, schemaMemberSchema, SchemaMemberContractError;
42896
+ var nonEmptyString, nullableString2, nullableId, finiteNumber, nullableNumber, nullableInteger, jsonValueSchema, schemaSourcePositionSchema, schemaSourceSpanSchema, schemaSourceSymbolKinds, schemaSourceIdentitySchema, memberSourceIdentitySchema, systemProtectionKindSchema, worldSystemClassKindSchema, schemaSystemMetadataSchema, schemaGenericBindingSchema, schemaGenericBindingRecordSchema, genericConstraintSchema, schemaGenericParameterSchema, primitiveTypeKinds, schemaTypeCache, returnTypeCache, schemaTypeSchema, schemaFunctionReturnTypeSchema, schemaParameterDefaultSchema, schemaFunctionArgumentSchema, memberOwnerSchema, schemaDefaultValueSchema, propertyScriptSchema, functionScriptSchema, commonMemberEntries, schemaMemberCommonSchema, simpleMemberSchemas, dictionaryKeySchema, schemaListIndexSchema, schemaListColumnSchema, callableEntries, schemaMemberSchema, SchemaMemberContractError;
42972
42897
  var init_schema_member = __esm({
42973
42898
  "../packages/manifest/src/schema-member.ts"() {
42974
42899
  "use strict";
42975
42900
  init_dist();
42976
- nonEmptyString2 = pipe(string3(), nonEmpty());
42901
+ nonEmptyString = pipe(string3(), nonEmpty());
42977
42902
  nullableString2 = nullable(string3());
42978
- nullableId2 = nullable(nonEmptyString2);
42903
+ nullableId = nullable(nonEmptyString);
42979
42904
  finiteNumber = pipe(number(), finite());
42980
42905
  nullableNumber = nullable(finiteNumber);
42981
42906
  nullableInteger = nullable(
@@ -42994,7 +42919,7 @@ var init_schema_member = __esm({
42994
42919
  });
42995
42920
  schemaSourceSpanSchema = pipe(
42996
42921
  strictObject({
42997
- path: nonEmptyString2,
42922
+ path: nonEmptyString,
42998
42923
  start: schemaSourcePositionSchema,
42999
42924
  end: schemaSourcePositionSchema
43000
42925
  }),
@@ -43041,13 +42966,13 @@ var init_schema_member = __esm({
43041
42966
  "variantFolder"
43042
42967
  ];
43043
42968
  schemaSourceIdentitySchema = strictObject({
43044
- symbolId: nonEmptyString2,
42969
+ symbolId: nonEmptyString,
43045
42970
  kind: picklist(schemaSourceSymbolKinds),
43046
42971
  span: schemaSourceSpanSchema,
43047
42972
  selectionSpan: schemaSourceSpanSchema
43048
42973
  });
43049
42974
  memberSourceIdentitySchema = strictObject({
43050
- symbolId: nonEmptyString2,
42975
+ symbolId: nonEmptyString,
43051
42976
  kind: literal2("member"),
43052
42977
  span: schemaSourceSpanSchema,
43053
42978
  selectionSpan: schemaSourceSpanSchema
@@ -43102,25 +43027,25 @@ var init_schema_member = __esm({
43102
43027
  schemaGenericBindingSchema = variant("kind", [
43103
43028
  strictObject({
43104
43029
  kind: literal2("generic"),
43105
- genericParamId: nonEmptyString2
43030
+ genericParamId: nonEmptyString
43106
43031
  }),
43107
- strictObject({ kind: literal2("member"), memberId: nonEmptyString2 })
43032
+ strictObject({ kind: literal2("member"), memberId: nonEmptyString })
43108
43033
  ]);
43109
43034
  schemaGenericBindingRecordSchema = record3(
43110
- nonEmptyString2,
43035
+ nonEmptyString,
43111
43036
  schemaGenericBindingSchema
43112
43037
  );
43113
43038
  genericConstraintSchema = variant("kind", [
43114
43039
  strictObject({
43115
43040
  kind: literal2("class"),
43116
- classId: nonEmptyString2,
43041
+ classId: nonEmptyString,
43117
43042
  classArguments: optional(nullable(schemaGenericBindingRecordSchema))
43118
43043
  }),
43119
- strictObject({ kind: literal2("enum"), enumId: nonEmptyString2 })
43044
+ strictObject({ kind: literal2("enum"), enumId: nonEmptyString })
43120
43045
  ]);
43121
43046
  schemaGenericParameterSchema = strictObject({
43122
- id: nonEmptyString2,
43123
- name: nonEmptyString2,
43047
+ id: nonEmptyString,
43048
+ name: nonEmptyString,
43124
43049
  constraint: nullable(genericConstraintSchema),
43125
43050
  source: schemaSourceSpanSchema,
43126
43051
  selectionSpan: schemaSourceSpanSchema
@@ -43150,7 +43075,7 @@ var init_schema_member = __esm({
43150
43075
  source: schemaSourceSpanSchema
43151
43076
  });
43152
43077
  schemaFunctionArgumentSchema = strictObject({
43153
- name: nonEmptyString2,
43078
+ name: nonEmptyString,
43154
43079
  type: schemaTypeSchema,
43155
43080
  default: nullable(schemaParameterDefaultSchema),
43156
43081
  source: schemaSourceSpanSchema,
@@ -43159,41 +43084,41 @@ var init_schema_member = __esm({
43159
43084
  memberOwnerSchema = variant("kind", [
43160
43085
  strictObject({
43161
43086
  kind: literal2("classMember"),
43162
- classId: nonEmptyString2,
43163
- schemaKey: nonEmptyString2
43087
+ classId: nonEmptyString,
43088
+ schemaKey: nonEmptyString
43164
43089
  }),
43165
43090
  strictObject({
43166
43091
  kind: literal2("sharedClassMember"),
43167
43092
  members: pipe(
43168
43093
  array2(
43169
- strictObject({ classId: nonEmptyString2, schemaKey: nonEmptyString2 })
43094
+ strictObject({ classId: nonEmptyString, schemaKey: nonEmptyString })
43170
43095
  ),
43171
43096
  minLength(2, "Must contain at least two shared declarations.")
43172
43097
  )
43173
43098
  }),
43174
43099
  strictObject({
43175
43100
  kind: literal2("collectionEntry"),
43176
- parentMemberId: nonEmptyString2
43101
+ parentMemberId: nonEmptyString
43177
43102
  }),
43178
43103
  strictObject({
43179
43104
  kind: literal2("sharedCollectionEntry"),
43180
43105
  parentMemberIds: pipe(
43181
- array2(nonEmptyString2),
43106
+ array2(nonEmptyString),
43182
43107
  minLength(2, "Must contain at least two shared collections.")
43183
43108
  )
43184
43109
  }),
43185
43110
  strictObject({
43186
43111
  kind: literal2("genericArgument"),
43187
- parentRecordId: nonEmptyString2,
43188
- genericParamId: nonEmptyString2
43112
+ parentRecordId: nonEmptyString,
43113
+ genericParamId: nonEmptyString
43189
43114
  }),
43190
43115
  strictObject({
43191
43116
  kind: literal2("sharedGenericArgument"),
43192
43117
  bindings: pipe(
43193
43118
  array2(
43194
43119
  strictObject({
43195
- parentRecordId: nonEmptyString2,
43196
- genericParamId: nonEmptyString2
43120
+ parentRecordId: nonEmptyString,
43121
+ genericParamId: nonEmptyString
43197
43122
  })
43198
43123
  ),
43199
43124
  minLength(2, "Must contain at least two shared bindings.")
@@ -43202,17 +43127,17 @@ var init_schema_member = __esm({
43202
43127
  strictObject({ kind: literal2("loose") })
43203
43128
  ]);
43204
43129
  schemaDefaultValueSchema = union([
43205
- strictObject({ serverValueId: nonEmptyString2 }),
43206
- strictObject({ init: strictObject({ code: nonEmptyString2 }) }),
43207
- strictObject({ value: jsonValueSchema, classId: nullableId2 })
43130
+ strictObject({ serverValueId: nonEmptyString }),
43131
+ strictObject({ init: strictObject({ code: nonEmptyString }) }),
43132
+ strictObject({ value: jsonValueSchema, classId: nullableId })
43208
43133
  ]);
43209
43134
  propertyScriptSchema = pipe(
43210
43135
  strictObject({
43211
43136
  kind: literal2("property"),
43212
- path: nonEmptyString2,
43137
+ path: nonEmptyString,
43213
43138
  sourceText: string3(),
43214
43139
  source: schemaSourceSpanSchema,
43215
- getterSource: nonEmptyString2,
43140
+ getterSource: nonEmptyString,
43216
43141
  setterSource: nullableString2
43217
43142
  }),
43218
43143
  forward(
@@ -43226,7 +43151,7 @@ var init_schema_member = __esm({
43226
43151
  functionScriptSchema = pipe(
43227
43152
  strictObject({
43228
43153
  kind: literal2("function"),
43229
- path: nonEmptyString2,
43154
+ path: nonEmptyString,
43230
43155
  sourceText: string3(),
43231
43156
  source: schemaSourceSpanSchema
43232
43157
  }),
@@ -43239,10 +43164,10 @@ var init_schema_member = __esm({
43239
43164
  )
43240
43165
  );
43241
43166
  commonMemberEntries = {
43242
- id: nonEmptyString2,
43167
+ id: nonEmptyString,
43243
43168
  source: memberSourceIdentitySchema,
43244
43169
  owner: memberOwnerSchema,
43245
- name: nonEmptyString2,
43170
+ name: nonEmptyString,
43246
43171
  docsText: optional(string3()),
43247
43172
  isReadOnly: boolean2(),
43248
43173
  accessModifier: picklist(["public", "protected", "private"]),
@@ -43257,11 +43182,11 @@ var init_schema_member = __esm({
43257
43182
  ]),
43258
43183
  required: boolean2(),
43259
43184
  defaultValue: nullable(schemaDefaultValueSchema),
43260
- overrideOf: nullableId2,
43185
+ overrideOf: nullableId,
43261
43186
  system: nullable(schemaSystemMetadataSchema),
43262
43187
  storage: nullable(picklist(["immutable", "save", "session", "writable"])),
43263
43188
  distribution: nullable(picklist(["sparse", "packed"])),
43264
- storageKey: nullableId2
43189
+ storageKey: nullableId
43265
43190
  };
43266
43191
  schemaMemberCommonSchema = strictObject(commonMemberEntries);
43267
43192
  simpleMemberSchemas = [
@@ -43276,14 +43201,14 @@ var init_schema_member = __esm({
43276
43201
  ];
43277
43202
  dictionaryKeySchema = variant("kind", [
43278
43203
  strictObject({ kind: literal2("string") }),
43279
- strictObject({ kind: literal2("enum"), enumId: nonEmptyString2 })
43204
+ strictObject({ kind: literal2("enum"), enumId: nonEmptyString })
43280
43205
  ]);
43281
43206
  schemaListIndexSchema = strictObject({
43282
- schemaKey: nonEmptyString2,
43207
+ schemaKey: nonEmptyString,
43283
43208
  unique: boolean2()
43284
43209
  });
43285
43210
  schemaListColumnSchema = strictObject({
43286
- memberKey: nonEmptyString2,
43211
+ memberKey: nonEmptyString,
43287
43212
  width: nullableNumber,
43288
43213
  hidden: boolean2(),
43289
43214
  frozen: boolean2(),
@@ -43314,33 +43239,33 @@ var init_schema_member = __esm({
43314
43239
  decimalPoints: nullableInteger
43315
43240
  }),
43316
43241
  memberSchema("dictionary", {
43317
- entryMemberId: nonEmptyString2,
43242
+ entryMemberId: nonEmptyString,
43318
43243
  key: dictionaryKeySchema
43319
43244
  }),
43320
43245
  memberSchema("list", {
43321
- entryMemberId: nonEmptyString2,
43246
+ entryMemberId: nonEmptyString,
43322
43247
  listKind: picklist(["ordered", "unordered"]),
43323
43248
  indexes: array2(schemaListIndexSchema),
43324
43249
  columns: array2(schemaListColumnSchema)
43325
43250
  }),
43326
43251
  memberSchema("class", {
43327
- classId: nonEmptyString2,
43252
+ classId: nonEmptyString,
43328
43253
  partial: optional(boolean2()),
43329
- schemaKeyOrder: nullable(array2(nonEmptyString2)),
43254
+ schemaKeyOrder: nullable(array2(nonEmptyString)),
43330
43255
  classArguments: schemaGenericBindingRecordSchema
43331
43256
  }),
43332
43257
  memberSchema("enum", {
43333
- enumId: nonEmptyString2,
43258
+ enumId: nonEmptyString,
43334
43259
  multiselect: boolean2()
43335
43260
  }),
43336
43261
  memberSchema("lookup", {
43337
- collectionMemberId: nonEmptyString2,
43338
- collectionValueId: nullableId2,
43262
+ collectionMemberId: nonEmptyString,
43263
+ collectionValueId: nullableId,
43339
43264
  multiselect: boolean2(),
43340
43265
  declaredType: nullable(schemaTypeSchema)
43341
43266
  }),
43342
43267
  memberSchema("dialogueLookup", {
43343
- dialogueGroupId: nullableId2,
43268
+ dialogueGroupId: nullableId,
43344
43269
  multiselect: boolean2()
43345
43270
  }),
43346
43271
  memberSchema("computed", {
@@ -43348,10 +43273,10 @@ var init_schema_member = __esm({
43348
43273
  script: nullable(propertyScriptSchema)
43349
43274
  }),
43350
43275
  memberSchema("sprite", {
43351
- templateId: nullableId2
43276
+ templateId: nullableId
43352
43277
  }),
43353
43278
  memberSchema("audio", {
43354
- templateId: nullableId2
43279
+ templateId: nullableId
43355
43280
  }),
43356
43281
  memberSchema("function", {
43357
43282
  ...callableEntries,
@@ -43382,7 +43307,7 @@ var init_schema_member = __esm({
43382
43307
  valueType: nullable(schemaTypeSchema)
43383
43308
  }),
43384
43309
  memberSchema("generic", {
43385
- genericParamId: nonEmptyString2,
43310
+ genericParamId: nonEmptyString,
43386
43311
  partial: optional(boolean2())
43387
43312
  })
43388
43313
  ]);
@@ -43441,7 +43366,7 @@ function assertProjectSchemaManifest(value) {
43441
43366
  "localizationStatuses",
43442
43367
  "internalRecordRelations"
43443
43368
  ]);
43444
- nonEmptyString3(manifest.namespace, "$.namespace");
43369
+ nonEmptyString2(manifest.namespace, "$.namespace");
43445
43370
  arrayOf(manifest.classes, "$.classes", assertNeoSchemaClass);
43446
43371
  arrayOf(manifest.constructors, "$.constructors", assertConstructor2);
43447
43372
  arrayOf(manifest.variants, "$.variants", assertVariant);
@@ -43515,7 +43440,7 @@ function assertConstructorInvariants(manifest) {
43515
43440
  const requiredConstructorId2 = schemaClass2.requiredConstructorId;
43516
43441
  if (requiredConstructorId2 === void 0) return;
43517
43442
  const path = `$.classes[${index}].requiredConstructorId`;
43518
- nonEmptyString3(requiredConstructorId2, path);
43443
+ nonEmptyString2(requiredConstructorId2, path);
43519
43444
  const id2 = String(requiredConstructorId2);
43520
43445
  if (listedIds.has(id2)) {
43521
43446
  invalid(path, `constructor ${JSON.stringify(id2)} is already owned.`);
@@ -43551,7 +43476,7 @@ function assertConstructorInvariants(manifest) {
43551
43476
  schemaClass2.constructorIds,
43552
43477
  `$.classes[${index}].constructorIds`
43553
43478
  ).map((entry, entryIndex) => {
43554
- nonEmptyString3(
43479
+ nonEmptyString2(
43555
43480
  entry,
43556
43481
  `$.classes[${index}].constructorIds[${entryIndex}]`
43557
43482
  );
@@ -43593,7 +43518,7 @@ function assertConstructor2(value, path) {
43593
43518
  );
43594
43519
  assertIdentity2(declared, path, "constructor");
43595
43520
  assertOptionalDocsText2(declared.docsText, `${path}.docsText`);
43596
- nonEmptyString3(declared.classId, `${path}.classId`);
43521
+ nonEmptyString2(declared.classId, `${path}.classId`);
43597
43522
  arrayOf(declared.arguments, `${path}.arguments`, assertFunctionArgument);
43598
43523
  if (declared.code !== null && typeof declared.code !== "string") {
43599
43524
  invalid(
@@ -43639,11 +43564,11 @@ function assertVariant(value, path) {
43639
43564
  "valueId"
43640
43565
  ]);
43641
43566
  assertIdentity2(variant2, path, "variant");
43642
- nonEmptyString3(variant2.classId, `${path}.classId`);
43643
- nonEmptyString3(variant2.name, `${path}.name`);
43644
- nonEmptyString3(variant2.valueId, `${path}.valueId`);
43567
+ nonEmptyString2(variant2.classId, `${path}.classId`);
43568
+ nonEmptyString2(variant2.name, `${path}.name`);
43569
+ nonEmptyString2(variant2.valueId, `${path}.valueId`);
43645
43570
  if (variant2.folderId === null) return;
43646
- nonEmptyString3(variant2.folderId, `${path}.folderId`);
43571
+ nonEmptyString2(variant2.folderId, `${path}.folderId`);
43647
43572
  }
43648
43573
  function assertVariantFolder(value, path) {
43649
43574
  const folder = objectAt(value, path, [
@@ -43654,30 +43579,30 @@ function assertVariantFolder(value, path) {
43654
43579
  "binding"
43655
43580
  ]);
43656
43581
  assertIdentity2(folder, path, "variantFolder");
43657
- nonEmptyString3(folder.classId, `${path}.classId`);
43582
+ nonEmptyString2(folder.classId, `${path}.classId`);
43658
43583
  if (typeof folder.path !== "string")
43659
43584
  invalid(`${path}.path`, "must be a string.");
43660
43585
  if (folder.binding === null) {
43661
- nonEmptyString3(folder.path, `${path}.path`);
43586
+ nonEmptyString2(folder.path, `${path}.path`);
43662
43587
  return;
43663
43588
  }
43664
43589
  const binding = objectAt(folder.binding, `${path}.binding`, [
43665
43590
  "collectionMemberId",
43666
43591
  "collectionValueId"
43667
43592
  ]);
43668
- nonEmptyString3(
43593
+ nonEmptyString2(
43669
43594
  binding.collectionMemberId,
43670
43595
  `${path}.binding.collectionMemberId`
43671
43596
  );
43672
- nonEmptyString3(
43597
+ nonEmptyString2(
43673
43598
  binding.collectionValueId,
43674
43599
  `${path}.binding.collectionValueId`
43675
43600
  );
43676
43601
  }
43677
43602
  function assertConstructorBaseArgument(value, path) {
43678
43603
  const argument2 = objectAt(value, path, ["name", "code"]);
43679
- nonEmptyString3(argument2.name, `${path}.name`);
43680
- nonEmptyString3(argument2.code, `${path}.code`);
43604
+ nonEmptyString2(argument2.name, `${path}.name`);
43605
+ nonEmptyString2(argument2.code, `${path}.code`);
43681
43606
  }
43682
43607
  function assertInternalRecordRelation(value, path) {
43683
43608
  const relation = objectAt(value, path, [
@@ -43690,13 +43615,13 @@ function assertInternalRecordRelation(value, path) {
43690
43615
  "targetRecordId",
43691
43616
  "order"
43692
43617
  ]);
43693
- nonEmptyString3(relation.id, `${path}.id`);
43618
+ nonEmptyString2(relation.id, `${path}.id`);
43694
43619
  assertSourceIdentity(relation.source, `${path}.source`);
43695
- nonEmptyString3(relation.relationKind, `${path}.relationKind`);
43620
+ nonEmptyString2(relation.relationKind, `${path}.relationKind`);
43696
43621
  projectRecordKind2(relation.sourceRecordKind, `${path}.sourceRecordKind`);
43697
- nonEmptyString3(relation.sourceRecordId, `${path}.sourceRecordId`);
43622
+ nonEmptyString2(relation.sourceRecordId, `${path}.sourceRecordId`);
43698
43623
  projectRecordKind2(relation.targetRecordKind, `${path}.targetRecordKind`);
43699
- nonEmptyString3(relation.targetRecordId, `${path}.targetRecordId`);
43624
+ nonEmptyString2(relation.targetRecordId, `${path}.targetRecordId`);
43700
43625
  if (relation.order !== null && (typeof relation.order !== "number" || !Number.isInteger(relation.order) || relation.order < 0)) {
43701
43626
  invalid(`${path}.order`, "expected null or a non-negative integer.");
43702
43627
  }
@@ -44002,8 +43927,8 @@ function assertStaticMemberInvariants(manifest) {
44002
43927
  `static member ${JSON.stringify(memberName)} (${memberId}) has owner kind ${JSON.stringify(ownerKind)}; expected exactly one direct Class owner.`
44003
43928
  );
44004
43929
  }
44005
- const ownerClassId = nonEmptyString3(owner.classId, `${path}.owner.classId`);
44006
- const schemaKey = nonEmptyString3(
43930
+ const ownerClassId = nonEmptyString2(owner.classId, `${path}.owner.classId`);
43931
+ const schemaKey = nonEmptyString2(
44007
43932
  owner.schemaKey,
44008
43933
  `${path}.owner.schemaKey`
44009
43934
  );
@@ -44201,7 +44126,7 @@ function assertStaticMemberInvariants(manifest) {
44201
44126
  }
44202
44127
  }
44203
44128
  function assertIdentity2(value, path, expectedKind) {
44204
- nonEmptyString3(value.id, `${path}.id`);
44129
+ nonEmptyString2(value.id, `${path}.id`);
44205
44130
  assertSourceIdentity(value.source, `${path}.source`, expectedKind);
44206
44131
  }
44207
44132
  function assertSourceIdentity(value, path, expectedKind) {
@@ -44247,7 +44172,7 @@ function assertNeoSchemaClass(value, path) {
44247
44172
  ]
44248
44173
  );
44249
44174
  assertIdentity2(type, path, "class");
44250
- nonEmptyString3(type.name, `${path}.name`);
44175
+ nonEmptyString2(type.name, `${path}.name`);
44251
44176
  assertOptionalDocsText2(type.docsText, `${path}.docsText`);
44252
44177
  stringIn(
44253
44178
  type.declarationModifier,
@@ -44275,7 +44200,7 @@ function assertNeoSchemaClass(value, path) {
44275
44200
  );
44276
44201
  nullableNonEmptyString(type.targetMemberId, `${path}.targetMemberId`);
44277
44202
  if (type.requiredConstructorId !== void 0) {
44278
- nonEmptyString3(type.requiredConstructorId, `${path}.requiredConstructorId`);
44203
+ nonEmptyString2(type.requiredConstructorId, `${path}.requiredConstructorId`);
44279
44204
  }
44280
44205
  }
44281
44206
  function assertGenericParameter(value, path) {
@@ -44309,7 +44234,7 @@ function assertInterface(value, path) {
44309
44234
  ["docsText"]
44310
44235
  );
44311
44236
  assertIdentity2(neoInterface, path, "interface");
44312
- nonEmptyString3(neoInterface.name, `${path}.name`);
44237
+ nonEmptyString2(neoInterface.name, `${path}.name`);
44313
44238
  assertOptionalDocsText2(neoInterface.docsText, `${path}.docsText`);
44314
44239
  arrayOf(neoInterface.members, `${path}.members`, assertInterfaceMember);
44315
44240
  stringArray(neoInterface.extendsInterfaceIds, `${path}.extendsInterfaceIds`);
@@ -44324,8 +44249,8 @@ function assertInterfaceMember(value, path) {
44324
44249
  ["id", "kind", "name", "type", "settable", "accessModifier", "source"],
44325
44250
  ["docsText"]
44326
44251
  );
44327
- nonEmptyString3(member.id, `${path}.id`);
44328
- nonEmptyString3(member.name, `${path}.name`);
44252
+ nonEmptyString2(member.id, `${path}.id`);
44253
+ nonEmptyString2(member.name, `${path}.name`);
44329
44254
  assertOptionalDocsText2(member.docsText, `${path}.docsText`);
44330
44255
  assertType2(member.type, `${path}.type`);
44331
44256
  booleanAt(member.settable, `${path}.settable`);
@@ -44349,8 +44274,8 @@ function assertInterfaceMember(value, path) {
44349
44274
  ],
44350
44275
  ["docsText"]
44351
44276
  );
44352
- nonEmptyString3(member.id, `${path}.id`);
44353
- nonEmptyString3(member.name, `${path}.name`);
44277
+ nonEmptyString2(member.id, `${path}.id`);
44278
+ nonEmptyString2(member.name, `${path}.name`);
44354
44279
  assertOptionalDocsText2(member.docsText, `${path}.docsText`);
44355
44280
  assertFunctionSignature(member, path);
44356
44281
  assertInterfaceMemberAccessModifier(member.accessModifier, path);
@@ -44370,7 +44295,7 @@ function assertEnum2(value, path) {
44370
44295
  ["docsText"]
44371
44296
  );
44372
44297
  assertIdentity2(neoEnum, path, "enum");
44373
- nonEmptyString3(neoEnum.name, `${path}.name`);
44298
+ nonEmptyString2(neoEnum.name, `${path}.name`);
44374
44299
  assertOptionalDocsText2(neoEnum.docsText, `${path}.docsText`);
44375
44300
  arrayOf(neoEnum.options, `${path}.options`, assertEnumOption);
44376
44301
  assertSystem(neoEnum.system, `${path}.system`);
@@ -44378,7 +44303,7 @@ function assertEnum2(value, path) {
44378
44303
  const options = requireArray(neoEnum.options, `${path}.options`);
44379
44304
  options.forEach((entry, index) => {
44380
44305
  const option = requireRecord(entry, `${path}.options[${index}]`);
44381
- const key = nonEmptyString3(option.key, `${path}.options[${index}].key`);
44306
+ const key = nonEmptyString2(option.key, `${path}.options[${index}].key`);
44382
44307
  if (seen.has(key))
44383
44308
  invalid(`${path}.options[${index}].key`, "is duplicated.");
44384
44309
  seen.add(key);
@@ -44391,9 +44316,9 @@ function assertEnumOption(value, path) {
44391
44316
  ["id", "name", "key", "text", "source"],
44392
44317
  ["docsText"]
44393
44318
  );
44394
- nonEmptyString3(option.id, `${path}.id`);
44395
- nonEmptyString3(option.name, `${path}.name`);
44396
- nonEmptyString3(option.key, `${path}.key`);
44319
+ nonEmptyString2(option.id, `${path}.id`);
44320
+ nonEmptyString2(option.name, `${path}.name`);
44321
+ nonEmptyString2(option.key, `${path}.key`);
44397
44322
  stringAt(option.text, `${path}.text`);
44398
44323
  assertOptionalDocsText2(option.docsText, `${path}.docsText`);
44399
44324
  assertSourceIdentity(option.source, `${path}.source`, "enumOption");
@@ -44439,7 +44364,7 @@ function assertTextureTemplate(value, path) {
44439
44364
  "swizzle"
44440
44365
  ]);
44441
44366
  assertIdentity2(texture, path, "textureTemplate");
44442
- nonEmptyString3(texture.name, `${path}.name`);
44367
+ nonEmptyString2(texture.name, `${path}.name`);
44443
44368
  exactValue(texture.type, "texture-2d", `${path}.type`);
44444
44369
  stringIn(texture.textureType, TEXTURE_TYPES, `${path}.textureType`);
44445
44370
  exactValue(texture.textureShape, "2d", `${path}.textureShape`);
@@ -44684,7 +44609,7 @@ function assertAudioTemplate(value, path) {
44684
44609
  "preloadAudioData"
44685
44610
  ]);
44686
44611
  assertIdentity2(audio, path, "audioTemplate");
44687
- nonEmptyString3(audio.name, `${path}.name`);
44612
+ nonEmptyString2(audio.name, `${path}.name`);
44688
44613
  for (const field of [
44689
44614
  "forceToMono",
44690
44615
  "normalize",
@@ -44726,14 +44651,14 @@ function assertLocalization(value, path) {
44726
44651
  "mainLocaleDefaultStatusId"
44727
44652
  ]);
44728
44653
  assertIdentity2(localization, path, "localization");
44729
- nonEmptyString3(localization.mainLocale, `${path}.mainLocale`);
44654
+ nonEmptyString2(localization.mainLocale, `${path}.mainLocale`);
44730
44655
  arrayOf(
44731
44656
  localization.supportedLocales,
44732
44657
  `${path}.supportedLocales`,
44733
44658
  assertLocale
44734
44659
  );
44735
44660
  stringArray(localization.sortedStatusIds, `${path}.sortedStatusIds`);
44736
- nonEmptyString3(
44661
+ nonEmptyString2(
44737
44662
  localization.mainLocaleDefaultStatusId,
44738
44663
  `${path}.mainLocaleDefaultStatusId`
44739
44664
  );
@@ -44754,8 +44679,8 @@ function assertLocalizationStatus(value, path) {
44754
44679
  "system"
44755
44680
  ]);
44756
44681
  assertIdentity2(status, path, "localizationStatus");
44757
- nonEmptyString3(status.slug, `${path}.slug`);
44758
- nonEmptyString3(status.name, `${path}.name`);
44682
+ nonEmptyString2(status.slug, `${path}.slug`);
44683
+ nonEmptyString2(status.name, `${path}.name`);
44759
44684
  nullableString3(status.description, `${path}.description`);
44760
44685
  nullableString3(status.color, `${path}.color`);
44761
44686
  nullableString3(status.emoji, `${path}.emoji`);
@@ -44781,7 +44706,7 @@ function assertLocale(value, path) {
44781
44706
  "sortOrder",
44782
44707
  "archivedAt"
44783
44708
  ]);
44784
- nonEmptyString3(locale.locale, `${path}.locale`);
44709
+ nonEmptyString2(locale.locale, `${path}.locale`);
44785
44710
  nullableNonEmptyString(locale.sourceLocale, `${path}.sourceLocale`);
44786
44711
  nullableString3(locale.name, `${path}.name`);
44787
44712
  finiteNumber2(locale.sortOrder, `${path}.sortOrder`);
@@ -44846,7 +44771,7 @@ function requireArray(value, path) {
44846
44771
  }
44847
44772
  function stringArray(value, path) {
44848
44773
  arrayOf(value, path, (entry, entryPath) => {
44849
- nonEmptyString3(entry, entryPath);
44774
+ nonEmptyString2(entry, entryPath);
44850
44775
  });
44851
44776
  }
44852
44777
  function nullableStringArray(value, path) {
@@ -44856,8 +44781,8 @@ function nullableStringArray(value, path) {
44856
44781
  function stringRecord(value, path) {
44857
44782
  const record6 = requireRecord(value, path);
44858
44783
  for (const [key, entry] of Object.entries(record6)) {
44859
- nonEmptyString3(key, `${path} key`);
44860
- nonEmptyString3(entry, `${path}.${key}`);
44784
+ nonEmptyString2(key, `${path} key`);
44785
+ nonEmptyString2(entry, `${path}.${key}`);
44861
44786
  }
44862
44787
  }
44863
44788
  function uniqueIds(value, path) {
@@ -44865,7 +44790,7 @@ function uniqueIds(value, path) {
44865
44790
  const seen = /* @__PURE__ */ new Set();
44866
44791
  records2.forEach((entry, index) => {
44867
44792
  const record6 = requireRecord(entry, `${path}[${index}]`);
44868
- const id2 = nonEmptyString3(record6.id, `${path}[${index}].id`);
44793
+ const id2 = nonEmptyString2(record6.id, `${path}[${index}].id`);
44869
44794
  if (seen.has(id2))
44870
44795
  invalid(`${path}[${index}].id`, `duplicates id ${JSON.stringify(id2)}.`);
44871
44796
  seen.add(id2);
@@ -44875,7 +44800,7 @@ function nullableObject(value, path, assertion) {
44875
44800
  if (value === null) return;
44876
44801
  assertion(value, path);
44877
44802
  }
44878
- function nonEmptyString3(value, path) {
44803
+ function nonEmptyString2(value, path) {
44879
44804
  const result = stringAt(value, path);
44880
44805
  if (result.length === 0) invalid(path, "must not be empty.");
44881
44806
  return result;
@@ -44901,7 +44826,7 @@ function nullableString3(value, path) {
44901
44826
  }
44902
44827
  function nullableNonEmptyString(value, path) {
44903
44828
  if (value === null) return;
44904
- nonEmptyString3(value, path);
44829
+ nonEmptyString2(value, path);
44905
44830
  }
44906
44831
  function finiteNumber2(value, path) {
44907
44832
  if (typeof value !== "number" || !Number.isFinite(value)) {
@@ -57976,12 +57901,12 @@ function lowerStructuredLeafComponents(kind, label, expression, lowering) {
57976
57901
  function structuredLeafPartialAssignments(kind, label, value, emit) {
57977
57902
  const stored = value[STRUCTURED_LEAF_PARTIAL_KEY];
57978
57903
  const declared = structuredLeafFields(kind);
57979
- const unknown2 = Object.keys(stored).find(
57904
+ const unknown = Object.keys(stored).find(
57980
57905
  (key) => !declared.some((entry) => entry.key === key)
57981
57906
  );
57982
- if (unknown2 !== void 0) {
57907
+ if (unknown !== void 0) {
57983
57908
  throw new Error(
57984
- `${label} stores unknown field ${JSON.stringify(unknown2)}. ${structuredLeafTypeName(kind)} accepts ${structuredLeafFieldNames(kind).join(", ")}.`
57909
+ `${label} stores unknown field ${JSON.stringify(unknown)}. ${structuredLeafTypeName(kind)} accepts ${structuredLeafFieldNames(kind).join(", ")}.`
57985
57910
  );
57986
57911
  }
57987
57912
  const assignments = [];
@@ -86570,6 +86495,54 @@ var init_materialize_values = __esm({
86570
86495
  }
86571
86496
  });
86572
86497
 
86498
+ // ../convex/convexValues.ts
86499
+ function decodeConvexOpaqueJson(value, context) {
86500
+ if (typeof value !== "string") {
86501
+ throw new Error(`${context} must be an encoded JSON string.`);
86502
+ }
86503
+ try {
86504
+ return JSON.parse(value);
86505
+ } catch (error) {
86506
+ const message = error instanceof Error ? error.message : String(error);
86507
+ throw new Error(`${context} could not be parsed as JSON: ${message}`);
86508
+ }
86509
+ }
86510
+ var CONVEX_DOCUMENT_WARNING_BYTES, CONVEX_DOCUMENT_MAX_BYTES;
86511
+ var init_convexValues = __esm({
86512
+ "../convex/convexValues.ts"() {
86513
+ "use strict";
86514
+ CONVEX_DOCUMENT_WARNING_BYTES = 750 * 1024;
86515
+ CONVEX_DOCUMENT_MAX_BYTES = 1024 * 1024;
86516
+ }
86517
+ });
86518
+
86519
+ // ../convex/projectRecordSnapshotStorage.ts
86520
+ function decodeProjectRecordSnapshotData(snapshot, context = `Project record snapshot for ${snapshot.recordKind} "${snapshot.recordId}" dataJson`) {
86521
+ const decoded = decodeConvexOpaqueJson(snapshot.dataJson, context);
86522
+ if (!isPlainRecord(decoded)) return decoded;
86523
+ const hydratedData = { ...decoded };
86524
+ if (snapshot.recordKind === "enum" && !Object.hasOwn(hydratedData, "optionKeyOrder") && isPlainRecord(hydratedData.options)) {
86525
+ hydratedData.optionKeyOrder = Object.keys(hydratedData.options);
86526
+ }
86527
+ hydratedData.id = snapshot.recordId;
86528
+ if (snapshot.recordKind !== "project") {
86529
+ hydratedData.projectId = snapshot.projectId;
86530
+ }
86531
+ if (!Object.hasOwn(hydratedData, "updatedAt")) {
86532
+ hydratedData.updatedAt = snapshot.createdAt;
86533
+ }
86534
+ return hydratedData;
86535
+ }
86536
+ function isPlainRecord(value) {
86537
+ return typeof value === "object" && value !== null && !Array.isArray(value);
86538
+ }
86539
+ var init_projectRecordSnapshotStorage = __esm({
86540
+ "../convex/projectRecordSnapshotStorage.ts"() {
86541
+ "use strict";
86542
+ init_convexValues();
86543
+ }
86544
+ });
86545
+
86573
86546
  // ../src/database/project-read-base.ts
86574
86547
  import { ConvexError } from "convex/values";
86575
86548
  function readProjectReadBase(value) {
@@ -86887,6 +86860,7 @@ var project_document_read_exports = {};
86887
86860
  __export(project_document_read_exports, {
86888
86861
  DOCUMENT_MANIFEST_PAGE_SIZE: () => DOCUMENT_MANIFEST_PAGE_SIZE,
86889
86862
  assembleProjectDocumentRaw: () => assembleProjectDocumentRaw,
86863
+ createDocumentPageReader: () => createDocumentPageReader,
86890
86864
  fetchProjectDocumentPartitionRecords: () => fetchProjectDocumentPartitionRecords,
86891
86865
  fetchProjectDocumentRawChunked: () => fetchProjectDocumentRawChunked,
86892
86866
  fetchProjectDocumentRawChunkedOnce: () => fetchProjectDocumentRawChunkedOnce,
@@ -86944,46 +86918,14 @@ async function fetchProjectDocumentRawChunkedOnce(runner, options = {}) {
86944
86918
  };
86945
86919
  try {
86946
86920
  await rememberRecords(firstPage);
86947
- const fetchRemainingPages = async (mapKey, initialCursor) => {
86948
- let cursor = initialCursor;
86949
- while (cursor !== null) {
86950
- const pageResult = await runner.fetchPage(
86951
- {
86952
- numItems: DOCUMENT_MANIFEST_PAGE_SIZE,
86953
- cursor
86954
- },
86955
- mapKey,
86956
- readBase
86957
- );
86958
- if (pageResult === null) {
86959
- throw new Error(
86960
- "Convex project document manifest returned null for a continuation page."
86961
- );
86962
- }
86963
- const page = readProjectDocumentPage(pageResult);
86964
- assertProjectReadBase(readBase, page.readBase);
86965
- await rememberRecords(page);
86966
- cursor = page.continueCursor;
86967
- }
86968
- };
86969
- await fetchRemainingPages(firstMapKey, firstPage.continueCursor);
86970
- for (const mapKey of mapKeys.slice(1)) {
86971
- const pageResult = await runner.fetchPage(
86972
- { numItems: DOCUMENT_MANIFEST_PAGE_SIZE, cursor: null },
86973
- mapKey,
86974
- readBase,
86975
- "omit"
86976
- );
86977
- if (pageResult === null) {
86978
- throw new Error(
86979
- `Convex project document manifest returned null for partition "${mapKey ?? "all"}".`
86980
- );
86981
- }
86982
- const page = readProjectDocumentPage(pageResult);
86983
- assertProjectReadBase(readBase, page.readBase);
86984
- await rememberRecords(page);
86985
- await fetchRemainingPages(mapKey, page.continueCursor);
86986
- }
86921
+ const pages = createDocumentPageReader(runner, firstPage.readConcurrency);
86922
+ await drainDocumentReads([
86923
+ pages.remaining(firstPage, firstMapKey, readBase, rememberRecords),
86924
+ ...mapKeys.slice(1).map(async (mapKey) => {
86925
+ const page = await pages.first(mapKey, readBase, rememberRecords);
86926
+ await pages.remaining(page, mapKey, readBase, rememberRecords);
86927
+ })
86928
+ ]);
86987
86929
  const snapshotsById = await snapshots.finish();
86988
86930
  if (options.mapKeys !== void 0 && !options.mapKeys.includes("all")) {
86989
86931
  const members = [];
@@ -87043,28 +86985,15 @@ async function fetchProjectDocumentPartitionRecords(runner, mapKey, readBase) {
87043
86985
  (ids) => fetchScopedSnapshotBatch(runner, ids, readBase)
87044
86986
  );
87045
86987
  try {
87046
- let cursor = null;
87047
- do {
87048
- const pageResult = await runner.fetchPage(
87049
- { numItems: DOCUMENT_MANIFEST_PAGE_SIZE, cursor },
87050
- mapKey,
87051
- readBase,
87052
- "omit"
87053
- );
87054
- if (pageResult === null) {
87055
- throw new Error(
87056
- `Convex project document manifest returned null for partition "${mapKey}".`
87057
- );
87058
- }
87059
- const page = readProjectDocumentPage(pageResult);
87060
- assertProjectReadBase(readBase, page.readBase);
87061
- for (const record6 of page.records) {
86988
+ const pages = createDocumentPageReader(runner);
86989
+ const remember = async (page) => {
86990
+ for (const record6 of page.records)
87062
86991
  recordsByKey.set(`${record6.recordKind} ${record6.recordId}`, record6);
87063
- }
87064
86992
  if (page.snapshots !== void 0) snapshots.seed(page.snapshots);
87065
86993
  await snapshots.enqueue(page.records.map((record6) => record6.snapshotId));
87066
- cursor = page.continueCursor;
87067
- } while (cursor !== null);
86994
+ };
86995
+ const first = await pages.first(mapKey, readBase, remember);
86996
+ await pages.remaining(first, mapKey, readBase, remember);
87068
86997
  const snapshotsById = await snapshots.finish();
87069
86998
  await runner.validateReadBase(readBase);
87070
86999
  return [...recordsByKey.values()].map((record6) => {
@@ -87086,6 +87015,84 @@ async function fetchProjectDocumentPartitionRecords(runner, mapKey, readBase) {
87086
87015
  await snapshots.stop();
87087
87016
  }
87088
87017
  }
87018
+ function createDocumentPageReader(runner, concurrency) {
87019
+ let active = 0;
87020
+ let nextWaiter = 0;
87021
+ let waiters = [];
87022
+ let failure;
87023
+ const readPage = async (pagination, mapKey, readBase, remember) => {
87024
+ if (active >= (concurrency ?? 1))
87025
+ await new Promise((resolve5) => waiters.push(resolve5));
87026
+ else active++;
87027
+ try {
87028
+ if (failure !== void 0) throw failure.error;
87029
+ const raw = await runner.fetchPage(pagination, mapKey, readBase, "omit");
87030
+ if (raw === null)
87031
+ throw new Error(
87032
+ `Missing document page for partition "${mapKey ?? "all"}".`
87033
+ );
87034
+ const page = readProjectDocumentPage(raw);
87035
+ assertProjectReadBase(readBase, page.readBase);
87036
+ concurrency ??= page.readConcurrency ?? 1;
87037
+ if (pagination.cursor !== null && page.continueCursor === pagination.cursor)
87038
+ throw new Error("Document continuation made no progress.");
87039
+ if (pagination.endCursor != null && page.continueCursor === null)
87040
+ throw new Error("Document range ended before its endpoint.");
87041
+ await remember(page, pagination.cursor);
87042
+ return page;
87043
+ } catch (error) {
87044
+ failure ??= { error };
87045
+ throw error;
87046
+ } finally {
87047
+ const next = waiters[nextWaiter++];
87048
+ if (next !== void 0) next();
87049
+ else {
87050
+ active--;
87051
+ nextWaiter = 0;
87052
+ waiters = [];
87053
+ }
87054
+ }
87055
+ };
87056
+ return {
87057
+ first(mapKey, readBase, remember) {
87058
+ return readPage(
87059
+ { numItems: DOCUMENT_MANIFEST_PAGE_SIZE, cursor: null },
87060
+ mapKey,
87061
+ readBase,
87062
+ remember
87063
+ );
87064
+ },
87065
+ async remaining(first, mapKey, readBase, remember) {
87066
+ if (first.continueCursor === null) return;
87067
+ const ranges = first.remainingRanges ?? [
87068
+ { cursor: first.continueCursor, endCursor: null }
87069
+ ];
87070
+ await drainDocumentReads(
87071
+ ranges.map(async (range2) => {
87072
+ let cursor = range2.cursor;
87073
+ while (cursor !== null && cursor !== range2.endCursor) {
87074
+ const page = await readPage(
87075
+ {
87076
+ numItems: DOCUMENT_MANIFEST_PAGE_SIZE,
87077
+ cursor,
87078
+ endCursor: range2.endCursor
87079
+ },
87080
+ mapKey,
87081
+ readBase,
87082
+ remember
87083
+ );
87084
+ cursor = page.continueCursor;
87085
+ }
87086
+ })
87087
+ );
87088
+ }
87089
+ };
87090
+ }
87091
+ async function drainDocumentReads(reads) {
87092
+ const results = await Promise.allSettled(reads);
87093
+ for (const result of results)
87094
+ if (result.status === "rejected") throw result.reason;
87095
+ }
87089
87096
  async function fetchProjectDocumentValueRecords(runner, valueIds, readBase) {
87090
87097
  if (runner.fetchValueSnapshotsPage === void 0) {
87091
87098
  throw new Error(
@@ -87151,6 +87158,41 @@ function readProjectDocumentPage(value) {
87151
87158
  "Convex project document manifest page continueCursor must be a string or null."
87152
87159
  );
87153
87160
  }
87161
+ let remainingRanges;
87162
+ if (value.remainingRanges !== void 0) {
87163
+ if (!Array.isArray(value.remainingRanges))
87164
+ throw new Error("Snapshot remaining ranges must be an array.");
87165
+ remainingRanges = [];
87166
+ let expectedCursor = continueCursor;
87167
+ for (const range2 of value.remainingRanges) {
87168
+ if (!isObject4(range2))
87169
+ throw new Error("Snapshot range must be an object.");
87170
+ if (typeof range2.cursor !== "string")
87171
+ throw new Error("Snapshot range cursor must be a string.");
87172
+ if (range2.endCursor !== null && typeof range2.endCursor !== "string")
87173
+ throw new Error("Snapshot range end cursor must be a string or null.");
87174
+ if (range2.cursor !== expectedCursor)
87175
+ throw new Error("Snapshot ranges must form a contiguous continuation.");
87176
+ if (range2.cursor === range2.endCursor)
87177
+ throw new Error("Snapshot range must make progress.");
87178
+ remainingRanges.push({
87179
+ cursor: range2.cursor,
87180
+ endCursor: range2.endCursor
87181
+ });
87182
+ expectedCursor = range2.endCursor;
87183
+ }
87184
+ if (expectedCursor !== null)
87185
+ throw new Error("Snapshot ranges must cover the entire remaining tail.");
87186
+ }
87187
+ const readConcurrency = value.readConcurrency;
87188
+ if (readConcurrency !== void 0) {
87189
+ if (typeof readConcurrency !== "number")
87190
+ throw new Error("Document read concurrency must be a number.");
87191
+ if (!Number.isSafeInteger(readConcurrency))
87192
+ throw new Error("Document read concurrency must be a safe integer.");
87193
+ if (readConcurrency < 1)
87194
+ throw new Error("Document read concurrency must be positive.");
87195
+ }
87154
87196
  const metadata = value.metadata ?? null;
87155
87197
  if (metadata !== null && !isObject4(metadata)) {
87156
87198
  throw new Error(
@@ -87167,6 +87209,8 @@ function readProjectDocumentPage(value) {
87167
87209
  releaseChannels: metadata.releaseChannels,
87168
87210
  documentRevision: metadata.documentRevision
87169
87211
  },
87212
+ ...remainingRanges === void 0 ? {} : { remainingRanges },
87213
+ ...readConcurrency === void 0 ? {} : { readConcurrency },
87170
87214
  ...snapshots === void 0 ? {} : { snapshots },
87171
87215
  records: snapshots === void 0 ? readProjectDocumentManifestRecords(value.records) : snapshots.map((snapshot) => ({
87172
87216
  recordKind: snapshot.recordKind,
@@ -87220,7 +87264,21 @@ function readProjectDocumentManifestPageRecords(value) {
87220
87264
  if (!isObject4(value)) {
87221
87265
  throw new Error("Convex project document manifest page must be an object.");
87222
87266
  }
87223
- return readProjectDocumentPage(value).records;
87267
+ if (value.snapshots === void 0)
87268
+ return readProjectDocumentManifestRecords(value.records);
87269
+ if (!Array.isArray(value.snapshots))
87270
+ throw new Error("Snapshot page snapshots must be an array.");
87271
+ return readProjectDocumentManifestRecords(
87272
+ value.snapshots.map((snapshot) => {
87273
+ if (!isObject4(snapshot))
87274
+ throw new Error("Snapshot page entry must be an object.");
87275
+ return {
87276
+ recordKind: snapshot.recordKind,
87277
+ recordId: snapshot.recordId,
87278
+ snapshotId: snapshot.id
87279
+ };
87280
+ })
87281
+ );
87224
87282
  }
87225
87283
  async function fetchProjectDocumentSnapshots(fetchBatch, snapshotIds) {
87226
87284
  const loader = createProjectDocumentSnapshotLoader(fetchBatch);
@@ -87236,6 +87294,7 @@ function createProjectDocumentSnapshotLoader(fetchBatch) {
87236
87294
  const snapshotsById = /* @__PURE__ */ new Map();
87237
87295
  const active = /* @__PURE__ */ new Set();
87238
87296
  let pending = [];
87297
+ let enqueued = Promise.resolve();
87239
87298
  let stopped = false;
87240
87299
  let failure;
87241
87300
  const checkFailure = () => {
@@ -87272,17 +87331,21 @@ function createProjectDocumentSnapshotLoader(fetchBatch) {
87272
87331
  snapshotsById.set(snapshot.id, snapshot);
87273
87332
  }
87274
87333
  },
87275
- async enqueue(snapshotIds) {
87276
- checkFailure();
87277
- for (const id2 of snapshotIds) {
87278
- if (seen.has(id2)) continue;
87279
- seen.add(id2);
87280
- pending.push(id2);
87281
- if (pending.length === DOCUMENT_SNAPSHOT_FETCH_CHUNK_SIZE)
87282
- await flush();
87283
- }
87334
+ enqueue(snapshotIds) {
87335
+ enqueued = enqueued.then(async () => {
87336
+ checkFailure();
87337
+ for (const id2 of snapshotIds) {
87338
+ if (seen.has(id2)) continue;
87339
+ seen.add(id2);
87340
+ pending.push(id2);
87341
+ if (pending.length === DOCUMENT_SNAPSHOT_FETCH_CHUNK_SIZE)
87342
+ await flush();
87343
+ }
87344
+ });
87345
+ return enqueued;
87284
87346
  },
87285
87347
  async finish() {
87348
+ await enqueued;
87286
87349
  await flush();
87287
87350
  await Promise.all(active);
87288
87351
  checkFailure();
@@ -87290,6 +87353,8 @@ function createProjectDocumentSnapshotLoader(fetchBatch) {
87290
87353
  },
87291
87354
  async stop() {
87292
87355
  stopped = true;
87356
+ await enqueued.catch(() => {
87357
+ });
87293
87358
  await Promise.all(active);
87294
87359
  }
87295
87360
  };
@@ -87361,6 +87426,30 @@ function readProjectDocumentSnapshotBatch(value, requestedIds) {
87361
87426
  `Convex project record snapshot "${snapshot.id}" is missing a content hash.`
87362
87427
  );
87363
87428
  }
87429
+ let data = snapshot.data;
87430
+ if ("dataJson" in snapshot) {
87431
+ if (typeof snapshot.dataJson !== "string")
87432
+ throw new Error(`Snapshot "${snapshot.id}" dataJson must be a string.`);
87433
+ if (typeof snapshot.projectId !== "string")
87434
+ throw new Error(
87435
+ `Snapshot "${snapshot.id}" projectId must be a string.`
87436
+ );
87437
+ if (typeof snapshot.createdAt !== "number")
87438
+ throw new Error(
87439
+ `Snapshot "${snapshot.id}" createdAt must be a number.`
87440
+ );
87441
+ if (!Number.isFinite(snapshot.createdAt))
87442
+ throw new Error(
87443
+ `Snapshot "${snapshot.id}" createdAt must be finite milliseconds.`
87444
+ );
87445
+ data = decodeProjectRecordSnapshotData({
87446
+ projectId: snapshot.projectId,
87447
+ recordKind,
87448
+ recordId: snapshot.recordId,
87449
+ createdAt: snapshot.createdAt,
87450
+ dataJson: snapshot.dataJson
87451
+ });
87452
+ }
87364
87453
  return {
87365
87454
  id: snapshot.id,
87366
87455
  recordKind,
@@ -87371,7 +87460,7 @@ function readProjectDocumentSnapshotBatch(value, requestedIds) {
87371
87460
  data: readCurrentProjectRecordData({
87372
87461
  recordKind,
87373
87462
  dataSchemaVersion: snapshot.dataSchemaVersion,
87374
- data: snapshot.data
87463
+ data
87375
87464
  })
87376
87465
  };
87377
87466
  });
@@ -87693,6 +87782,7 @@ var DOCUMENT_MANIFEST_PAGE_SIZE, DOCUMENT_SNAPSHOT_FETCH_CHUNK_SIZE, DOCUMENT_SN
87693
87782
  var init_project_document_read = __esm({
87694
87783
  "../src/database/project-document-read.ts"() {
87695
87784
  "use strict";
87785
+ init_projectRecordSnapshotStorage();
87696
87786
  init_project_read_base();
87697
87787
  init_project2();
87698
87788
  init_members();
@@ -87711,7 +87801,7 @@ var init_project_document_read = __esm({
87711
87801
  init_projectRecordBuckets();
87712
87802
  init_project_record_migrations();
87713
87803
  init_member_default_reference_ids();
87714
- DOCUMENT_MANIFEST_PAGE_SIZE = 2048;
87804
+ DOCUMENT_MANIFEST_PAGE_SIZE = 8192;
87715
87805
  DOCUMENT_SNAPSHOT_FETCH_CHUNK_SIZE = 128;
87716
87806
  DOCUMENT_SNAPSHOT_FETCH_CONCURRENCY = 4;
87717
87807
  }
@@ -88394,7 +88484,7 @@ var init_commit_preparation_scope_planner = __esm({
88394
88484
 
88395
88485
  // ../src/database/project-record-semantics.ts
88396
88486
  function projectRecordSemanticData(value) {
88397
- if (!isPlainRecord(value)) return value;
88487
+ if (!isPlainRecord2(value)) return value;
88398
88488
  const semantic = {};
88399
88489
  for (const [key, child] of Object.entries(value)) {
88400
88490
  if (SERVER_MANAGED_PROJECT_RECORD_FIELDS.has(key)) continue;
@@ -88431,7 +88521,7 @@ function toCanonicalJsonValue2(value) {
88431
88521
  if (Array.isArray(value)) {
88432
88522
  return value.map((item) => toCanonicalJsonValue2(item) ?? null);
88433
88523
  }
88434
- if (!isPlainRecord(value)) {
88524
+ if (!isPlainRecord2(value)) {
88435
88525
  throw new Error("Cannot canonicalize a non-plain object.");
88436
88526
  }
88437
88527
  const canonical = {};
@@ -88445,7 +88535,7 @@ function toCanonicalJsonValue2(value) {
88445
88535
  }
88446
88536
  return canonical;
88447
88537
  }
88448
- function isPlainRecord(value) {
88538
+ function isPlainRecord2(value) {
88449
88539
  if (value === null || typeof value !== "object") return false;
88450
88540
  const prototype = Object.getPrototypeOf(value);
88451
88541
  return prototype === Object.prototype || prototype === null;
@@ -88479,7 +88569,7 @@ function stagedChangesAffectClassRelations(current, changes) {
88479
88569
  const before2 = classesById.get(change.recordId);
88480
88570
  if (before2 === void 0) return true;
88481
88571
  const after = change.nextData;
88482
- if (!isPlainRecord2(after)) return true;
88572
+ if (!isPlainRecord3(after)) return true;
88483
88573
  if (before2.extendsClassId !== after.extendsClassId) return true;
88484
88574
  continue;
88485
88575
  }
@@ -88498,11 +88588,102 @@ function valueCreateCannotAffectClassRelations(change, before) {
88498
88588
  return before === void 0;
88499
88589
  }
88500
88590
  function relationEndpointClassId(record6) {
88501
- if (!isPlainRecord2(record6)) return void 0;
88591
+ if (!isPlainRecord3(record6)) return void 0;
88502
88592
  if (typeof record6.classId === "string") return record6.classId;
88503
88593
  return void 0;
88504
88594
  }
88505
- function isPlainRecord2(value) {
88595
+ function relationOrderMaintenanceNoopIds(currentRelations, changes) {
88596
+ const currentById = new Map(
88597
+ currentRelations.map((relation) => [relation.id, relation])
88598
+ );
88599
+ const currentByGroup = /* @__PURE__ */ new Map();
88600
+ for (const relation of currentRelations) {
88601
+ const group = relationOrderGroupKey(relation);
88602
+ const grouped = currentByGroup.get(group) ?? /* @__PURE__ */ new Map();
88603
+ grouped.set(relation.id, relation);
88604
+ currentByGroup.set(group, grouped);
88605
+ }
88606
+ const changesByGroup = /* @__PURE__ */ new Map();
88607
+ const candidatesByGroup = /* @__PURE__ */ new Map();
88608
+ for (const change of changes) {
88609
+ const before = currentById.get(change.recordId);
88610
+ const groups = /* @__PURE__ */ new Set();
88611
+ if (before !== void 0) groups.add(relationOrderGroupKey(before));
88612
+ if (change.deleted !== true && change.operation !== "delete" && isInternalRecordRelation(change.nextData)) {
88613
+ groups.add(relationOrderGroupKey(change.nextData));
88614
+ }
88615
+ for (const group of groups) {
88616
+ const grouped = changesByGroup.get(group) ?? [];
88617
+ grouped.push(change);
88618
+ changesByGroup.set(group, grouped);
88619
+ }
88620
+ if (relationOrderOnlyChangeIsCandidate(before, change)) {
88621
+ const group = relationOrderGroupKey(change.nextData);
88622
+ const candidates = candidatesByGroup.get(group) ?? [];
88623
+ candidates.push(change);
88624
+ candidatesByGroup.set(group, candidates);
88625
+ }
88626
+ }
88627
+ const noops = /* @__PURE__ */ new Set();
88628
+ for (const [group, candidates] of candidatesByGroup) {
88629
+ const groupChanges = changesByGroup.get(group) ?? [];
88630
+ const candidateSet = new Set(candidates);
88631
+ if (groupChanges.some((change) => !candidateSet.has(change))) continue;
88632
+ const current = currentByGroup.get(group) ?? /* @__PURE__ */ new Map();
88633
+ const projected = new Map(current);
88634
+ for (const change of groupChanges) {
88635
+ const before = currentById.get(change.recordId);
88636
+ if (before !== void 0 && relationOrderGroupKey(before) === group) {
88637
+ projected.delete(before.id);
88638
+ }
88639
+ if (change.deleted !== true && change.operation !== "delete" && isInternalRecordRelation(change.nextData) && relationOrderGroupKey(change.nextData) === group) {
88640
+ projected.set(change.nextData.id, change.nextData);
88641
+ }
88642
+ }
88643
+ if (!sameRelationIdSequence(current.values(), projected.values())) continue;
88644
+ for (const candidate of candidates) noops.add(candidate.recordId);
88645
+ }
88646
+ return noops;
88647
+ }
88648
+ function relationOrderOnlyChangeIsCandidate(before, change) {
88649
+ if (change.recordKind !== "internal-record-relation") return false;
88650
+ if (change.operation !== "update" || change.deleted === true) return false;
88651
+ if (before === void 0 || !isInternalRecordRelation(change.nextData)) {
88652
+ return false;
88653
+ }
88654
+ const nextRelation = change.nextData;
88655
+ const contract = INTERNAL_RECORD_RELATION_KIND_CONTRACTS.find(
88656
+ (candidate) => candidate.relationKind === nextRelation.relationKind
88657
+ );
88658
+ if (contract?.merge !== "ordered-union") return false;
88659
+ return projectRecordDataIsSemanticallyEqual(
88660
+ relationWithoutOrderKey(before),
88661
+ relationWithoutOrderKey(nextRelation)
88662
+ );
88663
+ }
88664
+ function relationWithoutOrderKey(value) {
88665
+ const semantic = projectRecordSemanticData(value);
88666
+ if (!isPlainRecord3(semantic)) return semantic;
88667
+ const result = { ...semantic };
88668
+ delete result.orderKey;
88669
+ return result;
88670
+ }
88671
+ function relationOrderGroupKey(relation) {
88672
+ return [
88673
+ relation.relationKind,
88674
+ relation.sourceRecordKind,
88675
+ relation.sourceRecordId
88676
+ ].join("\0");
88677
+ }
88678
+ function sameRelationIdSequence(left, right) {
88679
+ const sequence = (relations) => [...relations].sort(
88680
+ (a, b) => (a.orderKey ?? "").localeCompare(b.orderKey ?? "") || a.id.localeCompare(b.id)
88681
+ ).map((relation) => relation.id);
88682
+ const leftIds = sequence(left);
88683
+ const rightIds = sequence(right);
88684
+ return leftIds.length === rightIds.length && leftIds.every((relationId, index) => relationId === rightIds[index]);
88685
+ }
88686
+ function isPlainRecord3(value) {
88506
88687
  if (value === null || typeof value !== "object") return false;
88507
88688
  return !Array.isArray(value);
88508
88689
  }
@@ -88558,7 +88739,7 @@ function assertWorldFootprintEntryTypes(document, changes) {
88558
88739
  if (change.recordKind !== "value" || change.operation === "delete" || change.deleted)
88559
88740
  continue;
88560
88741
  referencedIds2.add(change.recordId);
88561
- if (isPlainRecord3(change.nextData) && Array.isArray(change.nextData.value)) {
88742
+ if (isPlainRecord4(change.nextData) && Array.isArray(change.nextData.value)) {
88562
88743
  for (const id2 of change.nextData.value)
88563
88744
  if (typeof id2 === "string") referencedIds2.add(id2);
88564
88745
  }
@@ -88595,14 +88776,14 @@ function createdWorldPlacementIds(changes, worldKinds) {
88595
88776
  }
88596
88777
  function hasWorldPlacementBinding(value, worldKinds) {
88597
88778
  if (hasWorldPlacementSidecar(value)) return true;
88598
- if (!isPlainRecord3(value) || typeof value.containerId !== "string")
88779
+ if (!isPlainRecord4(value) || typeof value.containerId !== "string")
88599
88780
  return false;
88600
88781
  if (typeof value.classId !== "string") return false;
88601
88782
  const kind = worldKinds?.get(value.classId);
88602
88783
  return kind === NeoWorldSystemClassKind.Tile;
88603
88784
  }
88604
88785
  function hasWorldPlacementSidecar(value) {
88605
- if (!isPlainRecord3(value) || !isPlainRecord3(value.value)) return false;
88786
+ if (!isPlainRecord4(value) || !isPlainRecord4(value.value)) return false;
88606
88787
  const body = value.value;
88607
88788
  if (typeof body.assetClassId === "string") return true;
88608
88789
  if (typeof body.assetValueId === "string") return true;
@@ -88616,7 +88797,7 @@ function worldPlacementBindingChanged(before, after) {
88616
88797
  );
88617
88798
  }
88618
88799
  function worldPlacementBindingSlice(value) {
88619
- if (!isPlainRecord3(value) || !isPlainRecord3(value.value)) return null;
88800
+ if (!isPlainRecord4(value) || !isPlainRecord4(value.value)) return null;
88620
88801
  return {
88621
88802
  classId: value.classId ?? null,
88622
88803
  containerId: value.containerId ?? null,
@@ -88635,13 +88816,13 @@ function ownedSparseValueBindingChanged(before, after) {
88635
88816
  );
88636
88817
  }
88637
88818
  function ownedSparseValueBindingSlice(value) {
88638
- if (!isPlainRecord3(value)) return null;
88819
+ if (!isPlainRecord4(value)) return null;
88639
88820
  return {
88640
88821
  classId: value.classId ?? null,
88641
88822
  containerId: value.containerId ?? null
88642
88823
  };
88643
88824
  }
88644
- function isPlainRecord3(value) {
88825
+ function isPlainRecord4(value) {
88645
88826
  return typeof value === "object" && value !== null && !Array.isArray(value);
88646
88827
  }
88647
88828
  function stagedChangesRequireWorldLayerBindingValidation(current, changes) {
@@ -88657,14 +88838,14 @@ function stagedChangesRequireWorldLayerBindingValidation(current, changes) {
88657
88838
  continue;
88658
88839
  }
88659
88840
  if (change.recordKind !== "class") continue;
88660
- if (change.operation === "create" && change.deleted !== true && !classesById.has(change.recordId) && isPlainRecord3(change.nextData) && change.nextData.extendsClassId == null && change.nextData.system == null)
88841
+ if (change.operation === "create" && change.deleted !== true && !classesById.has(change.recordId) && isPlainRecord4(change.nextData) && change.nextData.extendsClassId == null && change.nextData.system == null)
88661
88842
  continue;
88662
88843
  if (change.operation !== "update") return true;
88663
88844
  if (change.deleted === true) return true;
88664
88845
  const before = classesById.get(change.recordId);
88665
88846
  if (before === void 0) return true;
88666
88847
  const after = change.nextData;
88667
- if (!isPlainRecord3(after)) return true;
88848
+ if (!isPlainRecord4(after)) return true;
88668
88849
  if (before.extendsClassId !== after.extendsClassId) return true;
88669
88850
  if (isAbstractClass(before) !== isAbstractClass(after)) return true;
88670
88851
  if (!worldClassSystemBlockIsEqual(before.system, after.system)) return true;
@@ -88686,12 +88867,12 @@ function stagedChangesRequireWorldLayerBindingValidation(current, changes) {
88686
88867
  before,
88687
88868
  change.deleted === true || change.operation === "delete" ? null : change.nextData
88688
88869
  ) ? [before, change.nextData] : []) {
88689
- if (!isPlainRecord3(row) || typeof row.containerId !== "string") continue;
88870
+ if (!isPlainRecord4(row) || typeof row.containerId !== "string") continue;
88690
88871
  for (const owner of [
88691
88872
  valuesById.get(row.containerId),
88692
88873
  changedValuesById.get(row.containerId)
88693
88874
  ]) {
88694
- if (isPlainRecord3(owner) && isPlainRecord3(owner.value) && owner.value.assetValueId === change.recordId)
88875
+ if (isPlainRecord4(owner) && isPlainRecord4(owner.value) && owner.value.assetValueId === change.recordId)
88695
88876
  return true;
88696
88877
  }
88697
88878
  }
@@ -88714,9 +88895,9 @@ function worldClassSystemBlockIsEqual(before, after) {
88714
88895
  );
88715
88896
  }
88716
88897
  function hasWorldLayerOverrideMetadata(record6) {
88717
- if (!isPlainRecord3(record6)) return false;
88898
+ if (!isPlainRecord4(record6)) return false;
88718
88899
  const value = record6.value;
88719
- if (!isPlainRecord3(value)) return false;
88900
+ if (!isPlainRecord4(value)) return false;
88720
88901
  return typeof value.layerOverrideValueId === "string";
88721
88902
  }
88722
88903
  var init_project_world_placement_bindings = __esm({
@@ -97455,6 +97636,47 @@ function orderLocalizedTextWritesBesideLinks(prepared) {
97455
97636
  });
97456
97637
  return ordered;
97457
97638
  }
97639
+ function projectVersionBasePayloadBytes(document, changes) {
97640
+ const targets = /* @__PURE__ */ new Map();
97641
+ for (const change of changes) {
97642
+ if (change.operation === "create") continue;
97643
+ const bucket = PROJECT_RECORD_BUCKETS[change.recordKind];
97644
+ let ids = targets.get(bucket);
97645
+ if (ids === void 0) {
97646
+ ids = /* @__PURE__ */ new Set();
97647
+ targets.set(bucket, ids);
97648
+ }
97649
+ ids.add(change.recordId);
97650
+ }
97651
+ const sizes = /* @__PURE__ */ new Map();
97652
+ const raw = {
97653
+ ...document,
97654
+ values: document.physicalValues ?? document.values
97655
+ };
97656
+ const encoder = new TextEncoder();
97657
+ for (const [bucket, ids] of targets) {
97658
+ const value = raw[bucket];
97659
+ if (value == null) continue;
97660
+ const rows = Array.isArray(value) ? value : [value];
97661
+ for (const row of rows) {
97662
+ if (typeof row !== "object" || row === null || !("id" in row) || typeof row.id !== "string")
97663
+ throw new Error("Transaction base record has no ID in " + bucket);
97664
+ if (ids.has(row.id))
97665
+ sizes.set(
97666
+ JSON.stringify([bucket, row.id]),
97667
+ encoder.encode(canonicalJsonStringify(row)).byteLength
97668
+ );
97669
+ }
97670
+ }
97671
+ return changes.map(
97672
+ (change) => sizes.get(
97673
+ JSON.stringify([
97674
+ PROJECT_RECORD_BUCKETS[change.recordKind],
97675
+ change.recordId
97676
+ ])
97677
+ ) ?? 0
97678
+ );
97679
+ }
97458
97680
  function addProjectVersionTransactionBudgets(left, right) {
97459
97681
  return {
97460
97682
  argumentBytes: left.argumentBytes + right.argumentBytes,
@@ -98326,13 +98548,6 @@ function* prepareServerOwnedSchemaCommitPasses(args) {
98326
98548
  prepared,
98327
98549
  contentHashHeads: args.contentHashHeads
98328
98550
  });
98329
- if (args.initializerMaterialization !== void 0) {
98330
- reconcileInitializerMaterializationTransport({
98331
- prepared,
98332
- transport: args.initializerMaterialization,
98333
- document: applyProjectVersionWriteChanges(args.document, prepared)
98334
- });
98335
- }
98336
98551
  drainConstructedGraphValidations({
98337
98552
  document: args.document,
98338
98553
  prepared,
@@ -98801,156 +99016,6 @@ function replayedCreationDataMatches(args) {
98801
99016
  }
98802
99017
  return true;
98803
99018
  }
98804
- function reconcileInitializerMaterializationTransport(args) {
98805
- const roots = new Map(
98806
- args.transport.roots.map((root) => [root.sourceValueId, root])
98807
- );
98808
- if (roots.size !== args.transport.roots.length) {
98809
- throw new Error(
98810
- "Initializer materialization transport contains duplicate source roots."
98811
- );
98812
- }
98813
- const serverCreatedByRoot = /* @__PURE__ */ new Map();
98814
- for (const change of args.prepared) {
98815
- if (change.recordKind !== "value" || change.operation === "delete" || change.nextData === void 0) {
98816
- continue;
98817
- }
98818
- const details = change.intent.details;
98819
- if (typeof details !== "object" || details === null || Reflect.get(details, "source") !== "server-initializer-materialization") {
98820
- continue;
98821
- }
98822
- const sourceValueId = Reflect.get(details, "sourceValueId");
98823
- if (typeof sourceValueId !== "string") continue;
98824
- const grouped = serverCreatedByRoot.get(sourceValueId) ?? [];
98825
- grouped.push(change);
98826
- serverCreatedByRoot.set(sourceValueId, grouped);
98827
- }
98828
- const serverRootIds = new Set(serverCreatedByRoot.keys());
98829
- for (const sourceValueId of roots.keys()) serverRootIds.add(sourceValueId);
98830
- const preparedValueChangeById = /* @__PURE__ */ new Map();
98831
- for (const change of args.prepared) {
98832
- if (change.recordKind !== "value") continue;
98833
- if (change.operation === "delete") continue;
98834
- if (change.nextData !== void 0)
98835
- preparedValueChangeById.set(change.recordId, change);
98836
- }
98837
- const allServerIds = /* @__PURE__ */ new Set();
98838
- for (const sourceValueId of serverRootIds) {
98839
- allServerIds.add(sourceValueId);
98840
- for (const change of serverCreatedByRoot.get(sourceValueId) ?? []) {
98841
- allServerIds.add(change.recordId);
98842
- }
98843
- }
98844
- const graph = createVariantMaterializedValueGraphContext(
98845
- args.document,
98846
- args.document.variants ?? []
98847
- );
98848
- const serverOwners = graph.ownersForValues(allServerIds);
98849
- const effectiveValues = new EffectiveValueReader(args.document);
98850
- for (const sourceValueId of serverRootIds) {
98851
- const local = roots.get(sourceValueId);
98852
- const rootChange = preparedValueChangeById.get(sourceValueId);
98853
- if (local === void 0)
98854
- throw new Error(
98855
- `Initializer materialization parity failed for value "${sourceValueId}": client root is missing.`
98856
- );
98857
- if (rootChange === void 0)
98858
- throw new Error(
98859
- `Initializer materialization parity failed for value "${sourceValueId}": server root is missing.`
98860
- );
98861
- if (local.rows.length === 0)
98862
- throw new Error(
98863
- `Initializer materialization transport for value "${sourceValueId}" has no rows.`
98864
- );
98865
- if (local.rows[0]?.id !== sourceValueId) {
98866
- throw new Error(
98867
- `Initializer materialization transport for value "${sourceValueId}" must be root-first.`
98868
- );
98869
- }
98870
- const serverChanges = [
98871
- rootChange,
98872
- ...serverCreatedByRoot.get(sourceValueId) ?? []
98873
- ];
98874
- if (serverChanges.length !== local.rows.length) {
98875
- throw new Error(
98876
- `Initializer materialization parity failed for value "${sourceValueId}": client produced ${local.rows.length} rows and server produced ${serverChanges.length}.`
98877
- );
98878
- }
98879
- const identities = /* @__PURE__ */ new Set();
98880
- const serverIdToAssigned = /* @__PURE__ */ new Map();
98881
- for (let index = 0; index < local.rows.length; index += 1) {
98882
- const id2 = local.rows[index].id;
98883
- if (typeof id2 !== "string")
98884
- throw new Error(
98885
- `Initializer materialization transport for value "${sourceValueId}" contains an invalid row id at index ${index}.`
98886
- );
98887
- if (identities.has(id2))
98888
- throw new Error(
98889
- `Initializer materialization transport for value "${sourceValueId}" contains duplicate row id "${id2}".`
98890
- );
98891
- identities.add(id2);
98892
- serverIdToAssigned.set(serverChanges[index].recordId, id2);
98893
- }
98894
- const rootRow = graph.valuesById.get(sourceValueId);
98895
- const owner = effectiveValues.memberForValue(sourceValueId);
98896
- if (rootRow === void 0)
98897
- throw new Error(
98898
- `Initializer parity root "${sourceValueId}" has no value row.`
98899
- );
98900
- if (owner === void 0)
98901
- throw new Error(
98902
- `Initializer parity root "${sourceValueId}" has no member placement.`
98903
- );
98904
- const env = graph.genericEnvironmentForRow(rootRow, owner);
98905
- const type = graph.typeInfoForMember(owner, env);
98906
- if (type === null)
98907
- throw new Error(
98908
- `Initializer parity root "${sourceValueId}" has no concrete type.`
98909
- );
98910
- const assignedServerRows = [];
98911
- const serverRowsById = /* @__PURE__ */ new Map();
98912
- for (const change of serverChanges) {
98913
- if (!isMemberValue(change.nextData))
98914
- throw new Error(
98915
- `Initializer materialization server row "${change.recordId}" is invalid.`
98916
- );
98917
- const row = graph.rewriteReferences({
98918
- row: change.nextData,
98919
- replacements: serverIdToAssigned,
98920
- ownerValueId: change.recordId,
98921
- owner: serverOwners.get(change.recordId)
98922
- });
98923
- assignedServerRows.push(row);
98924
- serverRowsById.set(row.id, row);
98925
- }
98926
- const normalizedServer = effectiveValues.withRowOverrides(serverRowsById).normalizeTypedRow(sourceValueId, type, owner, env, identities);
98927
- const localRows = /* @__PURE__ */ new Map();
98928
- for (const row of local.rows) {
98929
- if (!isMemberValue(row))
98930
- throw new Error(
98931
- `Initializer materialization transport for value "${sourceValueId}" contains an invalid value row.`
98932
- );
98933
- localRows.set(row.id, row);
98934
- }
98935
- const normalizedLocal = effectiveValues.withRowOverrides(localRows).normalizeTypedRow(sourceValueId, type, owner, env, identities);
98936
- if (!effectiveValuesEqual(normalizedServer, normalizedLocal)) {
98937
- throw new Error(
98938
- `Initializer materialization parity failed for value "${sourceValueId}": CLI and server graphs differ.`
98939
- );
98940
- }
98941
- for (const [index, change] of serverChanges.entries()) {
98942
- const assignedRow = assignedServerRows[index];
98943
- change.recordId = assignedRow.id;
98944
- change.nextData = assignedRow;
98945
- }
98946
- roots.delete(sourceValueId);
98947
- }
98948
- if (roots.size > 0) {
98949
- throw new Error(
98950
- `Initializer materialization transport names roots the server did not materialize: ${[...roots.keys()].join(", ")}.`
98951
- );
98952
- }
98953
- }
98954
99019
  function constructorArgumentsSemanticallyEqual(args) {
98955
99020
  const current = args.currentReader;
98956
99021
  const replayRows = /* @__PURE__ */ new Map([
@@ -99708,9 +99773,9 @@ function materializeAuthoredValueSeeds(args) {
99708
99773
  member: materializationMember,
99709
99774
  // P61 must leave a computed static root as an init-backed prepared
99710
99775
  // row until `materializePreparedInstanceInitializers` runs. The
99711
- // default builder evaluates it immediately, which bypasses both
99712
- // the server-initializer-materialization grouping and the CLI's
99713
- // parity/identity transport for evaluator-created interior rows.
99776
+ // default builder evaluates it immediately, which bypasses the
99777
+ // initializer-materialization grouping for evaluator-created
99778
+ // interior rows.
99714
99779
  seed: { ...seed, values: seed.values ?? [] }
99715
99780
  });
99716
99781
  const { createdValues, localizedTexts, storageKeyDeclarations, rootValue } = materialized;
@@ -106579,7 +106644,7 @@ function systemProtectedWriteInheritedRecordId(write) {
106579
106644
  return null;
106580
106645
  if (write.deleted) return null;
106581
106646
  if (!isSystemBearingRecordKind(write.recordKind)) return null;
106582
- if (!isPlainRecord4(write.nextData)) return null;
106647
+ if (!isPlainRecord5(write.nextData)) return null;
106583
106648
  if (readSystemMetadata(write.nextData) === null) return null;
106584
106649
  const extendsMemberId = write.nextData.extendsMemberId;
106585
106650
  if (typeof extendsMemberId !== "string") return null;
@@ -106599,7 +106664,7 @@ function assertSystemProtectedRecordWriteValid(write) {
106599
106664
  assertSystemMetadataUnchanged(write, base);
106600
106665
  }
106601
106666
  function readBaseRecord(write) {
106602
- if (!isPlainRecord4(write.baseData)) return null;
106667
+ if (!isPlainRecord5(write.baseData)) return null;
106603
106668
  return {
106604
106669
  recordKind: write.recordKind,
106605
106670
  data: write.baseData,
@@ -106612,7 +106677,7 @@ function collectSystemBearingBaseRecords(document) {
106612
106677
  const stored = document[collection];
106613
106678
  if (!Array.isArray(stored)) continue;
106614
106679
  for (const record6 of stored) {
106615
- if (!isPlainRecord4(record6)) continue;
106680
+ if (!isPlainRecord5(record6)) continue;
106616
106681
  const id2 = record6.id;
106617
106682
  if (typeof id2 !== "string") continue;
106618
106683
  records2.set(baseKey(recordKind, id2), {
@@ -106626,7 +106691,7 @@ function collectSystemBearingBaseRecords(document) {
106626
106691
  }
106627
106692
  function assertCreateDeclaresNoSystemMetadata(write) {
106628
106693
  if (!isSystemBearingRecordKind(write.recordKind)) return;
106629
- if (!isPlainRecord4(write.nextData)) return;
106694
+ if (!isPlainRecord5(write.nextData)) return;
106630
106695
  const system = readSystemMetadata(write.nextData);
106631
106696
  if (system === null) return;
106632
106697
  if (inheritsLegacyEmittedSystemMetadata(write, system)) return;
@@ -106652,11 +106717,11 @@ function assertProtectedRecordNotEdited(change, base) {
106652
106717
  )) {
106653
106718
  return;
106654
106719
  }
106655
- if (!isPlainRecord4(change.nextData)) return;
106720
+ if (!isPlainRecord5(change.nextData)) return;
106656
106721
  if (authoredFieldsEqual(change.recordKind, base.data, change.nextData)) {
106657
106722
  return;
106658
106723
  }
106659
- if (isInheritedWorldDefaultEdit(change) && isPlainRecord4(change.inheritedBaseData) && change.inheritedBaseData.id === base.data.extendsMemberId && systemMetadataEqual(
106724
+ if (isInheritedWorldDefaultEdit(change) && isPlainRecord5(change.inheritedBaseData) && change.inheritedBaseData.id === base.data.extendsMemberId && systemMetadataEqual(
106660
106725
  base.system,
106661
106726
  readSystemMetadata(change.inheritedBaseData)
106662
106727
  ))
@@ -106668,7 +106733,7 @@ function assertProtectedRecordNotEdited(change, base) {
106668
106733
  function isInheritedWorldDefaultEdit(write) {
106669
106734
  if (write.recordKind !== "member" || write.recordId.startsWith("system_"))
106670
106735
  return false;
106671
- if (write.deleted || !isPlainRecord4(write.baseData) || !isPlainRecord4(write.nextData))
106736
+ if (write.deleted || !isPlainRecord5(write.baseData) || !isPlainRecord5(write.nextData))
106672
106737
  return false;
106673
106738
  if (readSystemMetadata(write.baseData)?.kind !== SystemProtectionKind.WorldAuthoring)
106674
106739
  return false;
@@ -106684,7 +106749,7 @@ function isInheritedWorldDefaultEdit(write) {
106684
106749
  );
106685
106750
  }
106686
106751
  function assertSystemMetadataUnchanged(change, base) {
106687
- if (!isPlainRecord4(change.nextData)) return;
106752
+ if (!isPlainRecord5(change.nextData)) return;
106688
106753
  const next = readSystemMetadata(change.nextData);
106689
106754
  if (systemMetadataEqual(base.system, next)) return;
106690
106755
  throw new Error(
@@ -106735,10 +106800,10 @@ function repointedChildValueIds(document, change) {
106735
106800
  );
106736
106801
  if (baseValue === void 0) return [];
106737
106802
  const before = baseValue.value;
106738
- if (!isPlainRecord4(before)) return [];
106739
- if (!isPlainRecord4(change.nextData)) return [];
106803
+ if (!isPlainRecord5(before)) return [];
106804
+ if (!isPlainRecord5(change.nextData)) return [];
106740
106805
  const after = change.nextData.value;
106741
- if (!isPlainRecord4(after)) return [];
106806
+ if (!isPlainRecord5(after)) return [];
106742
106807
  return Object.entries(before).flatMap(([schemaKey, childValueId2]) => {
106743
106808
  if (typeof childValueId2 !== "string") return [];
106744
106809
  if (after[schemaKey] === childValueId2) return [];
@@ -106773,7 +106838,7 @@ function isSystemBearingRecordKind(recordKind) {
106773
106838
  );
106774
106839
  }
106775
106840
  function readSystemMetadata(record6) {
106776
- if (!isPlainRecord4(record6)) return null;
106841
+ if (!isPlainRecord5(record6)) return null;
106777
106842
  const system = record6.system;
106778
106843
  if (!isSystemMetadata(system)) return null;
106779
106844
  return system;
@@ -106792,11 +106857,11 @@ function systemReason(system) {
106792
106857
  return SYSTEM_PROTECTION_RULES[system.kind].serverReason;
106793
106858
  }
106794
106859
  function describeChangedRecord(recordKind, recordId, record6) {
106795
- const name = isPlainRecord4(record6) ? record6.name : void 0;
106860
+ const name = isPlainRecord5(record6) ? record6.name : void 0;
106796
106861
  if (typeof name !== "string") return `Record ${recordKind} "${recordId}"`;
106797
106862
  return `Record ${recordKind} "${name}" (${recordId})`;
106798
106863
  }
106799
- function isPlainRecord4(value) {
106864
+ function isPlainRecord5(value) {
106800
106865
  return typeof value === "object" && value !== null && !Array.isArray(value);
106801
106866
  }
106802
106867
  function baseKey(recordKind, recordId) {
@@ -106927,7 +106992,7 @@ function readWorldReferenceList(args) {
106927
106992
  args.keyCandidates
106928
106993
  );
106929
106994
  if (schemaKey === null) return [];
106930
- if (!isPlainRecord5(args.ownerValue.value)) return [];
106995
+ if (!isPlainRecord6(args.ownerValue.value)) return [];
106931
106996
  const listValueId = args.ownerValue.value[schemaKey];
106932
106997
  if (typeof listValueId !== "string") return [];
106933
106998
  const listValue2 = args.graph.valuesById.get(listValueId);
@@ -106993,18 +107058,18 @@ function worldReferenceClassInherits(graph, classId, ancestorClassId) {
106993
107058
  return false;
106994
107059
  }
106995
107060
  function toWorldReferenceClassRecord(value) {
106996
- if (!isPlainRecord5(value)) return null;
107061
+ if (!isPlainRecord6(value)) return null;
106997
107062
  const id2 = stringField2(value, "id");
106998
107063
  if (id2 === null) return null;
106999
107064
  return {
107000
107065
  id: id2,
107001
107066
  extendsClassId: nullableStringField(value, "extendsClassId"),
107002
107067
  schema: isStringRecord8(value.schema) ? value.schema : void 0,
107003
- system: isPlainRecord5(value.system) ? value.system : null
107068
+ system: isPlainRecord6(value.system) ? value.system : null
107004
107069
  };
107005
107070
  }
107006
107071
  function toWorldReferenceValueRecord(value) {
107007
- if (!isPlainRecord5(value)) return null;
107072
+ if (!isPlainRecord6(value)) return null;
107008
107073
  const id2 = stringField2(value, "id");
107009
107074
  if (id2 === null) return null;
107010
107075
  return {
@@ -107018,10 +107083,10 @@ function worldReferenceValueClassId(value) {
107018
107083
  return typeof value.classId === "string" && value.classId.length > 0 ? value.classId : null;
107019
107084
  }
107020
107085
  function isStringRecord8(value) {
107021
- if (!isPlainRecord5(value)) return false;
107086
+ if (!isPlainRecord6(value)) return false;
107022
107087
  return Object.values(value).every((entry) => typeof entry === "string");
107023
107088
  }
107024
- function isPlainRecord5(value) {
107089
+ function isPlainRecord6(value) {
107025
107090
  return typeof value === "object" && value !== null && !Array.isArray(value);
107026
107091
  }
107027
107092
  function stringField2(value, key) {
@@ -107603,7 +107668,7 @@ function stagedAffectedWorldLayerLinkClassIds(args) {
107603
107668
  change.nextData
107604
107669
  ];
107605
107670
  for (const candidate of candidates) {
107606
- if (!isPlainRecord2(candidate)) continue;
107671
+ if (!isPlainRecord3(candidate)) continue;
107607
107672
  const relationKind = candidate.relationKind;
107608
107673
  if (typeof relationKind !== "string") continue;
107609
107674
  if (!isStagedWorldLayerLinkTargetRelationKind(relationKind)) continue;
@@ -107788,7 +107853,7 @@ function candidateActionListenerRowIds(projected, actions) {
107788
107853
  for (const row of projected.values) {
107789
107854
  if (storedRowActionListeners(row).length > 0) candidates.add(row.id);
107790
107855
  if (actionSchemaKeys.size === 0) continue;
107791
- if (!isPlainRecord2(row.value)) continue;
107856
+ if (!isPlainRecord3(row.value)) continue;
107792
107857
  for (const schemaKey of actionSchemaKeys) {
107793
107858
  const childId = row.value[schemaKey];
107794
107859
  if (typeof childId === "string") candidates.add(childId);
@@ -107798,7 +107863,7 @@ function candidateActionListenerRowIds(projected, actions) {
107798
107863
  }
107799
107864
  function storedRowActionListeners(row) {
107800
107865
  const body = row.value;
107801
- if (!isPlainRecord2(body)) return [];
107866
+ if (!isPlainRecord3(body)) return [];
107802
107867
  const listeners = body.listeners;
107803
107868
  return Array.isArray(listeners) ? listeners : [];
107804
107869
  }
@@ -107876,7 +107941,7 @@ function authoredActionListeners(action) {
107876
107941
  if (defaultValue === void 0 || defaultValue === null) return [];
107877
107942
  if (!isLiteralValueContent(defaultValue)) return [];
107878
107943
  const body = defaultValue.value;
107879
- if (!isPlainRecord2(body)) return [];
107944
+ if (!isPlainRecord3(body)) return [];
107880
107945
  const listeners = body.listeners;
107881
107946
  return Array.isArray(listeners) ? listeners : [];
107882
107947
  }
@@ -108238,7 +108303,7 @@ function candidateVariantRowIds(projected, variantMembers) {
108238
108303
  candidates.add(row.id);
108239
108304
  }
108240
108305
  if (schemaKeys.size === 0) continue;
108241
- if (!isPlainRecord2(row.value)) continue;
108306
+ if (!isPlainRecord3(row.value)) continue;
108242
108307
  for (const [schemaKey, childId] of Object.entries(row.value)) {
108243
108308
  if (schemaKeys.has(schemaKey) && typeof childId === "string")
108244
108309
  candidates.add(childId);
@@ -112872,12 +112937,12 @@ function lowerGenericRelations(context, analysis) {
112872
112937
  );
112873
112938
  }
112874
112939
  const args = expressionArguments(expression);
112875
- const unknown2 = [...args.keys()].find(
112940
+ const unknown = [...args.keys()].find(
112876
112941
  (name) => !["kind", "source", "target", "order"].includes(name)
112877
112942
  );
112878
- if (unknown2 !== void 0) {
112943
+ if (unknown !== void 0) {
112879
112944
  throw new Error(
112880
- `ProjectRelations[${index}] has unknown argument ${JSON.stringify(unknown2)}.`
112945
+ `ProjectRelations[${index}] has unknown argument ${JSON.stringify(unknown)}.`
112881
112946
  );
112882
112947
  }
112883
112948
  const kind = args.get("kind");
@@ -117420,7 +117485,7 @@ function materializeInitializersLocallyV4(args) {
117420
117485
  },
117421
117486
  // §4: a call-site field is an explicit override even when it equals the
117422
117487
  // class default, so the evaluated construction's own field list is what
117423
- // pins rows against collapse. The server commit pins the same set.
117488
+ // pins rows against collapse. Push preparation pins the same set.
117424
117489
  pinnedRootSchemaKeys,
117425
117490
  virtualValueIdForSource: (instanceRootId, sourceIdentity3) => isPendingId(instanceRootId) || hasPendingVirtualSourceIdentity(sourceIdentity3) ? pendingVirtualValueId(instanceRootId, sourceIdentity3) : virtualValueId(instanceRootId, sourceIdentity3)
117426
117491
  });
@@ -117737,6 +117802,25 @@ function compareWorkspacePaths(left, right) {
117737
117802
  if (left > right) return 1;
117738
117803
  return 0;
117739
117804
  }
117805
+ function materializeWorkspaceStatusInitializers(workspace, status, forceRecompile) {
117806
+ return materializeInitializersLocallyV4({
117807
+ workspace,
117808
+ forceRecompile,
117809
+ changes: status.changes.map((change) => ({
117810
+ recordKind: change.recordKind,
117811
+ recordId: change.recordId,
117812
+ operation: change.kind,
117813
+ nextData: change.kind === "delete" ? void 0 : change.nextData,
117814
+ deleted: change.kind === "delete" ? true : void 0,
117815
+ intent: createNeoCliPushIntent(change),
117816
+ expectedBaseContentHash: change.kind === "create" ? null : change.casBaseHash ?? null
117817
+ })),
117818
+ authoredValueSeeds: Array.from(
117819
+ status.authoredValueSeeds,
117820
+ ([memberId, seed]) => ({ memberId, ...seed })
117821
+ )
117822
+ });
117823
+ }
117740
117824
  function computeWorkspaceStatus(workspace, options) {
117741
117825
  let phaseStarted = performance.now();
117742
117826
  options.onPhase?.("Reading project schema\u2026");
@@ -118484,39 +118568,25 @@ function computeWorkspaceStatus(workspace, options) {
118484
118568
  )
118485
118569
  );
118486
118570
  }
118487
- let localInitializerMaterialization;
118488
- try {
118489
- localInitializerMaterialization = materializeInitializersLocallyV4({
118490
- workspace,
118491
- forceRecompile: options.forceRecompile,
118492
- changes: changes.map((change) => ({
118493
- recordKind: change.recordKind,
118494
- recordId: change.recordId,
118495
- operation: change.kind,
118496
- nextData: change.kind === "delete" ? void 0 : change.nextData,
118497
- deleted: change.kind === "delete" ? true : void 0,
118498
- intent: createNeoCliPushIntent(change),
118499
- expectedBaseContentHash: change.kind === "create" ? null : change.casBaseHash ?? null
118500
- })),
118501
- authoredValueSeeds: Array.from(
118502
- authoredValueSeeds,
118503
- ([memberId, seed]) => ({
118504
- memberId,
118505
- ...seed
118506
- })
118507
- )
118508
- });
118509
- } catch (error) {
118510
- parseErrors.push(
118511
- new SchemaSourceError(
118512
- error instanceof Error ? error.message : String(error),
118513
- "<initializer-materialization>",
118514
- 1,
118515
- 1
118516
- )
118517
- );
118571
+ if (options.skipInitializerMaterialization !== true) {
118572
+ try {
118573
+ materializeWorkspaceStatusInitializers(
118574
+ workspace,
118575
+ { changes, authoredValueSeeds },
118576
+ options.forceRecompile
118577
+ );
118578
+ } catch (error) {
118579
+ parseErrors.push(
118580
+ new SchemaSourceError(
118581
+ error instanceof Error ? error.message : String(error),
118582
+ "<initializer-materialization>",
118583
+ 1,
118584
+ 1
118585
+ )
118586
+ );
118587
+ }
118588
+ reportPhase("initializer-materialization");
118518
118589
  }
118519
- reportPhase("initializer-materialization");
118520
118590
  return {
118521
118591
  ...projectAnalysisV4 === null ? {} : {
118522
118592
  sourceSnapshot: {
@@ -118532,7 +118602,6 @@ function computeWorkspaceStatus(workspace, options) {
118532
118602
  reconstructed: reconstructed3,
118533
118603
  authoredValueSeeds,
118534
118604
  pendingValueIdentitySites: valueLowerRegistry.pendingValueIdentitySites,
118535
- localInitializerMaterialization,
118536
118605
  binaryChanges,
118537
118606
  binaryFiles,
118538
118607
  initConversions: collectInitDefaultConversions(
@@ -119614,6 +119683,7 @@ function verifyProjectSourceCommitAgainstStateV4(args) {
119614
119683
  const status = computeWorkspaceStatus(workspace, {
119615
119684
  forceRecompile: args.forceRecompile,
119616
119685
  skipProjectBinaryInspection: true,
119686
+ skipInitializerMaterialization: true,
119617
119687
  useBuildCaches: false,
119618
119688
  writeProjectAnalysisCache: () => void 0,
119619
119689
  trustedPendingProjectFiles,
@@ -119659,9 +119729,6 @@ function verifyProjectSourceCommitAgainstStateV4(args) {
119659
119729
  ...rewrite(seed)
119660
119730
  })
119661
119731
  );
119662
- const expectedInitializerMaterialization = rewrite(
119663
- status.localInitializerMaterialization ?? { roots: [] }
119664
- );
119665
119732
  for (const pendingId2 of assignments.keys()) {
119666
119733
  if (!usedAssignments.has(pendingId2)) {
119667
119734
  throw new ProjectSourceCommitVerificationError(
@@ -119680,10 +119747,6 @@ function verifyProjectSourceCommitAgainstStateV4(args) {
119680
119747
  });
119681
119748
  compareChanges(expectedChanges, verifiableChanges);
119682
119749
  compareSeeds(expectedSeeds, args.authoredValueSeeds);
119683
- compareInitializerMaterialization(
119684
- expectedInitializerMaterialization,
119685
- args.initializerMaterialization ?? { roots: [] }
119686
- );
119687
119750
  }
119688
119751
  function isDerivedOnlyRefresh(change, stateRecords) {
119689
119752
  if (change.operation !== "update") return false;
@@ -120077,33 +120140,6 @@ function compareSeeds(expected, received) {
120077
120140
  );
120078
120141
  }
120079
120142
  }
120080
- function compareInitializerMaterialization(expected, received) {
120081
- const normalize = (transport) => ({
120082
- roots: transport.roots.map((root) => ({
120083
- sourceValueId: root.sourceValueId,
120084
- rows: [...root.rows].map((row) => {
120085
- const normalized = { ...row };
120086
- delete normalized.createdAt;
120087
- delete normalized.updatedAt;
120088
- return normalized;
120089
- }).sort(
120090
- (left, right) => String(left.id ?? "").localeCompare(String(right.id ?? ""))
120091
- )
120092
- })).sort(
120093
- (left, right) => left.sourceValueId.localeCompare(right.sourceValueId)
120094
- )
120095
- });
120096
- const normalizedExpected = normalize(expected);
120097
- const normalizedReceived = normalize(received);
120098
- if (canonicalStringify(normalizedExpected) !== canonicalStringify(normalizedReceived)) {
120099
- const difference = firstDifference(normalizedExpected, normalizedReceived);
120100
- const rootIndex = difference === null ? null : /^\$\.roots\[(\d+)\]/u.exec(difference.path)?.[1];
120101
- const sourceValueId = rootIndex === null || rootIndex === void 0 ? void 0 : normalizedExpected.roots[Number(rootIndex)]?.sourceValueId;
120102
- throw new ProjectSourceCommitVerificationError(
120103
- `Source commit initializer materialization does not match trusted evaluation${difference === null ? "." : `${sourceValueId === void 0 ? "" : ` for root ${JSON.stringify(sourceValueId)}`} at ${difference.path}: trusted ${formatDifferenceValue(difference.trusted)}, submitted ${formatDifferenceValue(difference.submitted)}.`}`
120104
- );
120105
- }
120106
- }
120107
120143
  function normalizeSeedForComparison(seed) {
120108
120144
  const normalized = { ...seed };
120109
120145
  if (seed.values !== void 0) {
@@ -120211,7 +120247,7 @@ var init_trusted_commit_verification = __esm({
120211
120247
  });
120212
120248
 
120213
120249
  // src/project-source/server-preparation-preflight.ts
120214
- function assertServerPreparationSucceeds(args) {
120250
+ function prepareClientPush(args) {
120215
120251
  for (const change of args.changes) {
120216
120252
  if (change.recordKind !== "value" || change.operation !== "update") {
120217
120253
  continue;
@@ -120223,14 +120259,40 @@ function assertServerPreparationSucceeds(args) {
120223
120259
  });
120224
120260
  if (refusal !== null) throw new ServerPreparationPreflightError(refusal);
120225
120261
  }
120262
+ const base = readPulledPreparationBase(args);
120263
+ let prepared;
120226
120264
  try {
120227
- return prepareServerPreparationChanges({
120228
- ...args,
120229
- initializerMaterialization: args.localInitializerMaterialization
120230
- });
120265
+ prepared = prepareAgainstPulledBase(args, base);
120231
120266
  } catch (error) {
120232
120267
  throw locateBodyCompileFailure(error, args.sourceByRecord);
120233
120268
  }
120269
+ const relationOrderNoopIds = relationOrderMaintenanceNoopIds(
120270
+ base.document.internalRecordRelations ?? [],
120271
+ prepared
120272
+ );
120273
+ const changes = [];
120274
+ for (const change of prepared) {
120275
+ if (change.recordKind === "internal-record-relation" && relationOrderNoopIds.has(change.recordId)) {
120276
+ continue;
120277
+ }
120278
+ changes.push({
120279
+ ...change,
120280
+ expectedBaseContentHash: change.expectedBaseContentHash === void 0 ? pulledCasBaseHash(
120281
+ change,
120282
+ args.workspace.state.records[`${change.recordKind}:${change.recordId}`]
120283
+ ) : change.expectedBaseContentHash
120284
+ });
120285
+ }
120286
+ return {
120287
+ changes,
120288
+ basePayloadBytes: projectVersionBasePayloadBytes(base.document, changes)
120289
+ };
120290
+ }
120291
+ function pulledCasBaseHash(change, record6) {
120292
+ if (change.operation === "create") return null;
120293
+ if (record6 === void 0) return null;
120294
+ if (record6.conflictServerHash !== void 0) return record6.conflictServerHash;
120295
+ return record6.contentHash;
120234
120296
  }
120235
120297
  function assertDerivedEdgeCompatibility(workspace) {
120236
120298
  const localVersion = PROJECT_SNAPSHOT_DERIVED_EDGE_EXTRACTOR_VERSION;
@@ -120295,15 +120357,22 @@ function prepareWithScopedSafetyValve(args) {
120295
120357
  args.validate(full);
120296
120358
  return full;
120297
120359
  }
120298
- function prepareServerPreparationChanges(args) {
120360
+ function readPulledPreparationBase(args) {
120299
120361
  const serverTimestamp = args.serverTimestamp ?? Date.now();
120300
120362
  const rawDocument = pulledProjectDocumentRaw(args.workspace);
120301
- const document = withReplayValueIdFactory(
120302
- withStoredValueBase(readProjectDocument(rawDocument)),
120303
- args.createValueId,
120363
+ return {
120364
+ rawDocument,
120365
+ document: withReplayValueIdFactory(
120366
+ withStoredValueBase(readProjectDocument(rawDocument)),
120367
+ args.createValueId,
120368
+ serverTimestamp
120369
+ ),
120370
+ contentHashHeads: readProjectDocumentContentHashHeads(rawDocument),
120304
120371
  serverTimestamp
120305
- );
120306
- const contentHashHeads = readProjectDocumentContentHashHeads(rawDocument);
120372
+ };
120373
+ }
120374
+ function prepareAgainstPulledBase(args, base) {
120375
+ const { rawDocument, document, contentHashHeads, serverTimestamp } = base;
120307
120376
  const changes = args.changes.map((change) => ({
120308
120377
  ...change,
120309
120378
  recordKind: narrowRecordKind(
@@ -120355,7 +120424,6 @@ function prepareServerPreparationChanges(args) {
120355
120424
  contentHashHeads,
120356
120425
  changes: trustedChanges,
120357
120426
  authoredValueSeeds: args.authoredValueSeeds,
120358
- initializerMaterialization: args.initializerMaterialization,
120359
120427
  // A CLI push is always a trusted-source commit, so the server always
120360
120428
  // expands read-only source conversions for it.
120361
120429
  expandReadOnlySourceConversions: true,
@@ -120721,6 +120789,8 @@ var init_server_preparation_preflight = __esm({
120721
120789
  init_project_document_read();
120722
120790
  init_project_snapshot_derived_edges();
120723
120791
  init_project_version_schema_commit();
120792
+ init_project_version_relation_sweep_trigger();
120793
+ init_project_version_transaction_planning();
120724
120794
  init_project_version_whole_graph_validation();
120725
120795
  init_project_world_placement_bindings();
120726
120796
  init_build_default_member_value();
@@ -130461,18 +130531,28 @@ async function createConvexPushConnection(workspace) {
130461
130531
  const bytes = Buffer2.from(json);
130462
130532
  if (bytes.byteLength > SCHEMA_COMMIT_HTTP_MAX_DECODED_BYTES)
130463
130533
  throw new NeoApiError(
130464
- "Schema commit requires the large-payload route.",
130534
+ `Schema commit is ${bytes.byteLength} bytes decoded; the limit is ${SCHEMA_COMMIT_HTTP_MAX_DECODED_BYTES}.`,
130465
130535
  413,
130466
- { error: "schema-commit-route-required" }
130536
+ {
130537
+ error: "schema-commit-too-large",
130538
+ measure: "decoded",
130539
+ bytes: bytes.byteLength,
130540
+ limitBytes: SCHEMA_COMMIT_HTTP_MAX_DECODED_BYTES
130541
+ }
130467
130542
  );
130468
130543
  const compressed = bytes.byteLength >= 1024 ? gzipSync(bytes) : bytes;
130469
130544
  const gzip = compressed.byteLength < bytes.byteLength;
130470
130545
  const payload = gzip ? compressed : bytes;
130471
130546
  if (payload.byteLength > SCHEMA_COMMIT_HTTP_MAX_BYTES)
130472
130547
  throw new NeoApiError(
130473
- "Schema commit exceeds the HTTP body limit.",
130548
+ `Schema commit is ${payload.byteLength} bytes encoded; the limit is ${SCHEMA_COMMIT_HTTP_MAX_BYTES}.`,
130474
130549
  413,
130475
- { error: "schema-commit-route-required" }
130550
+ {
130551
+ error: "schema-commit-too-large",
130552
+ measure: "encoded",
130553
+ bytes: payload.byteLength,
130554
+ limitBytes: SCHEMA_COMMIT_HTTP_MAX_BYTES
130555
+ }
130476
130556
  );
130477
130557
  const client = new NeoApiClient(siteUrl, await tokenCache.getToken());
130478
130558
  const path = `${SCHEMA_COMMIT_HTTP_PATH}?${new URLSearchParams({ projectId: workspace.config.projectId, versionId: workspace.config.versionId })}`;
@@ -130577,27 +130657,6 @@ var init_convex = __esm({
130577
130657
  }
130578
130658
  });
130579
130659
 
130580
- // ../convex/convexValues.ts
130581
- function decodeConvexOpaqueJson(value, context) {
130582
- if (typeof value !== "string") {
130583
- throw new Error(`${context} must be an encoded JSON string.`);
130584
- }
130585
- try {
130586
- return JSON.parse(value);
130587
- } catch (error) {
130588
- const message = error instanceof Error ? error.message : String(error);
130589
- throw new Error(`${context} could not be parsed as JSON: ${message}`);
130590
- }
130591
- }
130592
- var CONVEX_DOCUMENT_WARNING_BYTES, CONVEX_DOCUMENT_MAX_BYTES;
130593
- var init_convexValues = __esm({
130594
- "../convex/convexValues.ts"() {
130595
- "use strict";
130596
- CONVEX_DOCUMENT_WARNING_BYTES = 750 * 1024;
130597
- CONVEX_DOCUMENT_MAX_BYTES = 1024 * 1024;
130598
- }
130599
- });
130600
-
130601
130660
  // ../src/database/project-version-transaction-result.ts
130602
130661
  function decodeProjectVersionTransactionResultPage(page) {
130603
130662
  const assignments = {};
@@ -131959,7 +132018,7 @@ import {
131959
132018
  statSync
131960
132019
  } from "node:fs";
131961
132020
  import { join as join11, relative as relative6, sep as sep6 } from "node:path";
131962
- function assignPendingIds(changes, authoredValueSeeds, reconstructed3, localInitializerMaterialization) {
132021
+ function assignPendingIds(changes, authoredValueSeeds, reconstructed3) {
131963
132022
  const assigned = /* @__PURE__ */ new Map();
131964
132023
  const assign = (pendingId2) => {
131965
132024
  const existing = assigned.get(pendingId2);
@@ -132034,9 +132093,6 @@ function assignPendingIds(changes, authoredValueSeeds, reconstructed3, localInit
132034
132093
  collect(record6.fullData);
132035
132094
  }
132036
132095
  }
132037
- if (localInitializerMaterialization !== void 0) {
132038
- collect(localInitializerMaterialization);
132039
- }
132040
132096
  const rewriteString = createIdentityRewriter(assigned);
132041
132097
  const rewrite = (value) => {
132042
132098
  if (assigned.size === 0) return value;
@@ -132146,16 +132202,7 @@ function assignPendingIds(changes, authoredValueSeeds, reconstructed3, localInit
132146
132202
  reconstructed3.set(key, record6);
132147
132203
  }
132148
132204
  }
132149
- const rewrittenLocalInitializerMaterialization = localInitializerMaterialization === void 0 ? void 0 : rewrite(
132150
- localInitializerMaterialization
132151
- );
132152
- return {
132153
- assigned,
132154
- authoredValueSeeds: rewrittenSeeds,
132155
- ...rewrittenLocalInitializerMaterialization === void 0 ? {} : {
132156
- localInitializerMaterialization: rewrittenLocalInitializerMaterialization
132157
- }
132158
- };
132205
+ return { assigned, authoredValueSeeds: rewrittenSeeds };
132159
132206
  }
132160
132207
  function pendingInterfaceMemberSymbolOwner(value) {
132161
132208
  const marker = ":member:";
@@ -132171,11 +132218,14 @@ function pendingInterfaceMemberSymbolOwner(value) {
132171
132218
  }
132172
132219
  async function commitProjectVersionChanges(args) {
132173
132220
  const { workspace } = args;
132174
- const body = {
132221
+ const body = clientPreparedCommitBody({
132222
+ workspace,
132175
132223
  operation: args.operation,
132176
- changes: args.changes,
132177
- authoredValueSeeds: [],
132178
- initializerMaterialization: { roots: [] },
132224
+ prepared: prepareClientPush({
132225
+ workspace,
132226
+ changes: args.changes,
132227
+ authoredValueSeeds: []
132228
+ }),
132179
132229
  stagedFiles: [],
132180
132230
  stagedUploadSessionId: null,
132181
132231
  // The asynchronous path keys reconnects on this identity; the rows name
@@ -132186,11 +132236,8 @@ async function commitProjectVersionChanges(args) {
132186
132236
  )
132187
132237
  ).digest("hex"),
132188
132238
  pendingIdAssignments: {},
132189
- summary: args.summary,
132190
- headTransactionHash: workspace.state.headTransactionHash ?? null,
132191
- derivedEdgeExtractorVersion: PROJECT_SNAPSHOT_DERIVED_EDGE_EXTRACTOR_VERSION,
132192
- forceRecompile: false
132193
- };
132239
+ summary: args.summary
132240
+ });
132194
132241
  const reporter = createPushProgressReporter(args.json, args.progressLabel);
132195
132242
  reporter.report({
132196
132243
  type: "project-transaction-progress",
@@ -132205,19 +132252,7 @@ async function commitProjectVersionChanges(args) {
132205
132252
  });
132206
132253
  try {
132207
132254
  const connection = await createConvexPushConnection(workspace);
132208
- let response;
132209
- try {
132210
- response = await connection.submit(body, false);
132211
- } catch (error) {
132212
- if (!(error instanceof NeoApiError) || error.status !== 413 || !isObjectRecord2(error.body) || error.body.error !== "schema-commit-route-required")
132213
- throw error;
132214
- response = await NeoApiClient.forBaseUrl(
132215
- workspace.config.apiBaseUrl
132216
- ).post(
132217
- `/api/projects/${workspace.config.projectId}/versions/${workspace.config.versionId}/schema/commit`,
132218
- body
132219
- );
132220
- }
132255
+ const response = await connection.submit(body, false);
132221
132256
  const accepted = readAcceptedProjectVersionCommitResponse(response);
132222
132257
  if (accepted === null) {
132223
132258
  if (!isObjectRecord2(response) || typeof response.kind !== "string") {
@@ -132244,6 +132279,23 @@ async function commitProjectVersionChanges(args) {
132244
132279
  reporter.stop();
132245
132280
  }
132246
132281
  }
132282
+ function clientPreparedCommitBody(args) {
132283
+ return {
132284
+ operation: args.operation,
132285
+ changes: args.prepared.changes,
132286
+ basePayloadBytes: args.prepared.basePayloadBytes,
132287
+ stagedFiles: args.stagedFiles,
132288
+ stagedUploadSessionId: args.stagedUploadSessionId,
132289
+ sourceHash: args.sourceHash,
132290
+ pendingIdAssignments: args.pendingIdAssignments,
132291
+ summary: args.summary,
132292
+ // P43 §4. Preparation ran against the pulled snapshot, so the server
132293
+ // refuses the push unless that snapshot is still the project head.
132294
+ headTransactionHash: args.workspace.state.headTransactionHash ?? null,
132295
+ derivedEdgeExtractorVersion: PROJECT_SNAPSHOT_DERIVED_EDGE_EXTRACTOR_VERSION,
132296
+ compilerRevision: NEOSCRIPT_COMPILER_REVISION
132297
+ };
132298
+ }
132247
132299
  function readAcceptedProjectVersionCommitResponse(value) {
132248
132300
  if (!isObjectRecord2(value) || value.kind !== "accepted") return null;
132249
132301
  if (typeof value.transactionId !== "string") {
@@ -132785,7 +132837,8 @@ async function preparePushStatus(workspace, options, onPhase = () => void 0) {
132785
132837
  onPhase("Analyzing working copy\u2026");
132786
132838
  const status = computeWorkspaceStatus2(workspace, {
132787
132839
  onPhase,
132788
- forceRecompile: options.forceRecompile
132840
+ forceRecompile: options.forceRecompile,
132841
+ skipInitializerMaterialization: true
132789
132842
  });
132790
132843
  if (status.conflictedFiles.length > 0) {
132791
132844
  throw new Error(
@@ -132823,11 +132876,6 @@ ${blockingErrors.map((error) => ` ${error.message}`).join("\n")}`
132823
132876
  }
132824
132877
  const blockedConversions = describeBlockingInitConversions(initConversions);
132825
132878
  if (blockedConversions !== null) throw new Error(blockedConversions);
132826
- if (!options.acceptBump && (workspace.state.headTransactionHash === void 0 || workspace.state.headTransactionHash === null)) {
132827
- throw new Error(
132828
- 'This workspace has no recorded project head, so a push cannot be proven to be a fast-forward. Run "neo pull" first, or re-run with "neo push --accept-bump" to force the write.'
132829
- );
132830
- }
132831
132879
  prepareNSPropertySetterChanges(workspace, status);
132832
132880
  prepareNSFunctionBodyChanges(workspace, status);
132833
132881
  const needsNeoScriptCompilation = status.changes.some(
@@ -133106,41 +133154,24 @@ async function runPush(workspace, options, preparationOverride) {
133106
133154
  pendingAssignment,
133107
133155
  transactionOperation,
133108
133156
  client,
133109
- transportChanges,
133110
- transportSeeds,
133157
+ clientPrepared,
133111
133158
  stagedUploadSessionId
133112
133159
  } = preparedPush;
133113
133160
  const { stagedFiles } = preparedPush;
133114
133161
  let pushConnection;
133115
133162
  const commit = async (force) => {
133116
- const body = {
133163
+ const body = clientPreparedCommitBody({
133164
+ workspace,
133117
133165
  operation: transactionOperation,
133118
- changes: transportChanges,
133119
- authoredValueSeeds: transportSeeds,
133120
- initializerMaterialization: pendingAssignment.localInitializerMaterialization ?? { roots: [] },
133166
+ prepared: clientPrepared,
133121
133167
  stagedFiles,
133122
133168
  stagedUploadSessionId,
133123
133169
  sourceHash: source.sourceHash,
133124
133170
  pendingIdAssignments: Object.fromEntries(pendingAssignment.assigned),
133125
- summary: options.summary ?? "neo push",
133126
- // P43 §4. The local evaluator computes against the pulled snapshot, so
133127
- // the server rejects a push whose base is not the project head.
133128
- headTransactionHash: workspace.state.headTransactionHash ?? null,
133129
- derivedEdgeExtractorVersion: PROJECT_SNAPSHOT_DERIVED_EDGE_EXTRACTOR_VERSION,
133130
- forceRecompile: options.forceRecompile === true
133131
- };
133171
+ summary: options.summary ?? "neo push"
133172
+ });
133132
133173
  pushConnection ??= await createConvexPushConnection(workspace);
133133
- try {
133134
- return await pushConnection.submit(body, force);
133135
- } catch (error) {
133136
- if (!(error instanceof NeoApiError) || error.status !== 413 || !isObjectRecord2(error.body) || error.body.error !== "schema-commit-route-required")
133137
- throw error;
133138
- }
133139
- return await client.post(
133140
- `/api/projects/${workspace.config.projectId}/versions/${workspace.config.versionId}/schema/commit`,
133141
- body,
133142
- force ? { "x-neo-force-project-version-write": "true" } : void 0
133143
- );
133174
+ return await pushConnection.submit(body, force);
133144
133175
  };
133145
133176
  const finishCommitResponse = async (response, reporter) => {
133146
133177
  let accepted;
@@ -133178,7 +133209,7 @@ async function runPush(workspace, options, preparationOverride) {
133178
133209
  errorMessage: null
133179
133210
  });
133180
133211
  reporter.stop();
133181
- reportAdditionalServerChanges(
133212
+ reportDerivedChanges(
133182
133213
  committedChangeCount,
133183
133214
  status.changes.length,
133184
133215
  options.json === true
@@ -133266,7 +133297,7 @@ async function runPush(workspace, options, preparationOverride) {
133266
133297
  errorMessage: null
133267
133298
  });
133268
133299
  reporter.stop();
133269
- reportAdditionalServerChanges(
133300
+ reportDerivedChanges(
133270
133301
  completed.totalChangeCount,
133271
133302
  status.changes.length,
133272
133303
  options.json === true
@@ -133368,7 +133399,7 @@ async function runPush(workspace, options, preparationOverride) {
133368
133399
  await finishCommitResponse(result, progress);
133369
133400
  }
133370
133401
  function isDefinitiveSchemaCommitRejection(error) {
133371
- return error.status === 400 || error.status === 401 || error.status === 403 || error.status === 404 || error.status === 409;
133402
+ return error.status === 400 || error.status === 401 || error.status === 403 || error.status === 404 || error.status === 409 || error.status === 413;
133372
133403
  }
133373
133404
  async function prepareLocalPushArtifactsV4(workspace, status, onPhase = () => void 0, options = {
133374
133405
  fullValidation: true,
@@ -133387,22 +133418,11 @@ async function prepareLocalPushArtifactsV4(workspace, status, onPhase = () => vo
133387
133418
  status,
133388
133419
  status.authoredValueSeeds
133389
133420
  ) : null;
133390
- const pendingTransportChanges = transportChangesForStatus(status);
133391
- const pendingTransportSeeds = [...status.authoredValueSeeds].map(
133392
- ([memberId, seed]) => ({ memberId, ...seed })
133393
- );
133394
- const localInitializerMaterialization = status.localInitializerMaterialization ?? materializeInitializersLocallyV4({
133395
- workspace,
133396
- changes: pendingTransportChanges,
133397
- authoredValueSeeds: pendingTransportSeeds,
133398
- forceRecompile: options.forceRecompile
133399
- });
133400
133421
  onPhase("Assigning pending value identities\u2026");
133401
133422
  const pendingAssignment = assignPendingIds(
133402
133423
  status.changes,
133403
133424
  status.authoredValueSeeds,
133404
- status.reconstructed,
133405
- localInitializerMaterialization
133425
+ status.reconstructed
133406
133426
  );
133407
133427
  const operations = new Set(status.changes.map((change) => change.kind));
133408
133428
  const transactionOperation = operations.size === 1 ? status.changes[0].kind : "update";
@@ -133416,11 +133436,11 @@ async function prepareLocalPushArtifactsV4(workspace, status, onPhase = () => vo
133416
133436
  binaryChanges: status.binaryChanges ?? [],
133417
133437
  assignedIds: pendingAssignment.assigned
133418
133438
  });
133439
+ const stagedRecordIds = new Set(preparedFiles.map((file) => file.recordId));
133419
133440
  assertPushedRecordsPassDomainGuards(
133420
133441
  status.changes,
133421
133442
  localizedTextCreateEnvelopeConfig2(workspace, status.changes)
133422
133443
  );
133423
- let preparedChanges = null;
133424
133444
  if (verificationSource !== null) {
133425
133445
  onPhase("Verifying the assigned-id source rewrite\u2026");
133426
133446
  materializeAssignedSchemaIdsInAuthoredSource(
@@ -133437,36 +133457,47 @@ async function prepareLocalPushArtifactsV4(workspace, status, onPhase = () => vo
133437
133457
  files: verificationSource.files,
133438
133458
  changes: transportChanges,
133439
133459
  authoredValueSeeds: transportSeeds,
133440
- initializerMaterialization: pendingAssignment.localInitializerMaterialization ?? { roots: [] },
133441
133460
  forceRecompile: options.forceRecompile,
133442
133461
  pendingIdAssignments: Object.fromEntries(pendingAssignment.assigned),
133443
133462
  stagedFiles: preparedFiles
133444
133463
  });
133445
- onPhase(
133446
- `Rehearsing server validation for ${transportChanges.length.toLocaleString("en-US")} change(s)\u2026`
133447
- );
133448
- preparedChanges = assertServerPreparationSucceeds({
133464
+ }
133465
+ onPhase(
133466
+ `Preparing ${transportChanges.length.toLocaleString("en-US")} change(s)\u2026`
133467
+ );
133468
+ const finishPreparation = startPerformanceSpan("client-preparation");
133469
+ let prepared;
133470
+ try {
133471
+ prepared = prepareClientPush({
133449
133472
  workspace,
133450
133473
  changes: completeLocallyStagedProjectFileChanges({
133451
133474
  projectId: workspace.config.projectId,
133452
133475
  changes: transportChanges,
133453
- stagedRecordIds: new Set(preparedFiles.map((file) => file.recordId))
133476
+ stagedRecordIds
133454
133477
  }),
133455
133478
  authoredValueSeeds: transportSeeds,
133456
133479
  sourceByRecord: status.reconstructed,
133457
- localInitializerMaterialization: pendingAssignment.localInitializerMaterialization,
133458
133480
  forceRecompile: options.forceRecompile
133459
133481
  });
133482
+ } finally {
133483
+ finishPreparation();
133460
133484
  }
133461
133485
  return {
133462
133486
  source,
133463
133487
  submittedStatus,
133464
133488
  pendingAssignment,
133465
133489
  transactionOperation,
133466
- transportChanges,
133467
- transportSeeds,
133468
133490
  preparedFiles,
133469
- preparedChanges
133491
+ /** The prepared graph with local stand-ins for staged file storage. */
133492
+ preparedChanges: prepared.changes,
133493
+ clientPrepared: {
133494
+ changes: restoreStagedProjectFileStorage(
133495
+ prepared.changes,
133496
+ transportChanges,
133497
+ stagedRecordIds
133498
+ ),
133499
+ basePayloadBytes: prepared.basePayloadBytes
133500
+ }
133470
133501
  };
133471
133502
  }
133472
133503
  async function prepareLocalCandidateV4(workspace, options = {}) {
@@ -133591,14 +133622,50 @@ function completeLocallyStagedProjectFileChanges(args) {
133591
133622
  ...change.nextData,
133592
133623
  id: change.recordId,
133593
133624
  projectId: args.projectId,
133594
- status: "uploaded",
133595
- storageKey: `local-candidate/${change.recordId}`,
133596
- storageETag: "local-candidate"
133625
+ ...localStagedProjectFileStorage(change.recordId)
133597
133626
  }
133598
133627
  };
133599
133628
  return completed;
133600
133629
  });
133601
133630
  }
133631
+ function localStagedProjectFileStorage(recordId) {
133632
+ return {
133633
+ status: "uploaded",
133634
+ storageKey: `local-candidate/${recordId}`,
133635
+ storageETag: "local-candidate"
133636
+ };
133637
+ }
133638
+ function restoreStagedProjectFileStorage(prepared, transportChanges, stagedRecordIds) {
133639
+ if (stagedRecordIds.size === 0) return prepared;
133640
+ const authoredById = /* @__PURE__ */ new Map();
133641
+ for (const change of transportChanges) {
133642
+ if (!stagedRecordIds.has(change.recordId)) continue;
133643
+ if (change.nextData === void 0) {
133644
+ throw new Error(
133645
+ `Staged project file ${change.recordId} has no local source record.`
133646
+ );
133647
+ }
133648
+ authoredById.set(change.recordId, change.nextData);
133649
+ }
133650
+ return prepared.map((change) => {
133651
+ if (change.recordKind !== "project-file") return change;
133652
+ const authored = authoredById.get(change.recordId);
133653
+ if (authored === void 0) return change;
133654
+ if (!isObjectRecord2(change.nextData)) {
133655
+ throw new Error(
133656
+ `Prepared staged project file ${change.recordId} has no record data.`
133657
+ );
133658
+ }
133659
+ const nextData = { ...change.nextData };
133660
+ for (const field of Object.keys(
133661
+ localStagedProjectFileStorage(change.recordId)
133662
+ )) {
133663
+ if (authored[field] === void 0) delete nextData[field];
133664
+ else nextData[field] = authored[field];
133665
+ }
133666
+ return { ...change, nextData };
133667
+ });
133668
+ }
133602
133669
  function transportChangesForStatus(status) {
133603
133670
  return status.changes.map((change) => ({
133604
133671
  recordKind: change.recordKind,
@@ -133963,6 +134030,12 @@ function reportPushRejection(status, body) {
133963
134030
  );
133964
134031
  return;
133965
134032
  }
134033
+ if (isObjectRecord2(body) && body.error === "schema-commit-too-large") {
134034
+ console.error(
134035
+ typeof body.bytes === "number" && typeof body.limitBytes === "number" ? `Push rejected: the prepared commit is ${body.bytes.toLocaleString("en-US")} bytes ${String(body.measure)}, over the ${body.limitBytes.toLocaleString("en-US")}-byte limit.` : "Push rejected: the prepared commit is over the server's body limit."
134036
+ );
134037
+ return;
134038
+ }
133966
134039
  console.error(`Push rejected (${status}): ${JSON.stringify(body)}`);
133967
134040
  }
133968
134041
  function applyCommittedHeadTransactionHash(workspace, result) {
@@ -133998,11 +134071,11 @@ function immediateCommittedChangeCount(result) {
133998
134071
  }
133999
134072
  return result.changedRecords.length;
134000
134073
  }
134001
- function reportAdditionalServerChanges(totalChangeCount, authoredChangeCount, json) {
134074
+ function reportDerivedChanges(totalChangeCount, authoredChangeCount, json) {
134002
134075
  if (json || totalChangeCount <= authoredChangeCount) return;
134003
134076
  console.log(
134004
134077
  color.dim(
134005
- `Server prepared ${totalChangeCount - authoredChangeCount} additional derived record change(s) (${totalChangeCount} total).`
134078
+ `Push preparation added ${totalChangeCount - authoredChangeCount} derived record change(s) (${totalChangeCount} total).`
134006
134079
  )
134007
134080
  );
134008
134081
  }
@@ -135370,7 +135443,6 @@ var init_push = __esm({
135370
135443
  init_project_file_push();
135371
135444
  init_trusted_commit_verification();
135372
135445
  init_server_preparation_preflight();
135373
- init_local_initializer_materialization();
135374
135446
  init_initializer_replay();
135375
135447
  init_project_version_validation();
135376
135448
  init_project2();
@@ -140680,7 +140752,7 @@ var init_registry2 = __esm({
140680
140752
  "schema-contract/registry.mjs"() {
140681
140753
  "use strict";
140682
140754
  PROJECT_SCHEMA_CONTRACT = Object.freeze({
140683
- cliVersion: "0.58.2",
140755
+ cliVersion: "0.59.0",
140684
140756
  projectFileUploadBatchSize: 32,
140685
140757
  documentRecords: {
140686
140758
  member: {
@@ -148395,7 +148467,7 @@ ${h("Usage")}
148395
148467
 
148396
148468
  ${h("Flags")}
148397
148469
  --dry-run ${d("Preview the change set; commit nothing.")}
148398
- --force-recompile ${d("Exhaustively recompile every stored NeoScript body through the durable server path (parity/recovery; slower, and may surface unrelated invalid bodies).")}
148470
+ --force-recompile ${d("Exhaustively recompile every stored NeoScript body during push preparation (parity/recovery; slower, and may surface unrelated invalid bodies).")}
148399
148471
  --summary <text> ${d("Attach a summary message to the transaction.")}
148400
148472
  --accept-bump ${d("Accept a server-required version bump instead of aborting.")}
148401
148473
  --json ${d("Emit machine-readable plan and transaction progress events.")}
@@ -148501,7 +148573,7 @@ There is no --keep-current: preserving current semantic state defines flatten.
148501
148573
  async function main() {
148502
148574
  const args = parseArgs(process.argv.slice(2));
148503
148575
  if (args.command === "--version") {
148504
- console.log("0.58.2");
148576
+ console.log("0.59.0");
148505
148577
  return;
148506
148578
  }
148507
148579
  if (args.command === null || args.command === "help" || args.command === "--help" || args.command === "-h") {