viell-effect-schema-http 0.1.0 → 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 (47) hide show
  1. package/README.md +43 -29
  2. package/dist/http/Body.d.ts +23 -13
  3. package/dist/http/Body.d.ts.map +1 -1
  4. package/dist/http/Body.js +18 -8
  5. package/dist/http/Body.js.map +1 -1
  6. package/dist/http/Operation.d.ts +270 -13
  7. package/dist/http/Operation.d.ts.map +1 -1
  8. package/dist/http/Operation.js +210 -11
  9. package/dist/http/Operation.js.map +1 -1
  10. package/dist/http/Policy.d.ts +3 -2
  11. package/dist/http/Policy.d.ts.map +1 -1
  12. package/dist/http/Policy.js +3 -2
  13. package/dist/http/Policy.js.map +1 -1
  14. package/dist/http/Request.d.ts +477 -85
  15. package/dist/http/Request.d.ts.map +1 -1
  16. package/dist/http/Request.js +621 -141
  17. package/dist/http/Request.js.map +1 -1
  18. package/dist/http/Response.d.ts +119 -5
  19. package/dist/http/Response.d.ts.map +1 -1
  20. package/dist/http/Response.js +88 -7
  21. package/dist/http/Response.js.map +1 -1
  22. package/dist/http/UrlEncoding.d.ts +23 -7
  23. package/dist/http/UrlEncoding.d.ts.map +1 -1
  24. package/dist/http/UrlEncoding.js +7 -3
  25. package/dist/http/UrlEncoding.js.map +1 -1
  26. package/dist/http/internal/fields.d.ts +17 -4
  27. package/dist/http/internal/fields.d.ts.map +1 -1
  28. package/dist/http/internal/fields.js +11 -6
  29. package/dist/http/internal/fields.js.map +1 -1
  30. package/dist/http/internal/input.d.ts +39 -0
  31. package/dist/http/internal/input.d.ts.map +1 -0
  32. package/dist/http/internal/input.js +40 -0
  33. package/dist/http/internal/input.js.map +1 -0
  34. package/dist/http/internal/shape.d.ts +44 -0
  35. package/dist/http/internal/shape.d.ts.map +1 -0
  36. package/dist/http/internal/shape.js +179 -0
  37. package/dist/http/internal/shape.js.map +1 -0
  38. package/package.json +12 -12
  39. package/src/http/Body.ts +39 -18
  40. package/src/http/Operation.ts +468 -33
  41. package/src/http/Policy.ts +3 -2
  42. package/src/http/Request.ts +1075 -251
  43. package/src/http/Response.ts +235 -22
  44. package/src/http/UrlEncoding.ts +31 -8
  45. package/src/http/internal/fields.ts +37 -9
  46. package/src/http/internal/input.ts +123 -0
  47. package/src/http/internal/shape.ts +279 -0
package/README.md CHANGED
@@ -6,7 +6,10 @@ to your application; the server does not need to use this library or Effect.
6
6
 
7
7
  ## Example
8
8
 
9
- Describe a user lookup and the JSON response your application understands:
9
+ Describe a user lookup and the JSON response your application understands. The constructor's path
10
+ and `Request.path` add together, so the example passes `""` and the template holds the whole path;
11
+ `Request.get("/users")` with the same template would ask for `/users/users/42`. A base URL is joined
12
+ to a relative path, and an absolute URL in the request bypasses it:
10
13
 
