@nbt-dev/nbt 0.0.1 → 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/LICENSE +177 -21
- package/README.md +16 -13
- package/TRADEMARKS.md +49 -0
- package/dist/nbt.js +398 -19
- package/package.json +5 -4
- package/stdlib/auth/README.md +83 -0
- package/stdlib/auth/migrations/20260424144652_initial/migration.nbt +48 -0
- package/stdlib/auth/migrations/20260424144652_initial/schema_snapshot.nbt +58 -0
- package/stdlib/auth/migrations/20260521191014_update_user/migration.nbt +3 -0
- package/stdlib/auth/migrations/20260521191014_update_user/schema_snapshot.nbt +59 -0
- package/stdlib/auth/schema.nbt +142 -0
- package/stdlib/calendar/adapters/gohighlevel/tests/fixtures/v2_calendar_pilot.json +12 -0
- package/stdlib/calendar/adapters/gohighlevel/tests/fixtures/webhooks/appointment_changed.json +70 -0
- package/stdlib/calendar/adapters/gohighlevel/tests/fixtures/webhooks/appointment_created.json +72 -0
- package/stdlib/calendar/migrations/20260501210107_initial/migration.nbt +60 -0
- package/stdlib/calendar/migrations/20260501210107_initial/schema_snapshot.nbt +66 -0
- package/stdlib/calendar/migrations/20260513151050_schema_update/migration.nbt +17 -0
- package/stdlib/calendar/migrations/20260513151050_schema_update/schema_snapshot.nbt +83 -0
- package/stdlib/calendar/schema.nbt +86 -0
- package/stdlib/chat/migrations/20260429222411_initial/migration.nbt +59 -0
- package/stdlib/chat/migrations/20260429222411_initial/schema_snapshot.nbt +71 -0
- package/stdlib/chat/migrations/20260430185225_add_messagereaction/migration.nbt +9 -0
- package/stdlib/chat/migrations/20260430185225_add_messagereaction/schema_snapshot.nbt +78 -0
- package/stdlib/chat/migrations/20260518191152_update_message/migration.nbt +3 -0
- package/stdlib/chat/migrations/20260518191152_update_message/schema_snapshot.nbt +81 -0
- package/stdlib/chat/schema.nbt +130 -0
- package/stdlib/crm/adapters/gohighlevel/README.md +85 -0
- package/stdlib/crm/adapters/gohighlevel/tests/README.md +159 -0
- package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/contact_138fields.json +222 -0
- package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/contact_140fields.json +219 -0
- package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/contact_alt.json +212 -0
- package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/contact_changed.json +102 -0
- package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/contact_created.json +95 -0
- package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/contact_full.json +213 -0
- package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/contact_sparse.json +161 -0
- package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/contact_update_a.json +197 -0
- package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/contact_update_b.json +197 -0
- package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/opportunity_changed.json +85 -0
- package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/opportunity_created.json +85 -0
- package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/v2_contact_pilot.json +43 -0
- package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/v2_contact_with_price_closed.json +7 -0
- package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/v2_contact_with_price_open.json +7 -0
- package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/v2_event_appointment_delete.json +1 -0
- package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/v2_event_calendar_update.json +1 -0
- package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/v2_event_contact_create.json +1 -0
- package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/v2_event_opp_status_update.json +1 -0
- package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/v2_opportunity_pilot.json +16 -0
- package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/v2_pipelines_pilot.json +137 -0
- package/stdlib/crm/migrations/20260501210107_initial/migration.nbt +63 -0
- package/stdlib/crm/migrations/20260501210107_initial/schema_snapshot.nbt +73 -0
- package/stdlib/crm/migrations/20260513151050_schema_update/migration.nbt +13 -0
- package/stdlib/crm/migrations/20260513151050_schema_update/schema_snapshot.nbt +86 -0
- package/stdlib/crm/schema.nbt +148 -0
- package/stdlib/design/migrations/20260501210107_initial/migration.nbt +19 -0
- package/stdlib/design/migrations/20260501210107_initial/schema_snapshot.nbt +21 -0
- package/stdlib/design/migrations/20260610130000_design_system/migration.nbt +50 -0
- package/stdlib/design/migrations/20260610130000_design_system/schema_snapshot.nbt +80 -0
- package/stdlib/design/schema.nbt +140 -0
- package/stdlib/dns/migrations/20260501210107_initial/migration.nbt +32 -0
- package/stdlib/dns/migrations/20260501210107_initial/schema_snapshot.nbt +36 -0
- package/stdlib/dns/schema.nbt +68 -0
- package/stdlib/email/migrations/20260427235207_initial/migration.nbt +75 -0
- package/stdlib/email/migrations/20260427235207_initial/schema_snapshot.nbt +87 -0
- package/stdlib/email/schema.nbt +145 -0
- package/stdlib/ingest/README.md +29 -0
- package/stdlib/ingest/migrations/20260424144652_initial/migration.nbt +18 -0
- package/stdlib/ingest/migrations/20260424144652_initial/schema_snapshot.nbt +20 -0
- package/stdlib/ingest/migrations/20260429203747_schema_update/migration.nbt +3 -0
- package/stdlib/ingest/migrations/20260429203747_schema_update/schema_snapshot.nbt +21 -0
- package/stdlib/ingest/schema.nbt +37 -0
- package/stdlib/notifications/README.md +118 -0
- package/stdlib/notifications/migrations/20260430204408_initial/migration.nbt +42 -0
- package/stdlib/notifications/migrations/20260430204408_initial/schema_snapshot.nbt +46 -0
- package/stdlib/notifications/schema.nbt +67 -0
- package/stdlib/phone/migrations/20260605205722_initial/migration.nbt +50 -0
- package/stdlib/phone/migrations/20260605205722_initial/schema_snapshot.nbt +56 -0
- package/stdlib/phone/schema.nbt +95 -0
- package/stdlib/registry/migrations/20260602181932_initial/migration.nbt +8 -0
- package/stdlib/registry/migrations/20260602181932_initial/schema_snapshot.nbt +8 -0
- package/stdlib/registry/schema.nbt +20 -0
- package/stdlib/workflows/schema.nbt +44 -0
- package/vendor/linux-x64/cartridges/auth/migrations/20260424144652_initial/migration.nbt +48 -0
- package/vendor/linux-x64/cartridges/auth/migrations/20260424144652_initial/schema_snapshot.nbt +58 -0
- package/vendor/linux-x64/cartridges/auth/migrations/20260521191014_update_user/migration.nbt +3 -0
- package/vendor/linux-x64/cartridges/auth/migrations/20260521191014_update_user/schema_snapshot.nbt +59 -0
- package/vendor/linux-x64/cartridges/auth/schema.nbt +142 -0
- package/vendor/linux-x64/cartridges/calendar/migrations/20260501210107_initial/migration.nbt +60 -0
- package/vendor/linux-x64/cartridges/calendar/migrations/20260501210107_initial/schema_snapshot.nbt +66 -0
- package/vendor/linux-x64/cartridges/calendar/migrations/20260513151050_schema_update/migration.nbt +17 -0
- package/vendor/linux-x64/cartridges/calendar/migrations/20260513151050_schema_update/schema_snapshot.nbt +83 -0
- package/vendor/linux-x64/cartridges/calendar/schema.nbt +86 -0
- package/vendor/linux-x64/cartridges/chat/migrations/20260429222411_initial/migration.nbt +59 -0
- package/vendor/linux-x64/cartridges/chat/migrations/20260429222411_initial/schema_snapshot.nbt +71 -0
- package/vendor/linux-x64/cartridges/chat/migrations/20260430185225_add_messagereaction/migration.nbt +9 -0
- package/vendor/linux-x64/cartridges/chat/migrations/20260430185225_add_messagereaction/schema_snapshot.nbt +78 -0
- package/vendor/linux-x64/cartridges/chat/migrations/20260518191152_update_message/migration.nbt +3 -0
- package/vendor/linux-x64/cartridges/chat/migrations/20260518191152_update_message/schema_snapshot.nbt +81 -0
- package/vendor/linux-x64/cartridges/chat/schema.nbt +130 -0
- package/vendor/linux-x64/cartridges/crm/migrations/20260501210107_initial/migration.nbt +63 -0
- package/vendor/linux-x64/cartridges/crm/migrations/20260501210107_initial/schema_snapshot.nbt +73 -0
- package/vendor/linux-x64/cartridges/crm/migrations/20260513151050_schema_update/migration.nbt +13 -0
- package/vendor/linux-x64/cartridges/crm/migrations/20260513151050_schema_update/schema_snapshot.nbt +86 -0
- package/vendor/linux-x64/cartridges/crm/schema.nbt +148 -0
- package/vendor/linux-x64/cartridges/design/migrations/20260501210107_initial/migration.nbt +19 -0
- package/vendor/linux-x64/cartridges/design/migrations/20260501210107_initial/schema_snapshot.nbt +21 -0
- package/vendor/linux-x64/cartridges/design/migrations/20260610130000_design_system/migration.nbt +50 -0
- package/vendor/linux-x64/cartridges/design/migrations/20260610130000_design_system/schema_snapshot.nbt +80 -0
- package/vendor/linux-x64/cartridges/design/schema.nbt +140 -0
- package/vendor/linux-x64/cartridges/dns/migrations/20260501210107_initial/migration.nbt +32 -0
- package/vendor/linux-x64/cartridges/dns/migrations/20260501210107_initial/schema_snapshot.nbt +36 -0
- package/vendor/linux-x64/cartridges/dns/schema.nbt +68 -0
- package/vendor/linux-x64/cartridges/email/migrations/20260427235207_initial/migration.nbt +75 -0
- package/vendor/linux-x64/cartridges/email/migrations/20260427235207_initial/schema_snapshot.nbt +87 -0
- package/vendor/linux-x64/cartridges/email/schema.nbt +145 -0
- package/vendor/linux-x64/cartridges/ingest/migrations/20260424144652_initial/migration.nbt +18 -0
- package/vendor/linux-x64/cartridges/ingest/migrations/20260424144652_initial/schema_snapshot.nbt +20 -0
- package/vendor/linux-x64/cartridges/ingest/migrations/20260429203747_schema_update/migration.nbt +3 -0
- package/vendor/linux-x64/cartridges/ingest/migrations/20260429203747_schema_update/schema_snapshot.nbt +21 -0
- package/vendor/linux-x64/cartridges/ingest/schema.nbt +37 -0
- package/vendor/linux-x64/cartridges/notifications/migrations/20260430204408_initial/migration.nbt +42 -0
- package/vendor/linux-x64/cartridges/notifications/migrations/20260430204408_initial/schema_snapshot.nbt +46 -0
- package/vendor/linux-x64/cartridges/notifications/schema.nbt +67 -0
- package/vendor/linux-x64/cartridges/phone/migrations/20260605205722_initial/migration.nbt +50 -0
- package/vendor/linux-x64/cartridges/phone/migrations/20260605205722_initial/schema_snapshot.nbt +56 -0
- package/vendor/linux-x64/cartridges/phone/schema.nbt +95 -0
- package/vendor/linux-x64/cartridges/registry/migrations/20260602181932_initial/migration.nbt +8 -0
- package/vendor/linux-x64/cartridges/registry/migrations/20260602181932_initial/schema_snapshot.nbt +8 -0
- package/vendor/linux-x64/cartridges/registry/schema.nbt +20 -0
- package/vendor/linux-x64/cartridges/workflows/schema.nbt +44 -0
- package/vendor/linux-x64/console +0 -0
- package/vendor/linux-x64/nbt +0 -0
- package/contracts/audit/.dist/contract.json +0 -56
- package/contracts/auth/.dist/contract.json +0 -252
- package/contracts/calendar/.dist/contract.json +0 -141
- package/contracts/chat/.dist/contract.json +0 -229
- package/contracts/crm/.dist/contract.json +0 -239
- package/contracts/design/.dist/contract.json +0 -85
- package/contracts/dns/.dist/contract.json +0 -123
- package/contracts/email/.dist/contract.json +0 -267
- package/contracts/embed/.dist/contract.json +0 -137
- package/contracts/ingest/.dist/contract.json +0 -86
- package/contracts/notifications/.dist/contract.json +0 -133
- package/contracts/phone/.dist/contract.json +0 -168
- package/contracts/registry/.dist/contract.json +0 -49
- package/contracts/workflows/.dist/contract.json +0 -106
package/vendor/linux-x64/cartridges/chat/migrations/20260429222411_initial/schema_snapshot.nbt
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
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 ChatReadState {
|
|
50
|
+
userId: string
|
|
51
|
+
scopeKey: string
|
|
52
|
+
scopeType: string
|
|
53
|
+
scopeId: string
|
|
54
|
+
lastReadMessageId: string
|
|
55
|
+
lastReadAt: DateTime
|
|
56
|
+
@@unique([userId, scopeKey])
|
|
57
|
+
@@index([userId])
|
|
58
|
+
@@index([scopeKey])
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
entity User {
|
|
62
|
+
name: string
|
|
63
|
+
username?: string
|
|
64
|
+
email?: string
|
|
65
|
+
emailVerified: bool
|
|
66
|
+
externalId?: string
|
|
67
|
+
capsVersion: u32
|
|
68
|
+
@@index([email])
|
|
69
|
+
@@index([externalId])
|
|
70
|
+
}
|
|
71
|
+
|
package/vendor/linux-x64/cartridges/chat/migrations/20260430185225_add_messagereaction/migration.nbt
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
migration add_messagereaction {
|
|
2
|
+
add_entity MessageReaction
|
|
3
|
+
add_field MessageReaction messageId string default("")
|
|
4
|
+
add_field MessageReaction emoji string default("")
|
|
5
|
+
add_field MessageReaction userId string default("")
|
|
6
|
+
add_index MessageReaction [messageId]
|
|
7
|
+
add_index MessageReaction [userId]
|
|
8
|
+
add_unique MessageReaction [messageId, emoji, userId]
|
|
9
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
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
|
+
participantB: string
|
|
24
|
+
lastActivityAt?: DateTime
|
|
25
|
+
@@unique([participantA, participantB])
|
|
26
|
+
@@index([participantA])
|
|
27
|
+
@@index([participantB])
|
|
28
|
+
@@collaborative([])
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
entity Message {
|
|
32
|
+
channelId?: string
|
|
33
|
+
dmRoomId?: string
|
|
34
|
+
parentMessageId?: string
|
|
35
|
+
senderType: string
|
|
36
|
+
senderId: string
|
|
37
|
+
content: string
|
|
38
|
+
editedAt?: DateTime
|
|
39
|
+
deletedAt?: DateTime
|
|
40
|
+
replyCount: u32
|
|
41
|
+
@@index([channelId])
|
|
42
|
+
@@index([dmRoomId])
|
|
43
|
+
@@index([parentMessageId])
|
|
44
|
+
@@index([senderId])
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
entity MessageReaction {
|
|
48
|
+
messageId: string
|
|
49
|
+
emoji: string
|
|
50
|
+
userId: string
|
|
51
|
+
@@unique([messageId, emoji, userId])
|
|
52
|
+
@@index([messageId])
|
|
53
|
+
@@index([userId])
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
entity ChatReadState {
|
|
57
|
+
userId: string
|
|
58
|
+
scopeKey: string
|
|
59
|
+
scopeType: string
|
|
60
|
+
scopeId: string
|
|
61
|
+
lastReadMessageId: string
|
|
62
|
+
lastReadAt: DateTime
|
|
63
|
+
@@unique([userId, scopeKey])
|
|
64
|
+
@@index([userId])
|
|
65
|
+
@@index([scopeKey])
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
entity User {
|
|
69
|
+
name: string
|
|
70
|
+
username?: string
|
|
71
|
+
email?: string
|
|
72
|
+
emailVerified: bool
|
|
73
|
+
externalId?: string
|
|
74
|
+
capsVersion: u32
|
|
75
|
+
@@index([email])
|
|
76
|
+
@@index([externalId])
|
|
77
|
+
}
|
|
78
|
+
|
|
@@ -0,0 +1,81 @@
|
|
|
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
|
+
@@search([content])
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
entity MessageReaction {
|
|
51
|
+
messageId: string
|
|
52
|
+
emoji: string
|
|
53
|
+
userId: string
|
|
54
|
+
@@unique([messageId, emoji, userId])
|
|
55
|
+
@@index([messageId])
|
|
56
|
+
@@index([userId])
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
entity ChatReadState {
|
|
60
|
+
userId: string
|
|
61
|
+
scopeKey: string
|
|
62
|
+
scopeType: string
|
|
63
|
+
scopeId: string
|
|
64
|
+
lastReadMessageId: string
|
|
65
|
+
lastReadAt: DateTime
|
|
66
|
+
@@unique([userId, scopeKey])
|
|
67
|
+
@@index([userId])
|
|
68
|
+
@@index([scopeKey])
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
entity User {
|
|
72
|
+
name: string
|
|
73
|
+
username?: string
|
|
74
|
+
email?: string
|
|
75
|
+
emailVerified: bool
|
|
76
|
+
externalId?: string
|
|
77
|
+
capsVersion: u32
|
|
78
|
+
@@index([email])
|
|
79
|
+
@@index([externalId])
|
|
80
|
+
}
|
|
81
|
+
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# Chat cart — channels, DMs, threaded messages.
|
|
2
|
+
|
|
3
|
+
import {User} from "auth";
|
|
4
|
+
|
|
5
|
+
entity Channel {
|
|
6
|
+
id: ulid
|
|
7
|
+
createdAt: DateTime @default(now())
|
|
8
|
+
updatedAt: DateTime @updatedAt
|
|
9
|
+
name: string
|
|
10
|
+
description?: string
|
|
11
|
+
creatorId: string
|
|
12
|
+
isPrivate: bool
|
|
13
|
+
isArchived: bool
|
|
14
|
+
lastActivityAt?: DateTime
|
|
15
|
+
|
|
16
|
+
@@unique([name])
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
# Membership table for private channels. Public channels skip this — any
|
|
20
|
+
# authed user can post. Membership = read+post; admin gates write metadata.
|
|
21
|
+
entity ChannelMember {
|
|
22
|
+
id: ulid
|
|
23
|
+
createdAt: DateTime @default(now())
|
|
24
|
+
updatedAt: DateTime @updatedAt
|
|
25
|
+
channelId: string
|
|
26
|
+
userId: string
|
|
27
|
+
joinedAt: DateTime @default(now())
|
|
28
|
+
|
|
29
|
+
@@unique([channelId, userId])
|
|
30
|
+
@@index([userId])
|
|
31
|
+
@@index([channelId])
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
# 1:1 DM room. Pair canonicalized in handler: participantA = lexicographic
|
|
35
|
+
# min(ULID), participantB = max. Lookups normalize both args before hitting
|
|
36
|
+
# the unique index.
|
|
37
|
+
#
|
|
38
|
+
# participantAType / participantBType ∈ "USER" | "AGENT". Required so DM
|
|
39
|
+
# triggers (`on dm(<agent>)`) can identify the peer at message send time
|
|
40
|
+
# without a cross-cart lookup. Existing rows default to USER/USER.
|
|
41
|
+
entity DirectMessageRoom {
|
|
42
|
+
id: ulid
|
|
43
|
+
createdAt: DateTime @default(now())
|
|
44
|
+
updatedAt: DateTime @updatedAt
|
|
45
|
+
participantA: string
|
|
46
|
+
participantAType: string
|
|
47
|
+
participantB: string
|
|
48
|
+
participantBType: string
|
|
49
|
+
lastActivityAt?: DateTime
|
|
50
|
+
|
|
51
|
+
@@unique([participantA, participantB])
|
|
52
|
+
@@index([participantA])
|
|
53
|
+
@@index([participantB])
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
# Single Message entity for both channel + DM scopes. Exactly one of
|
|
57
|
+
# channelId / dmRoomId is non-empty per row. parentMessageId set => thread
|
|
58
|
+
# reply (Google-Chat-style inline replies; only one level deep — replies
|
|
59
|
+
# of replies coalesce to the top-level parent).
|
|
60
|
+
#
|
|
61
|
+
# senderType ∈ "USER" | "AGENT" | "SYSTEM". senderId points at the
|
|
62
|
+
# corresponding entity in the appropriate cart (User/Agent/System). UI
|
|
63
|
+
# renders a bot badge for non-USER senders. No fake User rows for bots.
|
|
64
|
+
entity Message {
|
|
65
|
+
id: ulid
|
|
66
|
+
createdAt: DateTime @default(now())
|
|
67
|
+
updatedAt: DateTime @updatedAt
|
|
68
|
+
channelId?: string
|
|
69
|
+
dmRoomId?: string
|
|
70
|
+
parentMessageId?: string
|
|
71
|
+
|
|
72
|
+
senderType: string
|
|
73
|
+
senderId: string
|
|
74
|
+
|
|
75
|
+
content: string
|
|
76
|
+
|
|
77
|
+
editedAt?: DateTime
|
|
78
|
+
deletedAt?: DateTime
|
|
79
|
+
|
|
80
|
+
# Denormalized — bumped by send_message handler when a reply is created.
|
|
81
|
+
# Keeps the parent row paginatable without a per-message COUNT scan.
|
|
82
|
+
replyCount: u32
|
|
83
|
+
|
|
84
|
+
@@index([channelId])
|
|
85
|
+
@@index([dmRoomId])
|
|
86
|
+
@@index([parentMessageId])
|
|
87
|
+
@@index([senderId])
|
|
88
|
+
@@search([content])
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
# Per-user emoji reaction on a message. Discord-style counts are computed from
|
|
92
|
+
# these rows at read time; one user can react once per emoji per message.
|
|
93
|
+
entity MessageReaction {
|
|
94
|
+
id: ulid
|
|
95
|
+
createdAt: DateTime @default(now())
|
|
96
|
+
updatedAt: DateTime @updatedAt
|
|
97
|
+
messageId: string
|
|
98
|
+
emoji: string
|
|
99
|
+
userId: string
|
|
100
|
+
|
|
101
|
+
@@unique([messageId, emoji, userId])
|
|
102
|
+
@@index([messageId])
|
|
103
|
+
@@index([userId])
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
# Per-(user, scope) read pointer.
|
|
107
|
+
#
|
|
108
|
+
# scopeKey is "channel:<channel_id>" or "dm:<dm_room_id>" — collapses the two
|
|
109
|
+
# parallel scope fields into a single composite-uniqueable key. Two parallel
|
|
110
|
+
# @@unique constraints on nullable cols aren't currently exercised by NBT
|
|
111
|
+
# codegen, so this is the safe shape.
|
|
112
|
+
#
|
|
113
|
+
# lastReadMessageId is a ULID; ULIDs sort lexicographically by creation time
|
|
114
|
+
# so "msg.id > lastReadMessageId" (string compare) cleanly answers "unread?".
|
|
115
|
+
entity ChatReadState {
|
|
116
|
+
id: ulid
|
|
117
|
+
createdAt: DateTime @default(now())
|
|
118
|
+
updatedAt: DateTime @updatedAt
|
|
119
|
+
userId: string
|
|
120
|
+
scopeKey: string
|
|
121
|
+
scopeType: string
|
|
122
|
+
scopeId: string
|
|
123
|
+
|
|
124
|
+
lastReadMessageId: string
|
|
125
|
+
lastReadAt: DateTime @default(now())
|
|
126
|
+
|
|
127
|
+
@@unique([userId, scopeKey])
|
|
128
|
+
@@index([userId])
|
|
129
|
+
@@index([scopeKey])
|
|
130
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
migration initial {
|
|
2
|
+
add_entity Contact
|
|
3
|
+
add_field Contact firstName string default("")
|
|
4
|
+
add_field Contact lastName string default("")
|
|
5
|
+
add_field Contact fullName string default("")
|
|
6
|
+
add_field Contact phone string default("")
|
|
7
|
+
add_field Contact mobile string default("")
|
|
8
|
+
add_field Contact email string default("")
|
|
9
|
+
add_field Contact address string default("")
|
|
10
|
+
add_field Contact fullAddress string default("")
|
|
11
|
+
add_field Contact postalCode string default("")
|
|
12
|
+
add_field Contact city string default("")
|
|
13
|
+
add_field Contact stateOrProvince string default("")
|
|
14
|
+
add_field Contact country string default("")
|
|
15
|
+
add_field Contact timezone string default("")
|
|
16
|
+
add_field Contact lat float default(0)
|
|
17
|
+
add_field Contact lon float default(0)
|
|
18
|
+
add_field Contact company string default("")
|
|
19
|
+
add_field Contact website string default("")
|
|
20
|
+
add_field Contact title string default("")
|
|
21
|
+
add_field Contact industry string default("")
|
|
22
|
+
add_field Contact source string default("")
|
|
23
|
+
add_field Contact notes string default("")
|
|
24
|
+
add_field Contact data document default(0)
|
|
25
|
+
add_field Contact customData document default(0)
|
|
26
|
+
add_entity Deal
|
|
27
|
+
add_field Deal name string default("")
|
|
28
|
+
add_field Deal contact Contact default(0)
|
|
29
|
+
add_field Deal value float default(0)
|
|
30
|
+
add_field Deal currency string default("")
|
|
31
|
+
add_field Deal type string default("")
|
|
32
|
+
add_field Deal stage string default("")
|
|
33
|
+
add_field Deal pipeline Pipeline default(0)
|
|
34
|
+
add_field Deal pipelineStage PipelineStage default(0)
|
|
35
|
+
add_field Deal data document default(0)
|
|
36
|
+
add_field Deal customData document default(0)
|
|
37
|
+
add_entity Pipeline
|
|
38
|
+
add_field Pipeline name string default("")
|
|
39
|
+
add_field Pipeline description string default("")
|
|
40
|
+
add_field Pipeline stages PipelineStage default(0)
|
|
41
|
+
add_field Pipeline deals Deal default(0)
|
|
42
|
+
add_entity PipelineStage
|
|
43
|
+
add_field PipelineStage name string default("")
|
|
44
|
+
add_field PipelineStage order u32 default(0)
|
|
45
|
+
add_field PipelineStage pipeline Pipeline default(0)
|
|
46
|
+
add_field PipelineStage deals Deal default(0)
|
|
47
|
+
add_entity PipelineStageTransition
|
|
48
|
+
add_field PipelineStageTransition fromPipelineId u64 default(0)
|
|
49
|
+
add_field PipelineStageTransition toPipelineId u64 default(0)
|
|
50
|
+
add_field PipelineStageTransition fromStageId u64 default(0)
|
|
51
|
+
add_field PipelineStageTransition toStageId u64 default(0)
|
|
52
|
+
add_field PipelineStageTransition movedBy User default(0)
|
|
53
|
+
add_index PipelineStageTransition [fromPipelineId, toPipelineId, fromStageId, toStageId]
|
|
54
|
+
add_entity User
|
|
55
|
+
add_field User name string default("")
|
|
56
|
+
add_field User username string default("")
|
|
57
|
+
add_field User email string default("")
|
|
58
|
+
add_field User emailVerified bool default(false)
|
|
59
|
+
add_field User externalId string default("")
|
|
60
|
+
add_field User capsVersion u32 default(0)
|
|
61
|
+
add_index User [email]
|
|
62
|
+
add_index User [externalId]
|
|
63
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
entity Contact {
|
|
2
|
+
firstName?: string
|
|
3
|
+
lastName?: string
|
|
4
|
+
fullName?: string
|
|
5
|
+
phone?: string
|
|
6
|
+
mobile?: string
|
|
7
|
+
email?: string
|
|
8
|
+
address?: string
|
|
9
|
+
fullAddress?: string
|
|
10
|
+
postalCode?: string
|
|
11
|
+
city?: string
|
|
12
|
+
stateOrProvince?: string
|
|
13
|
+
country?: string
|
|
14
|
+
timezone?: string
|
|
15
|
+
lat?: float
|
|
16
|
+
lon?: float
|
|
17
|
+
company?: string
|
|
18
|
+
website?: string
|
|
19
|
+
title?: string
|
|
20
|
+
industry?: string
|
|
21
|
+
source?: string
|
|
22
|
+
notes?: string
|
|
23
|
+
data: document
|
|
24
|
+
customData: document
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
entity Deal {
|
|
28
|
+
name: string
|
|
29
|
+
contact: Contact
|
|
30
|
+
value?: float
|
|
31
|
+
currency?: string
|
|
32
|
+
type?: string
|
|
33
|
+
stage?: string
|
|
34
|
+
pipeline?: Pipeline
|
|
35
|
+
pipelineStage?: PipelineStage
|
|
36
|
+
data: document
|
|
37
|
+
customData: document
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
entity Pipeline {
|
|
41
|
+
name: string
|
|
42
|
+
description?: string
|
|
43
|
+
stages: PipelineStage
|
|
44
|
+
deals: Deal
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
entity PipelineStage {
|
|
48
|
+
name: string
|
|
49
|
+
order: u32
|
|
50
|
+
pipeline: Pipeline
|
|
51
|
+
deals: Deal
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
entity PipelineStageTransition {
|
|
55
|
+
fromPipelineId?: u64
|
|
56
|
+
toPipelineId: u64
|
|
57
|
+
fromStageId?: u64
|
|
58
|
+
toStageId: u64
|
|
59
|
+
movedBy?: User
|
|
60
|
+
@@index([fromPipelineId, toPipelineId, fromStageId, toStageId])
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
entity User {
|
|
64
|
+
name: string
|
|
65
|
+
username?: string
|
|
66
|
+
email?: string
|
|
67
|
+
emailVerified: bool
|
|
68
|
+
externalId?: string
|
|
69
|
+
capsVersion: u32
|
|
70
|
+
@@index([email])
|
|
71
|
+
@@index([externalId])
|
|
72
|
+
}
|
|
73
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
migration schema_update {
|
|
2
|
+
add_entity Outcome
|
|
3
|
+
add_field Outcome appointmentId string default("")
|
|
4
|
+
add_field Outcome rating float default(0)
|
|
5
|
+
add_field Outcome status string default("")
|
|
6
|
+
add_field Outcome notes string default("")
|
|
7
|
+
add_field Outcome recordedAt DateTime default(0)
|
|
8
|
+
add_index Outcome [appointmentId]
|
|
9
|
+
add_field Deal status string default("")
|
|
10
|
+
add_field Deal appointmentId string default("")
|
|
11
|
+
add_field Deal totalContractPrice float default(0)
|
|
12
|
+
add_field Deal closedDate DateTime default(0)
|
|
13
|
+
}
|
package/vendor/linux-x64/cartridges/crm/migrations/20260513151050_schema_update/schema_snapshot.nbt
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
entity Contact {
|
|
2
|
+
firstName?: string
|
|
3
|
+
lastName?: string
|
|
4
|
+
fullName?: string
|
|
5
|
+
phone?: string
|
|
6
|
+
mobile?: string
|
|
7
|
+
email?: string
|
|
8
|
+
address?: string
|
|
9
|
+
fullAddress?: string
|
|
10
|
+
postalCode?: string
|
|
11
|
+
city?: string
|
|
12
|
+
stateOrProvince?: string
|
|
13
|
+
country?: string
|
|
14
|
+
timezone?: string
|
|
15
|
+
lat?: float
|
|
16
|
+
lon?: float
|
|
17
|
+
company?: string
|
|
18
|
+
website?: string
|
|
19
|
+
title?: string
|
|
20
|
+
industry?: string
|
|
21
|
+
source?: string
|
|
22
|
+
notes?: string
|
|
23
|
+
data: document
|
|
24
|
+
customData: document
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
entity Outcome {
|
|
28
|
+
appointmentId: string
|
|
29
|
+
rating?: float
|
|
30
|
+
status?: string
|
|
31
|
+
notes?: string
|
|
32
|
+
recordedAt: DateTime
|
|
33
|
+
@@index([appointmentId])
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
entity Deal {
|
|
37
|
+
name: string
|
|
38
|
+
contact: Contact
|
|
39
|
+
value?: float
|
|
40
|
+
currency?: string
|
|
41
|
+
type?: string
|
|
42
|
+
stage?: string
|
|
43
|
+
pipeline?: Pipeline
|
|
44
|
+
pipelineStage?: PipelineStage
|
|
45
|
+
data: document
|
|
46
|
+
customData: document
|
|
47
|
+
status?: string
|
|
48
|
+
appointmentId?: string
|
|
49
|
+
totalContractPrice?: float
|
|
50
|
+
closedDate?: DateTime
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
entity Pipeline {
|
|
54
|
+
name: string
|
|
55
|
+
description?: string
|
|
56
|
+
stages: PipelineStage
|
|
57
|
+
deals: Deal
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
entity PipelineStage {
|
|
61
|
+
name: string
|
|
62
|
+
order: u32
|
|
63
|
+
pipeline: Pipeline
|
|
64
|
+
deals: Deal
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
entity PipelineStageTransition {
|
|
68
|
+
fromPipelineId?: u64
|
|
69
|
+
toPipelineId: u64
|
|
70
|
+
fromStageId?: u64
|
|
71
|
+
toStageId: u64
|
|
72
|
+
movedBy?: User
|
|
73
|
+
@@index([fromPipelineId, toPipelineId, fromStageId, toStageId])
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
entity User {
|
|
77
|
+
name: string
|
|
78
|
+
username?: string
|
|
79
|
+
email?: string
|
|
80
|
+
emailVerified: bool
|
|
81
|
+
externalId?: string
|
|
82
|
+
capsVersion: u32
|
|
83
|
+
@@index([email])
|
|
84
|
+
@@index([externalId])
|
|
85
|
+
}
|
|
86
|
+
|