@coffre/cli 0.1.9 → 0.1.11
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/{connect-BONR52al.js → connect-CpN0VYGE.js} +53 -1
- package/dist/{connect-BZdPYNbZ.js → connect-fkn_APVy.js} +1 -1
- package/dist/main.js +1 -1
- package/dist/{setup-D3SXt_P-.js → setup-ClLcofuy.js} +2 -2
- package/dist/templates/node/package.json +3 -3
- package/dist/templates/workers/package.json +4 -4
- package/package.json +4 -4
|
@@ -4,6 +4,7 @@ import { A as bigint, G as sql, H as SQL, O as customType, T as integer, ct as e
|
|
|
4
4
|
import { r as drizzle } from "./node-postgres-_y-EeSHQ.js";
|
|
5
5
|
import { a as trackCommits, i as relationsOf, n as asPostgresDatabase, r as ACTIVE_SUBJECT } from "./portable-CPh2thNN.js";
|
|
6
6
|
import { resolve } from "node:path";
|
|
7
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
7
8
|
import { checkServerIdentity } from "node:tls";
|
|
8
9
|
//#region ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@5.20260920.1_@libsql+client@0.18.0_@types+pg@8.20.0_pg@8.16.3/node_modules/drizzle-orm/pg-core/checks.js
|
|
9
10
|
var CheckBuilder = class {
|
|
@@ -580,8 +581,59 @@ const { environmentsRelations, secretsRelations, syncsRelations, syncKeysRelatio
|
|
|
580
581
|
});
|
|
581
582
|
//#endregion
|
|
582
583
|
//#region ../db/dist/index.js
|
|
584
|
+
/**
|
|
585
|
+
* A query made on the database from inside one of its own transactions,
|
|
586
|
+
* rather than through the transaction. With one connection per call, as on
|
|
587
|
+
* Workers, it would wait for the transaction, which waits for it: a call
|
|
588
|
+
* Cloudflare cancels as hung, and nothing says why. So it is refused at
|
|
589
|
+
* once, with this, wherever the database runs.
|
|
590
|
+
*/
|
|
591
|
+
var QueryOutsideTransaction = class extends Error {
|
|
592
|
+
constructor() {
|
|
593
|
+
super("query outside its transaction: use tx. A query on the database inside one of its own transactions waits for that transaction, which waits for it");
|
|
594
|
+
this.name = "QueryOutsideTransaction";
|
|
595
|
+
}
|
|
596
|
+
};
|
|
597
|
+
/** The transaction a flow of work runs inside, with the pool it holds, while it is open. */
|
|
598
|
+
const inside = new AsyncLocalStorage();
|
|
599
|
+
/**
|
|
600
|
+
* `pool`, refusing a query or a transaction asked from inside a transaction
|
|
601
|
+
* it is already running. Work from any other flow, a concurrent request's,
|
|
602
|
+
* or what the transaction left running after it ended, goes on as before.
|
|
603
|
+
*/
|
|
604
|
+
function guarded(pool) {
|
|
605
|
+
return new Proxy(pool, { get(target, key) {
|
|
606
|
+
const value = Reflect.get(target, key, target);
|
|
607
|
+
if (typeof value !== "function") return value;
|
|
608
|
+
if (key !== "query" && key !== "connect") return value.bind(target);
|
|
609
|
+
return (...args) => {
|
|
610
|
+
const open = inside.getStore();
|
|
611
|
+
if (open?.open === true && open.pool === target) throw new QueryOutsideTransaction();
|
|
612
|
+
return value.apply(target, args);
|
|
613
|
+
};
|
|
614
|
+
} });
|
|
615
|
+
}
|
|
616
|
+
/** The refusal `error` is, or was caused by. */
|
|
617
|
+
function brokenRule(error) {
|
|
618
|
+
for (let cause = error; cause instanceof Error; cause = cause.cause) if (cause instanceof QueryOutsideTransaction) return cause;
|
|
619
|
+
}
|
|
583
620
|
function createDatabase(pool) {
|
|
584
|
-
|
|
621
|
+
const db = drizzle(guarded(pool), { schema: schema_exports });
|
|
622
|
+
const run = db.transaction.bind(db);
|
|
623
|
+
db.transaction = (async (work, config) => {
|
|
624
|
+
const open = {
|
|
625
|
+
pool,
|
|
626
|
+
open: true
|
|
627
|
+
};
|
|
628
|
+
try {
|
|
629
|
+
return await run((tx) => inside.run(open, () => work(tx)), config);
|
|
630
|
+
} catch (error) {
|
|
631
|
+
throw brokenRule(error) ?? error;
|
|
632
|
+
} finally {
|
|
633
|
+
open.open = false;
|
|
634
|
+
}
|
|
635
|
+
});
|
|
636
|
+
return trackCommits(db);
|
|
585
637
|
}
|
|
586
638
|
//#endregion
|
|
587
639
|
//#region ../../node_modules/.pnpm/pg-connection-string@2.14.0/node_modules/pg-connection-string/esm/index.mjs
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as openDatabase, r as postgresConnection, t as engineOfUrl } from "./connect-
|
|
1
|
+
import { n as openDatabase, r as postgresConnection, t as engineOfUrl } from "./connect-CpN0VYGE.js";
|
|
2
2
|
export { engineOfUrl, openDatabase, postgresConnection };
|
package/dist/main.js
CHANGED
|
@@ -2639,7 +2639,7 @@ switch (command) {
|
|
|
2639
2639
|
await keys(rest);
|
|
2640
2640
|
break;
|
|
2641
2641
|
case "setup":
|
|
2642
|
-
await (await import("./setup-
|
|
2642
|
+
await (await import("./setup-ClLcofuy.js")).setup(rest);
|
|
2643
2643
|
break;
|
|
2644
2644
|
case "login":
|
|
2645
2645
|
await login(rest);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { d as esm_default } from "./esm-Bts-esAl.js";
|
|
2
2
|
import { C as yes, E as isEmpty, S as wrap, T as init, _ as select, b as truncate, c as Cancelled, d as listed, f as openTerminal, g as row, h as release, i as keyValues, l as edit, m as readKeys, n as jsonWarning, o as needsTerminal, p as paragraph, r as keyGuide, s as showSecrets, t as generateKeys, u as hiddenLine, v as style, w as KINDS, x as width, y as textLine } from "./keys-BCKUEb-Y.js";
|
|
3
|
-
import { r as postgresConnection, t as engineOfUrl } from "./connect-
|
|
3
|
+
import { r as postgresConnection, t as engineOfUrl } from "./connect-CpN0VYGE.js";
|
|
4
4
|
import { parseArgs } from "node:util";
|
|
5
5
|
import { spawn } from "node:child_process";
|
|
6
6
|
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
@@ -95,7 +95,7 @@ async function postgresMigrator(url) {
|
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
97
|
async function sqliteMigrator(url) {
|
|
98
|
-
const [{ openDatabase }, { migrate }] = await Promise.all([import("./connect-
|
|
98
|
+
const [{ openDatabase }, { migrate }] = await Promise.all([import("./connect-fkn_APVy.js"), import("drizzle-orm/libsql/migrator")]);
|
|
99
99
|
const { db, close } = await openDatabase(url);
|
|
100
100
|
const sqlite = db;
|
|
101
101
|
return {
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
"conformance": "coffre-conformance node"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@coffre/server": "0.1.
|
|
17
|
-
"@coffre/vault": "0.1.
|
|
16
|
+
"@coffre/server": "0.1.11",
|
|
17
|
+
"@coffre/vault": "0.1.11"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@coffre/conformance": "0.1.
|
|
20
|
+
"@coffre/conformance": "0.1.11",
|
|
21
21
|
"@types/node": "26.1.1",
|
|
22
22
|
"typescript": "5.9.3"
|
|
23
23
|
}
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
"conformance": "coffre-conformance workers"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@coffre/server": "0.1.
|
|
18
|
-
"@coffre/ui": "0.1.
|
|
19
|
-
"@coffre/vault": "0.1.
|
|
17
|
+
"@coffre/server": "0.1.11",
|
|
18
|
+
"@coffre/ui": "0.1.11",
|
|
19
|
+
"@coffre/vault": "0.1.11"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@cloudflare/workers-types": "5.20260920.1",
|
|
23
|
-
"@coffre/conformance": "0.1.
|
|
23
|
+
"@coffre/conformance": "0.1.11",
|
|
24
24
|
"typescript": "5.9.3",
|
|
25
25
|
"wrangler": "4.118.0"
|
|
26
26
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coffre/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"description": "The coffre command line: secrets in your shell, and `coffre init` for a new deployment.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"pg": "8.16.3",
|
|
29
29
|
"tsdown": "0.23.0",
|
|
30
30
|
"typescript": "5.9.3",
|
|
31
|
-
"@coffre/client": "0.1.
|
|
32
|
-
"@coffre/core": "0.1.
|
|
33
|
-
"@coffre/db": "0.1.
|
|
31
|
+
"@coffre/client": "0.1.11",
|
|
32
|
+
"@coffre/core": "0.1.11",
|
|
33
|
+
"@coffre/db": "0.1.11"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"build": "tsdown && node scripts/copy-templates.ts && node scripts/copy-migrations.ts",
|