11
14
  ```ts
12
15
  import { Effect, Schema } from "effect";
@@ -14,12 +17,10 @@ import { FetchHttpClient } from "effect/http";
14
17
  import { Body, Operation, Request, Response } from "viell-effect-schema-http";
15
18
 
16
19
  const api = Request.baseUrl("https://api.example.test");
20
+ const userId = Request.pathValue("userId", Schema.FiniteFromString);
17
21
 
18
22
  const getUser = Operation.make(
19
- Request.get("").pipe(
20
- api,
21
- Request.path(Schema.NumberFromString, (id, encode) => `/users/${encode(id)}`),
22
- ),
23
+ Request.get("").pipe(api, Request.path`/users/${userId}`),
23
24
  Response.status(
24
25
  200,
25
26
  Body.jsonSchema(Schema.Struct({ id: Schema.Number, name: Schema.String })),
@@ -27,31 +28,40 @@ const getUser = Operation.make(
27
28
  );
28
29
 
29
30
  const program = getUser
30
- .execute({ path: 42 })
31
+ .execute({ path: { userId: 42 } })
31
32
  .pipe(Effect.provide(FetchHttpClient.layer));
32
33
  // Replace the example endpoint with your service, then: await Effect.runPromise(program).
34
+
35
+ // Adjust the definition where it is used. getUser itself does not change.
36
+ const inFrench = Request.setHeader("accept-language", "fr");
37
+ const getUserInFrench = getUser.pipe(Operation.mapRequest(inFrench));
33
38
  ```
