@compforge/harness-toolbox 0.3.5 → 0.3.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.
@@ -0,0 +1,11 @@
1
+ // src/mysql/connection.ts
2
+ function destroyMysqlConnection(connection) {
3
+ const native = connection.connection;
4
+ try {
5
+ connection.destroy();
6
+ } finally {
7
+ native.stream.destroy();
8
+ }
9
+ }
10
+
11
+ export { destroyMysqlConnection };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ServicePortForwarder
3
- } from "./chunk-qhpqse1y.js";
3
+ } from "./chunk-2171tajs.js";
4
4
  import {
5
5
  resourceAccess
6
6
  } from "./chunk-2m0mh09h.js";
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-6fnhzhdb.js";
9
9
  import {
10
10
  PortForwardScope
11
- } from "./chunk-xh3zwhjh.js";
11
+ } from "./chunk-631vce5z.js";
12
12
 
13
13
  // src/kubernetes/service-port-forward.ts
14
14
  class ServicePortForwarder {
@@ -2,7 +2,6 @@ import {
2
2
  buildKubectlArgs
3
3
  } from "./chunk-hmah9t8e.js";
4
4
  import {
5
- sleep,
6
5
  spawnProcess
7
6
  } from "./chunk-mn6dwsvh.js";
8
7
 
@@ -34,11 +33,16 @@ async function startPortForward(opts) {
34
33
  const remain = deadline - Date.now();
35
34
  if (remain <= 0)
36
35
  break;
36
+ let timer;
37
37
  const chunk = await Promise.race([
38
38
  reader.read(),
39
- sleep(remain).then(() => "timeout"),
39
+ new Promise((resolve) => {
40
+ timer = setTimeout(() => resolve("timeout"), remain);
41
+ }),
40
42
  proc.exited.then(() => "exited").catch((error) => ({ error }))
41
- ]);
43
+ ]).finally(() => {
44
+ clearTimeout(timer);
45
+ });
42
46
  if (chunk === "timeout")
43
47
  break;
44
48
  if (typeof chunk === "object" && "error" in chunk) {
@@ -1,3 +1,7 @@
1
+ import {
2
+ destroyMysqlConnection
3
+ } from "./chunk-136egyff.js";
4
+
1
5
  // src/mysql/readonly.ts
2
6
  function validateQueryLimits(limits) {
3
7
  for (const name of ["timeoutMs", "maxRows", "maxBytes"]) {
@@ -23,7 +27,7 @@ async function queryReadonlySession(connection, sql, values, limits, signal) {
23
27
  })(),
24
28
  new Promise((_resolve, reject) => {
25
29
  const fail = (reason) => {
26
- connection.destroy();
30
+ destroyMysqlConnection(connection);
27
31
  reject(reason);
28
32
  };
29
33
  abort = () => fail(signal?.reason ?? new Error("MySQL query cancelled"));
@@ -38,7 +42,7 @@ async function queryReadonlySession(connection, sql, values, limits, signal) {
38
42
  clearTimeout(timer);
39
43
  if (abort)
40
44
  signal?.removeEventListener("abort", abort);
41
- connection.destroy();
45
+ destroyMysqlConnection(connection);
42
46
  }
43
47
  }
44
48
  function collectRows(connection, sql, values, limits) {
@@ -64,21 +68,21 @@ function collectRows(connection, sql, values, limits) {
64
68
  return;
65
69
  if (result.rows.length >= limits.maxRows) {
66
70
  finish("rows");
67
- connection.destroy();
71
+ destroyMysqlConnection(connection);
68
72
  return;
69
73
  }
70
74
  try {
71
75
  const bytes = Buffer.byteLength(JSON.stringify(row));
72
76
  if (result.bytes + bytes > limits.maxBytes) {
73
77
  finish("bytes");
74
- connection.destroy();
78
+ destroyMysqlConnection(connection);
75
79
  return;
76
80
  }
77
81
  result.rows.push(row);
78
82
  result.bytes += bytes;
79
83
  } catch (error) {
80
84
  settled = true;
81
- connection.destroy();
85
+ destroyMysqlConnection(connection);
82
86
  reject(error);
83
87
  }
84
88
  });
@@ -1,11 +1,14 @@
1
+ import {
2
+ queryReadonlySession,
3
+ validateQueryLimits
4
+ } from "./chunk-age65q4n.js";
5
+ import {
6
+ destroyMysqlConnection
7
+ } from "./chunk-136egyff.js";
1
8
  import {
2
9
  queryMysqlViaPod,
3
10
  queryMysqlViaPodBatch
4
11
  } from "./chunk-m91t44jh.js";
5
- import {
6
- queryReadonlySession,
7
- validateQueryLimits
8
- } from "./chunk-kbewz29a.js";
9
12
  import {
10
13
  ConcurrencyPool
11
14
  } from "./chunk-v3hxvnrc.js";
@@ -54,7 +57,7 @@ class MysqlDatabase {
54
57
  try {
55
58
  return await queryReadonlySession(session.connection, sql, values, limits, this.options.signal);
56
59
  } finally {
57
- session.connection.destroy();
60
+ destroyMysqlConnection(session.connection);
58
61
  }
59
62
  }, this.options.signal);
60
63
  }
@@ -90,7 +93,7 @@ class MysqlDatabase {
90
93
  if (this.#connections.get(key) === pending)
91
94
  this.#connections.delete(key);
92
95
  if (session?.kind === "tcp")
93
- session.connection.destroy();
96
+ destroyMysqlConnection(session.connection);
94
97
  throw error;
95
98
  }
96
99
  }
@@ -143,7 +146,7 @@ class MysqlDatabase {
143
146
  this.#connections.clear();
144
147
  for (const result of await Promise.allSettled(pending)) {
145
148
  if (result.status === "fulfilled" && result.value.kind === "tcp")
146
- result.value.connection.destroy();
149
+ destroyMysqlConnection(result.value.connection);
147
150
  }
148
151
  });
