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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 viell
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,89 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Effect Schema HTTP
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Define what your application sends to an HTTP service and what it expects back. Effect Schema
|
|
4
|
+
validates and transforms values, and your Effect HTTP client sends the request. The contract belongs
|
|
5
|
+
to your application; the server does not need to use this library or Effect.
|
|
6
|
+
|
|
7
|
+
## Example
|
|
8
|
+
|
|
9
|
+
Describe a user lookup and the JSON response your application understands:
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { Effect, Schema } from "effect";
|
|
13
|
+
import { FetchHttpClient } from "effect/http";
|
|
14
|
+
import { Body, Operation, Request, Response } from "viell-effect-schema-http";
|
|
15
|
+
|
|
16
|
+
const api = Request.baseUrl("https://api.example.test");
|
|
17
|
+
|
|
18
|
+
const getUser = Operation.make(
|
|
19
|
+
Request.get("").pipe(
|
|
20
|
+
api,
|
|
21
|
+
Request.path(Schema.NumberFromString, (id, encode) => `/users/${encode(id)}`),
|
|
22
|
+
),
|
|
23
|
+
Response.status(
|
|
24
|
+
200,
|
|
25
|
+
Body.jsonSchema(Schema.Struct({ id: Schema.Number, name: Schema.String })),
|
|
26
|
+
),
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
const program = getUser
|
|
30
|
+
.execute({ path: 42 })
|
|
31
|
+
.pipe(Effect.provide(FetchHttpClient.layer));
|
|
32
|
+
// Replace the example endpoint with your service, then: await Effect.runPromise(program).
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Reuse `api` across requests to share the base URL. The path renderer supplies `/users/42`, which is
|
|
36
|
+
joined to that base; it replaces the empty path passed to `Request.get`. The path schema encodes the
|
|
37
|
+
number as URL text. The response schema validates the returned JSON. Constructing `program` sends
|
|
38
|
+
nothing; evaluating it produces a typed user or an Effect failure. [Getting
|
|
39
|
+
started](https://viell-dev.github.io/slop-effect-schema-http/getting-started) supplies a complete
|
|
40
|
+
in-memory example you can run without a server or credentials.
|
|
41
|
+
|
|
42
|
+
## Install
|
|
43
|
+
|
|
44
|
+
In an existing Node.js 24 ESM project with Effect `^4.0.7`, add the library:
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
npm install viell-effect-schema-http
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
`0.1.0` is the first stable release. The same package is available as a checksummed [GitHub release
|
|
51
|
+
tarball](https://github.com/viell-dev/slop-effect-schema-http/releases/tag/0.1.0).
|
|
52
|
+
|
|
53
|
+
TypeScript declarations and editor documentation are included. The supported environments are Node
|
|
54
|
+
24 on Windows/Linux and browser Fetch in Chromium. See [compatibility and
|
|
55
|
+
limits](https://viell-dev.github.io/slop-effect-schema-http/limits) for tested Effect/compiler
|
|
56
|
+
versions and provider boundaries.
|
|
57
|
+
|
|
58
|
+
## Documentation
|
|
59
|
+
|
|
60
|
+
- [Getting started](https://viell-dev.github.io/slop-effect-schema-http/getting-started):
|
|
61
|
+
installation, a runnable example and the expected output.
|
|
62
|
+
- [Usage](https://viell-dev.github.io/slop-effect-schema-http/usage): add PATCH and DELETE actions,
|
|
63
|
+
share URL descriptions and connect an operation to your HTTP client.
|
|
64
|
+
- [Module guides](https://viell-dev.github.io/slop-effect-schema-http/api): Request, Body, Response,
|
|
65
|
+
Operation, Policy, Interaction, UrlEncoding and Transport, from basic use to advanced behavior.
|
|
66
|
+
- [Limits and recovery](https://viell-dev.github.io/slop-effect-schema-http/limits): compatibility,
|
|
67
|
+
failure stages and bug reporting.
|
|
68
|
+
- [What's in 0.1](https://viell-dev.github.io/slop-effect-schema-http/release-notes/0.1) introduces
|
|
69
|
+
the release; [Versions](https://viell-dev.github.io/slop-effect-schema-http/versions) covers
|
|
70
|
+
updates and compatibility policy. [CHANGELOG.md](./CHANGELOG.md) records the detailed history.
|
|
71
|
+
|
|
72
|
+
The library provides finite-body codecs, typed contracts, ordered response selection, retry policies
|
|
73
|
+
and scoped interaction coordination. It uses the application's HTTP transport and Effect runtime.
|
|
74
|
+
Streaming bodies, server generation and a general cache are outside its scope. The [design
|
|
75
|
+
contract](https://viell-dev.github.io/slop-effect-schema-http/design) explains the precise
|
|
76
|
+
guarantees.
|
|
77
|
+
|
|
78
|
+
## Project and contribution
|
|
79
|
+
|
|
80
|
+
Agents write and maintain this project. Its code is not human-reviewed. The source is
|
|
81
|
+
[MIT-licensed](./LICENSE). The [release
|
|
82
|
+
tracker](https://github.com/viell-dev/slop-effect-schema-http/issues/2) records the first stable
|
|
83
|
+
release's qualification and publication.
|
|
84
|
+
|
|
85
|
+
Use [CONTRIBUTING.md](./CONTRIBUTING.md) for checkout setup, verification and pull requests. [Report
|
|
86
|
+
a defect](https://github.com/viell-dev/slop-effect-schema-http/issues) with a small synthetic
|
|
87
|
+
reproduction and library, Effect and environment versions. Include expected and actual results; keep
|
|
88
|
+
credentials and private service data out. For sensitive security reports, use [private vulnerability
|
|
89
|
+
reporting](https://github.com/viell-dev/slop-effect-schema-http/security/advisories/new).
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Effect, type Equivalence, Scope } from "effect";
|
|
2
|
+
declare const Closed_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
3
|
+
readonly _tag: "InteractionClosed";
|
|
4
|
+
} & Readonly<A>;
|
|
5
|
+
/**
|
|
6
|
+
* A call tried to start work after the interaction had permanently closed.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* The error's `_tag` is `"InteractionClosed"`.
|
|
10
|
+
*/
|
|
11
|
+
export declare class Closed extends Closed_base {
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Options for one call to an interaction.
|
|
15
|
+
*/
|
|
16
|
+
export interface RunOptions {
|
|
17
|
+
/** Start fresh work, superseding active work and bypassing the retained result. */
|
|
18
|
+
readonly force?: boolean | undefined;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Coordinate one active execution and one retained successful result.
|
|
22
|
+
*
|
|
23
|
+
* @remarks
|
|
24
|
+
* Use for one user-facing activity, such as a search field. Equal input shares work or reuses a
|
|
25
|
+
* success; different input supersedes active work. This is not a cache of all previous inputs.
|
|
26
|
+
*/
|
|
27
|
+
export interface Interaction<in I, out A, out E = never> {
|
|
28
|
+
/** Equal input joins active work or reuses the retained success; different input supersedes active work. */
|
|
29
|
+
readonly run: (input: I, options?: RunOptions) => Effect.Effect<A, E | Closed>;
|
|
30
|
+
/** Permanent and idempotent. Every caller waits for all owned finalizers, including superseded work. */
|
|
31
|
+
readonly close: Effect.Effect<void>;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Choose how inputs compare and which successful results are retained.
|
|
35
|
+
*/
|
|
36
|
+
export interface Options<I, A> {
|
|
37
|
+
/** Defaults to `Equal.equals`, which compares plain objects and arrays structurally. */
|
|
38
|
+
readonly equivalence?: Equivalence.Equivalence<I> | undefined;
|
|
39
|
+
/** Whether to retain a success. Defaults to retaining; the result is returned either way. */
|
|
40
|
+
readonly retain?: ((value: A, input: I) => boolean) | undefined;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Acquire a scoped interaction around an Effect-returning function.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* import { Effect } from "effect";
|
|
48
|
+
* import { Interaction } from "viell-effect-schema-http";
|
|
49
|
+
* const program = Effect.scoped(Effect.gen(function* () {
|
|
50
|
+
* const lookup = yield* Interaction.make((id: number) => Effect.succeed({ id }));
|
|
51
|
+
* const first = yield* lookup.run(42);
|
|
52
|
+
* const reused = yield* lookup.run(42);
|
|
53
|
+
* return [first, reused];
|
|
54
|
+
* }));
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* @remarks
|
|
58
|
+
* Keep the acquiring scope alive while calls should be accepted. Required services are captured
|
|
59
|
+
* at acquisition. Each execution belongs to the interaction in its own child scope; cancelling
|
|
60
|
+
* one waiter does not cancel shared work. Closing the acquiring scope closes the interaction
|
|
61
|
+
* and waits for all owned cleanup.
|
|
62
|
+
*/
|
|
63
|
+
export declare const make: <I, A, E, R>(execute: (input: I) => Effect.Effect<A, E, R>, options?: Options<I, A> | undefined) => Effect.Effect<Interaction<I, A, E>, never, R | Scope.Scope>;
|
|
64
|
+
export {};
|
|
65
|
+
//# sourceMappingURL=Interaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Interaction.d.ts","sourceRoot":"","sources":["../../src/concurrency/Interaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,MAAM,EAEN,KAAK,WAAW,EAGhB,KAAK,EAEN,MAAM,QAAQ,CAAC;;;;AAEhB;;;;;GAKG;AACH,qBAAa,MAAO,SAAQ,WAAqC;CAAG;AAEpE;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,mFAAmF;IACnF,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACtC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,KAAK;IACrD,4GAA4G;IAC5G,QAAQ,CAAC,GAAG,EAAE,CACZ,KAAK,EAAE,CAAC,EACR,OAAO,CAAC,EAAE,UAAU,KACjB,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC;IAClC,wGAAwG;IACxG,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;CACrC;AAED;;GAEG;AACH,MAAM,WAAW,OAAO,CAAC,CAAC,EAAE,CAAC;IAC3B,wFAAwF;IACxF,QAAQ,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IAC9D,6FAA6F;IAC7F,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC,GAAG,SAAS,CAAC;CACjE;AAQD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,IAAI,GAAgC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,mBACxC,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,qGA2G7C,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { Context, Data, Deferred, Effect, Equal, Exit, Scope, Semaphore, } from "effect";
|
|
2
|
+
/**
|
|
3
|
+
* A call tried to start work after the interaction had permanently closed.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* The error's `_tag` is `"InteractionClosed"`.
|
|
7
|
+
*/
|
|
8
|
+
export class Closed extends Data.TaggedError("InteractionClosed") {
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Acquire a scoped interaction around an Effect-returning function.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* import { Effect } from "effect";
|
|
16
|
+
* import { Interaction } from "viell-effect-schema-http";
|
|
17
|
+
* const program = Effect.scoped(Effect.gen(function* () {
|
|
18
|
+
* const lookup = yield* Interaction.make((id: number) => Effect.succeed({ id }));
|
|
19
|
+
* const first = yield* lookup.run(42);
|
|
20
|
+
* const reused = yield* lookup.run(42);
|
|
21
|
+
* return [first, reused];
|
|
22
|
+
* }));
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @remarks
|
|
26
|
+
* Keep the acquiring scope alive while calls should be accepted. Required services are captured
|
|
27
|
+
* at acquisition. Each execution belongs to the interaction in its own child scope; cancelling
|
|
28
|
+
* one waiter does not cancel shared work. Closing the acquiring scope closes the interaction
|
|
29
|
+
* and waits for all owned cleanup.
|
|
30
|
+
*/
|
|
31
|
+
export const make = Effect.fnUntraced(function* (execute, options) {
|
|
32
|
+
const context = yield* Effect.context();
|
|
33
|
+
const owned = yield* Scope.make("parallel");
|
|
34
|
+
const lock = yield* Semaphore.make(1);
|
|
35
|
+
const closing = yield* Deferred.make();
|
|
36
|
+
const equivalent = options?.equivalence ?? Equal.equals;
|
|
37
|
+
let closed = false;
|
|
38
|
+
let flight;
|
|
39
|
+
let retained;
|
|
40
|
+
const close = Effect.uninterruptible(Effect.gen(function* () {
|
|
41
|
+
const first = yield* lock.withPermit(Effect.sync(() => {
|
|
42
|
+
if (closed)
|
|
43
|
+
return false;
|
|
44
|
+
closed = true;
|
|
45
|
+
flight = undefined;
|
|
46
|
+
retained = undefined;
|
|
47
|
+
return true;
|
|
48
|
+
}));
|
|
49
|
+
if (first)
|
|
50
|
+
yield* Deferred.done(closing, yield* Effect.exit(Scope.close(owned, Exit.void)));
|
|
51
|
+
yield* Deferred.await(closing);
|
|
52
|
+
}));
|
|
53
|
+
yield* Effect.addFinalizer(() => close);
|
|
54
|
+
// State transitions hold the lock briefly; it is never held while waiting for work or finalizers.
|
|
55
|
+
const publish = (input, shared, exit) => lock.withPermit(Effect.sync(() => {
|
|
56
|
+
if (flight?.result !== shared)
|
|
57
|
+
return;
|
|
58
|
+
try {
|
|
59
|
+
if (Exit.isSuccess(exit)) {
|
|
60
|
+
if (options?.retain?.(exit.value, input) ?? true)
|
|
61
|
+
retained = { input, value: exit.value };
|
|
62
|
+
else if (retained !== undefined &&
|
|
63
|
+
equivalent(retained.input, input))
|
|
64
|
+
retained = undefined;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
finally {
|
|
68
|
+
flight = undefined;
|
|
69
|
+
}
|
|
70
|
+
}));
|
|
71
|
+
// Forked uninterruptibly so that publication always happens, even when superseded before starting.
|
|
72
|
+
const worker = Effect.fnUntraced(function* (input, shared) {
|
|
73
|
+
const exit = yield* Effect.exit(Effect.interruptible(Effect.scopedWith((scope) => Effect.suspend(() => execute(input)).pipe(Effect.provideContext(Context.add(context, Scope.Scope, scope))))));
|
|
74
|
+
// A retention predicate defect still releases every waiter and clears the active flight.
|
|
75
|
+
const publication = yield* Effect.exit(publish(input, shared, exit));
|
|
76
|
+
yield* Deferred.done(shared, Exit.isFailure(publication) ? Exit.failCause(publication.cause) : exit);
|
|
77
|
+
});
|
|
78
|
+
const admit = Effect.fnUntraced(function* (input, force) {
|
|
79
|
+
if (closed)
|
|
80
|
+
return yield* new Closed();
|
|
81
|
+
if (!force && flight !== undefined && equivalent(flight.input, input))
|
|
82
|
+
return Deferred.await(flight.result);
|
|
83
|
+
if (flight !== undefined) {
|
|
84
|
+
flight.fiber.interruptUnsafe();
|
|
85
|
+
flight = undefined;
|
|
86
|
+
}
|
|
87
|
+
if (!force && retained !== undefined && equivalent(retained.input, input))
|
|
88
|
+
return Effect.succeed(retained.value);
|
|
89
|
+
const shared = yield* Deferred.make();
|
|
90
|
+
const fiber = yield* Effect.forkIn(worker(input, shared), owned, {
|
|
91
|
+
uninterruptible: true,
|
|
92
|
+
});
|
|
93
|
+
flight = { input, result: shared, fiber };
|
|
94
|
+
return Deferred.await(shared);
|
|
95
|
+
});
|
|
96
|
+
const run = (input, settings) => Effect.uninterruptibleMask((restore) => Effect.flatMap(lock.withPermit(admit(input, settings?.force === true)), (result) => restore(result)));
|
|
97
|
+
return { run, close };
|
|
98
|
+
});
|
|
99
|
+
//# sourceMappingURL=Interaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Interaction.js","sourceRoot":"","sources":["../../src/concurrency/Interaction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,KAAK,EAEL,IAAI,EAEJ,KAAK,EACL,SAAS,GACV,MAAM,QAAQ,CAAC;AAEhB;;;;;GAKG;AACH,MAAM,OAAO,MAAO,SAAQ,IAAI,CAAC,WAAW,CAAC,mBAAmB,CAAC;CAAG;AA2CpE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,EAC7C,OAA6C,EAC7C,OAAuB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C,OAAO,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;IAEH,MAAM,GAAG,GAAG,CAAC,KAAQ,EAAE,QAAqB,EAAgC,EAAE,CAC5E,MAAM,CAAC,mBAAmB,CAAC,CAAC,OAAO,EAAE,EAAE,CACrC,MAAM,CAAC,OAAO,CACZ,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,KAAK,IAAI,CAAC,CAAC,EACvD,CAAC,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAC5B,CACF,CAAC;IAEJ,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;AACxB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { Effect, Pipeable, Schema } from "effect";
|
|
2
|
+
import { HttpBody, HttpClientError, type HttpClientResponse, type UrlParams } from "effect/http";
|
|
3
|
+
/**
|
|
4
|
+
* Turn an application value into a finite outgoing HTTP body.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Use with `Request.body`. Encoding occurs once per operation evaluation, before dispatch.
|
|
8
|
+
*/
|
|
9
|
+
export interface Encoder<in A, out E = never, out R = never> extends Pipeable.Pipeable {
|
|
10
|
+
readonly encode: (value: A) => Effect.Effect<HttpBody.HttpBody, E, R>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Read a finite response body into an application value.
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* Use with `Response.status` or `Response.when`. Read the body within the returned Effect;
|
|
17
|
+
* `Operation.make` closes the attempt's resources before returning the decoded result.
|
|
18
|
+
*/
|
|
19
|
+
export interface Decoder<out A, out E = never, out R = never> extends Pipeable.Pipeable {
|
|
20
|
+
readonly decode: (response: HttpClientResponse.HttpClientResponse) => Effect.Effect<A, E, R>;
|
|
21
|
+
/** Contributes to automatic `Accept`; it does not validate response Content-Type. */
|
|
22
|
+
readonly mediaType: string | undefined;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* An encoder and decoder for the same application value.
|
|
26
|
+
*
|
|
27
|
+
* @remarks
|
|
28
|
+
* Encoding and decoding errors and required services are tracked separately.
|
|
29
|
+
*/
|
|
30
|
+
export interface Codec<A, EncodeError = never, DecodeError = never, EncodeServices = never, DecodeServices = never> extends Encoder<A, EncodeError, EncodeServices>, Decoder<A, DecodeError, DecodeServices> {
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Create a custom outgoing body encoder from an Effect-returning function.
|
|
34
|
+
*
|
|
35
|
+
* @remarks
|
|
36
|
+
* Return an Effect `HttpBody` with the representation and content metadata your service needs.
|
|
37
|
+
*/
|
|
38
|
+
export declare const encoder: <A, E = never, R = never>(encode: (value: A) => Effect.Effect<HttpBody.HttpBody, E, R>) => Encoder<A, E, R>;
|
|
39
|
+
/**
|
|
40
|
+
* Create a custom response-body decoder from an Effect-returning function.
|
|
41
|
+
*
|
|
42
|
+
* @remarks
|
|
43
|
+
* `mediaType` contributes to automatic `Accept`; it does not validate response Content-Type.
|
|
44
|
+
* Return typed failures through the Effect error channel; thrown exceptions are defects.
|
|
45
|
+
*/
|
|
46
|
+
export declare const decoder: <A, E = never, R = never>(decode: (response: HttpClientResponse.HttpClientResponse) => Effect.Effect<A, E, R>, mediaType?: string) => Decoder<A, E, R>;
|
|
47
|
+
/**
|
|
48
|
+
* Combine custom encoding and decoding functions into one body codec.
|
|
49
|
+
*
|
|
50
|
+
* @remarks
|
|
51
|
+
* `mediaType` describes the accepted response representation. Outgoing content metadata comes
|
|
52
|
+
* from the `HttpBody` returned by `encode`.
|
|
53
|
+
*/
|
|
54
|
+
export declare const make: <A, EncodeError = never, DecodeError = never, EncodeServices = never, DecodeServices = never>(options: {
|
|
55
|
+
readonly encode: (value: A) => Effect.Effect<HttpBody.HttpBody, EncodeError, EncodeServices>;
|
|
56
|
+
readonly decode: (response: HttpClientResponse.HttpClientResponse) => Effect.Effect<A, DecodeError, DecodeServices>;
|
|
57
|
+
readonly mediaType?: string | undefined;
|
|
58
|
+
}) => Codec<A, EncodeError, DecodeError, EncodeServices, DecodeServices>;
|
|
59
|
+
/**
|
|
60
|
+
* Read and write JSON without schema validation.
|
|
61
|
+
*
|
|
62
|
+
* @remarks
|
|
63
|
+
* Encoding uses Effect's `HttpBody.json`. Values omitted by `JSON.stringify`, such as
|
|
64
|
+
* `undefined`, produce an empty outgoing body. An empty incoming body is a decoding failure,
|
|
65
|
+
* not `null`. Use {@link jsonSchema} to validate and transform application values.
|
|
66
|
+
*/
|
|
67
|
+
export declare const json: Codec<unknown, HttpBody.HttpBodyError, HttpClientError.HttpClientError>;
|
|
68
|
+
/**
|
|
69
|
+
* Read and write text, with `text/plain` as the media type.
|
|
70
|
+
*
|
|
71
|
+
* @remarks
|
|
72
|
+
* Outgoing text is UTF-8. Incoming decoding delegates to the provider's `response.text`.
|
|
73
|
+
* Fetch-backed providers ignore charset parameters, strip a leading UTF-8 BOM, and replace
|
|
74
|
+
* malformed bytes with U+FFFD. Use {@link bytes} for strict or non-UTF-8 decoding.
|
|
75
|
+
*/
|
|
76
|
+
export declare const text: Codec<string, never, HttpClientError.HttpClientError>;
|
|
77
|
+
/**
|
|
78
|
+
* Read and write `Uint8Array` bodies as `application/octet-stream`.
|
|
79
|
+
*
|
|
80
|
+
* @remarks
|
|
81
|
+
* Incoming bytes are buffered. Use a schema or custom decoder to interpret another encoding.
|
|
82
|
+
*/
|
|
83
|
+
export declare const bytes: Codec<Uint8Array, never, HttpClientError.HttpClientError>;
|
|
84
|
+
/**
|
|
85
|
+
* Read and write Web `FormData` as multipart form data.
|
|
86
|
+
*
|
|
87
|
+
* @remarks
|
|
88
|
+
* The transport supplies the outgoing multipart boundary and its Content-Type. Do not set a
|
|
89
|
+
* boundary-less Content-Type manually. Decoding delegates to the HTTP provider.
|
|
90
|
+
*/
|
|
91
|
+
export declare const formData: Codec<FormData, never, HttpClientError.HttpClientError>;
|
|
92
|
+
/**
|
|
93
|
+
* Read and write form bodies using Effect's `UrlParams.UrlParams`.
|
|
94
|
+
*
|
|
95
|
+
* @remarks
|
|
96
|
+
* Construct values with `UrlParams.fromInput` from `effect/http`. The media type is
|
|
97
|
+
* `application/x-www-form-urlencoded`.
|
|
98
|
+
*/
|
|
99
|
+
export declare const urlEncoded: Codec<UrlParams.UrlParams, never, HttpClientError.HttpClientError>;
|
|
100
|
+
/**
|
|
101
|
+
* Send no body, or discard an incoming body when its content is not needed.
|
|
102
|
+
*
|
|
103
|
+
* @remarks
|
|
104
|
+
* Decoding drains even unexpected incoming bytes without buffering them. Draining has no
|
|
105
|
+
* intrinsic timeout; use an attempt or operation timeout for an unbounded response.
|
|
106
|
+
*/
|
|
107
|
+
export declare const empty: Codec<void, never, HttpClientError.HttpClientError>;
|
|
108
|
+
/**
|
|
109
|
+
* Transform a decoded value with a pure function, preserving its media type.
|
|
110
|
+
*
|
|
111
|
+
* @remarks
|
|
112
|
+
* Returns a decoder only. Use {@link mapEffect} if the transformation may fail or need services.
|
|
113
|
+
*/
|
|
114
|
+
export declare const map: <A, B>(f: (value: A) => B) => <E, R>(self: Decoder<A, E, R>) => Decoder<B, E, R>;
|
|
115
|
+
/**
|
|
116
|
+
* Transform a decoded value with an Effect, adding its errors and required services.
|
|
117
|
+
*
|
|
118
|
+
* @remarks
|
|
119
|
+
* Returns a decoder only and preserves the media type. When used in a response case, this work
|
|
120
|
+
* is part of that attempt's decoding and is covered by its timeout.
|
|
121
|
+
*/
|
|
122
|
+
export declare const mapEffect: <A, B, E2, R2>(f: (value: A) => Effect.Effect<B, E2, R2>) => <E, R>(self: Decoder<A, E, R>) => Decoder<B, E | E2, R | R2>;
|
|
123
|
+
/**
|
|
124
|
+
* Validate and transform a decoded value with an Effect schema.
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```ts
|
|
128
|
+
* import { Schema } from "effect";
|
|
129
|
+
* import { Body } from "viell-effect-schema-http";
|
|
130
|
+
* const numberFromText = Body.text.pipe(Body.schema(Schema.NumberFromString));
|
|
131
|
+
* // Decodes the text "42" to the number 42.
|
|
132
|
+
* ```
|
|
133
|
+
*
|
|
134
|
+
* @remarks
|
|
135
|
+
* Returns a decoder with the schema's application type. A failure in a selected response case
|
|
136
|
+
* is final for that attempt; it does not try a later response case.
|
|
137
|
+
*/
|
|
138
|
+
export declare const schema: <S extends Schema.Constraint>(contract: S) => <A, E, R>(self: Decoder<A, E, R>) => Decoder<S["Type"], E | Schema.SchemaError, R | S["DecodingServices"]>;
|
|
139
|
+
/**
|
|
140
|
+
* Validate and encode application input before passing it to a body encoder.
|
|
141
|
+
*
|
|
142
|
+
* @remarks
|
|
143
|
+
* The schema's encoded type must match the underlying encoder's input. Returns an encoder only;
|
|
144
|
+
* use {@link schema} for the decoding direction.
|
|
145
|
+
*/
|
|
146
|
+
export declare const encodeSchema: <S extends Schema.Constraint>(contract: S) => <E, R>(self: Encoder<S["Encoded"], E, R>) => Encoder<S["Type"], E | Schema.SchemaError, R | S["EncodingServices"]>;
|
|
147
|
+
/**
|
|
148
|
+
* Read and write schema-validated JSON using the schema's application type.
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```ts
|
|
152
|
+
* import { Schema } from "effect";
|
|
153
|
+
* import { Body } from "viell-effect-schema-http";
|
|
154
|
+
* const user = Body.jsonSchema(Schema.Struct({ id: Schema.Number, name: Schema.String }));
|
|
155
|
+
* ```
|
|
156
|
+
*
|
|
157
|
+
* @remarks
|
|
158
|
+
* Uses `Schema.toCodecJson` to obtain the schema's canonical JSON codec. Encoding failures occur
|
|
159
|
+
* before dispatch; an operation wraps response decoding failures in `Response.DecodeError`.
|
|
160
|
+
*/
|
|
161
|
+
export declare const jsonSchema: <S extends Schema.Constraint>(contract: S) => Codec<S["Type"], Schema.SchemaError | HttpBody.HttpBodyError, Schema.SchemaError | HttpClientError.HttpClientError, S["EncodingServices"], S["DecodingServices"]>;
|
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create a custom outgoing body encoder from an Effect-returning function.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Return an Effect `HttpBody` with the representation and content metadata your service needs.
|
|
8
|
+
*/
|
|
9
|
+
export const encoder = (encode) => ({
|
|
10
|
+
...Pipeable.Prototype,
|
|
11
|
+
encode,
|
|
12
|
+
});
|
|
13
|
+
/**
|
|
14
|
+
* Create a custom response-body decoder from an Effect-returning function.
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
* `mediaType` contributes to automatic `Accept`; it does not validate response Content-Type.
|
|
18
|
+
* Return typed failures through the Effect error channel; thrown exceptions are defects.
|
|
19
|
+
*/
|
|
20
|
+
export const decoder = (decode, mediaType) => ({ ...Pipeable.Prototype, decode, mediaType });
|
|
21
|
+
/**
|
|
22
|
+
* Combine custom encoding and decoding functions into one body codec.
|
|
23
|
+
*
|
|
24
|
+
* @remarks
|
|
25
|
+
* `mediaType` describes the accepted response representation. Outgoing content metadata comes
|
|
26
|
+
* from the `HttpBody` returned by `encode`.
|
|
27
|
+
*/
|
|
28
|
+
export const make = (options) => ({
|
|
29
|
+
...Pipeable.Prototype,
|
|
30
|
+
encode: options.encode,
|
|
31
|
+
decode: options.decode,
|
|
32
|
+
mediaType: options.mediaType,
|
|
33
|
+
});
|
|
34
|
+
const decodeFailure = (response, cause) => new HttpClientError.HttpClientError({
|
|
35
|
+
reason: new HttpClientError.DecodeError({
|
|
36
|
+
request: response.request,
|
|
37
|
+
response,
|
|
38
|
+
cause,
|
|
39
|
+
}),
|
|
40
|
+
});
|
|
41
|
+
/**
|
|
42
|
+
* Read and write JSON without schema validation.
|
|
43
|
+
*
|
|
44
|
+
* @remarks
|
|
45
|
+
* Encoding uses Effect's `HttpBody.json`. Values omitted by `JSON.stringify`, such as
|
|
46
|
+
* `undefined`, produce an empty outgoing body. An empty incoming body is a decoding failure,
|
|
47
|
+
* not `null`. Use {@link jsonSchema} to validate and transform application values.
|
|
48
|
+
*/
|
|
49
|
+
export const json = make({
|
|
50
|
+
encode: (value) => HttpBody.json(value),
|
|
51
|
+
decode: (response) => Effect.flatMap(response.text, (text) => Effect.try({
|
|
52
|
+
try: () => JSON.parse(text),
|
|
53
|
+
catch: (cause) => decodeFailure(response, cause),
|
|
54
|
+
})),
|
|
55
|
+
mediaType: "application/json",
|
|
56
|
+
});
|
|
57
|
+
/**
|
|
58
|
+
* Read and write text, with `text/plain` as the media type.
|
|
59
|
+
*
|
|
60
|
+
* @remarks
|
|
61
|
+
* Outgoing text is UTF-8. Incoming decoding delegates to the provider's `response.text`.
|
|
62
|
+
* Fetch-backed providers ignore charset parameters, strip a leading UTF-8 BOM, and replace
|
|
63
|
+
* malformed bytes with U+FFFD. Use {@link bytes} for strict or non-UTF-8 decoding.
|
|
64
|
+
*/
|
|
65
|
+
export const text = make({
|
|
66
|
+
encode: (value) => Effect.sync(() => HttpBody.text(value)),
|
|
67
|
+
decode: (response) => response.text,
|
|
68
|
+
mediaType: "text/plain",
|
|
69
|
+
});
|
|
70
|
+
/**
|
|
71
|
+
* Read and write `Uint8Array` bodies as `application/octet-stream`.
|
|
72
|
+
*
|
|
73
|
+
* @remarks
|
|
74
|
+
* Incoming bytes are buffered. Use a schema or custom decoder to interpret another encoding.
|
|
75
|
+
*/
|
|
76
|
+
export const bytes = make({
|
|
77
|
+
encode: (value) => Effect.sync(() => HttpBody.uint8Array(value)),
|
|
78
|
+
decode: (response) => Effect.map(response.arrayBuffer, (buffer) => new Uint8Array(buffer)),
|
|
79
|
+
mediaType: "application/octet-stream",
|
|
80
|
+
});
|
|
81
|
+
/**
|
|
82
|
+
* Read and write Web `FormData` as multipart form data.
|
|
83
|
+
*
|
|
84
|
+
* @remarks
|
|
85
|
+
* The transport supplies the outgoing multipart boundary and its Content-Type. Do not set a
|
|
86
|
+
* boundary-less Content-Type manually. Decoding delegates to the HTTP provider.
|
|
87
|
+
*/
|
|
88
|
+
export const formData = make({
|
|
89
|
+
encode: (value) => Effect.sync(() => HttpBody.formData(value)),
|
|
90
|
+
decode: (response) => response.formData,
|
|
91
|
+
mediaType: "multipart/form-data",
|
|
92
|
+
});
|
|
93
|
+
/**
|
|
94
|
+
* Read and write form bodies using Effect's `UrlParams.UrlParams`.
|
|
95
|
+
*
|
|
96
|
+
* @remarks
|
|
97
|
+
* Construct values with `UrlParams.fromInput` from `effect/http`. The media type is
|
|
98
|
+
* `application/x-www-form-urlencoded`.
|
|
99
|
+
*/
|
|
100
|
+
export const urlEncoded = make({
|
|
101
|
+
encode: (value) => Effect.sync(() => HttpBody.urlParams(value)),
|
|
102
|
+
decode: (response) => response.urlParamsBody,
|
|
103
|
+
mediaType: "application/x-www-form-urlencoded",
|
|
104
|
+
});
|
|
105
|
+
const isEmptyBody = (error) => error.reason._tag === "EmptyBodyError";
|
|
106
|
+
/**
|
|
107
|
+
* Send no body, or discard an incoming body when its content is not needed.
|
|
108
|
+
*
|
|
109
|
+
* @remarks
|
|
110
|
+
* Decoding drains even unexpected incoming bytes without buffering them. Draining has no
|
|
111
|
+
* intrinsic timeout; use an attempt or operation timeout for an unbounded response.
|
|
112
|
+
*/
|
|
113
|
+
export const empty = make({
|
|
114
|
+
encode: () => Effect.succeed(HttpBody.empty),
|
|
115
|
+
decode: (response) => Stream.runDrain(response.stream).pipe(Effect.catchIf(isEmptyBody, () => Effect.void)),
|
|
116
|
+
});
|
|
117
|
+
/**
|
|
118
|
+
* Transform a decoded value with a pure function, preserving its media type.
|
|
119
|
+
*
|
|
120
|
+
* @remarks
|
|
121
|
+
* Returns a decoder only. Use {@link mapEffect} if the transformation may fail or need services.
|
|
122
|
+
*/
|
|
123
|
+
export const map = (f) => (self) => decoder((response) => Effect.map(self.decode(response), f), self.mediaType);
|
|
124
|
+
/**
|
|
125
|
+
* Transform a decoded value with an Effect, adding its errors and required services.
|
|
126
|
+
*
|
|
127
|
+
* @remarks
|
|
128
|
+
* Returns a decoder only and preserves the media type. When used in a response case, this work
|
|
129
|
+
* is part of that attempt's decoding and is covered by its timeout.
|
|
130
|
+
*/
|
|
131
|
+
export const mapEffect = (f) => (self) => decoder((response) => Effect.flatMap(self.decode(response), f), self.mediaType);
|
|
132
|
+
/**
|
|
133
|
+
* Validate and transform a decoded value with an Effect schema.
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```ts
|
|
137
|
+
* import { Schema } from "effect";
|
|
138
|
+
* import { Body } from "viell-effect-schema-http";
|
|
139
|
+
* const numberFromText = Body.text.pipe(Body.schema(Schema.NumberFromString));
|
|
140
|
+
* // Decodes the text "42" to the number 42.
|
|
141
|
+
* ```
|
|
142
|
+
*
|
|
143
|
+
* @remarks
|
|
144
|
+
* Returns a decoder with the schema's application type. A failure in a selected response case
|
|
145
|
+
* is final for that attempt; it does not try a later response case.
|
|
146
|
+
*/
|
|
147
|
+
export const schema = (contract) => {
|
|
148
|
+
const decode = Schema.decodeUnknownEffect(contract);
|
|
149
|
+
return (self) => self.pipe(mapEffect((value) => decode(value)));
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* Validate and encode application input before passing it to a body encoder.
|
|
153
|
+
*
|
|
154
|
+
* @remarks
|
|
155
|
+
* The schema's encoded type must match the underlying encoder's input. Returns an encoder only;
|
|
156
|
+
* use {@link schema} for the decoding direction.
|
|
157
|
+
*/
|
|
158
|
+
export const encodeSchema = (contract) => {
|
|
159
|
+
const encode = Schema.encodeEffect(contract);
|
|
160
|
+
return (self) => encoder((value) => Effect.flatMap(encode(value), self.encode));
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* Read and write schema-validated JSON using the schema's application type.
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* ```ts
|
|
167
|
+
* import { Schema } from "effect";
|
|
168
|
+
* import { Body } from "viell-effect-schema-http";
|
|
169
|
+
* const user = Body.jsonSchema(Schema.Struct({ id: Schema.Number, name: Schema.String }));
|
|
170
|
+
* ```
|
|
171
|
+
*
|
|
172
|
+
* @remarks
|
|
173
|
+
* Uses `Schema.toCodecJson` to obtain the schema's canonical JSON codec. Encoding failures occur
|
|
174
|
+
* before dispatch; an operation wraps response decoding failures in `Response.DecodeError`.
|
|
175
|
+
*/
|
|
176
|
+
export const jsonSchema = (contract) => {
|
|
177
|
+
const codec = Schema.toCodecJson(contract);
|
|
178
|
+
return make({
|
|
179
|
+
encode: encodeSchema(codec)(json).encode,
|
|
180
|
+
decode: json.pipe(schema(codec)).decode,
|
|
181
|
+
mediaType: json.mediaType,
|
|
182
|
+
});
|
|
183
|
+
};
|
|
184
|
+
//# sourceMappingURL=Body.js.map
|
|
@@ -0,0 +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;AA8CrB;;;;;GAKG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CACrB,MAA4D,EAC1C,EAAE,CAAC,CAAC;IACtB,GAAG,QAAQ,CAAC,SAAS;IACrB,MAAM;CACP,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,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;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAMlB,OAQD,EAAsE,EAAE,CAAC,CAAC;IACzE,GAAG,QAAQ,CAAC,SAAS;IACrB,MAAM,EAAE,OAAO,CAAC,MAAM;IACtB,MAAM,EAAE,OAAO,CAAC,MAAM;IACtB,SAAS,EAAE,OAAO,CAAC,SAAS;CAC7B,CAAC,CAAC;AAEH,MAAM,aAAa,GAAG,CACpB,QAA+C,EAC/C,KAAc,EACd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