@trycompai/db 1.3.21 → 1.3.22-canary.0

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.
Files changed (2) hide show
  1. package/dist/schema.prisma +144 -3
  2. package/package.json +5 -5
@@ -71,6 +71,7 @@ model User {
71
71
  invitations Invitation[]
72
72
  members Member[]
73
73
  sessions Session[]
74
+ fleetPolicyResults FleetPolicyResult[]
74
75
 
75
76
  @@unique([email])
76
77
  }
@@ -168,6 +169,8 @@ model Member {
168
169
  createdTaskItems TaskItem[] @relation("TaskItemCreator")
169
170
  updatedTaskItems TaskItem[] @relation("TaskItemUpdater")
170
171
  assignedTaskItems TaskItem[] @relation("TaskItemAssignee")
172
+ createdFindings Finding[] @relation("FindingCreatedBy")
173
+ publishedPolicyVersions PolicyVersion[] @relation("PolicyVersionPublisher")
171
174
  }
172
175
 
173
176
  model Invitation {
@@ -476,6 +479,76 @@ model Control {
476
479
  }
477
480
 
478
481
 
482
+ // ===== finding.prisma =====
483
+ enum FindingType {
484
+ soc2
485
+ iso27001
486
+ }
487
+
488
+ enum FindingStatus {
489
+ open
490
+ ready_for_review
491
+ needs_revision
492
+ closed
493
+ }
494
+
495
+ model FindingTemplate {
496
+ id String @id @default(dbgenerated("generate_prefixed_cuid('fnd_t'::text)"))
497
+ category String // e.g., "evidence_issue", "further_evidence", "task_specific", "na_incorrect"
498
+ title String // Short title
499
+ content String // Full message template
500
+ order Int @default(0)
501
+ createdAt DateTime @default(now())
502
+ updatedAt DateTime @updatedAt
503
+
504
+ findings Finding[]
505
+ }
506
+
507
+ model Finding {
508
+ id String @id @default(dbgenerated("generate_prefixed_cuid('fnd'::text)"))
509
+ type FindingType @default(soc2)
510
+ status FindingStatus @default(open)
511
+ content String // Custom message or copied from template
512
+ revisionNote String? // Auditor's note when requesting revision
513
+
514
+ createdAt DateTime @default(now())
515
+ updatedAt DateTime @updatedAt
516
+
517
+ // Relationships
518
+ taskId String
519
+ task Task @relation(fields: [taskId], references: [id], onDelete: Cascade)
520
+ templateId String?
521
+ template FindingTemplate? @relation(fields: [templateId], references: [id])
522
+ createdById String
523
+ createdBy Member @relation("FindingCreatedBy", fields: [createdById], references: [id])
524
+ organizationId String
525
+ organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
526
+
527
+ @@index([taskId])
528
+ @@index([organizationId, status])
529
+ }
530
+
531
+
532
+ // ===== fleet-policy-result.prisma =====
533
+ model FleetPolicyResult {
534
+ id String @id @default(dbgenerated("generate_prefixed_cuid('fpr'::text)"))
535
+ userId String
536
+ organizationId String
537
+ fleetPolicyId Int
538
+ fleetPolicyName String
539
+ fleetPolicyResponse String
540
+ attachments String[] @default([])
541
+ createdAt DateTime @default(now())
542
+ updatedAt DateTime @updatedAt
543
+
544
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
545
+ organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
546
+
547
+ @@index([userId])
548
+ @@index([organizationId])
549
+ }
550
+
551
+
479
552
  // ===== framework-editor.prisma =====
480
553
  // --- Data for Framework Editor ---
481
554
  model FrameworkEditorVideo {
@@ -671,9 +744,9 @@ model IntegrationConnection {
671
744
  findings IntegrationPlatformFinding[]
672
745
  checkRuns IntegrationCheckRun[]
673
746
 
674
- @@unique([providerId, organizationId])
675
747
  @@index([organizationId])
676
748
  @@index([providerId])
749
+ @@index([providerId, organizationId])
677
750
  @@index([status])
678
751
  }
679
752
 
@@ -1146,6 +1219,7 @@ model Organization {
1146
1219
  trustNdaAgreements TrustNDAAgreement[]
1147
1220
  trustDocuments TrustDocument[]
1148
1221
  trustResources TrustResource[] @relation("OrganizationTrustResources")
1222
+ trustCustomLinks TrustCustomLink[]
1149
1223
  knowledgeBaseDocuments KnowledgeBaseDocument[]
1150
1224
  questionnaires Questionnaire[]
1151
1225
  securityQuestionnaireManualAnswers SecurityQuestionnaireManualAnswer[]
@@ -1153,13 +1227,16 @@ model Organization {
1153
1227
  primaryColor String?
1154
1228
  trustPortalFaqs Json? // Array of { question: string, answer: string, order: number }
1155
1229
 
1156
-
1157
1230
  // Integration Platform
1158
1231
  integrationConnections IntegrationConnection[]
1159
1232
  integrationOAuthApps IntegrationOAuthApp[]
1160
1233
 
1161
1234
  // Browser Automation
1162
1235
  browserbaseContext BrowserbaseContext?
1236
+ fleetPolicyResults FleetPolicyResult[]
1237
+
1238
+ // Findings
1239
+ findings Finding[]
1163
1240
 
1164
1241
  @@index([slug])
1165
1242
  }
@@ -1177,6 +1254,7 @@ model Policy {
1177
1254
  description String?
1178
1255
  status PolicyStatus @default(draft)
1179
1256
  content Json[]
1257
+ draftContent Json[] @default([])
1180
1258
  frequency Frequency?
1181
1259
  department Departments?
1182
1260
  isRequiredToSign Boolean @default(true)
@@ -1202,10 +1280,37 @@ model Policy {
1202
1280
  policyTemplateId String?
1203
1281
  policyTemplate FrameworkEditorPolicyTemplate? @relation(fields: [policyTemplateId], references: [id])
1204
1282
  controls Control[]
1283
+ currentVersionId String? @unique
1284
+ currentVersion PolicyVersion? @relation("PolicyCurrentVersion", fields: [currentVersionId], references: [id])
1285
+ pendingVersionId String?
1286
+ versions PolicyVersion[] @relation("PolicyVersions")
1205
1287
 
1206
1288
  @@index([organizationId])
1207
1289
  }
1208
1290
 
1291
+ model PolicyVersion {
1292
+ id String @id @default(dbgenerated("generate_prefixed_cuid('pv'::text)"))
1293
+ createdAt DateTime @default(now())
1294
+ updatedAt DateTime @updatedAt
1295
+
1296
+ // Relations
1297
+ policyId String
1298
+ policy Policy @relation("PolicyVersions", fields: [policyId], references: [id], onDelete: Cascade)
1299
+ currentForPolicy Policy? @relation("PolicyCurrentVersion")
1300
+
1301
+ // Version details
1302
+ version Int
1303
+ content Json[]
1304
+ pdfUrl String?
1305
+ publishedById String?
1306
+ publishedBy Member? @relation("PolicyVersionPublisher", fields: [publishedById], references: [id], onDelete: SetNull)
1307
+ changelog String?
1308
+
1309
+ @@unique([policyId, version])
1310
+ @@index([policyId])
1311
+ @@index([createdAt])
1312
+ }
1313
+
1209
1314
 
1210
1315
  // ===== questionnaire.prisma =====
1211
1316
  model Questionnaire {
@@ -1453,6 +1558,7 @@ enum AuditLogEntityType {
1453
1558
  tests
1454
1559
  integration
1455
1560
  trust
1561
+ finding
1456
1562
  }
1457
1563
 
1458
1564
  model GlobalVendors {
@@ -1742,6 +1848,7 @@ model Task {
1742
1848
 
1743
1849
  EvidenceAutomationRun EvidenceAutomationRun[]
1744
1850
  integrationCheckRuns IntegrationCheckRun[]
1851
+ findings Finding[]
1745
1852
  }
1746
1853
 
1747
1854
  enum TaskStatus {
@@ -1775,9 +1882,12 @@ model Trust {
1775
1882
  domainVerified Boolean @default(false)
1776
1883
  isVercelDomain Boolean @default(false)
1777
1884
  vercelVerification String?
1778
- status TrustStatus @default(draft)
1885
+ status TrustStatus @default(published)
1779
1886
  contactEmail String?
1780
1887
 
1888
+ /// Domains that bypass NDA signing when requesting trust portal access
1889
+ allowedDomains String[] @default([])
1890
+
1781
1891
  email String?
1782
1892
  privacyPolicy String?
1783
1893
  soc2 Boolean @default(false)
@@ -1802,6 +1912,11 @@ model Trust {
1802
1912
  pci_dss_status FrameworkStatus @default(started)
1803
1913
  iso9001_status FrameworkStatus @default(started)
1804
1914
 
1915
+ // Overview section for public trust portal
1916
+ overviewTitle String?
1917
+ overviewContent String? // Markdown content with links
1918
+ showOverview Boolean @default(false)
1919
+
1805
1920
  @@id([status, organizationId])
1806
1921
  @@unique([organizationId])
1807
1922
  @@index([organizationId])
@@ -1989,6 +2104,25 @@ model TrustDocument {
1989
2104
  @@index([organizationId, isActive])
1990
2105
  }
1991
2106
 
2107
+ model TrustCustomLink {
2108
+ id String @id @default(dbgenerated("generate_prefixed_cuid('tcl'::text)"))
2109
+
2110
+ organizationId String
2111
+ organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
2112
+
2113
+ title String
2114
+ description String?
2115
+ url String
2116
+ order Int @default(0)
2117
+ isActive Boolean @default(true)
2118
+
2119
+ createdAt DateTime @default(now())
2120
+ updatedAt DateTime @updatedAt
2121
+
2122
+ @@index([organizationId])
2123
+ @@index([organizationId, isActive, order])
2124
+ }
2125
+
1992
2126
 
1993
2127
  // ===== vendor.prisma =====
1994
2128
  model Vendor {
@@ -2002,6 +2136,13 @@ model Vendor {
2002
2136
  residualProbability Likelihood @default(very_unlikely)
2003
2137
  residualImpact Impact @default(insignificant)
2004
2138
  website String?
2139
+ isSubProcessor Boolean @default(false)
2140
+
2141
+ // Trust Portal display settings
2142
+ logoUrl String?
2143
+ showOnTrustPortal Boolean @default(false)
2144
+ trustPortalOrder Int?
2145
+ complianceBadges Json? // Array of { type: 'soc2' | 'iso27001' | etc, verified: boolean }
2005
2146
 
2006
2147
  createdAt DateTime @default(now())
2007
2148
  updatedAt DateTime @updatedAt
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@trycompai/db",
3
3
  "description": "Database package with Prisma client and schema for Comp AI",
4
- "version": "1.3.21",
4
+ "version": "1.3.22-canary.0",
5
5
  "dependencies": {
6
- "@prisma/client": "^6.13.0",
6
+ "@prisma/client": "6.18.0",
7
7
  "dotenv": "^16.4.5",
8
8
  "zod": "^4.1.12"
9
9
  },
10
10
  "devDependencies": {
11
11
  "@types/node": "^24.2.0",
12
- "prisma": "^6.13.0",
12
+ "prisma": "6.18.0",
13
13
  "ts-node": "^10.9.2",
14
14
  "typescript": "^5.9.2"
15
15
  },
@@ -42,9 +42,9 @@
42
42
  "directory": "packages/db"
43
43
  },
44
44
  "scripts": {
45
- "build": "rm -rf dist && rm -rf ./prisma/generated && prisma generate && node scripts/combine-schemas.js && tsc",
45
+ "build": "rm -rf dist && rm -rf ./prisma/generated && node scripts/combine-schemas.js && prisma generate --schema=dist/schema.prisma && tsc",
46
46
  "check-types": "tsc --noEmit",
47
- "db:generate": "prisma generate",
47
+ "db:generate": "node scripts/combine-schemas.js && prisma generate --schema=dist/schema.prisma",
48
48
  "db:migrate": "prisma migrate dev",
49
49
  "db:migrate:reset": "prisma migrate reset",
50
50
  "db:push": "prisma db push",