@derwinjs/db 0.8.0 → 0.10.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 (40) hide show
  1. package/dist/auto-promotion-evaluator.d.ts +63 -0
  2. package/dist/auto-promotion-evaluator.d.ts.map +1 -0
  3. package/dist/auto-promotion-evaluator.js +195 -0
  4. package/dist/auto-promotion-evaluator.js.map +1 -0
  5. package/dist/contract-baseline-store.d.ts +21 -0
  6. package/dist/contract-baseline-store.d.ts.map +1 -0
  7. package/dist/contract-baseline-store.js +103 -0
  8. package/dist/contract-baseline-store.js.map +1 -0
  9. package/dist/index.d.ts +5 -0
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +5 -0
  12. package/dist/index.js.map +1 -1
  13. package/dist/project-mode-store.d.ts +28 -0
  14. package/dist/project-mode-store.d.ts.map +1 -0
  15. package/dist/project-mode-store.js +126 -0
  16. package/dist/project-mode-store.js.map +1 -0
  17. package/dist/scripts/smoke-auto-fix.js +1 -1
  18. package/dist/scripts/smoke-auto-fix.js.map +1 -1
  19. package/dist/tenant-fuzz-config-store.d.ts +28 -0
  20. package/dist/tenant-fuzz-config-store.d.ts.map +1 -0
  21. package/dist/tenant-fuzz-config-store.js +173 -0
  22. package/dist/tenant-fuzz-config-store.js.map +1 -0
  23. package/dist/visual-baseline-store.d.ts +21 -0
  24. package/dist/visual-baseline-store.d.ts.map +1 -0
  25. package/dist/visual-baseline-store.js +87 -0
  26. package/dist/visual-baseline-store.js.map +1 -0
  27. package/package.json +3 -3
  28. package/prisma/migrations/20260501165631_init/migration.sql +407 -0
  29. package/prisma/migrations/20260503051425_0002_qap018b_qaticket_crosslink_fields/migration.sql +6 -0
  30. package/prisma/migrations/20260507130000_sprint10_visual_baselines/migration.sql +27 -0
  31. package/prisma/migrations/20260507130100_sprint10_phase3_contract_baselines/migration.sql +32 -0
  32. package/prisma/migrations/20260507130200_sprint10_phase4_tenant_fuzz/migration.sql +34 -0
  33. package/prisma/schema.prisma +107 -0
  34. package/prisma-client/edge.js +36 -4
  35. package/prisma-client/index-browser.js +33 -1
  36. package/prisma-client/index.d.ts +15602 -10678
  37. package/prisma-client/index.js +36 -4
  38. package/prisma-client/package.json +1 -1
  39. package/prisma-client/schema.prisma +107 -0
  40. package/prisma-client/wasm.js +33 -1
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "prisma-client-80d22168424dade7c0d713042f02aefb7e5dd12207a0e4feb91cb2584021f57a",
2
+ "name": "prisma-client-deda071698db4a99242c121e3538d4b7fb3a521480d46d881f9efc884cebfc6f",
3
3
  "main": "index.js",
4
4
  "types": "index.d.ts",
5
5
  "browser": "index-browser.js",
