From 2303aba3a01d90d31536f877e0e831c3a3c16071 Mon Sep 17 00:00:00 2001 From: Romain Lenzotti Date: Thu, 28 Dec 2023 13:03:01 +0100 Subject: [PATCH] chore(platform-fastify): map request/reply methods to PlatformRequest/PlatformResponse Closes: #2446, #2447 --- .../platform/platform-fastify/jest.config.js | 18 +++ .../src/components/PlatformFastify.spec.ts | 61 +------- .../src/components/PlatformFastify.ts | 139 +++++++++++------- .../platform/platform-fastify/src/index.ts | 9 -- .../services/PlatformFastifyRequest.spec.ts | 66 +-------- .../src/services/PlatformFastifyRequest.ts | 16 +- .../services/PlatformFastifyResponse.spec.ts | 97 +++--------- .../src/services/PlatformFastifyResponse.ts | 60 +++----- .../test/platform-fastify.spec.ts | 4 +- yarn.lock | 14 +- 10 files changed, 173 insertions(+), 311 deletions(-) create mode 100644 packages/platform/platform-fastify/jest.config.js diff --git a/packages/platform/platform-fastify/jest.config.js b/packages/platform/platform-fastify/jest.config.js new file mode 100644 index 00000000000..4b1a5203fbf --- /dev/null +++ b/packages/platform/platform-fastify/jest.config.js @@ -0,0 +1,18 @@ +// For a detailed explanation regarding each configuration property, visit: +// https://jestjs.io/docs/en/configuration.html + +module.exports = { + ...require("@tsed/jest-config"), + roots: ["/src", "/test"], + moduleNameMapper: { + "^@tsed/platform-fastify$": "/src/index.ts" + }, + coverageThreshold: { + global: { + statements: 98.28, + branches: 92.59, + functions: 100, + lines: 98.28 + } + } +}; diff --git a/packages/platform/platform-fastify/src/components/PlatformFastify.spec.ts b/packages/platform/platform-fastify/src/components/PlatformFastify.spec.ts index bf1cd2bc465..7479f466a7b 100644 --- a/packages/platform/platform-fastify/src/components/PlatformFastify.spec.ts +++ b/packages/platform/platform-fastify/src/components/PlatformFastify.spec.ts @@ -1,82 +1,33 @@ import {PlatformBuilder} from "@tsed/common"; -import Sinon from "sinon"; -import {expect} from "chai"; import {PlatformFastify} from "./PlatformFastify"; -const sandbox = Sinon.createSandbox(); - class Server {} describe("PlatformFastify", () => { describe("create()", () => { beforeEach(() => { - sandbox.stub(PlatformBuilder, "create"); + jest.spyOn(PlatformBuilder, "create").mockReturnValue({}); }); - afterEach(() => sandbox.restore()); + afterEach(() => jest.resetAllMocks()); it("should create platform", () => { PlatformFastify.create(Server, {}); - expect(PlatformBuilder.create).to.have.been.calledWithExactly(Server, { + expect(PlatformBuilder.create).toHaveBeenCalledWith(Server, { adapter: PlatformFastify }); }); }); describe("bootstrap()", () => { beforeEach(() => { - sandbox.stub(PlatformBuilder, "bootstrap"); + jest.spyOn(PlatformBuilder, "bootstrap").mockReturnValue({}); }); - afterEach(() => sandbox.restore()); + afterEach(() => jest.resetAllMocks()); it("should create platform", async () => { await PlatformFastify.bootstrap(Server, {}); - expect(PlatformBuilder.bootstrap).to.have.been.calledWithExactly(Server, { + expect(PlatformBuilder.bootstrap).toHaveBeenCalledWith(Server, { adapter: PlatformFastify }); }); }); - describe("bodyParser()", () => { - afterEach(() => sandbox.restore()); - it("should return the body parser (json) ", () => { - const stub = sandbox.stub().returns("body"); - - const platform = PlatformFastify.create(Server, { - fastify: { - bodyParser: stub - } - }); - - const result = platform.adapter.bodyParser("json", {strict: true}); - - expect(result).to.equal("body"); - expect(stub).to.have.been.calledWithExactly({strict: true}); - }); - it("should return the body parser (raw) ", () => { - const stub = sandbox.stub().returns("body"); - - const platform = PlatformFastify.create(Server, { - fastify: { - bodyParser: stub - } - }); - - const result = platform.adapter.bodyParser("raw", {strict: true}); - - expect(result).to.equal("body"); - expect(stub).to.have.been.calledWithExactly({strict: true}); - }); - it("should return the body parser (urlencoded) ", () => { - const stub = sandbox.stub().returns("body"); - - const platform = PlatformFastify.create(Server, { - fastify: { - bodyParser: stub - } - }); - - const result = platform.adapter.bodyParser("urlencoded", {strict: true}); - - expect(result).to.equal("body"); - expect(stub).to.have.been.calledWithExactly({strict: true}); - }); - }); }); diff --git a/packages/platform/platform-fastify/src/components/PlatformFastify.ts b/packages/platform/platform-fastify/src/components/PlatformFastify.ts index bf5684d143e..cf28b651939 100644 --- a/packages/platform/platform-fastify/src/components/PlatformFastify.ts +++ b/packages/platform/platform-fastify/src/components/PlatformFastify.ts @@ -1,23 +1,22 @@ import middie from "@fastify/middie"; import { createContext, - InjectorService, PlatformAdapter, - PlatformApplication, PlatformBuilder, PlatformContext, PlatformExceptions, - PlatformHandler, + PlatformMulter, + PlatformMulterSettings, PlatformRequest, PlatformResponse, + PlatformStaticsOptions, runInContext } from "@tsed/common"; import {Type} from "@tsed/core"; import {PlatformHandlerMetadata, PlatformLayer} from "@tsed/platform-router"; -import next from "ajv/dist/vocabularies/next"; import Fastify, {FastifyInstance, FastifyReply, FastifyRequest} from "fastify"; -import {PlatformFastifyApplication} from "../services/PlatformFastifyApplication"; -import {PlatformFastifyHandler} from "../services/PlatformFastifyHandler"; +import * as Http from "http"; +import * as Https from "https"; import {PlatformFastifyRequest} from "../services/PlatformFastifyRequest"; import {PlatformFastifyResponse} from "../services/PlatformFastifyResponse"; @@ -33,12 +32,8 @@ declare global { * @platform * @fastify */ -export class PlatformFastify implements PlatformAdapter { +export class PlatformFastify extends PlatformAdapter { readonly providers = [ - { - provide: PlatformApplication, - useClass: PlatformFastifyApplication - }, { provide: PlatformResponse, useClass: PlatformFastifyResponse @@ -46,15 +41,9 @@ export class PlatformFastify implements PlatformAdapter { { provide: PlatformRequest, useClass: PlatformFastifyRequest - }, - { - provide: PlatformHandler, - useClass: PlatformFastifyHandler } ]; - constructor(private injector: InjectorService) {} - /** * Create new serverless application. In this mode, the component scan are disabled. * @param module @@ -79,20 +68,20 @@ export class PlatformFastify implements PlatformAdapter { }); } - onInit() { - // const injector = this.injector; - // const app = this.injector.get(PlatformApplication)!; - // - // const listener: any = (error: any, ctx: F.Context) => { - // injector.get(PlatformExceptions)?.catch(error, ctx.request.$ctx); - // }; - // - // app.getApp().silent = true; - // app.getApp().on("error", listener); - } + // onInit() { + // const injector = this.injector; + // const app = this.injector.get(PlatformApplication)!; + // + // const listener: any = (error: any, ctx: F.Context) => { + // injector.get(PlatformExceptions)?.catch(error, ctx.request.$ctx); + // }; + // + // app.getApp().silent = true; + // app.getApp().on("error", listener); + // } mapLayers(layers: PlatformLayer[]) { - const app = this.getPlatformApplication(); + const {app} = this; const rawApp: FastifyInstance = app.getApp(); layers.forEach((layer) => { @@ -105,22 +94,26 @@ export class PlatformFastify implements PlatformAdapter { rawApp.route({ method: layer.method, url: layer.path, - handler: layer.handler + handler: async (req, reply) => { + for (const handler of layer.handlers) { + if (!reply.sent) { + await handler(req, reply); + } + } + } }); }); } mapHandler(handler: Function, metadata: PlatformHandlerMetadata) { - // if (metadata.isRawMiddleware()) { - // return handler; - // } - // - // return async (koaContext: Koa.Context, next: Koa.Next) => { - // const {$ctx} = koaContext.request; - // $ctx.next = next; - // - // await handler($ctx); - // }; + if (metadata.isRawMiddleware()) { + return handler; + } + + return (request: FastifyRequest, reply: FastifyReply) => { + const {$ctx} = request; + return runInContext(req.$ctx, () => handler($ctx)); + }; } useRouter(): this { @@ -135,23 +128,21 @@ export class PlatformFastify implements PlatformAdapter { } useContext(): this { - const app = this.getPlatformApplication(); + const {app} = this; const invoke = createContext(this.injector); this.injector.logger.debug("Mount app context"); - app.addHook("onRequest", async (request: FastifyRequest, reply: FastifyReply) => { + app.rawApp.addHook("onRequest", async (request, reply) => { const $ctx = invoke({ request: request, response: reply }); await $ctx.start(); - - return runInContext($ctx, next); }); - app.addHook("onResponse", async () => { + app.rawApp.addHook("onResponse", async () => { const $ctx = PlatformContext.get(); await $ctx.finish(); }); @@ -159,20 +150,44 @@ export class PlatformFastify implements PlatformAdapter { return this; } - app() { + createApp() { const {app, ...props} = this.injector.settings.get("fastify") || {}; - const app: FastifyInstance = app || Fastify(); - app.register(middie); + const httpPort = this.injector.settings.get("httpPort"); + const httpOptions = this.injector.settings.get("httpOptions"); + const httpsPort = settings.get("httpsPort"); + const httpsOptions = settings.get("httpsOptions"); + + const instance: FastifyInstance = + app || + Fastify({ + ...props, + http: + httpPort !== false + ? { + ...httpOptions + } + : null, + https: + httpsPort !== false + ? { + ...httpsOptions + } + : null + }); + + instance.decorateRequest("$ctx", null); + instance.decorateRequest("id", null); + instance.decorateReply("locals", null); - app.get("/test", (req, res) => {}); + instance.register(middie); - app.addHook("onError", (request, reply, error) => { + instance.addHook("onError", (request, reply, error) => { this.injector.get(PlatformExceptions)?.catch(error, ctx.request.$ctx); }); return { - app, - callback: () => app + app: instance, + callback: () => () => instance }; } @@ -184,6 +199,26 @@ export class PlatformFastify implements PlatformAdapter { // return staticsMiddleware(options); } + getServers(): any[] { + const httpsPort = this.injector.settings.get("httpsPort"); + const httpPort = this.injector.settings.get("httpPort"); + + return [ + createServer(this.injector, { + port: httpsPort, + type: "https", + token: Https.Server, + server: () => this.app.getApp().server + }), + createServer(this.injector, { + port: httpsPort ? null : httpPort, + type: "http", + token: Http.Server, + server: () => this.app.getApp().server + }) + ]; + } + // bodyParser(type: "json" | "urlencoded" | "raw" | "text", additionalOptions: any = {}): any { // // const opts = this.injector.settings.get(`koa.bodyParser`); // // let parser: any = koaBodyParser; diff --git a/packages/platform/platform-fastify/src/index.ts b/packages/platform/platform-fastify/src/index.ts index 7a79f2e959b..5695988ae29 100644 --- a/packages/platform/platform-fastify/src/index.ts +++ b/packages/platform/platform-fastify/src/index.ts @@ -4,16 +4,7 @@ export * from "./exports"; export * from "./components/PlatformFastify"; -export * from "./decorators/caseSensitive"; -export * from "./decorators/ctx"; -export * from "./decorators/routerSettings"; -export * from "./decorators/state"; -export * from "./decorators/strict"; export * from "./interfaces/PlatformFastifySettings"; export * from "./interfaces/interfaces"; -export * from "./middlewares/resourceNotFoundMiddleware"; -export * from "./middlewares/staticsMiddleware"; -export * from "./services/PlatformFastifyHandler"; export * from "./services/PlatformFastifyRequest"; export * from "./services/PlatformFastifyResponse"; -export * from "./utils/multer"; diff --git a/packages/platform/platform-fastify/src/services/PlatformFastifyRequest.spec.ts b/packages/platform/platform-fastify/src/services/PlatformFastifyRequest.spec.ts index b9cfba02d9a..07d1c02e18b 100644 --- a/packages/platform/platform-fastify/src/services/PlatformFastifyRequest.spec.ts +++ b/packages/platform/platform-fastify/src/services/PlatformFastifyRequest.spec.ts @@ -1,29 +1,12 @@ import {PlatformTest} from "@tsed/common"; -import {PlatformFastifyRequest} from "../.."; import {expect} from "chai"; +import {PlatformFastifyRequest} from "./PlatformFastifyRequest"; function createRequest() { const request = PlatformTest.createRequest(); - // const fastifyCtx = { - // request: { - // protocol: "http", - // req: request - // }, - // cookie: { - // test: "test" - // }, - // cookies: { - // test: "test" - // }, - // session: { - // test: "test" - // } - // }; - // request.ctx = koaCtx; const ctx = PlatformTest.createRequestContext({ event: { request - // ctx: koaCtx }, RequestKlass: PlatformFastifyRequest }); @@ -34,6 +17,7 @@ function createRequest() { describe("PlatformFastifyRequest", () => { beforeEach(() => PlatformTest.create()); afterEach(() => PlatformTest.reset()); + it("should create a PlatformRequest instance", () => { const {req, request} = createRequest(); @@ -41,66 +25,28 @@ describe("PlatformFastifyRequest", () => { }); describe("secure", () => { - it("should get cookies from cookie", () => { + it("should get secure info", () => { const {req, request} = createRequest(); - req.ctx.request.secure = true; + req.protocol = "https"; expect(request.secure).to.deep.eq(true); }); }); - describe("protocol()", () => { - it("should return the protocol request state (http)", () => { - const {req, request} = createRequest(); - - req.ctx.request.protocol = "http"; - - expect(request.protocol).to.equal("http"); - }); - it("should return the protocol request state (https)", () => { - const {req, request} = createRequest(); - - req.ctx.request.protocol = "https"; - - expect(request.protocol).to.equal("https"); - }); - }); - describe("host()", () => { it("should return the host", () => { const {req, request} = createRequest(); - req.ctx.request.host = "host"; + req.hostname = "host"; expect(request.host).to.equal("host"); }); }); - describe("cookies", () => { - it("should get cookies from cookies", () => { - const {req, request} = createRequest(); - - req.ctx.cookie = null; - - expect(request.cookies).to.deep.eq({test: "test"}); - }); - it("should get cookies from cookie", () => { - const {request} = createRequest(); - - expect(request.cookies).to.deep.eq({test: "test"}); - }); - }); - describe("session", () => { - it("should get session", () => { - const {req, request} = createRequest(); - - expect(request.session).to.deep.eq({test: "test"}); - }); - }); describe("getReq()", () => { it("should return nodejs request", () => { const {req, request} = createRequest(); - req.req = {}; + req.raw = {}; expect(request.getReq()).to.deep.eq({}); }); diff --git a/packages/platform/platform-fastify/src/services/PlatformFastifyRequest.ts b/packages/platform/platform-fastify/src/services/PlatformFastifyRequest.ts index ff2c86224d2..a2115abd8a0 100644 --- a/packages/platform/platform-fastify/src/services/PlatformFastifyRequest.ts +++ b/packages/platform/platform-fastify/src/services/PlatformFastifyRequest.ts @@ -20,24 +20,12 @@ declare global { * @fastify */ export class PlatformFastifyRequest extends PlatformRequest { - get protocol(): string { - // return this.#ctx.request.protocol; - } - get host(): string { - // return this.#ctx.request.host; + return this.raw.hostname; } get secure(): boolean { - // return this.#ctx.request.secure; - } - - get cookies(): {[p: string]: any} { - // return this.#ctx.cookie || this.#ctx.cookies; - } - - get session(): any { - // return this.#ctx.session; + return this.protocol === "https"; } getReq(): IncomingMessage { diff --git a/packages/platform/platform-fastify/src/services/PlatformFastifyResponse.spec.ts b/packages/platform/platform-fastify/src/services/PlatformFastifyResponse.spec.ts index caf2a7b56c9..06a9084a706 100644 --- a/packages/platform/platform-fastify/src/services/PlatformFastifyResponse.spec.ts +++ b/packages/platform/platform-fastify/src/services/PlatformFastifyResponse.spec.ts @@ -1,12 +1,11 @@ import {PlatformTest} from "@tsed/common"; -import {expect} from "chai"; -import Sinon from "sinon"; import {PlatformFastifyResponse} from "./PlatformFastifyResponse"; -const sandbox = Sinon.createSandbox(); - function createResponse() { const response = PlatformTest.createResponse(); + response.code = response.status; + response.type = response.contentType; + response.header = response.set; const ctx = PlatformTest.createRequestContext({ event: { @@ -21,20 +20,21 @@ function createResponse() { describe("PlatformFastifyResponse", () => { beforeEach(() => PlatformTest.create()); afterEach(() => PlatformTest.reset()); + it("should create a PlatformResponse instance", () => { const {res, response} = createResponse(); - expect(response.raw).to.eq(res); + expect(response.raw).toEqual(res); }); describe("getRes()", () => { it("return res", async () => { const {res, response} = createResponse(); - res.res = {}; + res.raw = {}; const result = await response.getRes(); - expect(result).to.eq(res.res); + expect(result).toEqual(res.raw); }); }); describe("statusCode", () => { @@ -43,19 +43,7 @@ describe("PlatformFastifyResponse", () => { response.status(302); - expect(response.statusCode).to.eq(302); - }); - }); - describe("hasStatus", () => { - it("return hasStatus", () => { - const {response} = createResponse(); - - response.status(404); - expect(response.statusCode).to.eq(404); - expect(response.hasStatus()).to.eq(false); - - response.status(201); - expect(response.hasStatus()).to.eq(true); + expect(response.statusCode).toEqual(302); }); }); describe("contentType()", () => { @@ -64,7 +52,7 @@ describe("PlatformFastifyResponse", () => { response.contentType("text/html"); - expect(res.type).to.equal("text/html"); + expect(res.headers).toEqual({"content-type": "text/html", "x-request-id": "id"}); }); }); describe("body()", () => { @@ -73,7 +61,17 @@ describe("PlatformFastifyResponse", () => { response.body("body"); - expect(res.body).to.equal("body"); + expect(res.data).toEqual("body"); + }); + }); + + describe("stream()", () => { + it("should set body", () => { + const {res, response} = createResponse(); + + response.stream("body"); + + expect(res.data).toEqual("body"); }); }); describe("location", () => { @@ -82,7 +80,7 @@ describe("PlatformFastifyResponse", () => { response.location("https://location"); - expect(res.headers).to.deep.eq({ + expect(res.headers).toEqual({ location: "https://location", "x-request-id": "id" }); @@ -95,7 +93,7 @@ describe("PlatformFastifyResponse", () => { await response.location("back"); - expect(res.headers).to.deep.eq({ + expect(res.headers).toEqual({ location: "https://location/back", "x-request-id": "id" }); @@ -106,59 +104,10 @@ describe("PlatformFastifyResponse", () => { await response.location("back"); - expect(res.headers).to.deep.eq({ + expect(res.headers).toEqual({ location: "/", "x-request-id": "id" }); }); }); - describe("redirect", () => { - it("should set header location (HEAD)", async () => { - const {res, response} = createResponse(); - - res.headers["location"] = "https://location"; - response.request.raw.method = "HEAD"; - res.res = {end: sandbox.stub()}; - - await response.redirect(301, "https://location"); - - expect(res.body).to.equal("Moved Permanently. Redirecting to https://location"); - expect(response.statusCode).to.equal(301); - expect(res.headers).to.deep.eq({ - "content-length": 50, - location: "https://location", - "x-request-id": "id" - }); - expect(res.res.end).to.have.been.calledWithExactly(); - }); - it("should set header location (POST)", async () => { - const {res, response} = createResponse(); - - res.headers["location"] = "https://location"; - response.request.raw.method = "POST"; - res.res = {end: sandbox.stub()}; - - await response.redirect(301, "https://location"); - - expect(res.body).to.equal("Moved Permanently. Redirecting to https://location"); - expect(response.statusCode).to.equal(301); - expect(res.headers).to.deep.eq({ - "content-length": 50, - location: "https://location", - "x-request-id": "id" - }); - expect(res.res.end).to.have.been.calledWithExactly("Moved Permanently. Redirecting to https://location"); - }); - }); - describe("getHeaders()", () => { - it("should get headers", () => { - const {res, response} = createResponse(); - - res.headers = {contentType: "application/json"}; - - const result = response.getHeaders(); - - expect(result).to.deep.eq({contentType: "application/json"}); - }); - }); }); diff --git a/packages/platform/platform-fastify/src/services/PlatformFastifyResponse.ts b/packages/platform/platform-fastify/src/services/PlatformFastifyResponse.ts index a8d64bce3f9..c5b191e6e17 100644 --- a/packages/platform/platform-fastify/src/services/PlatformFastifyResponse.ts +++ b/packages/platform/platform-fastify/src/services/PlatformFastifyResponse.ts @@ -1,12 +1,13 @@ -import {PlatformResponse} from "@tsed/common"; -import {getStatusMessage} from "@tsed/schema"; +import {PlatformContext, PlatformResponse} from "@tsed/common"; import encodeUrl from "encodeurl"; import {FastifyReply} from "fastify"; import {ServerResponse} from "http"; declare global { namespace TsED { - export interface Response {} + export interface Response extends FastifyReply { + locals: Record; + } } } @@ -14,13 +15,10 @@ declare global { * @platform * @fastify */ -export class PlatformFastifyResponse extends PlatformResponse { - get statusCode() { - // return this.raw.status; - } - - get locals() { - // return this.#ctx.state; +export class PlatformFastifyResponse extends PlatformResponse { + constructor(readonly $ctx: PlatformContext) { + super(); + this.raw.locals = {}; } /** @@ -30,17 +28,13 @@ export class PlatformFastifyResponse extends PlatformResponse { return this.raw.raw; } - // hasStatus() { - // return this.statusCode !== 404; - // } - /** * Sets the HTTP status for the response. * * @param status */ status(status: number) { - this.raw.status = status; + this.raw.code(status); return this; } @@ -58,13 +52,19 @@ export class PlatformFastifyResponse extends PlatformResponse { * res.type('png'); */ contentType(contentType: string) { - this.raw.type = contentType; + this.raw.type(contentType); return this; } - getHeaders() { - return this.raw.headers; + setHeader(key: string, item: any) { + if (key.toLowerCase() === "location") { + return this.location(String(item)); + } + + this.raw.header(key, item); + + return this; } /** @@ -76,29 +76,13 @@ export class PlatformFastifyResponse extends PlatformResponse { * @param data */ body(data: any): this { - this.raw.body = data; + this.raw.send(data); return this; } - getBody(): any { - return this.raw.body; - } - - redirect(status: number, url: string): this { - status = status || 302; - // Set location header - url = this.location(url).raw.get("Location"); - - this.body(`${getStatusMessage(status)}. Redirecting to ${url}`); - this.status(status); - this.setHeader("Content-Length", Buffer.byteLength(this.raw.body as any)); - - if (this.request.method === "HEAD") { - this.getRes().end(); - } else { - this.getRes().end(this.getBody()); - } + stream(data: any) { + this.raw.send(data); return this; } @@ -110,7 +94,7 @@ export class PlatformFastifyResponse extends PlatformResponse { } // set location - this.raw.set("Location", encodeUrl(location)); + this.raw.header("Location", encodeUrl(location)); return this; } diff --git a/packages/platform/platform-fastify/test/platform-fastify.spec.ts b/packages/platform/platform-fastify/test/platform-fastify.spec.ts index 8ffd7f57e3a..0d515f02378 100644 --- a/packages/platform/platform-fastify/test/platform-fastify.spec.ts +++ b/packages/platform/platform-fastify/test/platform-fastify.spec.ts @@ -1,8 +1,8 @@ -import {PlatformTestUtils} from "@tsed/platform-test-utils"; +import {PlatformTestSdk} from "@tsed/platform-test-sdk"; import {PlatformFastify} from "../src"; import {rootDir, Server} from "./app/Server"; -const utils = PlatformTestUtils.create({ +const utils = PlatformTestSdk.create({ rootDir, platform: PlatformFastify, server: Server diff --git a/yarn.lock b/yarn.lock index 9281ccdbf36..3b53abdface 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3703,6 +3703,13 @@ resolved "https://registry.yarnpkg.com/@jsdevtools/ono/-/ono-7.1.3.tgz#9df03bbd7c696a5c58885c34aa06da41c8543796" integrity sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg== +"@koa/cors@3.3.0", "@koa/cors@^3.1.0": + version "3.3.0" + resolved "https://registry.yarnpkg.com/@koa/cors/-/cors-3.3.0.tgz#b4c1c7ee303b7c968c8727f2a638a74675b50bb2" + integrity sha512-lzlkqLlL5Ond8jb6JLnVVDmD2OPym0r5kvZlMgAWiS9xle+Q5ulw1T358oW+RVguxUkANquZQz82i/STIRmsqQ== + dependencies: + vary "^1.1.2" + "@koa/cors@5.0.0": version "5.0.0" resolved "https://registry.yarnpkg.com/@koa/cors/-/cors-5.0.0.tgz#0029b5f057fa0d0ae0e37dd2c89ece315a0daffd" @@ -3710,13 +3717,6 @@ dependencies: vary "^1.1.2" -"@koa/cors@^3.1.0": - version "3.3.0" - resolved "https://registry.yarnpkg.com/@koa/cors/-/cors-3.3.0.tgz#b4c1c7ee303b7c968c8727f2a638a74675b50bb2" - integrity sha512-lzlkqLlL5Ond8jb6JLnVVDmD2OPym0r5kvZlMgAWiS9xle+Q5ulw1T358oW+RVguxUkANquZQz82i/STIRmsqQ== - dependencies: - vary "^1.1.2" - "@koa/cors@^4.0.0": version "4.0.0" resolved "https://registry.yarnpkg.com/@koa/cors/-/cors-4.0.0.tgz#b2d300d7368d2e0ad6faa1d918eff6d0cde0859a"