viell-effect-schema-http 0.1.0-rc.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/README.md +93 -48
  2. package/dist/concurrency/Interaction.d.ts +39 -6
  3. package/dist/concurrency/Interaction.d.ts.map +1 -1
  4. package/dist/concurrency/Interaction.js +25 -4
  5. package/dist/concurrency/Interaction.js.map +1 -1
  6. package/dist/http/Body.d.ts +142 -22
  7. package/dist/http/Body.d.ts.map +1 -1
  8. package/dist/http/Body.js +118 -14
  9. package/dist/http/Body.js.map +1 -1
  10. package/dist/http/Operation.d.ts +332 -12
  11. package/dist/http/Operation.d.ts.map +1 -1
  12. package/dist/http/Operation.js +255 -9
  13. package/dist/http/Operation.js.map +1 -1
  14. package/dist/http/Policy.d.ts +49 -13
  15. package/dist/http/Policy.d.ts.map +1 -1
  16. package/dist/http/Policy.js +32 -10
  17. package/dist/http/Policy.js.map +1 -1
  18. package/dist/http/Request.d.ts +661 -79
  19. package/dist/http/Request.d.ts.map +1 -1
  20. package/dist/http/Request.js +762 -120
  21. package/dist/http/Request.js.map +1 -1
  22. package/dist/http/Response.d.ts +200 -11
  23. package/dist/http/Response.d.ts.map +1 -1
  24. package/dist/http/Response.js +149 -10
  25. package/dist/http/Response.js.map +1 -1
  26. package/dist/http/Transport.d.ts +59 -11
  27. package/dist/http/Transport.d.ts.map +1 -1
  28. package/dist/http/Transport.js +46 -9
  29. package/dist/http/Transport.js.map +1 -1
  30. package/dist/http/UrlEncoding.d.ts +81 -9
  31. package/dist/http/UrlEncoding.d.ts.map +1 -1
  32. package/dist/http/UrlEncoding.js +41 -5
  33. package/dist/http/UrlEncoding.js.map +1 -1
  34. package/dist/http/internal/fields.d.ts +17 -4
  35. package/dist/http/internal/fields.d.ts.map +1 -1
  36. package/dist/http/internal/fields.js +11 -6
  37. package/dist/http/internal/fields.js.map +1 -1
  38. package/dist/http/internal/input.d.ts +39 -0
  39. package/dist/http/internal/input.d.ts.map +1 -0
  40. package/dist/http/internal/input.js +40 -0
  41. package/dist/http/internal/input.js.map +1 -0
  42. package/dist/http/internal/shape.d.ts +44 -0
  43. package/dist/http/internal/shape.d.ts.map +1 -0
  44. package/dist/http/internal/shape.js +179 -0
  45. package/dist/http/internal/shape.js.map +1 -0
  46. package/dist/main.d.ts +24 -0
  47. package/dist/main.d.ts.map +1 -1
  48. package/dist/main.js +24 -0
  49. package/dist/main.js.map +1 -1
  50. package/package.json +13 -13
  51. package/src/concurrency/Interaction.ts +39 -6
  52. package/src/http/Body.ts +158 -27
  53. package/src/http/Operation.ts +530 -32
  54. package/src/http/Policy.ts +49 -13
  55. package/src/http/Request.ts +1241 -227
  56. package/src/http/Response.ts +316 -28
  57. package/src/http/Transport.ts +59 -11
  58. package/src/http/UrlEncoding.ts +89 -10
  59. package/src/http/internal/fields.ts +37 -9
  60. package/src/http/internal/input.ts +123 -0
  61. package/src/http/internal/shape.ts +279 -0
  62. package/src/main.ts +24 -0
package/dist/http/Body.js CHANGED
@@ -1,10 +1,31 @@
1
1
  import { Effect, Pipeable, Schema, Stream } from "effect";
2
2
  import { HttpBody, HttpClientError, } from "effect/http";
3
+ import * as Inputs from "./internal/input.js";
4
+ /**
5
+ * Create a custom outgoing body encoder from an Effect-returning function.
6
+ *
7
+ * @remarks
8
+ * Return an Effect `HttpBody` with the representation and content metadata your service needs.
9
+ */
3
10
  export const encoder = (encode) => ({
4
11
  ...Pipeable.Prototype,
5
12
  encode,
6
13
  });
14
+ /**
15
+ * Create a custom response-body decoder from an Effect-returning function.
16
+ *
17
+ * @remarks
18
+ * `mediaType` contributes to automatic `Accept`; it does not validate response Content-Type.
19
+ * Return typed failures through the Effect error channel; thrown exceptions are defects.
20
+ */
7
21
  export const decoder = (decode, mediaType) => ({ ...Pipeable.Prototype, decode, mediaType });
