@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.
Files changed (128) hide show
  1. package/bin/voxgig-sdkgen +1 -1
  2. package/dist/helpers/canonType.d.ts +2 -1
  3. package/dist/helpers/canonType.js +36 -0
  4. package/dist/helpers/canonType.js.map +1 -1
  5. package/dist/sdkgen.d.ts +2 -2
  6. package/dist/sdkgen.js +3 -2
  7. package/dist/sdkgen.js.map +1 -1
  8. package/dist/tsconfig.tsbuildinfo +1 -1
  9. package/package.json +1 -1
  10. package/project/.sdk/src/cmp/c/ReadmeEntity_c.ts +2 -2
  11. package/project/.sdk/src/cmp/c/ReadmeHowto_c.ts +2 -2
  12. package/project/.sdk/src/cmp/c/ReadmeQuick_c.ts +2 -2
  13. package/project/.sdk/src/cmp/c/ReadmeRef_c.ts +2 -2
  14. package/project/.sdk/src/cmp/c/ReadmeTopQuick_c.ts +2 -2
  15. package/project/.sdk/src/cmp/c/ReadmeTopTest_c.ts +2 -2
  16. package/project/.sdk/src/cmp/clojure/ReadmeEntity_clojure.ts +2 -2
  17. package/project/.sdk/src/cmp/clojure/ReadmeHowto_clojure.ts +2 -2
  18. package/project/.sdk/src/cmp/clojure/ReadmeQuick_clojure.ts +2 -2
  19. package/project/.sdk/src/cmp/clojure/ReadmeRef_clojure.ts +2 -2
  20. package/project/.sdk/src/cmp/clojure/ReadmeTopQuick_clojure.ts +2 -2
  21. package/project/.sdk/src/cmp/clojure/ReadmeTopTest_clojure.ts +2 -2
  22. package/project/.sdk/src/cmp/cpp/ReadmeEntity_cpp.ts +2 -2
  23. package/project/.sdk/src/cmp/cpp/ReadmeHowto_cpp.ts +2 -2
  24. package/project/.sdk/src/cmp/cpp/ReadmeQuick_cpp.ts +2 -2
  25. package/project/.sdk/src/cmp/cpp/ReadmeRef_cpp.ts +2 -2
  26. package/project/.sdk/src/cmp/cpp/ReadmeTopQuick_cpp.ts +2 -2
  27. package/project/.sdk/src/cmp/cpp/ReadmeTopTest_cpp.ts +2 -2
  28. package/project/.sdk/src/cmp/csharp/ReadmeEntity_csharp.ts +2 -2
  29. package/project/.sdk/src/cmp/csharp/ReadmeHowto_csharp.ts +2 -2
  30. package/project/.sdk/src/cmp/csharp/ReadmeQuick_csharp.ts +2 -2
  31. package/project/.sdk/src/cmp/csharp/ReadmeRef_csharp.ts +2 -2
  32. package/project/.sdk/src/cmp/csharp/ReadmeTopQuick_csharp.ts +2 -2
  33. package/project/.sdk/src/cmp/csharp/ReadmeTopTest_csharp.ts +2 -2
  34. package/project/.sdk/src/cmp/dart/ReadmeEntity_dart.ts +2 -2
  35. package/project/.sdk/src/cmp/dart/ReadmeHowto_dart.ts +2 -2
  36. package/project/.sdk/src/cmp/dart/ReadmeQuick_dart.ts +2 -2
  37. package/project/.sdk/src/cmp/dart/ReadmeRef_dart.ts +2 -2
  38. package/project/.sdk/src/cmp/dart/ReadmeTopQuick_dart.ts +2 -2
  39. package/project/.sdk/src/cmp/dart/ReadmeTopTest_dart.ts +2 -2
  40. package/project/.sdk/src/cmp/dart/TestEntity_dart.ts +6 -3
  41. package/project/.sdk/src/cmp/elixir/utility_elixir.ts +2 -1
  42. package/project/.sdk/src/cmp/go/ReadmeHowto_go.ts +2 -2
  43. package/project/.sdk/src/cmp/go/ReadmeTopTest_go.ts +2 -2
  44. package/project/.sdk/src/cmp/go/utility_go.ts +10 -1
  45. package/project/.sdk/src/cmp/java/ReadmeEntity_java.ts +2 -2
  46. package/project/.sdk/src/cmp/java/ReadmeHowto_java.ts +2 -2
  47. package/project/.sdk/src/cmp/java/ReadmeQuick_java.ts +2 -2
  48. package/project/.sdk/src/cmp/java/ReadmeRef_java.ts +2 -2
  49. package/project/.sdk/src/cmp/java/ReadmeTopQuick_java.ts +2 -2
  50. package/project/.sdk/src/cmp/java/ReadmeTopTest_java.ts +2 -2
  51. package/project/.sdk/src/cmp/java/TestDirect_java.ts +13 -1
  52. package/project/.sdk/src/cmp/js/utility_js.ts +10 -1
  53. package/project/.sdk/src/cmp/kotlin/ReadmeEntity_kotlin.ts +2 -2
  54. package/project/.sdk/src/cmp/kotlin/ReadmeHowto_kotlin.ts +2 -2
  55. package/project/.sdk/src/cmp/kotlin/ReadmeQuick_kotlin.ts +2 -2
  56. package/project/.sdk/src/cmp/kotlin/ReadmeRef_kotlin.ts +2 -2
  57. package/project/.sdk/src/cmp/kotlin/ReadmeTopQuick_kotlin.ts +2 -2
  58. package/project/.sdk/src/cmp/kotlin/ReadmeTopTest_kotlin.ts +2 -2
  59. package/project/.sdk/src/cmp/kotlin/TestDirect_kotlin.ts +2 -2
  60. package/project/.sdk/src/cmp/kotlin/TestEntity_kotlin.ts +1 -1
  61. package/project/.sdk/src/cmp/lua/ReadmeEntity_lua.ts +2 -2
  62. package/project/.sdk/src/cmp/lua/ReadmeHowto_lua.ts +2 -2
  63. package/project/.sdk/src/cmp/lua/ReadmeQuick_lua.ts +2 -2
  64. package/project/.sdk/src/cmp/lua/ReadmeRef_lua.ts +2 -2
  65. package/project/.sdk/src/cmp/lua/ReadmeTopQuick_lua.ts +2 -2
  66. package/project/.sdk/src/cmp/lua/ReadmeTopTest_lua.ts +2 -2
  67. package/project/.sdk/src/cmp/ocaml/ReadmeEntity_ocaml.ts +2 -2
  68. package/project/.sdk/src/cmp/ocaml/ReadmeHowto_ocaml.ts +2 -2
  69. package/project/.sdk/src/cmp/ocaml/ReadmeQuick_ocaml.ts +2 -2
  70. package/project/.sdk/src/cmp/ocaml/ReadmeRef_ocaml.ts +2 -2
  71. package/project/.sdk/src/cmp/ocaml/ReadmeTopQuick_ocaml.ts +2 -2
  72. package/project/.sdk/src/cmp/ocaml/ReadmeTopTest_ocaml.ts +2 -2
  73. package/project/.sdk/src/cmp/perl/ReadmeEntity_perl.ts +2 -2
  74. package/project/.sdk/src/cmp/perl/ReadmeHowto_perl.ts +2 -2
  75. package/project/.sdk/src/cmp/perl/ReadmeQuick_perl.ts +2 -2
  76. package/project/.sdk/src/cmp/perl/ReadmeRef_perl.ts +2 -2
  77. package/project/.sdk/src/cmp/perl/ReadmeTopQuick_perl.ts +2 -2
  78. package/project/.sdk/src/cmp/perl/ReadmeTopTest_perl.ts +2 -2
  79. package/project/.sdk/src/cmp/perl/TestEntity_perl.ts +6 -1
  80. package/project/.sdk/src/cmp/php/ReadmeEntity_php.ts +2 -2
  81. package/project/.sdk/src/cmp/php/ReadmeHowto_php.ts +2 -2
  82. package/project/.sdk/src/cmp/php/ReadmeQuick_php.ts +2 -2
  83. package/project/.sdk/src/cmp/php/ReadmeRef_php.ts +2 -2
  84. package/project/.sdk/src/cmp/php/ReadmeTopQuick_php.ts +2 -2
  85. package/project/.sdk/src/cmp/php/ReadmeTopTest_php.ts +2 -2
  86. package/project/.sdk/src/cmp/py/ReadmeEntity_py.ts +2 -2
  87. package/project/.sdk/src/cmp/py/ReadmeHowto_py.ts +2 -2
  88. package/project/.sdk/src/cmp/py/ReadmeQuick_py.ts +2 -2
  89. package/project/.sdk/src/cmp/py/ReadmeRef_py.ts +2 -2
  90. package/project/.sdk/src/cmp/py/ReadmeTopQuick_py.ts +2 -2
  91. package/project/.sdk/src/cmp/py/ReadmeTopTest_py.ts +2 -2
  92. package/project/.sdk/src/cmp/rb/ReadmeEntity_rb.ts +2 -2
  93. package/project/.sdk/src/cmp/rb/ReadmeHowto_rb.ts +2 -2
  94. package/project/.sdk/src/cmp/rb/ReadmeQuick_rb.ts +2 -2
  95. package/project/.sdk/src/cmp/rb/ReadmeRef_rb.ts +2 -2
  96. package/project/.sdk/src/cmp/rb/ReadmeTopQuick_rb.ts +2 -2
  97. package/project/.sdk/src/cmp/rb/ReadmeTopTest_rb.ts +2 -2
  98. package/project/.sdk/src/cmp/rust/ReadmeEntity_rust.ts +2 -2
  99. package/project/.sdk/src/cmp/rust/ReadmeHowto_rust.ts +2 -2
  100. package/project/.sdk/src/cmp/rust/ReadmeQuick_rust.ts +2 -2
  101. package/project/.sdk/src/cmp/rust/ReadmeRef_rust.ts +2 -2
  102. package/project/.sdk/src/cmp/rust/ReadmeTopQuick_rust.ts +2 -2
  103. package/project/.sdk/src/cmp/rust/ReadmeTopTest_rust.ts +2 -2
  104. package/project/.sdk/src/cmp/rust/utility_rust.ts +8 -1
  105. package/project/.sdk/src/cmp/scala/ReadmeEntity_scala.ts +2 -2
  106. package/project/.sdk/src/cmp/scala/ReadmeHowto_scala.ts +2 -2
  107. package/project/.sdk/src/cmp/scala/ReadmeQuick_scala.ts +2 -2
  108. package/project/.sdk/src/cmp/scala/ReadmeRef_scala.ts +2 -2
  109. package/project/.sdk/src/cmp/scala/ReadmeTopQuick_scala.ts +2 -2
  110. package/project/.sdk/src/cmp/scala/ReadmeTopTest_scala.ts +2 -2
  111. package/project/.sdk/src/cmp/swift/ReadmeEntity_swift.ts +2 -2
  112. package/project/.sdk/src/cmp/swift/ReadmeHowto_swift.ts +2 -2
  113. package/project/.sdk/src/cmp/swift/ReadmeQuick_swift.ts +2 -2
  114. package/project/.sdk/src/cmp/swift/ReadmeRef_swift.ts +2 -2
  115. package/project/.sdk/src/cmp/swift/ReadmeTopQuick_swift.ts +2 -2
  116. package/project/.sdk/src/cmp/swift/ReadmeTopTest_swift.ts +2 -2
  117. package/project/.sdk/src/cmp/swift/utility_swift.ts +16 -2
  118. package/project/.sdk/src/cmp/ts/utility_ts.ts +10 -1
  119. package/project/.sdk/src/cmp/zig/ReadmeEntity_zig.ts +2 -2
  120. package/project/.sdk/src/cmp/zig/ReadmeHowto_zig.ts +2 -2
  121. package/project/.sdk/src/cmp/zig/ReadmeQuick_zig.ts +2 -2
  122. package/project/.sdk/src/cmp/zig/ReadmeRef_zig.ts +2 -2
  123. package/project/.sdk/src/cmp/zig/ReadmeTopQuick_zig.ts +2 -2
  124. package/project/.sdk/src/cmp/zig/ReadmeTopTest_zig.ts +2 -2
  125. package/project/.sdk/tm/elixir/lib/utility/struct/voxgig_struct.ex +13 -1
  126. package/project/sdkgen-package.json +1 -1
  127. package/src/helpers/canonType.ts +38 -0
  128. package/src/sdkgen.ts +2 -1