149
152
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  startPortForward
3
- } from "./chunk-xh3zwhjh.js";
3
+ } from "./chunk-631vce5z.js";
4
4
  import {
5
5
  KubectlExecutor
6
6
  } from "./chunk-hmah9t8e.js";
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  KubernetesClient
3
- } from "../chunk-bg1syayb.js";
4
- import"../chunk-qhpqse1y.js";
3
+ } from "../chunk-1e3arqz3.js";
4
+ import"../chunk-2171tajs.js";
5
5
  import"../chunk-j46x7j7c.js";
6
6
  import"../chunk-6fnhzhdb.js";
7
7
  import"../chunk-2m0mh09h.js";
8
8
  import"../chunk-y3dx8jh6.js";
9
9
  import"../chunk-ntfm5e85.js";
10
10
  import"../chunk-v3hxvnrc.js";
11
- import"../chunk-xh3zwhjh.js";
11
+ import"../chunk-631vce5z.js";
12
12
  import"../chunk-hmah9t8e.js";
13
13
  import"../chunk-mn6dwsvh.js";
14
14
  export {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  KubernetesClient
3
- } from "../chunk-bg1syayb.js";
4
- import"../chunk-qhpqse1y.js";
3
+ } from "../chunk-1e3arqz3.js";
4
+ import"../chunk-2171tajs.js";
5
5
  import"../chunk-j46x7j7c.js";
6
6
  import"../chunk-6fnhzhdb.js";
7
7
  import"../chunk-2m0mh09h.js";
@@ -11,7 +11,7 @@ import {
11
11
  } from "../chunk-a9htb6cr.js";
12
12
  import"../chunk-ntfm5e85.js";
13
13
  import"../chunk-v3hxvnrc.js";
14
- import"../chunk-xh3zwhjh.js";
14
+ import"../chunk-631vce5z.js";
15
15
  import"../chunk-hmah9t8e.js";
16
16
  import"../chunk-mn6dwsvh.js";
17
17
 
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  PortForwardScope,
3
3
  startPortForward
4
- } from "../chunk-xh3zwhjh.js";
4
+ } from "../chunk-631vce5z.js";
5
5
  import"../chunk-hmah9t8e.js";
6
6
  import"../chunk-mn6dwsvh.js";
7
7
  export {
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  ServicePortForwarder
3
- } from "../chunk-qhpqse1y.js";
3
+ } from "../chunk-2171tajs.js";
4
4
  import"../chunk-j46x7j7c.js";
5
5
  import"../chunk-6fnhzhdb.js";
6
- import"../chunk-xh3zwhjh.js";
6
+ import"../chunk-631vce5z.js";
7
7
  import"../chunk-hmah9t8e.js";
8
8
  import"../chunk-mn6dwsvh.js";
9
9
  export {
@@ -2,13 +2,14 @@ import {
2
2
  MysqlClient,
3
3
  MysqlDatabase,
4
4
  openMysql
5
- } from "../chunk-56t4qyp7.js";
5
+ } from "../chunk-qqntng20.js";
6
+ import"../chunk-age65q4n.js";
7
+ import"../chunk-136egyff.js";
6
8
  import"../chunk-m91t44jh.js";
7
- import"../chunk-kbewz29a.js";
8
9
  import"../chunk-v3hxvnrc.js";
9
10
  import"../chunk-h8fwx0k7.js";
