@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.
Files changed (145) hide show
  1. package/LICENSE +177 -21
  2. package/README.md +16 -13
  3. package/TRADEMARKS.md +49 -0
  4. package/dist/nbt.js +398 -19
  5. package/package.json +5 -4
  6. package/stdlib/auth/README.md +83 -0
  7. package/stdlib/auth/migrations/20260424144652_initial/migration.nbt +48 -0
  8. package/stdlib/auth/migrations/20260424144652_initial/schema_snapshot.nbt +58 -0
  9. package/stdlib/auth/migrations/20260521191014_update_user/migration.nbt +3 -0
  10. package/stdlib/auth/migrations/20260521191014_update_user/schema_snapshot.nbt +59 -0
  11. package/stdlib/auth/schema.nbt +142 -0
  12. package/stdlib/calendar/adapters/gohighlevel/tests/fixtures/v2_calendar_pilot.json +12 -0
  13. package/stdlib/calendar/adapters/gohighlevel/tests/fixtures/webhooks/appointment_changed.json +70 -0
  14. package/stdlib/calendar/adapters/gohighlevel/tests/fixtures/webhooks/appointment_created.json +72 -0
  15. package/stdlib/calendar/migrations/20260501210107_initial/migration.nbt +60 -0
  16. package/stdlib/calendar/migrations/20260501210107_initial/schema_snapshot.nbt +66 -0
  17. package/stdlib/calendar/migrations/20260513151050_schema_update/migration.nbt +17 -0
  18. package/stdlib/calendar/migrations/20260513151050_schema_update/schema_snapshot.nbt +83 -0
  19. package/stdlib/calendar/schema.nbt +86 -0
  20. package/stdlib/chat/migrations/20260429222411_initial/migration.nbt +59 -0
  21. package/stdlib/chat/migrations/20260429222411_initial/schema_snapshot.nbt +71 -0
  22. package/stdlib/chat/migrations/20260430185225_add_messagereaction/migration.nbt +9 -0
  23. package/stdlib/chat/migrations/20260430185225_add_messagereaction/schema_snapshot.nbt +78 -0
  24. package/stdlib/chat/migrations/20260518191152_update_message/migration.nbt +3 -0
  25. package/stdlib/chat/migrations/20260518191152_update_message/schema_snapshot.nbt +81 -0
  26. package/stdlib/chat/schema.nbt +130 -0
  27. package/stdlib/crm/adapters/gohighlevel/README.md +85 -0
  28. package/stdlib/crm/adapters/gohighlevel/tests/README.md +159 -0
  29. package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/contact_138fields.json +222 -0
  30. package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/contact_140fields.json +219 -0
  31. package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/contact_alt.json +212 -0
  32. package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/contact_changed.json +102 -0
  33. package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/contact_created.json +95 -0
  34. package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/contact_full.json +213 -0
  35. package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/contact_sparse.json +161 -0
  36. package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/contact_update_a.json +197 -0
  37. package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/contact_update_b.json +197 -0
  38. package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/opportunity_changed.json +85 -0
  39. package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/opportunity_created.json +85 -0
  40. package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/v2_contact_pilot.json +43 -0
  41. package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/v2_contact_with_price_closed.json +7 -0
  42. package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/v2_contact_with_price_open.json +7 -0
  43. package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/v2_event_appointment_delete.json +1 -0
  44. package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/v2_event_calendar_update.json +1 -0
  45. package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/v2_event_contact_create.json +1 -0
  46. package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/v2_event_opp_status_update.json +1 -0
  47. package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/v2_opportunity_pilot.json +16 -0
  48. package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/v2_pipelines_pilot.json +137 -0
  49. package/stdlib/crm/migrations/20260501210107_initial/migration.nbt +63 -0
  50. package/stdlib/crm/migrations/20260501210107_initial/schema_snapshot.nbt +73 -0
  51. package/stdlib/crm/migrations/20260513151050_schema_update/migration.nbt +13 -0
  52. package/stdlib/crm/migrations/20260513151050_schema_update/schema_snapshot.nbt +86 -0
  53. package/stdlib/crm/schema.nbt +148 -0
  54. package/stdlib/design/migrations/20260501210107_initial/migration.nbt +19 -0
  55. package/stdlib/design/migrations/20260501210107_initial/schema_snapshot.nbt +21 -0
  56. package/stdlib/design/migrations/20260610130000_design_system/migration.nbt +50 -0
  57. package/stdlib/design/migrations/20260610130000_design_system/schema_snapshot.nbt +80 -0
  58. package/stdlib/design/schema.nbt +140 -0
  59. package/stdlib/dns/migrations/20260501210107_initial/migration.nbt +32 -0
  60. package/stdlib/dns/migrations/20260501210107_initial/schema_snapshot.nbt +36 -0
  61. package/stdlib/dns/schema.nbt +68 -0
  62. package/stdlib/email/migrations/20260427235207_initial/migration.nbt +75 -0
  63. package/stdlib/email/migrations/20260427235207_initial/schema_snapshot.nbt +87 -0
  64. package/stdlib/email/schema.nbt +145 -0
  65. package/stdlib/ingest/README.md +29 -0
  66. package/stdlib/ingest/migrations/20260424144652_initial/migration.nbt +18 -0
  67. package/stdlib/ingest/migrations/20260424144652_initial/schema_snapshot.nbt +20 -0
  68. package/stdlib/ingest/migrations/20260429203747_schema_update/migration.nbt +3 -0
  69. package/stdlib/ingest/migrations/20260429203747_schema_update/schema_snapshot.nbt +21 -0
  70. package/stdlib/ingest/schema.nbt +37 -0
  71. package/stdlib/notifications/README.md +118 -0
  72. package/stdlib/notifications/migrations/20260430204408_initial/migration.nbt +42 -0
  73. package/stdlib/notifications/migrations/20260430204408_initial/schema_snapshot.nbt +46 -0
  74. package/stdlib/notifications/schema.nbt +67 -0
  75. package/stdlib/phone/migrations/20260605205722_initial/migration.nbt +50 -0
  76. package/stdlib/phone/migrations/20260605205722_initial/schema_snapshot.nbt +56 -0
  77. package/stdlib/phone/schema.nbt +95 -0
  78. package/stdlib/registry/migrations/20260602181932_initial/migration.nbt +8 -0
  79. package/stdlib/registry/migrations/20260602181932_initial/schema_snapshot.nbt +8 -0
  80. package/stdlib/registry/schema.nbt +20 -0
  81. package/stdlib/workflows/schema.nbt +44 -0
  82. package/vendor/linux-x64/cartridges/auth/migrations/20260424144652_initial/migration.nbt +48 -0
  83. package/vendor/linux-x64/cartridges/auth/migrations/20260424144652_initial/schema_snapshot.nbt +58 -0
  84. package/vendor/linux-x64/cartridges/auth/migrations/20260521191014_update_user/migration.nbt +3 -0
  85. package/vendor/linux-x64/cartridges/auth/migrations/20260521191014_update_user/schema_snapshot.nbt +59 -0
  86. package/vendor/linux-x64/cartridges/auth/schema.nbt +142 -0
  87. package/vendor/linux-x64/cartridges/calendar/migrations/20260501210107_initial/migration.nbt +60 -0
  88. package/vendor/linux-x64/cartridges/calendar/migrations/20260501210107_initial/schema_snapshot.nbt +66 -0
  89. package/vendor/linux-x64/cartridges/calendar/migrations/20260513151050_schema_update/migration.nbt +17 -0
  90. package/vendor/linux-x64/cartridges/calendar/migrations/20260513151050_schema_update/schema_snapshot.nbt +83 -0
  91. package/vendor/linux-x64/cartridges/calendar/schema.nbt +86 -0
  92. package/vendor/linux-x64/cartridges/chat/migrations/20260429222411_initial/migration.nbt +59 -0
  93. package/vendor/linux-x64/cartridges/chat/migrations/20260429222411_initial/schema_snapshot.nbt +71 -0
  94. package/vendor/linux-x64/cartridges/chat/migrations/20260430185225_add_messagereaction/migration.nbt +9 -0
  95. package/vendor/linux-x64/cartridges/chat/migrations/20260430185225_add_messagereaction/schema_snapshot.nbt +78 -0
  96. package/vendor/linux-x64/cartridges/chat/migrations/20260518191152_update_message/migration.nbt +3 -0
  97. package/vendor/linux-x64/cartridges/chat/migrations/20260518191152_update_message/schema_snapshot.nbt +81 -0
  98. package/vendor/linux-x64/cartridges/chat/schema.nbt +130 -0
  99. package/vendor/linux-x64/cartridges/crm/migrations/20260501210107_initial/migration.nbt +63 -0
  100. package/vendor/linux-x64/cartridges/crm/migrations/20260501210107_initial/schema_snapshot.nbt +73 -0
  101. package/vendor/linux-x64/cartridges/crm/migrations/20260513151050_schema_update/migration.nbt +13 -0
  102. package/vendor/linux-x64/cartridges/crm/migrations/20260513151050_schema_update/schema_snapshot.nbt +86 -0
  103. package/vendor/linux-x64/cartridges/crm/schema.nbt +148 -0
  104. package/vendor/linux-x64/cartridges/design/migrations/20260501210107_initial/migration.nbt +19 -0
  105. package/vendor/linux-x64/cartridges/design/migrations/20260501210107_initial/schema_snapshot.nbt +21 -0
  106. package/vendor/linux-x64/cartridges/design/migrations/20260610130000_design_system/migration.nbt +50 -0
  107. package/vendor/linux-x64/cartridges/design/migrations/20260610130000_design_system/schema_snapshot.nbt +80 -0
  108. package/vendor/linux-x64/cartridges/design/schema.nbt +140 -0
  109. package/vendor/linux-x64/cartridges/dns/migrations/20260501210107_initial/migration.nbt +32 -0
  110. package/vendor/linux-x64/cartridges/dns/migrations/20260501210107_initial/schema_snapshot.nbt +36 -0
  111. package/vendor/linux-x64/cartridges/dns/schema.nbt +68 -0
  112. package/vendor/linux-x64/cartridges/email/migrations/20260427235207_initial/migration.nbt +75 -0
  113. package/vendor/linux-x64/cartridges/email/migrations/20260427235207_initial/schema_snapshot.nbt +87 -0
  114. package/vendor/linux-x64/cartridges/email/schema.nbt +145 -0
  115. package/vendor/linux-x64/cartridges/ingest/migrations/20260424144652_initial/migration.nbt +18 -0
  116. package/vendor/linux-x64/cartridges/ingest/migrations/20260424144652_initial/schema_snapshot.nbt +20 -0
  117. package/vendor/linux-x64/cartridges/ingest/migrations/20260429203747_schema_update/migration.nbt +3 -0
  118. package/vendor/linux-x64/cartridges/ingest/migrations/20260429203747_schema_update/schema_snapshot.nbt +21 -0
  119. package/vendor/linux-x64/cartridges/ingest/schema.nbt +37 -0
  120. package/vendor/linux-x64/cartridges/notifications/migrations/20260430204408_initial/migration.nbt +42 -0
  121. package/vendor/linux-x64/cartridges/notifications/migrations/20260430204408_initial/schema_snapshot.nbt +46 -0
  122. package/vendor/linux-x64/cartridges/notifications/schema.nbt +67 -0
  123. package/vendor/linux-x64/cartridges/phone/migrations/20260605205722_initial/migration.nbt +50 -0
  124. package/vendor/linux-x64/cartridges/phone/migrations/20260605205722_initial/schema_snapshot.nbt +56 -0
  125. package/vendor/linux-x64/cartridges/phone/schema.nbt +95 -0
  126. package/vendor/linux-x64/cartridges/registry/migrations/20260602181932_initial/migration.nbt +8 -0
  127. package/vendor/linux-x64/cartridges/registry/migrations/20260602181932_initial/schema_snapshot.nbt +8 -0
  128. package/vendor/linux-x64/cartridges/registry/schema.nbt +20 -0
  129. package/vendor/linux-x64/cartridges/workflows/schema.nbt +44 -0
  130. package/vendor/linux-x64/console +0 -0
  131. package/vendor/linux-x64/nbt +0 -0
  132. package/contracts/audit/.dist/contract.json +0 -56
  133. package/contracts/auth/.dist/contract.json +0 -252
  134. package/contracts/calendar/.dist/contract.json +0 -141
  135. package/contracts/chat/.dist/contract.json +0 -229
  136. package/contracts/crm/.dist/contract.json +0 -239
  137. package/contracts/design/.dist/contract.json +0 -85
  138. package/contracts/dns/.dist/contract.json +0 -123
  139. package/contracts/email/.dist/contract.json +0 -267
  140. package/contracts/embed/.dist/contract.json +0 -137
  141. package/contracts/ingest/.dist/contract.json +0 -86
  142. package/contracts/notifications/.dist/contract.json +0 -133
  143. package/contracts/phone/.dist/contract.json +0 -168
  144. package/contracts/registry/.dist/contract.json +0 -49
  145. package/contracts/workflows/.dist/contract.json +0 -106
