@conduitplatform/module-tools 0.17.0-alpha.2 → 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 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
  }
@@ -454,6 +456,7 @@ var RouteBuilder = class {
454
456
  this.manager = manager;
455
457
  this._options = {};
456
458
  }
459
+ manager;
457
460
  _options;
458
461
  _returns;
459
462
  _handler;
@@ -514,6 +517,14 @@ var RouteBuilder = class {
514
517
  this._options.rateLimit = { maxRequests, resetInterval };
515
518
  return this;
516
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
+ }
517
528
  return(name, fields) {
518
529
  this._returns = new import_grpc_sdk5.ConduitRouteReturnDefinition(name, fields);
519
530
  return this;
@@ -663,6 +674,12 @@ function wrapRouterGrpcFunction(fun, routerType) {
663
674
  routerRequest = !call.request.hasOwnProperty("event");
664
675
  if (routerRequest) {
665
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
+ }
666
683
  }
667
684
  } catch (e) {
668
685
  import_grpc_sdk6.ConduitGrpcSdk.Metrics?.increment(`${routerType}_grpc_errors_total`);
@@ -733,6 +750,8 @@ var RoutingManager = class _RoutingManager {
733
750
  this.isAdmin = true;
734
751
  }
735
752
  }
753
+ _router;
754
+ _server;
736
755
  _moduleRoutes = {};
737
756
  static ClientController;
738
757
  static AdminController;