@@ -4,6 +4,7 @@ import * as Path from 'node:path'
4
4
 
5
5
  import {
6
6
  canonKey,
7
+ canonScalarKey,
7
8
  each,
8
9
  } from '@voxgig/sdkgen'
9
10
 
@@ -47,7 +48,12 @@ function paramCanonType(entity: any, op: any, paramName: string): unknown {
47
48
  // `{}`, everything else (STRING, unknown, missing) as the quoted
48
49
  // `placeholder`.
49
50
  function exampleValue(entity: any, op: any, paramName: string, placeholder: string): string {
50
- const key = canonKey(paramCanonType(entity, op, paramName))
51
+ // canonScalarKey, not canonKey: a nullable field's sentinel is the union
52
+ // ['`$ONE`', ['`$NUMBER`','`$NULL`']], which canonKey stringifies into
53
+ // nothing recognizable — so a `number | null` id fell through to the
54
+ // quoted placeholder and the example failed to compile against the type
55
+ // generated from that very sentinel.
56
+ const key = canonScalarKey(paramCanonType(entity, op, paramName))
51
57
  if ('INTEGER' === key || 'NUMBER' === key) {
52
58
  return '1'
53
59
  }
@@ -60,6 +66,9 @@ function exampleValue(entity: any, op: any, paramName: string, placeholder: stri
60
66
  if ('OBJECT' === key) {
61
67
  return '{}'
62
68
  }
69
+ if ('NULL' === key) {
70
+ return 'null'
71
+ }
63
72
  return `'${placeholder}'`
64
73
  }
65
74
 
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, each, Content, canonToType, canonKey, entityIdField, opRequestShape } from '@voxgig/sdkgen'
2
+ import { cmp, each, Content, canonToType, canonKey, canonScalarKey, entityIdField, opRequestShape } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -13,7 +13,7 @@ import { kotlinVarName } from './utility_kotlin'
13
13
 
14
14
  // A type-correct Kotlin literal for a field's canonical type.
15
15
  function kotlinLit(type: any, placeholder: string = 'example'): string {
16
- const k = canonKey(type)
16
+ const k = canonScalarKey(type)
17
17
  if ('INTEGER' === k) return '1L'
18
18
  if ('NUMBER' === k) return '1.0'
19
19
  if ('BOOLEAN' === k) return 'true'
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, isAuthActive, envName, canonKey, entityIdField, pickExampleEntity, opRequestShape } from '@voxgig/sdkgen'
2
+ import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, pickExampleEntity, opRequestShape } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -11,7 +11,7 @@ import { kotlinVarName } from './utility_kotlin'
11
11
 
