@adaptware/eagles-db 0.5.9 → 0.5.11

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": "@adaptware/eagles-db",
3
- "version": "0.5.9",
3
+ "version": "0.5.11",
4
4
  "description": "A Prisma client package for Treadspace database operations",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -0,0 +1,14 @@
1
+ /// Orion workflow names bundled in license — excluded from ai.cost metering.
2
+ /// Future license plans will reference subsets of this catalogue.
3
+ model LicenseIncludedWorkflow {
4
+ id String @id @default(uuid())
5
+ workflow_name String @unique
6
+ created_at DateTime @default(now())
7
+ updated_at DateTime @updatedAt
8
+ created_by String @default("system")
9
+ updated_by String @default("system")
10
+ is_active Boolean @default(true)
11
+
12
+ @@map("license_included_workflows")
13
+ @@schema("usage")
14
+ }
@@ -0,0 +1,23 @@
1
+ model UsageAggregate {
2
+ id String @id @default(uuid())
3
+ organisation_id String
4
+ metric_key String
5
+ dimension_hash String
6
+ dimensions Json
7
+ total_quantity Decimal
8
+ period_start DateTime?
9
+ period_end DateTime?
10
+ created_at DateTime @default(now())
11
+ updated_at DateTime @updatedAt
12
+ created_by String @default("system")
13
+ updated_by String @default("system")
14
+ is_active Boolean @default(true)
15
+
16
+ organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
17
+ metric UsageMetricDefinition @relation(fields: [metric_key], references: [key], onDelete: Restrict, onUpdate: Cascade)
18
+
19
+ @@unique([organisation_id, metric_key, dimension_hash, period_start])
20
+ @@index([organisation_id, metric_key])
21
+ @@map("usage_aggregates")
22
+ @@schema("usage")
23
+ }
@@ -0,0 +1,24 @@
1
+ enum UsageUnit {
2
+ COUNT
3
+ BYTES
4
+ SECONDS
5
+ TOKENS
6
+ COST
7
+
8
+ @@schema("usage")
9
+ }
10
+
11
+ enum UsageAggregationType {
12
+ SUM
13
+ GAUGE
14
+
15
+ @@schema("usage")
16
+ }
17
+
18
+ enum UsageSourceType {
19
+ activity_event
20
+ usage_publisher
21
+ reconcile
22
+
23
+ @@schema("usage")
24
+ }
@@ -0,0 +1,26 @@
1
+ model UsageLedgerEntry {
2
+ id String @id @default(uuid())
3
+ organisation_id String
4
+ metric_key String
5
+ quantity Decimal @db.Decimal(20, 4)
6
+ occurred_at DateTime
7
+ dimensions Json
8
+ idempotency_key String @unique
9
+ source_type UsageSourceType
10
+ source_id String?
11
+ resource_type String?
12
+ resource_id String?
13
+ created_at DateTime @default(now())
14
+ updated_at DateTime @default(now()) @updatedAt
15
+ created_by String @default("system")
16
+ updated_by String @default("system")
17
+ is_active Boolean @default(true)
18
+
19
+ organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
20
+ metric UsageMetricDefinition @relation(fields: [metric_key], references: [key], onDelete: Restrict, onUpdate: Cascade)
21
+
22
+ @@index([organisation_id, metric_key, occurred_at])
23
+ @@index([organisation_id, occurred_at])
24
+ @@map("usage_ledger")
25
+ @@schema("usage")
26
+ }
@@ -0,0 +1,19 @@
1
+ model UsageMetricDefinition {
2
+ id String @id @default(uuid())
3
+ key String @unique
4
+ name String
5
+ unit UsageUnit
6
+ aggregation_type UsageAggregationType
7
+ metadata Json?
8
+ created_at DateTime @default(now())
9
+ updated_at DateTime @updatedAt
10
+ created_by String @default("system")
11
+ updated_by String @default("system")
12
+ is_active Boolean @default(true)
13
+
14
+ ledger_entries UsageLedgerEntry[]
15
+ aggregates UsageAggregate[]
16
+
17
+ @@map("usage_metric_definitions")
18
+ @@schema("usage")
19
+ }
@@ -1,96 +0,0 @@
1
- enum UsageUnit {
2
- COUNT
3
- BYTES
4
- SECONDS
5
- TOKENS
6
- COST
7
-
8
- @@schema("usage")
9
- }
10
-
11
- enum UsageAggregationType {
12
- SUM
13
- GAUGE
14
-
15
- @@schema("usage")
16
- }
17
-
18
- enum UsageSourceType {
19
- activity_event
20
- usage_publisher
21
- reconcile
22
-
23
- @@schema("usage")
24
- }
25
-
26
- model UsageMetricDefinition {
27
- id String @id @default(uuid())
28
- key String @unique
29
- name String
30
- unit UsageUnit
31
- aggregation_type UsageAggregationType
32
- metadata Json?
33
- created_at DateTime @default(now())
34
- updated_at DateTime @updatedAt
35
-
36
- ledger_entries UsageLedgerEntry[]
37
- aggregates UsageAggregate[]
38
-
39
- @@map("usage_metric_definitions")
40
- @@schema("usage")
41
- }
42
-
43
- model UsageLedgerEntry {
44
- id String @id @default(uuid())
45
- organisation_id String
46
- metric_key String
47
- quantity Decimal @db.Decimal(20, 4)
48
- occurred_at DateTime
49
- dimensions Json
50
- idempotency_key String @unique
51
- source_type UsageSourceType
52
- source_id String?
53
- resource_type String?
54
- resource_id String?
55
- created_at DateTime @default(now())
56
-
57
- organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
58
- metric UsageMetricDefinition @relation(fields: [metric_key], references: [key], onDelete: Restrict, onUpdate: Cascade)
59
-
60
- @@index([organisation_id, metric_key, occurred_at])
61
- @@index([organisation_id, occurred_at])
62
- @@map("usage_ledger")
63
- @@schema("usage")
64
- }
65
-
66
- model UsageAggregate {
67
- id String @id @default(uuid())
68
- organisation_id String
69
- metric_key String
70
- dimension_hash String
71
- dimensions Json
72
- total_quantity Decimal
73
- period_start DateTime?
74
- period_end DateTime?
75
- updated_at DateTime @updatedAt
76
-
77
- organisation Organisation @relation(fields: [organisation_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
78
- metric UsageMetricDefinition @relation(fields: [metric_key], references: [key], onDelete: Restrict, onUpdate: Cascade)
79
-
80
- @@unique([organisation_id, metric_key, dimension_hash, period_start])
81
- @@index([organisation_id, metric_key])
82
- @@map("usage_aggregates")
83
- @@schema("usage")
84
- }
85
-
86
- /// Orion workflow names bundled in license — excluded from ai.cost metering.
87
- /// Future license plans will reference subsets of this catalogue.
88
- model LicenseIncludedWorkflow {
89
- id String @id @default(uuid())
90
- workflow_name String @unique
91
- created_at DateTime @default(now())
92
- updated_at DateTime @updatedAt
93
-
94
- @@map("license_included_workflows")
95
- @@schema("usage")
96
- }