@workerstack/clients 0.0.0-stage → 1.0.0-rc.23
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.
- package/LICENSE +21 -0
- package/README.md +619 -2
- package/bin/honey-clients.js +94 -0
- package/dist/cli.d.ts +102 -0
- package/dist/cli.js +190 -0
- package/dist/emit/cli/channels.d.ts +73 -0
- package/dist/emit/cli/channels.js +197 -0
- package/dist/emit/cli/commands.d.ts +27 -0
- package/dist/emit/cli/commands.js +187 -0
- package/dist/emit/cli/discovery.d.ts +35 -0
- package/dist/emit/cli/discovery.js +202 -0
- package/dist/emit/cli/flags.d.ts +59 -0
- package/dist/emit/cli/flags.js +186 -0
- package/dist/emit/cli/index.d.ts +1 -0
- package/dist/emit/cli/index.js +1 -0
- package/dist/emit/cli/install.d.ts +37 -0
- package/dist/emit/cli/install.js +88 -0
- package/dist/emit/cli/layout.d.ts +23 -0
- package/dist/emit/cli/layout.js +118 -0
- package/dist/emit/cli/module.d.ts +30 -0
- package/dist/emit/cli/module.js +186 -0
- package/dist/emit/cli/release.d.ts +40 -0
- package/dist/emit/cli/release.js +183 -0
- package/dist/emit/cli/skills.d.ts +11 -0
- package/dist/emit/cli/skills.js +56 -0
- package/dist/emit/csharp/errors.d.ts +7 -0
- package/dist/emit/csharp/errors.js +69 -0
- package/dist/emit/csharp/index.d.ts +1 -0
- package/dist/emit/csharp/index.js +1 -0
- package/dist/emit/csharp/json.d.ts +13 -0
- package/dist/emit/csharp/json.js +113 -0
- package/dist/emit/csharp/realtime.d.ts +10 -0
- package/dist/emit/csharp/realtime.js +33 -0
- package/dist/emit/csharp/sdk-answer.d.ts +48 -0
- package/dist/emit/csharp/sdk-answer.js +85 -0
- package/dist/emit/csharp/sdk-body.d.ts +10 -0
- package/dist/emit/csharp/sdk-body.js +87 -0
- package/dist/emit/csharp/sdk-client.d.ts +32 -0
- package/dist/emit/csharp/sdk-client.js +177 -0
- package/dist/emit/csharp/sdk-csproj.d.ts +36 -0
- package/dist/emit/csharp/sdk-csproj.js +136 -0
- package/dist/emit/csharp/sdk-doc.d.ts +12 -0
- package/dist/emit/csharp/sdk-doc.js +35 -0
- package/dist/emit/csharp/sdk-method.d.ts +26 -0
- package/dist/emit/csharp/sdk-method.js +187 -0
- package/dist/emit/csharp/sdk-plan.d.ts +38 -0
- package/dist/emit/csharp/sdk-plan.js +1 -0
- package/dist/emit/csharp/sdk.d.ts +40 -0
- package/dist/emit/csharp/sdk.js +105 -0
- package/dist/emit/csharp/sse.d.ts +18 -0
- package/dist/emit/csharp/sse.js +29 -0
- package/dist/emit/csharp/transport.d.ts +11 -0
- package/dist/emit/csharp/transport.js +67 -0
- package/dist/emit/csharp/types-enum.d.ts +19 -0
- package/dist/emit/csharp/types-enum.js +63 -0
- package/dist/emit/csharp/types-names.d.ts +33 -0
- package/dist/emit/csharp/types-names.js +182 -0
- package/dist/emit/csharp/types-record.d.ts +25 -0
- package/dist/emit/csharp/types-record.js +65 -0
- package/dist/emit/csharp/types-union.d.ts +27 -0
- package/dist/emit/csharp/types-union.js +113 -0
- package/dist/emit/csharp/types.d.ts +36 -0
- package/dist/emit/csharp/types.js +126 -0
- package/dist/emit/csharp/ws.d.ts +20 -0
- package/dist/emit/csharp/ws.js +14 -0
- package/dist/emit/go/errors.d.ts +7 -0
- package/dist/emit/go/errors.js +44 -0
- package/dist/emit/go/http.d.ts +11 -0
- package/dist/emit/go/http.js +50 -0
- package/dist/emit/go/index.d.ts +1 -0
- package/dist/emit/go/index.js +1 -0
- package/dist/emit/go/module-path.d.ts +2 -0
- package/dist/emit/go/module-path.js +27 -0
- package/dist/emit/go/sdk-answer.d.ts +28 -0
- package/dist/emit/go/sdk-answer.js +41 -0
- package/dist/emit/go/sdk-body.d.ts +24 -0
- package/dist/emit/go/sdk-body.js +76 -0
- package/dist/emit/go/sdk-client.d.ts +29 -0
- package/dist/emit/go/sdk-client.js +141 -0
- package/dist/emit/go/sdk-method.d.ts +68 -0
- package/dist/emit/go/sdk-method.js +172 -0
- package/dist/emit/go/sdk-mirror.d.ts +23 -0
- package/dist/emit/go/sdk-mirror.js +97 -0
- package/dist/emit/go/sdk-opts.d.ts +55 -0
- package/dist/emit/go/sdk-opts.js +100 -0
- package/dist/emit/go/sdk.d.ts +26 -0
- package/dist/emit/go/sdk.js +111 -0
- package/dist/emit/go/sse.d.ts +16 -0
- package/dist/emit/go/sse.js +26 -0
- package/dist/emit/go/types-codec.d.ts +15 -0
- package/dist/emit/go/types-codec.js +171 -0
- package/dist/emit/go/types-names.d.ts +14 -0
- package/dist/emit/go/types-names.js +64 -0
- package/dist/emit/go/types-struct.d.ts +29 -0
- package/dist/emit/go/types-struct.js +65 -0
- package/dist/emit/go/types-union.d.ts +17 -0
- package/dist/emit/go/types-union.js +84 -0
- package/dist/emit/go/types.d.ts +32 -0
- package/dist/emit/go/types.js +177 -0
- package/dist/emit/go/ws.d.ts +12 -0
- package/dist/emit/go/ws.js +70 -0
- package/dist/emit/java/gradle.d.ts +57 -0
- package/dist/emit/java/gradle.js +221 -0
- package/dist/emit/java/index.d.ts +2 -0
- package/dist/emit/java/index.js +2 -0
- package/dist/emit/java/json.d.ts +13 -0
- package/dist/emit/java/json.js +84 -0
- package/dist/emit/java/layout-ast.d.ts +146 -0
- package/dist/emit/java/layout-ast.js +102 -0
- package/dist/emit/java/layout-decl.d.ts +20 -0
- package/dist/emit/java/layout-decl.js +155 -0
- package/dist/emit/java/layout-doc.d.ts +55 -0
- package/dist/emit/java/layout-doc.js +166 -0
- package/dist/emit/java/layout-dot.d.ts +18 -0
- package/dist/emit/java/layout-dot.js +127 -0
- package/dist/emit/java/layout-strings.d.ts +8 -0
- package/dist/emit/java/layout-strings.js +76 -0
- package/dist/emit/java/layout-types.d.ts +11 -0
- package/dist/emit/java/layout-types.js +95 -0
- package/dist/emit/java/layout-visitor.d.ts +38 -0
- package/dist/emit/java/layout-visitor.js +232 -0
- package/dist/emit/java/layout.d.ts +61 -0
- package/dist/emit/java/layout.js +121 -0
- package/dist/emit/java/models-enum.d.ts +17 -0
- package/dist/emit/java/models-enum.js +51 -0
- package/dist/emit/java/models-names.d.ts +29 -0
- package/dist/emit/java/models-names.js +97 -0
- package/dist/emit/java/models-record.d.ts +24 -0
- package/dist/emit/java/models-record.js +79 -0
- package/dist/emit/java/models-union.d.ts +27 -0
- package/dist/emit/java/models-union.js +86 -0
- package/dist/emit/java/models.d.ts +28 -0
- package/dist/emit/java/models.js +118 -0
- package/dist/emit/java/realtime.d.ts +50 -0
- package/dist/emit/java/realtime.js +69 -0
- package/dist/emit/java/sdk-client.d.ts +66 -0
- package/dist/emit/java/sdk-client.js +207 -0
- package/dist/emit/java/sdk-decl.d.ts +11 -0
- package/dist/emit/java/sdk-decl.js +63 -0
- package/dist/emit/java/sdk-errors.d.ts +13 -0
- package/dist/emit/java/sdk-errors.js +141 -0
- package/dist/emit/java/sdk-headers.d.ts +12 -0
- package/dist/emit/java/sdk-headers.js +74 -0
- package/dist/emit/java/sdk-mirror.d.ts +14 -0
- package/dist/emit/java/sdk-mirror.js +107 -0
- package/dist/emit/java/sdk-models.d.ts +16 -0
- package/dist/emit/java/sdk-models.js +68 -0
- package/dist/emit/java/sdk-op.d.ts +57 -0
- package/dist/emit/java/sdk-op.js +216 -0
- package/dist/emit/java/sdk-params.d.ts +38 -0
- package/dist/emit/java/sdk-params.js +133 -0
- package/dist/emit/java/sdk-plan.d.ts +52 -0
- package/dist/emit/java/sdk-plan.js +1 -0
- package/dist/emit/java/sdk-record.d.ts +16 -0
- package/dist/emit/java/sdk-record.js +99 -0
- package/dist/emit/java/sdk.d.ts +49 -0
- package/dist/emit/java/sdk.js +216 -0
- package/dist/emit/java/sse.d.ts +35 -0
- package/dist/emit/java/sse.js +57 -0
- package/dist/emit/java/ws.d.ts +27 -0
- package/dist/emit/java/ws.js +31 -0
- package/dist/emit/mcp/annotations.d.ts +15 -0
- package/dist/emit/mcp/annotations.js +15 -0
- package/dist/emit/mcp/files.d.ts +18 -0
- package/dist/emit/mcp/files.js +42 -0
- package/dist/emit/mcp/index.d.ts +3 -0
- package/dist/emit/mcp/index.js +3 -0
- package/dist/emit/mcp/literal.d.ts +2 -0
- package/dist/emit/mcp/literal.js +33 -0
- package/dist/emit/mcp/mounted.d.ts +21 -0
- package/dist/emit/mcp/mounted.js +89 -0
- package/dist/emit/mcp/output-schema.d.ts +18 -0
- package/dist/emit/mcp/output-schema.js +38 -0
- package/dist/emit/mcp/registry.d.ts +23 -0
- package/dist/emit/mcp/registry.js +83 -0
- package/dist/emit/mcp/runtime.d.ts +10 -0
- package/dist/emit/mcp/runtime.js +47 -0
- package/dist/emit/mcp/schema.d.ts +19 -0
- package/dist/emit/mcp/schema.js +88 -0
- package/dist/emit/mcp/server.d.ts +30 -0
- package/dist/emit/mcp/server.js +246 -0
- package/dist/emit/mcp/tools.d.ts +51 -0
- package/dist/emit/mcp/tools.js +153 -0
- package/dist/emit/python/errors.d.ts +8 -0
- package/dist/emit/python/errors.js +68 -0
- package/dist/emit/python/index.d.ts +1 -0
- package/dist/emit/python/index.js +1 -0
- package/dist/emit/python/realtime.d.ts +10 -0
- package/dist/emit/python/realtime.js +33 -0
- package/dist/emit/python/sdk-answer.d.ts +49 -0
- package/dist/emit/python/sdk-answer.js +89 -0
- package/dist/emit/python/sdk-body.d.ts +11 -0
- package/dist/emit/python/sdk-body.js +40 -0
- package/dist/emit/python/sdk-client.d.ts +36 -0
- package/dist/emit/python/sdk-client.js +163 -0
- package/dist/emit/python/sdk-doc.d.ts +9 -0
- package/dist/emit/python/sdk-doc.js +32 -0
- package/dist/emit/python/sdk-imports.d.ts +14 -0
- package/dist/emit/python/sdk-imports.js +38 -0
- package/dist/emit/python/sdk-method.d.ts +29 -0
- package/dist/emit/python/sdk-method.js +183 -0
- package/dist/emit/python/sdk-plan.d.ts +33 -0
- package/dist/emit/python/sdk-plan.js +1 -0
- package/dist/emit/python/sdk-pyproject.d.ts +27 -0
- package/dist/emit/python/sdk-pyproject.js +103 -0
- package/dist/emit/python/sdk.d.ts +22 -0
- package/dist/emit/python/sdk.js +154 -0
- package/dist/emit/python/sse.d.ts +12 -0
- package/dist/emit/python/sse.js +23 -0
- package/dist/emit/python/transport.d.ts +15 -0
- package/dist/emit/python/transport.js +60 -0
- package/dist/emit/python/types-dict.d.ts +31 -0
- package/dist/emit/python/types-dict.js +45 -0
- package/dist/emit/python/types-names.d.ts +16 -0
- package/dist/emit/python/types-names.js +52 -0
- package/dist/emit/python/types-union.d.ts +32 -0
- package/dist/emit/python/types-union.js +46 -0
- package/dist/emit/python/types.d.ts +36 -0
- package/dist/emit/python/types.js +128 -0
- package/dist/emit/python/ws.d.ts +14 -0
- package/dist/emit/python/ws.js +16 -0
- package/dist/emit/rust/errors.d.ts +7 -0
- package/dist/emit/rust/errors.js +107 -0
- package/dist/emit/rust/http.d.ts +13 -0
- package/dist/emit/rust/http.js +67 -0
- package/dist/emit/rust/index.d.ts +1 -0
- package/dist/emit/rust/index.js +1 -0
- package/dist/emit/rust/realtime.d.ts +11 -0
- package/dist/emit/rust/realtime.js +29 -0
- package/dist/emit/rust/sdk-body.d.ts +19 -0
- package/dist/emit/rust/sdk-body.js +53 -0
- package/dist/emit/rust/sdk-cargo.d.ts +43 -0
- package/dist/emit/rust/sdk-cargo.js +178 -0
- package/dist/emit/rust/sdk-client.d.ts +25 -0
- package/dist/emit/rust/sdk-client.js +108 -0
- package/dist/emit/rust/sdk-method.d.ts +15 -0
- package/dist/emit/rust/sdk-method.js +119 -0
- package/dist/emit/rust/sdk-opts.d.ts +58 -0
- package/dist/emit/rust/sdk-opts.js +117 -0
- package/dist/emit/rust/sdk-plan.d.ts +33 -0
- package/dist/emit/rust/sdk-plan.js +1 -0
- package/dist/emit/rust/sdk.d.ts +23 -0
- package/dist/emit/rust/sdk.js +111 -0
- package/dist/emit/rust/sse.d.ts +19 -0
- package/dist/emit/rust/sse.js +20 -0
- package/dist/emit/rust/types-enum.d.ts +13 -0
- package/dist/emit/rust/types-enum.js +62 -0
- package/dist/emit/rust/types-names.d.ts +19 -0
- package/dist/emit/rust/types-names.js +66 -0
- package/dist/emit/rust/types-struct.d.ts +21 -0
- package/dist/emit/rust/types-struct.js +59 -0
- package/dist/emit/rust/types-union.d.ts +24 -0
- package/dist/emit/rust/types-union.js +97 -0
- package/dist/emit/rust/types.d.ts +34 -0
- package/dist/emit/rust/types.js +105 -0
- package/dist/emit/rust/ws.d.ts +21 -0
- package/dist/emit/rust/ws.js +20 -0
- package/dist/emit/shared/escape.d.ts +55 -0
- package/dist/emit/shared/escape.js +144 -0
- package/dist/emit/shared/format.d.ts +24 -0
- package/dist/emit/shared/format.js +23 -0
- package/dist/emit/shared/gofmt.d.ts +3 -0
- package/dist/emit/shared/gofmt.js +26 -0
- package/dist/emit/shared/lang.d.ts +60 -0
- package/dist/emit/shared/lang.js +233 -0
- package/dist/emit/shared/literals.d.ts +4 -0
- package/dist/emit/shared/literals.js +31 -0
- package/dist/emit/shared/metadata.d.ts +106 -0
- package/dist/emit/shared/metadata.js +130 -0
- package/dist/emit/shared/mirror.d.ts +22 -0
- package/dist/emit/shared/mirror.js +26 -0
- package/dist/emit/shared/ruff.d.ts +3 -0
- package/dist/emit/shared/ruff.js +31 -0
- package/dist/emit/shared/rustfmt.d.ts +3 -0
- package/dist/emit/shared/rustfmt.js +32 -0
- package/dist/emit/shared/status-keys.d.ts +7 -0
- package/dist/emit/shared/status-keys.js +67 -0
- package/dist/emit/shared/type-emitter.d.ts +19 -0
- package/dist/emit/shared/type-emitter.js +100 -0
- package/dist/emit/ts/app-client.d.ts +4 -0
- package/dist/emit/ts/app-client.js +68 -0
- package/dist/emit/ts/http.d.ts +20 -0
- package/dist/emit/ts/http.js +74 -0
- package/dist/emit/ts/package.d.ts +36 -0
- package/dist/emit/ts/package.js +126 -0
- package/dist/emit/ts/route-tree.d.ts +68 -0
- package/dist/emit/ts/route-tree.js +240 -0
- package/dist/emit/ts/sdk-types-preamble.d.ts +14 -0
- package/dist/emit/ts/sdk-types-preamble.js +123 -0
- package/dist/emit/ts/sdk-types.d.ts +13 -0
- package/dist/emit/ts/sdk-types.js +213 -0
- package/dist/emit/ts/sdk.d.ts +21 -0
- package/dist/emit/ts/sdk.js +173 -0
- package/dist/emit/ts/service-map.d.ts +40 -0
- package/dist/emit/ts/service-map.js +171 -0
- package/dist/emit/ts/tanstack-query.d.ts +12 -0
- package/dist/emit/ts/tanstack-query.js +156 -0
- package/dist/emit/ts/type-gen.d.ts +26 -0
- package/dist/emit/ts/type-gen.js +255 -0
- package/dist/emit/ts/webhooks.d.ts +19 -0
- package/dist/emit/ts/webhooks.js +81 -0
- package/dist/extract/chain.d.ts +34 -0
- package/dist/extract/chain.js +84 -0
- package/dist/extract/extract.d.ts +41 -0
- package/dist/extract/extract.js +191 -0
- package/dist/extract/serialize.d.ts +34 -0
- package/dist/extract/serialize.js +295 -0
- package/dist/extract/walk.d.ts +47 -0
- package/dist/extract/walk.js +109 -0
- package/dist/gen/args.d.ts +28 -0
- package/dist/gen/args.js +133 -0
- package/dist/gen/formatters.d.ts +62 -0
- package/dist/gen/formatters.js +146 -0
- package/dist/gen/process.d.ts +13 -0
- package/dist/gen/process.js +35 -0
- package/dist/gen/shipped.d.ts +17 -0
- package/dist/gen/shipped.js +55 -0
- package/dist/gen/targets.d.ts +93 -0
- package/dist/gen/targets.js +171 -0
- package/dist/gen/write.d.ts +33 -0
- package/dist/gen/write.js +118 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +15 -0
- package/dist/ir/build.d.ts +37 -0
- package/dist/ir/build.js +152 -0
- package/dist/ir/load.d.ts +11 -0
- package/dist/ir/load.js +112 -0
- package/dist/ir/model.d.ts +206 -0
- package/dist/ir/model.js +5 -0
- package/dist/ir/resolve-refs.d.ts +11 -0
- package/dist/ir/resolve-refs.js +66 -0
- package/dist/ir/resource-tree.d.ts +9 -0
- package/dist/ir/resource-tree.js +53 -0
- package/dist/ir/route-tree-intern.d.ts +18 -0
- package/dist/ir/route-tree-intern.js +174 -0
- package/dist/ir/schema.d.ts +11 -0
- package/dist/ir/schema.js +192 -0
- package/dist/ir/sdk-model.d.ts +86 -0
- package/dist/ir/sdk-model.js +204 -0
- package/dist/ir/slots.d.ts +42 -0
- package/dist/ir/slots.js +245 -0
- package/dist/runtime/cli/body.go +176 -0
- package/dist/runtime/cli/config.go +243 -0
- package/dist/runtime/cli/discovery.go +147 -0
- package/dist/runtime/cli/format.go +174 -0
- package/dist/runtime/cli/log.go +117 -0
- package/dist/runtime/cli/output.go +247 -0
- package/dist/runtime/cli/params.go +197 -0
- package/dist/runtime/cli/run.go +226 -0
- package/dist/runtime/cli/socket.go +60 -0
- package/dist/runtime/cli/stream.go +217 -0
- package/dist/runtime/cli/target.go +117 -0
- package/dist/runtime/csharp/Adapters.cs +183 -0
- package/dist/runtime/csharp/Auth.cs +56 -0
- package/dist/runtime/csharp/Body.cs +135 -0
- package/dist/runtime/csharp/Config.cs +161 -0
- package/dist/runtime/csharp/Envelope.cs +149 -0
- package/dist/runtime/csharp/Errors.cs +194 -0
- package/dist/runtime/csharp/Events.cs +155 -0
- package/dist/runtime/csharp/Exchange.cs +247 -0
- package/dist/runtime/csharp/Handler.cs +103 -0
- package/dist/runtime/csharp/Hooks.cs +128 -0
- package/dist/runtime/csharp/Invalidation.cs +102 -0
- package/dist/runtime/csharp/Json.cs +144 -0
- package/dist/runtime/csharp/Log.cs +48 -0
- package/dist/runtime/csharp/Operation.cs +33 -0
- package/dist/runtime/csharp/Path.cs +65 -0
- package/dist/runtime/csharp/Query.cs +72 -0
- package/dist/runtime/csharp/Realtime.cs +118 -0
- package/dist/runtime/csharp/RealtimeLoop.cs +236 -0
- package/dist/runtime/csharp/Redirect.cs +53 -0
- package/dist/runtime/csharp/Result.cs +57 -0
- package/dist/runtime/csharp/Sse.cs +122 -0
- package/dist/runtime/csharp/Stale.cs +151 -0
- package/dist/runtime/csharp/Transport.cs +143 -0
- package/dist/runtime/csharp/TransportLongPoll.cs +63 -0
- package/dist/runtime/csharp/TransportSse.cs +54 -0
- package/dist/runtime/csharp/TransportWs.cs +40 -0
- package/dist/runtime/csharp/Wire.cs +109 -0
- package/dist/runtime/csharp/Ws.cs +300 -0
- package/dist/runtime/csharp/WsDial.cs +127 -0
- package/dist/runtime/go/auth.go +127 -0
- package/dist/runtime/go/body.go +129 -0
- package/dist/runtime/go/config.go +75 -0
- package/dist/runtime/go/errors.go +185 -0
- package/dist/runtime/go/export.go +37 -0
- package/dist/runtime/go/hooks.go +53 -0
- package/dist/runtime/go/invalidation.go +112 -0
- package/dist/runtime/go/log.go +92 -0
- package/dist/runtime/go/nullable.go +64 -0
- package/dist/runtime/go/options.go +118 -0
- package/dist/runtime/go/path.go +156 -0
- package/dist/runtime/go/query.go +147 -0
- package/dist/runtime/go/realtime.go +239 -0
- package/dist/runtime/go/realtime_loop.go +208 -0
- package/dist/runtime/go/redirect.go +124 -0
- package/dist/runtime/go/request.go +222 -0
- package/dist/runtime/go/result.go +86 -0
- package/dist/runtime/go/sse.go +186 -0
- package/dist/runtime/go/stale.go +229 -0
- package/dist/runtime/go/stream.go +105 -0
- package/dist/runtime/go/transport.go +242 -0
- package/dist/runtime/go/transport_longpoll.go +121 -0
- package/dist/runtime/go/transport_sse.go +175 -0
- package/dist/runtime/go/ws.go +205 -0
- package/dist/runtime/java/Answer.java +107 -0
- package/dist/runtime/java/ApiException.java +110 -0
- package/dist/runtime/java/BinaryBody.java +36 -0
- package/dist/runtime/java/Body.java +105 -0
- package/dist/runtime/java/Call.java +23 -0
- package/dist/runtime/java/CallLog.java +51 -0
- package/dist/runtime/java/ClientConfig.java +233 -0
- package/dist/runtime/java/ConnectionState.java +12 -0
- package/dist/runtime/java/Credential.java +58 -0
- package/dist/runtime/java/Deadline.java +38 -0
- package/dist/runtime/java/Decode.java +181 -0
- package/dist/runtime/java/Envelope.java +141 -0
- package/dist/runtime/java/ErrorEnvelope.java +23 -0
- package/dist/runtime/java/EventStream.java +129 -0
- package/dist/runtime/java/Exchange.java +62 -0
- package/dist/runtime/java/FilePart.java +5 -0
- package/dist/runtime/java/Flight.java +306 -0
- package/dist/runtime/java/HoneyException.java +14 -0
- package/dist/runtime/java/Hooks.java +47 -0
- package/dist/runtime/java/Hops.java +133 -0
- package/dist/runtime/java/InvalidationConfig.java +73 -0
- package/dist/runtime/java/Json.java +23 -0
- package/dist/runtime/java/Keepalive.java +60 -0
- package/dist/runtime/java/LogEntry.java +14 -0
- package/dist/runtime/java/LongPollAdapter.java +68 -0
- package/dist/runtime/java/Operation.java +21 -0
- package/dist/runtime/java/Opt.java +121 -0
- package/dist/runtime/java/Pump.java +160 -0
- package/dist/runtime/java/RawResponse.java +48 -0
- package/dist/runtime/java/Realtime.java +152 -0
- package/dist/runtime/java/RealtimeLoop.java +371 -0
- package/dist/runtime/java/RedirectPolicy.java +13 -0
- package/dist/runtime/java/Redirects.java +126 -0
- package/dist/runtime/java/RequestContext.java +78 -0
- package/dist/runtime/java/RequestHook.java +9 -0
- package/dist/runtime/java/RequestOptions.java +91 -0
- package/dist/runtime/java/ResponseContext.java +70 -0
- package/dist/runtime/java/ResponseHook.java +12 -0
- package/dist/runtime/java/Result.java +32 -0
- package/dist/runtime/java/ResumableConnection.java +165 -0
- package/dist/runtime/java/SdkException.java +11 -0
- package/dist/runtime/java/Socket.java +301 -0
- package/dist/runtime/java/Sse.java +171 -0
- package/dist/runtime/java/SseAdapter.java +61 -0
- package/dist/runtime/java/SseEvent.java +10 -0
- package/dist/runtime/java/StaleMeta.java +16 -0
- package/dist/runtime/java/StaleTracker.java +287 -0
- package/dist/runtime/java/Transport.java +16 -0
- package/dist/runtime/java/TransportAdapter.java +14 -0
- package/dist/runtime/java/TransportConnection.java +15 -0
- package/dist/runtime/java/TransportKind.java +12 -0
- package/dist/runtime/java/TransportMessage.java +9 -0
- package/dist/runtime/java/TransportOptions.java +138 -0
- package/dist/runtime/java/TypedWebSocket.java +83 -0
- package/dist/runtime/java/UrlPath.java +49 -0
- package/dist/runtime/java/UrlQuery.java +99 -0
- package/dist/runtime/java/WsAdapter.java +52 -0
- package/dist/runtime/java/WsClose.java +47 -0
- package/dist/runtime/java/WsDial.java +148 -0
- package/dist/runtime/java/WsMessage.java +18 -0
- package/dist/runtime/mcp/call.ts +167 -0
- package/dist/runtime/mcp/files.ts +183 -0
- package/dist/runtime/mcp/guard.ts +176 -0
- package/dist/runtime/mcp/http.ts +159 -0
- package/dist/runtime/mcp/jsonrpc.ts +50 -0
- package/dist/runtime/mcp/listen.ts +76 -0
- package/dist/runtime/mcp/mount.ts +123 -0
- package/dist/runtime/mcp/protocol.ts +219 -0
- package/dist/runtime/mcp/reader.ts +57 -0
- package/dist/runtime/mcp/result.ts +85 -0
- package/dist/runtime/mcp/stdio.ts +79 -0
- package/dist/runtime/mcp/stream.ts +62 -0
- package/dist/runtime/python/__init__.py +2 -0
- package/dist/runtime/python/auth.py +67 -0
- package/dist/runtime/python/body.py +83 -0
- package/dist/runtime/python/config.py +139 -0
- package/dist/runtime/python/errors.py +213 -0
- package/dist/runtime/python/events.py +152 -0
- package/dist/runtime/python/exchange.py +298 -0
- package/dist/runtime/python/hooks.py +86 -0
- package/dist/runtime/python/invalidation.py +57 -0
- package/dist/runtime/python/log.py +60 -0
- package/dist/runtime/python/operation.py +25 -0
- package/dist/runtime/python/path.py +41 -0
- package/dist/runtime/python/query.py +48 -0
- package/dist/runtime/python/realtime.py +244 -0
- package/dist/runtime/python/redirect.py +93 -0
- package/dist/runtime/python/result.py +58 -0
- package/dist/runtime/python/send_async.py +189 -0
- package/dist/runtime/python/send_sync.py +105 -0
- package/dist/runtime/python/sse.py +81 -0
- package/dist/runtime/python/stale.py +94 -0
- package/dist/runtime/python/transport.py +157 -0
- package/dist/runtime/python/transport_longpoll.py +60 -0
- package/dist/runtime/python/transport_sse.py +60 -0
- package/dist/runtime/python/transport_ws.py +57 -0
- package/dist/runtime/python/ws.py +276 -0
- package/dist/runtime/rust/Cargo.lock +1763 -0
- package/dist/runtime/rust/answer.rs +120 -0
- package/dist/runtime/rust/auth.rs +80 -0
- package/dist/runtime/rust/body.rs +150 -0
- package/dist/runtime/rust/call.rs +200 -0
- package/dist/runtime/rust/config.rs +254 -0
- package/dist/runtime/rust/envelope.rs +84 -0
- package/dist/runtime/rust/errors.rs +235 -0
- package/dist/runtime/rust/events.rs +177 -0
- package/dist/runtime/rust/exchange.rs +287 -0
- package/dist/runtime/rust/hooks.rs +63 -0
- package/dist/runtime/rust/invalidation.rs +84 -0
- package/dist/runtime/rust/log.rs +88 -0
- package/dist/runtime/rust/nullable.rs +13 -0
- package/dist/runtime/rust/path.rs +83 -0
- package/dist/runtime/rust/query.rs +84 -0
- package/dist/runtime/rust/realtime.rs +182 -0
- package/dist/runtime/rust/realtime_loop.rs +177 -0
- package/dist/runtime/rust/redirect.rs +121 -0
- package/dist/runtime/rust/request.rs +178 -0
- package/dist/runtime/rust/result.rs +101 -0
- package/dist/runtime/rust/sse.rs +104 -0
- package/dist/runtime/rust/stale.rs +209 -0
- package/dist/runtime/rust/transport.rs +221 -0
- package/dist/runtime/rust/transport_longpoll.rs +108 -0
- package/dist/runtime/rust/transport_sse.rs +91 -0
- package/dist/runtime/rust/transport_ws.rs +75 -0
- package/dist/runtime/rust/ws.rs +322 -0
- package/dist/runtime/ts/app-types.ts +200 -0
- package/dist/runtime/ts/app.ts +104 -0
- package/dist/runtime/ts/config.ts +124 -0
- package/dist/runtime/ts/defaults.ts +48 -0
- package/dist/runtime/ts/error.ts +113 -0
- package/dist/runtime/ts/hooks.ts +92 -0
- package/dist/runtime/ts/http.ts +228 -0
- package/dist/runtime/ts/media-type.ts +36 -0
- package/dist/runtime/ts/path.ts +152 -0
- package/dist/runtime/ts/realtime-connection.ts +296 -0
- package/dist/runtime/ts/realtime-transports.ts +149 -0
- package/dist/runtime/ts/realtime.ts +293 -0
- package/dist/runtime/ts/redirect-policy.ts +17 -0
- package/dist/runtime/ts/redirects.ts +74 -0
- package/dist/runtime/ts/request.ts +239 -0
- package/dist/runtime/ts/response.ts +219 -0
- package/dist/runtime/ts/sdk-realtime.ts +10 -0
- package/dist/runtime/ts/sdk-sse.ts +55 -0
- package/dist/runtime/ts/sdk-ws.ts +21 -0
- package/dist/runtime/ts/sdk.ts +242 -0
- package/dist/runtime/ts/sse.ts +175 -0
- package/dist/runtime/ts/stale.ts +137 -0
- package/dist/runtime/ts/stream.ts +87 -0
- package/dist/runtime/ts/webhook.ts +116 -0
- package/dist/runtime/ts/ws.ts +155 -0
- package/dist/runtime/ts-tanstack-query/invalidate.ts +152 -0
- package/dist/runtime/ts-tanstack-query/query.ts +261 -0
- package/package.json +84 -5
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { javaString } from "../shared/escape.js";
|
|
2
|
+
import { assign, bin, call, exprStmt, field, ifOpen, local, methodHeader, newOf, param, returnStmt, statement, throwStmt, typeHeader, } from "./layout.js";
|
|
3
|
+
import { docOf } from "./sdk-decl.js";
|
|
4
|
+
import { multipartRecord } from "./sdk-params.js";
|
|
5
|
+
/** One builder setter: its doc, `public Builder field(Type field)`, the assignment, `return this`. */
|
|
6
|
+
const setterLines = (f) => [
|
|
7
|
+
"",
|
|
8
|
+
docOf(`Sets {@code ${f.name}}.`, " "),
|
|
9
|
+
...methodHeader(4, {
|
|
10
|
+
modifiers: ["public"],
|
|
11
|
+
name: f.field,
|
|
12
|
+
params: [param(f.type, f.field)],
|
|
13
|
+
returns: "Builder",
|
|
14
|
+
}),
|
|
15
|
+
...statement(6, exprStmt(assign(`this.${f.field}`, f.field))),
|
|
16
|
+
" return this;",
|
|
17
|
+
" }",
|
|
18
|
+
];
|
|
19
|
+
/** `<Op>Params`: the record over `fields`, its static `builder()`, and the builder's setters and `build()`. */
|
|
20
|
+
export function paramsRecord(name, id, fields) {
|
|
21
|
+
const setters = fields.flatMap(setterLines);
|
|
22
|
+
const checks = fields
|
|
23
|
+
.filter((f) => f.required)
|
|
24
|
+
.flatMap((f) => [
|
|
25
|
+
...statement(6, ifOpen(bin("==", f.field, "null"))),
|
|
26
|
+
...statement(8, throwStmt(newOf("IllegalStateException", [javaString(`${f.name} is required`)]))),
|
|
27
|
+
" }",
|
|
28
|
+
]);
|
|
29
|
+
return [
|
|
30
|
+
docOf(`The parameters of {@code ${id}}.`, ""),
|
|
31
|
+
...typeHeader(0, {
|
|
32
|
+
components: fields.map((f) => param(f.type, f.field)),
|
|
33
|
+
end: "{",
|
|
34
|
+
kind: "record",
|
|
35
|
+
modifiers: ["public"],
|
|
36
|
+
name,
|
|
37
|
+
}),
|
|
38
|
+
" /** A builder for the parameters: one setter per field. */",
|
|
39
|
+
" public static Builder builder() {",
|
|
40
|
+
" return new Builder();",
|
|
41
|
+
" }",
|
|
42
|
+
"",
|
|
43
|
+
" /** Builds the parameters; a required field left unset is an {@link IllegalStateException}. */",
|
|
44
|
+
" public static final class Builder {",
|
|
45
|
+
...fields.flatMap((f) => field(4, { modifiers: ["private"], name: f.field, type: f.type })),
|
|
46
|
+
...(fields.length > 0 ? [""] : []),
|
|
47
|
+
" private Builder() {}",
|
|
48
|
+
...setters,
|
|
49
|
+
"",
|
|
50
|
+
" /** Builds the parameters. */",
|
|
51
|
+
...methodHeader(4, { modifiers: ["public"], name: "build", params: [], returns: name }),
|
|
52
|
+
...checks,
|
|
53
|
+
...statement(6, returnStmt(newOf(name, fields.map((f) => f.field)))),
|
|
54
|
+
" }",
|
|
55
|
+
" }",
|
|
56
|
+
"}",
|
|
57
|
+
"",
|
|
58
|
+
];
|
|
59
|
+
}
|
|
60
|
+
/** `<Op>Body`: the multipart body record, one component per part, typed as its `Part` (`FilePart`, a list or text). */
|
|
61
|
+
export function multipartRecordLines(name, id, components) {
|
|
62
|
+
return [
|
|
63
|
+
docOf(`The multipart body of {@code ${id}}: one component per part.`, ""),
|
|
64
|
+
...typeHeader(0, {
|
|
65
|
+
components: components.map((c) => param(c.type, c.field)),
|
|
66
|
+
end: "{}",
|
|
67
|
+
kind: "record",
|
|
68
|
+
modifiers: ["public"],
|
|
69
|
+
name,
|
|
70
|
+
}),
|
|
71
|
+
"",
|
|
72
|
+
];
|
|
73
|
+
}
|
|
74
|
+
/** The `multipart` helper of a multipart body: null without a body, else the parts, one per component, in order. */
|
|
75
|
+
export function multipartHelper(op, env) {
|
|
76
|
+
const body = op.body;
|
|
77
|
+
if (body === undefined || body.kind !== "multipart")
|
|
78
|
+
return [];
|
|
79
|
+
const { components, name } = multipartRecord(op, body.parts, env.ctx, env.isArray);
|
|
80
|
+
const parts = components.map(({ field: component, name: part, type }) => {
|
|
81
|
+
const kind = type === "FilePart" ? "file" : type === "List<FilePart>" ? "files" : "text";
|
|
82
|
+
return call("Body.Part", kind, [javaString(part), call("body", component)]);
|
|
83
|
+
});
|
|
84
|
+
return [
|
|
85
|
+
...methodHeader(2, {
|
|
86
|
+
modifiers: ["private", "static"],
|
|
87
|
+
name: "multipart",
|
|
88
|
+
params: [param(name, "body")],
|
|
89
|
+
returns: "Body",
|
|
90
|
+
}),
|
|
91
|
+
...statement(4, ifOpen(bin("==", "body", "null"))),
|
|
92
|
+
" return null;",
|
|
93
|
+
" }",
|
|
94
|
+
...statement(4, local({ init: call("List", "of", parts), name: "parts", type: "List<Body.Part>" })),
|
|
95
|
+
" return Body.multipart(parts);",
|
|
96
|
+
" }",
|
|
97
|
+
"",
|
|
98
|
+
];
|
|
99
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type JavaPomMetadata } from "./gradle.ts";
|
|
2
|
+
import { type JavaCallPlan } from "./sdk-plan.ts";
|
|
3
|
+
import { type PackageIdentity } from "../shared/metadata.ts";
|
|
4
|
+
/** The package's options, each defaulted and validated. */
|
|
5
|
+
export type JavaSdkOptions = {
|
|
6
|
+
/** the Maven group id; `com.example` by default, the reserved example domain as the Go SDK's `example.com/sdk`: Maven
|
|
7
|
+
* Central publishes only under a group you own */
|
|
8
|
+
readonly groupId?: string;
|
|
9
|
+
/** the Maven artifact id and the root project's name; `sdk` by default */
|
|
10
|
+
readonly artifactId?: string;
|
|
11
|
+
/** the package of every type; the group id by default */
|
|
12
|
+
readonly packageName?: string;
|
|
13
|
+
/** the client class; `<Last package segment>Client` by default */
|
|
14
|
+
readonly clientName?: string;
|
|
15
|
+
/** the package version; `0.1.0` by default */
|
|
16
|
+
readonly version?: string;
|
|
17
|
+
} & JavaPomMetadata;
|
|
18
|
+
/**
|
|
19
|
+
* The SDK's files by path, and what the generation reports (bit 21 i6): a root member renamed off the safe mirror, a
|
|
20
|
+
* component emitted as `<Name>Model`.
|
|
21
|
+
*/
|
|
22
|
+
export type GeneratedJavaSdk = {
|
|
23
|
+
readonly files: Readonly<Record<string, string>>;
|
|
24
|
+
readonly notices: readonly string[];
|
|
25
|
+
/** the artifact as Maven Central lists it, `<groupId>:<artifactId>` */
|
|
26
|
+
readonly packages: readonly PackageIdentity[];
|
|
27
|
+
};
|
|
28
|
+
/** What the runtime holds besides the call surface: the mapper, `Opt` for a three-state field, the transport holder. */
|
|
29
|
+
export type JavaRuntimeFeatures = {
|
|
30
|
+
readonly json: boolean;
|
|
31
|
+
readonly opt: boolean;
|
|
32
|
+
/** the exchange machinery: the call runtime, its errors, its results */
|
|
33
|
+
readonly operations: boolean;
|
|
34
|
+
/** the phase-a transport holder, which a document with no operation ships alone */
|
|
35
|
+
readonly transport: boolean;
|
|
36
|
+
/** the WebSocket runtime, which a document with a WebSocket or realtime operation ships (realtime dials through it) */
|
|
37
|
+
readonly ws: boolean;
|
|
38
|
+
/** the realtime runtime, which only a document with a realtime operation ships */
|
|
39
|
+
readonly realtime: boolean;
|
|
40
|
+
};
|
|
41
|
+
/** The vendored runtime's files by class name, read from disk on every call, in `packageName`; every file by default. */
|
|
42
|
+
export declare function runtimeFiles(packageName: string, features?: JavaRuntimeFeatures): Record<string, string>;
|
|
43
|
+
/** The package's files for `document`, by path, in code-unit order. */
|
|
44
|
+
export declare function generateJavaSdk(document: Record<string, unknown>, options?: JavaSdkOptions): GeneratedJavaSdk;
|
|
45
|
+
/**
|
|
46
|
+
* Each operation's call plan by id, from the very emit `generateJavaSdk` runs with these options: the names the fixed
|
|
47
|
+
* reflection driver walks, never re-derived outside the emitter.
|
|
48
|
+
*/
|
|
49
|
+
export declare function javaCallPlans(document: Record<string, unknown>, options?: JavaSdkOptions): Readonly<Record<string, JavaCallPlan>>;
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Java SDK as files (bit 16, R5): `generateJavaSdk` writes the Gradle build, the client and the vendored runtime
|
|
3
|
+
* for a document. Phase a's client has no operation yet: `<Client>.builder().baseUrl(…).build()` holds one transport,
|
|
4
|
+
* whose `HttpClient` follows no redirect on its own (R2 owns the follow loop) and is never closed (`--release 17` has
|
|
5
|
+
* no `HttpClient.close`). The emitted Java is google-java-format's canonical form by construction (format.test.ts).
|
|
6
|
+
*/
|
|
7
|
+
import { readFileSync } from "node:fs";
|
|
8
|
+
import { compareCodeUnits } from "../shared/lang.js";
|
|
9
|
+
import { buildGradle, pomOf, settingsGradle, validateArtifactId, validateClientName, validateGroupId, validatePackageName, validateVersion, } from "./gradle.js";
|
|
10
|
+
import { componentDecls, modelFiles, putFile } from "./sdk-models.js";
|
|
11
|
+
import { errorClassFiles, errorKeyFiles } from "./sdk-errors.js";
|
|
12
|
+
import { surfaceOf } from "./sdk-client.js";
|
|
13
|
+
import { mirrorOf } from "./sdk-mirror.js";
|
|
14
|
+
import { renameNotice } from "../shared/mirror.js";
|
|
15
|
+
import { packageOn } from "../shared/metadata.js";
|
|
16
|
+
import { javaTypeContext } from "./models.js";
|
|
17
|
+
import { SSE_FILES } from "./sse.js";
|
|
18
|
+
import { REALTIME_FILES } from "./realtime.js";
|
|
19
|
+
import { WS_FILES } from "./ws.js";
|
|
20
|
+
import { sdkModel } from "../../ir/sdk-model.js";
|
|
21
|
+
import { toIR } from "../../ir/build.js";
|
|
22
|
+
/** The marker on line 1 of every emitted file. */
|
|
23
|
+
const MARKER = "// @generated by honey. DO NOT EDIT.";
|
|
24
|
+
/* the package line of every vendored runtime file */
|
|
25
|
+
const RUNTIME_PACKAGE = /^package honey\.runtime;$/m;
|
|
26
|
+
/** The validated package for `options`. */
|
|
27
|
+
function packageOf(options) {
|
|
28
|
+
const groupId = validateGroupId(options.groupId ?? "com.example");
|
|
29
|
+
const packageName = validatePackageName(options.packageName ?? groupId);
|
|
30
|
+
const last = packageName.split(".").at(-1);
|
|
31
|
+
return {
|
|
32
|
+
artifactId: validateArtifactId(options.artifactId ?? "sdk"),
|
|
33
|
+
clientName: validateClientName(options.clientName ?? `${last.charAt(0).toUpperCase()}${last.slice(1)}Client`),
|
|
34
|
+
groupId,
|
|
35
|
+
packageName,
|
|
36
|
+
version: validateVersion(options.version ?? "0.1.0"),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/** The client class: its builder takes the base URL and builds the one transport. */
|
|
40
|
+
const clientJava = (pkg) => `package ${pkg.packageName};
|
|
41
|
+
|
|
42
|
+
import java.net.URI;
|
|
43
|
+
|
|
44
|
+
/** The client for the API. Build one with {@link #builder()}. */
|
|
45
|
+
public final class ${pkg.clientName} {
|
|
46
|
+
private final Transport transport;
|
|
47
|
+
|
|
48
|
+
private ${pkg.clientName}(Transport transport) {
|
|
49
|
+
this.transport = transport;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** A builder for a client; the base URL is required. */
|
|
53
|
+
public static Builder builder() {
|
|
54
|
+
return new Builder();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Builds an {@link ${pkg.clientName}}. */
|
|
58
|
+
public static final class Builder {
|
|
59
|
+
private URI baseUrl;
|
|
60
|
+
|
|
61
|
+
private Builder() {}
|
|
62
|
+
|
|
63
|
+
/** Sets the base URL that every request resolves against. */
|
|
64
|
+
public Builder baseUrl(String baseUrl) {
|
|
65
|
+
this.baseUrl = URI.create(baseUrl);
|
|
66
|
+
return this;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Builds the client; throws {@link IllegalStateException} when no base URL was set. */
|
|
70
|
+
public ${pkg.clientName} build() {
|
|
71
|
+
if (baseUrl == null) {
|
|
72
|
+
throw new IllegalStateException("baseUrl is required");
|
|
73
|
+
}
|
|
74
|
+
return new ${pkg.clientName}(new Transport(baseUrl));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
`;
|
|
79
|
+
/** The vendored runtime's operation files, the exchange machinery a call needs. */
|
|
80
|
+
const OPERATION_FILES = [
|
|
81
|
+
"ApiException",
|
|
82
|
+
"Answer",
|
|
83
|
+
"BinaryBody",
|
|
84
|
+
"Body",
|
|
85
|
+
"Call",
|
|
86
|
+
"CallLog",
|
|
87
|
+
"ClientConfig",
|
|
88
|
+
"Credential",
|
|
89
|
+
"Decode",
|
|
90
|
+
"Deadline",
|
|
91
|
+
"ErrorEnvelope",
|
|
92
|
+
"Envelope",
|
|
93
|
+
"Exchange",
|
|
94
|
+
"Flight",
|
|
95
|
+
"FilePart",
|
|
96
|
+
"HoneyException",
|
|
97
|
+
"Hops",
|
|
98
|
+
"Hooks",
|
|
99
|
+
"LogEntry",
|
|
100
|
+
"Operation",
|
|
101
|
+
"RawResponse",
|
|
102
|
+
"RedirectPolicy",
|
|
103
|
+
"Redirects",
|
|
104
|
+
"RequestContext",
|
|
105
|
+
"RequestHook",
|
|
106
|
+
"RequestOptions",
|
|
107
|
+
"Result",
|
|
108
|
+
"ResponseContext",
|
|
109
|
+
"ResponseHook",
|
|
110
|
+
"SdkException",
|
|
111
|
+
"UrlPath",
|
|
112
|
+
"UrlQuery",
|
|
113
|
+
];
|
|
114
|
+
/** The vendored runtime's files by class name, read from disk on every call, in `packageName`; every file by default. */
|
|
115
|
+
export function runtimeFiles(packageName, features = {
|
|
116
|
+
json: true,
|
|
117
|
+
opt: true,
|
|
118
|
+
operations: true,
|
|
119
|
+
realtime: true,
|
|
120
|
+
transport: true,
|
|
121
|
+
ws: true,
|
|
122
|
+
}) {
|
|
123
|
+
const names = [
|
|
124
|
+
...(features.json ? ["Json"] : []),
|
|
125
|
+
...(features.opt ? ["Opt"] : []),
|
|
126
|
+
...(features.transport ? ["Transport"] : []),
|
|
127
|
+
...(features.operations ? [...OPERATION_FILES, ...STALE_FILES, ...SSE_FILES] : []),
|
|
128
|
+
...(features.ws ? WS_FILES : []),
|
|
129
|
+
...(features.realtime ? REALTIME_FILES : []),
|
|
130
|
+
];
|
|
131
|
+
return Object.fromEntries(names.map((name) => [
|
|
132
|
+
name,
|
|
133
|
+
readFileSync(new URL(`../../runtime/java/${name}.java`, import.meta.url), "utf8").replace(RUNTIME_PACKAGE, () => `package ${packageName};`),
|
|
134
|
+
]));
|
|
135
|
+
}
|
|
136
|
+
/** The exchange's stale tracking, shipped with every exchange: the tracker, its config and the read's view. */
|
|
137
|
+
const STALE_FILES = ["InvalidationConfig", "StaleMeta", "StaleTracker"];
|
|
138
|
+
/** The package's files for `document`, by path, in code-unit order. */
|
|
139
|
+
export function generateJavaSdk(document, options = {}) {
|
|
140
|
+
const { files, notices } = emitJava(document, options);
|
|
141
|
+
const { artifactId, groupId, version } = packageOf(options);
|
|
142
|
+
return { files, notices, packages: [packageOn("maven-central", `${groupId}:${artifactId}`, version)] };
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Each operation's call plan by id, from the very emit `generateJavaSdk` runs with these options: the names the fixed
|
|
146
|
+
* reflection driver walks, never re-derived outside the emitter.
|
|
147
|
+
*/
|
|
148
|
+
export function javaCallPlans(document, options = {}) {
|
|
149
|
+
return Object.fromEntries(emitJava(document, options).plans.map((plan) => [plan.operation, plan]));
|
|
150
|
+
}
|
|
151
|
+
/** The runtime files an SDK of `ops` and the component declarations `decls` ships. */
|
|
152
|
+
function featuresOf(ops, decls) {
|
|
153
|
+
const operations = ops.length > 0;
|
|
154
|
+
return {
|
|
155
|
+
json: decls.size > 0 || operations,
|
|
156
|
+
operations,
|
|
157
|
+
opt: [...decls.values()].some((decl) => /\bOpt</.test(decl)) || operations,
|
|
158
|
+
realtime: ops.some((op) => op.stream === "realtime"),
|
|
159
|
+
transport: !operations,
|
|
160
|
+
ws: ops.some((op) => op.stream === "ws" || op.stream === "realtime"),
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
/** The package's files and the call plans, from one emit. */
|
|
164
|
+
function emitJava(document, options) {
|
|
165
|
+
const pkg = packageOf(options);
|
|
166
|
+
const dir = `src/main/java/${pkg.packageName.replaceAll(".", "/")}`;
|
|
167
|
+
/* an operation without an operationId is named by the IR's derivation, as every sibling emitter asks */
|
|
168
|
+
const ir = toIR(document, { deriveOperationIds: true });
|
|
169
|
+
const pom = pomOf(options, ir.info);
|
|
170
|
+
const model = sdkModel(ir);
|
|
171
|
+
const ctx = javaTypeContext(ir, [pkg.clientName]);
|
|
172
|
+
const isArray = (schema) => model.resolve(schema).kind === "array";
|
|
173
|
+
const operations = model.ops.length > 0;
|
|
174
|
+
const env = {
|
|
175
|
+
client: pkg.clientName,
|
|
176
|
+
ctx,
|
|
177
|
+
isArray,
|
|
178
|
+
marker: MARKER,
|
|
179
|
+
notices: [],
|
|
180
|
+
ops: model.opsById,
|
|
181
|
+
packageName: pkg.packageName,
|
|
182
|
+
};
|
|
183
|
+
const surface = operations ? surfaceOf(ir, env) : { files: {}, plans: [] };
|
|
184
|
+
const errors = operations
|
|
185
|
+
? {
|
|
186
|
+
...errorClassFiles(dir, pkg.packageName, MARKER),
|
|
187
|
+
...errorKeyFiles(model, ctx, { dir, marker: MARKER, packageName: pkg.packageName }),
|
|
188
|
+
}
|
|
189
|
+
: {};
|
|
190
|
+
const decls = componentDecls(ir, ctx);
|
|
191
|
+
/* the mirror's names are claimed last, after every normal one (the components' own hoists included) */
|
|
192
|
+
const mirror = operations ? mirrorOf(ir, env) : {};
|
|
193
|
+
const runtime = Object.entries(runtimeFiles(pkg.packageName, featuresOf(model.ops, decls))).map(([name, text]) => [`${dir}/${name}.java`, text]);
|
|
194
|
+
const client = operations ? mirror[`${pkg.clientName}.java`] : `${MARKER}\n${clientJava(pkg)}`;
|
|
195
|
+
const entries = [
|
|
196
|
+
["build.gradle", `${MARKER}\n${buildGradle(pkg, pom)}`],
|
|
197
|
+
["settings.gradle", `${MARKER}\n${settingsGradle(pkg)}`],
|
|
198
|
+
[`${dir}/${pkg.clientName}.java`, client],
|
|
199
|
+
...runtime,
|
|
200
|
+
...Object.entries(modelFiles(decls, { dir, marker: MARKER, packageName: pkg.packageName })),
|
|
201
|
+
...Object.entries(errors),
|
|
202
|
+
...Object.entries({ ...surface.files, ...mirror })
|
|
203
|
+
.filter(([name]) => name !== `${pkg.clientName}.java`)
|
|
204
|
+
.map(([name, text]) => [`${dir}/${name}`, text]),
|
|
205
|
+
];
|
|
206
|
+
/* one declaration per file: a second claim of a path throws, never overwrites */
|
|
207
|
+
const files = {};
|
|
208
|
+
for (const [path, text] of entries)
|
|
209
|
+
putFile(files, path, text);
|
|
210
|
+
const renamed = ctx.names.renamed.map((rename) => renameNotice("java", rename));
|
|
211
|
+
return {
|
|
212
|
+
files: Object.fromEntries(Object.entries(files).sort(([a], [b]) => compareCodeUnits(a, b))),
|
|
213
|
+
notices: [...new Set([...env.notices, ...renamed])],
|
|
214
|
+
plans: surface.plans,
|
|
215
|
+
};
|
|
216
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An SSE operation's method (bit 16 phase d1, J1/J3/J7; C#'s `sse.ts`): `EventStream<T>`, `T` the declared event
|
|
3
|
+
* schema's type, or `EventStream<String>` for untyped events, opened by the call through the exchange's `events`, so an
|
|
4
|
+
* error status throws before any event. Its cursor field, `lastEventId`, is sent as Last-Event-ID only when set and
|
|
5
|
+
* non-empty; a declared Last-Event-ID header param folds into it. A stream method is the same text in either mode: it
|
|
6
|
+
* answers no Result. Its javadoc says how a stream lets its connection go (F1: a for-each `break` has no close hook).
|
|
7
|
+
*/
|
|
8
|
+
import type { SdkOp } from "../../ir/sdk-model.ts";
|
|
9
|
+
import { type JavaTypeContext } from "./models.ts";
|
|
10
|
+
import type { JavaHeaders } from "./sdk-headers.ts";
|
|
11
|
+
/** The header an SSE open resumes an event stream with. */
|
|
12
|
+
export declare const LAST_EVENT_ID = "Last-Event-ID";
|
|
13
|
+
/** The cursor's Params field. */
|
|
14
|
+
export declare const CURSOR = "lastEventId";
|
|
15
|
+
/** Whether a declared header param is Last-Event-ID (any casing), the resume channel the cursor field carries. */
|
|
16
|
+
export declare const isLastEventIdHeader: (name: string) => boolean;
|
|
17
|
+
/** F1's doc obligation: how a stream lets its connection go. */
|
|
18
|
+
export declare const RELEASE = "Open it in try-with-resources: a for-each break without one keeps the connection.";
|
|
19
|
+
/** The SSE runtime's files: the stream, its event, the parser and the body's pump; core, with every exchange. */
|
|
20
|
+
export declare const SSE_FILES: string[];
|
|
21
|
+
/** The type an SSE op's events decode to: the declared event schema's, else `String`. */
|
|
22
|
+
export declare const eventTypeOf: (op: SdkOp, ctx: JavaTypeContext) => string;
|
|
23
|
+
/** What an SSE method's lines need: its name and constant, its Params, its headers holder, and its Call's lines. */
|
|
24
|
+
export type SseSite = {
|
|
25
|
+
readonly name: string;
|
|
26
|
+
readonly constant: string;
|
|
27
|
+
readonly params: string;
|
|
28
|
+
readonly headers: JavaHeaders | null;
|
|
29
|
+
readonly call: readonly string[];
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* An SSE method's lines: `op(params)` and `op(params, options)`, and `op(params, headersInto, options)` for an operation
|
|
33
|
+
* with response headers, filled at the open; the shorter overloads delegate to the longest.
|
|
34
|
+
*/
|
|
35
|
+
export declare function sseMethodLines(op: SdkOp, site: SseSite, ctx: JavaTypeContext): string[];
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { javaTypeOf } from "./models.js";
|
|
2
|
+
import { bin, call as callOf, cond, methodHeader, param, newOf, ref, returnStmt, statement, } from "./layout.js";
|
|
3
|
+
import { docOf } from "./sdk-decl.js";
|
|
4
|
+
/** The header an SSE open resumes an event stream with. */
|
|
5
|
+
export const LAST_EVENT_ID = "Last-Event-ID";
|
|
6
|
+
/** The cursor's Params field. */
|
|
7
|
+
export const CURSOR = "lastEventId";
|
|
8
|
+
/** Whether a declared header param is Last-Event-ID (any casing), the resume channel the cursor field carries. */
|
|
9
|
+
export const isLastEventIdHeader = (name) => name.toLowerCase() === LAST_EVENT_ID.toLowerCase();
|
|
10
|
+
/** F1's doc obligation: how a stream lets its connection go. */
|
|
11
|
+
export const RELEASE = "Open it in try-with-resources: a for-each break without one keeps the connection.";
|
|
12
|
+
/** The SSE runtime's files: the stream, its event, the parser and the body's pump; core, with every exchange. */
|
|
13
|
+
export const SSE_FILES = ["EventStream", "Pump", "Sse", "SseEvent"];
|
|
14
|
+
/** The type an SSE op's events decode to: the declared event schema's, else `String`. */
|
|
15
|
+
export const eventTypeOf = (op, ctx) => op.events === undefined ? "String" : javaTypeOf(op.events, { ...ctx, fieldName: "Event", parentName: op.id });
|
|
16
|
+
/**
|
|
17
|
+
* An SSE method's lines: `op(params)` and `op(params, options)`, and `op(params, headersInto, options)` for an operation
|
|
18
|
+
* with response headers, filled at the open; the shorter overloads delegate to the longest.
|
|
19
|
+
*/
|
|
20
|
+
export function sseMethodLines(op, site, ctx) {
|
|
21
|
+
const { call, constant, headers, name, params } = site;
|
|
22
|
+
const type = eventTypeOf(op, ctx);
|
|
23
|
+
const doc = docOf(`${op.id}: the open stream. An error status throws before any event, and no timeout bounds it after that. ${RELEASE}`);
|
|
24
|
+
const signature = (args) => methodHeader(2, { modifiers: ["public"], name, params: args, returns: `EventStream<${type}>` });
|
|
25
|
+
const holder = headers === null ? "null" : cond(bin("==", "headersInto", "null"), "null", ref("headersInto", "read"));
|
|
26
|
+
const open = [
|
|
27
|
+
...call,
|
|
28
|
+
...statement(4, returnStmt(callOf("exchange", "events", [constant, "call", "options", holder, newOf(`TypeReference<${type}>`, [], true)]))),
|
|
29
|
+
];
|
|
30
|
+
const delegate = (args) => statement(4, returnStmt(callOf(null, name, args)));
|
|
31
|
+
const longest = headers === null ? open : delegate(["params", "null", "options"]);
|
|
32
|
+
return [
|
|
33
|
+
doc,
|
|
34
|
+
...signature([param(params, "params")]),
|
|
35
|
+
...delegate(headers === null ? ["params", "null"] : ["params", "null", "null"]),
|
|
36
|
+
" }",
|
|
37
|
+
"",
|
|
38
|
+
doc,
|
|
39
|
+
...signature([param(params, "params"), param("RequestOptions", "options")]),
|
|
40
|
+
...longest,
|
|
41
|
+
" }",
|
|
42
|
+
"",
|
|
43
|
+
...(headers === null
|
|
44
|
+
? []
|
|
45
|
+
: [
|
|
46
|
+
doc,
|
|
47
|
+
...signature([
|
|
48
|
+
param(params, "params"),
|
|
49
|
+
param(headers.type, "headersInto"),
|
|
50
|
+
param("RequestOptions", "options"),
|
|
51
|
+
]),
|
|
52
|
+
...open,
|
|
53
|
+
" }",
|
|
54
|
+
"",
|
|
55
|
+
]),
|
|
56
|
+
];
|
|
57
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A WebSocket operation's method (bit 16 phase d2a, K1/K2/K3; C#'s `ws.ts`): `TypedWebSocket`, dialed by the call
|
|
3
|
+
* through `WsDial.open` (no hook and no log), so a refused handshake throws before the method returns. The entry
|
|
4
|
+
* sits in the gated WebSocket files, as C#'s `SocketAsync` in WsDial.cs: an SDK without a socket references none. Its
|
|
5
|
+
* fields, `protocols` (offered in order) and `reconnectToken` (sent as `reconnect_token` after the declared query, only
|
|
6
|
+
* when set and non-empty); a declared `reconnect_token` query folds into the token, and a param spelled like either
|
|
7
|
+
* field claims `…2`. A socket method is the same text in either mode: it answers no Result.
|
|
8
|
+
*/
|
|
9
|
+
import type { SdkOp } from "../../ir/sdk-model.ts";
|
|
10
|
+
/** The query param the token travels in. */
|
|
11
|
+
export declare const RECONNECT_TOKEN = "reconnect_token";
|
|
12
|
+
/** The socket's Params fields: the subprotocols offered, then the resume token. */
|
|
13
|
+
export declare const PROTOCOLS = "protocols";
|
|
14
|
+
export declare const TOKEN = "reconnectToken";
|
|
15
|
+
/** Whether a declared query param is reconnect_token, the resume channel the token field carries. */
|
|
16
|
+
export declare const isReconnectTokenQuery: (name: string) => name is "reconnect_token";
|
|
17
|
+
/** The WebSocket runtime's files: the socket and its parts; only an SDK with a WebSocket operation ships them. */
|
|
18
|
+
export declare const WS_FILES: string[];
|
|
19
|
+
/** What a socket method's lines need: its name and constant, its Params, and its Call's lines. */
|
|
20
|
+
export type WsSite = {
|
|
21
|
+
readonly name: string;
|
|
22
|
+
readonly constant: string;
|
|
23
|
+
readonly params: string;
|
|
24
|
+
readonly call: readonly string[];
|
|
25
|
+
};
|
|
26
|
+
/** A socket method's lines: `op(params)`, delegating to `op(params, options)`, which dials. */
|
|
27
|
+
export declare function wsMethodLines(op: SdkOp, site: WsSite): string[];
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { call as callOf, methodHeader, param, returnStmt, statement } from "./layout.js";
|
|
2
|
+
import { docOf } from "./sdk-decl.js";
|
|
3
|
+
/** The query param the token travels in. */
|
|
4
|
+
export const RECONNECT_TOKEN = "reconnect_token";
|
|
5
|
+
/** The socket's Params fields: the subprotocols offered, then the resume token. */
|
|
6
|
+
export const PROTOCOLS = "protocols";
|
|
7
|
+
export const TOKEN = "reconnectToken";
|
|
8
|
+
/** Whether a declared query param is reconnect_token, the resume channel the token field carries. */
|
|
9
|
+
export const isReconnectTokenQuery = (name) => name === RECONNECT_TOKEN;
|
|
10
|
+
/** The WebSocket runtime's files: the socket and its parts; only an SDK with a WebSocket operation ships them. */
|
|
11
|
+
export const WS_FILES = ["Keepalive", "Socket", "TypedWebSocket", "WsClose", "WsDial", "WsMessage"];
|
|
12
|
+
/** A socket method's lines: `op(params)`, delegating to `op(params, options)`, which dials. */
|
|
13
|
+
export function wsMethodLines(op, site) {
|
|
14
|
+
const { call, constant, name, params } = site;
|
|
15
|
+
const doc = docOf(`${op.id}: the open socket. A refused handshake throws; once open, no timeout bounds it. Close it, or open it in try-with-resources.`);
|
|
16
|
+
const signature = (args) => methodHeader(2, { modifiers: ["public"], name, params: args, returns: "TypedWebSocket" });
|
|
17
|
+
const dial = callOf("WsDial", "open", ["exchange", constant, "call", "options", callOf("params", "protocols")]);
|
|
18
|
+
return [
|
|
19
|
+
doc,
|
|
20
|
+
...signature([param(params, "params")]),
|
|
21
|
+
...statement(4, returnStmt(callOf(null, name, ["params", "null"]))),
|
|
22
|
+
" }",
|
|
23
|
+
"",
|
|
24
|
+
doc,
|
|
25
|
+
...signature([param(params, "params"), param("RequestOptions", "options")]),
|
|
26
|
+
...call,
|
|
27
|
+
...statement(4, returnStmt(dial)),
|
|
28
|
+
" }",
|
|
29
|
+
"",
|
|
30
|
+
];
|
|
31
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A tool's annotations (bit 18 phase d), by its operation's method, each hint written only where it differs from the
|
|
3
|
+
* spec's default (readOnly false, destructive true, idempotent false, openWorld true), so no token is spent saying the
|
|
4
|
+
* default: GET and HEAD read only; a POST not destructive, and idempotent when it takes an idempotency key; PUT and
|
|
5
|
+
* DELETE idempotent, destructive as the default says; PATCH and any other method none at all.
|
|
6
|
+
*/
|
|
7
|
+
import type { SdkOp } from "../../ir/sdk-model.ts";
|
|
8
|
+
/** The hints a tool's annotations hold. */
|
|
9
|
+
export type Annotations = {
|
|
10
|
+
readonly readOnlyHint?: true;
|
|
11
|
+
readonly destructiveHint?: false;
|
|
12
|
+
readonly idempotentHint?: true;
|
|
13
|
+
};
|
|
14
|
+
/** `op`'s annotations, or none when every hint is the default. */
|
|
15
|
+
export declare function annotationsOf(op: SdkOp): Annotations | undefined;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** `op`'s annotations, or none when every hint is the default. */
|
|
2
|
+
export function annotationsOf(op) {
|
|
3
|
+
switch (op.method.toUpperCase()) {
|
|
4
|
+
case "GET":
|
|
5
|
+
case "HEAD":
|
|
6
|
+
return { readOnlyHint: true };
|
|
7
|
+
case "POST":
|
|
8
|
+
return op.idempotent ? { destructiveHint: false, idempotentHint: true } : { destructiveHint: false };
|
|
9
|
+
case "PUT":
|
|
10
|
+
case "DELETE":
|
|
11
|
+
return { idempotentHint: true };
|
|
12
|
+
default:
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A tool's file argument as its inputSchema shows it (bit 21 c): the provisional file-uploads extension's FileInput
|
|
3
|
+
* (its draft at PR head 6101d34), an object schema marked `x-mcp-file` requiring the members the draft
|
|
4
|
+
* requires (id, mimeType, size, digest), the digest's algorithm SHA-256; or honey's `{path}`, a file the stdio server
|
|
5
|
+
* reads under its root. Members a type alone would state are not declared (a host taking the extension knows them, and
|
|
6
|
+
* a model is not to see them): runtime/mcp/files.ts checks the values, 38 tokens a file argument spared. A mounted
|
|
7
|
+
* tool's (bit 21 g) takes an https URL in place of the path. The emitter's half of the extension: its keyword is named
|
|
8
|
+
* here and nowhere else in gen.
|
|
9
|
+
*/
|
|
10
|
+
import type { JsonSchema } from "./schema.ts";
|
|
11
|
+
/** A file argument's schema: the extension's FileInput, or a path the server reads. */
|
|
12
|
+
export declare const FILE_SCHEMA: JsonSchema;
|
|
13
|
+
/**
|
|
14
|
+
* A mounted tool's file argument (bit 21 g): the FileInput (inline, or uploaded through the extension's flow), or an
|
|
15
|
+
* https URL the app fetches; a mount that fetches none shows the FileInput alone (runtime/mcp/mount.ts). A mount reads
|
|
16
|
+
* no path, so it shows none.
|
|
17
|
+
*/
|
|
18
|
+
export declare const MOUNTED_FILE_SCHEMA: JsonSchema;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
const STRING = { type: "string" };
|
|
2
|
+
/** The extension's FileInput, marked: the members it requires, the digest's algorithm SHA-256. */
|
|
3
|
+
const FILE_INPUT = {
|
|
4
|
+
type: "object",
|
|
5
|
+
"x-mcp-file": {},
|
|
6
|
+
properties: {
|
|
7
|
+
digest: {
|
|
8
|
+
type: "object",
|
|
9
|
+
properties: { algorithm: { const: "sha-256" }, value: STRING },
|
|
10
|
+
required: ["algorithm", "value"],
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
required: ["id", "mimeType", "size", "digest"],
|
|
14
|
+
};
|
|
15
|
+
/** A file argument's schema: the extension's FileInput, or a path the server reads. */
|
|
16
|
+
export const FILE_SCHEMA = {
|
|
17
|
+
anyOf: [
|
|
18
|
+
FILE_INPUT,
|
|
19
|
+
{
|
|
20
|
+
type: "object",
|
|
21
|
+
properties: { path: { type: "string", description: "A file under the server's file root" } },
|
|
22
|
+
required: ["path"],
|
|
23
|
+
additionalProperties: false,
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* A mounted tool's file argument (bit 21 g): the FileInput (inline, or uploaded through the extension's flow), or an
|
|
29
|
+
* https URL the app fetches; a mount that fetches none shows the FileInput alone (runtime/mcp/mount.ts). A mount reads
|
|
30
|
+
* no path, so it shows none.
|
|
31
|
+
*/
|
|
32
|
+
export const MOUNTED_FILE_SCHEMA = {
|
|
33
|
+
anyOf: [
|
|
34
|
+
FILE_INPUT,
|
|
35
|
+
{
|
|
36
|
+
type: "object",
|
|
37
|
+
properties: { url: { type: "string", description: "An https URL the server fetches" } },
|
|
38
|
+
required: ["url"],
|
|
39
|
+
additionalProperties: false,
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/** The MCP server emitter's entry (bit 18): its generator and the shapes it takes and returns. */
|
|
2
|
+
export { type GeneratedMcpServer, generateMcpServer, type McpServerOptions } from "./server.ts";
|
|
3
|
+
export { type GeneratedMcpHandler, generateMcpHandler, type McpHandlerOptions } from "./mounted.ts";
|