elysia-openapi-codegen 0.1.3 → 0.1.5

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/README.md CHANGED
@@ -318,26 +318,14 @@ your-project/
318
318
  ```bash
319
319
  # Install dependencies
320
320
  bun install
321
- ```
322
-
323
- ### Local Development
324
321
 
325
- ```bash
326
- # Run directly with Bun during development
322
+ # Run the generator locally
327
323
  bun index.ts -i ./example/openapi.json -o ./output
328
324
  ```
329
325
 
330
- ### Building for Production
331
-
332
- ```bash
333
- # Compile TypeScript to JavaScript
334
- npm run build
335
-
336
- # Test the compiled version
337
- node dist/index.js --help
338
- ```
326
+ ### Building
339
327
 
340
- The build outputs JavaScript files to the `dist/` folder, which is what gets published to npm.
328
+ This project uses Bun as the runtime. No build step is necessary for development.
341
329
 
342
330
  ## How It Works
343
331
 
package/dist/index.js CHANGED
@@ -1,279 +1,278 @@
1
1
  #!/usr/bin/env node
2
- /**
3
- * Elysia OpenAPI Code Generator
4
- * Generates typed React Query hooks from OpenAPI specifications.
5
- */
6
- import fs from 'fs';
7
- import path from 'path';
8
- import https from 'https';
9
- import http from 'http';
2
+
3
+ // index.ts
4
+ import fs from "fs";
5
+ import path from "path";
6
+ import https from "https";
7
+ import http from "http";
10
8
  async function fetchSpec(source) {
11
- if (source.startsWith('http://') || source.startsWith('https://')) {
12
- return new Promise((resolve, reject) => {
13
- const client = source.startsWith('https://') ? https : http;
14
- client.get(source, (res) => {
15
- let data = '';
16
- res.on('data', (chunk) => data += chunk.toString());
17
- res.on('end', () => {
18
- try {
19
- resolve(JSON.parse(data));
20
- }
21
- catch (e) {
22
- reject(new Error(`Failed to parse OpenAPI spec: ${e.message}`));
23
- }
24
- });
25
- res.on('error', reject);
26
- });
9
+ if (source.startsWith("http://") || source.startsWith("https://")) {
10
+ return new Promise((resolve, reject) => {
11
+ const client = source.startsWith("https://") ? https : http;
12
+ client.get(source, (res) => {
13
+ let data = "";
14
+ res.on("data", (chunk) => data += chunk);
15
+ res.on("end", () => {
16
+ try {
17
+ resolve(JSON.parse(data));
18
+ } catch (e) {
19
+ reject(new Error(`Failed to parse OpenAPI spec: ${e.message}`));
20
+ }
27
21
  });
28
- }
29
- return JSON.parse(fs.readFileSync(source, 'utf8'));
22
+ res.on("error", reject);
23
+ });
24
+ });
25
+ }
26
+ return JSON.parse(fs.readFileSync(source, "utf8"));
30
27
  }
31
28
  function resolveType(schema) {
32
- if (!schema)
33
- return 'any';
34
- if (schema.$ref) {
35
- return schema.$ref.split('/').pop() || 'any';
36
- }
37
- if (schema.type === 'array' && schema.items) {
38
- return `Array<${resolveType(schema.items)}>`;
39
- }
40
- if (schema.type === 'object') {
41
- if (!schema.properties)
42
- return 'Record<string, any>';
43
- const props = Object.entries(schema.properties).map(([key, prop]) => {
44
- const isRequired = schema.required?.includes(key);
45
- const optional = isRequired ? '' : '?';
46
- return ` ${key}${optional}: ${resolveType(prop)};`;
47
- });
48
- return `{\n${props.join('\n')}\n}`;
49
- }
50
- if (schema.anyOf || schema.oneOf) {
51
- return (schema.anyOf || schema.oneOf || []).map(resolveType).join(' | ');
52
- }
53
- if (schema.allOf) {
54
- return schema.allOf.map(resolveType).join(' & ');
55
- }
56
- if (schema.nullable) {
57
- return `${resolveType({ ...schema, nullable: false })} | null`;
58
- }
59
- const typeMap = {
60
- string: 'string',
61
- number: 'number',
62
- integer: 'number',
63
- boolean: 'boolean',
64
- null: 'null',
65
- };
66
- return (schema.type && typeMap[schema.type]) || 'any';
29
+ if (!schema)
30
+ return "any";
31
+ if (schema.$ref) {
32
+ return schema.$ref.split("/").pop() || "any";
33
+ }
34
+ if (schema.type === "array" && schema.items) {
35
+ return `Array<${resolveType(schema.items)}>`;
36
+ }
37
+ if (schema.type === "object") {
38
+ if (!schema.properties)
39
+ return "Record<string, any>";
40
+ const props = Object.entries(schema.properties).map(([key, prop]) => {
41
+ const isRequired = schema.required?.includes(key);
42
+ const optional = isRequired ? "" : "?";
43
+ return ` ${key}${optional}: ${resolveType(prop)};`;
44
+ });
45
+ return `{
46
+ ${props.join(`
47
+ `)}
48
+ }`;
49
+ }
50
+ if (schema.anyOf || schema.oneOf) {
51
+ return (schema.anyOf || schema.oneOf || []).map(resolveType).join(" | ");
52
+ }
53
+ if (schema.allOf) {
54
+ return schema.allOf.map(resolveType).join(" & ");
55
+ }
56
+ if (schema.nullable) {
57
+ return `${resolveType({ ...schema, nullable: false })} | null`;
58
+ }
59
+ const typeMap = {
60
+ string: "string",
61
+ number: "number",
62
+ integer: "number",
63
+ boolean: "boolean",
64
+ null: "null"
65
+ };
66
+ return schema.type && typeMap[schema.type] || "any";
67
67
  }
68
68
  function generateTypes(spec) {
69
- const definitions = [];
70
- if (spec.components?.schemas) {
71
- for (const [name, schema] of Object.entries(spec.components.schemas)) {
72
- definitions.push(`export type ${name} = ${resolveType(schema)};`);
73
- }
69
+ const definitions = [];
70
+ if (spec.components?.schemas) {
71
+ for (const [name, schema] of Object.entries(spec.components.schemas)) {
72
+ definitions.push(`export type ${name} = ${resolveType(schema)};`);
74
73
  }
75
- for (const [pathUrl, pathItem] of Object.entries(spec.paths)) {
76
- for (const [method, operation] of Object.entries(pathItem)) {
77
- if (!['get', 'post', 'put', 'patch', 'delete'].includes(method))
78
- continue;
79
- const op = operation;
80
- const opId = op.operationId || `${method}${pathUrl.replace(/[^a-zA-Z0-9]/g, '')}`;
81
- const response = op.responses?.['200'];
82
- if (response?.content?.['application/json']?.schema) {
83
- const responseType = resolveType(response.content['application/json'].schema);
84
- definitions.push(`export type ${capitalize(opId)}Response = ${responseType};`);
85
- }
86
- const params = op.parameters || [];
87
- if (params.length > 0) {
88
- const paramProps = params.map(param => {
89
- const required = param.required ? '' : '?';
90
- return ` ${param.name}${required}: ${resolveType(param.schema)};`;
91
- });
92
- definitions.push(`export type ${capitalize(opId)}Params = {\n${paramProps.join('\n')}\n};`);
93
- }
94
- if (op.requestBody?.content?.['application/json']?.schema) {
95
- const bodyType = resolveType(op.requestBody.content['application/json'].schema);
96
- definitions.push(`export type ${capitalize(opId)}Body = ${bodyType};`);
97
- }
98
- }
74
+ }
75
+ for (const [pathUrl, pathItem] of Object.entries(spec.paths)) {
76
+ for (const [method, operation] of Object.entries(pathItem)) {
77
+ if (!["get", "post", "put", "patch", "delete"].includes(method))
78
+ continue;
79
+ const op = operation;
80
+ const opId = op.operationId || `${method}${pathUrl.replace(/[^a-zA-Z0-9]/g, "")}`;
81
+ const response = op.responses?.["200"];
82
+ if (response?.content?.["application/json"]?.schema) {
83
+ const responseType = resolveType(response.content["application/json"].schema);
84
+ definitions.push(`export type ${capitalize(opId)}Response = ${responseType};`);
85
+ }
86
+ const params = op.parameters || [];
87
+ if (params.length > 0) {
88
+ const paramProps = params.map((param) => {
89
+ const required = param.required ? "" : "?";
90
+ return ` ${param.name}${required}: ${resolveType(param.schema)};`;
91
+ });
92
+ definitions.push(`export type ${capitalize(opId)}Params = {
93
+ ${paramProps.join(`
94
+ `)}
95
+ };`);
96
+ }
97
+ if (op.requestBody?.content?.["application/json"]?.schema) {
98
+ const bodyType = resolveType(op.requestBody.content["application/json"].schema);
99
+ definitions.push(`export type ${capitalize(opId)}Body = ${bodyType};`);
100
+ }
99
101
  }
100
- return definitions.join('\n\n');
102
+ }
103
+ return definitions.join(`
104
+
105
+ `);
101
106
  }
102
107
  function generateHooks(spec) {
103
- const hooks = [];
104
- const baseUrl = spec.servers?.[0]?.url || '';
105
- for (const [pathUrl, pathItem] of Object.entries(spec.paths)) {
106
- for (const [method, operation] of Object.entries(pathItem)) {
107
- if (!['get', 'post', 'put', 'patch', 'delete'].includes(method))
108
- continue;
109
- const op = operation;
110
- const opId = op.operationId || `${method}${pathUrl.replace(/[^a-zA-Z0-9]/g, '')}`;
111
- const hasResponse = !!op.responses?.['200']?.content?.['application/json']?.schema;
112
- const responseType = hasResponse ? `${capitalize(opId)}Response` : 'any';
113
- const params = op.parameters || [];
114
- const hasParams = params.length > 0;
115
- const paramsType = hasParams ? `${capitalize(opId)}Params` : 'void';
116
- const hasBody = !!op.requestBody?.content?.['application/json']?.schema;
117
- const bodyType = hasBody ? `${capitalize(opId)}Body` : 'void';
118
- if (method === 'get') {
119
- const queryParams = params.map(p => p.name);
120
- const queryString = queryParams.length > 0
121
- ? `?${queryParams.map((p) => `\${params?.${p} !== undefined ? '${p}=' + params.${p} : ''}`).join('&')}`
122
- : '';
123
- hooks.push(`
124
- export const use${capitalize(opId)} = (
125
- params${hasParams ? '' : '?'}: ${paramsType},
126
- options?: Omit<UseQueryOptions<${responseType}>, 'queryKey' | 'queryFn'>
127
- ) => {
128
- return useQuery<${responseType}>({
129
- queryKey: ['${opId}', params],
130
- queryFn: async () => {
131
- const res = await fetch(\`\${baseUrl}${pathUrl}${queryString}\`);
132
- if (!res.ok) throw new Error('API Error');
133
- return res.json();
134
- },
135
- ...options,
136
- });
137
- };`);
138
- }
139
- else {
140
- let inputType = 'void';
141
- let inputArg = '';
142
- if (hasBody) {
143
- inputType = bodyType;
144
- inputArg = 'body';
145
- }
146
- else if (hasParams) {
147
- inputType = paramsType;
148
- inputArg = 'params';
149
- }
150
- const hasInput = inputType !== 'void';
151
- hooks.push(`
152
- export const use${capitalize(opId)} = (
153
- options?: UseMutationOptions<${responseType}, Error, ${inputType}>
154
- ) => {
155
- return useMutation<${responseType}, Error, ${inputType}>({
156
- mutationFn: async (${hasInput ? inputArg : ''}) => {
157
- const res = await fetch(\`\${baseUrl}${pathUrl}\`, {
158
- method: '${method.toUpperCase()}',
159
- headers: { 'Content-Type': 'application/json' },
160
- body: JSON.stringify(${hasInput ? inputArg : '{}'}),
161
- });
162
- if (!res.ok) throw new Error('API Error');
163
- return res.json();
164
- },
165
- ...options,
166
- });
108
+ const hooks = [];
109
+ const baseUrl = spec.servers?.[0]?.url || "";
110
+ for (const [pathUrl, pathItem] of Object.entries(spec.paths)) {
111
+ for (const [method, operation] of Object.entries(pathItem)) {
112
+ if (!["get", "post", "put", "patch", "delete"].includes(method))
113
+ continue;
114
+ const op = operation;
115
+ const opId = op.operationId || `${method}${pathUrl.replace(/[^a-zA-Z0-9]/g, "")}`;
116
+ const hasResponse = !!op.responses?.["200"]?.content?.["application/json"]?.schema;
117
+ const responseType = hasResponse ? `${capitalize(opId)}Response` : "any";
118
+ const params = op.parameters || [];
119
+ const hasParams = params.length > 0;
120
+ const paramsType = hasParams ? `${capitalize(opId)}Params` : "void";
121
+ const hasBody = !!op.requestBody?.content?.["application/json"]?.schema;
122
+ const bodyType = hasBody ? `${capitalize(opId)}Body` : "void";
123
+ if (method === "get") {
124
+ const queryParams = params.map((p) => p.name);
125
+ const queryString = queryParams.length > 0 ? `?${queryParams.map((p) => `\${params?.${p} !== undefined ? '${p}=' + params.${p} : ''}`).join("&")}` : "";
126
+ hooks.push(`
127
+ export const use${capitalize(opId)} = (
128
+ params${hasParams ? "" : "?"}: ${paramsType},
129
+ options?: Omit<UseQueryOptions<${responseType}>, 'queryKey' | 'queryFn'>
130
+ ) => {
131
+ return useQuery<${responseType}>({
132
+ queryKey: ['${opId}', params],
133
+ queryFn: async () => {
134
+ const res = await fetch(\`\${baseUrl}${pathUrl}${queryString}\`);
135
+ if (!res.ok) throw new Error('API Error');
136
+ return res.json();
137
+ },
138
+ ...options,
139
+ });
167
140
  };`);
168
- }
141
+ } else {
142
+ let inputType = "void";
143
+ let inputArg = "";
144
+ if (hasBody) {
145
+ inputType = bodyType;
146
+ inputArg = "body";
147
+ } else if (hasParams) {
148
+ inputType = paramsType;
149
+ inputArg = "params";
169
150
  }
151
+ const hasInput = inputType !== "void";
152
+ hooks.push(`
153
+ export const use${capitalize(opId)} = (
154
+ options?: UseMutationOptions<${responseType}, Error, ${inputType}>
155
+ ) => {
156
+ return useMutation<${responseType}, Error, ${inputType}>({
157
+ mutationFn: async (${hasInput ? inputArg : ""}) => {
158
+ const res = await fetch(\`\${baseUrl}${pathUrl}\`, {
159
+ method: '${method.toUpperCase()}',
160
+ headers: { 'Content-Type': 'application/json' },
161
+ body: JSON.stringify(${hasInput ? inputArg : "{}"}),
162
+ });
163
+ if (!res.ok) throw new Error('API Error');
164
+ return res.json();
165
+ },
166
+ ...options,
167
+ });
168
+ };`);
169
+ }
170
170
  }
171
- return hooks.join('\n');
171
+ }
172
+ return hooks.join(`
173
+ `);
172
174
  }
173
175
  function capitalize(str) {
174
- return str.charAt(0).toUpperCase() + str.slice(1);
176
+ return str.charAt(0).toUpperCase() + str.slice(1);
175
177
  }
176
178
  async function parseArgs() {
177
- const args = process.argv.slice(2);
178
- const config = {
179
- input: '',
180
- output: '',
181
- };
182
- for (let i = 0; i < args.length; i++) {
183
- const arg = args[i];
184
- if (!arg)
185
- continue;
186
- if (arg === '-i' || arg === '--input') {
187
- const value = args[++i];
188
- if (!value) {
189
- console.error(`Error: ${arg} flag requires a value`);
190
- process.exit(1);
191
- }
192
- config.input = value;
193
- }
194
- else if (arg === '-o' || arg === '--output') {
195
- const value = args[++i];
196
- if (!value) {
197
- console.error(`Error: ${arg} flag requires a value`);
198
- process.exit(1);
199
- }
200
- config.output = value;
201
- }
202
- else if (!arg.startsWith('-')) {
203
- if (!config.input)
204
- config.input = arg;
205
- else if (!config.output)
206
- config.output = arg;
207
- }
179
+ const args = process.argv.slice(2);
180
+ const config = {
181
+ input: "",
182
+ output: ""
183
+ };
184
+ for (let i = 0;i < args.length; i++) {
185
+ const arg = args[i];
186
+ if (!arg)
187
+ continue;
188
+ if (arg === "-i" || arg === "--input") {
189
+ const value = args[++i];
190
+ if (!value) {
191
+ console.error(`Error: ${arg} flag requires a value`);
192
+ process.exit(1);
193
+ }
194
+ config.input = value;
195
+ } else if (arg === "-o" || arg === "--output") {
196
+ const value = args[++i];
197
+ if (!value) {
198
+ console.error(`Error: ${arg} flag requires a value`);
199
+ process.exit(1);
200
+ }
201
+ config.output = value;
202
+ } else if (!arg.startsWith("-")) {
203
+ if (!config.input)
204
+ config.input = arg;
205
+ else if (!config.output)
206
+ config.output = arg;
208
207
  }
209
- return config;
208
+ }
209
+ return config;
210
210
  }
211
211
  function showHelp() {
212
- console.log(`
213
- Elysia OpenAPI Code Generator
214
- Generate React Query hooks and TypeScript types from OpenAPI specifications.
215
-
216
- Usage:
217
- elysia-codegen -i <source> -o <output>
218
- elysia-codegen --input <source> --output <output>
219
- elysia-codegen <source> <output>
220
-
221
- Arguments:
222
- -i, --input <source> OpenAPI spec source (URL or file path)
223
- -o, --output <output> Output directory for generated files
224
-
225
- Examples:
226
- # Using flags
227
- elysia-codegen -i https://api.example.com/openapi.json -o ./src/api
228
- elysia-codegen --input ./openapi.json --output ./generated
229
-
230
- # Using positional arguments
231
- elysia-codegen https://api.example.com/openapi.json ./src/api
232
- elysia-codegen ./openapi.json ./generated
212
+ console.log(`
213
+ Elysia OpenAPI Code Generator
214
+ Generate React Query hooks and TypeScript types from OpenAPI specifications.
215
+
216
+ Usage:
217
+ elysia-codegen -i <source> -o <output>
218
+ elysia-codegen --input <source> --output <output>
219
+ elysia-codegen <source> <output>
220
+
221
+ Arguments:
222
+ -i, --input <source> OpenAPI spec source (URL or file path)
223
+ -o, --output <output> Output directory for generated files
224
+
225
+ Examples:
226
+ # Using flags
227
+ elysia-codegen -i https://api.example.com/openapi.json -o ./src/api
228
+ elysia-codegen --input ./openapi.json --output ./generated
229
+
230
+ # Using positional arguments
231
+ elysia-codegen https://api.example.com/openapi.json ./src/api
232
+ elysia-codegen ./openapi.json ./generated
233
233
  `);
234
234
  }
235
235
  async function main() {
236
- const args = process.argv.slice(2);
237
- if (args.includes('-h') || args.includes('--help') || args.length === 0) {
238
- showHelp();
239
- process.exit(0);
240
- }
241
- const { input, output } = await parseArgs();
242
- if (!input || !output) {
243
- console.error('Error: Both input source and output directory are required.\n');
244
- showHelp();
245
- process.exit(1);
246
- }
247
- console.log('Fetching OpenAPI spec...');
248
- try {
249
- const spec = await fetchSpec(input);
250
- const types = generateTypes(spec);
251
- const hooks = generateHooks(spec);
252
- const baseUrl = spec.servers?.[0]?.url || '';
253
- const fileContent = `/* eslint-disable */
254
- /**
255
- * Auto-generated by Elysia OpenAPI Codegen
256
- */
257
-
258
- import { useQuery, useMutation, UseQueryOptions, UseMutationOptions } from '@tanstack/react-query';
259
-
260
- const baseUrl = '${baseUrl}';
261
-
262
- ${types}
263
-
264
- ${hooks}
236
+ const args = process.argv.slice(2);
237
+ if (args.includes("-h") || args.includes("--help") || args.length === 0) {
238
+ showHelp();
239
+ process.exit(0);
240
+ }
241
+ const { input, output } = await parseArgs();
242
+ if (!input || !output) {
243
+ console.error(`Error: Both input source and output directory are required.
244
+ `);
245
+ showHelp();
246
+ process.exit(1);
247
+ }
248
+ console.log("Fetching OpenAPI spec...");
249
+ try {
250
+ const spec = await fetchSpec(input);
251
+ const types = generateTypes(spec);
252
+ const hooks = generateHooks(spec);
253
+ const baseUrl = spec.servers?.[0]?.url || "";
254
+ const fileContent = `/* eslint-disable */
255
+ /**
256
+ * Auto-generated by Elysia OpenAPI Codegen
257
+ */
258
+
259
+ import { useQuery, useMutation, UseQueryOptions, UseMutationOptions } from '@tanstack/react-query';
260
+
261
+ const baseUrl = '${baseUrl}';
262
+
263
+ ${types}
264
+
265
+ ${hooks}
265
266
  `;
266
- if (!fs.existsSync(output)) {
267
- fs.mkdirSync(output, { recursive: true });
268
- }
269
- const outputPath = path.join(output, 'generated.ts');
270
- fs.writeFileSync(outputPath, fileContent);
271
- console.log(`Successfully generated hooks at ${outputPath}`);
272
- }
273
- catch (err) {
274
- console.error('Generation failed:', err instanceof Error ? err.message : String(err));
275
- process.exit(1);
267
+ if (!fs.existsSync(output)) {
268
+ fs.mkdirSync(output, { recursive: true });
276
269
  }
270
+ const outputPath = path.join(output, "generated.ts");
271
+ fs.writeFileSync(outputPath, fileContent);
272
+ console.log(`Successfully generated hooks at ${outputPath}`);
273
+ } catch (err) {
274
+ console.error("Generation failed:", err instanceof Error ? err.message : String(err));
275
+ process.exit(1);
276
+ }
277
277
  }
278
278
  main().catch(console.error);
279
- //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,10 +1,8 @@
1
1
  {
2
2
  "name": "elysia-openapi-codegen",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Generate React Query hooks and fully typed TypeScript interfaces from Elysia OpenAPI specs.",
5
- "main": "./dist/index.js",
6
- "module": "./dist/index.js",
7
- "types": "./dist/index.d.ts",
5
+ "module": "index.ts",
8
6
  "type": "module",
9
7
  "bin": {
10
8
  "elysia-codegen": "./dist/index.js"
@@ -13,10 +11,6 @@
13
11
  "dist",
14
12
  "README.md"
15
13
  ],
16
- "scripts": {
17
- "build": "tsc -p tsconfig.build.json",
18
- "prepublishOnly": "npm run build"
19
- },
20
14
  "author": "Khantamir mkhantamir77@gmail.com",
21
15
  "license": "MIT",
22
16
  "repository": {
@@ -36,10 +30,13 @@
36
30
  "tanstack-query"
37
31
  ],
38
32
  "devDependencies": {
39
- "@types/bun": "latest",
40
- "typescript": "^5"
33
+ "@types/bun": "latest"
41
34
  },
42
35
  "peerDependencies": {
43
- "typescript": "^5"
44
- }
45
- }
36
+ "typescript": "^6.0.2"
37
+ },
38
+ "scripts": {
39
+ "build": "bun build index.ts --outfile dist/index.js --target node"
40
+ },
41
+ "main": "dist/index.js"
42
+ }
package/dist/index.d.ts DELETED
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Elysia OpenAPI Code Generator
4
- * Generates typed React Query hooks from OpenAPI specifications.
5
- */
6
- export {};
7
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";AAEA;;;GAGG"}
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";AAEA;;;GAGG;AAEH,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM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