sdkloom 0.0.0-stage → 0.1.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 (383) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +239 -2
  3. package/kits/allowed-sources.json +24 -0
  4. package/kits/csharp/kit.json +6 -0
  5. package/kits/csharp/src/Runtime/Client.cs +295 -0
  6. package/kits/csharp/src/Runtime/Context.cs +216 -0
  7. package/kits/csharp/src/Runtime/Errors.cs +121 -0
  8. package/kits/csharp/src/Runtime/Http.cs +218 -0
  9. package/kits/csharp/src/Runtime/Json.cs +650 -0
  10. package/kits/csharp/src/Runtime/Lang.cs +212 -0
  11. package/kits/csharp/src/Runtime/Models.cs +206 -0
  12. package/kits/csharp/src/Runtime/Multipart.cs +108 -0
  13. package/kits/csharp/src/Runtime/Pagination.cs +122 -0
  14. package/kits/csharp/src/Runtime/Sse.cs +197 -0
  15. package/kits/csharp/src/Runtime/Testing.cs +375 -0
  16. package/kits/csharp/src/Runtime/Transport.cs +212 -0
  17. package/kits/csharp/src/Runtime/Wait.cs +57 -0
  18. package/kits/csharp/src/Runtime/Webhooks.cs +148 -0
  19. package/kits/csharp/tests/ClientTests.cs +128 -0
  20. package/kits/csharp/tests/HttpTests.cs +44 -0
  21. package/kits/csharp/tests/JsonTests.cs +132 -0
  22. package/kits/csharp/tests/LangTests.cs +57 -0
  23. package/kits/csharp/tests/MultipartTests.cs +31 -0
  24. package/kits/csharp/tests/PaginationTests.cs +93 -0
  25. package/kits/csharp/tests/SseTests.cs +122 -0
  26. package/kits/csharp/tests/TestRunner.cs +93 -0
  27. package/kits/csharp/tests/TestingTests.cs +80 -0
  28. package/kits/csharp/tests/TransportTests.cs +145 -0
  29. package/kits/csharp/tests/WaitTests.cs +39 -0
  30. package/kits/csharp/tests/WebhooksTests.cs +46 -0
  31. package/kits/csharp/versions.json +12 -0
  32. package/kits/go/kit.json +6 -0
  33. package/kits/go/src/sdkruntime/client.go +322 -0
  34. package/kits/go/src/sdkruntime/context.go +207 -0
  35. package/kits/go/src/sdkruntime/errors.go +74 -0
  36. package/kits/go/src/sdkruntime/http.go +261 -0
  37. package/kits/go/src/sdkruntime/json.go +527 -0
  38. package/kits/go/src/sdkruntime/lang.go +462 -0
  39. package/kits/go/src/sdkruntime/multipart.go +75 -0
  40. package/kits/go/src/sdkruntime/pagination.go +150 -0
  41. package/kits/go/src/sdkruntime/sse.go +267 -0
  42. package/kits/go/src/sdkruntime/testing.go +343 -0
  43. package/kits/go/src/sdkruntime/transport.go +168 -0
  44. package/kits/go/src/sdkruntime/wait.go +49 -0
  45. package/kits/go/src/sdkruntime/webhooks.go +129 -0
  46. package/kits/go/tests/client_test.go +185 -0
  47. package/kits/go/tests/http_test.go +78 -0
  48. package/kits/go/tests/json_test.go +127 -0
  49. package/kits/go/tests/lang_test.go +98 -0
  50. package/kits/go/tests/multipart_test.go +29 -0
  51. package/kits/go/tests/pagination_test.go +69 -0
  52. package/kits/go/tests/sse_test.go +129 -0
  53. package/kits/go/tests/testing_test.go +121 -0
  54. package/kits/go/tests/transport_test.go +133 -0
  55. package/kits/go/tests/wait_test.go +46 -0
  56. package/kits/go/tests/webhooks_test.go +62 -0
  57. package/kits/go/versions.json +12 -0
  58. package/kits/java/kit.json +6 -0
  59. package/kits/java/src/dev/sdkloom/runtime/ApiException.java +63 -0
  60. package/kits/java/src/dev/sdkloom/runtime/ArgumentException.java +24 -0
  61. package/kits/java/src/dev/sdkloom/runtime/Assert.java +72 -0
  62. package/kits/java/src/dev/sdkloom/runtime/ClientRuntime.java +220 -0
  63. package/kits/java/src/dev/sdkloom/runtime/Clock.java +39 -0
  64. package/kits/java/src/dev/sdkloom/runtime/Context.java +79 -0
  65. package/kits/java/src/dev/sdkloom/runtime/Decode.java +200 -0
  66. package/kits/java/src/dev/sdkloom/runtime/DecodeException.java +26 -0
  67. package/kits/java/src/dev/sdkloom/runtime/Decoder.java +16 -0
  68. package/kits/java/src/dev/sdkloom/runtime/Emitter.java +56 -0
  69. package/kits/java/src/dev/sdkloom/runtime/ErrorFactory.java +18 -0
  70. package/kits/java/src/dev/sdkloom/runtime/EventListener.java +20 -0
  71. package/kits/java/src/dev/sdkloom/runtime/EventStream.java +232 -0
  72. package/kits/java/src/dev/sdkloom/runtime/FakeClock.java +37 -0
  73. package/kits/java/src/dev/sdkloom/runtime/Headers.java +42 -0
  74. package/kits/java/src/dev/sdkloom/runtime/HttpRequest.java +88 -0
  75. package/kits/java/src/dev/sdkloom/runtime/HttpResponse.java +69 -0
  76. package/kits/java/src/dev/sdkloom/runtime/JdkTransport.java +97 -0
  77. package/kits/java/src/dev/sdkloom/runtime/Js.java +230 -0
  78. package/kits/java/src/dev/sdkloom/runtime/Json.java +281 -0
  79. package/kits/java/src/dev/sdkloom/runtime/JsonValue.java +15 -0
  80. package/kits/java/src/dev/sdkloom/runtime/Links.java +62 -0
  81. package/kits/java/src/dev/sdkloom/runtime/Middleware.java +16 -0
  82. package/kits/java/src/dev/sdkloom/runtime/MiddlewareEntry.java +43 -0
  83. package/kits/java/src/dev/sdkloom/runtime/MockRoute.java +111 -0
  84. package/kits/java/src/dev/sdkloom/runtime/MockTransport.java +62 -0
  85. package/kits/java/src/dev/sdkloom/runtime/MultipartForm.java +111 -0
  86. package/kits/java/src/dev/sdkloom/runtime/Next.java +16 -0
  87. package/kits/java/src/dev/sdkloom/runtime/OperationInfo.java +35 -0
  88. package/kits/java/src/dev/sdkloom/runtime/OperationMock.java +105 -0
  89. package/kits/java/src/dev/sdkloom/runtime/OperationSpec.java +125 -0
  90. package/kits/java/src/dev/sdkloom/runtime/Pages.java +55 -0
  91. package/kits/java/src/dev/sdkloom/runtime/Pipeline.java +29 -0
  92. package/kits/java/src/dev/sdkloom/runtime/RawResult.java +31 -0
  93. package/kits/java/src/dev/sdkloom/runtime/RecordedEvent.java +36 -0
  94. package/kits/java/src/dev/sdkloom/runtime/SdkInfo.java +38 -0
  95. package/kits/java/src/dev/sdkloom/runtime/SendOptions.java +34 -0
  96. package/kits/java/src/dev/sdkloom/runtime/ServerSentEvent.java +58 -0
  97. package/kits/java/src/dev/sdkloom/runtime/State.java +58 -0
  98. package/kits/java/src/dev/sdkloom/runtime/Test.java +21 -0
  99. package/kits/java/src/dev/sdkloom/runtime/TestRunner.java +63 -0
  100. package/kits/java/src/dev/sdkloom/runtime/Transport.java +16 -0
  101. package/kits/java/src/dev/sdkloom/runtime/TransportException.java +30 -0
  102. package/kits/java/src/dev/sdkloom/runtime/UrlConnectionTransport.java +195 -0
  103. package/kits/java/src/dev/sdkloom/runtime/Urls.java +116 -0
  104. package/kits/java/src/dev/sdkloom/runtime/Waits.java +53 -0
  105. package/kits/java/src/dev/sdkloom/runtime/WebhookSignatureException.java +24 -0
  106. package/kits/java/src/dev/sdkloom/runtime/Webhooks.java +146 -0
  107. package/kits/java/tests/dev/sdkloom/runtime/ClientTest.java +266 -0
  108. package/kits/java/tests/dev/sdkloom/runtime/EventStreamTest.java +131 -0
  109. package/kits/java/tests/dev/sdkloom/runtime/HttpTest.java +95 -0
  110. package/kits/java/tests/dev/sdkloom/runtime/JdkTransportTest.java +12 -0
  111. package/kits/java/tests/dev/sdkloom/runtime/JsTest.java +102 -0
  112. package/kits/java/tests/dev/sdkloom/runtime/JsonTest.java +87 -0
  113. package/kits/java/tests/dev/sdkloom/runtime/LinksTest.java +22 -0
  114. package/kits/java/tests/dev/sdkloom/runtime/MultipartFormTest.java +30 -0
  115. package/kits/java/tests/dev/sdkloom/runtime/PagesTest.java +75 -0
  116. package/kits/java/tests/dev/sdkloom/runtime/TestData.java +53 -0
  117. package/kits/java/tests/dev/sdkloom/runtime/TestingTest.java +156 -0
  118. package/kits/java/tests/dev/sdkloom/runtime/TransportContract.java +201 -0
  119. package/kits/java/tests/dev/sdkloom/runtime/UrlConnectionTransportTest.java +49 -0
  120. package/kits/java/tests/dev/sdkloom/runtime/WaitsTest.java +43 -0
  121. package/kits/java/tests/dev/sdkloom/runtime/WebhooksTest.java +45 -0
  122. package/kits/java/versions.json +41 -0
  123. package/kits/python/kit.json +6 -0
  124. package/kits/python/src/sdkloom_runtime/__init__.py +1 -0
  125. package/kits/python/src/sdkloom_runtime/client.py +232 -0
  126. package/kits/python/src/sdkloom_runtime/compat.py +195 -0
  127. package/kits/python/src/sdkloom_runtime/context.py +134 -0
  128. package/kits/python/src/sdkloom_runtime/errors.py +65 -0
  129. package/kits/python/src/sdkloom_runtime/http.py +192 -0
  130. package/kits/python/src/sdkloom_runtime/lang.py +207 -0
  131. package/kits/python/src/sdkloom_runtime/models.py +221 -0
  132. package/kits/python/src/sdkloom_runtime/multipart.py +69 -0
  133. package/kits/python/src/sdkloom_runtime/pagination.py +61 -0
  134. package/kits/python/src/sdkloom_runtime/pipeline.py +39 -0
  135. package/kits/python/src/sdkloom_runtime/sse.py +121 -0
  136. package/kits/python/src/sdkloom_runtime/testing.py +224 -0
  137. package/kits/python/src/sdkloom_runtime/transport.py +120 -0
  138. package/kits/python/src/sdkloom_runtime/wait.py +44 -0
  139. package/kits/python/src/sdkloom_runtime/webhooks.py +84 -0
  140. package/kits/python/tests/support.py +28 -0
  141. package/kits/python/tests/test_client.py +275 -0
  142. package/kits/python/tests/test_compat.py +87 -0
  143. package/kits/python/tests/test_http.py +94 -0
  144. package/kits/python/tests/test_lang.py +104 -0
  145. package/kits/python/tests/test_models.py +110 -0
  146. package/kits/python/tests/test_multipart.py +37 -0
  147. package/kits/python/tests/test_pagination.py +70 -0
  148. package/kits/python/tests/test_sse.py +61 -0
  149. package/kits/python/tests/test_testing.py +130 -0
  150. package/kits/python/tests/test_transport.py +124 -0
  151. package/kits/python/tests/test_wait.py +46 -0
  152. package/kits/python/tests/test_webhooks.py +57 -0
  153. package/kits/python/versions.json +33 -0
  154. package/kits/rust/kit.json +6 -0
  155. package/kits/rust/src/runtime/client.rs +212 -0
  156. package/kits/rust/src/runtime/context.rs +182 -0
  157. package/kits/rust/src/runtime/crypto.rs +84 -0
  158. package/kits/rust/src/runtime/errors.rs +147 -0
  159. package/kits/rust/src/runtime/http.rs +248 -0
  160. package/kits/rust/src/runtime/json.rs +424 -0
  161. package/kits/rust/src/runtime/lang.rs +296 -0
  162. package/kits/rust/src/runtime/mod.rs +30 -0
  163. package/kits/rust/src/runtime/models.rs +266 -0
  164. package/kits/rust/src/runtime/multipart.rs +81 -0
  165. package/kits/rust/src/runtime/pagination.rs +117 -0
  166. package/kits/rust/src/runtime/sse.rs +195 -0
  167. package/kits/rust/src/runtime/testing.rs +308 -0
  168. package/kits/rust/src/runtime/transport.rs +324 -0
  169. package/kits/rust/src/runtime/wait.rs +29 -0
  170. package/kits/rust/src/runtime/webhooks.rs +142 -0
  171. package/kits/rust/tests/client.rs +152 -0
  172. package/kits/rust/tests/http.rs +44 -0
  173. package/kits/rust/tests/json.rs +82 -0
  174. package/kits/rust/tests/lang.rs +74 -0
  175. package/kits/rust/tests/multipart.rs +21 -0
  176. package/kits/rust/tests/pagination.rs +61 -0
  177. package/kits/rust/tests/sse.rs +77 -0
  178. package/kits/rust/tests/testing.rs +90 -0
  179. package/kits/rust/tests/transport.rs +218 -0
  180. package/kits/rust/tests/wait.rs +32 -0
  181. package/kits/rust/tests/webhooks.rs +73 -0
  182. package/kits/rust/versions.json +6 -0
  183. package/kits/typescript/kit.json +6 -0
  184. package/kits/typescript/src/client.ts +223 -0
  185. package/kits/typescript/src/context.ts +108 -0
  186. package/kits/typescript/src/errors.ts +63 -0
  187. package/kits/typescript/src/helpers.ts +49 -0
  188. package/kits/typescript/src/http.ts +192 -0
  189. package/kits/typescript/src/models.ts +139 -0
  190. package/kits/typescript/src/multipart.ts +66 -0
  191. package/kits/typescript/src/pagination.ts +54 -0
  192. package/kits/typescript/src/pipeline.ts +25 -0
  193. package/kits/typescript/src/sse.ts +102 -0
  194. package/kits/typescript/src/testing.ts +217 -0
  195. package/kits/typescript/src/transport.ts +101 -0
  196. package/kits/typescript/src/wait.ts +36 -0
  197. package/kits/typescript/src/webhooks.ts +168 -0
  198. package/kits/typescript/tests/client.test.ts +269 -0
  199. package/kits/typescript/tests/helpers.test.ts +27 -0
  200. package/kits/typescript/tests/http.test.ts +80 -0
  201. package/kits/typescript/tests/models.test.ts +71 -0
  202. package/kits/typescript/tests/multipart.test.ts +28 -0
  203. package/kits/typescript/tests/pagination.test.ts +76 -0
  204. package/kits/typescript/tests/sse.test.ts +82 -0
  205. package/kits/typescript/tests/testing.test.ts +103 -0
  206. package/kits/typescript/tests/transport.test.ts +127 -0
  207. package/kits/typescript/tests/wait.test.ts +31 -0
  208. package/kits/typescript/tests/webhooks.test.ts +53 -0
  209. package/kits/typescript/versions.json +15 -0
  210. package/package.json +37 -4
  211. package/packages/cli/recipes/apiKeyHeader.ts +16 -0
  212. package/packages/cli/recipes/apiVersionHeader.ts +16 -0
  213. package/packages/cli/recipes/basic.ts +13 -0
  214. package/packages/cli/recipes/bearer.ts +10 -0
  215. package/packages/cli/recipes/hmacSign.ts +23 -0
  216. package/packages/cli/recipes/idempotencyKey.ts +19 -0
  217. package/packages/cli/recipes/oauthClientCredentials.ts +50 -0
  218. package/packages/cli/recipes/retry.ts +42 -0
  219. package/packages/cli/recipes/timing.ts +12 -0
  220. package/packages/cli/recipes/userAgent.ts +8 -0
  221. package/packages/cli/src/build.js +93 -0
  222. package/packages/cli/src/commands/build.js +31 -0
  223. package/packages/cli/src/commands/conformance-check.js +50 -0
  224. package/packages/cli/src/commands/contract.js +181 -0
  225. package/packages/cli/src/commands/diff.js +113 -0
  226. package/packages/cli/src/commands/doctor.js +43 -0
  227. package/packages/cli/src/commands/import-openapi.js +42 -0
  228. package/packages/cli/src/commands/init.js +27 -0
  229. package/packages/cli/src/commands/kit-check.js +145 -0
  230. package/packages/cli/src/commands/publish.js +81 -0
  231. package/packages/cli/src/commands/recipe.js +49 -0
  232. package/packages/cli/src/commands/record.js +181 -0
  233. package/packages/cli/src/commands/serve.js +156 -0
  234. package/packages/cli/src/commands/spec-check.js +57 -0
  235. package/packages/cli/src/commands/test.js +177 -0
  236. package/packages/cli/src/commands/variants.js +32 -0
  237. package/packages/cli/src/commands/verify.js +57 -0
  238. package/packages/cli/src/commands/version.js +63 -0
  239. package/packages/cli/src/containers.js +82 -0
  240. package/packages/cli/src/coverage.js +72 -0
  241. package/packages/cli/src/git.js +25 -0
  242. package/packages/cli/src/io.js +50 -0
  243. package/packages/cli/src/java/ScenarioHarness.java +297 -0
  244. package/packages/cli/src/java/SchemaRoundTrip.java +63 -0
  245. package/packages/cli/src/java.js +70 -0
  246. package/packages/cli/src/js/harness.mjs +120 -0
  247. package/packages/cli/src/kits.js +103 -0
  248. package/packages/cli/src/languages/csharp.js +274 -0
  249. package/packages/cli/src/languages/go.js +185 -0
  250. package/packages/cli/src/languages/index.js +18 -0
  251. package/packages/cli/src/languages/java.js +187 -0
  252. package/packages/cli/src/languages/python.js +120 -0
  253. package/packages/cli/src/languages/rust.js +189 -0
  254. package/packages/cli/src/languages/types.js +93 -0
  255. package/packages/cli/src/languages/typescript.js +112 -0
  256. package/packages/cli/src/main.js +13 -0
  257. package/packages/cli/src/packaging.js +39 -0
  258. package/packages/cli/src/portability.js +45 -0
  259. package/packages/cli/src/profiles.js +55 -0
  260. package/packages/cli/src/project.js +56 -0
  261. package/packages/cli/src/python/scenario_harness.py +162 -0
  262. package/packages/cli/src/python/schema_roundtrip.py +42 -0
  263. package/packages/cli/src/registries.js +214 -0
  264. package/packages/cli/src/resolve-core.js +39 -0
  265. package/packages/cli/src/run.js +133 -0
  266. package/packages/cli/src/runtimes.js +61 -0
  267. package/packages/cli/src/scenarios-java.js +82 -0
  268. package/packages/cli/src/scenarios-javascript.js +54 -0
  269. package/packages/cli/src/scenarios-python.js +90 -0
  270. package/packages/cli/src/scenarios.js +183 -0
  271. package/packages/cli/src/schema.js +84 -0
  272. package/packages/cli/src/templates.js +85 -0
  273. package/packages/cli/src/toolchains.js +68 -0
  274. package/packages/cli/src/transpiled-tests.js +92 -0
  275. package/packages/codegen/src/canonical-json.js +31 -0
  276. package/packages/codegen/src/capabilities.js +50 -0
  277. package/packages/codegen/src/code-writer.js +54 -0
  278. package/packages/codegen/src/file-tree.js +25 -0
  279. package/packages/codegen/src/hash.js +6 -0
  280. package/packages/codegen/src/index.js +16 -0
  281. package/packages/codegen/src/lock.js +106 -0
  282. package/packages/conformance/src/case.js +143 -0
  283. package/packages/conformance/src/checks.js +40 -0
  284. package/packages/conformance/src/index.js +3 -0
  285. package/packages/conformance/src/matrix.js +48 -0
  286. package/packages/conformance/src/suite.js +48 -0
  287. package/packages/differ/src/diff.js +500 -0
  288. package/packages/differ/src/index.js +3 -0
  289. package/packages/differ/src/notes.js +112 -0
  290. package/packages/differ/src/support.js +34 -0
  291. package/packages/gen-csharp/src/emit-client.js +397 -0
  292. package/packages/gen-csharp/src/emit-harness.js +333 -0
  293. package/packages/gen-csharp/src/emit-mock.js +111 -0
  294. package/packages/gen-csharp/src/emit-models.js +119 -0
  295. package/packages/gen-csharp/src/emit-webhooks.js +57 -0
  296. package/packages/gen-csharp/src/generate.js +245 -0
  297. package/packages/gen-csharp/src/index.js +5 -0
  298. package/packages/gen-csharp/src/names.js +284 -0
  299. package/packages/gen-go/src/emit-client.js +405 -0
  300. package/packages/gen-go/src/emit-harness.js +294 -0
  301. package/packages/gen-go/src/emit-mock.js +112 -0
  302. package/packages/gen-go/src/emit-models.js +146 -0
  303. package/packages/gen-go/src/emit-webhooks.js +58 -0
  304. package/packages/gen-go/src/generate.js +205 -0
  305. package/packages/gen-go/src/index.js +5 -0
  306. package/packages/gen-go/src/names.js +197 -0
  307. package/packages/gen-java/src/emit-client.js +441 -0
  308. package/packages/gen-java/src/emit-models.js +342 -0
  309. package/packages/gen-java/src/emit-testing.js +123 -0
  310. package/packages/gen-java/src/emit-webhooks.js +70 -0
  311. package/packages/gen-java/src/generate.js +244 -0
  312. package/packages/gen-java/src/index.js +4 -0
  313. package/packages/gen-java/src/names.js +197 -0
  314. package/packages/gen-python/src/emit-client.js +272 -0
  315. package/packages/gen-python/src/emit-models.js +139 -0
  316. package/packages/gen-python/src/emit-testing.js +93 -0
  317. package/packages/gen-python/src/emit-webhooks.js +48 -0
  318. package/packages/gen-python/src/generate.js +237 -0
  319. package/packages/gen-python/src/index.js +2 -0
  320. package/packages/gen-python/src/names.js +161 -0
  321. package/packages/gen-python/src/style.js +67 -0
  322. package/packages/gen-rust/src/emit-client.js +379 -0
  323. package/packages/gen-rust/src/emit-harness.js +278 -0
  324. package/packages/gen-rust/src/emit-mock.js +121 -0
  325. package/packages/gen-rust/src/emit-models.js +117 -0
  326. package/packages/gen-rust/src/emit-webhooks.js +58 -0
  327. package/packages/gen-rust/src/generate.js +243 -0
  328. package/packages/gen-rust/src/index.js +5 -0
  329. package/packages/gen-rust/src/names.js +223 -0
  330. package/packages/gen-typescript/src/emit-client.js +434 -0
  331. package/packages/gen-typescript/src/emit-models.js +93 -0
  332. package/packages/gen-typescript/src/emit-package.js +90 -0
  333. package/packages/gen-typescript/src/emit-testing.js +138 -0
  334. package/packages/gen-typescript/src/emit-webhooks.js +52 -0
  335. package/packages/gen-typescript/src/generate.js +70 -0
  336. package/packages/gen-typescript/src/index.js +3 -0
  337. package/packages/gen-typescript/src/naming.js +64 -0
  338. package/packages/gen-typescript/src/runtime.js +81 -0
  339. package/packages/gen-typescript/src/types.js +136 -0
  340. package/packages/ir/src/api-surface.js +22 -0
  341. package/packages/ir/src/checks.js +52 -0
  342. package/packages/ir/src/index.js +32 -0
  343. package/packages/ir/src/ir.js +214 -0
  344. package/packages/ir/src/pages.js +18 -0
  345. package/packages/ir/src/validate-ir.js +462 -0
  346. package/packages/ir/src/validate-types.js +140 -0
  347. package/packages/kit/src/block-parser.js +196 -0
  348. package/packages/kit/src/index.js +15 -0
  349. package/packages/kit/src/kit-check.js +203 -0
  350. package/packages/kit/src/sources.js +53 -0
  351. package/packages/kit/src/version-policy.js +133 -0
  352. package/packages/kit/src/version-range.js +132 -0
  353. package/packages/openapi/src/import.js +292 -0
  354. package/packages/openapi/src/index.js +1 -0
  355. package/packages/openapi/src/names.js +50 -0
  356. package/packages/openapi/src/schemas.js +264 -0
  357. package/packages/packager/src/archive.js +106 -0
  358. package/packages/packager/src/crate.js +39 -0
  359. package/packages/packager/src/gomodule.js +11 -0
  360. package/packages/packager/src/index.js +9 -0
  361. package/packages/packager/src/maven.js +85 -0
  362. package/packages/packager/src/metadata.js +34 -0
  363. package/packages/packager/src/npm.js +71 -0
  364. package/packages/packager/src/nuget.js +78 -0
  365. package/packages/packager/src/sbom.js +56 -0
  366. package/packages/packager/src/wheel.js +62 -0
  367. package/packages/spec/src/index.js +11 -0
  368. package/packages/spec/src/requirements.js +139 -0
  369. package/packages/transpile/src/ast.js +51 -0
  370. package/packages/transpile/src/check.js +669 -0
  371. package/packages/transpile/src/emit-csharp.js +469 -0
  372. package/packages/transpile/src/emit-go.js +529 -0
  373. package/packages/transpile/src/emit-java.js +360 -0
  374. package/packages/transpile/src/emit-python.js +320 -0
  375. package/packages/transpile/src/emit-rust.js +499 -0
  376. package/packages/transpile/src/errors.js +15 -0
  377. package/packages/transpile/src/index.js +13 -0
  378. package/packages/transpile/src/lexer.js +161 -0
  379. package/packages/transpile/src/parser.js +543 -0
  380. package/packages/transpile/src/tests/ast.js +46 -0
  381. package/packages/transpile/src/tests/parse.js +376 -0
  382. package/packages/transpile/src/tests/translate.js +849 -0
  383. package/packages/transpile/src/transpile.js +57 -0
