@dooboostore/simple-boot-http-server 1.0.29 → 1.0.31
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 +58 -1
- package/dist/cjs/SimpleBootHttpServer.js +9 -4
- package/dist/cjs/SimpleBootHttpServer.js.map +2 -2
- package/dist/cjs/codes/Mimes.js +2 -0
- package/dist/cjs/codes/Mimes.js.map +2 -2
- package/dist/cjs/generators/ContentTypeGenerator.js +320 -0
- package/dist/cjs/generators/ContentTypeGenerator.js.map +7 -0
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/models/RequestResponse.js +3 -2
- package/dist/cjs/models/RequestResponse.js.map +2 -2
- package/dist/esm/SimpleBootHttpServer.js +9 -4
- package/dist/esm/SimpleBootHttpServer.js.map +2 -2
- package/dist/esm/codes/Mimes.js +2 -0
- package/dist/esm/codes/Mimes.js.map +2 -2
- package/dist/esm/generators/ContentTypeGenerator.js +287 -0
- package/dist/esm/generators/ContentTypeGenerator.js.map +7 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/models/RequestResponse.js +3 -2
- package/dist/esm/models/RequestResponse.js.map +2 -2
- package/dist/esm-bundle/dooboostore-simple-boot-http-server.esm.js +628 -5219
- package/dist/esm-bundle/dooboostore-simple-boot-http-server.esm.js.map +4 -4
- package/dist/types/SimpleBootHttpServer.d.ts.map +1 -1
- package/dist/types/codes/Mimes.d.ts +2 -0
- package/dist/types/codes/Mimes.d.ts.map +1 -1
- package/dist/types/generators/ContentTypeGenerator.d.ts +172 -0
- package/dist/types/generators/ContentTypeGenerator.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/models/RequestResponse.d.ts +4 -1
- package/dist/types/models/RequestResponse.d.ts.map +1 -1
- package/dist/umd-bundle/dooboostore-simple-boot-http-server.umd.js +628 -5219
- package/dist/umd-bundle/dooboostore-simple-boot-http-server.umd.js.map +4 -4
- package/package.json +4 -4
- package/src/SimpleBootHttpServer.ts +12 -4
- package/src/codes/Mimes.ts +2 -0
- package/src/generators/ContentTypeGenerator.ts +431 -0
- package/src/index.ts +1 -0
- package/src/models/RequestResponse.ts +3 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/models/RequestResponse.ts"],
|
|
4
|
-
"sourcesContent": ["import { IncomingMessage, OutgoingHttpHeader, OutgoingHttpHeaders, ServerResponse } from 'http';\nimport { HttpHeaders, HttpHeadersType } from '../codes/HttpHeaders';\nimport { Mimes } from '../codes/Mimes';\nimport { Intent } from '@dooboostore/simple-boot';\nimport { URL, URLSearchParams } from 'url';\nimport { Buffer } from 'buffer';\nimport { MultipartData } from './datas/MultipartData';\nimport { ReqFormUrlBody } from './datas/body/ReqFormUrlBody';\nimport { ReqJsonBody } from './datas/body/ReqJsonBody';\nimport { ReqHeader } from './datas/ReqHeader';\nimport { ReqMultipartFormBody } from './datas/body/ReqMultipartFormBody';\nimport { HttpStatus } from '../codes/HttpStatus';\nimport { gzip } from 'node-gzip';\nimport { createGzip, constants as zlibConstants } from 'zlib';\nimport { SessionManager } from '../session/SessionManager';\nimport { HttpServerOption } from '../option/HttpServerOption';\nimport { Blob } from 'node:buffer';\nimport * as fs from 'fs';\nimport * as os from 'os';\nimport { RandomUtils } from '@dooboostore/core';\nimport { FileUtils } from '@dooboostore/core-node';\nimport { ConvertUtils as CoreConvertUtils } from '@dooboostore/core';\nimport { ConvertUtils } from '@dooboostore/core-node';\nimport {HttpMethod} from \"../codes\";\n\ntype Config = { sessionManager?: SessionManager; option: HttpServerOption };\n\nexport class RequestResponse {\n protected resWriteChunk: string | Buffer | undefined;\n protected reqBodyChunk?: Buffer;\n protected req: IncomingMessage;\n protected res: ServerResponse;\n protected config: Config;\n\n // [\uC544\uD0A4\uD14D\uD2B8\uB2D8\uC758 \uC815\uC11D] RequestResponse \uAC1D\uCCB4 \uACE0\uC720\uC758 \uC18D\uC131 \uC800\uC7A5\uC18C (\uD2B8\uB79C\uC7AD\uC158 \uC0DD\uBA85\uC8FC\uAE30)\n protected attributes = new Map<string, any>();\n\n constructor(req: IncomingMessage | RequestResponse, res: ServerResponse, config: Config) {\n if (req instanceof RequestResponse) {\n this.req = req.req;\n this.res = req.res;\n this.config = config;\n this.attributes = req.attributes;\n } else {\n this.req = req;\n this.res = res!;\n this.config = config;\n }\n }\n\n // --- RequestResponse Attributes (Transaction Life-cycle) ---\n\n setAttribute(key: string, value: any): void {\n this.attributes.set(key, value);\n }\n\n getAttribute<T = any>(key: string): T | undefined {\n return this.attributes.get(key) as T;\n }\n\n get reqSocket() {\n return this.req.socket;\n }\n\n get reqCookieMap() {\n let cookies = this.reqHeader(HttpHeaders.Cookie) ?? '';\n if (Array.isArray(cookies)) {\n cookies = cookies.join(';');\n }\n\n const map = new Map<string, string>();\n cookies\n .split(';')\n .map(it => it.trim().split('='))\n .forEach(it => {\n if (it[0]) map.set(it[0], it[1]);\n });\n return map;\n }\n\n reqCookieGet(key: string) {\n return this.reqCookieMap.get(key);\n }\n\n get reqRemoteAddress(): string | undefined {\n const ipHeader = this.req.headers['x-forwarded-for'];\n let ip = this.req.socket.remoteAddress;\n if (Array.isArray(ipHeader)) {\n ip = ipHeader.join(',').split(',').shift();\n } else if (typeof ipHeader === 'string') {\n ip = ipHeader.split(',').shift();\n }\n return ip;\n }\n\n get reqUrlObject(): URL {\n return new URL(this.reqUrl, `${this.reqSocket ? 'https://' : 'http://'}${this.reqHost ?? 'localhost'}`);\n }\n\n get reqUrlPathName(): string {\n return this.reqUrlObj().pathname ?? '';\n }\n\n get reqUrl(): string {\n return this.req.url ?? '';\n }\n\n reqUrlObj(config?: { scheme?: string; host?: string }): URL {\n return new URL(`${config?.scheme ?? 'http'}://${config?.host ? config?.host : (this.reqHeaderFirst(HttpHeaders.Host) ?? 'localhost')}${this.req.url ?? ''}`);\n }\n\n get reqUrlSearchParamTuples(): [string, string][] {\n return Array.from(this.reqUrlObj().searchParams as any);\n }\n\n get reqUrlSearchParams(): URLSearchParams {\n return this.reqUrlObj().searchParams;\n }\n\n get reqUrlSearchParamsObj(): { [p: string]: string | string[] } {\n const entries = this.reqUrlObj().searchParams;\n return CoreConvertUtils.toObject(entries);\n }\n\n get reqPathSearchParamUrl(): string {\n const reqUrlObj = this.reqUrlObj();\n return reqUrlObj.pathname + (reqUrlObj.searchParams.toString() ? '?' + reqUrlObj.searchParams.toString() : '');\n }\n\n get reqReadable() {\n return this.req.readable;\n }\n\n get reqIntent() {\n return new Intent(this.reqPathSearchParamUrl);\n }\n\n reqHasContentTypeHeader(mime: Mimes | string): boolean {\n const contentType = this.reqHeader(HttpHeaders.ContentType);\n if (!contentType) return false;\n \n const targetMime = mime.toString().toLowerCase();\n const contentTypes = Array.isArray(contentType) ? contentType : [contentType];\n \n // \uBAA8\uB4E0 Content-Type \uD5E4\uB354\uB97C \uD655\uC778\n return contentTypes.some(ct => {\n // Content-Type\uC740 \uBCF4\uD1B5 \uB2E8\uC77C \uAC12\uC774\uC9C0\uB9CC, \uD30C\uB77C\uBBF8\uD130\uAC00 \uBD99\uC744 \uC218 \uC788\uC74C (charset=utf-8 \uB4F1)\n // \uC138\uBBF8\uCF5C\uB860\uC73C\uB85C split\uD574\uC11C \uC55E \uBD80\uBD84(MIME \uD0C0\uC785)\uB9CC \uBE44\uAD50\n const [mimeType] = ct.split(';').map(m => m.trim());\n return mimeType.toLowerCase() === targetMime || mimeType.toLowerCase().includes(targetMime);\n });\n }\n\n reqHasAcceptHeader(mime: Mimes | string): boolean {\n const accept = this.reqHeader(HttpHeaders.Accept);\n if (!accept) return false;\n\n const targetMime = mime.toString().toLowerCase();\n const acceptHeaders = Array.isArray(accept) ? accept : [accept];\n\n return acceptHeaders.some(acceptHeader => {\n const acceptMimes = acceptHeader.split(',').map(m => m.split(';')[0].trim().toLowerCase());\n return acceptMimes.some(acceptMime => acceptMime.includes(targetMime));\n });\n }\n\n reqBodyData(): Promise<Buffer> {\n return new Promise<Buffer>((resolve, reject) => {\n if (this.reqReadable) {\n const data: Uint8Array[] = [];\n this.req.on('data', chunk => data.push(chunk));\n this.req.on('error', err => reject(err));\n this.req.on('end', () => {\n this.reqBodyChunk = Buffer.concat(data);\n resolve(this.reqBodyChunk);\n });\n } else {\n resolve(this.reqBodyChunk ?? Buffer.alloc(0));\n }\n });\n }\n\n resBodyData(): string | Buffer | undefined {\n return this.resWriteChunk;\n }\n\n async reqBodyMultipartFormDataObject<T>(): Promise<T> {\n const m = await this.reqBodyMultipartFormData();\n const formData = {} as any;\n\n for (const it of m) {\n if (it.isFile) {\n formData[it.name] = await FileUtils.writeFile(it.value, { originalName: it.filename, etcData: it });\n } else {\n const target = formData[it.name];\n if (Array.isArray(target)) {\n target.push(it.value);\n } else if (typeof target === 'string') {\n formData[it.name] = [target, it.value];\n } else {\n formData[it.name] = it.value;\n }\n }\n }\n return formData;\n }\n\n reqBodyMultipartFormData(): Promise<MultipartData[]> {\n return new Promise((resolve, reject) => {\n const contentTypeHeader = this.req.headers['content-type'];\n if (!contentTypeHeader || !contentTypeHeader.startsWith('multipart/form-data')) {\n return reject(new Error('Invalid Content-Type. Expected multipart/form-data.'));\n }\n\n const boundaryMatch = contentTypeHeader.match(/boundary=(?:\"([^\"]+)\"|([^;]+))/i);\n if (!boundaryMatch) {\n return reject(new Error('Boundary not found in Content-Type header.'));\n }\n const boundary = boundaryMatch[1] || boundaryMatch[2];\n if (!boundary) {\n return reject(new Error('Failed to extract boundary.'));\n }\n\n const boundaryBuffer = Buffer.from(`--${boundary}`);\n const crlfBuffer = Buffer.from('\\r\\n');\n const doubleCrlfBuffer = Buffer.from('\\r\\n\\r\\n');\n\n const chunks: Buffer[] = [];\n let totalLength = 0;\n\n this.req.on('data', (chunk: Buffer) => {\n chunks.push(chunk);\n totalLength += chunk.length;\n });\n\n this.req.on('error', err => {\n reject(err);\n });\n\n this.req.on('end', () => {\n if (totalLength === 0) {\n return resolve([]);\n }\n\n const fullBuffer = Buffer.concat(chunks, totalLength);\n const parsedParts: MultipartData[] = [];\n let currentPosition = 0;\n\n let boundaryStartIndex = fullBuffer.indexOf(boundaryBuffer, currentPosition);\n if (boundaryStartIndex === -1) {\n return reject(new Error('Initial boundary not found.'));\n }\n currentPosition = boundaryStartIndex + boundaryBuffer.length;\n if (fullBuffer.slice(currentPosition, currentPosition + crlfBuffer.length).equals(crlfBuffer)) {\n currentPosition += crlfBuffer.length;\n }\n\n while (currentPosition < fullBuffer.length) {\n const nextBoundaryIndex = fullBuffer.indexOf(boundaryBuffer, currentPosition);\n if (nextBoundaryIndex === -1) {\n break;\n }\n\n let partEndIndex = nextBoundaryIndex;\n if (partEndIndex > crlfBuffer.length && fullBuffer.slice(partEndIndex - crlfBuffer.length, partEndIndex).equals(crlfBuffer)) {\n partEndIndex -= crlfBuffer.length;\n }\n const partBuffer = fullBuffer.slice(currentPosition, partEndIndex);\n\n const headerBodySeparatorIndex = partBuffer.indexOf(doubleCrlfBuffer);\n if (headerBodySeparatorIndex === -1) {\n currentPosition = nextBoundaryIndex + boundaryBuffer.length;\n if (fullBuffer.slice(currentPosition, currentPosition + crlfBuffer.length).equals(crlfBuffer)) {\n currentPosition += crlfBuffer.length;\n }\n if (fullBuffer.slice(currentPosition, currentPosition + 2).toString() === '--') break;\n continue;\n }\n\n const headerBuffer = partBuffer.slice(0, headerBodySeparatorIndex);\n const bodyBuffer = partBuffer.slice(headerBodySeparatorIndex + doubleCrlfBuffer.length);\n const headersStr = headerBuffer.toString('utf-8');\n\n const headers: { [key: string]: string } = {};\n headersStr.split('\\r\\n').forEach(line => {\n const colonIndex = line.indexOf(':');\n if (colonIndex > 0) {\n const key = line.substring(0, colonIndex).trim().toLowerCase();\n const value = line.substring(colonIndex + 1).trim();\n headers[key] = value;\n }\n });\n\n const contentDisposition = headers['content-disposition'];\n if (!contentDisposition) {\n currentPosition = nextBoundaryIndex + boundaryBuffer.length;\n if (fullBuffer.slice(currentPosition, currentPosition + crlfBuffer.length).equals(crlfBuffer)) {\n currentPosition += crlfBuffer.length;\n }\n if (fullBuffer.slice(currentPosition, currentPosition + 2).toString() === '--') break;\n continue;\n }\n\n const nameMatch = contentDisposition.match(/name=\"([^\"]+)\"/i);\n const filenameMatch = contentDisposition.match(/filename=\"([^\"]+)\"/i);\n\n const name = nameMatch ? nameMatch[1] : null;\n const filename = filenameMatch ? filenameMatch[1] : null;\n const contentType = headers['content-type'] || null;\n\n if (name) {\n if (filename) {\n parsedParts.push({\n isFile: true,\n name: name,\n filename: filename,\n contentType: contentType ?? 'application/octet-stream',\n value: bodyBuffer\n });\n } else {\n parsedParts.push({\n isFile: false,\n name: name,\n value: bodyBuffer.toString('utf-8')\n });\n }\n }\n\n currentPosition = nextBoundaryIndex + boundaryBuffer.length;\n if (fullBuffer.slice(currentPosition, currentPosition + crlfBuffer.length).equals(crlfBuffer)) {\n currentPosition += crlfBuffer.length;\n }\n\n if (fullBuffer.slice(currentPosition, currentPosition + 2).toString() === '--') {\n break;\n }\n }\n resolve(parsedParts);\n });\n });\n }\n\n async reqBodyStringData(): Promise<string> {\n const data = (await this.reqBodyData()).toString();\n return data;\n }\n\n async reqBodyJsonData<T>(): Promise<T> {\n return JSON.parse(await this.reqBodyStringData());\n }\n\n async reqBodyFormUrlData<T>(): Promise<T> {\n const data = await this.reqBodyStringData();\n const formData = {} as any;\n Array.from(new URLSearchParams(data).entries()).forEach(([k, v]) => {\n const target = formData[k];\n if (Array.isArray(target)) {\n target.push(v);\n } else if (typeof target === 'string') {\n formData[k] = [target, v];\n } else {\n formData[k] = v;\n }\n });\n return formData;\n }\n\n async reqBodyReqFormUrlBody() {\n const data = await this.reqBodyFormUrlData();\n return Object.assign(new ReqFormUrlBody(), data);\n }\n\n async reqBodyReqJsonBody(): Promise<ReqJsonBody> {\n const data = await this.reqBodyStringData();\n return Object.assign(new ReqJsonBody(), data ? JSON.parse(data) : {});\n }\n\n resBodyJsonData<T>(): T | null {\n const data = ConvertUtils.toString(this.resBodyData());\n return data ? JSON.parse(data) : null;\n }\n\n resBodyStringData() {\n return ConvertUtils.toString(this.resBodyData());\n }\n\n reqMethod() {\n return this.req.method?.toUpperCase();\n }\n\n reqIsMethod(method: HttpMethod | string) {\n return this.reqMethod().toUpperCase() === (method as string).toUpperCase();\n }\n\n reqHeader(key: keyof typeof HttpHeaders | string) {\n return this.req.headers[(key as string).toLowerCase()];\n }\n\n get reqHost() {\n return this.reqHeaderFirst(HttpHeaders.Host);\n }\n\n get reqHeaderObj(): ReqHeader {\n const h = new ReqHeader();\n Object.entries(this.req.headers).forEach(([k, v]) => {\n h[k] = v;\n });\n return h;\n }\n\n reqHeaderFirst(key: HttpHeadersType | string, defaultValue?: string) {\n const header = this.req.headers[(key as string).toLowerCase()];\n if (header && Array.isArray(header)) {\n return header[0] ?? defaultValue;\n } else {\n return (header as string) ?? defaultValue;\n }\n }\n\n public reqAuthorizationHeader() {\n return this.reqHeaderFirst(HttpHeaders.Authorization);\n }\n\n reqRefreshTokenHeader() {\n return this.reqHeaderFirst(HttpHeaders.Authorization);\n }\n\n resStatusCode(code?: undefined): number;\n resStatusCode(code: number | HttpStatus): RequestResponseChain<number>;\n resStatusCode(code: number | undefined | HttpStatus): number | RequestResponseChain<number> {\n if (code) {\n this.res.statusCode = code;\n return new RequestResponseChain<number>(this.req, this.res, this.config, this.res.statusCode);\n } else {\n return this.res.statusCode;\n }\n }\n\n resHeader(key: HttpHeadersType | string) {\n return this.res.getHeader((key as string).toLowerCase());\n }\n\n resHeaderFirst(key: HttpHeadersType | string, defaultValue?: string) {\n const header = this.res.getHeader((key as string).toLowerCase());\n if (header && Array.isArray(header)) {\n return header[0] ?? defaultValue;\n } else {\n return (header as string) ?? defaultValue;\n }\n }\n\n async reqSession(): Promise<{ [key: string]: any }> {\n if (this.config.sessionManager) {\n const session = await this.config.sessionManager.session(this);\n session.dataSet.data ??= {};\n return session.dataSet.data;\n } else {\n return Promise.reject(new Error('Not SessionManager'));\n }\n }\n\n async reqSessionSet(key: string, value: any): Promise<void> {\n const sessionData = await this.reqSession();\n sessionData[key] = value;\n }\n\n async reqSessionGet<T = any>(key: string): Promise<T | undefined> {\n const sessionData = await this.reqSession();\n return sessionData[key] as T;\n }\n\n resSetStatusCode(statusCode: number) {\n this.res.statusCode = statusCode;\n return this.createRequestResponseChain(this.res.statusCode);\n }\n\n resWrite(chunk: string | Buffer | any, encoding: BufferEncoding = 'utf8') {\n this.resWriteChunk = chunk;\n return this.createRequestResponseChain(this.resWriteChunk);\n }\n\n resWriteJson(chunk: any, encoding: BufferEncoding = 'utf8') {\n return this.resWrite(JSON.stringify(chunk), encoding);\n }\n\n resSetHeader(key: HttpHeadersType | string, value: string | string[]) {\n this.res.setHeader((key as string).toLowerCase(), value);\n return this.createRequestResponseChain();\n }\n\n resAddHeader(key: HttpHeadersType | string, value: string | string[]) {\n const existingValue = this.res.getHeader((key as string).toLowerCase());\n const newValue = Array.isArray(existingValue) ? existingValue.concat(value) : existingValue ? [existingValue.toString(), ...[].concat(value as any)] : value;\n this.res.setHeader((key as string).toLowerCase(), newValue as any);\n return this.createRequestResponseChain();\n }\n\n resSetHeaders(headers: { [key: string]: string | string[] }) {\n Object.entries(headers).forEach(([key, value]) => this.resSetHeader(key, value));\n return this.createRequestResponseChain();\n }\n\n resAddHeaders(headers: { [key: string]: string | string[] }) {\n Object.entries(headers).forEach(([key, value]) => this.resAddHeader(key, value));\n return this.createRequestResponseChain();\n }\n\n private async resEndChunk() {\n const encoding = this.reqHeaderFirst(HttpHeaders.AcceptEncoding);\n let data = this.resWriteChunk;\n if (encoding?.includes('gzip') && data) {\n data = await gzip(data);\n this.resSetHeader(HttpHeaders.ContentEncoding, 'gzip');\n }\n this.res.end(data);\n }\n\n async resEnd(chunk?: string | Buffer | Blob | ArrayBuffer | Response) {\n if (chunk instanceof Response) {\n chunk.headers.forEach((value, key) => {\n this.res.setHeader(`ORIGIN-${key}`, value);\n });\n if (!this.resHeader(HttpHeaders.ContentType)) {\n const contentType = chunk.headers.get(HttpHeaders.ContentType);\n if (contentType) this.res.setHeader(HttpHeaders.ContentType, contentType);\n }\n this.res.statusCode = chunk.status;\n this.resWriteChunk = Buffer.from(await chunk.arrayBuffer());\n } else if (chunk instanceof Blob) {\n this.resWriteChunk = Buffer.from(await chunk.arrayBuffer());\n if (!this.resHeader(HttpHeaders.ContentType)) {\n this.res.setHeader(HttpHeaders.ContentType, chunk.type);\n }\n } else if (chunk instanceof ArrayBuffer) {\n this.resWriteChunk = Buffer.from(chunk);\n } else {\n this.resWriteChunk = chunk ?? this.resWriteChunk;\n }\n\n if (this.req.readable) {\n await this.reqBodyData();\n await this.resEndChunk();\n } else {\n await this.resEndChunk();\n }\n }\n\n resRedirect(statusCode: number, location: string) {\n this.res.statusCode = statusCode;\n this.res.setHeader(HttpHeaders.Location, location);\n this.res.end();\n }\n resWriteHead(statusCode: number, headers?: OutgoingHttpHeaders | OutgoingHttpHeader[] | { [key: string]: string | string[] }) {\n return this.createRequestResponseChain(this.res.writeHead(statusCode, headers as any));\n }\n resWriteHeadEnd(statusCode: number, headers?: OutgoingHttpHeaders | OutgoingHttpHeader[] | { [key: string]: string | string[] }) {\n this.createRequestResponseChain(this.res.writeHead(statusCode, headers as any));\n this.res.end();\n }\n\n /**\n * \uD5E4\uB354\uB97C \uC989\uC2DC \uBCF4\uB0B4\uACE0, source \uAC00 \uB0B4\uB193\uB294 \uAC12\uC744 \uD558\uB098\uC529 \uBC14\uB85C body \uC5D0 \uC4F4 \uB4A4 end.\n * (SSE / \uC2A4\uD2B8\uB9AC\uBC0D \uC751\uB2F5\uC6A9. resWrite \uB294 \uBC84\uD37C\uB9C1 \uD6C4 resEnd \uC5D0\uC11C \uD55C \uBC88\uC5D0 \uBCF4\uB0B4\uBBC0\uB85C \uC2A4\uD2B8\uB9AC\uBC0D \uBD88\uAC00)\n * - \uBB38\uC790\uC5F4/Buffer \uB294 \uADF8\uB300\uB85C, \uADF8 \uC678\uB294 JSON.stringify\n * - Accept-Encoding \uC5D0 gzip \uC774 \uC788\uC73C\uBA74 gzip \uC2A4\uD2B8\uB9BC\uC73C\uB85C \uC555\uCD95\uD558\uACE0, \uCCAD\uD06C\uB9C8\uB2E4 Z_SYNC_FLUSH \uB85C \uBC14\uB85C \uB0B4\uBCF4\uB0B8\uB2E4\n * (flush \uC5C6\uC774 \uC4F0\uBA74 zlib \uB0B4\uBD80 \uBC84\uD37C\uC5D0 \uBAA8\uC600\uB2E4\uAC00 \uB2A6\uAC8C \uB098\uAC00\uC11C SSE \uC2E4\uC2DC\uAC04\uC131\uC774 \uAE68\uC9D0)\n * - \uD074\uB77C\uC774\uC5B8\uD2B8\uAC00 \uB04A\uC73C\uBA74 source.return() \uC73C\uB85C \uC81C\uB108\uB808\uC774\uD130\uB97C \uC885\uB8CC\uC2DC\uCF1C finally \uAC00 \uB3CC\uAC8C \uD55C\uB2E4\n */\n async resStream(source: Iterable<any> | AsyncIterable<any>) {\n const res = this.res;\n const gz = this.reqHeaderFirst(HttpHeaders.AcceptEncoding)?.includes('gzip') ? createGzip() : undefined;\n if (gz) {\n res.setHeader(HttpHeaders.ContentEncoding, 'gzip');\n res.removeHeader(HttpHeaders.ContentLength);\n gz.pipe(res);\n }\n const out = gz ?? res;\n res.flushHeaders();\n let closed = false;\n const onClose = () => {\n closed = true;\n (source as any).return?.();\n };\n res.once('close', onClose);\n try {\n for await (const chunk of source) {\n if (closed) break;\n const data = typeof chunk === 'string' || Buffer.isBuffer(chunk) ? chunk : JSON.stringify(chunk);\n const ok = out.write(data);\n gz?.flush(zlibConstants.Z_SYNC_FLUSH);\n // backpressure: \uBC84\uD37C\uAC00 \uCC28\uBA74 drain(\uB610\uB294 \uC5F0\uACB0 \uC885\uB8CC)\uAE4C\uC9C0 \uB300\uAE30\n if (!ok) await new Promise(resolve => { out.once('drain', resolve); res.once('close', resolve); });\n }\n } catch (e) {\n // \uD074\uB77C\uC774\uC5B8\uD2B8\uAC00 \uB04A\uAE34 \uB4A4\uC758 \uC5D0\uB7EC(AbortSignal \uB85C \uB300\uAE30\uB97C \uD47C AbortError \uB4F1)\uB294 \uBC1B\uC744 \uC0C1\uB300\uAC00 \uC5C6\uC73C\uB2C8 \uC0BC\uD0A8\uB2E4\n if (!closed) throw e;\n } finally {\n res.off('close', onClose);\n if (closed) {\n gz?.destroy();\n } else if (!res.writableEnded) {\n // gzip \uC774\uBA74 gz.end() \u2192 pipe \uAC00 res.end() \uAE4C\uC9C0 \uD574\uC900\uB2E4. \uB05D\uAE4C\uC9C0 \uD758\uB824\uBCF4\uB0B8 \uB4A4 \uB9AC\uD134\n const finished = new Promise(resolve => { res.once('finish', resolve); res.once('close', resolve); });\n out.end();\n await finished;\n }\n }\n }\n\n resIsDone() {\n return this.res.finished || this.res.writableEnded || this.res.headersSent;\n }\n\n createRequestResponseChain<T = any>(data?: T) {\n const requestResponseChain = new RequestResponseChain(this.req, this.res, this.config, data);\n requestResponseChain.resWriteChunk = this.resWriteChunk;\n requestResponseChain.reqBodyChunk = this.reqBodyChunk;\n return requestResponseChain;\n }\n}\n\nexport class RequestResponseChain<T> extends RequestResponse {\n constructor(\n req: IncomingMessage,\n res: ServerResponse,\n config: Config,\n public result?: T\n ) {\n super(req, res, config);\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,yBAA6C;AAE7C,yBAAuB;AACvB,iBAAqC;AACrC,oBAAuB;AAEvB,4BAA+B;AAC/B,yBAA4B;AAC5B,uBAA0B;AAG1B,uBAAqB;AACrB,kBAAuD;AAGvD,yBAAqB;AAIrB,uBAA0B;AAC1B,IAAAA,eAAiD;AACjD,IAAAC,oBAA6B;AAKtB,MAAM,gBAAgB;AAAA,EAU3B,YAAY,KAAwC,KAAqB,QAAgB;AAFzF;AAAA,SAAU,aAAa,oBAAI,IAAiB;AAG1C,QAAI,eAAe,iBAAiB;AAClC,WAA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AEO,MAAM,6BAAgC,gBAAgB;AAAA,EAC3D,YACE,KACA,KACA,QACO,QACP;AACA,UAAM,KAAK,KAAK,MAAM;AAFf;AAAA,EAGT;AACF;",
|
|
4
|
+
"sourcesContent": ["import { IncomingMessage, OutgoingHttpHeader, OutgoingHttpHeaders, ServerResponse } from 'http';\nimport { HttpHeaders, HttpHeadersType } from '../codes/HttpHeaders';\nimport { Mimes } from '../codes/Mimes';\nimport { Intent } from '@dooboostore/simple-boot';\nimport { URL, URLSearchParams } from 'url';\nimport { Buffer } from 'buffer';\nimport { MultipartData } from './datas/MultipartData';\nimport { ReqFormUrlBody } from './datas/body/ReqFormUrlBody';\nimport { ReqJsonBody } from './datas/body/ReqJsonBody';\nimport { ReqHeader } from './datas/ReqHeader';\nimport { ReqMultipartFormBody } from './datas/body/ReqMultipartFormBody';\nimport { HttpStatus } from '../codes/HttpStatus';\nimport { gzip } from 'node-gzip';\nimport { createGzip, constants as zlibConstants } from 'zlib';\nimport { SessionManager } from '../session/SessionManager';\nimport { HttpServerOption } from '../option/HttpServerOption';\nimport { Blob } from 'node:buffer';\nimport * as fs from 'fs';\nimport * as os from 'os';\nimport { RandomUtils } from '@dooboostore/core';\nimport { FileUtils } from '@dooboostore/core-node';\nimport { ConvertUtils as CoreConvertUtils } from '@dooboostore/core';\nimport { ConvertUtils } from '@dooboostore/core-node';\nimport {HttpMethod} from \"../codes\";\n\ntype Config = { sessionManager?: SessionManager; option: HttpServerOption };\n\nexport class RequestResponse {\n protected resWriteChunk: string | Buffer | undefined;\n protected reqBodyChunk?: Buffer;\n protected req: IncomingMessage;\n protected res: ServerResponse;\n protected config: Config;\n\n // [\uC544\uD0A4\uD14D\uD2B8\uB2D8\uC758 \uC815\uC11D] RequestResponse \uAC1D\uCCB4 \uACE0\uC720\uC758 \uC18D\uC131 \uC800\uC7A5\uC18C (\uD2B8\uB79C\uC7AD\uC158 \uC0DD\uBA85\uC8FC\uAE30)\n protected attributes = new Map<string, any>();\n\n constructor(req: IncomingMessage | RequestResponse, res: ServerResponse, config: Config) {\n if (req instanceof RequestResponse) {\n this.req = req.req;\n this.res = req.res;\n this.config = config;\n this.attributes = req.attributes;\n } else {\n this.req = req;\n this.res = res!;\n this.config = config;\n }\n }\n\n // --- RequestResponse Attributes (Transaction Life-cycle) ---\n\n setAttribute(key: string, value: any): void {\n this.attributes.set(key, value);\n }\n\n getAttribute<T = any>(key: string): T | undefined {\n return this.attributes.get(key) as T;\n }\n\n get reqSocket() {\n return this.req.socket;\n }\n\n get reqCookieMap() {\n let cookies = this.reqHeader(HttpHeaders.Cookie) ?? '';\n if (Array.isArray(cookies)) {\n cookies = cookies.join(';');\n }\n\n const map = new Map<string, string>();\n cookies\n .split(';')\n .map(it => it.trim().split('='))\n .forEach(it => {\n if (it[0]) map.set(it[0], it[1]);\n });\n return map;\n }\n\n reqCookieGet(key: string) {\n return this.reqCookieMap.get(key);\n }\n\n get reqRemoteAddress(): string | undefined {\n const ipHeader = this.req.headers['x-forwarded-for'];\n let ip = this.req.socket.remoteAddress;\n if (Array.isArray(ipHeader)) {\n ip = ipHeader.join(',').split(',').shift();\n } else if (typeof ipHeader === 'string') {\n ip = ipHeader.split(',').shift();\n }\n return ip;\n }\n\n get reqUrlObject(): URL {\n return new URL(this.reqUrl, `${this.reqSocket ? 'https://' : 'http://'}${this.reqHost ?? 'localhost'}`);\n }\n\n get reqUrlPathName(): string {\n return this.reqUrlObj().pathname ?? '';\n }\n\n get reqUrl(): string {\n return this.req.url ?? '';\n }\n\n reqUrlObj(config?: { scheme?: string; host?: string }): URL {\n return new URL(`${config?.scheme ?? 'http'}://${config?.host ? config?.host : (this.reqHeaderFirst(HttpHeaders.Host) ?? 'localhost')}${this.req.url ?? ''}`);\n }\n\n get reqUrlSearchParamTuples(): [string, string][] {\n return Array.from(this.reqUrlObj().searchParams as any);\n }\n\n get reqUrlSearchParams(): URLSearchParams {\n return this.reqUrlObj().searchParams;\n }\n\n get reqUrlSearchParamsObj(): { [p: string]: string | string[] } {\n const entries = this.reqUrlObj().searchParams;\n return CoreConvertUtils.toObject(entries);\n }\n\n get reqPathSearchParamUrl(): string {\n const reqUrlObj = this.reqUrlObj();\n return reqUrlObj.pathname + (reqUrlObj.searchParams.toString() ? '?' + reqUrlObj.searchParams.toString() : '');\n }\n\n get reqReadable() {\n return this.req.readable;\n }\n\n get reqIntent() {\n return new Intent(this.reqPathSearchParamUrl);\n }\n\n reqHasContentTypeHeader(mime: Mimes | string): boolean {\n const contentType = this.reqHeader(HttpHeaders.ContentType);\n if (!contentType) return false;\n \n const targetMime = mime.toString().toLowerCase();\n const contentTypes = Array.isArray(contentType) ? contentType : [contentType];\n \n // \uBAA8\uB4E0 Content-Type \uD5E4\uB354\uB97C \uD655\uC778\n return contentTypes.some(ct => {\n // Content-Type\uC740 \uBCF4\uD1B5 \uB2E8\uC77C \uAC12\uC774\uC9C0\uB9CC, \uD30C\uB77C\uBBF8\uD130\uAC00 \uBD99\uC744 \uC218 \uC788\uC74C (charset=utf-8 \uB4F1)\n // \uC138\uBBF8\uCF5C\uB860\uC73C\uB85C split\uD574\uC11C \uC55E \uBD80\uBD84(MIME \uD0C0\uC785)\uB9CC \uBE44\uAD50\n const [mimeType] = ct.split(';').map(m => m.trim());\n return mimeType.toLowerCase() === targetMime || mimeType.toLowerCase().includes(targetMime);\n });\n }\n\n reqHasAcceptHeader(mime: Mimes | string): boolean {\n const accept = this.reqHeader(HttpHeaders.Accept);\n if (!accept) return false;\n\n const targetMime = mime.toString().toLowerCase();\n const acceptHeaders = Array.isArray(accept) ? accept : [accept];\n\n return acceptHeaders.some(acceptHeader => {\n const acceptMimes = acceptHeader.split(',').map(m => m.split(';')[0].trim().toLowerCase());\n return acceptMimes.some(acceptMime => acceptMime.includes(targetMime));\n });\n }\n\n reqBodyData(): Promise<Buffer> {\n return new Promise<Buffer>((resolve, reject) => {\n if (this.reqReadable) {\n const data: Uint8Array[] = [];\n this.req.on('data', chunk => data.push(chunk));\n this.req.on('error', err => reject(err));\n this.req.on('end', () => {\n this.reqBodyChunk = Buffer.concat(data);\n resolve(this.reqBodyChunk);\n });\n } else {\n resolve(this.reqBodyChunk ?? Buffer.alloc(0));\n }\n });\n }\n\n resBodyData(): string | Buffer | undefined {\n return this.resWriteChunk;\n }\n\n async reqBodyMultipartFormDataObject<T>(): Promise<T> {\n const m = await this.reqBodyMultipartFormData();\n const formData = {} as any;\n\n for (const it of m) {\n if (it.isFile) {\n formData[it.name] = await FileUtils.writeFile(it.value, { originalName: it.filename, etcData: it });\n } else {\n const target = formData[it.name];\n if (Array.isArray(target)) {\n target.push(it.value);\n } else if (typeof target === 'string') {\n formData[it.name] = [target, it.value];\n } else {\n formData[it.name] = it.value;\n }\n }\n }\n return formData;\n }\n\n reqBodyMultipartFormData(): Promise<MultipartData[]> {\n return new Promise((resolve, reject) => {\n const contentTypeHeader = this.req.headers['content-type'];\n if (!contentTypeHeader || !contentTypeHeader.startsWith('multipart/form-data')) {\n return reject(new Error('Invalid Content-Type. Expected multipart/form-data.'));\n }\n\n const boundaryMatch = contentTypeHeader.match(/boundary=(?:\"([^\"]+)\"|([^;]+))/i);\n if (!boundaryMatch) {\n return reject(new Error('Boundary not found in Content-Type header.'));\n }\n const boundary = boundaryMatch[1] || boundaryMatch[2];\n if (!boundary) {\n return reject(new Error('Failed to extract boundary.'));\n }\n\n const boundaryBuffer = Buffer.from(`--${boundary}`);\n const crlfBuffer = Buffer.from('\\r\\n');\n const doubleCrlfBuffer = Buffer.from('\\r\\n\\r\\n');\n\n const chunks: Buffer[] = [];\n let totalLength = 0;\n\n this.req.on('data', (chunk: Buffer) => {\n chunks.push(chunk);\n totalLength += chunk.length;\n });\n\n this.req.on('error', err => {\n reject(err);\n });\n\n this.req.on('end', () => {\n if (totalLength === 0) {\n return resolve([]);\n }\n\n const fullBuffer = Buffer.concat(chunks, totalLength);\n const parsedParts: MultipartData[] = [];\n let currentPosition = 0;\n\n let boundaryStartIndex = fullBuffer.indexOf(boundaryBuffer, currentPosition);\n if (boundaryStartIndex === -1) {\n return reject(new Error('Initial boundary not found.'));\n }\n currentPosition = boundaryStartIndex + boundaryBuffer.length;\n if (fullBuffer.slice(currentPosition, currentPosition + crlfBuffer.length).equals(crlfBuffer)) {\n currentPosition += crlfBuffer.length;\n }\n\n while (currentPosition < fullBuffer.length) {\n const nextBoundaryIndex = fullBuffer.indexOf(boundaryBuffer, currentPosition);\n if (nextBoundaryIndex === -1) {\n break;\n }\n\n let partEndIndex = nextBoundaryIndex;\n if (partEndIndex > crlfBuffer.length && fullBuffer.slice(partEndIndex - crlfBuffer.length, partEndIndex).equals(crlfBuffer)) {\n partEndIndex -= crlfBuffer.length;\n }\n const partBuffer = fullBuffer.slice(currentPosition, partEndIndex);\n\n const headerBodySeparatorIndex = partBuffer.indexOf(doubleCrlfBuffer);\n if (headerBodySeparatorIndex === -1) {\n currentPosition = nextBoundaryIndex + boundaryBuffer.length;\n if (fullBuffer.slice(currentPosition, currentPosition + crlfBuffer.length).equals(crlfBuffer)) {\n currentPosition += crlfBuffer.length;\n }\n if (fullBuffer.slice(currentPosition, currentPosition + 2).toString() === '--') break;\n continue;\n }\n\n const headerBuffer = partBuffer.slice(0, headerBodySeparatorIndex);\n const bodyBuffer = partBuffer.slice(headerBodySeparatorIndex + doubleCrlfBuffer.length);\n const headersStr = headerBuffer.toString('utf-8');\n\n const headers: { [key: string]: string } = {};\n headersStr.split('\\r\\n').forEach(line => {\n const colonIndex = line.indexOf(':');\n if (colonIndex > 0) {\n const key = line.substring(0, colonIndex).trim().toLowerCase();\n const value = line.substring(colonIndex + 1).trim();\n headers[key] = value;\n }\n });\n\n const contentDisposition = headers['content-disposition'];\n if (!contentDisposition) {\n currentPosition = nextBoundaryIndex + boundaryBuffer.length;\n if (fullBuffer.slice(currentPosition, currentPosition + crlfBuffer.length).equals(crlfBuffer)) {\n currentPosition += crlfBuffer.length;\n }\n if (fullBuffer.slice(currentPosition, currentPosition + 2).toString() === '--') break;\n continue;\n }\n\n const nameMatch = contentDisposition.match(/name=\"([^\"]+)\"/i);\n const filenameMatch = contentDisposition.match(/filename=\"([^\"]+)\"/i);\n\n const name = nameMatch ? nameMatch[1] : null;\n const filename = filenameMatch ? filenameMatch[1] : null;\n const contentType = headers['content-type'] || null;\n\n if (name) {\n if (filename) {\n parsedParts.push({\n isFile: true,\n name: name,\n filename: filename,\n contentType: contentType ?? 'application/octet-stream',\n value: bodyBuffer\n });\n } else {\n parsedParts.push({\n isFile: false,\n name: name,\n value: bodyBuffer.toString('utf-8')\n });\n }\n }\n\n currentPosition = nextBoundaryIndex + boundaryBuffer.length;\n if (fullBuffer.slice(currentPosition, currentPosition + crlfBuffer.length).equals(crlfBuffer)) {\n currentPosition += crlfBuffer.length;\n }\n\n if (fullBuffer.slice(currentPosition, currentPosition + 2).toString() === '--') {\n break;\n }\n }\n resolve(parsedParts);\n });\n });\n }\n\n async reqBodyStringData(): Promise<string> {\n const data = (await this.reqBodyData()).toString();\n return data;\n }\n\n async reqBodyJsonData<T>(): Promise<T> {\n return JSON.parse(await this.reqBodyStringData());\n }\n\n async reqBodyFormUrlData<T>(): Promise<T> {\n const data = await this.reqBodyStringData();\n const formData = {} as any;\n Array.from(new URLSearchParams(data).entries()).forEach(([k, v]) => {\n const target = formData[k];\n if (Array.isArray(target)) {\n target.push(v);\n } else if (typeof target === 'string') {\n formData[k] = [target, v];\n } else {\n formData[k] = v;\n }\n });\n return formData;\n }\n\n async reqBodyReqFormUrlBody() {\n const data = await this.reqBodyFormUrlData();\n return Object.assign(new ReqFormUrlBody(), data);\n }\n\n async reqBodyReqJsonBody(): Promise<ReqJsonBody> {\n const data = await this.reqBodyStringData();\n return Object.assign(new ReqJsonBody(), data ? JSON.parse(data) : {});\n }\n\n resBodyJsonData<T>(): T | null {\n const data = ConvertUtils.toString(this.resBodyData());\n return data ? JSON.parse(data) : null;\n }\n\n resBodyStringData() {\n return ConvertUtils.toString(this.resBodyData());\n }\n\n reqMethod() {\n return this.req.method?.toUpperCase();\n }\n\n reqIsMethod(method: HttpMethod | string) {\n return this.reqMethod().toUpperCase() === (method as string).toUpperCase();\n }\n\n reqHeader(key: keyof typeof HttpHeaders | string) {\n return this.req.headers[(key as string).toLowerCase()];\n }\n\n get reqHost() {\n return this.reqHeaderFirst(HttpHeaders.Host);\n }\n\n get reqHeaderObj(): ReqHeader {\n const h = new ReqHeader();\n Object.entries(this.req.headers).forEach(([k, v]) => {\n h[k] = v;\n });\n return h;\n }\n\n reqHeaderFirst(key: HttpHeadersType | string, defaultValue?: string) {\n const header = this.req.headers[(key as string).toLowerCase()];\n if (header && Array.isArray(header)) {\n return header[0] ?? defaultValue;\n } else {\n return (header as string) ?? defaultValue;\n }\n }\n\n public reqAuthorizationHeader() {\n return this.reqHeaderFirst(HttpHeaders.Authorization);\n }\n\n reqRefreshTokenHeader() {\n return this.reqHeaderFirst(HttpHeaders.Authorization);\n }\n\n resStatusCode(code?: undefined): number;\n resStatusCode(code: number | HttpStatus): RequestResponseChain<number>;\n resStatusCode(code: number | undefined | HttpStatus): number | RequestResponseChain<number> {\n if (code) {\n this.res.statusCode = code;\n return new RequestResponseChain<number>(this.req, this.res, this.config, this.res.statusCode);\n } else {\n return this.res.statusCode;\n }\n }\n\n resHeader(key: HttpHeadersType | string) {\n return this.res.getHeader((key as string).toLowerCase());\n }\n\n resHeaderFirst(key: HttpHeadersType | string, defaultValue?: string) {\n const header = this.res.getHeader((key as string).toLowerCase());\n if (header && Array.isArray(header)) {\n return header[0] ?? defaultValue;\n } else {\n return (header as string) ?? defaultValue;\n }\n }\n\n async reqSession(): Promise<{ [key: string]: any }> {\n if (this.config.sessionManager) {\n const session = await this.config.sessionManager.session(this);\n session.dataSet.data ??= {};\n return session.dataSet.data;\n } else {\n return Promise.reject(new Error('Not SessionManager'));\n }\n }\n\n async reqSessionSet(key: string, value: any): Promise<void> {\n const sessionData = await this.reqSession();\n sessionData[key] = value;\n }\n\n async reqSessionGet<T = any>(key: string): Promise<T | undefined> {\n const sessionData = await this.reqSession();\n return sessionData[key] as T;\n }\n\n resSetStatusCode(statusCode: number) {\n this.res.statusCode = statusCode;\n return this.createRequestResponseChain(this.res.statusCode);\n }\n\n resWrite(chunk: string | Buffer | any, encoding: BufferEncoding = 'utf8') {\n this.resWriteChunk = chunk;\n return this.createRequestResponseChain(this.resWriteChunk);\n }\n\n resWriteJson(chunk: any, encoding: BufferEncoding = 'utf8') {\n return this.resWrite(JSON.stringify(chunk), encoding);\n }\n\n resSetHeader(key: HttpHeadersType | string, value: string | string[]) {\n this.res.setHeader((key as string).toLowerCase(), value);\n return this.createRequestResponseChain();\n }\n\n resAddHeader(key: HttpHeadersType | string, value: string | string[]) {\n const existingValue = this.res.getHeader((key as string).toLowerCase());\n const newValue = Array.isArray(existingValue) ? existingValue.concat(value) : existingValue ? [existingValue.toString(), ...[].concat(value as any)] : value;\n this.res.setHeader((key as string).toLowerCase(), newValue as any);\n return this.createRequestResponseChain();\n }\n\n resSetHeaders(headers: { [key: string]: string | string[] }) {\n Object.entries(headers).forEach(([key, value]) => this.resSetHeader(key, value));\n return this.createRequestResponseChain();\n }\n\n resAddHeaders(headers: { [key: string]: string | string[] }) {\n Object.entries(headers).forEach(([key, value]) => this.resAddHeader(key, value));\n return this.createRequestResponseChain();\n }\n\n private async resEndChunk() {\n const encoding = this.reqHeaderFirst(HttpHeaders.AcceptEncoding);\n let data = this.resWriteChunk;\n if (encoding?.includes('gzip') && data) {\n data = await gzip(data);\n this.resSetHeader(HttpHeaders.ContentEncoding, 'gzip');\n }\n this.res.end(data);\n }\n\n async resEnd(chunk?: string | Buffer | Blob | ArrayBuffer | Response) {\n if (chunk instanceof Response) {\n chunk.headers.forEach((value, key) => {\n this.res.setHeader(`ORIGIN-${key}`, value);\n });\n if (!this.resHeader(HttpHeaders.ContentType)) {\n const contentType = chunk.headers.get(HttpHeaders.ContentType);\n if (contentType) this.res.setHeader(HttpHeaders.ContentType, contentType);\n }\n this.res.statusCode = chunk.status;\n this.resWriteChunk = Buffer.from(await chunk.arrayBuffer());\n } else if (chunk instanceof Blob) {\n this.resWriteChunk = Buffer.from(await chunk.arrayBuffer());\n if (!this.resHeader(HttpHeaders.ContentType)) {\n this.res.setHeader(HttpHeaders.ContentType, chunk.type);\n }\n } else if (chunk instanceof ArrayBuffer) {\n this.resWriteChunk = Buffer.from(chunk);\n } else {\n this.resWriteChunk = chunk ?? this.resWriteChunk;\n }\n\n if (this.req.readable) {\n await this.reqBodyData();\n await this.resEndChunk();\n } else {\n await this.resEndChunk();\n }\n }\n\n resRedirect(statusCode: number, location: string) {\n this.res.statusCode = statusCode;\n this.res.setHeader(HttpHeaders.Location, location);\n this.res.end();\n }\n resWriteHead(statusCode: number, headers?: OutgoingHttpHeaders | OutgoingHttpHeader[] | { [key: string]: string | string[] }) {\n return this.createRequestResponseChain(this.res.writeHead(statusCode, headers as any));\n }\n resWriteHeadEnd(statusCode: number, headers?: OutgoingHttpHeaders | OutgoingHttpHeader[] | { [key: string]: string | string[] }) {\n this.createRequestResponseChain(this.res.writeHead(statusCode, headers as any));\n this.res.end();\n }\n\n /**\n * \uD5E4\uB354\uB97C \uC989\uC2DC \uBCF4\uB0B4\uACE0, source \uAC00 \uB0B4\uB193\uB294 \uAC12\uC744 \uD558\uB098\uC529 \uBC14\uB85C body \uC5D0 \uC4F4 \uB4A4 end.\n * (SSE / \uC2A4\uD2B8\uB9AC\uBC0D \uC751\uB2F5\uC6A9. resWrite \uB294 \uBC84\uD37C\uB9C1 \uD6C4 resEnd \uC5D0\uC11C \uD55C \uBC88\uC5D0 \uBCF4\uB0B4\uBBC0\uB85C \uC2A4\uD2B8\uB9AC\uBC0D \uBD88\uAC00)\n * - \uBB38\uC790\uC5F4/Buffer \uB294 \uADF8\uB300\uB85C, \uADF8 \uC678\uB294 JSON.stringify\n * - Accept-Encoding \uC5D0 gzip \uC774 \uC788\uC73C\uBA74 gzip \uC2A4\uD2B8\uB9BC\uC73C\uB85C \uC555\uCD95\uD558\uACE0, \uCCAD\uD06C\uB9C8\uB2E4 Z_SYNC_FLUSH \uB85C \uBC14\uB85C \uB0B4\uBCF4\uB0B8\uB2E4\n * (flush \uC5C6\uC774 \uC4F0\uBA74 zlib \uB0B4\uBD80 \uBC84\uD37C\uC5D0 \uBAA8\uC600\uB2E4\uAC00 \uB2A6\uAC8C \uB098\uAC00\uC11C SSE \uC2E4\uC2DC\uAC04\uC131\uC774 \uAE68\uC9D0)\n * option.compress === false \uBA74 \uC555\uCD95 \uC548 \uD568 (MJPEG \uCC98\uB7FC \uC774\uBBF8 \uC555\uCD95\uB41C \uB0B4\uC6A9 \u2014 CPU\uB9CC \uC4F0\uACE0, gzip \uBABB \uD478\uB294 \uD074\uB77C\uC774\uC5B8\uD2B8\uB3C4 \uC788\uC74C)\n * - \uD074\uB77C\uC774\uC5B8\uD2B8\uAC00 \uB04A\uC73C\uBA74 source.return() \uC73C\uB85C \uC81C\uB108\uB808\uC774\uD130\uB97C \uC885\uB8CC\uC2DC\uCF1C finally \uAC00 \uB3CC\uAC8C \uD55C\uB2E4\n */\n async resStream(source: Iterable<any> | AsyncIterable<any>, option: { compress?: boolean } = {}) {\n const res = this.res;\n const gz = option.compress !== false && this.reqHeaderFirst(HttpHeaders.AcceptEncoding)?.includes('gzip') ? createGzip() : undefined;\n if (gz) {\n res.setHeader(HttpHeaders.ContentEncoding, 'gzip');\n res.removeHeader(HttpHeaders.ContentLength);\n gz.pipe(res);\n }\n const out = gz ?? res;\n res.flushHeaders();\n let closed = false;\n const onClose = () => {\n closed = true;\n (source as any).return?.();\n };\n res.once('close', onClose);\n try {\n for await (const chunk of source) {\n if (closed) break;\n const data = typeof chunk === 'string' || Buffer.isBuffer(chunk) ? chunk : JSON.stringify(chunk);\n const ok = out.write(data);\n gz?.flush(zlibConstants.Z_SYNC_FLUSH);\n // backpressure: \uBC84\uD37C\uAC00 \uCC28\uBA74 drain(\uB610\uB294 \uC5F0\uACB0 \uC885\uB8CC)\uAE4C\uC9C0 \uB300\uAE30\n if (!ok) await new Promise(resolve => { out.once('drain', resolve); res.once('close', resolve); });\n }\n } catch (e) {\n // \uD074\uB77C\uC774\uC5B8\uD2B8\uAC00 \uB04A\uAE34 \uB4A4\uC758 \uC5D0\uB7EC(AbortSignal \uB85C \uB300\uAE30\uB97C \uD47C AbortError \uB4F1)\uB294 \uBC1B\uC744 \uC0C1\uB300\uAC00 \uC5C6\uC73C\uB2C8 \uC0BC\uD0A8\uB2E4\n if (!closed) throw e;\n } finally {\n res.off('close', onClose);\n if (closed) {\n gz?.destroy();\n } else if (!res.writableEnded) {\n // gzip \uC774\uBA74 gz.end() \u2192 pipe \uAC00 res.end() \uAE4C\uC9C0 \uD574\uC900\uB2E4. \uB05D\uAE4C\uC9C0 \uD758\uB824\uBCF4\uB0B8 \uB4A4 \uB9AC\uD134\n const finished = new Promise(resolve => { res.once('finish', resolve); res.once('close', resolve); });\n out.end();\n await finished;\n }\n }\n }\n\n resIsDone() {\n return this.res.finished || this.res.writableEnded || this.res.headersSent;\n }\n\n createRequestResponseChain<T = any>(data?: T) {\n const requestResponseChain = new RequestResponseChain(this.req, this.res, this.config, data);\n requestResponseChain.resWriteChunk = this.resWriteChunk;\n requestResponseChain.reqBodyChunk = this.reqBodyChunk;\n return requestResponseChain;\n }\n}\n\nexport class RequestResponseChain<T> extends RequestResponse {\n constructor(\n req: IncomingMessage,\n res: ServerResponse,\n config: Config,\n public result?: T\n ) {\n super(req, res, config);\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,yBAA6C;AAE7C,yBAAuB;AACvB,iBAAqC;AACrC,oBAAuB;AAEvB,4BAA+B;AAC/B,yBAA4B;AAC5B,uBAA0B;AAG1B,uBAAqB;AACrB,kBAAuD;AAGvD,yBAAqB;AAIrB,uBAA0B;AAC1B,IAAAA,eAAiD;AACjD,IAAAC,oBAA6B;AAKtB,MAAM,gBAAgB;AAAA,EAU3B,YAAY,KAAwC,KAAqB,QAAgB;AAF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AAK,KAAK,KAAK,QAAQ,IAAI;AAC3F,yBAAqB,gBAAgB,KAAK;AAC1C,yBAAqB,eAAe,KAAK;AACzC,WAAO;AAAA,EACT;AACF;AAEO,MAAM,6BAAgC,gBAAgB;AAAA,EAC3D,YACE,KACA,KACA,QACO,QACP;AACA,UAAM,KAAK,KAAK,MAAM;AAFf;AAAA,EAGT;AACF;",
|
|
6
6
|
"names": ["import_core", "import_core_node", "CoreConvertUtils", "zlibConstants"]
|
|
7
7
|
}
|
|
@@ -23,6 +23,7 @@ import { getRoute } from "@dooboostore/simple-boot";
|
|
|
23
23
|
import { URLSearchParams } from "url";
|
|
24
24
|
import { HttpMethod } from "./codes/HttpMethod.js";
|
|
25
25
|
import { SessionManager } from "./session/SessionManager.js";
|
|
26
|
+
import { ContentTypeGenerator } from "./generators/ContentTypeGenerator.js";
|
|
26
27
|
import { ReqSearchParamsObj } from "./models/datas/path/ReqSearchParamsObj.js";
|
|
27
28
|
import { ReqPathData } from "./models/datas/path/ReqPathData.js";
|
|
28
29
|
class SimpleBootHttpServer extends SimpleApplication {
|
|
@@ -157,7 +158,9 @@ class SimpleBootHttpServer extends SimpleApplication {
|
|
|
157
158
|
break;
|
|
158
159
|
}
|
|
159
160
|
}
|
|
160
|
-
if (!rr.resIsDone()) {
|
|
161
|
+
if (!rr.resIsDone() && !this.option.rootRouter) {
|
|
162
|
+
rr.resStatusCode(HttpStatus.NotFound);
|
|
163
|
+
} else if (!rr.resIsDone()) {
|
|
161
164
|
const routerModule = await super.routing(rr.reqIntent);
|
|
162
165
|
otherStorage.set(RouterModule, routerModule);
|
|
163
166
|
const moduleInstance = routerModule?.getModuleInstance?.();
|
|
@@ -277,13 +280,15 @@ class SimpleBootHttpServer extends SimpleApplication {
|
|
|
277
280
|
const resConfig = it.config?.res;
|
|
278
281
|
if (resConfig === "manual") {
|
|
279
282
|
} else if (ValidUtils.isGenerator(data) || ValidUtils.isAsyncGenerator(data)) {
|
|
283
|
+
const stream = ContentTypeGenerator.isStream(data) ? data : void 0;
|
|
280
284
|
const headers = resConfig?.header ?? {};
|
|
281
|
-
|
|
282
|
-
|
|
285
|
+
const contentType = stream?.contentType ?? resConfig?.contentType;
|
|
286
|
+
if (contentType) {
|
|
287
|
+
headers[HttpHeaders.ContentType] = contentType;
|
|
283
288
|
}
|
|
284
289
|
rr.resSetHeaders(headers);
|
|
285
290
|
rr.resSetStatusCode(resConfig?.status ?? HttpStatus.Ok);
|
|
286
|
-
await rr.resStream(data);
|
|
291
|
+
await rr.resStream(data, { compress: stream?.compress });
|
|
287
292
|
} else {
|
|
288
293
|
if (it.config?.resolver) {
|
|
289
294
|
const execute = typeof it.config.resolver === "function" ? this.simstanceManager.getOrNewSim({ target: it.config.resolver }) : it.config.resolver;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/SimpleBootHttpServer.ts"],
|
|
4
|
-
"sourcesContent": ["import {SimpleApplication} from '@dooboostore/simple-boot';\nimport {HttpServerOption} from './option/HttpServerOption';\nimport {ConstructorType} from '@dooboostore/core';\nimport {IncomingMessage, Server as HttpServer, ServerResponse} from 'http'\nimport {Server as HttpsServer} from 'https'; // Add HTTPS support\nimport {WebSocketServer, WebSocket} from 'ws';\nimport {RequestResponse} from './models/RequestResponse';\nimport {getUrlMapping, getUrlMappings, SaveMappingConfig, UrlMappingSituationType} from './decorators/MethodMapping';\nimport {HttpStatus} from './codes/HttpStatus';\nimport {HttpHeaders} from './codes/HttpHeaders';\nimport {Mimes} from './codes/Mimes';\nimport {Filter} from './filters/Filter';\nimport {ExceptionHandlerSituationType, targetExceptionHandler} from '@dooboostore/simple-boot';\nimport {getInject, SituationTypeContainer, SituationTypeContainers} from '@dooboostore/simple-boot';\nimport {EndPoint} from './endpoints/EndPoint';\nimport {ReflectUtils, ValidUtils} from '@dooboostore/core';\nimport {ReqFormUrlBody} from './models/datas/body/ReqFormUrlBody';\nimport {ReqJsonBody} from './models/datas/body/ReqJsonBody';\nimport {ReqHeader} from './models/datas/ReqHeader';\nimport {RouterModule} from '@dooboostore/simple-boot';\nimport {ReqMultipartFormBody} from './models/datas/body/ReqMultipartFormBody';\nimport {execValidationInValid, getValidIndex} from '@dooboostore/simple-boot';\nimport {ValidException} from '@dooboostore/simple-boot';\nimport {HttpError} from './errors/HttpError';\nimport {getRoute} from '@dooboostore/simple-boot';\nimport {OnInit} from './lifecycle/OnInit';\nimport {URLSearchParams} from 'url';\nimport {HttpMethod} from './codes/HttpMethod';\nimport {SessionManager} from './session/SessionManager';\nimport {InjectSituationType} from './inject/InjectSituationType';\nimport {ReqSearchParamsObj} from \"./models/datas/path/ReqSearchParamsObj\";\nimport {SimConfig} from '@dooboostore/simple-boot';\nimport {ReqPathData} from './models/datas/path/ReqPathData';\nimport {WebSocketEndPoint} from './endpoints/WebSocketEndPoint';\n\nexport class SimpleBootHttpServer extends SimpleApplication {\n public server?: HttpServer | HttpsServer;\n private sessionManager: SessionManager;\n private webSocketClients = new Map<WebSocket, { request: IncomingMessage }>();\n\n constructor(public option: HttpServerOption = new HttpServerOption()) {\n super(option);\n this.sessionManager = new SessionManager(this.option);\n }\n\n\n public run(otherInstanceSim?: Map<ConstructorType<any> | Function | SimConfig | symbol, any>) {\n otherInstanceSim ??= new Map<ConstructorType<any> | Function | SimConfig | symbol, any>();\n otherInstanceSim.set(SimpleBootHttpServer, this);\n super.run(otherInstanceSim);\n const targets = [...this.option.closeEndPoints ?? [], ...this.option.errorEndPoints ?? [], ...this.option.requestEndPoints ?? [], ...(this.option.filters ?? []).map(it=>it.filter)];\n Promise.all(targets.map(it => (typeof it === 'function' ? this.simstanceManager.getOrNewSim({target: it as ConstructorType<any>}) : it) as OnInit).map(it => it.onInit(this))).then(it => {\n this.startServer();\n });\n return this;\n }\n\n private startServer() {\n\n // const a = this.option.serverOption as HttpsServerOption;\n // this.option.serverOption?.\n\n if (this.option.serverOption && 'key' in this.option.serverOption && 'cert' in this.option.serverOption) {\n this.server = new HttpsServer(this.option.serverOption);\n const httpServer = new HttpServer();\n httpServer.on('request', (req: IncomingMessage, res: ServerResponse) => {\n res.writeHead(301, {Location: `https://${req.headers.host}${req.url}`});\n res.end();\n });\n httpServer.listen(80, this.option.listen.hostname, () => {\n console.log('HTTP redirect server running on port 80');\n });\n } else if (this.option.serverOption) {\n this.server = new HttpServer(this.option.serverOption);\n } else {\n this.server = new HttpServer();\n }\n // const thisRef = this;\n this.server.on('request', async (req: IncomingMessage, res: ServerResponse) => {\n // console.log('request', req.url);\n const transactionManager = this.option.transactionManagerFactory ? await this.option.transactionManagerFactory() : undefined;\n res.on('close', async () => {\n if (this.option.closeEndPoints) {\n for (const it of this.option.closeEndPoints) {\n try {\n const execute = (typeof it === 'function' ? this.simstanceManager.getOrNewSim({target: it}) : it) as EndPoint;\n const endPoint = execute?.endPoint(rr, this);\n if (endPoint instanceof Promise) {\n await endPoint;\n }\n } catch (e) {\n }\n }\n }\n\n if (!rr.resIsDone()) {\n rr.resEnd();\n }\n });\n res.on('error', async () => {\n if (this.option.errorEndPoints) {\n for (const it of this.option.errorEndPoints) {\n try {\n const execute = (typeof it === 'function' ? this.simstanceManager.getOrNewSim({target: it}) : it) as EndPoint;\n const endPoint = execute?.endPoint(rr, this);\n if (endPoint instanceof Promise) {\n await endPoint;\n }\n } catch (e) {\n }\n }\n }\n\n if (!rr.resIsDone()) {\n rr.resEnd();\n }\n });\n\n const rr = new RequestResponse(req, res, {sessionManager: this.sessionManager, option: this.option});\n /*\n default setting first\n */\n rr.resSetHeader(HttpHeaders.Server, 'simple-boot-http-server');\n const cookie = rr.reqCookieGet(this.option.sessionOption.key);\n if (!cookie) {\n const session = await this.sessionManager.session();\n\n const cookieParts: string[] = [];\n cookieParts.push(`${this.option.sessionOption.key}=${session.uuid}`);\n cookieParts.push(`Path=${this.option.sessionOption.path}`);\n if (this.option.sessionOption.httpOnly) cookieParts.push('HttpOnly');\n if (this.option.sessionOption.secure) cookieParts.push('Secure');\n if (this.option.sessionOption.sameSite != null && this.option.sessionOption.sameSite) cookieParts.push(`SameSite=${this.option.sessionOption.sameSite}`);\n const maxAge = (this.option.sessionOption as any).maxAge ?? (this.sessionManager.sessionOption)?.maxAge;\n if (maxAge != null) cookieParts.push(`Max-Age=${maxAge}`);\n rr.resSetHeader(HttpHeaders.SetCookie, cookieParts.join('; '));\n }\n\n const otherStorage = new Map<ConstructorType<any>, any>();\n otherStorage.set(RequestResponse, rr);\n otherStorage.set(IncomingMessage, req);\n otherStorage.set(ServerResponse, res);\n // \uD074\uB77C\uC774\uC5B8\uD2B8\uAC00 \uC751\uB2F5 \uC644\uB8CC \uC804\uC5D0 \uB04A\uC73C\uBA74 abort. \uD578\uB4E4\uB7EC\uB294 \uD30C\uB77C\uBBF8\uD130 \uD0C0\uC785 AbortSignal \uB85C \uC8FC\uC785\uBC1B\uC544\n // fetch/timers/events.once \uB4F1\uC5D0 \uB118\uAE30\uBA74 \uB300\uAE30 \uC911\uC774\uC5B4\uB3C4 \uBC14\uB85C \uD480\uB9B0\uB2E4 (\uC81C\uB108\uB808\uC774\uD130 \uC2A4\uD2B8\uB9BC\uC758 \uC774\uBCA4\uD2B8 \uB300\uAE30 \uB204\uC218 \uBC29\uC9C0)\n const abortController = new AbortController();\n res.once('close', () => {\n if (!res.writableFinished) abortController.abort();\n });\n otherStorage.set(AbortSignal, abortController.signal);\n try {\n transactionManager?.try();\n if (this.option.requestEndPoints) {\n for (const it of this.option.requestEndPoints) {\n try {\n const execute = (typeof it === 'function' ? this.simstanceManager.getOrNewSim<EndPoint>({target: it}) : it) as EndPoint;\n execute?.endPoint(rr, this);\n } catch (e) {\n }\n }\n }\n\n const filter = {\n carrier: new Map<string, any>(),\n filters: [] as { filter: Filter, sw: boolean }[]\n };\n for (let i = 0; this.option.filters && i < this.option.filters.length; i++) {\n const it = this.option.filters[i];\n\n let isSkip = false;\n if (typeof it.isSupport === 'boolean') {\n isSkip = !it.isSupport;\n } else if (typeof it.isSupport === 'object') {\n isSkip = !it.isSupport.test(rr.reqUrlPathName)\n } else if (typeof it.isSupport === 'function') {\n isSkip = !it.isSupport(rr);\n }\n if(isSkip) {\n continue;\n }\n\n let sw = true;\n const itFilter = it.filter;\n const execute = (typeof itFilter === 'function' ? this.simstanceManager.getOrNewSim({target: itFilter}) : itFilter) as Filter;\n if (execute?.proceedBefore) {\n sw = await execute.proceedBefore({rr, app: this, carrier: filter.carrier});\n filter.filters.push({filter: execute, sw});\n }\n if (!sw) {\n break;\n }\n }\n\n // body.. something..\n if (!rr.resIsDone()) {\n const routerModule = await super.routing(rr.reqIntent);\n otherStorage.set(RouterModule, routerModule);\n const moduleInstance = routerModule?.getModuleInstance?.();\n let methods: SaveMappingConfig[] = [];\n if (routerModule && moduleInstance) {\n // router \uD074\uB798\uC2A4 \uB0B4\uBD80\uC5D0\uC11C \uC120\uC5B8\uB41C Route\uC77C\uB54C\n if (routerModule.propertyKeys) {\n const map = routerModule.propertyKeys?.map((it: string | symbol) => {\n return {propertyKey: it, config: getUrlMapping(moduleInstance, it)} as SaveMappingConfig\n });\n methods.push(...(map ?? []));\n } else {\n methods.push(...(getUrlMappings(moduleInstance).filter(it => !getRoute(moduleInstance, it.propertyKey)) ?? []));\n }\n\n // options\uB85C \uC694\uCCAD\uC624\uBA74\uC740 allow\uB85C \uB123\uACE0 \uADF8\uB0E5 200\uCC98\uB9AC\uD574\uC57C\uB428.\n if (rr.reqMethod()?.toUpperCase() === HttpMethod.OPTIONS.toUpperCase()) {\n rr.resSetHeader(HttpHeaders.Allow, methods.map(it => it.config.method).join(', '));\n rr.resStatusCode(HttpStatus.Ok);\n }\n\n // method \uCC3E\uAE30\n methods = methods.filter(it => it && it.propertyKey && it.config && rr.reqMethod()?.toUpperCase() === it.config.method.toUpperCase());\n methods.sort((a, b) => {\n return ((b.config?.req?.contentType?.length ?? 0) + (b.config?.req?.accept?.length ?? 0)) - ((a.config?.req?.contentType?.length ?? 0) + (a.config?.req?.accept?.length ?? 0));\n });\n methods = methods\n .filter(it => it.config?.req?.contentType ? (!!it.config?.req?.contentType?.find(sit => rr.reqHasContentTypeHeader(sit))) : true)\n .filter(it => it.config?.req?.accept ? (!!it.config?.req?.accept?.find(sit => rr.reqHasAcceptHeader(sit))) : true);\n\n if (methods[0]) {\n const it = methods[0];\n const paramTypes = ReflectUtils.getParameterTypes(moduleInstance, it.propertyKey)\n const injects = getInject(moduleInstance, it.propertyKey);\n const validIndexs = getValidIndex(moduleInstance, it.propertyKey);\n if (injects) {\n const isPathData = injects.find(it => it.config?.situationType === UrlMappingSituationType.REQ_PATH_DATA);\n const isJson = injects.find(it => it.config?.situationType === UrlMappingSituationType.REQ_JSON_BODY);\n const isSearchParamsObj = injects.find(it => it.config?.situationType === UrlMappingSituationType.REQ_URL_SEARCH_PARAMS_OBJ);\n const isFormUrl = injects.find(it => it.config?.situationType === UrlMappingSituationType.REQ_FORM_URL_BODY);\n // \uC6B0\uC120 \uB2E4\uC2DC \uC81C\uAC70\uD55C\uB2E4.. \uD2B8\uB79C\uC81D\uC158 \uC5B4\uB5BB\uAC8C \uD560\uC9C0 \uB2E4\uC2DC \uC0DD\uAC01\n // const isTransactionManager = injects.find(it => it.config?.situationType === InjectSituationType.TransactionManager);\n const siturationContainers = new SituationTypeContainers();\n if (isPathData) {\n let data = await routerModule.pathData\n if (isPathData.type) {\n data = Object.assign(new isPathData.type(), data);\n }\n if (validIndexs.includes(isPathData.index)) {\n const inValid = execValidationInValid(data);\n if ((inValid?.length ?? 0) > 0) {\n throw new ValidException(inValid);\n }\n }\n siturationContainers.push(new SituationTypeContainer({\n situationType: UrlMappingSituationType.REQ_PATH_DATA,\n data\n }));\n }\n if (isJson) {\n let data = await rr.reqBodyJsonData();\n if (data !== null && isJson.type) {\n data = Object.assign(new isJson.type(), data);\n }\n if (validIndexs.includes(isJson.index)) {\n const inValid = execValidationInValid(data);\n if ((inValid?.length ?? 0) > 0) {\n throw new ValidException(inValid);\n }\n }\n siturationContainers.push(new SituationTypeContainer({\n situationType: UrlMappingSituationType.REQ_JSON_BODY,\n data\n }));\n }\n if (isSearchParamsObj) {\n let data = rr.reqUrlSearchParamsObj\n if (validIndexs.includes(isSearchParamsObj.index)) {\n const inValid = execValidationInValid(data);\n if ((inValid?.length ?? 0) > 0) {\n throw new ValidException(inValid);\n }\n }\n siturationContainers.push(new SituationTypeContainer({\n situationType: UrlMappingSituationType.REQ_URL_SEARCH_PARAMS_OBJ,\n data\n }));\n }\n if (isFormUrl) {\n let data = await rr.reqBodyFormUrlData()\n if (isFormUrl.type) {\n data = Object.assign(new isFormUrl.type(), data);\n }\n if (validIndexs.includes(isFormUrl.index)) {\n const inValid = execValidationInValid(data);\n if ((inValid?.length ?? 0) > 0) {\n throw new ValidException(inValid);\n }\n }\n siturationContainers.push(new SituationTypeContainer({situationType: UrlMappingSituationType.REQ_FORM_URL_BODY, data}));\n }\n // \uD2B8\uB79C\uC81D\uC158 \uC6B0\uC120 \uC81C\uAC70 \uB098\uC911\uC5D0 \uC5B4\uB5BB\uAC8C \uAD6C\uD604\uD560\uC9C0 \uC0DD\uAC01..\n // if (isTransactionManager && isTransactionManager.type && transactionManager && transactionManager.hasTransaction(isTransactionManager.type)) {\n // let data = await transactionManager.getTransaction(isTransactionManager.type);\n // if (data) {\n // data = await data.try(isTransactionManager.config.argument);\n // siturationContainers.push(new SituationTypeContainer({situationType: InjectSituationType.TransactionManager, data, index: isTransactionManager.index}));\n // }\n // }\n if (siturationContainers.length) {\n otherStorage.set(SituationTypeContainers, siturationContainers);\n }\n }\n\n for (const paramType of paramTypes) {\n if (paramType === ReqFormUrlBody) {\n otherStorage.set(ReqFormUrlBody, await rr.reqBodyReqFormUrlBody())\n } else if (paramType === ReqPathData) {\n otherStorage.set(ReqPathData, routerModule.pathData)\n } else if (paramType === ReqJsonBody) {\n otherStorage.set(ReqJsonBody, await rr.reqBodyReqJsonBody())\n } else if (paramType === ReqSearchParamsObj) {\n otherStorage.set(ReqSearchParamsObj, rr.reqUrlSearchParamsObj)\n } else if (paramType === URLSearchParams) {\n otherStorage.set(URLSearchParams, rr.reqUrlSearchParams)\n } else if (paramType === ReqMultipartFormBody) {\n otherStorage.set(ReqMultipartFormBody, rr.reqBodyMultipartFormData())\n } else if (paramType === ReqHeader) {\n otherStorage.set(ReqHeader, rr.reqHeaderObj)\n }\n }\n\n // execute !!!\n let data = await this.simstanceManager.executeBindParameterSimPromise({\n target: moduleInstance,\n targetKey: it.propertyKey\n }, otherStorage);\n /*\n \uC5EC\uAE30\uC5D0\uC11C \uC815\uD574\uC9C4 \uD0C0\uC785 \uB9AC\uD134\uC5D0 \uB530\uB978 \uC870\uCE58\n ...\n */\n const resConfig = it.config?.res;\n if (resConfig === 'manual') {\n // \uD578\uB4E4\uB7EC\uAC00 ServerResponse\uB97C \uC9C1\uC811 \uC8FC\uC785\uBC1B\uC544 \uC2A4\uC2A4\uB85C write/end\uB97C \uC81C\uC5B4\uD55C\uB2E4 (\uC608: SSE \uC2A4\uD2B8\uB9AC\uBC0D)\n } else if (ValidUtils.isGenerator(data) || ValidUtils.isAsyncGenerator(data)) {\n // \uC81C\uB108\uB808\uC774\uD130 \uB9AC\uD134: \uD5E4\uB354 \uBA3C\uC800 \uBCF4\uB0B4\uACE0, yield \uB41C \uAC12\uC744 \uD558\uB098\uC529 \uBC14\uB85C body \uB85C \uD758\uB824\uBCF4\uB0B8\uB2E4 (\uC608: SSE)\n const headers = resConfig?.header ?? {};\n if (resConfig?.contentType) {\n headers[HttpHeaders.ContentType] = resConfig.contentType;\n }\n rr.resSetHeaders(headers);\n rr.resSetStatusCode(resConfig?.status ?? HttpStatus.Ok);\n await rr.resStream(data);\n } else {\n if (it.config?.resolver) {\n const execute = typeof it.config.resolver === 'function' ? this.simstanceManager.getOrNewSim({target: it.config.resolver}) : it.config.resolver;\n data = await execute?.resolve?.(data, rr, resConfig);\n }\n const status = resConfig?.status ?? HttpStatus.Ok;\n const headers = resConfig?.header ?? {};\n if (resConfig?.contentType) {\n headers[HttpHeaders.ContentType] = resConfig.contentType;\n }\n if ((resConfig?.contentType?.toLowerCase().indexOf(Mimes.ApplicationJson.toLowerCase()) ?? -1) > -1) {\n data = JSON.stringify(data);\n } else if (data && typeof data === 'object') {\n data = JSON.stringify(data);\n }\n rr.resSetHeaders(headers)\n rr.resSetStatusCode(status);\n rr.resWrite(data);\n }\n }\n }\n\n if (this.option.noSuchRouteEndPointMappingThrow && methods.length <= 0 && rr.reqMethod()?.toUpperCase() !== HttpMethod.OPTIONS) {\n throw this.option.noSuchRouteEndPointMappingThrow(rr);\n }\n }\n\n // after\n for (const it of filter.filters.reverse()) {\n if (it.filter?.proceedAfter && !await it.filter.proceedAfter({rr, app: this, before: it.sw, carrier: filter.carrier})) {\n break;\n }\n }\n } catch (e) {\n console.error('request error:', e);\n transactionManager?.catch(e);\n rr.resStatusCode(e instanceof HttpError ? e.status : HttpStatus.InternalServerError)\n const execute = typeof this.option.globalAdvice === 'function' ? this.simstanceManager.getOrNewSim(this.option.globalAdvice) : this.option.globalAdvice;\n if (!execute) {\n rr.resEnd();\n // rr.resEnd().catch(e => {\n // });\n return;\n }\n if (e && typeof e === 'object') {\n otherStorage.set(e.constructor as ConstructorType<any>, e);\n otherStorage.set(SituationTypeContainer, new SituationTypeContainer({\n situationType: ExceptionHandlerSituationType.ERROR_OBJECT,\n data: e\n }));\n }\n const target = targetExceptionHandler(execute, e);\n if (target) {\n await this.simstanceManager.executeBindParameterSimPromise({\n target: execute,\n targetKey: target.propertyKey\n }, otherStorage);\n }\n } finally {\n transactionManager?.finally();\n }\n\n if (!rr.resIsDone()) {\n rr.resEnd();\n }\n });\n\n if (this.option.webSocketEndPoints) {\n const webSocketServer = new WebSocketServer({server: this.server});\n const execute = this.option.webSocketEndPoints.map(it => typeof it === 'function' ? this.simstanceManager.getOrNewSim({target: it}) : it);\n webSocketServer.on('connection', async (ws, request) => {\n this.webSocketClients.set(ws, {request});\n const wsSet = {socket: ws, request};\n execute.forEach(it => it.connect?.(wsSet));\n ws.on('error', err => execute.forEach(it => it.error?.(wsSet, err)));\n ws.on('message', (data, isBinary) => execute.forEach(it => it.message(wsSet, {data, isBinary})));\n ws.on('ping', () => execute.forEach(it => it.ping?.(wsSet)));\n ws.on('close', () => {\n this.webSocketClients.delete(ws);\n execute.forEach(it => it.close?.(wsSet));\n });\n });\n }\n this.server.listen(this.option.listen.port, this.option.listen.hostname, this.option.listen.backlog, () => {\n this.option.listen.listeningListener?.(this, this.server);\n });\n }\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAQ,yBAAwB;AAChC,SAAQ,wBAAuB;AAE/B,SAAQ,iBAAiB,UAAU,YAAY,sBAAqB;AACpE,SAAQ,UAAU,mBAAkB;AACpC,SAAQ,uBAAiC;AACzC,SAAQ,uBAAsB;AAC9B,SAAQ,eAAe,gBAAmC,+BAA8B;AACxF,SAAQ,kBAAiB;AACzB,SAAQ,mBAAkB;AAC1B,SAAQ,aAAY;AAEpB,SAAQ,+BAA+B,8BAA6B;AACpE,SAAQ,WAAW,wBAAwB,+BAA8B;AAEzE,SAAQ,cAAc,kBAAiB;AACvC,SAAQ,sBAAqB;AAC7B,SAAQ,mBAAkB;AAC1B,SAAQ,iBAAgB;AACxB,SAAQ,oBAAmB;AAC3B,SAAQ,4BAA2B;AACnC,SAAQ,uBAAuB,qBAAoB;AACnD,SAAQ,sBAAqB;AAC7B,SAAQ,iBAAgB;AACxB,SAAQ,gBAAe;AAEvB,SAAQ,uBAAsB;AAC9B,SAAQ,kBAAiB;AACzB,SAAQ,sBAAqB;AAE7B,SAAQ,0BAAyB;AAEjC,SAAQ,mBAAkB;AAGnB,MAAM,6BAA6B,kBAAkB;AAAA,EAK1D,YAAmB,SAA2B,IAAI,iBAAiB,GAAG;AACpE,UAAM,MAAM;AADK;AAFnB,SAAQ,mBAAmB,oBAAI,IAA6C;AAI1E,SAAK,iBAAiB,IAAI,eAAe,KAAK,MAAM;AAAA,EACtD;AAAA,EAGO,IAAI,kBAAmF;AAC5F,yBAAqB,oBAAI,I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UAAU,GAAG;AACnB,WAAG,OAAO;AAAA,MACZ;AAAA,IACF,CAAC;AAED,QAAI,KAAK,OAAO,oBAAoB;AAClC,YAAM,kBAAkB,IAAI,gBAAgB,EAAC,QAAQ,KAAK,OAAM,CAAC;AACjE,YAAM,UAAU,KAAK,OAAO,mBAAmB,IAAI,QAAM,OAAO,OAAO,aAAa,KAAK,iBAAiB,YAAY,EAAC,QAAQ,GAAE,CAAC,IAAI,EAAE;AACxI,sBAAgB,GAAG,cAAc,OAAO,IAAI,YAAY;AACtD,aAAK,iBAAiB,IAAI,IAAI,EAAC,QAAO,CAAC;AACvC,cAAM,QAAQ,EAAC,QAAQ,IAAI,QAAO;AAClC,gBAAQ,QAAQ,QAAM,GAAG,UAAU,KAAK,CAAC;AACzC,WAAG,GAAG,SAAS,SAAO,QAAQ,QAAQ,QAAM,GAAG,QAAQ,OAAO,GAAG,CAAC,CAAC;AACnE,WAAG,GAAG,WAAW,CAAC,MAAM,aAAa,QAAQ,QAAQ,QAAM,GAAG,QAAQ,OAAO,EAAC,MAAM,SAAQ,CAAC,CAAC,CAAC;AAC/F,WAAG,GAAG,QAAQ,MAAM,QAAQ,QAAQ,QAAM,GAAG,OAAO,KAAK,CAAC,CAAC;AAC3D,WAAG,GAAG,SAAS,MAAM;AACnB,eAAK,iBAAiB,OAAO,EAAE;AAC/B,kBAAQ,QAAQ,QAAM,GAAG,QAAQ,KAAK,CAAC;AAAA,QACzC,CAAC;AAAA,MACH,CAAC;AAAA,IACH;AACA,SAAK,OAAO,OAAO,KAAK,OAAO,OAAO,MAAM,KAAK,OAAO,OAAO,UAAU,KAAK,OAAO,OAAO,SAAS,MAAM;AACzG,WAAK,OAAO,OAAO,oBAAoB,MAAM,KAAK,MAAM;AAAA,IAC1D,CAAC;AAAA,EACH;AACF;",
|
|
4
|
+
"sourcesContent": ["import {SimpleApplication} from '@dooboostore/simple-boot';\nimport {HttpServerOption} from './option/HttpServerOption';\nimport {ConstructorType} from '@dooboostore/core';\nimport {IncomingMessage, Server as HttpServer, ServerResponse} from 'http'\nimport {Server as HttpsServer} from 'https'; // Add HTTPS support\nimport {WebSocketServer, WebSocket} from 'ws';\nimport {RequestResponse} from './models/RequestResponse';\nimport {getUrlMapping, getUrlMappings, SaveMappingConfig, UrlMappingSituationType} from './decorators/MethodMapping';\nimport {HttpStatus} from './codes/HttpStatus';\nimport {HttpHeaders} from './codes/HttpHeaders';\nimport {Mimes} from './codes/Mimes';\nimport {Filter} from './filters/Filter';\nimport {ExceptionHandlerSituationType, targetExceptionHandler} from '@dooboostore/simple-boot';\nimport {getInject, SituationTypeContainer, SituationTypeContainers} from '@dooboostore/simple-boot';\nimport {EndPoint} from './endpoints/EndPoint';\nimport {ReflectUtils, ValidUtils} from '@dooboostore/core';\nimport {ReqFormUrlBody} from './models/datas/body/ReqFormUrlBody';\nimport {ReqJsonBody} from './models/datas/body/ReqJsonBody';\nimport {ReqHeader} from './models/datas/ReqHeader';\nimport {RouterModule} from '@dooboostore/simple-boot';\nimport {ReqMultipartFormBody} from './models/datas/body/ReqMultipartFormBody';\nimport {execValidationInValid, getValidIndex} from '@dooboostore/simple-boot';\nimport {ValidException} from '@dooboostore/simple-boot';\nimport {HttpError} from './errors/HttpError';\nimport {getRoute} from '@dooboostore/simple-boot';\nimport {OnInit} from './lifecycle/OnInit';\nimport {URLSearchParams} from 'url';\nimport {HttpMethod} from './codes/HttpMethod';\nimport {SessionManager} from './session/SessionManager';\nimport {InjectSituationType} from './inject/InjectSituationType';\nimport {ContentTypeGenerator} from './generators/ContentTypeGenerator';\nimport {ReqSearchParamsObj} from \"./models/datas/path/ReqSearchParamsObj\";\nimport {SimConfig} from '@dooboostore/simple-boot';\nimport {ReqPathData} from './models/datas/path/ReqPathData';\nimport {WebSocketEndPoint} from './endpoints/WebSocketEndPoint';\n\nexport class SimpleBootHttpServer extends SimpleApplication {\n public server?: HttpServer | HttpsServer;\n private sessionManager: SessionManager;\n private webSocketClients = new Map<WebSocket, { request: IncomingMessage }>();\n\n constructor(public option: HttpServerOption = new HttpServerOption()) {\n super(option);\n this.sessionManager = new SessionManager(this.option);\n }\n\n\n public run(otherInstanceSim?: Map<ConstructorType<any> | Function | SimConfig | symbol, any>) {\n otherInstanceSim ??= new Map<ConstructorType<any> | Function | SimConfig | symbol, any>();\n otherInstanceSim.set(SimpleBootHttpServer, this);\n super.run(otherInstanceSim);\n const targets = [...this.option.closeEndPoints ?? [], ...this.option.errorEndPoints ?? [], ...this.option.requestEndPoints ?? [], ...(this.option.filters ?? []).map(it=>it.filter)];\n Promise.all(targets.map(it => (typeof it === 'function' ? this.simstanceManager.getOrNewSim({target: it as ConstructorType<any>}) : it) as OnInit).map(it => it.onInit(this))).then(it => {\n this.startServer();\n });\n return this;\n }\n\n private startServer() {\n\n // const a = this.option.serverOption as HttpsServerOption;\n // this.option.serverOption?.\n\n if (this.option.serverOption && 'key' in this.option.serverOption && 'cert' in this.option.serverOption) {\n this.server = new HttpsServer(this.option.serverOption);\n const httpServer = new HttpServer();\n httpServer.on('request', (req: IncomingMessage, res: ServerResponse) => {\n res.writeHead(301, {Location: `https://${req.headers.host}${req.url}`});\n res.end();\n });\n httpServer.listen(80, this.option.listen.hostname, () => {\n console.log('HTTP redirect server running on port 80');\n });\n } else if (this.option.serverOption) {\n this.server = new HttpServer(this.option.serverOption);\n } else {\n this.server = new HttpServer();\n }\n // const thisRef = this;\n this.server.on('request', async (req: IncomingMessage, res: ServerResponse) => {\n // console.log('request', req.url);\n const transactionManager = this.option.transactionManagerFactory ? await this.option.transactionManagerFactory() : undefined;\n res.on('close', async () => {\n if (this.option.closeEndPoints) {\n for (const it of this.option.closeEndPoints) {\n try {\n const execute = (typeof it === 'function' ? this.simstanceManager.getOrNewSim({target: it}) : it) as EndPoint;\n const endPoint = execute?.endPoint(rr, this);\n if (endPoint instanceof Promise) {\n await endPoint;\n }\n } catch (e) {\n }\n }\n }\n\n if (!rr.resIsDone()) {\n rr.resEnd();\n }\n });\n res.on('error', async () => {\n if (this.option.errorEndPoints) {\n for (const it of this.option.errorEndPoints) {\n try {\n const execute = (typeof it === 'function' ? this.simstanceManager.getOrNewSim({target: it}) : it) as EndPoint;\n const endPoint = execute?.endPoint(rr, this);\n if (endPoint instanceof Promise) {\n await endPoint;\n }\n } catch (e) {\n }\n }\n }\n\n if (!rr.resIsDone()) {\n rr.resEnd();\n }\n });\n\n const rr = new RequestResponse(req, res, {sessionManager: this.sessionManager, option: this.option});\n /*\n default setting first\n */\n rr.resSetHeader(HttpHeaders.Server, 'simple-boot-http-server');\n const cookie = rr.reqCookieGet(this.option.sessionOption.key);\n if (!cookie) {\n const session = await this.sessionManager.session();\n\n const cookieParts: string[] = [];\n cookieParts.push(`${this.option.sessionOption.key}=${session.uuid}`);\n cookieParts.push(`Path=${this.option.sessionOption.path}`);\n if (this.option.sessionOption.httpOnly) cookieParts.push('HttpOnly');\n if (this.option.sessionOption.secure) cookieParts.push('Secure');\n if (this.option.sessionOption.sameSite != null && this.option.sessionOption.sameSite) cookieParts.push(`SameSite=${this.option.sessionOption.sameSite}`);\n const maxAge = (this.option.sessionOption as any).maxAge ?? (this.sessionManager.sessionOption)?.maxAge;\n if (maxAge != null) cookieParts.push(`Max-Age=${maxAge}`);\n rr.resSetHeader(HttpHeaders.SetCookie, cookieParts.join('; '));\n }\n\n const otherStorage = new Map<ConstructorType<any>, any>();\n otherStorage.set(RequestResponse, rr);\n otherStorage.set(IncomingMessage, req);\n otherStorage.set(ServerResponse, res);\n // \uD074\uB77C\uC774\uC5B8\uD2B8\uAC00 \uC751\uB2F5 \uC644\uB8CC \uC804\uC5D0 \uB04A\uC73C\uBA74 abort. \uD578\uB4E4\uB7EC\uB294 \uD30C\uB77C\uBBF8\uD130 \uD0C0\uC785 AbortSignal \uB85C \uC8FC\uC785\uBC1B\uC544\n // fetch/timers/events.once \uB4F1\uC5D0 \uB118\uAE30\uBA74 \uB300\uAE30 \uC911\uC774\uC5B4\uB3C4 \uBC14\uB85C \uD480\uB9B0\uB2E4 (\uC81C\uB108\uB808\uC774\uD130 \uC2A4\uD2B8\uB9BC\uC758 \uC774\uBCA4\uD2B8 \uB300\uAE30 \uB204\uC218 \uBC29\uC9C0)\n const abortController = new AbortController();\n res.once('close', () => {\n if (!res.writableFinished) abortController.abort();\n });\n otherStorage.set(AbortSignal, abortController.signal);\n try {\n transactionManager?.try();\n if (this.option.requestEndPoints) {\n for (const it of this.option.requestEndPoints) {\n try {\n const execute = (typeof it === 'function' ? this.simstanceManager.getOrNewSim<EndPoint>({target: it}) : it) as EndPoint;\n execute?.endPoint(rr, this);\n } catch (e) {\n }\n }\n }\n\n const filter = {\n carrier: new Map<string, any>(),\n filters: [] as { filter: Filter, sw: boolean }[]\n };\n for (let i = 0; this.option.filters && i < this.option.filters.length; i++) {\n const it = this.option.filters[i];\n\n let isSkip = false;\n if (typeof it.isSupport === 'boolean') {\n isSkip = !it.isSupport;\n } else if (typeof it.isSupport === 'object') {\n isSkip = !it.isSupport.test(rr.reqUrlPathName)\n } else if (typeof it.isSupport === 'function') {\n isSkip = !it.isSupport(rr);\n }\n if(isSkip) {\n continue;\n }\n\n let sw = true;\n const itFilter = it.filter;\n const execute = (typeof itFilter === 'function' ? this.simstanceManager.getOrNewSim({target: itFilter}) : itFilter) as Filter;\n if (execute?.proceedBefore) {\n sw = await execute.proceedBefore({rr, app: this, carrier: filter.carrier});\n filter.filters.push({filter: execute, sw});\n }\n if (!sw) {\n break;\n }\n }\n\n // body.. something..\n // \uB77C\uC6B0\uD130 \uC5C6\uC774 \uD544\uD130\uB9CC\uC73C\uB85C \uB3C4\uB294 \uC11C\uBC84(\uC608: SSR \uC804\uC6A9)\uBA74, \uC5B4\uB290 \uD544\uD130\uB3C4 \uCC98\uB9AC\uD558\uC9C0 \uC54A\uC740 \uC694\uCCAD\uC740 404 \uB85C \uB05D\uB0B8\uB2E4\n // (\uBE0C\uB77C\uC6B0\uC800\uAC00 \uC54C\uC544\uC11C \uBCF4\uB0B4\uB294 /favicon.ico, /.well-known/... \uAC19\uC740 \uAC83 \u2014 \uC608\uC804\uC5D4 'no router' \uC5D0\uB7EC\uB85C 500 + \uB85C\uADF8)\n if (!rr.resIsDone() && !this.option.rootRouter) {\n rr.resStatusCode(HttpStatus.NotFound);\n } else if (!rr.resIsDone()) {\n const routerModule = await super.routing(rr.reqIntent);\n otherStorage.set(RouterModule, routerModule);\n const moduleInstance = routerModule?.getModuleInstance?.();\n let methods: SaveMappingConfig[] = [];\n if (routerModule && moduleInstance) {\n // router \uD074\uB798\uC2A4 \uB0B4\uBD80\uC5D0\uC11C \uC120\uC5B8\uB41C Route\uC77C\uB54C\n if (routerModule.propertyKeys) {\n const map = routerModule.propertyKeys?.map((it: string | symbol) => {\n return {propertyKey: it, config: getUrlMapping(moduleInstance, it)} as SaveMappingConfig\n });\n methods.push(...(map ?? []));\n } else {\n methods.push(...(getUrlMappings(moduleInstance).filter(it => !getRoute(moduleInstance, it.propertyKey)) ?? []));\n }\n\n // options\uB85C \uC694\uCCAD\uC624\uBA74\uC740 allow\uB85C \uB123\uACE0 \uADF8\uB0E5 200\uCC98\uB9AC\uD574\uC57C\uB428.\n if (rr.reqMethod()?.toUpperCase() === HttpMethod.OPTIONS.toUpperCase()) {\n rr.resSetHeader(HttpHeaders.Allow, methods.map(it => it.config.method).join(', '));\n rr.resStatusCode(HttpStatus.Ok);\n }\n\n // method \uCC3E\uAE30\n methods = methods.filter(it => it && it.propertyKey && it.config && rr.reqMethod()?.toUpperCase() === it.config.method.toUpperCase());\n methods.sort((a, b) => {\n return ((b.config?.req?.contentType?.length ?? 0) + (b.config?.req?.accept?.length ?? 0)) - ((a.config?.req?.contentType?.length ?? 0) + (a.config?.req?.accept?.length ?? 0));\n });\n methods = methods\n .filter(it => it.config?.req?.contentType ? (!!it.config?.req?.contentType?.find(sit => rr.reqHasContentTypeHeader(sit))) : true)\n .filter(it => it.config?.req?.accept ? (!!it.config?.req?.accept?.find(sit => rr.reqHasAcceptHeader(sit))) : true);\n\n if (methods[0]) {\n const it = methods[0];\n const paramTypes = ReflectUtils.getParameterTypes(moduleInstance, it.propertyKey)\n const injects = getInject(moduleInstance, it.propertyKey);\n const validIndexs = getValidIndex(moduleInstance, it.propertyKey);\n if (injects) {\n const isPathData = injects.find(it => it.config?.situationType === UrlMappingSituationType.REQ_PATH_DATA);\n const isJson = injects.find(it => it.config?.situationType === UrlMappingSituationType.REQ_JSON_BODY);\n const isSearchParamsObj = injects.find(it => it.config?.situationType === UrlMappingSituationType.REQ_URL_SEARCH_PARAMS_OBJ);\n const isFormUrl = injects.find(it => it.config?.situationType === UrlMappingSituationType.REQ_FORM_URL_BODY);\n // \uC6B0\uC120 \uB2E4\uC2DC \uC81C\uAC70\uD55C\uB2E4.. \uD2B8\uB79C\uC81D\uC158 \uC5B4\uB5BB\uAC8C \uD560\uC9C0 \uB2E4\uC2DC \uC0DD\uAC01\n // const isTransactionManager = injects.find(it => it.config?.situationType === InjectSituationType.TransactionManager);\n const siturationContainers = new SituationTypeContainers();\n if (isPathData) {\n let data = await routerModule.pathData\n if (isPathData.type) {\n data = Object.assign(new isPathData.type(), data);\n }\n if (validIndexs.includes(isPathData.index)) {\n const inValid = execValidationInValid(data);\n if ((inValid?.length ?? 0) > 0) {\n throw new ValidException(inValid);\n }\n }\n siturationContainers.push(new SituationTypeContainer({\n situationType: UrlMappingSituationType.REQ_PATH_DATA,\n data\n }));\n }\n if (isJson) {\n let data = await rr.reqBodyJsonData();\n if (data !== null && isJson.type) {\n data = Object.assign(new isJson.type(), data);\n }\n if (validIndexs.includes(isJson.index)) {\n const inValid = execValidationInValid(data);\n if ((inValid?.length ?? 0) > 0) {\n throw new ValidException(inValid);\n }\n }\n siturationContainers.push(new SituationTypeContainer({\n situationType: UrlMappingSituationType.REQ_JSON_BODY,\n data\n }));\n }\n if (isSearchParamsObj) {\n let data = rr.reqUrlSearchParamsObj\n if (validIndexs.includes(isSearchParamsObj.index)) {\n const inValid = execValidationInValid(data);\n if ((inValid?.length ?? 0) > 0) {\n throw new ValidException(inValid);\n }\n }\n siturationContainers.push(new SituationTypeContainer({\n situationType: UrlMappingSituationType.REQ_URL_SEARCH_PARAMS_OBJ,\n data\n }));\n }\n if (isFormUrl) {\n let data = await rr.reqBodyFormUrlData()\n if (isFormUrl.type) {\n data = Object.assign(new isFormUrl.type(), data);\n }\n if (validIndexs.includes(isFormUrl.index)) {\n const inValid = execValidationInValid(data);\n if ((inValid?.length ?? 0) > 0) {\n throw new ValidException(inValid);\n }\n }\n siturationContainers.push(new SituationTypeContainer({situationType: UrlMappingSituationType.REQ_FORM_URL_BODY, data}));\n }\n // \uD2B8\uB79C\uC81D\uC158 \uC6B0\uC120 \uC81C\uAC70 \uB098\uC911\uC5D0 \uC5B4\uB5BB\uAC8C \uAD6C\uD604\uD560\uC9C0 \uC0DD\uAC01..\n // if (isTransactionManager && isTransactionManager.type && transactionManager && transactionManager.hasTransaction(isTransactionManager.type)) {\n // let data = await transactionManager.getTransaction(isTransactionManager.type);\n // if (data) {\n // data = await data.try(isTransactionManager.config.argument);\n // siturationContainers.push(new SituationTypeContainer({situationType: InjectSituationType.TransactionManager, data, index: isTransactionManager.index}));\n // }\n // }\n if (siturationContainers.length) {\n otherStorage.set(SituationTypeContainers, siturationContainers);\n }\n }\n\n for (const paramType of paramTypes) {\n if (paramType === ReqFormUrlBody) {\n otherStorage.set(ReqFormUrlBody, await rr.reqBodyReqFormUrlBody())\n } else if (paramType === ReqPathData) {\n otherStorage.set(ReqPathData, routerModule.pathData)\n } else if (paramType === ReqJsonBody) {\n otherStorage.set(ReqJsonBody, await rr.reqBodyReqJsonBody())\n } else if (paramType === ReqSearchParamsObj) {\n otherStorage.set(ReqSearchParamsObj, rr.reqUrlSearchParamsObj)\n } else if (paramType === URLSearchParams) {\n otherStorage.set(URLSearchParams, rr.reqUrlSearchParams)\n } else if (paramType === ReqMultipartFormBody) {\n otherStorage.set(ReqMultipartFormBody, rr.reqBodyMultipartFormData())\n } else if (paramType === ReqHeader) {\n otherStorage.set(ReqHeader, rr.reqHeaderObj)\n }\n }\n\n // execute !!!\n let data = await this.simstanceManager.executeBindParameterSimPromise({\n target: moduleInstance,\n targetKey: it.propertyKey\n }, otherStorage);\n /*\n \uC5EC\uAE30\uC5D0\uC11C \uC815\uD574\uC9C4 \uD0C0\uC785 \uB9AC\uD134\uC5D0 \uB530\uB978 \uC870\uCE58\n ...\n */\n const resConfig = it.config?.res;\n if (resConfig === 'manual') {\n // \uD578\uB4E4\uB7EC\uAC00 ServerResponse\uB97C \uC9C1\uC811 \uC8FC\uC785\uBC1B\uC544 \uC2A4\uC2A4\uB85C write/end\uB97C \uC81C\uC5B4\uD55C\uB2E4 (\uC608: SSE \uC2A4\uD2B8\uB9AC\uBC0D)\n } else if (ValidUtils.isGenerator(data) || ValidUtils.isAsyncGenerator(data)) {\n // \uC81C\uB108\uB808\uC774\uD130 \uB9AC\uD134: \uD5E4\uB354 \uBA3C\uC800 \uBCF4\uB0B4\uACE0, yield \uB41C \uAC12\uC744 \uD558\uB098\uC529 \uBC14\uB85C body \uB85C \uD758\uB824\uBCF4\uB0B8\uB2E4 (\uC608: SSE)\n // ContentTypeGenerator.Stream \uC774\uBA74 Content-Type(boundary \uD3EC\uD568)\u00B7\uC555\uCD95 \uC5EC\uBD80\uB97C \uC2A4\uD2B8\uB9BC\uC774 \uC815\uD55C\uB2E4\n const stream = ContentTypeGenerator.isStream(data) ? data : undefined;\n const headers = resConfig?.header ?? {};\n const contentType = stream?.contentType ?? resConfig?.contentType;\n if (contentType) {\n headers[HttpHeaders.ContentType] = contentType;\n }\n rr.resSetHeaders(headers);\n rr.resSetStatusCode(resConfig?.status ?? HttpStatus.Ok);\n await rr.resStream(data, { compress: stream?.compress });\n } else {\n if (it.config?.resolver) {\n const execute = typeof it.config.resolver === 'function' ? this.simstanceManager.getOrNewSim({target: it.config.resolver}) : it.config.resolver;\n data = await execute?.resolve?.(data, rr, resConfig);\n }\n const status = resConfig?.status ?? HttpStatus.Ok;\n const headers = resConfig?.header ?? {};\n if (resConfig?.contentType) {\n headers[HttpHeaders.ContentType] = resConfig.contentType;\n }\n if ((resConfig?.contentType?.toLowerCase().indexOf(Mimes.ApplicationJson.toLowerCase()) ?? -1) > -1) {\n data = JSON.stringify(data);\n } else if (data && typeof data === 'object') {\n data = JSON.stringify(data);\n }\n rr.resSetHeaders(headers)\n rr.resSetStatusCode(status);\n rr.resWrite(data);\n }\n }\n }\n\n if (this.option.noSuchRouteEndPointMappingThrow && methods.length <= 0 && rr.reqMethod()?.toUpperCase() !== HttpMethod.OPTIONS) {\n throw this.option.noSuchRouteEndPointMappingThrow(rr);\n }\n }\n\n // after\n for (const it of filter.filters.reverse()) {\n if (it.filter?.proceedAfter && !await it.filter.proceedAfter({rr, app: this, before: it.sw, carrier: filter.carrier})) {\n break;\n }\n }\n } catch (e) {\n console.error('request error:', e);\n transactionManager?.catch(e);\n rr.resStatusCode(e instanceof HttpError ? e.status : HttpStatus.InternalServerError)\n const execute = typeof this.option.globalAdvice === 'function' ? this.simstanceManager.getOrNewSim(this.option.globalAdvice) : this.option.globalAdvice;\n if (!execute) {\n rr.resEnd();\n // rr.resEnd().catch(e => {\n // });\n return;\n }\n if (e && typeof e === 'object') {\n otherStorage.set(e.constructor as ConstructorType<any>, e);\n otherStorage.set(SituationTypeContainer, new SituationTypeContainer({\n situationType: ExceptionHandlerSituationType.ERROR_OBJECT,\n data: e\n }));\n }\n const target = targetExceptionHandler(execute, e);\n if (target) {\n await this.simstanceManager.executeBindParameterSimPromise({\n target: execute,\n targetKey: target.propertyKey\n }, otherStorage);\n }\n } finally {\n transactionManager?.finally();\n }\n\n if (!rr.resIsDone()) {\n rr.resEnd();\n }\n });\n\n if (this.option.webSocketEndPoints) {\n const webSocketServer = new WebSocketServer({server: this.server});\n const execute = this.option.webSocketEndPoints.map(it => typeof it === 'function' ? this.simstanceManager.getOrNewSim({target: it}) : it);\n webSocketServer.on('connection', async (ws, request) => {\n this.webSocketClients.set(ws, {request});\n const wsSet = {socket: ws, request};\n execute.forEach(it => it.connect?.(wsSet));\n ws.on('error', err => execute.forEach(it => it.error?.(wsSet, err)));\n ws.on('message', (data, isBinary) => execute.forEach(it => it.message(wsSet, {data, isBinary})));\n ws.on('ping', () => execute.forEach(it => it.ping?.(wsSet)));\n ws.on('close', () => {\n this.webSocketClients.delete(ws);\n execute.forEach(it => it.close?.(wsSet));\n });\n });\n }\n this.server.listen(this.option.listen.port, this.option.listen.hostname, this.option.listen.backlog, () => {\n this.option.listen.listeningListener?.(this, this.server);\n });\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAQ,yBAAwB;AAChC,SAAQ,wBAAuB;AAE/B,SAAQ,iBAAiB,UAAU,YAAY,sBAAqB;AACpE,SAAQ,UAAU,mBAAkB;AACpC,SAAQ,uBAAiC;AACzC,SAAQ,uBAAsB;AAC9B,SAAQ,eAAe,gBAAmC,+BAA8B;AACxF,SAAQ,kBAAiB;AACzB,SAAQ,mBAAkB;AAC1B,SAAQ,aAAY;AAEpB,SAAQ,+BAA+B,8BAA6B;AACpE,SAAQ,WAAW,wBAAwB,+BAA8B;AAEzE,SAAQ,cAAc,kBAAiB;AACvC,SAAQ,sBAAqB;AAC7B,SAAQ,mBAAkB;AAC1B,SAAQ,iBAAgB;AACxB,SAAQ,oBAAmB;AAC3B,SAAQ,4BAA2B;AACnC,SAAQ,uBAAuB,qBAAoB;AACnD,SAAQ,sBAAqB;AAC7B,SAAQ,iBAAgB;AACxB,SAAQ,gBAAe;AAEvB,SAAQ,uBAAsB;AAC9B,SAAQ,kBAAiB;AACzB,SAAQ,sBAAqB;AAE7B,SAAQ,4BAA2B;AACnC,SAAQ,0BAAyB;AAEjC,SAAQ,mBAAkB;AAGnB,MAAM,6BAA6B,kBAAkB;AAAA,EAK1D,YAAmB,SAA2B,IAAI,iBAAiB,GAAG;AACpE,UAAM,MAAM;AADK;AAFnB,SAAQ,mBAAmB,oBAAI,IAA6C;AAI1E,SAAK,iBAAiB,IAAI,eAAe,KAAK,MAAM;A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AAO,MAAM,KAAK,OAAO,OAAO,UAAU,KAAK,OAAO,OAAO,SAAS,MAAM;AACzG,WAAK,OAAO,OAAO,oBAAoB,MAAM,KAAK,MAAM;AAAA,IAC1D,CAAC;AAAA,EACH;AACF;",
|
|
6
6
|
"names": ["it", "data"]
|
|
7
7
|
}
|
package/dist/esm/codes/Mimes.js
CHANGED
|
@@ -26,6 +26,8 @@ var Mimes = /* @__PURE__ */ ((Mimes2) => {
|
|
|
26
26
|
Mimes2["MultipartFormData"] = "multipart/form-data";
|
|
27
27
|
Mimes2["TextEventStream"] = "text/event-stream";
|
|
28
28
|
Mimes2["ApplicationXndjson"] = "application/x-ndjson";
|
|
29
|
+
Mimes2["ApplicationJsonSeq"] = "application/json-seq";
|
|
30
|
+
Mimes2["TextCsv"] = "text/csv";
|
|
29
31
|
Mimes2["ApplicationJsonPostSimpleBootSsrIntentScheme"] = "application/json-post+simple-boot-ssr-intent-scheme";
|
|
30
32
|
Mimes2["Intent"] = "intent";
|
|
31
33
|
return Mimes2;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/codes/Mimes.ts"],
|
|
4
|
-
"sourcesContent": ["export enum Mimes {\n ApplicationJson = 'application/json',\n ApplicationOctetStream = 'application/octet-stream',\n ApplicationXml = 'application/xml',\n ApplicationJsonPatch = 'application/json-patch+json',\n ApplicationXWwwFormUrlencoded = 'application/x-www-form-urlencoded',\n TextPlain = 'text/plain',\n TextHtml = 'text/html',\n All = '*/*',\n TextCss = 'text/css',\n TextJavascript = 'text/javascript',\n TextXml = 'text/xml',\n TextXslt = 'text/xslt',\n TextXmlDtd = 'text/xml-dtd',\n TextPlainUtf8 = 'text/plain; charset=utf-8',\n ImagePng = 'image/png',\n ImageGif = 'image/gif',\n ImageJpeg = 'image/jpeg',\n ImageSvg = 'image/svg+xml',\n ImageBmp = 'image/bmp',\n ImageTiff = 'image/tiff',\n ImagePdf = 'application/pdf',\n ImageXBmp = 'image/x-bmp',\n ImageXpixmap = 'image/x-xpixmap',\n ImageXxbm = 'image/x-xbm',\n MultipartFormData = 'multipart/form-data',\n TextEventStream = 'text/event-stream', // SSE \uC2E4\uC2DC\uAC04 \uD14D\uC2A4\uD2B8 \uC2A4\uD2B8\uB9AC\uBC0D\n ApplicationXndjson = 'application/x-ndjson',\n ApplicationJsonPostSimpleBootSsrIntentScheme = 'application/json-post+simple-boot-ssr-intent-scheme',\n Intent = 'intent'\n}\n"],
|
|
5
|
-
"mappings": "AAAO,IAAK,QAAL,kBAAKA,WAAL;AACL,EAAAA,OAAA,qBAAkB;AAClB,EAAAA,OAAA,4BAAyB;AACzB,EAAAA,OAAA,oBAAiB;AACjB,EAAAA,OAAA,0BAAuB;AACvB,EAAAA,OAAA,mCAAgC;AAChC,EAAAA,OAAA,eAAY;AACZ,EAAAA,OAAA,cAAW;AACX,EAAAA,OAAA,SAAM;AACN,EAAAA,OAAA,aAAU;AACV,EAAAA,OAAA,oBAAiB;AACjB,EAAAA,OAAA,aAAU;AACV,EAAAA,OAAA,cAAW;AACX,EAAAA,OAAA,gBAAa;AACb,EAAAA,OAAA,mBAAgB;AAChB,EAAAA,OAAA,cAAW;AACX,EAAAA,OAAA,cAAW;AACX,EAAAA,OAAA,eAAY;AACZ,EAAAA,OAAA,cAAW;AACX,EAAAA,OAAA,cAAW;AACX,EAAAA,OAAA,eAAY;AACZ,EAAAA,OAAA,cAAW;AACX,EAAAA,OAAA,eAAY;AACZ,EAAAA,OAAA,kBAAe;AACf,EAAAA,OAAA,eAAY;AACZ,EAAAA,OAAA,uBAAoB;AACpB,EAAAA,OAAA,qBAAkB;AAClB,EAAAA,OAAA,wBAAqB;AACrB,EAAAA,OAAA,kDAA+C;AAC/C,EAAAA,OAAA,YAAS;
|
|
4
|
+
"sourcesContent": ["export enum Mimes {\n ApplicationJson = 'application/json',\n ApplicationOctetStream = 'application/octet-stream',\n ApplicationXml = 'application/xml',\n ApplicationJsonPatch = 'application/json-patch+json',\n ApplicationXWwwFormUrlencoded = 'application/x-www-form-urlencoded',\n TextPlain = 'text/plain',\n TextHtml = 'text/html',\n All = '*/*',\n TextCss = 'text/css',\n TextJavascript = 'text/javascript',\n TextXml = 'text/xml',\n TextXslt = 'text/xslt',\n TextXmlDtd = 'text/xml-dtd',\n TextPlainUtf8 = 'text/plain; charset=utf-8',\n ImagePng = 'image/png',\n ImageGif = 'image/gif',\n ImageJpeg = 'image/jpeg',\n ImageSvg = 'image/svg+xml',\n ImageBmp = 'image/bmp',\n ImageTiff = 'image/tiff',\n ImagePdf = 'application/pdf',\n ImageXBmp = 'image/x-bmp',\n ImageXpixmap = 'image/x-xpixmap',\n ImageXxbm = 'image/x-xbm',\n MultipartFormData = 'multipart/form-data',\n TextEventStream = 'text/event-stream', // SSE \uC2E4\uC2DC\uAC04 \uD14D\uC2A4\uD2B8 \uC2A4\uD2B8\uB9AC\uBC0D\n ApplicationXndjson = 'application/x-ndjson',\n ApplicationJsonSeq = 'application/json-seq', // RFC 7464 JSON Text Sequences\n TextCsv = 'text/csv',\n ApplicationJsonPostSimpleBootSsrIntentScheme = 'application/json-post+simple-boot-ssr-intent-scheme',\n Intent = 'intent'\n}\n"],
|
|
5
|
+
"mappings": "AAAO,IAAK,QAAL,kBAAKA,WAAL;AACL,EAAAA,OAAA,qBAAkB;AAClB,EAAAA,OAAA,4BAAyB;AACzB,EAAAA,OAAA,oBAAiB;AACjB,EAAAA,OAAA,0BAAuB;AACvB,EAAAA,OAAA,mCAAgC;AAChC,EAAAA,OAAA,eAAY;AACZ,EAAAA,OAAA,cAAW;AACX,EAAAA,OAAA,SAAM;AACN,EAAAA,OAAA,aAAU;AACV,EAAAA,OAAA,oBAAiB;AACjB,EAAAA,OAAA,aAAU;AACV,EAAAA,OAAA,cAAW;AACX,EAAAA,OAAA,gBAAa;AACb,EAAAA,OAAA,mBAAgB;AAChB,EAAAA,OAAA,cAAW;AACX,EAAAA,OAAA,cAAW;AACX,EAAAA,OAAA,eAAY;AACZ,EAAAA,OAAA,cAAW;AACX,EAAAA,OAAA,cAAW;AACX,EAAAA,OAAA,eAAY;AACZ,EAAAA,OAAA,cAAW;AACX,EAAAA,OAAA,eAAY;AACZ,EAAAA,OAAA,kBAAe;AACf,EAAAA,OAAA,eAAY;AACZ,EAAAA,OAAA,uBAAoB;AACpB,EAAAA,OAAA,qBAAkB;AAClB,EAAAA,OAAA,wBAAqB;AACrB,EAAAA,OAAA,wBAAqB;AACrB,EAAAA,OAAA,aAAU;AACV,EAAAA,OAAA,kDAA+C;AAC/C,EAAAA,OAAA,YAAS;AA/BC,SAAAA;AAAA,GAAA;",
|
|
6
6
|
"names": ["Mimes"]
|
|
7
7
|
}
|