@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.
- 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 +85 -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/20260514202654_update_directmessageroom/migration.nbt +4 -0
- package/stdlib/chat/migrations/20260514202654_update_directmessageroom/schema_snapshot.nbt +80 -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 +146 -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 +43 -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 +85 -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/20260514202654_update_directmessageroom/migration.nbt +4 -0
- package/vendor/linux-x64/cartridges/chat/migrations/20260514202654_update_directmessageroom/schema_snapshot.nbt +80 -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 +146 -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 +43 -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
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
entity TwilioAccount {
|
|
2
|
+
name: string
|
|
3
|
+
subAccountSid: string
|
|
4
|
+
authToken: string
|
|
5
|
+
publicUrlBase: string
|
|
6
|
+
status: string
|
|
7
|
+
retentionDays: s32
|
|
8
|
+
@@unique([name])
|
|
9
|
+
@@index([subAccountSid])
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
entity PhoneNumber {
|
|
13
|
+
accountId: string
|
|
14
|
+
phoneNumber: string
|
|
15
|
+
numberSid: string
|
|
16
|
+
friendlyName: string
|
|
17
|
+
capabilities: string
|
|
18
|
+
@@index([accountId])
|
|
19
|
+
@@unique([phoneNumber])
|
|
20
|
+
@@index([numberSid])
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
entity SmsMessage {
|
|
24
|
+
accountId: string
|
|
25
|
+
numberId: string
|
|
26
|
+
direction: string
|
|
27
|
+
fromE164: string
|
|
28
|
+
toE164: string
|
|
29
|
+
body: string
|
|
30
|
+
twilioSid: string
|
|
31
|
+
status: string
|
|
32
|
+
errorCode: s32
|
|
33
|
+
errorMessage: string
|
|
34
|
+
priceMicros: s64
|
|
35
|
+
priceCurrency: string
|
|
36
|
+
numSegments: s32
|
|
37
|
+
numMedia: s32
|
|
38
|
+
mediaUrls: string
|
|
39
|
+
senderUserId: string
|
|
40
|
+
dateSentMs: u64
|
|
41
|
+
dateDeliveredMs: u64
|
|
42
|
+
@@index([accountId])
|
|
43
|
+
@@index([numberId])
|
|
44
|
+
@@index([twilioSid])
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
entity PhoneUsageDaily {
|
|
48
|
+
accountId: string
|
|
49
|
+
date: string
|
|
50
|
+
smsCount: s64
|
|
51
|
+
smsSegmentsTotal: s64
|
|
52
|
+
smsPriceMicros: s64
|
|
53
|
+
@@unique([accountId, date])
|
|
54
|
+
@@index([accountId])
|
|
55
|
+
}
|
|
56
|
+
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# Phone cartridge — Twilio number management, SMS, click-to-call.
|
|
2
|
+
#
|
|
3
|
+
# Per-tenant model (see modules/twilio/module.jai for the rationale):
|
|
4
|
+
# - One master Twilio account owned by the platform (SID + auth token in
|
|
5
|
+
# env: TWILIO_MASTER_SID, TWILIO_MASTER_TOKEN).
|
|
6
|
+
# - Each tenant gets a TwilioAccount row with its own subaccount SID and
|
|
7
|
+
# auth token. All per-tenant API calls authenticate as the subaccount.
|
|
8
|
+
# - Webhooks are configured to URLs under the tenant's public base
|
|
9
|
+
# (TwilioAccount.publicUrlBase), which the gateway routes back to this
|
|
10
|
+
# cart. Signature verification uses the subaccount's auth token.
|
|
11
|
+
|
|
12
|
+
# Behavior (the former jai{} helper blocks + actions) lives in
|
|
13
|
+
# native/runtime.jai over the generated ORM — see phone_register_extra_routes,
|
|
14
|
+
# which registers the HTTP routes.
|
|
15
|
+
|
|
16
|
+
# Auth policy for the hand-written routes (formerly @public actions). The
|
|
17
|
+
# handlers live in native/runtime.jai; these keep the daemon's public-route
|
|
18
|
+
# manifest correct so the /api/* auth gate is bypassed for Twilio webhooks.
|
|
19
|
+
@public_route "/api/phone/webhook/sms"
|
|
20
|
+
@public_route "/api/phone/webhook/status"
|
|
21
|
+
|
|
22
|
+
entity TwilioAccount {
|
|
23
|
+
id: ulid
|
|
24
|
+
createdAt: DateTime @default(now())
|
|
25
|
+
updatedAt: DateTime @updatedAt
|
|
26
|
+
name: string # operator-facing label
|
|
27
|
+
subAccountSid: string # AC... — populated by provision()
|
|
28
|
+
authToken: string # subaccount auth token (TODO: encrypt at rest)
|
|
29
|
+
publicUrlBase: string # e.g. "https://acme.console.app"
|
|
30
|
+
status: string # PENDING | ACTIVE | SUSPENDED | CLOSED
|
|
31
|
+
retentionDays: s32 # 0 = keep message bodies forever; N = null body after N days
|
|
32
|
+
|
|
33
|
+
@@unique([name])
|
|
34
|
+
@@index([subAccountSid])
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
entity PhoneNumber {
|
|
38
|
+
id: ulid
|
|
39
|
+
createdAt: DateTime @default(now())
|
|
40
|
+
updatedAt: DateTime @updatedAt
|
|
41
|
+
accountId: string # FK TwilioAccount.id
|
|
42
|
+
phoneNumber: string # E.164 "+15551234567"
|
|
43
|
+
numberSid: string # PN...
|
|
44
|
+
friendlyName: string
|
|
45
|
+
capabilities: string # "sms"
|
|
46
|
+
|
|
47
|
+
@@index([accountId])
|
|
48
|
+
@@unique([phoneNumber])
|
|
49
|
+
@@index([numberSid])
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
entity SmsMessage {
|
|
53
|
+
id: ulid
|
|
54
|
+
createdAt: DateTime @default(now())
|
|
55
|
+
updatedAt: DateTime @updatedAt
|
|
56
|
+
accountId: string
|
|
57
|
+
numberId: string # FK PhoneNumber.id (empty on inbound if not matched)
|
|
58
|
+
direction: string # inbound | outbound
|
|
59
|
+
fromE164: string
|
|
60
|
+
toE164: string
|
|
61
|
+
body: string # nulled after retentionDays if TwilioAccount configured
|
|
62
|
+
twilioSid: string # SM...
|
|
63
|
+
status: string # queued | sent | delivered | failed | received
|
|
64
|
+
errorCode: s32
|
|
65
|
+
errorMessage: string # human-readable sibling of errorCode
|
|
66
|
+
priceMicros: s64 # negative = charged (Twilio convention); 0 until status callback
|
|
67
|
+
priceCurrency: string # "USD" / "CAD"
|
|
68
|
+
numSegments: s32
|
|
69
|
+
numMedia: s32
|
|
70
|
+
mediaUrls: string # JSON array of MMS media URLs
|
|
71
|
+
senderUserId: string # who triggered the send (empty for inbound)
|
|
72
|
+
dateSentMs: u64 # Twilio canonical timestamp (ms since epoch)
|
|
73
|
+
dateDeliveredMs: u64
|
|
74
|
+
|
|
75
|
+
@@index([accountId])
|
|
76
|
+
@@index([numberId])
|
|
77
|
+
@@index([twilioSid])
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
# Per-tenant per-day usage rollup. Written by the nightly rollup workflow;
|
|
81
|
+
# read by the portal to generate invoices.
|
|
82
|
+
entity PhoneUsageDaily {
|
|
83
|
+
id: ulid
|
|
84
|
+
createdAt: DateTime @default(now())
|
|
85
|
+
updatedAt: DateTime @updatedAt
|
|
86
|
+
accountId: string
|
|
87
|
+
date: string # "YYYY-MM-DD" in UTC
|
|
88
|
+
smsCount: s64
|
|
89
|
+
smsSegmentsTotal: s64
|
|
90
|
+
smsPriceMicros: s64
|
|
91
|
+
|
|
92
|
+
@@unique([accountId, date])
|
|
93
|
+
@@index([accountId])
|
|
94
|
+
}
|
|
95
|
+
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
migration initial {
|
|
2
|
+
add_entity InstalledCartridge
|
|
3
|
+
add_field InstalledCartridge tier string default("")
|
|
4
|
+
add_field InstalledCartridge source string default("")
|
|
5
|
+
add_field InstalledCartridge schemaChecksum string default("")
|
|
6
|
+
add_field InstalledCartridge installedAt u64 default(0)
|
|
7
|
+
add_field InstalledCartridge status string default("")
|
|
8
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Installed-cartridge registry — the single source of truth for which tier-2
|
|
2
|
+
# (bundled) and customer cartridges are installed on this instance.
|
|
3
|
+
#
|
|
4
|
+
# Lives in replicated storage, so the install set is HA-safe and survives
|
|
5
|
+
# restarts: on boot the console re-activates every InstalledCartridge row.
|
|
6
|
+
#
|
|
7
|
+
# The console daemon is the SINGLE WRITER (cartridge_registry.jai writes rows
|
|
8
|
+
# through THIS cart's generated serializer — same code, no format drift). The
|
|
9
|
+
# generated CRUD routes are read-mostly, for the portal/client. The row id is
|
|
10
|
+
# the cartridge name.
|
|
11
|
+
entity InstalledCartridge {
|
|
12
|
+
id: string @id # the cartridge name (slug), NOT a ulid
|
|
13
|
+
createdAt: DateTime @default(now())
|
|
14
|
+
updatedAt: DateTime @updatedAt
|
|
15
|
+
tier: string # "bundled" | "customer"
|
|
16
|
+
source: string # "bundled" | "customer"
|
|
17
|
+
schemaChecksum: string # checksum of the installed schema (drift detection)
|
|
18
|
+
installedAt: u64 # ms epoch
|
|
19
|
+
status: string # "installed" | "failed"
|
|
20
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
|
|
2
|
+
# Question: How do we tie in cartridge metadata and workflow side effects into all this?
|
|
3
|
+
|
|
4
|
+
enum WorkerStatus {
|
|
5
|
+
WAITING
|
|
6
|
+
RUNNING
|
|
7
|
+
TERMINATED
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
entity Worker {
|
|
11
|
+
id: ulid
|
|
12
|
+
createdAt: DateTime @default(now())
|
|
13
|
+
updatedAt: DateTime @updatedAt
|
|
14
|
+
source: blob
|
|
15
|
+
contentHash: string
|
|
16
|
+
queue?: string
|
|
17
|
+
# TODO: We need some sort of termination options like a restart policy
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
# Stub — flesh out execution lifecycle fields later.
|
|
21
|
+
entity WorkflowExecution {
|
|
22
|
+
id: ulid
|
|
23
|
+
createdAt: DateTime @default(now())
|
|
24
|
+
updatedAt: DateTime @updatedAt
|
|
25
|
+
status: string
|
|
26
|
+
events: WorkflowExecutionEvent[]
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
# Do we want this to be a string?
|
|
30
|
+
enum WorkflowExecutionEventKind {
|
|
31
|
+
WORKFLOW_EXECUTION_STARTED
|
|
32
|
+
WORKFLOW_STEP_SCHEDULED
|
|
33
|
+
WORKFLOW_STEP_STARTED
|
|
34
|
+
WORKFLOW_STEP_COMPLETED
|
|
35
|
+
WORKFLOW_EXECUTION_COMPLETED
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
entity WorkflowExecutionEvent {
|
|
39
|
+
id: ulid
|
|
40
|
+
createdAt: DateTime @default(now())
|
|
41
|
+
updatedAt: DateTime @updatedAt
|
|
42
|
+
kind: WorkflowExecutionEventKind
|
|
43
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
migration initial {
|
|
2
|
+
add_entity User
|
|
3
|
+
add_field User name string default("")
|
|
4
|
+
add_field User username string default("")
|
|
5
|
+
add_field User email string default("")
|
|
6
|
+
add_field User emailVerified bool default(false)
|
|
7
|
+
add_field User externalId string default("")
|
|
8
|
+
add_field User capsVersion u32 default(0)
|
|
9
|
+
add_index User [email]
|
|
10
|
+
add_index User [externalId]
|
|
11
|
+
add_entity UserRole
|
|
12
|
+
add_field UserRole userId string default("")
|
|
13
|
+
add_field UserRole cart string default("")
|
|
14
|
+
add_field UserRole role string default("")
|
|
15
|
+
add_index UserRole [userId]
|
|
16
|
+
add_entity Session
|
|
17
|
+
add_field Session userId string default("")
|
|
18
|
+
add_field Session token string default("")
|
|
19
|
+
add_field Session expiresAt DateTime default(0)
|
|
20
|
+
add_field Session ipAddress string default("")
|
|
21
|
+
add_field Session userAgent string default("")
|
|
22
|
+
add_index Session [token]
|
|
23
|
+
add_index Session [userId]
|
|
24
|
+
add_entity Account
|
|
25
|
+
add_field Account userId string default("")
|
|
26
|
+
add_field Account providerId string default("")
|
|
27
|
+
add_field Account password string default("")
|
|
28
|
+
add_field Account accessToken string default("")
|
|
29
|
+
add_field Account refreshToken string default("")
|
|
30
|
+
add_field Account idToken string default("")
|
|
31
|
+
add_field Account accessTokenExpiresAt DateTime default(0)
|
|
32
|
+
add_field Account refreshTokenExpiresAt DateTime default(0)
|
|
33
|
+
add_field Account scope string default("")
|
|
34
|
+
add_index Account [userId]
|
|
35
|
+
add_entity Verification
|
|
36
|
+
add_field Verification identifier string default("")
|
|
37
|
+
add_field Verification value string default("")
|
|
38
|
+
add_field Verification expiresAt DateTime default(0)
|
|
39
|
+
add_index Verification [identifier]
|
|
40
|
+
add_entity ApiKey
|
|
41
|
+
add_field ApiKey name string default("")
|
|
42
|
+
add_field ApiKey projectId string default("")
|
|
43
|
+
add_field ApiKey start string default("")
|
|
44
|
+
add_field ApiKey prefix string default("")
|
|
45
|
+
add_field ApiKey key string default("")
|
|
46
|
+
add_field ApiKey permissions string default("")
|
|
47
|
+
add_field ApiKey roles string default("")
|
|
48
|
+
}
|
package/vendor/linux-x64/cartridges/auth/migrations/20260424144652_initial/schema_snapshot.nbt
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
entity User {
|
|
2
|
+
name: string
|
|
3
|
+
username?: string
|
|
4
|
+
email?: string
|
|
5
|
+
emailVerified: bool
|
|
6
|
+
externalId?: string
|
|
7
|
+
capsVersion: u32
|
|
8
|
+
@@index([email])
|
|
9
|
+
@@index([externalId])
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
entity UserRole {
|
|
13
|
+
userId: string
|
|
14
|
+
cart: string
|
|
15
|
+
role: string
|
|
16
|
+
@@index([userId])
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
entity Session {
|
|
20
|
+
userId: string
|
|
21
|
+
token: string
|
|
22
|
+
expiresAt: DateTime
|
|
23
|
+
ipAddress?: string
|
|
24
|
+
userAgent?: string
|
|
25
|
+
@@index([token])
|
|
26
|
+
@@index([userId])
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
entity Account {
|
|
30
|
+
userId: string
|
|
31
|
+
providerId: string
|
|
32
|
+
password: string
|
|
33
|
+
accessToken: string
|
|
34
|
+
refreshToken: string
|
|
35
|
+
idToken: string
|
|
36
|
+
accessTokenExpiresAt: DateTime
|
|
37
|
+
refreshTokenExpiresAt: DateTime
|
|
38
|
+
scope: string
|
|
39
|
+
@@index([userId])
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
entity Verification {
|
|
43
|
+
identifier: string
|
|
44
|
+
value: string
|
|
45
|
+
expiresAt: DateTime
|
|
46
|
+
@@index([identifier])
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
entity ApiKey {
|
|
50
|
+
name: string
|
|
51
|
+
projectId: string
|
|
52
|
+
start: string
|
|
53
|
+
prefix: string
|
|
54
|
+
key: string
|
|
55
|
+
permissions: string
|
|
56
|
+
roles: string
|
|
57
|
+
}
|
|
58
|
+
|
package/vendor/linux-x64/cartridges/auth/migrations/20260521191014_update_user/schema_snapshot.nbt
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
entity User {
|
|
2
|
+
name: string
|
|
3
|
+
username?: string
|
|
4
|
+
email?: string
|
|
5
|
+
emailVerified: bool
|
|
6
|
+
externalId?: string
|
|
7
|
+
capsVersion: u32
|
|
8
|
+
@@index([email])
|
|
9
|
+
@@index([externalId])
|
|
10
|
+
@@unique([email])
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
entity UserRole {
|
|
14
|
+
userId: string
|
|
15
|
+
cart: string
|
|
16
|
+
role: string
|
|
17
|
+
@@index([userId])
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
entity Session {
|
|
21
|
+
userId: string
|
|
22
|
+
token: string
|
|
23
|
+
expiresAt: DateTime
|
|
24
|
+
ipAddress?: string
|
|
25
|
+
userAgent?: string
|
|
26
|
+
@@index([token])
|
|
27
|
+
@@index([userId])
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
entity Account {
|
|
31
|
+
userId: string
|
|
32
|
+
providerId: string
|
|
33
|
+
password: string
|
|
34
|
+
accessToken: string
|
|
35
|
+
refreshToken: string
|
|
36
|
+
idToken: string
|
|
37
|
+
accessTokenExpiresAt: DateTime
|
|
38
|
+
refreshTokenExpiresAt: DateTime
|
|
39
|
+
scope: string
|
|
40
|
+
@@index([userId])
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
entity Verification {
|
|
44
|
+
identifier: string
|
|
45
|
+
value: string
|
|
46
|
+
expiresAt: DateTime
|
|
47
|
+
@@index([identifier])
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
entity ApiKey {
|
|
51
|
+
name: string
|
|
52
|
+
projectId: string
|
|
53
|
+
start: string
|
|
54
|
+
prefix: string
|
|
55
|
+
key: string
|
|
56
|
+
permissions: string
|
|
57
|
+
roles: string
|
|
58
|
+
}
|
|
59
|
+
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import crypto from "crypto"
|
|
2
|
+
|
|
3
|
+
# Auth policy for the hand-written routes in native/runtime.jai (formerly the
|
|
4
|
+
# @public actions + the `authenticate` middleware block). These keep the
|
|
5
|
+
# daemon's public-route + middleware manifest correct: public routes bypass the
|
|
6
|
+
# /api/* auth gate; @middleware tells the proxy this cart exports the global
|
|
7
|
+
# authenticate gate (registered at /_middleware/authenticate). The @authn
|
|
8
|
+
# (service) sync/role routes carry NO directive — they require auth, gated
|
|
9
|
+
# inline in the handler.
|
|
10
|
+
@public_route "/api/auth/user/signup"
|
|
11
|
+
@public_route "/api/auth/user/signin"
|
|
12
|
+
@public_route "/api/auth/session/signout"
|
|
13
|
+
@public_route "/api/auth/session/current"
|
|
14
|
+
@public_route "/api/auth/user/forgot_password"
|
|
15
|
+
@public_route "/api/auth/user/reset_password"
|
|
16
|
+
@public_route "/api/auth/user/verify_email"
|
|
17
|
+
@middleware "authenticate"
|
|
18
|
+
|
|
19
|
+
export entity User {
|
|
20
|
+
id: ulid
|
|
21
|
+
createdAt: DateTime @default(now())
|
|
22
|
+
updatedAt: DateTime @updatedAt
|
|
23
|
+
name: string
|
|
24
|
+
username?: string
|
|
25
|
+
email?: string
|
|
26
|
+
emailVerified: bool
|
|
27
|
+
externalId?: string
|
|
28
|
+
capsVersion: u32 # what is this?
|
|
29
|
+
|
|
30
|
+
@@index([email])
|
|
31
|
+
@@index([externalId])
|
|
32
|
+
@@unique([email])
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
# Per-cartridge role assignments. Role names refer to entries in the owning
|
|
36
|
+
# cartridge's `roles { }` block — this cartridge does not validate them.
|
|
37
|
+
entity UserRole {
|
|
38
|
+
id: ulid
|
|
39
|
+
createdAt: DateTime @default(now())
|
|
40
|
+
updatedAt: DateTime @updatedAt
|
|
41
|
+
userId: string
|
|
42
|
+
cart: string
|
|
43
|
+
role: string
|
|
44
|
+
|
|
45
|
+
@@index([userId])
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
entity Session {
|
|
49
|
+
id: ulid
|
|
50
|
+
createdAt: DateTime @default(now())
|
|
51
|
+
updatedAt: DateTime @updatedAt
|
|
52
|
+
userId: string
|
|
53
|
+
token: string
|
|
54
|
+
expiresAt: DateTime
|
|
55
|
+
ipAddress?: string
|
|
56
|
+
userAgent?: string
|
|
57
|
+
|
|
58
|
+
@@index([token])
|
|
59
|
+
@@index([userId])
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
entity Account {
|
|
63
|
+
id: ulid
|
|
64
|
+
createdAt: DateTime @default(now())
|
|
65
|
+
updatedAt: DateTime @updatedAt
|
|
66
|
+
userId: string
|
|
67
|
+
providerId: string
|
|
68
|
+
password: string
|
|
69
|
+
accessToken: string
|
|
70
|
+
refreshToken: string
|
|
71
|
+
idToken: string
|
|
72
|
+
accessTokenExpiresAt: DateTime
|
|
73
|
+
refreshTokenExpiresAt: DateTime
|
|
74
|
+
scope: string
|
|
75
|
+
|
|
76
|
+
@@index([userId])
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
entity Verification {
|
|
80
|
+
id: ulid
|
|
81
|
+
createdAt: DateTime @default(now())
|
|
82
|
+
updatedAt: DateTime @updatedAt
|
|
83
|
+
identifier: string
|
|
84
|
+
value: string
|
|
85
|
+
expiresAt: DateTime
|
|
86
|
+
|
|
87
|
+
@@index([identifier])
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
entity ApiKey {
|
|
91
|
+
id: ulid
|
|
92
|
+
createdAt: DateTime @default(now())
|
|
93
|
+
updatedAt: DateTime @updatedAt
|
|
94
|
+
name: string
|
|
95
|
+
projectId: string
|
|
96
|
+
start: string
|
|
97
|
+
prefix: string
|
|
98
|
+
key: string
|
|
99
|
+
permissions: string
|
|
100
|
+
roles: string
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
# Console-operator SSH public keys. The console daemon authenticates SSH
|
|
104
|
+
# connections by looking up rows here via modules/auth_lookup/ (in-process,
|
|
105
|
+
# direct storage read — auth cart liveness is not required).
|
|
106
|
+
entity SshKey {
|
|
107
|
+
id: ulid
|
|
108
|
+
createdAt: DateTime @default(now())
|
|
109
|
+
updatedAt: DateTime @updatedAt
|
|
110
|
+
userId: string
|
|
111
|
+
label: string
|
|
112
|
+
blob: string
|
|
113
|
+
|
|
114
|
+
@@index([userId])
|
|
115
|
+
@@unique([blob])
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
jai {
|
|
119
|
+
find_synced_user :: (requestedId: string, email: string) -> (User, bool) {
|
|
120
|
+
if requestedId.count > 0 {
|
|
121
|
+
by_id, by_id_ok := get_user(requestedId);
|
|
122
|
+
if by_id_ok return by_id, true;
|
|
123
|
+
|
|
124
|
+
by_external := find_users_by_externalId(requestedId);
|
|
125
|
+
if by_external.count > 0 {
|
|
126
|
+
u, ok := get_user(by_external[0].id);
|
|
127
|
+
if ok return u, true;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if email.count > 0 {
|
|
132
|
+
by_email := find_users_by_email(email);
|
|
133
|
+
if by_email.count > 0 {
|
|
134
|
+
u, ok := get_user(by_email[0].id);
|
|
135
|
+
if ok return u, true;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
empty: User;
|
|
140
|
+
return empty, false;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
migration initial {
|
|
2
|
+
add_entity Calendar
|
|
3
|
+
add_field Calendar name string default("")
|
|
4
|
+
add_field Calendar description string default("")
|
|
5
|
+
add_field Calendar timezone string default("")
|
|
6
|
+
add_field Calendar slotDuration u32 default(0)
|
|
7
|
+
add_field Calendar slotInterval u32 default(0)
|
|
8
|
+
add_field Calendar isActive bool default(false)
|
|
9
|
+
add_field Calendar source string default("")
|
|
10
|
+
add_entity Appointment
|
|
11
|
+
add_field Appointment calendar Calendar default(0)
|
|
12
|
+
add_field Appointment contact Contact default(0)
|
|
13
|
+
add_field Appointment title string default("")
|
|
14
|
+
add_field Appointment address string default("")
|
|
15
|
+
add_field Appointment notes string default("")
|
|
16
|
+
add_field Appointment startTime DateTime default(0)
|
|
17
|
+
add_field Appointment endTime DateTime default(0)
|
|
18
|
+
add_field Appointment timezone string default("")
|
|
19
|
+
add_field Appointment status string default("")
|
|
20
|
+
add_field Appointment source string default("")
|
|
21
|
+
add_field Appointment assignedUser User default(0)
|
|
22
|
+
add_field Appointment isRescheduled bool default(false)
|
|
23
|
+
add_field Appointment originalStartTime DateTime default(0)
|
|
24
|
+
add_field Appointment originalEndTime DateTime default(0)
|
|
25
|
+
add_index Appointment [contactId]
|
|
26
|
+
add_index Appointment [calendarId]
|
|
27
|
+
add_entity Contact
|
|
28
|
+
add_field Contact firstName string default("")
|
|
29
|
+
add_field Contact lastName string default("")
|
|
30
|
+
add_field Contact fullName string default("")
|
|
31
|
+
add_field Contact phone string default("")
|
|
32
|
+
add_field Contact mobile string default("")
|
|
33
|
+
add_field Contact email string default("")
|
|
34
|
+
add_field Contact address string default("")
|
|
35
|
+
add_field Contact fullAddress string default("")
|
|
36
|
+
add_field Contact postalCode string default("")
|
|
37
|
+
add_field Contact city string default("")
|
|
38
|
+
add_field Contact stateOrProvince string default("")
|
|
39
|
+
add_field Contact country string default("")
|
|
40
|
+
add_field Contact timezone string default("")
|
|
41
|
+
add_field Contact lat float default(0)
|
|
42
|
+
add_field Contact lon float default(0)
|
|
43
|
+
add_field Contact company string default("")
|
|
44
|
+
add_field Contact website string default("")
|
|
45
|
+
add_field Contact title string default("")
|
|
46
|
+
add_field Contact industry string default("")
|
|
47
|
+
add_field Contact source string default("")
|
|
48
|
+
add_field Contact notes string default("")
|
|
49
|
+
add_field Contact data document default(0)
|
|
50
|
+
add_field Contact customData document default(0)
|
|
51
|
+
add_entity User
|
|
52
|
+
add_field User name string default("")
|
|
53
|
+
add_field User username string default("")
|
|
54
|
+
add_field User email string default("")
|
|
55
|
+
add_field User emailVerified bool default(false)
|
|
56
|
+
add_field User externalId string default("")
|
|
57
|
+
add_field User capsVersion u32 default(0)
|
|
58
|
+
add_index User [email]
|
|
59
|
+
add_index User [externalId]
|
|
60
|
+
}
|
package/vendor/linux-x64/cartridges/calendar/migrations/20260501210107_initial/schema_snapshot.nbt
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
entity Calendar {
|
|
2
|
+
name: string
|
|
3
|
+
description?: string
|
|
4
|
+
timezone?: string
|
|
5
|
+
slotDuration?: u32
|
|
6
|
+
slotInterval?: u32
|
|
7
|
+
isActive: bool
|
|
8
|
+
source?: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
entity Appointment {
|
|
12
|
+
calendar: Calendar
|
|
13
|
+
contact: Contact
|
|
14
|
+
title?: string
|
|
15
|
+
address?: string
|
|
16
|
+
notes?: string
|
|
17
|
+
startTime: DateTime
|
|
18
|
+
endTime: DateTime
|
|
19
|
+
timezone?: string
|
|
20
|
+
status: string
|
|
21
|
+
source?: string
|
|
22
|
+
assignedUser?: User
|
|
23
|
+
isRescheduled: bool
|
|
24
|
+
originalStartTime?: DateTime
|
|
25
|
+
originalEndTime?: DateTime
|
|
26
|
+
@@index([contactId])
|
|
27
|
+
@@index([calendarId])
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
entity Contact {
|
|
31
|
+
firstName?: string
|
|
32
|
+
lastName?: string
|
|
33
|
+
fullName?: string
|
|
34
|
+
phone?: string
|
|
35
|
+
mobile?: string
|
|
36
|
+
email?: string
|
|
37
|
+
address?: string
|
|
38
|
+
fullAddress?: string
|
|
39
|
+
postalCode?: string
|
|
40
|
+
city?: string
|
|
41
|
+
stateOrProvince?: string
|
|
42
|
+
country?: string
|
|
43
|
+
timezone?: string
|
|
44
|
+
lat?: float
|
|
45
|
+
lon?: float
|
|
46
|
+
company?: string
|
|
47
|
+
website?: string
|
|
48
|
+
title?: string
|
|
49
|
+
industry?: string
|
|
50
|
+
source?: string
|
|
51
|
+
notes?: string
|
|
52
|
+
data: document
|
|
53
|
+
customData: document
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
entity User {
|
|
57
|
+
name: string
|
|
58
|
+
username?: string
|
|
59
|
+
email?: string
|
|
60
|
+
emailVerified: bool
|
|
61
|
+
externalId?: string
|
|
62
|
+
capsVersion: u32
|
|
63
|
+
@@index([email])
|
|
64
|
+
@@index([externalId])
|
|
65
|
+
}
|
|
66
|
+
|
package/vendor/linux-x64/cartridges/calendar/migrations/20260513151050_schema_update/migration.nbt
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
migration schema_update {
|
|
2
|
+
add_field Appointment state string default("")
|
|
3
|
+
add_field Appointment outcomeClass string default("")
|
|
4
|
+
add_field Appointment embedText string default("")
|
|
5
|
+
add_index Appointment [state]
|
|
6
|
+
add_index Appointment [outcomeClass]
|
|
7
|
+
add_entity AppointmentParticipant
|
|
8
|
+
add_field AppointmentParticipant appointment Appointment default(0)
|
|
9
|
+
add_field AppointmentParticipant user User default(0)
|
|
10
|
+
add_field AppointmentParticipant role string default("")
|
|
11
|
+
add_field AppointmentParticipant assignedAt DateTime default(0)
|
|
12
|
+
add_field AppointmentParticipant assignedBy User default(0)
|
|
13
|
+
add_field AppointmentParticipant notes string default("")
|
|
14
|
+
add_index AppointmentParticipant [appointmentId]
|
|
15
|
+
add_index AppointmentParticipant [userId, role]
|
|
16
|
+
add_unique AppointmentParticipant [appointmentId, role, userId]
|
|
17
|
+
}
|