@apart-tech/intelligence-core 1.17.2 → 1.18.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/dist/auth/ability.d.ts +1 -1
- package/dist/auth/ability.d.ts.map +1 -1
- package/dist/auth/ability.js +4 -0
- package/dist/auth/ability.js.map +1 -1
- package/dist/auth/ability.test.js +14 -3
- package/dist/auth/ability.test.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/services/__tests__/agent-instruction-service.test.d.ts +2 -0
- package/dist/services/__tests__/agent-instruction-service.test.d.ts.map +1 -0
- package/dist/services/__tests__/agent-instruction-service.test.js +408 -0
- package/dist/services/__tests__/agent-instruction-service.test.js.map +1 -0
- package/dist/services/agent-instruction-service.d.ts +82 -0
- package/dist/services/agent-instruction-service.d.ts.map +1 -0
- package/dist/services/agent-instruction-service.js +249 -0
- package/dist/services/agent-instruction-service.js.map +1 -0
- package/dist/services/agent-run-service.d.ts +61 -0
- package/dist/services/agent-run-service.d.ts.map +1 -1
- package/dist/services/agent-run-service.js +72 -0
- package/dist/services/agent-run-service.js.map +1 -1
- package/dist/services/search-service.d.ts.map +1 -1
- package/dist/services/search-service.js +9 -4
- package/dist/services/search-service.js.map +1 -1
- package/package.json +1 -1
- package/prisma/schema.prisma +209 -162
package/prisma/schema.prisma
CHANGED
|
@@ -20,30 +20,31 @@ model Organization {
|
|
|
20
20
|
stripeSubscriptionId String? @map("stripe_subscription_id") @db.VarChar(255)
|
|
21
21
|
currentPeriodEnd DateTime? @map("current_period_end") @db.Timestamptz
|
|
22
22
|
|
|
23
|
-
nodes
|
|
24
|
-
edges
|
|
25
|
-
domains
|
|
26
|
-
apiKeys
|
|
27
|
-
workspaces
|
|
28
|
-
embeddingConfig
|
|
29
|
-
piiConfig
|
|
30
|
-
agentConfig
|
|
31
|
-
agentRuns
|
|
32
|
-
agentSchedules
|
|
33
|
-
memberships
|
|
34
|
-
invites
|
|
35
|
-
orgAgentTypes
|
|
36
|
-
orgMcpServers
|
|
37
|
-
usageRecords
|
|
38
|
-
quotaOverrides
|
|
39
|
-
onboardingPackages
|
|
40
|
-
billingEvents
|
|
41
|
-
searchMetrics
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
23
|
+
nodes Node[]
|
|
24
|
+
edges Edge[]
|
|
25
|
+
domains Domain[]
|
|
26
|
+
apiKeys ApiKey[]
|
|
27
|
+
workspaces Workspace[]
|
|
28
|
+
embeddingConfig OrgEmbeddingConfig?
|
|
29
|
+
piiConfig OrgPiiConfig?
|
|
30
|
+
agentConfig OrgAgentConfig?
|
|
31
|
+
agentRuns AgentRun[]
|
|
32
|
+
agentSchedules AgentSchedule[]
|
|
33
|
+
memberships Membership[]
|
|
34
|
+
invites Invite[]
|
|
35
|
+
orgAgentTypes OrgAgentType[]
|
|
36
|
+
orgMcpServers OrgMcpServer[]
|
|
37
|
+
usageRecords UsageRecord[]
|
|
38
|
+
quotaOverrides QuotaOverride[]
|
|
39
|
+
onboardingPackages OnboardingPackage[]
|
|
40
|
+
billingEvents BillingEvent[]
|
|
41
|
+
searchMetrics SearchMetric[]
|
|
42
|
+
agentInstructions AgentInstruction[]
|
|
43
|
+
tagDefinitions TagDefinition[]
|
|
44
|
+
nodeTags NodeTag[]
|
|
45
|
+
nodeChunks NodeChunk[]
|
|
46
|
+
piiQueryLogs PiiQueryLog[]
|
|
47
|
+
documents Document[]
|
|
47
48
|
|
|
48
49
|
@@map("organizations")
|
|
49
50
|
}
|
|
@@ -173,22 +174,22 @@ model Domain {
|
|
|
173
174
|
}
|
|
174
175
|
|
|
175
176
|
model Node {
|
|
176
|
-
id
|
|
177
|
-
type
|
|
178
|
-
title
|
|
179
|
-
content
|
|
180
|
-
embedding
|
|
181
|
-
searchVector
|
|
182
|
-
metadata
|
|
183
|
-
status
|
|
184
|
-
createdBy
|
|
185
|
-
createdAt
|
|
186
|
-
updatedAt
|
|
187
|
-
version
|
|
188
|
-
hasPii
|
|
189
|
-
embeddingPiiMode
|
|
190
|
-
domainId
|
|
191
|
-
organizationId
|
|
177
|
+
id String @id @default(uuid()) @db.Uuid
|
|
178
|
+
type String @db.VarChar(100)
|
|
179
|
+
title String @db.VarChar(500)
|
|
180
|
+
content String @default("") @db.Text
|
|
181
|
+
embedding Unsupported("vector")?
|
|
182
|
+
searchVector Unsupported("tsvector")? @map("search_vector")
|
|
183
|
+
metadata Json @default("{}")
|
|
184
|
+
status String @default("draft") @db.VarChar(20)
|
|
185
|
+
createdBy String @map("created_by") @db.VarChar(255)
|
|
186
|
+
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz
|
|
187
|
+
updatedAt DateTime @default(now()) @map("updated_at") @db.Timestamptz
|
|
188
|
+
version Int @default(1)
|
|
189
|
+
hasPii Boolean @default(false) @map("has_pii")
|
|
190
|
+
embeddingPiiMode String? @map("embedding_pii_mode") @db.VarChar(20)
|
|
191
|
+
domainId String? @map("domain_id") @db.Uuid
|
|
192
|
+
organizationId String @map("organization_id") @db.Uuid
|
|
192
193
|
|
|
193
194
|
sourceEdges Edge[] @relation("SourceNode")
|
|
194
195
|
targetEdges Edge[] @relation("TargetNode")
|
|
@@ -207,19 +208,19 @@ model Node {
|
|
|
207
208
|
}
|
|
208
209
|
|
|
209
210
|
model NodeChunk {
|
|
210
|
-
id String
|
|
211
|
-
nodeId String
|
|
212
|
-
chunkIndex Int
|
|
213
|
-
content String
|
|
214
|
-
tokenCount Int
|
|
215
|
-
headingContext String?
|
|
216
|
-
startOffset Int
|
|
217
|
-
endOffset Int
|
|
218
|
-
overlapPrev Int
|
|
211
|
+
id String @id @default(uuid()) @db.Uuid
|
|
212
|
+
nodeId String @map("node_id") @db.Uuid
|
|
213
|
+
chunkIndex Int @map("chunk_index")
|
|
214
|
+
content String @db.Text
|
|
215
|
+
tokenCount Int @map("token_count")
|
|
216
|
+
headingContext String? @map("heading_context") @db.VarChar(500)
|
|
217
|
+
startOffset Int @map("start_offset")
|
|
218
|
+
endOffset Int @map("end_offset")
|
|
219
|
+
overlapPrev Int @default(0) @map("overlap_prev")
|
|
219
220
|
embedding Unsupported("vector")?
|
|
220
|
-
embeddingPiiMode String?
|
|
221
|
-
organizationId String
|
|
222
|
-
createdAt DateTime
|
|
221
|
+
embeddingPiiMode String? @map("embedding_pii_mode") @db.VarChar(20)
|
|
222
|
+
organizationId String @map("organization_id") @db.Uuid
|
|
223
|
+
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz
|
|
223
224
|
|
|
224
225
|
node Node @relation(fields: [nodeId], references: [id], onDelete: Cascade)
|
|
225
226
|
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
|
@@ -326,11 +327,12 @@ model OrgAgentType {
|
|
|
326
327
|
secretEnvMapping Json @default("{}") @map("secret_env_mapping")
|
|
327
328
|
dynamicSecrets String[] @default([]) @map("dynamic_secrets")
|
|
328
329
|
|
|
329
|
-
organization Organization
|
|
330
|
-
createdByUser User?
|
|
331
|
-
agentRuns AgentRun[]
|
|
332
|
-
schedules AgentSchedule[]
|
|
333
|
-
apiKeys ApiKey[]
|
|
330
|
+
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
|
331
|
+
createdByUser User? @relation("OrgAgentTypeCreatedBy", fields: [createdByUserId], references: [id], onDelete: SetNull)
|
|
332
|
+
agentRuns AgentRun[] @relation("AgentRunAgent")
|
|
333
|
+
schedules AgentSchedule[] @relation("AgentScheduleAgent")
|
|
334
|
+
apiKeys ApiKey[] @relation("ApiKeyAgent")
|
|
335
|
+
instructions AgentInstruction[] @relation("AgentTypeInstructions")
|
|
334
336
|
|
|
335
337
|
@@unique([organizationId, slug], map: "uq_org_agent_type_org_slug")
|
|
336
338
|
@@index([organizationId], map: "idx_org_agent_types_organization")
|
|
@@ -376,13 +378,21 @@ model AgentRun {
|
|
|
376
378
|
parentAgentRunId String? @map("parent_agent_run_id") @db.Uuid
|
|
377
379
|
actClaim Json? @map("act_claim")
|
|
378
380
|
capturedAbility Json? @map("captured_ability")
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
381
|
+
instructionId String? @map("instruction_id") @db.Uuid
|
|
382
|
+
reasoningTrace Json? @map("reasoning_trace")
|
|
383
|
+
toolsCalled Json? @map("tools_called")
|
|
384
|
+
outcome Json?
|
|
385
|
+
confidence Decimal? @db.Decimal
|
|
386
|
+
taskType String? @map("task_type") @db.VarChar(100)
|
|
387
|
+
outcomeStatus String? @map("outcome_status") @db.VarChar(30)
|
|
388
|
+
|
|
389
|
+
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
|
390
|
+
schedule AgentSchedule? @relation(fields: [scheduleId], references: [id], onDelete: SetNull)
|
|
391
|
+
agent OrgAgentType? @relation("AgentRunAgent", fields: [agentId], references: [id], onDelete: SetNull)
|
|
392
|
+
invokedByUser User? @relation("AgentRunInvokedBy", fields: [invokedByUserId], references: [id], onDelete: SetNull)
|
|
393
|
+
parent AgentRun? @relation("AgentRunParent", fields: [parentAgentRunId], references: [id], onDelete: SetNull)
|
|
394
|
+
children AgentRun[] @relation("AgentRunParent")
|
|
395
|
+
instruction AgentInstruction? @relation(fields: [instructionId], references: [id], onDelete: SetNull)
|
|
386
396
|
|
|
387
397
|
@@index([organizationId], map: "idx_agent_runs_organization")
|
|
388
398
|
@@index([status], map: "idx_agent_runs_status")
|
|
@@ -391,9 +401,46 @@ model AgentRun {
|
|
|
391
401
|
@@index([agentId], map: "idx_agent_runs_agent_id")
|
|
392
402
|
@@index([invokedByUserId], map: "idx_agent_runs_invoked_by_user_id")
|
|
393
403
|
@@index([parentAgentRunId], map: "idx_agent_runs_parent_agent_run_id")
|
|
404
|
+
@@index([instructionId], map: "idx_agent_runs_instruction")
|
|
405
|
+
@@index([taskType, status], map: "idx_agent_runs_task_type")
|
|
394
406
|
@@map("agent_runs")
|
|
395
407
|
}
|
|
396
408
|
|
|
409
|
+
model AgentInstruction {
|
|
410
|
+
id String @id @default(uuid()) @db.Uuid
|
|
411
|
+
organizationId String @map("organization_id") @db.Uuid
|
|
412
|
+
agentTypeId String? @map("agent_type_id") @db.Uuid
|
|
413
|
+
taskType String? @map("task_type") @db.VarChar(100)
|
|
414
|
+
version String @db.VarChar(20)
|
|
415
|
+
status String @default("draft") @db.VarChar(20)
|
|
416
|
+
systemPrompt String @default("") @map("system_prompt") @db.Text
|
|
417
|
+
tools Json @default("[]")
|
|
418
|
+
guardrails Json @default("{}")
|
|
419
|
+
modelConfig Json @default("{}") @map("model_config")
|
|
420
|
+
contentHash String? @map("content_hash") @db.VarChar(64)
|
|
421
|
+
parentVersionId String? @map("parent_version_id") @db.Uuid
|
|
422
|
+
changeNote String? @map("change_note") @db.Text
|
|
423
|
+
publishedAt DateTime? @map("published_at") @db.Timestamptz
|
|
424
|
+
deprecatedAt DateTime? @map("deprecated_at") @db.Timestamptz
|
|
425
|
+
effectiveFrom DateTime? @map("effective_from") @db.Timestamptz
|
|
426
|
+
effectiveTo DateTime? @map("effective_to") @db.Timestamptz
|
|
427
|
+
createdBy String @map("created_by") @db.VarChar(255)
|
|
428
|
+
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz
|
|
429
|
+
updatedAt DateTime @default(now()) @map("updated_at") @db.Timestamptz
|
|
430
|
+
|
|
431
|
+
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
|
432
|
+
agentType OrgAgentType? @relation("AgentTypeInstructions", fields: [agentTypeId], references: [id], onDelete: SetNull)
|
|
433
|
+
parentVersion AgentInstruction? @relation("InstructionVersionChain", fields: [parentVersionId], references: [id], onDelete: SetNull)
|
|
434
|
+
childVersions AgentInstruction[] @relation("InstructionVersionChain")
|
|
435
|
+
agentRuns AgentRun[]
|
|
436
|
+
|
|
437
|
+
@@index([organizationId], map: "idx_agent_instructions_org")
|
|
438
|
+
@@index([agentTypeId], map: "idx_agent_instructions_agent_type")
|
|
439
|
+
@@index([organizationId, agentTypeId, taskType, status, publishedAt(sort: Desc)], map: "idx_agent_instructions_org_agent_status")
|
|
440
|
+
@@index([contentHash], map: "idx_agent_instructions_hash")
|
|
441
|
+
@@map("agent_instructions")
|
|
442
|
+
}
|
|
443
|
+
|
|
397
444
|
model AgentSchedule {
|
|
398
445
|
id String @id @default(uuid()) @db.Uuid
|
|
399
446
|
organizationId String @map("organization_id") @db.Uuid
|
|
@@ -494,32 +541,32 @@ model UsageRecord {
|
|
|
494
541
|
// ── Tag System ──────────────────────────────────────────────────────────────
|
|
495
542
|
|
|
496
543
|
model TagDefinition {
|
|
497
|
-
id
|
|
498
|
-
organizationId
|
|
499
|
-
tagName
|
|
500
|
-
tagType
|
|
501
|
-
cardinality
|
|
502
|
-
source
|
|
503
|
-
status
|
|
504
|
-
description
|
|
505
|
-
category
|
|
506
|
-
labels
|
|
507
|
-
applicableNodeTypes
|
|
508
|
-
requiredForNodeTypes Json
|
|
509
|
-
enumValues
|
|
510
|
-
enumVersion
|
|
511
|
-
dependsOn
|
|
512
|
-
autoAcceptThreshold
|
|
513
|
-
parentDefinitionId
|
|
514
|
-
replacedBy
|
|
515
|
-
deprecatedAt
|
|
516
|
-
createdAt
|
|
517
|
-
createdBy
|
|
518
|
-
|
|
519
|
-
organization Organization?
|
|
520
|
-
parentDef TagDefinition?
|
|
544
|
+
id String @id @default(uuid()) @db.Uuid
|
|
545
|
+
organizationId String? @map("organization_id") @db.Uuid
|
|
546
|
+
tagName String @map("tag_name") @db.VarChar(100)
|
|
547
|
+
tagType String @map("tag_type") @db.VarChar(20)
|
|
548
|
+
cardinality String @default("singleton") @db.VarChar(10)
|
|
549
|
+
source String @default("extracted") @db.VarChar(20)
|
|
550
|
+
status String @default("active") @map("status") @db.VarChar(20)
|
|
551
|
+
description String @default("") @db.Text
|
|
552
|
+
category String? @map("category") @db.VarChar(50)
|
|
553
|
+
labels Json? @map("labels") @db.JsonB
|
|
554
|
+
applicableNodeTypes Json @default("[]") @map("applicable_node_types")
|
|
555
|
+
requiredForNodeTypes Json @default("[]") @map("required_for_node_types")
|
|
556
|
+
enumValues Json? @map("enum_values")
|
|
557
|
+
enumVersion Int @default(1) @map("enum_version")
|
|
558
|
+
dependsOn Json @default("[]") @map("depends_on")
|
|
559
|
+
autoAcceptThreshold Float? @map("auto_accept_threshold") @db.Real
|
|
560
|
+
parentDefinitionId String? @map("parent_definition_id") @db.Uuid
|
|
561
|
+
replacedBy String? @map("replaced_by") @db.Uuid
|
|
562
|
+
deprecatedAt DateTime? @map("deprecated_at") @db.Timestamptz
|
|
563
|
+
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz
|
|
564
|
+
createdBy String @map("created_by") @db.VarChar(255)
|
|
565
|
+
|
|
566
|
+
organization Organization? @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
|
567
|
+
parentDef TagDefinition? @relation("TagDefHierarchy", fields: [parentDefinitionId], references: [id])
|
|
521
568
|
childDefs TagDefinition[] @relation("TagDefHierarchy")
|
|
522
|
-
replacementDef TagDefinition?
|
|
569
|
+
replacementDef TagDefinition? @relation("TagDefReplacement", fields: [replacedBy], references: [id])
|
|
523
570
|
replacedDefs TagDefinition[] @relation("TagDefReplacement")
|
|
524
571
|
tags NodeTag[]
|
|
525
572
|
|
|
@@ -530,25 +577,25 @@ model TagDefinition {
|
|
|
530
577
|
}
|
|
531
578
|
|
|
532
579
|
model NodeTag {
|
|
533
|
-
id
|
|
534
|
-
nodeId
|
|
535
|
-
organizationId
|
|
536
|
-
tagDefinitionId
|
|
537
|
-
tagName
|
|
538
|
-
isSingleton
|
|
539
|
-
|
|
540
|
-
valueText
|
|
541
|
-
valueNum
|
|
542
|
-
valueCurrency
|
|
543
|
-
valueUnit
|
|
544
|
-
valueDate
|
|
545
|
-
valueRef
|
|
546
|
-
|
|
547
|
-
textSpan
|
|
548
|
-
offsetStart
|
|
549
|
-
offsetEnd
|
|
550
|
-
contentVersion
|
|
551
|
-
attrs
|
|
580
|
+
id String @id @default(uuid()) @db.Uuid
|
|
581
|
+
nodeId String @map("node_id") @db.Uuid
|
|
582
|
+
organizationId String @map("organization_id") @db.Uuid
|
|
583
|
+
tagDefinitionId String @map("tag_definition_id") @db.Uuid
|
|
584
|
+
tagName String @map("tag_name") @db.VarChar(100)
|
|
585
|
+
isSingleton Boolean @default(false) @map("is_singleton")
|
|
586
|
+
|
|
587
|
+
valueText String? @map("value_text") @db.Text
|
|
588
|
+
valueNum Float? @map("value_num") @db.DoublePrecision
|
|
589
|
+
valueCurrency String? @map("value_currency") @db.Char(3)
|
|
590
|
+
valueUnit String? @map("value_unit") @db.VarChar(20)
|
|
591
|
+
valueDate DateTime? @map("value_date") @db.Timestamptz
|
|
592
|
+
valueRef String? @map("value_ref") @db.Uuid
|
|
593
|
+
|
|
594
|
+
textSpan String? @map("text_span") @db.Text
|
|
595
|
+
offsetStart Int? @map("offset_start")
|
|
596
|
+
offsetEnd Int? @map("offset_end")
|
|
597
|
+
contentVersion Int? @map("content_version")
|
|
598
|
+
attrs Json @default("{}") @db.JsonB
|
|
552
599
|
|
|
553
600
|
taggedBy String @map("tagged_by") @db.VarChar(255)
|
|
554
601
|
modelId String? @map("model_id") @db.VarChar(100)
|
|
@@ -560,14 +607,14 @@ model NodeTag {
|
|
|
560
607
|
supersededBy String? @map("superseded_by") @db.Uuid
|
|
561
608
|
batchId String? @map("batch_id") @db.Uuid
|
|
562
609
|
|
|
563
|
-
createdAt
|
|
564
|
-
updatedAt
|
|
610
|
+
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz
|
|
611
|
+
updatedAt DateTime @default(now()) @map("updated_at") @db.Timestamptz
|
|
565
612
|
|
|
566
|
-
node
|
|
567
|
-
organization
|
|
568
|
-
tagDefinition
|
|
569
|
-
supersedes
|
|
570
|
-
supersededTags NodeTag[]
|
|
613
|
+
node Node @relation(fields: [nodeId], references: [id], onDelete: Cascade)
|
|
614
|
+
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
|
615
|
+
tagDefinition TagDefinition @relation(fields: [tagDefinitionId], references: [id])
|
|
616
|
+
supersedes NodeTag? @relation("TagSupersession", fields: [supersededBy], references: [id])
|
|
617
|
+
supersededTags NodeTag[] @relation("TagSupersession")
|
|
571
618
|
|
|
572
619
|
@@index([nodeId], map: "idx_node_tags_node")
|
|
573
620
|
@@index([organizationId, tagName], map: "idx_node_tags_org_name")
|
|
@@ -577,25 +624,25 @@ model NodeTag {
|
|
|
577
624
|
}
|
|
578
625
|
|
|
579
626
|
model NodeTagHistory {
|
|
580
|
-
id
|
|
581
|
-
tagId
|
|
582
|
-
nodeId
|
|
583
|
-
organizationId
|
|
584
|
-
tagName
|
|
585
|
-
|
|
586
|
-
valueText
|
|
587
|
-
valueNum
|
|
588
|
-
valueCurrency
|
|
589
|
-
valueUnit
|
|
590
|
-
valueDate
|
|
591
|
-
valueRef
|
|
592
|
-
|
|
593
|
-
validFrom
|
|
594
|
-
validUntil
|
|
595
|
-
systemFrom
|
|
596
|
-
systemTo
|
|
597
|
-
|
|
598
|
-
replacedBy
|
|
627
|
+
id String @id @default(uuid()) @db.Uuid
|
|
628
|
+
tagId String @map("tag_id") @db.Uuid
|
|
629
|
+
nodeId String @map("node_id") @db.Uuid
|
|
630
|
+
organizationId String @map("organization_id") @db.Uuid
|
|
631
|
+
tagName String @map("tag_name") @db.VarChar(100)
|
|
632
|
+
|
|
633
|
+
valueText String? @map("value_text") @db.Text
|
|
634
|
+
valueNum Float? @map("value_num") @db.DoublePrecision
|
|
635
|
+
valueCurrency String? @map("value_currency") @db.Char(3)
|
|
636
|
+
valueUnit String? @map("value_unit") @db.VarChar(20)
|
|
637
|
+
valueDate DateTime? @map("value_date") @db.Timestamptz
|
|
638
|
+
valueRef String? @map("value_ref") @db.Uuid
|
|
639
|
+
|
|
640
|
+
validFrom DateTime @map("valid_from") @db.Timestamptz
|
|
641
|
+
validUntil DateTime @map("valid_until") @db.Timestamptz
|
|
642
|
+
systemFrom DateTime @map("system_from") @db.Timestamptz
|
|
643
|
+
systemTo DateTime? @map("system_to") @db.Timestamptz
|
|
644
|
+
|
|
645
|
+
replacedBy String @map("replaced_by") @db.VarChar(255)
|
|
599
646
|
|
|
600
647
|
@@index([nodeId, tagName, validFrom], map: "idx_tag_history_node_name_time")
|
|
601
648
|
@@index([organizationId, tagName, validFrom], map: "idx_tag_history_org_name_time")
|
|
@@ -604,16 +651,16 @@ model NodeTagHistory {
|
|
|
604
651
|
}
|
|
605
652
|
|
|
606
653
|
model NodeTagAudit {
|
|
607
|
-
id
|
|
608
|
-
tagId
|
|
609
|
-
nodeId
|
|
610
|
-
orgId
|
|
611
|
-
action
|
|
612
|
-
oldValue
|
|
613
|
-
newValue
|
|
614
|
-
actorId
|
|
615
|
-
reason
|
|
616
|
-
createdAt
|
|
654
|
+
id String @id @default(uuid()) @db.Uuid
|
|
655
|
+
tagId String @map("tag_id") @db.Uuid
|
|
656
|
+
nodeId String @map("node_id") @db.Uuid
|
|
657
|
+
orgId String @map("organization_id") @db.Uuid
|
|
658
|
+
action String @map("action") @db.VarChar(20)
|
|
659
|
+
oldValue Json? @map("old_value") @db.JsonB
|
|
660
|
+
newValue Json? @map("new_value") @db.JsonB
|
|
661
|
+
actorId String @map("actor_id") @db.Uuid
|
|
662
|
+
reason String? @db.Text
|
|
663
|
+
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz
|
|
617
664
|
|
|
618
665
|
@@index([tagId], map: "idx_tag_audit_tag")
|
|
619
666
|
@@index([nodeId], map: "idx_tag_audit_node")
|
|
@@ -642,25 +689,25 @@ model QuotaOverride {
|
|
|
642
689
|
// ── Document Archive ────────────────────────────────────────────────────────
|
|
643
690
|
|
|
644
691
|
model Document {
|
|
645
|
-
id
|
|
646
|
-
organizationId
|
|
647
|
-
fileName
|
|
648
|
-
mimeType
|
|
649
|
-
fileSizeBytes
|
|
650
|
-
storagePath
|
|
651
|
-
contentHash
|
|
652
|
-
status
|
|
653
|
-
ocrModel
|
|
654
|
-
ocrTokensIn
|
|
655
|
-
ocrTokensOut
|
|
656
|
-
pageCount
|
|
657
|
-
nodeId
|
|
658
|
-
errorMessage
|
|
659
|
-
createdBy
|
|
660
|
-
createdAt
|
|
661
|
-
updatedAt
|
|
692
|
+
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
|
|
693
|
+
organizationId String @map("organization_id") @db.Uuid
|
|
694
|
+
fileName String @map("file_name") @db.VarChar(500)
|
|
695
|
+
mimeType String @map("mime_type") @db.VarChar(100)
|
|
696
|
+
fileSizeBytes Int @map("file_size_bytes")
|
|
697
|
+
storagePath String @map("storage_path") @db.VarChar(1000)
|
|
698
|
+
contentHash String? @map("content_hash") @db.VarChar(64)
|
|
699
|
+
status String @default("uploading") @db.VarChar(20)
|
|
700
|
+
ocrModel String? @map("ocr_model") @db.VarChar(100)
|
|
701
|
+
ocrTokensIn Int? @map("ocr_tokens_in")
|
|
702
|
+
ocrTokensOut Int? @map("ocr_tokens_out")
|
|
703
|
+
pageCount Int? @map("page_count")
|
|
704
|
+
nodeId String? @map("node_id") @db.Uuid
|
|
705
|
+
errorMessage String? @map("error_message")
|
|
706
|
+
createdBy String @map("created_by") @db.VarChar(255)
|
|
707
|
+
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz
|
|
708
|
+
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz
|
|
662
709
|
|
|
663
|
-
organization
|
|
710
|
+
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
|
664
711
|
|
|
665
712
|
@@index([organizationId, contentHash], map: "idx_documents_org_hash")
|
|
666
713
|
@@index([organizationId, status], map: "idx_documents_org_status")
|