12
12
  // A type-correct Kotlin literal for a field's canonical type.
13
13
  function kotlinLit(type: any): string {
14
- const k = canonKey(type)
14
+ const k = canonScalarKey(type)
15
15
  if ('INTEGER' === k) return '1L'
16
16
  if ('NUMBER' === k) return '1.0'
17
17
  if ('BOOLEAN' === k) return 'true'
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, isAuthActive, envName, canonKey, opRequestShape, entityIdField, entityOps } from '@voxgig/sdkgen'
2
+ import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, opRequestShape, entityIdField, entityOps } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -35,7 +35,7 @@ const ReadmeQuick = cmp(function ReadmeQuick(props: any) {
35
35
  // A type-correct Kotlin literal for a param — the loose object model means
36
36
  // all values live in a MutableMap<String, Any?>.
37
37
  const kotlinLit = (type: any, placeholder: string = 'example'): string => {
38
- const k = canonKey(type)
38
+ const k = canonScalarKey(type)
39
39
  if ('INTEGER' === k) return '1L'
40
40
  if ('NUMBER' === k) return '1.0'
41
41
  if ('BOOLEAN' === k) return 'true'
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, each, Content, canonToType, canonKey, File, isAuthActive, entityIdField, opRequestShape } from '@voxgig/sdkgen'
2
+ import { cmp, each, Content, canonToType, canonKey, canonScalarKey, File, isAuthActive, entityIdField, opRequestShape } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -13,7 +13,7 @@ import { kotlinVarName } from './utility_kotlin'
13
13
 
14
14
  // A type-correct Kotlin literal for a field's canonical type.
15
15
  function kotlinLit(type: any, placeholder: string = 'example'): string {
16
- const k = canonKey(type)
16
+ const k = canonScalarKey(type)
17
17
  if ('INTEGER' === k) return '1L'
18
18
  if ('NUMBER' === k) return '1.0'
19
19
  if ('BOOLEAN' === k) return 'true'
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, isAuthActive, envName, canonKey, entityIdField, opRequestShape } from '@voxgig/sdkgen'
2
+ import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, opRequestShape } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -14,7 +14,7 @@ import { kotlinVarName, kotlinPackage } from './utility_kotlin'
14
14
  // params render a typed literal; strings render the quoted placeholder. The
15
15
  // SDK's loose object model means all values live in MutableMap<String, Any?>.
16
16
  function kotlinLit(type: any, placeholder: string = 'example'): string {
17
- const k = canonKey(type)
17
+ const k = canonScalarKey(type)
18
18
  if ('INTEGER' === k) return '1L'
19
19
  if ('NUMBER' === k) return '1.0'
20
20
  if ('BOOLEAN' === k) return 'true'
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, canonKey, entityIdField, pickExampleEntity, opRequestShape } from '@voxgig/sdkgen'
2
+ import { cmp, Content, canonKey, canonScalarKey, entityIdField, pickExampleEntity, opRequestShape } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -11,7 +11,7 @@ import { kotlinVarName } from './utility_kotlin'
11
11
 
12
12
  // A type-correct Kotlin literal for a field's canonical type.
13
13
  function kotlinLit(type: any): string {
14
- const k = canonKey(type)
14
+ const k = canonScalarKey(type)
15
15
  if ('INTEGER' === k) return '1L'
16
16
  if ('NUMBER' === k) return '1.0'
17
17
  if ('BOOLEAN' === k) return 'true'
@@ -158,7 +158,7 @@ class ${entity.Name}DirectTest {
158
158
  : []
159
159
  const listSkipBlock = listLiveIdKeys.length > 0
160
160
  ? ` if (setup.live) {
161
- for (liveKey in arrayOf(${listLiveIdKeys.map((k: string) => `"${k}"`).join(', ')})) {
161
+ for (liveKey in arrayOf<String>(${listLiveIdKeys.map((k: string) => `"${k}"`).join(', ')})) {
162
162
  Assumptions.assumeTrue(setup.idmap[liveKey] != null,
163
163
  "live test needs " + liveKey + " via *_ENTID env var (synthetic IDs only)")
164
164
  }
@@ -265,7 +265,7 @@ ${listSkipBlock} val client = setup.client
265
265
  }
266
266
  const loadSkipBlock = loadLiveIdKeys.length > 0
267
267
  ? ` if (setup.live) {
268
- for (liveKey in arrayOf(${loadLiveIdKeys.map(k => `"${k}"`).join(', ')})) {
268
+ for (liveKey in arrayOf<String>(${loadLiveIdKeys.map(k => `"${k}"`).join(', ')})) {
269
269
  Assumptions.assumeTrue(setup.idmap[liveKey] != null,
270
270
  "live test needs " + liveKey + " via *_ENTID env var (synthetic IDs only)")
271
271
  }
@@ -114,7 +114,7 @@ class ${entity.Name}EntityTest {
114
114
  val setup = ${accessor}BasicSetup(null)
115
115
  // Per-op sdk-test-control.json skip.
116
116
  val mode = if (setup.live) "live" else "unit"
117
- for (op in arrayOf(${stepOps.map(o => `"${o}"`).join(', ')})) {
117
+ for (op in arrayOf<String>(${stepOps.map(o => `"${o}"`).join(', ')})) {
118
118
  val reason = RunnerSupport.skipReason("entityOp", "${entity.name}.\$op", mode)
119
119
  Assumptions.assumeTrue(
120
120
  reason == null,
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, each, Content, canonToType, canonKey, entityIdField, opRequestShape, safeVarName, exampleVarName } from '@voxgig/sdkgen'
2
+ import { cmp, each, Content, canonToType, canonKey, canonScalarKey, entityIdField, opRequestShape, safeVarName, exampleVarName } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -12,7 +12,7 @@ import {
12
12
  // doc test EXECUTES runnable blocks, so a comment placeholder would not
13
13
  // parse).
14
14
  function luaLit(type: any, placeholder: string = 'example'): string {
15
- const k = canonKey(type)
15
+ const k = canonScalarKey(type)
16
16
  if ('INTEGER' === k || 'NUMBER' === k) return '1'
17
17
  if ('BOOLEAN' === k) return 'true'
18
18
  if ('ARRAY' === k || 'OBJECT' === k) return '{}'
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, isAuthActive, envName, canonKey, entityIdField, pickExampleEntity, opRequestShape } from '@voxgig/sdkgen'
2
+ import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, pickExampleEntity, opRequestShape } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -10,7 +10,7 @@ import {
10
10
 
11
11
  // A type-correct Lua literal for a field's canonical type.
12
12
  function luaLit(type: any): string {
13
- const k = canonKey(type)
13
+ const k = canonScalarKey(type)
14
14
  if ('INTEGER' === k || 'NUMBER' === k) return '1'
15
15
  if ('BOOLEAN' === k) return 'true'
16
16
  if ('ARRAY' === k || 'OBJECT' === k) return '{}'
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, each, Content, isAuthActive, envName, canonKey, opRequestShape, entityIdField, entityDataIdField, entityOps, safeVarName, exampleVarName } from '@voxgig/sdkgen'
2
+ import { cmp, each, Content, isAuthActive, envName, canonKey, canonScalarKey, opRequestShape, entityIdField, entityDataIdField, entityOps, safeVarName, exampleVarName } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -59,7 +59,7 @@ local client = ${ctor}
59
59
  // placeholder (the doc test EXECUTES these blocks, so a comment
60
60
  // placeholder would not parse). Non-identifier keys use bracket syntax.
61
61
  const luaLit = (type: any, placeholder: string = 'example'): string => {
62
- const k = canonKey(type)
62
+ const k = canonScalarKey(type)
63
63
  if ('INTEGER' === k || 'NUMBER' === k) return '1'
64
64
  if ('BOOLEAN' === k) return 'true'
65
65
  if ('ARRAY' === k || 'OBJECT' === k) return '{}'
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, each, Content, canonToType, canonKey, File, isAuthActive, entityIdField, opRequestShape, safeVarName, exampleVarName } from '@voxgig/sdkgen'
2
+ import { cmp, each, Content, canonToType, canonKey, canonScalarKey, File, isAuthActive, entityIdField, opRequestShape, safeVarName, exampleVarName } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -12,7 +12,7 @@ import {
12
12
  // doc test EXECUTES runnable blocks, so a comment placeholder would not
13
13
  // parse).
14
14
  function luaLit(type: any, placeholder: string = 'example'): string {
15
- const k = canonKey(type)
15
+ const k = canonScalarKey(type)
16
16
  if ('INTEGER' === k || 'NUMBER' === k) return '1'
17
17
  if ('BOOLEAN' === k) return 'true'
18
18
  if ('ARRAY' === k || 'OBJECT' === k) return '{}'
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, isAuthActive, envName, canonKey, entityIdField, opRequestShape, safeVarName, exampleVarName } from '@voxgig/sdkgen'
2
+ import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, opRequestShape, safeVarName, exampleVarName } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -12,7 +12,7 @@ import {
12
12
  // params render a typed literal; strings render the quoted placeholder (the
13
13
  // doc test EXECUTES this block, so a comment placeholder would break it).
14
14
  function luaLit(type: any, placeholder: string = 'example'): string {
15
- const k = canonKey(type)
15
+ const k = canonScalarKey(type)
16
16
  if ('INTEGER' === k || 'NUMBER' === k) return '1'
17
17
  if ('BOOLEAN' === k) return 'true'
18
18
  if ('ARRAY' === k || 'OBJECT' === k) return '{}'
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, canonKey, entityIdField, pickExampleEntity, opRequestShape } from '@voxgig/sdkgen'
2
+ import { cmp, Content, canonKey, canonScalarKey, entityIdField, pickExampleEntity, opRequestShape } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -10,7 +10,7 @@ import {
10
10
 
11
11
  // A type-correct Lua literal for a field's canonical type.
12
12
  function luaLit(type: any): string {
13
- const k = canonKey(type)
13
+ const k = canonScalarKey(type)
14
14
  if ('INTEGER' === k || 'NUMBER' === k) return '1'
15
15
  if ('BOOLEAN' === k) return 'true'
16
16
  if ('ARRAY' === k || 'OBJECT' === k) return '{}'
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, each, Content, canonKey, entityIdField, opRequestShape } from '@voxgig/sdkgen'
2
+ import { cmp, each, Content, canonKey, canonScalarKey, entityIdField, opRequestShape } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -12,7 +12,7 @@ import { ocamlVarName } from './utility_ocaml'
12
12
  // A type-correct OCaml `value` literal for a field's canonical type. Strings
13
13
  // render the quoted placeholder.
14
14
  function ocamlLit(type: any, placeholder: string = 'example'): string {
15
- const k = canonKey(type)
15
+ const k = canonScalarKey(type)
16
16
  if ('INTEGER' === k || 'NUMBER' === k) return '(Num 1.)'
17
17
  if ('BOOLEAN' === k) return '(Bool true)'
18
18
  if ('ARRAY' === k) return '(empty_list ())'
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, isAuthActive, envName, canonKey, entityIdField, pickExampleEntity, opRequestShape } from '@voxgig/sdkgen'
2
+ import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, pickExampleEntity, opRequestShape } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -11,7 +11,7 @@ import { ocamlVarName } from './utility_ocaml'
11
11
 
12
12
  // A type-correct OCaml `value` literal for a field's canonical type.
13
13
  function ocamlLit(type: any): string {
14
- const k = canonKey(type)
14
+ const k = canonScalarKey(type)
15
15
  if ('INTEGER' === k || 'NUMBER' === k) return '(Num 1.)'
16
16
  if ('BOOLEAN' === k) return '(Bool true)'
17
17
  if ('ARRAY' === k) return '(empty_list ())'
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, isAuthActive, envName, canonKey, opRequestShape, entityIdField, entityDataIdField, entityOps } from '@voxgig/sdkgen'
2
+ import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, opRequestShape, entityIdField, entityDataIdField, entityOps } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -55,7 +55,7 @@ let client = ${ctor}
55
55
 
56
56
  // A type-correct OCaml `value` literal for a param.
57
57
  const ocamlLit = (type: any, placeholder: string = 'example'): string => {
58
- const k = canonKey(type)
58
+ const k = canonScalarKey(type)
59
59
  if ('INTEGER' === k || 'NUMBER' === k) return '(Num 1.)'
60
60
  if ('BOOLEAN' === k) return '(Bool true)'
61
61
  if ('ARRAY' === k) return '(empty_list ())'
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, each, Content, canonKey, File, isAuthActive, entityIdField, opRequestShape } from '@voxgig/sdkgen'
2
+ import { cmp, each, Content, canonKey, canonScalarKey, File, isAuthActive, entityIdField, opRequestShape } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -11,7 +11,7 @@ import { ocamlVarName } from './utility_ocaml'
11
11
 
12
12
  // A type-correct OCaml `value` literal. Strings render the quoted placeholder.
13
13
  function ocamlLit(type: any, placeholder: string = 'example'): string {
14
- const k = canonKey(type)
14
+ const k = canonScalarKey(type)
15
15
  if ('INTEGER' === k || 'NUMBER' === k) return '(Num 1.)'
16
16
  if ('BOOLEAN' === k) return '(Bool true)'
17
17
  if ('ARRAY' === k) return '(empty_list ())'
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, isAuthActive, envName, canonKey, entityIdField, opRequestShape } from '@voxgig/sdkgen'
2
+ import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, opRequestShape } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -12,7 +12,7 @@ import { ocamlVarName } from './utility_ocaml'
12
12
  // A type-correct OCaml `value` literal for a param: numeric/boolean/array/
13
13
  // object params render a typed literal; strings render the quoted placeholder.
14
14
  function ocamlLit(type: any, placeholder: string = 'example'): string {
15
- const k = canonKey(type)
15
+ const k = canonScalarKey(type)
16
16
  if ('INTEGER' === k || 'NUMBER' === k) return '(Num 1.)'
17
17
  if ('BOOLEAN' === k) return '(Bool true)'
18
18
  if ('ARRAY' === k) return '(empty_list ())'
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, canonKey, entityIdField, pickExampleEntity, opRequestShape } from '@voxgig/sdkgen'
2
+ import { cmp, Content, canonKey, canonScalarKey, entityIdField, pickExampleEntity, opRequestShape } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -11,7 +11,7 @@ import { ocamlVarName } from './utility_ocaml'
11
11
 
12
12
  // A type-correct OCaml `value` literal for a field's canonical type.
13
13
  function ocamlLit(type: any): string {
14
- const k = canonKey(type)
14
+ const k = canonScalarKey(type)
15
15
  if ('INTEGER' === k || 'NUMBER' === k) return '(Num 1.)'
16
16
  if ('BOOLEAN' === k) return '(Bool true)'
17
17
  if ('ARRAY' === k) return '(empty_list ())'
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, each, Content, canonKey, entityIdField, opRequestShape } from '@voxgig/sdkgen'
2
+ import { cmp, each, Content, canonKey, canonScalarKey, entityIdField, opRequestShape } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -11,7 +11,7 @@ import {
11
11
  // create example is EXECUTED by the doc test, so a placeholder must be a real
12
12
  // value. Strings render the quoted placeholder.
13
13
  function perlLit(type: any, placeholder: string = 'example'): string {
14
- const k = canonKey(type)
14
+ const k = canonScalarKey(type)
15
15
  if ('INTEGER' === k || 'NUMBER' === k) return '1'
16
16
  if ('BOOLEAN' === k) return '1'
17
17
  if ('ARRAY' === k) return '[]'
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, isAuthActive, envName, canonKey, entityIdField, pickExampleEntity, opRequestShape } from '@voxgig/sdkgen'
2
+ import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, pickExampleEntity, opRequestShape } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -10,7 +10,7 @@ import {
10
10
 
11
11
  // A type-correct Perl literal for a field's canonical type.
12
12
  function perlLit(type: any): string {
13
- const k = canonKey(type)
13
+ const k = canonScalarKey(type)
14
14
  if ('INTEGER' === k || 'NUMBER' === k) return '1'
15
15
  if ('BOOLEAN' === k) return '1'
16
16
  if ('ARRAY' === k) return '[]'
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, isAuthActive, envName, canonKey, opRequestShape, entityIdField, entityDataIdField, entityOps } from '@voxgig/sdkgen'
2
+ import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, opRequestShape, entityIdField, entityDataIdField, entityOps } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -55,7 +55,7 @@ my $client = ${ctor};
55
55
 
56
56
  // A type-correct, executable Perl literal for a param.
57
57
  const perlLit = (type: any, placeholder: string = 'example'): string => {
58
- const k = canonKey(type)
58
+ const k = canonScalarKey(type)
59
59
  if ('INTEGER' === k || 'NUMBER' === k) return '1'
60
60
  if ('BOOLEAN' === k) return '1'
61
61
  if ('ARRAY' === k) return '[]'
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, each, Content, canonKey, File, isAuthActive, entityIdField, opRequestShape } from '@voxgig/sdkgen'
2
+ import { cmp, each, Content, canonKey, canonScalarKey, File, isAuthActive, entityIdField, opRequestShape } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -9,7 +9,7 @@ import {
9
9
 
10
10
  // A type-correct, executable Perl literal for a field's canonical type.
11
11
  function perlLit(type: any, placeholder: string = 'example'): string {
12
- const k = canonKey(type)
12
+ const k = canonScalarKey(type)
13
13
  if ('INTEGER' === k || 'NUMBER' === k) return '1'
14
14
  if ('BOOLEAN' === k) return '1'
15
15
  if ('ARRAY' === k) return '[]'
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, isAuthActive, envName, canonKey, entityIdField, opRequestShape } from '@voxgig/sdkgen'
2
+ import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, opRequestShape } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -13,7 +13,7 @@ import {
13
13
  // placeholder (the doc test EXECUTES this block, so a comment placeholder
14
14
  // would break it).
15
15
  function perlLit(type: any, placeholder: string = 'example'): string {
16
- const k = canonKey(type)
16
+ const k = canonScalarKey(type)
17
17
  if ('INTEGER' === k || 'NUMBER' === k) return '1'
18
18
  if ('BOOLEAN' === k) return '1'
19
19
  if ('ARRAY' === k) return '[]'
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, canonKey, entityIdField, pickExampleEntity, opRequestShape } from '@voxgig/sdkgen'
2
+ import { cmp, Content, canonKey, canonScalarKey, entityIdField, pickExampleEntity, opRequestShape } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -10,7 +10,7 @@ import {
10
10
 
11
11
  // A type-correct Perl literal for a field's canonical type.
12
12
  function perlLit(type: any): string {
13
- const k = canonKey(type)
13
+ const k = canonScalarKey(type)
14
14
  if ('INTEGER' === k || 'NUMBER' === k) return '1'
15
15
  if ('BOOLEAN' === k) return '1'
16
16
  if ('ARRAY' === k) return '[]'
@@ -70,6 +70,11 @@ const TestEntity = cmp(function TestEntity(props: any) {
70
70
  : []
71
71
  const aliases = updateData.map(([k, v]: any) => [k, v])
72
72
 
73
+ // An entity whose basic flow has no steps yields an EMPTY list, and Perl's
74
+ // `for my $x () {` is a syntax error (unlike `for my $x (()) {`, which is a
75
+ // valid empty loop) — the whole test file then fails to compile. The loop
76
+ // below therefore wraps this in a second pair of parens, which is a no-op
77
+ // for a non-empty list because Perl flattens it.
73
78
  const opsList = Array.from(new Set(
74
79
  (allSteps as any[]).map((s: any) => s.op).filter(Boolean)))
75
80
  .map(o => `'${o}'`).join(', ')
@@ -101,7 +106,7 @@ BASIC_FLOW: {
101
106
  my $setup = ${entity.name}_basic_setup(undef);
102
107
  my $_live = $setup->{live} ? 1 : 0;
103
108
  # Per-op sdk-test-control.json skip.
104
- for my $_op (${opsList}) {
109
+ for my $_op ((${opsList})) {
105
110
  my ($_should_skip, $_reason) = ${N}TestRunner::is_control_skipped(
106
111
  'entityOp', "${entity.name}." . $_op, $_live ? 'live' : 'unit');
107
112
  if ($_should_skip) {
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, each, Content, canonToType, canonKey, entityIdField, opRequestShape, phpEntityAccessor } from '@voxgig/sdkgen'
2
+ import { cmp, each, Content, canonToType, canonKey, canonScalarKey, entityIdField, opRequestShape, phpEntityAccessor } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -12,7 +12,7 @@ import {
12
12
  // doc test EXECUTES runnable blocks, so a comment placeholder would not
13
13
  // parse).
14
14
  function phpLit(type: any, placeholder: string = 'example'): string {
15
- const k = canonKey(type)
15
+ const k = canonScalarKey(type)
16
16
  if ('INTEGER' === k || 'NUMBER' === k) return '1'
17
17
  if ('BOOLEAN' === k) return 'true'
18
18
  if ('ARRAY' === k || 'OBJECT' === k) return '[]'
@@ -1,12 +1,12 @@
1
1
 
2
- import { cmp, Content, isAuthActive, envName, canonKey, entityIdField, pickExampleEntity, opRequestShape, phpEntityAccessor } from '@voxgig/sdkgen'
2
+ import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, pickExampleEntity, opRequestShape, phpEntityAccessor } from '@voxgig/sdkgen'
3
3
 
4
4
  import { KIT, getModelPath, nom } from '@voxgig/apidef'
5
5
 
6
6
 
7
7
  // A type-correct PHP literal for a field's canonical type.
8
8
  function phpLit(type: any): string {
9
- const k = canonKey(type)
9
+ const k = canonScalarKey(type)
10
10
  if ('INTEGER' === k || 'NUMBER' === k) return '1'
11
11
  if ('BOOLEAN' === k) return 'true'
12
12
  if ('ARRAY' === k || 'OBJECT' === k) return '[]'
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, each, Content, isAuthActive, envName, canonKey, opRequestShape, entityIdField, entityDataIdField, entityOps, phpEntityAccessor } from '@voxgig/sdkgen'
2
+ import { cmp, each, Content, isAuthActive, envName, canonKey, canonScalarKey, opRequestShape, entityIdField, entityDataIdField, entityOps, phpEntityAccessor } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -57,7 +57,7 @@ $client = ${ctor};
57
57
  // placeholder (the doc test EXECUTES these blocks, so a comment
58
58
  // placeholder would not parse).
59
59
  const phpLit = (type: any, placeholder: string = 'example'): string => {
60
- const k = canonKey(type)
60
+ const k = canonScalarKey(type)
61
61
  if ('INTEGER' === k || 'NUMBER' === k) return '1'
62
62
  if ('BOOLEAN' === k) return 'true'
63
63
  if ('ARRAY' === k || 'OBJECT' === k) return '[]'
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, each, Content, canonToType, canonKey, File, isAuthActive, entityIdField, opRequestShape, phpEntityAccessor } from '@voxgig/sdkgen'
2
+ import { cmp, each, Content, canonToType, canonKey, canonScalarKey, File, isAuthActive, entityIdField, opRequestShape, phpEntityAccessor } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -12,7 +12,7 @@ import {
12
12
  // doc test EXECUTES runnable blocks, so a comment placeholder would not
13
13
  // parse).
14
14
  function phpLit(type: any, placeholder: string = 'example'): string {
15
- const k = canonKey(type)
15
+ const k = canonScalarKey(type)
16
16
  if ('INTEGER' === k || 'NUMBER' === k) return '1'
17
17
  if ('BOOLEAN' === k) return 'true'
18
18
  if ('ARRAY' === k || 'OBJECT' === k) return '[]'
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, isAuthActive, envName, canonKey, entityIdField, opRequestShape, phpEntityAccessor } from '@voxgig/sdkgen'
2
+ import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, opRequestShape, phpEntityAccessor } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -12,7 +12,7 @@ import {
12
12
  // params render a typed literal; strings render the quoted placeholder (the
13
13
  // doc test EXECUTES this block, so a comment placeholder would break it).
14
14
  function phpLit(type: any, placeholder: string = 'example'): string {
15
- const k = canonKey(type)
15
+ const k = canonScalarKey(type)
16
16
  if ('INTEGER' === k || 'NUMBER' === k) return '1'
17
17
  if ('BOOLEAN' === k) return 'true'
18
18
  if ('ARRAY' === k || 'OBJECT' === k) return '[]'
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, canonKey, entityIdField, pickExampleEntity, opRequestShape, phpEntityAccessor } from '@voxgig/sdkgen'
2
+ import { cmp, Content, canonKey, canonScalarKey, entityIdField, pickExampleEntity, opRequestShape, phpEntityAccessor } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -10,7 +10,7 @@ import {
10
10
 
11
11
  // A type-correct PHP literal for a field's canonical type.
12
12
  function phpLit(type: any): string {
13
- const k = canonKey(type)
13
+ const k = canonScalarKey(type)
14
14
  if ('INTEGER' === k || 'NUMBER' === k) return '1'
15
15
  if ('BOOLEAN' === k) return 'true'
16
16
  if ('ARRAY' === k || 'OBJECT' === k) return '[]'
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, each, Content, canonToType, canonKey, entityIdField, opRequestShape, safeVarName, exampleVarName, matchArg, idLiteral } from '@voxgig/sdkgen'
2
+ import { cmp, each, Content, canonToType, canonKey, canonScalarKey, entityIdField, opRequestShape, safeVarName, exampleVarName, matchArg, idLiteral } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -13,7 +13,7 @@ import {
13
13
  // "Object of type ellipsis is not JSON serializable" — use a real value.
14
14
  // Strings render the quoted placeholder.
15
15
  function pyLit(type: any, placeholder: string = 'example'): string {
16
- const k = canonKey(type)
16
+ const k = canonScalarKey(type)
17
17
  if ('INTEGER' === k || 'NUMBER' === k) return '1'
18
18
  if ('BOOLEAN' === k) return 'True'
19
19
  if ('ARRAY' === k) return '[]'
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, isAuthActive, envName, canonKey, entityIdField, pickExampleEntity, opRequestShape, safeVarName, exampleVarName } from '@voxgig/sdkgen'
2
+ import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, pickExampleEntity, opRequestShape, safeVarName, exampleVarName } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -10,7 +10,7 @@ import {
10
10
 
11
11
  // A type-correct Python literal for a field's canonical type.
12
12
  function pyLit(type: any): string {
13
- const k = canonKey(type)
13
+ const k = canonScalarKey(type)
14
14
  if ('INTEGER' === k || 'NUMBER' === k) return '1'
15
15
  if ('BOOLEAN' === k) return 'True'
16
16
  if ('ARRAY' === k) return '[]'
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, each, Content, isAuthActive, envName, canonKey, opRequestShape, entityIdField, entityDataIdField, entityOps, safeVarName, exampleVarName, matchArg, idLiteral } from '@voxgig/sdkgen'
2
+ import { cmp, each, Content, isAuthActive, envName, canonKey, canonScalarKey, opRequestShape, entityIdField, entityDataIdField, entityOps, safeVarName, exampleVarName, matchArg, idLiteral } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -73,7 +73,7 @@ client = ${ctor}
73
73
  // placeholder (the doc test EXECUTES these blocks, so a comment
74
74
  // placeholder would not parse).
75
75
  const pyLit = (type: any, placeholder: string = 'example'): string => {
76
- const k = canonKey(type)
76
+ const k = canonScalarKey(type)
77
77
  if ('INTEGER' === k || 'NUMBER' === k) return '1'
78
78
  if ('BOOLEAN' === k) return 'True'
79
79
  if ('ARRAY' === k) return '[]'