10
- import"../chunk-5fgbhx2r.js";
11
- import"../chunk-xh3zwhjh.js";
11
+ import"../chunk-wv4jwhvj.js";
12
+ import"../chunk-631vce5z.js";
12
13
  import"../chunk-hmah9t8e.js";
13
14
  import"../chunk-mn6dwsvh.js";
14
15
  import"../chunk-ssj93brx.js";
@@ -0,0 +1,3 @@
1
+ import type { Connection } from "mysql2/promise";
2
+ /** @why Disposal must release the socket even when the peer never finishes its TCP half-close. */
3
+ export declare function destroyMysqlConnection(connection: Connection): void;
@@ -0,0 +1,6 @@
1
+ import {
2
+ destroyMysqlConnection
3
+ } from "../chunk-136egyff.js";
4
+ export {
5
+ destroyMysqlConnection
6
+ };
@@ -14,13 +14,14 @@ import {
14
14
  MysqlClient,
15
15
  MysqlDatabase,
16
16
  openMysql
17
- } from "../chunk-56t4qyp7.js";
17
+ } from "../chunk-qqntng20.js";
18
+ import"../chunk-age65q4n.js";
19
+ import"../chunk-136egyff.js";
18
20
  import"../chunk-m91t44jh.js";
19
- import"../chunk-kbewz29a.js";
20
21
  import"../chunk-v3hxvnrc.js";
21
22
  import"../chunk-h8fwx0k7.js";
22
- import"../chunk-5fgbhx2r.js";
23
- import"../chunk-xh3zwhjh.js";
23
+ import"../chunk-wv4jwhvj.js";
24
+ import"../chunk-631vce5z.js";
24
25
  import"../chunk-hmah9t8e.js";
25
26
  import"../chunk-mn6dwsvh.js";
26
27
  import"../chunk-ssj93brx.js";
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  queryReadonlySession,
3
3
  validateQueryLimits
4
- } from "../chunk-kbewz29a.js";
4
+ } from "../chunk-age65q4n.js";
5
+ import"../chunk-136egyff.js";
5
6
  export {
6
7
  validateQueryLimits,
7
8
  queryReadonlySession
@@ -7,8 +7,8 @@ import"../chunk-zp1s833x.js";
7
7
  import"../chunk-v3hxvnrc.js";
8
8
  import"../chunk-x4ntb898.js";
9
9
  import"../chunk-h8fwx0k7.js";
10
- import"../chunk-5fgbhx2r.js";
11
- import"../chunk-xh3zwhjh.js";
10
+ import"../chunk-wv4jwhvj.js";
11
+ import"../chunk-631vce5z.js";
12
12
  import"../chunk-hmah9t8e.js";
13
13
  import"../chunk-mn6dwsvh.js";
14
14
  import"../chunk-ssj93brx.js";
package/dist/s3/index.js CHANGED
@@ -9,8 +9,8 @@ import {
9
9
  import"../chunk-v3hxvnrc.js";
10
10
  import"../chunk-x4ntb898.js";
11
11
  import"../chunk-h8fwx0k7.js";
12
- import"../chunk-5fgbhx2r.js";
13
- import"../chunk-xh3zwhjh.js";
12
+ import"../chunk-wv4jwhvj.js";
13
+ import"../chunk-631vce5z.js";
14
14
  import"../chunk-hmah9t8e.js";
15
15
  import"../chunk-mn6dwsvh.js";
16
16
  import"../chunk-ssj93brx.js";
@@ -6,8 +6,8 @@ import {
6
6
  } from "../chunk-h8fwx0k7.js";
7
7
  import {
8
8
  PodRelayTransport
9
- } from "../chunk-5fgbhx2r.js";
10
- import"../chunk-xh3zwhjh.js";
9
+ } from "../chunk-wv4jwhvj.js";
10
+ import"../chunk-631vce5z.js";
11
11
  import"../chunk-hmah9t8e.js";
12
12
  import"../chunk-mn6dwsvh.js";
13
13
  import"../chunk-ssj93brx.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  PodRelayTransport
3
- } from "../chunk-5fgbhx2r.js";
4
- import"../chunk-xh3zwhjh.js";
3
+ } from "../chunk-wv4jwhvj.js";
4
+ import"../chunk-631vce5z.js";
5
5
  import"../chunk-hmah9t8e.js";
6
6
  import"../chunk-mn6dwsvh.js";
7
7
  import"../chunk-ssj93brx.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compforge/harness-toolbox",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "description": "Shared infrastructure clients, transports and bounded data capture",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -110,9 +110,6 @@
110
110
  "@types/node-fetch": "2.6.13",
111
111
  "@types/node": "^22"
112
112
  },
113
- "overrides": {
114
- "@compforge/harness-common": "file:../common"
115
- },
116
113
  "publishConfig": {
117
114
  "access": "public"
118
115
  },