@voxgig/sdkgen 1.3.17 → 1.3.19

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 (267) hide show
  1. package/bin/voxgig-sdkgen +1 -1
  2. package/dist/cmp/Deploy.js +16 -16
  3. package/dist/cmp/Deploy.js.map +1 -1
  4. package/dist/cmp/Entity.js +5 -1
  5. package/dist/cmp/Entity.js.map +1 -1
  6. package/dist/cmp/Feature.js +2 -1
  7. package/dist/cmp/Feature.js.map +1 -1
  8. package/dist/cmp/ReadmeTop.js +13 -11
  9. package/dist/cmp/ReadmeTop.js.map +1 -1
  10. package/dist/helpers/canonType.js +8 -3
  11. package/dist/helpers/canonType.js.map +1 -1
  12. package/dist/helpers/collectDeps.d.ts +1 -1
  13. package/dist/helpers/collectDeps.js +36 -13
  14. package/dist/helpers/collectDeps.js.map +1 -1
  15. package/dist/helpers/naming.d.ts +5 -1
  16. package/dist/helpers/naming.js +118 -0
  17. package/dist/helpers/naming.js.map +1 -1
  18. package/dist/helpers/opShape.d.ts +3 -1
  19. package/dist/helpers/opShape.js +87 -8
  20. package/dist/helpers/opShape.js.map +1 -1
  21. package/dist/helpers/serverVars.d.ts +10 -0
  22. package/dist/helpers/serverVars.js +87 -0
  23. package/dist/helpers/serverVars.js.map +1 -0
  24. package/dist/sdkgen.d.ts +4 -3
  25. package/dist/sdkgen.js +11 -2
  26. package/dist/sdkgen.js.map +1 -1
  27. package/dist/tsconfig.tsbuildinfo +1 -1
  28. package/package.json +15 -10
  29. package/project/.sdk/model/target/cpp.aontu +4 -4
  30. package/project/.sdk/model/target/go-cli.aontu +17 -17
  31. package/project/.sdk/model/target/go-mcp.aontu +11 -11
  32. package/project/.sdk/model/target/go.aontu +1 -1
  33. package/project/.sdk/model/target/java.aontu +4 -4
  34. package/project/.sdk/model/target/kotlin.aontu +4 -4
  35. package/project/.sdk/model/target/lean.aontu +51 -0
  36. package/project/.sdk/model/target/scala.aontu +4 -4
  37. package/project/.sdk/src/cmp/c/EntityTypes_c.ts +3 -4
  38. package/project/.sdk/src/cmp/c/Entity_c.ts +3 -3
  39. package/project/.sdk/src/cmp/c/ReadmeExamplesTest_c.ts +24 -7
  40. package/project/.sdk/src/cmp/c/TestDirect_c.ts +3 -3
  41. package/project/.sdk/src/cmp/c/TestEntity_c.ts +1 -1
  42. package/project/.sdk/src/cmp/clojure/Entity_clojure.ts +1 -1
  43. package/project/.sdk/src/cmp/clojure/ReadmeExamplesTest_clojure.ts +19 -8
  44. package/project/.sdk/src/cmp/cpp/EntityTypes_cpp.ts +2 -2
  45. package/project/.sdk/src/cmp/cpp/Entity_cpp.ts +3 -3
  46. package/project/.sdk/src/cmp/cpp/MainEntity_cpp.ts +2 -2
  47. package/project/.sdk/src/cmp/cpp/ReadmeExamplesTest_cpp.ts +136 -0
  48. package/project/.sdk/src/cmp/cpp/TestDirect_cpp.ts +3 -3
  49. package/project/.sdk/src/cmp/cpp/Test_cpp.ts +4 -0
  50. package/project/.sdk/src/cmp/csharp/EntityTypes_csharp.ts +2 -3
  51. package/project/.sdk/src/cmp/csharp/Entity_csharp.ts +3 -3
  52. package/project/.sdk/src/cmp/csharp/MainEntity_csharp.ts +2 -2
  53. package/project/.sdk/src/cmp/csharp/Package_csharp.ts +1 -1
  54. package/project/.sdk/src/cmp/csharp/ReadmeExamplesTest_csharp.ts +13 -1
  55. package/project/.sdk/src/cmp/csharp/TestDirect_csharp.ts +3 -3
  56. package/project/.sdk/src/cmp/csharp/TestEntity_csharp.ts +22 -15
  57. package/project/.sdk/src/cmp/dart/EntityTypes_dart.ts +2 -3
  58. package/project/.sdk/src/cmp/dart/Entity_dart.ts +3 -3
  59. package/project/.sdk/src/cmp/dart/MainEntity_dart.ts +2 -2
  60. package/project/.sdk/src/cmp/dart/Main_dart.ts +3 -3
  61. package/project/.sdk/src/cmp/dart/Package_dart.ts +1 -1
  62. package/project/.sdk/src/cmp/dart/TestDirect_dart.ts +4 -4
  63. package/project/.sdk/src/cmp/elixir/EntityTypes_elixir.ts +2 -3
  64. package/project/.sdk/src/cmp/elixir/Entity_elixir.ts +1 -1
  65. package/project/.sdk/src/cmp/elixir/ReadmeExamplesTest_elixir.ts +21 -3
  66. package/project/.sdk/src/cmp/go/Config_go.ts +14 -2
  67. package/project/.sdk/src/cmp/go/EntityTypes_go.ts +110 -18
  68. package/project/.sdk/src/cmp/go/Entity_go.ts +3 -3
  69. package/project/.sdk/src/cmp/go/Main_go.ts +7 -6
  70. package/project/.sdk/src/cmp/go/Package_go.ts +1 -1
  71. package/project/.sdk/src/cmp/go/TestDirect_go.ts +3 -3
  72. package/project/.sdk/src/cmp/go/TestEntity_go.ts +1 -1
  73. package/project/.sdk/src/cmp/go/utility_go.ts +25 -0
  74. package/project/.sdk/src/cmp/go-cli/Main_go-cli.ts +62 -35
  75. package/project/.sdk/src/cmp/go-cli/fragment/main.fragment.go +7 -7
  76. package/project/.sdk/src/cmp/go-cli/fragment/words.fragment.go +21 -18
  77. package/project/.sdk/src/cmp/go-mcp/Main_go-mcp.ts +9 -1
  78. package/project/.sdk/src/cmp/haskell/ReadmeExamplesTest_haskell.ts +28 -18
  79. package/project/.sdk/src/cmp/java/EntityTypes_java.ts +2 -3
  80. package/project/.sdk/src/cmp/java/Entity_java.ts +3 -3
  81. package/project/.sdk/src/cmp/java/MainEntity_java.ts +2 -2
  82. package/project/.sdk/src/cmp/java/Package_java.ts +1 -1
  83. package/project/.sdk/src/cmp/java/ReadmeExamplesTest_java.ts +23 -1
  84. package/project/.sdk/src/cmp/java/TestDirect_java.ts +3 -3
  85. package/project/.sdk/src/cmp/js/Config_js.ts +11 -0
  86. package/project/.sdk/src/cmp/js/EntityTypes_js.ts +2 -3
  87. package/project/.sdk/src/cmp/js/Entity_js.ts +3 -3
  88. package/project/.sdk/src/cmp/js/MainEntity_js.ts +2 -2
  89. package/project/.sdk/src/cmp/js/Main_js.ts +2 -2
  90. package/project/.sdk/src/cmp/js/TestDirect_js.ts +4 -4
  91. package/project/.sdk/src/cmp/js/fragment/Config.fragment.js +2 -2
  92. package/project/.sdk/src/cmp/js/fragment/Direct.test.fragment.js +4 -0
  93. package/project/.sdk/src/cmp/kotlin/EntityTypes_kotlin.ts +2 -3
  94. package/project/.sdk/src/cmp/kotlin/Entity_kotlin.ts +3 -3
  95. package/project/.sdk/src/cmp/kotlin/MainEntity_kotlin.ts +2 -2
  96. package/project/.sdk/src/cmp/kotlin/Package_kotlin.ts +1 -1
  97. package/project/.sdk/src/cmp/kotlin/ReadmeExamplesTest_kotlin.ts +27 -2
  98. package/project/.sdk/src/cmp/kotlin/TestDirect_kotlin.ts +3 -3
  99. package/project/.sdk/src/cmp/lean/Config_lean.ts +88 -0
  100. package/project/.sdk/src/cmp/lean/Entity_lean.ts +9 -0
  101. package/project/.sdk/src/cmp/lean/Gitignore_lean.ts +18 -0
  102. package/project/.sdk/src/cmp/lean/Main_lean.ts +120 -0
  103. package/project/.sdk/src/cmp/lean/Package_lean.ts +68 -0
  104. package/project/.sdk/src/cmp/lean/ReadmeEntity_lean.ts +29 -0
  105. package/project/.sdk/src/cmp/lean/ReadmeExplanation_lean.ts +19 -0
  106. package/project/.sdk/src/cmp/lean/ReadmeHowto_lean.ts +25 -0
  107. package/project/.sdk/src/cmp/lean/ReadmeInstall_lean.ts +38 -0
  108. package/project/.sdk/src/cmp/lean/ReadmeIntro_lean.ts +25 -0
  109. package/project/.sdk/src/cmp/lean/ReadmeModel_lean.ts +24 -0
  110. package/project/.sdk/src/cmp/lean/ReadmeOptions_lean.ts +22 -0
  111. package/project/.sdk/src/cmp/lean/ReadmeQuick_lean.ts +50 -0
  112. package/project/.sdk/src/cmp/lean/ReadmeRef_lean.ts +16 -0
  113. package/project/.sdk/src/cmp/lean/ReadmeTopHowto_lean.ts +16 -0
  114. package/project/.sdk/src/cmp/lean/ReadmeTopQuick_lean.ts +23 -0
  115. package/project/.sdk/src/cmp/lean/ReadmeTopTest_lean.ts +18 -0
  116. package/project/.sdk/src/cmp/lean/Test_lean.ts +207 -0
  117. package/project/.sdk/src/cmp/lean/utility_lean.ts +78 -0
  118. package/project/.sdk/src/cmp/lua/Config_lua.ts +10 -1
  119. package/project/.sdk/src/cmp/lua/EntityTypes_lua.ts +2 -3
  120. package/project/.sdk/src/cmp/lua/Entity_lua.ts +3 -3
  121. package/project/.sdk/src/cmp/lua/Package_lua.ts +1 -1
  122. package/project/.sdk/src/cmp/lua/TestDirect_lua.ts +3 -3
  123. package/project/.sdk/src/cmp/lua/TestEntity_lua.ts +1 -1
  124. package/project/.sdk/src/cmp/ocaml/ReadmeExamplesTest_ocaml.ts +29 -14
  125. package/project/.sdk/src/cmp/perl/Entity_perl.ts +3 -3
  126. package/project/.sdk/src/cmp/perl/MainEntity_perl.ts +2 -2
  127. package/project/.sdk/src/cmp/perl/Package_perl.ts +1 -1
  128. package/project/.sdk/src/cmp/perl/TestDirect_perl.ts +3 -3
  129. package/project/.sdk/src/cmp/php/Config_php.ts +13 -2
  130. package/project/.sdk/src/cmp/php/EntityTypes_php.ts +2 -3
  131. package/project/.sdk/src/cmp/php/Entity_php.ts +3 -3
  132. package/project/.sdk/src/cmp/php/MainEntity_php.ts +2 -2
  133. package/project/.sdk/src/cmp/php/Package_php.ts +1 -1
  134. package/project/.sdk/src/cmp/php/TestDirect_php.ts +3 -3
  135. package/project/.sdk/src/cmp/php/TestEntity_php.ts +1 -1
  136. package/project/.sdk/src/cmp/py/Config_py.ts +10 -1
  137. package/project/.sdk/src/cmp/py/EntityTypes_py.ts +2 -3
  138. package/project/.sdk/src/cmp/py/Entity_py.ts +3 -3
  139. package/project/.sdk/src/cmp/py/MainEntity_py.ts +2 -2
  140. package/project/.sdk/src/cmp/py/Main_py.ts +2 -2
  141. package/project/.sdk/src/cmp/py/Package_py.ts +1 -1
  142. package/project/.sdk/src/cmp/py/TestDirect_py.ts +3 -3
  143. package/project/.sdk/src/cmp/py/TestEntity_py.ts +1 -1
  144. package/project/.sdk/src/cmp/rb/Config_rb.ts +12 -1
  145. package/project/.sdk/src/cmp/rb/EntityTypes_rb.ts +15 -5
  146. package/project/.sdk/src/cmp/rb/Entity_rb.ts +3 -3
  147. package/project/.sdk/src/cmp/rb/MainEntity_rb.ts +2 -2
  148. package/project/.sdk/src/cmp/rb/Package_rb.ts +2 -2
  149. package/project/.sdk/src/cmp/rb/TestDirect_rb.ts +3 -3
  150. package/project/.sdk/src/cmp/rb/TestEntity_rb.ts +1 -1
  151. package/project/.sdk/src/cmp/rust/EntityBase_rust.ts +2 -2
  152. package/project/.sdk/src/cmp/rust/EntityTypes_rust.ts +3 -4
  153. package/project/.sdk/src/cmp/rust/Entity_rust.ts +3 -3
  154. package/project/.sdk/src/cmp/rust/MainEntity_rust.ts +2 -2
  155. package/project/.sdk/src/cmp/rust/Package_rust.ts +1 -1
  156. package/project/.sdk/src/cmp/rust/ReadmeExamplesTest_rust.ts +22 -10
  157. package/project/.sdk/src/cmp/rust/TestDirect_rust.ts +3 -3
  158. package/project/.sdk/src/cmp/rust/TestEntity_rust.ts +25 -18
  159. package/project/.sdk/src/cmp/scala/EntityTypes_scala.ts +2 -3
  160. package/project/.sdk/src/cmp/scala/Entity_scala.ts +3 -3
  161. package/project/.sdk/src/cmp/scala/MainEntity_scala.ts +2 -2
  162. package/project/.sdk/src/cmp/scala/ReadmeExamplesTest_scala.ts +22 -3
  163. package/project/.sdk/src/cmp/scala/TestDirect_scala.ts +3 -3
  164. package/project/.sdk/src/cmp/scala/Test_scala.ts +1 -1
  165. package/project/.sdk/src/cmp/swift/EntityTypes_swift.ts +12 -6
  166. package/project/.sdk/src/cmp/swift/Entity_swift.ts +3 -3
  167. package/project/.sdk/src/cmp/swift/MainEntity_swift.ts +2 -2
  168. package/project/.sdk/src/cmp/swift/Package_swift.ts +1 -1
  169. package/project/.sdk/src/cmp/swift/ReadmeExamplesTest_swift.ts +18 -1
  170. package/project/.sdk/src/cmp/swift/TestDirect_swift.ts +1 -1
  171. package/project/.sdk/src/cmp/ts/Config_ts.ts +11 -0
  172. package/project/.sdk/src/cmp/ts/EntityTypes_ts.ts +2 -3
  173. package/project/.sdk/src/cmp/ts/Entity_ts.ts +3 -3
  174. package/project/.sdk/src/cmp/ts/MainEntity_ts.ts +2 -2
  175. package/project/.sdk/src/cmp/ts/Main_ts.ts +2 -2
  176. package/project/.sdk/src/cmp/ts/TestDirect_ts.ts +4 -4
  177. package/project/.sdk/src/cmp/ts/fragment/Config.fragment.ts +2 -2
  178. package/project/.sdk/src/cmp/ts/fragment/Direct.test.fragment.ts +4 -0
  179. package/project/.sdk/src/cmp/zig/Entity_zig.ts +3 -3
  180. package/project/.sdk/src/cmp/zig/MainEntity_zig.ts +2 -2
  181. package/project/.sdk/src/cmp/zig/Package_zig.ts +10 -2
  182. package/project/.sdk/tm/cpp/test/primary_utility_test.cpp +8 -16
  183. package/project/.sdk/tm/csharp/Makefile +6 -6
  184. package/project/.sdk/tm/csharp/test/PrimaryUtilityTest.cs +10 -28
  185. package/project/.sdk/tm/dart/Makefile +3 -3
  186. package/project/.sdk/tm/dart/test/primary_test.dart +7 -0
  187. package/project/.sdk/tm/go/Makefile +6 -6
  188. package/project/.sdk/tm/go/feature/test_feature.go +33 -1
  189. package/project/.sdk/tm/go/test/primary_utility_test.go +46 -42
  190. package/project/.sdk/tm/go/test/runner_test.go +30 -1
  191. package/project/.sdk/tm/go/utility/make_options.go +48 -0
  192. package/project/.sdk/tm/java/Makefile +6 -6
  193. package/project/.sdk/tm/java/test/PrimaryUtilityTest.java +7 -24
  194. package/project/.sdk/tm/js/Makefile +6 -6
  195. package/project/.sdk/tm/js/src/feature/test/TestFeature.js +18 -1
  196. package/project/.sdk/tm/js/src/utility/MakeOptionsUtility.js +39 -1
  197. package/project/.sdk/tm/js/test/utility/PrimaryUtility.test.js +13 -0
  198. package/project/.sdk/tm/kotlin/Makefile +6 -6
  199. package/project/.sdk/tm/kotlin/test/PrimaryUtilityTest.kt +7 -20
  200. package/project/.sdk/tm/lean/LICENSE +21 -0
  201. package/project/.sdk/tm/lean/VERSION +1 -0
  202. package/project/.sdk/tm/lean/src/SdkFeature.lean +171 -0
  203. package/project/.sdk/tm/lean/src/SdkFeatures.lean +602 -0
  204. package/project/.sdk/tm/lean/src/SdkJson.lean +134 -0
  205. package/project/.sdk/tm/lean/src/SdkRuntime.lean +356 -0
  206. package/project/.sdk/tm/lean/src/SdkUtility.lean +617 -0
  207. package/project/.sdk/tm/lean/src/VoxgigStruct.lean +2880 -0
  208. package/project/.sdk/tm/lean/src/Vregex.lean +412 -0
  209. package/project/.sdk/tm/lean/src/feature/README.md +5 -0
  210. package/project/.sdk/tm/lean/src/feature/audit/.gitkeep +0 -0
  211. package/project/.sdk/tm/lean/src/feature/base/.gitkeep +0 -0
  212. package/project/.sdk/tm/lean/src/feature/cache/.gitkeep +0 -0
  213. package/project/.sdk/tm/lean/src/feature/clienttrack/.gitkeep +0 -0
  214. package/project/.sdk/tm/lean/src/feature/debug/.gitkeep +0 -0
  215. package/project/.sdk/tm/lean/src/feature/idempotency/.gitkeep +0 -0
  216. package/project/.sdk/tm/lean/src/feature/log/.gitkeep +0 -0
  217. package/project/.sdk/tm/lean/src/feature/metrics/.gitkeep +0 -0
  218. package/project/.sdk/tm/lean/src/feature/netsim/.gitkeep +0 -0
  219. package/project/.sdk/tm/lean/src/feature/paging/.gitkeep +0 -0
  220. package/project/.sdk/tm/lean/src/feature/proxy/.gitkeep +0 -0
  221. package/project/.sdk/tm/lean/src/feature/ratelimit/.gitkeep +0 -0
  222. package/project/.sdk/tm/lean/src/feature/rbac/.gitkeep +0 -0
  223. package/project/.sdk/tm/lean/src/feature/retry/.gitkeep +0 -0
  224. package/project/.sdk/tm/lean/src/feature/streaming/.gitkeep +0 -0
  225. package/project/.sdk/tm/lean/src/feature/telemetry/.gitkeep +0 -0
  226. package/project/.sdk/tm/lean/src/feature/test/.gitkeep +0 -0
  227. package/project/.sdk/tm/lean/src/feature/timeout/.gitkeep +0 -0
  228. package/project/.sdk/tm/lean/test/StructCorpus.lean +697 -0
  229. package/project/.sdk/tm/lean/test/TFeature.lean +268 -0
  230. package/project/.sdk/tm/lean/test/TPrimaryUtility.lean +349 -0
  231. package/project/.sdk/tm/lua/Makefile +7 -7
  232. package/project/.sdk/tm/lua/feature/test_feature.lua +29 -1
  233. package/project/.sdk/tm/lua/test/primary_utility_test.lua +14 -8
  234. package/project/.sdk/tm/lua/utility/make_options.lua +39 -0
  235. package/project/.sdk/tm/perl/Makefile +6 -6
  236. package/project/.sdk/tm/perl/t/primary_utility.t +8 -17
  237. package/project/.sdk/tm/php/Makefile +6 -6
  238. package/project/.sdk/tm/php/feature/TestFeature.php +30 -2
  239. package/project/.sdk/tm/php/test/PrimaryUtilityTest.php +14 -7
  240. package/project/.sdk/tm/php/utility/MakeOptions.php +44 -0
  241. package/project/.sdk/tm/py/Makefile +6 -6
  242. package/project/.sdk/tm/py/feature/test_feature.py +28 -1
  243. package/project/.sdk/tm/py/test/test_primary_utility.py +18 -18
  244. package/project/.sdk/tm/py/utility/make_options.py +42 -0
  245. package/project/.sdk/tm/rb/Makefile +6 -6
  246. package/project/.sdk/tm/rb/feature/test_feature.rb +24 -1
  247. package/project/.sdk/tm/rb/test/primary_utility_test.rb +11 -8
  248. package/project/.sdk/tm/rb/utility/make_options.rb +37 -0
  249. package/project/.sdk/tm/rust/Makefile +6 -6
  250. package/project/.sdk/tm/rust/tests/common/mod.rs +37 -1
  251. package/project/.sdk/tm/rust/tests/primary_utility_test.rs +12 -26
  252. package/project/.sdk/tm/swift/Makefile +6 -6
  253. package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/PrimaryUtilityTest.swift +7 -8
  254. package/project/.sdk/tm/ts/Makefile +6 -6
  255. package/project/.sdk/tm/ts/src/feature/test/TestFeature.ts +18 -1
  256. package/project/.sdk/tm/ts/src/utility/MakeOptionsUtility.ts +39 -1
  257. package/project/.sdk/tm/ts/test/utility/PrimaryUtility.test.ts +69 -21
  258. package/src/cmp/Deploy.ts +16 -16
  259. package/src/cmp/Entity.ts +5 -1
  260. package/src/cmp/Feature.ts +2 -1
  261. package/src/cmp/ReadmeTop.ts +13 -11
  262. package/src/helpers/canonType.ts +8 -3
  263. package/src/helpers/collectDeps.ts +39 -12
  264. package/src/helpers/naming.ts +130 -0
  265. package/src/helpers/opShape.ts +99 -12
  266. package/src/helpers/serverVars.ts +105 -0
  267. package/src/sdkgen.ts +12 -3
