@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.
- package/dist/chunk-136egyff.js +11 -0
- package/dist/{chunk-bg1syayb.js → chunk-1e3arqz3.js} +1 -1
- package/dist/{chunk-qhpqse1y.js → chunk-2171tajs.js} +1 -1
- package/dist/{chunk-xh3zwhjh.js → chunk-631vce5z.js} +7 -3
- package/dist/{chunk-kbewz29a.js → chunk-age65q4n.js} +9 -5
- package/dist/{chunk-56t4qyp7.js → chunk-qqntng20.js} +10 -7
- package/dist/{chunk-5fgbhx2r.js → chunk-wv4jwhvj.js} +1 -1
- package/dist/kubernetes/client.js +3 -3
- package/dist/kubernetes/environment.js +3 -3
- package/dist/kubernetes/port-forward.js +1 -1
- package/dist/kubernetes/service-port-forward.js +2 -2
- package/dist/mysql/client.js +5 -4
- package/dist/mysql/connection.d.ts +3 -0
- package/dist/mysql/connection.js +6 -0
- package/dist/mysql/index.js +5 -4
- package/dist/mysql/readonly.js +2 -1
- package/dist/s3/datasource.js +2 -2
- package/dist/s3/index.js +2 -2
- package/dist/transport/index.js +2 -2
- package/dist/transport/pod-relay.js +2 -2
- package/package.json +1 -4
|
@@ -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
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
149
|
+
destroyMysqlConnection(result.value.connection);
|
|
147
150
|
}
|
|
148
151
|
});
|
|
149
152
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
KubernetesClient
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import"../chunk-
|
|
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-
|
|
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-
|
|
4
|
-
import"../chunk-
|
|
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-
|
|
14
|
+
import"../chunk-631vce5z.js";
|
|
15
15
|
import"../chunk-hmah9t8e.js";
|
|
16
16
|
import"../chunk-mn6dwsvh.js";
|
|
17
17
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ServicePortForwarder
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-2171tajs.js";
|
|
4
4
|
import"../chunk-j46x7j7c.js";
|
|
5
5
|
import"../chunk-6fnhzhdb.js";
|
|
6
|
-
import"../chunk-
|
|
6
|
+
import"../chunk-631vce5z.js";
|
|
7
7
|
import"../chunk-hmah9t8e.js";
|
|
8
8
|
import"../chunk-mn6dwsvh.js";
|
|
9
9
|
export {
|
package/dist/mysql/client.js
CHANGED
|
@@ -2,13 +2,14 @@ import {
|
|
|
2
2
|
MysqlClient,
|
|
3
3
|
MysqlDatabase,
|
|
4
4
|
openMysql
|
|
5
|
-
} from "../chunk-
|
|
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-
|
|
11
|
-
import"../chunk-
|
|
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";
|
package/dist/mysql/index.js
CHANGED
|
@@ -14,13 +14,14 @@ import {
|
|
|
14
14
|
MysqlClient,
|
|
15
15
|
MysqlDatabase,
|
|
16
16
|
openMysql
|
|
17
|
-
} from "../chunk-
|
|
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-
|
|
23
|
-
import"../chunk-
|
|
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";
|
package/dist/mysql/readonly.js
CHANGED
package/dist/s3/datasource.js
CHANGED
|
@@ -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-
|
|
11
|
-
import"../chunk-
|
|
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-
|
|
13
|
-
import"../chunk-
|
|
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";
|
package/dist/transport/index.js
CHANGED
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
} from "../chunk-h8fwx0k7.js";
|
|
7
7
|
import {
|
|
8
8
|
PodRelayTransport
|
|
9
|
-
} from "../chunk-
|
|
10
|
-
import"../chunk-
|
|
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";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@compforge/harness-toolbox",
|
|
3
|
-
"version": "0.3.
|
|
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
|
},
|