@akanjs/nest 0.9.48 → 0.9.50

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.
@@ -67,16 +67,15 @@ let CacheInterceptor = class {
67
67
  __privateAdd(this, _CACHE_PREFIX, "signal:");
68
68
  }
69
69
  async intercept(context, next) {
70
- const handler = context.getHandler();
71
- const signalKey = handler.name;
72
- const gqlMeta = (0, import_signal.getGqlMeta)(context.getClass(), signalKey);
70
+ const key = import_signal.signalInfo.getHandlerKey(context.getHandler());
71
+ const gqlMeta = (0, import_signal.getGqlMeta)(context.getClass(), key);
73
72
  if (gqlMeta.type !== "Query" || !gqlMeta.signalOption.cache) {
74
73
  if (gqlMeta.signalOption.cache)
75
- __privateGet(this, _logger).warn(`CacheInterceptor: ${signalKey} is not Query endpoint or cache is not set`);
74
+ __privateGet(this, _logger).warn(`CacheInterceptor: ${key} is not Query endpoint or cache is not set`);
76
75
  return next.handle();
77
76
  }
78
77
  const args = (0, import_authGuards.getArgs)(context);
79
- const cacheKey = __privateMethod(this, _generateCacheKey, generateCacheKey_fn).call(this, signalKey, args);
78
+ const cacheKey = __privateMethod(this, _generateCacheKey, generateCacheKey_fn).call(this, key, args);
80
79
  const cachedData = await __privateMethod(this, _getCache, getCache_fn).call(this, cacheKey);
81
80
  if (cachedData) {
82
81
  __privateGet(this, _logger).debug(`Cache hit for key: ${cacheKey}`);
@@ -142,7 +141,8 @@ CacheInterceptor = __decorateClass([
142
141
  ], CacheInterceptor);
143
142
  let TimeoutInterceptor = class {
144
143
  intercept(context, next) {
145
- const gqlMeta = (0, import_signal.getGqlMeta)(context.getClass(), context.getHandler().name);
144
+ const key = import_signal.signalInfo.getHandlerKey(context.getHandler());
145
+ const gqlMeta = (0, import_signal.getGqlMeta)(context.getClass(), key);
146
146
  const timeoutMs = gqlMeta.signalOption.timeout ?? 3e4;
147
147
  if (timeoutMs === 0)
148
148
  return next.handle();
package/cjs/src/pipes.js CHANGED
@@ -38,7 +38,7 @@ __export(pipes_exports, {
38
38
  });
39
39
  module.exports = __toCommonJS(pipes_exports);
40
40
  var import_base = require("@akanjs/base");
41
- var import_signal = require("@akanjs/signal");
41
+ var import_constant = require("@akanjs/constant");
42
42
  var import_common = require("@nestjs/common");
43
43
  var import_stream = require("stream");
44
44
  let ArrayifyPipe = class {
@@ -125,7 +125,8 @@ const getBodyPipes = (argMeta) => {
125
125
  return [];
126
126
  let BodyPipe = class {
127
127
  transform(value, metadata) {
128
- return (0, import_signal.deserializeArg)(argMeta, value);
128
+ const [argRef, arrDepth] = (0, import_base.getNonArrayModel)(argMeta.returns());
129
+ return (0, import_constant.deserializeArg)(argRef, arrDepth, value, argMeta.argsOption);
129
130
  }
130
131
  };
131
132
  BodyPipe = __decorateClass([
@@ -29,7 +29,7 @@ var __privateMethod = (obj, member, method) => {
29
29
  };
30
30
  var _logger, _CACHE_PREFIX, _generateCacheKey, generateCacheKey_fn, _getCache, getCache_fn, _setCache, setCache_fn;
31
31
  import { Logger } from "@akanjs/common";
32
- import { getGqlMeta } from "@akanjs/signal";
32
+ import { getGqlMeta, signalInfo } from "@akanjs/signal";
33
33
  import {
34
34
  Inject,
35
35
  Injectable,
@@ -49,16 +49,15 @@ let CacheInterceptor = class {
49
49
  __privateAdd(this, _CACHE_PREFIX, "signal:");
50
50
  }
51
51
  async intercept(context, next) {
52
- const handler = context.getHandler();
53
- const signalKey = handler.name;
54
- const gqlMeta = getGqlMeta(context.getClass(), signalKey);
52
+ const key = signalInfo.getHandlerKey(context.getHandler());
53
+ const gqlMeta = getGqlMeta(context.getClass(), key);
55
54
  if (gqlMeta.type !== "Query" || !gqlMeta.signalOption.cache) {
56
55
  if (gqlMeta.signalOption.cache)
57
- __privateGet(this, _logger).warn(`CacheInterceptor: ${signalKey} is not Query endpoint or cache is not set`);
56
+ __privateGet(this, _logger).warn(`CacheInterceptor: ${key} is not Query endpoint or cache is not set`);
58
57
  return next.handle();
59
58
  }
60
59
  const args = getArgs(context);
61
- const cacheKey = __privateMethod(this, _generateCacheKey, generateCacheKey_fn).call(this, signalKey, args);
60
+ const cacheKey = __privateMethod(this, _generateCacheKey, generateCacheKey_fn).call(this, key, args);
62
61
  const cachedData = await __privateMethod(this, _getCache, getCache_fn).call(this, cacheKey);
63
62
  if (cachedData) {
64
63
  __privateGet(this, _logger).debug(`Cache hit for key: ${cacheKey}`);
@@ -124,7 +123,8 @@ CacheInterceptor = __decorateClass([
124
123
  ], CacheInterceptor);
125
124
  let TimeoutInterceptor = class {
126
125
  intercept(context, next) {
127
- const gqlMeta = getGqlMeta(context.getClass(), context.getHandler().name);
126
+ const key = signalInfo.getHandlerKey(context.getHandler());
127
+ const gqlMeta = getGqlMeta(context.getClass(), key);
128
128
  const timeoutMs = gqlMeta.signalOption.timeout ?? 3e4;
129
129
  if (timeoutMs === 0)
130
130
  return next.handle();
package/esm/src/pipes.js CHANGED
@@ -10,7 +10,7 @@ var __decorateClass = (decorators, target, key, kind) => {
10
10
  return result;
11
11
  };
12
12
  import { dayjs, Float, getNonArrayModel, Int, isGqlScalar, JSON as GqlJSON } from "@akanjs/base";
13
- import { deserializeArg } from "@akanjs/signal";
13
+ import { deserializeArg } from "@akanjs/constant";
14
14
  import { Injectable } from "@nestjs/common";
15
15
  import { Readable } from "stream";
16
16
  let ArrayifyPipe = class {
@@ -97,7 +97,8 @@ const getBodyPipes = (argMeta) => {
97
97
  return [];
98
98
  let BodyPipe = class {
99
99
  transform(value, metadata) {
100
- return deserializeArg(argMeta, value);
100
+ const [argRef, arrDepth] = getNonArrayModel(argMeta.returns());
101
+ return deserializeArg(argRef, arrDepth, value, argMeta.argsOption);
101
102
  }
102
103
  };
103
104
  BodyPipe = __decorateClass([
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akanjs/nest",
3
- "version": "0.9.48",
3
+ "version": "0.9.50",
4
4
  "sourceType": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"