@varaos/db 1.4.1 → 1.4.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@varaos/db",
3
- "version": "1.4.1",
3
+ "version": "1.4.3",
4
4
  "private": false,
5
5
  "main": "index.js",
6
6
  "files": [
@@ -0,0 +1,30 @@
1
+ -- AlterEnum
2
+ -- Not adding an enum since Prisma didn't complain about it, assuming 'TriggerType' already exists in DB.
3
+
4
+ -- AlterTable
5
+ ALTER TABLE "DocumentChunk" ADD COLUMN "embedding" vector(768);
6
+
7
+ -- AlterTable
8
+ ALTER TABLE "Memory" ADD COLUMN "embedding" vector(768);
9
+
10
+ -- CreateIndex
11
+ CREATE INDEX IF NOT EXISTS "Memory_embedding_idx" ON "Memory" USING ivfflat ("embedding" vector_cosine_ops) WITH (lists = 100);
12
+
13
+ -- CreateIndex
14
+ CREATE INDEX IF NOT EXISTS "DocumentChunk_embedding_idx" ON "DocumentChunk" USING ivfflat ("embedding" vector_cosine_ops) WITH (lists = 100);
15
+
16
+ -- AlterTable
17
+ ALTER TABLE "Workflow" ADD COLUMN "templateId" TEXT;
18
+ ALTER TABLE "Workflow" ADD COLUMN "tokensPerRun" INTEGER NOT NULL DEFAULT 10;
19
+
20
+ -- AlterTable
21
+ ALTER TABLE "WorkflowTemplate" ADD COLUMN "requiredInputs" JSONB;
22
+ ALTER TABLE "WorkflowTemplate" ADD COLUMN "requiredIntegrations" TEXT[] DEFAULT ARRAY[]::TEXT[];
23
+ ALTER TABLE "WorkflowTemplate" ADD COLUMN "runTokenCost" INTEGER NOT NULL DEFAULT 10;
24
+ ALTER TABLE "WorkflowTemplate" ADD COLUMN "setupTokenCost" INTEGER NOT NULL DEFAULT 0;
25
+ ALTER TABLE "WorkflowTemplate" ADD COLUMN "spec" JSONB;
26
+ ALTER TABLE "WorkflowTemplate" ADD COLUMN "triggerConfig" JSONB;
27
+ ALTER TABLE "WorkflowTemplate" ADD COLUMN "triggerType" "TriggerType";
28
+
29
+ -- AddForeignKey
30
+ ALTER TABLE "Workflow" ADD CONSTRAINT "Workflow_templateId_fkey" FOREIGN KEY ("templateId") REFERENCES "WorkflowTemplate"("id") ON DELETE SET NULL ON UPDATE CASCADE;
@@ -0,0 +1,6 @@
1
+ -- AddFields to Onboarding table
2
+ ALTER TABLE "Onboarding" ADD COLUMN "quizAnswers" JSONB DEFAULT '{}',
3
+ ADD COLUMN "selectedAutomations" TEXT[] DEFAULT ARRAY[]::TEXT[],
4
+ ADD COLUMN "workspaceName" TEXT,
5
+ ADD COLUMN "workspaceNameValid" BOOLEAN NOT NULL DEFAULT false,
6
+ ADD COLUMN "workspaceNameError" TEXT;
@@ -666,6 +666,13 @@ model Workflow {
666
666
  /// Includes: trigger, conditions, actions, etc.
667
667
  spec Json?
668
668
 
669
+ /// Link to the template this was instantiated from (if any)
670
+ templateId String?
671
+ template WorkflowTemplate? @relation(fields: [templateId], references: [id])
672
+
673
+ /// Track cost to execute
674
+ tokensPerRun Int @default(10) // Copied from template.runTokenCost
675
+
669
676
  /// How this workflow is triggered
670
677
  triggerType TriggerType?
671
678
 
@@ -867,6 +874,11 @@ model Memory {
867
874
  /// Soft delete
868
875
  active Boolean @default(true)
869
876
 
877
+ /// Gemini text-embedding-004 vector (768 dims) for semantic search
878
+ /// Apply via raw SQL: ALTER TABLE "Memory" ADD COLUMN embedding vector(768);
879
+ /// CREATE INDEX ON "Memory" USING ivfflat (embedding vector_cosine_ops) WITH (lists = 100);
880
+ embedding Unsupported("vector(768)")?
881
+
870
882
  metadata Json?
871
883
 
872
884
  createdAt DateTime @default(now())
@@ -969,15 +981,17 @@ model DocumentChunk {
969
981
  sectionTitle String?
970
982
  pageNumber Int?
971
983
 
984
+ /// Gemini text-embedding-004 vector (768 dims) for semantic search
985
+ /// Apply via raw SQL: ALTER TABLE "DocumentChunk" ADD COLUMN embedding vector(768);
986
+ /// CREATE INDEX ON "DocumentChunk" USING ivfflat (embedding vector_cosine_ops) WITH (lists = 100);
987
+ embedding Unsupported("vector(768)")?
988
+
972
989
  metadata Json?
973
990
 
974
991
  createdAt DateTime @default(now())
975
992
 
976
993
  document Document @relation(fields: [documentId], references: [id], onDelete: Cascade)
977
994
 
978
- /// Note: Vector index needs to be added via raw SQL:
979
- /// CREATE INDEX ON "DocumentChunk" USING ivfflat (embedding vector_cosine_ops)
980
-
981
995
  @@index([documentId, chunkIndex])
982
996
  }
983
997
 
@@ -1108,10 +1122,29 @@ model WorkflowTemplate {
1108
1122
  estimatedSetupTime Int?
1109
1123
  status Status @default(active)
1110
1124
 
1125
+ /// The blueprint workflow configuration in JSON format (maps to Workflow.spec)
1126
+ spec Json?
1127
+
1128
+ /// How this template is triggered
1129
+ triggerType TriggerType?
1130
+ triggerConfig Json?
1131
+
1132
+ /// Integrations required (e.g., ["gmail", "slack"])
1133
+ requiredIntegrations String[] @default([])
1134
+
1135
+ /// Inputs the UI needs to gather from the user before instantiation
1136
+ /// e.g. [{"key": "slack_channel", "type": "string", "label": "Slack Channel"}]
1137
+ requiredInputs Json?
1138
+
1139
+ /// Token costs shown in the UI
1140
+ setupTokenCost Int @default(0) // Tokens deducted when copying template
1141
+ runTokenCost Int @default(10) // Expected tokens per run or per step
1142
+
1111
1143
  createdAt DateTime @default(now())
1112
1144
  updatedAt DateTime @updatedAt
1113
1145
 
1114
1146
  steps WorkflowStepTemplate[]
1147
+ workflows Workflow[]
1115
1148
  }
1116
1149
 
1117
1150
  model WorkflowStepTemplate {
@@ -1539,12 +1572,17 @@ model Job {
1539
1572
  }
1540
1573
 
1541
1574
  model Onboarding {
1542
- id String @id @default(uuid())
1543
- userId String @unique
1544
- persona String?
1545
- setupType String?
1546
- progress Json?
1547
- completed Boolean @default(false)
1575
+ id String @id @default(uuid())
1576
+ userId String @unique
1577
+ persona String?
1578
+ setupType String?
1579
+ quizAnswers Json? @default("{}")
1580
+ selectedAutomations String[] @default([])
1581
+ workspaceName String?
1582
+ workspaceNameValid Boolean @default(false)
1583
+ workspaceNameError String?
1584
+ progress Json?
1585
+ completed Boolean @default(false)
1548
1586
 
1549
1587
  createdAt DateTime @default(now())
1550
1588
  updatedAt DateTime @updatedAt