@open-norantec/herbal 1.0.2-alpha.35 → 1.0.2-alpha.36

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/core.d.ts CHANGED
@@ -43,6 +43,7 @@ declare class MethodConfig<IS extends z.Schema<any>, OS extends z.Schema<any>, C
43
43
  declare class MethodPool {
44
44
  protected readonly methods: Map<string, MethodConfig<any, any, any>>;
45
45
  registerMethod<IS extends z.Schema<any>, OS extends z.Schema<any>, C>(name: string, options: MethodRegisterOptions<IS, OS>, callback: MethodCallback<IS, OS, C>): void;
46
+ transactionDisabled(name: string): boolean | undefined;
46
47
  getCallFn(name: string): ((controller: any, callContext: MethodCallContext<any>) => Promise<any>) | null;
47
48
  getAuthAdapters(name: string): Constructor<AuthAdapter>[] | null | undefined;
48
49
  getOpenAPIPathsObject(group?: string): PathsObject;
package/dist/core.js CHANGED
@@ -235,6 +235,14 @@ var MethodPool = (function () {
235
235
  throw new Error("Method name cannot contain slashes: ".concat(name));
236
236
  this.methods.set(name, new MethodConfig(name, options, callback));
237
237
  };
238
+ MethodPool.prototype.transactionDisabled = function (name) {
239
+ var _a, _b;
240
+ if (string_util_class_1.StringUtil.isFalsyString(name))
241
+ return;
242
+ if (name.includes('/'))
243
+ throw new Error("Method name cannot contain slashes: ".concat(name));
244
+ return !!((_b = (_a = this.methods.get(name)) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.disableTransaction);
245
+ };
238
246
  MethodPool.prototype.getCallFn = function (name) {
239
247
  var config = this.methods.get(name);
240
248
  if (!(config instanceof MethodConfig))
@@ -365,7 +373,7 @@ function HerbalGuard(options) {
365
373
  var _a, e_1, _b, _c;
366
374
  var _d, _e, _f, _g, _h, _j, _k, _l, _m;
367
375
  return __awaiter(this, void 0, void 0, function () {
368
- var sequelizeInstance, transaction, request, response, traceId, chunks, _o, request_1, request_1_1, chunk, e_1_1, _p, parsedBody, rawHandlerName, handlerPropertype, handlerName, authAdapters, error_3, _i, authAdapters_1, AuthAdapterClass, adapter, authenticateResult, error_4, _q;
376
+ var sequelizeInstance, transaction, request, response, traceId, chunks, _o, request_1, request_1_1, chunk, e_1_1, _p, parsedBody, rawHandlerName, handlerPropertype, handlerName, methodPool, authAdapters, error_3, _i, authAdapters_1, AuthAdapterClass, adapter, authenticateResult, error_4, _q;
369
377
  var _this = this;
370
378
  return __generator(this, function (_r) {
371
379
  switch (_r.label) {
@@ -435,10 +443,13 @@ function HerbalGuard(options) {
435
443
  rawHandlerName = (_e = (_d = context === null || context === void 0 ? void 0 : context.getHandler) === null || _d === void 0 ? void 0 : _d.call(context)) === null || _e === void 0 ? void 0 : _e.name;
436
444
  handlerPropertype = (_g = (_f = context === null || context === void 0 ? void 0 : context.getClass) === null || _f === void 0 ? void 0 : _f.call(context)) === null || _g === void 0 ? void 0 : _g.prototype;
437
445
  handlerName = string_util_class_1.StringUtil.isFalsyString(request.methodName) ? rawHandlerName : request.methodName;
438
- authAdapters = (_j = (_h = getMethodPool(handlerPropertype)) === null || _h === void 0 ? void 0 : _h.getAuthAdapters) === null || _j === void 0 ? void 0 : _j.call(_h, handlerName);
446
+ methodPool = getMethodPool(handlerPropertype);
447
+ authAdapters = (_h = methodPool === null || methodPool === void 0 ? void 0 : methodPool.getAuthAdapters) === null || _h === void 0 ? void 0 : _h.call(methodPool, handlerName);
439
448
  if (authAdapters === null)
440
449
  authAdapters = auth_adapter_decorator_1.AuthAdapters.getAdapters(handlerPropertype, handlerName);
441
- if (!(!(sequelizeInstance instanceof Error) && !decorators_1.NoTransaction.isDisabled(handlerPropertype, handlerName))) return [3, 20];
450
+ if (!(!(sequelizeInstance instanceof Error) &&
451
+ !decorators_1.NoTransaction.isDisabled(handlerPropertype, rawHandlerName) &&
452
+ !((_j = methodPool === null || methodPool === void 0 ? void 0 : methodPool.transactionDisabled) === null || _j === void 0 ? void 0 : _j.call(methodPool, handlerName)))) return [3, 20];
442
453
  _r.label = 16;
443
454
  case 16:
444
455
  _r.trys.push([16, 18, , 19]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-norantec/herbal",
3
- "version": "1.0.2-alpha.35",
3
+ "version": "1.0.2-alpha.36",
4
4
  "description": "Herbal is a builder and toolchain for Nest.js applications",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {