@nestia/fetcher 11.0.0-dev.20260312 → 11.0.0-dev.20260313

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 (50) hide show
  1. package/package.json +3 -3
  2. package/src/EncryptedFetcher.ts +176 -176
  3. package/src/FormDataInput.ts +80 -80
  4. package/src/IConnection.ts +241 -241
  5. package/src/IEncryptionPassword.ts +44 -44
  6. package/src/IFetchEvent.ts +31 -31
  7. package/src/IFetchRoute.ts +60 -60
  8. package/src/IPropagation.ts +99 -99
  9. package/src/NestiaSimulator.ts +82 -82
  10. package/src/PlainFetcher.ts +105 -105
  11. package/src/internal/FetcherBase.ts +235 -235
  12. package/lib/AesPkcs5.d.ts +0 -30
  13. package/lib/AesPkcs5.js +0 -49
  14. package/lib/AesPkcs5.js.map +0 -1
  15. package/lib/EncryptedFetcher.d.ts +0 -47
  16. package/lib/EncryptedFetcher.js +0 -98
  17. package/lib/EncryptedFetcher.js.map +0 -1
  18. package/lib/FormDataInput.d.ts +0 -70
  19. package/lib/FormDataInput.js +0 -3
  20. package/lib/FormDataInput.js.map +0 -1
  21. package/lib/HttpError.d.ts +0 -1
  22. package/lib/HttpError.js +0 -6
  23. package/lib/HttpError.js.map +0 -1
  24. package/lib/IConnection.d.ts +0 -165
  25. package/lib/IConnection.js +0 -3
  26. package/lib/IConnection.js.map +0 -1
  27. package/lib/IEncryptionPassword.d.ts +0 -41
  28. package/lib/IEncryptionPassword.js +0 -3
  29. package/lib/IEncryptionPassword.js.map +0 -1
  30. package/lib/IFetchEvent.d.ts +0 -11
  31. package/lib/IFetchEvent.js +0 -21
  32. package/lib/IFetchEvent.js.map +0 -1
  33. package/lib/IFetchRoute.d.ts +0 -46
  34. package/lib/IFetchRoute.js +0 -3
  35. package/lib/IFetchRoute.js.map +0 -1
  36. package/lib/IPropagation.d.ts +0 -69
  37. package/lib/IPropagation.js +0 -3
  38. package/lib/IPropagation.js.map +0 -1
  39. package/lib/NestiaSimulator.d.ts +0 -13
  40. package/lib/NestiaSimulator.js +0 -44
  41. package/lib/NestiaSimulator.js.map +0 -1
  42. package/lib/PlainFetcher.d.ts +0 -46
  43. package/lib/PlainFetcher.js +0 -58
  44. package/lib/PlainFetcher.js.map +0 -1
  45. package/lib/index.d.ts +0 -11
  46. package/lib/index.js +0 -28
  47. package/lib/index.js.map +0 -1
  48. package/lib/internal/FetcherBase.d.ts +0 -1
  49. package/lib/internal/FetcherBase.js +0 -185
  50. package/lib/internal/FetcherBase.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"NestiaSimulator.js","sourceRoot":"","sources":["../src/NestiaSimulator.ts"],"names":[],"mappings":";;;AAAA,2CAAwC;AAExC,IAAiB,eAAe,CAgE/B;AAhED,WAAiB,eAAe;IAQjB,sBAAM,GAAG,CAAC,KAAa,EAAE,EAAE;QACtC,OAAO;YACL,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC;YACnB,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC;YACnB,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC;SAClB,CAAC;IACJ,CAAC,CAAC;IACF,MAAM,KAAK,GACT,CAAC,KAAa,EAAE,EAAE,CAClB,CAAC,IAAY,EAAE,EAAE,CACjB,CAAI,IAAa,EAAQ,EAAE;QACzB,QAAQ,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,kBAAkB,IAAI,YAAY,GAAG,CAAC,QAAQ,QAAQ,CAAC,CACvE,KAAK,CACN,CAAC,IAAI,CAAC,CAAC;IACV,CAAC,CAAC;IAEJ,MAAM,KAAK,GACT,CAAC,KAAa,EAAE,EAAE,CAClB,CAAI,IAAa,EAAQ,EAAE,CACzB,QAAQ,CACN,GAAG,EAAE,CAAC,+DAA+D,CACtE,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC;IAEnB,MAAM,IAAI,GACR,CAAC,KAAa,EAAE,EAAE,CAClB,CAAI,IAAa,EAAQ,EAAE,CACzB,QAAQ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IAAI,QAAQ,KAAK,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC"}
