@nbt-dev/nbt 0.0.1 → 0.0.3

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 (149) 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 +85 -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/20260514202654_update_directmessageroom/migration.nbt +4 -0
  25. package/stdlib/chat/migrations/20260514202654_update_directmessageroom/schema_snapshot.nbt +80 -0
  26. package/stdlib/chat/migrations/20260518191152_update_message/migration.nbt +3 -0
  27. package/stdlib/chat/migrations/20260518191152_update_message/schema_snapshot.nbt +81 -0
  28. package/stdlib/chat/schema.nbt +130 -0
  29. package/stdlib/crm/adapters/gohighlevel/README.md +85 -0
  30. package/stdlib/crm/adapters/gohighlevel/tests/README.md +159 -0
  31. package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/contact_138fields.json +222 -0
  32. package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/contact_140fields.json +219 -0
  33. package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/contact_alt.json +212 -0
  34. package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/contact_changed.json +102 -0
  35. package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/contact_created.json +95 -0
  36. package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/contact_full.json +213 -0
  37. package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/contact_sparse.json +161 -0
  38. package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/contact_update_a.json +197 -0
  39. package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/contact_update_b.json +197 -0
  40. package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/opportunity_changed.json +85 -0
  41. package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/opportunity_created.json +85 -0
  42. package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/v2_contact_pilot.json +43 -0
  43. package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/v2_contact_with_price_closed.json +7 -0
  44. package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/v2_contact_with_price_open.json +7 -0
  45. package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/v2_event_appointment_delete.json +1 -0
  46. package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/v2_event_calendar_update.json +1 -0
  47. package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/v2_event_contact_create.json +1 -0
  48. package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/v2_event_opp_status_update.json +1 -0
  49. package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/v2_opportunity_pilot.json +16 -0
  50. package/stdlib/crm/adapters/gohighlevel/tests/fixtures/webhooks/v2_pipelines_pilot.json +137 -0
  51. package/stdlib/crm/migrations/20260501210107_initial/migration.nbt +63 -0
  52. package/stdlib/crm/migrations/20260501210107_initial/schema_snapshot.nbt +73 -0
  53. package/stdlib/crm/migrations/20260513151050_schema_update/migration.nbt +13 -0
  54. package/stdlib/crm/migrations/20260513151050_schema_update/schema_snapshot.nbt +86 -0
  55. package/stdlib/crm/schema.nbt +146 -0
  56. package/stdlib/design/migrations/20260501210107_initial/migration.nbt +19 -0
  57. package/stdlib/design/migrations/20260501210107_initial/schema_snapshot.nbt +21 -0
  58. package/stdlib/design/migrations/20260610130000_design_system/migration.nbt +50 -0
  59. package/stdlib/design/migrations/20260610130000_design_system/schema_snapshot.nbt +80 -0
  60. package/stdlib/design/schema.nbt +140 -0
  61. package/stdlib/dns/migrations/20260501210107_initial/migration.nbt +32 -0
  62. package/stdlib/dns/migrations/20260501210107_initial/schema_snapshot.nbt +36 -0
  63. package/stdlib/dns/schema.nbt +68 -0
  64. package/stdlib/email/migrations/20260427235207_initial/migration.nbt +75 -0
  65. package/stdlib/email/migrations/20260427235207_initial/schema_snapshot.nbt +87 -0
  66. package/stdlib/email/schema.nbt +145 -0
  67. package/stdlib/ingest/README.md +29 -0
  68. package/stdlib/ingest/migrations/20260424144652_initial/migration.nbt +18 -0
  69. package/stdlib/ingest/migrations/20260424144652_initial/schema_snapshot.nbt +20 -0
  70. package/stdlib/ingest/migrations/20260429203747_schema_update/migration.nbt +3 -0
  71. package/stdlib/ingest/migrations/20260429203747_schema_update/schema_snapshot.nbt +21 -0
  72. package/stdlib/ingest/schema.nbt +37 -0
  73. package/stdlib/notifications/README.md +118 -0
  74. package/stdlib/notifications/migrations/20260430204408_initial/migration.nbt +42 -0
  75. package/stdlib/notifications/migrations/20260430204408_initial/schema_snapshot.nbt +46 -0
  76. package/stdlib/notifications/schema.nbt +67 -0
  77. package/stdlib/phone/migrations/20260605205722_initial/migration.nbt +50 -0
  78. package/stdlib/phone/migrations/20260605205722_initial/schema_snapshot.nbt +56 -0
  79. package/stdlib/phone/schema.nbt +95 -0
  80. package/stdlib/registry/migrations/20260602181932_initial/migration.nbt +8 -0
  81. package/stdlib/registry/migrations/20260602181932_initial/schema_snapshot.nbt +8 -0
  82. package/stdlib/registry/schema.nbt +20 -0
  83. package/stdlib/workflows/schema.nbt +43 -0
  84. package/vendor/linux-x64/cartridges/auth/migrations/20260424144652_initial/migration.nbt +48 -0
  85. package/vendor/linux-x64/cartridges/auth/migrations/20260424144652_initial/schema_snapshot.nbt +58 -0
  86. package/vendor/linux-x64/cartridges/auth/migrations/20260521191014_update_user/migration.nbt +3 -0
  87. package/vendor/linux-x64/cartridges/auth/migrations/20260521191014_update_user/schema_snapshot.nbt +59 -0
  88. package/vendor/linux-x64/cartridges/auth/schema.nbt +142 -0
  89. package/vendor/linux-x64/cartridges/calendar/migrations/20260501210107_initial/migration.nbt +60 -0
  90. package/vendor/linux-x64/cartridges/calendar/migrations/20260501210107_initial/schema_snapshot.nbt +66 -0
  91. package/vendor/linux-x64/cartridges/calendar/migrations/20260513151050_schema_update/migration.nbt +17 -0
  92. package/vendor/linux-x64/cartridges/calendar/migrations/20260513151050_schema_update/schema_snapshot.nbt +83 -0
  93. package/vendor/linux-x64/cartridges/calendar/schema.nbt +85 -0
  94. package/vendor/linux-x64/cartridges/chat/migrations/20260429222411_initial/migration.nbt +59 -0
  95. package/vendor/linux-x64/cartridges/chat/migrations/20260429222411_initial/schema_snapshot.nbt +71 -0
  96. package/vendor/linux-x64/cartridges/chat/migrations/20260430185225_add_messagereaction/migration.nbt +9 -0
  97. package/vendor/linux-x64/cartridges/chat/migrations/20260430185225_add_messagereaction/schema_snapshot.nbt +78 -0
  98. package/vendor/linux-x64/cartridges/chat/migrations/20260514202654_update_directmessageroom/migration.nbt +4 -0
  99. package/vendor/linux-x64/cartridges/chat/migrations/20260514202654_update_directmessageroom/schema_snapshot.nbt +80 -0
  100. package/vendor/linux-x64/cartridges/chat/migrations/20260518191152_update_message/migration.nbt +3 -0
  101. package/vendor/linux-x64/cartridges/chat/migrations/20260518191152_update_message/schema_snapshot.nbt +81 -0
  102. package/vendor/linux-x64/cartridges/chat/schema.nbt +130 -0
  103. package/vendor/linux-x64/cartridges/crm/migrations/20260501210107_initial/migration.nbt +63 -0
  104. package/vendor/linux-x64/cartridges/crm/migrations/20260501210107_initial/schema_snapshot.nbt +73 -0
  105. package/vendor/linux-x64/cartridges/crm/migrations/20260513151050_schema_update/migration.nbt +13 -0
  106. package/vendor/linux-x64/cartridges/crm/migrations/20260513151050_schema_update/schema_snapshot.nbt +86 -0
  107. package/vendor/linux-x64/cartridges/crm/schema.nbt +146 -0
  108. package/vendor/linux-x64/cartridges/design/migrations/20260501210107_initial/migration.nbt +19 -0
  109. package/vendor/linux-x64/cartridges/design/migrations/20260501210107_initial/schema_snapshot.nbt +21 -0
  110. package/vendor/linux-x64/cartridges/design/migrations/20260610130000_design_system/migration.nbt +50 -0
  111. package/vendor/linux-x64/cartridges/design/migrations/20260610130000_design_system/schema_snapshot.nbt +80 -0
  112. package/vendor/linux-x64/cartridges/design/schema.nbt +140 -0
  113. package/vendor/linux-x64/cartridges/dns/migrations/20260501210107_initial/migration.nbt +32 -0
  114. package/vendor/linux-x64/cartridges/dns/migrations/20260501210107_initial/schema_snapshot.nbt +36 -0
  115. package/vendor/linux-x64/cartridges/dns/schema.nbt +68 -0
  116. package/vendor/linux-x64/cartridges/email/migrations/20260427235207_initial/migration.nbt +75 -0
  117. package/vendor/linux-x64/cartridges/email/migrations/20260427235207_initial/schema_snapshot.nbt +87 -0
  118. package/vendor/linux-x64/cartridges/email/schema.nbt +145 -0
  119. package/vendor/linux-x64/cartridges/ingest/migrations/20260424144652_initial/migration.nbt +18 -0
  120. package/vendor/linux-x64/cartridges/ingest/migrations/20260424144652_initial/schema_snapshot.nbt +20 -0
  121. package/vendor/linux-x64/cartridges/ingest/migrations/20260429203747_schema_update/migration.nbt +3 -0
  122. package/vendor/linux-x64/cartridges/ingest/migrations/20260429203747_schema_update/schema_snapshot.nbt +21 -0
  123. package/vendor/linux-x64/cartridges/ingest/schema.nbt +37 -0
  124. package/vendor/linux-x64/cartridges/notifications/migrations/20260430204408_initial/migration.nbt +42 -0
  125. package/vendor/linux-x64/cartridges/notifications/migrations/20260430204408_initial/schema_snapshot.nbt +46 -0
  126. package/vendor/linux-x64/cartridges/notifications/schema.nbt +67 -0
  127. package/vendor/linux-x64/cartridges/phone/migrations/20260605205722_initial/migration.nbt +50 -0
  128. package/vendor/linux-x64/cartridges/phone/migrations/20260605205722_initial/schema_snapshot.nbt +56 -0
  129. package/vendor/linux-x64/cartridges/phone/schema.nbt +95 -0
  130. package/vendor/linux-x64/cartridges/registry/migrations/20260602181932_initial/migration.nbt +8 -0
  131. package/vendor/linux-x64/cartridges/registry/migrations/20260602181932_initial/schema_snapshot.nbt +8 -0
  132. package/vendor/linux-x64/cartridges/registry/schema.nbt +20 -0
  133. package/vendor/linux-x64/cartridges/workflows/schema.nbt +43 -0
  134. package/vendor/linux-x64/console +0 -0
  135. package/vendor/linux-x64/nbt +0 -0
  136. package/contracts/audit/.dist/contract.json +0 -56
  137. package/contracts/auth/.dist/contract.json +0 -252
  138. package/contracts/calendar/.dist/contract.json +0 -141
  139. package/contracts/chat/.dist/contract.json +0 -229
  140. package/contracts/crm/.dist/contract.json +0 -239
  141. package/contracts/design/.dist/contract.json +0 -85
  142. package/contracts/dns/.dist/contract.json +0 -123
  143. package/contracts/email/.dist/contract.json +0 -267
  144. package/contracts/embed/.dist/contract.json +0 -137
  145. package/contracts/ingest/.dist/contract.json +0 -86
  146. package/contracts/notifications/.dist/contract.json +0 -133
  147. package/contracts/phone/.dist/contract.json +0 -168
  148. package/contracts/registry/.dist/contract.json +0 -49
  149. package/contracts/workflows/.dist/contract.json +0 -106
