@devpad/api 2.2.7 → 2.2.9
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-5ALH7B5B.js → chunk-NQZIDUBQ.js} +7 -1
- package/dist/chunk-TEOIDOOX.js +669 -0
- package/dist/{errors.d-ByyBTSwW.d.ts → errors.d-CNYqUDaJ.d.ts} +10 -2
- package/dist/index.d.ts +106 -4
- package/dist/index.js +260 -494
- package/dist/schema/blog.d.ts +19 -0
- package/dist/schema/index.d.ts +3 -3
- package/dist/schema/index.js +15 -5
- package/dist/schema/media.d.ts +3 -3
- package/dist/schema/media.js +7 -3
- package/dist/{schema.d-DFyjWZV1.d.ts → schema.d-BeVFWenc.d.ts} +19 -0
- package/dist/{types.d-YhCFiUtt.d.ts → types.d-BcKx3ryl.d.ts} +1 -1
- package/dist/{types.d-i9gbGlha.d.ts → types.d-BvfRohlZ.d.ts} +201 -8
- package/package.json +2 -2
- package/dist/chunk-ZPEX7KVX.js +0 -238
|
@@ -0,0 +1,669 @@
|
|
|
1
|
+
// ../schema/dist/validation.js
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
// ../schema/dist/database/schema.js
|
|
5
|
+
import { relations, sql } from "drizzle-orm";
|
|
6
|
+
import { int, integer, primaryKey, sqliteTable, text, unique } from "drizzle-orm/sqlite-core";
|
|
7
|
+
var timestamps = () => ({
|
|
8
|
+
created_at: text("created_at").notNull().default(sql`(CURRENT_TIMESTAMP)`),
|
|
9
|
+
updated_at: text("updated_at").notNull().default(sql`(CURRENT_TIMESTAMP)`)
|
|
10
|
+
});
|
|
11
|
+
var deleted = () => ({
|
|
12
|
+
deleted: int("deleted", { mode: "boolean" }).notNull().default(false)
|
|
13
|
+
});
|
|
14
|
+
var provenance = () => ({
|
|
15
|
+
created_by: text("created_by", { enum: ["user", "api"] }).notNull().default("user"),
|
|
16
|
+
modified_by: text("modified_by", { enum: ["user", "api"] }).notNull().default("user"),
|
|
17
|
+
protected: int("protected", { mode: "boolean" }).notNull().default(false)
|
|
18
|
+
});
|
|
19
|
+
var owner_id = () => ({
|
|
20
|
+
owner_id: text("owner_id").notNull().references(() => user.id)
|
|
21
|
+
});
|
|
22
|
+
var id = (prefix) => ({
|
|
23
|
+
id: text("id").primaryKey().$defaultFn(() => `${prefix}_${crypto.randomUUID()}`)
|
|
24
|
+
});
|
|
25
|
+
var entity = (prefix) => ({
|
|
26
|
+
...id(prefix),
|
|
27
|
+
...timestamps(),
|
|
28
|
+
...deleted(),
|
|
29
|
+
...provenance()
|
|
30
|
+
});
|
|
31
|
+
var owned_entity = (prefix) => ({
|
|
32
|
+
...entity(prefix),
|
|
33
|
+
...owner_id()
|
|
34
|
+
});
|
|
35
|
+
var user = sqliteTable("user", {
|
|
36
|
+
id: text("id").primaryKey().$defaultFn(() => `user_${crypto.randomUUID()}`),
|
|
37
|
+
github_id: integer("github_id"),
|
|
38
|
+
name: text("name"),
|
|
39
|
+
email: text("email").unique(),
|
|
40
|
+
email_verified: text("email_verified"),
|
|
41
|
+
// timestamp
|
|
42
|
+
image_url: text("image_url"),
|
|
43
|
+
task_view: text("task_view", { enum: ["list", "grid"] }).notNull().default("list")
|
|
44
|
+
});
|
|
45
|
+
var session = sqliteTable("session", {
|
|
46
|
+
id: text("id").notNull().primaryKey(),
|
|
47
|
+
userId: text("user_id").notNull().references(() => user.id),
|
|
48
|
+
expiresAt: integer("expires_at").notNull(),
|
|
49
|
+
access_token: text("access_token")
|
|
50
|
+
});
|
|
51
|
+
var api_keys = sqliteTable("api_keys", {
|
|
52
|
+
...id("apikey"),
|
|
53
|
+
user_id: text("user_id").notNull().references(() => user.id),
|
|
54
|
+
key_hash: text("key_hash").notNull().unique(),
|
|
55
|
+
name: text("name"),
|
|
56
|
+
note: text("note"),
|
|
57
|
+
scope: text("scope", { enum: ["devpad", "blog", "media", "pulse", "all"] }).notNull().default("all"),
|
|
58
|
+
enabled: integer("enabled", { mode: "boolean" }).notNull().default(true),
|
|
59
|
+
last_used_at: text("last_used_at"),
|
|
60
|
+
...timestamps(),
|
|
61
|
+
deleted: integer("deleted", { mode: "boolean" }).notNull().default(false)
|
|
62
|
+
});
|
|
63
|
+
var project = sqliteTable("project", {
|
|
64
|
+
...owned_entity("project"),
|
|
65
|
+
project_id: text("project_id").notNull(),
|
|
66
|
+
name: text("name").notNull(),
|
|
67
|
+
description: text("description"),
|
|
68
|
+
specification: text("specification"),
|
|
69
|
+
repo_url: text("repo_url"),
|
|
70
|
+
repo_id: integer("repo_id"),
|
|
71
|
+
icon_url: text("icon_url"),
|
|
72
|
+
status: text("status", { enum: ["DEVELOPMENT", "PAUSED", "RELEASED", "LIVE", "FINISHED", "ABANDONED", "STOPPED"] }).notNull().default("DEVELOPMENT"),
|
|
73
|
+
link_url: text("link_url"),
|
|
74
|
+
link_text: text("link_text"),
|
|
75
|
+
visibility: text("visibility", { enum: ["PUBLIC", "PRIVATE", "HIDDEN", "ARCHIVED", "DRAFT", "DELETED"] }).notNull().default("PRIVATE"),
|
|
76
|
+
current_version: text("current_version"),
|
|
77
|
+
scan_branch: text("scan_branch")
|
|
78
|
+
});
|
|
79
|
+
var ACTIONS = [
|
|
80
|
+
"CREATE_TASK",
|
|
81
|
+
"UPDATE_TASK",
|
|
82
|
+
"DELETE_TASK",
|
|
83
|
+
"CREATE_PROJECT",
|
|
84
|
+
"UPDATE_PROJECT",
|
|
85
|
+
"DELETE_PROJECT",
|
|
86
|
+
"CREATE_TAG",
|
|
87
|
+
"UPDATE_TAG",
|
|
88
|
+
"DELETE_TAG",
|
|
89
|
+
"CREATE_GOAL",
|
|
90
|
+
"UPDATE_GOAL",
|
|
91
|
+
"DELETE_GOAL",
|
|
92
|
+
"CREATE_MILESTONE",
|
|
93
|
+
"UPDATE_MILESTONE",
|
|
94
|
+
"DELETE_MILESTONE",
|
|
95
|
+
"CREATE_CHECKLIST",
|
|
96
|
+
"UPDATE_CHECKLIST",
|
|
97
|
+
"DELETE_CHECKLIST"
|
|
98
|
+
];
|
|
99
|
+
var action = sqliteTable("action", {
|
|
100
|
+
...owned_entity("action"),
|
|
101
|
+
type: text("type", { enum: ACTIONS }).notNull(),
|
|
102
|
+
description: text("description").notNull(),
|
|
103
|
+
data: text("data", { mode: "json" }),
|
|
104
|
+
channel: text("channel", { enum: ["user", "api"] }).notNull().default("user")
|
|
105
|
+
});
|
|
106
|
+
var tracker_result = sqliteTable("tracker_result", {
|
|
107
|
+
id: integer("id").primaryKey({ autoIncrement: true }),
|
|
108
|
+
project_id: text("project_id").notNull().references(() => project.id),
|
|
109
|
+
created_at: text("created_at").notNull().default(sql`(CURRENT_TIMESTAMP)`),
|
|
110
|
+
data: text("data", { mode: "json" }).notNull(),
|
|
111
|
+
accepted: integer("accepted", { mode: "boolean" }).notNull().default(false)
|
|
112
|
+
});
|
|
113
|
+
var todo_updates = sqliteTable("todo_updates", {
|
|
114
|
+
id: integer("id").primaryKey({ autoIncrement: true }),
|
|
115
|
+
project_id: text("project_id").notNull().references(() => project.id),
|
|
116
|
+
created_at: text("created_at").notNull().default(sql`(CURRENT_TIMESTAMP)`),
|
|
117
|
+
old_id: integer("old_id").references(() => tracker_result.id),
|
|
118
|
+
new_id: integer("new_id").notNull().references(() => tracker_result.id),
|
|
119
|
+
data: text("data", { mode: "json" }).notNull(),
|
|
120
|
+
status: text("status", { enum: ["PENDING", "ACCEPTED", "REJECTED", "IGNORED"] }).notNull().default("PENDING"),
|
|
121
|
+
branch: text("branch"),
|
|
122
|
+
commit_sha: text("commit_sha"),
|
|
123
|
+
commit_msg: text("commit_msg"),
|
|
124
|
+
commit_url: text("commit_url")
|
|
125
|
+
});
|
|
126
|
+
var update_tracker_relations = relations(todo_updates, ({ one }) => ({
|
|
127
|
+
old: one(tracker_result, { fields: [todo_updates.old_id], references: [tracker_result.id] }),
|
|
128
|
+
new: one(tracker_result, { fields: [todo_updates.new_id], references: [tracker_result.id] })
|
|
129
|
+
}));
|
|
130
|
+
var milestone = sqliteTable("milestone", {
|
|
131
|
+
...entity("milestone"),
|
|
132
|
+
project_id: text("project_id").notNull().references(() => project.id),
|
|
133
|
+
name: text("name").notNull(),
|
|
134
|
+
description: text("description"),
|
|
135
|
+
target_time: text("target_time"),
|
|
136
|
+
target_version: text("target_version"),
|
|
137
|
+
finished_at: text("finished_at"),
|
|
138
|
+
after_id: text("after_id")
|
|
139
|
+
});
|
|
140
|
+
var goal = sqliteTable("goal", {
|
|
141
|
+
...entity("goal"),
|
|
142
|
+
milestone_id: text("milestone_id").notNull().references(() => milestone.id),
|
|
143
|
+
name: text("name").notNull(),
|
|
144
|
+
description: text("description"),
|
|
145
|
+
target_time: text("target_time"),
|
|
146
|
+
finished_at: text("finished_at")
|
|
147
|
+
});
|
|
148
|
+
var task = sqliteTable("task", {
|
|
149
|
+
...owned_entity("task"),
|
|
150
|
+
title: text("title").notNull(),
|
|
151
|
+
progress: text("progress", { enum: ["UNSTARTED", "IN_PROGRESS", "COMPLETED"] }).notNull().default("UNSTARTED"),
|
|
152
|
+
visibility: text("visibility", { enum: ["PUBLIC", "PRIVATE", "HIDDEN", "ARCHIVED", "DRAFT", "DELETED"] }).notNull().default("PRIVATE"),
|
|
153
|
+
goal_id: text("goal_id").references(() => goal.id),
|
|
154
|
+
project_id: text("project_id").references(() => project.id),
|
|
155
|
+
description: text("description"),
|
|
156
|
+
start_time: text("start_time"),
|
|
157
|
+
end_time: text("end_time"),
|
|
158
|
+
summary: text("summary"),
|
|
159
|
+
codebase_task_id: text("codebase_task_id").references(() => codebase_tasks.id),
|
|
160
|
+
priority: text("priority", { enum: ["LOW", "MEDIUM", "HIGH"] }).notNull().default("LOW")
|
|
161
|
+
});
|
|
162
|
+
var checklist = sqliteTable("checklist", {
|
|
163
|
+
...entity("checklist"),
|
|
164
|
+
task_id: text("task_id").notNull().references(() => task.id),
|
|
165
|
+
name: text("name").notNull()
|
|
166
|
+
});
|
|
167
|
+
var checklist_item = sqliteTable("checklist_item", {
|
|
168
|
+
...entity("checklist-item"),
|
|
169
|
+
checklist_id: text("checklist_id").notNull().references(() => checklist.id),
|
|
170
|
+
parent_id: text("parent_id"),
|
|
171
|
+
name: text("name").notNull(),
|
|
172
|
+
checked: int("checked", { mode: "boolean" }).notNull().default(false)
|
|
173
|
+
});
|
|
174
|
+
var codebase_tasks = sqliteTable("codebase_tasks", {
|
|
175
|
+
...entity("codebase-task"),
|
|
176
|
+
branch: text("branch"),
|
|
177
|
+
commit_sha: text("commit_sha"),
|
|
178
|
+
commit_msg: text("commit_msg"),
|
|
179
|
+
commit_url: text("commit_url"),
|
|
180
|
+
type: text("type"),
|
|
181
|
+
text: text("text"),
|
|
182
|
+
file: text("file"),
|
|
183
|
+
line: integer("line"),
|
|
184
|
+
context: text("context", { mode: "json" }),
|
|
185
|
+
recent_scan_id: integer("recent_scan_id").references(() => tracker_result.id)
|
|
186
|
+
});
|
|
187
|
+
var tag = sqliteTable("tag", {
|
|
188
|
+
...owned_entity("tag"),
|
|
189
|
+
title: text("title").notNull(),
|
|
190
|
+
color: text("color"),
|
|
191
|
+
render: int("render", { mode: "boolean" }).notNull().default(true)
|
|
192
|
+
}, (table) => ({
|
|
193
|
+
tag_unique: unique("tag_unique").on(table.owner_id, table.title)
|
|
194
|
+
}));
|
|
195
|
+
var task_tag = sqliteTable("task_tag", {
|
|
196
|
+
task_id: text("task_id").notNull().references(() => task.id),
|
|
197
|
+
tag_id: text("tag_id").notNull().references(() => tag.id),
|
|
198
|
+
...timestamps()
|
|
199
|
+
}, (table) => ({
|
|
200
|
+
task_tag_unique: primaryKey({ columns: [table.task_id, table.tag_id] })
|
|
201
|
+
}));
|
|
202
|
+
var commit_detail = sqliteTable("commit_detail", {
|
|
203
|
+
sha: text("sha").primaryKey(),
|
|
204
|
+
message: text("message").notNull(),
|
|
205
|
+
url: text("url").notNull(),
|
|
206
|
+
avatar_url: text("avatar_url"),
|
|
207
|
+
author_user: text("author_user").notNull(),
|
|
208
|
+
author_name: text("author_name"),
|
|
209
|
+
author_email: text("author_email").notNull(),
|
|
210
|
+
date: text("date").notNull()
|
|
211
|
+
});
|
|
212
|
+
var tag_config = sqliteTable("tag_config", {
|
|
213
|
+
...id("tag_config"),
|
|
214
|
+
project_id: text("project_id").notNull().references(() => project.id),
|
|
215
|
+
// Foreign key to projects
|
|
216
|
+
tag_id: text("tag_id").notNull().references(() => tag.id),
|
|
217
|
+
// Foreign key to tags
|
|
218
|
+
match: text("match").notNull(),
|
|
219
|
+
// Match pattern for this tag
|
|
220
|
+
...timestamps()
|
|
221
|
+
});
|
|
222
|
+
var ignore_path = sqliteTable("ignore_path", {
|
|
223
|
+
...id("ignore_path"),
|
|
224
|
+
project_id: text("project_id").notNull().references(() => project.id),
|
|
225
|
+
// Foreign key to projects
|
|
226
|
+
path: text("path").notNull(),
|
|
227
|
+
// Ignore path
|
|
228
|
+
...timestamps()
|
|
229
|
+
});
|
|
230
|
+
var ROLLOUT_SHAPES = ["gradual", "atomic"];
|
|
231
|
+
var RUN_KINDS = ["deploy", "rollback"];
|
|
232
|
+
var RUN_STATUSES = ["queued", "deploying", "baking", "awaiting_approval", "rolling_back", "completed", "rolled_back", "failed", "cancelled"];
|
|
233
|
+
var FORCED_ATOMIC_REASONS = ["do_migrations", "asset_affinity_none"];
|
|
234
|
+
var STAGE_EVENT_KINDS = ["deploy_started", "deploy_completed", "bake_started", "bake_completed", "gate_verdict", "approval_requested", "rollback_started", "rollback_completed", "warning", "error"];
|
|
235
|
+
var APPROVAL_DECISIONS = ["approved", "denied"];
|
|
236
|
+
var pipeline_package = sqliteTable("pipeline_package", {
|
|
237
|
+
...entity("pipeline-package"),
|
|
238
|
+
owner_id: text("owner_id").notNull().references(() => user.id),
|
|
239
|
+
name: text("name").notNull(),
|
|
240
|
+
repo_url: text("repo_url"),
|
|
241
|
+
default_template_ref: text("default_template_ref"),
|
|
242
|
+
script_name_overrides: text("script_name_overrides", { mode: "json" }),
|
|
243
|
+
project_id: text("project_id").references(() => project.id)
|
|
244
|
+
});
|
|
245
|
+
var pipeline_run = sqliteTable("pipeline_run", {
|
|
246
|
+
...entity("pipeline-run"),
|
|
247
|
+
package_id: text("package_id").notNull().references(() => pipeline_package.id),
|
|
248
|
+
version_set_id: text("version_set_id").notNull(),
|
|
249
|
+
shape: text("shape", { enum: ROLLOUT_SHAPES }).notNull(),
|
|
250
|
+
kind: text("kind", { enum: RUN_KINDS }).notNull().default("deploy"),
|
|
251
|
+
status: text("status", { enum: RUN_STATUSES }).notNull().default("queued"),
|
|
252
|
+
current_stage: text("current_stage"),
|
|
253
|
+
resolved_rollout: text("resolved_rollout", { mode: "json" }).notNull(),
|
|
254
|
+
resolved_gates: text("resolved_gates", { mode: "json" }).notNull(),
|
|
255
|
+
forced_atomic_reason: text("forced_atomic_reason", { enum: FORCED_ATOMIC_REASONS }),
|
|
256
|
+
started_at: text("started_at"),
|
|
257
|
+
finished_at: text("finished_at")
|
|
258
|
+
});
|
|
259
|
+
var pipeline_stage_event = sqliteTable("pipeline_stage_event", {
|
|
260
|
+
...id("pipeline-stage-event"),
|
|
261
|
+
run_id: text("run_id").notNull().references(() => pipeline_run.id),
|
|
262
|
+
stage_name: text("stage_name").notNull(),
|
|
263
|
+
kind: text("kind", { enum: STAGE_EVENT_KINDS }).notNull(),
|
|
264
|
+
payload: text("payload", { mode: "json" }),
|
|
265
|
+
ts: text("ts").notNull().default(sql`(CURRENT_TIMESTAMP)`),
|
|
266
|
+
idempotency_hash: text("idempotency_hash")
|
|
267
|
+
});
|
|
268
|
+
var pipeline_grant = sqliteTable("pipeline_grant", {
|
|
269
|
+
...entity("pipeline-grant"),
|
|
270
|
+
package_id: text("package_id").notNull().references(() => pipeline_package.id),
|
|
271
|
+
stage_name: text("stage_name").notNull(),
|
|
272
|
+
scope: text("scope").notNull(),
|
|
273
|
+
granted_by: text("granted_by").references(() => user.id),
|
|
274
|
+
granted_at: text("granted_at")
|
|
275
|
+
});
|
|
276
|
+
var pipeline_approval = sqliteTable("pipeline_approval", {
|
|
277
|
+
...id("pipeline-approval"),
|
|
278
|
+
run_id: text("run_id").notNull().references(() => pipeline_run.id),
|
|
279
|
+
stage_name: text("stage_name").notNull(),
|
|
280
|
+
decision: text("decision", { enum: APPROVAL_DECISIONS }),
|
|
281
|
+
reason: text("reason"),
|
|
282
|
+
decided_by: text("decided_by").references(() => user.id),
|
|
283
|
+
decided_at: text("decided_at"),
|
|
284
|
+
...timestamps()
|
|
285
|
+
});
|
|
286
|
+
var pipeline_analysis_template = sqliteTable("pipeline_analysis_template", {
|
|
287
|
+
...entity("pipeline-analysis-template"),
|
|
288
|
+
owner_id: text("owner_id").notNull().references(() => user.id),
|
|
289
|
+
name: text("name").notNull(),
|
|
290
|
+
query_dsl: text("query_dsl", { mode: "json" }).notNull(),
|
|
291
|
+
threshold_dsl: text("threshold_dsl", { mode: "json" }).notNull(),
|
|
292
|
+
window_ms: integer("window_ms").notNull().default(6e5)
|
|
293
|
+
});
|
|
294
|
+
var PIPELINE_OIDC_PROVIDERS = ["github"];
|
|
295
|
+
var pipeline_oidc_trust = sqliteTable("pipeline_oidc_trust", {
|
|
296
|
+
...entity("pipeline-oidc-trust"),
|
|
297
|
+
owner_id: text("owner_id").notNull().references(() => user.id),
|
|
298
|
+
provider: text("provider", { enum: PIPELINE_OIDC_PROVIDERS }).notNull().default("github"),
|
|
299
|
+
github_owner: text("github_owner").notNull(),
|
|
300
|
+
repo_pattern: text("repo_pattern").notNull().default("*"),
|
|
301
|
+
allowed_refs: text("allowed_refs", { mode: "json" }).$type().notNull().default(sql`'[]'`),
|
|
302
|
+
allowed_environments: text("allowed_environments", { mode: "json" }).$type().notNull().default(sql`'[]'`),
|
|
303
|
+
expected_audience: text("expected_audience").notNull(),
|
|
304
|
+
allowed_actions: text("allowed_actions", { mode: "json" }).$type().notNull().default(sql`'["artifacts:upload","runs:start"]'`),
|
|
305
|
+
session_ttl_seconds: integer("session_ttl_seconds").notNull().default(900),
|
|
306
|
+
last_used_at: text("last_used_at")
|
|
307
|
+
});
|
|
308
|
+
var user_relations = relations(user, ({ many }) => ({
|
|
309
|
+
sessions: many(session),
|
|
310
|
+
api_keys: many(api_keys),
|
|
311
|
+
actions: many(action),
|
|
312
|
+
tasks: many(task),
|
|
313
|
+
tags: many(tag)
|
|
314
|
+
}));
|
|
315
|
+
var session_relations = relations(session, ({ one }) => ({
|
|
316
|
+
user: one(user, { fields: [session.userId], references: [user.id] })
|
|
317
|
+
}));
|
|
318
|
+
var api_keys_relations = relations(api_keys, ({ one }) => ({
|
|
319
|
+
owner: one(user, { fields: [api_keys.user_id], references: [user.id] })
|
|
320
|
+
}));
|
|
321
|
+
var project_relations = relations(project, ({ one, many }) => ({
|
|
322
|
+
owner: one(user, { fields: [project.owner_id], references: [user.id] }),
|
|
323
|
+
tracker_results: many(tracker_result),
|
|
324
|
+
milestones: many(milestone),
|
|
325
|
+
todo_updates: many(todo_updates)
|
|
326
|
+
}));
|
|
327
|
+
var action_relations = relations(action, ({ one }) => ({
|
|
328
|
+
owner: one(user, { fields: [action.owner_id], references: [user.id] })
|
|
329
|
+
}));
|
|
330
|
+
var tracker_result_relations = relations(tracker_result, ({ one }) => ({
|
|
331
|
+
project: one(project, { fields: [tracker_result.project_id], references: [project.id] })
|
|
332
|
+
}));
|
|
333
|
+
var todoUpdatesRelations = relations(todo_updates, ({ one }) => ({
|
|
334
|
+
project: one(project, { fields: [todo_updates.project_id], references: [project.id] }),
|
|
335
|
+
oldTrackerResult: one(tracker_result, { fields: [todo_updates.old_id], references: [tracker_result.id] }),
|
|
336
|
+
newTrackerResult: one(tracker_result, { fields: [todo_updates.new_id], references: [tracker_result.id] })
|
|
337
|
+
}));
|
|
338
|
+
var milestone_relations = relations(milestone, ({ one, many }) => ({
|
|
339
|
+
project: one(project, { fields: [milestone.project_id], references: [project.id] }),
|
|
340
|
+
goals: many(goal)
|
|
341
|
+
}));
|
|
342
|
+
var goal_relations = relations(goal, ({ one }) => ({
|
|
343
|
+
milestone: one(milestone, { fields: [goal.milestone_id], references: [milestone.id] })
|
|
344
|
+
}));
|
|
345
|
+
var task_relations = relations(task, ({ one, many }) => ({
|
|
346
|
+
owner: one(user, { fields: [task.owner_id], references: [user.id] }),
|
|
347
|
+
goal: one(goal, { fields: [task.goal_id], references: [goal.id] }),
|
|
348
|
+
codebase_task: one(codebase_tasks, { fields: [task.codebase_task_id], references: [codebase_tasks.id] }),
|
|
349
|
+
checklists: many(checklist)
|
|
350
|
+
}));
|
|
351
|
+
var checklist_relations = relations(checklist, ({ one, many }) => ({
|
|
352
|
+
task: one(task, { fields: [checklist.task_id], references: [task.id] }),
|
|
353
|
+
items: many(checklist_item)
|
|
354
|
+
}));
|
|
355
|
+
var checklist_item_relations = relations(checklist_item, ({ one }) => ({
|
|
356
|
+
checklist: one(checklist, { fields: [checklist_item.checklist_id], references: [checklist.id] })
|
|
357
|
+
}));
|
|
358
|
+
var tag_relations = relations(tag, ({ one }) => ({
|
|
359
|
+
owner: one(user, { fields: [tag.owner_id], references: [user.id] })
|
|
360
|
+
}));
|
|
361
|
+
var task_tag_relations = relations(task_tag, ({ one }) => ({
|
|
362
|
+
task: one(task, { fields: [task_tag.task_id], references: [task.id] }),
|
|
363
|
+
tag: one(tag, { fields: [task_tag.tag_id], references: [tag.id] })
|
|
364
|
+
}));
|
|
365
|
+
var pipeline_package_relations = relations(pipeline_package, ({ one, many }) => ({
|
|
366
|
+
owner: one(user, { fields: [pipeline_package.owner_id], references: [user.id] }),
|
|
367
|
+
runs: many(pipeline_run),
|
|
368
|
+
grants: many(pipeline_grant)
|
|
369
|
+
}));
|
|
370
|
+
var pipeline_run_relations = relations(pipeline_run, ({ one, many }) => ({
|
|
371
|
+
package: one(pipeline_package, { fields: [pipeline_run.package_id], references: [pipeline_package.id] }),
|
|
372
|
+
events: many(pipeline_stage_event),
|
|
373
|
+
approvals: many(pipeline_approval)
|
|
374
|
+
}));
|
|
375
|
+
var pipeline_stage_event_relations = relations(pipeline_stage_event, ({ one }) => ({
|
|
376
|
+
run: one(pipeline_run, { fields: [pipeline_stage_event.run_id], references: [pipeline_run.id] })
|
|
377
|
+
}));
|
|
378
|
+
var pipeline_grant_relations = relations(pipeline_grant, ({ one }) => ({
|
|
379
|
+
package: one(pipeline_package, { fields: [pipeline_grant.package_id], references: [pipeline_package.id] }),
|
|
380
|
+
granted_by_user: one(user, { fields: [pipeline_grant.granted_by], references: [user.id] })
|
|
381
|
+
}));
|
|
382
|
+
var pipeline_approval_relations = relations(pipeline_approval, ({ one }) => ({
|
|
383
|
+
run: one(pipeline_run, { fields: [pipeline_approval.run_id], references: [pipeline_run.id] }),
|
|
384
|
+
decided_by_user: one(user, { fields: [pipeline_approval.decided_by], references: [user.id] })
|
|
385
|
+
}));
|
|
386
|
+
var pipeline_analysis_template_relations = relations(pipeline_analysis_template, ({ one }) => ({
|
|
387
|
+
owner: one(user, { fields: [pipeline_analysis_template.owner_id], references: [user.id] })
|
|
388
|
+
}));
|
|
389
|
+
var pipeline_oidc_trust_relations = relations(pipeline_oidc_trust, ({ one }) => ({
|
|
390
|
+
owner: one(user, { fields: [pipeline_oidc_trust.owner_id], references: [user.id] })
|
|
391
|
+
}));
|
|
392
|
+
|
|
393
|
+
// ../schema/dist/validation.js
|
|
394
|
+
var upsert_project = z.object({
|
|
395
|
+
id: z.string().optional().nullable(),
|
|
396
|
+
project_id: z.string(),
|
|
397
|
+
owner_id: z.string().optional(),
|
|
398
|
+
name: z.string(),
|
|
399
|
+
description: z.string().nullable(),
|
|
400
|
+
specification: z.string().nullable(),
|
|
401
|
+
repo_url: z.string().nullable(),
|
|
402
|
+
repo_id: z.number().nullable(),
|
|
403
|
+
icon_url: z.string().nullable(),
|
|
404
|
+
status: z.union([z.literal("DEVELOPMENT"), z.literal("PAUSED"), z.literal("RELEASED"), z.literal("LIVE"), z.literal("FINISHED"), z.literal("ABANDONED"), z.literal("STOPPED")]).optional(),
|
|
405
|
+
deleted: z.boolean().optional().default(false),
|
|
406
|
+
link_url: z.string().nullable(),
|
|
407
|
+
link_text: z.string().nullable(),
|
|
408
|
+
visibility: z.union([z.literal("PUBLIC"), z.literal("PRIVATE"), z.literal("HIDDEN"), z.literal("ARCHIVED"), z.literal("DRAFT"), z.literal("DELETED")]).optional(),
|
|
409
|
+
current_version: z.string().nullable(),
|
|
410
|
+
force: z.boolean().optional().describe("Override protection on user-modified entities")
|
|
411
|
+
});
|
|
412
|
+
var upsert_todo = z.object({
|
|
413
|
+
id: z.string().optional().nullable(),
|
|
414
|
+
title: z.string().optional(),
|
|
415
|
+
summary: z.string().optional().nullable(),
|
|
416
|
+
description: z.string().optional().nullable(),
|
|
417
|
+
progress: z.union([z.literal("UNSTARTED"), z.literal("IN_PROGRESS"), z.literal("COMPLETED")]).optional(),
|
|
418
|
+
visibility: z.union([z.literal("PUBLIC"), z.literal("PRIVATE"), z.literal("HIDDEN"), z.literal("ARCHIVED"), z.literal("DRAFT"), z.literal("DELETED")]).optional(),
|
|
419
|
+
start_time: z.string().optional().nullable(),
|
|
420
|
+
end_time: z.string().optional().nullable(),
|
|
421
|
+
priority: z.union([z.literal("LOW"), z.literal("MEDIUM"), z.literal("HIGH")]).optional(),
|
|
422
|
+
owner_id: z.string(),
|
|
423
|
+
project_id: z.string().optional().nullable(),
|
|
424
|
+
goal_id: z.string().optional().nullable(),
|
|
425
|
+
force: z.boolean().optional().describe("Override protection on user-modified entities")
|
|
426
|
+
});
|
|
427
|
+
var update_action = z.union([z.literal("CONFIRM"), z.literal("UNLINK"), z.literal("CREATE"), z.literal("IGNORE"), z.literal("DELETE"), z.literal("COMPLETE")]);
|
|
428
|
+
var upsert_tag = z.object({
|
|
429
|
+
id: z.string().optional(),
|
|
430
|
+
title: z.string(),
|
|
431
|
+
color: z.union([z.literal("red"), z.literal("green"), z.literal("blue"), z.literal("yellow"), z.literal("purple"), z.literal("orange"), z.literal("teal"), z.literal("pink"), z.literal("gray"), z.literal("cyan"), z.literal("lime")]).nullable().optional(),
|
|
432
|
+
deleted: z.boolean().optional().default(false),
|
|
433
|
+
render: z.boolean().optional().default(true),
|
|
434
|
+
owner_id: z.string()
|
|
435
|
+
});
|
|
436
|
+
var project_config = z.object({
|
|
437
|
+
tags: z.array(z.object({
|
|
438
|
+
name: z.string(),
|
|
439
|
+
match: z.array(z.string())
|
|
440
|
+
})),
|
|
441
|
+
ignore: z.array(z.string())
|
|
442
|
+
});
|
|
443
|
+
var save_config_request = z.object({
|
|
444
|
+
id: z.string(),
|
|
445
|
+
config: project_config,
|
|
446
|
+
scan_branch: z.string().optional()
|
|
447
|
+
});
|
|
448
|
+
var save_tags_request = z.array(upsert_tag);
|
|
449
|
+
var update_user = z.object({
|
|
450
|
+
id: z.string(),
|
|
451
|
+
name: z.string().optional(),
|
|
452
|
+
image_url: z.string().optional(),
|
|
453
|
+
task_view: z.union([z.literal("list"), z.literal("grid")]).optional(),
|
|
454
|
+
email_verified: z.boolean().optional()
|
|
455
|
+
});
|
|
456
|
+
var config_schema = z.object({
|
|
457
|
+
tags: z.array(z.object({
|
|
458
|
+
name: z.string(),
|
|
459
|
+
match: z.array(z.string())
|
|
460
|
+
})),
|
|
461
|
+
ignore: z.array(z.string().regex(/^[\s\S]*$/, "Invalid path"))
|
|
462
|
+
});
|
|
463
|
+
var upsert_milestone = z.object({
|
|
464
|
+
id: z.string().optional().nullable(),
|
|
465
|
+
project_id: z.string(),
|
|
466
|
+
name: z.string().min(1).max(200),
|
|
467
|
+
description: z.string().nullable().optional(),
|
|
468
|
+
target_time: z.string().nullable().optional(),
|
|
469
|
+
target_version: z.string().nullable().optional(),
|
|
470
|
+
finished_at: z.string().nullable().optional(),
|
|
471
|
+
after_id: z.string().nullable().optional(),
|
|
472
|
+
force: z.boolean().optional().describe("Override protection on user-modified entities")
|
|
473
|
+
});
|
|
474
|
+
var upsert_goal = z.object({
|
|
475
|
+
id: z.string().optional().nullable(),
|
|
476
|
+
milestone_id: z.string(),
|
|
477
|
+
name: z.string().min(1).max(200),
|
|
478
|
+
description: z.string().nullable().optional(),
|
|
479
|
+
target_time: z.string().nullable().optional(),
|
|
480
|
+
finished_at: z.string().nullable().optional(),
|
|
481
|
+
force: z.boolean().optional().describe("Override protection on user-modified entities")
|
|
482
|
+
});
|
|
483
|
+
var rollout_shape = z.union([z.literal("gradual"), z.literal("atomic")]);
|
|
484
|
+
var run_kind = z.union([z.literal("deploy"), z.literal("rollback")]);
|
|
485
|
+
var run_status = z.union([
|
|
486
|
+
z.literal("queued"),
|
|
487
|
+
z.literal("deploying"),
|
|
488
|
+
z.literal("baking"),
|
|
489
|
+
z.literal("awaiting_approval"),
|
|
490
|
+
z.literal("rolling_back"),
|
|
491
|
+
z.literal("completed"),
|
|
492
|
+
z.literal("rolled_back"),
|
|
493
|
+
z.literal("failed"),
|
|
494
|
+
z.literal("cancelled")
|
|
495
|
+
]);
|
|
496
|
+
var forced_atomic_reason = z.union([z.literal("do_migrations"), z.literal("asset_affinity_none")]);
|
|
497
|
+
var stage_event_kind = z.union([
|
|
498
|
+
z.literal("deploy_started"),
|
|
499
|
+
z.literal("deploy_completed"),
|
|
500
|
+
z.literal("bake_started"),
|
|
501
|
+
z.literal("bake_completed"),
|
|
502
|
+
z.literal("gate_verdict"),
|
|
503
|
+
z.literal("approval_requested"),
|
|
504
|
+
z.literal("rollback_started"),
|
|
505
|
+
z.literal("rollback_completed"),
|
|
506
|
+
z.literal("warning"),
|
|
507
|
+
z.literal("error")
|
|
508
|
+
]);
|
|
509
|
+
var approval_decision = z.union([z.literal("approved"), z.literal("denied")]);
|
|
510
|
+
var grant_scope = z.string().regex(/^[a-z0-9_-]+:[a-z0-9_-]+(:[^\s]+)?$/, "Invalid scope format");
|
|
511
|
+
var rollout_stage = z.object({
|
|
512
|
+
name: z.string(),
|
|
513
|
+
traffic: z.number().int().min(0).max(100),
|
|
514
|
+
bake: z.string().nullable()
|
|
515
|
+
});
|
|
516
|
+
var resolved_rollout = z.discriminatedUnion("type", [
|
|
517
|
+
z.object({
|
|
518
|
+
type: z.literal("gradual"),
|
|
519
|
+
stages: z.array(rollout_stage)
|
|
520
|
+
}),
|
|
521
|
+
z.object({
|
|
522
|
+
type: z.literal("atomic")
|
|
523
|
+
})
|
|
524
|
+
]);
|
|
525
|
+
var gate_descriptor = z.discriminatedUnion("type", [
|
|
526
|
+
z.object({ type: z.literal("manual") }),
|
|
527
|
+
z.object({ type: z.literal("auto"), afterBake: z.boolean().optional() }),
|
|
528
|
+
z.object({ type: z.literal("analysis"), template: z.string() })
|
|
529
|
+
]);
|
|
530
|
+
var resolved_gates = z.record(z.string(), gate_descriptor);
|
|
531
|
+
var upsert_pipeline_package = z.object({
|
|
532
|
+
id: z.string().optional().nullable(),
|
|
533
|
+
owner_id: z.string(),
|
|
534
|
+
name: z.string().min(1).max(200),
|
|
535
|
+
repo_url: z.string().nullable().optional(),
|
|
536
|
+
default_template_ref: z.string().nullable().optional(),
|
|
537
|
+
script_name_overrides: z.record(z.string(), z.string()).nullable().optional(),
|
|
538
|
+
project_id: z.string().nullable().optional()
|
|
539
|
+
});
|
|
540
|
+
var upsert_pipeline_run = z.object({
|
|
541
|
+
id: z.string().optional().nullable(),
|
|
542
|
+
package_id: z.string(),
|
|
543
|
+
version_set_id: z.string(),
|
|
544
|
+
shape: rollout_shape,
|
|
545
|
+
kind: run_kind.optional(),
|
|
546
|
+
status: run_status.optional(),
|
|
547
|
+
current_stage: z.string().nullable().optional(),
|
|
548
|
+
resolved_rollout,
|
|
549
|
+
resolved_gates,
|
|
550
|
+
forced_atomic_reason: forced_atomic_reason.nullable().optional(),
|
|
551
|
+
started_at: z.string().nullable().optional(),
|
|
552
|
+
finished_at: z.string().nullable().optional()
|
|
553
|
+
});
|
|
554
|
+
var insert_pipeline_stage_event = z.object({
|
|
555
|
+
run_id: z.string(),
|
|
556
|
+
stage_name: z.string(),
|
|
557
|
+
kind: stage_event_kind,
|
|
558
|
+
payload: z.unknown().optional()
|
|
559
|
+
});
|
|
560
|
+
var upsert_pipeline_grant = z.object({
|
|
561
|
+
id: z.string().optional().nullable(),
|
|
562
|
+
package_id: z.string(),
|
|
563
|
+
stage_name: z.string(),
|
|
564
|
+
scope: grant_scope,
|
|
565
|
+
granted_by: z.string().nullable().optional(),
|
|
566
|
+
granted_at: z.string().nullable().optional()
|
|
567
|
+
});
|
|
568
|
+
var upsert_pipeline_approval = z.object({
|
|
569
|
+
run_id: z.string(),
|
|
570
|
+
stage_name: z.string(),
|
|
571
|
+
decision: approval_decision.nullable().optional(),
|
|
572
|
+
reason: z.string().nullable().optional(),
|
|
573
|
+
decided_by: z.string().nullable().optional(),
|
|
574
|
+
decided_at: z.string().nullable().optional()
|
|
575
|
+
});
|
|
576
|
+
var upsert_pipeline_analysis_template = z.object({
|
|
577
|
+
id: z.string().optional(),
|
|
578
|
+
owner_id: z.string().min(1),
|
|
579
|
+
name: z.string().min(1).max(200),
|
|
580
|
+
query_dsl: z.unknown(),
|
|
581
|
+
threshold_dsl: z.string().min(1),
|
|
582
|
+
window_ms: z.number().int().positive()
|
|
583
|
+
});
|
|
584
|
+
var pipeline_oidc_provider = z.literal("github");
|
|
585
|
+
var upsert_pipeline_oidc_trust = z.object({
|
|
586
|
+
id: z.string().optional().nullable(),
|
|
587
|
+
owner_id: z.string(),
|
|
588
|
+
provider: pipeline_oidc_provider.optional(),
|
|
589
|
+
github_owner: z.string().min(1).max(200),
|
|
590
|
+
repo_pattern: z.string().min(1).max(200).optional(),
|
|
591
|
+
allowed_refs: z.array(z.string()).optional(),
|
|
592
|
+
allowed_environments: z.array(z.string()).optional(),
|
|
593
|
+
expected_audience: z.string().min(1),
|
|
594
|
+
allowed_actions: z.array(z.string()).optional(),
|
|
595
|
+
session_ttl_seconds: z.number().int().positive().optional(),
|
|
596
|
+
last_used_at: z.string().nullable().optional()
|
|
597
|
+
});
|
|
598
|
+
var webhook_event_body = z.object({
|
|
599
|
+
stage_name: z.string().min(1),
|
|
600
|
+
kind: z.enum(STAGE_EVENT_KINDS),
|
|
601
|
+
payload: z.unknown().optional(),
|
|
602
|
+
idempotency_key: z.string().uuid()
|
|
603
|
+
});
|
|
604
|
+
var dashboard_window_query = z.object({
|
|
605
|
+
package_id: z.string().min(1),
|
|
606
|
+
window_ms: z.number().int().positive().default(24 * 60 * 60 * 1e3)
|
|
607
|
+
});
|
|
608
|
+
var verdict_breakdown = z.object({
|
|
609
|
+
pass: z.number().int().nonnegative(),
|
|
610
|
+
fail: z.number().int().nonnegative(),
|
|
611
|
+
pending: z.number().int().nonnegative()
|
|
612
|
+
});
|
|
613
|
+
var dashboard_response = z.object({
|
|
614
|
+
run_counts: z.object({
|
|
615
|
+
total: z.number().int().nonnegative(),
|
|
616
|
+
completed: z.number().int().nonnegative(),
|
|
617
|
+
failed: z.number().int().nonnegative(),
|
|
618
|
+
cancelled: z.number().int().nonnegative(),
|
|
619
|
+
rolled_back: z.number().int().nonnegative(),
|
|
620
|
+
in_flight: z.number().int().nonnegative()
|
|
621
|
+
}),
|
|
622
|
+
verdict_counts: z.object({
|
|
623
|
+
manual: verdict_breakdown,
|
|
624
|
+
auto: verdict_breakdown,
|
|
625
|
+
analysis: verdict_breakdown
|
|
626
|
+
}),
|
|
627
|
+
latency_p50_ms: z.number().nonnegative().nullable(),
|
|
628
|
+
latency_p95_ms: z.number().nonnegative().nullable(),
|
|
629
|
+
approval_turnaround_p50_ms: z.number().nonnegative().nullable(),
|
|
630
|
+
rollback_rate: z.number().min(0).max(1).nullable()
|
|
631
|
+
});
|
|
632
|
+
|
|
633
|
+
export {
|
|
634
|
+
RUN_STATUSES,
|
|
635
|
+
STAGE_EVENT_KINDS,
|
|
636
|
+
upsert_project,
|
|
637
|
+
upsert_todo,
|
|
638
|
+
update_action,
|
|
639
|
+
upsert_tag,
|
|
640
|
+
project_config,
|
|
641
|
+
save_config_request,
|
|
642
|
+
save_tags_request,
|
|
643
|
+
update_user,
|
|
644
|
+
config_schema,
|
|
645
|
+
upsert_milestone,
|
|
646
|
+
upsert_goal,
|
|
647
|
+
rollout_shape,
|
|
648
|
+
run_kind,
|
|
649
|
+
run_status,
|
|
650
|
+
forced_atomic_reason,
|
|
651
|
+
stage_event_kind,
|
|
652
|
+
approval_decision,
|
|
653
|
+
grant_scope,
|
|
654
|
+
rollout_stage,
|
|
655
|
+
resolved_rollout,
|
|
656
|
+
gate_descriptor,
|
|
657
|
+
resolved_gates,
|
|
658
|
+
upsert_pipeline_package,
|
|
659
|
+
upsert_pipeline_run,
|
|
660
|
+
insert_pipeline_stage_event,
|
|
661
|
+
upsert_pipeline_grant,
|
|
662
|
+
upsert_pipeline_approval,
|
|
663
|
+
upsert_pipeline_analysis_template,
|
|
664
|
+
pipeline_oidc_provider,
|
|
665
|
+
upsert_pipeline_oidc_trust,
|
|
666
|
+
webhook_event_body,
|
|
667
|
+
dashboard_window_query,
|
|
668
|
+
dashboard_response
|
|
669
|
+
};
|