@znight/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 +2333 -2
- package/dist/adapter-CGSceVEN.d.mts +876 -0
- package/dist/compiler.d.mts +156 -0
- package/dist/compiler.mjs +2180 -0
- package/dist/compiler.mjs.map +1 -0
- package/dist/express.d.mts +39 -0
- package/dist/express.mjs +135 -0
- package/dist/express.mjs.map +1 -0
- package/dist/fastify.d.mts +33 -0
- package/dist/fastify.mjs +191 -0
- package/dist/fastify.mjs.map +1 -0
- package/dist/hono.d.mts +49 -0
- package/dist/hono.mjs +319 -0
- package/dist/hono.mjs.map +1 -0
- package/dist/index.d.mts +1254 -0
- package/dist/index.mjs +5618 -0
- package/dist/index.mjs.map +1 -0
- package/dist/node-BUnkdSsa.mjs +183 -0
- package/dist/node-BUnkdSsa.mjs.map +1 -0
- package/dist/node-io-BY1ZDLRQ.mjs +1566 -0
- package/dist/node-io-BY1ZDLRQ.mjs.map +1 -0
- package/dist/node.d.mts +30 -0
- package/dist/node.mjs +1 -0
- package/dist/path-JI87C4k8.d.mts +109 -0
- package/dist/path.d.mts +2 -0
- package/dist/path.mjs +245 -0
- package/dist/path.mjs.map +1 -0
- package/dist/size-D8rsQcV0.mjs +184 -0
- package/dist/size-D8rsQcV0.mjs.map +1 -0
- package/dist/utils-DCbu3a4w.mjs +27 -0
- package/dist/utils-DCbu3a4w.mjs.map +1 -0
- package/package.json +142 -4
- package/src/adapter.ts +240 -0
- package/src/adapters/express.ts +201 -0
- package/src/adapters/fastify.ts +280 -0
- package/src/adapters/hono.ts +488 -0
- package/src/adapters/node-io.ts +368 -0
- package/src/adapters/node.ts +135 -0
- package/src/adapters/shared.ts +508 -0
- package/src/body.ts +135 -0
- package/src/coerce.ts +195 -0
- package/src/compiler/analyze.ts +1513 -0
- package/src/compiler/ast.ts +90 -0
- package/src/compiler/coercion.ts +267 -0
- package/src/compiler/generate.ts +374 -0
- package/src/compiler/index.ts +76 -0
- package/src/compiler/model.ts +260 -0
- package/src/compiler/route-decorators.ts +405 -0
- package/src/compiler/validate.ts +288 -0
- package/src/context.ts +533 -0
- package/src/cookie-settings.ts +68 -0
- package/src/cookie-signer.ts +106 -0
- package/src/cookies.ts +726 -0
- package/src/cors.ts +349 -0
- package/src/decisions.ts +331 -0
- package/src/decorators.ts +486 -0
- package/src/event-channel.ts +197 -0
- package/src/exceptions.ts +257 -0
- package/src/files.ts +429 -0
- package/src/headers.ts +39 -0
- package/src/index.ts +185 -0
- package/src/inject-sse.ts +309 -0
- package/src/interfaces.ts +101 -0
- package/src/metadata.ts +162 -0
- package/src/mime.ts +157 -0
- package/src/multipart.ts +597 -0
- package/src/option-error.ts +31 -0
- package/src/path.ts +288 -0
- package/src/pipeline.ts +918 -0
- package/src/plugin-routes.ts +188 -0
- package/src/plugin.ts +1432 -0
- package/src/proxy.ts +236 -0
- package/src/query.ts +30 -0
- package/src/response.ts +240 -0
- package/src/router.ts +119 -0
- package/src/security-headers.ts +161 -0
- package/src/serialize.ts +264 -0
- package/src/size.ts +66 -0
- package/src/sse-parse.ts +194 -0
- package/src/sse.ts +650 -0
- package/src/standard-schema.ts +81 -0
- package/src/status.ts +78 -0
- package/src/stream.ts +200 -0
- package/src/tokens.ts +21 -0
- package/src/uploads.ts +176 -0
- package/src/utils.ts +31 -0
- package/src/validate.ts +65 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hono.mjs","names":[],"sources":["../src/adapters/hono.ts"],"sourcesContent":["/**\n * `@znight/http/hono`: serves Znight routes with [Hono](https://hono.dev) 4 (optional peer\n * dependency `hono`). On Bun the server is `Bun.serve()`; on Node.js it is `@hono/node-server`\n * (optional peer dependency, loaded on `listen()`). `inject()` uses `app.request()`.\n */\nimport type { Server, ServerResponse } from 'node:http'\nimport type {\n AdapterCloseOptions,\n AdapterHandler,\n AdapterReply,\n AdapterRequest,\n AdapterRoute,\n FallbackHandler,\n HttpAdapter,\n HttpServerAddress,\n InjectRequest,\n InjectResponse,\n InjectStreamRequest,\n InjectStreamResponse,\n} from '../adapter.ts'\n\nimport { type Context, Hono, type Next } from 'hono'\n\nimport { toHonoPath } from '../path.ts'\nimport { discardStream } from '../stream.ts'\nimport { isBun } from '../utils.ts'\nimport { ConnectionTracker, closeServer, onResponseAbort } from './node-io.ts'\nimport { bufferInjectStream, injectFetchStream, readWebStream, serverAddress, webBodyStream } from './shared.ts'\n\n/** Options of {@link honoAdapter}. */\nexport interface HonoAdapterOptions {\n /**\n * An existing application: its middleware (`app.use(...)`) runs before the Znight routes. Znight\n * sets its `notFound` and `onError` handlers.\n */\n readonly app?: Hono\n /**\n * Options of `Bun.serve()` on Bun (`tls`, `idleTimeout`, `development`, `error`...); Znight sets\n * `port`, `hostname` and `fetch`. Ignored on Node.js.\n */\n readonly serveOptions?: HonoServeOptions\n}\n\n/**\n * Options of `Bun.serve()` (see the Bun documentation; Bun types are not required). Defaults set by\n * the adapter: `maxRequestBodySize` unlimited (Znight enforces `bodyLimit` / `@BodyLimit` itself)\n * and Bun's `idleTimeout` (10 s), lifted while a streamed response is sent.\n */\nexport interface HonoServeOptions {\n /** Seconds a connection may stay idle (`0`: never closed). Default: 10. */\n readonly idleTimeout?: number\n /** Request bodies above this size are refused by Bun (413). Default: unlimited. */\n readonly maxRequestBodySize?: number\n /** TLS options (`{ key, cert }`). */\n readonly tls?: unknown\n /** Any other `Bun.serve()` option. */\n readonly [option: string]: unknown\n}\n\n/** The Hono adapter. */\nexport interface HonoAdapter extends HttpAdapter {\n readonly name: 'hono'\n /** The Hono application. */\n readonly app: Hono\n /** Fetch handler of the application (`export default { fetch: adapter.fetch }` on edge runtimes). */\n readonly fetch: (request: Request, env?: unknown) => Response | Promise<Response>\n}\n\n/**\n * Creates a Hono adapter.\n *\n * ```ts\n * import { honoAdapter } from '@znight/http/hono'\n *\n * HttpPlugin.configure({ adapter: honoAdapter() })\n * ```\n */\nexport function honoAdapter(options: HonoAdapterOptions = {}): HonoAdapter {\n return new HonoHttpAdapter(options)\n}\n\n/** The parts of a Bun server used here (Bun types are not available to the package sources). */\ninterface BunServer {\n readonly port: number\n readonly hostname: string\n stop(closeActiveConnections?: boolean): Promise<void> | void\n requestIP?(request: Request): { readonly address: string } | null\n /** Idle timeout of one request, in seconds (`0`: none). */\n timeout?(request: Request, seconds: number): void\n}\n\ninterface BunRuntime {\n serve(\n options: HonoServeOptions & {\n port: number\n hostname: string\n fetch: (request: Request, server: BunServer) => Response | Promise<Response>\n },\n ): BunServer\n}\n\n/** Default `idleTimeout` of `Bun.serve()`, in seconds. */\nconst BUN_IDLE_TIMEOUT = 10\n\n/** A response body built while serving with `Bun.serve()` (see `#bunFetch`). */\ninterface BunBody {\n /** The `Blob` (file) the body reads. */\n readonly blob: Blob | undefined\n /** Sets the function called when the body ends (read to its end, failed or cancelled). */\n onEnd(callback: () => void): void\n}\n\n/** Response bodies built while serving with `Bun.serve()`, by body (Hono may copy a `Response`, not its body). */\nconst BUN_BODIES = new WeakMap<ReadableStream<Uint8Array>, BunBody>()\n\n/** The Node.js request behind a request of `@hono/node-server`. */\ninterface NodeIncoming {\n readonly url?: string\n readonly socket?: { readonly encrypted?: unknown }\n readonly httpVersionMajor: number\n readonly stream?: { readonly endAfterHeaders?: boolean }\n}\n\n/** Bindings of injected requests (the remote address the other adapters report for `inject()`). */\nconst INJECT_ENV = Object.freeze({ incoming: Object.freeze({ socket: Object.freeze({ remoteAddress: '127.0.0.1' }) }) })\n\ntype HonoMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS'\n\nclass HonoHttpAdapter implements HonoAdapter {\n readonly name = 'hono' as const\n readonly app: Hono\n readonly #serveOptions: HonoServeOptions\n #fallback: FallbackHandler | undefined\n #prepared = false\n #bun: BunServer | undefined\n #node: Server | undefined\n #tracker: ConnectionTracker | undefined\n #closing: Promise<void> | undefined\n\n constructor(options: HonoAdapterOptions) {\n this.app = options.app ?? new Hono()\n this.#serveOptions = options.serveOptions ?? {}\n }\n\n readonly fetch = (request: Request, env?: unknown): Response | Promise<Response> => {\n this.#prepare()\n return this.app.fetch(request, env)\n }\n\n registerRoute(route: AdapterRoute): void {\n const handler = route.handler\n const path = toHonoPath(route.path)\n if (route.method === 'HEAD') {\n // Hono routes HEAD requests to GET handlers: serve them from a GET handler that only answers HEAD\n this.app.get(path, (c: Context, next: Next) =>\n c.req.raw.method === 'HEAD' ? this.#serve(c, handler) : next().then(() => c.res),\n )\n return\n }\n this.app.on(route.method as HonoMethod, path, (c: Context) => this.#serve(c, handler))\n }\n\n setFallbackHandler(handler: FallbackHandler): void {\n this.#fallback = handler\n }\n\n #prepare(): void {\n if (this.#prepared) return\n this.#prepared = true\n this.app.notFound(c => this.#serveFallback(c, undefined))\n this.app.onError((error, c) => this.#serveFallback(c, error))\n }\n\n async #serve(c: Context, handler: AdapterHandler): Promise<Response> {\n const request = adapterRequest(c)\n // Hono routes the WHATWG-normalised URL (`/a/../b` → `/b`, `%2e%2e` resolved): when the raw\n // target differs (Node.js), let the plugin route the raw path, like on the other adapters\n const reply =\n this.#fallback !== undefined && pathOf(request.url) !== pathOf(pathAndQuery(c.req.raw.url))\n ? await this.#fallback(request)\n : await handler(request)\n return this.#toResponse(c, reply)\n }\n\n async #serveFallback(c: Context, error: unknown): Promise<Response> {\n if (this.#fallback === undefined) throw error ?? new Error('No fallback handler')\n return this.#toResponse(c, await this.#fallback(adapterRequest(c), error))\n }\n\n #toResponse(c: Context, reply: AdapterReply): Response {\n const outgoing = nodeOutgoing(c)\n if (outgoing !== undefined) {\n const body = reply.body instanceof ReadableStream ? reply.body : null\n if (outgoing.destroyed) {\n // @hono/node-server: the client left before the reply was ready (an async pre-flight). The\n // server would neither read nor cancel the body: release it (event source, request scope)\n discardStream(body)\n return toResponse(c, { ...reply, body: null })\n }\n if (body !== null) {\n // the client may leave before @hono/node-server reads the body (its own listener then comes\n // too late): a body nobody locked is cancelled when the response closes unfinished\n outgoing.once('close', () => {\n if (!outgoing.writableFinished) discardStream(body)\n })\n }\n // a quiet event stream must outlive a socket timeout\n if (reply.eventStream === true && typeof outgoing.setTimeout === 'function') outgoing.setTimeout(0)\n }\n if (this.#bun === undefined || !(reply.body instanceof ReadableStream)) return toResponse(c, reply)\n // served by Bun.serve(): observe the end of the body (idle timeout, native blob: see #bunFetch)\n const reader = reply.body.getReader()\n let ended = false\n let onEnd = (): void => undefined\n const end = (): void => {\n if (ended) return\n ended = true\n onEnd()\n }\n const body = new ReadableStream<Uint8Array>(\n {\n async pull(controller) {\n let result: Awaited<ReturnType<typeof reader.read>>\n try {\n result = await reader.read()\n } catch (error) {\n end()\n throw error\n }\n if (result.done) {\n end() // before closing: Bun ignores timeout() once the response is complete\n controller.close()\n return\n }\n controller.enqueue(result.value)\n },\n cancel(reason) {\n end()\n return reader.cancel(reason)\n },\n },\n { highWaterMark: 0 },\n )\n BUN_BODIES.set(body, {\n blob: reply.blob,\n onEnd: callback => {\n onEnd = callback\n },\n })\n return toResponse(c, { ...reply, body })\n }\n\n /** The fetch handler given to `Bun.serve()`. */\n async #bunFetch(request: Request, server: BunServer, idleTimeout: number): Promise<Response> {\n const response = await this.app.fetch(request, server)\n const body = response.body\n const served = body === null ? undefined : BUN_BODIES.get(body)\n if (body === null || served === undefined) return response\n BUN_BODIES.delete(body)\n if (served.blob !== undefined && !body.locked) {\n // a Blob is sent by Bun itself (sendfile, exact Content-Length; a stream would be chunked). Bun\n // opens its file as soon as it takes the response: release the stream (and with it the request\n // scope, which may delete the file) right after\n const native = new Response(served.blob, {\n status: response.status,\n statusText: response.statusText,\n headers: response.headers,\n })\n setImmediate(() => discardStream(body))\n return native\n }\n if (idleTimeout > 0 && typeof server.timeout === 'function') {\n // the idle timeout of Bun.serve() also cuts a response whose stream pauses (SSE, slow producers):\n // lift it while the stream is sent, then restore it for the keep-alive connection\n server.timeout(request, 0)\n served.onEnd(() => {\n try {\n server.timeout?.(request, idleTimeout)\n } catch {\n // the connection is gone\n }\n })\n }\n return response\n }\n\n async listen(port: number, host: string): Promise<HttpServerAddress> {\n this.#prepare()\n this.#closing = undefined\n const bun = (globalThis as { Bun?: BunRuntime }).Bun\n if (isBun() && bun !== undefined) {\n const options = this.#serveOptions\n const idleTimeout = typeof options.idleTimeout === 'number' ? options.idleTimeout : BUN_IDLE_TIMEOUT\n const server = bun.serve({\n // Znight enforces the body limits (route @BodyLimit, plugin bodyLimit): not Bun's 128 MiB default\n maxRequestBodySize: Number.MAX_SAFE_INTEGER,\n ...options,\n port,\n hostname: host,\n fetch: (request, server) => this.#bunFetch(request, server, idleTimeout),\n })\n this.#bun = server\n return serverAddress(server.hostname, server.port)\n }\n let nodeServer: typeof import('@hono/node-server')\n try {\n nodeServer = await import('@hono/node-server')\n } catch (error) {\n throw new Error(\n 'honoAdapter on Node.js requires the optional peer dependency \"@hono/node-server\" (npm i @hono/node-server)',\n { cause: error },\n )\n }\n const server = nodeServer.createAdaptorServer({ fetch: this.app.fetch }) as Server\n this.#node = server\n this.#tracker = new ConnectionTracker(server)\n await new Promise<void>((resolve, reject) => {\n const onError = (error: Error): void => reject(error)\n server.once('error', onError)\n server.listen(port, host, () => {\n server.off('error', onError)\n resolve()\n })\n })\n const address = server.address()\n if (address === null || typeof address === 'string') return serverAddress(host, port)\n return serverAddress(address.address, address.port, address.family)\n }\n\n close(options: AdapterCloseOptions = {}): Promise<void> {\n const bun = this.#bun\n if (bun !== undefined) {\n if (options.force === true) {\n this.#closing = Promise.resolve(bun.stop(true))\n } else {\n this.#closing ??= Promise.resolve(bun.stop(false))\n }\n return this.#closing\n }\n const server = this.#node\n const tracker = this.#tracker\n if (server === undefined || tracker === undefined) return Promise.resolve()\n this.#closing = closeServer(server, tracker, this.#closing, options.force === true)\n return this.#closing\n }\n\n inject(request: InjectRequest): Promise<InjectResponse> {\n return bufferInjectStream(stream => this.injectStream(stream), request)\n }\n\n injectStream(request: InjectStreamRequest): Promise<InjectStreamResponse> {\n this.#prepare()\n return injectFetchStream(request => this.app.request(request, undefined, INJECT_ENV), request)\n }\n}\n\nfunction adapterRequest(c: Context): AdapterRequest {\n const request = c.req.raw\n const headers: Record<string, string> = {}\n for (const [name, value] of request.headers) headers[name] = value\n const incoming = nodeIncoming(c)\n const address = remoteAddress(c)\n let body: Promise<Uint8Array> | undefined\n return {\n method: request.method,\n // the raw target on Node.js; on Bun only the normalised URL is known\n url: pathAndQuery(typeof incoming?.url === 'string' && incoming.url !== '' ? incoming.url : request.url),\n headers,\n ip: address,\n remoteAddress: address,\n encrypted: incoming === undefined ? request.url.startsWith('https:') : incoming.socket?.encrypted === true,\n raw: request,\n rawResponse: c,\n readBody: (limit: number): Promise<Uint8Array> => {\n body ??= readWebStream(() => request.body, limit, headers['content-length'])\n return body\n },\n streamBody: (limit: number): ReadableStream<Uint8Array> =>\n webBodyStream(() => request.body, limit, headers['content-length']),\n // asked only without content-length / transfer-encoding: a request read from an HTTP/1.1\n // connection then has no body (`@hono/node-server` still gives every POST a body stream), an\n // HTTP/2 one unless its HEADERS frame ended the stream; a Web `Request` (Bun, inject) says it\n hasBody: (): boolean =>\n incoming === undefined\n ? request.body !== null\n : incoming.httpVersionMajor >= 2 && incoming.stream?.endAfterHeaders === false,\n onAbort: (listener: () => void): void => {\n const outgoing = nodeOutgoing(c)\n if (outgoing !== undefined) {\n onResponseAbort(outgoing as unknown as ServerResponse, listener)\n return\n }\n // Bun.serve() and inject(): the request signal aborts when the client leaves\n const signal = request.signal\n if (signal.aborted) queueMicrotask(listener)\n else signal.addEventListener('abort', listener, { once: true })\n },\n }\n}\n\n/** The part of a Node.js `ServerResponse` used here. */\ninterface NodeOutgoing {\n readonly writableFinished: boolean\n readonly destroyed: boolean\n once(event: 'close', listener: () => void): unknown\n setTimeout?(ms: number): unknown\n}\n\n/** The Node.js response of `@hono/node-server` (`c.env.outgoing`), absent on Bun and for `inject()`. */\nfunction nodeOutgoing(c: Context): NodeOutgoing | undefined {\n const outgoing = (c.env as { outgoing?: Partial<NodeOutgoing> } | undefined)?.outgoing\n return typeof outgoing?.once === 'function' ? (outgoing as NodeOutgoing) : undefined\n}\n\n/** The Node.js request of `@hono/node-server` (`c.env.incoming`), absent on Bun and for `inject()`. */\nfunction nodeIncoming(c: Context): NodeIncoming | undefined {\n const incoming = (c.env as { incoming?: Partial<NodeIncoming> } | undefined)?.incoming\n return typeof incoming?.httpVersionMajor === 'number' ? (incoming as NodeIncoming) : undefined\n}\n\nfunction pathAndQuery(url: string): string {\n if (url.startsWith('/')) return url\n const scheme = url.indexOf('://')\n const start = url.indexOf('/', scheme === -1 ? 0 : scheme + 3)\n return start === -1 ? '/' : url.slice(start)\n}\n\nfunction pathOf(url: string): string {\n const query = url.indexOf('?')\n return query === -1 ? url : url.slice(0, query)\n}\n\nfunction remoteAddress(c: Context): string | undefined {\n const env = c.env as\n | { incoming?: { socket?: { remoteAddress?: string } }; requestIP?: BunServer['requestIP'] }\n | undefined\n if (env === undefined || env === null) return undefined\n if (typeof env.requestIP === 'function') return env.requestIP(c.req.raw)?.address ?? undefined\n return env.incoming?.socket?.remoteAddress\n}\n\nfunction toResponse(c: Context, reply: AdapterReply): Response {\n if (reply.raw === true) {\n discardStream(reply.body instanceof ReadableStream ? reply.body : null)\n return c.res\n }\n const headers = new Headers()\n try {\n for (const name of Object.keys(reply.headers)) {\n const value = reply.headers[name]\n if (typeof value === 'string') headers.set(name, value)\n else if (value !== undefined) for (const item of value) headers.append(name, item)\n }\n } catch {\n // a header Headers refuses (the plugin validates them): never rethrow into Hono's onError, which\n // would run the pipeline again; release the body and answer a plain 500, like writeNodeReply\n discardStream(reply.body instanceof ReadableStream ? reply.body : null)\n return new Response('{\"statusCode\":500,\"error\":\"Internal Server Error\"}', {\n status: 500,\n headers: { 'content-type': 'application/json; charset=utf-8' },\n })\n }\n keepContextCookies(c, headers)\n return new Response(reply.body, { status: reply.status, headers })\n}\n\n/**\n * Keeps the cookies Hono middleware set before the Znight route (`setCookie(c, ...)`,\n * `c.header('set-cookie', ..., { append: true })`) before the reply's own, like the other adapters.\n * Hono drops the headers of the context when a handler returns its own `Response` (or, when a\n * middleware read `c.res`, replaces the response's cookies with the context's): the reply's cookies\n * are added to the context too, so that both ways end with every cookie, in order.\n */\nfunction keepContextCookies(c: Context, headers: Headers): void {\n let context: string[]\n try {\n // the headers of the context without changing it (`c.res` would create the context response)\n context = c.newResponse(null).headers.getSetCookie()\n } catch {\n return // a status a bodyless Response refuses (`c.status(101)`): nothing to keep\n }\n if (context.length === 0) return\n const own = headers.getSetCookie()\n for (const line of own) c.header('set-cookie', line, { append: true })\n headers.delete('set-cookie')\n for (const line of context) headers.append('set-cookie', line)\n for (const line of own) headers.append('set-cookie', line)\n}\n"],"mappings":";;;;;;;;;;;;;;AA6EA,SAAgB,YAAY,UAA8B,CAAC,GAAgB;CACzE,OAAO,IAAI,gBAAgB,OAAO;AACpC;;AAuBA,MAAM,mBAAmB;;AAWzB,MAAM,6BAAa,IAAI,QAA6C;;AAWpE,MAAM,aAAa,OAAO,OAAO,EAAE,UAAU,OAAO,OAAO,EAAE,QAAQ,OAAO,OAAO,EAAE,eAAe,YAAY,CAAC,EAAE,CAAC,EAAE,CAAC;AAIvH,IAAM,kBAAN,MAA6C;CAC3C,OAAgB;CAChB;CACA;CACA;CACA,YAAY;CACZ;CACA;CACA;CACA;CAEA,YAAY,SAA6B;EACvC,KAAK,MAAM,QAAQ,OAAO,IAAI,KAAK;EACnC,KAAK,gBAAgB,QAAQ,gBAAgB,CAAC;CAChD;CAEA,SAAkB,SAAkB,QAAgD;EAClF,KAAK,SAAS;EACd,OAAO,KAAK,IAAI,MAAM,SAAS,GAAG;CACpC;CAEA,cAAc,OAA2B;EACvC,MAAM,UAAU,MAAM;EACtB,MAAM,OAAO,WAAW,MAAM,IAAI;EAClC,IAAI,MAAM,WAAW,QAAQ;GAE3B,KAAK,IAAI,IAAI,OAAO,GAAY,SAC9B,EAAE,IAAI,IAAI,WAAW,SAAS,KAAK,OAAO,GAA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