@gscdump/cloudflare 0.19.3 → 0.19.4
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/index.mjs +21 -2
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -22,6 +22,25 @@ function resolveSvc(env) {
|
|
|
22
22
|
if (!svc) throw new Error("DUCKDB_SVC service binding is not configured");
|
|
23
23
|
return svc;
|
|
24
24
|
}
|
|
25
|
+
const DUCKDB_RPC_TIMEOUT_MS = 22e3;
|
|
26
|
+
var DuckDBServiceTimeoutError = class extends Error {
|
|
27
|
+
name = "DuckDBServiceTimeoutError";
|
|
28
|
+
constructor(timeoutMs) {
|
|
29
|
+
super(`DUCKDB_SVC.runSQL exceeded ${timeoutMs}ms deadline`);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
function withDuckDBDeadline(op, timeoutMs, signal) {
|
|
33
|
+
if (signal?.aborted) return Promise.reject(signal.reason ?? new DOMException("Aborted", "AbortError"));
|
|
34
|
+
return new Promise((resolve, reject) => {
|
|
35
|
+
const timer = setTimeout(() => reject(new DuckDBServiceTimeoutError(timeoutMs)), timeoutMs);
|
|
36
|
+
const onAbort = () => reject(signal.reason ?? new DOMException("Aborted", "AbortError"));
|
|
37
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
38
|
+
op.then(resolve, reject).finally(() => {
|
|
39
|
+
clearTimeout(timer);
|
|
40
|
+
signal?.removeEventListener("abort", onAbort);
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
}
|
|
25
44
|
function createDucklingsCodec(_env) {
|
|
26
45
|
return createHyparquetCodec();
|
|
27
46
|
}
|
|
@@ -90,10 +109,10 @@ function createDucklingsExecutor(env) {
|
|
|
90
109
|
if (!tmp) throw new Error(`createDucklingsExecutor: SQL references {{${placeholder}}} but no fileKeys entry provided`);
|
|
91
110
|
return tmp;
|
|
92
111
|
}), params);
|
|
93
|
-
const result = await svc.runSQL({
|
|
112
|
+
const result = await withDuckDBDeadline(svc.runSQL({
|
|
94
113
|
sql: finalSql,
|
|
95
114
|
tables
|
|
96
|
-
});
|
|
115
|
+
}), DUCKDB_RPC_TIMEOUT_MS, signal);
|
|
97
116
|
return {
|
|
98
117
|
rows: result.rows.map(coerceRow),
|
|
99
118
|
sql: result.sql
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gscdump/cloudflare",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.19.
|
|
4
|
+
"version": "0.19.4",
|
|
5
5
|
"description": "Cloudflare-Workers-flavored helpers for the gscdump analytics stack: AnalyticsEnv binding contract, R2 SigV4 presigner, size-hint HMAC, DuckDB Workers shims, engine factory.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Harlan Wilton",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"aws4fetch": "^1.0.20",
|
|
43
|
-
"@gscdump/engine": "0.19.
|
|
44
|
-
"@gscdump/engine-sqlite": "0.19.
|
|
43
|
+
"@gscdump/engine": "0.19.4",
|
|
44
|
+
"@gscdump/engine-sqlite": "0.19.4"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@cloudflare/workers-types": "^4.20260519.1",
|