@voxgig/sdkgen 4.2.0 → 4.2.2
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/bin/voxgig-sdkgen +1 -1
- package/dist/helpers/canonType.d.ts +2 -1
- package/dist/helpers/canonType.js +36 -0
- package/dist/helpers/canonType.js.map +1 -1
- package/dist/sdkgen.d.ts +2 -2
- package/dist/sdkgen.js +3 -2
- package/dist/sdkgen.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/project/.sdk/src/cmp/c/ReadmeEntity_c.ts +2 -2
- package/project/.sdk/src/cmp/c/ReadmeHowto_c.ts +2 -2
- package/project/.sdk/src/cmp/c/ReadmeQuick_c.ts +2 -2
- package/project/.sdk/src/cmp/c/ReadmeRef_c.ts +2 -2
- package/project/.sdk/src/cmp/c/ReadmeTopQuick_c.ts +2 -2
- package/project/.sdk/src/cmp/c/ReadmeTopTest_c.ts +2 -2
- package/project/.sdk/src/cmp/clojure/ReadmeEntity_clojure.ts +2 -2
- package/project/.sdk/src/cmp/clojure/ReadmeHowto_clojure.ts +2 -2
- package/project/.sdk/src/cmp/clojure/ReadmeQuick_clojure.ts +2 -2
- package/project/.sdk/src/cmp/clojure/ReadmeRef_clojure.ts +2 -2
- package/project/.sdk/src/cmp/clojure/ReadmeTopQuick_clojure.ts +2 -2
- package/project/.sdk/src/cmp/clojure/ReadmeTopTest_clojure.ts +2 -2
- package/project/.sdk/src/cmp/cpp/ReadmeEntity_cpp.ts +2 -2
- package/project/.sdk/src/cmp/cpp/ReadmeHowto_cpp.ts +2 -2
- package/project/.sdk/src/cmp/cpp/ReadmeQuick_cpp.ts +2 -2
- package/project/.sdk/src/cmp/cpp/ReadmeRef_cpp.ts +2 -2
- package/project/.sdk/src/cmp/cpp/ReadmeTopQuick_cpp.ts +2 -2
- package/project/.sdk/src/cmp/cpp/ReadmeTopTest_cpp.ts +2 -2
- package/project/.sdk/src/cmp/csharp/ReadmeEntity_csharp.ts +2 -2
- package/project/.sdk/src/cmp/csharp/ReadmeHowto_csharp.ts +2 -2
- package/project/.sdk/src/cmp/csharp/ReadmeQuick_csharp.ts +2 -2
- package/project/.sdk/src/cmp/csharp/ReadmeRef_csharp.ts +2 -2
- package/project/.sdk/src/cmp/csharp/ReadmeTopQuick_csharp.ts +2 -2
- package/project/.sdk/src/cmp/csharp/ReadmeTopTest_csharp.ts +2 -2
- package/project/.sdk/src/cmp/dart/ReadmeEntity_dart.ts +2 -2
- package/project/.sdk/src/cmp/dart/ReadmeHowto_dart.ts +2 -2
- package/project/.sdk/src/cmp/dart/ReadmeQuick_dart.ts +2 -2
- package/project/.sdk/src/cmp/dart/ReadmeRef_dart.ts +2 -2
- package/project/.sdk/src/cmp/dart/ReadmeTopQuick_dart.ts +2 -2
- package/project/.sdk/src/cmp/dart/ReadmeTopTest_dart.ts +2 -2
- package/project/.sdk/src/cmp/dart/TestEntity_dart.ts +6 -3
- package/project/.sdk/src/cmp/elixir/utility_elixir.ts +2 -1
- package/project/.sdk/src/cmp/go/ReadmeHowto_go.ts +2 -2
- package/project/.sdk/src/cmp/go/ReadmeTopTest_go.ts +2 -2
- package/project/.sdk/src/cmp/go/utility_go.ts +10 -1
- package/project/.sdk/src/cmp/java/ReadmeEntity_java.ts +2 -2
- package/project/.sdk/src/cmp/java/ReadmeHowto_java.ts +2 -2
- package/project/.sdk/src/cmp/java/ReadmeQuick_java.ts +2 -2
- package/project/.sdk/src/cmp/java/ReadmeRef_java.ts +2 -2
- package/project/.sdk/src/cmp/java/ReadmeTopQuick_java.ts +2 -2
- package/project/.sdk/src/cmp/java/ReadmeTopTest_java.ts +2 -2
- package/project/.sdk/src/cmp/java/TestDirect_java.ts +13 -1
- package/project/.sdk/src/cmp/js/utility_js.ts +10 -1
- package/project/.sdk/src/cmp/kotlin/ReadmeEntity_kotlin.ts +2 -2
- package/project/.sdk/src/cmp/kotlin/ReadmeHowto_kotlin.ts +2 -2
- package/project/.sdk/src/cmp/kotlin/ReadmeQuick_kotlin.ts +2 -2
- package/project/.sdk/src/cmp/kotlin/ReadmeRef_kotlin.ts +2 -2
- package/project/.sdk/src/cmp/kotlin/ReadmeTopQuick_kotlin.ts +2 -2
- package/project/.sdk/src/cmp/kotlin/ReadmeTopTest_kotlin.ts +2 -2
- package/project/.sdk/src/cmp/kotlin/TestDirect_kotlin.ts +2 -2
- package/project/.sdk/src/cmp/kotlin/TestEntity_kotlin.ts +1 -1
- package/project/.sdk/src/cmp/lua/ReadmeEntity_lua.ts +2 -2
- package/project/.sdk/src/cmp/lua/ReadmeHowto_lua.ts +2 -2
- package/project/.sdk/src/cmp/lua/ReadmeQuick_lua.ts +2 -2
- package/project/.sdk/src/cmp/lua/ReadmeRef_lua.ts +2 -2
- package/project/.sdk/src/cmp/lua/ReadmeTopQuick_lua.ts +2 -2
- package/project/.sdk/src/cmp/lua/ReadmeTopTest_lua.ts +2 -2
- package/project/.sdk/src/cmp/ocaml/ReadmeEntity_ocaml.ts +2 -2
- package/project/.sdk/src/cmp/ocaml/ReadmeHowto_ocaml.ts +2 -2
- package/project/.sdk/src/cmp/ocaml/ReadmeQuick_ocaml.ts +2 -2
- package/project/.sdk/src/cmp/ocaml/ReadmeRef_ocaml.ts +2 -2
- package/project/.sdk/src/cmp/ocaml/ReadmeTopQuick_ocaml.ts +2 -2
- package/project/.sdk/src/cmp/ocaml/ReadmeTopTest_ocaml.ts +2 -2
- package/project/.sdk/src/cmp/perl/ReadmeEntity_perl.ts +2 -2
- package/project/.sdk/src/cmp/perl/ReadmeHowto_perl.ts +2 -2
- package/project/.sdk/src/cmp/perl/ReadmeQuick_perl.ts +2 -2
- package/project/.sdk/src/cmp/perl/ReadmeRef_perl.ts +2 -2
- package/project/.sdk/src/cmp/perl/ReadmeTopQuick_perl.ts +2 -2
- package/project/.sdk/src/cmp/perl/ReadmeTopTest_perl.ts +2 -2
- package/project/.sdk/src/cmp/perl/TestEntity_perl.ts +6 -1
- package/project/.sdk/src/cmp/php/ReadmeEntity_php.ts +2 -2
- package/project/.sdk/src/cmp/php/ReadmeHowto_php.ts +2 -2
- package/project/.sdk/src/cmp/php/ReadmeQuick_php.ts +2 -2
- package/project/.sdk/src/cmp/php/ReadmeRef_php.ts +2 -2
- package/project/.sdk/src/cmp/php/ReadmeTopQuick_php.ts +2 -2
- package/project/.sdk/src/cmp/php/ReadmeTopTest_php.ts +2 -2
- package/project/.sdk/src/cmp/py/ReadmeEntity_py.ts +2 -2
- package/project/.sdk/src/cmp/py/ReadmeHowto_py.ts +2 -2
- package/project/.sdk/src/cmp/py/ReadmeQuick_py.ts +2 -2
- package/project/.sdk/src/cmp/py/ReadmeRef_py.ts +2 -2
- package/project/.sdk/src/cmp/py/ReadmeTopQuick_py.ts +2 -2
- package/project/.sdk/src/cmp/py/ReadmeTopTest_py.ts +2 -2
- package/project/.sdk/src/cmp/rb/ReadmeEntity_rb.ts +2 -2
- package/project/.sdk/src/cmp/rb/ReadmeHowto_rb.ts +2 -2
- package/project/.sdk/src/cmp/rb/ReadmeQuick_rb.ts +2 -2
- package/project/.sdk/src/cmp/rb/ReadmeRef_rb.ts +2 -2
- package/project/.sdk/src/cmp/rb/ReadmeTopQuick_rb.ts +2 -2
- package/project/.sdk/src/cmp/rb/ReadmeTopTest_rb.ts +2 -2
- package/project/.sdk/src/cmp/rust/ReadmeEntity_rust.ts +2 -2
- package/project/.sdk/src/cmp/rust/ReadmeHowto_rust.ts +2 -2
- package/project/.sdk/src/cmp/rust/ReadmeQuick_rust.ts +2 -2
- package/project/.sdk/src/cmp/rust/ReadmeRef_rust.ts +2 -2
- package/project/.sdk/src/cmp/rust/ReadmeTopQuick_rust.ts +2 -2
- package/project/.sdk/src/cmp/rust/ReadmeTopTest_rust.ts +2 -2
- package/project/.sdk/src/cmp/rust/utility_rust.ts +8 -1
- package/project/.sdk/src/cmp/scala/ReadmeEntity_scala.ts +2 -2
- package/project/.sdk/src/cmp/scala/ReadmeHowto_scala.ts +2 -2
- package/project/.sdk/src/cmp/scala/ReadmeQuick_scala.ts +2 -2
- package/project/.sdk/src/cmp/scala/ReadmeRef_scala.ts +2 -2
- package/project/.sdk/src/cmp/scala/ReadmeTopQuick_scala.ts +2 -2
- package/project/.sdk/src/cmp/scala/ReadmeTopTest_scala.ts +2 -2
- package/project/.sdk/src/cmp/swift/ReadmeEntity_swift.ts +2 -2
- package/project/.sdk/src/cmp/swift/ReadmeHowto_swift.ts +2 -2
- package/project/.sdk/src/cmp/swift/ReadmeQuick_swift.ts +2 -2
- package/project/.sdk/src/cmp/swift/ReadmeRef_swift.ts +2 -2
- package/project/.sdk/src/cmp/swift/ReadmeTopQuick_swift.ts +2 -2
- package/project/.sdk/src/cmp/swift/ReadmeTopTest_swift.ts +2 -2
- package/project/.sdk/src/cmp/swift/utility_swift.ts +16 -2
- package/project/.sdk/src/cmp/ts/utility_ts.ts +10 -1
- package/project/.sdk/src/cmp/zig/ReadmeEntity_zig.ts +2 -2
- package/project/.sdk/src/cmp/zig/ReadmeHowto_zig.ts +2 -2
- package/project/.sdk/src/cmp/zig/ReadmeQuick_zig.ts +2 -2
- package/project/.sdk/src/cmp/zig/ReadmeRef_zig.ts +2 -2
- package/project/.sdk/src/cmp/zig/ReadmeTopQuick_zig.ts +2 -2
- package/project/.sdk/src/cmp/zig/ReadmeTopTest_zig.ts +2 -2
- package/project/.sdk/tm/elixir/lib/utility/struct/voxgig_struct.ex +13 -1
- package/project/sdkgen-package.json +1 -1
- package/src/helpers/canonType.ts +38 -0
- package/src/sdkgen.ts +2 -1
|
@@ -50,14 +50,26 @@ defmodule Voxgig.Struct do
|
|
|
50
50
|
id
|
|
51
51
|
end
|
|
52
52
|
|
|
53
|
+
# ensure_heap here too, not only in alloc. A named ETS table belongs to the
|
|
54
|
+
# process that created it and dies with it — and ExUnit runs each test in its
|
|
55
|
+
# own process, so a table created by an alloc in one test is gone by the
|
|
56
|
+
# next. hget then raised ArgumentError ("the table identifier does not refer
|
|
57
|
+
# to an existing ETS table") from whichever unrelated test happened to run
|
|
58
|
+
# second, which is why this surfaced as a pipeline/netsim failure rather than
|
|
59
|
+
# as anything to do with the heap.
|
|
53
60
|
defp hget(id) do
|
|
61
|
+
ensure_heap()
|
|
62
|
+
|
|
54
63
|
case :ets.lookup(@heap, id) do
|
|
55
64
|
[{_, c}] -> c
|
|
56
65
|
_ -> nil
|
|
57
66
|
end
|
|
58
67
|
end
|
|
59
68
|
|
|
60
|
-
defp hset(id, contents)
|
|
69
|
+
defp hset(id, contents) do
|
|
70
|
+
ensure_heap()
|
|
71
|
+
:ets.insert(@heap, {id, contents})
|
|
72
|
+
end
|
|
61
73
|
|
|
62
74
|
defp vmap_new(pairs), do: {:vmap, alloc(pairs)}
|
|
63
75
|
defp vlist_new(items), do: {:vlist, alloc(items)}
|
package/src/helpers/canonType.ts
CHANGED
|
@@ -182,6 +182,43 @@ function canonKey(sentinel: unknown): string {
|
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
|
|
185
|
+
// The bare key of the sentinel a VALUE of this type must satisfy, resolving
|
|
186
|
+
// the union sentinel `['`$ONE`', [member, ...]]` to its first non-NULL member
|
|
187
|
+
// (recursively — a member may itself be a union).
|
|
188
|
+
//
|
|
189
|
+
// canonKey alone cannot do this: given an array it stringifies it, so a
|
|
190
|
+
// nullable `['`$ONE`', ['`$NUMBER`','`$NULL`']]` field yields neither NUMBER
|
|
191
|
+
// nor anything else recognizable and every caller falls through to its
|
|
192
|
+
// "unknown, use a string" branch. canonToType meanwhile renders that same
|
|
193
|
+
// sentinel as `number | null`, so the doc example said `'..._id'` while the
|
|
194
|
+
// generated type said `number` — a TS2322 in the SDK's own README, which is
|
|
195
|
+
// exactly the disagreement the example helpers exist to prevent.
|
|
196
|
+
//
|
|
197
|
+
// A union of nothing but NULL resolves to NULL; an unrecognized array shape,
|
|
198
|
+
// or an empty member list, resolves to '' (unknown) like any missing
|
|
199
|
+
// sentinel.
|
|
200
|
+
function canonScalarKey(sentinel: unknown): string {
|
|
201
|
+
if (Array.isArray(sentinel)) {
|
|
202
|
+
if ('ONE' !== canonKey(sentinel[0]) || !Array.isArray(sentinel[1])) {
|
|
203
|
+
return ''
|
|
204
|
+
}
|
|
205
|
+
let sawNull = false
|
|
206
|
+
for (const member of sentinel[1]) {
|
|
207
|
+
const key = canonScalarKey(member)
|
|
208
|
+
if ('NULL' === key) {
|
|
209
|
+
sawNull = true
|
|
210
|
+
continue
|
|
211
|
+
}
|
|
212
|
+
if ('' !== key) {
|
|
213
|
+
return key
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return sawNull ? 'NULL' : ''
|
|
217
|
+
}
|
|
218
|
+
return canonKey(sentinel)
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
|
|
185
222
|
// Map a field/param type sentinel to a target-language primitive type.
|
|
186
223
|
// Unknown or missing sentinel -> that language's "any" (never throws).
|
|
187
224
|
//
|
|
@@ -220,6 +257,7 @@ export {
|
|
|
220
257
|
canonToType,
|
|
221
258
|
canonToDtype,
|
|
222
259
|
canonKey,
|
|
260
|
+
canonScalarKey,
|
|
223
261
|
CANON_TYPE,
|
|
224
262
|
CANON_ANY,
|
|
225
263
|
CANON_UNION_JOIN,
|
package/src/sdkgen.ts
CHANGED
|
@@ -57,7 +57,7 @@ import { buildIdNames } from './helpers/buildIdNames'
|
|
|
57
57
|
import { getMatchEntries } from './helpers/getMatchEntries'
|
|
58
58
|
import { collectDeps } from './helpers/collectDeps'
|
|
59
59
|
import type { DepEntry } from './helpers/collectDeps'
|
|
60
|
-
import { canonToType, canonToDtype, canonKey } from './helpers/canonType'
|
|
60
|
+
import { canonToType, canonToDtype, canonKey, canonScalarKey } from './helpers/canonType'
|
|
61
61
|
import { OP_SUFFIX, opTypeName, opParams, ownPoint, opActions, entityActions, entityPath, opRequestShape, entityIdField, entityDataIdField, entityOps, entityPrimaryOp, pickExampleEntity, entityClassName, entityTypeCollisions, warnEntityTypeCollisions, deriveEntityNames, entityCollection } from './helpers/opShape'
|
|
62
62
|
import { isReservedName, safeVarName, exampleVarName, phpEntityAccessor, entityCacheField, isRbCoreConstant, isRbSdkConstant, rbSafeTypeName, isSwiftSdkType, swiftSafeTypeName, isPhpReservedType, phpSafeTypeName, isTsReservedType, tsSafeTypeName, jsProp, jsOptProp, jsKey } from './helpers/naming'
|
|
63
63
|
import { serverVariables, hasServerVariables } from './helpers/serverVars'
|
|
@@ -1059,6 +1059,7 @@ export {
|
|
|
1059
1059
|
canonToType,
|
|
1060
1060
|
canonToDtype,
|
|
1061
1061
|
canonKey,
|
|
1062
|
+
canonScalarKey,
|
|
1062
1063
|
|
|
1063
1064
|
OP_SUFFIX,
|
|
1064
1065
|
opTypeName,
|