viell-effect-schema-http 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +88 -2
- package/dist/concurrency/Interaction.d.ts +65 -0
- package/dist/concurrency/Interaction.d.ts.map +1 -0
- package/dist/concurrency/Interaction.js +99 -0
- package/dist/concurrency/Interaction.js.map +1 -0
- package/dist/http/Body.d.ts +162 -0
- package/dist/http/Body.d.ts.map +1 -0
- package/dist/http/Body.js +184 -0
- package/dist/http/Body.js.map +1 -0
- package/dist/http/Operation.d.ts +97 -0
- package/dist/http/Operation.d.ts.map +1 -0
- package/dist/http/Operation.js +146 -0
- package/dist/http/Operation.js.map +1 -0
- package/dist/http/Policy.d.ts +82 -0
- package/dist/http/Policy.d.ts.map +1 -0
- package/dist/http/Policy.js +76 -0
- package/dist/http/Policy.js.map +1 -0
- package/dist/http/Request.d.ts +324 -0
- package/dist/http/Request.d.ts.map +1 -0
- package/dist/http/Request.js +391 -0
- package/dist/http/Request.js.map +1 -0
- package/dist/http/Response.d.ts +126 -0
- package/dist/http/Response.d.ts.map +1 -0
- package/dist/http/Response.js +100 -0
- package/dist/http/Response.js.map +1 -0
- package/dist/http/Transport.d.ts +75 -0
- package/dist/http/Transport.d.ts.map +1 -0
- package/dist/http/Transport.js +91 -0
- package/dist/http/Transport.js.map +1 -0
- package/dist/http/UrlEncoding.d.ts +78 -0
- package/dist/http/UrlEncoding.d.ts.map +1 -0
- package/dist/http/UrlEncoding.js +64 -0
- package/dist/http/UrlEncoding.js.map +1 -0
- package/dist/http/internal/fields.d.ts +12 -0
- package/dist/http/internal/fields.d.ts.map +1 -0
- package/dist/http/internal/fields.js +21 -0
- package/dist/http/internal/fields.js.map +1 -0
- package/dist/main.d.ts +33 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +33 -0
- package/dist/main.js.map +1 -0
- package/package.json +125 -4
- package/src/concurrency/Interaction.ts +192 -0
- package/src/http/Body.ts +318 -0
- package/src/http/Operation.ts +300 -0
- package/src/http/Policy.ts +130 -0
- package/src/http/Request.ts +700 -0
- package/src/http/Response.ts +201 -0
- package/src/http/Transport.ts +143 -0
- package/src/http/UrlEncoding.ts +119 -0
- package/src/http/internal/fields.ts +46 -0
- package/src/main.ts +32 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Context, Effect, Option } from "effect";
|
|
2
|
+
import { Headers, type HttpClientRequest, type HttpClientResponse } from "effect/http";
|
|
3
|
+
/**
|
|
4
|
+
* Ordered header name/value pairs, preserving supplied spelling and repeated lines.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* These are declarations or provider observations. Sending separate lines requires provider
|
|
8
|
+
* support; normalized headers cannot reveal their original line boundaries.
|
|
9
|
+
*/
|
|
10
|
+
export type Lines = ReadonlyArray<readonly [string, string]>;
|
|
11
|
+
/**
|
|
12
|
+
* The header collection shapes accepted by Effect's `Headers.Input`.
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* Use {@link entries} to expand them without combining repeated values.
|
|
16
|
+
*/
|
|
17
|
+
export type HeaderInput = Headers.Input;
|
|
18
|
+
/**
|
|
19
|
+
* Expand a supported header collection into ordered name/value lines.
|
|
20
|
+
*
|
|
21
|
+
* @remarks
|
|
22
|
+
* Record array values become repeated lines; `undefined` fields are omitted.
|
|
23
|
+
*/
|
|
24
|
+
export declare const entries: (input: HeaderInput) => Lines;
|
|
25
|
+
/**
|
|
26
|
+
* Produce Effect's normalized header view from ordered lines.
|
|
27
|
+
*
|
|
28
|
+
* @remarks
|
|
29
|
+
* Names become lowercase and repeated values are joined with `, `. This loses line boundaries;
|
|
30
|
+
* keep the original lines when a provider can send them.
|
|
31
|
+
*/
|
|
32
|
+
export declare const toHeaders: (lines: Lines) => Headers.Headers;
|
|
33
|
+
/**
|
|
34
|
+
* Preserve original header lines where native middleware left the normalized value unchanged.
|
|
35
|
+
*
|
|
36
|
+
* @remarks
|
|
37
|
+
* Changed or added native fields replace those fields' original lines. Removed fields disappear.
|
|
38
|
+
* For a provider handling an operation, prefer {@link headerLines} to obtain the original lines
|
|
39
|
+
* from the current Effect context.
|
|
40
|
+
*/
|
|
41
|
+
export declare const reconcile: (lines: Lines, headers: Headers.Headers) => Lines;
|
|
42
|
+
/**
|
|
43
|
+
* The original request header lines available during an operation's attempt.
|
|
44
|
+
*
|
|
45
|
+
* @remarks
|
|
46
|
+
* Operations supply this context reference to the client. It defaults to an empty array outside
|
|
47
|
+
* that context. Providers should read it through {@link headerLines}.
|
|
48
|
+
*/
|
|
49
|
+
export declare const HeaderLines: Context.Reference<Lines>;
|
|
50
|
+
/**
|
|
51
|
+
* Get the header lines a custom provider should send after native middleware edits.
|
|
52
|
+
*
|
|
53
|
+
* @remarks
|
|
54
|
+
* Reads {@link HeaderLines} and reconciles it with the native request. Fetch does not gain
|
|
55
|
+
* separate-line support from this helper.
|
|
56
|
+
*/
|
|
57
|
+
export declare const headerLines: (request: HttpClientRequest.HttpClientRequest) => Effect.Effect<Lines>;
|
|
58
|
+
/**
|
|
59
|
+
* Attach the header lines a custom provider observed to its native response.
|
|
60
|
+
*
|
|
61
|
+
* @remarks
|
|
62
|
+
* Copies the supplied lines, mutates the response with that snapshot, and returns the same
|
|
63
|
+
* response object. Normalized headers and received bytes are unchanged. Attach only information
|
|
64
|
+
* the provider actually observed; do not split normalized values to guess original lines.
|
|
65
|
+
*/
|
|
66
|
+
export declare const withResponseHeaders: (response: HttpClientResponse.HttpClientResponse, lines: Lines) => HttpClientResponse.HttpClientResponse;
|
|
67
|
+
/**
|
|
68
|
+
* Read the original response lines attached by a supporting provider.
|
|
69
|
+
*
|
|
70
|
+
* @remarks
|
|
71
|
+
* Returns `None` when none were supplied, not when the response necessarily has no headers.
|
|
72
|
+
* Normalized header values are never split to reconstruct lines.
|
|
73
|
+
*/
|
|
74
|
+
export declare const responseHeaderLines: (response: HttpClientResponse.HttpClientResponse) => Option.Option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AKnB,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { Context, Effect, Option } from "effect";
|
|
2
|
+
import { Headers, } from "effect/http";
|
|
3
|
+
/**
|
|
4
|
+
* Expand a supported header collection into ordered name/value lines.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Record array values become repeated lines; `undefined` fields are omitted.
|
|
8
|
+
*/
|
|
9
|
+
export const entries = (input) => Symbol.iterator in input
|
|
10
|
+
? Array.from(input, ([name, value]) => [name, value])
|
|
11
|
+
: Object.entries(input).flatMap(([name, value]) => value === undefined
|
|
12
|
+
? []
|
|
13
|
+
: typeof value === "string"
|
|
14
|
+
? [[name, value]]
|
|
15
|
+
: value.map((line) => [name, line]));
|
|
16
|
+
/**
|
|
17
|
+
* Produce Effect's normalized header view from ordered lines.
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* Names become lowercase and repeated values are joined with `, `. This loses line boundaries;
|
|
21
|
+
* keep the original lines when a provider can send them.
|
|
22
|
+
*/
|
|
23
|
+
export const toHeaders = (lines) => {
|
|
24
|
+
const grouped = new Map();
|
|
25
|
+
for (const [name, value] of lines) {
|
|
26
|
+
const key = name.toLowerCase();
|
|
27
|
+
const values = grouped.get(key);
|
|
28
|
+
if (values === undefined)
|
|
29
|
+
grouped.set(key, [value]);
|
|
30
|
+
else
|
|
31
|
+
values.push(value);
|
|
32
|
+
}
|
|
33
|
+
return Headers.fromInput(Array.from(grouped, ([key, values]) => [key, values.join(", ")]));
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Preserve original header lines where native middleware left the normalized value unchanged.
|
|
37
|
+
*
|
|
38
|
+
* @remarks
|
|
39
|
+
* Changed or added native fields replace those fields' original lines. Removed fields disappear.
|
|
40
|
+
* For a provider handling an operation, prefer {@link headerLines} to obtain the original lines
|
|
41
|
+
* from the current Effect context.
|
|
42
|
+
*/
|
|
43
|
+
export const reconcile = (lines, headers) => {
|
|
44
|
+
const original = toHeaders(lines);
|
|
45
|
+
const preserved = new Set(Object.keys(original).filter((name) => original[name] === headers[name]));
|
|
46
|
+
return [
|
|
47
|
+
...lines.filter(([name]) => preserved.has(name.toLowerCase())),
|
|
48
|
+
...Object.entries(headers).filter(([name]) => !preserved.has(name)),
|
|
49
|
+
];
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* The original request header lines available during an operation's attempt.
|
|
53
|
+
*
|
|
54
|
+
* @remarks
|
|
55
|
+
* Operations supply this context reference to the client. It defaults to an empty array outside
|
|
56
|
+
* that context. Providers should read it through {@link headerLines}.
|
|
57
|
+
*/
|
|
58
|
+
export const HeaderLines = Context.Reference("viell-effect-schema-http/Transport/HeaderLines", { defaultValue: () => [] });
|
|
59
|
+
/**
|
|
60
|
+
* Get the header lines a custom provider should send after native middleware edits.
|
|
61
|
+
*
|
|
62
|
+
* @remarks
|
|
63
|
+
* Reads {@link HeaderLines} and reconciles it with the native request. Fetch does not gain
|
|
64
|
+
* separate-line support from this helper.
|
|
65
|
+
*/
|
|
66
|
+
export const headerLines = (request) => Effect.map(HeaderLines, (lines) => reconcile(lines, request.headers));
|
|
67
|
+
const ResponseHeaderLines = Symbol.for("viell-effect-schema-http/Transport/ResponseHeaderLines");
|
|
68
|
+
/**
|
|
69
|
+
* Attach the header lines a custom provider observed to its native response.
|
|
70
|
+
*
|
|
71
|
+
* @remarks
|
|
72
|
+
* Copies the supplied lines, mutates the response with that snapshot, and returns the same
|
|
73
|
+
* response object. Normalized headers and received bytes are unchanged. Attach only information
|
|
74
|
+
* the provider actually observed; do not split normalized values to guess original lines.
|
|
75
|
+
*/
|
|
76
|
+
export const withResponseHeaders = (response, lines) => {
|
|
77
|
+
Object.defineProperty(response, ResponseHeaderLines, {
|
|
78
|
+
value: lines.map(([name, value]) => [name, value]),
|
|
79
|
+
configurable: true,
|
|
80
|
+
});
|
|
81
|
+
return response;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Read the original response lines attached by a supporting provider.
|
|
85
|
+
*
|
|
86
|
+
* @remarks
|
|
87
|
+
* Returns `None` when none were supplied, not when the response necessarily has no headers.
|
|
88
|
+
* Normalized header values are never split to reconstruct lines.
|
|
89
|
+
*/
|
|
90
|
+
export const responseHeaderLines = (response) => Option.fromUndefinedOr(response[ResponseHeaderLines]);
|
|
91
|
+
//# sourceMappingURL=Transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Transport.js","sourceRoot":"","sources":["../../src/http/Transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,EACL,OAAO,GAGR,MAAM,aAAa,CAAC;AAmBrB;;;;;GAKG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,KAAkB,EAAS,EAAE,CACnD,MAAM,CAAC,QAAQ,IAAI,KAAK;IACtB,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,CAAU,CAAC;IAC9D,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,CAC3B,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAoC,EAAE,CAClD,KAAK,KAAK,SAAS;QACjB,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ;YACzB,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YACjB,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAC1C,CAAC;AAER;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAY,EAAmB,EAAE;IACzD,MAAM,OAAO,GAAG,IAAI,GAAG,EAA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,CAAC,CAAC;KACpE,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,WAAW,GAA6B,OAAO,CAAC,SAAS,CACpE,gDAAgD,EAChD,EAAE,YAAY,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,CAC3B,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,OAA4C,EACtB,EAAE,CACxB,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;AAExE,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CACpC,wDAAwD,CACzD,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,QAA+C,EAC/C,KAAY,EAC2B,EAAE;IACzC,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,mBAAmB,EAAE;QACnD,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,CAAU,CAAC;QAC3D,YAAY,EAAE,IAAI;KACnB,CAAC,CAAC;IACH,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,QAA+C,EACzB,EAAE,CACxB,MAAM,CAAC,eAAe,CACnB,QAAuD,CACtD,mBAAmB,CACpB,CACF,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { Context, Layer } from "effect";
|
|
2
|
+
/**
|
|
3
|
+
* Ordered decoded query entries, including repeated names.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* `null` is a bare key (`?preview`); `""` is an empty value (`?preview=`).
|
|
7
|
+
*/
|
|
8
|
+
export type Query = ReadonlyArray<readonly [string, string | null]>;
|
|
9
|
+
/**
|
|
10
|
+
* A scalar query value before conversion to URL text.
|
|
11
|
+
*
|
|
12
|
+
* @remarks
|
|
13
|
+
* `null` keeps a bare key and `undefined` omits an entry. Other values are converted to strings.
|
|
14
|
+
*/
|
|
15
|
+
export type QueryValue = string | number | bigint | boolean | null | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* A record or iterable of query pairs accepted as a schema's encoded output.
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* Array values expand to repeated entries. Use ordered pairs to control order across names.
|
|
21
|
+
*/
|
|
22
|
+
export type QueryInput = Readonly<Record<string, QueryValue | ReadonlyArray<QueryValue>>> | Iterable<readonly [string, QueryValue | ReadonlyArray<QueryValue>]>;
|
|
23
|
+
/**
|
|
24
|
+
* Expand query input into ordered decoded entries, preserving repetitions.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* import { UrlEncoding } from "viell-effect-schema-http";
|
|
29
|
+
* const entries = UrlEncoding.queryEntries({ tag: ["one", "two"], preview: null });
|
|
30
|
+
* // [["tag", "one"], ["tag", "two"], ["preview", null]]
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* Omits `undefined`, keeps `null`, and converts other scalar values to strings. URL escaping
|
|
35
|
+
* happens later through the query renderer.
|
|
36
|
+
*/
|
|
37
|
+
export declare const queryEntries: (input: QueryInput) => Query;
|
|
38
|
+
/**
|
|
39
|
+
* Functions that render path values, query entries and the final request URL.
|
|
40
|
+
*
|
|
41
|
+
* @remarks
|
|
42
|
+
* The default policy is available without setup. Provide {@link layer} to replace it for a
|
|
43
|
+
* service that needs another URL representation.
|
|
44
|
+
*/
|
|
45
|
+
export interface Service {
|
|
46
|
+
/** Escape one dynamic path value; the renderer supplies separators between values. */
|
|
47
|
+
readonly path: (value: string) => string;
|
|
48
|
+
/** Render ordered query entries without a leading `?`. */
|
|
49
|
+
readonly query: (entries: Query) => string;
|
|
50
|
+
/** Combine the base origin/prefix and the request's rendered path or absolute URL. */
|
|
51
|
+
readonly join: (base: string, path: string) => string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Percent-encode path values and query fields, and join a base URL with a request path.
|
|
55
|
+
*
|
|
56
|
+
* @remarks
|
|
57
|
+
* Uses `encodeURIComponent`, preserving bare keys, empty values, repetition and order.
|
|
58
|
+
* An absolute request URL bypasses the base. Otherwise joining removes one boundary slash from
|
|
59
|
+
* each side before inserting `/`. Dot segments and empty path values are not normalized here;
|
|
60
|
+
* the HTTP provider's later URL processing may normalize them.
|
|
61
|
+
*/
|
|
62
|
+
export declare const defaults: Service;
|
|
63
|
+
/**
|
|
64
|
+
* The Effect context reference used to render request URLs.
|
|
65
|
+
*
|
|
66
|
+
* @remarks
|
|
67
|
+
* Uses {@link defaults} unless replaced. The value is read during request preparation.
|
|
68
|
+
*/
|
|
69
|
+
export declare const UrlEncoding: Context.Reference<Service>;
|
|
70
|
+
/**
|
|
71
|
+
* Supply an alternative URL-rendering policy through an Effect layer.
|
|
72
|
+
*
|
|
73
|
+
* @remarks
|
|
74
|
+
* Provide it around request compilation or operation execution. Renderer exceptions become
|
|
75
|
+
* `Request.InvalidRequest`. Provider URL processing still applies after library rendering.
|
|
76
|
+
*/
|
|
77
|
+
export declare const layer: (service: Service) => Layer.Layer<never>;
|
|
78
|
+
//# sourceMappingURL=UrlEncoding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UrlEncoding.d.ts","sourceRoot":"","sources":["../../src/http/UrlEncoding.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAExC;;;;;GAKG;AACH,MAAM,MAAM,KAAK,GAAG,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;AAEpE;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC;AAE/E;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAClB,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC,GAChE,QAAQ,CAAC,SAAS,CAAC,MAAM,EAAE,UAAU,GAAG,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;AAExE;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,UAAU,KAAG,KAWhD,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,WAAW,OAAO;IACtB,sFAAsF;IACtF,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACzC,0DAA0D;IAC1D,QAAQ,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,KAAK,KAAK,MAAM,CAAC;IAC3C,sFAAsF;IACtF,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CACvD;AAID;;;;;;;;GAQG;AACH,eAAO,MAAM,QAAQ,EAAE,OAetB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,WAAW,EAAE,OAAO,CAAC,SAAS,CAAC,OAAO,CAG/C,CAAC;AAEL;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,GAAI,SAAS,OAAO,KAAG,KAAK,CAAC,KAAK,CAAC,KAAK,CACrB,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Context, Layer } from "effect";
|
|
2
|
+
/**
|
|
3
|
+
* Expand query input into ordered decoded entries, preserving repetitions.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { UrlEncoding } from "viell-effect-schema-http";
|
|
8
|
+
* const entries = UrlEncoding.queryEntries({ tag: ["one", "two"], preview: null });
|
|
9
|
+
* // [["tag", "one"], ["tag", "two"], ["preview", null]]
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* @remarks
|
|
13
|
+
* Omits `undefined`, keeps `null`, and converts other scalar values to strings. URL escaping
|
|
14
|
+
* happens later through the query renderer.
|
|
15
|
+
*/
|
|
16
|
+
export const queryEntries = (input) => {
|
|
17
|
+
const entries = Symbol.iterator in input ? Array.from(input) : Object.entries(input);
|
|
18
|
+
return entries.flatMap(([key, value]) => (Array.isArray(value) ? value : [value]).flatMap((entry) => entry === undefined
|
|
19
|
+
? []
|
|
20
|
+
: [[key, entry === null ? null : String(entry)]]));
|
|
21
|
+
};
|
|
22
|
+
const absolute = /^[a-z][a-z\d+.-]*:\/\//i;
|
|
23
|
+
/**
|
|
24
|
+
* Percent-encode path values and query fields, and join a base URL with a request path.
|
|
25
|
+
*
|
|
26
|
+
* @remarks
|
|
27
|
+
* Uses `encodeURIComponent`, preserving bare keys, empty values, repetition and order.
|
|
28
|
+
* An absolute request URL bypasses the base. Otherwise joining removes one boundary slash from
|
|
29
|
+
* each side before inserting `/`. Dot segments and empty path values are not normalized here;
|
|
30
|
+
* the HTTP provider's later URL processing may normalize them.
|
|
31
|
+
*/
|
|
32
|
+
export const defaults = {
|
|
33
|
+
path: encodeURIComponent,
|
|
34
|
+
query: (entries) => entries
|
|
35
|
+
.map(([key, value]) => value === null
|
|
36
|
+
? encodeURIComponent(key)
|
|
37
|
+
: `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
|
|
38
|
+
.join("&"),
|
|
39
|
+
join: (base, path) => {
|
|
40
|
+
if (base === "" || absolute.test(path))
|
|
41
|
+
return path;
|
|
42
|
+
if (path === "")
|
|
43
|
+
return base;
|
|
44
|
+
return `${base.replace(/\/$/, "")}/${path.replace(/^\//, "")}`;
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* The Effect context reference used to render request URLs.
|
|
49
|
+
*
|
|
50
|
+
* @remarks
|
|
51
|
+
* Uses {@link defaults} unless replaced. The value is read during request preparation.
|
|
52
|
+
*/
|
|
53
|
+
export const UrlEncoding = Context.Reference("viell-effect-schema-http/UrlEncoding", {
|
|
54
|
+
defaultValue: () => defaults,
|
|
55
|
+
});
|
|
56
|
+
/**
|
|
57
|
+
* Supply an alternative URL-rendering policy through an Effect layer.
|
|
58
|
+
*
|
|
59
|
+
* @remarks
|
|
60
|
+
* Provide it around request compilation or operation execution. Renderer exceptions become
|
|
61
|
+
* `Request.InvalidRequest`. Provider URL processing still applies after library rendering.
|
|
62
|
+
*/
|
|
63
|
+
export const layer = (service) => Layer.succeed(UrlEncoding, service);
|
|
64
|
+
//# sourceMappingURL=UrlEncoding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UrlEncoding.js","sourceRoot":"","sources":["../../src/http/UrlEncoding.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AA4BxC;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAiB,EAAS,EAAE;IACvD,MAAM,OAAO,GACX,MAAM,CAAC,QAAQ,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACvE,OAAO,OAAO,CAAC,OAAO,CACpB,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAA2C,EAAE,CACxD,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,KAAiB,EAAE,EAAE,CACrE,KAAK,KAAK,SAAS;QACjB,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,CAAC,CAAC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AC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** A field value, or a computation that stays data until materialization. `undefined` omits the field. */
|
|
2
|
+
export type Value<A = string> = A | (() => A | undefined);
|
|
3
|
+
/** Ordered declarations. Entries preserve repetition and their order across names. */
|
|
4
|
+
export type Fields<A = string> = ReadonlyArray<readonly [string, Value<A>]>;
|
|
5
|
+
/** Replace a name at its first position and drop its later entries, or append a new entry. */
|
|
6
|
+
export declare const set: <A>(fields: Fields<A>, name: string, value: Value<A>) => Fields<A>;
|
|
7
|
+
export declare const append: <A>(fields: Fields<A>, name: string, value: Value<A>) => Fields<A>;
|
|
8
|
+
/** Without a value, remove the whole name. With one, remove matching static entries without evaluating computations. */
|
|
9
|
+
export declare const remove: <A>(fields: Fields<A>, name: string, value?: A) => Fields<A>;
|
|
10
|
+
/** Evaluate every surviving computation once, omitting `undefined` results. */
|
|
11
|
+
export declare const resolve: <A extends string | null>(fields: Fields<A>) => Array<readonly [string, A]>;
|
|
12
|
+
//# sourceMappingURL=fields.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../../src/http/internal/fields.ts"],"names":[],"mappings":"AAAA,0GAA0G;AAC1G,MAAM,MAAM,KAAK,CAAC,CAAC,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC,CAAC;AAE1D,sFAAsF;AACtF,MAAM,MAAM,MAAM,CAAC,CAAC,GAAG,MAAM,IAAI,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE5E,8FAA8F;AAC9F,eAAO,MAAM,GAAG,GAAI,CAAC,EACnB,QAAQ,MAAM,CAAC,CAAC,CAAC,EACjB,MAAM,MAAM,EACZ,OAAO,KAAK,CAAC,CAAC,CAAC,KACd,MAAM,CAAC,CAAC,CAMV,CAAC;AAEF,eAAO,MAAM,MAAM,GAAI,CAAC,EACtB,QAAQ,MAAM,CAAC,CAAC,CAAC,EACjB,MAAM,MAAM,EACZ,OAAO,KAAK,CAAC,CAAC,CAAC,KACd,MAAM,CAAC,CAAC,CAA+B,CAAC;AAE3C,wHAAwH;AACxH,eAAO,MAAM,MAAM,GAAI,CAAC,EACtB,QAAQ,MAAM,CAAC,CAAC,CAAC,EACjB,MAAM,MAAM,EACZ,QAAQ,CAAC,KACR,MAAM,CAAC,CAAC,CAGR,CAAC;AAEJ,+EAA+E;AAC/E,eAAO,MAAM,OAAO,GAAI,CAAC,SAAS,MAAM,GAAG,IAAI,EAC7C,QAAQ,MAAM,CAAC,CAAC,CAAC,KAChB,KAAK,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC,CAO5B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** Replace a name at its first position and drop its later entries, or append a new entry. */
|
|
2
|
+
export const set = (fields, name, value) => {
|
|
3
|
+
const position = fields.findIndex(([key]) => key === name);
|
|
4
|
+
if (position < 0)
|
|
5
|
+
return [...fields, [name, value]];
|
|
6
|
+
return fields.flatMap((entry, index) => index === position ? [[name, value]] : entry[0] === name ? [] : [entry]);
|
|
7
|
+
};
|
|
8
|
+
export const append = (fields, name, value) => [...fields, [name, value]];
|
|
9
|
+
/** Without a value, remove the whole name. With one, remove matching static entries without evaluating computations. */
|
|
10
|
+
export const remove = (fields, name, value) => fields.filter(([key, entry]) => key !== name || (value !== undefined && entry !== value));
|
|
11
|
+
/** Evaluate every surviving computation once, omitting `undefined` results. */
|
|
12
|
+
export const resolve = (fields) => {
|
|
13
|
+
const output = [];
|
|
14
|
+
for (const [name, value] of fields) {
|
|
15
|
+
const resolved = typeof value === "function" ? value() : value;
|
|
16
|
+
if (resolved !== undefined)
|
|
17
|
+
output.push([name, resolved]);
|
|
18
|
+
}
|
|
19
|
+
return output;
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=fields.js.map
|
|
@@ -0,0 +1 @@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,MAAM,MAAM,GAAgC,EAAE,CAAC;IAC/C,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,EAAE,CAAC;QACnC,MAAM,QAAQ,GAAG,OAAO,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;QAC/D,IAAI,QAAQ,KAAK,SAAS;YAAE,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC5D,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
|
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Encode and decode finite HTTP bodies, with optional schema validation.
|
|
3
|
+
*/
|
|
4
|
+
export * as Body from "./http/Body.js";
|
|
5
|
+
/**
|
|
6
|
+
* Share or replace work for one scoped user interaction.
|
|
7
|
+
*/
|
|
8
|
+
export * as Interaction from "./concurrency/Interaction.js";
|
|
9
|
+
/**
|
|
10
|
+
* Pair request and response contracts and execute them through an Effect HTTP client.
|
|
11
|
+
*/
|
|
12
|
+
export * as Operation from "./http/Operation.js";
|
|
13
|
+
/**
|
|
14
|
+
* Configure operation retries, delays and attempt timeouts.
|
|
15
|
+
*/
|
|
16
|
+
export * as Policy from "./http/Policy.js";
|
|
17
|
+
/**
|
|
18
|
+
* Describe outgoing requests and bind typed application input.
|
|
19
|
+
*/
|
|
20
|
+
export * as Request from "./http/Request.js";
|
|
21
|
+
/**
|
|
22
|
+
* Select and decode accepted responses using status and metadata.
|
|
23
|
+
*/
|
|
24
|
+
export * as Response from "./http/Response.js";
|
|
25
|
+
/**
|
|
26
|
+
* Preserve individual header lines through a supporting HTTP provider.
|
|
27
|
+
*/
|
|
28
|
+
export * as Transport from "./http/Transport.js";
|
|
29
|
+
/**
|
|
30
|
+
* Customize path escaping, query rendering and base-URL joining.
|
|
31
|
+
*/
|
|
32
|
+
export * as UrlEncoding from "./http/UrlEncoding.js";
|
|
33
|
+
//# sourceMappingURL=main.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AACvC;;GAEG;AACH,OAAO,KAAK,WAAW,MAAM,8BAA8B,CAAC;AAC5D;;GAEG;AACH,OAAO,KAAK,SAAS,MAAM,qBAAqB,CAAC;AACjD;;GAEG;AACH,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAC3C;;GAEG;AACH,OAAO,KAAK,OAAO,MAAM,mBAAmB,CAAC;AAC7C;;GAEG;AACH,OAAO,KAAK,QAAQ,MAAM,oBAAoB,CAAC;AAC/C;;GAEG;AACH,OAAO,KAAK,SAAS,MAAM,qBAAqB,CAAC;AACjD;;GAEG;AACH,OAAO,KAAK,WAAW,MAAM,uBAAuB,CAAC"}
|
package/dist/main.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Encode and decode finite HTTP bodies, with optional schema validation.
|
|
3
|
+
*/
|
|
4
|
+
export * as Body from "./http/Body.js";
|
|
5
|
+
/**
|
|
6
|
+
* Share or replace work for one scoped user interaction.
|
|
7
|
+
*/
|
|
8
|
+
export * as Interaction from "./concurrency/Interaction.js";
|
|
9
|
+
/**
|
|
10
|
+
* Pair request and response contracts and execute them through an Effect HTTP client.
|
|
11
|
+
*/
|
|
12
|
+
export * as Operation from "./http/Operation.js";
|
|
13
|
+
/**
|
|
14
|
+
* Configure operation retries, delays and attempt timeouts.
|
|
15
|
+
*/
|
|
16
|
+
export * as Policy from "./http/Policy.js";
|
|
17
|
+
/**
|
|
18
|
+
* Describe outgoing requests and bind typed application input.
|
|
19
|
+
*/
|
|
20
|
+
export * as Request from "./http/Request.js";
|
|
21
|
+
/**
|
|
22
|
+
* Select and decode accepted responses using status and metadata.
|
|
23
|
+
*/
|
|
24
|
+
export * as Response from "./http/Response.js";
|
|
25
|
+
/**
|
|
26
|
+
* Preserve individual header lines through a supporting HTTP provider.
|
|
27
|
+
*/
|
|
28
|
+
export * as Transport from "./http/Transport.js";
|
|
29
|
+
/**
|
|
30
|
+
* Customize path escaping, query rendering and base-URL joining.
|
|
31
|
+
*/
|
|
32
|
+
export * as UrlEncoding from "./http/UrlEncoding.js";
|
|
33
|
+
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AACvC;;GAEG;AACH,OAAO,KAAK,WAAW,MAAM,8BAA8B,CAAC;AAC5D;;GAEG;AACH,OAAO,KAAK,SAAS,MAAM,qBAAqB,CAAC;AACjD;;GAEG;AACH,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAC3C;;GAEG;AACH,OAAO,KAAK,OAAO,MAAM,mBAAmB,CAAC;AAC7C;;GAEG;AACH,OAAO,KAAK,QAAQ,MAAM,oBAAoB,CAAC;AAC/C;;GAEG;AACH,OAAO,KAAK,SAAS,MAAM,qBAAqB,CAAC;AACjD;;GAEG;AACH,OAAO,KAAK,WAAW,MAAM,uBAAuB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,127 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "viell-effect-schema-http",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Consumer-owned HTTP contracts composed with Effect",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/viell-dev/slop-effect-schema-http.git"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://viell-dev.github.io/slop-effect-schema-http/",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/viell-dev/slop-effect-schema-http/issues"
|
|
13
|
+
},
|
|
14
|
+
"author": "viell",
|
|
15
|
+
"type": "module",
|
|
16
|
+
"sideEffects": false,
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": ">=24 <25"
|
|
19
|
+
},
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/main.d.ts",
|
|
23
|
+
"default": "./dist/main.js"
|
|
24
|
+
},
|
|
25
|
+
"./Body": {
|
|
26
|
+
"types": "./dist/http/Body.d.ts",
|
|
27
|
+
"default": "./dist/http/Body.js"
|
|
28
|
+
},
|
|
29
|
+
"./Interaction": {
|
|
30
|
+
"types": "./dist/concurrency/Interaction.d.ts",
|
|
31
|
+
"default": "./dist/concurrency/Interaction.js"
|
|
32
|
+
},
|
|
33
|
+
"./Operation": {
|
|
34
|
+
"types": "./dist/http/Operation.d.ts",
|
|
35
|
+
"default": "./dist/http/Operation.js"
|
|
36
|
+
},
|
|
37
|
+
"./Policy": {
|
|
38
|
+
"types": "./dist/http/Policy.d.ts",
|
|
39
|
+
"default": "./dist/http/Policy.js"
|
|
40
|
+
},
|
|
41
|
+
"./Request": {
|
|
42
|
+
"types": "./dist/http/Request.d.ts",
|
|
43
|
+
"default": "./dist/http/Request.js"
|
|
44
|
+
},
|
|
45
|
+
"./Response": {
|
|
46
|
+
"types": "./dist/http/Response.d.ts",
|
|
47
|
+
"default": "./dist/http/Response.js"
|
|
48
|
+
},
|
|
49
|
+
"./Transport": {
|
|
50
|
+
"types": "./dist/http/Transport.d.ts",
|
|
51
|
+
"default": "./dist/http/Transport.js"
|
|
52
|
+
},
|
|
53
|
+
"./UrlEncoding": {
|
|
54
|
+
"types": "./dist/http/UrlEncoding.d.ts",
|
|
55
|
+
"default": "./dist/http/UrlEncoding.js"
|
|
56
|
+
},
|
|
57
|
+
"./package.json": "./package.json"
|
|
58
|
+
},
|
|
59
|
+
"main": "./dist/main.js",
|
|
60
|
+
"types": "./dist/main.d.ts",
|
|
61
|
+
"packageManager": "npm@11.19.0",
|
|
62
|
+
"devEngines": {
|
|
63
|
+
"packageManager": {
|
|
64
|
+
"name": "npm",
|
|
65
|
+
"version": "^11.19.0",
|
|
66
|
+
"onFail": "error"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"scripts": {
|
|
70
|
+
"build": "tsc -p tsconfig.build.json",
|
|
71
|
+
"check": "run-p check:*",
|
|
72
|
+
"check:tsc": "tsc --noEmit",
|
|
73
|
+
"check:prettier": "prettier --check .",
|
|
74
|
+
"check:mdrefine": "mdrefine format --check",
|
|
75
|
+
"format": "run-s format:*",
|
|
76
|
+
"format:prettier": "prettier --write .",
|
|
77
|
+
"format:mdrefine": "mdrefine format --write",
|
|
78
|
+
"lint": "run-s lint:*",
|
|
79
|
+
"lint:oxlint": "oxlint",
|
|
80
|
+
"lint:eslint": "eslint .",
|
|
81
|
+
"lint:mdrefine": "mdrefine lint",
|
|
82
|
+
"test": "vitest run",
|
|
83
|
+
"test:package": "node scripts/check-package.mjs",
|
|
84
|
+
"test:release": "node --test scripts/release.test.mjs",
|
|
85
|
+
"release:prepare": "node scripts/prepare-release.mjs",
|
|
86
|
+
"test:watch": "vitest",
|
|
87
|
+
"docs:dev": "vitepress dev docs",
|
|
88
|
+
"docs:build": "vitepress build docs && node scripts/check-doc-links.mjs",
|
|
89
|
+
"docs:preview": "vite preview --host 127.0.0.1 --outDir docs/.vitepress/dist --base /slop-effect-schema-http/",
|
|
90
|
+
"docs:examples": "tsc -p tsconfig.examples.json && node scripts/check-doc-examples.mjs && node examples/guides.mjs && node examples/modules.mjs"
|
|
91
|
+
},
|
|
92
|
+
"files": [
|
|
93
|
+
"dist",
|
|
94
|
+
"src",
|
|
95
|
+
"README.md",
|
|
96
|
+
"!dist/**/*.test.*",
|
|
97
|
+
"!src/**/*.test.ts"
|
|
98
|
+
],
|
|
99
|
+
"keywords": [
|
|
100
|
+
"effect",
|
|
101
|
+
"http",
|
|
102
|
+
"schema"
|
|
103
|
+
],
|
|
104
|
+
"peerDependencies": {
|
|
105
|
+
"effect": "^4.0.7"
|
|
106
|
+
},
|
|
107
|
+
"overrides": {
|
|
108
|
+
"minimatch@10": "11.0.1"
|
|
109
|
+
},
|
|
110
|
+
"devDependencies": {
|
|
111
|
+
"@effect/vitest": "^4.1.1",
|
|
112
|
+
"@eslint/js": "^10.0.1",
|
|
113
|
+
"@types/node": "^26.6.6",
|
|
114
|
+
"effect": "^4.1.1",
|
|
115
|
+
"eslint": "^10.14.0",
|
|
116
|
+
"eslint-config-prettier": "^10.1.8",
|
|
117
|
+
"eslint-plugin-oxlint": "^1.90.0",
|
|
118
|
+
"mdrefine": "^0.6.3",
|
|
119
|
+
"npm-run-all2": "^9.0.4",
|
|
120
|
+
"oxlint": "^1.90.0",
|
|
121
|
+
"prettier": "^3.9.10",
|
|
122
|
+
"typescript": "^6.0.3",
|
|
123
|
+
"typescript-eslint": "^8.72.1",
|
|
124
|
+
"vitepress": "2.0.0-alpha.21",
|
|
125
|
+
"vitest": "^5.0.5"
|
|
126
|
+
}
|
|
127
|
+
}
|