@neocompose/cli 0.82.3 → 0.82.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.82.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 8ce5b54: Accept Reference<T> constructor and method parameters during record validation, including enum and scalar slots. Invalid callable parameters now report the parameter name and validation cause.
8
+
3
9
  ## 0.82.3
4
10
 
5
11
  ### Patch Changes
@@ -15508,7 +15508,7 @@ var init_registry = __esm({
15508
15508
  "../packages/manifest/schema-contract/registry.mjs"() {
15509
15509
  "use strict";
15510
15510
  PROJECT_SCHEMA_CONTRACT = Object.freeze({
15511
- cliVersion: "0.82.3",
15511
+ cliVersion: "0.82.4",
15512
15512
  projectFileUploadBatchSize: 32,
15513
15513
  documentRecords: {
15514
15514
  member: {
@@ -128632,6 +128632,8 @@ function typeInfoInterfaceIds(value) {
128632
128632
  }
128633
128633
  if ("entryTypeInfo" in value)
128634
128634
  ids.push(...typeInfoInterfaceIds(value.entryTypeInfo));
128635
+ if ("targetTypeInfo" in value)
128636
+ ids.push(...typeInfoInterfaceIds(value.targetTypeInfo));
128635
128637
  if (isRecord8(value.typeArguments)) {
128636
128638
  for (const argument2 of Object.values(value.typeArguments)) {
128637
128639
  ids.push(...typeInfoInterfaceIds(argument2));
@@ -128711,6 +128713,15 @@ function isOpaqueNSTypeInfo(value, ancestors = /* @__PURE__ */ new Set()) {
128711
128713
  if (value.type === 22) {
128712
128714
  return typeof value.interfaceId === "string" && value.interfaceId.length > 0;
128713
128715
  }
128716
+ if (value.type === 29 /* Reference */) {
128717
+ if (ancestors.has(value)) return false;
128718
+ ancestors.add(value);
128719
+ try {
128720
+ return isOpaqueNSTypeInfo(value.targetTypeInfo, ancestors);
128721
+ } finally {
128722
+ ancestors.delete(value);
128723
+ }
128724
+ }
128714
128725
  if (value.type === 25) {
128715
128726
  if (!Array.isArray(value.argumentTypes) || ancestors.has(value)) {
128716
128727
  return false;
@@ -128750,6 +128761,9 @@ function isOpaqueNSTypeInfo(value, ancestors = /* @__PURE__ */ new Set()) {
128750
128761
  }
128751
128762
  function opaqueTypeInfoContainsUnknown(value) {
128752
128763
  if (value.type === "Unknown") return true;
128764
+ if (value.type === 29 /* Reference */) {
128765
+ return isRecord8(value.targetTypeInfo) && opaqueTypeInfoContainsUnknown(value.targetTypeInfo);
128766
+ }
128753
128767
  if (value.type === 5 /* Dictionary */ || value.type === 6 /* List */ || value.type === 28 /* Set */ || value.type === 9 /* Lookup */) {
128754
128768
  return isRecord8(value.entryTypeInfo) && opaqueTypeInfoContainsUnknown(value.entryTypeInfo);
128755
128769
  }
@@ -128838,6 +128852,7 @@ function opaqueFunctionGenericReference(value, matches) {
128838
128852
  }
128839
128853
  const children = [
128840
128854
  value.entryTypeInfo,
128855
+ value.targetTypeInfo,
128841
128856
  value.returnTypeInfo,
128842
128857
  ...Array.isArray(value.argumentTypes) ? value.argumentTypes : [],
128843
128858
  ...isRecord8(value.typeArguments) ? Object.values(value.typeArguments) : []
@@ -128855,7 +128870,38 @@ function isOpaqueNSFunctionReturnTypeInfo(value) {
128855
128870
  return isOpaqueNSTypeInfo(value);
128856
128871
  }
128857
128872
  function isOpaqueCallableArgumentTypeInfo(value) {
128858
- return isOpaqueNSTypeInfo(value) && isOpaqueCallableArgumentIdentifier(value.name) && !opaqueTypeInfoContainsUnknown(value) && hasValidOpaqueParameterDefault(value);
128873
+ return opaqueCallableArgumentError(value) === null;
128874
+ }
128875
+ function opaqueCallableArgumentError(value) {
128876
+ if (!isRecord8(value)) return "must be an argument type object.";
128877
+ const { type, required: required2 } = value;
128878
+ if (!isOpaqueNSTypeInfo(value)) {
128879
+ if (type === 29 /* Reference */) {
128880
+ if (typeof required2 !== "boolean") {
128881
+ return "Reference required must be a boolean.";
128882
+ }
128883
+ return "Reference targetTypeInfo is invalid.";
128884
+ }
128885
+ return "type information is invalid.";
128886
+ }
128887
+ if (!isOpaqueCallableArgumentIdentifier(value.name)) {
128888
+ return "name is invalid or reserved.";
128889
+ }
128890
+ if (opaqueTypeInfoContainsUnknown(value)) {
128891
+ return "type contains Unknown.";
128892
+ }
128893
+ if (!hasValidOpaqueParameterDefault(value)) {
128894
+ return "defaultValue is invalid for its type.";
128895
+ }
128896
+ return null;
128897
+ }
128898
+ function assertOpaqueCallableArgumentsValid(arguments_, owner) {
128899
+ for (const [index, argument2] of arguments_.entries()) {
128900
+ const error = opaqueCallableArgumentError(argument2);
128901
+ if (error === null) continue;
128902
+ const label = isRecord8(argument2) && typeof argument2.name === "string" ? `"${argument2.name}"` : `at index ${index}`;
128903
+ throw new Error(`${owner} parameter ${label} ${error}`);
128904
+ }
128859
128905
  }
128860
128906
  function hasValidOpaqueParameterDefault(value) {
128861
128907
  const wrapper = value.defaultValue;
@@ -128914,7 +128960,7 @@ function assertOpaqueParameterDefaultsValid(member) {
128914
128960
  for (const argument2 of argumentTypes) {
128915
128961
  if (!isRecord8(argument2) || !hasValidOpaqueParameterDefault(argument2)) {
128916
128962
  throw new Error(
128917
- `Function "${member.name}" (${member.id}) declares a parameter default value that does not match the parameter's type.`
128963
+ `Function "${member.name}" (${member.id}) parameter "${isRecord8(argument2) ? String(argument2.name) : "<invalid>"}" defaultValue is invalid for its type.`
128918
128964
  );
128919
128965
  }
128920
128966
  parameters.push(argument2);
@@ -129756,6 +129802,15 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
129756
129802
  )
129757
129803
  };
129758
129804
  }
129805
+ if (typeInfo.type === 29 /* Reference */) {
129806
+ return {
129807
+ ...typeInfo,
129808
+ targetTypeInfo: substituteTypeInfoForClass(
129809
+ typeInfo.targetTypeInfo,
129810
+ schemaClass2
129811
+ )
129812
+ };
129813
+ }
129759
129814
  if (typeInfo.type === 25 && Array.isArray(typeInfo.argumentTypes)) {
129760
129815
  return {
129761
129816
  ...typeInfo,
@@ -130224,11 +130279,10 @@ function assertOpaqueConstructorValid(declaredConstructor) {
130224
130279
  );
130225
130280
  }
130226
130281
  const argumentTypes = declaredConstructor.argumentTypes;
130227
- if (!argumentTypes.every(isOpaqueCallableArgumentTypeInfo)) {
130228
- throw new Error(
130229
- `Constructor "${declaredConstructor.id}" argumentTypes are invalid.`
130230
- );
130231
- }
130282
+ assertOpaqueCallableArgumentsValid(
130283
+ argumentTypes,
130284
+ `Constructor "${declaredConstructor.id}"`
130285
+ );
130232
130286
  const names = /* @__PURE__ */ new Set();
130233
130287
  for (const argument2 of argumentTypes) {
130234
130288
  const name = argument2.name;
@@ -130529,9 +130583,10 @@ function assertOpaqueNSFunctionValid(member, membersById, typeInfoInDeclaringCla
130529
130583
  if (!Array.isArray(member.argumentTypes)) {
130530
130584
  throw new Error(`NSFunction "${member.id}" argumentTypes are invalid.`);
130531
130585
  }
130532
- if (!member.argumentTypes.every(isOpaqueCallableArgumentTypeInfo)) {
130533
- throw new Error(`NSFunction "${member.id}" has an invalid argument type.`);
130534
- }
130586
+ assertOpaqueCallableArgumentsValid(
130587
+ member.argumentTypes,
130588
+ `NSFunction "${member.id}"`
130589
+ );
130535
130590
  const argumentNames = /* @__PURE__ */ new Set();
130536
130591
  for (const argument2 of member.argumentTypes) {
130537
130592
  const name = argument2.name;
@@ -208017,7 +208072,7 @@ var releaseWorkspaceLock = () => void 0;
208017
208072
  async function main() {
208018
208073
  const args = parseArgs(process.argv.slice(2));
208019
208074
  if (args.command === "--version") {
208020
- console.log("0.82.3");
208075
+ console.log("0.82.4");
208021
208076
  return;
208022
208077
  }
208023
208078
  if (args.command === null || args.command === "help" || args.command === "--help" || args.command === "-h") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neocompose/cli",
3
- "version": "0.82.3",
3
+ "version": "0.82.4",
4
4
  "description": "Neo Compose native project-source CLI with bidirectional sync.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -9,7 +9,7 @@ description: >-
9
9
  `@neocompose/cli` or `node cli/bin/neo.mjs` in the neo-compose repository.
10
10
  ---
11
11
 
12
- <!-- reviewed-through-cli: 0.82.3 -->
12
+ <!-- reviewed-through-cli: 0.82.4 -->
13
13
 
14
14
  # Neo Compose CLI
15
15
 
@@ -129,7 +129,7 @@ wrappers.
129
129
  The marker near the top of `SKILL.md` must exactly match the package version:
130
130
 
131
131
  ```html
132
- <!-- reviewed-through-cli: 0.82.3 -->
132
+ <!-- reviewed-through-cli: 0.82.4 -->
133
133
  ```
134
134
 
135
135
  The quoted version above is checked too, so this instruction cannot go stale
@@ -256,11 +256,11 @@ code types; see the NeoScript reference for handle and slot references.
256
256
  `public Reference<Config> Config` selects one row and reads as `Config`.
257
257
  `public Set<Reference<Config>> Configs` selects several and reads as
258
258
  `Set<Config>`. `public Reference<int> TrackedStat` names another member's int.
259
- `Reference<T>` also works as a collection element, a dictionary value, and an
260
- unbound generic argument such as `Box<Reference<int>>`. An initializer body for
261
- a single reference returns one row, never a set. `T` with
262
- `@settings(collection:)` is an error; the language server's quick fix respells
263
- it.
259
+ `Reference<T>` also works as a constructor or method parameter, a collection
260
+ element, a dictionary value, and an unbound generic argument such as
261
+ `Box<Reference<int>>`. An initializer body for a single reference returns one
262
+ row, never a set. `T` with `@settings(collection:)` is an error; the language
263
+ server's quick fix respells it.
264
264
 
265
265
  `@settings(collection: Owner.Member)` binds a class reference to one
266
266
  collection. Without it the reference is unbound: it selects any stored row of