@stuntman/server 0.1.0 → 0.1.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/src/storage.ts DELETED
@@ -1,39 +0,0 @@
1
- import LRUCache from 'lru-cache';
2
- import type * as Stuntman from '@stuntman/shared';
3
- import sizeof from 'object-sizeof';
4
-
5
- const DNS_CACHE_OPTIONS: LRUCache.Options<string, string> = {
6
- max: 1000,
7
- ttl: 1000 * 60 * 15,
8
- allowStale: false,
9
- updateAgeOnGet: false,
10
- updateAgeOnHas: false,
11
- };
12
-
13
- const trafficStoreInstances: Record<string, LRUCache<string, Stuntman.LogEntry>> = {};
14
- const dnsResolutionCacheInstances: Record<string, LRUCache<string, string>> = {};
15
-
16
- export const getTrafficStore = (key: string, options?: Stuntman.StorageConfig) => {
17
- if (!(key in trafficStoreInstances)) {
18
- if (!options) {
19
- throw new Error('initialize with options first');
20
- }
21
- trafficStoreInstances[key] = new LRUCache<string, Stuntman.LogEntry>({
22
- max: options.limitCount,
23
- maxSize: options.limitSize,
24
- ttl: options.ttl,
25
- allowStale: false,
26
- updateAgeOnGet: false,
27
- updateAgeOnHas: false,
28
- sizeCalculation: (value) => sizeof(value),
29
- });
30
- }
31
- return trafficStoreInstances[key];
32
- };
33
-
34
- export const getDnsResolutionCache = (key: string) => {
35
- if (!(key in dnsResolutionCacheInstances)) {
36
- dnsResolutionCacheInstances[key] = new LRUCache<string, string>(DNS_CACHE_OPTIONS);
37
- }
38
- return dnsResolutionCacheInstances[key];
39
- };
package/tsconfig.json DELETED
@@ -1,16 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2018",
4
- "module": "commonjs",
5
- "rootDir": "src",
6
- "declaration": true,
7
- "outDir": "dist",
8
- "esModuleInterop": true,
9
- "forceConsistentCasingInFileNames": true,
10
- "strict": true,
11
- "skipLibCheck": true,
12
- "typeRoots": ["node_modules/@types"],
13
- "allowJs": true,
14
- "moduleResolution": "node16"
15
- }
16
- }