@varaos/db 1.0.4 → 1.1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@varaos/db",
3
- "version": "1.0.4",
3
+ "version": "1.1.0",
4
4
  "private": false,
5
5
  "main": "index.js",
6
6
  "files": [
@@ -0,0 +1,74 @@
1
+ -- AlterTable
2
+ ALTER TABLE "public"."integration_catalog" ADD COLUMN "category" TEXT,
3
+ ADD COLUMN "oauthType" TEXT,
4
+ ADD COLUMN "premium" BOOLEAN NOT NULL DEFAULT false,
5
+ ADD COLUMN "setupInstructions" JSONB;
6
+
7
+ -- CreateTable
8
+ CREATE TABLE "public"."Onboarding" (
9
+ "id" TEXT NOT NULL,
10
+ "userId" TEXT NOT NULL,
11
+ "persona" TEXT,
12
+ "setupType" TEXT,
13
+ "progress" JSONB,
14
+ "completed" BOOLEAN NOT NULL DEFAULT false,
15
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
16
+ "updatedAt" TIMESTAMP(3) NOT NULL,
17
+
18
+ CONSTRAINT "Onboarding_pkey" PRIMARY KEY ("id")
19
+ );
20
+
21
+ -- CreateTable
22
+ CREATE TABLE "public"."WorkflowTemplate" (
23
+ "id" TEXT NOT NULL,
24
+ "name" TEXT NOT NULL,
25
+ "description" TEXT,
26
+ "category" TEXT,
27
+ "recommended" BOOLEAN NOT NULL DEFAULT false,
28
+ "iconUrl" TEXT,
29
+ "estimatedSetupTime" INTEGER,
30
+ "status" "public"."Status" NOT NULL DEFAULT 'active',
31
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
32
+ "updatedAt" TIMESTAMP(3) NOT NULL,
33
+
34
+ CONSTRAINT "WorkflowTemplate_pkey" PRIMARY KEY ("id")
35
+ );
36
+
37
+ -- CreateTable
38
+ CREATE TABLE "public"."WorkflowStepTemplate" (
39
+ "id" TEXT NOT NULL,
40
+ "templateId" TEXT NOT NULL,
41
+ "type" TEXT NOT NULL,
42
+ "config" JSONB NOT NULL,
43
+ "order" INTEGER NOT NULL,
44
+ "status" TEXT NOT NULL DEFAULT 'active',
45
+
46
+ CONSTRAINT "WorkflowStepTemplate_pkey" PRIMARY KEY ("id")
47
+ );
48
+
49
+ -- CreateTable
50
+ CREATE TABLE "public"."OnboardingPersona" (
51
+ "id" TEXT NOT NULL,
52
+ "key" TEXT NOT NULL,
53
+ "title" TEXT NOT NULL,
54
+ "description" TEXT,
55
+ "iconUrl" TEXT,
56
+ "recommended" BOOLEAN NOT NULL DEFAULT false,
57
+ "status" "public"."Status" NOT NULL DEFAULT 'active',
58
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
59
+ "updatedAt" TIMESTAMP(3) NOT NULL,
60
+
61
+ CONSTRAINT "OnboardingPersona_pkey" PRIMARY KEY ("id")
62
+ );
63
+
64
+ -- CreateIndex
65
+ CREATE UNIQUE INDEX "Onboarding_userId_key" ON "public"."Onboarding"("userId");
66
+
67
+ -- CreateIndex
68
+ CREATE UNIQUE INDEX "OnboardingPersona_key_key" ON "public"."OnboardingPersona"("key");
69
+
70
+ -- AddForeignKey
71
+ ALTER TABLE "public"."Onboarding" ADD CONSTRAINT "Onboarding_userId_fkey" FOREIGN KEY ("userId") REFERENCES "public"."User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
72
+
73
+ -- AddForeignKey
74
+ ALTER TABLE "public"."WorkflowStepTemplate" ADD CONSTRAINT "WorkflowStepTemplate_templateId_fkey" FOREIGN KEY ("templateId") REFERENCES "public"."WorkflowTemplate"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
@@ -97,6 +97,7 @@ model User {
97
97
  deletedAt DateTime?
98
98
  Workflow Workflow[]
99
99
  Notification Notification[]
100
+ Onboarding Onboarding?
100
101
  }
101
102
 
102
103
  /// OAuth or other third-party accounts linked to user
@@ -172,16 +173,20 @@ model Integration {
172
173
 
173
174
  /// Master list of officially supported integrations/tools
174
175
  model IntegrationCatalog {
175
- id String @id @default(uuid())
176
- provider String
177
- integration String
176
+ id String @id @default(uuid())
177
+ provider String // e.g. google, slack
178
+ integration String // e.g. gmail, drive, sheets
178
179
  name String
179
- showDuringOnboarding Boolean @default(true)
180
- default Boolean @default(false)
180
+ category String? // e.g. "communication", "storage"
181
+ showDuringOnboarding Boolean @default(true)
182
+ default Boolean @default(false)
183
+ premium Boolean @default(false) // requires paid plan
181
184
  iconUrl String?
182
185
  description String?
183
186
  docsUrl String?
184
- status Status @default(active)
187
+ oauthType String? // "oauth2", "api_key", "none"
188
+ setupInstructions Json? // flexible storage for config steps
189
+ status Status @default(active)
185
190
 
186
191
  createdAt DateTime @default(now())
187
192
  updatedAt DateTime @updatedAt
@@ -190,6 +195,7 @@ model IntegrationCatalog {
190
195
  @@map("integration_catalog")
191
196
  }
192
197
 
198
+
193
199
  /// Log of sync activity for integrations
194
200
  model IntegrationSyncLog {
195
201
  id String @id @default(uuid())
@@ -372,3 +378,63 @@ model Notification {
372
378
 
373
379
  user User? @relation(fields: [userId], references: [id])
374
380
  }
381
+
382
+ /// Tracks user onboarding flow & preferences
383
+ model Onboarding {
384
+ id String @id @default(uuid())
385
+ userId String @unique
386
+ persona String? // startup_founder, freelancer, etc.
387
+ setupType String? // quick_start_template | build_from_scratch
388
+ progress Json? // flexible: store answers, intermediate selections
389
+ completed Boolean @default(false)
390
+
391
+ createdAt DateTime @default(now())
392
+ updatedAt DateTime @updatedAt
393
+
394
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
395
+ }
396
+
397
+
398
+ /// Predefined workflow templates shown during onboarding
399
+ model WorkflowTemplate {
400
+ id String @id @default(uuid())
401
+ name String
402
+ description String?
403
+ category String? // e.g. "content_creation", "sales", "marketing"
404
+ recommended Boolean @default(false)
405
+ iconUrl String?
406
+ estimatedSetupTime Int? // minutes
407
+ status Status @default(active)
408
+
409
+ createdAt DateTime @default(now())
410
+ updatedAt DateTime @updatedAt
411
+
412
+ steps WorkflowStepTemplate[]
413
+ }
414
+
415
+ /// Template version of workflow steps
416
+ model WorkflowStepTemplate {
417
+ id String @id @default(uuid())
418
+ templateId String
419
+ type String // ai_agent, http_request, email, integration_action
420
+ config Json // inputs, defaults, etc.
421
+ order Int
422
+ status String @default("active")
423
+
424
+ template WorkflowTemplate @relation(fields: [templateId], references: [id])
425
+ }
426
+
427
+
428
+ /// Catalog of onboarding personas/roles
429
+ model OnboardingPersona {
430
+ id String @id @default(uuid())
431
+ key String @unique // e.g. "startup_founder"
432
+ title String
433
+ description String?
434
+ iconUrl String?
435
+ recommended Boolean @default(false)
436
+ status Status @default(active)
437
+
438
+ createdAt DateTime @default(now())
439
+ updatedAt DateTime @updatedAt
440
+ }