@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, canonScalarKey, opRequestShape, entityIdField, entityOps, matchExampleItems, requiredItems } from '@voxgig/sdkgen'
2
+ import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, opRequestShape, entityIdField, entityOps, matchExampleItems, requiredItems, requestExampleItems, sendsId } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -163,7 +163,7 @@ catch (Exception err)
163
163
  // Model-driven example fields: derive the create/update body from the op
164
164
  // shape (opRequestShape) so the docs reference REAL writable fields.
165
165
  const examplePairs = (opname: string): string[] => {
166
- const items = opRequestShape(exampleEntity, opname).items
166
+ const items = requestExampleItems(exampleEntity, opname)
167
167
  .filter((it: any) => (it.name !== idF && it.name !== 'id') ||
168
168
  ('create' === opname && !it.optional))
169
169
  const required = items.filter((it: any) => !it.optional)
@@ -192,15 +192,15 @@ var created = client.${eName}().Create(new Dictionary<string, object?> { ${examp
192
192
  `)
193
193
  }
194
194
  if (opnames.includes('update')) {
195
- const updatePairs = (idF ? [`[${csStringLiteral(idF)}] = ${csLit(idParamType('update'), 'example_id')}`] : [])
195
+ const updatePairs = (sendsId(exampleEntity, 'update', idF) ? [`[${csStringLiteral(idF)}] = ${csLit(idParamType('update'), 'example_id')}`] : [])
196
196
  .concat(examplePairs('update'))
197
- Content(`// Update — supply the id in the match/data
197
+ Content(`// Update${sendsId(exampleEntity, 'update', idF) ? ' — supply the id in the match/data' : ''}
198
198
  client.${eName}().Update(new Dictionary<string, object?> { ${updatePairs.join(', ')} });
199
199
 
200
200
  `)
201
201
  }
202
202
  if (opnames.includes('patch')) {
203
- const patchPairs = (idF ? [`[${csStringLiteral(idF)}] = ${csLit(idParamType('patch'), 'example_id')}`] : [])
203
+ const patchPairs = (sendsId(exampleEntity, 'patch', idF) ? [`[${csStringLiteral(idF)}] = ${csLit(idParamType('patch'), 'example_id')}`] : [])
204
204
  .concat(examplePairs('patch'))
205
205
  Content(`// Patch — sends only the fields given
206
206
  client.${eName}().Patch(new Dictionary<string, object?> { ${patchPairs.join(', ')} });
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, each, Content, canonToType, canonKey, canonScalarKey, File, isAuthActive, entityIdField, opRequestShape , targetFeatures, opNeedsAction, bodyNote, matchExampleItems } from '@voxgig/sdkgen'
2
+ import { cmp, each, Content, canonToType, canonKey, canonScalarKey, File, isAuthActive, entityIdField , targetFeatures, opNeedsAction, bodyNote, matchExampleItems, requestExampleItems } from '@voxgig/sdkgen'
3
3
  import { ReadmeRefFeatures } from '@voxgig/sdkgen'
4
4
 
5
5
  import {
@@ -296,7 +296,7 @@ foreach (var item in results)
296
296
  `)
297
297
  }
298
298
  else if ('create' === opname) {
299
- const createItems = opRequestShape(ent, 'create').items
299
+ const createItems = requestExampleItems(ent, 'create')
300
300
  .filter((it: any) => !it.optional)
301
301
  Content(`\`\`\`csharp
302
302
  var result = client.${ent.Name}().Create(new Dictionary<string, object?>
@@ -312,7 +312,7 @@ var result = client.${ent.Name}().Create(new Dictionary<string, object?>
312
312
  `)
313
313
  }
314
314
  else if ('update' === opname || 'patch' === opname) {
315
- const updateItems = opRequestShape(ent, opname).items
315
+ const updateItems = requestExampleItems(ent, opname)
316
316
  .filter((it: any) => !it.optional || it.name === idF)
317
317
  .sort((a: any, b: any) =>
318
318
  (a.name === idF ? 0 : 1) - (b.name === idF ? 0 : 1))
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, opRequestShape, matchExampleItems } from '@voxgig/sdkgen'
2
+ import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, opRequestShape, matchExampleItems, entityOps } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -38,7 +38,7 @@ const ReadmeTopQuick = cmp(function ReadmeTopQuick(props: any) {
38
38
  : `new ${model.const.Name}SDK()`
39
39
 
40
40
  const shown = null != exampleEntity &&
41
- ['list', 'load'].some((op: string) => Object.keys(exampleEntity.op || {}).includes(op))
41
+ ['list', 'load'].some((op: string) => entityOps(exampleEntity).includes(op))
42
42
 
43
43
  Content(`\`\`\`csharp
44
44
  using ${model.const.Name}Sdk;
@@ -52,7 +52,7 @@ var client = ${ctor};
52
52
  // Sanitise the local variable name — an entity whose camelCased name is a
53
53
  // C# keyword gets a trailing underscore (csVarName) so the snippet compiles.
54
54
  const eVar = csVarName(exampleEntity.name)
55
- const opnames = Object.keys(exampleEntity.op || {})
55
+ const opnames = entityOps(exampleEntity)
56
56
  const idF = entityIdField(exampleEntity)
57
57
 
58
58
  if (opnames.includes('list')) {
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, canonKey, canonScalarKey, entityIdField, pickExampleEntity, opRequestShape, requiredItems, matchExampleItems } from '@voxgig/sdkgen'
2
+ import { cmp, Content, canonKey, canonScalarKey, entityIdField, pickExampleEntity, requiredItems, matchExampleItems, requestExampleItems } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -53,7 +53,7 @@ var client = ${model.const.Name}SDK.TestSDK(null, null);
53
53
  ` [${csStringLiteral(it.name)}] = ${isMatchOp && it.name === idF ? '"test01"' : csLit(it.type)}`).join(',')} }`
54
54
  : 'null'
55
55
  } else if ('create' === primaryOp || 'update' === primaryOp || 'patch' === primaryOp) {
56
- const items = opRequestShape(exampleEntity, primaryOp).items
56
+ const items = requestExampleItems(exampleEntity, primaryOp)
57
57
  .filter((it: any) => it.name !== idF && it.name !== 'id')
58
58
  const required = items.filter((it: any) => !it.optional)
59
59
  const chosen = required.length ? required : items.slice(0, 3)
@@ -15,10 +15,15 @@ import {
15
15
  serverVarEnv,
16
16
  serverVariables,
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
  import { formatCsValue } from './utility_csharp'
@@ -61,12 +66,26 @@ function normalizePathParams(
61
66
  }
62
67
 
63
68
 
69
+ // A GET-only live run excludes a test needing an id that only a write gives.
70
+ function getOnlyKeysBlock(model: any, entity: any, test: string, keys: string[]): string {
71
+ return liveDirectGetOnly(model, entity, test, keys).map((miss) =>
72
+ ` if (setup.Live && Environment.GetEnvironmentVariable(${formatCsValue(LIVE_GETONLY_ENV)}) == "TRUE"
73
+ && StructUtils.GetProp(setup.Idmap, ${formatCsValue(miss.key)}) == null)
74
+ {
75
+ Console.WriteLine(${formatCsValue(liveExcludedLines({ excluded: [miss] })[0])});
76
+ Console.WriteLine(${formatCsValue('skip: ' + liveExcludedSummary({ excluded: [miss] }))});
77
+ return;
78
+ }
79
+ `).join('')
80
+ }
81
+
82
+
64
83
  const TestDirect = cmp(function TestDirect(props: any) {
65
84
  const ctx$ = props.ctx$
66
85
  const model: Model = ctx$.model
67
86
 
68
87
  const target = props.target
69
- const entity: ModelEntity = props.entity
88
+ const entity: ModelEntity = liveEntity(ctx$, props.entity)
70
89
 
71
90
  const Name = model.const.Name
72
91
  const PROJECTNAME = envName(model)
@@ -111,12 +130,7 @@ const TestDirect = cmp(function TestDirect(props: any) {
111
130
  const allLoadParams = loadPoint?.g?.params || []
112
131
  // Only path params that actually appear in the URL template drive direct
113
132
  // path-param setup and URL-substitution asserts.
114
- const _pathPlaceholders = new Set<string>()
115
- for (const part of pointParts(loadPoint)) {
116
- if (typeof part === 'string' && part.startsWith('{') && part.endsWith('}')) {
117
- _pathPlaceholders.add(part.slice(1, -1))
118
- }
119
- }
133
+ const _pathPlaceholders = new Set<string>(pointPlaceholders(loadPoint))
120
134
  const _renameMap = (loadPoint?.r?.param || {}) as Record<string, string>
121
135
  const _renamedPlaceholders = new Set<string>()
122
136
  for (const ph of _pathPlaceholders) {
@@ -134,11 +148,8 @@ const TestDirect = cmp(function TestDirect(props: any) {
134
148
  const listParams = listPoint?.g?.params || []
135
149
 
136
150
  // Required query params with spec-provided examples - needed in live mode.
137
- const loadQuery = loadPoint?.g?.query || []
138
- const loadLiveQueryEntries = loadQuery
139
- .filter((q: any) => q.r && undefined !== q.ex && null !== q.ex)
140
- const loadLiveQueryLines = loadLiveQueryEntries
141
- .map((q: any) => ` query["${q.n}"] = ${formatCsValue(q.ex)};`)
151
+ const loadLiveQueryLines = liveQueryExamples(loadPoint)
152
+ .map(([name, ex]) => ` query["${name}"] = ${formatCsValue(ex)};`)
142
153
  .join('\n')
143
154
 
144
155
  // Path params with spec-provided examples - when ALL load params have
@@ -153,6 +164,10 @@ const TestDirect = cmp(function TestDirect(props: any) {
153
164
 
154
165
  const entidEnvVar = `${PROJECTNAME}_TEST_${ENTUPPER}_ENTID`
155
166
 
167
+ const exampleIds = liveExampleIds(entity)
168
+ const listLiveQueryLines = liveQueryExamples(listPoint)
169
+ .map(([name, ex]) => ` query["${name}"] = ${formatCsValue(ex)};\n`).join('')
170
+
156
171
  File({ name: entity.Name + 'DirectTest.' + target.ext }, () => {
157
172
 
158
173
  Content(`// ${entity.name} direct API tests (generated from the API model).
@@ -192,7 +207,8 @@ ${liveStrictNote(liveStrict(model, target.name), '//', ' ')}
192
207
  const listLiveIdKeys = listParams.length > 0
193
208
  ? listLiveParams.map((lp: any) => lp.key)
194
209
  : []
195
- const listSkipBlock = listLiveIdKeys.length > 0
210
+ const listSkipBlock = getOnlyKeysBlock(model, entity, 'direct-list-' + entity.name, listLiveIdKeys) +
211
+ (listLiveIdKeys.length > 0
196
212
  ? ` if (setup.Live)
197
213
  {
198
214
  foreach (var _liveKey in new[] { ${listLiveIdKeys.map((k: string) => `"${k}"`).join(', ')} })
@@ -205,7 +221,7 @@ ${liveStrictNote(liveStrict(model, target.name), '//', ' ')}
205
221
  }
206
222
  }
207
223
  `
208
- : ''
224
+ : '')
209
225
 
210
226
  Content(` [Fact]
211
227
  public void DirectList()
@@ -226,9 +242,10 @@ ${listSkipBlock} var client = setup.Client;
226
242
 
227
243
  `)
228
244
 
229
- if (listParams.length > 0) {
245
+ if (listParams.length > 0 || '' !== listLiveQueryLines) {
230
246
  Content(` var pathParams = new Dictionary<string, object?>();
231
- `)
247
+ var query = new Dictionary<string, object?>();
248
+ ${listLiveQueryLines ? ' if (setup.Live)\n {\n' + listLiveQueryLines + ' }\n' : ''}`)
232
249
  listLiveParams.forEach((lp: any, i: number) => {
233
250
  const placeholder = 'direct0' + (i + 1)
234
251
  Content(` if (setup.Live)
@@ -247,6 +264,7 @@ ${listSkipBlock} var client = setup.Client;
247
264
  ["path"] = "${listPath}",
248
265
  ["method"] = "GET",
249
266
  ["params"] = pathParams,
267
+ ["query"] = query,
250
268
  });
251
269
  `)
252
270
  } else {
@@ -327,7 +345,8 @@ ${listSkipBlock} var client = setup.Client;
327
345
  loadLiveIdKeys = [...new Set((hasList ?
328
346
  [...listParams, ...loadParams.filter((p: any) => p.n !== 'id')] : loadParams).map(liveKey))]
329
347
  }
330
- const loadSkipBlock = loadLiveIdKeys.length > 0
348
+ const loadSkipBlock = getOnlyKeysBlock(model, entity, 'direct-load-' + entity.name, loadLiveIdKeys) +
349
+ (loadLiveIdKeys.length > 0
331
350
  ? ` if (setup.Live)
332
351
  {
333
352
  foreach (var _liveKey in new[] { ${loadLiveIdKeys.map(k => `"${k}"`).join(', ')} })
@@ -340,7 +359,7 @@ ${listSkipBlock} var client = setup.Client;
340
359
  }
341
360
  }
342
361
  `
343
- : ''
362
+ : '')
344
363
 
345
364
  Content(` [Fact]
346
365
  public void DirectLoad()
@@ -559,7 +578,10 @@ ${loadSkipBlock} var client = setup.Client;
559
578
  {
560
579
  idmap = entidMap;
561
580
  }
562
-
581
+ ${0 === exampleIds.length ? '' : ` // A path parameter's example stands in for an id *_ENTID does not give.
582
+ idmap = new Dictionary<string, object?>(idmap);
583
+ ${exampleIds.map(([key, ex]) => ` idmap.TryAdd("${key}", ${formatCsValue(ex)});
584
+ `).join('')}`}
563
585
  return new ${entity.Name}DirectSetupResult
564
586
  {
565
587
  Client = liveClient,
@@ -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,10 +22,13 @@ import {
22
22
  serverVarEnv,
23
23
  serverVariables,
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
 
28
- import { csVarName } from './utility_csharp'
31
+ import { csVarName, formatCsValue } from './utility_csharp'
29
32
 
30
33
 
31
34
  // Convert a model name to a camelCase C# local (planet_ref01 -> planetRef01).
@@ -78,7 +81,9 @@ function liveFlowGate(entity: any, needs: any, entidEnv: string, strict: boolean
78
81
  out += ' var client = setup.Client;\n'
79
82
  if (null != needs.discover) {
80
83
  const match = Object.entries(needs.discover)
81
- .map(([k, v]: any) => ` [${JSON.stringify(k)}] = setup.Idmap[${JSON.stringify(v)}],`).join('')
84
+ .map(([k, v]: any) => ` [${JSON.stringify(k)}] = setup.Idmap[${JSON.stringify(v)}],`)
85
+ .concat(liveRouteExamples(entity, 'list', Object.keys(needs.discover))
86
+ .map(([k, ex]) => ` [${JSON.stringify(k)}] = ${formatCsValue(ex)},`)).join('')
82
87
  out += ` if (setup.Live && !TestRunner.LiveExisting(setup.Data, LIVE_STRICT, ${JSON.stringify(entity.name)},
83
88
  () => client.${entity.Name}().List(new Dictionary<string, object?> {${match} }, null)))
84
89
  {
@@ -98,7 +103,7 @@ const TestEntity = cmp(function TestEntity(props: any) {
98
103
  const model: Model = ctx$.model
99
104
 
100
105
  const target = props.target
101
- const entity: ModelEntity = props.entity
106
+ const entity: ModelEntity = liveEntity(ctx$, props.entity)
102
107
 
103
108
  const basicflow: ModelEntityFlow | undefined =
104
109
  getModelPath(model, `main.${KIT}.flow.Basic${nom(entity, 'Name')}Flow`)
@@ -146,7 +151,6 @@ const TestEntity = cmp(function TestEntity(props: any) {
146
151
  const genCtx: GenCtx = { model, entity, flow: basicflow, PROJUPPER }
147
152
 
148
153
  const strict = liveStrict(model, target.name)
149
- const needs = liveFlowNeeds(entity, basicflow)
150
154
  const entidEnvVar = `${PROJUPPER}_TEST_${ENTUPPER}_ENTID`
151
155
 
152
156
  const opNames = Array.from(new Set(
@@ -201,14 +205,18 @@ ${liveStrictNote(strict, '//', ' ')}
201
205
  public void Basic()
202
206
  {
203
207
  var setup = ${entity.Name}BasicSetup(null);
204
- ${skipBlock}${liveFlowGate(entity, needs, entidEnvVar, strict, allSteps.length > 0)}`)
205
-
206
- // Check if the flow has a create step; if not, bootstrap entity data
207
- const flowHasCreate = allSteps.some((s: any) => s.o === 'create')
208
- if (!flowHasCreate) {
209
- const preambleRef = entity.name + '_ref01'
210
- const preambleVar = csVar(preambleRef)
211
- Content(` // Bootstrap entity data from existing test data (no create step in flow).
208
+ ${skipBlock}`)
209
+
210
+ const flowBody = (flow: any) => {
211
+ const steps = flowSteps(flow) as any[]
212
+ Content(liveFlowGate(entity, liveFlowNeeds(entity, flow), entidEnvVar, strict, steps.length > 0))
213
+
214
+ // Check if the flow has a create step; if not, bootstrap entity data
215
+ const flowHasCreate = steps.some((s: any) => s.o === 'create')
216
+ if (!flowHasCreate) {
217
+ const preambleRef = entity.name + '_ref01'
218
+ const preambleVar = csVar(preambleRef)
219
+ Content(` // Bootstrap entity data from existing test data (no create step in flow).
212
220
  var ${preambleVar}DataRaw = StructUtils.Items(
213
221
  Helpers.ToMapAny(StructUtils.GetPath(setup.Data, "existing.${entity.name}")));
214
222
  var ${preambleVar}Data = ${preambleVar}DataRaw.Count > 0
@@ -216,25 +224,55 @@ ${skipBlock}${liveFlowGate(entity, needs, entidEnvVar, strict, allSteps.length >
216
224
  : null;
217
225
 
218
226
  `)
219
- }
220
-
221
- // Model-driven step iteration
222
- each(flowSteps(basicflow), (step: any, index: any) => {
223
- const opgen: OpGen = GENERATE_OP[step.o]
224
- if (opgen) {
225
- opgen(genCtx, step, index)
226
- Content('\n')
227
227
  }
228
- })
229
228
 
230
- Content(`${strict || 0 === allSteps.length ? '' : ` }
229
+ // Model-driven step iteration
230
+ each(steps, (step: any, index: any) => {
231
+ const opgen: OpGen = GENERATE_OP[step.o]
232
+ if (opgen) {
233
+ opgen({ ...genCtx, flow }, step, index)
234
+ Content('\n')
235
+ }
236
+ })
237
+
238
+ Content(strict || 0 === steps.length ? '' : ` }
231
239
  catch (Exception liveErr)
232
240
  {
233
241
  TestRunner.LiveObserve(liveErr, setup.Live, LIVE_STRICT);
234
242
  }
235
- `} }
243
+ `)
244
+ }
245
+
246
+ // A C# local is in scope throughout its block, so the steps a GET-only
247
+ // run keeps cannot share the method with the full flow's.
248
+ const getOnly = liveGetOnly(entity, basicflow)
249
+ const getOnlyRuns = null != getOnly && 0 < flowSteps(getOnly.flow).length
250
+ if (null != getOnly) {
251
+ Content(` if (setup.Live && Environment.GetEnvironmentVariable(${formatCsValue(LIVE_GETONLY_ENV)}) == "TRUE")
252
+ {
253
+ ${liveExcludedLines(getOnly).map((line) => ' Console.WriteLine(' + formatCsValue(line) + ');\n').join('')}${getOnlyRuns ?
254
+ ' BasicGetOnly(setup);\n' :
255
+ ' Console.WriteLine(' + formatCsValue('skip: ' + liveExcludedSummary(getOnly)) + ');\n'} return;
256
+ }
257
+
258
+ `)
259
+ }
260
+
261
+ flowBody(basicflow)
262
+
263
+ Content(` }
264
+
265
+ `)
266
+
267
+ if (null != getOnly && getOnlyRuns) {
268
+ Content(` private static void BasicGetOnly(EntityTestSetup setup)
269
+ {
270
+ `)
271
+ flowBody(getOnly.flow)
272
+ Content(` }
236
273
 
237
274
  `)
275
+ }
238
276
 
239
277
  // The stream test lists with no match, so a bare call must reach a route.
240
278
  const flowHasList = allSteps.some((s: any) => s.o === 'list') &&
@@ -482,6 +520,7 @@ const generateList: OpGen = (ctx, step, index) => {
482
520
  Content(` };
483
521
  `)
484
522
  }
523
+ Content(liveFill(entity, step, matchvar))
485
524
 
486
525
  Content(`
487
526
  var ${listvar}Result = ${entvar}.List(${matchvar}, null);
@@ -635,7 +674,7 @@ const generateLoad: OpGen = (ctx, step, index) => {
635
674
  Content(` var ${entvar} = client.${entity.Name}();
636
675
  `)
637
676
  }
638
- if (!hasSrcData && hasEntId) {
677
+ if (!hasSrcData && (hasEntId || flowLoadReadsRecord(entity, step))) {
639
678
  Content(` var ${srcdatavar}Raw = StructUtils.Items(
640
679
  Helpers.ToMapAny(StructUtils.GetPath(setup.Data, "existing.${entity.name}")));
641
680
  var ${srcdatavar} = ${srcdatavar}Raw.Count > 0
@@ -648,7 +687,7 @@ const generateLoad: OpGen = (ctx, step, index) => {
648
687
  {
649
688
  ["id"] = ${srcdatavar}!["id"],
650
689
  };
651
- ${parentMatch(step, matchvar)} var ${datavar}Loaded = ${entvar}.Load(${matchvar}, null);
690
+ ${loadMatch(entity, step, matchvar, srcdatavar)}${liveFill(entity, step, matchvar)} var ${datavar}Loaded = ${entvar}.Load(${matchvar}, null);
652
691
  var ${datavar}LoadResult = Helpers.ToMapAny(${datavar}Loaded is IEntity le ? le.Data() : ${datavar}Loaded);
653
692
  Assert.True(${datavar}LoadResult != null, "expected load result to be a map");
654
693
  Assert.True(StructRunner.DeepEqual(${datavar}LoadResult!["id"], ${srcdatavar}["id"]),
@@ -657,7 +696,7 @@ ${parentMatch(step, matchvar)} var ${datavar}Loaded = ${entvar}.Load(${ma
657
696
  }
658
697
  else {
659
698
  Content(` var ${matchvar} = new Dictionary<string, object?>();
660
- ${parentMatch(step, matchvar)} var ${datavar}Loaded = ${entvar}.Load(${matchvar}, null);
699
+ ${loadMatch(entity, step, matchvar, srcdatavar)}${liveFill(entity, step, matchvar)} var ${datavar}Loaded = ${entvar}.Load(${matchvar}, null);
661
700
  Assert.True(${datavar}Loaded != null, "expected load result to be non-null");
662
701
  `)
663
702
  }
@@ -694,6 +733,16 @@ ${parentMatch(step, matchvar)} ${entvar}.Remove(${matchvar}, null);
694
733
  // A child's route names its parents, and an entity no earlier step has
695
734
  // filled knows none of them, so the call itself gives each parent id. A live
696
735
  // ENTID may key a parent by its field name, the fixture by its own name.
736
+ // A live step sends each example its route requires and the step leaves unbound.
737
+ function liveFill(entity: any, step: any, matchvar: string): string {
738
+ const fills = liveStepExamples(entity, step)
739
+ return 0 === fills.length ? '' : ` if (setup.Live)
740
+ {
741
+ ${fills.map(([k, ex]) => ` ${matchvar}[${JSON.stringify(k)}] = ${formatCsValue(ex)};\n`).join('')} }
742
+ `
743
+ }
744
+
745
+
697
746
  function parentMatch(step: any, matchvar: string): string {
698
747
  return Object.entries(step.m || {})
699
748
  .filter(([k]: any) => k !== 'id' && !k.endsWith('$'))
@@ -702,6 +751,35 @@ function parentMatch(step: any, matchvar: string): string {
702
751
  }
703
752
 
704
753
 
754
+ // A load of a known record fills its route from that record, and from the
755
+ // step's binding where the record holds no scalar for it. A record only the
756
+ // fixture holds replaces the step's binding offline.
757
+ function loadMatch(entity: any, step: any, matchvar: string, srcdatavar: string): string {
758
+ const route = flowLoadRoute(entity, step)
759
+ if (null == route) {
760
+ return parentMatch(step, matchvar)
761
+ }
762
+ if (route.offline) {
763
+ const own = route.args.filter((arg) => null != arg.field)
764
+ return parentMatch(step, matchvar) + (0 === own.length ? '' : ` if (!setup.Live)
765
+ {
766
+ ${own.map((arg, i) => ` if (StructUtils.GetProp(${srcdatavar}, "${arg.field}") is System.IConvertible own${i})
767
+ {
768
+ ${matchvar}["${arg.name}"] = own${i};
769
+ }
770
+ `).join('')} }
771
+ `)
772
+ }
773
+ return route.args.map((arg) => {
774
+ const bound = arg.idmap.map((key) => `StructUtils.GetProp(setup.Idmap, "${key}")`).join(' ?? ')
775
+ const own = `StructUtils.GetProp(${srcdatavar}, "${arg.field}")`
776
+ return ` ${matchvar}["${arg.name}"] = ${null == arg.field ? bound :
777
+ `${own} is System.IConvertible ? ${own} : ${bound}`};
778
+ `
779
+ }).join('')
780
+ }
781
+
782
+
705
783
  const GENERATE_OP: Record<string, OpGen> = {
706
784
  create: generateCreate,
707
785
  list: generateList,
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, each, Content, canonToType, entityIdField, opRequestShape, opNeedsAction, elixirAccessor, entityCollection, exampleVarName, matchExampleItems } from '@voxgig/sdkgen'
2
+ import { cmp, each, Content, canonToType, entityIdField, opNeedsAction, elixirAccessor, entityCollection, exampleVarName, matchExampleItems, requestExampleItems } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -140,7 +140,7 @@ ${eVar}s = ${Name}.Entity.${EName}.list(${eVar}${elixirListArgs(entity, Name)})
140
140
  // Members come from the SAME shape the runtime validates
141
141
  // (opRequestShape): every required member must appear — with a real,
142
142
  // executable literal.
143
- const createItems = opRequestShape(entity, 'create').items
143
+ const createItems = requestExampleItems(entity, 'create')
144
144
  .filter((it: any) => !it.optional)
145
145
  Content(`#### Example: Create
146
146
 
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, isAuthActive, envName, entityIdField, pickExampleEntity, opRequestShape, elixirAccessor, entityCollection, exampleVarName, requiredItems, matchExampleItems } from '@voxgig/sdkgen'
2
+ import { cmp, Content, isAuthActive, envName, entityIdField, pickExampleEntity, elixirAccessor, entityCollection, exampleVarName, requiredItems, matchExampleItems, requestExampleItems } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -34,7 +34,7 @@ const ReadmeHowto = cmp(function ReadmeHowto(props: any) {
34
34
  const chosen = requiredItems(exampleEntity, 'list')
35
35
  testArg = `H.deep(%{${chosen.map((it: any) => `${elixirString(it.name)} => ${elixirLit(it.type)}`).join(', ')}})`
36
36
  } else if (exampleEntity && ('create' === primaryOp || 'update' === primaryOp || 'patch' === primaryOp)) {
37
- const items = opRequestShape(exampleEntity, primaryOp).items
37
+ const items = requestExampleItems(exampleEntity, primaryOp)
38
38
  .filter((it: any) => it.name !== idF && it.name !== 'id')
39
39
  const required = items.filter((it: any) => !it.optional)
40
40
  const chosen = required.length ? required : items.slice(0, 3)
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, isAuthActive, envName, opRequestShape, entityIdField, entityDataIdField, entityOps, elixirAccessor, entityCollection, exampleVarName, matchExampleItems, requiredItems } from '@voxgig/sdkgen'
2
+ import { cmp, Content, isAuthActive, envName, opRequestShape, entityIdField, entityDataIdField, entityOps, elixirAccessor, entityCollection, exampleVarName, matchExampleItems, requiredItems, requestExampleItems, sendsId } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -140,7 +140,7 @@ end
140
140
  // Model-driven example fields: derive the create/update body from the op
141
141
  // shape so the docs reference REAL writable fields.
142
142
  const examplePairs = (opname: string): string[] => {
143
- const items = opRequestShape(exampleEntity, opname).items
143
+ const items = requestExampleItems(exampleEntity, opname)
144
144
  .filter((it: any) => (it.name !== idF && it.name !== 'id') ||
145
145
  ('create' === opname && !it.optional))
146
146
  const required = items.filter((it: any) => !it.optional)
@@ -174,14 +174,14 @@ created = ${Name}.Entity.${eName}.create(${eVar}, H.deep(%{${examplePairs('creat
174
174
  `)
175
175
  }
176
176
  if (opnames.includes('update')) {
177
- const updatePairs = (idF ? [`${elixirString(idF)} => ${idValueFor('update')}`] : []).concat(examplePairs('update'))
177
+ const updatePairs = (sendsId(exampleEntity, 'update', idF) ? [`${elixirString(idF)} => ${idValueFor('update')}`] : []).concat(examplePairs('update'))
178
178
  Content(`# Update
179
179
  ${Name}.Entity.${eName}.update(${eVar}, H.deep(%{${updatePairs.join(', ')}}))
180
180
 
181
181
  `)
182
182
  }
183
183
  if (opnames.includes('patch')) {
184
- const patchPairs = (idF ? [`${elixirString(idF)} => ${idValueFor('patch')}`] : []).concat(examplePairs('patch'))
184
+ const patchPairs = (sendsId(exampleEntity, 'patch', idF) ? [`${elixirString(idF)} => ${idValueFor('patch')}`] : []).concat(examplePairs('patch'))
185
185
  Content(`# Patch — sends only the fields given
186
186
  ${Name}.Entity.${eName}.patch(${eVar}, H.deep(%{${patchPairs.join(', ')}}))
187
187
 
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, each, Content, canonToType, File, isAuthActive, entityIdField, opRequestShape , targetFeatures, opNeedsAction, bodyNote, elixirAccessor, entityCollection, exampleVarName, matchExampleItems } from '@voxgig/sdkgen'
2
+ import { cmp, each, Content, canonToType, File, isAuthActive, entityIdField , targetFeatures, opNeedsAction, bodyNote, elixirAccessor, entityCollection, exampleVarName, matchExampleItems, requestExampleItems } from '@voxgig/sdkgen'
3
3
  import { ReadmeRefFeatures } from '@voxgig/sdkgen'
4
4
 
5
5
  import {
@@ -230,7 +230,7 @@ ${eVar}s = ${Name}.Entity.${EName}.list(${eVar}${elixirListArgs(ent, Name)})
230
230
  `)
231
231
  }
232
232
  else if ('create' === opname) {
233
- const createItems = opRequestShape(ent, 'create').items
233
+ const createItems = requestExampleItems(ent, 'create')
234
234
  .filter((it: any) => !it.optional)
235
235
  Content(`\`\`\`elixir
236
236
  ${eVar} = ${Name}.Entity.${EName}.create(${eVar}, ${Name}.Helpers.deep(%{
@@ -245,7 +245,7 @@ ${eVar} = ${Name}.Entity.${EName}.create(${eVar}, ${Name}.Helpers.deep(%{
245
245
  `)
246
246
  }
247
247
  else if ('update' === opname || 'patch' === opname) {
248
- const updateItems = opRequestShape(ent, opname).items
248
+ const updateItems = requestExampleItems(ent, opname)
249
249
  .filter((it: any) => !it.optional || it.name === idF)
250
250
  .sort((a: any, b: any) =>
251
251
  (a.name === idF ? 0 : 1) - (b.name === idF ? 0 : 1))
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, isAuthActive, envName, entityIdField, opRequestShape, elixirAccessor, entityCollection, exampleVarName, matchExampleItems } from '@voxgig/sdkgen'
2
+ import { cmp, Content, isAuthActive, envName, entityIdField, opRequestShape, elixirAccessor, entityCollection, exampleVarName, matchExampleItems, entityOps } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -34,7 +34,7 @@ sdk = ${ctor}
34
34
  const eName = nom(exampleEntity, 'Name')
35
35
  const eVar = exampleVarName(exampleEntity.name, 'elixir')
36
36
  const eCall = elixirAccessor(exampleEntity, entityCollection(model))
37
- const opnames = Object.keys(exampleEntity.op || {})
37
+ const opnames = entityOps(exampleEntity)
38
38
  const idF = entityIdField(exampleEntity)
39
39
 
40
40
  Content(`${eVar} = ${Name}.${eCall}(sdk)
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, entityIdField, pickExampleEntity, opRequestShape, elixirAccessor, entityCollection, exampleVarName, requiredItems, matchExampleItems } from '@voxgig/sdkgen'
2
+ import { cmp, Content, entityIdField, pickExampleEntity, elixirAccessor, entityCollection, exampleVarName, requiredItems, matchExampleItems, requestExampleItems } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -42,7 +42,7 @@ sdk = ${Name}.test()
42
42
  `${elixirString(it.name)} => ${isMatchOp && it.name === idF ? '"test01"' : elixirLit(it.type)}`).join(', ')}})`
43
43
  : 'H.deep(%{})'
44
44
  } else if ('create' === primaryOp || 'update' === primaryOp || 'patch' === primaryOp) {
45
- const items = opRequestShape(exampleEntity, primaryOp).items
45
+ const items = requestExampleItems(exampleEntity, primaryOp)
46
46
  .filter((it: any) => it.name !== idF && it.name !== 'id')
47
47
  const required = items.filter((it: any) => !it.optional)
48
48
  const chosen = required.length ? required : items.slice(0, 3)
@@ -10,7 +10,7 @@ import { formatGoMap } from './utility_go'
10
10
 
11
11
  const EntityOperation = cmp(function Operation(props: any) {
12
12
  const { model } = props.ctx$
13
- const { ff, opname, entity, entrep, gomodule, cls } = props
13
+ const { ff, opname, entity, entrep, gomodule, cls, ctor } = props
14
14
 
15
15
  let { indent } = props
16
16
 
@@ -39,7 +39,7 @@ const EntityOperation = cmp(function Operation(props: any) {
39
39
  // in the Entity<Op>Op.fragment.go files (receiver -> cls; the per-op
40
40
  // EntityName<Op>Match/Data data types stay derived from EntityName).
41
41
  EntyClass: cls,
42
- NewEntyClass: 'New' + cls,
42
+ NewEntyClass: ctor,
43
43
 
44
44
  '#Feature-Hook': ({ name, indent }: any) =>
45
45
  Content({ indent }, `