22
+ /**
23
+ * Combine custom encoding and decoding functions into one body codec.
24
+ *
25
+ * @remarks
26
+ * `mediaType` describes the accepted response representation. Outgoing content metadata comes
27
+ * from the `HttpBody` returned by `encode`. `encode` may take more than `decode` returns.
28
+ */
8
29
  export const make = (options) => ({
9
30
  ...Pipeable.Prototype,
10
31
  encode: options.encode,
@@ -19,9 +40,12 @@ const decodeFailure = (response, cause) => new HttpClientError.HttpClientError({
19
40
  }),
20
41
  });
21
42
  /**
22
- * Any JSON value, encoded with `HttpBody.json`. Like it, a value `JSON.stringify` omits, such as `undefined`,
23
- * encodes as an empty body; use {@link jsonSchema} to validate first. Unlike `response.json`, an empty
24
- * response body is a decoding failure rather than `null`.
43
+ * Read and write JSON without schema validation.
44
+ *
45
+ * @remarks
46
+ * Encoding uses Effect's `HttpBody.json`. Values omitted by `JSON.stringify`, such as
47
+ * `undefined`, produce an empty outgoing body. An empty incoming body is a decoding failure,
48
+ * not `null`. Use {@link jsonSchema} to validate and transform application values.
25
49
  */