@@ -1,6 +1,7 @@
1
1
  package sdktest
2
2
 
3
3
  import (
4
+ "fmt"
4
5
  "strings"
5
6
  "testing"
6
7
 
@@ -119,7 +120,7 @@ func TestPrimaryUtility(t *testing.T) {
119
120
  })
120
121
 
121
122
  t.Run("done-basic", func(t *testing.T) {
122
- runset(t, getSpec(primary, "done", "basic"), func(entry map[string]any) (any, error) {
123
+ runsetNamed(t, "done", getSpec(primary, "done", "basic"), func(entry map[string]any) (any, error) {
123
124
  ctxmap, _ := entry["ctx"].(map[string]any)
124
125
  ctx := makeCtxFromMap(ctxmap, client, utility)
125
126
  fixctx(ctx, client)
@@ -128,7 +129,7 @@ func TestPrimaryUtility(t *testing.T) {
128
129
  })
129
130
 
130
131
  t.Run("makeError-basic", func(t *testing.T) {
131
- runset(t, getSpec(primary, "makeError", "basic"), func(entry map[string]any) (any, error) {
132
+ runsetNamed(t, "makeError", getSpec(primary, "makeError", "basic"), func(entry map[string]any) (any, error) {
132
133
  args, _ := entry["args"].([]any)
133
134
  if len(args) == 0 {
134
135
  args = []any{map[string]any{}}
@@ -251,6 +252,10 @@ func TestPrimaryUtility(t *testing.T) {
251
252
  t.Run("fetcher-live", func(t *testing.T) {
252
253
  calls := []map[string]any{}
253
254
  liveClient := sdk.NewProjectNameSDK(map[string]any{
255
+ // Concrete base: a live construction must satisfy any server
256
+ // variables a templated base URL declares; a literal base
257
+ // sidesteps the requirement.
258
+ "base": "http://localhost:8080",
254
259
  "system": map[string]any{
255
260
  "fetch": func(url string, fetchdef map[string]any) (map[string]any, error) {
256
261
  calls = append(calls, map[string]any{"url": url, "init": fetchdef})
@@ -281,6 +286,7 @@ func TestPrimaryUtility(t *testing.T) {
281
286
  t.Run("fetcher-blocked-test-mode", func(t *testing.T) {
282
287
  // Create a live SDK then set mode to test (not using TestSDK, which installs test feature)
283
288
  blockedClient := sdk.NewProjectNameSDK(map[string]any{
289
+ "base": "http://localhost:8080",
284
290
  "system": map[string]any{
285
291
  "fetch": func(url string, fetchdef map[string]any) (map[string]any, error) {
286
292
  return map[string]any{}, nil
@@ -306,7 +312,7 @@ func TestPrimaryUtility(t *testing.T) {
306
312
  })
307
313
 
308
314
  t.Run("makeContext-basic", func(t *testing.T) {
309
- runset(t, getSpec(primary, "makeContext", "basic"), func(entry map[string]any) (any, error) {
315
+ runsetNamed(t, "makeContext", getSpec(primary, "makeContext", "basic"), func(entry map[string]any) (any, error) {
310
316
  in := entry["in"]
311
317
  if inMap, ok := in.(map[string]any); ok {
312
318
  ctx := utility.MakeContext(inMap, nil)
@@ -395,7 +401,7 @@ func TestPrimaryUtility(t *testing.T) {
395
401
  })
396
402
 
397
403
  t.Run("makeOptions-basic", func(t *testing.T) {
398
- runset(t, getSpec(primary, "makeOptions", "basic"), func(entry map[string]any) (any, error) {
404
+ runsetNamed(t, "makeOptions", getSpec(primary, "makeOptions", "basic"), func(entry map[string]any) (any, error) {
399
405
  in, _ := entry["in"].(map[string]any)
400
406
  ctx := utility.MakeContext(map[string]any{
401
407
  "options": in["options"],
@@ -408,7 +414,7 @@ func TestPrimaryUtility(t *testing.T) {
408
414
  })
409
415
 
410
416
  t.Run("makeRequest-basic", func(t *testing.T) {
411
- runset(t, getSpec(primary, "makeRequest", "basic"), func(entry map[string]any) (any, error) {
417
+ runsetNamed(t, "makeRequest", getSpec(primary, "makeRequest", "basic"), func(entry map[string]any) (any, error) {
412
418
  ctxmap, _ := entry["ctx"].(map[string]any)
413
419
  ctx := makeCtxFromMap(ctxmap, client, utility)
414
420
  ctx.Options = client.OptionsMap()
@@ -432,7 +438,7 @@ func TestPrimaryUtility(t *testing.T) {
432
438
  })
433
439
 
434
440
  t.Run("makeResponse-basic", func(t *testing.T) {
435
- runset(t, getSpec(primary, "makeResponse", "basic"), func(entry map[string]any) (any, error) {
441
+ runsetNamed(t, "makeResponse", getSpec(primary, "makeResponse", "basic"), func(entry map[string]any) (any, error) {
436
442
  ctxmap, _ := entry["ctx"].(map[string]any)
437
443
  ctx := makeCtxFromMap(ctxmap, client, utility)
438
444
  fixctx(ctx, client)
@@ -521,7 +527,7 @@ func TestPrimaryUtility(t *testing.T) {
521
527
  specClient := sdk.TestSDK(nil, setupOpts)
522
528
  specUtility := specClient.GetUtility()
523
529
 
524
- runset(t, getSpec(primary, "makeSpec", "basic"), func(entry map[string]any) (any, error) {
530
+ runsetNamed(t, "makeSpec", getSpec(primary, "makeSpec", "basic"), func(entry map[string]any) (any, error) {
525
531
  ctxmap, _ := entry["ctx"].(map[string]any)
526
532
  ctx := makeCtxFromMap(ctxmap, specClient, specUtility)
527
533
  ctx.Options = specClient.OptionsMap()
@@ -574,7 +580,7 @@ func TestPrimaryUtility(t *testing.T) {
574
580
  })
575
581
 
576
582
  t.Run("makeUrl-basic", func(t *testing.T) {
577
- runset(t, getSpec(primary, "makeUrl", "basic"), func(entry map[string]any) (any, error) {
583
+ runsetNamed(t, "makeUrl", getSpec(primary, "makeUrl", "basic"), func(entry map[string]any) (any, error) {
578
584
  ctxmap, _ := entry["ctx"].(map[string]any)
579
585
  ctx := makeCtxFromMap(ctxmap, client, utility)
580
586
  if ctx.Result == nil {
@@ -585,7 +591,7 @@ func TestPrimaryUtility(t *testing.T) {
585
591
  })
586
592
 
587
593
  t.Run("operator-basic", func(t *testing.T) {
588
- runset(t, getSpec(primary, "operator", "basic"), func(entry map[string]any) (any, error) {
594
+ runsetNamed(t, "operator", getSpec(primary, "operator", "basic"), func(entry map[string]any) (any, error) {
589
595
  in, _ := entry["in"].(map[string]any)
590
596
  op := sdk.NewOperation(in)
591
597
  return map[string]any{
@@ -598,7 +604,7 @@ func TestPrimaryUtility(t *testing.T) {
598
604
  })
599
605
 
600
606
  t.Run("param-basic", func(t *testing.T) {
601
- runset(t, getSpec(primary, "param", "basic"), func(entry map[string]any) (any, error) {
607
+ runsetNamed(t, "param", getSpec(primary, "param", "basic"), func(entry map[string]any) (any, error) {
602
608
  args, _ := entry["args"].([]any)
603
609
  if len(args) < 2 {
604
610
  return nil, nil
@@ -647,7 +653,7 @@ func TestPrimaryUtility(t *testing.T) {
647
653
  authClient := sdk.TestSDK(nil, setupOpts)
648
654
  authUtility := authClient.GetUtility()
649
655
 
650
- runset(t, getSpec(primary, "prepareAuth", "basic"), func(entry map[string]any) (any, error) {
656
+ runsetNamed(t, "prepareAuth", getSpec(primary, "prepareAuth", "basic"), func(entry map[string]any) (any, error) {
651
657
  ctxmap, _ := entry["ctx"].(map[string]any)
652
658
  ctx := makeCtxFromMap(ctxmap, authClient, authUtility)
653
659
  fixctx(ctx, authClient)
@@ -670,7 +676,7 @@ func TestPrimaryUtility(t *testing.T) {
670
676
  })
671
677
 
672
678
  t.Run("prepareBody-basic", func(t *testing.T) {
673
- runset(t, getSpec(primary, "prepareBody", "basic"), func(entry map[string]any) (any, error) {
679
+ runsetNamed(t, "prepareBody", getSpec(primary, "prepareBody", "basic"), func(entry map[string]any) (any, error) {
674
680
  ctxmap, _ := entry["ctx"].(map[string]any)
675
681
  ctx := makeCtxFromMap(ctxmap, client, utility)
676
682
  fixctx(ctx, client)
@@ -679,7 +685,7 @@ func TestPrimaryUtility(t *testing.T) {
679
685
  })
680
686
 
681
687
  t.Run("prepareHeaders-basic", func(t *testing.T) {
682
- runset(t, getSpec(primary, "prepareHeaders", "basic"), func(entry map[string]any) (any, error) {
688
+ runsetNamed(t, "prepareHeaders", getSpec(primary, "prepareHeaders", "basic"), func(entry map[string]any) (any, error) {
683
689
  ctxmap, _ := entry["ctx"].(map[string]any)
684
690
  ctx := makeCtxFromMap(ctxmap, client, utility)
685
691
  return utility.PrepareHeaders(ctx), nil
@@ -687,7 +693,7 @@ func TestPrimaryUtility(t *testing.T) {
687
693
  })
688
694
 
689
695
  t.Run("prepareMethod-basic", func(t *testing.T) {
690
- runset(t, getSpec(primary, "prepareMethod", "basic"), func(entry map[string]any) (any, error) {
696
+ runsetNamed(t, "prepareMethod", getSpec(primary, "prepareMethod", "basic"), func(entry map[string]any) (any, error) {
691
697
  ctxmap, _ := entry["ctx"].(map[string]any)
692
698
  ctx := makeCtxFromMap(ctxmap, client, utility)
693
699
  return utility.PrepareMethod(ctx), nil
@@ -695,41 +701,39 @@ func TestPrimaryUtility(t *testing.T) {
695
701
  })
696
702
 
697
703
  t.Run("prepareParams-basic", func(t *testing.T) {
698
- runset(t, getSpec(primary, "prepareParams", "basic"), func(entry map[string]any) (any, error) {
704
+ runsetNamed(t, "prepareParams", getSpec(primary, "prepareParams", "basic"), func(entry map[string]any) (any, error) {
699
705
  ctxmap, _ := entry["ctx"].(map[string]any)
700
706
  ctx := makeCtxFromMap(ctxmap, client, utility)
701
707
  return utility.PrepareParams(ctx), nil
702
708
  })
703
709
  })
704
710
 
711
+ // Was two hand-written cases that had drifted out of the shared corpus
712
+ // (the preparePath fixture shipped as an empty `set: []`). Now driven by
713
+ // the corpus like every other section, so all ports assert the same
714
+ // separator/blank-segment behaviour.
705
715
  t.Run("preparePath-basic", func(t *testing.T) {
706
- ctx := makeTestFullCtx(client, utility)
707
- ctx.Point = map[string]any{
708
- "parts": []any{"api", "planet", "{id}"},
709
- "args": map[string]any{"params": []any{}},
710
- }
711
-
712
- path := utility.PreparePath(ctx)
713
- if path != "api/planet/{id}" {
714
- t.Errorf("expected api/planet/{id}, got %s", path)
715
- }
716
+ runsetNamed(t, "preparePath", getSpec(primary, "preparePath", "basic"), func(entry map[string]any) (any, error) {
717
+ ctxmap, _ := entry["ctx"].(map[string]any)
718
+ ctx := makeCtxFromMap(ctxmap, client, utility)
719
+ return utility.PreparePath(ctx), nil
720
+ })
716
721
  })
717
722
 
718
- t.Run("preparePath-single", func(t *testing.T) {
719
- ctx := makeTestFullCtx(client, utility)
720
- ctx.Point = map[string]any{
721
- "parts": []any{"items"},
722
- "args": map[string]any{"params": []any{}},
723
- }
724
-
725
- path := utility.PreparePath(ctx)
726
- if path != "items" {
727
- t.Errorf("expected items, got %s", path)
728
- }
723
+ t.Run("clean-corpus", func(t *testing.T) {
724
+ runsetNamed(t, "clean", getSpec(primary, "clean", "basic"), func(entry map[string]any) (any, error) {
725
+ args, _ := entry["args"].([]any)
726
+ if 2 != len(args) {
727
+ return nil, fmt.Errorf("clean: expected 2 args, got %d", len(args))
728
+ }
729
+ ctxmap, _ := args[0].(map[string]any)
730
+ ctx := makeCtxFromMap(ctxmap, client, utility)
731
+ return utility.Clean(ctx, args[1]), nil
732
+ })
729
733
  })
730
734
 
731
735
  t.Run("prepareQuery-basic", func(t *testing.T) {
732
- runset(t, getSpec(primary, "prepareQuery", "basic"), func(entry map[string]any) (any, error) {
736
+ runsetNamed(t, "prepareQuery", getSpec(primary, "prepareQuery", "basic"), func(entry map[string]any) (any, error) {
733
737
  ctxmap, _ := entry["ctx"].(map[string]any)
734
738
  ctx := makeCtxFromMap(ctxmap, client, utility)
735
739
  return utility.PrepareQuery(ctx), nil
@@ -737,7 +741,7 @@ func TestPrimaryUtility(t *testing.T) {
737
741
  })
738
742
 
739
743
  t.Run("resultBasic-basic", func(t *testing.T) {
740
- runset(t, getSpec(primary, "resultBasic", "basic"), func(entry map[string]any) (any, error) {
744
+ runsetNamed(t, "resultBasic", getSpec(primary, "resultBasic", "basic"), func(entry map[string]any) (any, error) {
741
745
  ctxmap, _ := entry["ctx"].(map[string]any)
742
746
  ctx := makeCtxFromMap(ctxmap, client, utility)
743
747
  fixctx(ctx, client)
@@ -759,7 +763,7 @@ func TestPrimaryUtility(t *testing.T) {
759
763
  })
760
764
 
761
765
  t.Run("resultBody-basic", func(t *testing.T) {
762
- runset(t, getSpec(primary, "resultBody", "basic"), func(entry map[string]any) (any, error) {
766
+ runsetNamed(t, "resultBody", getSpec(primary, "resultBody", "basic"), func(entry map[string]any) (any, error) {
763
767
  ctxmap, _ := entry["ctx"].(map[string]any)
764
768
  ctx := makeCtxFromMap(ctxmap, client, utility)
765
769
 
@@ -778,7 +782,7 @@ func TestPrimaryUtility(t *testing.T) {
778
782
  })
779
783
 
780
784
  t.Run("resultHeaders-basic", func(t *testing.T) {
781
- runset(t, getSpec(primary, "resultHeaders", "basic"), func(entry map[string]any) (any, error) {
785
+ runsetNamed(t, "resultHeaders", getSpec(primary, "resultHeaders", "basic"), func(entry map[string]any) (any, error) {
782
786
  ctxmap, _ := entry["ctx"].(map[string]any)
783
787
  ctx := makeCtxFromMap(ctxmap, client, utility)
784
788
 
@@ -797,7 +801,7 @@ func TestPrimaryUtility(t *testing.T) {
797
801
  })
798
802
 
799
803
  t.Run("transformRequest-basic", func(t *testing.T) {
800
- runset(t, getSpec(primary, "transformRequest", "basic"), func(entry map[string]any) (any, error) {
804
+ runsetNamed(t, "transformRequest", getSpec(primary, "transformRequest", "basic"), func(entry map[string]any) (any, error) {
801
805
  ctxmap, _ := entry["ctx"].(map[string]any)
802
806
  ctx := makeCtxFromMap(ctxmap, client, utility)
803
807
 
@@ -816,7 +820,7 @@ func TestPrimaryUtility(t *testing.T) {
816
820
  })
817
821
 
818
822
  t.Run("transformResponse-basic", func(t *testing.T) {
819
- runset(t, getSpec(primary, "transformResponse", "basic"), func(entry map[string]any) (any, error) {
823
+ runsetNamed(t, "transformResponse", getSpec(primary, "transformResponse", "basic"), func(entry map[string]any) (any, error) {
820
824
  ctxmap, _ := entry["ctx"].(map[string]any)
821
825
  ctx := makeCtxFromMap(ctxmap, client, utility)
822
826
 
@@ -215,11 +215,40 @@ func getSpec(spec map[string]any, keys ...string) map[string]any {
215
215
 
216
216
  type RunSubject func(entry map[string]any) (any, error)
217
217
 
218
+ // PENDING sections are the ones deliberately left empty in the shared corpus
219
+ // (.sdk/test/primary/<name>.aontu). Everything else MUST contribute cases.
220
+ var pendingSections = map[string]bool{
221
+ "fetcher": true, "makeFetchDef": true, "makePoint": true, "makeResult": true,
222
+ "featureAdd": true, "featureHook": true, "featureInit": true,
223
+ }
224
+
225
+ // runset drives one section of the shared test corpus.
226
+ //
227
+ // It used to `return` silently when "set" was missing or not a list, so a
228
+ // renamed section, a fixture that failed to compile, or an empty set reported
229
+ // PASS while running zero assertions — the whole point of a shared oracle
230
+ // lost without a single red test. Both conditions are now fatal, except for
231
+ // the sections explicitly marked PENDING in the corpus.
218
232
  func runset(t *testing.T, testspec map[string]any, subject RunSubject) {
219
233
  t.Helper()
234
+ runsetNamed(t, "", testspec, subject)
235
+ }
236
+
237
+ func runsetNamed(t *testing.T, name string, testspec map[string]any, subject RunSubject) {
238
+ t.Helper()
239
+
240
+ if testspec == nil {
241
+ t.Fatalf("test corpus section %q missing — check the name against .sdk/test/primary/", name)
242
+ }
243
+
220
244
  set, ok := testspec["set"].([]any)
221
245
  if !ok {
222
- return
246
+ t.Fatalf("test corpus section %q has no `set` list — zero cases would run", name)
247
+ }
248
+
249
+ if 0 == len(set) && !pendingSections[name] {
250
+ t.Fatalf("test corpus section %q is EMPTY — zero cases would run; "+
251
+ "add cases, or mark the fixture PENDING in .sdk/test/primary/", name)
223
252
  }
224
253
 
225
254
  for i, e := range set {
@@ -1,6 +1,7 @@
1
1
  package utility
2
2
 
3
3
  import (
4
+ "regexp"
4
5
  "sort"
5
6
  "strings"
6
7
 
@@ -9,6 +10,9 @@ import (
9
10
  "GOMODULE/core"
10
11
  )
11
12
 
13
+ // {name} placeholders in a templated server URL (OpenAPI server variables).
14
+ var serverVarRe = regexp.MustCompile(`\{[A-Za-z0-9_]+\}`)
15
+
12
16
  func makeOptionsUtil(ctx *core.Context) map[string]any {
13
17
  options := ctx.Options
14
18
  if options == nil {
@@ -108,6 +112,13 @@ func makeOptionsUtil(ctx *core.Context) map[string]any {
108
112
  "clean": map[string]any{
109
113
  "keys": "key,token,id",
110
114
  },
115
+ // Server-variable values for a templated base URL (OpenAPI server
116
+ // variables): {name} placeholders in "base" are substituted from this
117
+ // map at construction. Spec defaults arrive via the generated config;
118
+ // user values override them.
119
+ "server": map[string]any{
120
+ "`$CHILD`": "",
121
+ },
111
122
  }
112
123
 
113
124
  // Preserve system.fetch before merge/validate.
@@ -120,6 +131,43 @@ func makeOptionsUtil(ctx *core.Context) map[string]any {
120
131
  validated, _ := vs.Validate(merged, optspec)
121
132
  opts = validated.(map[string]any)
122
133
 
134
+ // Resolve a templated base URL (e.g. https://{tenant_id}.hanko.io).
135
+ // Every placeholder must resolve to a non-empty value: from
136
+ // options["server"] (user), else the config default. A placeholder that
137
+ // resolves to "" is a construction error in live mode — the URL cannot
138
+ // work — but in test mode substitutes the deterministic value
139
+ // "test-<name>" so offline tests need no configuration. The SDK
140
+ // constructor has no error return, so a missing required variable
141
+ // PANICS (construction-time misconfiguration, as regexp.MustCompile).
142
+ if base, ok := opts["base"].(string); ok && strings.Contains(base, "{") {
143
+ testmode := false
144
+ if ta, ok := vs.GetPath([]any{"test", "active"}, opts).(bool); ok && ta {
145
+ testmode = true
146
+ }
147
+ if fa, ok := vs.GetPath([]any{"feature", "test", "active"}, opts).(bool); ok && fa {
148
+ testmode = true
149
+ }
150
+ server := core.ToMapAny(opts["server"])
151
+ sdkname := "SDK"
152
+ if mn, ok := vs.GetPath([]any{"main", "name"}, config).(string); ok && mn != "" {
153
+ sdkname = mn
154
+ }
155
+ resolved := serverVarRe.ReplaceAllStringFunc(base, func(ph string) string {
156
+ name := ph[1 : len(ph)-1]
157
+ val, _ := server[name].(string)
158
+ if val == "" {
159
+ if testmode {
160
+ return "test-" + name
161
+ }
162
+ panic(sdkname + ": the server variable '" + name + "' is required: " +
163
+ "the API base URL is '" + base + "' — pass " +
164
+ `options["server"].(map)["` + name + `"] in the SDK options`)
165
+ }
166
+ return val
167
+ })
168
+ opts["base"] = resolved
169
+ }
170
+
123
171
  // Restore system.fetch.
124
172
  if sysFetch != nil {
125
173
  if sys, ok := opts["system"]; ok {
@@ -12,10 +12,10 @@ clean:
12
12
  # --- Release: tag java/vX.Y.Z ----------------------------------------------
13
13
  # Maven Central publication (Sonatype Central Portal) is pending for this
14
14
  # target; publishing a version currently means pushing the java/vX.Y.Z git
15
- # tag. Run headless under the aql key vault, which injects the GitHub token
15
+ # tag. Run headless under the boru key vault, which injects the GitHub token
16
16
  # so nothing lands on disk or argv:
17
- # aql vault exec --for=github=<alias> -- make publish
18
- # aql `--dry-run` injects a filler token we detect to rehearse (no tag/push).
17
+ # boru vault exec --for=github=<alias> -- make publish
18
+ # boru `--dry-run` injects a filler token we detect to rehearse (no tag/push).
19
19
  # set -e + tag-last: a failed push never leaves a tag behind.
20
20
  #
21
21
  # NOTE: publishing the git tag is deliberately NOT gated on `mvn test` (every
@@ -23,14 +23,14 @@ clean:
23
23
  # block the tag). Run `make test` separately in CI to gate quality.
24
24
  VERSION := $(shell cat VERSION)
25
25
  TAG := java/v$(VERSION)
26
- AQL_DRY_RUN_FILLER := AQL-DRY-RUN-FILLER-NOT-A-REAL-SECRET
26
+ BORU_DRY_RUN_FILLER := BORU-DRY-RUN-FILLER-NOT-A-REAL-SECRET
27
27
  publish:
28
28
  @if git rev-parse -q --verify "refs/tags/$(TAG)" >/dev/null; then \
29
29
  echo "tag $(TAG) already exists — bump VERSION first"; exit 1; fi
30
30
  @set -e; \
31
31
  token="$${GITHUB_TOKEN:-$$GH_TOKEN}"; \
32
- if [ "$$token" = "$(AQL_DRY_RUN_FILLER)" ]; then \
33
- echo "[dry-run] aql filler token detected: would tag $(TAG); nothing pushed."; \
32
+ if [ "$$token" = "$(BORU_DRY_RUN_FILLER)" ]; then \
33
+ echo "[dry-run] boru filler token detected: would tag $(TAG); nothing pushed."; \
34
34
  exit 0; \
35
35
  fi; \
36
36
  git tag -a "$(TAG)" -m "java v$(VERSION)"; \
@@ -717,32 +717,15 @@ public class PrimaryUtilityTest {
717
717
 
718
718
  @Test
719
719
  public void preparePathBasic() {
720
+ // Was two hand-written cases that had drifted out of the shared corpus
721
+ // (the preparePath fixture shipped as an empty `set: []`).
720
722
  ProjectNameSDK client = client();
721
723
  Utility utility = client.getUtility();
722
- Context ctx = makeTestFullCtx(client, utility);
723
- List<Object> parts = new ArrayList<>();
724
- parts.add("api");
725
- parts.add("planet");
726
- parts.add("{id}");
727
- ctx.point = fhMap(
728
- "parts", parts,
729
- "args", fhMap("params", new ArrayList<>()));
730
-
731
- assertEquals("api/planet/{id}", utility.preparePath.apply(ctx));
732
- }
733
-
734
- @Test
735
- public void preparePathSingle() {
736
- ProjectNameSDK client = client();
737
- Utility utility = client.getUtility();
738
- Context ctx = makeTestFullCtx(client, utility);
739
- List<Object> parts = new ArrayList<>();
740
- parts.add("items");
741
- ctx.point = fhMap(
742
- "parts", parts,
743
- "args", fhMap("params", new ArrayList<>()));
744
-
745
- assertEquals("items", utility.preparePath.apply(ctx));
724
+ runset(getSpec(primary(), "preparePath", "basic"), (entry) -> {
725
+ Map<String, Object> ctxmap = Helpers.toMapAny(entry.get("ctx"));
726
+ Context ctx = makeCtxFromMap(ctxmap, client, utility);
727
+ return utility.preparePath.apply(ctx);
728
+ });
746
729
  }
747
730
 
748
731
  @Test
@@ -10,23 +10,23 @@ clean:
10
10
  rm -rf node_modules
11
11
 
12
12
  # --- Release: publish to npm ----------------------------------------------
13
- # Publish this package to npm, then tag js/vX.Y.Z. Run headless under the aql
13
+ # Publish this package to npm, then tag js/vX.Y.Z. Run headless under the boru
14
14
  # key vault, which injects the npm auth token + the GitHub token (never on disk
15
15
  # or argv):
16
- # aql vault exec --for=npm=<alias> --for=github=<alias> -- make publish
17
- # aql `--dry-run` injects a filler token we detect to rehearse (no publish/tag).
16
+ # boru vault exec --for=npm=<alias> --for=github=<alias> -- make publish
17
+ # boru `--dry-run` injects a filler token we detect to rehearse (no publish/tag).
18
18
  # set -e + tag-last: a failed publish never leaves a tag behind.
19
19
  SHELL := /bin/bash
20
20
  VERSION := $(shell node -p "require('./package.json').version")
21
21
  TAG := js/v$(VERSION)
22
- AQL_DRY_RUN_FILLER := AQL-DRY-RUN-FILLER-NOT-A-REAL-SECRET
22
+ BORU_DRY_RUN_FILLER := BORU-DRY-RUN-FILLER-NOT-A-REAL-SECRET
23
23
  publish: test
24
24
  @if git rev-parse -q --verify "refs/tags/$(TAG)" >/dev/null; then \
25
25
  echo "tag $(TAG) already exists — bump package.json version first"; exit 1; fi
26
26
  @set -e; \
27
27
  token="$${GITHUB_TOKEN:-$$GH_TOKEN}"; \
28
- if [ "$$token" = "$(AQL_DRY_RUN_FILLER)" ]; then \
29
- echo "[dry-run] aql filler token detected: would publish to npm and tag $(TAG); nothing pushed."; \
28
+ if [ "$$token" = "$(BORU_DRY_RUN_FILLER)" ]; then \
29
+ echo "[dry-run] boru filler token detected: would publish to npm and tag $(TAG); nothing pushed."; \
30
30
  exit 0; \
31
31
  fi; \
32
32
  npm stage publish --access public --registry https://registry.npmjs.org; \
@@ -49,12 +49,29 @@ class TestFeature extends BaseFeature {
49
49
  const delprop = struct.delprop
50
50
  const getdef = struct.getdef
51
51
 
52
+ // Shape the mock payload the way the real API would, so the op's
53
+ // response transform recovers the entity from it. A point carrying
54
+ // `transform.res: \`body.item\`` describes an API that answers
55
+ // `{item: {...}}`; handing back the bare entity means the transform
56
+ // unwraps a property that is not there and the caller gets undefined.
57
+ // The mock has to agree with the model, or it only ever simulates APIs
58
+ // whose responses happen to be unwrapped.
59
+ function envelope(data) {
60
+ const restf = getprop(getprop(ctx.point, 'transform', {}), 'res')
61
+ if (null == data || 'string' !== typeof restf) {
62
+ return data
63
+ }
64
+ const m = restf.match(/^`body\.([^`.]+)`$/)
65
+ return null == m ? data : { [m[1]]: data }
66
+ }
67
+
52
68
  function respond(status, data, res) {
69
+ const payload = envelope(data)
53
70
  const out = merge([
54
71
  {
55
72
  status,
56
73
  statusText: 'OK',
57
- json: async () => data,
74
+ json: async () => payload,
58
75
  body: 'not-used',
59
76
  },
60
77
  getdef(res, {})
@@ -79,16 +79,54 @@ function makeOptions(ctx) {
79
79
  },
80
80
  clean: {
81
81
  keys: 'key,token,id'
82
+ },
83
+ // Server-variable values for a templated base URL (OpenAPI server
84
+ // variables): `{name}` placeholders in `base` are substituted from
85
+ // this map at construction. Spec defaults arrive via the generated
86
+ // Config; user values override them.
87
+ server: {
88
+ '`$CHILD`': ''
82
89
  }
83
90
  }
84
91
 
85
92
  // JavaScript specific option values.
86
93
  optspec.system.fetch = opts.system?.fetch || global.fetch
87
94
 
88
- opts = merge([{}, cfgopts, opts])
95
+ // Clone the config side before merging: `config` is a module-level
96
+ // singleton in ts/js, and merge would otherwise use its nested maps as
97
+ // merge TARGETS — one instance's options (server, headers, ...) would
98
+ // contaminate every instance constructed after it.
99
+ opts = merge([{}, struct.clone(cfgopts), opts])
89
100
 
90
101
  opts = validate(opts, optspec)
91
102
 
103
+ // Resolve a templated base URL (e.g. https://{tenant_id}.hanko.io).
104
+ // Every placeholder must resolve to a non-empty value: from
105
+ // options.server (user), else the Config default. A placeholder that
106
+ // resolves to '' is a construction ERROR in live mode — the URL cannot
107
+ // work — but in test mode substitutes the deterministic value
108
+ // `test-<name>` so offline tests need no configuration.
109
+ if ('string' === typeof opts.base && opts.base.includes('{')) {
110
+ const testmode = true === opts.test.active ||
111
+ true === (opts.feature && opts.feature.test && opts.feature.test.active)
112
+ const server = opts.server || {}
113
+ opts.base = opts.base.replace(/\{([A-Za-z0-9_]+)\}/g,
114
+ (_m, name) => {
115
+ let val = server[name]
116
+ val = 'string' === typeof val ? val : ''
117
+ if ('' === val) {
118
+ if (testmode) {
119
+ return 'test-' + name
120
+ }
121
+ throw new Error(
122
+ (config?.main?.name || 'SDK') + ": the server variable '" + name +
123
+ "' is required: the API base URL is '" + opts.base +
124
+ "' — pass { server: { " + name + ": '...' } } in the SDK options")
125
+ }
126
+ return val
127
+ })
128
+ }
129
+
92
130
  // Resolve the feature add-order: an explicit array order (above) wins;
93
131
  // otherwise order the map test-first, then the remaining names sorted, so
94
132
  // the outcome is deterministic and `test` is always the base transport.
@@ -96,6 +96,14 @@ describe('PrimaryUtility', async () => {
96
96
  })
97
97
 
98
98
 
99
+ // preparePath shipped as an empty `set: []`, so no port drove it and several
100
+ // kept private hand-written cases instead. Corpus-driven like every other
101
+ // section now.
102
+ test('path-basic', async () => {
103
+ await runset(spec.preparePath.basic, utility.preparePath)
104
+ })
105
+
106
+
99
107
  test('body-basic', async () => {
100
108
  await runset(spec.prepareBody.basic, (ctx) => {
101
109
  fixctx(ctx)
@@ -197,6 +205,9 @@ describe('PrimaryUtility', async () => {
197
205
  body: 'present',
198
206
  })
199
207
  const reqClient = new SDK({
208
+ // Concrete base: a live construction must satisfy any server variables
209
+ // a templated base URL declares; a literal base sidesteps the requirement.
210
+ base: 'http://localhost:8080',
200
211
  system: { fetch: mockFetch }
201
212
  })
202
213
  const reqUtility = reqClient.utility()
@@ -378,6 +389,7 @@ describe('PrimaryUtility', async () => {
378
389
  test('fetcher-live', async () => {
379
390
  const calls = []
380
391
  const liveClient = new SDK({
392
+ base: 'http://localhost:8080',
381
393
  system: {
382
394
  fetch: async (url, init) => {
383
395
  calls.push({ url, init })
@@ -399,6 +411,7 @@ describe('PrimaryUtility', async () => {
399
411
 
400
412
  test('fetcher-blocked-test-mode', async () => {
401
413
  const blockedClient = new SDK({
414
+ base: 'http://localhost:8080',
402
415
  system: { fetch: async () => ({}) }
403
416
  })
404
417
  blockedClient._mode = 'test'
@@ -16,20 +16,20 @@ clean:
16
16
  # --- Release: tag kotlin/vX.Y.Z ---------------------------------------------
17
17
  # Maven Central publication (Sonatype Central Portal) is pending for this
18
18
  # target; publishing a version currently means pushing the kotlin/vX.Y.Z git
19
- # tag. Run headless under the aql key vault, which injects the GitHub token
19
+ # tag. Run headless under the boru key vault, which injects the GitHub token
20
20
  # so nothing lands on disk or argv:
21
- # aql vault exec --for=github=<alias> -- make publish
22
- # aql `--dry-run` injects a filler token we detect to rehearse (no tag/push).
21
+ # boru vault exec --for=github=<alias> -- make publish
22
+ # boru `--dry-run` injects a filler token we detect to rehearse (no tag/push).
23
23
  VERSION := $(shell cat VERSION)
24
24
  TAG := kotlin/v$(VERSION)
25
- AQL_DRY_RUN_FILLER := AQL-DRY-RUN-FILLER-NOT-A-REAL-SECRET
25
+ BORU_DRY_RUN_FILLER := BORU-DRY-RUN-FILLER-NOT-A-REAL-SECRET
26
26
  publish:
27
27
  @if git rev-parse -q --verify "refs/tags/$(TAG)" >/dev/null; then \
28
28
  echo "tag $(TAG) already exists — bump VERSION first"; exit 1; fi
29
29
  @set -e; \
30
30
  token="$${GITHUB_TOKEN:-$$GH_TOKEN}"; \
31
- if [ "$$token" = "$(AQL_DRY_RUN_FILLER)" ]; then \
32
- echo "[dry-run] aql filler token detected: would tag $(TAG); nothing pushed."; \
31
+ if [ "$$token" = "$(BORU_DRY_RUN_FILLER)" ]; then \
32
+ echo "[dry-run] boru filler token detected: would tag $(TAG); nothing pushed."; \
33
33
  exit 0; \
34
34
  fi; \
35
35
  git tag -a "$(TAG)" -m "kotlin v$(VERSION)"; \