@voxgig/sdkgen 4.35.2 → 4.36.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.
Files changed (259) hide show
  1. package/bin/voxgig-sdkgen +1 -1
  2. package/dist/cmp/ReadmeTop.js +1 -1
  3. package/dist/cmp/ReadmeTop.js.map +1 -1
  4. package/dist/helpers/flowGuard.js +12 -1
  5. package/dist/helpers/flowGuard.js.map +1 -1
  6. package/dist/helpers/opExample.d.ts +4 -1
  7. package/dist/helpers/opExample.js +11 -1
  8. package/dist/helpers/opExample.js.map +1 -1
  9. package/dist/helpers/opShape.d.ts +2 -1
  10. package/dist/helpers/opShape.js +53 -26
  11. package/dist/helpers/opShape.js.map +1 -1
  12. package/dist/helpers/pointPath.d.ts +2 -1
  13. package/dist/helpers/pointPath.js +17 -0
  14. package/dist/helpers/pointPath.js.map +1 -1
  15. package/dist/helpers/testPolicy.d.ts +48 -2
  16. package/dist/helpers/testPolicy.js +265 -0
  17. package/dist/helpers/testPolicy.js.map +1 -1
  18. package/dist/sdkgen.d.ts +7 -7
  19. package/dist/sdkgen.js +26 -4
  20. package/dist/sdkgen.js.map +1 -1
  21. package/dist/tsconfig.tsbuildinfo +1 -1
  22. package/package.json +1 -1
  23. package/project/.sdk/src/cmp/c/PrepareAuth_c.ts +10 -4
  24. package/project/.sdk/src/cmp/c/ReadmeEntity_c.ts +2 -2
  25. package/project/.sdk/src/cmp/c/ReadmeHowto_c.ts +2 -2
  26. package/project/.sdk/src/cmp/c/ReadmeQuick_c.ts +6 -5
  27. package/project/.sdk/src/cmp/c/ReadmeRef_c.ts +3 -3
  28. package/project/.sdk/src/cmp/c/ReadmeTopQuick_c.ts +2 -2
  29. package/project/.sdk/src/cmp/c/ReadmeTopTest_c.ts +2 -2
  30. package/project/.sdk/src/cmp/c/TestDirect_c.ts +2 -6
  31. package/project/.sdk/src/cmp/clojure/ReadmeEntity_clojure.ts +2 -2
  32. package/project/.sdk/src/cmp/clojure/ReadmeHowto_clojure.ts +2 -2
  33. package/project/.sdk/src/cmp/clojure/ReadmeQuick_clojure.ts +4 -4
  34. package/project/.sdk/src/cmp/clojure/ReadmeRef_clojure.ts +3 -3
  35. package/project/.sdk/src/cmp/clojure/ReadmeTopQuick_clojure.ts +2 -2
  36. package/project/.sdk/src/cmp/clojure/ReadmeTopTest_clojure.ts +2 -2
  37. package/project/.sdk/src/cmp/cpp/ReadmeEntity_cpp.ts +2 -2
  38. package/project/.sdk/src/cmp/cpp/ReadmeHowto_cpp.ts +2 -2
  39. package/project/.sdk/src/cmp/cpp/ReadmeQuick_cpp.ts +4 -4
  40. package/project/.sdk/src/cmp/cpp/ReadmeRef_cpp.ts +3 -3
  41. package/project/.sdk/src/cmp/cpp/ReadmeTopQuick_cpp.ts +2 -2
  42. package/project/.sdk/src/cmp/cpp/ReadmeTopTest_cpp.ts +2 -2
  43. package/project/.sdk/src/cmp/cpp/TestDirect_cpp.ts +2 -6
  44. package/project/.sdk/src/cmp/cpp/TestEntity_cpp.ts +51 -3
  45. package/project/.sdk/src/cmp/csharp/ReadmeEntity_csharp.ts +2 -2
  46. package/project/.sdk/src/cmp/csharp/ReadmeHowto_csharp.ts +2 -2
  47. package/project/.sdk/src/cmp/csharp/ReadmeQuick_csharp.ts +5 -5
  48. package/project/.sdk/src/cmp/csharp/ReadmeRef_csharp.ts +3 -3
  49. package/project/.sdk/src/cmp/csharp/ReadmeTopQuick_csharp.ts +3 -3
  50. package/project/.sdk/src/cmp/csharp/ReadmeTopTest_csharp.ts +2 -2
  51. package/project/.sdk/src/cmp/csharp/TestDirect_csharp.ts +41 -19
  52. package/project/.sdk/src/cmp/csharp/TestEntity_csharp.ts +105 -27
  53. package/project/.sdk/src/cmp/elixir/ReadmeEntity_elixir.ts +2 -2
  54. package/project/.sdk/src/cmp/elixir/ReadmeHowto_elixir.ts +2 -2
  55. package/project/.sdk/src/cmp/elixir/ReadmeQuick_elixir.ts +4 -4
  56. package/project/.sdk/src/cmp/elixir/ReadmeRef_elixir.ts +3 -3
  57. package/project/.sdk/src/cmp/elixir/ReadmeTopQuick_elixir.ts +2 -2
  58. package/project/.sdk/src/cmp/elixir/ReadmeTopTest_elixir.ts +2 -2
  59. package/project/.sdk/src/cmp/go/EntityOperation_go.ts +2 -2
  60. package/project/.sdk/src/cmp/go/Entity_go.ts +4 -3
  61. package/project/.sdk/src/cmp/go/Main_go.ts +2 -2
  62. package/project/.sdk/src/cmp/go/PrepareAuth_go.ts +24 -15
  63. package/project/.sdk/src/cmp/go/ReadmeEntity_go.ts +2 -2
  64. package/project/.sdk/src/cmp/go/ReadmeHowto_go.ts +2 -2
  65. package/project/.sdk/src/cmp/go/ReadmeQuick_go.ts +4 -4
  66. package/project/.sdk/src/cmp/go/ReadmeRef_go.ts +3 -3
  67. package/project/.sdk/src/cmp/go/ReadmeTopTest_go.ts +2 -2
  68. package/project/.sdk/src/cmp/go/TestDirect_go.ts +61 -26
  69. package/project/.sdk/src/cmp/go/TestEntity_go.ts +115 -32
  70. package/project/.sdk/src/cmp/java/ReadmeEntity_java.ts +2 -2
  71. package/project/.sdk/src/cmp/java/ReadmeHowto_java.ts +2 -2
  72. package/project/.sdk/src/cmp/java/ReadmeQuick_java.ts +5 -5
  73. package/project/.sdk/src/cmp/java/ReadmeRef_java.ts +3 -3
  74. package/project/.sdk/src/cmp/java/ReadmeTopQuick_java.ts +3 -3
  75. package/project/.sdk/src/cmp/java/ReadmeTopTest_java.ts +2 -2
  76. package/project/.sdk/src/cmp/java/TestDirect_java.ts +40 -20
  77. package/project/.sdk/src/cmp/java/TestEntity_java.ts +107 -26
  78. package/project/.sdk/src/cmp/js/ReadmeEntity_js.ts +2 -2
  79. package/project/.sdk/src/cmp/js/ReadmeHowto_js.ts +2 -2
  80. package/project/.sdk/src/cmp/js/ReadmeQuick_js.ts +4 -4
  81. package/project/.sdk/src/cmp/js/ReadmeRef_js.ts +3 -3
  82. package/project/.sdk/src/cmp/js/ReadmeTopTest_js.ts +2 -2
  83. package/project/.sdk/src/cmp/js/TestDirect_js.ts +68 -13
  84. package/project/.sdk/src/cmp/js/TestEntity_js.ts +46 -4
  85. package/project/.sdk/src/cmp/kotlin/ReadmeEntity_kotlin.ts +2 -2
  86. package/project/.sdk/src/cmp/kotlin/ReadmeHowto_kotlin.ts +2 -2
  87. package/project/.sdk/src/cmp/kotlin/ReadmeQuick_kotlin.ts +5 -5
  88. package/project/.sdk/src/cmp/kotlin/ReadmeRef_kotlin.ts +3 -3
  89. package/project/.sdk/src/cmp/kotlin/ReadmeTopQuick_kotlin.ts +3 -3
  90. package/project/.sdk/src/cmp/kotlin/ReadmeTopTest_kotlin.ts +2 -2
  91. package/project/.sdk/src/cmp/kotlin/TestDirect_kotlin.ts +41 -21
  92. package/project/.sdk/src/cmp/kotlin/TestEntity_kotlin.ts +99 -22
  93. package/project/.sdk/src/cmp/lua/ReadmeEntity_lua.ts +2 -2
  94. package/project/.sdk/src/cmp/lua/ReadmeHowto_lua.ts +2 -2
  95. package/project/.sdk/src/cmp/lua/ReadmeQuick_lua.ts +4 -4
  96. package/project/.sdk/src/cmp/lua/ReadmeRef_lua.ts +3 -3
  97. package/project/.sdk/src/cmp/lua/ReadmeTopQuick_lua.ts +3 -3
  98. package/project/.sdk/src/cmp/lua/ReadmeTopTest_lua.ts +2 -2
  99. package/project/.sdk/src/cmp/lua/TestDirect_lua.ts +40 -16
  100. package/project/.sdk/src/cmp/lua/TestEntity_lua.ts +108 -30
  101. package/project/.sdk/src/cmp/ocaml/ReadmeEntity_ocaml.ts +2 -2
  102. package/project/.sdk/src/cmp/ocaml/ReadmeHowto_ocaml.ts +2 -2
  103. package/project/.sdk/src/cmp/ocaml/ReadmeQuick_ocaml.ts +4 -4
  104. package/project/.sdk/src/cmp/ocaml/ReadmeRef_ocaml.ts +3 -3
  105. package/project/.sdk/src/cmp/ocaml/ReadmeTopQuick_ocaml.ts +2 -2
  106. package/project/.sdk/src/cmp/ocaml/ReadmeTopTest_ocaml.ts +2 -2
  107. package/project/.sdk/src/cmp/perl/ReadmeEntity_perl.ts +2 -2
  108. package/project/.sdk/src/cmp/perl/ReadmeHowto_perl.ts +2 -2
  109. package/project/.sdk/src/cmp/perl/ReadmeQuick_perl.ts +4 -4
  110. package/project/.sdk/src/cmp/perl/ReadmeRef_perl.ts +3 -3
  111. package/project/.sdk/src/cmp/perl/ReadmeTopQuick_perl.ts +2 -2
  112. package/project/.sdk/src/cmp/perl/ReadmeTopTest_perl.ts +2 -2
  113. package/project/.sdk/src/cmp/perl/TestDirect_perl.ts +35 -16
  114. package/project/.sdk/src/cmp/perl/TestEntity_perl.ts +98 -22
  115. package/project/.sdk/src/cmp/php/ReadmeEntity_php.ts +2 -2
  116. package/project/.sdk/src/cmp/php/ReadmeHowto_php.ts +2 -2
  117. package/project/.sdk/src/cmp/php/ReadmeQuick_php.ts +4 -4
  118. package/project/.sdk/src/cmp/php/ReadmeRef_php.ts +3 -3
  119. package/project/.sdk/src/cmp/php/ReadmeTopQuick_php.ts +2 -2
  120. package/project/.sdk/src/cmp/php/ReadmeTopTest_php.ts +2 -2
  121. package/project/.sdk/src/cmp/php/TestDirect_php.ts +33 -16
  122. package/project/.sdk/src/cmp/php/TestEntity_php.ts +98 -29
  123. package/project/.sdk/src/cmp/py/ReadmeEntity_py.ts +2 -2
  124. package/project/.sdk/src/cmp/py/ReadmeHowto_py.ts +2 -2
  125. package/project/.sdk/src/cmp/py/ReadmeQuick_py.ts +4 -4
  126. package/project/.sdk/src/cmp/py/ReadmeRef_py.ts +3 -3
  127. package/project/.sdk/src/cmp/py/ReadmeTopQuick_py.ts +2 -2
  128. package/project/.sdk/src/cmp/py/ReadmeTopTest_py.ts +2 -2
  129. package/project/.sdk/src/cmp/py/TestDirect_py.ts +39 -16
  130. package/project/.sdk/src/cmp/py/TestEntity_py.ts +90 -27
  131. package/project/.sdk/src/cmp/rb/ReadmeEntity_rb.ts +2 -2
  132. package/project/.sdk/src/cmp/rb/ReadmeHowto_rb.ts +2 -2
  133. package/project/.sdk/src/cmp/rb/ReadmeQuick_rb.ts +4 -4
  134. package/project/.sdk/src/cmp/rb/ReadmeRef_rb.ts +3 -3
  135. package/project/.sdk/src/cmp/rb/ReadmeTopQuick_rb.ts +2 -2
  136. package/project/.sdk/src/cmp/rb/ReadmeTopTest_rb.ts +2 -2
  137. package/project/.sdk/src/cmp/rb/TestClean_rb.ts +1 -1
  138. package/project/.sdk/src/cmp/rb/TestDirect_rb.ts +33 -16
  139. package/project/.sdk/src/cmp/rb/TestEntity_rb.ts +90 -25
  140. package/project/.sdk/src/cmp/rb/fragment/Main.fragment.rb +3 -3
  141. package/project/.sdk/src/cmp/rust/ReadmeEntity_rust.ts +2 -2
  142. package/project/.sdk/src/cmp/rust/ReadmeHowto_rust.ts +2 -2
  143. package/project/.sdk/src/cmp/rust/ReadmeQuick_rust.ts +4 -4
  144. package/project/.sdk/src/cmp/rust/ReadmeRef_rust.ts +3 -3
  145. package/project/.sdk/src/cmp/rust/ReadmeTopQuick_rust.ts +2 -2
  146. package/project/.sdk/src/cmp/rust/ReadmeTopTest_rust.ts +2 -2
  147. package/project/.sdk/src/cmp/rust/TestDirect_rust.ts +40 -12
  148. package/project/.sdk/src/cmp/rust/TestEntity_rust.ts +108 -25
  149. package/project/.sdk/src/cmp/scala/ReadmeEntity_scala.ts +2 -2
  150. package/project/.sdk/src/cmp/scala/ReadmeHowto_scala.ts +2 -2
  151. package/project/.sdk/src/cmp/scala/ReadmeQuick_scala.ts +5 -5
  152. package/project/.sdk/src/cmp/scala/ReadmeRef_scala.ts +3 -3
  153. package/project/.sdk/src/cmp/scala/ReadmeTopQuick_scala.ts +3 -3
  154. package/project/.sdk/src/cmp/scala/ReadmeTopTest_scala.ts +2 -2
  155. package/project/.sdk/src/cmp/scala/TestDirect_scala.ts +2 -6
  156. package/project/.sdk/src/cmp/scala/TestEntity_scala.ts +36 -7
  157. package/project/.sdk/src/cmp/swift/ReadmeEntity_swift.ts +2 -2
  158. package/project/.sdk/src/cmp/swift/ReadmeHowto_swift.ts +2 -2
  159. package/project/.sdk/src/cmp/swift/ReadmeQuick_swift.ts +5 -5
  160. package/project/.sdk/src/cmp/swift/ReadmeRef_swift.ts +3 -3
  161. package/project/.sdk/src/cmp/swift/ReadmeTopQuick_swift.ts +2 -2
  162. package/project/.sdk/src/cmp/swift/ReadmeTopTest_swift.ts +2 -2
  163. package/project/.sdk/src/cmp/ts/ReadmeEntity_ts.ts +2 -2
  164. package/project/.sdk/src/cmp/ts/ReadmeExamplesTest_ts.ts +49 -19
  165. package/project/.sdk/src/cmp/ts/ReadmeHowto_ts.ts +2 -2
  166. package/project/.sdk/src/cmp/ts/ReadmeQuick_ts.ts +4 -4
  167. package/project/.sdk/src/cmp/ts/ReadmeRef_ts.ts +3 -3
  168. package/project/.sdk/src/cmp/ts/ReadmeTopTest_ts.ts +3 -3
  169. package/project/.sdk/src/cmp/ts/TestDirect_ts.ts +54 -23
  170. package/project/.sdk/src/cmp/ts/TestEntity_ts.ts +49 -4
  171. package/project/.sdk/src/cmp/zig/ReadmeEntity_zig.ts +2 -2
  172. package/project/.sdk/src/cmp/zig/ReadmeHowto_zig.ts +2 -2
  173. package/project/.sdk/src/cmp/zig/ReadmeQuick_zig.ts +4 -4
  174. package/project/.sdk/src/cmp/zig/ReadmeRef_zig.ts +3 -3
  175. package/project/.sdk/src/cmp/zig/ReadmeTopQuick_zig.ts +2 -2
  176. package/project/.sdk/src/cmp/zig/ReadmeTopTest_zig.ts +2 -2
  177. package/project/.sdk/tm/c/tests/primary_utility_test.c +37 -0
  178. package/project/.sdk/tm/c/utility/fetcher.c +31 -1
  179. package/project/.sdk/tm/c/utility/make_url.c +6 -2
  180. package/project/.sdk/tm/clojure/src/sdk/core.clj +21 -3
  181. package/project/.sdk/tm/clojure/test/sdk/test/pipeline.clj +34 -0
  182. package/project/.sdk/tm/cpp/test/primary_utility_test.cpp +37 -0
  183. package/project/.sdk/tm/cpp/utility/pipeline.hpp +28 -2
  184. package/project/.sdk/tm/csharp/test/PrimaryUtilityTest.cs +40 -0
  185. package/project/.sdk/tm/csharp/utility/Fetcher.cs +27 -0
  186. package/project/.sdk/tm/csharp/utility/MakeUrl.cs +7 -2
  187. package/project/.sdk/tm/elixir/lib/projectname/utility.ex +30 -3
  188. package/project/.sdk/tm/elixir/test/pipeline_test.exs +23 -0
  189. package/project/.sdk/tm/go/test/feature_corpus_test.go +3 -4
  190. package/project/.sdk/tm/go/test/primary_utility_test.go +28 -0
  191. package/project/.sdk/tm/go/utility/fetcher.go +26 -0
  192. package/project/.sdk/tm/go/utility/make_url.go +5 -2
  193. package/project/.sdk/tm/java/test/FeatureCorpusTest.java +4 -5
  194. package/project/.sdk/tm/java/test/PrimaryUtilityTest.java +49 -0
  195. package/project/.sdk/tm/java/utility/Fetcher.java +24 -0
  196. package/project/.sdk/tm/java/utility/MakeUrl.java +6 -2
  197. package/project/.sdk/tm/js/src/utility/FetcherUtility.js +24 -0
  198. package/project/.sdk/tm/js/src/utility/MakeUrlUtility.js +6 -2
  199. package/project/.sdk/tm/js/test/feature/Corpus.test.js +7 -6
  200. package/project/.sdk/tm/js/test/live-entity.js +18 -6
  201. package/project/.sdk/tm/js/test/live-runner.js +15 -3
  202. package/project/.sdk/tm/js/test/utility/PrimaryUtility.test.js +25 -0
  203. package/project/.sdk/tm/kotlin/test/PrimaryUtilityTest.kt +48 -0
  204. package/project/.sdk/tm/kotlin/utility/Fetcher.kt +20 -0
  205. package/project/.sdk/tm/kotlin/utility/MakeSpecUrl.kt +6 -2
  206. package/project/.sdk/tm/lua/test/pipeline_test.lua +27 -0
  207. package/project/.sdk/tm/lua/test/primary_utility_test.lua +36 -0
  208. package/project/.sdk/tm/lua/utility/fetcher.lua +31 -0
  209. package/project/.sdk/tm/lua/utility/make_url.lua +6 -2
  210. package/project/.sdk/tm/ocaml/Makefile +5 -1
  211. package/project/.sdk/tm/ocaml/sdk_runtime.ml +36 -4
  212. package/project/.sdk/tm/ocaml/test/t_pipeline.ml +22 -0
  213. package/project/.sdk/tm/perl/t/primary_utility.t +22 -0
  214. package/project/.sdk/tm/perl/utility/fetcher.pm +18 -0
  215. package/project/.sdk/tm/perl/utility/make_url.pm +4 -2
  216. package/project/.sdk/tm/php/test/FeatureCorpusTest.php +6 -5
  217. package/project/.sdk/tm/php/test/PipelineTest.php +31 -7
  218. package/project/.sdk/tm/php/utility/Fetcher.php +34 -27
  219. package/project/.sdk/tm/php/utility/MakeOptions.php +2 -1
  220. package/project/.sdk/tm/php/utility/MakeUrl.php +6 -2
  221. package/project/.sdk/tm/py/pkg/utility/fetcher.py +23 -0
  222. package/project/.sdk/tm/py/pkg/utility/make_url.py +5 -2
  223. package/project/.sdk/tm/py/test/test_feature_corpus.py +5 -5
  224. package/project/.sdk/tm/py/test/test_primary_utility.py +21 -0
  225. package/project/.sdk/tm/rb/core/context.rb +1 -1
  226. package/project/.sdk/tm/rb/core/error.rb +20 -1
  227. package/project/.sdk/tm/rb/test/feature_corpus_test.rb +4 -5
  228. package/project/.sdk/tm/rb/test/feature_test.rb +2 -2
  229. package/project/.sdk/tm/rb/test/omni.rb +1 -1
  230. package/project/.sdk/tm/rb/test/pipeline_test.rb +19 -2
  231. package/project/.sdk/tm/rb/test/primary_utility_test.rb +28 -1
  232. package/project/.sdk/tm/rb/utility/fetcher.rb +20 -1
  233. package/project/.sdk/tm/rb/utility/make_error.rb +1 -1
  234. package/project/.sdk/tm/rb/utility/make_url.rb +4 -2
  235. package/project/.sdk/tm/rust/tests/primary_utility_test.rs +34 -0
  236. package/project/.sdk/tm/rust/utility/fetcher.rs +27 -0
  237. package/project/.sdk/tm/rust/utility/make_url.rs +7 -2
  238. package/project/.sdk/tm/scala/sdktest/SdkTestMain.scala +51 -1
  239. package/project/.sdk/tm/scala/utility/Fetcher.scala +16 -0
  240. package/project/.sdk/tm/scala/utility/Make.scala +6 -2
  241. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Fetcher.swift +24 -0
  242. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Make.swift +6 -2
  243. package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/PrimaryUtilityTest.swift +34 -0
  244. package/project/.sdk/tm/ts/src/utility/FetcherUtility.ts +24 -0
  245. package/project/.sdk/tm/ts/src/utility/MakeUrlUtility.ts +6 -2
  246. package/project/.sdk/tm/ts/test/feature/Corpus.test.ts +7 -6
  247. package/project/.sdk/tm/ts/test/live-entity.ts +20 -5
  248. package/project/.sdk/tm/ts/test/live-runner.ts +17 -3
  249. package/project/.sdk/tm/ts/test/utility/PrimaryUtility.test.ts +25 -0
  250. package/project/.sdk/tm/zig/core/utility.zig +30 -3
  251. package/project/.sdk/tm/zig/test/primary_utility_test.zig +28 -0
  252. package/project/sdkgen-package.json +1 -1
  253. package/src/cmp/ReadmeTop.ts +3 -3
  254. package/src/helpers/flowGuard.ts +12 -1
  255. package/src/helpers/opExample.ts +16 -1
  256. package/src/helpers/opShape.ts +64 -30
  257. package/src/helpers/pointPath.ts +19 -0
  258. package/src/helpers/testPolicy.ts +316 -2
  259. package/src/sdkgen.ts +37 -5
