@voxgig/sdkgen 4.35.3 → 4.37.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 (270) 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 +5 -4
  59. package/project/.sdk/src/cmp/go/MainEntity_go.ts +1 -1
  60. package/project/.sdk/src/cmp/go/Main_go.ts +9 -5
  61. package/project/.sdk/src/cmp/go/PrepareAuth_go.ts +24 -15
  62. package/project/.sdk/src/cmp/go/ReadmeEntity_go.ts +2 -2
  63. package/project/.sdk/src/cmp/go/ReadmeHowto_go.ts +2 -2
  64. package/project/.sdk/src/cmp/go/ReadmeModel_go.ts +3 -3
  65. package/project/.sdk/src/cmp/go/ReadmeQuick_go.ts +4 -4
  66. package/project/.sdk/src/cmp/go/ReadmeRef_go.ts +4 -4
  67. package/project/.sdk/src/cmp/go/ReadmeTopTest_go.ts +2 -2
  68. package/project/.sdk/src/cmp/go/TestDirect_go.ts +61 -26
  69. package/project/.sdk/src/cmp/go/TestEntity_go.ts +115 -32
  70. package/project/.sdk/src/cmp/go-cli/fragment/words.fragment.go +1 -1
  71. package/project/.sdk/src/cmp/go-mcp/fragment/tools.fragment.go +1 -1
  72. package/project/.sdk/src/cmp/java/ReadmeEntity_java.ts +2 -2
  73. package/project/.sdk/src/cmp/java/ReadmeHowto_java.ts +2 -2
  74. package/project/.sdk/src/cmp/java/ReadmeQuick_java.ts +5 -5
  75. package/project/.sdk/src/cmp/java/ReadmeRef_java.ts +3 -3
  76. package/project/.sdk/src/cmp/java/ReadmeTopQuick_java.ts +3 -3
  77. package/project/.sdk/src/cmp/java/ReadmeTopTest_java.ts +2 -2
  78. package/project/.sdk/src/cmp/java/TestDirect_java.ts +40 -20
  79. package/project/.sdk/src/cmp/java/TestEntity_java.ts +107 -26
  80. package/project/.sdk/src/cmp/js/ReadmeEntity_js.ts +2 -2
  81. package/project/.sdk/src/cmp/js/ReadmeHowto_js.ts +2 -2
  82. package/project/.sdk/src/cmp/js/ReadmeQuick_js.ts +4 -4
  83. package/project/.sdk/src/cmp/js/ReadmeRef_js.ts +3 -3
  84. package/project/.sdk/src/cmp/js/ReadmeTopTest_js.ts +2 -2
  85. package/project/.sdk/src/cmp/js/TestDirect_js.ts +68 -13
  86. package/project/.sdk/src/cmp/js/TestEntity_js.ts +46 -4
  87. package/project/.sdk/src/cmp/kotlin/ReadmeEntity_kotlin.ts +2 -2
  88. package/project/.sdk/src/cmp/kotlin/ReadmeHowto_kotlin.ts +2 -2
  89. package/project/.sdk/src/cmp/kotlin/ReadmeQuick_kotlin.ts +5 -5
  90. package/project/.sdk/src/cmp/kotlin/ReadmeRef_kotlin.ts +3 -3
  91. package/project/.sdk/src/cmp/kotlin/ReadmeTopQuick_kotlin.ts +3 -3
  92. package/project/.sdk/src/cmp/kotlin/ReadmeTopTest_kotlin.ts +2 -2
  93. package/project/.sdk/src/cmp/kotlin/TestDirect_kotlin.ts +41 -21
  94. package/project/.sdk/src/cmp/kotlin/TestEntity_kotlin.ts +99 -22
  95. package/project/.sdk/src/cmp/lua/ReadmeEntity_lua.ts +2 -2
  96. package/project/.sdk/src/cmp/lua/ReadmeHowto_lua.ts +2 -2
  97. package/project/.sdk/src/cmp/lua/ReadmeQuick_lua.ts +4 -4
  98. package/project/.sdk/src/cmp/lua/ReadmeRef_lua.ts +3 -3
  99. package/project/.sdk/src/cmp/lua/ReadmeTopQuick_lua.ts +3 -3
  100. package/project/.sdk/src/cmp/lua/ReadmeTopTest_lua.ts +2 -2
  101. package/project/.sdk/src/cmp/lua/TestDirect_lua.ts +40 -16
  102. package/project/.sdk/src/cmp/lua/TestEntity_lua.ts +108 -30
  103. package/project/.sdk/src/cmp/ocaml/ReadmeEntity_ocaml.ts +2 -2
  104. package/project/.sdk/src/cmp/ocaml/ReadmeHowto_ocaml.ts +2 -2
  105. package/project/.sdk/src/cmp/ocaml/ReadmeQuick_ocaml.ts +4 -4
  106. package/project/.sdk/src/cmp/ocaml/ReadmeRef_ocaml.ts +3 -3
  107. package/project/.sdk/src/cmp/ocaml/ReadmeTopQuick_ocaml.ts +2 -2
  108. package/project/.sdk/src/cmp/ocaml/ReadmeTopTest_ocaml.ts +2 -2
  109. package/project/.sdk/src/cmp/perl/ReadmeEntity_perl.ts +2 -2
  110. package/project/.sdk/src/cmp/perl/ReadmeHowto_perl.ts +2 -2
  111. package/project/.sdk/src/cmp/perl/ReadmeQuick_perl.ts +4 -4
  112. package/project/.sdk/src/cmp/perl/ReadmeRef_perl.ts +3 -3
  113. package/project/.sdk/src/cmp/perl/ReadmeTopQuick_perl.ts +2 -2
  114. package/project/.sdk/src/cmp/perl/ReadmeTopTest_perl.ts +2 -2
  115. package/project/.sdk/src/cmp/perl/TestDirect_perl.ts +35 -16
  116. package/project/.sdk/src/cmp/perl/TestEntity_perl.ts +98 -22
  117. package/project/.sdk/src/cmp/php/ReadmeEntity_php.ts +2 -2
  118. package/project/.sdk/src/cmp/php/ReadmeHowto_php.ts +2 -2
  119. package/project/.sdk/src/cmp/php/ReadmeQuick_php.ts +4 -4
  120. package/project/.sdk/src/cmp/php/ReadmeRef_php.ts +3 -3
  121. package/project/.sdk/src/cmp/php/ReadmeTopQuick_php.ts +2 -2
  122. package/project/.sdk/src/cmp/php/ReadmeTopTest_php.ts +2 -2
  123. package/project/.sdk/src/cmp/php/TestDirect_php.ts +33 -16
  124. package/project/.sdk/src/cmp/php/TestEntity_php.ts +98 -29
  125. package/project/.sdk/src/cmp/py/ReadmeEntity_py.ts +2 -2
  126. package/project/.sdk/src/cmp/py/ReadmeHowto_py.ts +2 -2
  127. package/project/.sdk/src/cmp/py/ReadmeQuick_py.ts +4 -4
  128. package/project/.sdk/src/cmp/py/ReadmeRef_py.ts +3 -3
  129. package/project/.sdk/src/cmp/py/ReadmeTopQuick_py.ts +2 -2
  130. package/project/.sdk/src/cmp/py/ReadmeTopTest_py.ts +2 -2
  131. package/project/.sdk/src/cmp/py/TestDirect_py.ts +39 -16
  132. package/project/.sdk/src/cmp/py/TestEntity_py.ts +90 -27
  133. package/project/.sdk/src/cmp/rb/ReadmeEntity_rb.ts +2 -2
  134. package/project/.sdk/src/cmp/rb/ReadmeHowto_rb.ts +2 -2
  135. package/project/.sdk/src/cmp/rb/ReadmeQuick_rb.ts +4 -4
  136. package/project/.sdk/src/cmp/rb/ReadmeRef_rb.ts +3 -3
  137. package/project/.sdk/src/cmp/rb/ReadmeTopQuick_rb.ts +2 -2
  138. package/project/.sdk/src/cmp/rb/ReadmeTopTest_rb.ts +2 -2
  139. package/project/.sdk/src/cmp/rb/TestClean_rb.ts +1 -1
  140. package/project/.sdk/src/cmp/rb/TestDirect_rb.ts +33 -16
  141. package/project/.sdk/src/cmp/rb/TestEntity_rb.ts +90 -25
  142. package/project/.sdk/src/cmp/rb/fragment/Main.fragment.rb +3 -3
  143. package/project/.sdk/src/cmp/rust/EntityOperation_rust.ts +1 -1
  144. package/project/.sdk/src/cmp/rust/Main_rust.ts +3 -1
  145. package/project/.sdk/src/cmp/rust/ReadmeEntity_rust.ts +2 -2
  146. package/project/.sdk/src/cmp/rust/ReadmeHowto_rust.ts +3 -3
  147. package/project/.sdk/src/cmp/rust/ReadmeModel_rust.ts +1 -1
  148. package/project/.sdk/src/cmp/rust/ReadmeQuick_rust.ts +5 -5
  149. package/project/.sdk/src/cmp/rust/ReadmeRef_rust.ts +4 -4
  150. package/project/.sdk/src/cmp/rust/ReadmeTopQuick_rust.ts +3 -3
  151. package/project/.sdk/src/cmp/rust/ReadmeTopTest_rust.ts +3 -3
  152. package/project/.sdk/src/cmp/rust/TestClean_rust.ts +1 -1
  153. package/project/.sdk/src/cmp/rust/TestDirect_rust.ts +40 -12
  154. package/project/.sdk/src/cmp/rust/TestEntity_rust.ts +109 -26
  155. package/project/.sdk/src/cmp/rust/fragment/Entity.fragment.rs +2 -2
  156. package/project/.sdk/src/cmp/scala/ReadmeEntity_scala.ts +2 -2
  157. package/project/.sdk/src/cmp/scala/ReadmeHowto_scala.ts +2 -2
  158. package/project/.sdk/src/cmp/scala/ReadmeQuick_scala.ts +5 -5
  159. package/project/.sdk/src/cmp/scala/ReadmeRef_scala.ts +3 -3
  160. package/project/.sdk/src/cmp/scala/ReadmeTopQuick_scala.ts +3 -3
  161. package/project/.sdk/src/cmp/scala/ReadmeTopTest_scala.ts +2 -2
  162. package/project/.sdk/src/cmp/scala/TestDirect_scala.ts +2 -6
  163. package/project/.sdk/src/cmp/scala/TestEntity_scala.ts +36 -7
  164. package/project/.sdk/src/cmp/swift/ReadmeEntity_swift.ts +2 -2
  165. package/project/.sdk/src/cmp/swift/ReadmeHowto_swift.ts +2 -2
  166. package/project/.sdk/src/cmp/swift/ReadmeQuick_swift.ts +5 -5
  167. package/project/.sdk/src/cmp/swift/ReadmeRef_swift.ts +3 -3
  168. package/project/.sdk/src/cmp/swift/ReadmeTopQuick_swift.ts +2 -2
  169. package/project/.sdk/src/cmp/swift/ReadmeTopTest_swift.ts +2 -2
  170. package/project/.sdk/src/cmp/ts/ReadmeEntity_ts.ts +2 -2
  171. package/project/.sdk/src/cmp/ts/ReadmeExamplesTest_ts.ts +49 -19
  172. package/project/.sdk/src/cmp/ts/ReadmeHowto_ts.ts +2 -2
  173. package/project/.sdk/src/cmp/ts/ReadmeQuick_ts.ts +4 -4
  174. package/project/.sdk/src/cmp/ts/ReadmeRef_ts.ts +3 -3
  175. package/project/.sdk/src/cmp/ts/ReadmeTopTest_ts.ts +3 -3
  176. package/project/.sdk/src/cmp/ts/TestDirect_ts.ts +54 -23
  177. package/project/.sdk/src/cmp/ts/TestEntity_ts.ts +49 -4
  178. package/project/.sdk/src/cmp/zig/ReadmeEntity_zig.ts +2 -2
  179. package/project/.sdk/src/cmp/zig/ReadmeHowto_zig.ts +2 -2
  180. package/project/.sdk/src/cmp/zig/ReadmeQuick_zig.ts +4 -4
  181. package/project/.sdk/src/cmp/zig/ReadmeRef_zig.ts +3 -3
  182. package/project/.sdk/src/cmp/zig/ReadmeTopQuick_zig.ts +2 -2
  183. package/project/.sdk/src/cmp/zig/ReadmeTopTest_zig.ts +2 -2
  184. package/project/.sdk/tm/c/core/sdk.h +2 -2
  185. package/project/.sdk/tm/c/tests/primary_utility_test.c +37 -0
  186. package/project/.sdk/tm/c/utility/fetcher.c +31 -1
  187. package/project/.sdk/tm/c/utility/make_url.c +6 -2
  188. package/project/.sdk/tm/clojure/src/sdk/core.clj +21 -3
  189. package/project/.sdk/tm/clojure/test/sdk/test/pipeline.clj +34 -0
  190. package/project/.sdk/tm/cpp/test/primary_utility_test.cpp +37 -0
  191. package/project/.sdk/tm/cpp/utility/pipeline.hpp +28 -2
  192. package/project/.sdk/tm/csharp/test/PrimaryUtilityTest.cs +40 -0
  193. package/project/.sdk/tm/csharp/utility/Fetcher.cs +27 -0
  194. package/project/.sdk/tm/csharp/utility/MakeUrl.cs +7 -2
  195. package/project/.sdk/tm/elixir/lib/projectname/utility.ex +30 -3
  196. package/project/.sdk/tm/elixir/test/pipeline_test.exs +23 -0
  197. package/project/.sdk/tm/go/core/helpers.go +1 -1
  198. package/project/.sdk/tm/go/core/types.go +9 -1
  199. package/project/.sdk/tm/go/test/feature_corpus_test.go +3 -4
  200. package/project/.sdk/tm/go/test/primary_utility_test.go +28 -0
  201. package/project/.sdk/tm/go/utility/fetcher.go +26 -0
  202. package/project/.sdk/tm/go/utility/make_url.go +5 -2
  203. package/project/.sdk/tm/java/test/FeatureCorpusTest.java +4 -5
  204. package/project/.sdk/tm/java/test/PrimaryUtilityTest.java +49 -0
  205. package/project/.sdk/tm/java/utility/Fetcher.java +24 -0
  206. package/project/.sdk/tm/java/utility/MakeUrl.java +6 -2
  207. package/project/.sdk/tm/js/src/utility/FetcherUtility.js +24 -0
  208. package/project/.sdk/tm/js/src/utility/MakeUrlUtility.js +6 -2
  209. package/project/.sdk/tm/js/test/feature/Corpus.test.js +7 -6
  210. package/project/.sdk/tm/js/test/live-entity.js +18 -6
  211. package/project/.sdk/tm/js/test/live-runner.js +15 -3
  212. package/project/.sdk/tm/js/test/utility/PrimaryUtility.test.js +25 -0
  213. package/project/.sdk/tm/kotlin/test/PrimaryUtilityTest.kt +48 -0
  214. package/project/.sdk/tm/kotlin/utility/Fetcher.kt +20 -0
  215. package/project/.sdk/tm/kotlin/utility/MakeSpecUrl.kt +6 -2
  216. package/project/.sdk/tm/lua/test/pipeline_test.lua +27 -0
  217. package/project/.sdk/tm/lua/test/primary_utility_test.lua +36 -0
  218. package/project/.sdk/tm/lua/utility/fetcher.lua +31 -0
  219. package/project/.sdk/tm/lua/utility/make_url.lua +6 -2
  220. package/project/.sdk/tm/ocaml/Makefile +5 -1
  221. package/project/.sdk/tm/ocaml/sdk_runtime.ml +36 -4
  222. package/project/.sdk/tm/ocaml/test/t_pipeline.ml +22 -0
  223. package/project/.sdk/tm/perl/t/primary_utility.t +22 -0
  224. package/project/.sdk/tm/perl/utility/fetcher.pm +18 -0
  225. package/project/.sdk/tm/perl/utility/make_url.pm +4 -2
  226. package/project/.sdk/tm/php/test/FeatureCorpusTest.php +6 -5
  227. package/project/.sdk/tm/php/test/PipelineTest.php +31 -7
  228. package/project/.sdk/tm/php/utility/Fetcher.php +34 -27
  229. package/project/.sdk/tm/php/utility/MakeOptions.php +2 -1
  230. package/project/.sdk/tm/php/utility/MakeUrl.php +6 -2
  231. package/project/.sdk/tm/py/pkg/utility/fetcher.py +23 -0
  232. package/project/.sdk/tm/py/pkg/utility/make_url.py +5 -2
  233. package/project/.sdk/tm/py/test/test_feature_corpus.py +5 -5
  234. package/project/.sdk/tm/py/test/test_primary_utility.py +21 -0
  235. package/project/.sdk/tm/rb/core/context.rb +1 -1
  236. package/project/.sdk/tm/rb/core/error.rb +20 -1
  237. package/project/.sdk/tm/rb/test/feature_corpus_test.rb +4 -5
  238. package/project/.sdk/tm/rb/test/feature_test.rb +2 -2
  239. package/project/.sdk/tm/rb/test/omni.rb +1 -1
  240. package/project/.sdk/tm/rb/test/pipeline_test.rb +19 -2
  241. package/project/.sdk/tm/rb/test/primary_utility_test.rb +28 -1
  242. package/project/.sdk/tm/rb/utility/fetcher.rb +20 -1
  243. package/project/.sdk/tm/rb/utility/make_error.rb +1 -1
  244. package/project/.sdk/tm/rb/utility/make_url.rb +4 -2
  245. package/project/.sdk/tm/rust/core/helpers.rs +1 -1
  246. package/project/.sdk/tm/rust/core/types.rs +2 -2
  247. package/project/.sdk/tm/rust/tests/primary_utility_test.rs +34 -0
  248. package/project/.sdk/tm/rust/utility/fetcher.rs +27 -0
  249. package/project/.sdk/tm/rust/utility/make_url.rs +7 -2
  250. package/project/.sdk/tm/scala/sdktest/SdkTestMain.scala +51 -1
  251. package/project/.sdk/tm/scala/utility/Fetcher.scala +16 -0
  252. package/project/.sdk/tm/scala/utility/Make.scala +6 -2
  253. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Fetcher.swift +24 -0
  254. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Make.swift +6 -2
  255. package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/PrimaryUtilityTest.swift +34 -0
  256. package/project/.sdk/tm/ts/src/utility/FetcherUtility.ts +24 -0
  257. package/project/.sdk/tm/ts/src/utility/MakeUrlUtility.ts +6 -2
  258. package/project/.sdk/tm/ts/test/feature/Corpus.test.ts +7 -6
  259. package/project/.sdk/tm/ts/test/live-entity.ts +20 -5
  260. package/project/.sdk/tm/ts/test/live-runner.ts +17 -3
  261. package/project/.sdk/tm/ts/test/utility/PrimaryUtility.test.ts +25 -0
  262. package/project/.sdk/tm/zig/core/utility.zig +30 -3
  263. package/project/.sdk/tm/zig/test/primary_utility_test.zig +28 -0
  264. package/project/sdkgen-package.json +1 -1
  265. package/src/cmp/ReadmeTop.ts +3 -3
  266. package/src/helpers/opExample.ts +16 -1
  267. package/src/helpers/opShape.ts +64 -30
  268. package/src/helpers/pointPath.ts +19 -0
  269. package/src/helpers/testPolicy.ts +316 -2
  270. package/src/sdkgen.ts +37 -5
