@treeseed/sdk 0.6.16 → 0.6.18
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/db/d1.d.ts +3493 -0
- package/dist/db/d1.js +8 -0
- package/dist/db/index.d.ts +2 -0
- package/dist/db/index.js +2 -0
- package/dist/db/node-sqlite.d.ts +3544 -0
- package/dist/db/node-sqlite.js +119 -0
- package/dist/db/schema.d.ts +6272 -0
- package/dist/db/schema.js +231 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/operations/providers/default.js +1 -0
- package/dist/operations/services/commit-message-provider.d.ts +33 -1
- package/dist/operations/services/commit-message-provider.js +228 -51
- package/dist/operations/services/config-runtime.js +0 -1
- package/dist/operations/services/deploy.d.ts +19 -5
- package/dist/operations/services/deploy.js +75 -36
- package/dist/operations/services/github-actions-verification.d.ts +123 -0
- package/dist/operations/services/github-actions-verification.js +440 -0
- package/dist/operations/services/mailpit-runtime.d.ts +5 -0
- package/dist/operations/services/mailpit-runtime.js +2 -2
- package/dist/operations/services/repository-save-orchestrator.js +64 -8
- package/dist/operations/services/runtime-tools.d.ts +6 -0
- package/dist/operations/services/runtime-tools.js +11 -0
- package/dist/operations-registry.js +1 -0
- package/dist/platform/contracts.d.ts +6 -0
- package/dist/platform/deploy-config.js +17 -0
- package/dist/reconcile/builtin-adapters.js +2 -16
- package/dist/reconcile/contracts.d.ts +1 -1
- package/dist/reconcile/desired-state.d.ts +6 -0
- package/dist/reconcile/desired-state.js +1 -13
- package/dist/reconcile/engine.d.ts +12 -0
- package/dist/reconcile/state.js +2 -1
- package/dist/reconcile/units.js +0 -1
- package/dist/scripts/tenant-d1-migrate-local.js +5 -2
- package/dist/scripts/tenant-destroy.js +3 -1
- package/dist/sdk.js +2 -6
- package/dist/types/cloudflare.d.ts +0 -1
- package/dist/workflow/operations.d.ts +2 -1
- package/dist/workflow/operations.js +115 -35
- package/dist/workflow-support.d.ts +1 -0
- package/dist/workflow-support.js +6 -0
- package/dist/workflow.d.ts +24 -2
- package/dist/workflow.js +6 -0
- package/package.json +19 -5
- package/templates/github/deploy.workflow.yml +4 -0
- package/dist/wrangler-d1.d.ts +0 -25
- package/dist/wrangler-d1.js +0 -89
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@treeseed/sdk",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.18",
|
|
4
4
|
"description": "Shared Treeseed SDK for content-backed and D1-backed object models.",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"repository": {
|
|
@@ -62,6 +62,7 @@
|
|
|
62
62
|
"esbuild": "^0.28.0",
|
|
63
63
|
"extract-zip": "2.0.1",
|
|
64
64
|
"github-slugger": "^2.0.0",
|
|
65
|
+
"drizzle-orm": "^0.45.2",
|
|
65
66
|
"ink": "^7.0.0",
|
|
66
67
|
"libsodium-wrappers": "^0.7.15",
|
|
67
68
|
"mdast-util-to-string": "^4.0.0",
|
|
@@ -79,6 +80,7 @@
|
|
|
79
80
|
},
|
|
80
81
|
"devDependencies": {
|
|
81
82
|
"@types/node": "^24.6.0",
|
|
83
|
+
"drizzle-kit": "^0.31.10",
|
|
82
84
|
"vitest": "^4.1.2"
|
|
83
85
|
},
|
|
84
86
|
"exports": {
|
|
@@ -227,14 +229,26 @@
|
|
|
227
229
|
"types": "./dist/types/cloudflare.d.ts",
|
|
228
230
|
"default": "./dist/types/cloudflare.js"
|
|
229
231
|
},
|
|
230
|
-
"./wrangler-d1": {
|
|
231
|
-
"types": "./dist/wrangler-d1.d.ts",
|
|
232
|
-
"default": "./dist/wrangler-d1.js"
|
|
233
|
-
},
|
|
234
232
|
"./d1-http": {
|
|
235
233
|
"types": "./dist/d1-http.d.ts",
|
|
236
234
|
"default": "./dist/d1-http.js"
|
|
237
235
|
},
|
|
236
|
+
"./db": {
|
|
237
|
+
"types": "./dist/db/index.d.ts",
|
|
238
|
+
"default": "./dist/db/index.js"
|
|
239
|
+
},
|
|
240
|
+
"./db/schema": {
|
|
241
|
+
"types": "./dist/db/schema.d.ts",
|
|
242
|
+
"default": "./dist/db/schema.js"
|
|
243
|
+
},
|
|
244
|
+
"./db/d1": {
|
|
245
|
+
"types": "./dist/db/d1.d.ts",
|
|
246
|
+
"default": "./dist/db/d1.js"
|
|
247
|
+
},
|
|
248
|
+
"./db/node-sqlite": {
|
|
249
|
+
"types": "./dist/db/node-sqlite.d.ts",
|
|
250
|
+
"default": "./dist/db/node-sqlite.js"
|
|
251
|
+
},
|
|
238
252
|
"./stores/cursor-store": {
|
|
239
253
|
"types": "./dist/stores/cursor-store.d.ts",
|
|
240
254
|
"default": "./dist/stores/cursor-store.js"
|
|
@@ -237,6 +237,7 @@ __WORKING_DIRECTORY_BLOCK__
|
|
|
237
237
|
TREESEED_PROJECT_DOMAINS: ${{ vars.TREESEED_PROJECT_DOMAINS }}
|
|
238
238
|
TREESEED_API_BASE_URL: ${{ vars.TREESEED_API_BASE_URL }}
|
|
239
239
|
TREESEED_BETTER_AUTH_SECRET: ${{ secrets.TREESEED_BETTER_AUTH_SECRET }}
|
|
240
|
+
TREESEED_API_AUTH_SECRET: ${{ secrets.TREESEED_API_AUTH_SECRET }}
|
|
240
241
|
TREESEED_WEB_SERVICE_ID: ${{ vars.TREESEED_WEB_SERVICE_ID }}
|
|
241
242
|
TREESEED_WEB_SERVICE_SECRET: ${{ secrets.TREESEED_WEB_SERVICE_SECRET }}
|
|
242
243
|
TREESEED_WEB_ASSERTION_SECRET: ${{ secrets.TREESEED_WEB_ASSERTION_SECRET }}
|
|
@@ -382,6 +383,7 @@ __WORKING_DIRECTORY_BLOCK__
|
|
|
382
383
|
TREESEED_PROJECT_DOMAINS: ${{ vars.TREESEED_PROJECT_DOMAINS }}
|
|
383
384
|
TREESEED_API_BASE_URL: ${{ vars.TREESEED_API_BASE_URL }}
|
|
384
385
|
TREESEED_BETTER_AUTH_SECRET: ${{ secrets.TREESEED_BETTER_AUTH_SECRET }}
|
|
386
|
+
TREESEED_API_AUTH_SECRET: ${{ secrets.TREESEED_API_AUTH_SECRET }}
|
|
385
387
|
TREESEED_WEB_SERVICE_ID: ${{ vars.TREESEED_WEB_SERVICE_ID }}
|
|
386
388
|
TREESEED_WEB_SERVICE_SECRET: ${{ secrets.TREESEED_WEB_SERVICE_SECRET }}
|
|
387
389
|
TREESEED_WEB_ASSERTION_SECRET: ${{ secrets.TREESEED_WEB_ASSERTION_SECRET }}
|
|
@@ -523,6 +525,7 @@ __WORKING_DIRECTORY_BLOCK__
|
|
|
523
525
|
TREESEED_PROJECT_DOMAINS: ${{ vars.TREESEED_PROJECT_DOMAINS }}
|
|
524
526
|
TREESEED_API_BASE_URL: ${{ vars.TREESEED_API_BASE_URL }}
|
|
525
527
|
TREESEED_BETTER_AUTH_SECRET: ${{ secrets.TREESEED_BETTER_AUTH_SECRET }}
|
|
528
|
+
TREESEED_API_AUTH_SECRET: ${{ secrets.TREESEED_API_AUTH_SECRET }}
|
|
526
529
|
TREESEED_WEB_SERVICE_ID: ${{ vars.TREESEED_WEB_SERVICE_ID }}
|
|
527
530
|
TREESEED_WEB_SERVICE_SECRET: ${{ secrets.TREESEED_WEB_SERVICE_SECRET }}
|
|
528
531
|
TREESEED_WEB_ASSERTION_SECRET: ${{ secrets.TREESEED_WEB_ASSERTION_SECRET }}
|
|
@@ -653,6 +656,7 @@ __WORKING_DIRECTORY_BLOCK__
|
|
|
653
656
|
TREESEED_PROJECT_DOMAINS: ${{ vars.TREESEED_PROJECT_DOMAINS }}
|
|
654
657
|
TREESEED_API_BASE_URL: ${{ vars.TREESEED_API_BASE_URL }}
|
|
655
658
|
TREESEED_BETTER_AUTH_SECRET: ${{ secrets.TREESEED_BETTER_AUTH_SECRET }}
|
|
659
|
+
TREESEED_API_AUTH_SECRET: ${{ secrets.TREESEED_API_AUTH_SECRET }}
|
|
656
660
|
TREESEED_WEB_SERVICE_ID: ${{ vars.TREESEED_WEB_SERVICE_ID }}
|
|
657
661
|
TREESEED_WEB_SERVICE_SECRET: ${{ secrets.TREESEED_WEB_SERVICE_SECRET }}
|
|
658
662
|
TREESEED_WEB_ASSERTION_SECRET: ${{ secrets.TREESEED_WEB_ASSERTION_SECRET }}
|
package/dist/wrangler-d1.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { D1DatabaseLike, D1PreparedStatementLike } from './types/cloudflare.ts';
|
|
2
|
-
declare class WranglerD1PreparedStatement implements D1PreparedStatementLike {
|
|
3
|
-
private readonly databaseName;
|
|
4
|
-
private readonly cwd;
|
|
5
|
-
private readonly persistTo?;
|
|
6
|
-
private readonly query;
|
|
7
|
-
private bindings;
|
|
8
|
-
constructor(databaseName: string, cwd: string, persistTo?: string | undefined, query?: string);
|
|
9
|
-
bind(...values: unknown[]): this;
|
|
10
|
-
private execute;
|
|
11
|
-
run(): Promise<any[]>;
|
|
12
|
-
all<T = Record<string, unknown>>(): Promise<{
|
|
13
|
-
results: T[];
|
|
14
|
-
}>;
|
|
15
|
-
first<T = Record<string, unknown>>(): Promise<NonNullable<T> | null>;
|
|
16
|
-
raw<T = unknown[]>(): Promise<T[]>;
|
|
17
|
-
}
|
|
18
|
-
export declare class WranglerD1Database implements D1DatabaseLike {
|
|
19
|
-
private readonly databaseName;
|
|
20
|
-
private readonly cwd;
|
|
21
|
-
private readonly persistTo?;
|
|
22
|
-
constructor(databaseName: string, cwd: string, persistTo?: string | undefined);
|
|
23
|
-
prepare(query: string): WranglerD1PreparedStatement;
|
|
24
|
-
}
|
|
25
|
-
export {};
|
package/dist/wrangler-d1.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { execFile } from "node:child_process";
|
|
2
|
-
import { promisify } from "node:util";
|
|
3
|
-
import { resolveTreeseedToolCommand } from "./managed-dependencies.js";
|
|
4
|
-
const execFileAsync = promisify(execFile);
|
|
5
|
-
function toSqlValue(value) {
|
|
6
|
-
if (value === null || value === void 0) {
|
|
7
|
-
return "NULL";
|
|
8
|
-
}
|
|
9
|
-
if (typeof value === "number") {
|
|
10
|
-
return String(value);
|
|
11
|
-
}
|
|
12
|
-
if (typeof value === "boolean") {
|
|
13
|
-
return value ? "1" : "0";
|
|
14
|
-
}
|
|
15
|
-
return `'${String(value).replace(/'/g, "''")}'`;
|
|
16
|
-
}
|
|
17
|
-
function interpolateBindings(query, values) {
|
|
18
|
-
let result = query;
|
|
19
|
-
for (const value of values) {
|
|
20
|
-
result = result.replace(/\?/, toSqlValue(value));
|
|
21
|
-
}
|
|
22
|
-
return result;
|
|
23
|
-
}
|
|
24
|
-
class WranglerD1PreparedStatement {
|
|
25
|
-
constructor(databaseName, cwd, persistTo, query = "") {
|
|
26
|
-
this.databaseName = databaseName;
|
|
27
|
-
this.cwd = cwd;
|
|
28
|
-
this.persistTo = persistTo;
|
|
29
|
-
this.query = query;
|
|
30
|
-
}
|
|
31
|
-
databaseName;
|
|
32
|
-
cwd;
|
|
33
|
-
persistTo;
|
|
34
|
-
query;
|
|
35
|
-
bindings = [];
|
|
36
|
-
bind(...values) {
|
|
37
|
-
this.bindings = values;
|
|
38
|
-
return this;
|
|
39
|
-
}
|
|
40
|
-
async execute() {
|
|
41
|
-
const args = ["d1", "execute", this.databaseName, "--json", "--command", interpolateBindings(this.query, this.bindings)];
|
|
42
|
-
if (this.persistTo) {
|
|
43
|
-
args.splice(3, 0, "--local", "--persist-to", this.persistTo);
|
|
44
|
-
}
|
|
45
|
-
const wrangler = resolveTreeseedToolCommand("wrangler");
|
|
46
|
-
if (!wrangler) {
|
|
47
|
-
throw new Error("Wrangler CLI is unavailable.");
|
|
48
|
-
}
|
|
49
|
-
const { stdout } = await execFileAsync(wrangler.command, [...wrangler.argsPrefix, ...args], {
|
|
50
|
-
cwd: this.cwd,
|
|
51
|
-
env: process.env
|
|
52
|
-
});
|
|
53
|
-
const parsed = JSON.parse(stdout);
|
|
54
|
-
return Array.isArray(parsed) ? parsed : [parsed];
|
|
55
|
-
}
|
|
56
|
-
async run() {
|
|
57
|
-
return this.execute();
|
|
58
|
-
}
|
|
59
|
-
async all() {
|
|
60
|
-
const results = await this.execute();
|
|
61
|
-
return {
|
|
62
|
-
results: results.flatMap((entry) => entry.results ?? [])
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
async first() {
|
|
66
|
-
const { results } = await this.all();
|
|
67
|
-
return results[0] ?? null;
|
|
68
|
-
}
|
|
69
|
-
async raw() {
|
|
70
|
-
const { results } = await this.all();
|
|
71
|
-
return results.map((entry) => Object.values(entry));
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
class WranglerD1Database {
|
|
75
|
-
constructor(databaseName, cwd, persistTo) {
|
|
76
|
-
this.databaseName = databaseName;
|
|
77
|
-
this.cwd = cwd;
|
|
78
|
-
this.persistTo = persistTo;
|
|
79
|
-
}
|
|
80
|
-
databaseName;
|
|
81
|
-
cwd;
|
|
82
|
-
persistTo;
|
|
83
|
-
prepare(query) {
|
|
84
|
-
return new WranglerD1PreparedStatement(this.databaseName, this.cwd, this.persistTo, query);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
export {
|
|
88
|
-
WranglerD1Database
|
|
89
|
-
};
|