26
50
  export const json = make({
27
51
  encode: (value) => HttpBody.json(value),
@@ -32,57 +56,137 @@ export const json = make({
32
56
  mediaType: "application/json",
33
57
  });
34
58
  /**
35
- * UTF-8 text. Incoming decoding delegates to `response.text`. Fetch-backed providers ignore charset
36
- * parameters, strip a leading UTF-8 BOM, and replace malformed bytes with U+FFFD without failing.
37
- * Use {@link bytes} with a schema or custom decoder for strict or non-UTF-8 decoding.
59
+ * Read and write text, with `text/plain` as the media type.
60
+ *
61
+ * @remarks
62
+ * Outgoing text is UTF-8. Incoming decoding delegates to the provider's `response.text`.
63
+ * Fetch-backed providers ignore charset parameters, strip a leading UTF-8 BOM, and replace
64
+ * malformed bytes with U+FFFD. Use {@link bytes} for strict or non-UTF-8 decoding.
38
65
  */
39
66
  export const text = make({
40
67
  encode: (value) => Effect.sync(() => HttpBody.text(value)),
41
68
  decode: (response) => response.text,
42
69
  mediaType: "text/plain",
43
70
  });
71
+ /**
72
+ * Read and write `Uint8Array` bodies as `application/octet-stream`.
73
+ *
74
+ * @remarks
75
+ * Incoming bytes are buffered. Use a schema or custom decoder to interpret another encoding.
76
+ */
44
77
  export const bytes = make({
45
78
  encode: (value) => Effect.sync(() => HttpBody.uint8Array(value)),
46
79
  decode: (response) => Effect.map(response.arrayBuffer, (buffer) => new Uint8Array(buffer)),
47
80
  mediaType: "application/octet-stream",
48
81
  });
49
- /** Multipart form data. The transport owns the boundary and its Content-Type. */
82
+ /**
83
+ * Read and write Web `FormData` as multipart form data.
84
+ *
85
+ * @remarks
86
+ * The transport supplies the outgoing multipart boundary and its Content-Type. A Content-Type the
87
+ * request declares replaces it, and without the boundary the body cannot be read. Decoding
88
+ * delegates to the HTTP provider.
89
+ */
50
90
  export const formData = make({
51
91
  encode: (value) => Effect.sync(() => HttpBody.formData(value)),
52
92
  decode: (response) => response.formData,
53
93
  mediaType: "multipart/form-data",
54
94
  });
95
+ /**
96
+ * Read and write form bodies using Effect's `UrlParams.UrlParams`.
97
+ *
98
+ * @remarks
99
+ * Construct values with `UrlParams.fromInput` from `effect/http`. The media type is
100
+ * `application/x-www-form-urlencoded`.
101
+ */
55
102
  export const urlEncoded = make({
56
103
  encode: (value) => Effect.sync(() => HttpBody.urlParams(value)),
57
104
  decode: (response) => response.urlParamsBody,
58
105
  mediaType: "application/x-www-form-urlencoded",
59
106
  });
60
107
  const isEmptyBody = (error) => error.reason._tag === "EmptyBodyError";
61
- /** No outgoing body. Incoming bytes, including unexpected ones, are drained without buffering. */
108
+ /**
109
+ * Send no body, or discard an incoming body when its content is not needed.
110
+ *
111
+ * @remarks
112
+ * Decoding drains even unexpected incoming bytes without buffering them. Draining has no
113
+ * intrinsic timeout; use an attempt or operation timeout for an unbounded response.
114
+ */
62
115
  export const empty = make({
63
116
  encode: () => Effect.succeed(HttpBody.empty),
64
117
  decode: (response) => Stream.runDrain(response.stream).pipe(Effect.catchIf(isEmptyBody, () => Effect.void)),
65
118
  });
119
+ /**
120
+ * Transform a decoded value with a pure function, preserving its media type.
121
+ *
122
+ * @remarks
123
+ * Returns a decoder only. Use {@link mapEffect} if the transformation may fail or need services.
124
+ */
66
125
  export const map = (f) => (self) => decoder((response) => Effect.map(self.decode(response), f), self.mediaType);
126
+ /**
127
+ * Transform a decoded value with an Effect, adding its errors and required services.
128
+ *
129
+ * @remarks
130
+ * Returns a decoder only and preserves the media type. When used in a response case, this work
131
+ * is part of that attempt's decoding and is covered by its timeout.
132
+ */
67
133
  export const mapEffect = (f) => (self) => decoder((response) => Effect.flatMap(self.decode(response), f), self.mediaType);
68
- /** Validate a decoded value with a schema. A failure is final: it never falls through to another response case. */
134
+ /**
135
+ * Validate and transform a decoded value with an Effect schema.
136
+ *
137
+ * @example
138
+ * ```ts
139
+ * import { Schema } from "effect";
140
+ * import { Body } from "viell-effect-schema-http";
141
+ * const numberFromText = Body.text.pipe(Body.schema(Schema.FiniteFromString));
142
+ * // Decodes the text "42" to the number 42.
143
+ * ```
144
+ *
145
+ * @remarks
146
+ * Returns a decoder with the schema's application type. A failure in a selected response case
147
+ * is final for that attempt; it does not try a later response case.
148
+ */
69
149
  export const schema = (contract) => {
70
150
  const decode = Schema.decodeUnknownEffect(contract);
71
151
  return (self) => self.pipe(mapEffect((value) => decode(value)));
72
152
  };
73
- /** Validate application input with a schema and encode it with the selected wire encoder. */
153
+ /**
154
+ * Validate and encode application input before passing it to a body encoder.
155
+ *
156
+ * @remarks
157
+ * The schema's encoded type must match the underlying encoder's input. Returns an encoder only;
158
+ * use {@link schema} for the decoding direction. The input takes either side of the schema, or a
159
+ * mix by field, as `Request.Input` describes, so a plain object works for a `Schema.Class`, and
160
+ * the underlying encoder receives what the schema writes.
161
+ */
74
162
  export const encodeSchema = (contract) => {
75
- const encode = Schema.encodeEffect(contract);
163
+ const encode = Inputs.encoder(contract, Schema.encodeEffect(contract));
76
164
  return (self) => encoder((value) => Effect.flatMap(encode(value), self.encode));
77
165
  };
78
166
  /**
79
- * Bidirectional JSON through the schema's canonical JSON codec (`Schema.toCodecJson`), as in Effect's own
80
- * JSON body helpers.
167
+ * Read and write schema-validated JSON, returning the schema's application type.
168
+ *
169
+ * @example
170
+ * ```ts
171
+ * import { Schema } from "effect";
172
+ * import { Body } from "viell-effect-schema-http";
173
+ * const user = Body.jsonSchema(Schema.Struct({ id: Schema.Number, name: Schema.String }));
174
+ * ```
175
+ *
176
+ * @remarks
177
+ * Uses `Schema.toCodecJson` to obtain the schema's canonical JSON codec. Encoding failures occur
178
+ * before dispatch; an operation wraps response decoding failures in `Response.DecodeError`.
179
+ *
180
+ * Encoding takes either side of the schema, or a mix by field, as `Request.Input` describes, and
181
+ * writes the canonical JSON. The encoded side is the schema's own, so a `Schema.Date` field takes a
182
+ * `Date`, not the ISO text JSON carries. Decoding returns the schema's application type, so a class
183
+ * comes back as an instance.
81
184
  */
82
185
  export const jsonSchema = (contract) => {
83
186
  const codec = Schema.toCodecJson(contract);
187
+ const encode = Inputs.encoder(contract, Schema.encodeEffect(codec));
84
188
  return make({
85
- encode: encodeSchema(codec)(json).encode,
189
+ encode: (value) => Effect.flatMap(encode(value), json.encode),
86
190
  decode: json.pipe(schema(codec)).decode,
87
191
  mediaType: json.mediaType,
88
192
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Body.js","sourceRoot":"","sources":["../../src/http/Body.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC1D,OAAO,EACL,QAAQ,EACR,eAAe,GAGhB,MAAM,aAAa,CAAC;AA8BrB,MAAM,CAAC,MAAM,OAAO,GAAG,CACrB,MAA4D,EAC1C,EAAE,CAAC,CAAC;IACtB,GAAG,QAAQ,CAAC,SAAS;IACrB,MAAM;CACP,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,CACrB,MAE2B,EAC3B,SAAkB,EACA,EAAE,CAAC,CAAC,EAAE,GAAG,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;AAEtE,MAAM,CAAC,MAAM,IAAI,GAAG,CAMlB,OAQD,EAAsE,E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AAM,CAAC,MAAM,YAAY,GAAG,CAAuB,QAAW,EAAE,EAAE;IAChE,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;IACvE,OAAO,CACL,IAAiC,EAKjC,EAAE,CACF,OAAO,CAAC,CAAC,KAAsB,EAAE,EAAE,CACjC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAC3C,CAAC;AACN,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,QAAW,EAQX,EAAE;IACF,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC3C,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;IACpE,OAAO,IAAI,CAAC;QACV,MAAM,EAAE,CAAC,KAAsB,EAAE,EAAE,CACjC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;QAC5C,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM;QACvC,SAAS,EAAE,IAAI,CAAC,SAAS;KAC1B,CAAC,CAAC;AACL,CAAC,CAAC"}
@@ -3,32 +3,352 @@ import { HttpClient, HttpClientError } from "effect/http";
3
3
  import * as Policy from "./Policy.js";
4
4
  import * as Request from "./Request.js";
5
5
  import * as Response from "./Response.js";
6
- /** A request paired with its response contract. Execution returns an ordinary cold Effect. */
7
- export interface Operation<in I, out A, out E = never, out R = never> extends Pipeable.Pipeable {
6
+ /**
7
+ * An executable contract with typed input, output, failures and required services.
8
+ *
9
+ * @remarks
10
+ * `execute(input)` returns a cold Effect: work starts when it is evaluated, and each evaluation
11
+ * runs again. `Operation.make` supplies HTTP execution; `fromEffect` adapts an existing function.
12
+ * With `make`, the request bindings determine `I`. {@link InputOf} extracts it.
13
+ *
14
+ * `make` also keeps what it was built from in `parts`, which `P` describes, so {@link mapRequest},
15
+ * {@link mapResponse} and {@link mapOptions} can derive a variant. Annotating a value as
16
+ * `Operation<I, A, E, R>` leaves `P` unknown, which stops those functions compiling on it.
17
+ */
18
+ export interface Operation<in I, out A, out E = never, out R = never, out P = unknown> extends Pipeable.Pipeable {
8
19
  readonly execute: (input: I) => Effect.Effect<A, E, R>;
20
+ /** What the operation was built from. A value from {@link fromEffect} has no parts. */
21
+ readonly parts?: P;
9
22
  }
10
- /** Adapt an Effect-returning function. Each execution is suspended, so construction stays pure. */
23
+ /**
24
+ * The input an operation's `execute` takes.
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * import { Schema } from "effect";
29
+ * import { Body, Operation, Request, Response } from "viell-effect-schema-http";
30
+ * const search = Operation.make(
31
+ * Request.get("https://api.example.test/things").pipe(
32
+ * Request.query(Schema.Struct({ sort: Schema.String })),
33
+ * ),
34
+ * Response.status(200, Body.json),
35
+ * );
36
+ * type SearchInput = Operation.InputOf<typeof search>;
37
+ * const searchAll = (input: SearchInput) => search.execute(input);
38
+ * ```
39
+ *
40
+ * @remarks
41
+ * `Request.InputOf` gives the same for a request.
42
+ */
43
+ export type InputOf<O> = O extends Operation<infer I, unknown, unknown, unknown, unknown> ? I : never;
44
+ /**
45
+ * Adapt an Effect-returning function to the operation interface.
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * import { Body, Operation, Request, Response } from "viell-effect-schema-http";
50
+ * const health = Operation.make(
51
+ * Request.get("https://api.example.test/health"),
52
+ * Response.status(200, Body.text),
53
+ * );
54
+ * // Callers can run this and map its result, and cannot adjust what it sends.
55
+ * const sealed = Operation.fromEffect(health.execute);
56
+ * ```
57
+ *
58
+ * @remarks
59
+ * The function is suspended until evaluation. This adapter adds no HTTP dispatch, decoding,
60
+ * retry policy or scope management beyond what the supplied function already does.
61
+ *
62
+ * The result has no parts, at compile time or at run time. So
63
+ * `Operation.fromEffect(operation.execute)` seals a definition: it keeps the same types and offers
64
+ * no adjustment.
65
+ */
11
66
  export declare const fromEffect: <I, A, E, R>(execute: (input: I) => Effect.Effect<A, E, R>) => Operation<I, A, E, R>;
67
+ /**
68
+ * Optional retry policy and per-attempt HTTP client transformation.
69
+ */
12
70
  export interface Options<E = HttpClientError.HttpClientError, R = never, EP = never, RP = never> {
71
+ /** Retry selection, budget and attempt timeout. Defaults to `Policy.none`. */
13
72
  readonly policy?: Policy.Policy<EP, RP> | undefined;
14
73
  /**
15
- * A native client transformation applied inside each attempt, after request materialization, suitable
16
- * for nonces and URL-dependent signatures. Run a signer after other request edits it must cover.
74
+ * Customize the HTTP client separately for each attempt.
75
+ *
76
+ * @remarks
77
+ * Applied after request preparation, suitable for fresh credentials or URL-dependent signatures.
78
+ * Run a signer after other request edits it must cover. Native status filters can reject responses
79
+ * before the declared response contract sees them.
80
+ * `attempt` starts at `1` and matches the `http.attempt` log annotation. A function with an optional
81
+ * second parameter of its own receives the number there, so wrap one in an arrow function.
17
82
  * Appending native URL parameters can reserialize the entire query as form data, changing bare keys and
18
83
  * escapes. Prefer Request query combinators, or preserve the query text when editing the URL directly.
19
84
  */
20
- readonly transformClient?: ((client: HttpClient.HttpClient) => HttpClient.HttpClient.With<E, R>) | undefined;
85
+ readonly transformClient?: ((client: HttpClient.HttpClient, attempt: number) => HttpClient.HttpClient.With<E, R>) | undefined;
21
86
  }
22
87
  /**
23
- * Materialize the request once, then run attempts under the policy. Each attempt owns a Scope that covers
24
- * dispatch and decoding; it closes before the outcome is classified or a retry delay begins.
88
+ * Combine a request and response contract into an executable HTTP operation.
89
+ *
90
+ * @example
91
+ * ```ts
92
+ * import { Effect } from "effect";
93
+ * import { FetchHttpClient } from "effect/http";
94
+ * import { Body, Operation, Request, Response } from "viell-effect-schema-http";
95
+ * const health = Operation.make(
96
+ * Request.get("https://api.example.test/health"),
97
+ * Response.status(200, Body.text),
98
+ * );
99
+ * const program = health.execute(undefined).pipe(Effect.provide(FetchHttpClient.layer));
100
+ * // Evaluate program only after choosing your real service URL.
101
+ * ```
102
+ *
103
+ * @remarks
104
+ * Defaults to one attempt with no library-imposed timeout. The caller supplies Effect's
105
+ * `HttpClient` service and evaluates `execute(input)`.
106
+ *
107
+ * Each evaluation prepares input once. Each attempt then owns a scope covering client execution
108
+ * and body decoding; cleanup completes before classification or a retry delay. Decoder and
109
+ * client `Scope` requirements are supplied by the attempt. Interruption and defects never retry.
110
+ * An automatic `Accept` header is added only when the request declares none and has not removed
111
+ * it with `Request.removeHeader`.
112
+ *
113
+ * The result keeps its parts, so a definition written once can be adjusted where it is used with
114
+ * {@link mapRequest}, {@link mapResponse} and {@link mapOptions}. The original never changes.
115
+ */
116
+ export declare const make: <I, E, R, A, E2, R2, E3 = HttpClientError.HttpClientError, R3 = never, EP = never, RP = never, C extends Response.AnyCase = Response.AnyCase>(request: Request.Request<I, E, R>, response: Response.Response<A, E2, R2, C>, options?: Options<E3, R3, EP, RP>) => Http<Request.Request<I, E, R>, Response.Response<A, E2, R2, C>, Options<E3, R3, EP, RP>>;
117
+ /**
118
+ * Return the Effect for an operation's input, in direct or pipeable form.
119
+ *
120
+ * @remarks
121
+ * Equivalent to `operation.execute(input)`. It does not itself evaluate the Effect.
25
122
  */
26
- export declare const make: <I, E, R, H extends boolean, Q extends boolean, A, E2, R2, E3 = HttpClientError.HttpClientError, R3 = never, EP = never, RP = never>(request: Request.Request<I, E, R, H, Q>, response: Response.Response<A, E2, R2>, options?: Options<E3, R3, EP, RP>) => Operation<I, A, E | E3 | EP | Request.InvalidRequest | HttpClientError.HttpClientError | Response.UnexpectedResponse | Response.DecodeError<E2 | HttpClientError.HttpClientError> | Cause.TimeoutError, R | RP | Exclude<R2 | R3, Scope.Scope> | HttpClient.HttpClient>;
27
123
  export declare const execute: {
28
124
  <I>(input: I): <A, E, R>(self: Operation<I, A, E, R>) => Effect.Effect<A, E, R>;
29
125
  <I, A, E, R>(self: Operation<I, A, E, R>, input: I): Effect.Effect<A, E, R>;
30
126
  };
31
- /** Interpret a successful result, for example to move a recognized outcome into the failure channel. */
32
- export declare const map: <A, B>(f: (value: A) => B) => <I, E, R>(self: Operation<I, A, E, R>) => Operation<I, B, E, R>;
33
- export declare const mapEffect: <A, B, E2, R2>(f: (value: A) => Effect.Effect<B, E2, R2>) => <I, E, R>(self: Operation<I, A, E, R>) => Operation<I, B, E | E2, R | R2>;
127
+ /**
128
+ * The conversion {@link map} and {@link mapEffect} recorded, run once after the parts.
129
+ *
130
+ * @remarks
131
+ * Only its failures and services are in the type. Its result is the operation's own `A`, and what
132
+ * it was written for is what the response still produces, so neither is repeated here.
133
+ */
134
+ export interface Step<out E = never, out R = never> {
135
+ readonly run: (value: never) => Effect.Effect<unknown, E, R>;
136
+ }
137
+ /**
138
+ * What {@link make} keeps: the three parts as given, and any recorded {@link Step}.
139
+ *
140
+ * @remarks
141
+ * Read a part with `operation.parts?.request`. Each whole part is one type parameter, which keeps
142
+ * the parameter count down as `Schema.decodeTo` does.
143
+ *
144
+ * `S` is invariant: widening it by annotation could otherwise make any response look as if it fits
145
+ * a recorded step.
146
+ *
147
+ * {@link mapRequest}, {@link mapResponse}, {@link mapOptions} and {@link unmap} build from these,
148
+ * so they drop an `execute` replaced on the value. {@link map} and {@link mapEffect} wrap
149
+ * `execute` itself, and keep it.
150
+ */
151
+ export interface Parts<out Q, in out S, out O, out T = undefined> {
152
+ readonly request: Q;
153
+ readonly response: S;
154
+ readonly options: O | undefined;
155
+ readonly step: T;
156
+ }
157
+ type RequestFailure<Q> = Q extends Request.Request<never, infer E, unknown> ? E : never;
158
+ type RequestServices<Q> = Q extends Request.Request<never, unknown, infer R> ? R : never;
159
+ type ValueOf<S> = S extends Response.Response<infer A, unknown, unknown, infer _C> ? A : never;
160
+ type ResponseFailure<S> = S extends Response.Response<unknown, infer E, unknown, infer _C> ? E : never;
161
+ type ResponseServices<S> = S extends Response.Response<unknown, unknown, infer R, infer _C> ? R : never;
162
+ type ClientFailure<O> = O extends Options<infer E, infer _R, infer _EP, infer _RP> ? E : never;
163
+ type ClientServices<O> = O extends Options<infer _E, infer R, infer _EP, infer _RP> ? R : never;
164
+ type PolicyFailure<O> = O extends Options<infer _E, infer _R, infer E, infer _RP> ? E : never;
165
+ type PolicyServices<O> = O extends Options<infer _E, infer _R, infer _EP, infer R> ? R : never;
166
+ type StepFailure<T> = T extends Step<infer E, unknown> ? E : never;
167
+ type StepServices<T> = T extends Step<unknown, infer R> ? R : never;
168
+ /** An operation fresh from {@link make}: three parts, no step, and the response's own result. */
169
+ export type Http<Q, S, O> = Derived<ValueOf<S>, Q, S, O>;
170
+ /**
171
+ * An operation built from parts, returning `B`.
172
+ *
173
+ * @remarks
174
+ * `B` comes first so that an editor hover shows the result before the parts. The unions stay
175
+ * inline: a named alias would print with all of `Q`, `S` and `O` repeated inside it.
176
+ */
177
+ export type Derived<B, Q, S, O, T = undefined> = Operation<Request.InputOf<Q>, B, RequestFailure<Q> | ClientFailure<O> | PolicyFailure<O> | StepFailure<T> | Request.InvalidRequest | HttpClientError.HttpClientError | Response.UnexpectedResponse | Response.DecodeError<ResponseFailure<S> | HttpClientError.HttpClientError> | Cause.TimeoutError, RequestServices<Q> | PolicyServices<O> | StepServices<T> | Exclude<ResponseServices<S> | ClientServices<O>, Scope.Scope> | HttpClient.HttpClient, Parts<Q, S, O, T>>;
178
+ /**
179
+ * Any operation carrying the parts `P` and returning `B`.
180
+ *
181
+ * @remarks
182
+ * What {@link mapRequest}, {@link mapResponse}, {@link mapOptions} and {@link unmap} accept. The
183
+ * input, failures and services are left open because a variant works them out again from `P`.
184
+ */
185
+ export type Adjustable<B, P> = Operation<never, B, unknown, unknown, P>;
186
+ /**
187
+ * Derive a variant with a changed request. A recorded result step stays.
188
+ *
189
+ * @example
190
+ * ```ts
191
+ * import { Body, Operation, Request, Response } from "viell-effect-schema-http";
192
+ * const getThings = Operation.make(
193
+ * Request.get("https://api.example.test/things?limit=25"),
194
+ * Response.status(200, Body.json),
195
+ * );
196
+ * const firstFive = Request.setQuery("limit", "5");
197
+ * const fewerThings = getThings.pipe(Operation.mapRequest(firstFive));
198
+ * // getThings still asks for 25.
199
+ * ```
200
+ *
201
+ * @remarks
202
+ * The function receives the current request, so every `Request` function works here, including a
203
+ * binding that changes the operation's input. The automatic `Accept` and the options carry over.
204
+ * The library cannot tell whether a change alters the shape of the answer: selecting fields or
205
+ * embedding relations usually does, and then needs {@link mapResponse} too.
206
+ *
207
+ * Works on any operation from {@link make}, mapped or not. A value from {@link fromEffect} has no
208
+ * parts, and one annotated as a plain `Operation<I, A, E, R>` hides them: both are compile errors.
209
+ */
210
+ export declare const mapRequest: <I, E, R, I2, E2, R2>(f: (request: Request.Request<I, E, R>) => Request.Request<I2, E2, R2>) => <B, S, O, T>(self: Adjustable<B, Parts<Request.Request<I, E, R>, S, O, T>>) => Derived<B, Request.Request<I2, E2, R2>, S, O, T>;
211
+ interface NoLongerFits<A> {
212
+ readonly "Use Operation.unmap first, then map again: this response no longer fits the mapping.": A;
213
+ }
214
+ /**
215
+ * The rule {@link mapResponse} applies to a new result `A2`, given the current result `A`.
216
+ *
217
+ * @remarks
218
+ * With no step, `T` is `undefined` and anything fits. With a step, `A2` must be something the
219
+ * current response could produce. An `any` result proves nothing, so it does not fit either.
220
+ *
221
+ * `W` is everything the function returned, and stays `never` when nothing was inferred from it.
222
+ * That means the function itself does not compile, as with a key the contract lacks. `A2` then
223
+ * reads `unknown` for no reason of its own, so the rule stands aside and leaves the function's own
224
+ * error as the only one. A function that returns a response, or `any`, always gives `W` a value, so
225
+ * a result that really is `unknown` is still refused.
226
+ */
227
+ export type Fits<A2, A, T, W = unknown> = [T] extends [undefined] ? unknown : [W] extends [never] ? unknown : 0 extends 1 & A2 ? NoLongerFits<A2> : [A2] extends [A] ? unknown : NoLongerFits<A2>;
228
+ /**
229
+ * Derive a variant with a changed response. A recorded result step stays, and has to fit.
230
+ *
231
+ * @example
232
+ * ```ts
233
+ * import { Schema } from "effect";
234
+ * import { Body, Operation, Request, Response } from "viell-effect-schema-http";
235
+ * const Thing = Schema.Struct({ id: Schema.Number, name: Schema.String });
236
+ * const ThingOption = Schema.Struct({ id: Schema.Number });
237
+ * const getThing = Operation.make(
238
+ * Request.get("https://api.example.test/things/1"),
239
+ * Response.status(200, Body.jsonSchema(Thing)),
240
+ * );
241
+ * const asOption = Response.replace(200, Body.jsonSchema(ThingOption));
242
+ * const thingOption = getThing.pipe(Operation.mapResponse(asOption));
243
+ * ```
244
+ *
245
+ * @remarks
246
+ * The function receives the current response, so {@link Response.replace},
247
+ * {@link Response.remove} and {@link Response.orElse} all work here. The automatic `Accept` follows
248
+ * the new response.
249
+ *
250
+ * On a mapped operation the new result must fit: it has to be assignable to the current response's
251
+ * result, and not `any`, because the recorded step was written for that result. So a same-shape
252
+ * replace or a removal works, and anything else is a compile error that names {@link unmap}.
253
+ * A narrowed result is the new baseline, so widening it back needs {@link unmap} as well.
254
+ * This is a compile-time rule: a cast gets past it, and the step then receives the wrong shape.
255
+ */
256
+ export declare const mapResponse: <A, E, R, C extends Response.AnyCase, A2, E2, R2, C2 extends Response.AnyCase, W = never>(f: (response: Response.Response<A, E, R, C>) => Response.Response<A2, E2, R2, C2> & W) => <B, Q, O, T>(self: Adjustable<B, Parts<Q, Response.Response<A, E, R, C>, O, T>> & Fits<A2, A, T, W>) => Derived<[T] extends [undefined] ? A2 : B, Q, Response.Response<A2, E2, R2, C2>, O, T>;
257
+ /**
258
+ * Derive a variant with changed options. A recorded result step stays.
259
+ *
260
+ * @example
261
+ * ```ts
262
+ * import { Schedule } from "effect";
263
+ * import {
264
+ * Body,
265
+ * Operation,
266
+ * Policy,
267
+ * Request,
268
+ * Response,
269
+ * } from "viell-effect-schema-http";
270
+ * const getThings = Operation.make(
271
+ * Request.get("https://api.example.test/things"),
272
+ * Response.status(200, Body.json),
273
+ * );
274
+ * const retryTwice = Policy.make(Schedule.recurs(2));
275
+ * const patient = getThings.pipe(
276
+ * Operation.mapOptions((options) => ({ ...options, policy: retryTwice })),
277
+ * );
278
+ * ```
279
+ *
280
+ * @remarks
281
+ * The function receives the current options, or `undefined` if there are none, and its result
282
+ * replaces them. Spread them to keep what you do not change. A failure or service type that only
283
+ * a dropped option added leaves with it.
284
+ */
285
+ export declare const mapOptions: <O, E = HttpClientError.HttpClientError, R = never, EP = never, RP = never>(f: (options: O | undefined) => Options<E, R, EP, RP>) => <B, Q, S, T>(self: Adjustable<B, Parts<Q, S, O, T>>) => Derived<B, Q, S, Options<E, R, EP, RP>, T>;
286
+ /**
287
+ * Remove every recorded result step, so the operation returns what its response decodes.
288
+ *
289
+ * @example
290
+ * ```ts
291
+ * import { Schema } from "effect";
292
+ * import { Body, Operation, Request, Response } from "viell-effect-schema-http";
293
+ * const Page = Schema.Struct({ data: Schema.Array(Schema.String) });
294
+ * const Names = Schema.Struct({ data: Schema.Array(Schema.Number) });
295
+ * const getThings = Operation.make(
296
+ * Request.get("https://api.example.test/things"),
297
+ * Response.status(200, Body.jsonSchema(Page)),
298
+ * ).pipe(Operation.map((page) => page.data));
299
+ *
300
+ * const asIds = Response.replace(200, Body.jsonSchema(Names));
301
+ * const thingIds = getThings.pipe(
302
+ * Operation.unmap,
303
+ * Operation.mapResponse(asIds),
304
+ * Operation.map((page) => page.data),
305
+ * );
306
+ * ```
307
+ *
308
+ * @remarks
309
+ * This is the route to a response {@link mapResponse} refuses: remove the mapping, change the
310
+ * response, then map again. The failures and services the steps added leave with them. On an
311
+ * operation with no step this changes nothing.
312
+ */
313
+ export declare const unmap: <B, Q, S, O, T>(self: Adjustable<B, Parts<Q, S, O, T>>) => Http<Q, S, O>;
314
+ /**
315
+ * The parts after {@link map} or {@link mapEffect} records a step adding failures `E` and services
316
+ * `R`. An operation with no parts stays that way.
317
+ *
318
+ * @remarks
319
+ * The conditional lives here, in the fifth argument, because a conditional return type would stop
320
+ * `flow` composing these functions.
321
+ */
322
+ export type Next<P, E, R> = [P] extends [
323
+ Parts<infer Q, infer S, infer O, infer T>
324
+ ] ? Parts<Q, S, O, Step<StepFailure<T> | E, StepServices<T> | R>> : P;
325
+ /**
326
+ * Transform an operation's successful result with a pure function.
327
+ *
328
+ * @remarks
329
+ * Keeps the input, error and service types. Runs once, after the operation and its retry policy
330
+ * finish, outside each attempt's scope and timeout. Use {@link mapEffect} to return a typed failure
331
+ * or perform further effectful work.
332
+ *
333
+ * The operation keeps its parts and records this as a step, so {@link mapRequest} and
334
+ * {@link mapOptions} still work on the result, and {@link mapResponse} works while the new result
335
+ * fits. Two maps combine into one step. The mapping applies to the whole result, whichever case
336
+ * produced it. For a conversion that belongs to one case, use `Body.map` on that case's decoder: a
337
+ * later `Response.replace` takes the conversion with the case.
338
+ */
339
+ export declare const map: <A, B>(f: (value: A) => B) => <I, E, R, P = unknown>(self: Operation<I, A, E, R, P>) => Operation<I, B, E, R, Next<P, never, never>>;
340
+ /**
341
+ * Transform an operation's successful result with an Effect.
342
+ *
343
+ * @remarks
344
+ * Adds the transformation's errors and required services. Runs once, after the operation's retry
345
+ * policy completes, outside each attempt's scope and timeout, so failures here do not trigger that
346
+ * policy and arrive as themselves. Use it to turn a recognized response outcome into an application
347
+ * error.
348
+ *
349
+ * The operation keeps its parts and records this as a step, as {@link map} describes. Its failures
350
+ * and services stay through a variant and leave with {@link unmap}.
351
+ */
352
+ export declare const mapEffect: <A, B, E2, R2>(f: (value: A) => Effect.Effect<B, E2, R2>) => <I, E, R, P = unknown>(self: Operation<I, A, E, R, P>) => Operation<I, B, E | E2, R | R2, Next<P, E2, R2>>;
353
+ export {};
34
354
  //# sourceMappingURL=Operation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Operation.d.ts","sourceRoot":"","sources":["../../src/http/Operation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EAGL,MAAM,EAIN,QAAQ,EAGR,KAAK,KAAK,EACX,MAAM,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