@@ -148,17 +148,22 @@ function isRunnable(code: string): boolean {
148
148
 
149
149
  // Wrap ONE block as a self-contained temp module: the block goes in its own
150
150
  // scope inside an async function with a shared seeded \`client\`.
151
+ const SNIPPET_HEAD = [
152
+ 'import { ' + SDK_NAME + ' } from ' + JSON.stringify(SDK_ROOT),
153
+ '',
154
+ 'async function __ex() {',
155
+ // Shared client for snippets that reference \`client\` without constructing
156
+ // one (e.g. the direct() example).
157
+ ' const client = ' + SDK_NAME + '.test()',
158
+ ' void client',
159
+ ' {',
160
+ ]
161
+ const SNIPPET_INDENT = ' '
162
+
151
163
  function buildSnippetModule(block: string): string {
152
- const inner = stripImports(block).split('\\n').map((l) => ' ' + l).join('\\n')
164
+ const inner = stripImports(block).split('\\n').map((l) => SNIPPET_INDENT + l).join('\\n')
153
165
  return [
154
- 'import { ' + SDK_NAME + ' } from ' + JSON.stringify(SDK_ROOT),
155
- '',
156
- 'async function __ex() {',
157
- // Shared client for snippets that reference \`client\` without constructing
158
- // one (e.g. the direct() example).
159
- ' const client = ' + SDK_NAME + '.test()',
160
- ' void client',
161
- ' {',
166
+ ...SNIPPET_HEAD,
162
167
  inner,
163
168
  ' }',
164
169
  '}',
@@ -168,6 +173,15 @@ function buildSnippetModule(block: string): string {
168
173
  }
169
174
 
170
175
 
176
+ // A tsc position in a wrapped module, as a line and column of the block itself.
177
+ function blockPosition(line: number, col: number): string {
178
+ const at = line - SNIPPET_HEAD.length
179
+ return 0 < at
180
+ ? 'line ' + at + ', col ' + Math.max(1, col - SNIPPET_INDENT.length)
181
+ : 'wrapper line ' + line + ', col ' + col
182
+ }
183
+
184
+
171
185
  // Compile a batch of blocks in ONE tsc pass — one temp file per block, so
172
186
  // each is an isolated program entry — and return which snippet indices
173
187
  // errored. NOTE: tsc suppresses ALL semantic diagnostics program-wide as
@@ -175,7 +189,7 @@ function buildSnippetModule(block: string): string {
175
189
  // \`typeCheckBlocks\` drives this in a fixpoint that removes erroring blocks
176
190
  // and recompiles the rest until a pass is clean.
177
191
  function compileBatch(indices: number[], blocks: string[], key: string): {
178
- errored: Set<number>; raw: string; unattributed: boolean
192
+ errored: Set<number>; diagnostics: Map<number, string[]>; raw: string; unattributed: boolean
179
193
  } {
180
194
  const tsDir = Path.join(__dirname, '..')
181
195
  // Outside the SDK's tree, so a run leaves nothing there even when it is
@@ -213,24 +227,36 @@ function compileBatch(indices: number[], blocks: string[], key: string): {
213
227
 
214
228
  const raw = ((res.stdout || '') + (res.stderr || '')).trim()
215
229
  const errored = new Set<number>()
230
+ // Each snippet's own diagnostics, so a report quotes only those of the
231
+ // blocks it names; tsc's indented follow-on lines stay with theirs.
232
+ const diagnostics = new Map<number, string[]>()
233
+ let current: string[] | null = null
216
234
  let unattributed = false
217
235
 
218
236
  if (0 !== res.status) {
219
237
  for (const line of raw.split('\\n')) {
220
- const m = /_snippet(\\d+)\\.gen\\.cts\\(\\d+,\\d+\\):\\s*error/.exec(line)
238
+ const m = /_snippet(\\d+)\\.gen\\.cts\\((\\d+),(\\d+)\\):\\s*(error[\\s\\S]*)$/.exec(line)
221
239
  if (null == m) {
222
240
  // A genuine error diagnostic not attributable to a snippet file
223
241
  // (e.g. inside the SDK itself) is an anomaly.
224
242
  if (/:\\s*error\\s+TS\\d+/.test(line)) {
225
243
  unattributed = true
244
+ current = null
245
+ }
246
+ else if (null != current && /^\\s/.test(line)) {
247
+ current.push(line)
226
248
  }
227
249
  continue
228
250
  }
229
- errored.add(parseInt(m[1], 10))
251
+ const i = parseInt(m[1], 10)
252
+ errored.add(i)
253
+ current = diagnostics.get(i) || []
254
+ diagnostics.set(i, current)
255
+ current.push(blockPosition(parseInt(m[2], 10), parseInt(m[3], 10)) + ': ' + m[4])
230
256
  }
231
257
  }
232
258
 
233
- return { errored, raw, unattributed }
259
+ return { errored, diagnostics, raw, unattributed }
234
260
  } finally {
235
261
  Fs.rmSync(dir, { recursive: true, force: true })
236
262
  }
@@ -245,17 +271,20 @@ function compileBatch(indices: number[], blocks: string[], key: string): {
245
271
  // terminates. \`globalError\` flags an unattributable tsc error, surfaced
246
272
  // verbatim by the caller.
247
273
  function typeCheckBlocks(blocks: string[], key: string): {
248
- failing: Set<number>; raw: string; globalError: boolean
274
+ failing: Set<number>; diagnostics: Map<number, string[]>; raw: string; globalError: boolean
249
275
  } {
250
276
  const failing = new Set<number>()
277
+ const diagnostics = new Map<number, string[]>()
251
278
  const raws: string[] = []
252
279
  let globalError = false
253
280
  let remaining = blocks.map((_b, i) => i)
254
281
 
255
282
  // Guard: at most one pass per block plus a final clean pass.
256
283
  for (let pass = 0; pass <= blocks.length && 0 < remaining.length; pass++) {
257
- const { errored, raw, unattributed } = compileBatch(remaining, blocks, key)
284
+ const batch = compileBatch(remaining, blocks, key)
285
+ const { errored, raw, unattributed } = batch
258
286
  raws.push(raw)
287
+ batch.diagnostics.forEach((lines, i) => diagnostics.set(i, lines))
259
288
  if (unattributed) {
260
289
  globalError = true
261
290
  }
@@ -268,7 +297,7 @@ function typeCheckBlocks(blocks: string[], key: string): {
268
297
  remaining = remaining.filter((i) => !errored.has(i))
269
298
  }
270
299
 
271
- return { failing, raw: raws.filter(Boolean).join('\\n'), globalError }
300
+ return { failing, diagnostics, raw: raws.filter(Boolean).join('\\n'), globalError }
272
301
  }
273
302
 
274
303
 
@@ -370,7 +399,7 @@ describe('README examples', () => {
370
399
  const blocks = extractTsBlocks(md)
371
400
  assert(blocks.length > 0, 'No TypeScript code blocks found in ' + doc.label)
372
401
 
373
- const { failing, raw, globalError } = typeCheckBlocks(blocks, doc.key)
402
+ const { failing, diagnostics, raw, globalError } = typeCheckBlocks(blocks, doc.key)
374
403
  assert(!globalError,
375
404
  'tsc reported an error outside any snippet in ' + doc.label +
376
405
  ' — the harness could not attribute it:\\n\\n' + raw + '\\n')
@@ -388,7 +417,8 @@ describe('README examples', () => {
388
417
  if (!typechecks && shape) {
389
418
  illustration++
390
419
  } else if (!typechecks && !shape) {
391
- unrecognized.push(' snippet ' + i + ':\\n' + indentBlock(b))
420
+ unrecognized.push(' snippet ' + i + ':\\n' + indentBlock(b) + '\\n\\n tsc:\\n' +
421
+ indentBlock((diagnostics.get(i) || []).join('\\n')))
392
422
  } else if (typechecks && runnable) {
393
423
  executed++
394
424
  } else {
@@ -406,7 +436,7 @@ describe('README examples', () => {
406
436
  'These ' + doc.label + ' \`\`\`ts blocks neither type-check nor match the ' +
407
437
  'illustration allowlist. Fix the snippet (or the SDK), or — if it is ' +
408
438
  'genuinely illustrative — reshape it to the allowlist:\\n\\n' +
409
- unrecognized.join('\\n\\n') + '\\n\\ntsc output:\\n' + raw + '\\n')
439
+ unrecognized.join('\\n\\n') + '\\n')
410
440
 
411
441
  assert.strictEqual(blocks.length, executed + typecheckedOnly + illustration,
412
442
  'completeness partition mismatch for ' + doc.label + ': ' + blocks.length +
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, isAuthActive, isHttpBasicAuth, envName, entityIdField, entityDataIdField, pickExampleEntity, opRequestShape, safeVarName, exampleVarName, jsKey, requiredItems, matchExampleItems, jsProp } from '@voxgig/sdkgen'
2
+ import { cmp, Content, isAuthActive, isHttpBasicAuth, envName, entityIdField, entityDataIdField, pickExampleEntity, safeVarName, exampleVarName, jsKey, requiredItems, matchExampleItems, jsProp, requestExampleItems } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -41,7 +41,7 @@ const ReadmeHowto = cmp(function ReadmeHowto(props: any) {
41
41
  return `{ ${pairs.join(', ')} }`
42
42
  }
43
43
  const isIdField = (it: any) => it.name === idF || it.name === 'id'
44
- const items = opRequestShape(exampleEntity, primaryOp).items
44
+ const items = requestExampleItems(exampleEntity, primaryOp)
45
45
  .filter((it: any) => !isIdField(it) || !it.optional)
46
46
  const required = items.filter((it: any) => !it.optional)
47
47
  const chosen = required.length ? required : items.slice(0, 3)
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, each, Content, isAuthActive, isHttpBasicAuth, packageName, envName, serverVariables, opRequestShape, entityIdField, entityDataIdField, entityOps, safeVarName, exampleVarName, jsKey, listMatchArg, matchExampleItems, requiredItems, jsProp } from '@voxgig/sdkgen'
2
+ import { cmp, each, Content, isAuthActive, isHttpBasicAuth, packageName, envName, serverVariables, opRequestShape, entityIdField, entityDataIdField, entityOps, safeVarName, exampleVarName, jsKey, listMatchArg, matchExampleItems, requiredItems, jsProp, requestExampleItems, sendsId } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -153,7 +153,7 @@ try {
153
153
  if (opnames.includes('create') || opnames.includes('update') || opnames.includes('patch') ||
154
154
  opnames.includes('remove')) {
155
155
  const exampleFields = (opname: string): string[] => {
156
- const items = opRequestShape(exampleEntity, opname).items
156
+ const items = requestExampleItems(exampleEntity, opname)
157
157
  .filter((it: any) => (it.name !== idF && it.name !== 'id') ||
158
158
  ('create' === opname && !it.optional))
159
159
  const required = items.filter((it: any) => !it.optional)
@@ -202,7 +202,7 @@ const created = await client.${eName}().create({${createBody}})
202
202
  `)
203
203
  }
204
204
  if (opnames.includes('update')) {
205
- const updateLines = (idF ? [` ${jsKey(idF)}: ${idValueFor('update')},`] : []).concat(exampleFields('update'))
205
+ const updateLines = (sendsId(exampleEntity, 'update', idF) ? [` ${jsKey(idF)}: ${idValueFor('update')},`] : []).concat(exampleFields('update'))
206
206
  const updateBody = updateLines.length ? '\n' + updateLines.join('\n') + '\n' : ''
207
207
  Content(`// Update${usesCreatedId('update') ? ' — the id comes off the returned entity\'s data()' : ''}
208
208
  const updated = await client.${eName}().update({${updateBody}})
@@ -210,7 +210,7 @@ const updated = await client.${eName}().update({${updateBody}})
210
210
  `)
211
211
  }
212
212
  if (opnames.includes('patch')) {
213
- const patchLines = (idF ? [` ${jsKey(idF)}: ${idValueFor('patch')},`] : []).concat(exampleFields('patch'))
213
+ const patchLines = (sendsId(exampleEntity, 'patch', idF) ? [` ${jsKey(idF)}: ${idValueFor('patch')},`] : []).concat(exampleFields('patch'))
214
214
  const patchBody = patchLines.length ? '\n' + patchLines.join('\n') + '\n' : ''
215
215
  Content(`// Patch — sends only the fields given${usesCreatedId('patch') ? '; the id comes off the returned entity\'s data()' : ''}
216
216
  const patched = await client.${eName}().patch({${patchBody}})
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, each, Content, canonToType, File, isAuthActive, isHttpBasicAuth, entityIdField, entityActions, opRequestShape, safeVarName, exampleVarName, jsKey, targetFeatures, opNeedsAction, bodyNote, listMatchArg, matchExampleItems } from '@voxgig/sdkgen'
2
+ import { cmp, each, Content, canonToType, File, isAuthActive, isHttpBasicAuth, entityIdField, entityActions, safeVarName, exampleVarName, jsKey, targetFeatures, opNeedsAction, bodyNote, listMatchArg, matchExampleItems, requestExampleItems } from '@voxgig/sdkgen'
3
3
  import { ReadmeRefFeatures } from '@voxgig/sdkgen'
4
4
 
5
5
  import {
@@ -351,7 +351,7 @@ const results = await client.${ent.Name}().${opname}(${listMatchArg('ts', ent)})
351
351
  // <Name>CreateData (every required member appears), each with a
352
352
  // type-correct example VALUE via exampleValue — a `name: /* type */`
353
353
  // comment is not a value and yields invalid TS (TS1109).
354
- const createItems = opRequestShape(ent, 'create').items
354
+ const createItems = requestExampleItems(ent, 'create')
355
355
  .filter((it: any) => !it.optional)
356
356
  Content(`\`\`\`ts
357
357
  const result = await client.${ent.Name}().create({
@@ -368,7 +368,7 @@ const result = await client.${ent.Name}().create({
368
368
  else if ('update' === opname || 'patch' === opname) {
369
369
  // The id key plus every REQUIRED data member — the same shape
370
370
  // that generates <Name>UpdateData — then the patch-fields note.
371
- const updateItems = opRequestShape(ent, opname).items
371
+ const updateItems = requestExampleItems(ent, opname)
372
372
  .filter((it: any) => !it.optional || it.name === idF)
373
373
  .sort((a: any, b: any) =>
374
374
  (a.name === idF ? 0 : 1) - (b.name === idF ? 0 : 1))
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, entityIdField, pickExampleEntity, opRequestShape, requiredItems, safeVarName, exampleVarName, jsKey, matchExampleItems } from '@voxgig/sdkgen'
2
+ import { cmp, Content, entityIdField, pickExampleEntity, requiredItems, safeVarName, exampleVarName, jsKey, matchExampleItems, requestExampleItems } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -20,7 +20,7 @@ const ReadmeTopTest = cmp(function ReadmeTopTest(props: any) {
20
20
 
21
21
  const seedEntity = exampleEntity ? nom(exampleEntity, 'name') : ''
22
22
  const seedFields = exampleEntity ?
23
- opRequestShape(exampleEntity, 'create').items
23
+ requestExampleItems(exampleEntity, 'create')
24
24
  .filter((it: any) => !it.optional)
25
25
  .slice(0, 3) : []
26
26
 
@@ -79,7 +79,7 @@ const client = ${model.const.Name}SDK.test({
79
79
  ? `{ ${items.map((it: any) => `${jsKey(it.name)}: ${lit(it)}`).join(', ')} }`
80
80
  : ''
81
81
  } else if ('create' === primaryOp || 'update' === primaryOp || 'patch' === primaryOp) {
82
- const items = opRequestShape(exampleEntity, primaryOp).items
82
+ const items = requestExampleItems(exampleEntity, primaryOp)
83
83
  .filter((it: any) => !isIdField(it) || !it.optional)
84
84
  const required = items.filter((it: any) => !it.optional)
85
85
  const chosen = required.length ? required : items.slice(0, 3)
@@ -24,9 +24,16 @@ import {
24
24
  jsOptProp, envName, envToken, liveStrict, liveStrictNote,
25
25
  jsKey,
26
26
  pointParts,
27
+ pointPlaceholders,
27
28
  pointIsGraphql,
28
29
  hasLiveScenarios,
29
30
  primaryPoint,
31
+ liveExampleIds,
32
+ liveQueryExamples,
33
+ litString,
34
+ liveEntity,
35
+ liveGetOnlyReason, LIVE_GETONLY_ENV,
36
+ liveDirectGetOnly, liveExcludedLines, liveExcludedSummary,
30
37
  } from '@voxgig/sdkgen'
31
38
 
32
39
 
@@ -41,7 +48,7 @@ const TestDirect = cmp(function TestDirect(props: any) {
41
48
  const stdrep = ctx$.stdrep
42
49
 
43
50
  const target = props.target
44
- const entity: ModelEntity = props.entity
51
+ const entity: ModelEntity = liveEntity(ctx$, props.entity)
45
52
 
46
53
  const ff = projectPath('src/cmp/ts/fragment/')
47
54
 
@@ -78,6 +85,14 @@ const TestDirect = cmp(function TestDirect(props: any) {
78
85
  return
79
86
  }
80
87
 
88
+ const exampleIds = liveExampleIds(entity)
89
+ const exampleIdLine = 0 === exampleIds.length ? '' :
90
+ ` // A path parameter's example stands in for an id *_ENTID does not give.
91
+ idmap = Object.assign({ ${exampleIds.map(([key, ex]) =>
92
+ `${jsKey(key)}: ${'string' === typeof ex ? litString('ts', ex) : String(ex)}`).join(', ')} },
93
+ 'object' === typeof idmap ? idmap : {})
94
+ `
95
+
81
96
  Folder({ name: entity.name }, () => {
82
97
 
83
98
  File({ name: nom(entity, 'Name') + 'Direct.test.' + target.name }, () => {
@@ -122,7 +137,7 @@ function directSetup(mockres?: any) {
122
137
  if ('string' === typeof idmap && idmap.startsWith('{')) {
123
138
  idmap = JSON.parse(idmap)
124
139
  }
125
-
140
+ ${exampleIdLine}
126
141
  return { client, calls, live, idmap, transport }
127
142
  }
128
143
 
@@ -179,6 +194,29 @@ function unwrapListData(data: any): any[] | null {
179
194
  })
180
195
 
181
196
 
197
+ // A GET-only live run excludes a test needing an id that only a write gives.
198
+ function getOnlyKeysLine(model: any, entity: any, test: string, keys: string[]): string {
199
+ return liveDirectGetOnly(model, entity, test, keys).map((miss) =>
200
+ ` if (setup.live && 'TRUE' === process.env.${LIVE_GETONLY_ENV} && null == setup.idmap?.[${JSON.stringify(miss.key)}]) {
201
+ console.log(${JSON.stringify(liveExcludedLines({ excluded: [miss] })[0])})
202
+ t.skip(${JSON.stringify(liveExcludedSummary({ excluded: [miss] }))})
203
+ return
204
+ }
205
+ `).join('')
206
+ }
207
+
208
+
209
+ // A GraphQL request is a POST, which a GET-only live run does not send.
210
+ function getOnlySkip(point: any): string {
211
+ const reason = liveGetOnlyReason(point)
212
+ return null == reason ? '' : ` if (setup.live && 'TRUE' === process.env.${LIVE_GETONLY_ENV}) {
213
+ t.skip(${JSON.stringify(reason)})
214
+ return
215
+ }
216
+ `
217
+ }
218
+
219
+
182
220
  function generateDirectGraphql(
183
221
  opname: 'load' | 'list',
184
222
  entity: ModelEntity,
@@ -230,7 +268,7 @@ ${varAsserts}`
230
268
  if (liveScenariosActive()) { t.skip('Covered by live operation scenarios'); return }
231
269
  const setup = directSetup()
232
270
  if (maybeSkipControl(t, 'direct', 'direct-${opname}-${entity.name}', setup.live)) return
233
- ${skipMissingLine} const { client, calls } = setup
271
+ ${getOnlySkip(point)}${skipMissingLine} const { client, calls } = setup
234
272
 
235
273
  const variables: any = {}
236
274
  if (setup.live) {
@@ -269,12 +307,7 @@ function generateDirectLoad(model: Model, entity: ModelEntity) {
269
307
  // actually appear in the URL template should drive direct-test path-param
270
308
  // setup and URL-substitution asserts; otherwise the SDK silently drops
271
309
  // them and the URL-includes assert fails.
272
- const pathPlaceholders = new Set<string>()
273
- for (const part of pointParts(loadPoint)) {
274
- if (typeof part === 'string' && part.startsWith('{') && part.endsWith('}')) {
275
- pathPlaceholders.add(part.slice(1, -1))
276
- }
277
- }
310
+ const pathPlaceholders = new Set<string>(pointPlaceholders(loadPoint))
278
311
  const renameMap = (loadPoint.r?.param || {}) as Record<string, string>
279
312
  const renamedPlaceholders = new Set<string>()
280
313
  for (const ph of pathPlaceholders) {
@@ -291,13 +324,8 @@ function generateDirectLoad(model: Model, entity: ModelEntity) {
291
324
  // ignores them. Optional query params (e.g. `app`, `version`) are skipped
292
325
  // even when they have examples — only the strictly required ones are
293
326
  // necessary to satisfy the contract.
294
- const loadQuery = loadPoint.g?.query || []
295
- const liveQueryEntries = loadQuery
296
- .filter((q: any) => q.r && undefined !== q.ex && null !== q.ex)
297
- const hasLiveQuery = liveQueryEntries.length > 0
298
- const liveQueryLines = liveQueryEntries
299
- .map((q: any) => ` ${jsProp('query', q.n)} = ${JSON.stringify(q.ex)}`)
300
- .join('\n')
327
+ const liveQueryLines = liveQueryLinesTs(loadPoint)
328
+ const hasLiveQuery = '' !== liveQueryLines
301
329
 
302
330
  const listOp = entity.op?.list
303
331
  const listPoint = null == listOp?.points ? undefined :
@@ -426,7 +454,7 @@ ${paramAsserts}`
426
454
  if (liveScenariosActive()) { t.skip('Covered by live operation scenarios'); return }
427
455
  const setup = directSetup({ id: 'direct01' })
428
456
  if (maybeSkipControl(t, 'direct', 'direct-load-${entity.name}', setup.live)) return
429
- ${skipMissingLine} const { client, calls } = setup
457
+ ${getOnlyKeysLine(model, entity, 'direct-load-' + entity.name, liveIdKeys)}${skipMissingLine} const { client, calls } = setup
430
458
 
431
459
  const params: any = {}
432
460
  const query: any = {}
@@ -462,11 +490,7 @@ function generateDirectList(model: Model, entity: ModelEntity) {
462
490
  const listParams = listPoint.g?.params || []
463
491
  const listPath = normalizePathParams(pointParts(listPoint), listParams, listPoint.r?.param)
464
492
 
465
- const listQuery = listPoint.g?.query || []
466
- const liveQueryLines = listQuery
467
- .filter((q: any) => q.r && undefined !== q.ex && null !== q.ex)
468
- .map((q: any) => ` ${jsProp('query', q.n)} = ${JSON.stringify(q.ex)}`)
469
- .join('\n')
493
+ const liveQueryLines = liveQueryLinesTs(listPoint)
470
494
 
471
495
  const liveParams = listParams.map((p: any) => {
472
496
  const key = p.n === 'id'
@@ -527,7 +551,7 @@ ${paramAsserts}`
527
551
  if (liveScenariosActive()) { t.skip('Covered by live operation scenarios'); return }
528
552
  const setup = directSetup([{ id: 'direct01' }, { id: 'direct02' }])
529
553
  if (maybeSkipControl(t, 'direct', 'direct-list-${entity.name}', setup.live)) return
530
- ${skipMissingLine} const { client, calls } = setup
554
+ ${getOnlyKeysLine(model, entity, 'direct-list-' + entity.name, liveIdKeys)}${skipMissingLine} const { client, calls } = setup
531
555
 
532
556
  ${paramsBlock}
533
557
  const result: any = await client.direct({
@@ -558,6 +582,13 @@ ${offline} }`
558
582
  }
559
583
 
560
584
 
585
+ function liveQueryLinesTs(point: any): string {
586
+ return liveQueryExamples(point)
587
+ .map(([name, ex]) => ` ${jsProp('query', name)} = ${JSON.stringify(ex)}`)
588
+ .join('\n')
589
+ }
590
+
591
+
561
592
  function normalizePathParams(
562
593
  parts: string[],
563
594
  params: any[],
@@ -42,6 +42,12 @@ import {
42
42
  hasLiveScenarios,
43
43
  liveStrict,
44
44
  liveStrictNote,
45
+ liveEntity,
46
+ liveGetOnly,
47
+ liveFlowRoutes,
48
+ flowLoadRoute,
49
+ flowLoadReadsRecord,
50
+ LIVE_GETONLY_ENV,
45
51
  } from '@voxgig/sdkgen'
46
52
 
47
53
 
@@ -50,6 +56,14 @@ import {
50
56
  } from './utility_ts'
51
57
 
52
58
 
59
+ // The steps a GET-only live run leaves out, for the live harness.
60
+ function getOnlyArg(entity: any, flow: any): string {
61
+ const plan = liveGetOnly(entity, flow)
62
+ return null == plan ? '' : `, 'TRUE' === process.env.${LIVE_GETONLY_ENV} ? ${JSON.stringify(
63
+ Object.fromEntries(plan.excluded.map(({ id, reason }) => [id, reason])))} : {}`
64
+ }
65
+
66
+
53
67
  type GenCtx = {
54
68
  model: Model
55
69
  entity: ModelEntity
@@ -240,7 +254,7 @@ function basicSetup(extra?: any) {
240
254
  ${hasLiveScenarios(model) ? `if (live) { t.skip('Covered by live operation scenarios'); return }` : ''}
241
255
  const setup = basicSetup()
242
256
  if (setup.live) {
243
- return runLiveEntity(setup, ${JSON.stringify(entity)}, ${JSON.stringify(basicflow)}, '${nom(entity, 'Name')}', ${JSON.stringify(liveFacts)}, { strict: LIVE_STRICT, t })
257
+ return runLiveEntity(setup, ${JSON.stringify(liveEntity(ctx$, entity))}, ${JSON.stringify(liveFlowRoutes(entity, basicflow))}, '${nom(entity, 'Name')}', ${JSON.stringify(liveFacts)}, { strict: LIVE_STRICT, t }${getOnlyArg(entity, basicflow)})
244
258
  }
245
259
  const client = setup.client
246
260
  const struct = setup.struct
@@ -497,7 +511,7 @@ const generateLoad: OpGen = (ctx, step, index) => {
497
511
  const loadPoint = loadOp?.points?.[0]
498
512
  const loadPathParams = loadPoint?.g?.params || []
499
513
  const loadHasRequiredParams = loadPathParams.some((p: any) => p.r !== false)
500
- if (!hasEntId && loadHasRequiredParams) {
514
+ if (!hasEntId && loadHasRequiredParams && null == flowLoadRoute(entity, step)) {
501
515
  if (!hasEntVar) {
502
516
  Content(`
503
517
  // LOAD: skipped — no entity id field and load requires path params.
@@ -515,7 +529,7 @@ const generateLoad: OpGen = (ctx, step, index) => {
515
529
  Content(` const ${entvar} = client.${nom(entity, 'Name')}()
516
530
  `)
517
531
  }
518
- if (!hasSrcData && hasEntId) {
532
+ if (!hasSrcData && (hasEntId || flowLoadReadsRecord(entity, step))) {
519
533
  Content(` const ${srcdatavar} = Object.values(setup.data.existing.${entity.name})[0] as any
520
534
  `)
521
535
  }
@@ -524,8 +538,11 @@ const generateLoad: OpGen = (ctx, step, index) => {
524
538
  if (hasEntId) {
525
539
  Content(` ${matchvar}.id = ${srcdatavar}.id
526
540
  `)
541
+ loadMatch(entity, step, matchvar, srcdatavar)
542
+ }
543
+ else {
544
+ loadMatch(entity, step, matchvar, srcdatavar)
527
545
  }
528
- parentMatch(step, matchvar)
529
546
  if (hasEntId) {
530
547
  Content(` const ${datavar} = (await ${entvar}.load(${matchvar})).data()
531
548
  assert(${datavar}.id === ${srcdatavar}.id)
@@ -588,6 +605,34 @@ function parentMatch(step: any, matchvar: string) {
588
605
  }
589
606
 
590
607
 
608
+ // A load of a known record fills its route from that record, and from the
609
+ // step's binding where the record holds no scalar for it. A record only the
610
+ // fixture holds replaces the step's binding, which the live harness keeps.
611
+ function loadMatch(entity: any, step: any, matchvar: string, srcdatavar: string) {
612
+ const route = flowLoadRoute(entity, step)
613
+ if (null == route) {
614
+ return parentMatch(step, matchvar)
615
+ }
616
+ if (route.offline) {
617
+ parentMatch(step, matchvar)
618
+ for (const arg of route.args.filter((arg) => null != arg.field)) {
619
+ const own = `${srcdatavar}['${arg.field}']`
620
+ Content(` if (['string', 'number', 'boolean'].includes(typeof ${own})) ${matchvar}['${arg.name}'] = ${own}
621
+ `)
622
+ }
623
+ return
624
+ }
625
+ for (const arg of route.args) {
626
+ const bound = arg.idmap.map((key) => `setup.idmap['${key}']`).join(' ?? ')
627
+ const own = `${srcdatavar}['${arg.field}']`
628
+ Content(null == arg.field ? ` ${matchvar}['${arg.name}'] = ${bound}
629
+ ` : ` ${matchvar}['${arg.name}'] = ['string', 'number', 'boolean'].includes(typeof ${own}) ?
630
+ ${own} : ${bound}
631
+ `)
632
+ }
633
+ }
634
+
635
+
591
636
  const GENERATE_OP: Record<string, OpGen> = {
592
637
  create: generateCreate,
593
638
  list: generateList,
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, each, Content, canonKey, canonScalarKey, entityIdField, opRequestShape, opNeedsAction, matchExampleItems } from '@voxgig/sdkgen'
2
+ import { cmp, each, Content, canonKey, canonScalarKey, entityIdField, opNeedsAction, matchExampleItems, requestExampleItems } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -168,7 +168,7 @@ switch (client.${method}(h.vnull()).list(${zigListMatch(entity)}, h.vnull())) {
168
168
  }
169
169
 
170
170
  if (callable.includes('create')) {
171
- const createItems = opRequestShape(entity, 'create').items
171
+ const createItems = requestExampleItems(entity, 'create')
172
172
  .filter((it: any) => !it.optional)
173
173
  Content(`#### Example: Create
174
174
 
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, pickExampleEntity, opRequestShape, requiredItems, matchExampleItems } from '@voxgig/sdkgen'
2
+ import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, pickExampleEntity, requiredItems, matchExampleItems, requestExampleItems } from '@voxgig/sdkgen'
3
3
 
4
4
  import {
5
5
  KIT,
@@ -45,7 +45,7 @@ const ReadmeHowto = cmp(function ReadmeHowto(props: any) {
45
45
  const chosen = requiredItems(exampleEntity, 'list')
46
46
  testArg = `h.jo(&.{${chosen.map((it: any) => `.{ ${JSON.stringify(it.name)}, ${zigLit(it.type)} }`).join(', ')}})`
47
47
  } else if (exampleEntity && ('create' === primaryOp || 'update' === primaryOp || 'patch' === primaryOp)) {
48
- const items = opRequestShape(exampleEntity, primaryOp).items
48
+ const items = requestExampleItems(exampleEntity, primaryOp)
49
49
  .filter((it: any) => it.name !== idF && it.name !== 'id')
50
50
  const required = items.filter((it: any) => !it.optional)
51
51
  const chosen = required.length ? required : items.slice(0, 3)
@@ -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,
@@ -144,7 +144,7 @@ switch (client.${method}(h.vnull()).load(${loadArg}, h.vnull())) {
144
144
  // Model-driven example fields: derive the create/update body from the op
145
145
  // shape so the docs reference REAL writable fields.
146
146
  const examplePairs = (opname: string): string[] => {
147
- const items = opRequestShape(exampleEntity, opname).items
147
+ const items = requestExampleItems(exampleEntity, opname)
148
148
  .filter((it: any) => (it.name !== idF && it.name !== 'id') ||
149
149
  ('create' === opname && !it.optional))
150
150
  const required = items.filter((it: any) => !it.optional)
@@ -177,7 +177,7 @@ switch (client.${method}(h.vnull()).create(h.jo(&.{${examplePairs('create').join
177
177
  `)
178
178
  }
179
179
  if (opnames.includes('update')) {
180
- const updatePairs = (idF ? [`.{ ${JSON.stringify(idF)}, ${idValueFor('update')} }`] : []).concat(examplePairs('update'))
180
+ const updatePairs = (sendsId(exampleEntity, 'update', idF) ? [`.{ ${JSON.stringify(idF)}, ${idValueFor('update')} }`] : []).concat(examplePairs('update'))
181
181
  Content(`// Update
182
182
  switch (client.${method}(h.vnull()).update(h.jo(&.{${updatePairs.join(', ')}}), h.vnull())) {
183
183
  .ok => |updated| std.debug.print("{s}\\n", .{h.stringify(updated.asEntity().data(null))}),
@@ -187,7 +187,7 @@ switch (client.${method}(h.vnull()).update(h.jo(&.{${updatePairs.join(', ')}}),
187
187
  `)
188
188
  }
189
189
  if (opnames.includes('patch')) {
190
- const patchPairs = (idF ? [`.{ ${JSON.stringify(idF)}, ${idValueFor('patch')} }`] : []).concat(examplePairs('patch'))
190
+ const patchPairs = (sendsId(exampleEntity, 'patch', idF) ? [`.{ ${JSON.stringify(idF)}, ${idValueFor('patch')} }`] : []).concat(examplePairs('patch'))
191
191
  Content(`// Patch — sends only the fields given
192
192
  switch (client.${method}(h.vnull()).patch(h.jo(&.{${patchPairs.join(', ')}}), h.vnull())) {
193
193
  .ok => |patched| std.debug.print("{s}\\n", .{h.stringify(patched.asEntity().data(null))}),
@@ -1,5 +1,5 @@
1
1
 
2
- import { cmp, each, Content, canonKey, canonScalarKey, File, isAuthActive, entityIdField, opRequestShape , targetFeatures, opNeedsAction, bodyNote, matchExampleItems } from '@voxgig/sdkgen'
2
+ import { cmp, each, Content, 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 {
@@ -303,7 +303,7 @@ switch (client.${method}(h.vnull()).list(${zigListMatch(ent)}, h.vnull())) {
303
303
  `)
304
304
  }
305
305
  else if ('create' === opname) {
306
- const createItems = opRequestShape(ent, 'create').items
306
+ const createItems = requestExampleItems(ent, 'create')
307
307
  .filter((it: any) => !it.optional)
308
308
  Content(`\`\`\`zig
309
309
  switch (client.${method}(h.vnull()).create(h.jo(&.{
@@ -321,7 +321,7 @@ switch (client.${method}(h.vnull()).create(h.jo(&.{
321
321
  `)
322
322
  }
323
323
  else if ('update' === opname || 'patch' === opname) {
324
- const updateItems = opRequestShape(ent, opname).items
324
+ const updateItems = requestExampleItems(ent, opname)
325
325
  .filter((it: any) => !it.optional || it.name === idF)
326
326
  .sort((a: any, b: any) =>
327
327
  (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,
@@ -49,7 +49,7 @@ const client = ${ctor};
49
49
  const eName = nom(exampleEntity, 'Name')
50
50
  const eVar = zigVarName(exampleEntity.name)
51
51
  const method = zigVarName(exampleEntity.name)
52
- const opnames = Object.keys(exampleEntity.op || {})
52
+ const opnames = entityOps(exampleEntity)
53
53
  // Model-driven id key: null when the entity has no id-like field, in which
54
54
  // case the load example takes no match argument.
55
55
  const idF = entityIdField(exampleEntity)
@@ -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,
@@ -55,7 +55,7 @@ const client = sdk.test_sdk(h.vnull(), h.vnull());
55
55
  `.{ ${JSON.stringify(it.name)}, ${isMatchOp && it.name === idF ? 'h.vstr("test01")' : zigLit(it.type)} }`).join(', ')}})`
56
56
  : 'h.vnull()'
57
57
  } else if ('create' === primaryOp || 'update' === primaryOp || 'patch' === primaryOp) {
58
- const items = opRequestShape(exampleEntity, primaryOp).items
58
+ const items = requestExampleItems(exampleEntity, primaryOp)
59
59
  .filter((it: any) => it.name !== idF && it.name !== 'id')
60
60
  const required = items.filter((it: any) => !it.optional)
61
61
  const chosen = required.length ? required : items.slice(0, 3)