@@ -0,0 +1,232 @@
1
+ // sdkloom Java kit: reading a stream of server-sent events.
2
+ package dev.sdkloom.runtime;
3
+
4
+ import java.io.ByteArrayOutputStream;
5
+ import java.io.Closeable;
6
+ import java.io.IOException;
7
+ import java.io.InputStream;
8
+ import java.net.SocketTimeoutException;
9
+ import java.nio.charset.StandardCharsets;
10
+ import java.util.Iterator;
11
+ import java.util.List;
12
+ import java.util.NoSuchElementException;
13
+ import java.util.function.Supplier;
14
+
15
+ // @block sse.parse
16
+ // @summary Reads a text/event-stream response as it arrives: splits lines on CRLF, LF or CR (also across reads), collects event, data and id fields, dispatches on a blank line, drops an unfinished event at the end, and decodes each event's data (JSON for a typed stream, text for a string stream). Close it to stop early.
17
+ // @versions >=8
18
+ // @source [1] https://html.spec.whatwg.org/multipage/server-sent-events.html
19
+ // @quote [1] "Event streams in this format must always be encoded as UTF-8."
20
+ // @quote [1] "Once the end of the file is reached, any pending data must be discarded."
21
+ // @quote [1] "If value starts with a U+0020 SPACE"
22
+ // @source [2] https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html#read-byte:A-
23
+ // @quote [2] "This method blocks until input data is available, end of file is detected, or an exception is thrown."
24
+ // @retrieved 2026-12-06
25
+ // @tests tests/dev/sdkloom/runtime/EventStreamTest.java
26
+ // @requirement SDKL-SSE-001
27
+ public final class EventStream<T> implements Iterator<ServerSentEvent<T>>, Iterable<ServerSentEvent<T>>, Closeable {
28
+ private static final int CR = '\r';
29
+ private static final int LF = '\n';
30
+
31
+ private Supplier<EventStream<T>> open;
32
+ private EventStream<T> opened;
33
+ private final InputStream input;
34
+ private final Decoder<T> decode;
35
+ private final byte[] chunk = new byte[8192];
36
+ private final ByteArrayOutputStream line = new ByteArrayOutputStream();
37
+ private boolean pendingCr;
38
+ private boolean first = true;
39
+ private boolean ended;
40
+ private String type = "";
41
+ private StringBuilder data;
42
+ private String lastId = "";
43
+ private ServerSentEvent<T> next;
44
+ private int position;
45
+ private int limit;
46
+
47
+ /** Events read from the stream; decode reads each event's JSON data, or null to keep the data as text. */
48
+ public EventStream(InputStream input, Decoder<T> decode) {
49
+ this.input = input;
50
+ this.decode = decode;
51
+ }
52
+
53
+ private EventStream(Supplier<EventStream<T>> open) {
54
+ this.open = open;
55
+ this.input = null;
56
+ this.decode = null;
57
+ }
58
+
59
+ /** A stream whose request is sent when iteration starts. */
60
+ public static <T> EventStream<T> lazy(Supplier<EventStream<T>> open) {
61
+ return new EventStream<>(open);
62
+ }
63
+
64
+ /** Writes events in the event-stream format (mocks and tests); data that is not a string is written as JSON. */
65
+ public static String encode(List<? extends ServerSentEvent<?>> events) {
66
+ StringBuilder out = new StringBuilder();
67
+ for (ServerSentEvent<?> event : events) {
68
+ if (!"message".equals(event.event())) {
69
+ out.append("event: ").append(event.event()).append('\n');
70
+ }
71
+ if (!event.id().isEmpty()) {
72
+ out.append("id: ").append(event.id()).append('\n');
73
+ }
74
+ String text = event.data() instanceof String ? (String) event.data() : Json.write(event.data());
75
+ for (String part : text.split("\r\n|\r|\n", -1)) {
76
+ out.append("data: ").append(part).append('\n');
77
+ }
78
+ out.append('\n');
79
+ }
80
+ return out.toString();
81
+ }
82
+
83
+ private EventStream<T> source() {
84
+ if (open != null) {
85
+ opened = open.get();
86
+ open = null;
87
+ }
88
+ return opened == null ? this : opened;
89
+ }
90
+
91
+ @Override
92
+ public Iterator<ServerSentEvent<T>> iterator() {
93
+ return this;
94
+ }
95
+
96
+ @Override
97
+ public boolean hasNext() {
98
+ EventStream<T> source = source();
99
+ if (source != this) {
100
+ return source.hasNext();
101
+ }
102
+ while (next == null && !ended) {
103
+ readLine();
104
+ }
105
+ return next != null;
106
+ }
107
+
108
+ @Override
109
+ public ServerSentEvent<T> next() {
110
+ if (!hasNext()) {
111
+ throw new NoSuchElementException();
112
+ }
113
+ EventStream<T> source = source();
114
+ if (source != this) {
115
+ return source.next();
116
+ }
117
+ ServerSentEvent<T> event = next;
118
+ next = null;
119
+ return event;
120
+ }
121
+
122
+ @Override
123
+ public void close() {
124
+ if (opened != null) {
125
+ opened.close();
126
+ }
127
+ open = null;
128
+ ended = true;
129
+ if (input != null) {
130
+ try {
131
+ input.close();
132
+ } catch (IOException ignored) {
133
+ // Closing only stops reading; nothing is lost.
134
+ }
135
+ }
136
+ }
137
+
138
+ /** Reads up to the next line end, then handles the line; at the end of the stream an unfinished line is dropped. */
139
+ private void readLine() {
140
+ for (;;) {
141
+ if (position == limit) {
142
+ try {
143
+ limit = input.read(chunk);
144
+ } catch (SocketTimeoutException error) {
145
+ close();
146
+ throw new TransportException("timeout", error);
147
+ } catch (IOException error) {
148
+ close();
149
+ throw new TransportException("network", error);
150
+ }
151
+ position = 0;
152
+ if (limit < 0) {
153
+ limit = 0;
154
+ close();
155
+ return;
156
+ }
157
+ }
158
+ int value = chunk[position++] & 0xff;
159
+ if (pendingCr) {
160
+ pendingCr = false;
161
+ if (value == LF) {
162
+ continue;
163
+ }
164
+ }
165
+ if (value == CR || value == LF) {
166
+ pendingCr = value == CR;
167
+ handle(text());
168
+ return;
169
+ }
170
+ line.write(value);
171
+ }
172
+ }
173
+
174
+ private String text() {
175
+ byte[] bytes = line.toByteArray();
176
+ line.reset();
177
+ int start = 0;
178
+ if (first) {
179
+ first = false;
180
+ // One leading byte order mark is not part of the stream.
181
+ if (bytes.length >= 3 && (bytes[0] & 0xff) == 0xEF && (bytes[1] & 0xff) == 0xBB && (bytes[2] & 0xff) == 0xBF) {
182
+ start = 3;
183
+ }
184
+ }
185
+ return new String(bytes, start, bytes.length - start, StandardCharsets.UTF_8);
186
+ }
187
+
188
+ private void handle(String text) {
189
+ if (text.isEmpty()) {
190
+ if (data == null) {
191
+ type = "";
192
+ return;
193
+ }
194
+ String value = data.length() > 0 && data.charAt(data.length() - 1) == '\n' ? data.substring(0, data.length() - 1) : data.toString();
195
+ next = new ServerSentEvent<>(type.isEmpty() ? "message" : type, lastId, read(value));
196
+ type = "";
197
+ data = null;
198
+ return;
199
+ }
200
+ if (text.startsWith(":")) {
201
+ return;
202
+ }
203
+ int colon = text.indexOf(':');
204
+ String field = colon < 0 ? text : text.substring(0, colon);
205
+ String value = colon < 0 ? "" : text.substring(colon + 1);
206
+ if (value.startsWith(" ")) {
207
+ value = value.substring(1);
208
+ }
209
+ if ("event".equals(field)) {
210
+ type = value;
211
+ } else if ("data".equals(field)) {
212
+ data = (data == null ? new StringBuilder() : data).append(value).append('\n');
213
+ } else if ("id".equals(field) && value.indexOf('\0') < 0) {
214
+ lastId = value;
215
+ }
216
+ }
217
+
218
+ @SuppressWarnings("unchecked")
219
+ private T read(String value) {
220
+ if (decode == null) {
221
+ return (T) value;
222
+ }
223
+ Object parsed;
224
+ try {
225
+ parsed = Json.parse(value);
226
+ } catch (DecodeException error) {
227
+ throw new DecodeException("$", "the event data is not JSON: " + error.getMessage());
228
+ }
229
+ return decode.decode(parsed, "$");
230
+ }
231
+ }
232
+ // @end
@@ -0,0 +1,37 @@
1
+ // sdkloom Java kit: a clock for tests.
2
+ package dev.sdkloom.runtime;
3
+
4
+ // @block testing.fake_clock
5
+ // @summary A clock for tests that moves only when slept or advanced, so retries and expiries run instantly.
6
+ // @versions >=8
7
+ // @source [1] https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/System.html#nanoTime()
8
+ // @quote [1] "This method can only be used to measure elapsed time and is not related to any other notion of system or wall-clock time."
9
+ // @retrieved 2026-12-05
10
+ // @tests tests/dev/sdkloom/runtime/TestingTest.java
11
+ // @requirement SDKL-MOCK-002
12
+ public final class FakeClock implements Clock {
13
+ private long now;
14
+
15
+ public FakeClock(long start) {
16
+ this.now = start;
17
+ }
18
+
19
+ public FakeClock() {
20
+ this(0);
21
+ }
22
+
23
+ @Override
24
+ public synchronized long now() {
25
+ return now;
26
+ }
27
+
28
+ @Override
29
+ public synchronized void sleep(long ms) {
30
+ now += ms;
31
+ }
32
+
33
+ public synchronized void advance(long ms) {
34
+ now += ms;
35
+ }
36
+ }
37
+ // @end
@@ -0,0 +1,42 @@
1
+ // sdkloom Java kit: case-insensitive header lookup shared by requests and responses.
2
+ package dev.sdkloom.runtime;
3
+
4
+ import java.util.ArrayList;
5
+ import java.util.List;
6
+ import java.util.Locale;
7
+ import java.util.Map;
8
+
9
+ // @block http.headers
10
+ // @summary Finds and removes header fields by name, ignoring case.
11
+ // @versions >=8
12
+ // @source [1] https://www.rfc-editor.org/rfc/rfc9110#section-5.1
13
+ // @quote [1] "Field names are case-insensitive"
14
+ // @retrieved 2026-12-05
15
+ // @tests tests/dev/sdkloom/runtime/HttpTest.java
16
+ // @requirement SDKL-HTTP-001
17
+ final class Headers {
18
+ private Headers() {
19
+ }
20
+
21
+ static String find(List<Map.Entry<String, String>> headers, String name) {
22
+ String key = name.toLowerCase(Locale.ROOT);
23
+ for (Map.Entry<String, String> header : headers) {
24
+ if (header.getKey().toLowerCase(Locale.ROOT).equals(key)) {
25
+ return header.getValue();
26
+ }
27
+ }
28
+ return null;
29
+ }
30
+
31
+ static List<Map.Entry<String, String>> without(List<Map.Entry<String, String>> headers, String name) {
32
+ String key = name.toLowerCase(Locale.ROOT);
33
+ List<Map.Entry<String, String>> kept = new ArrayList<>();
34
+ for (Map.Entry<String, String> header : headers) {
35
+ if (!header.getKey().toLowerCase(Locale.ROOT).equals(key)) {
36
+ kept.add(header);
37
+ }
38
+ }
39
+ return kept;
40
+ }
41
+ }
42
+ // @end
@@ -0,0 +1,88 @@
1
+ // sdkloom Java kit: an HTTP request value.
2
+ package dev.sdkloom.runtime;
3
+
4
+ import java.util.AbstractMap;
5
+ import java.util.ArrayList;
6
+ import java.util.Collections;
7
+ import java.util.List;
8
+ import java.util.Map;
9
+ import java.util.Objects;
10
+
11
+ // @block http.request
12
+ // @summary An immutable HTTP request whose header names are matched case-insensitively.
13
+ // @versions >=8
14
+ // @source [1] https://www.rfc-editor.org/rfc/rfc9110#section-5.1
15
+ // @quote [1] "Field names are case-insensitive"
16
+ // @retrieved 2026-12-05
17
+ // @tests tests/dev/sdkloom/runtime/HttpTest.java
18
+ // @requirement SDKL-HTTP-001
19
+ public final class HttpRequest {
20
+ private final String method;
21
+ private final String url;
22
+ private final List<Map.Entry<String, String>> headers;
23
+ private final byte[] body;
24
+
25
+ public HttpRequest(String method, String url, List<Map.Entry<String, String>> headers, byte[] body) {
26
+ this.method = Objects.requireNonNull(method, "method");
27
+ this.url = Objects.requireNonNull(url, "url");
28
+ this.headers = Collections.unmodifiableList(new ArrayList<>(headers));
29
+ this.body = body == null ? null : body.clone();
30
+ }
31
+
32
+ public HttpRequest(String method, String url) {
33
+ this(method, url, Collections.<Map.Entry<String, String>>emptyList(), null);
34
+ }
35
+
36
+ public String method() {
37
+ return method;
38
+ }
39
+
40
+ public String url() {
41
+ return url;
42
+ }
43
+
44
+ /** Headers in the order they were set. */
45
+ public List<Map.Entry<String, String>> headers() {
46
+ return headers;
47
+ }
48
+
49
+ /** The body, or null when there is none. */
50
+ public byte[] body() {
51
+ return body == null ? null : body.clone();
52
+ }
53
+
54
+ /** The value of a header, or null; the name is matched case-insensitively. */
55
+ public String header(String name) {
56
+ return Headers.find(headers, name);
57
+ }
58
+
59
+ public HttpRequest withHeader(String name, String value) {
60
+ List<Map.Entry<String, String>> next = Headers.without(headers, name);
61
+ next.add(new AbstractMap.SimpleImmutableEntry<>(name, value));
62
+ return new HttpRequest(method, url, next, body);
63
+ }
64
+
65
+ public HttpRequest withoutHeader(String name) {
66
+ return new HttpRequest(method, url, Headers.without(headers, name), body);
67
+ }
68
+
69
+ public HttpRequest withUrl(String newUrl) {
70
+ return new HttpRequest(method, newUrl, headers, body);
71
+ }
72
+
73
+ public HttpRequest withBody(byte[] newBody) {
74
+ return new HttpRequest(method, url, headers, newBody);
75
+ }
76
+
77
+ /** The body as UTF-8 text, "" without one. */
78
+ public String text() {
79
+ byte[] current = body();
80
+ return current == null ? "" : new String(current, java.nio.charset.StandardCharsets.UTF_8);
81
+ }
82
+
83
+ @Override
84
+ public String toString() {
85
+ return method + " " + url;
86
+ }
87
+ }
88
+ // @end
@@ -0,0 +1,69 @@
1
+ // sdkloom Java kit: an HTTP response value.
2
+ package dev.sdkloom.runtime;
3
+
4
+ import java.io.ByteArrayInputStream;
5
+ import java.io.InputStream;
6
+ import java.nio.charset.StandardCharsets;
7
+ import java.util.ArrayList;
8
+ import java.util.Collections;
9
+ import java.util.List;
10
+ import java.util.Map;
11
+
12
+ // @block http.response
13
+ // @summary A received HTTP response whose body can be read as bytes, text or JSON any number of times, or as a stream as it arrives when the transport streamed it.
14
+ // @versions >=8
15
+ // @source [1] https://www.rfc-editor.org/rfc/rfc8259#section-2
16
+ // @quote [1] "A JSON text is a sequence of tokens."
17
+ // @retrieved 2026-12-05
18
+ // @tests tests/dev/sdkloom/runtime/HttpTest.java
19
+ // @requirement SDKL-HTTP-003
20
+ public final class HttpResponse {
21
+ private final int status;
22
+ private final List<Map.Entry<String, String>> headers;
23
+ private final byte[] body;
24
+ private final InputStream stream;
25
+
26
+ public HttpResponse(int status, List<Map.Entry<String, String>> headers, byte[] body) {
27
+ this(status, headers, body, null);
28
+ }
29
+
30
+ /** A streamed response: an empty body, and stream to read once as the bytes arrive. */
31
+ public HttpResponse(int status, List<Map.Entry<String, String>> headers, byte[] body, InputStream stream) {
32
+ this.status = status;
33
+ this.headers = Collections.unmodifiableList(new ArrayList<>(headers));
34
+ this.body = body == null ? new byte[0] : body.clone();
35
+ this.stream = stream;
36
+ }
37
+
38
+ /** The body as it arrives: the transport's stream for a streamed response, else the buffered body. Read it once. */
39
+ public InputStream bodyStream() {
40
+ return stream != null ? stream : new ByteArrayInputStream(body);
41
+ }
42
+
43
+ public int status() {
44
+ return status;
45
+ }
46
+
47
+ public List<Map.Entry<String, String>> headers() {
48
+ return headers;
49
+ }
50
+
51
+ public byte[] body() {
52
+ return body.clone();
53
+ }
54
+
55
+ public String header(String name) {
56
+ return Headers.find(headers, name);
57
+ }
58
+
59
+ public String text() {
60
+ return new String(body, StandardCharsets.UTF_8);
61
+ }
62
+
63
+ /** The body parsed as JSON, or null for an empty body. Throws DecodeException for invalid JSON. */
64
+ public Object json() {
65
+ String text = text();
66
+ return text.isEmpty() ? null : Json.parse(text);
67
+ }
68
+ }
69
+ // @end
@@ -0,0 +1,97 @@
1
+ // sdkloom Java kit: the default transport, built on java.net.http.
2
+ package dev.sdkloom.runtime;
3
+
4
+ import java.io.IOException;
5
+ import java.io.InputStream;
6
+ import java.net.ProxySelector;
7
+ import java.net.URI;
8
+ import java.net.http.HttpClient;
9
+ import java.net.http.HttpTimeoutException;
10
+ import java.time.Duration;
11
+ import java.util.ArrayList;
12
+ import java.util.List;
13
+ import java.util.Locale;
14
+ import java.util.Map;
15
+ import java.util.Set;
16
+ import javax.net.ssl.SSLContext;
17
+
18
+ // @block transport.jdk
19
+ // @summary The default transport, built on java.net.http.HttpClient with timeouts, an optional proxy and an optional TLS context. Non-2xx responses are returned, not thrown. A successful body is handed over as it arrives when the caller asks for a stream.
20
+ // @versions >=11
21
+ // @source [1] https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpClient.html
22
+ // @quote [1] "Once built, an HttpClient is immutable, and can be used to send multiple requests."
23
+ // @source [2] https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpRequest.Builder.html
24
+ // @quote [2] "If the response is not received within the specified timeout then an HttpTimeoutException is thrown from HttpClient::send"
25
+ // @retrieved 2026-12-05
26
+ // @tests tests/dev/sdkloom/runtime/JdkTransportTest.java
27
+ // @requirement SDKL-HTTP-004
28
+ public final class JdkTransport implements Transport {
29
+ /** Headers java.net.http sets itself and refuses to take from callers. */
30
+ private static final Set<String> RESTRICTED = Set.of("connection", "content-length", "expect", "host", "upgrade");
31
+
32
+ private final HttpClient client;
33
+
34
+ public JdkTransport(ProxySelector proxy, SSLContext sslContext) {
35
+ HttpClient.Builder builder = HttpClient.newBuilder().followRedirects(HttpClient.Redirect.NEVER);
36
+ if (proxy != null) {
37
+ builder.proxy(proxy);
38
+ }
39
+ if (sslContext != null) {
40
+ builder.sslContext(sslContext);
41
+ }
42
+ this.client = builder.build();
43
+ }
44
+
45
+ public JdkTransport() {
46
+ this(null, null);
47
+ }
48
+
49
+ private static List<Map.Entry<String, String>> headersOf(java.net.http.HttpResponse<?> response) {
50
+ List<Map.Entry<String, String>> headers = new ArrayList<>();
51
+ response.headers().map().forEach((name, values) -> values.forEach((value) -> headers.add(Map.entry(name, value))));
52
+ return headers;
53
+ }
54
+
55
+ @Override
56
+ public HttpResponse send(HttpRequest request, SendOptions options) {
57
+ URI uri = URI.create(request.url());
58
+ java.net.http.HttpRequest.Builder builder = java.net.http.HttpRequest.newBuilder(uri);
59
+ byte[] body = request.body();
60
+ builder.method(request.method(), body == null
61
+ ? java.net.http.HttpRequest.BodyPublishers.noBody()
62
+ : java.net.http.HttpRequest.BodyPublishers.ofByteArray(body));
63
+ if ("http".equalsIgnoreCase(uri.getScheme())) {
64
+ builder.version(HttpClient.Version.HTTP_1_1);
65
+ }
66
+ for (Map.Entry<String, String> header : request.headers()) {
67
+ if (!RESTRICTED.contains(header.getKey().toLowerCase(Locale.ROOT))) {
68
+ builder.header(header.getKey(), header.getValue());
69
+ }
70
+ }
71
+ if (options != null && options.timeoutMs() != null) {
72
+ builder.timeout(Duration.ofMillis(options.timeoutMs()));
73
+ }
74
+ try {
75
+ if (options != null && options.stream()) {
76
+ java.net.http.HttpResponse<InputStream> response = client.send(builder.build(), java.net.http.HttpResponse.BodyHandlers.ofInputStream());
77
+ List<Map.Entry<String, String>> headers = headersOf(response);
78
+ if (response.statusCode() >= 200 && response.statusCode() <= 299) {
79
+ return new HttpResponse(response.statusCode(), headers, new byte[0], response.body());
80
+ }
81
+ try (InputStream errorBody = response.body()) {
82
+ return new HttpResponse(response.statusCode(), headers, errorBody.readAllBytes());
83
+ }
84
+ }
85
+ java.net.http.HttpResponse<byte[]> response = client.send(builder.build(), java.net.http.HttpResponse.BodyHandlers.ofByteArray());
86
+ return new HttpResponse(response.statusCode(), headersOf(response), response.body());
87
+ } catch (HttpTimeoutException error) {
88
+ throw new TransportException("timeout", error);
89
+ } catch (IOException error) {
90
+ throw new TransportException("network", error);
91
+ } catch (InterruptedException error) {
92
+ Thread.currentThread().interrupt();
93
+ throw new TransportException("network", error);
94
+ }
95
+ }
96
+ }
97
+ // @end