@@ -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,146 @@
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
+
40
+ # Generic per-appointment lifecycle outcome — neutral over customer domain.
41
+ # Customers project their domain-specific outcome into the (rating, status)
42
+ # pair: solar deployments record `status="won"|"lost"`, therapy clinics
43
+ # record `rating: 1..5`, field-service deployments record both. The
44
+ # `outcomeClass` mapping that drives similarity-weighted aggregation lives
45
+ # in each customer's own lifecycle logic, not on this entity.
46
+ export entity Outcome {
47
+ id: ulid
48
+ createdAt: DateTime @default(now())
49
+ updatedAt: DateTime @updatedAt
50
+ appointmentId: string
51
+ rating?: float
52
+ status?: string
53
+ notes?: string
54
+ recordedAt: DateTime @default(now())
55
+
56
+ @@index([appointmentId])
57
+ }
58
+
59
+ export entity Deal {
60
+ id: ulid
61
+ createdAt: DateTime @default(now())
62
+ updatedAt: DateTime @updatedAt
63
+ name: string
64
+ contact: Contact
65
+ value?: float
66
+ currency?: string
67
+ type?: string
68
+
69
+ stage?: string
70
+
71
+ pipeline?: Pipeline
72
+ pipelineStage?: PipelineStage
73
+
74
+ data: document
75
+ customData: document
76
+
77
+ # Append-only suffix — fields below this comment must stay at the end
78
+ # of the entity declaration. Codegen serializes in declaration order;
79
+ # newly-added fields go *after* existing fields so the on-disk byte
80
+ # layout stays forward-compatible (old records deserialize cleanly with
81
+ # trailing fields default-initialised). See the EOF-tolerant deserialize
82
+ # codegen in modules/nbt/codegen_serial.jai.
83
+
84
+ # D09.02 — generic lifecycle status, customer-domain. mylocalpro reacts
85
+ # to `deal.status == "won"` to mark the source Appointment positive.
86
+ status?: string
87
+
88
+ # D09.02 — optional back-reference to the Appointment this Deal
89
+ # originated from. Plain string id (not a relation) so webhook ingest
90
+ # can set it without requiring the Appointment row to exist yet.
91
+ appointmentId?: string
92
+
93
+ # Total contract price for the deal (USD). Resolved at GHL adapter
94
+ # ingest from Contact custom field "Total Contract Price" via
95
+ # CONTACT_LATEST_OPEN_DEAL Field_Mapping resolver. Closed deals lock —
96
+ # adapter writes to status ∈ {won, lost} are rejected to preserve
97
+ # historical pricing without double-storing.
98
+ totalContractPrice?: float
99
+
100
+ # Date the deal closed (won or lost). Resolved at GHL adapter ingest
101
+ # from Contact custom field "Date Sold" via CONTACT_LATEST_OPEN_DEAL.
102
+ # Append-only field — codegen serializes in declaration order, so
103
+ # existing rows deserialize cleanly with this trailing default.
104
+ closedDate?: DateTime
105
+ }
106
+
107
+ entity Pipeline {
108
+ id: ulid
109
+ createdAt: DateTime @default(now())
110
+ updatedAt: DateTime @updatedAt
111
+ name: string
112
+ description?: string
113
+ stages: PipelineStage[]
114
+
115
+ deals: Deal[]
116
+ }
117
+
118
+ entity PipelineStage {
119
+ id: ulid
120
+ createdAt: DateTime @default(now())
121
+ updatedAt: DateTime @updatedAt
122
+ name: string
123
+ order: u32
124
+ pipeline: Pipeline
125
+
126
+ deals: Deal[]
127
+ }
128
+
129
+ entity PipelineStageTransition {
130
+ id: ulid
131
+ createdAt: DateTime @default(now())
132
+ updatedAt: DateTime @updatedAt
133
+ # updatedAt is added automatically but means nothing since these are immutable
134
+ # createdAt is equivalent to movedAt
135
+
136
+ fromPipelineId?: string
137
+ toPipelineId: string
138
+
139
+ fromStageId?: string
140
+ toStageId: string
141
+
142
+ movedBy?: User
143
+
144
+ @@index([fromPipelineId, toPipelineId, fromStageId, toStageId])
145
+ }
146
+
@@ -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
+ }
@@ -0,0 +1,140 @@
1
+ # Published designs are world-readable (a site's frontend stitches itself from
2
+ # them before any session exists); writes stay behind the auth gate.
3
+ @public_route "GET /api/design/Design"
4
+ @public_route "GET /api/design/Designer"
5
+ @public_route "GET /api/design/Token"
6
+ @public_route "GET /api/design/Component"
7
+ @public_route "GET /api/design/Block"
8
+ @public_route "GET /api/design/Rule"
9
+ @public_route "GET /api/design/Page"
10
+
11
+ #--- Entities ---
12
+ # A Design is a named DESIGN.md file. Its body lives in DesignVersion rows so
13
+ # the full revision history is preserved. Design.headVersionId points at the
14
+ # latest version for O(1) current-state reads.
15
+
16
+ entity Design {
17
+ id: ulid
18
+ createdAt: DateTime @default(now())
19
+ updatedAt: DateTime @updatedAt
20
+ name: string
21
+ slug: string
22
+ description: string
23
+ designerId: string # who made this design system
24
+ headVersionId: string
25
+ headVersion: u32
26
+
27
+ @@unique([slug])
28
+ }
29
+
30
+ entity DesignVersion {
31
+ id: ulid
32
+ createdAt: DateTime @default(now())
33
+ updatedAt: DateTime @updatedAt
34
+ designId: string
35
+ version: u32 # domain revision counter (1, 2, 3 …)
36
+ body: document @scope(designId)
37
+ source: string
38
+ note: string
39
+ createdBy: string
40
+ parseErrors: string
41
+
42
+ @@index([designId])
43
+ @@unique([designId, version])
44
+ }
45
+
46
+ #--- Design system ---
47
+ # The product thesis: frontends are stitched from REAL designer-made designs.
48
+ # Tokens/Components/Blocks carry designer attribution so anything rendered on a
49
+ # site traces back to the person who designed it. JSON-shaped payloads
50
+ # (propsSpec, slotsSpec, defaults, blocks, rule) are plain JSON strings the
51
+ # renderer parses — no docstore ceremony for prototype-sized payloads.
52
+
53
+ # Attribution-only profile: enough to say "this designer made X". No profile
54
+ # pages, no auth linkage — just the name behind the work.
55
+ entity Designer {
56
+ id: ulid
57
+ createdAt: DateTime @default(now())
58
+ updatedAt: DateTime @updatedAt
59
+ name: string # "Jane Doe"
60
+ handle: string # "jane"
61
+ url: string # portfolio link, may be empty
62
+ bio: string
63
+
64
+ @@unique([handle])
65
+ }
66
+
67
+ entity Token {
68
+ id: ulid
69
+ createdAt: DateTime @default(now())
70
+ updatedAt: DateTime @updatedAt
71
+ designId: string
72
+ name: string # "surface/brand", "text/primary", "font/body", "space/section"
73
+ kind: string # color | font | size | space | radius
74
+ value: string # "#0A0A0A", "Inter", "6rem"
75
+ darkValue: string # empty = same as value
76
+
77
+ @@index([designId])
78
+ @@unique([designId, name])
79
+ }
80
+
81
+ entity Component {
82
+ id: ulid
83
+ createdAt: DateTime @default(now())
84
+ updatedAt: DateTime @updatedAt
85
+ designId: string
86
+ name: string # "button", "nav", "hero", "feature-card", "footer"
87
+ version: u32
88
+ designerId: string # real attribution — the trace-to-designer anchor
89
+ propsSpec: string # JSON: [{"name":"label","type":"string","default":"..."}]
90
+ notes: string
91
+
92
+ @@index([designId])
93
+ @@unique([designId, name])
94
+ }
95
+
96
+ entity Block {
97
+ id: ulid
98
+ createdAt: DateTime @default(now())
99
+ updatedAt: DateTime @updatedAt
100
+ designId: string
101
+ name: string # "nav", "hero", "feature-grid", "cta", "footer"
102
+ version: u32
103
+ designerId: string
104
+ components: string # JSON array of component names this block stitches
105
+ slotsSpec: string # JSON: [{"name":"headline","type":"string"}, ...]
106
+ defaults: string # JSON: default slot content
107
+
108
+ @@index([designId])
109
+ @@unique([designId, name])
110
+ }
111
+
112
+ entity Rule {
113
+ id: ulid
114
+ createdAt: DateTime @default(now())
115
+ updatedAt: DateTime @updatedAt
116
+ designId: string
117
+ subject: string # block/component name, or "page"
118
+ kind: string # ordering | count | pairing
119
+ rule: string # machine-checkable JSON, e.g. {"first":"nav"} / {"max":1,"of":"hero"}
120
+ note: string # designer's human rationale
121
+
122
+ @@index([designId])
123
+ }
124
+
125
+ entity Page {
126
+ id: ulid
127
+ createdAt: DateTime @default(now())
128
+ updatedAt: DateTime @updatedAt
129
+ designId: string
130
+ slug: string # "landing"
131
+ title: string
132
+ blocks: string # JSON: [{"block":"nav","props":{...}}, ...]
133
+
134
+ @@index([designId])
135
+ @@unique([designId, slug])
136
+ }
137
+
138
+ # Behavior (former Design.create/save_version/get_head/list_versions actions +
139
+ # tasks/parse.nbt @task) moved to native/runtime.jai over the generated ORM —
140
+ # see design_register_extra_routes.