tricache 0.7.1 → 0.9.0
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/LICENSE +21 -21
- package/README.md +89 -1371
- package/dashboards/prometheus-scrape.yml +18 -0
- package/dashboards/tricache-alerts.yaml +54 -0
- package/dashboards/tricache-grafana.json +548 -0
- package/dist/cache-service-DVvroyqA.d.ts +886 -0
- package/dist/cache-service-KI5ACF3F.js +12 -0
- package/dist/chunk-7RV5ZVBB.js +1023 -0
- package/dist/chunk-BQRURGGD.js +60 -0
- package/dist/chunk-IITRFWHY.js +196 -0
- package/dist/{chunk-X5AXHPVD.js → chunk-LJ5QJB5O.js} +90 -5
- package/dist/{chunk-EUGYR7KR.js → chunk-PL5J3ZNT.js} +3184 -514
- package/dist/chunk-QNU7B43J.js +687 -0
- package/dist/chunk-UGD4VEPD.js +138 -0
- package/dist/chunk-XZL45ABR.js +108 -0
- package/dist/cli.cjs +3122 -495
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +121 -5
- package/dist/dashboard/index.cjs +1065 -0
- package/dist/dashboard/index.d.ts +183 -0
- package/dist/dashboard/index.js +22 -0
- package/dist/drizzle/index.cjs +2846 -494
- package/dist/drizzle/index.d.ts +3 -1
- package/dist/drizzle/index.js +1 -1
- package/dist/edge/index.cjs +1559 -0
- package/dist/edge/index.d.ts +127 -0
- package/dist/edge/index.js +1109 -0
- package/dist/hono/index.cjs +7760 -0
- package/dist/hono/index.d.ts +91 -0
- package/dist/hono/index.js +185 -0
- package/dist/hono-VA9A1m0I.d.ts +371 -0
- package/dist/http/index.cjs +3281 -587
- package/dist/http/index.d.ts +85 -23
- package/dist/http/index.js +176 -78
- package/dist/index.cjs +7212 -2505
- package/dist/index.d.ts +547 -30
- package/dist/index.js +104 -5
- package/dist/murmur3-CMGw9PbV.d.ts +98 -0
- package/dist/nestjs/index.cjs +2787 -487
- package/dist/nestjs/index.d.ts +3 -1
- package/dist/nestjs/index.js +6 -3
- package/dist/next/index.cjs +2804 -501
- package/dist/next/index.d.ts +4 -2
- package/dist/next/index.js +14 -10
- package/dist/prisma/index.d.ts +3 -1
- package/dist/serialize-worker.cjs +5 -4
- package/dist/serialize-worker.js +1 -1
- package/dist/{cache-service-D8tIXmzb.d.ts → types-B_QkVwJ7.d.ts} +622 -662
- package/dist/utils-CEsU_Z0s.d.ts +27 -0
- package/package.json +48 -10
- package/src/adapters/auto-pipeliner.ts +206 -0
- package/src/adapters/node-redis.ts +370 -0
- package/src/cache-service.ts +1619 -415
- package/src/cli.ts +137 -2
- package/src/codec.ts +72 -0
- package/src/cross-region.ts +245 -0
- package/src/dashboard/handler.ts +392 -0
- package/src/dashboard/html.ts +594 -0
- package/src/dashboard/index.ts +195 -0
- package/src/dashboard/types.ts +96 -0
- package/src/disk-tier.ts +449 -47
- package/src/drizzle/index.ts +86 -86
- package/src/edge/adapters/cloudflare-do.ts +130 -0
- package/src/edge/adapters/cloudflare-kv.ts +115 -0
- package/src/edge/adapters/upstash.ts +143 -0
- package/src/edge/cache.ts +797 -0
- package/src/edge/crypto.ts +182 -0
- package/src/edge/hono.ts +284 -0
- package/src/edge/index.ts +37 -0
- package/src/edge/types.ts +230 -0
- package/src/edge/utils/base64.ts +63 -0
- package/src/edge/utils/murmur3.ts +179 -0
- package/src/encryption.ts +127 -5
- package/src/hono/index.ts +316 -0
- package/src/http/express.ts +195 -0
- package/src/http/fastify.ts +260 -0
- package/src/http/index.ts +44 -258
- package/src/http/utils.ts +92 -0
- package/src/index.ts +149 -47
- package/src/ipc-telemetry.ts +509 -0
- package/src/latency-watchdog.ts +282 -0
- package/src/nestjs/decorators.ts +161 -161
- package/src/nestjs/index.ts +23 -23
- package/src/nestjs/tricache.module.ts +104 -104
- package/src/nestjs/tricache.store.ts +97 -97
- package/src/nestjs/types.ts +79 -79
- package/src/next/cache-handler.ts +12 -9
- package/src/next/index.ts +37 -37
- package/src/next/isr-handler.ts +105 -105
- package/src/next/types.ts +130 -130
- package/src/remote-snapshot.ts +153 -0
- package/src/serialize-worker.ts +120 -120
- package/src/sigv4-snapshot-adapter.ts +260 -0
- package/src/smart-memory-cache.ts +91 -8
- package/src/types.ts +315 -2
- package/src/utils/cgroup.ts +100 -0
- package/src/utils/tracing.ts +54 -0
- package/src/wasm/bloom-filter-wasm.ts +109 -102
- package/src/worker-pool.ts +299 -299
- package/src/wtiny-lfu.ts +624 -0
- package/dist/cache-service-5GATUYAK.js +0 -7
- package/dist/chunk-UBSR5UYA.js +0 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
interface KeyDerivationOptions {
|
|
2
|
+
/** Custom key derivation function. Overrides default URL and query string serialization. */
|
|
3
|
+
keyGenerator?: (req: any) => string;
|
|
4
|
+
/** Optional list of header names (case-insensitive) to include in the cache key. */
|
|
5
|
+
headerWhitelist?: string[];
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Generates a deterministic HTTP cache key from request method, URL path, sorted query parameters,
|
|
9
|
+
* and optional whitelisted headers.
|
|
10
|
+
*
|
|
11
|
+
* Example:
|
|
12
|
+
* GET /api/products?sort=desc&page=2
|
|
13
|
+
* GET /api/products?page=2&sort=desc
|
|
14
|
+
* Both map to: http:GET:/api/products?page=2&sort=desc
|
|
15
|
+
*/
|
|
16
|
+
declare function buildDeterministicKey(req: any, options?: KeyDerivationOptions): string;
|
|
17
|
+
/**
|
|
18
|
+
* Checks if request specifies Cache-Control bypass directives (no-cache, no-store)
|
|
19
|
+
* or matches a custom skipCache predicate.
|
|
20
|
+
*/
|
|
21
|
+
declare function shouldSkipCache(req: any, customSkip?: (req: any) => boolean): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Compute a weak ETag (W/"...") from string, Buffer, or JSON-serializable object.
|
|
24
|
+
*/
|
|
25
|
+
declare function generateETag(data: unknown): string;
|
|
26
|
+
|
|
27
|
+
export { type KeyDerivationOptions as K, buildDeterministicKey as b, generateETag as g, shouldSkipCache as s };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tricache",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Three-tier Node.js cache: L1 smart RAM (adaptive LFU/LRU + Count-Min Sketch) → L1.5 NVMe disk spill → L2 Redis/Valkey. Includes AES-256-GCM at-rest encryption, WASM Bloom filter, Stale-While-Revalidate, and thundering-herd prevention.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cache",
|
|
@@ -14,16 +14,23 @@
|
|
|
14
14
|
"stale-while-revalidate",
|
|
15
15
|
"msgpack",
|
|
16
16
|
"aes-256-gcm",
|
|
17
|
+
"envelope-encryption",
|
|
17
18
|
"nextjs",
|
|
19
|
+
"express",
|
|
20
|
+
"fastify",
|
|
21
|
+
"hono",
|
|
22
|
+
"edge",
|
|
23
|
+
"cli",
|
|
18
24
|
"nodejs"
|
|
19
25
|
],
|
|
20
26
|
"license": "MIT",
|
|
21
27
|
"author": "Kareem (https://github.com/Kareem411)",
|
|
22
28
|
"repository": {
|
|
23
29
|
"type": "git",
|
|
24
|
-
"url": "https://github.com/Kareem411/TriCache.git"
|
|
30
|
+
"url": "git+https://github.com/Kareem411/TriCache.git"
|
|
25
31
|
},
|
|
26
32
|
"homepage": "https://github.com/Kareem411/TriCache#readme",
|
|
33
|
+
"sideEffects": false,
|
|
27
34
|
"type": "module",
|
|
28
35
|
"main": "./dist/index.js",
|
|
29
36
|
"module": "./dist/index.js",
|
|
@@ -61,10 +68,29 @@
|
|
|
61
68
|
"types": "./dist/http/index.d.ts",
|
|
62
69
|
"import": "./dist/http/index.js",
|
|
63
70
|
"require": "./dist/http/index.cjs"
|
|
71
|
+
},
|
|
72
|
+
"./hono": {
|
|
73
|
+
"types": "./dist/hono/index.d.ts",
|
|
74
|
+
"import": "./dist/hono/index.js",
|
|
75
|
+
"require": "./dist/hono/index.cjs"
|
|
76
|
+
},
|
|
77
|
+
"./dashboard": {
|
|
78
|
+
"types": "./dist/dashboard/index.d.ts",
|
|
79
|
+
"import": "./dist/dashboard/index.js",
|
|
80
|
+
"require": "./dist/dashboard/index.cjs"
|
|
81
|
+
},
|
|
82
|
+
"./edge": {
|
|
83
|
+
"types": "./dist/edge/index.d.ts",
|
|
84
|
+
"edge-light": "./dist/edge/index.js",
|
|
85
|
+
"workerd": "./dist/edge/index.js",
|
|
86
|
+
"import": "./dist/edge/index.js",
|
|
87
|
+
"require": "./dist/edge/index.cjs",
|
|
88
|
+
"default": "./dist/edge/index.js"
|
|
64
89
|
}
|
|
65
90
|
},
|
|
66
91
|
"files": [
|
|
67
92
|
"bin",
|
|
93
|
+
"dashboards",
|
|
68
94
|
"dist",
|
|
69
95
|
"src",
|
|
70
96
|
"README.md",
|
|
@@ -72,7 +98,8 @@
|
|
|
72
98
|
],
|
|
73
99
|
"peerDependencies": {
|
|
74
100
|
"@nestjs/common": "^10.0.0 || ^11.0.0",
|
|
75
|
-
"@nestjs/core": "^10.0.0 || ^11.0.0"
|
|
101
|
+
"@nestjs/core": "^10.0.0 || ^11.0.0",
|
|
102
|
+
"hono": ">=3.0.0 <5.0.0"
|
|
76
103
|
},
|
|
77
104
|
"peerDependenciesMeta": {
|
|
78
105
|
"@nestjs/common": {
|
|
@@ -80,29 +107,35 @@
|
|
|
80
107
|
},
|
|
81
108
|
"@nestjs/core": {
|
|
82
109
|
"optional": true
|
|
110
|
+
},
|
|
111
|
+
"hono": {
|
|
112
|
+
"optional": true
|
|
83
113
|
}
|
|
84
114
|
},
|
|
85
115
|
"dependencies": {
|
|
86
116
|
"ioredis": "6.0.0",
|
|
87
|
-
"msgpackr": "2.0
|
|
117
|
+
"msgpackr": "2.1.0"
|
|
88
118
|
},
|
|
89
119
|
"devDependencies": {
|
|
90
120
|
"@nestjs/common": "^11.0.0",
|
|
91
121
|
"@nestjs/core": "^11.0.0",
|
|
92
|
-
"@types/node": "^26.2
|
|
93
|
-
"
|
|
122
|
+
"@types/node": "^26.6.2",
|
|
123
|
+
"hono": "^4.0.0",
|
|
124
|
+
"markdown-it-mathjax3": "^4.3.2",
|
|
125
|
+
"oxlint": "^1.85.0",
|
|
94
126
|
"redis": "^6.2.1",
|
|
95
127
|
"tsup": "^8.5.1",
|
|
96
|
-
"tsx": "^4.23.
|
|
128
|
+
"tsx": "^4.23.15",
|
|
97
129
|
"typescript": "^6.0.3",
|
|
98
130
|
"vite": "^8.2.2",
|
|
131
|
+
"vitepress": "2.0.0-alpha.20",
|
|
99
132
|
"vitest": "^4.1.11"
|
|
100
133
|
},
|
|
101
134
|
"engines": {
|
|
102
|
-
"node": ">=
|
|
135
|
+
"node": ">=20.10.0"
|
|
103
136
|
},
|
|
104
137
|
"scripts": {
|
|
105
|
-
"build": "tsup src/index.ts src/cli.ts src/serialize-worker.ts src/next/index.ts src/nestjs/index.ts src/prisma/index.ts src/drizzle/index.ts src/http/index.ts --format esm,cjs --dts --clean",
|
|
138
|
+
"build": "tsup src/index.ts src/cli.ts src/serialize-worker.ts src/next/index.ts src/nestjs/index.ts src/prisma/index.ts src/drizzle/index.ts src/http/index.ts src/hono/index.ts src/dashboard/index.ts src/edge/index.ts --format esm,cjs --dts --clean",
|
|
106
139
|
"postbuild": "node --input-type=module -e \"import{readdirSync,rmSync,statSync}from'fs';import{join}from'path';function clean(d){for(const f of readdirSync(d)){const p=join(d,f);if(statSync(p).isDirectory())clean(p);else if(p.endsWith('.d.cts'))rmSync(p,{force:true});}}clean('dist');\"",
|
|
107
140
|
"dev": "tsup src/index.ts src/serialize-worker.ts --format esm,cjs --dts --watch",
|
|
108
141
|
"typecheck": "tsc --noEmit",
|
|
@@ -112,6 +145,11 @@
|
|
|
112
145
|
"test": "vitest run",
|
|
113
146
|
"test:integration": "vitest run --config vitest.integration.config.ts",
|
|
114
147
|
"test:watch": "vitest",
|
|
115
|
-
"bench": "node --expose-gc --max-old-space-size=8192 --import tsx/esm bench/benchmark.ts"
|
|
148
|
+
"bench": "node --expose-gc --max-old-space-size=8192 --import tsx/esm bench/benchmark.ts",
|
|
149
|
+
"bench:roi": "tsx bench/cloud-roi-simulation.ts",
|
|
150
|
+
"docs:dev": "vitepress dev docs",
|
|
151
|
+
"docs:build": "vitepress build docs",
|
|
152
|
+
"docs:preview": "vitepress preview docs",
|
|
153
|
+
"docs:start": "vitepress preview docs"
|
|
116
154
|
}
|
|
117
155
|
}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import type { IRedisDriver, IRedisPipeline } from '../types';
|
|
2
|
+
|
|
3
|
+
export interface AutoPipelinerOptions {
|
|
4
|
+
/** Maximum number of operations to coalesce before forcing an immediate pipeline dispatch. Default: 100 */
|
|
5
|
+
maxBatchSize?: number;
|
|
6
|
+
/** Whether auto-pipelining is enabled. Default: true */
|
|
7
|
+
enabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface PendingGetOp {
|
|
11
|
+
type: 'get';
|
|
12
|
+
key: string;
|
|
13
|
+
resolve: (val: string | null) => void;
|
|
14
|
+
reject: (err: Error) => void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface PendingSetexOp {
|
|
18
|
+
type: 'setex';
|
|
19
|
+
key: string;
|
|
20
|
+
seconds: number;
|
|
21
|
+
value: string;
|
|
22
|
+
resolve: () => void;
|
|
23
|
+
reject: (err: Error) => void;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface PendingDelOp {
|
|
27
|
+
type: 'del';
|
|
28
|
+
keys: string[];
|
|
29
|
+
resolve: (deleted: number) => void;
|
|
30
|
+
reject: (err: Error) => void;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
type PendingOp = PendingGetOp | PendingSetexOp | PendingDelOp;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* AutoPipeliner — Microtask-coalesced Redis request batching.
|
|
37
|
+
*
|
|
38
|
+
* Automatically combines individual Redis commands dispatched during the same synchronous
|
|
39
|
+
* tick of the Node.js event loop into a single `pipeline()` network round-trip.
|
|
40
|
+
*
|
|
41
|
+
* Uses `queueMicrotask` exclusively (never `setImmediate` or timers) to ensure ZERO
|
|
42
|
+
* artificial latency penalty (0ms overhead) while slashing network syscalls under high concurrency.
|
|
43
|
+
*/
|
|
44
|
+
export class AutoPipeliner {
|
|
45
|
+
public readonly maxBatchSize: number;
|
|
46
|
+
public enabled: boolean;
|
|
47
|
+
|
|
48
|
+
private queue: PendingOp[] = [];
|
|
49
|
+
private scheduled = false;
|
|
50
|
+
private inFlight = false;
|
|
51
|
+
|
|
52
|
+
private statsInternal = {
|
|
53
|
+
batchesDispatched: 0,
|
|
54
|
+
operationsBatched: 0,
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
constructor(
|
|
58
|
+
private readonly client: IRedisDriver | any,
|
|
59
|
+
options?: AutoPipelinerOptions,
|
|
60
|
+
) {
|
|
61
|
+
this.maxBatchSize = options?.maxBatchSize ?? 100;
|
|
62
|
+
this.enabled = options?.enabled ?? true;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
public get stats() {
|
|
66
|
+
return {
|
|
67
|
+
batchesDispatched: this.statsInternal.batchesDispatched,
|
|
68
|
+
operationsBatched: this.statsInternal.operationsBatched,
|
|
69
|
+
pendingQueueSize: this.queue.length,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
public async get(key: string): Promise<string | null> {
|
|
74
|
+
if (!this.enabled || !this.supportsPipelines()) {
|
|
75
|
+
return this.client.get(key);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return new Promise<string | null>((resolve, reject) => {
|
|
79
|
+
this.enqueue({ type: 'get', key, resolve, reject });
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
public async setex(key: string, seconds: number, value: string): Promise<void> {
|
|
84
|
+
if (!this.enabled || !this.supportsPipelines()) {
|
|
85
|
+
if (typeof this.client.setex === 'function') {
|
|
86
|
+
await this.client.setex(key, seconds, value);
|
|
87
|
+
} else {
|
|
88
|
+
await this.client.set(key, value, 'EX', seconds);
|
|
89
|
+
}
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return new Promise<void>((resolve, reject) => {
|
|
94
|
+
this.enqueue({ type: 'setex', key, seconds, value, resolve, reject });
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
public async del(...keys: string[]): Promise<number> {
|
|
99
|
+
if (keys.length === 0) return 0;
|
|
100
|
+
if (!this.enabled || !this.supportsPipelines()) {
|
|
101
|
+
return this.client.del(...keys);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return new Promise<number>((resolve, reject) => {
|
|
105
|
+
this.enqueue({ type: 'del', keys, resolve, reject });
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
private supportsPipelines(): boolean {
|
|
110
|
+
return Boolean(
|
|
111
|
+
typeof this.client?.pipeline === 'function' ||
|
|
112
|
+
typeof this.client?.multi === 'function'
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
private enqueue(op: PendingOp): void {
|
|
117
|
+
this.queue.push(op);
|
|
118
|
+
|
|
119
|
+
// If batch limit reached, trigger immediate synchronous dispatch to avoid microtask queue starvation
|
|
120
|
+
if (this.queue.length >= this.maxBatchSize) {
|
|
121
|
+
void this.flush();
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Schedule flush in the identical execution tick via microtask
|
|
126
|
+
if (!this.scheduled) {
|
|
127
|
+
this.scheduled = true;
|
|
128
|
+
queueMicrotask(() => {
|
|
129
|
+
this.scheduled = false;
|
|
130
|
+
void this.flush();
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
public async flush(): Promise<void> {
|
|
136
|
+
if (this.queue.length === 0) return;
|
|
137
|
+
|
|
138
|
+
const batch = this.queue;
|
|
139
|
+
this.queue = [];
|
|
140
|
+
this.scheduled = false;
|
|
141
|
+
|
|
142
|
+
this.statsInternal.batchesDispatched++;
|
|
143
|
+
this.statsInternal.operationsBatched += batch.length;
|
|
144
|
+
|
|
145
|
+
const pipe: IRedisPipeline = typeof this.client.pipeline === 'function'
|
|
146
|
+
? this.client.pipeline()
|
|
147
|
+
: this.client.multi();
|
|
148
|
+
|
|
149
|
+
for (const op of batch) {
|
|
150
|
+
switch (op.type) {
|
|
151
|
+
case 'get':
|
|
152
|
+
pipe.get(op.key);
|
|
153
|
+
break;
|
|
154
|
+
case 'setex':
|
|
155
|
+
pipe.setex(op.key, op.seconds, op.value);
|
|
156
|
+
break;
|
|
157
|
+
case 'del':
|
|
158
|
+
pipe.del(...op.keys);
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
try {
|
|
164
|
+
const results = await pipe.exec();
|
|
165
|
+
|
|
166
|
+
if (!results) {
|
|
167
|
+
// Pipeline returned null / aborted
|
|
168
|
+
for (const op of batch) {
|
|
169
|
+
if (op.type === 'get') op.resolve(null);
|
|
170
|
+
else if (op.type === 'del') op.resolve(0);
|
|
171
|
+
else op.resolve();
|
|
172
|
+
}
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
for (let i = 0; i < batch.length; i++) {
|
|
177
|
+
const op = batch[i];
|
|
178
|
+
const resTuple = results[i];
|
|
179
|
+
|
|
180
|
+
if (!resTuple) {
|
|
181
|
+
if (op.type === 'get') op.resolve(null);
|
|
182
|
+
else if (op.type === 'del') op.resolve(0);
|
|
183
|
+
else op.resolve();
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const [err, val] = resTuple;
|
|
188
|
+
if (err) {
|
|
189
|
+
op.reject(err instanceof Error ? err : new Error(String(err)));
|
|
190
|
+
} else {
|
|
191
|
+
if (op.type === 'get') {
|
|
192
|
+
op.resolve(val != null ? String(val) : null);
|
|
193
|
+
} else if (op.type === 'del') {
|
|
194
|
+
op.resolve(typeof val === 'number' ? val : Number(val) || 0);
|
|
195
|
+
} else {
|
|
196
|
+
op.resolve();
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
} catch (err) {
|
|
201
|
+
for (const op of batch) {
|
|
202
|
+
op.reject(err instanceof Error ? err : new Error(String(err)));
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|