@rudderhq/db 0.7.3 → 0.7.4

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../src/schema/requests.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgCpB,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BnC,CAAC"}
@@ -0,0 +1,62 @@
1
+ import { sql } from "drizzle-orm";
2
+ import { boolean, index, integer, jsonb, pgTable, text, timestamp, uniqueIndex, uuid } from "drizzle-orm/pg-core";
3
+ import { agents } from "./agents.js";
4
+ import { heartbeatRuns } from "./heartbeat_runs.js";
5
+ import { issues } from "./issues.js";
6
+ import { organizations } from "./organizations.js";
7
+ export const requests = pgTable("requests", {
8
+ id: uuid("id").primaryKey().defaultRandom(),
9
+ orgId: uuid("org_id").notNull().references(() => organizations.id),
10
+ kind: text("kind").notNull(),
11
+ subtype: text("subtype").notNull(),
12
+ status: text("status").notNull().default("open"),
13
+ issueId: uuid("issue_id").references(() => issues.id, { onDelete: "cascade" }),
14
+ requestedByAgentId: uuid("requested_by_agent_id").references(() => agents.id, { onDelete: "set null" }),
15
+ requestedByUserId: text("requested_by_user_id"),
16
+ originRunId: uuid("origin_run_id").references(() => heartbeatRuns.id, { onDelete: "set null" }),
17
+ assigneeAgentId: uuid("assignee_agent_id").references(() => agents.id, { onDelete: "set null" }),
18
+ blockerFingerprint: text("blocker_fingerprint"),
19
+ supersededByRequestId: uuid("superseded_by_request_id"),
20
+ title: text("title").notNull(),
21
+ prompt: text("prompt").notNull(),
22
+ resolution: text("resolution"),
23
+ response: text("response"),
24
+ resolvedByUserId: text("resolved_by_user_id"),
25
+ resolvedAt: timestamp("resolved_at", { withTimezone: true }),
26
+ metadata: jsonb("metadata").$type().notNull().default({}),
27
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
28
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
29
+ }, (table) => ({
30
+ orgStatusUpdatedIdx: index("requests_org_status_updated_idx").on(table.orgId, table.status, table.updatedAt),
31
+ issueUpdatedIdx: index("requests_issue_updated_idx").on(table.issueId, table.updatedAt),
32
+ openAssistanceLineageUniqueIdx: uniqueIndex("requests_open_assistance_lineage_uq")
33
+ .on(table.orgId, table.issueId, table.blockerFingerprint)
34
+ .where(sql `${table.kind} = 'assistance' and ${table.status} = 'open'`),
35
+ }));
36
+ export const issueBlockAuditAttempts = pgTable("issue_block_audit_attempts", {
37
+ id: uuid("id").primaryKey().defaultRandom(),
38
+ orgId: uuid("org_id").notNull().references(() => organizations.id),
39
+ issueId: uuid("issue_id").notNull().references(() => issues.id, { onDelete: "cascade" }),
40
+ requestId: uuid("request_id").notNull().references(() => requests.id, { onDelete: "cascade" }),
41
+ runId: uuid("run_id").notNull().references(() => heartbeatRuns.id),
42
+ rootRunId: uuid("root_run_id").notNull().references(() => heartbeatRuns.id),
43
+ previousRunId: uuid("previous_run_id").references(() => heartbeatRuns.id, { onDelete: "set null" }),
44
+ agentId: uuid("agent_id").notNull().references(() => agents.id, { onDelete: "cascade" }),
45
+ continuationKind: text("continuation_kind").notNull(),
46
+ eligible: boolean("eligible").notNull().default(true),
47
+ failureClass: text("failure_class").notNull(),
48
+ blockerFingerprint: text("blocker_fingerprint").notNull(),
49
+ attemptNumber: integer("attempt_number").notNull(),
50
+ requiredAttempts: integer("required_attempts").notNull(),
51
+ statusBefore: text("status_before").notNull(),
52
+ statusAfter: text("status_after").notNull(),
53
+ resetReason: text("reset_reason"),
54
+ blockerReason: text("blocker_reason").notNull(),
55
+ requestedAction: text("requested_action").notNull(),
56
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
57
+ }, (table) => ({
58
+ issueLineageIdx: index("issue_block_audit_attempts_issue_lineage_idx")
59
+ .on(table.issueId, table.blockerFingerprint, table.attemptNumber),
60
+ issueRunUniqueIdx: uniqueIndex("issue_block_audit_attempts_issue_run_uq").on(table.issueId, table.runId),
61
+ }));
62
+ //# sourceMappingURL=requests.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requests.js","sourceRoot":"","sources":["../../src/schema/requests.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAClH,OAAO,EA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- "version": "0.7.3",
3
+ "version": "0.7.4",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "homepage": "https://github.com/Undertone0809/rudder",
6
6
  "bugs": {
@@ -51,7 +51,7 @@
51
51
  "seed": "tsx src/seed.ts"
52
52
  },
53
53
  "dependencies": {
54
- "@rudderhq/shared": "0.7.3",
54
+ "@rudderhq/shared": "0.7.4",
55
55
  "drizzle-orm": "^0.45.2",
56
56
  "embedded-postgres": "18.1.0-beta.16",
57
57
  "postgres": "^3.4.8"