@treeseed/sdk 0.4.9 → 0.4.10
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/control-plane-client.d.ts +45 -0
- package/dist/control-plane-client.js +229 -0
- package/dist/control-plane.d.ts +94 -0
- package/dist/control-plane.js +125 -0
- package/dist/d1-store.d.ts +56 -1
- package/dist/d1-store.js +132 -0
- package/dist/index.d.ts +11 -1
- package/dist/index.js +69 -1
- package/dist/operations/services/config-runtime.d.ts +10 -0
- package/dist/operations/services/config-runtime.js +60 -2
- package/dist/operations/services/deploy.d.ts +95 -0
- package/dist/operations/services/deploy.js +350 -9
- package/dist/operations/services/github-automation.d.ts +37 -1
- package/dist/operations/services/github-automation.js +71 -14
- package/dist/operations/services/project-platform.d.ts +835 -0
- package/dist/operations/services/project-platform.js +782 -0
- package/dist/operations/services/railway-deploy.d.ts +113 -18
- package/dist/operations/services/railway-deploy.js +355 -6
- package/dist/operations/services/runtime-tools.d.ts +25 -0
- package/dist/operations/services/runtime-tools.js +65 -3
- package/dist/operations/services/template-registry.d.ts +1 -1
- package/dist/operations/services/template-registry.js +17 -3
- package/dist/platform/books-data.d.ts +3 -4
- package/dist/platform/books-data.js +30 -4
- package/dist/platform/contracts.d.ts +55 -2
- package/dist/platform/deploy-config.js +109 -4
- package/dist/platform/deploy-runtime.d.ts +2 -0
- package/dist/platform/deploy-runtime.js +9 -1
- package/dist/platform/env.yaml +677 -0
- package/dist/platform/environment.js +57 -2
- package/dist/platform/plugin.d.ts +8 -0
- package/dist/platform/plugins/constants.d.ts +2 -0
- package/dist/platform/plugins/constants.js +2 -0
- package/dist/platform/plugins/runtime.d.ts +2 -0
- package/dist/platform/plugins/runtime.js +9 -1
- package/dist/platform/plugins.d.ts +1 -1
- package/dist/platform/plugins.js +4 -0
- package/dist/platform/published-content-pipeline.d.ts +84 -0
- package/dist/platform/published-content-pipeline.js +543 -0
- package/dist/platform/published-content.d.ts +223 -0
- package/dist/platform/published-content.js +588 -0
- package/dist/platform/tenant/runtime-config.d.ts +1 -1
- package/dist/platform/tenant/runtime-config.js +34 -1
- package/dist/platform/tenant-config.d.ts +2 -1
- package/dist/platform/tenant-config.js +17 -1
- package/dist/platform/utils/site-config-schema.js +104 -0
- package/dist/plugin-default.d.ts +2 -0
- package/dist/plugin-default.js +2 -0
- package/dist/scripts/check-build-warnings.js +50 -0
- package/dist/scripts/config-treeseed.js +7 -0
- package/dist/scripts/tenant-workflow-action.js +71 -0
- package/dist/sdk-types.d.ts +442 -3
- package/dist/sdk-types.js +37 -1
- package/dist/sdk.d.ts +11 -1
- package/dist/sdk.js +40 -0
- package/dist/stores/operational-store.d.ts +22 -2
- package/dist/stores/operational-store.js +235 -0
- package/dist/template-catalog.js +8 -1
- package/dist/treeseed/template-catalog/templates/starter-basic/template/treeseed.site.yaml +20 -0
- package/dist/types/cloudflare.d.ts +23 -0
- package/dist/workflow/operations.d.ts +12 -3
- package/dist/workflow/policy.d.ts +1 -1
- package/package.json +7 -2
- package/templates/github/deploy.workflow.yml +442 -0
- package/templates/github/hosted-project.workflow.yml +77 -0
|
@@ -88,6 +88,78 @@ function reportFromRow(row) {
|
|
|
88
88
|
createdAt: String(row.created_at ?? row.createdAt ?? nowIso())
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
|
+
function parseJsonValue(value, fallback) {
|
|
92
|
+
if (typeof value !== "string" || !value.trim()) {
|
|
93
|
+
return fallback;
|
|
94
|
+
}
|
|
95
|
+
try {
|
|
96
|
+
return JSON.parse(value);
|
|
97
|
+
} catch {
|
|
98
|
+
return fallback;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
function normalizeAutoscale(value, fallback) {
|
|
102
|
+
return {
|
|
103
|
+
minWorkers: Number(value?.minWorkers ?? fallback?.minWorkers ?? 0),
|
|
104
|
+
maxWorkers: Number(value?.maxWorkers ?? fallback?.maxWorkers ?? 1),
|
|
105
|
+
targetQueueDepth: Number(value?.targetQueueDepth ?? fallback?.targetQueueDepth ?? 1),
|
|
106
|
+
cooldownSeconds: Number(value?.cooldownSeconds ?? fallback?.cooldownSeconds ?? 60)
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
function workPolicyFromRow(row) {
|
|
110
|
+
return {
|
|
111
|
+
projectId: String(row.project_id ?? ""),
|
|
112
|
+
environment: String(row.environment ?? "local"),
|
|
113
|
+
schedule: parseJsonValue(row.schedule_json, {
|
|
114
|
+
timezone: "UTC",
|
|
115
|
+
windows: []
|
|
116
|
+
}),
|
|
117
|
+
dailyTaskCreditBudget: Number(row.daily_task_credit_budget ?? 0),
|
|
118
|
+
maxQueuedTasks: Number(row.max_queued_tasks ?? 0),
|
|
119
|
+
maxQueuedCredits: Number(row.max_queued_credits ?? 0),
|
|
120
|
+
autoscale: normalizeAutoscale(parseJsonValue(row.autoscale_json, {})),
|
|
121
|
+
creditWeights: parseJsonValue(row.credit_weights_json, []),
|
|
122
|
+
metadata: parseJsonValue(row.metadata_json, {})
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
function prioritySnapshotFromRow(row) {
|
|
126
|
+
const payload = parseJsonValue(row.snapshot_json, {});
|
|
127
|
+
return {
|
|
128
|
+
id: String(row.id ?? ""),
|
|
129
|
+
projectId: String(row.project_id ?? ""),
|
|
130
|
+
workDayId: row.work_day_id !== void 0 && row.work_day_id !== null ? String(row.work_day_id) : null,
|
|
131
|
+
generatedAt: String(row.generated_at ?? row.created_at ?? nowIso()),
|
|
132
|
+
items: Array.isArray(payload.items) ? payload.items : [],
|
|
133
|
+
metadata: parseJsonValue(row.metadata_json, {})
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
function taskCreditLedgerEntryFromRow(row) {
|
|
137
|
+
return {
|
|
138
|
+
id: String(row.id ?? ""),
|
|
139
|
+
projectId: String(row.project_id ?? ""),
|
|
140
|
+
workDayId: String(row.work_day_id ?? ""),
|
|
141
|
+
taskId: row.task_id !== void 0 && row.task_id !== null ? String(row.task_id) : null,
|
|
142
|
+
phase: String(row.phase ?? "seed"),
|
|
143
|
+
credits: Number(row.credits ?? 0),
|
|
144
|
+
metadata: parseJsonValue(row.metadata_json, {}),
|
|
145
|
+
createdAt: String(row.created_at ?? nowIso())
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
function scaleDecisionFromRow(row) {
|
|
149
|
+
return {
|
|
150
|
+
id: String(row.id ?? ""),
|
|
151
|
+
projectId: String(row.project_id ?? ""),
|
|
152
|
+
environment: String(row.environment ?? "local"),
|
|
153
|
+
poolName: String(row.pool_name ?? ""),
|
|
154
|
+
workDayId: row.work_day_id !== void 0 && row.work_day_id !== null ? String(row.work_day_id) : null,
|
|
155
|
+
desiredWorkers: Number(row.desired_workers ?? 0),
|
|
156
|
+
observedQueueDepth: Number(row.observed_queue_depth ?? 0),
|
|
157
|
+
observedActiveLeases: Number(row.observed_active_leases ?? 0),
|
|
158
|
+
reason: String(row.reason ?? "reconcile"),
|
|
159
|
+
metadata: parseJsonValue(row.metadata_json, {}),
|
|
160
|
+
createdAt: String(row.created_at ?? nowIso())
|
|
161
|
+
};
|
|
162
|
+
}
|
|
91
163
|
class OperationalStore extends SqliteStoreBase {
|
|
92
164
|
async getWorkDay(id) {
|
|
93
165
|
const row = await this.selectFirst(`SELECT * FROM work_days WHERE id = ${toSqlValue(id)} LIMIT 1`);
|
|
@@ -273,6 +345,169 @@ class OperationalStore extends SqliteStoreBase {
|
|
|
273
345
|
const row = await this.selectFirst(`SELECT * FROM reports WHERE id = ${toSqlValue(id)} LIMIT 1`);
|
|
274
346
|
return row ? reportFromRow(row) : null;
|
|
275
347
|
}
|
|
348
|
+
async getWorkPolicy(projectId, environment = "local") {
|
|
349
|
+
if (!await this.tableExists("work_policies")) {
|
|
350
|
+
return null;
|
|
351
|
+
}
|
|
352
|
+
const row = await this.selectFirst(
|
|
353
|
+
`SELECT * FROM work_policies WHERE project_id = ${toSqlValue(projectId)} AND environment = ${toSqlValue(environment)} LIMIT 1`
|
|
354
|
+
);
|
|
355
|
+
return row ? workPolicyFromRow(row) : null;
|
|
356
|
+
}
|
|
357
|
+
async upsertWorkPolicy(request) {
|
|
358
|
+
const timestamp = nowIso();
|
|
359
|
+
await this.execute(
|
|
360
|
+
`INSERT OR REPLACE INTO work_policies (
|
|
361
|
+
project_id, environment, schedule_json, daily_task_credit_budget, max_queued_tasks, max_queued_credits, autoscale_json, credit_weights_json, metadata_json, created_at, updated_at
|
|
362
|
+
) VALUES (
|
|
363
|
+
${toSqlValue(request.projectId)},
|
|
364
|
+
${toSqlValue(request.environment)},
|
|
365
|
+
${toSqlValue(json(request.schedule))},
|
|
366
|
+
${Number(request.dailyTaskCreditBudget ?? 0)},
|
|
367
|
+
${Number(request.maxQueuedTasks ?? 0)},
|
|
368
|
+
${Number(request.maxQueuedCredits ?? 0)},
|
|
369
|
+
${toSqlValue(json(request.autoscale))},
|
|
370
|
+
${toSqlValue(json(request.creditWeights ?? []))},
|
|
371
|
+
${toSqlValue(json(request.metadata ?? {}))},
|
|
372
|
+
COALESCE((SELECT created_at FROM work_policies WHERE project_id = ${toSqlValue(request.projectId)} AND environment = ${toSqlValue(request.environment)}), ${toSqlValue(timestamp)}),
|
|
373
|
+
${toSqlValue(timestamp)}
|
|
374
|
+
)`
|
|
375
|
+
);
|
|
376
|
+
return this.getWorkPolicy(request.projectId, request.environment);
|
|
377
|
+
}
|
|
378
|
+
async listPriorityOverrides(projectId) {
|
|
379
|
+
if (!await this.tableExists("priority_overrides")) {
|
|
380
|
+
return [];
|
|
381
|
+
}
|
|
382
|
+
return this.selectAll(
|
|
383
|
+
`SELECT * FROM priority_overrides WHERE project_id = ${toSqlValue(projectId)} ORDER BY priority DESC, updated_at DESC`
|
|
384
|
+
);
|
|
385
|
+
}
|
|
386
|
+
async upsertPriorityOverride(request) {
|
|
387
|
+
const id = request.id ?? crypto.randomUUID();
|
|
388
|
+
const timestamp = nowIso();
|
|
389
|
+
await this.execute(
|
|
390
|
+
`INSERT OR REPLACE INTO priority_overrides (
|
|
391
|
+
id, project_id, model, subject_id, priority, estimated_credits, metadata_json, created_at, updated_at
|
|
392
|
+
) VALUES (
|
|
393
|
+
${toSqlValue(id)},
|
|
394
|
+
${toSqlValue(request.projectId)},
|
|
395
|
+
${toSqlValue(request.model)},
|
|
396
|
+
${toSqlValue(request.subjectId)},
|
|
397
|
+
${Number(request.priority ?? 0)},
|
|
398
|
+
${toSqlValue(request.estimatedCredits ?? null)},
|
|
399
|
+
${toSqlValue(json(request.metadata ?? {}))},
|
|
400
|
+
COALESCE((SELECT created_at FROM priority_overrides WHERE id = ${toSqlValue(id)}), ${toSqlValue(timestamp)}),
|
|
401
|
+
${toSqlValue(timestamp)}
|
|
402
|
+
)`
|
|
403
|
+
);
|
|
404
|
+
const row = await this.selectFirst(`SELECT * FROM priority_overrides WHERE id = ${toSqlValue(id)} LIMIT 1`);
|
|
405
|
+
return row ? {
|
|
406
|
+
id: String(row.id ?? ""),
|
|
407
|
+
projectId: String(row.project_id ?? ""),
|
|
408
|
+
model: String(row.model ?? ""),
|
|
409
|
+
subjectId: String(row.subject_id ?? ""),
|
|
410
|
+
priority: Number(row.priority ?? 0),
|
|
411
|
+
estimatedCredits: row.estimated_credits === null || row.estimated_credits === void 0 ? null : Number(row.estimated_credits),
|
|
412
|
+
metadata: parseJsonValue(row.metadata_json, {}),
|
|
413
|
+
createdAt: String(row.created_at ?? timestamp),
|
|
414
|
+
updatedAt: String(row.updated_at ?? timestamp)
|
|
415
|
+
} : null;
|
|
416
|
+
}
|
|
417
|
+
async createPrioritySnapshot(request) {
|
|
418
|
+
const id = request.id ?? crypto.randomUUID();
|
|
419
|
+
const timestamp = nowIso();
|
|
420
|
+
await this.execute(
|
|
421
|
+
`INSERT OR REPLACE INTO priority_snapshots (
|
|
422
|
+
id, project_id, work_day_id, snapshot_json, metadata_json, generated_at, created_at, updated_at
|
|
423
|
+
) VALUES (
|
|
424
|
+
${toSqlValue(id)},
|
|
425
|
+
${toSqlValue(request.projectId)},
|
|
426
|
+
${toSqlValue(request.workDayId ?? null)},
|
|
427
|
+
${toSqlValue(json({ items: request.items }))},
|
|
428
|
+
${toSqlValue(json(request.metadata ?? {}))},
|
|
429
|
+
${toSqlValue(timestamp)},
|
|
430
|
+
COALESCE((SELECT created_at FROM priority_snapshots WHERE id = ${toSqlValue(id)}), ${toSqlValue(timestamp)}),
|
|
431
|
+
${toSqlValue(timestamp)}
|
|
432
|
+
)`
|
|
433
|
+
);
|
|
434
|
+
const row = await this.selectFirst(`SELECT * FROM priority_snapshots WHERE id = ${toSqlValue(id)} LIMIT 1`);
|
|
435
|
+
return row ? prioritySnapshotFromRow(row) : null;
|
|
436
|
+
}
|
|
437
|
+
async getLatestPrioritySnapshot(projectId, workDayId) {
|
|
438
|
+
if (!await this.tableExists("priority_snapshots")) {
|
|
439
|
+
return null;
|
|
440
|
+
}
|
|
441
|
+
const row = await this.selectFirst(
|
|
442
|
+
`SELECT * FROM priority_snapshots WHERE project_id = ${toSqlValue(projectId)}${workDayId ? ` AND work_day_id = ${toSqlValue(workDayId)}` : ""} ORDER BY generated_at DESC LIMIT 1`
|
|
443
|
+
);
|
|
444
|
+
return row ? prioritySnapshotFromRow(row) : null;
|
|
445
|
+
}
|
|
446
|
+
async recordTaskCredits(request) {
|
|
447
|
+
const id = request.id ?? crypto.randomUUID();
|
|
448
|
+
const timestamp = nowIso();
|
|
449
|
+
await this.execute(
|
|
450
|
+
`INSERT INTO task_credit_ledger (
|
|
451
|
+
id, project_id, work_day_id, task_id, phase, credits, metadata_json, created_at
|
|
452
|
+
) VALUES (
|
|
453
|
+
${toSqlValue(id)},
|
|
454
|
+
${toSqlValue(request.projectId)},
|
|
455
|
+
${toSqlValue(request.workDayId)},
|
|
456
|
+
${toSqlValue(request.taskId ?? null)},
|
|
457
|
+
${toSqlValue(request.phase)},
|
|
458
|
+
${Number(request.credits ?? 0)},
|
|
459
|
+
${toSqlValue(json(request.metadata ?? {}))},
|
|
460
|
+
${toSqlValue(timestamp)}
|
|
461
|
+
)`
|
|
462
|
+
);
|
|
463
|
+
const delta = request.phase === "refund" ? -Math.abs(Number(request.credits ?? 0)) : Math.abs(Number(request.credits ?? 0));
|
|
464
|
+
await this.execute(
|
|
465
|
+
`UPDATE work_days SET capacity_used = MAX(0, capacity_used + ${delta}), updated_at = ${toSqlValue(timestamp)} WHERE id = ${toSqlValue(request.workDayId)}`
|
|
466
|
+
);
|
|
467
|
+
const row = await this.selectFirst(`SELECT * FROM task_credit_ledger WHERE id = ${toSqlValue(id)} LIMIT 1`);
|
|
468
|
+
return row ? taskCreditLedgerEntryFromRow(row) : null;
|
|
469
|
+
}
|
|
470
|
+
async listTaskCredits(workDayId) {
|
|
471
|
+
if (!await this.tableExists("task_credit_ledger")) {
|
|
472
|
+
return [];
|
|
473
|
+
}
|
|
474
|
+
const rows = await this.selectAll(
|
|
475
|
+
`SELECT * FROM task_credit_ledger WHERE work_day_id = ${toSqlValue(workDayId)} ORDER BY created_at ASC`
|
|
476
|
+
);
|
|
477
|
+
return rows.map(taskCreditLedgerEntryFromRow);
|
|
478
|
+
}
|
|
479
|
+
async recordScaleDecision(request) {
|
|
480
|
+
const id = request.id ?? crypto.randomUUID();
|
|
481
|
+
const timestamp = nowIso();
|
|
482
|
+
await this.execute(
|
|
483
|
+
`INSERT INTO scale_decisions (
|
|
484
|
+
id, project_id, environment, pool_name, work_day_id, desired_workers, observed_queue_depth, observed_active_leases, reason, metadata_json, created_at
|
|
485
|
+
) VALUES (
|
|
486
|
+
${toSqlValue(id)},
|
|
487
|
+
${toSqlValue(request.projectId)},
|
|
488
|
+
${toSqlValue(request.environment)},
|
|
489
|
+
${toSqlValue(request.poolName)},
|
|
490
|
+
${toSqlValue(request.workDayId ?? null)},
|
|
491
|
+
${Number(request.desiredWorkers ?? 0)},
|
|
492
|
+
${Number(request.observedQueueDepth ?? 0)},
|
|
493
|
+
${Number(request.observedActiveLeases ?? 0)},
|
|
494
|
+
${toSqlValue(request.reason)},
|
|
495
|
+
${toSqlValue(json(request.metadata ?? {}))},
|
|
496
|
+
${toSqlValue(timestamp)}
|
|
497
|
+
)`
|
|
498
|
+
);
|
|
499
|
+
const row = await this.selectFirst(`SELECT * FROM scale_decisions WHERE id = ${toSqlValue(id)} LIMIT 1`);
|
|
500
|
+
return row ? scaleDecisionFromRow(row) : null;
|
|
501
|
+
}
|
|
502
|
+
async getLatestScaleDecision(projectId, environment, poolName) {
|
|
503
|
+
if (!await this.tableExists("scale_decisions")) {
|
|
504
|
+
return null;
|
|
505
|
+
}
|
|
506
|
+
const row = await this.selectFirst(
|
|
507
|
+
`SELECT * FROM scale_decisions WHERE project_id = ${toSqlValue(projectId)} AND environment = ${toSqlValue(environment)} AND pool_name = ${toSqlValue(poolName)} ORDER BY created_at DESC LIMIT 1`
|
|
508
|
+
);
|
|
509
|
+
return row ? scaleDecisionFromRow(row) : null;
|
|
510
|
+
}
|
|
276
511
|
}
|
|
277
512
|
export {
|
|
278
513
|
OperationalStore
|
package/dist/template-catalog.js
CHANGED
|
@@ -67,7 +67,14 @@ function normalizeTemplateCatalogEntry(value) {
|
|
|
67
67
|
minCoreVersion: optionalString(record.minCoreVersion),
|
|
68
68
|
fulfillment: {
|
|
69
69
|
mode: optionalString(fulfillment.mode),
|
|
70
|
-
source: {
|
|
70
|
+
source: optionalString(source.kind) === "r2" ? {
|
|
71
|
+
kind: "r2",
|
|
72
|
+
bucket: optionalString(source.bucket),
|
|
73
|
+
objectKey: expectString(source.objectKey, "fulfillment.source.objectKey"),
|
|
74
|
+
version: expectString(source.version, "fulfillment.source.version"),
|
|
75
|
+
publicUrl: optionalString(source.publicUrl),
|
|
76
|
+
integrity: optionalString(source.integrity)
|
|
77
|
+
} : {
|
|
71
78
|
kind: "git",
|
|
72
79
|
repoUrl: expectString(source.repoUrl, "fulfillment.source.repoUrl"),
|
|
73
80
|
directory: expectString(source.directory, "fulfillment.source.directory"),
|
|
@@ -2,9 +2,27 @@ name: __SITE_NAME__
|
|
|
2
2
|
slug: __SITE_SLUG__
|
|
3
3
|
siteUrl: __SITE_URL__
|
|
4
4
|
contactEmail: __CONTACT_EMAIL__
|
|
5
|
+
hosting:
|
|
6
|
+
kind: hosted_project
|
|
7
|
+
registration: optional
|
|
8
|
+
marketBaseUrl: https://api.treeseed.ai
|
|
9
|
+
teamId: __SITE_SLUG__
|
|
10
|
+
projectId: __SITE_SLUG__
|
|
5
11
|
cloudflare:
|
|
6
12
|
accountId: replace-with-cloudflare-account-id
|
|
7
13
|
workerName: __SITE_SLUG__
|
|
14
|
+
pages:
|
|
15
|
+
projectName: __SITE_SLUG__
|
|
16
|
+
previewProjectName: __SITE_SLUG__-staging
|
|
17
|
+
productionBranch: main
|
|
18
|
+
stagingBranch: staging
|
|
19
|
+
buildOutputDir: dist
|
|
20
|
+
r2:
|
|
21
|
+
binding: TREESEED_CONTENT_BUCKET
|
|
22
|
+
bucketName: __SITE_SLUG__-content
|
|
23
|
+
manifestKeyTemplate: teams/{teamId}/published/common.json
|
|
24
|
+
previewRootTemplate: teams/{teamId}/previews
|
|
25
|
+
previewTtlHours: 168
|
|
8
26
|
plugins:
|
|
9
27
|
- package: '@treeseed/sdk/plugin-default'
|
|
10
28
|
providers:
|
|
@@ -18,6 +36,8 @@ providers:
|
|
|
18
36
|
research: stub
|
|
19
37
|
deploy: cloudflare
|
|
20
38
|
content:
|
|
39
|
+
runtime: team_scoped_r2_overlay
|
|
40
|
+
publish: team_scoped_r2_overlay
|
|
21
41
|
docs: default
|
|
22
42
|
site: default
|
|
23
43
|
smtp:
|
|
@@ -22,11 +22,34 @@ export interface D1DatabaseLike {
|
|
|
22
22
|
export interface CloudflareRuntimeAssets {
|
|
23
23
|
fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
|
24
24
|
}
|
|
25
|
+
export interface R2ObjectBodyLike {
|
|
26
|
+
text(): Promise<string>;
|
|
27
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
28
|
+
json<T = unknown>(): Promise<T>;
|
|
29
|
+
}
|
|
30
|
+
export interface R2ObjectLike extends R2ObjectBodyLike {
|
|
31
|
+
httpEtag?: string;
|
|
32
|
+
etag?: string;
|
|
33
|
+
size?: number;
|
|
34
|
+
uploaded?: Date;
|
|
35
|
+
writeHttpMetadata?(headers: Headers): void;
|
|
36
|
+
}
|
|
37
|
+
export interface R2PutOptionsLike {
|
|
38
|
+
httpMetadata?: Record<string, unknown>;
|
|
39
|
+
customMetadata?: Record<string, string>;
|
|
40
|
+
}
|
|
41
|
+
export interface R2BucketLike {
|
|
42
|
+
get(key: string): Promise<R2ObjectLike | null>;
|
|
43
|
+
head?(key: string): Promise<R2ObjectLike | null>;
|
|
44
|
+
put(key: string, value: string | ArrayBuffer | ArrayBufferView | ReadableStream, options?: R2PutOptionsLike): Promise<unknown>;
|
|
45
|
+
delete?(key: string | string[]): Promise<void>;
|
|
46
|
+
}
|
|
25
47
|
export interface CloudflareRuntime {
|
|
26
48
|
env: {
|
|
27
49
|
FORM_GUARD_KV: KvNamespaceLike;
|
|
28
50
|
SITE_DATA_DB: D1DatabaseLike;
|
|
29
51
|
SESSION: KvNamespaceLike;
|
|
30
52
|
ASSETS?: CloudflareRuntimeAssets;
|
|
53
|
+
[key: string]: unknown;
|
|
31
54
|
};
|
|
32
55
|
}
|
|
@@ -30,7 +30,7 @@ export declare function workflowTasks(helpers: WorkflowOperationHelpers): Promis
|
|
|
30
30
|
export declare function workflowConfig(helpers: WorkflowOperationHelpers, input?: TreeseedConfigInput): Promise<TreeseedWorkflowResult<{
|
|
31
31
|
mode: string;
|
|
32
32
|
scopes: ("local" | "staging" | "prod")[];
|
|
33
|
-
sync: "
|
|
33
|
+
sync: "none" | "cloudflare" | "railway" | "github" | "all";
|
|
34
34
|
configPath: string;
|
|
35
35
|
keyPath: string;
|
|
36
36
|
repairs: import("../operations/services/config-runtime.ts").TreeseedRepairAction[];
|
|
@@ -79,6 +79,12 @@ export declare function workflowConfig(helpers: WorkflowOperationHelpers, input?
|
|
|
79
79
|
}>;
|
|
80
80
|
connectionChecks: ReturnType<typeof checkTreeseedProviderConnections>[];
|
|
81
81
|
validationByScope: Record<import("../operations/services/config-runtime.ts").TreeseedConfigScope, ReturnType<typeof import("../platform/environment.ts").validateTreeseedEnvironmentValues>>;
|
|
82
|
+
readinessByScope: Record<import("../operations/services/config-runtime.ts").TreeseedConfigScope, {
|
|
83
|
+
configured: boolean;
|
|
84
|
+
provisioned: boolean;
|
|
85
|
+
deployable: boolean;
|
|
86
|
+
checks: Record<string, unknown>;
|
|
87
|
+
}>;
|
|
82
88
|
updated: {
|
|
83
89
|
scope: import("../operations/services/config-runtime.ts").TreeseedConfigScope | "shared";
|
|
84
90
|
id: string;
|
|
@@ -133,7 +139,7 @@ export declare function workflowConfig(helpers: WorkflowOperationHelpers, input?
|
|
|
133
139
|
payload: {
|
|
134
140
|
mode: string;
|
|
135
141
|
scopes: ("local" | "staging" | "prod")[];
|
|
136
|
-
sync: "
|
|
142
|
+
sync: "none" | "cloudflare" | "railway" | "github" | "all";
|
|
137
143
|
secretsRevealed: boolean;
|
|
138
144
|
reports: {
|
|
139
145
|
scope: "local" | "staging" | "prod";
|
|
@@ -196,7 +202,7 @@ export declare function workflowConfig(helpers: WorkflowOperationHelpers, input?
|
|
|
196
202
|
payload: {
|
|
197
203
|
mode: string;
|
|
198
204
|
scopes: ("local" | "staging" | "prod")[];
|
|
199
|
-
sync: "
|
|
205
|
+
sync: "none" | "cloudflare" | "railway" | "github" | "all";
|
|
200
206
|
keyPath: string;
|
|
201
207
|
repairs: import("../operations/services/config-runtime.ts").TreeseedRepairAction[];
|
|
202
208
|
preflight: {
|
|
@@ -455,9 +461,12 @@ export declare function workflowDestroy(helpers: WorkflowOperationHelpers, input
|
|
|
455
461
|
workerName: any;
|
|
456
462
|
siteUrl: any;
|
|
457
463
|
accountId: any;
|
|
464
|
+
pages: any;
|
|
458
465
|
formGuardKv: any;
|
|
459
466
|
sessionKv: any;
|
|
460
467
|
siteDataDb: any;
|
|
468
|
+
queue: any;
|
|
469
|
+
content: any;
|
|
461
470
|
};
|
|
462
471
|
operations: {
|
|
463
472
|
worker: {
|
|
@@ -9,4 +9,4 @@ export type TreeseedResolvedWorkflowPaths = {
|
|
|
9
9
|
};
|
|
10
10
|
export declare function classifyTreeseedBranchRole(branchName: string | null, repoDir: string | null): TreeseedWorkflowBranchRole;
|
|
11
11
|
export declare function resolveTreeseedWorkflowPaths(startCwd: string): TreeseedResolvedWorkflowPaths;
|
|
12
|
-
export declare function workflowEnvironmentForBranchRole(branchRole: TreeseedWorkflowBranchRole): "local" | "
|
|
12
|
+
export declare function workflowEnvironmentForBranchRole(branchRole: TreeseedWorkflowBranchRole): "local" | "none" | "staging" | "prod";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@treeseed/sdk",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.10",
|
|
4
4
|
"description": "Shared Treeseed SDK for content-backed and D1-backed object models.",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"repository": {
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
"files": [
|
|
21
21
|
"README.md",
|
|
22
22
|
"dist",
|
|
23
|
-
"scripts/verify-driver.mjs"
|
|
23
|
+
"scripts/verify-driver.mjs",
|
|
24
|
+
"templates"
|
|
24
25
|
],
|
|
25
26
|
"publishConfig": {
|
|
26
27
|
"access": "public"
|
|
@@ -133,6 +134,10 @@
|
|
|
133
134
|
"types": "./dist/platform/books-data.d.ts",
|
|
134
135
|
"default": "./dist/platform/books-data.js"
|
|
135
136
|
},
|
|
137
|
+
"./platform/published-content": {
|
|
138
|
+
"types": "./dist/platform/published-content.d.ts",
|
|
139
|
+
"default": "./dist/platform/published-content.js"
|
|
140
|
+
},
|
|
136
141
|
"./platform/book-export": {
|
|
137
142
|
"types": "./dist/platform/book-export.d.ts",
|
|
138
143
|
"default": "./dist/platform/book-export.js"
|