@devpad/api 2.6.10 → 2.6.12

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.
@@ -1,4 +1,4 @@
1
- // ../schema/dist/errors.js
1
+ // ../schema/src/errors.ts
2
2
  import { err } from "@f0rbit/corpus";
3
3
  var defaultLogger = ({ error, context }) => {
4
4
  console.error(`[${context.timestamp}] [${error.kind}]`, error.message || error.kind, {
@@ -10,10 +10,8 @@ var defaultLogger = ({ error, context }) => {
10
10
  var errorLogger = defaultLogger;
11
11
  var contextProvider = null;
12
12
  var configureErrorLogging = (config) => {
13
- if (config.logger)
14
- errorLogger = config.logger;
15
- if (config.contextProvider)
16
- contextProvider = config.contextProvider;
13
+ if (config.logger) errorLogger = config.logger;
14
+ if (config.contextProvider) contextProvider = config.contextProvider;
17
15
  };
18
16
  var logAndReturn = (error, ctx) => {
19
17
  const context = {
@@ -59,23 +57,29 @@ var parseError = (message, ctx) => logAndReturn({ kind: "parse_error", ...messag
59
57
  var encryptionError = (operation, message, ctx) => logAndReturn({ kind: "encryption_error", operation, ...message && { message } }, ctx);
60
58
  var dbError = (message, ctx) => logAndReturn({ kind: "db_error", ...message && { message } }, ctx);
61
59
  var conflict = (resource, message, ctx) => logAndReturn({ kind: "conflict", ...resource && { resource }, ...message && { message } }, ctx);
62
- var protectedEntity = (entity_id, message, modified_by, modified_at, ctx) => logAndReturn({
63
- kind: "protected",
64
- ...entity_id && { entity_id },
65
- ...message && { message },
66
- ...modified_by && { modified_by },
67
- ...modified_at && { modified_at }
68
- }, ctx);
60
+ var protectedEntity = (entity_id, message, modified_by, modified_at, ctx) => logAndReturn(
61
+ {
62
+ kind: "protected",
63
+ ...entity_id && { entity_id },
64
+ ...message && { message },
65
+ ...modified_by && { modified_by },
66
+ ...modified_at && { modified_at }
67
+ },
68
+ ctx
69
+ );
69
70
  var badRequest = (message, details, ctx) => logAndReturn({ kind: "bad_request", ...message && { message }, ...details !== void 0 && { details } }, ctx);
70
71
  var unauthorized = (message, ctx) => logAndReturn({ kind: "unauthorized", ...message && { message } }, ctx);
71
72
  var scanError = (message, ctx) => logAndReturn({ kind: "scan_error", ...message && { message } }, ctx);
72
73
  var githubError = (message, ctx) => logAndReturn({ kind: "github_error", ...message && { message } }, ctx);
73
74
  var validationFieldError = (field, message, ctx) => logAndReturn({ kind: "validation_error", field, ...message && { message } }, ctx);
74
- var approvalChannel = (task_id, message, ctx) => logAndReturn({
75
- kind: "approval_channel",
76
- task_id,
77
- message: message ?? `Task ${task_id} is an approval node \u2014 only a human (auth_channel=user) may complete it`
78
- }, ctx);
75
+ var approvalChannel = (task_id, message, ctx) => logAndReturn(
76
+ {
77
+ kind: "approval_channel",
78
+ task_id,
79
+ message: message ?? `Task ${task_id} is an approval node \u2014 only a human (auth_channel=user) may complete it`
80
+ },
81
+ ctx
82
+ );
79
83
  var errors = {
80
84
  notFound,
81
85
  forbidden,
@@ -1,4 +1,4 @@
1
- // ../schema/dist/database/schema.js
1
+ // ../schema/src/database/schema.ts
2
2
  import { relations, sql } from "drizzle-orm";
3
3
  import { index, int, integer, primaryKey, sqliteTable, text, unique, uniqueIndex } from "drizzle-orm/sqlite-core";
4
4
  var timestamps = () => ({
@@ -167,46 +167,54 @@ var COMPLETION_POLICIES = ["manual", "auto_children"];
167
167
  var COMPLETED_VIA_VALUES = ["user", "api", "policy"];
168
168
  var TASK_LINK_KINDS = ["blocks", "relates_to", "references", "discovered_from", "tracks_metric"];
169
169
  var SDLC_STAGES = ["ideate", "plan", "build", "review", "deploy", "live"];
170
- var task = sqliteTable("task", {
171
- ...owned_entity("task"),
172
- title: text("title").notNull(),
173
- progress: text("progress", { enum: ["UNSTARTED", "IN_PROGRESS", "COMPLETED"] }).notNull().default("UNSTARTED"),
174
- visibility: text("visibility", { enum: ["PUBLIC", "PRIVATE", "HIDDEN", "ARCHIVED", "DRAFT", "DELETED"] }).notNull().default("PRIVATE"),
175
- goal_id: text("goal_id").references(() => goal.id),
176
- project_id: text("project_id").references(() => project.id),
177
- description: text("description"),
178
- start_time: text("start_time"),
179
- end_time: text("end_time"),
180
- summary: text("summary"),
181
- codebase_task_id: text("codebase_task_id").references(() => codebase_tasks.id),
182
- priority: text("priority", { enum: ["LOW", "MEDIUM", "HIGH"] }).notNull().default("LOW"),
183
- // graph columns (v2.4) — self-FK omitted deliberately (mirrors
184
- // checklist_item.parent_id): guarded writes in the graph service own
185
- // the invariant, not a DB-level FK constraint.
186
- parent_id: text("parent_id"),
187
- rank: text("rank").notNull().default(""),
188
- rev: integer("rev").notNull().default(0),
189
- kind: text("kind", { enum: TASK_KINDS }).notNull().default("task"),
190
- completion_policy: text("completion_policy", { enum: COMPLETION_POLICIES }).notNull().default("manual"),
191
- completed_via: text("completed_via", { enum: COMPLETED_VIA_VALUES }),
192
- claimed_by: text("claimed_by"),
193
- claimed_at: text("claimed_at"),
194
- // v2.4 (task A4.5) — nullable: opting a task into SDLC stage tracking is
195
- // per-task, not a blanket migration.
196
- stage: text("stage", { enum: SDLC_STAGES })
197
- }, (table) => [index("task_parent_id_idx").on(table.parent_id)]);
198
- var task_link = sqliteTable("task_link", {
199
- ...entity("link"),
200
- src_id: text("src_id").notNull().references(() => task.id),
201
- dst_id: text("dst_id").references(() => task.id),
202
- kind: text("kind", { enum: TASK_LINK_KINDS }).notNull(),
203
- ref: text("ref", { mode: "json" }),
204
- note: text("note")
205
- }, (table) => [
206
- unique("task_link_unique").on(table.src_id, table.dst_id, table.kind),
207
- index("task_link_src_id_idx").on(table.src_id),
208
- index("task_link_dst_id_idx").on(table.dst_id)
209
- ]);
170
+ var task = sqliteTable(
171
+ "task",
172
+ {
173
+ ...owned_entity("task"),
174
+ title: text("title").notNull(),
175
+ progress: text("progress", { enum: ["UNSTARTED", "IN_PROGRESS", "COMPLETED"] }).notNull().default("UNSTARTED"),
176
+ visibility: text("visibility", { enum: ["PUBLIC", "PRIVATE", "HIDDEN", "ARCHIVED", "DRAFT", "DELETED"] }).notNull().default("PRIVATE"),
177
+ goal_id: text("goal_id").references(() => goal.id),
178
+ project_id: text("project_id").references(() => project.id),
179
+ description: text("description"),
180
+ start_time: text("start_time"),
181
+ end_time: text("end_time"),
182
+ summary: text("summary"),
183
+ codebase_task_id: text("codebase_task_id").references(() => codebase_tasks.id),
184
+ priority: text("priority", { enum: ["LOW", "MEDIUM", "HIGH"] }).notNull().default("LOW"),
185
+ // graph columns (v2.4) — self-FK omitted deliberately (mirrors
186
+ // checklist_item.parent_id): guarded writes in the graph service own
187
+ // the invariant, not a DB-level FK constraint.
188
+ parent_id: text("parent_id"),
189
+ rank: text("rank").notNull().default(""),
190
+ rev: integer("rev").notNull().default(0),
191
+ kind: text("kind", { enum: TASK_KINDS }).notNull().default("task"),
192
+ completion_policy: text("completion_policy", { enum: COMPLETION_POLICIES }).notNull().default("manual"),
193
+ completed_via: text("completed_via", { enum: COMPLETED_VIA_VALUES }),
194
+ claimed_by: text("claimed_by"),
195
+ claimed_at: text("claimed_at"),
196
+ // v2.4 (task A4.5) — nullable: opting a task into SDLC stage tracking is
197
+ // per-task, not a blanket migration.
198
+ stage: text("stage", { enum: SDLC_STAGES })
199
+ },
200
+ (table) => [index("task_parent_id_idx").on(table.parent_id)]
201
+ );
202
+ var task_link = sqliteTable(
203
+ "task_link",
204
+ {
205
+ ...entity("link"),
206
+ src_id: text("src_id").notNull().references(() => task.id),
207
+ dst_id: text("dst_id").references(() => task.id),
208
+ kind: text("kind", { enum: TASK_LINK_KINDS }).notNull(),
209
+ ref: text("ref", { mode: "json" }),
210
+ note: text("note")
211
+ },
212
+ (table) => [
213
+ unique("task_link_unique").on(table.src_id, table.dst_id, table.kind),
214
+ index("task_link_src_id_idx").on(table.src_id),
215
+ index("task_link_dst_id_idx").on(table.dst_id)
216
+ ]
217
+ );
210
218
  var task_rollup = sqliteTable("task_rollup", {
211
219
  task_id: text("task_id").primaryKey().references(() => task.id),
212
220
  direct_done: integer("direct_done").notNull().default(0),
@@ -242,103 +250,131 @@ var TASK_EVENT_KINDS = [
242
250
  ];
243
251
  var TASK_EVENT_ACTORS = ["user", "api", "policy", "github"];
244
252
  var TASK_EVENT_DISPATCH_STATUSES = ["pending", "dispatched"];
245
- var task_event = sqliteTable("task_event", {
246
- id: integer("id").primaryKey({ autoIncrement: true }),
247
- event_id: text("event_id").notNull().unique().$defaultFn(() => `evt_${crypto.randomUUID()}`),
248
- kind: text("kind", { enum: TASK_EVENT_KINDS }).notNull(),
249
- subject_id: text("subject_id").notNull(),
250
- project_id: text("project_id"),
251
- actor: text("actor", { enum: TASK_EVENT_ACTORS }).notNull(),
252
- payload: text("payload", { mode: "json" }).notNull(),
253
- occurred_at: text("occurred_at").notNull().default(sql`(CURRENT_TIMESTAMP)`),
254
- dispatch_status: text("dispatch_status", { enum: TASK_EVENT_DISPATCH_STATUSES }).notNull().default("pending"),
255
- dispatched_at: text("dispatched_at")
256
- }, (table) => [
257
- index("task_event_subject_id_idx").on(table.subject_id),
258
- index("task_event_dispatch_status_idx").on(table.dispatch_status)
259
- ]);
260
- var hook = sqliteTable("hook", {
261
- ...entity("hook"),
262
- project_id: text("project_id").notNull().references(() => project.id),
263
- enabled: integer("enabled", { mode: "boolean" }).notNull().default(true),
264
- // HookTrigger: { kinds: TaskEventKind[], selector: { subject_kind?, tag?, ancestor_id? } }
265
- trigger: text("trigger", { mode: "json" }).notNull(),
266
- // HookAction: { kind: "webhook", url, secret_encrypted? } | { kind: "vault", scope, op, args? } | { kind: "pipeline", package_id }
267
- action: text("action", { mode: "json" }).notNull()
268
- }, (table) => [index("hook_project_id_idx").on(table.project_id)]);
253
+ var task_event = sqliteTable(
254
+ "task_event",
255
+ {
256
+ id: integer("id").primaryKey({ autoIncrement: true }),
257
+ event_id: text("event_id").notNull().unique().$defaultFn(() => `evt_${crypto.randomUUID()}`),
258
+ kind: text("kind", { enum: TASK_EVENT_KINDS }).notNull(),
259
+ subject_id: text("subject_id").notNull(),
260
+ project_id: text("project_id"),
261
+ actor: text("actor", { enum: TASK_EVENT_ACTORS }).notNull(),
262
+ payload: text("payload", { mode: "json" }).notNull(),
263
+ occurred_at: text("occurred_at").notNull().default(sql`(CURRENT_TIMESTAMP)`),
264
+ dispatch_status: text("dispatch_status", { enum: TASK_EVENT_DISPATCH_STATUSES }).notNull().default("pending"),
265
+ dispatched_at: text("dispatched_at")
266
+ },
267
+ (table) => [
268
+ index("task_event_subject_id_idx").on(table.subject_id),
269
+ index("task_event_dispatch_status_idx").on(table.dispatch_status)
270
+ ]
271
+ );
272
+ var hook = sqliteTable(
273
+ "hook",
274
+ {
275
+ ...entity("hook"),
276
+ project_id: text("project_id").notNull().references(() => project.id),
277
+ enabled: integer("enabled", { mode: "boolean" }).notNull().default(true),
278
+ // HookTrigger: { kinds: TaskEventKind[], selector: { subject_kind?, tag?, ancestor_id? } }
279
+ trigger: text("trigger", { mode: "json" }).notNull(),
280
+ // HookAction: { kind: "webhook", url, secret_encrypted? } | { kind: "vault", scope, op, args? } | { kind: "pipeline", package_id }
281
+ action: text("action", { mode: "json" }).notNull()
282
+ },
283
+ (table) => [index("hook_project_id_idx").on(table.project_id)]
284
+ );
269
285
  var HOOK_DELIVERY_STATUSES = ["pending", "delivered", "failed_transient", "failed_permanent"];
270
- var hook_delivery = sqliteTable("hook_delivery", {
271
- // PK = sha256(`${event_id}:${hook_id}`) — see hooks/dispatch.ts's
272
- // `hook_delivery_id`. Never generated any other way.
273
- id: text("id").primaryKey(),
274
- hook_id: text("hook_id").notNull().references(() => hook.id),
275
- event_id: text("event_id").notNull(),
276
- status: text("status", { enum: HOOK_DELIVERY_STATUSES }).notNull().default("pending"),
277
- attempts: integer("attempts").notNull().default(0),
278
- last_error: text("last_error"),
279
- ...timestamps()
280
- }, (table) => [
281
- index("hook_delivery_hook_id_idx").on(table.hook_id),
282
- index("hook_delivery_status_idx").on(table.status)
283
- ]);
284
- var github_webhook_event = sqliteTable("github_webhook_event", {
285
- id: text("id").primaryKey(),
286
- delivery_guid: text("delivery_guid").notNull(),
287
- event_type: text("event_type").notNull(),
288
- processed_at: text("processed_at").notNull().default(sql`(CURRENT_TIMESTAMP)`)
289
- }, (table) => [index("github_webhook_event_delivery_guid_idx").on(table.delivery_guid)]);
286
+ var hook_delivery = sqliteTable(
287
+ "hook_delivery",
288
+ {
289
+ // PK = sha256(`${event_id}:${hook_id}`) — see hooks/dispatch.ts's
290
+ // `hook_delivery_id`. Never generated any other way.
291
+ id: text("id").primaryKey(),
292
+ hook_id: text("hook_id").notNull().references(() => hook.id),
293
+ event_id: text("event_id").notNull(),
294
+ status: text("status", { enum: HOOK_DELIVERY_STATUSES }).notNull().default("pending"),
295
+ attempts: integer("attempts").notNull().default(0),
296
+ last_error: text("last_error"),
297
+ ...timestamps()
298
+ },
299
+ (table) => [
300
+ index("hook_delivery_hook_id_idx").on(table.hook_id),
301
+ index("hook_delivery_status_idx").on(table.status)
302
+ ]
303
+ );
304
+ var github_webhook_event = sqliteTable(
305
+ "github_webhook_event",
306
+ {
307
+ id: text("id").primaryKey(),
308
+ delivery_guid: text("delivery_guid").notNull(),
309
+ event_type: text("event_type").notNull(),
310
+ processed_at: text("processed_at").notNull().default(sql`(CURRENT_TIMESTAMP)`)
311
+ },
312
+ (table) => [index("github_webhook_event_delivery_guid_idx").on(table.delivery_guid)]
313
+ );
290
314
  var DOCUMENT_KINDS = ["plan", "design", "interface"];
291
315
  var DOCUMENT_STATUSES = ["draft", "in_review", "approved"];
292
- var document = sqliteTable("document", {
293
- ...entity("doc"),
294
- project_id: text("project_id").notNull().references(() => project.id),
295
- // Nullable subject node — a doc need not be tied to a specific task
296
- // (e.g. a project-level design doc).
297
- task_id: text("task_id").references(() => task.id),
298
- kind: text("kind", { enum: DOCUMENT_KINDS }).notNull(),
299
- title: text("title").notNull(),
300
- // Corpus version pointer cache — the DB never stores content, only the
301
- // latest corpus snapshot version for this document's dedicated store
302
- // (`docStoreId`). Null until the first push.
303
- head_version: text("head_version"),
304
- status: text("status", { enum: DOCUMENT_STATUSES }).notNull().default("draft")
305
- }, (table) => [index("document_project_id_idx").on(table.project_id), index("document_task_id_idx").on(table.task_id)]);
316
+ var document = sqliteTable(
317
+ "document",
318
+ {
319
+ ...entity("doc"),
320
+ project_id: text("project_id").notNull().references(() => project.id),
321
+ // Nullable subject node — a doc need not be tied to a specific task
322
+ // (e.g. a project-level design doc).
323
+ task_id: text("task_id").references(() => task.id),
324
+ kind: text("kind", { enum: DOCUMENT_KINDS }).notNull(),
325
+ title: text("title").notNull(),
326
+ // Corpus version pointer cache — the DB never stores content, only the
327
+ // latest corpus snapshot version for this document's dedicated store
328
+ // (`docStoreId`). Null until the first push.
329
+ head_version: text("head_version"),
330
+ status: text("status", { enum: DOCUMENT_STATUSES }).notNull().default("draft")
331
+ },
332
+ (table) => [index("document_project_id_idx").on(table.project_id), index("document_task_id_idx").on(table.task_id)]
333
+ );
306
334
  var THREAD_STATUSES = ["open", "addressed", "resolved", "orphaned"];
307
- var annotation_thread = sqliteTable("annotation_thread", {
308
- ...id("thread"),
309
- document_id: text("document_id").notNull().references(() => document.id),
310
- // The marker's own `id` field (embedded in the doc) — stable across
311
- // versions/re-anchoring, distinct from this row's own DB id.
312
- thread_id: text("thread_id").notNull(),
313
- status: text("status", { enum: THREAD_STATUSES }).notNull().default("open"),
314
- blocking: int("blocking", { mode: "boolean" }).notNull().default(false),
315
- ...timestamps()
316
- }, (table) => [
317
- unique("annotation_thread_unique").on(table.document_id, table.thread_id),
318
- index("annotation_thread_document_id_idx").on(table.document_id),
319
- index("annotation_thread_status_idx").on(table.status)
320
- ]);
335
+ var annotation_thread = sqliteTable(
336
+ "annotation_thread",
337
+ {
338
+ ...id("thread"),
339
+ document_id: text("document_id").notNull().references(() => document.id),
340
+ // The marker's own `id` field (embedded in the doc) — stable across
341
+ // versions/re-anchoring, distinct from this row's own DB id.
342
+ thread_id: text("thread_id").notNull(),
343
+ status: text("status", { enum: THREAD_STATUSES }).notNull().default("open"),
344
+ blocking: int("blocking", { mode: "boolean" }).notNull().default(false),
345
+ ...timestamps()
346
+ },
347
+ (table) => [
348
+ unique("annotation_thread_unique").on(table.document_id, table.thread_id),
349
+ index("annotation_thread_document_id_idx").on(table.document_id),
350
+ index("annotation_thread_status_idx").on(table.status)
351
+ ]
352
+ );
321
353
  var SIGNOFF_SUBJECT_KINDS = ["doc_version", "stage", "pipeline_gate"];
322
354
  var SIGNOFF_CHECKPOINTS = ["plan", "types", "design"];
323
355
  var SIGNOFF_DECISIONS = ["approved", "changes_requested", "auto"];
324
- var signoff = sqliteTable("signoff", {
325
- ...entity("signoff"),
326
- subject_kind: text("subject_kind", { enum: SIGNOFF_SUBJECT_KINDS }).notNull(),
327
- subject_id: text("subject_id").notNull(),
328
- checkpoint: text("checkpoint", { enum: SIGNOFF_CHECKPOINTS }).notNull(),
329
- // The `kind:"approval"` task node this checkpoint projects into the
330
- // graph — null only for the brief window before `request_checkpoint`
331
- // finishes creating it (never persisted mid-transaction in practice).
332
- task_id: text("task_id").references(() => task.id),
333
- decision: text("decision", { enum: SIGNOFF_DECISIONS }),
334
- decided_by: text("decided_by").references(() => user.id),
335
- decided_at: text("decided_at"),
336
- reason: text("reason"),
337
- content_hash: text("content_hash")
338
- }, (table) => [
339
- index("signoff_subject_idx").on(table.subject_kind, table.subject_id),
340
- index("signoff_task_id_idx").on(table.task_id)
341
- ]);
356
+ var signoff = sqliteTable(
357
+ "signoff",
358
+ {
359
+ ...entity("signoff"),
360
+ subject_kind: text("subject_kind", { enum: SIGNOFF_SUBJECT_KINDS }).notNull(),
361
+ subject_id: text("subject_id").notNull(),
362
+ checkpoint: text("checkpoint", { enum: SIGNOFF_CHECKPOINTS }).notNull(),
363
+ // The `kind:"approval"` task node this checkpoint projects into the
364
+ // graph — null only for the brief window before `request_checkpoint`
365
+ // finishes creating it (never persisted mid-transaction in practice).
366
+ task_id: text("task_id").references(() => task.id),
367
+ decision: text("decision", { enum: SIGNOFF_DECISIONS }),
368
+ decided_by: text("decided_by").references(() => user.id),
369
+ decided_at: text("decided_at"),
370
+ reason: text("reason"),
371
+ content_hash: text("content_hash")
372
+ },
373
+ (table) => [
374
+ index("signoff_subject_idx").on(table.subject_kind, table.subject_id),
375
+ index("signoff_task_id_idx").on(table.task_id)
376
+ ]
377
+ );
342
378
  var checklist = sqliteTable("checklist", {
343
379
  ...entity("checklist"),
344
380
  task_id: text("task_id").notNull().references(() => task.id),
@@ -364,17 +400,25 @@ var codebase_tasks = sqliteTable("codebase_tasks", {
364
400
  context: text("context", { mode: "json" }),
365
401
  recent_scan_id: integer("recent_scan_id").references(() => tracker_result.id)
366
402
  });
367
- var tag = sqliteTable("tag", {
368
- ...owned_entity("tag"),
369
- title: text("title").notNull(),
370
- color: text("color"),
371
- render: int("render", { mode: "boolean" }).notNull().default(true)
372
- }, (table) => [unique("tag_unique").on(table.owner_id, table.title)]);
373
- var task_tag = sqliteTable("task_tag", {
374
- task_id: text("task_id").notNull().references(() => task.id),
375
- tag_id: text("tag_id").notNull().references(() => tag.id),
376
- ...timestamps()
377
- }, (table) => [primaryKey({ columns: [table.task_id, table.tag_id] })]);
403
+ var tag = sqliteTable(
404
+ "tag",
405
+ {
406
+ ...owned_entity("tag"),
407
+ title: text("title").notNull(),
408
+ color: text("color"),
409
+ render: int("render", { mode: "boolean" }).notNull().default(true)
410
+ },
411
+ (table) => [unique("tag_unique").on(table.owner_id, table.title)]
412
+ );
413
+ var task_tag = sqliteTable(
414
+ "task_tag",
415
+ {
416
+ task_id: text("task_id").notNull().references(() => task.id),
417
+ tag_id: text("tag_id").notNull().references(() => tag.id),
418
+ ...timestamps()
419
+ },
420
+ (table) => [primaryKey({ columns: [table.task_id, table.tag_id] })]
421
+ );
378
422
  var commit_detail = sqliteTable("commit_detail", {
379
423
  sha: text("sha").primaryKey(),
380
424
  message: text("message").notNull(),
@@ -448,27 +492,35 @@ var pipeline_run = sqliteTable("pipeline_run", {
448
492
  // `deploy_failed` stage event carrying the same text in its payload.
449
493
  error: text("error")
450
494
  });
451
- var pipeline_stage_event = sqliteTable("pipeline_stage_event", {
452
- ...id("pipeline-stage-event"),
453
- run_id: text("run_id").notNull().references(() => pipeline_run.id),
454
- stage_name: text("stage_name").notNull(),
455
- kind: text("kind", { enum: STAGE_EVENT_KINDS }).notNull(),
456
- payload: text("payload", { mode: "json" }),
457
- ts: text("ts").notNull().default(sql`(CURRENT_TIMESTAMP)`),
458
- idempotency_hash: text("idempotency_hash")
459
- }, (table) => [
460
- uniqueIndex("idx_pipeline_stage_event_idem_uniq").on(table.run_id, table.idempotency_hash).where(sql`idempotency_hash IS NOT NULL`)
461
- ]);
462
- var pipeline_dispatch = sqliteTable("pipeline_dispatch", {
463
- ...id("pipeline-dispatch"),
464
- run_id: text("run_id").notNull().references(() => pipeline_run.id),
465
- stage_name: text("stage_name").notNull(),
466
- commit_sha: text("commit_sha").notNull(),
467
- status: text("status", { enum: DISPATCH_STATUSES }).notNull().default("claimed"),
468
- error: text("error"),
469
- requested_by: text("requested_by"),
470
- ...timestamps()
471
- }, (table) => [unique("pipeline_dispatch_run_stage_unique").on(table.run_id, table.stage_name)]);
495
+ var pipeline_stage_event = sqliteTable(
496
+ "pipeline_stage_event",
497
+ {
498
+ ...id("pipeline-stage-event"),
499
+ run_id: text("run_id").notNull().references(() => pipeline_run.id),
500
+ stage_name: text("stage_name").notNull(),
501
+ kind: text("kind", { enum: STAGE_EVENT_KINDS }).notNull(),
502
+ payload: text("payload", { mode: "json" }),
503
+ ts: text("ts").notNull().default(sql`(CURRENT_TIMESTAMP)`),
504
+ idempotency_hash: text("idempotency_hash")
505
+ },
506
+ (table) => [
507
+ uniqueIndex("idx_pipeline_stage_event_idem_uniq").on(table.run_id, table.idempotency_hash).where(sql`idempotency_hash IS NOT NULL`)
508
+ ]
509
+ );
510
+ var pipeline_dispatch = sqliteTable(
511
+ "pipeline_dispatch",
512
+ {
513
+ ...id("pipeline-dispatch"),
514
+ run_id: text("run_id").notNull().references(() => pipeline_run.id),
515
+ stage_name: text("stage_name").notNull(),
516
+ commit_sha: text("commit_sha").notNull(),
517
+ status: text("status", { enum: DISPATCH_STATUSES }).notNull().default("claimed"),
518
+ error: text("error"),
519
+ requested_by: text("requested_by"),
520
+ ...timestamps()
521
+ },
522
+ (table) => [unique("pipeline_dispatch_run_stage_unique").on(table.run_id, table.stage_name)]
523
+ );
472
524
  var pipeline_grant = sqliteTable("pipeline_grant", {
473
525
  ...entity("pipeline-grant"),
474
526
  package_id: text("package_id").notNull().references(() => pipeline_package.id),
@@ -635,7 +687,7 @@ var signoff_relations = relations(signoff, ({ one }) => ({
635
687
  decided_by_user: one(user, { fields: [signoff.decided_by], references: [user.id] })
636
688
  }));
637
689
 
638
- // ../schema/dist/validation.js
690
+ // ../schema/src/validation.ts
639
691
  import { createSelectSchema } from "drizzle-zod";
640
692
  import { z } from "zod";
641
693
  var upsert_project = z.object({
@@ -729,10 +781,12 @@ var upsert_tag = z.object({
729
781
  owner_id: z.string()
730
782
  });
731
783
  var project_config = z.object({
732
- tags: z.array(z.object({
733
- name: z.string(),
734
- match: z.array(z.string())
735
- })),
784
+ tags: z.array(
785
+ z.object({
786
+ name: z.string(),
787
+ match: z.array(z.string())
788
+ })
789
+ ),
736
790
  ignore: z.array(z.string())
737
791
  });
738
792
  var save_config_request = z.object({
@@ -745,14 +799,15 @@ var update_user = z.object({
745
799
  id: z.string(),
746
800
  name: z.string().optional(),
747
801
  image_url: z.string().optional(),
748
- task_view: z.union([z.literal("list"), z.literal("grid")]).optional(),
749
- email_verified: z.boolean().optional()
802
+ task_view: z.union([z.literal("list"), z.literal("grid")]).optional()
750
803
  });
751
804
  var config_schema = z.object({
752
- tags: z.array(z.object({
753
- name: z.string(),
754
- match: z.array(z.string())
755
- })),
805
+ tags: z.array(
806
+ z.object({
807
+ name: z.string(),
808
+ match: z.array(z.string())
809
+ })
810
+ ),
756
811
  ignore: z.array(z.string().regex(/^[\s\S]*$/, "Invalid path"))
757
812
  });
758
813
  var upsert_milestone = z.object({
@@ -877,7 +932,7 @@ var upsert_pipeline_grant = z.object({
877
932
  scope: grant_scope,
878
933
  granted_by: z.string().nullable().optional(),
879
934
  granted_at: z.string().nullable().optional(),
880
- auto_approved: z.boolean().nullable().optional()
935
+ auto_approved: z.boolean().optional()
881
936
  });
882
937
  var upsert_pipeline_approval = z.object({
883
938
  run_id: z.string(),
@@ -1,4 +1,4 @@
1
- // ../schema/dist/blog/corpus.js
1
+ // ../schema/src/blog/corpus.ts
2
2
  import { define_store, json_codec } from "@f0rbit/corpus";
3
3
  import { z } from "zod";
4
4
  var PostContentSchema = z.object({
@@ -34,12 +34,40 @@ var mapCorpusError = (e) => {
34
34
  var parsePostContent = PostContentSchema.parse.bind(PostContentSchema);
35
35
  var serializePostContent = (content) => JSON.stringify(content);
36
36
 
37
- // ../schema/dist/blog/corpus-shim.js
38
- import { at, fetch_result, first, format_error, last, match, pipe, to_fallback, to_nullable, try_catch, try_catch_async, unwrap_or } from "@f0rbit/corpus";
37
+ // ../schema/src/blog/corpus-shim.ts
38
+ import {
39
+ at,
40
+ fetch_result,
41
+ first,
42
+ format_error,
43
+ last,
44
+ match,
45
+ pipe,
46
+ to_fallback,
47
+ to_nullable,
48
+ try_catch,
49
+ try_catch_async,
50
+ unwrap_or
51
+ } from "@f0rbit/corpus";
39
52
 
40
- // ../schema/dist/blog/types.js
53
+ // ../schema/src/blog/types.ts
41
54
  import { z as z2 } from "zod";
42
- import { at as at2, err, fetch_result as fetch_result2, first as first2, format_error as format_error2, last as last2, match as match2, ok, pipe as pipe2, to_fallback as to_fallback2, to_nullable as to_nullable2, try_catch as try_catch2, try_catch_async as try_catch_async2, unwrap_or as unwrap_or2 } from "@f0rbit/corpus";
55
+ import {
56
+ at as at2,
57
+ err,
58
+ fetch_result as fetch_result2,
59
+ first as first2,
60
+ format_error as format_error2,
61
+ last as last2,
62
+ match as match2,
63
+ ok,
64
+ pipe as pipe2,
65
+ to_fallback as to_fallback2,
66
+ to_nullable as to_nullable2,
67
+ try_catch as try_catch2,
68
+ try_catch_async as try_catch_async2,
69
+ unwrap_or as unwrap_or2
70
+ } from "@f0rbit/corpus";
43
71
  var PostRowSchema = z2.object({
44
72
  id: z2.number(),
45
73
  uuid: z2.string(),
@@ -198,10 +226,8 @@ var isPublished = (post) => post.publish_at !== null && post.publish_at <= /* @_
198
226
  var isScheduled = (post) => post.publish_at !== null && post.publish_at > /* @__PURE__ */ new Date();
199
227
  var isDraft = (post) => post.publish_at === null;
200
228
  var postStatus = (post) => {
201
- if (isDraft(post))
202
- return "draft";
203
- if (isScheduled(post))
204
- return "scheduled";
229
+ if (isDraft(post)) return "draft";
230
+ if (isScheduled(post)) return "scheduled";
205
231
  return "published";
206
232
  };
207
233
  var CategoryCreateSchema = z2.object({
package/dist/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
- import { G as PostListParams, T as PostsResponse, x as Post, D as PostCreate, Q as PostUpdate, Z as VersionInfo, y as PostContent, C as Category, k as CategoryCreate, A as AccessKey } from './types.d-DbgtG-w1.js';
2
- import { ai as Profile, u as CreateProfileInput, aw as UpdateProfileInput, aj as ProfileFilter, c as AddFilterInput, aq as Timeline, A as Account, ae as PlatformSettings } from './types.d-Dt-0_WMH.js';
1
+ import { G as PostListParams, T as PostsResponse, x as Post, D as PostCreate, Q as PostUpdate, Z as VersionInfo, y as PostContent, C as Category, k as CategoryCreate, A as AccessKey } from './types-CDD2mUV6.js';
2
+ import { ai as Profile, u as CreateProfileInput, aw as UpdateProfileInput, aj as ProfileFilter, c as AddFilterInput, aq as Timeline, A as Account, ae as PlatformSettings } from './types-T4cFlYTI.js';
3
3
  import { z } from 'zod';
4
- import { c as ApiKey, R as Project, aH as UpsertProject, G as GetConfigResult, a4 as SaveConfigRequest, aq as TodoUpdate, H as HistoryAction, T as ProjectGraphResponse, U as ProjectViewLayoutInput, M as Milestone, af as Task, p as Goal, q as Hook, w as HookTrigger, s as HookActionPublic, ay as UpsertHook, u as HookDelivery, am as TaskWithDetails, aK as UpsertTodo, aI as UpsertTag, ai as TaskLink, C as ClaimRequest, m as DoneRequest, a as AdvanceStageRequest, aJ as UpsertTaskLink, f as ApplyRequest, e as ApplyOp, ae as TagWithTypedColor, l as Document, W as PushDocRequest, ap as ThreadMarker, i as CreateThreadRequest, b as AnnotationThread, X as PushInterfaceReportRequest, z as InterfaceDiffClass, a8 as Signoff, _ as RequestCheckpointRequest, k as DecideCheckpointRequest, $ as ReviewItem, D as DashboardResponse, O as PipelineRun, Q as PipelineStageEvent, J as PipelineGrant, L as PipelinePackage, P as PipelineAnalysisTemplate, K as PipelineOidcTrust } from './types.d-D1ao8Ynh.js';
5
- export { S as ProjectConfig, a0 as ReviewItemKind } from './types.d-D1ao8Ynh.js';
4
+ import { c as ApiKey, R as Project, aH as UpsertProject, G as GetConfigResult, a4 as SaveConfigRequest, aq as TodoUpdate, H as HistoryAction, T as ProjectGraphResponse, U as ProjectViewLayoutInput, M as Milestone, af as Task, p as Goal, q as Hook, w as HookTrigger, s as HookActionPublic, ay as UpsertHook, u as HookDelivery, am as TaskWithDetails, aK as UpsertTodo, aI as UpsertTag, ai as TaskLink, C as ClaimRequest, m as DoneRequest, a as AdvanceStageRequest, aJ as UpsertTaskLink, f as ApplyRequest, e as ApplyOp, ae as TagWithTypedColor, l as Document, W as PushDocRequest, ap as ThreadMarker, i as CreateThreadRequest, b as AnnotationThread, X as PushInterfaceReportRequest, z as InterfaceDiffClass, a8 as Signoff, _ as RequestCheckpointRequest, k as DecideCheckpointRequest, $ as ReviewItem, D as DashboardResponse, O as PipelineRun, Q as PipelineStageEvent, J as PipelineGrant, L as PipelinePackage, P as PipelineAnalysisTemplate, K as PipelineOidcTrust } from './types-CnplaVqa.js';
5
+ export { S as ProjectConfig, a0 as ReviewItemKind } from './types-CnplaVqa.js';
6
6
  import { Result } from '@f0rbit/corpus';
7
7
  export { Result, err, ok } from '@f0rbit/corpus';
8
- import { b as CompletionPolicy, H as HookDeliveryStatus, C as CompletedVia, c as DispatchStatus, l as StageEventKind } from './schema.d-CUm4wtV_.js';
8
+ import { b as CompletionPolicy, H as HookDeliveryStatus, C as CompletedVia, c as DispatchStatus, l as StageEventKind } from './schema-CizNlS2t.js';
9
9
  import 'drizzle-orm';
10
- import './media.d-R87HGuRp.js';
10
+ import './media-R87HGuRp.js';
11
11
  import 'drizzle-orm/sqlite-core';
12
12
  import 'drizzle-zod';
13
13