@danielcok17/prisma-db 1.0.1 → 1.0.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.
Files changed (43) hide show
  1. package/README.md +99 -8
  2. package/dist/index.d.ts +1 -0
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +1 -0
  5. package/dist/index.js.map +1 -1
  6. package/dist/paths.d.ts +4 -0
  7. package/dist/paths.d.ts.map +1 -0
  8. package/dist/paths.js +12 -0
  9. package/dist/paths.js.map +1 -0
  10. package/package.json +3 -3
  11. package/prisma/app.prisma +148 -72
  12. package/prisma/generated/app/edge.js +67 -11
  13. package/prisma/generated/app/index-browser.js +62 -6
  14. package/prisma/generated/app/index.d.ts +5386 -292
  15. package/prisma/generated/app/index.js +67 -11
  16. package/prisma/generated/app/libquery_engine-darwin-arm64.dylib.node +0 -0
  17. package/prisma/generated/app/package.json +2 -2
  18. package/prisma/generated/app/runtime/edge-esm.js +3 -3
  19. package/prisma/generated/app/runtime/edge.js +3 -3
  20. package/prisma/generated/app/runtime/library.d.ts +66 -92
  21. package/prisma/generated/app/runtime/library.js +21 -21
  22. package/prisma/generated/app/runtime/react-native.js +13 -13
  23. package/prisma/generated/app/runtime/wasm-compiler-edge.js +27 -27
  24. package/prisma/generated/app/runtime/wasm-engine-edge.js +13 -13
  25. package/prisma/generated/app/schema.prisma +99 -21
  26. package/prisma/generated/app/wasm.js +62 -6
  27. package/prisma/generated/law/edge.js +6 -6
  28. package/prisma/generated/law/index-browser.js +4 -4
  29. package/prisma/generated/law/index.d.ts +2 -2
  30. package/prisma/generated/law/index.js +6 -6
  31. package/prisma/generated/law/libquery_engine-darwin-arm64.dylib.node +0 -0
  32. package/prisma/generated/law/package.json +1 -1
  33. package/prisma/generated/law/runtime/edge-esm.js +3 -3
  34. package/prisma/generated/law/runtime/edge.js +3 -3
  35. package/prisma/generated/law/runtime/library.d.ts +66 -92
  36. package/prisma/generated/law/runtime/library.js +21 -21
  37. package/prisma/generated/law/runtime/react-native.js +13 -13
  38. package/prisma/generated/law/runtime/wasm-compiler-edge.js +27 -27
  39. package/prisma/generated/law/runtime/wasm-engine-edge.js +13 -13
  40. package/prisma/generated/law/wasm.js +4 -4
  41. package/prisma/migrations/20250818134929_init/migration.sql +374 -0
  42. package/prisma/migrations/20250903104817_add_workflow_log/migration.sql +103 -0
  43. package/prisma/migrations/20250817194531_/migration.sql +0 -372
@@ -57,6 +57,7 @@ model User {
57
57
  feedbacks Feedback[]
58
58
  pageViews PageView[]
59
59
  sessions Session[]
60
+ workflowLogs WorkflowLog[]
60
61
  }
61
62
 
62
63
  // Nový model pre žiadosti o schválenie