@@ -148,6 +148,9 @@ model Project {
148
148
  classificationOverrides ClassificationOverride[]
149
149
  freezeWindows FreezeWindow[]
150
150
  killSwitches KillSwitchState[]
151
+ visualBaselines VisualBaseline[]
152
+ contractBaselines ContractBaseline[]
153
+ tenantFuzzConfig TenantFuzzConfig?
151
154
 
152
155
  @@map("projects")
153
156
  @@schema("derwin")
@@ -982,3 +985,107 @@ enum QAUniformityStatus {
982
985
 
983
986
  @@schema("derwin")
984
987
  }
988
+
989
+ // ═══════════════════════════════════════════════════════════════════════════
990
+ // QAP-105 (Sprint 10 Phase 2) — Visual baselines (pixel-diff regression)
991
+ // ═══════════════════════════════════════════════════════════════════════════
992
+ //
993
+ // Stores the durable baseline screenshot bytes that VisualRegressionScanner
994
+ // pixel-diffs against on subsequent runs. One row per (projectId, scopeKey)
995
+ // — operator approves a new baseline by replacing the bytes via
996
+ // VisualBaselineStore.setBaseline. The Prisma-backed implementation lives
997
+ // at packages/db/src/visual-baseline-store.ts; the SDK contract is in
998
+ // @derwinjs/sdk (VisualBaselineStore in
999
+ // packages/sdk/src/types/visual-regression-scanner.ts).
1000
+ //
1001
+ // Stored as Postgres BYTEA so a small to mid-sized PNG fits inline. Rows
1002
+ // large enough to push past Postgres TOAST threshold get TOAST'd
1003
+ // transparently — no special handling required at this layer.
1004
+
1005
+ model VisualBaseline {
1006
+ id String @id @default(cuid())
1007
+ projectId String
1008
+ scopeKey String
1009
+ bytes Bytes
1010
+ createdAt DateTime @default(now())
1011
+ updatedAt DateTime @updatedAt
1012
+
1013
+ project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
1014
+
1015
+ @@unique([projectId, scopeKey])
1016
+ @@map("visual_baselines")
1017
+ @@schema("derwin")
1018
+ }
1019
+
1020
+ // ═══════════════════════════════════════════════════════════════════════════
1021
+ // QAP-103 (Sprint 10 Phase 3) — Contract baselines (API contract diff)
1022
+ // ═══════════════════════════════════════════════════════════════════════════
1023
+ //
1024
+ // Stores the durable baseline OpenAPI / JSON-schema spec text that
1025
+ // ContractDiffer diffs candidates against on subsequent runs. One row per
1026
+ // (projectId, specKey) — operator approves a new baseline by replacing the
1027
+ // spec via ContractBaselineStore.setBaseline. Multiple specKeys are
1028
+ // allowed per project ('main-api', 'webhook-payloads', etc.).
1029
+ //
1030
+ // The Prisma-backed implementation lives at
1031
+ // packages/db/src/contract-baseline-store.ts; the SDK contract is in
1032
+ // @derwinjs/sdk (ContractBaselineStore in
1033
+ // packages/sdk/src/types/contract-baseline-store.ts).
1034
+ //
1035
+ // `format` is held as a String so adding new formats (proto, GraphQL SDL)
1036
+ // later does not require a migration. The factory validates the value
1037
+ // against the SDK union ('openapi' | 'json-schema') at runtime.
1038
+
1039
+ model ContractBaseline {
1040
+ id String @id @default(cuid())
1041
+ projectId String
1042
+ specKey String
1043
+ spec String @db.Text
1044
+ format String // 'openapi' | 'json-schema' — runtime-validated
1045
+ capturedAt DateTime @default(now())
1046
+ capturedBy String
1047
+
1048
+ project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
1049
+
1050
+ @@unique([projectId, specKey])
1051
+ @@index([projectId, capturedAt(sort: Desc)])
1052
+ @@map("contract_baselines")
1053
+ @@schema("derwin")
1054
+ }
1055
+
1056
+ // ═══════════════════════════════════════════════════════════════════════════
1057
+ // QAP-104 (Sprint 10 Phase 4) — Tenant-isolation fuzz config
1058
+ // ═══════════════════════════════════════════════════════════════════════════
1059
+ //
1060
+ // Stores the operator-curated fuzz configuration that drives the
1061
+ // cross-tenant probing fuzzer (TenantFuzz). One row per project
1062
+ // (@unique projectId) — the fuzzer reads consentToFuzz, tenantSafeRoutes
1063
+ // and probePairs at run time. The store-side gate prevents probePairs
1064
+ // from being persisted unless consentToFuzz=true; the fuzzer itself
1065
+ // re-checks consent for defense-in-depth against stale config objects.
1066
+ //
1067
+ // The Prisma-backed implementation lives at
1068
+ // packages/db/src/tenant-fuzz-config-store.ts; the SDK contract is in
1069
+ // @derwinjs/sdk (TenantFuzzConfigStore in
1070
+ // packages/sdk/src/types/tenant-fuzz-config.ts).
1071
+ //
1072
+ // `tenantSafeRoutes` and `probePairs` are JSON columns — the route shape
1073
+ // (method/path/body templates) and pair shape (token/resourceId/label)
1074
+ // are runtime-validated at the SDK boundary on every read/write rather
1075
+ // than carved into the schema. This keeps the schema simple and lets new
1076
+ // optional fields land without migrations.
1077
+
1078
+ model TenantFuzzConfig {
1079
+ id String @id @default(cuid())
1080
+ projectId String @unique
1081
+ consentToFuzz Boolean @default(false)
1082
+ tenantSafeRoutes Json // TenantFuzzRoute[]
1083
+ probePairs Json // TenantFuzzPair[]
1084
+ updatedAt DateTime @updatedAt
1085
+ updatedBy String
1086
+
1087
+ project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
1088
+
1089
+ @@map("tenant_fuzz_configs")
1090
+ @@schema("derwin")
1091
+ }
@@ -450,6 +450,35 @@ exports.Prisma.QAUniformityScalarFieldEnum = {
450
450
  createdAt: 'createdAt'
451
451
  };
452
452
 
453
+ exports.Prisma.VisualBaselineScalarFieldEnum = {
454
+ id: 'id',
455
+ projectId: 'projectId',
456
+ scopeKey: 'scopeKey',
457
+ bytes: 'bytes',
458
+ createdAt: 'createdAt',
459
+ updatedAt: 'updatedAt'
460
+ };
461
+
462
+ exports.Prisma.ContractBaselineScalarFieldEnum = {
463
+ id: 'id',
464
+ projectId: 'projectId',
465
+ specKey: 'specKey',
466
+ spec: 'spec',
467
+ format: 'format',
468
+ capturedAt: 'capturedAt',
469
+ capturedBy: 'capturedBy'
470
+ };
471
+
472
+ exports.Prisma.TenantFuzzConfigScalarFieldEnum = {
473
+ id: 'id',
474
+ projectId: 'projectId',
475
+ consentToFuzz: 'consentToFuzz',
476
+ tenantSafeRoutes: 'tenantSafeRoutes',
477
+ probePairs: 'probePairs',
478
+ updatedAt: 'updatedAt',
479
+ updatedBy: 'updatedBy'
480
+ };
481
+
453
482
  exports.Prisma.SortOrder = {
454
483
  asc: 'asc',
455
484
  desc: 'desc'
@@ -658,7 +687,10 @@ exports.Prisma.ModelName = {
658
687
  SpendLedger: 'SpendLedger',
659
688
  QAPattern: 'QAPattern',
660
689
  QARevert: 'QARevert',
661
- QAUniformity: 'QAUniformity'
690
+ QAUniformity: 'QAUniformity',
691
+ VisualBaseline: 'VisualBaseline',
692
+ ContractBaseline: 'ContractBaseline',
693
+ TenantFuzzConfig: 'TenantFuzzConfig'
662
694
  };
663
695
 
664
696
  /**