34
39
 
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
40
+ Reuse `api` across requests to share the base URL. The path value's schema turns the number into URL
41
+ text, and the library escapes it. The response schema validates the returned JSON. Constructing
42
+ `program` sends nothing; evaluating it produces a typed user or an Effect failure.
43
+
44
+ A definition describes the most common request, not the only one. Write it once, near the
45
+ integration, and let each part of your application adjust its request, response or options. [Getting
39
46
  started](https://viell-dev.github.io/slop-effect-schema-http/getting-started) supplies a complete
40
47
  in-memory example you can run without a server or credentials.
41
48
 
42
49
  ## Install
43
50
 
44
- In an existing Node.js 24 ESM project with Effect `^4.0.7`, add the library:
51
+ In an existing Node.js 24 or 26 ESM project with Effect `^4.0.7`, add the library:
45
52
 
46
53
  ```sh
47
54
  npm install viell-effect-schema-http
48
55
  ```
49
56
 
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).
57
+ `0.2.0` is the current release. The same package is available as a checksummed [GitHub release
58
+ tarball](https://github.com/viell-dev/slop-effect-schema-http/releases/tag/0.2.0). It changes
59
+ existing behavior, so read [What's in
60
+ 0.2](https://viell-dev.github.io/slop-effect-schema-http/release-notes/0.2) before you update from
61
+ `0.1`.
52
62
 
53
63
  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
64
+ 24 or 26 on Windows/Linux and browser Fetch in Chromium. See [compatibility and
55
65
  limits](https://viell-dev.github.io/slop-effect-schema-http/limits) for tested Effect/compiler
56
66
  versions and provider boundaries.
57
67
 
@@ -60,20 +70,24 @@ versions and provider boundaries.
60
70
  - [Getting started](https://viell-dev.github.io/slop-effect-schema-http/getting-started):
61
71
  installation, a runnable example and the expected output.
62
72
  - [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.
73
+ share URL descriptions, adjust a definition and connect an operation to your HTTP client.
74
+ - [Recipes](https://viell-dev.github.io/slop-effect-schema-http/recipes): everyday tasks that
75
+ combine the modules, such as adjusting a definition for one component.
64
76
  - [Module guides](https://viell-dev.github.io/slop-effect-schema-http/api): Request, Body, Response,
65
77
  Operation, Policy, Interaction, UrlEncoding and Transport, from basic use to advanced behavior.
66
78
  - [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.
79
+ where the library's promise stops, failure stages and bug reporting.
80
+ - [What's in 0.2](https://viell-dev.github.io/slop-effect-schema-http/release-notes/0.2) introduces
81
+ the release and how to update, and [What's in
82
+ 0.1](https://viell-dev.github.io/slop-effect-schema-http/release-notes/0.1) the one before it;
83
+ [Versions](https://viell-dev.github.io/slop-effect-schema-http/versions) covers updates and
84
+ compatibility policy. [CHANGELOG.md](./CHANGELOG.md) records the detailed history.
85
+
86
+ The library provides finite-body codecs, typed contracts you can adjust where they are used, ordered
87
+ response selection, retry policies and scoped interaction coordination. It uses the application's
88
+ HTTP transport and Effect runtime. Streaming bodies, server generation and a general cache are
89
+ outside its scope. The [design contract](https://viell-dev.github.io/slop-effect-schema-http/design)
90
+ explains the precise guarantees.
77
91
 
78
92
  ## Project and contribution
79
93
 
@@ -83,7 +97,7 @@ tracker](https://github.com/viell-dev/slop-effect-schema-http/issues/2) records
83
97
  release's qualification and publication.
84
98
 
85
99
  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).
100
+ a defect](https://github.com/viell-dev/slop-effect-schema-http/issues/new?template=bug_report.yml)
101
+ with a small synthetic reproduction and library, Effect and environment versions. Include expected
102
+ and actual results; keep credentials and private service data out. For sensitive security reports,
103
+ follow the [security policy](./SECURITY.md).
@@ -1,5 +1,6 @@
1
1
  import { Effect, Pipeable, Schema } from "effect";
2
2
  import { HttpBody, HttpClientError, type HttpClientResponse, type UrlParams } from "effect/http";
3
+ import * as Inputs from "./internal/input.js";
3
4
  /**
4
5
  * Turn an application value into a finite outgoing HTTP body.
5
6
  *
@@ -25,9 +26,10 @@ export interface Decoder<out A, out E = never, out R = never> extends Pipeable.P
25
26
  * An encoder and decoder for the same application value.
26
27
  *
27
28
  * @remarks
28
- * Encoding and decoding errors and required services are tracked separately.
29
+ * Encoding and decoding errors and required services are tracked separately. `In` is what encoding
30
+ * takes, which is `A` unless the codec accepts more than it decodes to, as {@link jsonSchema} does.
29
31
  */
30
- export interface Codec<A, EncodeError = never, DecodeError = never, EncodeServices = never, DecodeServices = never> extends Encoder<A, EncodeError, EncodeServices>, Decoder<A, DecodeError, DecodeServices> {
32
+ export interface Codec<A, EncodeError = never, DecodeError = never, EncodeServices = never, DecodeServices = never, In = A> extends Encoder<In, EncodeError, EncodeServices>, Decoder<A, DecodeError, DecodeServices> {
31
33
  }
32
34
  /**
33
35
  * Create a custom outgoing body encoder from an Effect-returning function.
@@ -49,13 +51,13 @@ export declare const decoder: <A, E = never, R = never>(decode: (response: HttpC
49
51
  *
50
52
  * @remarks
51
53
  * `mediaType` describes the accepted response representation. Outgoing content metadata comes
52
- * from the `HttpBody` returned by `encode`.
54
+ * from the `HttpBody` returned by `encode`. `encode` may take more than `decode` returns.
53
55
  */
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
+ export declare const make: <A, EncodeError = never, DecodeError = never, EncodeServices = never, DecodeServices = never, In = A>(options: {
57
+ readonly encode: (value: In) => Effect.Effect<HttpBody.HttpBody, EncodeError, EncodeServices>;
56
58
  readonly decode: (response: HttpClientResponse.HttpClientResponse) => Effect.Effect<A, DecodeError, DecodeServices>;
57
59
  readonly mediaType?: string | undefined;
58
- }) => Codec<A, EncodeError, DecodeError, EncodeServices, DecodeServices>;
60
+ }) => Codec<A, EncodeError, DecodeError, EncodeServices, DecodeServices, In>;
59
61
  /**
60
62
  * Read and write JSON without schema validation.
61
63
  *
@@ -85,8 +87,9 @@ export declare const bytes: Codec<Uint8Array, never, HttpClientError.HttpClientE
85
87
  * Read and write Web `FormData` as multipart form data.
86
88
  *
87
89
  * @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
+ * The transport supplies the outgoing multipart boundary and its Content-Type. A Content-Type the
91
+ * request declares replaces it, and without the boundary the body cannot be read. Decoding
92
+ * delegates to the HTTP provider.
90
93
  */
91
94
  export declare const formData: Codec<FormData, never, HttpClientError.HttpClientError>;
92
95
  /**
@@ -127,7 +130,7 @@ export declare const mapEffect: <A, B, E2, R2>(f: (value: A) => Effect.Effect<B,
127
130
  * ```ts
128
131
  * import { Schema } from "effect";
129
132
  * import { Body } from "viell-effect-schema-http";
130
- * const numberFromText = Body.text.pipe(Body.schema(Schema.NumberFromString));
133
+ * const numberFromText = Body.text.pipe(Body.schema(Schema.FiniteFromString));
131
134
  * // Decodes the text "42" to the number 42.
132
135
  * ```
133
136
  *
@@ -141,11 +144,13 @@ export declare const schema: <S extends Schema.Constraint>(contract: S) => <A, E
141
144
  *
142
145
  * @remarks
143
146
  * The schema's encoded type must match the underlying encoder's input. Returns an encoder only;
144
- * use {@link schema} for the decoding direction.
147
+ * use {@link schema} for the decoding direction. The input takes either side of the schema, or a
148
+ * mix by field, as `Request.Input` describes, so a plain object works for a `Schema.Class`, and
149
+ * the underlying encoder receives what the schema writes.
145
150
  */
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"]>;
151
+ export declare const encodeSchema: <S extends Schema.Top>(contract: S) => <E, R>(self: Encoder<S["Encoded"], E, R>) => Encoder<Inputs.Input<S>, E | Schema.SchemaError, R | S["EncodingServices"] | S["DecodingServices"]>;
147
152
  /**
148
- * Read and write schema-validated JSON using the schema's application type.
153
+ * Read and write schema-validated JSON, returning the schema's application type.
149
154
  *
150
155
  * @example
151
156
  * ```ts
@@ -157,6 +162,11 @@ export declare const encodeSchema: <S extends Schema.Constraint>(contract: S) =>
157
162
  * @remarks
158
163
  * Uses `Schema.toCodecJson` to obtain the schema's canonical JSON codec. Encoding failures occur
159
164
  * before dispatch; an operation wraps response decoding failures in `Response.DecodeError`.
165
+ *
166
+ * Encoding takes either side of the schema, or a mix by field, as `Request.Input` describes, and
167
+ * writes the canonical JSON. The encoded side is the schema's own, so a `Schema.Date` field takes a
168
+ * `Date`, not the ISO text JSON carries. Decoding returns the schema's application type, so a class
169
+ * comes back as an instance.
160
170
  */
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"]>;
171
+ export declare const jsonSchema: <S extends Schema.Top>(contract: S) => Codec<S["Type"], Schema.SchemaError | HttpBody.HttpBodyError, Schema.SchemaError | HttpClientError.HttpClientError, S["EncodingServices"] | S["DecodingServices"], S["DecodingServices"], Inputs.Input<S>>;
162
172
  //# sourceMappingURL=Body.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Body.d.ts","sourceRoot":"","sources":["../../src/http/Body.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAC;AAC1D,OAAO,EACL,QAAQ,EACR,eAAe,EACf,KAAK,kBAAkB,EACvB,KAAK,SAAS,EACf,MAAM,aAAa,CAAC;AAErB;;;;;GAKG;AACH,MAAM,WAAW,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,KAAK,EAAE,GAAG,CAAC,CAAC,GAAG,KAAK,CACzD,SAAQ,QAAQ,CAAC,QAAQ;IACzB,QAAQ,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;CACvE;AAED;;;;;;GAMG;AACH,MAAM,WAAW,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,KAAK,EAAE,GAAG,CAAC,CAAC,GAAG,KAAK,CAC1D,SAAQ,QAAQ,CAAC,QAAQ;IACzB,QAAQ,CAAC,MAAM,EAAE,CACf,QAAQ,EAAE,kBAAkB,CAAC,kBAAkB,KAC5C,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5B,qFAAqF;IACrF,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;CACxC;AAED;;;;;GAKG;AACH,MAAM,WAAW,KAAK,CACpB,CAAC,EACD,WAAW,GAAG,KAAK,EACnB,WAAW,GAAG,KAAK,EACnB,cAAc,GAAG,KAAK,EACtB,cAAc,GAAG,KAAK,CAEtB,SACE,OAAO,CAAC,CAAC,EAAE,WAAW,E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pBody, HttpClientError, } from "effect/http";
3
+ import * as Inputs from "./internal/input.js";
3
4
  /**
4
5
  * Create a custom outgoing body encoder from an Effect-returning function.
5
6
  *
@@ -23,7 +24,7 @@ export const decoder = (decode, mediaType) => ({ ...Pipeable.Prototype, decode,
23
24
  *
24
25
  * @remarks
25
26
  * `mediaType` describes the accepted response representation. Outgoing content metadata comes
26
- * from the `HttpBody` returned by `encode`.
27
+ * from the `HttpBody` returned by `encode`. `encode` may take more than `decode` returns.
27
28
  */
28
29
  export const make = (options) => ({
29
30
  ...Pipeable.Prototype,
@@ -82,8 +83,9 @@ export const bytes = make({
82
83
  * Read and write Web `FormData` as multipart form data.
83
84
  *
84
85
  * @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.
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.
87
89
  */
88
90
  export const formData = make({
89
91
  encode: (value) => Effect.sync(() => HttpBody.formData(value)),
@@ -136,7 +138,7 @@ export const mapEffect = (f) => (self) => decoder((response) => Effect.flatMap(s
136
138
  * ```ts
137
139
  * import { Schema } from "effect";
138
140
  * import { Body } from "viell-effect-schema-http";
139
- * const numberFromText = Body.text.pipe(Body.schema(Schema.NumberFromString));
141
+ * const numberFromText = Body.text.pipe(Body.schema(Schema.FiniteFromString));
140
142
  * // Decodes the text "42" to the number 42.
141
143
  * ```
142
144
  *
@@ -153,14 +155,16 @@ export const schema = (contract) => {
153
155
  *
154
156
  * @remarks
155
157
  * The schema's encoded type must match the underlying encoder's input. Returns an encoder only;
156
- * use {@link schema} for the decoding direction.
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.
157
161
  */
158
162
  export const encodeSchema = (contract) => {
159
- const encode = Schema.encodeEffect(contract);
163
+ const encode = Inputs.encoder(contract, Schema.encodeEffect(contract));
160
164
  return (self) => encoder((value) => Effect.flatMap(encode(value), self.encode));
161
165
  };
162
166
  /**
163
- * Read and write schema-validated JSON using the schema's application type.
167
+ * Read and write schema-validated JSON, returning the schema's application type.
164
168
  *
165
169
  * @example
166
170
  * ```ts
@@ -172,11 +176,17 @@ export const encodeSchema = (contract) => {
172
176
  * @remarks
173
177
  * Uses `Schema.toCodecJson` to obtain the schema's canonical JSON codec. Encoding failures occur
174
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.
175
184
  */
176
185
  export const jsonSchema = (contract) => {
177
186
  const codec = Schema.toCodecJson(contract);
187
+ const encode = Inputs.encoder(contract, Schema.encodeEffect(codec));
178
188
  return make({
179
- encode: encodeSchema(codec)(json).encode,
189
+ encode: (value) => Effect.flatMap(encode(value), json.encode),
180
190
  decode: json.pipe(schema(codec)).decode,
181
191
  mediaType: json.mediaType,
182
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;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,EA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