@noego/sqlego 0.1.6-dev.8 → 0.1.6
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/README.md +5 -5
- package/dist/client.d.ts +9 -0
- package/dist/index.js +50 -39
- package/package.json +10 -8
- package/src/client.ts +52 -32
package/README.md
CHANGED
|
@@ -412,14 +412,14 @@ see above), `maxOwners` (owner processes, see above), `idleTimeoutMs`, `connectT
|
|
|
412
412
|
## Develop
|
|
413
413
|
|
|
414
414
|
```
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
415
|
+
pnpm install
|
|
416
|
+
pnpm test
|
|
417
|
+
pnpm run build # → dist/ and bin/sqlego-<host platform>-<arch> (host executable)
|
|
418
|
+
pnpm run build:bin:all # → bin/sqlego-{darwin,linux}-{arm64,x64}, bin/sqlego-win32-x64.exe
|
|
419
419
|
bun scripts/release.ts --channel dev --pack ./out # build + stage + check all six packages, write tarballs, publish nothing
|
|
420
420
|
```
|
|
421
421
|
|
|
422
|
-
`
|
|
422
|
+
`pnpm run build` runs the fresh binary with `--version` and fails unless it
|
|
423
423
|
reports `<package.json version>+<build id>`, so a stale binary cannot be
|
|
424
424
|
mistaken for the current one. The build id hashes `src/*.ts` and the Rust
|
|
425
425
|
owner's inputs (`rust/Cargo.toml`, `rust/Cargo.lock`, `rust/build.rs`, every
|
package/dist/client.d.ts
CHANGED
|
@@ -286,8 +286,17 @@ export declare class SqlegoClient {
|
|
|
286
286
|
* result; a reply that does not parse is a `protocol` failure.
|
|
287
287
|
*/
|
|
288
288
|
private call;
|
|
289
|
+
private parseReply;
|
|
289
290
|
/** Never rejects: every outcome, including transport failures, is a `Result`. The reply is `unknown` until parsed. */
|
|
290
291
|
private request;
|
|
292
|
+
/**
|
|
293
|
+
* The pending waiter for `id`. Built outside `request` so the waiter and
|
|
294
|
+
* timer closures capture only `id`, `op` and `timeoutMs`: a pending reply
|
|
295
|
+
* must not keep the request body or its encoded frame alive after the write.
|
|
296
|
+
*/
|
|
297
|
+
private register;
|
|
298
|
+
/** Drops the waiter for `id` and its timer; its promise is abandoned unsettled. */
|
|
299
|
+
private forget;
|
|
291
300
|
private settleAll;
|
|
292
301
|
}
|
|
293
302
|
/**
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import net from "node:net";
|
|
|
6
6
|
import path5 from "node:path";
|
|
7
7
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
8
8
|
|
|
9
|
-
// node_modules/@noego/trust/dist/index.js
|
|
9
|
+
// node_modules/.pnpm/@noego+trust@0.5.1_typescript@5.9.3/node_modules/@noego/trust/dist/index.js
|
|
10
10
|
function ok(value) {
|
|
11
11
|
return { ok: true, value };
|
|
12
12
|
}
|
|
@@ -1033,7 +1033,7 @@ import { fileURLToPath } from "node:url";
|
|
|
1033
1033
|
// package.json
|
|
1034
1034
|
var package_default = {
|
|
1035
1035
|
name: "@noego/sqlego",
|
|
1036
|
-
version: "0.1.6
|
|
1036
|
+
version: "0.1.6",
|
|
1037
1037
|
description: "One owner per SQLite file, many files per owner process. Clients (CLI, Node, Bun) pass SQL over a local socket (Unix) or named pipe (Windows); the owner starts on demand and exits when idle.",
|
|
1038
1038
|
type: "module",
|
|
1039
1039
|
license: "ISC",
|
|
@@ -1071,26 +1071,28 @@ var package_default = {
|
|
|
1071
1071
|
"build:bin": "bun scripts/build.ts bin",
|
|
1072
1072
|
"build:bin:all": "bun scripts/build.ts bin:all",
|
|
1073
1073
|
release: "bun scripts/release.ts",
|
|
1074
|
-
typecheck: "
|
|
1074
|
+
typecheck: "tsc --noEmit",
|
|
1075
1075
|
trust: "trust check src",
|
|
1076
1076
|
test: "bun test"
|
|
1077
1077
|
},
|
|
1078
1078
|
devDependencies: {
|
|
1079
1079
|
"@types/bun": "^1.2.0",
|
|
1080
1080
|
"@types/node": "^22.0.0",
|
|
1081
|
+
"bun-types": "^1.4.4",
|
|
1081
1082
|
typescript: "^5.6.0"
|
|
1082
1083
|
},
|
|
1083
1084
|
dependencies: {
|
|
1084
1085
|
"@noego/trust": "^0.5.1"
|
|
1085
1086
|
},
|
|
1086
1087
|
optionalDependencies: {
|
|
1087
|
-
"@noego/sqlego-darwin-arm64": "0.1.6
|
|
1088
|
-
"@noego/sqlego-darwin-x64": "0.1.6
|
|
1089
|
-
"@noego/sqlego-linux-x64": "0.1.6
|
|
1090
|
-
"@noego/sqlego-linux-arm64": "0.1.6
|
|
1091
|
-
"@noego/sqlego-win32-x64": "0.1.6
|
|
1088
|
+
"@noego/sqlego-darwin-arm64": "0.1.6",
|
|
1089
|
+
"@noego/sqlego-darwin-x64": "0.1.6",
|
|
1090
|
+
"@noego/sqlego-linux-x64": "0.1.6",
|
|
1091
|
+
"@noego/sqlego-linux-arm64": "0.1.6",
|
|
1092
|
+
"@noego/sqlego-win32-x64": "0.1.6"
|
|
1092
1093
|
},
|
|
1093
|
-
|
|
1094
|
+
packageManager: "pnpm@10.34.9",
|
|
1095
|
+
sqlegoBuild: "382c13027eae"
|
|
1094
1096
|
};
|
|
1095
1097
|
|
|
1096
1098
|
// src/version.ts
|
|
@@ -1161,7 +1163,7 @@ function buildIdFromSource() {
|
|
|
1161
1163
|
return id.value;
|
|
1162
1164
|
}
|
|
1163
1165
|
function resolveBuildId() {
|
|
1164
|
-
return chooseBuildId("
|
|
1166
|
+
return chooseBuildId("382c13027eae", stampedBuild, rustInTree(), buildIdFromSource);
|
|
1165
1167
|
}
|
|
1166
1168
|
function decideUnknownBuild(kind) {
|
|
1167
1169
|
switch (kind) {
|
|
@@ -1252,22 +1254,20 @@ class SqlegoClient {
|
|
|
1252
1254
|
}, parseHelloResult));
|
|
1253
1255
|
return this.hello.capabilities.includes("detached-plain");
|
|
1254
1256
|
}
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
return callerRows(result.rows);
|
|
1257
|
+
query(sql, params) {
|
|
1258
|
+
return this.call({ op: "query", sql, params }, parseQueryResult).then((reply) => callerRows(unwrap(reply).rows));
|
|
1258
1259
|
}
|
|
1259
|
-
|
|
1260
|
-
return
|
|
1260
|
+
run(sql, params) {
|
|
1261
|
+
return this.call({ op: "run", sql, params }, parseRunResult).then((reply) => unwrap(reply));
|
|
1261
1262
|
}
|
|
1262
|
-
|
|
1263
|
-
return
|
|
1263
|
+
statement(sql, params) {
|
|
1264
|
+
return this.call({ op: "statement", sql, params }, parseStatementResult).then((reply) => callerStatement(unwrap(reply)));
|
|
1264
1265
|
}
|
|
1265
|
-
|
|
1266
|
-
return
|
|
1266
|
+
exec(sql) {
|
|
1267
|
+
return this.call({ op: "exec", sql }, parseExecResult).then((reply) => unwrap(reply));
|
|
1267
1268
|
}
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
return result.results;
|
|
1269
|
+
batch(statements) {
|
|
1270
|
+
return this.call({ op: "batch", statements }, parseBatchResult).then((reply) => unwrap(reply).results);
|
|
1271
1271
|
}
|
|
1272
1272
|
async begin(options = {}) {
|
|
1273
1273
|
const opened = unwrap(await this.call({ op: "begin", mode: options.mode, leaseMs: options.leaseMs }, parseBeginResult));
|
|
@@ -1285,15 +1285,14 @@ class SqlegoClient {
|
|
|
1285
1285
|
});
|
|
1286
1286
|
throw outcome.error.cause;
|
|
1287
1287
|
}
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
return callerRows(result.rows);
|
|
1288
|
+
transactionQuery(txId, sql, params) {
|
|
1289
|
+
return this.call({ op: "query", sql, params, txId }, parseQueryResult).then((reply) => callerRows(unwrap(reply).rows));
|
|
1291
1290
|
}
|
|
1292
|
-
|
|
1293
|
-
return
|
|
1291
|
+
transactionRun(txId, sql, params) {
|
|
1292
|
+
return this.call({ op: "run", sql, params, txId }, parseRunResult).then((reply) => unwrap(reply));
|
|
1294
1293
|
}
|
|
1295
|
-
|
|
1296
|
-
return
|
|
1294
|
+
transactionStatement(txId, sql, params) {
|
|
1295
|
+
return this.call({ op: "statement", sql, params, txId }, parseStatementResult).then((reply) => callerStatement(unwrap(reply)));
|
|
1297
1296
|
}
|
|
1298
1297
|
async transactionExec(txId, sql) {
|
|
1299
1298
|
return unwrap(await this.call({ op: "exec", sql, txId }, parseExecResult));
|
|
@@ -1729,15 +1728,18 @@ class SqlegoClient {
|
|
|
1729
1728
|
waiter.settle(response.ok ? Result.ok(response.result) : Result.err({ kind: response.error.code, message: response.error.message }));
|
|
1730
1729
|
}
|
|
1731
1730
|
}
|
|
1732
|
-
|
|
1733
|
-
const
|
|
1731
|
+
call(body, parse, timeoutMs) {
|
|
1732
|
+
const op = body.op;
|
|
1733
|
+
return this.request(body, timeoutMs).then((reply) => this.parseReply(op, reply, parse));
|
|
1734
|
+
}
|
|
1735
|
+
parseReply(op, reply, parse) {
|
|
1734
1736
|
if (!reply.ok)
|
|
1735
1737
|
return reply;
|
|
1736
1738
|
const parsed = parse(reply.value);
|
|
1737
1739
|
if (parsed.ok)
|
|
1738
1740
|
return parsed;
|
|
1739
1741
|
if (parsed.error.kind === "invalid") {
|
|
1740
|
-
return Result.err({ kind: "protocol", message: `unexpected ${
|
|
1742
|
+
return Result.err({ kind: "protocol", message: `unexpected ${op} reply: ${parsed.error.message}` });
|
|
1741
1743
|
}
|
|
1742
1744
|
const unhandled = parsed.error.kind;
|
|
1743
1745
|
return unhandled;
|
|
@@ -1751,20 +1753,29 @@ class SqlegoClient {
|
|
|
1751
1753
|
const frame = encodeRequestFrame({ id, ...body });
|
|
1752
1754
|
if (!frame.ok)
|
|
1753
1755
|
return Promise.resolve(frame);
|
|
1756
|
+
const reply = this.register(id, body.op, timeoutMs);
|
|
1757
|
+
const written = Trust.try(() => socket.write(frame.value), (cause) => ({ kind: "socket", message: errorMessage(cause) }));
|
|
1758
|
+
if (!written.ok) {
|
|
1759
|
+
this.forget(id);
|
|
1760
|
+
return Promise.resolve(written);
|
|
1761
|
+
}
|
|
1762
|
+
return reply;
|
|
1763
|
+
}
|
|
1764
|
+
register(id, op, timeoutMs) {
|
|
1754
1765
|
return new Promise((settle) => {
|
|
1755
1766
|
const timer = setTimeout(() => {
|
|
1756
1767
|
this.pending.delete(id);
|
|
1757
|
-
settle(Result.err({ kind: "request-timeout", message: `request ${id} (${
|
|
1768
|
+
settle(Result.err({ kind: "request-timeout", message: `request ${id} (${op}) timed out` }));
|
|
1758
1769
|
}, timeoutMs);
|
|
1759
1770
|
this.pending.set(id, { settle, timer });
|
|
1760
|
-
const written = Trust.try(() => socket.write(frame.value), (cause) => ({ kind: "socket", message: errorMessage(cause) }));
|
|
1761
|
-
if (!written.ok) {
|
|
1762
|
-
this.pending.delete(id);
|
|
1763
|
-
clearTimeout(timer);
|
|
1764
|
-
settle(written);
|
|
1765
|
-
}
|
|
1766
1771
|
});
|
|
1767
1772
|
}
|
|
1773
|
+
forget(id) {
|
|
1774
|
+
const waiter = this.pending.get(id);
|
|
1775
|
+
if (waiter)
|
|
1776
|
+
clearTimeout(waiter.timer);
|
|
1777
|
+
this.pending.delete(id);
|
|
1778
|
+
}
|
|
1768
1779
|
settleAll(failure) {
|
|
1769
1780
|
for (const waiter of this.pending.values()) {
|
|
1770
1781
|
clearTimeout(waiter.timer);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noego/sqlego",
|
|
3
|
-
"version": "0.1.6
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "One owner per SQLite file, many files per owner process. Clients (CLI, Node, Bun) pass SQL over a local socket (Unix) or named pipe (Windows); the owner starts on demand and exits when idle.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "ISC",
|
|
@@ -38,24 +38,26 @@
|
|
|
38
38
|
"build:bin": "bun scripts/build.ts bin",
|
|
39
39
|
"build:bin:all": "bun scripts/build.ts bin:all",
|
|
40
40
|
"release": "bun scripts/release.ts",
|
|
41
|
-
"typecheck": "
|
|
41
|
+
"typecheck": "tsc --noEmit",
|
|
42
42
|
"trust": "trust check src",
|
|
43
43
|
"test": "bun test"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/bun": "^1.2.0",
|
|
47
47
|
"@types/node": "^22.0.0",
|
|
48
|
+
"bun-types": "^1.4.4",
|
|
48
49
|
"typescript": "^5.6.0"
|
|
49
50
|
},
|
|
50
51
|
"dependencies": {
|
|
51
52
|
"@noego/trust": "^0.5.1"
|
|
52
53
|
},
|
|
53
54
|
"optionalDependencies": {
|
|
54
|
-
"@noego/sqlego-darwin-arm64": "0.1.6
|
|
55
|
-
"@noego/sqlego-darwin-x64": "0.1.6
|
|
56
|
-
"@noego/sqlego-linux-x64": "0.1.6
|
|
57
|
-
"@noego/sqlego-linux-arm64": "0.1.6
|
|
58
|
-
"@noego/sqlego-win32-x64": "0.1.6
|
|
55
|
+
"@noego/sqlego-darwin-arm64": "0.1.6",
|
|
56
|
+
"@noego/sqlego-darwin-x64": "0.1.6",
|
|
57
|
+
"@noego/sqlego-linux-x64": "0.1.6",
|
|
58
|
+
"@noego/sqlego-linux-arm64": "0.1.6",
|
|
59
|
+
"@noego/sqlego-win32-x64": "0.1.6"
|
|
59
60
|
},
|
|
60
|
-
"
|
|
61
|
+
"packageManager": "pnpm@10.34.9",
|
|
62
|
+
"sqlegoBuild": "382c13027eae"
|
|
61
63
|
}
|
package/src/client.ts
CHANGED
|
@@ -252,13 +252,14 @@ export class SqlegoClient {
|
|
|
252
252
|
return this.hello.capabilities.includes('detached-plain');
|
|
253
253
|
}
|
|
254
254
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
255
|
+
// The request methods below are deliberately not `async`: a suspended async
|
|
256
|
+
// frame would keep `sql`/`params`/`statements` alive until the reply (#1178).
|
|
257
|
+
query<Row extends SqlRow = SqlRow>(sql: string, params?: SqlParams): Promise<Row[]> {
|
|
258
|
+
return this.call({ op: 'query', sql, params }, parseQueryResult).then((reply) => callerRows<Row>(unwrap(reply).rows));
|
|
258
259
|
}
|
|
259
260
|
|
|
260
|
-
|
|
261
|
-
return
|
|
261
|
+
run(sql: string, params?: SqlParams): Promise<RunResult> {
|
|
262
|
+
return this.call({ op: 'run', sql, params }, parseRunResult).then((reply) => unwrap(reply));
|
|
262
263
|
}
|
|
263
264
|
|
|
264
265
|
/**
|
|
@@ -268,8 +269,8 @@ export class SqlegoClient {
|
|
|
268
269
|
* changed (0 for a read). Integers beyond ±2^53-1 come back as `bigint`,
|
|
269
270
|
* blobs as `Uint8Array`; `bigint` and `Uint8Array` parameters bind losslessly.
|
|
270
271
|
*/
|
|
271
|
-
|
|
272
|
-
return
|
|
272
|
+
statement<Row extends SqlRow = SqlRow>(sql: string, params?: SqlParams): Promise<StatementResult<Row>> {
|
|
273
|
+
return this.call({ op: 'statement', sql, params }, parseStatementResult).then((reply) => callerStatement<Row>(unwrap(reply)));
|
|
273
274
|
}
|
|
274
275
|
|
|
275
276
|
/**
|
|
@@ -278,14 +279,13 @@ export class SqlegoClient {
|
|
|
278
279
|
* unless this runs inside a transaction that is then rolled back.
|
|
279
280
|
* Transaction control anywhere in the text is refused, as with `run`.
|
|
280
281
|
*/
|
|
281
|
-
|
|
282
|
-
return
|
|
282
|
+
exec(sql: string): Promise<ExecResult> {
|
|
283
|
+
return this.call({ op: 'exec', sql }, parseExecResult).then((reply) => unwrap(reply));
|
|
283
284
|
}
|
|
284
285
|
|
|
285
286
|
/** One transaction; the whole batch rolls back on the first failure. */
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
return result.results;
|
|
287
|
+
batch(statements: readonly Statement[]): Promise<BatchResult['results']> {
|
|
288
|
+
return this.call({ op: 'batch', statements }, parseBatchResult).then((reply) => unwrap(reply).results);
|
|
289
289
|
}
|
|
290
290
|
|
|
291
291
|
/**
|
|
@@ -315,19 +315,18 @@ export class SqlegoClient {
|
|
|
315
315
|
}
|
|
316
316
|
|
|
317
317
|
/** @internal Statements inside a transaction; `SqlegoTransaction` is the public face. */
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
return callerRows<Row>(result.rows);
|
|
318
|
+
transactionQuery<Row extends SqlRow>(txId: number, sql: string, params?: SqlParams): Promise<Row[]> {
|
|
319
|
+
return this.call({ op: 'query', sql, params, txId }, parseQueryResult).then((reply) => callerRows<Row>(unwrap(reply).rows));
|
|
321
320
|
}
|
|
322
321
|
|
|
323
322
|
/** @internal */
|
|
324
|
-
|
|
325
|
-
return
|
|
323
|
+
transactionRun(txId: number, sql: string, params?: SqlParams): Promise<RunResult> {
|
|
324
|
+
return this.call({ op: 'run', sql, params, txId }, parseRunResult).then((reply) => unwrap(reply));
|
|
326
325
|
}
|
|
327
326
|
|
|
328
327
|
/** @internal */
|
|
329
|
-
|
|
330
|
-
return
|
|
328
|
+
transactionStatement<Row extends SqlRow>(txId: number, sql: string, params?: SqlParams): Promise<StatementResult<Row>> {
|
|
329
|
+
return this.call({ op: 'statement', sql, params, txId }, parseStatementResult).then((reply) => callerStatement<Row>(unwrap(reply)));
|
|
331
330
|
}
|
|
332
331
|
|
|
333
332
|
/** @internal */
|
|
@@ -893,13 +892,18 @@ export class SqlegoClient {
|
|
|
893
892
|
* One request whose reply `parse` turns from `unknown` into its typed
|
|
894
893
|
* result; a reply that does not parse is a `protocol` failure.
|
|
895
894
|
*/
|
|
896
|
-
private
|
|
897
|
-
|
|
895
|
+
private call<T>(body: RequestBody, parse: (input: unknown) => Result<T, Invalid>, timeoutMs?: number) {
|
|
896
|
+
// Not `async`: a suspended async frame would keep `body` (and its params) alive until the reply.
|
|
897
|
+
const op = body.op;
|
|
898
|
+
return this.request(body, timeoutMs).then((reply) => this.parseReply(op, reply, parse));
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
private parseReply<T>(op: string, reply: Result<unknown, RequestFailure>, parse: (input: unknown) => Result<T, Invalid>) {
|
|
898
902
|
if (!reply.ok) return reply;
|
|
899
903
|
const parsed = parse(reply.value);
|
|
900
904
|
if (parsed.ok) return parsed;
|
|
901
905
|
if (parsed.error.kind === 'invalid') {
|
|
902
|
-
return Result.err<RequestFailure>({ kind: 'protocol', message: `unexpected ${
|
|
906
|
+
return Result.err<RequestFailure>({ kind: 'protocol', message: `unexpected ${op} reply: ${parsed.error.message}` });
|
|
903
907
|
}
|
|
904
908
|
const unhandled: never = parsed.error.kind;
|
|
905
909
|
return unhandled;
|
|
@@ -914,24 +918,40 @@ export class SqlegoClient {
|
|
|
914
918
|
const id = this.nextId++;
|
|
915
919
|
const frame = encodeRequestFrame({ id, ...body } as Request);
|
|
916
920
|
if (!frame.ok) return Promise.resolve(frame);
|
|
921
|
+
const reply = this.register(id, body.op, timeoutMs);
|
|
922
|
+
const written = Trust.try(
|
|
923
|
+
() => socket.write(frame.value),
|
|
924
|
+
(cause) => ({ kind: 'socket' as const, message: errorMessage(cause) }),
|
|
925
|
+
);
|
|
926
|
+
if (!written.ok) {
|
|
927
|
+
this.forget(id);
|
|
928
|
+
return Promise.resolve(written);
|
|
929
|
+
}
|
|
930
|
+
return reply;
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
/**
|
|
934
|
+
* The pending waiter for `id`. Built outside `request` so the waiter and
|
|
935
|
+
* timer closures capture only `id`, `op` and `timeoutMs`: a pending reply
|
|
936
|
+
* must not keep the request body or its encoded frame alive after the write.
|
|
937
|
+
*/
|
|
938
|
+
private register(id: number, op: string, timeoutMs: number): Promise<Result<unknown, RequestFailure>> {
|
|
917
939
|
return new Promise<Result<unknown, RequestFailure>>((settle) => {
|
|
918
940
|
const timer = setTimeout(() => {
|
|
919
941
|
this.pending.delete(id);
|
|
920
|
-
settle(Result.err({ kind: 'request-timeout', message: `request ${id} (${
|
|
942
|
+
settle(Result.err({ kind: 'request-timeout', message: `request ${id} (${op}) timed out` }));
|
|
921
943
|
}, timeoutMs);
|
|
922
944
|
this.pending.set(id, { settle, timer });
|
|
923
|
-
const written = Trust.try(
|
|
924
|
-
() => socket.write(frame.value),
|
|
925
|
-
(cause) => ({ kind: 'socket' as const, message: errorMessage(cause) }),
|
|
926
|
-
);
|
|
927
|
-
if (!written.ok) {
|
|
928
|
-
this.pending.delete(id);
|
|
929
|
-
clearTimeout(timer);
|
|
930
|
-
settle(written);
|
|
931
|
-
}
|
|
932
945
|
});
|
|
933
946
|
}
|
|
934
947
|
|
|
948
|
+
/** Drops the waiter for `id` and its timer; its promise is abandoned unsettled. */
|
|
949
|
+
private forget(id: number): void {
|
|
950
|
+
const waiter = this.pending.get(id);
|
|
951
|
+
if (waiter) clearTimeout(waiter.timer);
|
|
952
|
+
this.pending.delete(id);
|
|
953
|
+
}
|
|
954
|
+
|
|
935
955
|
private settleAll(failure: RequestFailure): void {
|
|
936
956
|
for (const waiter of this.pending.values()) {
|
|
937
957
|
clearTimeout(waiter.timer);
|