@conduitplatform/module-tools 0.17.0-alpha.3 → 0.17.0-alpha.6
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/dist/index.cjs +17 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.esm.js +17 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/module.proto +2 -0
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -302,7 +302,7 @@ function throwError(callback, message, code = import_grpc_js2.status.INTERNAL) {
|
|
|
302
302
|
}
|
|
303
303
|
|
|
304
304
|
// src/helpers/GrpcToParsedRouterRequest.ts
|
|
305
|
-
function createParsedRouterRequest(params, urlParams, queryParams, bodyParams, path4, headers, context, cookies) {
|
|
305
|
+
function createParsedRouterRequest(params, urlParams, queryParams, bodyParams, path4, headers, context, cookies, rawHeaders, rawBody) {
|
|
306
306
|
return {
|
|
307
307
|
request: {
|
|
308
308
|
params,
|
|
@@ -311,6 +311,8 @@ function createParsedRouterRequest(params, urlParams, queryParams, bodyParams, p
|
|
|
311
311
|
bodyParams: bodyParams ?? {},
|
|
312
312
|
path: path4 ?? "",
|
|
313
313
|
headers,
|
|
314
|
+
rawHeaders: rawHeaders ?? [],
|
|
315
|
+
rawBody: rawBody ?? Buffer.alloc(0),
|
|
314
316
|
context: context ?? {},
|
|
315
317
|
cookies: cookies ?? {}
|
|
316
318
|
}
|
|
@@ -515,6 +517,14 @@ var RouteBuilder = class {
|
|
|
515
517
|
this._options.rateLimit = { maxRequests, resetInterval };
|
|
516
518
|
return this;
|
|
517
519
|
}
|
|
520
|
+
captureRawBody(capture) {
|
|
521
|
+
this._options.captureRawBody = capture;
|
|
522
|
+
return this;
|
|
523
|
+
}
|
|
524
|
+
captureRawHeaders(capture) {
|
|
525
|
+
this._options.captureRawHeaders = capture;
|
|
526
|
+
return this;
|
|
527
|
+
}
|
|
518
528
|
return(name, fields) {
|
|
519
529
|
this._returns = new import_grpc_sdk5.ConduitRouteReturnDefinition(name, fields);
|
|
520
530
|
return this;
|
|
@@ -664,6 +674,12 @@ function wrapRouterGrpcFunction(fun, routerType) {
|
|
|
664
674
|
routerRequest = !call.request.hasOwnProperty("event");
|
|
665
675
|
if (routerRequest) {
|
|
666
676
|
call.request.headers = parseRequestData(call.request.headers);
|
|
677
|
+
call.request.rawHeaders = call.request.rawHeaders ? JSON.parse(call.request.rawHeaders) : [];
|
|
678
|
+
if (call.request.rawBody && !Buffer.isBuffer(call.request.rawBody)) {
|
|
679
|
+
call.request.rawBody = Buffer.from(call.request.rawBody);
|
|
680
|
+
} else if (!call.request.rawBody) {
|
|
681
|
+
call.request.rawBody = Buffer.alloc(0);
|
|
682
|
+
}
|
|
667
683
|
}
|
|
668
684
|
} catch (e) {
|
|
669
685
|
import_grpc_sdk6.ConduitGrpcSdk.Metrics?.increment(`${routerType}_grpc_errors_total`);
|