@@ -77,17 +78,20 @@ model UserApprovalRequest {
77
78
 
78
79
  // ZJEDNODUŠENÝ Conversation - len metadata, bez duplikátov
79
80
  model Conversation {
80
- id String @id @default(cuid())
81
- name String
82
- userId String
83
- isShareable Boolean @default(false)
84
- shareUrl String? @unique
85
- sharedAt DateTime?
86
- createdAt DateTime @default(now())
87
- updatedAt DateTime @updatedAt
81
+ id String @id @default(cuid())
82
+ name String
83
+ userId String
84
+ isShareable Boolean @default(false)
85
+ shareUrl String? @unique
86
+ sharedAt DateTime?
87
+ createdAt DateTime @default(now())
88
+ updatedAt DateTime @updatedAt
89
+ summary String?
90
+ messagesSinceLastSummary Int? @default(0)
88
91
  // Relácie
89
- answers Answer[]
90
- user User @relation(fields: [userId], references: [id])
92
+ answers Answer[]
93
+ user User @relation(fields: [userId], references: [id])
94
+ workflowLogs WorkflowLog[]
91
95
 
92
96
  @@index([userId])
93
97
  @@index([createdAt])
@@ -115,6 +119,7 @@ model Answer {
115
119
  feedback Feedback?
116
120
  references Reference[]
117
121
  metrics AnswerMetrics?
122
+ WorkflowLog WorkflowLog[]
118
123
 
119
124
  @@index([conversationId])
120
125
  @@index([messageId])
@@ -200,7 +205,7 @@ model Reference {
200
205
  model PageView {
201
206
  id String @id @default(cuid())
202
207
  userId String?
203
- sessionId String
208
+ sessionId String?
204
209
  page String
205
210
  path String
206
211
  referrer String?
@@ -216,7 +221,7 @@ model PageView {
216
221
  timeOnPage Int?
217
222
  isBounce Boolean @default(true)
218
223
  createdAt DateTime @default(now())
219
- session Session @relation(fields: [sessionId], references: [sessionId], onDelete: SetNull)
224
+ session Session? @relation(fields: [sessionId], references: [sessionId], onDelete: SetNull)
220
225
  user User? @relation(fields: [userId], references: [id])
221
226
 
222
227
  @@index([userId])
@@ -228,16 +233,16 @@ model PageView {
228
233
  }
229
234
 
230
235
  model Session {
231
- id String @id @default(cuid())
232
- sessionId String @unique
233
- userId String?
234
- startedAt DateTime @default(now())
235
- endedAt DateTime?
236
- duration Int?
237
- pageViews PageView[]
238
- user User? @relation(fields: [userId], references: [id])
236
+ id String @id @default(cuid())
237
+ sessionId String @unique
238
+ userId String?
239
+ startedAt DateTime @default(now())
240
+ endedAt DateTime?
241
+ duration Int?
242
+ pageViews PageView[]
243
+ user User? @relation(fields: [userId], references: [id])
244
+ workflowLogs WorkflowLog[]
239
245
 
240
- @@index([sessionId])
241
246
  @@index([userId])
242
247
  @@index([startedAt])
243
248
  }
@@ -282,3 +287,76 @@ model AdminActionLog {
282
287
  @@index([adminEmail])
283
288
  @@index([createdAt])
284
289
  }
290
+
291
+ model WorkflowLog {
292
+ id String @id @default(cuid()) // Added @default(cuid())
293
+ conversationId String
294
+ messageId String?
295
+ userId String? // Made optional to preserve logs when users are deleted
296
+ sessionId String? // Removed @unique to allow multiple workflows per session
297
+ startedAt DateTime @default(now())
298
+ completedAt DateTime?
299
+ status WorkflowStatus @default(IN_PROGRESS)
300
+ totalDuration Int? // milliseconds
301
+ error String?
302
+ metadata Json?
303
+ steps WorkflowStep[] // Renamed from WorkflowStep to steps (lowerCamel, plural)
304
+ conversation Conversation @relation(fields: [conversationId], references: [id], onDelete: Cascade)
305
+ user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
306
+ session Session? @relation(fields: [sessionId], references: [sessionId], onDelete: SetNull)
307
+ answer Answer? @relation(fields: [messageId], references: [messageId])
308
+
309
+ @@index([conversationId])
310
+ @@index([userId])
311
+ @@index([sessionId])
312
+ @@index([startedAt])
313
+ @@index([status])
314
+ @@index([conversationId, startedAt]) // Composite index for timeline queries
315
+ @@index([messageId])
316
+ }
317
+
318
+ model WorkflowStep {
319
+ id String @id @default(cuid()) // Added @default(cuid())
320
+ workflowId String
321
+ stepName String // 'classify_question', 'rag_search', 'ai_processing', 'generate_response'
322
+ stepType StepType
323
+ startedAt DateTime @default(now())
324
+ completedAt DateTime?
325
+ duration Int? // milliseconds
326
+ status StepStatus @default(IN_PROGRESS)
327
+ inputData Json? // Sanitized input data
328
+ outputData Json? // Sanitized output data
329
+ error String?
330
+ metadata Json? // Provider used, model used, tokens, costs, etc.
331
+ workflow WorkflowLog @relation(fields: [workflowId], references: [id], onDelete: Cascade)
332
+
333
+ @@index([workflowId])
334
+ @@index([stepName])
335
+ @@index([stepType])
336
+ @@index([startedAt])
337
+ @@index([status])
338
+ @@index([workflowId, startedAt]) // Composite index for timeline queries
339
+ }
340
+
341
+ enum WorkflowStatus {
342
+ IN_PROGRESS
343
+ COMPLETED
344
+ FAILED
345
+ CANCELLED
346
+ }
347
+
348
+ enum StepStatus {
349
+ IN_PROGRESS
350
+ COMPLETED
351
+ FAILED
352
+ SKIPPED
353
+ }
354
+
355
+ enum StepType {
356
+ CLASSIFICATION
357
+ RAG_RETRIEVAL
358
+ AI_PROCESSING
359
+ RESPONSE_GENERATION
360
+ DATA_PERSISTENCE
361
+ ERROR_HANDLING
362
+ }
@@ -20,12 +20,12 @@ exports.Prisma = Prisma
20
20
  exports.$Enums = {}
21
21
 
22
22
  /**
23
- * Prisma Client JS version: 6.14.0
24
- * Query Engine version: 717184b7b35ea05dfa71a3236b7af656013e1e49
23
+ * Prisma Client JS version: 6.15.0
24
+ * Query Engine version: 85179d7826409ee107a6ba334b5e305ae3fba9fb
25
25
  */
26
26
  Prisma.prismaVersion = {
27
- client: "6.14.0",
28
- engine: "717184b7b35ea05dfa71a3236b7af656013e1e49"
27
+ client: "6.15.0",
28
+ engine: "85179d7826409ee107a6ba334b5e305ae3fba9fb"
29
29
  }
30
30
 
31
31
  Prisma.PrismaClientKnownRequestError = () => {
@@ -176,7 +176,9 @@ exports.Prisma.ConversationScalarFieldEnum = {
176
176
  shareUrl: 'shareUrl',
177
177
  sharedAt: 'sharedAt',
178
178
  createdAt: 'createdAt',
179
- updatedAt: 'updatedAt'
179
+ updatedAt: 'updatedAt',
180
+ summary: 'summary',
181
+ messagesSinceLastSummary: 'messagesSinceLastSummary'
180
182
  };
181
183
 
182
184
  exports.Prisma.AnswerScalarFieldEnum = {
@@ -280,6 +282,35 @@ exports.Prisma.AdminActionLogScalarFieldEnum = {
280
282
  createdAt: 'createdAt'
281
283
  };
282
284
 
285
+ exports.Prisma.WorkflowLogScalarFieldEnum = {
286
+ id: 'id',
287
+ conversationId: 'conversationId',
288
+ messageId: 'messageId',
289
+ userId: 'userId',
290
+ sessionId: 'sessionId',
291
+ startedAt: 'startedAt',
292
+ completedAt: 'completedAt',
293
+ status: 'status',
294
+ totalDuration: 'totalDuration',
295
+ error: 'error',
296
+ metadata: 'metadata'
297
+ };
298
+
299
+ exports.Prisma.WorkflowStepScalarFieldEnum = {
300
+ id: 'id',
301
+ workflowId: 'workflowId',
302
+ stepName: 'stepName',
303
+ stepType: 'stepType',
304
+ startedAt: 'startedAt',
305
+ completedAt: 'completedAt',
306
+ duration: 'duration',
307
+ status: 'status',
308
+ inputData: 'inputData',
309
+ outputData: 'outputData',
310
+ error: 'error',
311
+ metadata: 'metadata'
312
+ };
313
+
283
314
  exports.Prisma.SortOrder = {
284
315
  asc: 'asc',
285
316
  desc: 'desc'
@@ -331,6 +362,29 @@ exports.ReferenceType = exports.$Enums.ReferenceType = {
331
362
  OTHER: 'OTHER'
332
363
  };
333
364
 
365
+ exports.WorkflowStatus = exports.$Enums.WorkflowStatus = {
366
+ IN_PROGRESS: 'IN_PROGRESS',
367
+ COMPLETED: 'COMPLETED',
368
+ FAILED: 'FAILED',
369
+ CANCELLED: 'CANCELLED'
370
+ };
371
+
372
+ exports.StepType = exports.$Enums.StepType = {
373
+ CLASSIFICATION: 'CLASSIFICATION',
374
+ RAG_RETRIEVAL: 'RAG_RETRIEVAL',
375
+ AI_PROCESSING: 'AI_PROCESSING',
376
+ RESPONSE_GENERATION: 'RESPONSE_GENERATION',
377
+ DATA_PERSISTENCE: 'DATA_PERSISTENCE',
378
+ ERROR_HANDLING: 'ERROR_HANDLING'
379
+ };
380
+
381
+ exports.StepStatus = exports.$Enums.StepStatus = {
382
+ IN_PROGRESS: 'IN_PROGRESS',
383
+ COMPLETED: 'COMPLETED',
384
+ FAILED: 'FAILED',
385
+ SKIPPED: 'SKIPPED'
386
+ };
387
+
334
388
  exports.Prisma.ModelName = {
335
389
  Account: 'Account',
336
390
  User: 'User',
@@ -342,7 +396,9 @@ exports.Prisma.ModelName = {
342
396
  Reference: 'Reference',
343
397
  PageView: 'PageView',
344
398
  Session: 'Session',
345
- AdminActionLog: 'AdminActionLog'
399
+ AdminActionLog: 'AdminActionLog',
400
+ WorkflowLog: 'WorkflowLog',
401
+ WorkflowStep: 'WorkflowStep'
346
402
  };
347
403
 
348
404
  /**
@@ -35,12 +35,12 @@ exports.Prisma = Prisma
35
35
  exports.$Enums = {}
36
36
 
37
37
  /**
38
- * Prisma Client JS version: 6.14.0
39
- * Query Engine version: 717184b7b35ea05dfa71a3236b7af656013e1e49
38
+ * Prisma Client JS version: 6.15.0
39
+ * Query Engine version: 85179d7826409ee107a6ba334b5e305ae3fba9fb
40
40
  */
41
41
  Prisma.prismaVersion = {
42
- client: "6.14.0",
43
- engine: "717184b7b35ea05dfa71a3236b7af656013e1e49"
42
+ client: "6.15.0",
43
+ engine: "85179d7826409ee107a6ba334b5e305ae3fba9fb"
44
44
  }
45
45
 
46
46
  Prisma.PrismaClientKnownRequestError = PrismaClientKnownRequestError;
@@ -209,8 +209,8 @@ const config = {
209
209
  "schemaEnvPath": "../../../.env"
210
210
  },
211
211
  "relativePath": "../..",
212
- "clientVersion": "6.14.0",
213
- "engineVersion": "717184b7b35ea05dfa71a3236b7af656013e1e49",
212
+ "clientVersion": "6.15.0",
213
+ "engineVersion": "85179d7826409ee107a6ba334b5e305ae3fba9fb",
214
214
  "datasourceNames": [
215
215
  "db"
216
216
  ],
@@ -20,12 +20,12 @@ exports.Prisma = Prisma
20
20
  exports.$Enums = {}
21
21
 
22
22
  /**
23
- * Prisma Client JS version: 6.14.0
24
- * Query Engine version: 717184b7b35ea05dfa71a3236b7af656013e1e49
23
+ * Prisma Client JS version: 6.15.0
24
+ * Query Engine version: 85179d7826409ee107a6ba334b5e305ae3fba9fb
25
25
  */
26
26
  Prisma.prismaVersion = {
27
- client: "6.14.0",
28
- engine: "717184b7b35ea05dfa71a3236b7af656013e1e49"
27
+ client: "6.15.0",
28
+ engine: "85179d7826409ee107a6ba334b5e305ae3fba9fb"
29
29
  }
30
30
 
31
31
  Prisma.PrismaClientKnownRequestError = () => {
@@ -234,8 +234,8 @@ export namespace Prisma {
234
234
  export import Exact = $Public.Exact
235
235
 
236
236
  /**
237
- * Prisma Client JS version: 6.14.0
238
- * Query Engine version: 717184b7b35ea05dfa71a3236b7af656013e1e49
237
+ * Prisma Client JS version: 6.15.0
238
+ * Query Engine version: 85179d7826409ee107a6ba334b5e305ae3fba9fb
239
239
  */
240
240
  export type PrismaVersion = {
241
241
  client: string
@@ -35,12 +35,12 @@ exports.Prisma = Prisma
35
35
  exports.$Enums = {}
36
36
 
37
37
  /**
38
- * Prisma Client JS version: 6.14.0
39
- * Query Engine version: 717184b7b35ea05dfa71a3236b7af656013e1e49
38
+ * Prisma Client JS version: 6.15.0
39
+ * Query Engine version: 85179d7826409ee107a6ba334b5e305ae3fba9fb
40
40
  */
41
41
  Prisma.prismaVersion = {
42
- client: "6.14.0",
43
- engine: "717184b7b35ea05dfa71a3236b7af656013e1e49"
42
+ client: "6.15.0",
43
+ engine: "85179d7826409ee107a6ba334b5e305ae3fba9fb"
44
44
  }
45
45
 
46
46
  Prisma.PrismaClientKnownRequestError = PrismaClientKnownRequestError;
@@ -210,8 +210,8 @@ const config = {
210
210
  "schemaEnvPath": "../../../.env"
211
211
  },
212
212
  "relativePath": "../..",
213
- "clientVersion": "6.14.0",
214
- "engineVersion": "717184b7b35ea05dfa71a3236b7af656013e1e49",
213
+ "clientVersion": "6.15.0",
214
+ "engineVersion": "85179d7826409ee107a6ba334b5e305ae3fba9fb",
215
215
  "datasourceNames": [
216
216
  "db"
217
217
  ],
@@ -145,6 +145,6 @@
145
145
  },
146
146
  "./*": "./*"
147
147
  },
148
- "version": "6.14.0",
148
+ "version": "6.15.0",
149
149
  "sideEffects": false
150
150
  }