@workerstack/clients 1.0.0-rc.26 → 1.0.0-rc.28
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/README.md +43 -43
- package/bin/{honey-clients.js → clients.js} +12 -12
- package/dist/cli.d.ts +3 -3
- package/dist/cli.js +14 -14
- package/dist/emit/cli/discovery.js +1 -1
- package/dist/emit/cli/install.js +2 -2
- package/dist/emit/cli/layout.js +1 -1
- package/dist/emit/cli/module.js +1 -1
- package/dist/emit/cli/release.js +1 -1
- package/dist/emit/csharp/errors.js +1 -1
- package/dist/emit/csharp/sdk-client.js +1 -1
- package/dist/emit/csharp/sdk-csproj.d.ts +1 -1
- package/dist/emit/csharp/sdk-csproj.js +2 -2
- package/dist/emit/csharp/sdk.d.ts +1 -1
- package/dist/emit/csharp/sdk.js +2 -2
- package/dist/emit/csharp/transport.js +2 -2
- package/dist/emit/csharp/types-record.d.ts +1 -1
- package/dist/emit/go/sdk-client.js +1 -1
- package/dist/emit/go/sdk.js +1 -1
- package/dist/emit/java/sdk-errors.js +5 -5
- package/dist/emit/java/sdk-op.d.ts +1 -1
- package/dist/emit/java/sdk.js +3 -3
- package/dist/emit/mcp/files.d.ts +1 -1
- package/dist/emit/mcp/mounted.js +2 -2
- package/dist/emit/mcp/runtime.js +1 -1
- package/dist/emit/mcp/server.js +1 -1
- package/dist/emit/python/errors.js +1 -1
- package/dist/emit/python/sdk-client.js +2 -2
- package/dist/emit/python/sdk-pyproject.js +4 -4
- package/dist/emit/python/sdk.d.ts +1 -1
- package/dist/emit/python/sdk.js +11 -11
- package/dist/emit/python/transport.js +1 -1
- package/dist/emit/rust/errors.js +2 -2
- package/dist/emit/rust/sdk-cargo.js +3 -3
- package/dist/emit/rust/sdk.d.ts +1 -1
- package/dist/emit/rust/sdk.js +2 -2
- package/dist/emit/shared/format.d.ts +1 -1
- package/dist/emit/shared/metadata.d.ts +1 -1
- package/dist/emit/shared/status-keys.d.ts +1 -1
- package/dist/emit/shared/status-keys.js +1 -1
- package/dist/emit/ts/app-client.js +2 -2
- package/dist/emit/ts/route-tree.d.ts +1 -1
- package/dist/emit/ts/route-tree.js +1 -12
- package/dist/emit/ts/sdk-types-preamble.js +16 -16
- package/dist/emit/ts/sdk-types.js +6 -6
- package/dist/emit/ts/tanstack-query.js +5 -5
- package/dist/emit/ts/type-gen.d.ts +4 -3
- package/dist/emit/ts/type-gen.js +86 -45
- package/dist/extract/chain.d.ts +10 -6
- package/dist/extract/chain.js +5 -19
- package/dist/extract/extract.d.ts +2 -2
- package/dist/extract/extract.js +40 -26
- package/dist/extract/serialize.js +1 -1
- package/dist/extract/walk.d.ts +15 -4
- package/dist/extract/walk.js +159 -15
- package/dist/gen/args.js +3 -3
- package/dist/gen/formatters.d.ts +6 -6
- package/dist/gen/formatters.js +7 -7
- package/dist/gen/process.d.ts +3 -3
- package/dist/gen/process.js +7 -7
- package/dist/gen/targets.d.ts +3 -3
- package/dist/gen/targets.js +3 -3
- package/dist/gen/write.d.ts +1 -1
- package/dist/gen/write.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/ir/load.js +10 -10
- package/dist/ir/model.d.ts +6 -4
- package/dist/ir/sdk-model.d.ts +1 -1
- package/dist/ir/sdk-model.js +1 -1
- package/dist/ir/slots.d.ts +3 -3
- package/dist/ir/slots.js +12 -10
- package/dist/release/bootstrap.js +1 -1
- package/dist/release/bump-command.js +1 -1
- package/dist/release/cli.d.ts +4 -4
- package/dist/release/cli.js +6 -6
- package/dist/release/context.d.ts +1 -1
- package/dist/release/context.js +1 -1
- package/dist/release/digest.d.ts +1 -1
- package/dist/release/digest.js +2 -2
- package/dist/release/index.d.ts +1 -1
- package/dist/release/load.js +1 -1
- package/dist/release/manifest.js +1 -1
- package/dist/release/registries.js +3 -3
- package/dist/release/release-workflow.js +1 -1
- package/dist/release/spec-gate.d.ts +2 -2
- package/dist/release/spec-gate.js +2 -2
- package/dist/release/sync-command.d.ts +1 -1
- package/dist/release/sync-command.js +1 -1
- package/dist/release/sync-tree.js +1 -1
- package/dist/release/types.d.ts +6 -6
- package/dist/runtime/cli/body.go +1 -1
- package/dist/runtime/cli/config.go +3 -3
- package/dist/runtime/cli/discovery.go +1 -1
- package/dist/runtime/cli/format.go +1 -1
- package/dist/runtime/cli/log.go +1 -1
- package/dist/runtime/cli/output.go +1 -1
- package/dist/runtime/cli/params.go +1 -1
- package/dist/runtime/cli/run.go +1 -1
- package/dist/runtime/cli/socket.go +1 -1
- package/dist/runtime/cli/stream.go +1 -1
- package/dist/runtime/cli/target.go +1 -1
- package/dist/runtime/csharp/Adapters.cs +2 -2
- package/dist/runtime/csharp/Auth.cs +2 -2
- package/dist/runtime/csharp/Body.cs +3 -3
- package/dist/runtime/csharp/Config.cs +2 -2
- package/dist/runtime/csharp/Envelope.cs +3 -3
- package/dist/runtime/csharp/Errors.cs +10 -10
- package/dist/runtime/csharp/Events.cs +2 -2
- package/dist/runtime/csharp/Exchange.cs +4 -4
- package/dist/runtime/csharp/Handler.cs +3 -3
- package/dist/runtime/csharp/Hooks.cs +3 -3
- package/dist/runtime/csharp/Invalidation.cs +2 -2
- package/dist/runtime/csharp/Json.cs +2 -2
- package/dist/runtime/csharp/Log.cs +2 -2
- package/dist/runtime/csharp/Operation.cs +2 -2
- package/dist/runtime/csharp/Path.cs +2 -2
- package/dist/runtime/csharp/Query.cs +2 -2
- package/dist/runtime/csharp/Realtime.cs +2 -2
- package/dist/runtime/csharp/RealtimeLoop.cs +3 -3
- package/dist/runtime/csharp/Redirect.cs +2 -2
- package/dist/runtime/csharp/Result.cs +2 -2
- package/dist/runtime/csharp/Sse.cs +2 -2
- package/dist/runtime/csharp/Stale.cs +2 -2
- package/dist/runtime/csharp/Transport.cs +2 -2
- package/dist/runtime/csharp/TransportLongPoll.cs +2 -2
- package/dist/runtime/csharp/TransportSse.cs +2 -2
- package/dist/runtime/csharp/TransportWs.cs +2 -2
- package/dist/runtime/csharp/Wire.cs +2 -2
- package/dist/runtime/csharp/Ws.cs +2 -2
- package/dist/runtime/csharp/WsDial.cs +2 -2
- package/dist/runtime/go/auth.go +1 -1
- package/dist/runtime/go/body.go +2 -2
- package/dist/runtime/go/config.go +1 -1
- package/dist/runtime/go/errors.go +5 -5
- package/dist/runtime/go/export.go +10 -10
- package/dist/runtime/go/hooks.go +2 -2
- package/dist/runtime/go/invalidation.go +2 -2
- package/dist/runtime/go/log.go +1 -1
- package/dist/runtime/go/nullable.go +1 -1
- package/dist/runtime/go/options.go +1 -1
- package/dist/runtime/go/path.go +1 -1
- package/dist/runtime/go/query.go +2 -2
- package/dist/runtime/go/realtime.go +4 -4
- package/dist/runtime/go/realtime_loop.go +1 -1
- package/dist/runtime/go/redirect.go +2 -2
- package/dist/runtime/go/request.go +9 -9
- package/dist/runtime/go/result.go +2 -2
- package/dist/runtime/go/sse.go +3 -3
- package/dist/runtime/go/stale.go +1 -1
- package/dist/runtime/go/stream.go +2 -2
- package/dist/runtime/go/transport.go +2 -2
- package/dist/runtime/go/transport_longpoll.go +1 -1
- package/dist/runtime/go/transport_sse.go +2 -2
- package/dist/runtime/go/ws.go +1 -1
- package/dist/runtime/java/Answer.java +2 -2
- package/dist/runtime/java/ApiException.java +2 -2
- package/dist/runtime/java/BinaryBody.java +2 -2
- package/dist/runtime/java/Body.java +4 -4
- package/dist/runtime/java/Call.java +2 -2
- package/dist/runtime/java/CallLog.java +2 -2
- package/dist/runtime/java/ClientConfig.java +2 -2
- package/dist/runtime/java/ConnectionState.java +2 -2
- package/dist/runtime/java/Credential.java +2 -2
- package/dist/runtime/java/Deadline.java +2 -2
- package/dist/runtime/java/Decode.java +2 -2
- package/dist/runtime/java/Envelope.java +2 -2
- package/dist/runtime/java/ErrorEnvelope.java +3 -3
- package/dist/runtime/java/EventStream.java +2 -2
- package/dist/runtime/java/Exchange.java +2 -2
- package/dist/runtime/java/FilePart.java +2 -2
- package/dist/runtime/java/Flight.java +3 -3
- package/dist/runtime/java/Hooks.java +3 -3
- package/dist/runtime/java/Hops.java +2 -2
- package/dist/runtime/java/{HoneyException.java → HttpException.java} +4 -4
- package/dist/runtime/java/InvalidationConfig.java +2 -2
- package/dist/runtime/java/Json.java +3 -3
- package/dist/runtime/java/Keepalive.java +2 -2
- package/dist/runtime/java/LogEntry.java +2 -2
- package/dist/runtime/java/LongPollAdapter.java +2 -2
- package/dist/runtime/java/Operation.java +2 -2
- package/dist/runtime/java/Opt.java +2 -2
- package/dist/runtime/java/Pump.java +2 -2
- package/dist/runtime/java/RawResponse.java +2 -2
- package/dist/runtime/java/Realtime.java +2 -2
- package/dist/runtime/java/RealtimeLoop.java +4 -4
- package/dist/runtime/java/RedirectPolicy.java +2 -2
- package/dist/runtime/java/Redirects.java +2 -2
- package/dist/runtime/java/RequestContext.java +2 -2
- package/dist/runtime/java/RequestHook.java +2 -2
- package/dist/runtime/java/RequestOptions.java +2 -2
- package/dist/runtime/java/ResponseContext.java +2 -2
- package/dist/runtime/java/ResponseHook.java +2 -2
- package/dist/runtime/java/Result.java +2 -2
- package/dist/runtime/java/ResumableConnection.java +2 -2
- package/dist/runtime/java/SdkException.java +3 -3
- package/dist/runtime/java/Socket.java +2 -2
- package/dist/runtime/java/Sse.java +2 -2
- package/dist/runtime/java/SseAdapter.java +2 -2
- package/dist/runtime/java/SseEvent.java +2 -2
- package/dist/runtime/java/StaleMeta.java +2 -2
- package/dist/runtime/java/StaleTracker.java +2 -2
- package/dist/runtime/java/Transport.java +2 -2
- package/dist/runtime/java/TransportAdapter.java +2 -2
- package/dist/runtime/java/TransportConnection.java +2 -2
- package/dist/runtime/java/TransportKind.java +2 -2
- package/dist/runtime/java/TransportMessage.java +2 -2
- package/dist/runtime/java/TransportOptions.java +2 -2
- package/dist/runtime/java/TypedWebSocket.java +2 -2
- package/dist/runtime/java/UrlPath.java +2 -2
- package/dist/runtime/java/UrlQuery.java +2 -2
- package/dist/runtime/java/WsAdapter.java +2 -2
- package/dist/runtime/java/WsClose.java +2 -2
- package/dist/runtime/java/WsDial.java +2 -2
- package/dist/runtime/java/WsMessage.java +2 -2
- package/dist/runtime/mcp/call.ts +3 -3
- package/dist/runtime/mcp/result.ts +2 -2
- package/dist/runtime/python/__init__.py +1 -1
- package/dist/runtime/python/auth.py +1 -1
- package/dist/runtime/python/body.py +1 -1
- package/dist/runtime/python/config.py +1 -1
- package/dist/runtime/python/errors.py +11 -11
- package/dist/runtime/python/events.py +4 -4
- package/dist/runtime/python/exchange.py +1 -1
- package/dist/runtime/python/hooks.py +4 -4
- package/dist/runtime/python/invalidation.py +1 -1
- package/dist/runtime/python/log.py +1 -1
- package/dist/runtime/python/operation.py +1 -1
- package/dist/runtime/python/path.py +1 -1
- package/dist/runtime/python/query.py +1 -1
- package/dist/runtime/python/realtime.py +5 -5
- package/dist/runtime/python/redirect.py +1 -1
- package/dist/runtime/python/result.py +1 -1
- package/dist/runtime/python/send_async.py +4 -4
- package/dist/runtime/python/send_sync.py +3 -3
- package/dist/runtime/python/sse.py +1 -1
- package/dist/runtime/python/stale.py +1 -1
- package/dist/runtime/python/transport.py +1 -1
- package/dist/runtime/python/transport_longpoll.py +1 -1
- package/dist/runtime/python/transport_sse.py +1 -1
- package/dist/runtime/python/transport_ws.py +1 -1
- package/dist/runtime/python/ws.py +3 -3
- package/dist/runtime/rust/Cargo.lock +1 -1
- package/dist/runtime/rust/answer.rs +1 -1
- package/dist/runtime/rust/auth.rs +1 -1
- package/dist/runtime/rust/body.rs +2 -2
- package/dist/runtime/rust/call.rs +1 -1
- package/dist/runtime/rust/config.rs +1 -1
- package/dist/runtime/rust/envelope.rs +3 -3
- package/dist/runtime/rust/errors.rs +3 -3
- package/dist/runtime/rust/events.rs +1 -1
- package/dist/runtime/rust/exchange.rs +1 -1
- package/dist/runtime/rust/hooks.rs +1 -1
- package/dist/runtime/rust/invalidation.rs +1 -1
- package/dist/runtime/rust/log.rs +1 -1
- package/dist/runtime/rust/nullable.rs +1 -1
- package/dist/runtime/rust/path.rs +1 -1
- package/dist/runtime/rust/query.rs +1 -1
- package/dist/runtime/rust/realtime.rs +1 -1
- package/dist/runtime/rust/realtime_loop.rs +1 -1
- package/dist/runtime/rust/redirect.rs +1 -1
- package/dist/runtime/rust/request.rs +1 -1
- package/dist/runtime/rust/result.rs +1 -1
- package/dist/runtime/rust/sse.rs +1 -1
- package/dist/runtime/rust/stale.rs +1 -1
- package/dist/runtime/rust/transport.rs +1 -1
- package/dist/runtime/rust/transport_longpoll.rs +1 -1
- package/dist/runtime/rust/transport_sse.rs +1 -1
- package/dist/runtime/rust/transport_ws.rs +1 -1
- package/dist/runtime/rust/ws.rs +1 -1
- package/dist/runtime/ts/app-types.ts +5 -5
- package/dist/runtime/ts/app.ts +5 -5
- package/dist/runtime/ts/http.ts +3 -3
- package/dist/runtime/ts/path.ts +1 -1
- package/dist/runtime/ts/request.ts +1 -1
- package/dist/runtime/ts/sdk.ts +1 -1
- package/package.json +2 -29
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// @generated by
|
|
2
|
-
//!
|
|
1
|
+
// @generated by clients. DO NOT EDIT.
|
|
2
|
+
//! backend's error envelope, read leniently from an error status's body, and the message an error
|
|
3
3
|
//! shows: control characters dropped, capped at 512 characters.
|
|
4
4
|
|
|
5
5
|
use std::collections::HashMap;
|
|
@@ -18,7 +18,7 @@ pub struct FieldError {
|
|
|
18
18
|
pub path: String,
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
///
|
|
21
|
+
/// backend's error body; an absent member is empty, and a member it does not name, or of another type
|
|
22
22
|
/// than the envelope's, is kept as it came in `extra`.
|
|
23
23
|
#[derive(Debug, Clone, Default, PartialEq)]
|
|
24
24
|
#[non_exhaustive]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by
|
|
1
|
+
// @generated by clients. DO NOT EDIT.
|
|
2
2
|
//! The SDK's one error type (G6): an error status as `Api`, and each way a call fails without one.
|
|
3
3
|
|
|
4
4
|
use std::fmt;
|
|
@@ -135,7 +135,7 @@ impl ErrorKind {
|
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
/// An error status: the response as it came, its parsed envelope,
|
|
138
|
+
/// An error status: the response as it came, its parsed envelope, backend's error key, and a message
|
|
139
139
|
/// safe to show. Boxed, so an `Error` stays small.
|
|
140
140
|
#[derive(Clone)]
|
|
141
141
|
pub struct ApiError(Box<Answered>);
|
|
@@ -185,7 +185,7 @@ impl ApiError {
|
|
|
185
185
|
&self.0.message
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
-
///
|
|
188
|
+
/// backend's error envelope, empty for a body that is not a JSON object.
|
|
189
189
|
pub fn envelope(&self) -> &ErrorEnvelope {
|
|
190
190
|
&self.0.envelope
|
|
191
191
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by
|
|
1
|
+
// @generated by clients. DO NOT EDIT.
|
|
2
2
|
//! An SSE operation's answer: the open event stream, each event's data as the operation declares
|
|
3
3
|
//! it (text, or JSON decoded into `T`). An error status at the open fails with its answer, which the
|
|
4
4
|
//! call's style settles; a failure once open is the stream's own. No timeout bounds it once open;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by
|
|
1
|
+
// @generated by clients. DO NOT EDIT.
|
|
2
2
|
//! The exchange every call shares: the URL, the header layers, the hooks in declaration order, one
|
|
3
3
|
//! retry with a refreshed token on a 401, the capped body read, the timeout, the log and the stale
|
|
4
4
|
//! tracker. A body past the cap is still an answer: its status and headers arrived, its body unread.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by
|
|
1
|
+
// @generated by clients. DO NOT EDIT.
|
|
2
2
|
//! The caller's async hooks (TypeScript parity): `on_request` before each send, `on_response` on
|
|
3
3
|
//! each answer, `on_auth_expired` on a 401, and the `state` map every hook of a client shares.
|
|
4
4
|
|
package/dist/runtime/rust/log.rs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by
|
|
1
|
+
// @generated by clients. DO NOT EDIT.
|
|
2
2
|
//! Path templates: `{name}` anywhere in a segment and a whole `:name` segment, each value encoded
|
|
3
3
|
//! like JavaScript's `encodeURIComponent`, so every SDK language sends the same path bytes.
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by
|
|
1
|
+
// @generated by clients. DO NOT EDIT.
|
|
2
2
|
//! Query, header and form values, the way every SDK language writes them: a string as it is, a
|
|
3
3
|
//! boolean as `true`/`false`, a number like JavaScript's `Number#toString`, a list repeated (or
|
|
4
4
|
//! joined with `,` in a header), anything else as JSON; an absent value (`None`) is not sent.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by
|
|
1
|
+
// @generated by clients. DO NOT EDIT.
|
|
2
2
|
//! A realtime operation's answer: a connection over a chain of transports (WebSocket, then SSE,
|
|
3
3
|
//! then long-poll by default) that reconnects after a drop and resumes from the last message it
|
|
4
4
|
//! delivered. The call's `cancel_on` bounds the open and ends an open connection quietly.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by
|
|
1
|
+
// @generated by clients. DO NOT EDIT.
|
|
2
2
|
//! A realtime connection's life: opening the chain (the proven transport first), advancing the cursor
|
|
3
3
|
//! past each delivered message, and reconnecting after a drop with backoff; and the operation's run,
|
|
4
4
|
//! which opens the connection before the call resolves.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by
|
|
1
|
+
// @generated by clients. DO NOT EDIT.
|
|
2
2
|
//! Which redirects a call follows (R3), and the following itself. The SDK's HTTP client never follows
|
|
3
3
|
//! one on its own (`redirect::Policy::none()`), whatever `http_builder` sets, so this is the only rule:
|
|
4
4
|
//! hop by hop, a hop to another origin stripped to the safe headers and never given a body.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by
|
|
1
|
+
// @generated by clients. DO NOT EDIT.
|
|
2
2
|
//! One call's request as a method fills it: its route, query, headers and body, copied in up
|
|
3
3
|
//! front so the `Call` holding it borrows nothing; a value that cannot be sent fails the call when
|
|
4
4
|
//! it is awaited.
|
package/dist/runtime/rust/sse.rs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by
|
|
1
|
+
// @generated by clients. DO NOT EDIT.
|
|
2
2
|
//! The WHATWG event-stream parser: lines end in CRLF, LF or CR; a blank line dispatches; a final
|
|
3
3
|
//! event without its blank line is never dispatched; the id is sticky and one holding NUL is
|
|
4
4
|
//! ignored; `retry` takes ASCII digits only; a leading BOM is skipped; values are not trimmed.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by
|
|
1
|
+
// @generated by clients. DO NOT EDIT.
|
|
2
2
|
//! Staleness per `METHOD /path` selector with TypeScript parity: exact keys and pattern keys, a
|
|
3
3
|
//! stale window, eviction of the least recently staled at the cap, and a sequence stamp so a read
|
|
4
4
|
//! clears only what was staled before it began. A lookup reads its own key and the pattern keys,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by
|
|
1
|
+
// @generated by clients. DO NOT EDIT.
|
|
2
2
|
//! The realtime transports: the trait a WebSocket, SSE or long-poll adapter implements (a caller's
|
|
3
3
|
//! own included), the options and resume cursor each dial reads, and the dial every default adapter
|
|
4
4
|
//! shares.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by
|
|
1
|
+
// @generated by clients. DO NOT EDIT.
|
|
2
2
|
//! The long-poll transport: each receive is one GET of the realtime endpoint through the call's
|
|
3
3
|
//! exchange, the resume cursor as query params, its 2xx answer one message (a 204 polls again), the
|
|
4
4
|
//! cursor advanced from each answer and each poll bounded at 60 s, never by the client's timeout; a
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by
|
|
1
|
+
// @generated by clients. DO NOT EDIT.
|
|
2
2
|
//! The SSE transport: the realtime endpoint as an event stream through the call's exchange (hooks,
|
|
3
3
|
//! the 401 refresh, the log), the reconnect token as a query param and the last event id as
|
|
4
4
|
//! `Last-Event-ID`; a send POSTs its JSON to the endpoint.
|
package/dist/runtime/rust/ws.rs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by
|
|
1
|
+
// @generated by clients. DO NOT EDIT.
|
|
2
2
|
//! A WebSocket operation's answer: the open socket, dialed with the call's URL, headers and
|
|
3
3
|
//! credential, its offered subprotocols, and a 16 MiB message cap. The call's `cancel_on` bounds the
|
|
4
4
|
//! handshake and ends an open socket's reads quietly; dropping it closes the connection. Its dial
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The app-typed client's types. They read the app's `$routes` phantom structurally, so the
|
|
3
|
-
* emitted client imports nothing from
|
|
4
|
-
* output type are spelled here as
|
|
3
|
+
* emitted client imports nothing from backend (D3): `InferRoutes`, the path params and a schema's
|
|
4
|
+
* output type are spelled here as backend spells them.
|
|
5
5
|
*/
|
|
6
6
|
import type { ClientError } from "./error.ts"
|
|
7
7
|
import type { Result, StatusOf } from "./response.ts"
|
|
@@ -109,7 +109,7 @@ export type IsSSE<TRoutes, P extends string, M extends string> =
|
|
|
109
109
|
type ErrorsByStatusFor<TRoutes, P extends string, M extends string> =
|
|
110
110
|
RouteOf<TRoutes, P, M> extends { errorsByStatus: infer S } ? S : never
|
|
111
111
|
|
|
112
|
-
/**
|
|
112
|
+
/** backend's error envelope, as a route without a schema of its own answers an error. */
|
|
113
113
|
export type ErrorEnvelope<TStatus extends number = number, TKey extends string = string> = {
|
|
114
114
|
error_key: TKey
|
|
115
115
|
fields: Record<string, FieldError[]>
|
|
@@ -122,7 +122,7 @@ export type ErrorEnvelope<TStatus extends number = number, TKey extends string =
|
|
|
122
122
|
/** `null` in a route's errorsByStatus means the default envelope, not a null body. */
|
|
123
123
|
type ResolveErrorBody<S extends number, T> = T extends null ? ErrorEnvelope<S> : T
|
|
124
124
|
|
|
125
|
-
/** Each declared status's error body,
|
|
125
|
+
/** Each declared status's error body, backend's envelope where the route names none. */
|
|
126
126
|
type ErrorBodies<S> = { [K in keyof S]: ResolveErrorBody<StatusOf<K>, S[K]> }
|
|
127
127
|
|
|
128
128
|
/** What a call resolves to, by transport. */
|
|
@@ -177,7 +177,7 @@ type PathHelper<TRoutes> = <P extends keyof TRoutes & string>(
|
|
|
177
177
|
) => string
|
|
178
178
|
|
|
179
179
|
/** The typed client: each call resolves to its value and throws an error status; `safe`'s answer a Result. */
|
|
180
|
-
export type
|
|
180
|
+
export type HttpClient<TRoutes> = {
|
|
181
181
|
$isClientError: (e: unknown) => e is ClientError
|
|
182
182
|
$path: PathHelper<TRoutes>
|
|
183
183
|
$url: PathHelper<TRoutes>
|
package/dist/runtime/ts/app.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { HttpClient, InferRoutes } from "./app-types.ts"
|
|
2
2
|
import type { ClientConfig } from "./config.ts"
|
|
3
3
|
import { isClientError } from "./error.ts"
|
|
4
4
|
import { HTTPClient } from "./http.ts"
|
|
@@ -86,15 +86,15 @@ function safeMethods(http: HTTPClient): object {
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
/** The app-typed client: each call throws an error status, and `client.safe`'s calls answer it as a Result. */
|
|
89
|
-
export function createClient<T>(config: ClientConfig):
|
|
89
|
+
export function createClient<T>(config: ClientConfig): HttpClient<InferRoutes<T>> {
|
|
90
90
|
const http = new HTTPClient(config)
|
|
91
91
|
const safe = safeMethods(http)
|
|
92
|
-
return new Proxy({} as
|
|
92
|
+
return new Proxy({} as HttpClient<InferRoutes<T>>, {
|
|
93
93
|
get(_target, prop: string | symbol) {
|
|
94
94
|
/* not a thenable, and printable: `await client` and `String(client)` must not hit the method table */
|
|
95
|
-
if (prop === Symbol.toStringTag) return "
|
|
95
|
+
if (prop === Symbol.toStringTag) return "HttpClient"
|
|
96
96
|
if (typeof prop === "symbol" || prop === "then") return undefined
|
|
97
|
-
if (prop === "toString" || prop === "toJSON") return () => "[object
|
|
97
|
+
if (prop === "toString" || prop === "toJSON") return () => "[object HttpClient]"
|
|
98
98
|
if (prop === "safe") return safe
|
|
99
99
|
if (!HTTP_METHODS.includes(prop)) return helper(http, prop)
|
|
100
100
|
return (path: string, input?: RequestOptions) =>
|
package/dist/runtime/ts/http.ts
CHANGED
|
@@ -23,11 +23,11 @@ type Prepared = { body: BodyInit | undefined; headers: Headers; url: URL }
|
|
|
23
23
|
export type Call = { method: string; opts: RequestOptions; path: string; refreshes?: false | undefined }
|
|
24
24
|
|
|
25
25
|
/** The realtime loop's refresh key, exported by the SDK under no name. */
|
|
26
|
-
export const REFRESH_AUTH: unique symbol = /* @__PURE__ */ Symbol("
|
|
26
|
+
export const REFRESH_AUTH: unique symbol = /* @__PURE__ */ Symbol("http.refreshAuth")
|
|
27
27
|
|
|
28
28
|
/** The send and the config, for the stream functions beside the client. */
|
|
29
|
-
export const SEND: unique symbol = /* @__PURE__ */ Symbol("
|
|
30
|
-
export const CONFIG: unique symbol = /* @__PURE__ */ Symbol("
|
|
29
|
+
export const SEND: unique symbol = /* @__PURE__ */ Symbol("http.send")
|
|
30
|
+
export const CONFIG: unique symbol = /* @__PURE__ */ Symbol("http.config")
|
|
31
31
|
|
|
32
32
|
/** One operation of a generated SDK: the call, how it is read, and its stale view for the hooks. */
|
|
33
33
|
export type Operation = Call & {
|
package/dist/runtime/ts/path.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Client-side path templates. Two spellings are accepted, segment by segment:
|
|
3
3
|
*
|
|
4
|
-
* -
|
|
4
|
+
* - Backend route patterns: `:name` (or `:name?`) takes a whole segment, `*name` (or `*`) takes the
|
|
5
5
|
* rest of the path. Names follow the router grammar, so `:user-id` is one parameter.
|
|
6
6
|
* - OpenAPI templates: `{name}` anywhere inside a segment (`/ops/{id}:cancel`).
|
|
7
7
|
*
|
|
@@ -112,7 +112,7 @@ export function newClientRequestId(): string {
|
|
|
112
112
|
}
|
|
113
113
|
return out
|
|
114
114
|
}
|
|
115
|
-
throw new Error("
|
|
115
|
+
throw new Error("httpsdk: no crypto.randomUUID or crypto.getRandomValues in this runtime")
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
function isFileLike(v: unknown): boolean {
|
package/dist/runtime/ts/sdk.ts
CHANGED
|
@@ -23,7 +23,7 @@ export type ServiceEntry = {
|
|
|
23
23
|
realtime?: boolean
|
|
24
24
|
/** an event stream; `"json"` when its events carry JSON `data` the client parses */
|
|
25
25
|
sse?: boolean | "json"
|
|
26
|
-
/** the param that spans segments (`x-
|
|
26
|
+
/** the param that spans segments (`x-backend-wildcard`) */
|
|
27
27
|
wildcard?: string
|
|
28
28
|
ws?: boolean
|
|
29
29
|
/** how a stream, WebSocket or realtime operation is called; a REST one has none */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workerstack/clients",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.28",
|
|
4
4
|
"description": "Generates SDKs (TypeScript, Go, Rust, Python, C#, Java), a CLI and an MCP server from any OpenAPI 3.x document.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"codegen",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"url": "git+https://github.com/workerstack/clients.git"
|
|
21
21
|
},
|
|
22
22
|
"bin": {
|
|
23
|
-
"
|
|
23
|
+
"clients": "bin/clients.js",
|
|
24
24
|
"installgen": "bin/installgen.js"
|
|
25
25
|
},
|
|
26
26
|
"files": [
|
|
@@ -87,33 +87,6 @@
|
|
|
87
87
|
"oxc-transform": "0.155.0",
|
|
88
88
|
"zod": "4.3.6"
|
|
89
89
|
},
|
|
90
|
-
"devDependencies": {
|
|
91
|
-
"@clack/prompts": "^0.11.0",
|
|
92
|
-
"@commitlint/cli": "21.2.4",
|
|
93
|
-
"@commitlint/config-conventional": "21.2.4",
|
|
94
|
-
"@lovrozagar/grunt": "0.16.1",
|
|
95
|
-
"@tanstack/query-core": "5.104.5",
|
|
96
|
-
"@total-typescript/ts-reset": "0.6.1",
|
|
97
|
-
"@types/node": "26.1.1",
|
|
98
|
-
"@vitest/coverage-v8": "4.1.10",
|
|
99
|
-
"@workerstack/backend": "1.0.0-rc.24",
|
|
100
|
-
"@workerstack/system": "0.3.0",
|
|
101
|
-
"ajv": "8.20.0",
|
|
102
|
-
"ajv-formats": "3.0.1",
|
|
103
|
-
"js-yaml": "5.3.0",
|
|
104
|
-
"lefthook": "2.2.2",
|
|
105
|
-
"oxc-parser": "0.152.0",
|
|
106
|
-
"oxfmt": "0.78.0",
|
|
107
|
-
"oxlint": "1.93.0",
|
|
108
|
-
"rulesync": "16.17.0",
|
|
109
|
-
"smol-toml": "^1.8.0",
|
|
110
|
-
"standardwebhooks": "1.1.1",
|
|
111
|
-
"ts-morph": "28.0.0",
|
|
112
|
-
"typescript": "7.0.2",
|
|
113
|
-
"vite": "8.1.4",
|
|
114
|
-
"vitest": "4.1.10",
|
|
115
|
-
"ws": "8.21.0"
|
|
116
|
-
},
|
|
117
90
|
"peerDependencies": {
|
|
118
91
|
"oxfmt": ">=0.63.0",
|
|
119
92
|
"ts-morph": ">=28.0.0"
|