@voxgig/sdkgen 4.35.3 → 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 (256) 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/opExample.d.ts +4 -1
  5. package/dist/helpers/opExample.js +11 -1
  6. package/dist/helpers/opExample.js.map +1 -1
  7. package/dist/helpers/opShape.d.ts +2 -1
  8. package/dist/helpers/opShape.js +53 -26
  9. package/dist/helpers/opShape.js.map +1 -1
  10. package/dist/helpers/pointPath.d.ts +2 -1
  11. package/dist/helpers/pointPath.js +17 -0
  12. package/dist/helpers/pointPath.js.map +1 -1
  13. package/dist/helpers/testPolicy.d.ts +48 -2
  14. package/dist/helpers/testPolicy.js +265 -0
  15. package/dist/helpers/testPolicy.js.map +1 -1
  16. package/dist/sdkgen.d.ts +7 -7
  17. package/dist/sdkgen.js +26 -4
  18. package/dist/sdkgen.js.map +1 -1
  19. package/dist/tsconfig.tsbuildinfo +1 -1
  20. package/package.json +1 -1
  21. package/project/.sdk/src/cmp/c/PrepareAuth_c.ts +10 -4
  22. package/project/.sdk/src/cmp/c/ReadmeEntity_c.ts +2 -2
  23. package/project/.sdk/src/cmp/c/ReadmeHowto_c.ts +2 -2
  24. package/project/.sdk/src/cmp/c/ReadmeQuick_c.ts +6 -5
  25. package/project/.sdk/src/cmp/c/ReadmeRef_c.ts +3 -3
  26. package/project/.sdk/src/cmp/c/ReadmeTopQuick_c.ts +2 -2
  27. package/project/.sdk/src/cmp/c/ReadmeTopTest_c.ts +2 -2
  28. package/project/.sdk/src/cmp/c/TestDirect_c.ts +2 -6
  29. package/project/.sdk/src/cmp/clojure/ReadmeEntity_clojure.ts +2 -2
  30. package/project/.sdk/src/cmp/clojure/ReadmeHowto_clojure.ts +2 -2
  31. package/project/.sdk/src/cmp/clojure/ReadmeQuick_clojure.ts +4 -4
  32. package/project/.sdk/src/cmp/clojure/ReadmeRef_clojure.ts +3 -3
  33. package/project/.sdk/src/cmp/clojure/ReadmeTopQuick_clojure.ts +2 -2
  34. package/project/.sdk/src/cmp/clojure/ReadmeTopTest_clojure.ts +2 -2
  35. package/project/.sdk/src/cmp/cpp/ReadmeEntity_cpp.ts +2 -2
  36. package/project/.sdk/src/cmp/cpp/ReadmeHowto_cpp.ts +2 -2
  37. package/project/.sdk/src/cmp/cpp/ReadmeQuick_cpp.ts +4 -4
  38. package/project/.sdk/src/cmp/cpp/ReadmeRef_cpp.ts +3 -3
  39. package/project/.sdk/src/cmp/cpp/ReadmeTopQuick_cpp.ts +2 -2
  40. package/project/.sdk/src/cmp/cpp/ReadmeTopTest_cpp.ts +2 -2
  41. package/project/.sdk/src/cmp/cpp/TestDirect_cpp.ts +2 -6
  42. package/project/.sdk/src/cmp/cpp/TestEntity_cpp.ts +51 -3
  43. package/project/.sdk/src/cmp/csharp/ReadmeEntity_csharp.ts +2 -2
  44. package/project/.sdk/src/cmp/csharp/ReadmeHowto_csharp.ts +2 -2
  45. package/project/.sdk/src/cmp/csharp/ReadmeQuick_csharp.ts +5 -5
  46. package/project/.sdk/src/cmp/csharp/ReadmeRef_csharp.ts +3 -3
  47. package/project/.sdk/src/cmp/csharp/ReadmeTopQuick_csharp.ts +3 -3
  48. package/project/.sdk/src/cmp/csharp/ReadmeTopTest_csharp.ts +2 -2
  49. package/project/.sdk/src/cmp/csharp/TestDirect_csharp.ts +41 -19
  50. package/project/.sdk/src/cmp/csharp/TestEntity_csharp.ts +105 -27
  51. package/project/.sdk/src/cmp/elixir/ReadmeEntity_elixir.ts +2 -2
  52. package/project/.sdk/src/cmp/elixir/ReadmeHowto_elixir.ts +2 -2
  53. package/project/.sdk/src/cmp/elixir/ReadmeQuick_elixir.ts +4 -4
  54. package/project/.sdk/src/cmp/elixir/ReadmeRef_elixir.ts +3 -3
  55. package/project/.sdk/src/cmp/elixir/ReadmeTopQuick_elixir.ts +2 -2
  56. package/project/.sdk/src/cmp/elixir/ReadmeTopTest_elixir.ts +2 -2
  57. package/project/.sdk/src/cmp/go/EntityOperation_go.ts +2 -2
  58. package/project/.sdk/src/cmp/go/Entity_go.ts +4 -3
  59. package/project/.sdk/src/cmp/go/Main_go.ts +2 -2
  60. package/project/.sdk/src/cmp/go/PrepareAuth_go.ts +24 -15
  61. package/project/.sdk/src/cmp/go/ReadmeEntity_go.ts +2 -2
  62. package/project/.sdk/src/cmp/go/ReadmeHowto_go.ts +2 -2
  63. package/project/.sdk/src/cmp/go/ReadmeQuick_go.ts +4 -4
  64. package/project/.sdk/src/cmp/go/ReadmeRef_go.ts +3 -3
  65. package/project/.sdk/src/cmp/go/ReadmeTopTest_go.ts +2 -2
  66. package/project/.sdk/src/cmp/go/TestDirect_go.ts +61 -26
  67. package/project/.sdk/src/cmp/go/TestEntity_go.ts +115 -32
  68. package/project/.sdk/src/cmp/java/ReadmeEntity_java.ts +2 -2
  69. package/project/.sdk/src/cmp/java/ReadmeHowto_java.ts +2 -2
  70. package/project/.sdk/src/cmp/java/ReadmeQuick_java.ts +5 -5
  71. package/project/.sdk/src/cmp/java/ReadmeRef_java.ts +3 -3
  72. package/project/.sdk/src/cmp/java/ReadmeTopQuick_java.ts +3 -3
  73. package/project/.sdk/src/cmp/java/ReadmeTopTest_java.ts +2 -2
  74. package/project/.sdk/src/cmp/java/TestDirect_java.ts +40 -20
  75. package/project/.sdk/src/cmp/java/TestEntity_java.ts +107 -26
  76. package/project/.sdk/src/cmp/js/ReadmeEntity_js.ts +2 -2
  77. package/project/.sdk/src/cmp/js/ReadmeHowto_js.ts +2 -2
  78. package/project/.sdk/src/cmp/js/ReadmeQuick_js.ts +4 -4
  79. package/project/.sdk/src/cmp/js/ReadmeRef_js.ts +3 -3
  80. package/project/.sdk/src/cmp/js/ReadmeTopTest_js.ts +2 -2
  81. package/project/.sdk/src/cmp/js/TestDirect_js.ts +68 -13
  82. package/project/.sdk/src/cmp/js/TestEntity_js.ts +46 -4
  83. package/project/.sdk/src/cmp/kotlin/ReadmeEntity_kotlin.ts +2 -2
  84. package/project/.sdk/src/cmp/kotlin/ReadmeHowto_kotlin.ts +2 -2
  85. package/project/.sdk/src/cmp/kotlin/ReadmeQuick_kotlin.ts +5 -5
  86. package/project/.sdk/src/cmp/kotlin/ReadmeRef_kotlin.ts +3 -3
  87. package/project/.sdk/src/cmp/kotlin/ReadmeTopQuick_kotlin.ts +3 -3
  88. package/project/.sdk/src/cmp/kotlin/ReadmeTopTest_kotlin.ts +2 -2
  89. package/project/.sdk/src/cmp/kotlin/TestDirect_kotlin.ts +41 -21
  90. package/project/.sdk/src/cmp/kotlin/TestEntity_kotlin.ts +99 -22
  91. package/project/.sdk/src/cmp/lua/ReadmeEntity_lua.ts +2 -2
  92. package/project/.sdk/src/cmp/lua/ReadmeHowto_lua.ts +2 -2
  93. package/project/.sdk/src/cmp/lua/ReadmeQuick_lua.ts +4 -4
  94. package/project/.sdk/src/cmp/lua/ReadmeRef_lua.ts +3 -3
  95. package/project/.sdk/src/cmp/lua/ReadmeTopQuick_lua.ts +3 -3
  96. package/project/.sdk/src/cmp/lua/ReadmeTopTest_lua.ts +2 -2
  97. package/project/.sdk/src/cmp/lua/TestDirect_lua.ts +40 -16
  98. package/project/.sdk/src/cmp/lua/TestEntity_lua.ts +108 -30
  99. package/project/.sdk/src/cmp/ocaml/ReadmeEntity_ocaml.ts +2 -2
  100. package/project/.sdk/src/cmp/ocaml/ReadmeHowto_ocaml.ts +2 -2
  101. package/project/.sdk/src/cmp/ocaml/ReadmeQuick_ocaml.ts +4 -4
  102. package/project/.sdk/src/cmp/ocaml/ReadmeRef_ocaml.ts +3 -3
  103. package/project/.sdk/src/cmp/ocaml/ReadmeTopQuick_ocaml.ts +2 -2
  104. package/project/.sdk/src/cmp/ocaml/ReadmeTopTest_ocaml.ts +2 -2
  105. package/project/.sdk/src/cmp/perl/ReadmeEntity_perl.ts +2 -2
  106. package/project/.sdk/src/cmp/perl/ReadmeHowto_perl.ts +2 -2
  107. package/project/.sdk/src/cmp/perl/ReadmeQuick_perl.ts +4 -4
  108. package/project/.sdk/src/cmp/perl/ReadmeRef_perl.ts +3 -3
  109. package/project/.sdk/src/cmp/perl/ReadmeTopQuick_perl.ts +2 -2
  110. package/project/.sdk/src/cmp/perl/ReadmeTopTest_perl.ts +2 -2
  111. package/project/.sdk/src/cmp/perl/TestDirect_perl.ts +35 -16
  112. package/project/.sdk/src/cmp/perl/TestEntity_perl.ts +98 -22
  113. package/project/.sdk/src/cmp/php/ReadmeEntity_php.ts +2 -2
  114. package/project/.sdk/src/cmp/php/ReadmeHowto_php.ts +2 -2
  115. package/project/.sdk/src/cmp/php/ReadmeQuick_php.ts +4 -4
  116. package/project/.sdk/src/cmp/php/ReadmeRef_php.ts +3 -3
  117. package/project/.sdk/src/cmp/php/ReadmeTopQuick_php.ts +2 -2
  118. package/project/.sdk/src/cmp/php/ReadmeTopTest_php.ts +2 -2
  119. package/project/.sdk/src/cmp/php/TestDirect_php.ts +33 -16
  120. package/project/.sdk/src/cmp/php/TestEntity_php.ts +98 -29
  121. package/project/.sdk/src/cmp/py/ReadmeEntity_py.ts +2 -2
  122. package/project/.sdk/src/cmp/py/ReadmeHowto_py.ts +2 -2
  123. package/project/.sdk/src/cmp/py/ReadmeQuick_py.ts +4 -4
  124. package/project/.sdk/src/cmp/py/ReadmeRef_py.ts +3 -3
  125. package/project/.sdk/src/cmp/py/ReadmeTopQuick_py.ts +2 -2
  126. package/project/.sdk/src/cmp/py/ReadmeTopTest_py.ts +2 -2
  127. package/project/.sdk/src/cmp/py/TestDirect_py.ts +39 -16
  128. package/project/.sdk/src/cmp/py/TestEntity_py.ts +90 -27
  129. package/project/.sdk/src/cmp/rb/ReadmeEntity_rb.ts +2 -2
  130. package/project/.sdk/src/cmp/rb/ReadmeHowto_rb.ts +2 -2
  131. package/project/.sdk/src/cmp/rb/ReadmeQuick_rb.ts +4 -4
  132. package/project/.sdk/src/cmp/rb/ReadmeRef_rb.ts +3 -3
  133. package/project/.sdk/src/cmp/rb/ReadmeTopQuick_rb.ts +2 -2
  134. package/project/.sdk/src/cmp/rb/ReadmeTopTest_rb.ts +2 -2
  135. package/project/.sdk/src/cmp/rb/TestClean_rb.ts +1 -1
  136. package/project/.sdk/src/cmp/rb/TestDirect_rb.ts +33 -16
  137. package/project/.sdk/src/cmp/rb/TestEntity_rb.ts +90 -25
  138. package/project/.sdk/src/cmp/rb/fragment/Main.fragment.rb +3 -3
  139. package/project/.sdk/src/cmp/rust/ReadmeEntity_rust.ts +2 -2
  140. package/project/.sdk/src/cmp/rust/ReadmeHowto_rust.ts +2 -2
  141. package/project/.sdk/src/cmp/rust/ReadmeQuick_rust.ts +4 -4
  142. package/project/.sdk/src/cmp/rust/ReadmeRef_rust.ts +3 -3
  143. package/project/.sdk/src/cmp/rust/ReadmeTopQuick_rust.ts +2 -2
  144. package/project/.sdk/src/cmp/rust/ReadmeTopTest_rust.ts +2 -2
  145. package/project/.sdk/src/cmp/rust/TestDirect_rust.ts +40 -12
  146. package/project/.sdk/src/cmp/rust/TestEntity_rust.ts +108 -25
  147. package/project/.sdk/src/cmp/scala/ReadmeEntity_scala.ts +2 -2
  148. package/project/.sdk/src/cmp/scala/ReadmeHowto_scala.ts +2 -2
  149. package/project/.sdk/src/cmp/scala/ReadmeQuick_scala.ts +5 -5
  150. package/project/.sdk/src/cmp/scala/ReadmeRef_scala.ts +3 -3
  151. package/project/.sdk/src/cmp/scala/ReadmeTopQuick_scala.ts +3 -3
  152. package/project/.sdk/src/cmp/scala/ReadmeTopTest_scala.ts +2 -2
  153. package/project/.sdk/src/cmp/scala/TestDirect_scala.ts +2 -6
  154. package/project/.sdk/src/cmp/scala/TestEntity_scala.ts +36 -7
  155. package/project/.sdk/src/cmp/swift/ReadmeEntity_swift.ts +2 -2
  156. package/project/.sdk/src/cmp/swift/ReadmeHowto_swift.ts +2 -2
  157. package/project/.sdk/src/cmp/swift/ReadmeQuick_swift.ts +5 -5
  158. package/project/.sdk/src/cmp/swift/ReadmeRef_swift.ts +3 -3
  159. package/project/.sdk/src/cmp/swift/ReadmeTopQuick_swift.ts +2 -2
  160. package/project/.sdk/src/cmp/swift/ReadmeTopTest_swift.ts +2 -2
  161. package/project/.sdk/src/cmp/ts/ReadmeEntity_ts.ts +2 -2
  162. package/project/.sdk/src/cmp/ts/ReadmeExamplesTest_ts.ts +49 -19
  163. package/project/.sdk/src/cmp/ts/ReadmeHowto_ts.ts +2 -2
  164. package/project/.sdk/src/cmp/ts/ReadmeQuick_ts.ts +4 -4
  165. package/project/.sdk/src/cmp/ts/ReadmeRef_ts.ts +3 -3
  166. package/project/.sdk/src/cmp/ts/ReadmeTopTest_ts.ts +3 -3
  167. package/project/.sdk/src/cmp/ts/TestDirect_ts.ts +54 -23
  168. package/project/.sdk/src/cmp/ts/TestEntity_ts.ts +49 -4
  169. package/project/.sdk/src/cmp/zig/ReadmeEntity_zig.ts +2 -2
  170. package/project/.sdk/src/cmp/zig/ReadmeHowto_zig.ts +2 -2
  171. package/project/.sdk/src/cmp/zig/ReadmeQuick_zig.ts +4 -4
  172. package/project/.sdk/src/cmp/zig/ReadmeRef_zig.ts +3 -3
  173. package/project/.sdk/src/cmp/zig/ReadmeTopQuick_zig.ts +2 -2
  174. package/project/.sdk/src/cmp/zig/ReadmeTopTest_zig.ts +2 -2
  175. package/project/.sdk/tm/c/tests/primary_utility_test.c +37 -0
  176. package/project/.sdk/tm/c/utility/fetcher.c +31 -1
  177. package/project/.sdk/tm/c/utility/make_url.c +6 -2
  178. package/project/.sdk/tm/clojure/src/sdk/core.clj +21 -3
  179. package/project/.sdk/tm/clojure/test/sdk/test/pipeline.clj +34 -0
  180. package/project/.sdk/tm/cpp/test/primary_utility_test.cpp +37 -0
  181. package/project/.sdk/tm/cpp/utility/pipeline.hpp +28 -2
  182. package/project/.sdk/tm/csharp/test/PrimaryUtilityTest.cs +40 -0
  183. package/project/.sdk/tm/csharp/utility/Fetcher.cs +27 -0
  184. package/project/.sdk/tm/csharp/utility/MakeUrl.cs +7 -2
  185. package/project/.sdk/tm/elixir/lib/projectname/utility.ex +30 -3
  186. package/project/.sdk/tm/elixir/test/pipeline_test.exs +23 -0
  187. package/project/.sdk/tm/go/test/feature_corpus_test.go +3 -4
  188. package/project/.sdk/tm/go/test/primary_utility_test.go +28 -0
  189. package/project/.sdk/tm/go/utility/fetcher.go +26 -0
  190. package/project/.sdk/tm/go/utility/make_url.go +5 -2
  191. package/project/.sdk/tm/java/test/FeatureCorpusTest.java +4 -5
  192. package/project/.sdk/tm/java/test/PrimaryUtilityTest.java +49 -0
  193. package/project/.sdk/tm/java/utility/Fetcher.java +24 -0
  194. package/project/.sdk/tm/java/utility/MakeUrl.java +6 -2
  195. package/project/.sdk/tm/js/src/utility/FetcherUtility.js +24 -0
  196. package/project/.sdk/tm/js/src/utility/MakeUrlUtility.js +6 -2
  197. package/project/.sdk/tm/js/test/feature/Corpus.test.js +7 -6
  198. package/project/.sdk/tm/js/test/live-entity.js +18 -6
  199. package/project/.sdk/tm/js/test/live-runner.js +15 -3
  200. package/project/.sdk/tm/js/test/utility/PrimaryUtility.test.js +25 -0
  201. package/project/.sdk/tm/kotlin/test/PrimaryUtilityTest.kt +48 -0
  202. package/project/.sdk/tm/kotlin/utility/Fetcher.kt +20 -0
  203. package/project/.sdk/tm/kotlin/utility/MakeSpecUrl.kt +6 -2
  204. package/project/.sdk/tm/lua/test/pipeline_test.lua +27 -0
  205. package/project/.sdk/tm/lua/test/primary_utility_test.lua +36 -0
  206. package/project/.sdk/tm/lua/utility/fetcher.lua +31 -0
  207. package/project/.sdk/tm/lua/utility/make_url.lua +6 -2
  208. package/project/.sdk/tm/ocaml/Makefile +5 -1
  209. package/project/.sdk/tm/ocaml/sdk_runtime.ml +36 -4
  210. package/project/.sdk/tm/ocaml/test/t_pipeline.ml +22 -0
  211. package/project/.sdk/tm/perl/t/primary_utility.t +22 -0
  212. package/project/.sdk/tm/perl/utility/fetcher.pm +18 -0
  213. package/project/.sdk/tm/perl/utility/make_url.pm +4 -2
  214. package/project/.sdk/tm/php/test/FeatureCorpusTest.php +6 -5
  215. package/project/.sdk/tm/php/test/PipelineTest.php +31 -7
  216. package/project/.sdk/tm/php/utility/Fetcher.php +34 -27
  217. package/project/.sdk/tm/php/utility/MakeOptions.php +2 -1
  218. package/project/.sdk/tm/php/utility/MakeUrl.php +6 -2
  219. package/project/.sdk/tm/py/pkg/utility/fetcher.py +23 -0
  220. package/project/.sdk/tm/py/pkg/utility/make_url.py +5 -2
  221. package/project/.sdk/tm/py/test/test_feature_corpus.py +5 -5
  222. package/project/.sdk/tm/py/test/test_primary_utility.py +21 -0
  223. package/project/.sdk/tm/rb/core/context.rb +1 -1
  224. package/project/.sdk/tm/rb/core/error.rb +20 -1
  225. package/project/.sdk/tm/rb/test/feature_corpus_test.rb +4 -5
  226. package/project/.sdk/tm/rb/test/feature_test.rb +2 -2
  227. package/project/.sdk/tm/rb/test/omni.rb +1 -1
  228. package/project/.sdk/tm/rb/test/pipeline_test.rb +19 -2
  229. package/project/.sdk/tm/rb/test/primary_utility_test.rb +28 -1
  230. package/project/.sdk/tm/rb/utility/fetcher.rb +20 -1
  231. package/project/.sdk/tm/rb/utility/make_error.rb +1 -1
  232. package/project/.sdk/tm/rb/utility/make_url.rb +4 -2
  233. package/project/.sdk/tm/rust/tests/primary_utility_test.rs +34 -0
  234. package/project/.sdk/tm/rust/utility/fetcher.rs +27 -0
  235. package/project/.sdk/tm/rust/utility/make_url.rs +7 -2
  236. package/project/.sdk/tm/scala/sdktest/SdkTestMain.scala +51 -1
  237. package/project/.sdk/tm/scala/utility/Fetcher.scala +16 -0
  238. package/project/.sdk/tm/scala/utility/Make.scala +6 -2
  239. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Fetcher.swift +24 -0
  240. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Make.swift +6 -2
  241. package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/PrimaryUtilityTest.swift +34 -0
  242. package/project/.sdk/tm/ts/src/utility/FetcherUtility.ts +24 -0
  243. package/project/.sdk/tm/ts/src/utility/MakeUrlUtility.ts +6 -2
  244. package/project/.sdk/tm/ts/test/feature/Corpus.test.ts +7 -6
  245. package/project/.sdk/tm/ts/test/live-entity.ts +20 -5
  246. package/project/.sdk/tm/ts/test/live-runner.ts +17 -3
  247. package/project/.sdk/tm/ts/test/utility/PrimaryUtility.test.ts +25 -0
  248. package/project/.sdk/tm/zig/core/utility.zig +30 -3
  249. package/project/.sdk/tm/zig/test/primary_utility_test.zig +28 -0
  250. package/project/sdkgen-package.json +1 -1
  251. package/src/cmp/ReadmeTop.ts +3 -3
  252. package/src/helpers/opExample.ts +16 -1
  253. package/src/helpers/opShape.ts +64 -30
  254. package/src/helpers/pointPath.ts +19 -0
  255. package/src/helpers/testPolicy.ts +316 -2
  256. package/src/sdkgen.ts +37 -5
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, isAuthActive, envName, canonKey, entityIdField, pickExampleEntity, opRequestShape, requiredItems, javaMapOf, matchExampleItems, javaMapItems } from '@voxgig/sdkgen'
2
+ import { cmp, Content, isAuthActive, envName, canonKey, entityIdField, pickExampleEntity, requiredItems, javaMapOf, matchExampleItems, javaMapItems, requestExampleItems } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -37,7 +37,7 @@ const ReadmeHowto = cmp(function ReadmeHowto(props: any) {
37
37
  testArg = javaMapOf(chosen.map((it: any) =>
38
38
  `${JSON.stringify(it.name)}, ${javaLit(it.type)}`))
39
39
  } else if (exampleEntity && ('create' === primaryOp || 'update' === primaryOp || 'patch' === primaryOp)) {
40
- const items = javaMapItems(opRequestShape(exampleEntity, primaryOp).items)
40
+ const items = javaMapItems(requestExampleItems(exampleEntity, primaryOp))
41
41
  .filter((it: any) => it.name !== idF && it.name !== 'id')
42
42
  const required = items.filter((it: any) => !it.optional)
43
43
  const chosen = required.length ? required : items.slice(0, 3)
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, isAuthActive, envName, canonKey, opRequestShape, entityIdField, entityOps , serverVariables, javaMapOf, matchExampleItems, requiredItems, javaMapItems } from '@voxgig/sdkgen'
2
+ import { cmp, Content, isAuthActive, envName, canonKey, opRequestShape, entityIdField, entityOps , serverVariables, javaMapOf, matchExampleItems, requiredItems, javaMapItems, requestExampleItems, sendsId } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -174,7 +174,7 @@ catch (RuntimeException err) {
174
174
  // Model-driven example fields: derive the create/update body from the op
175
175
  // shape (opRequestShape) so the docs reference REAL writable fields.
176
176
  const examplePairs = (opname: string): string[] => {
177
- const items = javaMapItems(opRequestShape(exampleEntity, opname).items)
177
+ const items = javaMapItems(requestExampleItems(exampleEntity, opname))
178
178
  .filter((it: any) => (it.name !== idF && it.name !== 'id') ||
179
179
  ('create' === opname && !it.optional))
180
180
  const required = items.filter((it: any) => !it.optional)
@@ -203,15 +203,15 @@ Object created = client.${accessor}(null).create(${javaMapOf(examplePairs('creat
203
203
  `)
204
204
  }
205
205
  if (opnames.includes('update')) {
206
- const updatePairs = (idF ? [`${JSON.stringify(idF)}, ${javaLit(idParamType('update'), 'example_id')}`] : [])
206
+ const updatePairs = (sendsId(exampleEntity, 'update', idF) ? [`${JSON.stringify(idF)}, ${javaLit(idParamType('update'), 'example_id')}`] : [])
207
207
  .concat(examplePairs('update'))
208
- Content(`// Update — supply the id in the match/data
208
+ Content(`// Update${sendsId(exampleEntity, 'update', idF) ? ' — supply the id in the match/data' : ''}
209
209
  client.${accessor}(null).update(${javaMapOf(updatePairs)}, null);
210
210
 
211
211
  `)
212
212
  }
213
213
  if (opnames.includes('patch')) {
214
- const patchPairs = (idF ? [`${JSON.stringify(idF)}, ${javaLit(idParamType('patch'), 'example_id')}`] : [])
214
+ const patchPairs = (sendsId(exampleEntity, 'patch', idF) ? [`${JSON.stringify(idF)}, ${javaLit(idParamType('patch'), 'example_id')}`] : [])
215
215
  .concat(examplePairs('patch'))
216
216
  Content(`// Patch — sends only the fields given
217
217
  client.${accessor}(null).patch(${javaMapOf(patchPairs)}, null);
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, each, Content, canonToType, canonKey, File, isAuthActive, entityIdField, opRequestShape , targetFeatures, opNeedsAction, bodyNote, javaMap, javaMapOf, matchExampleItems, javaMapItems } from '@voxgig/sdkgen'
2
+ import { cmp, each, Content, canonToType, canonKey, File, isAuthActive, entityIdField , targetFeatures, opNeedsAction, bodyNote, javaMap, javaMapOf, matchExampleItems, javaMapItems, requestExampleItems } from '@voxgig/sdkgen'
3
3
  import { ReadmeRefFeatures } from '@voxgig/sdkgen'
4
4
 
5
5
  import {
@@ -281,7 +281,7 @@ for (Object item : results) {
281
281
  `)
282
282
  }
283
283
  else if ('create' === opname) {
284
- const createItems = javaMapItems(opRequestShape(ent, 'create').items)
284
+ const createItems = javaMapItems(requestExampleItems(ent, 'create'))
285
285
  .filter((it: any) => !it.optional)
286
286
  const createMap = javaMap(createItems.length)
287
287
  Content(`\`\`\`java
@@ -298,7 +298,7 @@ Object result = client.${accessor}(null).create(${createMap.open}
298
298
  `)
299
299
  }
300
300
  else if ('update' === opname || 'patch' === opname) {
301
- const updateItems = javaMapItems(opRequestShape(ent, opname).items)
301
+ const updateItems = javaMapItems(requestExampleItems(ent, opname))
302
302
  .filter((it: any) => !it.optional || it.name === idF)
303
303
  .sort((a: any, b: any) =>
304
304
  (a.name === idF ? 0 : 1) - (b.name === idF ? 0 : 1))
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, isAuthActive, envName, canonKey, entityIdField, opRequestShape , serverVariables, javaMapOf, matchExampleItems, javaMapItems } from '@voxgig/sdkgen'
2
+ import { cmp, Content, isAuthActive, envName, canonKey, entityIdField, opRequestShape , serverVariables, javaMapOf, matchExampleItems, javaMapItems, entityOps } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -34,7 +34,7 @@ const ReadmeTopQuick = cmp(function ReadmeTopQuick(props: any) {
34
34
 
35
35
 
36
36
  const shown = null == exampleEntity ? [] :
37
- ['list', 'load'].filter((op: string) => Object.keys(exampleEntity.op || {}).includes(op))
37
+ ['list', 'load'].filter((op: string) => entityOps(exampleEntity).includes(op))
38
38
  const imports = [
39
39
  ...(shown.includes('list') ? ['java.util.List'] : []),
40
40
  ...(authActive || '' !== javaServerLines || shown.includes('load') ? ['java.util.Map'] : []),
@@ -66,7 +66,7 @@ ${javaServerLines}${SDK} client = new ${SDK}(options);
66
66
  const eVar = javaVarName(exampleEntity.name)
67
67
  const accessor = javaVarName(exampleEntity.name)
68
68
  const eNameLower = nom(exampleEntity, 'Name').toLowerCase()
69
- const opnames = Object.keys(exampleEntity.op || {})
69
+ const opnames = entityOps(exampleEntity)
70
70
  const idF = entityIdField(exampleEntity)
71
71
 
72
72
  if (opnames.includes('list')) {
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, canonKey, entityIdField, pickExampleEntity, opRequestShape, requiredItems, javaMapOf, matchExampleItems, javaMapItems } from '@voxgig/sdkgen'
2
+ import { cmp, Content, canonKey, entityIdField, pickExampleEntity, requiredItems, javaMapOf, matchExampleItems, javaMapItems, requestExampleItems } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -39,7 +39,7 @@ ${SDK} client = ${SDK}.testSDK(null, null);
39
39
  `${JSON.stringify(it.name)}, ${isMatchOp && it.name === idF ? '"test01"' : javaLit(it.type)}`))
40
40
  : 'null'
41
41
  } else if ('create' === primaryOp || 'update' === primaryOp || 'patch' === primaryOp) {
42
- const items = javaMapItems(opRequestShape(exampleEntity, primaryOp).items)
42
+ const items = javaMapItems(requestExampleItems(exampleEntity, primaryOp))
43
43
  .filter((it: any) => it.name !== idF && it.name !== 'id')
44
44
  const required = items.filter((it: any) => !it.optional)
45
45
  const chosen = required.length ? required : items.slice(0, 3)
@@ -15,10 +15,15 @@ import {
15
15
  serverVarEnv,
16
16
  serverVariables, envName, envToken,
17
17
  pointParts,
18
+ pointPlaceholders,
18
19
  liveStrict,
19
20
  liveStrictNote,
20
21
  pointIsGraphql,
21
22
  graphqlDirectSkip,
23
+ liveExampleIds,
24
+ liveQueryExamples,
25
+ liveEntity,
26
+ liveDirectGetOnly, liveExcludedLines, liveExcludedSummary, LIVE_GETONLY_ENV,
22
27
  } from '@voxgig/sdkgen'
23
28
 
24
29
 
@@ -74,12 +79,24 @@ function javaLiteral(v: any): string {
74
79
  }
75
80
 
76
81
 
82
+ // A GET-only live run excludes a test needing an id that only a write gives.
83
+ function getOnlyKeysBlock(model: any, entity: any, test: string, keys: string[]): string {
84
+ return liveDirectGetOnly(model, entity, test, keys).map((miss) =>
85
+ ` if (setup.live && "TRUE".equals(System.getenv(${javaLiteral(LIVE_GETONLY_ENV)}))
86
+ && setup.idmap.get(${javaLiteral(miss.key)}) == null) {
87
+ System.out.println(${javaLiteral(liveExcludedLines({ excluded: [miss] })[0])});
88
+ Assumptions.abort(${javaLiteral(liveExcludedSummary({ excluded: [miss] }))});
89
+ }
90
+ `).join('')
91
+ }
92
+
93
+
77
94
  const TestDirect = cmp(function TestDirect(props: any) {
78
95
  const ctx$ = props.ctx$
79
96
  const model: Model = ctx$.model
80
97
 
81
98
  const target = props.target
82
- const entity: ModelEntity = props.entity
99
+ const entity: ModelEntity = liveEntity(ctx$, props.entity)
83
100
  const javapackage: string = props.javapackage
84
101
 
85
102
  const PROJECTNAME = envName(model)
@@ -118,12 +135,7 @@ const TestDirect = cmp(function TestDirect(props: any) {
118
135
  const allLoadParams = loadPoint?.g?.params || []
119
136
  // Only path params that actually appear in the URL template drive
120
137
  // direct-test path-param setup and URL-substitution asserts.
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
- }
138
+ const _pathPlaceholders = new Set<string>(pointPlaceholders(loadPoint))
127
139
  const _renameMap = (loadPoint?.r?.param || {}) as Record<string, string>
128
140
  const _renamedPlaceholders = new Set<string>()
129
141
  for (const ph of _pathPlaceholders) {
@@ -141,11 +153,8 @@ const TestDirect = cmp(function TestDirect(props: any) {
141
153
  const listParams = listPoint?.g?.params || []
142
154
 
143
155
  // Required query params with spec-provided examples — needed in live mode.
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) => ` query.put("${q.n}", ${javaLiteral(q.ex)});`)
156
+ const loadLiveQueryLines = liveQueryExamples(loadPoint)
157
+ .map(([name, ex]) => ` query.put("${name}", ${javaLiteral(ex)});`)
149
158
  .join('\n')
150
159
 
151
160
  // Path params with spec-provided examples — when ALL load params have
@@ -160,6 +169,10 @@ const TestDirect = cmp(function TestDirect(props: any) {
160
169
  // Build the ENTID env var name for this entity
161
170
  const entidEnvVar = `${PROJECTNAME}_TEST_${envToken(entity.name)}_ENTID`
162
171
 
172
+ const exampleIds = liveExampleIds(entity)
173
+ const listLiveQueryLines = liveQueryExamples(listPoint)
174
+ .map(([name, ex]) => ` query.put("${name}", ${javaLiteral(ex)});\n`).join('')
175
+
163
176
  File({ name: entity.Name + 'DirectTest.' + target.ext }, () => {
164
177
 
165
178
  Content(`package ${javapackage}.sdktest;
@@ -225,7 +238,8 @@ ${liveStrictNote(liveStrict(model, target.name), '//', ' ')}
225
238
  const listLiveIdKeys = listParams.length > 0
226
239
  ? listLiveParams.map((lp: any) => lp.key)
227
240
  : []
228
- const listSkipBlock = listLiveIdKeys.length > 0
241
+ const listSkipBlock = getOnlyKeysBlock(model, entity, 'direct-list-' + entity.name, listLiveIdKeys) +
242
+ (listLiveIdKeys.length > 0
229
243
  ? ` if (setup.live) {
230
244
  for (String liveKey : new String[] { ${listLiveIdKeys.map((k: string) => `"${k}"`).join(', ')} }) {
231
245
  if (setup.idmap.get(liveKey) == null) {
@@ -234,7 +248,7 @@ ${liveStrictNote(liveStrict(model, target.name), '//', ' ')}
234
248
  }
235
249
  }
236
250
  `
237
- : ''
251
+ : '')
238
252
 
239
253
  Content(` @Test
240
254
  public void directList${entity.Name}() {
@@ -251,9 +265,10 @@ ${listSkipBlock} ${SDK} client = setup.client;
251
265
 
252
266
  `)
253
267
 
254
- if (listParams.length > 0) {
268
+ if (listParams.length > 0 || '' !== listLiveQueryLines) {
255
269
  Content(` Map<String, Object> params = new LinkedHashMap<>();
256
- `)
270
+ Map<String, Object> query = new LinkedHashMap<>();
271
+ ${listLiveQueryLines ? ' if (setup.live) {\n' + listLiveQueryLines + ' }\n' : ''}`)
257
272
  listLiveParams.forEach((lp: any, i: number) => {
258
273
  const placeholder = 'direct0' + (i + 1)
259
274
  Content(` if (setup.live) {
@@ -268,7 +283,8 @@ ${listSkipBlock} ${SDK} client = setup.client;
268
283
  Map<String, Object> result = client.direct(jm(
269
284
  "path", "${listPath}",
270
285
  "method", "GET",
271
- "params", params));
286
+ "params", params,
287
+ "query", query));
272
288
  `)
273
289
  } else {
274
290
  Content(`
@@ -340,7 +356,8 @@ ${listSkipBlock} ${SDK} client = setup.client;
340
356
  loadLiveIdKeys = [...new Set((hasList ?
341
357
  [...listParams, ...loadParams.filter((p: any) => p.n !== 'id')] : loadParams).map(liveKey))]
342
358
  }
343
- const loadSkipBlock = loadLiveIdKeys.length > 0
359
+ const loadSkipBlock = getOnlyKeysBlock(model, entity, 'direct-load-' + entity.name, loadLiveIdKeys) +
360
+ (loadLiveIdKeys.length > 0
344
361
  ? ` if (setup.live) {
345
362
  for (String liveKey : new String[] { ${loadLiveIdKeys.map(k => `"${k}"`).join(', ')} }) {
346
363
  if (setup.idmap.get(liveKey) == null) {
@@ -349,7 +366,7 @@ ${listSkipBlock} ${SDK} client = setup.client;
349
366
  }
350
367
  }
351
368
  `
352
- : ''
369
+ : '')
353
370
 
354
371
  Content(` @Test
355
372
  public void directLoad${entity.Name}() {
@@ -533,7 +550,10 @@ ${authActive ? ` mergedOpts.put("apikey", env.get("${PROJECTNAME}_APIKEY"))
533
550
  else if (entidRaw instanceof Map) {
534
551
  idmap = (Map<String, Object>) entidRaw;
535
552
  }
536
- setup.idmap = idmap;
553
+ ${0 === exampleIds.length ? '' : ` // A path parameter's example stands in for an id *_ENTID does not give.
554
+ idmap = new LinkedHashMap<>(idmap);
555
+ ${exampleIds.map(([key, ex]) => ` idmap.putIfAbsent("${key}", ${javaLiteral(ex)});
556
+ `).join('')}`} setup.idmap = idmap;
537
557
  return setup;
538
558
  }
539
559
 
@@ -1,4 +1,4 @@
1
- import { flowSteps, opReachable, invalidRequest } from '@voxgig/sdkgen'
1
+ import { flowSteps, opReachable, invalidRequest, flowLoadRoute, flowLoadReadsRecord } from '@voxgig/sdkgen'
2
2
 
3
3
  import {
4
4
  KIT,
@@ -22,6 +22,9 @@ import {
22
22
  serverVarEnv,
23
23
  serverVariables, envName, envToken,
24
24
  liveFlowNeeds, liveStrict, liveStrictNote,
25
+ liveGetOnly, liveExcludedLines, liveExcludedSummary, LIVE_GETONLY_ENV,
26
+ liveRouteExamples, liveStepExamples,
27
+ liveEntity,
25
28
  } from '@voxgig/sdkgen'
26
29
 
27
30
 
@@ -76,7 +79,9 @@ function liveFlowGate(entity: any, needs: any, entidEnv: string, accessor: strin
76
79
  out += ` ${SDK} client = setup.client;\n`
77
80
  if (null != needs.discover) {
78
81
  const match = Object.entries(needs.discover)
79
- .map(([k, v]: any) => `match.put(${JSON.stringify(k)}, setup.idmap.get(${JSON.stringify(v)}));`).join(' ')
82
+ .map(([k, v]: any) => `match.put(${JSON.stringify(k)}, setup.idmap.get(${JSON.stringify(v)}));`)
83
+ .concat(liveRouteExamples(entity, 'list', Object.keys(needs.discover))
84
+ .map(([k, ex]) => `match.put(${JSON.stringify(k)}, ${javaLit(ex)});`)).join(' ')
80
85
  out += ` if (setup.live) {
81
86
  RunnerSupport.liveExisting(setup.data, LIVE_STRICT, ${JSON.stringify(entity.name)}, () -> {
82
87
  Map<String, Object> match = new LinkedHashMap<>();${match ? ' ' + match : ''}
@@ -97,7 +102,7 @@ const TestEntity = cmp(function TestEntity(props: any) {
97
102
  const model: Model = ctx$.model
98
103
 
99
104
  const target = props.target
100
- const entity: ModelEntity = props.entity
105
+ const entity: ModelEntity = liveEntity(ctx$, props.entity)
101
106
  const javapackage: string = props.javapackage
102
107
 
103
108
  const basicflow: ModelEntityFlow | undefined =
@@ -142,7 +147,6 @@ const TestEntity = cmp(function TestEntity(props: any) {
142
147
  const genCtx: GenCtx = { model, entity, javapackage, flow: basicflow, PROJUPPER, accessor }
143
148
 
144
149
  const strict = liveStrict(model, target.name)
145
- const needs = liveFlowNeeds(entity, basicflow)
146
150
 
147
151
  const stepOps = Array.from(new Set(
148
152
  (allSteps as any[]).map((s: any) => s.o).filter(Boolean)))
@@ -203,36 +207,66 @@ ${liveStrictNote(strict, '//', ' ')}
203
207
  reason == null || "".equals(reason)
204
208
  ? "skipped via sdk-test-control.json" : reason);
205
209
  }
206
- ${liveFlowGate(entity, needs, entidEnvVar, accessor, SDK, strict, allSteps.length > 0)}`)
207
-
208
- // Check if the flow has a create step; if not, bootstrap entity data
209
- const flowHasCreate = allSteps.some((s: any) => s.o === 'create')
210
- if (!flowHasCreate) {
211
- const preambleRef = entity.name + '_ref01'
212
- const preambleVar = javaVar(preambleRef)
213
- Content(` // Bootstrap entity data from existing test data (no create step in flow).
210
+ `)
211
+
212
+ const flowBody = (flow: any) => {
213
+ const steps = flowSteps(flow) as any[]
214
+ Content(liveFlowGate(entity, liveFlowNeeds(entity, flow), entidEnvVar, accessor, SDK, strict,
215
+ steps.length > 0))
216
+
217
+ // Check if the flow has a create step; if not, bootstrap entity data
218
+ const flowHasCreate = steps.some((s: any) => s.o === 'create')
219
+ if (!flowHasCreate) {
220
+ const preambleRef = entity.name + '_ref01'
221
+ const preambleVar = javaVar(preambleRef)
222
+ Content(` // Bootstrap entity data from existing test data (no create step in flow).
214
223
  List<List<Object>> ${preambleVar}DataRaw = Struct.items(Helpers.toMapAny(
215
224
  Struct.getpath(setup.data, "existing.${entity.name}")));
216
225
  Map<String, Object> ${preambleVar}Data = ${preambleVar}DataRaw.isEmpty()
217
226
  ? null : Helpers.toMapAny(${preambleVar}DataRaw.get(0).get(1));
218
227
 
219
228
  `)
220
- }
221
-
222
- // Model-driven step iteration
223
- each(flowSteps(basicflow), (step: any, index: any) => {
224
- const opgen: OpGen = GENERATE_OP[step.o]
225
- if (opgen) {
226
- opgen(genCtx, step, index)
227
- Content('\n')
228
229
  }
229
- })
230
230
 
231
- Content(`${strict || 0 === allSteps.length ? '' : ` }
231
+ // Model-driven step iteration
232
+ each(steps, (step: any, index: any) => {
233
+ const opgen: OpGen = GENERATE_OP[step.o]
234
+ if (opgen) {
235
+ opgen({ ...genCtx, flow }, step, index)
236
+ Content('\n')
237
+ }
238
+ })
239
+
240
+ Content(strict || 0 === steps.length ? '' : ` }
232
241
  catch (Throwable err) {
233
242
  RunnerSupport.liveObserve(err, setup.live, LIVE_STRICT);
234
243
  }
235
- `} }
244
+ `)
245
+ }
246
+
247
+ const getOnly = liveGetOnly(entity, basicflow)
248
+ if (null != getOnly) {
249
+ Content(` if (setup.live && "TRUE".equals(System.getenv(${javaLit(LIVE_GETONLY_ENV)}))) {
250
+ ${liveExcludedLines(getOnly).map((line) => ' System.out.println(' + javaLit(line) + ');\n').join('')}`)
251
+ if (0 === flowSteps(getOnly.flow).length) {
252
+ Content(` Assumptions.abort(${javaLit(liveExcludedSummary(getOnly))});
253
+ return;
254
+ }
255
+
256
+ `)
257
+ }
258
+ else {
259
+ flowBody(getOnly.flow)
260
+ Content(` return;
261
+ }
262
+
263
+ `)
264
+ }
265
+ }
266
+
267
+ flowBody(basicflow)
268
+
269
+ Content(` }
236
270
 
237
271
  `)
238
272
 
@@ -456,6 +490,7 @@ const generateList: OpGen = (ctx, step, index) => {
456
490
  Content(` ${matchvar}.put("${key}", setup.idmap.get("${val}"));
457
491
  `)
458
492
  }
493
+ Content(liveFill(entity, step, matchvar))
459
494
 
460
495
  // Only declare ${listvar} as a real var when a downstream validator
461
496
  // actually uses it.
@@ -615,7 +650,7 @@ const generateLoad: OpGen = (ctx, step, index) => {
615
650
  Content(` SdkEntity ${entvar} = client.${accessor}(null);
616
651
  `)
617
652
  }
618
- if (!hasSrcData && hasEntId) {
653
+ if (!hasSrcData && (hasEntId || flowLoadReadsRecord(entity, step))) {
619
654
  Content(` List<List<Object>> ${srcdatavar}Raw = Struct.items(Helpers.toMapAny(
620
655
  Struct.getpath(setup.data, "existing.${entity.name}")));
621
656
  Map<String, Object> ${srcdatavar} = ${srcdatavar}Raw.isEmpty()
@@ -626,7 +661,7 @@ const generateLoad: OpGen = (ctx, step, index) => {
626
661
  `)
627
662
  if (hasEntId) {
628
663
  Content(` ${matchvar}.put("id", ${srcdatavar}.get("id"));
629
- ${parentMatch(step, matchvar)} Object ${datavar}Loaded = ${entvar}.load(${matchvar}, null);
664
+ ${loadMatch(entity, step, matchvar, srcdatavar)}${liveFill(entity, step, matchvar)} Object ${datavar}Loaded = ${entvar}.load(${matchvar}, null);
630
665
  Map<String, Object> ${datavar}LoadResult = Helpers.toMapAny(${datavar}Loaded instanceof SdkEntity ? ((SdkEntity) ${datavar}Loaded).data() : ${datavar}Loaded);
631
666
  assertNotNull(${datavar}LoadResult, "expected load result to be a map");
632
667
  assertEquals(${srcdatavar}.get("id"), ${datavar}LoadResult.get("id"),
@@ -634,7 +669,7 @@ ${parentMatch(step, matchvar)} Object ${datavar}Loaded = ${entvar}.load(${mat
634
669
  `)
635
670
  }
636
671
  else {
637
- Content(`${parentMatch(step, matchvar)} Object ${datavar}Loaded = ${entvar}.load(${matchvar}, null);
672
+ Content(`${loadMatch(entity, step, matchvar, srcdatavar)}${liveFill(entity, step, matchvar)} Object ${datavar}Loaded = ${entvar}.load(${matchvar}, null);
638
673
  assertNotNull(${datavar}Loaded, "expected load result to be non-null");
639
674
  `)
640
675
  }
@@ -669,6 +704,21 @@ ${parentMatch(step, matchvar)} ${entvar}.remove(${matchvar}, null);
669
704
  // A child's route names its parents, and an entity no earlier step has
670
705
  // filled knows none of them, so the call itself gives each parent id. A live
671
706
  // ENTID may key a parent by its field name, the fixture by its own name.
707
+ function javaLit(value: any): string {
708
+ if ('string' === typeof value) return JSON.stringify(value)
709
+ return Number.isInteger(value) && Math.abs(value) > 2147483647 ? value + 'L' : String(value)
710
+ }
711
+
712
+
713
+ // A live step sends each example its route requires and the step leaves unbound.
714
+ function liveFill(entity: any, step: any, matchvar: string): string {
715
+ const fills = liveStepExamples(entity, step)
716
+ return 0 === fills.length ? '' : ` if (setup.live) {
717
+ ${fills.map(([k, ex]) => ` ${matchvar}.put(${JSON.stringify(k)}, ${javaLit(ex)});\n`).join('')} }
718
+ `
719
+ }
720
+
721
+
672
722
  function parentMatch(step: any, matchvar: string): string {
673
723
  return Object.entries(step.m || {})
674
724
  .filter(([k]: any) => k !== 'id' && !k.endsWith('$'))
@@ -678,6 +728,37 @@ function parentMatch(step: any, matchvar: string): string {
678
728
  }
679
729
 
680
730
 
731
+ // A load of a known record fills its route from that record, and from the
732
+ // step's binding where the record holds no scalar for it. A record only the
733
+ // fixture holds replaces the step's binding offline.
734
+ function loadMatch(entity: any, step: any, matchvar: string, srcdatavar: string): string {
735
+ const route = flowLoadRoute(entity, step)
736
+ if (null == route) {
737
+ return parentMatch(step, matchvar)
738
+ }
739
+ if (route.offline) {
740
+ const own = route.args.filter((arg) => null != arg.field)
741
+ return parentMatch(step, matchvar) + (0 === own.length ? '' : ` if (!setup.live) {
742
+ ${own.map((arg, i) => ` Object own${i} = ${srcdatavar}.get("${arg.field}");
743
+ if (own${i} instanceof String || own${i} instanceof Number || own${i} instanceof Boolean) {
744
+ ${matchvar}.put("${arg.name}", own${i});
745
+ }
746
+ `).join('')} }
747
+ `)
748
+ }
749
+ return route.args.map((arg) => {
750
+ const get = (key: string) => `setup.idmap.get("${key}")`
751
+ const bound = 1 === arg.idmap.length ? get(arg.idmap[0]) :
752
+ `null != ${get(arg.idmap[0])} ? ${get(arg.idmap[0])} : ${get(arg.idmap[1])}`
753
+ const own = `${srcdatavar}.get("${arg.field}")`
754
+ return null == arg.field ? ` ${matchvar}.put("${arg.name}", ${bound});
755
+ ` : ` ${matchvar}.put("${arg.name}", ${own} instanceof String || ${own} instanceof Number
756
+ || ${own} instanceof Boolean ? ${own} : (${bound}));
757
+ `
758
+ }).join('')
759
+ }
760
+
761
+
681
762
  const GENERATE_OP: Record<string, OpGen> = {
682
763
  create: generateCreate,
683
764
  list: generateList,
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, each, Content, canonToType, entityIdField, opRequestShape, safeVarName, exampleVarName, jsKey, opNeedsAction, listMatchArg, matchExampleItems } from '@voxgig/sdkgen'
2
+ import { cmp, each, Content, canonToType, entityIdField, safeVarName, exampleVarName, jsKey, opNeedsAction, listMatchArg, matchExampleItems, requestExampleItems } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -134,7 +134,7 @@ const ${eVar}s = await client.${entity.Name}().list(${listMatchArg('js', entity)
134
134
  // required id and parent keys like page_id — each with a type-correct
135
135
  // example VALUE via exampleValue — a `name: /* type */` comment is not
136
136
  // a value and yields invalid code.
137
- const createItems = opRequestShape(entity, 'create').items
137
+ const createItems = requestExampleItems(entity, 'create')
138
138
  .filter((it: any) => !it.optional)
139
139
  Content(`#### Example: Create
140
140
 
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, isAuthActive, envName, entityIdField, entityDataIdField, pickExampleEntity, opRequestShape, safeVarName, exampleVarName, jsKey, requiredItems, matchExampleItems, jsProp } from '@voxgig/sdkgen'
2
+ import { cmp, Content, isAuthActive, envName, entityIdField, entityDataIdField, pickExampleEntity, safeVarName, exampleVarName, jsKey, requiredItems, matchExampleItems, jsProp, requestExampleItems } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -39,7 +39,7 @@ const ReadmeHowto = cmp(function ReadmeHowto(props: any) {
39
39
  it.name === idF ? idPlaceholder : 'example_' + it.name)}`)
40
40
  return `{ ${pairs.join(', ')} }`
41
41
  }
42
- const items = opRequestShape(exampleEntity, primaryOp).items
42
+ const items = requestExampleItems(exampleEntity, primaryOp)
43
43
  .filter((it: any) => it.name !== idF && it.name !== 'id')
44
44
  const required = items.filter((it: any) => !it.optional)
45
45
  const chosen = required.length ? required : items.slice(0, 3)
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, each, Content, isAuthActive, packageName, envName, opRequestShape, entityIdField, entityOps, safeVarName, exampleVarName, jsKey, matchArg, listMatchArg, matchExampleItems } from '@voxgig/sdkgen'
2
+ import { cmp, each, Content, isAuthActive, packageName, envName, entityIdField, entityOps, safeVarName, exampleVarName, jsKey, matchArg, listMatchArg, matchExampleItems, requestExampleItems, sendsId } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -45,7 +45,7 @@ const client = ${ctor}
45
45
  const idF = entityIdField(exampleEntity)
46
46
  const eVar = exampleVarName(exampleEntity.name, 'js')
47
47
  const exampleFields = (opname: string): string[] => {
48
- const items = opRequestShape(exampleEntity, opname).items
48
+ const items = requestExampleItems(exampleEntity, opname)
49
49
  .filter((it: any) => (it.name !== idF && it.name !== 'id') ||
50
50
  ('create' === opname && !it.optional))
51
51
  const required = items.filter((it: any) => !it.optional)
@@ -109,7 +109,7 @@ console.log(created.data())
109
109
  }
110
110
 
111
111
  if (opnames.includes('update')) {
112
- const updateLines = (idF
112
+ const updateLines = (sendsId(exampleEntity, 'update', idF)
113
113
  ? [` ${jsKey(idF)}: ${exampleValue(exampleEntity, exampleEntity.op && exampleEntity.op.update, idF, exampleEntity.name + '_id')},`]
114
114
  : []).concat(exampleFields('update'))
115
115
  const updateBody = updateLines.length ? '\n' + updateLines.join('\n') + '\n' : ''
@@ -124,7 +124,7 @@ console.log(updated.data())
124
124
  }
125
125
 
126
126
  if (opnames.includes('patch')) {
127
- const patchLines = (idF
127
+ const patchLines = (sendsId(exampleEntity, 'patch', idF)
128
128
  ? [` ${jsKey(idF)}: ${exampleValue(exampleEntity, exampleEntity.op && exampleEntity.op.patch, idF, exampleEntity.name + '_id')},`]
129
129
  : []).concat(exampleFields('patch'))
130
130
  const patchBody = patchLines.length ? '\n' + patchLines.join('\n') + '\n' : ''
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, each, Content, canonToType, File, isAuthActive, entityIdField, opRequestShape, safeVarName, exampleVarName, jsKey , targetFeatures, opNeedsAction, bodyNote, listMatchArg, matchExampleItems } from '@voxgig/sdkgen'
2
+ import { cmp, each, Content, canonToType, File, isAuthActive, entityIdField, safeVarName, exampleVarName, jsKey , targetFeatures, opNeedsAction, bodyNote, listMatchArg, matchExampleItems, requestExampleItems } from '@voxgig/sdkgen'
3
3
  import { ReadmeRefFeatures } from '@voxgig/sdkgen'
4
4
 
5
5
  import {
@@ -321,7 +321,7 @@ const results = await client.${ent.Name}().${opname}(${listMatchArg('js', ent)})
321
321
  // a required id and parent keys like page_id — each with a
322
322
  // type-correct example VALUE via exampleValue — a
323
323
  // `name: /* type */` comment is not a value and yields invalid code.
324
- const createItems = opRequestShape(ent, 'create').items
324
+ const createItems = requestExampleItems(ent, 'create')
325
325
  .filter((it: any) => !it.optional)
326
326
  Content(`\`\`\`ts
327
327
  const result = await client.${ent.Name}().create({
@@ -338,7 +338,7 @@ const result = await client.${ent.Name}().create({
338
338
  else if ('update' === opname || 'patch' === opname) {
339
339
  // The id key plus every REQUIRED data member — the same shape the
340
340
  // runtime validates — then the patch-fields note.
341
- const updateItems = opRequestShape(ent, opname).items
341
+ const updateItems = requestExampleItems(ent, opname)
342
342
  .filter((it: any) => !it.optional || it.name === idF)
343
343
  .sort((a: any, b: any) =>
344
344
  (a.name === idF ? 0 : 1) - (b.name === idF ? 0 : 1))
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, entityIdField, pickExampleEntity, opRequestShape, safeVarName, exampleVarName, jsKey, requiredItems, matchExampleItems } from '@voxgig/sdkgen'
2
+ import { cmp, Content, entityIdField, pickExampleEntity, safeVarName, exampleVarName, jsKey, requiredItems, matchExampleItems, requestExampleItems } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -43,7 +43,7 @@ const client = ${model.const.Name}SDK.test()
43
43
  it.name === idF ? 'test01' : 'example_' + it.name)}`).join(', ')} }`
44
44
  : ''
45
45
  } else if ('create' === primaryOp || 'update' === primaryOp || 'patch' === primaryOp) {
46
- const items = opRequestShape(exampleEntity, primaryOp).items
46
+ const items = requestExampleItems(exampleEntity, primaryOp)
47
47
  .filter((it: any) => it.name !== idF && it.name !== 'id')
48
48
  const required = items.filter((it: any) => !it.optional)
49
49
  const chosen = required.length ? required : items.slice(0, 3)