@@ -0,0 +1,137 @@
1
+ {
2
+ "pipelines": [
3
+ {
4
+ "id": "UxTCmFzbqr6IxQAIXqnD",
5
+ "name": "MLP SM Pipeline",
6
+ "opportunityCount": 12,
7
+ "stages": [
8
+ {
9
+ "id": "64cd63b4-bdc4-48c6-a58f-33f0ae4066fb",
10
+ "name": "Hot Leads (First 48 Hours)"
11
+ },
12
+ {
13
+ "id": "fb7c6191-ec24-435f-b61a-ec721c0aa513",
14
+ "name": "Warm Leads (Day 3-10)"
15
+ },
16
+ {
17
+ "id": "e78b46a1-0da9-496f-a8f1-1d4eca89d3a7",
18
+ "name": "Cool Leads (Day 10+)"
19
+ },
20
+ {
21
+ "id": "ae0e6d15-7556-4dbe-81bb-9154f29cbdc4",
22
+ "name": "Lead Replied"
23
+ },
24
+ {
25
+ "id": "17a4170c-3841-4901-9232-7be58f875319",
26
+ "name": "Currently Working"
27
+ },
28
+ {
29
+ "id": "811da9ed-4b67-47ac-8d58-1ef7f43d0ba9",
30
+ "name": "Workflow Reentry"
31
+ },
32
+ {
33
+ "id": "aeaecfd9-2c51-49cc-9aa8-d341a84c8d3d",
34
+ "name": "Discovery Call on Funnel"
35
+ },
36
+ {
37
+ "id": "14787095-0a31-4067-b7fd-f4ab785c3bcc",
38
+ "name": "Appointment Set"
39
+ },
40
+ {
41
+ "id": "f67e73cf-84e3-4dee-b6a0-91d913ff949c",
42
+ "name": "Task Set"
43
+ },
44
+ {
45
+ "id": "db326b60-09ad-42d4-81b6-303ee42fd6af",
46
+ "name": "Never Responded"
47
+ },
48
+ {
49
+ "id": "faa35266-9b4c-48b3-8438-9f2d782ce7b2",
50
+ "name": "Disqualified"
51
+ },
52
+ {
53
+ "id": "814e0795-abcc-46de-8256-631a93102c61",
54
+ "name": "Not Interested"
55
+ }
56
+ ]
57
+ },
58
+ {
59
+ "id": "286FgIGF2NMRoTJS4o5z",
60
+ "name": "Rehash Lori & Susan",
61
+ "opportunityCount": 3107,
62
+ "stages": [
63
+ {
64
+ "id": "5dbe3b2d-1e6b-47a7-a7b7-39e9336eae76",
65
+ "name": "No Show"
66
+ },
67
+ {
68
+ "id": "29c54677-e7f0-4715-a3fb-5025b7b00f6a",
69
+ "name": "Needs to Reschedule"
70
+ },
71
+ {
72
+ "id": "010541a1-220e-4715-9143-a04e27f90cfe",
73
+ "name": "Appointment Refused"
74
+ },
75
+ {
76
+ "id": "3e3dbf3c-cfc9-40a8-b48d-f14c46b7c9d3",
77
+ "name": "Appointment Reset"
78
+ }
79
+ ]
80
+ },
81
+ {
82
+ "id": "Rz9YDTwgtB7oZSEnr7Q0",
83
+ "name": "MLP Skynet Pipeline",
84
+ "opportunityCount": 212,
85
+ "stages": [
86
+ {
87
+ "id": "e3b2b805-4377-4591-a2db-af013d4a1989",
88
+ "name": "Hot Leads (First 48 Hours)"
89
+ },
90
+ {
91
+ "id": "5799baa2-4c47-4715-a509-b4bde322b8b6",
92
+ "name": "Warm Leads (Day 3-10)"
93
+ },
94
+ {
95
+ "id": "39f0bc73-9d2e-43ba-a196-97913f1134e3",
96
+ "name": "Cool Leads (Day 10+)"
97
+ },
98
+ {
99
+ "id": "25cbf317-87fe-4b17-b643-5cfc8e03a3c3",
100
+ "name": "Lead Replied"
101
+ },
102
+ {
103
+ "id": "6dbf45fa-1f35-4c41-9887-4813043f9f9d",
104
+ "name": "Currently Working"
105
+ },
106
+ {
107
+ "id": "76b07f0d-df0f-4c32-bfd5-b225a7b38503",
108
+ "name": "Workflow Reentry"
109
+ },
110
+ {
111
+ "id": "880c1db8-67ef-41bb-bbb9-43060daea2c4",
112
+ "name": "Discovery Call on Funnel"
113
+ },
114
+ {
115
+ "id": "a38d3706-8bed-4bc1-b957-b5fc2ab9cf22",
116
+ "name": "Appointment Set"
117
+ },
118
+ {
119
+ "id": "a0b5b71a-2228-413c-8523-993b7d35466a",
120
+ "name": "Task Set"
121
+ },
122
+ {
123
+ "id": "731bbb26-2636-47ea-8d82-8c3d4d7a8fed",
124
+ "name": "Never Responded"
125
+ },
126
+ {
127
+ "id": "29c9c778-01f5-4c2a-82ee-b813358b893a",
128
+ "name": "Disqualified"
129
+ },
130
+ {
131
+ "id": "2a104d02-7923-4ad2-a650-ebce9b18ea44",
132
+ "name": "Not Interested"
133
+ }
134
+ ]
135
+ }
136
+ ]
137
+ }
@@ -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
+ }
@@ -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
+
@@ -0,0 +1,148 @@
1
+ import {User} from "auth";
2
+
3
+ export entity Contact {
4
+ id: ulid
5
+ createdAt: DateTime @default(now())
6
+ updatedAt: DateTime @updatedAt
7
+ firstName?: string
8
+ lastName?: string
9
+ fullName?: string
10
+
11
+ phone?: string
12
+ mobile?: string
13
+ email?: string
14
+
15
+ address?: string
16
+ fullAddress?: string
17
+ postalCode?: string
18
+ city?: string
19
+ stateOrProvince?: string
20
+ country?: string
21
+ timezone?: string
22
+
23
+ lat?: float
24
+ lon?: float
25
+
26
+ company?: string
27
+ website?: string
28
+ title?: string
29
+ industry?: string
30
+ source?: string
31
+ notes?: string
32
+
33
+ # custom client usecase specific data goes here
34
+ # for mylocalpro currently custom stuff is:
35
+ # * location deemed insufficient
36
+ data: document
37
+ customData: document
38
+
39
+ deals: Deal[]
40
+ }
41
+
42
+ # Generic per-appointment lifecycle outcome — neutral over customer domain.
43
+ # Customers project their domain-specific outcome into the (rating, status)
44
+ # pair: solar deployments record `status="won"|"lost"`, therapy clinics
45
+ # record `rating: 1..5`, field-service deployments record both. The
46
+ # `outcomeClass` mapping that drives similarity-weighted aggregation lives
47
+ # in each customer's own lifecycle logic, not on this entity.
48
+ export entity Outcome {
49
+ id: ulid
50
+ createdAt: DateTime @default(now())
51
+ updatedAt: DateTime @updatedAt
52
+ appointmentId: string
53
+ rating?: float
54
+ status?: string
55
+ notes?: string
56
+ recordedAt: DateTime @default(now())
57
+
58
+ @@index([appointmentId])
59
+ }
60
+
61
+ export entity Deal {
62
+ id: ulid
63
+ createdAt: DateTime @default(now())
64
+ updatedAt: DateTime @updatedAt
65
+ name: string
66
+ contact: Contact
67
+ value?: float
68
+ currency?: string
69
+ type?: string
70
+
71
+ stage?: string
72
+
73
+ pipeline?: Pipeline
74
+ pipelineStage?: PipelineStage
75
+
76
+ data: document
77
+ customData: document
78
+
79
+ # Append-only suffix — fields below this comment must stay at the end
80
+ # of the entity declaration. Codegen serializes in declaration order;
81
+ # newly-added fields go *after* existing fields so the on-disk byte
82
+ # layout stays forward-compatible (old records deserialize cleanly with
83
+ # trailing fields default-initialised). See the EOF-tolerant deserialize
84
+ # codegen in modules/nbt/codegen_serial.jai.
85
+
86
+ # D09.02 — generic lifecycle status, customer-domain. mylocalpro reacts
87
+ # to `deal.status == "won"` to mark the source Appointment positive.
88
+ status?: string
89
+
90
+ # D09.02 — optional back-reference to the Appointment this Deal
91
+ # originated from. Plain string id (not a relation) so webhook ingest
92
+ # can set it without requiring the Appointment row to exist yet.
93
+ appointmentId?: string
94
+
95
+ # Total contract price for the deal (USD). Resolved at GHL adapter
96
+ # ingest from Contact custom field "Total Contract Price" via
97
+ # CONTACT_LATEST_OPEN_DEAL Field_Mapping resolver. Closed deals lock —
98
+ # adapter writes to status ∈ {won, lost} are rejected to preserve
99
+ # historical pricing without double-storing.
100
+ totalContractPrice?: float
101
+
102
+ # Date the deal closed (won or lost). Resolved at GHL adapter ingest
103
+ # from Contact custom field "Date Sold" via CONTACT_LATEST_OPEN_DEAL.
104
+ # Append-only field — codegen serializes in declaration order, so
105
+ # existing rows deserialize cleanly with this trailing default.
106
+ closedDate?: DateTime
107
+ }
108
+
109
+ entity Pipeline {
110
+ id: ulid
111
+ createdAt: DateTime @default(now())
112
+ updatedAt: DateTime @updatedAt
113
+ name: string
114
+ description?: string
115
+ stages: PipelineStage[]
116
+
117
+ deals: Deal[]
118
+ }
119
+
120
+ entity PipelineStage {
121
+ id: ulid
122
+ createdAt: DateTime @default(now())
123
+ updatedAt: DateTime @updatedAt
124
+ name: string
125
+ order: u32
126
+ pipeline: Pipeline @relation(onDelete: Cascade) # stages are owned by their pipeline
127
+
128
+ deals: Deal[]
129
+ }
130
+
131
+ entity PipelineStageTransition {
132
+ id: ulid
133
+ createdAt: DateTime @default(now())
134
+ updatedAt: DateTime @updatedAt
135
+ # updatedAt is added automatically but means nothing since these are immutable
136
+ # createdAt is equivalent to movedAt
137
+
138
+ fromPipelineId?: string
139
+ toPipelineId: string
140
+
141
+ fromStageId?: string
142
+ toStageId: string
143
+
144
+ movedBy?: User @relation(onDelete: SetNull)
145
+
146
+ @@index([fromPipelineId, toPipelineId, fromStageId, toStageId])
147
+ }
148
+
@@ -0,0 +1,19 @@
1
+ migration initial {
2
+ add_entity Design
3
+ add_field Design name string default("")
4
+ add_field Design slug string default("")
5
+ add_field Design description string default("")
6
+ add_field Design headVersionId string default("")
7
+ add_field Design headVersion u32 default(0)
8
+ add_unique Design [slug]
9
+ add_entity DesignVersion
10
+ add_field DesignVersion designId string default("")
11
+ add_field DesignVersion version u32 default(0)
12
+ add_field DesignVersion body document default(0)
13
+ add_field DesignVersion source string default("")
14
+ add_field DesignVersion note string default("")
15
+ add_field DesignVersion createdBy string default("")
16
+ add_field DesignVersion parseErrors string default("")
17
+ add_index DesignVersion [designId]
18
+ add_unique DesignVersion [designId, version]
19
+ }
@@ -0,0 +1,21 @@
1
+ entity Design {
2
+ name: string
3
+ slug: string
4
+ description: string
5
+ headVersionId: string
6
+ headVersion: u32
7
+ @@unique([slug])
8
+ }
9
+
10
+ entity DesignVersion {
11
+ designId: string
12
+ version: u32
13
+ body: document
14
+ source: string
15
+ note: string
16
+ createdBy: string
17
+ parseErrors: string
18
+ @@index([designId])
19
+ @@unique([designId, version])
20
+ }
21
+
@@ -0,0 +1,50 @@
1
+ migration design_system {
2
+ add_field Design designerId string default("")
3
+ add_entity Designer
4
+ add_field Designer name string default("")
5
+ add_field Designer handle string default("")
6
+ add_field Designer url string default("")
7
+ add_field Designer bio string default("")
8
+ add_unique Designer [handle]
9
+ add_entity Token
10
+ add_field Token designId string default("")
11
+ add_field Token name string default("")
12
+ add_field Token kind string default("")
13
+ add_field Token value string default("")
14
+ add_field Token darkValue string default("")
15
+ add_index Token [designId]
16
+ add_unique Token [designId, name]
17
+ add_entity Component
18
+ add_field Component designId string default("")
19
+ add_field Component name string default("")
20
+ add_field Component version u32 default(0)
21
+ add_field Component designerId string default("")
22
+ add_field Component propsSpec string default("")
23
+ add_field Component notes string default("")
24
+ add_index Component [designId]
25
+ add_unique Component [designId, name]
26
+ add_entity Block
27
+ add_field Block designId string default("")
28
+ add_field Block name string default("")
29
+ add_field Block version u32 default(0)
30
+ add_field Block designerId string default("")
31
+ add_field Block components string default("")
32
+ add_field Block slotsSpec string default("")
33
+ add_field Block defaults string default("")
34
+ add_index Block [designId]
35
+ add_unique Block [designId, name]
36
+ add_entity Rule
37
+ add_field Rule designId string default("")
38
+ add_field Rule subject string default("")
39
+ add_field Rule kind string default("")
40
+ add_field Rule rule string default("")
41
+ add_field Rule note string default("")
42
+ add_index Rule [designId]
43
+ add_entity Page
44
+ add_field Page designId string default("")
45
+ add_field Page slug string default("")
46
+ add_field Page title string default("")
47
+ add_field Page blocks string default("")
48
+ add_index Page [designId]
49
+ add_unique Page [designId, slug]
50
+ }
@@ -0,0 +1,80 @@
1
+ entity Design {
2
+ name: string
3
+ slug: string
4
+ description: string
5
+ designerId: string
6
+ headVersionId: string
7
+ headVersion: u32
8
+ @@unique([slug])
9
+ }
10
+
11
+ entity DesignVersion {
12
+ designId: string
13
+ version: u32
14
+ body: document
15
+ source: string
16
+ note: string
17
+ createdBy: string
18
+ parseErrors: string
19
+ @@index([designId])
20
+ @@unique([designId, version])
21
+ }
22
+
23
+ entity Designer {
24
+ name: string
25
+ handle: string
26
+ url: string
27
+ bio: string
28
+ @@unique([handle])
29
+ }
30
+
31
+ entity Token {
32
+ designId: string
33
+ name: string
34
+ kind: string
35
+ value: string
36
+ darkValue: string
37
+ @@index([designId])
38
+ @@unique([designId, name])
39
+ }
40
+
41
+ entity Component {
42
+ designId: string
43
+ name: string
44
+ version: u32
45
+ designerId: string
46
+ propsSpec: string
47
+ notes: string
48
+ @@index([designId])
49
+ @@unique([designId, name])
50
+ }
51
+
52
+ entity Block {
53
+ designId: string
54
+ name: string
55
+ version: u32
56
+ designerId: string
57
+ components: string
58
+ slotsSpec: string
59
+ defaults: string
60
+ @@index([designId])
61
+ @@unique([designId, name])
62
+ }
63
+
64
+ entity Rule {
65
+ designId: string
66
+ subject: string
67
+ kind: string
68
+ rule: string
69
+ note: string
70
+ @@index([designId])
71
+ }
72
+
73
+ entity Page {
74
+ designId: string
75
+ slug: string
76
+ title: string
77
+ blocks: string
78
+ @@index([designId])
79
+ @@unique([designId, slug])
80
+ }