@@ -1,46 +0,0 @@
1
- import { IConnection } from "./IConnection";
2
- import { IFetchRoute } from "./IFetchRoute";
3
- import { IPropagation } from "./IPropagation";
4
- /**
5
- * Utility class for `fetch` functions used in `@nestia/sdk`.
6
- *
7
- * `PlainFetcher` is a utility class designed for SDK functions generated by
8
- * [`@nestia/sdk`](https://nestia.io/docs/sdk/sdk), interacting with the remote
9
- * HTTP sever API. In other words, this is a collection of dedicated `fetch()`
10
- * functions for `@nestia/sdk`.
11
- *
12
- * For reference, `PlainFetcher` class does not encrypt or decrypt the body data
13
- * at all. It just delivers plain data without any post processing. If you've
14
- * defined a controller method through `@EncryptedRoute` or `@EncryptedBody`
15
- * decorator, then {@liink EncryptedFetcher} class would be used instead.
16
- *
17
- * @author Jeongho Nam - https://github.com/samchon
18
- */
19
- export declare namespace PlainFetcher {
20
- /**
21
- * Fetch function only for `HEAD` method.
22
- *
23
- * @param connection Connection information for the remote HTTP server
24
- * @param route Route information about the target API
25
- * @returns Nothing because of `HEAD` method
26
- */
27
- function fetch(connection: IConnection, route: IFetchRoute<"HEAD">): Promise<void>;
28
- /**
29
- * Fetch function only for `GET` method.
30
- *
31
- * @param connection Connection information for the remote HTTP server
32
- * @param route Route information about the target API
33
- * @returns Response body data from the remote API
34
- */
35
- function fetch<Output>(connection: IConnection, route: IFetchRoute<"GET">): Promise<Output>;
36
- /**
37
- * Fetch function for the `POST`, `PUT`, `PATCH` and `DELETE` methods.
38
- *
39
- * @param connection Connection information for the remote HTTP server
40
- * @param route Route information about the target API
41
- * @returns Response body data from the remote API
42
- */
43
- function fetch<Input, Output>(connection: IConnection, route: IFetchRoute<"POST" | "PUT" | "PATCH" | "DELETE">, input?: Input, stringify?: (input: Input) => string): Promise<Output>;
44
- function propagate<Output extends IPropagation<any, any>>(connection: IConnection, route: IFetchRoute<"GET" | "HEAD">): Promise<Output>;
45
- function propagate<Input, Output extends IPropagation<any, any>>(connection: IConnection, route: IFetchRoute<"DELETE" | "GET" | "HEAD" | "PATCH" | "POST" | "PUT">, input?: Input, stringify?: (input: Input) => string): Promise<Output>;
46
- }
@@ -1,58 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.PlainFetcher = void 0;
13
- const FetcherBase_1 = require("./internal/FetcherBase");
14
- /**
15
- * Utility class for `fetch` functions used in `@nestia/sdk`.
16
- *
17
- * `PlainFetcher` is a utility class designed for SDK functions generated by
18
- * [`@nestia/sdk`](https://nestia.io/docs/sdk/sdk), interacting with the remote
19
- * HTTP sever API. In other words, this is a collection of dedicated `fetch()`
20
- * functions for `@nestia/sdk`.
21
- *
22
- * For reference, `PlainFetcher` class does not encrypt or decrypt the body data
23
- * at all. It just delivers plain data without any post processing. If you've
24
- * defined a controller method through `@EncryptedRoute` or `@EncryptedBody`
25
- * decorator, then {@liink EncryptedFetcher} class would be used instead.
26
- *
27
- * @author Jeongho Nam - https://github.com/samchon
28
- */
29
- var PlainFetcher;
30
- (function (PlainFetcher) {
31
- function fetch(connection, route, input, stringify) {
32
- return __awaiter(this, void 0, void 0, function* () {
33
- var _a, _b;
34
- if (((_a = route.request) === null || _a === void 0 ? void 0 : _a.encrypted) === true || ((_b = route.response) === null || _b === void 0 ? void 0 : _b.encrypted) === true)
35
- throw new Error("Error on PlainFetcher.fetch(): PlainFetcher doesn't have encryption ability. Use EncryptedFetcher instead.");
36
- return FetcherBase_1.FetcherBase.request({
37
- className: "PlainFetcher",
38
- encode: (input) => input,
39
- decode: (input) => input,
40
- })(connection, route, input, stringify);
41
- });
42
- }
43
- PlainFetcher.fetch = fetch;
44
- function propagate(connection, route, input, stringify) {
45
- return __awaiter(this, void 0, void 0, function* () {
46
- var _a, _b;
47
- if (((_a = route.request) === null || _a === void 0 ? void 0 : _a.encrypted) === true || ((_b = route.response) === null || _b === void 0 ? void 0 : _b.encrypted) === true)
48
- throw new Error("Error on PlainFetcher.propagate(): PlainFetcher doesn't have encryption ability. Use EncryptedFetcher instead.");
49
- return FetcherBase_1.FetcherBase.propagate({
50
- className: "PlainFetcher",
51
- encode: (input) => input,
52
- decode: (input) => input,
53
- })(connection, route, input, stringify);
54
- });
55
- }
56
- PlainFetcher.propagate = propagate;
57
- })(PlainFetcher || (exports.PlainFetcher = PlainFetcher = {}));
58
- //# sourceMappingURL=PlainFetcher.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PlainFetcher.js","sourceRoot":"","sources":["../src/PlainFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,wDAAqD;AAErD;;;;;;;;;;;;;;GAcG;AACH,IAAiB,YAAY,CAoF5B;AApFD,WAAiB,YAAY;IAuC3B,SAAsB,KAAK,CACzB,UAAuB,EACvB,KAAwE,EACxE,KAAa,EACb,SAAoC;;;YAEpC,IAAI,CAAA,MAAA,KAAK,CAAC,OAAO,0CAAE,SAAS,MAAK,IAAI,IAAI,CAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,SAAS,MAAK,IAAI;gBACzE,MAAM,IAAI,KAAK,CACb,4GAA4G,CAC7G,CAAC;YACJ,OAAO,yBAAW,CAAC,OAAO,CAAC;gBACzB,SAAS,EAAE,cAAc;gBACzB,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK;gBACxB,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK;aACzB,CAAC,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;QAC1C,CAAC;KAAA;IAfqB,kBAAK,QAe1B,CAAA;IAcD,SAAsB,SAAS,CAC7B,UAAuB,EACvB,KAAwE,EACxE,KAAa,EACb,SAAoC;;;YAEpC,IAAI,CAAA,MAAA,KAAK,CAAC,OAAO,0CAAE,SAAS,MAAK,IAAI,IAAI,CAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,SAAS,MAAK,IAAI;gBACzE,MAAM,IAAI,KAAK,CACb,gHAAgH,CACjH,CAAC;YACJ,OAAO,yBAAW,CAAC,SAAS,CAAC;gBAC3B,SAAS,EAAE,cAAc;gBACzB,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK;gBACxB,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK;aACzB,CAAC,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,CAAoB,CAAC;QAC7D,CAAC;KAAA;IAfqB,sBAAS,YAe9B,CAAA;AACH,CAAC,EApFgB,YAAY,4BAAZ,YAAY,QAoF5B"}
package/lib/index.d.ts DELETED
@@ -1,11 +0,0 @@
1
- export * from "./AesPkcs5";
2
- export * from "./EncryptedFetcher";
3
- export * from "./FormDataInput";
4
- export * from "./HttpError";
5
- export * from "./IConnection";
6
- export * from "./IEncryptionPassword";
7
- export * from "./IFetchEvent";
8
- export * from "./IFetchRoute";
9
- export * from "./IPropagation";
10
- export * from "./NestiaSimulator";
11
- export * from "./PlainFetcher";
package/lib/index.js DELETED
@@ -1,28 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./AesPkcs5"), exports);
18
- __exportStar(require("./EncryptedFetcher"), exports);
19
- __exportStar(require("./FormDataInput"), exports);
20
- __exportStar(require("./HttpError"), exports);
21
- __exportStar(require("./IConnection"), exports);
22
- __exportStar(require("./IEncryptionPassword"), exports);
23
- __exportStar(require("./IFetchEvent"), exports);
24
- __exportStar(require("./IFetchRoute"), exports);
25
- __exportStar(require("./IPropagation"), exports);
26
- __exportStar(require("./NestiaSimulator"), exports);
27
- __exportStar(require("./PlainFetcher"), exports);
28
- //# sourceMappingURL=index.js.map
package/lib/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,qDAAmC;AACnC,kDAAgC;AAChC,8CAA4B;AAC5B,gDAA8B;AAC9B,wDAAsC;AACtC,gDAA8B;AAC9B,gDAA8B;AAC9B,iDAA+B;AAE/B,oDAAkC;AAClC,iDAA+B"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,185 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.FetcherBase = void 0;
13
- const HttpError_1 = require("../HttpError");
14
- /** @internal */
15
- var FetcherBase;
16
- (function (FetcherBase) {
17
- FetcherBase.request = (props) => (connection, route, input, stringify) => __awaiter(this, void 0, void 0, function* () {
18
- const result = yield _Propagate("fetch")(props)(connection, route, input, stringify);
19
- if (result.success === false)
20
- throw new HttpError_1.HttpError(route.method, route.path, result.status, result.headers, result.data);
21
- return result.data;
22
- });
23
- FetcherBase.propagate = (props) => (connection, route, input, stringify) => __awaiter(this, void 0, void 0, function* () { return _Propagate("propagate")(props)(connection, route, input, stringify); });
24
- /** @internal */
25
- const _Propagate = (method) => (props) => (connection, route, input, stringify) => __awaiter(this, void 0, void 0, function* () {
26
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
27
- //----
28
- // REQUEST MESSAGE
29
- //----
30
- // METHOD & HEADERS
31
- const headers = Object.assign({}, ((_a = connection.headers) !== null && _a !== void 0 ? _a : {}));
32
- if (input !== undefined) {
33
- if (((_b = route.request) === null || _b === void 0 ? void 0 : _b.type) === undefined)
34
- throw new Error(`Error on ${props.className}.fetch(): no content-type being configured.`);
35
- else if (route.request.type !== "multipart/form-data")
36
- headers["Content-Type"] = route.request.type;
37
- }
38
- else if (input === undefined && headers["Content-Type"] !== undefined)
39
- delete headers["Content-Type"];
40
- // INIT REQUEST DATA
41
- const init = Object.assign(Object.assign({}, ((_c = connection.options) !== null && _c !== void 0 ? _c : {})), { method: route.method, headers: (() => {
42
- const output = [];
43
- for (const [key, value] of Object.entries(headers))
44
- if (value === undefined)
45
- continue;
46
- else if (Array.isArray(value))
47
- for (const v of value)
48
- output.push([key, String(v)]);
49
- else
50
- output.push([key, String(value)]);
51
- return output;
52
- })() });
53
- // CONSTRUCT BODY DATA
54
- if (input !== undefined)
55
- init.body = props.encode(
56
- // BODY TRANSFORM
57
- ((_d = route.request) === null || _d === void 0 ? void 0 : _d.type) === "application/x-www-form-urlencoded"
58
- ? request_query_body(input)
59
- : ((_e = route.request) === null || _e === void 0 ? void 0 : _e.type) === "multipart/form-data"
60
- ? request_form_data_body(input)
61
- : ((_f = route.request) === null || _f === void 0 ? void 0 : _f.type) !== "text/plain"
62
- ? (stringify !== null && stringify !== void 0 ? stringify : JSON.stringify)(input)
63
- : input, headers);
64
- //----
65
- // RESPONSE MESSAGE
66
- //----
67
- // URL SPECIFICATION
68
- const path = connection.host[connection.host.length - 1] !== "/" &&
69
- route.path[0] !== "/"
70
- ? `/${route.path}`
71
- : route.path;
72
- const url = new URL(`${connection.host}${path}`);
73
- // DO FETCH
74
- const event = {
75
- route,
76
- path,
77
- status: null,
78
- input,
79
- output: undefined,
80
- started_at: new Date(),
81
- respond_at: null,
82
- completed_at: null,
83
- };
84
- try {
85
- // TRY FETCH
86
- const response = yield ((_g = connection.fetch) !== null && _g !== void 0 ? _g : fetch)(url.href, init);
87
- event.respond_at = new Date();
88
- event.status = response.status;
89
- // CONSTRUCT RESULT DATA
90
- const result = {
91
- success: response.status === 200 ||
92
- response.status === 201 ||
93
- response.status === route.status,
94
- status: response.status,
95
- headers: response_headers_to_object(response.headers),
96
- data: undefined,
97
- };
98
- if (result.success === false) {
99
- // WHEN FAILED
100
- result.data = yield response.text();
101
- const type = response.headers.get("content-type");
102
- if (method !== "fetch" &&
103
- type &&
104
- type.indexOf("application/json") !== -1)
105
- try {
106
- result.data = JSON.parse(result.data);
107
- }
108
- catch (_k) { }
109
- }
110
- else {
111
- // WHEN SUCCESS
112
- if (route.method === "HEAD")
113
- result.data = undefined;
114
- else if (((_h = route.response) === null || _h === void 0 ? void 0 : _h.type) === "application/json") {
115
- const text = yield response.text();
116
- result.data = text.length ? JSON.parse(text) : undefined;
117
- }
118
- else if (((_j = route.response) === null || _j === void 0 ? void 0 : _j.type) === "application/x-www-form-urlencoded") {
119
- const query = new URLSearchParams(yield response.text());
120
- result.data = route.parseQuery ? route.parseQuery(query) : query;
121
- }
122
- else
123
- result.data = props.decode(yield response.text(), result.headers);
124
- }
125
- event.output = result.data;
126
- return result;
127
- }
128
- catch (exp) {
129
- throw exp;
130
- }
131
- finally {
132
- event.completed_at = new Date();
133
- if (connection.logger)
134
- try {
135
- yield connection.logger(event);
136
- }
137
- catch (_l) { }
138
- }
139
- });
140
- })(FetcherBase || (exports.FetcherBase = FetcherBase = {}));
141
- /** @internal */
142
- const request_query_body = (input) => {
143
- const q = new URLSearchParams();
144
- for (const [key, value] of Object.entries(input))
145
- if (value === undefined)
146
- continue;
147
- else if (Array.isArray(value))
148
- value.forEach((elem) => q.append(key, String(elem)));
149
- else
150
- q.set(key, String(value));
151
- return q;
152
- };
153
- /** @internal */
154
- const request_form_data_body = (input) => {
155
- const encoded = new FormData();
156
- const append = (key) => (value) => {
157
- if (value === undefined)
158
- return;
159
- else if (typeof File === "function" && value instanceof File)
160
- encoded.append(key, value, value.name);
161
- else
162
- encoded.append(key, value);
163
- };
164
- for (const [key, value] of Object.entries(input))
165
- if (Array.isArray(value))
166
- value.map(append(key));
167
- else
168
- append(key)(value);
169
- return encoded;
170
- };
171
- /** @internal */
172
- const response_headers_to_object = (headers) => {
173
- const output = {};
174
- headers.forEach((value, key) => {
175
- var _a;
176
- if (key === "set-cookie") {
177
- (_a = output[key]) !== null && _a !== void 0 ? _a : (output[key] = []);
178
- output[key].push(...value.split(";").map((str) => str.trim()));
179
- }
180
- else
181
- output[key] = value;
182
- });
183
- return output;
184
- };
185
- //# sourceMappingURL=FetcherBase.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FetcherBase.js","sourceRoot":"","sources":["../../src/internal/FetcherBase.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAAyC;AAMzC,gBAAgB;AAChB,IAAiB,WAAW,CAyL3B;AAzLD,WAAiB,WAAW;IAab,mBAAO,GAClB,CAAC,KAAa,EAAE,EAAE,CAClB,CACE,UAAuB,EACvB,KAAwE,EACxE,KAAa,EACb,SAAoC,EACnB,EAAE;QACnB,MAAM,MAAM,GAAG,MAAM,UAAU,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