dicoshot-nest 0.2.0 → 0.2.2
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/dicoshot.constants.d.ts +1 -0
- package/dist/dicoshot.constants.js +2 -1
- package/dist/dicoshot.constants.js.map +1 -1
- package/dist/dicoshot.listener.d.ts +3 -2
- package/dist/dicoshot.listener.js +5 -4
- package/dist/dicoshot.listener.js.map +1 -1
- package/dist/dicoshot.module.d.ts +4 -2
- package/dist/dicoshot.module.js +50 -7
- package/dist/dicoshot.module.js.map +1 -1
- package/dist/dicoshot.service.d.ts +14 -0
- package/dist/dicoshot.service.js +47 -0
- package/dist/dicoshot.service.js.map +1 -0
- package/dist/filters/dicoshot-exception.filter.d.ts +13 -0
- package/dist/filters/dicoshot-exception.filter.js +124 -0
- package/dist/filters/dicoshot-exception.filter.js.map +1 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/interceptors/dicoshot.interceptor.d.ts +14 -0
- package/dist/interceptors/dicoshot.interceptor.js +126 -0
- package/dist/interceptors/dicoshot.interceptor.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utils/throttle.util.d.ts +4 -0
- package/dist/utils/throttle.util.js +17 -0
- package/dist/utils/throttle.util.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ThrottleUtil = void 0;
|
|
4
|
+
class ThrottleUtil {
|
|
5
|
+
static cache = new Map();
|
|
6
|
+
static shouldThrottle(key, seconds) {
|
|
7
|
+
const last = this.cache.get(key);
|
|
8
|
+
const now = Date.now();
|
|
9
|
+
if (last !== undefined && now - last < seconds * 1000)
|
|
10
|
+
return true;
|
|
11
|
+
this.cache.set(key, now);
|
|
12
|
+
setTimeout(() => this.cache.delete(key), seconds * 1000).unref();
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.ThrottleUtil = ThrottleUtil;
|
|
17
|
+
//# sourceMappingURL=throttle.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"throttle.util.js","sourceRoot":"","sources":["../../src/utils/throttle.util.ts"],"names":[],"mappings":";;;AAAA,MAAa,YAAY;IACf,MAAM,CAAU,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAC;IAE1D,MAAM,CAAC,cAAc,CAAC,GAAW,EAAE,OAAe;QAChD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACjC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,IAAI,IAAI,KAAK,SAAS,IAAI,GAAG,GAAG,IAAI,GAAG,OAAO,GAAG,IAAI;YAAE,OAAO,IAAI,CAAC;QACnE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAEzB,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC;QACjE,OAAO,KAAK,CAAC;IACf,CAAC;;AAXH,oCAYC"}
|