@genroc/eval-node 0.0.0-edge.2063545 → 0.0.0-edge.207f75a

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/import.js CHANGED
@@ -90,15 +90,17 @@ function objectType(s, used) {
90
90
  const doc = typeof sub.description === "string"
91
91
  ? ` /** ${sub.description} */\n`
92
92
  : "";
93
- lines.push(`${doc} ${propKey(key)}${required.has(key) ? "" : "?"}: ${tsType(sub, used)};`);
93
+ lines.push(`${doc} ${propKey(key)}${required.has(key) ? "" : "?"}: ${nest(tsType(sub, used))};`);
94
94
  }
95
95
  if (s.additionalProperties && typeof s.additionalProperties === "object") {
96
- lines.push(` [key: string]: ${tsType(s.additionalProperties, used)};`);
96
+ lines.push(` [key: string]: ${nest(tsType(s.additionalProperties, used))};`);
97
97
  }
98
98
  if (lines.length === 0)
99
99
  return "Record<string, unknown>";
100
100
  return `{\n${lines.join("\n")}\n}`;
101
101
  }
102
+ /** Every line but the first, which is already placed by the property that opens it. */
103
+ const nest = (t) => t.replace(/\n/g, "\n ");
102
104
  function union(parts) {
103
105
  const seen = [...new Set(parts)];
104
106
  return seen.length === 0 ? "unknown" : seen.join(" | ");
@@ -106,13 +108,6 @@ function union(parts) {
106
108
  const IDENT = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
107
109
  const propKey = (k) => (IDENT.test(k) ? k : JSON.stringify(k));
108
110
  const identifier = (n) => IDENT.test(n) ? n : `Def_${n.replace(/[^A-Za-z0-9_$]/g, "_")}`;
109
- function deref(s, defs) {
110
- let cur = s;
111
- for (let i = 0; cur && typeof cur.$ref === "string" && i < 16; i++) {
112
- cur = defs[cur.$ref.replace(/^#\/\$defs\//, "")];
113
- }
114
- return cur;
115
- }
116
111
  /** Emits one named type per reachable $def rather than inlining: a task output may
117
112
  * reference itself (specs/recursive-type-inference.md) and inlining would not terminate. */
118
113
  function declarations(at) {
package/import.ts CHANGED
@@ -137,16 +137,21 @@ function objectType(s: Schema, used: Set<string>): string {
137
137
  ? ` /** ${sub.description} */\n`
138
138
  : "";
139
139
  lines.push(
140
- `${doc} ${propKey(key)}${required.has(key) ? "" : "?"}: ${tsType(sub, used)};`,
140
+ `${doc} ${propKey(key)}${required.has(key) ? "" : "?"}: ${nest(tsType(sub, used))};`,
141
141
  );
142
142
  }
143
143
  if (s.additionalProperties && typeof s.additionalProperties === "object") {
144
- lines.push(` [key: string]: ${tsType(s.additionalProperties, used)};`);
144
+ lines.push(
145
+ ` [key: string]: ${nest(tsType(s.additionalProperties, used))};`,
146
+ );
145
147
  }
146
148
  if (lines.length === 0) return "Record<string, unknown>";
147
149
  return `{\n${lines.join("\n")}\n}`;
148
150
  }
149
151
 
152
+ /** Every line but the first, which is already placed by the property that opens it. */
153
+ const nest = (t: string) => t.replace(/\n/g, "\n ");
154
+
150
155
  function union(parts: string[]): string {
151
156
  const seen = [...new Set(parts)];
152
157
  return seen.length === 0 ? "unknown" : seen.join(" | ");
@@ -157,17 +162,6 @@ const propKey = (k: string) => (IDENT.test(k) ? k : JSON.stringify(k));
157
162
  const identifier = (n: string) =>
158
163
  IDENT.test(n) ? n : `Def_${n.replace(/[^A-Za-z0-9_$]/g, "_")}`;
159
164
 
160
- function deref(
161
- s: Schema | undefined,
162
- defs: Record<string, Schema>,
163
- ): Schema | undefined {
164
- let cur = s;
165
- for (let i = 0; cur && typeof cur.$ref === "string" && i < 16; i++) {
166
- cur = defs[cur.$ref.replace(/^#\/\$defs\//, "")];
167
- }
168
- return cur;
169
- }
170
-
171
165
  /** Emits one named type per reachable $def rather than inlining: a task output may
172
166
  * reference itself (specs/recursive-type-inference.md) and inlining would not terminate. */
173
167
  function declarations(at: Located): string {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@genroc/eval-node",
3
- "version": "0.0.0-edge.2063545",
3
+ "version": "0.0.0-edge.207f75a",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=24"