@trycompai/db 1.3.19 → 1.3.20
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/README.md +28 -0
- package/dist/schema.prisma +172 -4
- package/package.json +11 -3
package/README.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# @trycompai/db
|
|
2
|
+
|
|
3
|
+
Database package for Comp AI.
|
|
4
|
+
|
|
5
|
+
## What’s included
|
|
6
|
+
|
|
7
|
+
- Prisma schema: `dist/schema.prisma`
|
|
8
|
+
- Built output: `dist/`
|
|
9
|
+
- Postinstall helper binary: `comp-prisma-postinstall`
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
bun add @trycompai/db
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { db } from '@trycompai/db';
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Notes
|
|
24
|
+
|
|
25
|
+
- Publishing runs a build automatically via `prepublishOnly`.
|
|
26
|
+
- See `INTEGRATION_GUIDE.md` for integration details.
|
|
27
|
+
|
|
28
|
+
|
package/dist/schema.prisma
CHANGED
|
@@ -39,6 +39,7 @@ enum AttachmentEntityType {
|
|
|
39
39
|
risk
|
|
40
40
|
comment
|
|
41
41
|
trust_nda
|
|
42
|
+
task_item
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
enum AttachmentType {
|
|
@@ -164,6 +165,9 @@ model Member {
|
|
|
164
165
|
reviewedAccessRequests TrustAccessRequest[] @relation("TrustAccessRequestReviewer")
|
|
165
166
|
issuedGrants TrustAccessGrant[] @relation("IssuedGrants")
|
|
166
167
|
revokedGrants TrustAccessGrant[] @relation("RevokedGrants")
|
|
168
|
+
createdTaskItems TaskItem[] @relation("TaskItemCreator")
|
|
169
|
+
updatedTaskItems TaskItem[] @relation("TaskItemUpdater")
|
|
170
|
+
assignedTaskItems TaskItem[] @relation("TaskItemAssignee")
|
|
167
171
|
}
|
|
168
172
|
|
|
169
173
|
model Invitation {
|
|
@@ -298,6 +302,105 @@ model EvidenceAutomation {
|
|
|
298
302
|
}
|
|
299
303
|
|
|
300
304
|
|
|
305
|
+
// ===== browserbase-context.prisma =====
|
|
306
|
+
/// Stores Browserbase context IDs for browser-based automation
|
|
307
|
+
/// One context per organization - shared like a normal browser
|
|
308
|
+
model BrowserbaseContext {
|
|
309
|
+
id String @id @default(dbgenerated("generate_prefixed_cuid('bbc'::text)"))
|
|
310
|
+
|
|
311
|
+
/// Organization that owns this browser context
|
|
312
|
+
organizationId String @unique
|
|
313
|
+
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
|
314
|
+
|
|
315
|
+
/// Browserbase context ID from their API
|
|
316
|
+
contextId String
|
|
317
|
+
|
|
318
|
+
createdAt DateTime @default(now())
|
|
319
|
+
updatedAt DateTime @updatedAt
|
|
320
|
+
|
|
321
|
+
@@index([organizationId])
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/// Browser automation configuration linked to a task
|
|
325
|
+
model BrowserAutomation {
|
|
326
|
+
id String @id @default(dbgenerated("generate_prefixed_cuid('bau'::text)"))
|
|
327
|
+
name String
|
|
328
|
+
description String?
|
|
329
|
+
|
|
330
|
+
/// Task this automation belongs to
|
|
331
|
+
taskId String
|
|
332
|
+
task Task @relation(fields: [taskId], references: [id], onDelete: Cascade)
|
|
333
|
+
|
|
334
|
+
/// Starting URL for the automation
|
|
335
|
+
targetUrl String
|
|
336
|
+
|
|
337
|
+
/// Natural language instruction for the AI agent
|
|
338
|
+
instruction String
|
|
339
|
+
|
|
340
|
+
/// Whether automation is enabled for scheduled runs
|
|
341
|
+
isEnabled Boolean @default(false)
|
|
342
|
+
|
|
343
|
+
/// Cron expression for scheduled runs (null = manual only)
|
|
344
|
+
schedule String?
|
|
345
|
+
|
|
346
|
+
createdAt DateTime @default(now())
|
|
347
|
+
updatedAt DateTime @updatedAt
|
|
348
|
+
|
|
349
|
+
runs BrowserAutomationRun[]
|
|
350
|
+
|
|
351
|
+
@@index([taskId])
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/// Records of browser automation executions
|
|
355
|
+
model BrowserAutomationRun {
|
|
356
|
+
id String @id @default(dbgenerated("generate_prefixed_cuid('bar'::text)"))
|
|
357
|
+
|
|
358
|
+
/// Parent automation
|
|
359
|
+
automationId String
|
|
360
|
+
automation BrowserAutomation @relation(fields: [automationId], references: [id], onDelete: Cascade)
|
|
361
|
+
|
|
362
|
+
/// Execution status
|
|
363
|
+
status BrowserAutomationRunStatus @default(pending)
|
|
364
|
+
|
|
365
|
+
/// Timestamps
|
|
366
|
+
startedAt DateTime?
|
|
367
|
+
completedAt DateTime?
|
|
368
|
+
|
|
369
|
+
/// Duration in milliseconds
|
|
370
|
+
durationMs Int?
|
|
371
|
+
|
|
372
|
+
/// Screenshot URL in S3 (if successful)
|
|
373
|
+
screenshotUrl String?
|
|
374
|
+
|
|
375
|
+
/// Evaluation result - whether the automation fulfilled the task requirements
|
|
376
|
+
evaluationStatus BrowserAutomationEvaluationStatus?
|
|
377
|
+
|
|
378
|
+
/// AI explanation of why it passed or failed
|
|
379
|
+
evaluationReason String?
|
|
380
|
+
|
|
381
|
+
/// Error message (if failed)
|
|
382
|
+
error String?
|
|
383
|
+
|
|
384
|
+
createdAt DateTime @default(now())
|
|
385
|
+
|
|
386
|
+
@@index([automationId])
|
|
387
|
+
@@index([status])
|
|
388
|
+
@@index([createdAt])
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
enum BrowserAutomationEvaluationStatus {
|
|
392
|
+
pass
|
|
393
|
+
fail
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
enum BrowserAutomationRunStatus {
|
|
397
|
+
pending
|
|
398
|
+
running
|
|
399
|
+
completed
|
|
400
|
+
failed
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
|
|
301
404
|
// ===== comment.prisma =====
|
|
302
405
|
model Comment {
|
|
303
406
|
id String @id @default(dbgenerated("generate_prefixed_cuid('cmt'::text)"))
|
|
@@ -1019,7 +1122,7 @@ model Organization {
|
|
|
1019
1122
|
|
|
1020
1123
|
// Employee sync provider (e.g., 'google-workspace', 'rippling')
|
|
1021
1124
|
// When set, the scheduled sync will only use this provider
|
|
1022
|
-
employeeSyncProvider
|
|
1125
|
+
employeeSyncProvider String?
|
|
1023
1126
|
|
|
1024
1127
|
apiKeys ApiKey[]
|
|
1025
1128
|
auditLog AuditLog[]
|
|
@@ -1032,6 +1135,7 @@ model Organization {
|
|
|
1032
1135
|
risk Risk[]
|
|
1033
1136
|
vendors Vendor[]
|
|
1034
1137
|
tasks Task[]
|
|
1138
|
+
taskItems TaskItem[]
|
|
1035
1139
|
comments Comment[]
|
|
1036
1140
|
attachments Attachment[]
|
|
1037
1141
|
trust Trust[]
|
|
@@ -1040,17 +1144,22 @@ model Organization {
|
|
|
1040
1144
|
trustAccessRequests TrustAccessRequest[]
|
|
1041
1145
|
trustNdaAgreements TrustNDAAgreement[]
|
|
1042
1146
|
trustDocuments TrustDocument[]
|
|
1043
|
-
trustResources TrustResource[]
|
|
1147
|
+
trustResources TrustResource[] @relation("OrganizationTrustResources")
|
|
1044
1148
|
knowledgeBaseDocuments KnowledgeBaseDocument[]
|
|
1045
1149
|
questionnaires Questionnaire[]
|
|
1046
1150
|
securityQuestionnaireManualAnswers SecurityQuestionnaireManualAnswer[]
|
|
1047
1151
|
soaDocuments SOADocument[]
|
|
1048
1152
|
primaryColor String?
|
|
1153
|
+
trustPortalFaqs Json? // Array of { question: string, answer: string, order: number }
|
|
1154
|
+
|
|
1049
1155
|
|
|
1050
1156
|
// Integration Platform
|
|
1051
1157
|
integrationConnections IntegrationConnection[]
|
|
1052
1158
|
integrationOAuthApps IntegrationOAuthApp[]
|
|
1053
1159
|
|
|
1160
|
+
// Browser Automation
|
|
1161
|
+
browserbaseContext BrowserbaseContext?
|
|
1162
|
+
|
|
1054
1163
|
@@index([slug])
|
|
1055
1164
|
}
|
|
1056
1165
|
|
|
@@ -1536,6 +1645,64 @@ enum SOAAnswerStatus {
|
|
|
1536
1645
|
}
|
|
1537
1646
|
|
|
1538
1647
|
|
|
1648
|
+
// ===== task-item.prisma =====
|
|
1649
|
+
model TaskItem {
|
|
1650
|
+
id String @id @default(dbgenerated("generate_prefixed_cuid('tski'::text)"))
|
|
1651
|
+
title String
|
|
1652
|
+
description String?
|
|
1653
|
+
status TaskItemStatus @default(todo)
|
|
1654
|
+
priority TaskItemPriority @default(medium)
|
|
1655
|
+
|
|
1656
|
+
// Polymorphic relation (like Comment and Attachment)
|
|
1657
|
+
entityId String
|
|
1658
|
+
entityType TaskItemEntityType
|
|
1659
|
+
|
|
1660
|
+
// Assignment (nullable)
|
|
1661
|
+
assigneeId String?
|
|
1662
|
+
assignee Member? @relation("TaskItemAssignee", fields: [assigneeId], references: [id], onDelete: SetNull)
|
|
1663
|
+
|
|
1664
|
+
// Creator & Updater
|
|
1665
|
+
createdById String
|
|
1666
|
+
createdBy Member @relation("TaskItemCreator", fields: [createdById], references: [id])
|
|
1667
|
+
updatedById String?
|
|
1668
|
+
updatedBy Member? @relation("TaskItemUpdater", fields: [updatedById], references: [id])
|
|
1669
|
+
|
|
1670
|
+
// Relationships
|
|
1671
|
+
organizationId String
|
|
1672
|
+
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
|
1673
|
+
|
|
1674
|
+
// Dates
|
|
1675
|
+
createdAt DateTime @default(now())
|
|
1676
|
+
updatedAt DateTime @updatedAt
|
|
1677
|
+
|
|
1678
|
+
@@index([entityId, entityType])
|
|
1679
|
+
@@index([organizationId])
|
|
1680
|
+
@@index([assigneeId])
|
|
1681
|
+
@@index([status])
|
|
1682
|
+
@@index([priority])
|
|
1683
|
+
}
|
|
1684
|
+
|
|
1685
|
+
enum TaskItemStatus {
|
|
1686
|
+
todo
|
|
1687
|
+
in_progress
|
|
1688
|
+
in_review
|
|
1689
|
+
done
|
|
1690
|
+
canceled
|
|
1691
|
+
}
|
|
1692
|
+
|
|
1693
|
+
enum TaskItemPriority {
|
|
1694
|
+
urgent
|
|
1695
|
+
high
|
|
1696
|
+
medium
|
|
1697
|
+
low
|
|
1698
|
+
}
|
|
1699
|
+
|
|
1700
|
+
enum TaskItemEntityType {
|
|
1701
|
+
vendor
|
|
1702
|
+
risk
|
|
1703
|
+
}
|
|
1704
|
+
|
|
1705
|
+
|
|
1539
1706
|
// ===== task.prisma =====
|
|
1540
1707
|
model Task {
|
|
1541
1708
|
// Metadata
|
|
@@ -1564,9 +1731,10 @@ model Task {
|
|
|
1564
1731
|
vendors Vendor[]
|
|
1565
1732
|
risks Risk[]
|
|
1566
1733
|
evidenceAutomations EvidenceAutomation[]
|
|
1734
|
+
browserAutomations BrowserAutomation[]
|
|
1567
1735
|
|
|
1568
|
-
EvidenceAutomationRun
|
|
1569
|
-
integrationCheckRuns
|
|
1736
|
+
EvidenceAutomationRun EvidenceAutomationRun[]
|
|
1737
|
+
integrationCheckRuns IntegrationCheckRun[]
|
|
1570
1738
|
}
|
|
1571
1739
|
|
|
1572
1740
|
enum TaskStatus {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trycompai/db",
|
|
3
3
|
"description": "Database package with Prisma client and schema for Comp AI",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.20",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@prisma/client": "^6.13.0",
|
|
7
7
|
"dotenv": "^16.4.5",
|
|
@@ -14,8 +14,16 @@
|
|
|
14
14
|
"typescript": "^5.9.2"
|
|
15
15
|
},
|
|
16
16
|
"exports": {
|
|
17
|
-
".":
|
|
18
|
-
|
|
17
|
+
".": {
|
|
18
|
+
"import": "./dist/index.js",
|
|
19
|
+
"types": "./src/index.ts",
|
|
20
|
+
"default": "./dist/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./postinstall": {
|
|
23
|
+
"import": "./dist/postinstall.js",
|
|
24
|
+
"types": "./src/postinstall.ts",
|
|
25
|
+
"default": "./dist/postinstall.js"
|
|
26
|
+
}
|
|
19
27
|
},
|
|
20
28
|
"bin": {
|
|
21
29
|
"comp-prisma-postinstall": "./dist/postinstall.js"
|