@nbt-dev/nbt 0.0.3 → 0.0.4

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": "@nbt-dev/nbt",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "The nbt CLI and console daemon for the nbt-dev console — a fixed-target OS for web development. Linux/x64 prebuilt binaries.",
5
5
  "bin": {
6
6
  "nbt": "dist/nbt.js"
@@ -12,6 +12,7 @@ entity Calendar {
12
12
  slotInterval?: u32
13
13
  isActive: bool
14
14
  source?: string
15
+ appointments: Appointment[]
15
16
  }
16
17
 
17
18
  export entity Appointment {
@@ -19,7 +20,7 @@ export entity Appointment {
19
20
  createdAt: DateTime @default(now())
20
21
  updatedAt: DateTime @updatedAt
21
22
  calendar: Calendar
22
- contact: Contact
23
+ contact: Contact @relation(onDelete: Restrict)
23
24
  title?: string
24
25
  address?: string
25
26
  notes?: string
@@ -28,7 +29,7 @@ export entity Appointment {
28
29
  timezone?: string
29
30
  status: string
30
31
  source?: string
31
- assignedUser?: User
32
+ assignedUser?: User @relation(onDelete: SetNull)
32
33
  isRescheduled: bool
33
34
  originalStartTime?: DateTime
34
35
  originalEndTime?: DateTime
@@ -50,8 +51,9 @@ export entity Appointment {
50
51
  # over Appointments needs it; the *content* of the text is customer policy.
51
52
  embedText?: string
52
53
 
53
- @@index([contactId])
54
- @@index([calendarId])
54
+ participants: AppointmentParticipant[]
55
+
56
+ # contact + calendar are FK fields — indexed automatically.
55
57
  @@index([state])
56
58
  @@index([outcomeClass])
57
59
  }
@@ -72,14 +74,13 @@ export entity AppointmentParticipant {
72
74
  id: ulid
73
75
  createdAt: DateTime @default(now())
74
76
  updatedAt: DateTime @updatedAt
75
- appointment: Appointment
76
- user: User
77
+ appointment: Appointment @relation(onDelete: Cascade)
78
+ user: User @relation(onDelete: Cascade)
77
79
  role: string # client-defined (e.g. "setter", "closer")
78
80
  assignedAt: DateTime @default(now())
79
- assignedBy?: User # who recorded this assignment (for audit)
81
+ assignedBy?: User @relation(onDelete: SetNull) # who recorded this assignment (for audit)
80
82
  notes?: string
81
83
 
82
- @@unique([appointmentId, role, userId])
83
- @@index([appointmentId])
84
- @@index([userId, role])
84
+ @@unique([appointment, role, user])
85
+ @@index([user, role])
85
86
  }
@@ -35,6 +35,8 @@ export entity Contact {
35
35
  # * location deemed insufficient
36
36
  data: document
37
37
  customData: document
38
+
39
+ deals: Deal[]
38
40
  }
39
41
 
40
42
  # Generic per-appointment lifecycle outcome — neutral over customer domain.
@@ -121,9 +123,9 @@ entity PipelineStage {
121
123
  updatedAt: DateTime @updatedAt
122
124
  name: string
123
125
  order: u32
124
- pipeline: Pipeline
126
+ pipeline: Pipeline @relation(onDelete: Cascade) # stages are owned by their pipeline
125
127
 
126
- deals: Deal[]
128
+ deals: Deal[]
127
129
  }
128
130
 
129
131
  entity PipelineStageTransition {
@@ -139,7 +141,7 @@ entity PipelineStageTransition {
139
141
  fromStageId?: string
140
142
  toStageId: string
141
143
 
142
- movedBy?: User
144
+ movedBy?: User @relation(onDelete: SetNull)
143
145
 
144
146
  @@index([fromPipelineId, toPipelineId, fromStageId, toStageId])
145
147
  }
@@ -39,5 +39,6 @@ entity WorkflowExecutionEvent {
39
39
  id: ulid
40
40
  createdAt: DateTime @default(now())
41
41
  updatedAt: DateTime @updatedAt
42
+ execution: WorkflowExecution @relation(onDelete: Cascade) # events are owned by their execution
42
43
  kind: WorkflowExecutionEventKind
43
44
  }
@@ -12,6 +12,7 @@ entity Calendar {
12
12
  slotInterval?: u32
13
13
  isActive: bool
14
14
  source?: string
15
+ appointments: Appointment[]
15
16
  }
16
17
 
17
18
  export entity Appointment {
@@ -19,7 +20,7 @@ export entity Appointment {
19
20
  createdAt: DateTime @default(now())
20
21
  updatedAt: DateTime @updatedAt
21
22
  calendar: Calendar
22
- contact: Contact
23
+ contact: Contact @relation(onDelete: Restrict)
23
24
  title?: string
24
25
  address?: string
25
26
  notes?: string
@@ -28,7 +29,7 @@ export entity Appointment {
28
29
  timezone?: string
29
30
  status: string
30
31
  source?: string
31
- assignedUser?: User
32
+ assignedUser?: User @relation(onDelete: SetNull)
32
33
  isRescheduled: bool
33
34
  originalStartTime?: DateTime
34
35
  originalEndTime?: DateTime
@@ -50,8 +51,9 @@ export entity Appointment {
50
51
  # over Appointments needs it; the *content* of the text is customer policy.
51
52
  embedText?: string
52
53
 
53
- @@index([contactId])
54
- @@index([calendarId])
54
+ participants: AppointmentParticipant[]
55
+
56
+ # contact + calendar are FK fields — indexed automatically.
55
57
  @@index([state])
56
58
  @@index([outcomeClass])
57
59
  }
@@ -72,14 +74,13 @@ export entity AppointmentParticipant {
72
74
  id: ulid
73
75
  createdAt: DateTime @default(now())
74
76
  updatedAt: DateTime @updatedAt
75
- appointment: Appointment
76
- user: User
77
+ appointment: Appointment @relation(onDelete: Cascade)
78
+ user: User @relation(onDelete: Cascade)
77
79
  role: string # client-defined (e.g. "setter", "closer")
78
80
  assignedAt: DateTime @default(now())
79
- assignedBy?: User # who recorded this assignment (for audit)
81
+ assignedBy?: User @relation(onDelete: SetNull) # who recorded this assignment (for audit)
80
82
  notes?: string
81
83
 
82
- @@unique([appointmentId, role, userId])
83
- @@index([appointmentId])
84
- @@index([userId, role])
84
+ @@unique([appointment, role, user])
85
+ @@index([user, role])
85
86
  }
@@ -35,6 +35,8 @@ export entity Contact {
35
35
  # * location deemed insufficient
36
36
  data: document
37
37
  customData: document
38
+
39
+ deals: Deal[]
38
40
  }
39
41
 
40
42
  # Generic per-appointment lifecycle outcome — neutral over customer domain.
@@ -121,9 +123,9 @@ entity PipelineStage {
121
123
  updatedAt: DateTime @updatedAt
122
124
  name: string
123
125
  order: u32
124
- pipeline: Pipeline
126
+ pipeline: Pipeline @relation(onDelete: Cascade) # stages are owned by their pipeline
125
127
 
126
- deals: Deal[]
128
+ deals: Deal[]
127
129
  }
128
130
 
129
131
  entity PipelineStageTransition {
@@ -139,7 +141,7 @@ entity PipelineStageTransition {
139
141
  fromStageId?: string
140
142
  toStageId: string
141
143
 
142
- movedBy?: User
144
+ movedBy?: User @relation(onDelete: SetNull)
143
145
 
144
146
  @@index([fromPipelineId, toPipelineId, fromStageId, toStageId])
145
147
  }
@@ -39,5 +39,6 @@ entity WorkflowExecutionEvent {
39
39
  id: ulid
40
40
  createdAt: DateTime @default(now())
41
41
  updatedAt: DateTime @updatedAt
42
+ execution: WorkflowExecution @relation(onDelete: Cascade) # events are owned by their execution
42
43
  kind: WorkflowExecutionEventKind
43
44
  }
Binary file
Binary file
@@ -1,4 +0,0 @@
1
- migration update_directmessageroom {
2
- add_field DirectMessageRoom participantAType string default("")
3
- add_field DirectMessageRoom participantBType string default("")
4
- }
@@ -1,80 +0,0 @@
1
- entity Channel {
2
- name: string
3
- description?: string
4
- creatorId: string
5
- isPrivate: bool
6
- isArchived: bool
7
- lastActivityAt?: DateTime
8
- @@unique([name])
9
- @@collaborative([])
10
- }
11
-
12
- entity ChannelMember {
13
- channelId: string
14
- userId: string
15
- joinedAt: DateTime
16
- @@unique([channelId, userId])
17
- @@index([userId])
18
- @@index([channelId])
19
- }
20
-
21
- entity DirectMessageRoom {
22
- participantA: string
23
- participantAType: string
24
- participantB: string
25
- participantBType: string
26
- lastActivityAt?: DateTime
27
- @@unique([participantA, participantB])
28
- @@index([participantA])
29
- @@index([participantB])
30
- @@collaborative([])
31
- }
32
-
33
- entity Message {
34
- channelId?: string
35
- dmRoomId?: string
36
- parentMessageId?: string
37
- senderType: string
38
- senderId: string
39
- content: string
40
- editedAt?: DateTime
41
- deletedAt?: DateTime
42
- replyCount: u32
43
- @@index([channelId])
44
- @@index([dmRoomId])
45
- @@index([parentMessageId])
46
- @@index([senderId])
47
- }
48
-
49
- entity MessageReaction {
50
- messageId: string
51
- emoji: string
52
- userId: string
53
- @@unique([messageId, emoji, userId])
54
- @@index([messageId])
55
- @@index([userId])
56
- }
57
-
58
- entity ChatReadState {
59
- userId: string
60
- scopeKey: string
61
- scopeType: string
62
- scopeId: string
63
- lastReadMessageId: string
64
- lastReadAt: DateTime
65
- @@unique([userId, scopeKey])
66
- @@index([userId])
67
- @@index([scopeKey])
68
- }
69
-
70
- entity User {
71
- name: string
72
- username?: string
73
- email?: string
74
- emailVerified: bool
75
- externalId?: string
76
- capsVersion: u32
77
- @@index([email])
78
- @@index([externalId])
79
- }
80
-
@@ -1,4 +0,0 @@
1
- migration update_directmessageroom {
2
- add_field DirectMessageRoom participantAType string default("")
3
- add_field DirectMessageRoom participantBType string default("")
4
- }
@@ -1,80 +0,0 @@
1
- entity Channel {
2
- name: string
3
- description?: string
4
- creatorId: string
5
- isPrivate: bool
6
- isArchived: bool
7
- lastActivityAt?: DateTime
8
- @@unique([name])
9
- @@collaborative([])
10
- }
11
-
12
- entity ChannelMember {
13
- channelId: string
14
- userId: string
15
- joinedAt: DateTime
16
- @@unique([channelId, userId])
17
- @@index([userId])
18
- @@index([channelId])
19
- }
20
-
21
- entity DirectMessageRoom {
22
- participantA: string
23
- participantAType: string
24
- participantB: string
25
- participantBType: string
26
- lastActivityAt?: DateTime
27
- @@unique([participantA, participantB])
28
- @@index([participantA])
29
- @@index([participantB])
30
- @@collaborative([])
31
- }
32
-
33
- entity Message {
34
- channelId?: string
35
- dmRoomId?: string
36
- parentMessageId?: string
37
- senderType: string
38
- senderId: string
39
- content: string
40
- editedAt?: DateTime
41
- deletedAt?: DateTime
42
- replyCount: u32
43
- @@index([channelId])
44
- @@index([dmRoomId])
45
- @@index([parentMessageId])
46
- @@index([senderId])
47
- }
48
-
49
- entity MessageReaction {
50
- messageId: string
51
- emoji: string
52
- userId: string
53
- @@unique([messageId, emoji, userId])
54
- @@index([messageId])
55
- @@index([userId])
56
- }
57
-
58
- entity ChatReadState {
59
- userId: string
60
- scopeKey: string
61
- scopeType: string
62
- scopeId: string
63
- lastReadMessageId: string
64
- lastReadAt: DateTime
65
- @@unique([userId, scopeKey])
66
- @@index([userId])
67
- @@index([scopeKey])
68
- }
69
-
70
- entity User {
71
- name: string
72
- username?: string
73
- email?: string
74
- emailVerified: bool
75
- externalId?: string
76
- capsVersion: u32
77
- @@index([email])
78
- @@index([externalId])
79
- }
80
-