@@ -4,7 +4,7 @@ import * as Path from 'node:path'
4
4
  import {
5
5
  cmp, each, camelify, names,
6
6
  File, Content, Folder, Fragment, Line, FeatureHook, Slot,
7
- entityClassName, entityCollection, goModule
7
+ entityClassName, entityConstructorName, entityCollection, goModule
8
8
  } from '@voxgig/sdkgen'
9
9
 
10
10
  import {
@@ -26,6 +26,7 @@ const Entity = cmp(function Entity(props: any) {
26
26
  // clash with another entity's data-type name. The DATA type stays `<Name>`.
27
27
  const entityColl = entityCollection(model)
28
28
  const cls = entityClassName(entity, entityColl)
29
+ const ctor = entityConstructorName(entity, entityColl)
29
30
 
30
31
  const entrep = {
31
32
  ...stdrep,
@@ -58,7 +59,7 @@ const Entity = cmp(function Entity(props: any) {
58
59
  `)
59
60
  } :
60
61
  ({ indent }: any) => {
61
- EntityOperation({ ff, opname, indent, entity, entrep, gomodule, cls })
62
+ EntityOperation({ ff, opname, indent, entity, entrep, gomodule, cls, ctor })
62
63
  }, a), {}))
63
64
 
64
65
  Fragment({
@@ -72,7 +73,7 @@ const Entity = cmp(function Entity(props: any) {
72
73
  entityname: entity.name,
73
74
 
74
75
  EntyClass: cls,
75
- NewEntyClass: 'New' + cls,
76
+ NewEntyClass: ctor,
76
77
 
77
78
  '#Entity-Hook': ({ name, indent }: any) =>
78
79
  Content({ indent }, `utility.FeatureHook(ctx, "${name}")`),
@@ -5,7 +5,7 @@ import {
5
5
  cmp, each, names, cmap,
6
6
  List, File, Content, Copy, Folder, Fragment, Line, FeatureHook,
7
7
  inactiveFeatureExcludes,
8
- entityClassName, entityCollection, goModule, goPackageIdent, pluginExcludes,
8
+ entityConstructorName, entityCollection, goModule, goPackageIdent, pluginExcludes,
9
9
  targetFeatures,
10
10
  TEST_CONTROL_EXCLUDE
11
11
  } from '@voxgig/sdkgen'
@@ -186,7 +186,7 @@ func init() {
186
186
 
187
187
  each(entity, (ent: any) => {
188
188
  Content(` core.New${ent.Name}EntityFunc = func(client *core.${model.const.Name}SDK, entopts map[string]any) core.${model.const.Name}Entity {
189
- return entity.New${entityClassName(ent, entityCollection(model))}(client, entopts)
189
+ return entity.${entityConstructorName(ent, entityCollection(model))}(client, entopts)
190
190
  }
191
191
  `)
192
192
  })
@@ -79,22 +79,10 @@ func prepareAuthUtil(ctx *core.Context) (*core.Spec, error) {
79
79
  // HTTP Basic is header-only by definition: the scheme is
80
80
  // `Authorization: Basic base64(user:pass)`. It cannot be expressed as a
81
81
  // query parameter or a cookie, so the branch is emitted only where it can
82
- // mean something — and base64 is imported only then.
82
+ // mean something.
83
83
  const withBasic = spec.basic && 'header' === spec.where
84
84
 
85
- const head = `package utility
86
-
87
- import (
88
- ${withBasic ? ` "encoding/base64"
89
-
90
- ` : ''}${'query' !== spec.where ? ` "strings"
91
-
92
- ` : ''} vs "${spec.gomodule}/utility/struct"
93
-
94
- "${spec.gomodule}/core"
95
- )
96
-
97
- const credName = "${gostr(credLiteral(spec.where, spec.name))}"
85
+ const head = `const credName = "${gostr(credLiteral(spec.where, spec.name))}"
98
86
  ${'cookie' === spec.where ? `const cookieHeader = "cookie"
99
87
  ` : ''}const optionApikey = "apikey"
100
88
  ${withBasic ? `const optionSecret = "secret"
@@ -181,7 +169,7 @@ ${cookieHelper(spec.where)}func prepareAuthUtil(ctx *core.Context) (*core.Spec,
181
169
  }
182
170
  `
183
171
 
184
- return head + basicBlock + `
172
+ const body = head + basicBlock + `
185
173
  if skip {
186
174
  ${clear(spec.where, 'name')}
187
175
  } else {
@@ -191,6 +179,27 @@ ${place(spec.where, 'name')}
191
179
  return spec, nil
192
180
  }
193
181
  `
182
+
183
+ return `package utility
184
+
185
+ import (
186
+ ${stdImports(body)} vs "${spec.gomodule}/utility/struct"
187
+
188
+ "${spec.gomodule}/core"
189
+ )
190
+
191
+ ` + body
192
+ }
193
+
194
+
195
+ // Go rejects an unused import, and which of these the body calls varies by placement.
196
+ const STD_IMPORTS = ['encoding/base64', 'strings']
197
+
198
+ function stdImports(body: string): string {
199
+ return STD_IMPORTS
200
+ .filter((pkg) => new RegExp('\\b' + pkg.split('/').pop() + '\\.[A-Z]').test(body))
201
+ .map((pkg) => `\t"${pkg}"\n\n`)
202
+ .join('')
194
203
  }
195
204
 
196
205
 
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, each, Content, canonToType, entityIdField, entityOps, opRequestShape, listMatchArg, matchExampleItems, litString } from '@voxgig/sdkgen'
2
+ import { cmp, each, Content, canonToType, entityIdField, entityOps, listMatchArg, matchExampleItems, litString, requestExampleItems } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -145,7 +145,7 @@ for _, item := range ${eVar}s.([]any) {
145
145
  // with a type-correct example VALUE via exampleValue — a
146
146
  // `"name": /* type */` comment is not a value and yields uncompilable
147
147
  // Go, so the example must carry a real literal.
148
- const createItems = opRequestShape(entity, 'create').items
148
+ const createItems = requestExampleItems(entity, 'create')
149
149
  .filter((it: any) => !it.optional)
150
150
  Content(`#### Example: Create
151
151
 
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, pickExampleEntity, opRequestShape, goModule, requiredItems, litPair, matchExampleItems } from '@voxgig/sdkgen'
2
+ import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, pickExampleEntity, goModule, requiredItems, litPair, matchExampleItems, requestExampleItems } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -49,7 +49,7 @@ const ReadmeHowto = cmp(function ReadmeHowto(props: any) {
49
49
  ? `map[string]any{${items.map((it: any) => litPair('go', it.name, isMatchOp && it.name === idF ? '"test01"' : goLit(it.type))).join(', ')}}`
50
50
  : 'nil'
51
51
  } else if (exampleEntity && ('create' === primaryOp || 'update' === primaryOp || 'patch' === primaryOp)) {
52
- const items = opRequestShape(exampleEntity, primaryOp).items
52
+ const items = requestExampleItems(exampleEntity, primaryOp)
53
53
  .filter((it: any) => it.name !== idF && it.name !== 'id')
54
54
  const required = items.filter((it: any) => !it.optional)
55
55
  const chosen = required.length ? required : items.slice(0, 3)
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, isAuthActive, envName, opRequestShape, entityIdField, entityOps, goModule, serverVariables, listMatchArg, matchExampleItems, litString } from '@voxgig/sdkgen'
2
+ import { cmp, Content, isAuthActive, envName, entityIdField, entityOps, goModule, serverVariables, listMatchArg, matchExampleItems, litString, requestExampleItems, sendsId } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -50,7 +50,7 @@ const ReadmeQuick = cmp(function ReadmeQuick(props: any) {
50
50
  const idF = entityIdField(exampleEntity)
51
51
 
52
52
  const exampleFields = (opname: string): string[] => {
53
- const items = opRequestShape(exampleEntity, opname).items
53
+ const items = requestExampleItems(exampleEntity, opname)
54
54
  .filter((it: any) => (it.name !== idF && it.name !== 'id') ||
55
55
  ('create' === opname && !it.optional))
56
56
  const required = items.filter((it: any) => !it.optional)
@@ -116,7 +116,7 @@ const ReadmeQuick = cmp(function ReadmeQuick(props: any) {
116
116
  if (opnames.includes('update')) {
117
117
  // The id member (when the entity has an id-like key) plus example
118
118
  // patch fields — the same shape that generates the op's request data.
119
- const updateMembers = (idF
119
+ const updateMembers = (sendsId(exampleEntity, 'update', idF)
120
120
  ? [`${litString('go', idF)}: ${exampleValue(exampleEntity, exampleEntity.op.update, idF, 'example_id')}`]
121
121
  : []).concat(exampleFields('update'))
122
122
  body.push(` // Update a ${eLower}.`)
@@ -130,7 +130,7 @@ const ReadmeQuick = cmp(function ReadmeQuick(props: any) {
130
130
  }
131
131
 
132
132
  if (opnames.includes('patch')) {
133
- const patchMembers = (idF
133
+ const patchMembers = (sendsId(exampleEntity, 'patch', idF)
134
134
  ? [`${litString('go', idF)}: ${exampleValue(exampleEntity, exampleEntity.op.patch, idF, 'example_id')}`]
135
135
  : []).concat(exampleFields('patch'))
136
136
  body.push(` // Patch a ${eLower}: only the fields given are sent.`)
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, each, Content, canonToType, File, isAuthActive, entityIdField, entityOps, opRequestShape, targetFeatures, bodyNote, listMatchArg, matchExampleItems, litString } from '@voxgig/sdkgen'
2
+ import { cmp, each, Content, canonToType, File, isAuthActive, entityIdField, entityOps, targetFeatures, bodyNote, listMatchArg, matchExampleItems, litString, requestExampleItems } from '@voxgig/sdkgen'
3
3
  import { ReadmeRefFeatures } from '@voxgig/sdkgen'
4
4
 
5
5
  import {
@@ -300,7 +300,7 @@ for _, item := range results.([]any) {
300
300
  // required id), each with a type-correct example VALUE via
301
301
  // exampleValue — a `"name": /* type */` comment is not a value
302
302
  // and yields uncompilable Go.
303
- const createItems = opRequestShape(ent, 'create').items
303
+ const createItems = requestExampleItems(ent, 'create')
304
304
  .filter((it: any) => !it.optional)
305
305
  Content(`\`\`\`go
306
306
  result, err := client.${ent.Name}(nil).Create(map[string]any{
@@ -322,7 +322,7 @@ fmt.Println(result.(sdk.Entity).Data())
322
322
  // The id key plus every REQUIRED data member — the same shape
323
323
  // that generates the op's request data — then the patch-fields
324
324
  // note.
325
- const updateItems = opRequestShape(ent, opname).items
325
+ const updateItems = requestExampleItems(ent, opname)
326
326
  .filter((it: any) => !it.optional || it.name === idF)
327
327
  .sort((a: any, b: any) =>
328
328
  (a.name === idF ? 0 : 1) - (b.name === idF ? 0 : 1))
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, canonKey, canonScalarKey, entityIdField, pickExampleEntity, opRequestShape, goModule, requiredItems, litPair, matchExampleItems } from '@voxgig/sdkgen'
2
+ import { cmp, Content, canonKey, canonScalarKey, entityIdField, pickExampleEntity, goModule, requiredItems, litPair, matchExampleItems, requestExampleItems } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -54,7 +54,7 @@ client := sdk.Test()
54
54
  const chosen = requiredItems(exampleEntity, 'list')
55
55
  arg = `map[string]any{${chosen.map((it: any) => litPair('go', it.name, goLit(it.type))).join(', ')}}`
56
56
  } else if ('create' === primaryOp || 'update' === primaryOp || 'patch' === primaryOp) {
57
- const items = opRequestShape(exampleEntity, primaryOp).items
57
+ const items = requestExampleItems(exampleEntity, primaryOp)
58
58
  .filter((it: any) => it.name !== idF && it.name !== 'id')
59
59
  const required = items.filter((it: any) => !it.optional)
60
60
  const chosen = required.length ? required : items.slice(0, 3)
@@ -15,8 +15,14 @@ import {
15
15
  serverVarEnv,
16
16
  serverVariables, envName, envToken, liveStrict, liveStrictNote,
17
17
  pointParts,
18
+ pointPlaceholders,
18
19
  pointIsGraphql,
19
20
  primaryPoint,
21
+ liveExampleIds,
22
+ liveQueryExamples,
23
+ liveEntity,
24
+ liveGetOnlyReason, LIVE_GETONLY_ENV,
25
+ liveDirectGetOnly, liveExcludedLines, liveExcludedSummary,
20
26
  } from '@voxgig/sdkgen'
21
27
 
22
28
 
@@ -67,7 +73,7 @@ const TestDirect = cmp(function TestDirect(props: any) {
67
73
  const model: Model = ctx$.model
68
74
 
69
75
  const target = props.target
70
- const entity: ModelEntity = props.entity
76
+ const entity: ModelEntity = liveEntity(ctx$, props.entity)
71
77
  const gomodule = props.gomodule
72
78
 
73
79
  const PROJECTNAME = envName(model)
@@ -118,12 +124,7 @@ const TestDirect = cmp(function TestDirect(props: any) {
118
124
  // actually appear in the URL template should drive direct-test path-param
119
125
  // setup and URL-substitution asserts; otherwise the SDK silently drops
120
126
  // them and the URL-includes assert fails.
121
- const _pathPlaceholders = new Set<string>()
122
- for (const part of pointParts(loadPoint)) {
123
- if (typeof part === 'string' && part.startsWith('{') && part.endsWith('}')) {
124
- _pathPlaceholders.add(part.slice(1, -1))
125
- }
126
- }
127
+ const _pathPlaceholders = new Set<string>(pointPlaceholders(loadPoint))
127
128
  const _renameMap = (loadPoint?.r?.param || {}) as Record<string, string>
128
129
  const _renamedPlaceholders = new Set<string>()
129
130
  for (const ph of _pathPlaceholders) {
@@ -141,19 +142,11 @@ const TestDirect = cmp(function TestDirect(props: any) {
141
142
  const listPath = listPoint ? normalizePathParams(pointParts(listPoint), listPoint?.g?.params || [], listPoint?.r?.param) : ''
142
143
  const listParams = listPoint?.g?.params || []
143
144
 
144
- const loadQuery = loadPoint?.g?.query || []
145
- const loadLiveQueryEntries = loadQuery
146
- .filter((q: any) => q.r && undefined !== q.ex && null !== q.ex)
147
- const loadLiveQueryLines = loadLiveQueryEntries
148
- .map((q: any) => `\t\t\tquery["${q.n}"] = ${JSON.stringify(q.ex)}`)
149
- .join('\n')
150
-
151
- const listQuery = listPoint?.g?.query || []
152
- const listLiveQueryEntries = listQuery
153
- .filter((q: any) => q.r && undefined !== q.ex && null !== q.ex)
154
- const listLiveQueryLines = listLiveQueryEntries
155
- .map((q: any) => `\t\t\tquery["${q.n}"] = ${JSON.stringify(q.ex)}`)
145
+ const liveQueryLines = (point: any) => liveQueryExamples(point)
146
+ .map(([name, ex]) => `\t\t\tquery[${JSON.stringify(name)}] = ${JSON.stringify(ex)}`)
156
147
  .join('\n')
148
+ const loadLiveQueryLines = liveQueryLines(loadPoint)
149
+ const listLiveQueryLines = liveQueryLines(listPoint)
157
150
 
158
151
  // Path params with spec-provided examples — when ALL load params have
159
152
  // spec examples, prefer them over list-bootstrap. Spec example values are
@@ -169,6 +162,17 @@ const TestDirect = cmp(function TestDirect(props: any) {
169
162
 
170
163
  const entidEnvVar = `${PROJECTNAME}_TEST_${envToken(entity.name)}_ENTID`
171
164
 
165
+ const exampleIds = liveExampleIds(entity)
166
+ const exampleIdBlock = 0 === exampleIds.length ? '' :
167
+ ` // A path parameter's example stands in for an id *_ENTID does not give.
168
+ for k, v := range map[string]any{${exampleIds.map(([key, ex]) =>
169
+ `${JSON.stringify(key)}: ${JSON.stringify(ex)}`).join(', ')}} {
170
+ if idmap[k] == nil {
171
+ idmap[k] = v
172
+ }
173
+ }
174
+ `
175
+
172
176
  File({ name: entity.name + '_direct_test.' + target.ext }, () => {
173
177
 
174
178
  Content(`package sdktest
@@ -213,7 +217,8 @@ func Test${entity.Name}Direct(t *testing.T) {
213
217
  const listLiveIdKeysGoLiteral = listLiveIdKeys.length > 0
214
218
  ? `[]string{${listLiveIdKeys.map((k: string) => `"${k}"`).join(', ')}}`
215
219
  : ''
216
- const listSkipBlock = listLiveIdKeys.length > 0
220
+ const listSkipBlock = getOnlyKeysBlock(model, entity, 'direct-list-' + entity.name, listLiveIdKeys) +
221
+ (listLiveIdKeys.length > 0
217
222
  ? ` if setup.live {
218
223
  for _, _liveKey := range ${listLiveIdKeysGoLiteral} {
219
224
  if v := setup.idmap[_liveKey]; v == nil {
@@ -223,7 +228,7 @@ func Test${entity.Name}Direct(t *testing.T) {
223
228
  }
224
229
  }
225
230
  `
226
- : ''
231
+ : '')
227
232
 
228
233
  Content(` t.Run("direct-list-${entity.name}", func(t *testing.T) {
229
234
  setup := ${entity.name}DirectSetup([]any{
@@ -245,9 +250,16 @@ ${listSkipBlock} client := setup.client
245
250
 
246
251
  `)
247
252
 
248
- if (listParams.length > 0) {
253
+ if (listParams.length > 0 || '' !== listLiveQueryLines) {
249
254
  Content(` params := map[string]any{}
255
+ query := map[string]any{}
256
+ `)
257
+ if (listLiveQueryLines) {
258
+ Content(` if setup.live {
259
+ ${listLiveQueryLines}
260
+ }
250
261
  `)
262
+ }
251
263
  listLiveParams.forEach((lp: any, i: number) => {
252
264
  const placeholder = 'direct0' + (i + 1)
253
265
  Content(` if setup.live {
@@ -262,6 +274,7 @@ ${listSkipBlock} client := setup.client
262
274
  "path": "${listPath}",
263
275
  "method": "GET",
264
276
  "params": params,
277
+ "query": query,
265
278
  })
266
279
  `)
267
280
  } else {
@@ -354,7 +367,8 @@ ${listSkipBlock} client := setup.client
354
367
  loadLiveIdKeys = [...new Set((hasList ?
355
368
  [...listParams, ...loadParams.filter((p: any) => p.n !== 'id')] : loadParams).map(liveKey))]
356
369
  }
357
- const loadSkipBlock = loadLiveIdKeys.length > 0
370
+ const loadSkipBlock = getOnlyKeysBlock(model, entity, 'direct-load-' + entity.name, loadLiveIdKeys) +
371
+ (loadLiveIdKeys.length > 0
358
372
  ? ` if setup.live {
359
373
  for _, _liveKey := range []string{${loadLiveIdKeys.map(k => `"${k}"`).join(', ')}} {
360
374
  if v := setup.idmap[_liveKey]; v == nil {
@@ -364,7 +378,7 @@ ${listSkipBlock} client := setup.client
364
378
  }
365
379
  }
366
380
  `
367
- : ''
381
+ : '')
368
382
 
369
383
  Content(` t.Run("direct-load-${entity.name}", func(t *testing.T) {
370
384
  setup := ${entity.name}DirectSetup(map[string]any{"id": "direct01"})
@@ -577,7 +591,7 @@ func ${entity.name}DirectSetup(mockres any) *${entity.name}DirectSetupResult {
577
591
  idmap = entidMap
578
592
  }
579
593
  }
580
-
594
+ ${exampleIdBlock}
581
595
  return &${entity.name}DirectSetupResult{client: client, calls: calls, live: true, idmap: idmap}
582
596
  }
583
597
 
@@ -615,6 +629,18 @@ var _ = json.Unmarshal
615
629
  })
616
630
 
617
631
 
632
+ // A GET-only live run excludes a test needing an id that only a write gives.
633
+ function getOnlyKeysBlock(model: any, entity: any, test: string, keys: string[]): string {
634
+ return liveDirectGetOnly(model, entity, test, keys).map((miss) =>
635
+ ` if setup.live && os.Getenv(${JSON.stringify(LIVE_GETONLY_ENV)}) == "TRUE" && setup.idmap[${JSON.stringify(miss.key)}] == nil {
636
+ t.Log(${JSON.stringify(liveExcludedLines({ excluded: [miss] })[0])})
637
+ t.Skip(${JSON.stringify(liveExcludedSummary({ excluded: [miss] }))})
638
+ return
639
+ }
640
+ `).join('')
641
+ }
642
+
643
+
618
644
  // GraphQL-backed op needs POST+body, not a REST-shaped GET+params Direct()
619
645
  // call — reuse apidef's own point.gq.doc via the SDK's Graphql() hatch.
620
646
  // Mirrors TestDirect_ts.ts's generateDirectGraphql.
@@ -628,6 +654,15 @@ function generateDirectGraphqlGo(
628
654
  const doc: string = point.gq.doc
629
655
  const vars: any[] = point.gq.vars || []
630
656
 
657
+ // A GraphQL request is a POST, which a GET-only live run does not send.
658
+ const getOnlyReason = liveGetOnlyReason(point)
659
+ const getOnlySkip = null == getOnlyReason ? '' :
660
+ `\t\tif setup.live && os.Getenv(${JSON.stringify(LIVE_GETONLY_ENV)}) == "TRUE" {
661
+ \t\t\tt.Skip(${JSON.stringify(getOnlyReason)})
662
+ \t\t\treturn
663
+ \t\t}
664
+ `
665
+
631
666
  const mockVarLines = vars.map((v: any, i: number) =>
632
667
  `\t\tvariables["${v.name}"] = "direct0${i + 1}"`).join('\n')
633
668
 
@@ -679,7 +714,7 @@ function generateDirectGraphqlGo(
679
714
  t.Skip(_reason)
680
715
  return
681
716
  }
682
- ${skipBlock} client := setup.client
717
+ ${getOnlySkip}${skipBlock} client := setup.client
683
718
 
684
719
  variables := map[string]any{}
685
720
  if setup.live {
@@ -30,6 +30,9 @@ import {
30
30
  entityDataIdField, envName, envToken,
31
31
  invalidRequest,
32
32
  liveFlowNeeds, liveStrict, liveStrictNote,
33
+ liveRouteExamples, liveStepExamples, flowLoadRoute, flowLoadReadsRecord,
34
+ liveGetOnly, liveExcludedLines, liveExcludedSummary, LIVE_GETONLY_ENV,
35
+ liveEntity,
33
36
  } from '@voxgig/sdkgen'
34
37
 
35
38
 
@@ -55,7 +58,7 @@ const TestEntity = cmp(function TestEntity(props: any) {
55
58
  const model: Model = ctx$.model
56
59
 
57
60
  const target = props.target
58
- const entity: ModelEntity = props.entity
61
+ const entity: ModelEntity = liveEntity(ctx$, props.entity)
59
62
  const gomodule: string = props.gomodule
60
63
 
61
64
  // The stream test streams the "list" op with no match and asserts a 3-item
@@ -222,15 +225,19 @@ ${failureTests(model, entity)}` : ''}${validateTest(model, entity)}
222
225
  return
223
226
  }
224
227
  }
225
- ${liveFlowGate(entity, liveFlowNeeds(entity, basicflow), strict, strictConst,
226
- PROJUPPER + '_TEST_' + envToken(entity.name) + '_ENTID', allSteps.length > 0)}`)
228
+ `)
229
+
230
+ const flowBody = (flow: any) => {
231
+ const steps = flowSteps(flow) as any[]
232
+ Content(liveFlowGate(entity, liveFlowNeeds(entity, flow), strict, strictConst,
233
+ PROJUPPER + '_TEST_' + envToken(entity.name) + '_ENTID', steps.length > 0))
227
234
 
228
- // Check if the flow has a create step; if not, bootstrap entity data
229
- const flowHasCreate = allSteps.some((s: any) => s.o === 'create')
230
- if (!flowHasCreate) {
231
- const preambleRef = entity.name + '_ref01'
232
- const preambleVar = goVar(preambleRef)
233
- Content(` // Bootstrap entity data from existing test data (no create step in flow).
235
+ // Check if the flow has a create step; if not, bootstrap entity data
236
+ const flowHasCreate = steps.some((s: any) => s.o === 'create')
237
+ if (!flowHasCreate) {
238
+ const preambleRef = entity.name + '_ref01'
239
+ const preambleVar = goVar(preambleRef)
240
+ Content(` // Bootstrap entity data from existing test data (no create step in flow).
234
241
  ${preambleVar}DataRaw := vs.Items(core.ToMapAny(vs.GetPath(setup.data, "existing.${entity.name}")))
235
242
  var ${preambleVar}Data map[string]any
236
243
  if len(${preambleVar}DataRaw) > 0 {
@@ -241,24 +248,47 @@ ${liveFlowGate(entity, liveFlowNeeds(entity, basicflow), strict, strictConst,
241
248
  _ = ${preambleVar}Data
242
249
 
243
250
  `)
251
+ }
252
+
253
+ // Model-driven step iteration
254
+ each(steps, (step: any, index: any) => {
255
+ // Never emit a REMOVE (or its removed-item verify LIST) without a
256
+ // preceding CREATE: a coherent CRUD flow only removes what it created,
257
+ // so a create-less remove would mutate pre-existing (live) data.
258
+ if (!flowHasCreate) {
259
+ if ('remove' === step.o) { return }
260
+ if ('list' === step.o &&
261
+ (step.v || []).some((v: any) => 'ItemNotExists' === v.apply)) { return }
262
+ }
263
+ const opgen: OpGen = GENERATE_OP[step.o]
264
+ if (opgen) {
265
+ opgen({ ...genCtx, flow }, step, index)
266
+ Content('\n')
267
+ }
268
+ })
244
269
  }
245
270
 
246
- // Model-driven step iteration
247
- each(flowSteps(basicflow), (step: any, index: any) => {
248
- // Never emit a REMOVE (or its removed-item verify LIST) without a
249
- // preceding CREATE: a coherent CRUD flow only removes what it created,
250
- // so a create-less remove would mutate pre-existing (live) data.
251
- if (!flowHasCreate) {
252
- if ('remove' === step.o) { return }
253
- if ('list' === step.o &&
254
- (step.v || []).some((v: any) => 'ItemNotExists' === v.apply)) { return }
271
+ const getOnly = liveGetOnly(entity, basicflow)
272
+ if (null != getOnly) {
273
+ Content(` if setup.live && os.Getenv(${JSON.stringify(LIVE_GETONLY_ENV)}) == "TRUE" {
274
+ ${liveExcludedLines(getOnly).map((line) => '\t\t\tt.Log(' + JSON.stringify(line) + ')\n').join('')}`)
275
+ if (0 === flowSteps(getOnly.flow).length) {
276
+ Content(` t.Skip(${JSON.stringify(liveExcludedSummary(getOnly))})
277
+ return
278
+ }
279
+
280
+ `)
255
281
  }
256
- const opgen: OpGen = GENERATE_OP[step.o]
257
- if (opgen) {
258
- opgen(genCtx, step, index)
259
- Content('\n')
282
+ else {
283
+ flowBody(getOnly.flow)
284
+ Content(` return
285
+ }
286
+
287
+ `)
260
288
  }
261
- })
289
+ }
290
+
291
+ flowBody(basicflow)
262
292
 
263
293
  Content(` })
264
294
  }
@@ -396,7 +426,9 @@ function liveFlowGate(entity: any, needs: any, strict: boolean, strictConst: str
396
426
  }
397
427
  if (null != needs.discover) {
398
428
  const match = Object.entries(needs.discover)
399
- .map(([k, v]: any) => `${JSON.stringify(k)}: setup.idmap[${JSON.stringify(v)}]`).join(', ')
429
+ .map(([k, v]: any) => `${JSON.stringify(k)}: setup.idmap[${JSON.stringify(v)}]`)
430
+ .concat(liveRouteExamples(entity, 'list', Object.keys(needs.discover))
431
+ .map(([k, ex]) => `${JSON.stringify(k)}: ${JSON.stringify(ex)}`)).join(', ')
400
432
  out += ` if setup.live {
401
433
  liveExisting(t, ${strictConst}, setup.data, ${JSON.stringify(entity.name)}, func() (any, error) {
402
434
  return client.${entity.Name}(nil).List(map[string]any{${match}}, nil)
@@ -511,6 +543,7 @@ const generateList: OpGen = (ctx, step, index) => {
511
543
  Content(` }
512
544
  `)
513
545
  }
546
+ liveFill(entity, step, matchvar)
514
547
 
515
548
  // Only declare ${listvar} as a real var when a downstream validator
516
549
  // actually uses it; otherwise `_` to satisfy Go's unused-var check.
@@ -687,7 +720,7 @@ const generateLoad: OpGen = (ctx, step, index) => {
687
720
  Content(` ${entvar} := client.${entity.Name}(nil)
688
721
  `)
689
722
  }
690
- if (!hasSrcData && hasEntId) {
723
+ if (!hasSrcData && (hasEntId || flowLoadReadsRecord(entity, step))) {
691
724
  Content(` ${srcdatavar}Raw := vs.Items(core.ToMapAny(vs.GetPath(setup.data, "existing.${entity.name}")))
692
725
  var ${srcdatavar} map[string]any
693
726
  if len(${srcdatavar}Raw) > 0 {
@@ -700,7 +733,8 @@ const generateLoad: OpGen = (ctx, step, index) => {
700
733
  "id": ${srcdatavar}["id"],
701
734
  }
702
735
  `)
703
- parentMatch(step, matchvar)
736
+ loadMatch(entity, step, matchvar, srcdatavar)
737
+ liveFill(entity, step, matchvar)
704
738
  Content(` ${datavar}Loaded, err := ${entvar}.Load(${matchvar}, nil)
705
739
  if err != nil {
706
740
  t.Fatalf("load failed: %v", err)
@@ -717,7 +751,8 @@ const generateLoad: OpGen = (ctx, step, index) => {
717
751
  else {
718
752
  Content(` ${matchvar} := map[string]any{}
719
753
  `)
720
- parentMatch(step, matchvar)
754
+ loadMatch(entity, step, matchvar, srcdatavar)
755
+ liveFill(entity, step, matchvar)
721
756
  Content(` ${datavar}Loaded, err := ${entvar}.Load(${matchvar}, nil)
722
757
  if err != nil {
723
758
  t.Fatalf("load failed: %v", err)
@@ -771,15 +806,63 @@ const generateRemove: OpGen = (ctx, step, index) => {
771
806
  // A child's route names its parents, and an entity no earlier step has
772
807
  // filled knows none of them, so the call itself gives each parent id. A live
773
808
  // ENTID may key a parent by its field name, the fixture by its own name.
809
+ // A live step sends each example its route requires and the step leaves unbound.
810
+ function liveFill(entity: any, step: any, matchvar: string) {
811
+ const fills = liveStepExamples(entity, step)
812
+ if (0 < fills.length) {
813
+ Content(` if setup.live {
814
+ ${fills.map(([k, ex]) => ` ${matchvar}[${JSON.stringify(k)}] = ${JSON.stringify(ex)}\n`).join('')} }
815
+ `)
816
+ }
817
+ }
818
+
819
+
774
820
  function parentMatch(step: any, matchvar: string) {
775
821
  const parents = Object.entries(step.m || {})
776
822
  .filter(([k]: any) => k !== 'id' && !k.endsWith('$'))
777
823
  for (const [key, val] of parents) {
778
- Content(` if v := setup.idmap["${key}"]; v != nil {
779
- ${matchvar}["${key}"] = v
780
- } else {
781
- ${matchvar}["${key}"] = setup.idmap["${val}"]
782
- }
824
+ Content(boundMatch(matchvar, key, [key, val as string], '\t\t'))
825
+ }
826
+ }
827
+
828
+
829
+ function boundMatch(matchvar: string, name: string, keys: string[], indent: string): string {
830
+ return 1 === keys.length ? `${indent}${matchvar}["${name}"] = setup.idmap["${keys[0]}"]
831
+ ` : `${indent}if v := setup.idmap["${keys[0]}"]; v != nil {
832
+ ${indent} ${matchvar}["${name}"] = v
833
+ ${indent}} else {
834
+ ${indent} ${matchvar}["${name}"] = setup.idmap["${keys[1]}"]
835
+ ${indent}}
836
+ `
837
+ }
838
+
839
+
840
+ // A load of a known record fills its route from that record, and from the
841
+ // step's binding where the record holds no scalar for it. A record only the
842
+ // fixture holds replaces the step's binding offline.
843
+ function loadMatch(entity: any, step: any, matchvar: string, srcdatavar: string) {
844
+ const route = flowLoadRoute(entity, step)
845
+ if (null == route) {
846
+ return parentMatch(step, matchvar)
847
+ }
848
+ if (route.offline) {
849
+ parentMatch(step, matchvar)
850
+ const own = route.args.filter((arg) => null != arg.field)
851
+ return 0 === own.length ? undefined : Content(` if !setup.live {
852
+ ${own.map((arg) => ` switch v := ${srcdatavar}["${arg.field}"].(type) {
853
+ case string, bool, float64, int, int64:
854
+ ${matchvar}["${arg.name}"] = v
855
+ }
856
+ `).join('')} }
857
+ `)
858
+ }
859
+ for (const arg of route.args) {
860
+ Content(null == arg.field ? boundMatch(matchvar, arg.name, arg.idmap, '\t\t') :
861
+ ` switch v := ${srcdatavar}["${arg.field}"].(type) {
862
+ case string, bool, float64, int, int64:
863
+ ${matchvar}["${arg.name}"] = v
864
+ default:
865
+ ${boundMatch(matchvar, arg.name, arg.idmap, '\t\t\t')} }
783
866
  `)
784
867
  }
785
868
  }
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, each, Content, canonToType, canonKey, entityIdField, opRequestShape, opNeedsAction, javaMap, javaMapOf, matchExampleItems, javaMapItems } from '@voxgig/sdkgen'
2
+ import { cmp, each, Content, canonToType, canonKey, entityIdField, opNeedsAction, javaMap, javaMapOf, matchExampleItems, javaMapItems, requestExampleItems } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -138,7 +138,7 @@ Object ${eVar}List = client.${accessor}(null).list(${javaListMatch(entity)}, nul
138
138
  // Members come from the SAME shape the runtime validates
139
139
  // (opRequestShape): every required member must appear — including a
140
140
  // required id and parent keys like page_id — with a real literal.
141
- const createItems = javaMapItems(opRequestShape(entity, 'create').items)
141
+ const createItems = javaMapItems(requestExampleItems(entity, 'create'))
142
142
  .filter((it: any) => !it.optional)
143
143
  const createMap = javaMap(createItems.length)
144
144
  Content(`#### Example: Create