@silenteer/natsu-port-server
Advanced tools
Comparing version 0.0.35 to 0.0.36
@@ -0,3 +1,9 @@ | ||
import type { FastifyRequest } from 'fastify'; | ||
import 'colors'; | ||
declare function start(): void; | ||
export declare type CustomFastifyRequest = FastifyRequest & { | ||
parts: () => any; | ||
}; | ||
declare function start(options?: { | ||
onBeforeSendNatsRequest?: (request: CustomFastifyRequest) => Promise<void>; | ||
}): void; | ||
declare const _default: { | ||
@@ -4,0 +10,0 @@ start: typeof start; |
@@ -9,2 +9,3 @@ "use strict"; | ||
const fastify_cors_1 = (0, tslib_1.__importDefault)(require("fastify-cors")); | ||
const fastify_multipart_1 = (0, tslib_1.__importDefault)(require("fastify-multipart")); | ||
const fastify_websocket_1 = (0, tslib_1.__importDefault)(require("fastify-websocket")); | ||
@@ -21,3 +22,3 @@ require("colors"); | ||
.trim() | ||
.test((value) => value === 'application/json'), | ||
.test((value) => value === 'application/json' || value.includes('multipart/form-data')), | ||
}); | ||
@@ -32,3 +33,4 @@ const wsRequestSchema = yup.object({ | ||
const responseCodec = (0, nats_1.JSONCodec)(); | ||
function start() { | ||
const multipartOptions = {}; | ||
function start(options) { | ||
(0, fastify_1.default)() | ||
@@ -40,2 +42,3 @@ .register(fastify_cors_1.default, { | ||
}) | ||
.register(fastify_multipart_1.default, multipartOptions) | ||
.register(fastify_websocket_1.default) | ||
@@ -68,2 +71,5 @@ .post(configuration_1.default.httpPath, (request, reply) => (0, tslib_1.__awaiter)(this, void 0, void 0, function* () { | ||
logger_1.default.log(`----- [${subject}]Begin send nats request -----`); | ||
if (options === null || options === void 0 ? void 0 : options.onBeforeSendNatsRequest) { | ||
yield options.onBeforeSendNatsRequest(request); | ||
} | ||
const { headers, response } = yield sendNatsRequest({ | ||
@@ -70,0 +76,0 @@ httpRequest: request, |
{ | ||
"name": "@silenteer/natsu-port-server", | ||
"version": "0.0.35", | ||
"version": "0.0.36", | ||
"license": "MIT", | ||
@@ -31,2 +31,3 @@ "private": false, | ||
"fastify-cors": "6.0.2", | ||
"fastify-multipart": "5.4.0", | ||
"fastify-websocket": "4.0.0", | ||
@@ -33,0 +34,0 @@ "nats": "2.6.1", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
49865
763
12
+ Addedfastify-multipart@5.4.0
+ Added@fastify/busboy@1.2.1(transitive)
+ Addedend-of-stream@1.4.4(transitive)
+ Addedfastify-multipart@5.3.15.4.0(transitive)
+ Addedhexoid@1.0.0(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedstream-wormhole@1.1.0(transitive)
+ Addedtext-decoding@1.0.0(transitive)
+ Addedwrappy@1.0.2(transitive)