@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,4 +1,4 @@
|
|
|
1
|
-
// @generated by
|
|
1
|
+
// @generated by clients. DO NOT EDIT.
|
|
2
2
|
using System;
|
|
3
3
|
using System.Collections.Generic;
|
|
4
4
|
using System.IO;
|
|
@@ -7,7 +7,7 @@ using System.Net.Http;
|
|
|
7
7
|
using System.Threading;
|
|
8
8
|
using System.Threading.Tasks;
|
|
9
9
|
|
|
10
|
-
namespace
|
|
10
|
+
namespace Http.Runtime;
|
|
11
11
|
|
|
12
12
|
internal sealed record Answered(int Status, Dictionary<string, string> Headers, byte[] Body, Uri Url, bool Over);
|
|
13
13
|
|
|
@@ -66,7 +66,7 @@ internal sealed class Exchange(Transport client, Operation op, Call call, bool s
|
|
|
66
66
|
{
|
|
67
67
|
return await AnswerAsync(deadline.Token).ConfigureAwait(false);
|
|
68
68
|
}
|
|
69
|
-
catch (
|
|
69
|
+
catch (HttpException e)
|
|
70
70
|
{
|
|
71
71
|
_log.Failed(e);
|
|
72
72
|
throw;
|
|
@@ -86,7 +86,7 @@ internal sealed class Exchange(Transport client, Operation op, Call call, bool s
|
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
private
|
|
89
|
+
private HttpException Failed(HttpException error)
|
|
90
90
|
{
|
|
91
91
|
_log.Failed(error);
|
|
92
92
|
return error;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by
|
|
1
|
+
// @generated by clients. DO NOT EDIT.
|
|
2
2
|
using System;
|
|
3
3
|
using System.Linq;
|
|
4
4
|
using System.Net;
|
|
@@ -6,11 +6,11 @@ using System.Net.Http;
|
|
|
6
6
|
using System.Threading;
|
|
7
7
|
using System.Threading.Tasks;
|
|
8
8
|
|
|
9
|
-
namespace
|
|
9
|
+
namespace Http.Runtime;
|
|
10
10
|
|
|
11
11
|
internal sealed class StripHandler : DelegatingHandler
|
|
12
12
|
{
|
|
13
|
-
public static readonly HttpRequestOptionsKey<bool> Cross = new("
|
|
13
|
+
public static readonly HttpRequestOptionsKey<bool> Cross = new("http.cross");
|
|
14
14
|
|
|
15
15
|
private static readonly string[] Safe = ["Accept", "Accept-Language", "User-Agent"];
|
|
16
16
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
// @generated by
|
|
1
|
+
// @generated by clients. DO NOT EDIT.
|
|
2
2
|
using System;
|
|
3
3
|
using System.Collections.Generic;
|
|
4
4
|
using System.Threading;
|
|
5
5
|
using System.Threading.Tasks;
|
|
6
6
|
|
|
7
|
-
namespace
|
|
7
|
+
namespace Http.Runtime;
|
|
8
8
|
|
|
9
9
|
/// <summary>
|
|
10
10
|
/// A request about to be sent, before each attempt: a hook may change its method, URL, headers and body. Its
|
|
@@ -124,5 +124,5 @@ internal static class Hooks
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
public static bool Wraps(Exception error, CancellationToken token) =>
|
|
127
|
-
error is not
|
|
127
|
+
error is not HttpException && !(error is OperationCanceledException && token.IsCancellationRequested);
|
|
128
128
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
// @generated by
|
|
1
|
+
// @generated by clients. DO NOT EDIT.
|
|
2
2
|
using System;
|
|
3
3
|
using System.Collections.Generic;
|
|
4
4
|
using System.Text.Json;
|
|
5
5
|
using System.Text.Json.Serialization;
|
|
6
6
|
using System.Text.Json.Serialization.Metadata;
|
|
7
7
|
|
|
8
|
-
namespace
|
|
8
|
+
namespace Http.Runtime;
|
|
9
9
|
|
|
10
10
|
/// <summary>An optional nullable member: unset (the default, never written), null, or a value.</summary>
|
|
11
11
|
public readonly struct Opt<T> : IEquatable<Opt<T>>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
// @generated by
|
|
1
|
+
// @generated by clients. DO NOT EDIT.
|
|
2
2
|
using System;
|
|
3
3
|
using System.Diagnostics;
|
|
4
4
|
|
|
5
|
-
namespace
|
|
5
|
+
namespace Http.Runtime;
|
|
6
6
|
|
|
7
7
|
/// <summary>
|
|
8
8
|
/// One event of a call for <c>ClientConfig.OnLog</c>: <c>request_start</c> (debug), <c>response_received</c> (info
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
// @generated by
|
|
1
|
+
// @generated by clients. DO NOT EDIT.
|
|
2
2
|
using System;
|
|
3
3
|
using System.Collections.Generic;
|
|
4
4
|
using System.Text.Json;
|
|
5
5
|
using System.Text.Json.Serialization.Metadata;
|
|
6
6
|
|
|
7
|
-
namespace
|
|
7
|
+
namespace Http.Runtime;
|
|
8
8
|
|
|
9
9
|
internal sealed record Operation(string Method, string Path, string[] PathParams, bool Idempotent, string? Accept = null, string[]? Invalidates = null);
|
|
10
10
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by
|
|
1
|
+
// @generated by clients. DO NOT EDIT.
|
|
2
2
|
using System;
|
|
3
3
|
using System.Collections.Generic;
|
|
4
4
|
using System.Text.Json;
|
|
@@ -6,7 +6,7 @@ using System.Text.Json.Serialization.Metadata;
|
|
|
6
6
|
using System.Threading;
|
|
7
7
|
using System.Threading.Tasks;
|
|
8
8
|
|
|
9
|
-
namespace
|
|
9
|
+
namespace Http.Runtime;
|
|
10
10
|
|
|
11
11
|
/// <summary>Where a realtime connection stands.</summary>
|
|
12
12
|
public enum ConnectionState
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by
|
|
1
|
+
// @generated by clients. DO NOT EDIT.
|
|
2
2
|
using System;
|
|
3
3
|
using System.Collections.Generic;
|
|
4
4
|
using System.IO;
|
|
@@ -8,7 +8,7 @@ using System.Net.WebSockets;
|
|
|
8
8
|
using System.Threading;
|
|
9
9
|
using System.Threading.Tasks;
|
|
10
10
|
|
|
11
|
-
namespace
|
|
11
|
+
namespace Http.Runtime;
|
|
12
12
|
|
|
13
13
|
/* ResumableConnection<T>'s loop (Python's realtime.py), its behavior documented there */
|
|
14
14
|
internal sealed class RealtimeLoop(IReadOnlyList<ITransportAdapter> adapters, TransportOptions options, string url)
|
|
@@ -232,5 +232,5 @@ internal sealed class RealtimeLoop(IReadOnlyList<ITransportAdapter> adapters, Tr
|
|
|
232
232
|
|
|
233
233
|
/* what an adapter's open or read throws when that transport failed; anything else is the caller's */
|
|
234
234
|
private static bool Fails(Exception e) =>
|
|
235
|
-
e is
|
|
235
|
+
e is HttpException or IOException or HttpRequestException or SocketException or WebSocketException;
|
|
236
236
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
// @generated by
|
|
1
|
+
// @generated by clients. DO NOT EDIT.
|
|
2
2
|
using System;
|
|
3
3
|
using System.Collections.Generic;
|
|
4
4
|
using System.IO;
|
|
5
5
|
using System.Linq;
|
|
6
6
|
using System.Net.Http;
|
|
7
7
|
|
|
8
|
-
namespace
|
|
8
|
+
namespace Http.Runtime;
|
|
9
9
|
|
|
10
10
|
internal sealed record Hop(string Method, Uri Url, IReadOnlyDictionary<string, string> Headers, byte[]? Content, Stream? Stream, bool Cross);
|
|
11
11
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
// @generated by
|
|
1
|
+
// @generated by clients. DO NOT EDIT.
|
|
2
2
|
using System;
|
|
3
3
|
using System.Diagnostics.CodeAnalysis;
|
|
4
4
|
|
|
5
|
-
namespace
|
|
5
|
+
namespace Http.Runtime;
|
|
6
6
|
|
|
7
7
|
/// <summary>
|
|
8
8
|
/// A <c>client.Safe</c> call's answer: Ok, or Err holding the <see cref="SdkException"/> the client's method throws
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
// @generated by
|
|
1
|
+
// @generated by clients. DO NOT EDIT.
|
|
2
2
|
using System;
|
|
3
3
|
using System.Collections.Generic;
|
|
4
4
|
using System.Globalization;
|
|
5
5
|
using System.IO;
|
|
6
6
|
using System.Text;
|
|
7
7
|
|
|
8
|
-
namespace
|
|
8
|
+
namespace Http.Runtime;
|
|
9
9
|
|
|
10
10
|
internal readonly record struct RawEvent(string Data, string? Event, string? Id, TimeSpan? Retry);
|
|
11
11
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
// @generated by
|
|
1
|
+
// @generated by clients. DO NOT EDIT.
|
|
2
2
|
using System;
|
|
3
3
|
using System.Collections.Generic;
|
|
4
4
|
using System.Diagnostics;
|
|
5
5
|
using System.Linq;
|
|
6
6
|
|
|
7
|
-
namespace
|
|
7
|
+
namespace Http.Runtime;
|
|
8
8
|
|
|
9
9
|
internal sealed record StaleMeta(string Selector, bool IsStale, IReadOnlyList<string> InvalidatedBy, long Seq)
|
|
10
10
|
{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by
|
|
1
|
+
// @generated by clients. DO NOT EDIT.
|
|
2
2
|
using System;
|
|
3
3
|
using System.Net.Http;
|
|
4
4
|
using System.Text;
|
|
@@ -7,7 +7,7 @@ using System.Text.Json.Serialization.Metadata;
|
|
|
7
7
|
using System.Threading;
|
|
8
8
|
using System.Threading.Tasks;
|
|
9
9
|
|
|
10
|
-
namespace
|
|
10
|
+
namespace Http.Runtime;
|
|
11
11
|
|
|
12
12
|
internal sealed partial class Transport : IDisposable
|
|
13
13
|
{
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
// @generated by
|
|
1
|
+
// @generated by clients. DO NOT EDIT.
|
|
2
2
|
using System.Collections.Generic;
|
|
3
3
|
using System.Text;
|
|
4
4
|
using System.Threading;
|
|
5
5
|
using System.Threading.Tasks;
|
|
6
6
|
|
|
7
|
-
namespace
|
|
7
|
+
namespace Http.Runtime;
|
|
8
8
|
|
|
9
9
|
/// <summary>A realtime call polled through its exchange: one GET per message with the cursor, held up to 60 s whatever the timeout (a 204 polls again); a send is a POST.</summary>
|
|
10
10
|
public sealed class LongPollAdapter : ITransportAdapter, IDialed
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
// @generated by
|
|
1
|
+
// @generated by clients. DO NOT EDIT.
|
|
2
2
|
using System.Collections.Generic;
|
|
3
3
|
using System.Threading;
|
|
4
4
|
using System.Threading.Tasks;
|
|
5
5
|
|
|
6
|
-
namespace
|
|
6
|
+
namespace Http.Runtime;
|
|
7
7
|
|
|
8
8
|
/// <summary>A realtime call's event stream through its exchange: the cursor's id as Last-Event-ID, its token as a query param; a send is a POST.</summary>
|
|
9
9
|
public sealed class SseAdapter : ITransportAdapter, IDialed
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
// @generated by
|
|
1
|
+
// @generated by clients. DO NOT EDIT.
|
|
2
2
|
using System.Threading;
|
|
3
3
|
using System.Threading.Tasks;
|
|
4
4
|
|
|
5
|
-
namespace
|
|
5
|
+
namespace Http.Runtime;
|
|
6
6
|
|
|
7
7
|
/// <summary>A realtime call's WebSocket: its own upgrade with the cursor as query params, no hook and no log on the dial.</summary>
|
|
8
8
|
public sealed class WsAdapter : ITransportAdapter, IDialed
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by
|
|
1
|
+
// @generated by clients. DO NOT EDIT.
|
|
2
2
|
using System;
|
|
3
3
|
using System.Buffers;
|
|
4
4
|
using System.Collections.Generic;
|
|
@@ -6,7 +6,7 @@ using System.Globalization;
|
|
|
6
6
|
using System.Net.Http;
|
|
7
7
|
using System.Net.Http.Headers;
|
|
8
8
|
|
|
9
|
-
namespace
|
|
9
|
+
namespace Http.Runtime;
|
|
10
10
|
|
|
11
11
|
internal static class Wire
|
|
12
12
|
{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by
|
|
1
|
+
// @generated by clients. DO NOT EDIT.
|
|
2
2
|
using System;
|
|
3
3
|
using System.IO;
|
|
4
4
|
using System.Net.WebSockets;
|
|
@@ -8,7 +8,7 @@ using System.Text.Json.Serialization.Metadata;
|
|
|
8
8
|
using System.Threading;
|
|
9
9
|
using System.Threading.Tasks;
|
|
10
10
|
|
|
11
|
-
namespace
|
|
11
|
+
namespace Http.Runtime;
|
|
12
12
|
|
|
13
13
|
/// <summary>One whole WebSocket message: its type and its data.</summary>
|
|
14
14
|
public sealed record WsMessage(WebSocketMessageType Type, byte[] Data)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by
|
|
1
|
+
// @generated by clients. DO NOT EDIT.
|
|
2
2
|
using System;
|
|
3
3
|
using System.Collections.Generic;
|
|
4
4
|
using System.IO;
|
|
@@ -11,7 +11,7 @@ using System.Text;
|
|
|
11
11
|
using System.Threading;
|
|
12
12
|
using System.Threading.Tasks;
|
|
13
13
|
|
|
14
|
-
namespace
|
|
14
|
+
namespace Http.Runtime;
|
|
15
15
|
|
|
16
16
|
internal sealed partial class Transport
|
|
17
17
|
{
|
package/dist/runtime/go/auth.go
CHANGED
package/dist/runtime/go/body.go
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Code generated by
|
|
1
|
+
// Code generated by clients. DO NOT EDIT.
|
|
2
2
|
|
|
3
3
|
package sdk
|
|
4
4
|
|
|
@@ -62,7 +62,7 @@ func (b requestBody) bytes() ([]byte, error) {
|
|
|
62
62
|
if b.hasJSON {
|
|
63
63
|
encoded, err := json.Marshal(b.json)
|
|
64
64
|
if err != nil {
|
|
65
|
-
return nil, fmt.Errorf("
|
|
65
|
+
return nil, fmt.Errorf("httpsdk: marshal body: %w", err)
|
|
66
66
|
}
|
|
67
67
|
return encoded, nil
|
|
68
68
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Code generated by
|
|
1
|
+
// Code generated by clients. DO NOT EDIT.
|
|
2
2
|
|
|
3
3
|
package sdk
|
|
4
4
|
|
|
@@ -18,7 +18,7 @@ type APIError interface {
|
|
|
18
18
|
Status() int
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
// ErrorKey is a
|
|
21
|
+
// ErrorKey is a backend error key. A declared key is a constant that is itself an error, so
|
|
22
22
|
// errors.Is(err, ErrItemNotFound) matches any *ClientError carrying that key.
|
|
23
23
|
type ErrorKey string
|
|
24
24
|
|
|
@@ -31,7 +31,7 @@ type FieldError struct {
|
|
|
31
31
|
Path string `json:"path"`
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
// ErrorEnvelope is
|
|
34
|
+
// ErrorEnvelope is backend's error body. Members it does not name, or that have another type than
|
|
35
35
|
// the envelope's, are kept raw in Extra.
|
|
36
36
|
type ErrorEnvelope struct {
|
|
37
37
|
Status int `json:"status,omitempty"`
|
|
@@ -42,7 +42,7 @@ type ErrorEnvelope struct {
|
|
|
42
42
|
Extra map[string]json.RawMessage `json:"-"`
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
// ClientError is a non-2xx answer: its status,
|
|
45
|
+
// ClientError is a non-2xx answer: its status, backend error key, a sanitized message, the parsed
|
|
46
46
|
// envelope, the raw body and the response (its Body re-readable). Reach it with errors.As:
|
|
47
47
|
//
|
|
48
48
|
// var ce *ClientError
|
|
@@ -141,7 +141,7 @@ func raiseForStatus(resp *http.Response, body []byte) error {
|
|
|
141
141
|
return e
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
// parseEnvelope reads
|
|
144
|
+
// parseEnvelope reads backend's envelope from a JSON object body, and the message to show: the
|
|
145
145
|
// envelope's string message when it has one, else the body text.
|
|
146
146
|
func parseEnvelope(body []byte) (ErrorEnvelope, string) {
|
|
147
147
|
var env ErrorEnvelope
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Code generated by
|
|
1
|
+
// Code generated by clients. DO NOT EDIT.
|
|
2
2
|
|
|
3
3
|
package sdk
|
|
4
4
|
|
|
@@ -8,17 +8,17 @@ import (
|
|
|
8
8
|
"net/http"
|
|
9
9
|
)
|
|
10
10
|
|
|
11
|
-
// The
|
|
11
|
+
// The Http* functions expose the SDK's URL, SSE and error handling to the generated CLI, so both
|
|
12
12
|
// send byte-identical requests and read answers the same way.
|
|
13
13
|
|
|
14
|
-
//
|
|
15
|
-
func
|
|
14
|
+
// HttpExpandPath fills a path template with escaped values and refuses "", "." and "..".
|
|
15
|
+
func HttpExpandPath(template string, params map[string]string) (string, error) {
|
|
16
16
|
return expandPath(template, params)
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
//
|
|
19
|
+
// HttpBuildURL joins base and an escaped path (keeping the base path) and appends the query pairs
|
|
20
20
|
// in order.
|
|
21
|
-
func
|
|
21
|
+
func HttpBuildURL(baseURL, path string, query [][2]string) (string, error) {
|
|
22
22
|
q := make(queryList, 0, len(query))
|
|
23
23
|
for _, p := range query {
|
|
24
24
|
q = append(q, queryPair{key: p[0], value: p[1]})
|
|
@@ -26,12 +26,12 @@ func HoneyBuildURL(baseURL, path string, query [][2]string) (string, error) {
|
|
|
26
26
|
return buildURL(baseURL, path, q)
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
//
|
|
30
|
-
func
|
|
29
|
+
// HttpParseSSEStream yields the events of an SSE response and closes its body.
|
|
30
|
+
func HttpParseSSEStream(ctx context.Context, resp *http.Response) iter.Seq2[SSEEvent[string], error] {
|
|
31
31
|
return parseSSEStream(ctx, resp)
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
//
|
|
35
|
-
func
|
|
34
|
+
// HttpRaiseForStatus returns the typed error for a non-2xx response, or nil.
|
|
35
|
+
func HttpRaiseForStatus(resp *http.Response, body []byte) error {
|
|
36
36
|
return raiseForStatus(resp, body)
|
|
37
37
|
}
|
package/dist/runtime/go/hooks.go
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Code generated by
|
|
1
|
+
// Code generated by clients. DO NOT EDIT.
|
|
2
2
|
|
|
3
3
|
package sdk
|
|
4
4
|
|
|
@@ -38,7 +38,7 @@ type ResponseContext struct {
|
|
|
38
38
|
func runHooks[C any](phase string, hooks []func(C) error, rc C) error {
|
|
39
39
|
for _, hook := range hooks {
|
|
40
40
|
if err := hook(rc); err != nil {
|
|
41
|
-
return fmt.Errorf("
|
|
41
|
+
return fmt.Errorf("httpsdk: %s hook: %w", phase, err)
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
return nil
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Code generated by
|
|
1
|
+
// Code generated by clients. DO NOT EDIT.
|
|
2
2
|
|
|
3
3
|
package sdk
|
|
4
4
|
|
|
@@ -85,7 +85,7 @@ func interpolatePath(template string, params map[string]string) (string, error)
|
|
|
85
85
|
return prefix + escapePathSegment(val)
|
|
86
86
|
})
|
|
87
87
|
if missing != "" {
|
|
88
|
-
return "", fmt.Errorf("
|
|
88
|
+
return "", fmt.Errorf("httpsdk: missing path param %q", missing)
|
|
89
89
|
}
|
|
90
90
|
return out, nil
|
|
91
91
|
}
|
package/dist/runtime/go/log.go
CHANGED
package/dist/runtime/go/path.go
CHANGED
package/dist/runtime/go/query.go
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Code generated by
|
|
1
|
+
// Code generated by clients. DO NOT EDIT.
|
|
2
2
|
|
|
3
3
|
package sdk
|
|
4
4
|
|
|
@@ -121,7 +121,7 @@ func buildURL(baseURL, path string, query queryList) (string, error) {
|
|
|
121
121
|
return "", err
|
|
122
122
|
}
|
|
123
123
|
if base.Scheme == "" || base.Host == "" {
|
|
124
|
-
return "", fmt.Errorf("
|
|
124
|
+
return "", fmt.Errorf("httpsdk: base URL %q needs a scheme and host", baseURL)
|
|
125
125
|
}
|
|
126
126
|
if !strings.HasPrefix(path, "/") {
|
|
127
127
|
path = "/" + path
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Code generated by
|
|
1
|
+
// Code generated by clients. DO NOT EDIT.
|
|
2
2
|
|
|
3
3
|
package sdk
|
|
4
4
|
|
|
@@ -45,7 +45,7 @@ const (
|
|
|
45
45
|
)
|
|
46
46
|
|
|
47
47
|
// ErrConnectionClosed is returned by Connect after Close.
|
|
48
|
-
var ErrConnectionClosed = errors.New("
|
|
48
|
+
var ErrConnectionClosed = errors.New("httpsdk: ResumableConnection closed")
|
|
49
49
|
|
|
50
50
|
// ResumableConnection runs a chain of Transports: the last one that worked is tried first, then
|
|
51
51
|
// the whole chain in order. Events arrive on Events() and a terminal error on Errors(); Close stops
|
|
@@ -79,7 +79,7 @@ type ResumableConnection struct {
|
|
|
79
79
|
// defaults). It panics when transports is empty, a programming error.
|
|
80
80
|
func NewResumableConnection(baseURL string, transports []Transport, opts *TransportOpts) *ResumableConnection {
|
|
81
81
|
if len(transports) == 0 {
|
|
82
|
-
panic("
|
|
82
|
+
panic("httpsdk: NewResumableConnection requires at least one transport")
|
|
83
83
|
}
|
|
84
84
|
var o TransportOpts
|
|
85
85
|
if opts != nil {
|
|
@@ -223,7 +223,7 @@ func (r *ResumableConnection) Send(ctx context.Context, data any) error {
|
|
|
223
223
|
conn := r.conn
|
|
224
224
|
r.mu.Unlock()
|
|
225
225
|
if conn == nil {
|
|
226
|
-
return errors.New("
|
|
226
|
+
return errors.New("httpsdk: ResumableConnection not connected")
|
|
227
227
|
}
|
|
228
228
|
return conn.Send(ctx, data)
|
|
229
229
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Code generated by
|
|
1
|
+
// Code generated by clients. DO NOT EDIT.
|
|
2
2
|
|
|
3
3
|
package sdk
|
|
4
4
|
|
|
@@ -58,7 +58,7 @@ func redirectClient(base *http.Client, policy RedirectPolicy) *http.Client {
|
|
|
58
58
|
return next(req, via)
|
|
59
59
|
}
|
|
60
60
|
if len(via) >= maxRedirects {
|
|
61
|
-
return errors.New("
|
|
61
|
+
return errors.New("httpsdk: stopped after " + strconv.Itoa(maxRedirects) + " redirects")
|
|
62
62
|
}
|
|
63
63
|
return nil
|
|
64
64
|
}
|