@minion-stack/db 0.2.0
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/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/relations.d.ts +126 -0
- package/dist/relations.d.ts.map +1 -0
- package/dist/relations.js +178 -0
- package/dist/relations.js.map +1 -0
- package/dist/schema/activity-bins.d.ts +118 -0
- package/dist/schema/activity-bins.d.ts.map +1 -0
- package/dist/schema/activity-bins.js +19 -0
- package/dist/schema/activity-bins.js.map +1 -0
- package/dist/schema/agent-groups.d.ts +180 -0
- package/dist/schema/agent-groups.d.ts.map +1 -0
- package/dist/schema/agent-groups.js +22 -0
- package/dist/schema/agent-groups.js.map +1 -0
- package/dist/schema/agents.d.ts +196 -0
- package/dist/schema/agents.d.ts.map +1 -0
- package/dist/schema/agents.js +20 -0
- package/dist/schema/agents.js.map +1 -0
- package/dist/schema/auth/index.d.ts +1713 -0
- package/dist/schema/auth/index.d.ts.map +1 -0
- package/dist/schema/auth/index.js +152 -0
- package/dist/schema/auth/index.js.map +1 -0
- package/dist/schema/backup-configs.d.ts +207 -0
- package/dist/schema/backup-configs.d.ts.map +1 -0
- package/dist/schema/backup-configs.js +18 -0
- package/dist/schema/backup-configs.js.map +1 -0
- package/dist/schema/bugs.d.ts +232 -0
- package/dist/schema/bugs.d.ts.map +1 -0
- package/dist/schema/bugs.js +26 -0
- package/dist/schema/bugs.js.map +1 -0
- package/dist/schema/builder.d.ts +1546 -0
- package/dist/schema/builder.d.ts.map +1 -0
- package/dist/schema/builder.js +143 -0
- package/dist/schema/builder.js.map +1 -0
- package/dist/schema/channel-assignments.d.ts +120 -0
- package/dist/schema/channel-assignments.d.ts.map +1 -0
- package/dist/schema/channel-assignments.js +19 -0
- package/dist/schema/channel-assignments.js.map +1 -0
- package/dist/schema/channel-identities.d.ts +141 -0
- package/dist/schema/channel-identities.d.ts.map +1 -0
- package/dist/schema/channel-identities.js +21 -0
- package/dist/schema/channel-identities.js.map +1 -0
- package/dist/schema/channels.d.ts +213 -0
- package/dist/schema/channels.d.ts.map +1 -0
- package/dist/schema/channels.js +26 -0
- package/dist/schema/channels.js.map +1 -0
- package/dist/schema/chat-messages.d.ts +192 -0
- package/dist/schema/chat-messages.d.ts.map +1 -0
- package/dist/schema/chat-messages.js +23 -0
- package/dist/schema/chat-messages.js.map +1 -0
- package/dist/schema/config-snapshots.d.ts +120 -0
- package/dist/schema/config-snapshots.d.ts.map +1 -0
- package/dist/schema/config-snapshots.js +16 -0
- package/dist/schema/config-snapshots.js.map +1 -0
- package/dist/schema/connection-events.d.ts +173 -0
- package/dist/schema/connection-events.d.ts.map +1 -0
- package/dist/schema/connection-events.js +22 -0
- package/dist/schema/connection-events.js.map +1 -0
- package/dist/schema/credential-health.d.ts +116 -0
- package/dist/schema/credential-health.d.ts.map +1 -0
- package/dist/schema/credential-health.js +19 -0
- package/dist/schema/credential-health.js.map +1 -0
- package/dist/schema/device-identities.d.ts +120 -0
- package/dist/schema/device-identities.d.ts.map +1 -0
- package/dist/schema/device-identities.js +14 -0
- package/dist/schema/device-identities.js.map +1 -0
- package/dist/schema/files.d.ts +175 -0
- package/dist/schema/files.d.ts.map +1 -0
- package/dist/schema/files.js +16 -0
- package/dist/schema/files.js.map +1 -0
- package/dist/schema/flows.d.ts +156 -0
- package/dist/schema/flows.d.ts.map +1 -0
- package/dist/schema/flows.js +12 -0
- package/dist/schema/flows.js.map +1 -0
- package/dist/schema/gateway-heartbeats.d.ts +186 -0
- package/dist/schema/gateway-heartbeats.d.ts.map +1 -0
- package/dist/schema/gateway-heartbeats.js +23 -0
- package/dist/schema/gateway-heartbeats.js.map +1 -0
- package/dist/schema/index.d.ts +37 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +38 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/marketplace-agents.d.ts +397 -0
- package/dist/schema/marketplace-agents.d.ts.map +1 -0
- package/dist/schema/marketplace-agents.js +25 -0
- package/dist/schema/marketplace-agents.js.map +1 -0
- package/dist/schema/marketplace-installs.d.ts +101 -0
- package/dist/schema/marketplace-installs.d.ts.map +1 -0
- package/dist/schema/marketplace-installs.js +21 -0
- package/dist/schema/marketplace-installs.js.map +1 -0
- package/dist/schema/missions.d.ts +194 -0
- package/dist/schema/missions.d.ts.map +1 -0
- package/dist/schema/missions.js +29 -0
- package/dist/schema/missions.js.map +1 -0
- package/dist/schema/personal-agents.d.ts +302 -0
- package/dist/schema/personal-agents.d.ts.map +1 -0
- package/dist/schema/personal-agents.js +37 -0
- package/dist/schema/personal-agents.js.map +1 -0
- package/dist/schema/reliability-events.d.ts +211 -0
- package/dist/schema/reliability-events.d.ts.map +1 -0
- package/dist/schema/reliability-events.js +28 -0
- package/dist/schema/reliability-events.js.map +1 -0
- package/dist/schema/server-backups.d.ts +154 -0
- package/dist/schema/server-backups.d.ts.map +1 -0
- package/dist/schema/server-backups.js +23 -0
- package/dist/schema/server-backups.js.map +1 -0
- package/dist/schema/server-provision-configs.d.ts +410 -0
- package/dist/schema/server-provision-configs.d.ts.map +1 -0
- package/dist/schema/server-provision-configs.js +43 -0
- package/dist/schema/server-provision-configs.js.map +1 -0
- package/dist/schema/servers.d.ts +192 -0
- package/dist/schema/servers.d.ts.map +1 -0
- package/dist/schema/servers.js +22 -0
- package/dist/schema/servers.js.map +1 -0
- package/dist/schema/session-tasks.d.ts +211 -0
- package/dist/schema/session-tasks.d.ts.map +1 -0
- package/dist/schema/session-tasks.js +26 -0
- package/dist/schema/session-tasks.js.map +1 -0
- package/dist/schema/sessions.d.ts +209 -0
- package/dist/schema/sessions.d.ts.map +1 -0
- package/dist/schema/sessions.js +27 -0
- package/dist/schema/sessions.js.map +1 -0
- package/dist/schema/settings.d.ts +118 -0
- package/dist/schema/settings.d.ts.map +1 -0
- package/dist/schema/settings.js +19 -0
- package/dist/schema/settings.js.map +1 -0
- package/dist/schema/skill-execution-stats.d.ts +209 -0
- package/dist/schema/skill-execution-stats.d.ts.map +1 -0
- package/dist/schema/skill-execution-stats.js +24 -0
- package/dist/schema/skill-execution-stats.js.map +1 -0
- package/dist/schema/skills.d.ts +209 -0
- package/dist/schema/skills.d.ts.map +1 -0
- package/dist/schema/skills.js +24 -0
- package/dist/schema/skills.js.map +1 -0
- package/dist/schema/tasks.d.ts +192 -0
- package/dist/schema/tasks.d.ts.map +1 -0
- package/dist/schema/tasks.js +22 -0
- package/dist/schema/tasks.js.map +1 -0
- package/dist/schema/unified-events.d.ts +247 -0
- package/dist/schema/unified-events.d.ts.map +1 -0
- package/dist/schema/unified-events.js +29 -0
- package/dist/schema/unified-events.js.map +1 -0
- package/dist/schema/user-agents.d.ts +82 -0
- package/dist/schema/user-agents.d.ts.map +1 -0
- package/dist/schema/user-agents.js +17 -0
- package/dist/schema/user-agents.js.map +1 -0
- package/dist/schema/user-preferences.d.ts +99 -0
- package/dist/schema/user-preferences.d.ts.map +1 -0
- package/dist/schema/user-preferences.js +15 -0
- package/dist/schema/user-preferences.js.map +1 -0
- package/dist/schema/user-servers.d.ts +63 -0
- package/dist/schema/user-servers.d.ts.map +1 -0
- package/dist/schema/user-servers.js +16 -0
- package/dist/schema/user-servers.js.map +1 -0
- package/dist/schema/workshop-saves.d.ts +156 -0
- package/dist/schema/workshop-saves.d.ts.map +1 -0
- package/dist/schema/workshop-saves.js +12 -0
- package/dist/schema/workshop-saves.js.map +1 -0
- package/dist/utils.d.ts +3 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +9 -0
- package/dist/utils.js.map +1 -0
- package/package.json +58 -0
- package/src/index.ts +7 -0
- package/src/relations.ts +258 -0
- package/src/schema/activity-bins.ts +23 -0
- package/src/schema/agent-groups.ts +31 -0
- package/src/schema/agents.ts +24 -0
- package/src/schema/auth/index.ts +190 -0
- package/src/schema/backup-configs.ts +22 -0
- package/src/schema/bugs.ts +30 -0
- package/src/schema/builder.ts +151 -0
- package/src/schema/channel-assignments.ts +23 -0
- package/src/schema/channel-identities.ts +25 -0
- package/src/schema/channels.ts +30 -0
- package/src/schema/chat-messages.ts +27 -0
- package/src/schema/config-snapshots.ts +20 -0
- package/src/schema/connection-events.ts +26 -0
- package/src/schema/credential-health.ts +23 -0
- package/src/schema/device-identities.ts +14 -0
- package/src/schema/files.ts +20 -0
- package/src/schema/flows.ts +12 -0
- package/src/schema/gateway-heartbeats.ts +27 -0
- package/src/schema/index.ts +59 -0
- package/src/schema/marketplace-agents.ts +25 -0
- package/src/schema/marketplace-installs.ts +25 -0
- package/src/schema/missions.ts +33 -0
- package/src/schema/personal-agents.ts +41 -0
- package/src/schema/reliability-events.ts +32 -0
- package/src/schema/server-backups.ts +27 -0
- package/src/schema/server-provision-configs.ts +57 -0
- package/src/schema/servers.ts +26 -0
- package/src/schema/session-tasks.ts +30 -0
- package/src/schema/sessions.ts +31 -0
- package/src/schema/settings.ts +23 -0
- package/src/schema/skill-execution-stats.ts +28 -0
- package/src/schema/skills.ts +28 -0
- package/src/schema/tasks.ts +26 -0
- package/src/schema/unified-events.ts +33 -0
- package/src/schema/user-agents.ts +21 -0
- package/src/schema/user-preferences.ts +19 -0
- package/src/schema/user-servers.ts +20 -0
- package/src/schema/workshop-saves.ts +12 -0
- package/src/utils.ts +11 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../src/schema/builder.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAetB,CAAC;AAGH,eAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAU3B,CAAC;AAGH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAc3B,CAAC;AAGH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoBrB,CAAC"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { sqliteTable, text, integer, real } from 'drizzle-orm/sqlite-core';
|
|
2
|
+
import { servers } from './servers.js';
|
|
3
|
+
import { organization } from './auth/index.js';
|
|
4
|
+
// ── Built Skills ──────────────────────────────────────────────────────
|
|
5
|
+
export const builtSkills = sqliteTable('built_skills', {
|
|
6
|
+
id: text('id').primaryKey(),
|
|
7
|
+
name: text('name').notNull(),
|
|
8
|
+
description: text('description').default(''),
|
|
9
|
+
emoji: text('emoji').default('📖'),
|
|
10
|
+
status: text('status', { enum: ['draft', 'published'] })
|
|
11
|
+
.notNull()
|
|
12
|
+
.default('draft'),
|
|
13
|
+
maxCycles: integer('max_cycles').notNull().default(3),
|
|
14
|
+
serverId: text('server_id').references(() => servers.id, { onDelete: 'cascade' }),
|
|
15
|
+
tenantId: text('tenant_id').references(() => organization.id, { onDelete: 'cascade' }),
|
|
16
|
+
createdBy: text('created_by'),
|
|
17
|
+
publishedAt: integer('published_at'),
|
|
18
|
+
createdAt: integer('created_at').notNull(),
|
|
19
|
+
updatedAt: integer('updated_at').notNull(),
|
|
20
|
+
});
|
|
21
|
+
// ── Skill Tool Pool (junction: skill → gateway tool IDs) ─────────────
|
|
22
|
+
export const builtSkillTools = sqliteTable('built_skill_tools', {
|
|
23
|
+
id: text('id').primaryKey(),
|
|
24
|
+
skillId: text('skill_id')
|
|
25
|
+
.notNull()
|
|
26
|
+
.references(() => builtSkills.id, { onDelete: 'cascade' }),
|
|
27
|
+
toolId: text('tool_id').notNull(), // gateway tool ID string (e.g., 'web-search')
|
|
28
|
+
});
|
|
29
|
+
// ── Chapters (subprocess nodes in the DAG) ───────────────────────────
|
|
30
|
+
export const builtChapters = sqliteTable('built_chapters', {
|
|
31
|
+
id: text('id').primaryKey(),
|
|
32
|
+
skillId: text('skill_id')
|
|
33
|
+
.notNull()
|
|
34
|
+
.references(() => builtSkills.id, { onDelete: 'cascade' }),
|
|
35
|
+
type: text('type', { enum: ['chapter', 'condition'] })
|
|
36
|
+
.notNull()
|
|
37
|
+
.default('chapter'),
|
|
38
|
+
name: text('name').notNull(),
|
|
39
|
+
description: text('description').default(''),
|
|
40
|
+
guide: text('guide').default(''), // instructions/markdown
|
|
41
|
+
context: text('context').default(''), // constraints, additional context
|
|
42
|
+
outputDef: text('output_def').default(''), // what this chapter produces
|
|
43
|
+
conditionText: text('condition_text').default(''), // binary question for condition nodes
|
|
44
|
+
positionX: real('position_x').notNull().default(0),
|
|
45
|
+
positionY: real('position_y').notNull().default(0),
|
|
46
|
+
createdAt: integer('created_at').notNull(),
|
|
47
|
+
updatedAt: integer('updated_at').notNull(),
|
|
48
|
+
});
|
|
49
|
+
// ── Chapter Edges (DAG connections between chapters) ─────────────────
|
|
50
|
+
export const builtChapterEdges = sqliteTable('built_chapter_edges', {
|
|
51
|
+
id: text('id').primaryKey(),
|
|
52
|
+
skillId: text('skill_id')
|
|
53
|
+
.notNull()
|
|
54
|
+
.references(() => builtSkills.id, { onDelete: 'cascade' }),
|
|
55
|
+
sourceChapterId: text('source_chapter_id')
|
|
56
|
+
.notNull()
|
|
57
|
+
.references(() => builtChapters.id, { onDelete: 'cascade' }),
|
|
58
|
+
targetChapterId: text('target_chapter_id')
|
|
59
|
+
.notNull()
|
|
60
|
+
.references(() => builtChapters.id, { onDelete: 'cascade' }),
|
|
61
|
+
label: text('label'),
|
|
62
|
+
});
|
|
63
|
+
// ── Chapter Tools (junction: chapter → subset of skill's tool pool) ──
|
|
64
|
+
export const builtChapterTools = sqliteTable('built_chapter_tools', {
|
|
65
|
+
id: text('id').primaryKey(),
|
|
66
|
+
chapterId: text('chapter_id')
|
|
67
|
+
.notNull()
|
|
68
|
+
.references(() => builtChapters.id, { onDelete: 'cascade' }),
|
|
69
|
+
toolId: text('tool_id').notNull(), // must exist in parent skill's pool
|
|
70
|
+
});
|
|
71
|
+
// ── Built Agents ─────────────────────────────────────────────────────
|
|
72
|
+
export const builtAgents = sqliteTable('built_agents', {
|
|
73
|
+
id: text('id').primaryKey(),
|
|
74
|
+
name: text('name').notNull(),
|
|
75
|
+
emoji: text('emoji').default('🤖'),
|
|
76
|
+
description: text('description').default(''),
|
|
77
|
+
model: text('model'),
|
|
78
|
+
systemPrompt: text('system_prompt').default(''),
|
|
79
|
+
temperature: real('temperature').default(0.7),
|
|
80
|
+
maxTokens: integer('max_tokens').default(4096),
|
|
81
|
+
retryPolicy: text('retry_policy').default('{}'), // JSON
|
|
82
|
+
fallbackAgentId: text('fallback_agent_id'),
|
|
83
|
+
status: text('status', { enum: ['draft', 'published'] })
|
|
84
|
+
.notNull()
|
|
85
|
+
.default('draft'),
|
|
86
|
+
serverId: text('server_id').references(() => servers.id, { onDelete: 'cascade' }),
|
|
87
|
+
tenantId: text('tenant_id').references(() => organization.id, { onDelete: 'cascade' }),
|
|
88
|
+
createdBy: text('created_by'),
|
|
89
|
+
publishedAt: integer('published_at'),
|
|
90
|
+
createdAt: integer('created_at').notNull(),
|
|
91
|
+
updatedAt: integer('updated_at').notNull(),
|
|
92
|
+
});
|
|
93
|
+
// ── Agent Skill Slots (junction: agent → skill with order) ───────────
|
|
94
|
+
export const builtAgentSkills = sqliteTable('built_agent_skills', {
|
|
95
|
+
id: text('id').primaryKey(),
|
|
96
|
+
agentId: text('agent_id')
|
|
97
|
+
.notNull()
|
|
98
|
+
.references(() => builtAgents.id, { onDelete: 'cascade' }),
|
|
99
|
+
skillId: text('skill_id')
|
|
100
|
+
.notNull()
|
|
101
|
+
.references(() => builtSkills.id, { onDelete: 'cascade' }),
|
|
102
|
+
position: integer('position').notNull().default(0),
|
|
103
|
+
configOverrides: text('config_overrides').default('{}'), // JSON
|
|
104
|
+
});
|
|
105
|
+
// ── Agent Built Skills (junction: gateway agent → built skill) ────────
|
|
106
|
+
export const agentBuiltSkills = sqliteTable('agent_built_skills', {
|
|
107
|
+
id: text('id').primaryKey(),
|
|
108
|
+
gatewayAgentId: text('gateway_agent_id').notNull(),
|
|
109
|
+
serverId: text('server_id')
|
|
110
|
+
.notNull()
|
|
111
|
+
.references(() => servers.id, { onDelete: 'cascade' }),
|
|
112
|
+
tenantId: text('tenant_id')
|
|
113
|
+
.notNull()
|
|
114
|
+
.references(() => organization.id, { onDelete: 'cascade' }),
|
|
115
|
+
skillId: text('skill_id')
|
|
116
|
+
.notNull()
|
|
117
|
+
.references(() => builtSkills.id, { onDelete: 'cascade' }),
|
|
118
|
+
position: integer('position').notNull().default(0),
|
|
119
|
+
createdAt: integer('created_at').notNull(),
|
|
120
|
+
});
|
|
121
|
+
// ── Built Tools (admin-only playground) ──────────────────────────────
|
|
122
|
+
export const builtTools = sqliteTable('built_tools', {
|
|
123
|
+
id: text('id').primaryKey(),
|
|
124
|
+
name: text('name').notNull(),
|
|
125
|
+
description: text('description').default(''),
|
|
126
|
+
scriptCode: text('script_code').default(''),
|
|
127
|
+
scriptLang: text('script_lang', { enum: ['javascript', 'python', 'bash'] })
|
|
128
|
+
.notNull()
|
|
129
|
+
.default('javascript'),
|
|
130
|
+
envVars: text('env_vars').default('{}'), // JSON key-value
|
|
131
|
+
validationRules: text('validation_rules').default('{}'), // JSON input schema
|
|
132
|
+
executionConfig: text('execution_config').default('{}'), // JSON timeout, retries
|
|
133
|
+
status: text('status', { enum: ['draft', 'published'] })
|
|
134
|
+
.notNull()
|
|
135
|
+
.default('draft'),
|
|
136
|
+
serverId: text('server_id').references(() => servers.id, { onDelete: 'cascade' }),
|
|
137
|
+
tenantId: text('tenant_id').references(() => organization.id, { onDelete: 'cascade' }),
|
|
138
|
+
createdBy: text('created_by'),
|
|
139
|
+
publishedAt: integer('published_at'),
|
|
140
|
+
createdAt: integer('created_at').notNull(),
|
|
141
|
+
updatedAt: integer('updated_at').notNull(),
|
|
142
|
+
});
|
|
143
|
+
//# sourceMappingURL=builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builder.js","sourceRoot":"","sources":["../../src/schema/builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,yEAAyE;AACzE,MAAM,CAAC,MAAM,WAAW,GAAG,WAAW,CAAC,cAAc,EAAE;IACrD,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE;IAC3B,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE;IAC5B,WAAW,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;IAC5C,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;IAClC,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC,OAAO,EAAE,WAAW,CA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GAAG,EAAE,CAAC,YAAY,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IACtF,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC;IAC7B,WAAW,EAAE,OAAO,CAAC,cAAc,CAAC;IACpC,SAAS,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE;IAC1C,SAAS,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE;CAC3C,CAAC,CAAC"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
export declare const channelAssignments: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
2
|
+
name: "channel_assignments";
|
|
3
|
+
schema: undefined;
|
|
4
|
+
columns: {
|
|
5
|
+
id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
6
|
+
name: "id";
|
|
7
|
+
tableName: "channel_assignments";
|
|
8
|
+
dataType: "string";
|
|
9
|
+
columnType: "SQLiteText";
|
|
10
|
+
data: string;
|
|
11
|
+
driverParam: string;
|
|
12
|
+
notNull: true;
|
|
13
|
+
hasDefault: false;
|
|
14
|
+
isPrimaryKey: true;
|
|
15
|
+
isAutoincrement: false;
|
|
16
|
+
hasRuntimeDefault: false;
|
|
17
|
+
enumValues: [string, ...string[]];
|
|
18
|
+
baseColumn: never;
|
|
19
|
+
identity: undefined;
|
|
20
|
+
generated: undefined;
|
|
21
|
+
}, {}, {
|
|
22
|
+
length: number | undefined;
|
|
23
|
+
}>;
|
|
24
|
+
tenantId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
25
|
+
name: "tenant_id";
|
|
26
|
+
tableName: "channel_assignments";
|
|
27
|
+
dataType: "string";
|
|
28
|
+
columnType: "SQLiteText";
|
|
29
|
+
data: string;
|
|
30
|
+
driverParam: string;
|
|
31
|
+
notNull: true;
|
|
32
|
+
hasDefault: false;
|
|
33
|
+
isPrimaryKey: false;
|
|
34
|
+
isAutoincrement: false;
|
|
35
|
+
hasRuntimeDefault: false;
|
|
36
|
+
enumValues: [string, ...string[]];
|
|
37
|
+
baseColumn: never;
|
|
38
|
+
identity: undefined;
|
|
39
|
+
generated: undefined;
|
|
40
|
+
}, {}, {
|
|
41
|
+
length: number | undefined;
|
|
42
|
+
}>;
|
|
43
|
+
channelId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
44
|
+
name: "channel_id";
|
|
45
|
+
tableName: "channel_assignments";
|
|
46
|
+
dataType: "string";
|
|
47
|
+
columnType: "SQLiteText";
|
|
48
|
+
data: string;
|
|
49
|
+
driverParam: string;
|
|
50
|
+
notNull: true;
|
|
51
|
+
hasDefault: false;
|
|
52
|
+
isPrimaryKey: false;
|
|
53
|
+
isAutoincrement: false;
|
|
54
|
+
hasRuntimeDefault: false;
|
|
55
|
+
enumValues: [string, ...string[]];
|
|
56
|
+
baseColumn: never;
|
|
57
|
+
identity: undefined;
|
|
58
|
+
generated: undefined;
|
|
59
|
+
}, {}, {
|
|
60
|
+
length: number | undefined;
|
|
61
|
+
}>;
|
|
62
|
+
targetType: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
63
|
+
name: "target_type";
|
|
64
|
+
tableName: "channel_assignments";
|
|
65
|
+
dataType: "string";
|
|
66
|
+
columnType: "SQLiteText";
|
|
67
|
+
data: "user" | "session";
|
|
68
|
+
driverParam: string;
|
|
69
|
+
notNull: true;
|
|
70
|
+
hasDefault: false;
|
|
71
|
+
isPrimaryKey: false;
|
|
72
|
+
isAutoincrement: false;
|
|
73
|
+
hasRuntimeDefault: false;
|
|
74
|
+
enumValues: ["user", "session"];
|
|
75
|
+
baseColumn: never;
|
|
76
|
+
identity: undefined;
|
|
77
|
+
generated: undefined;
|
|
78
|
+
}, {}, {
|
|
79
|
+
length: number | undefined;
|
|
80
|
+
}>;
|
|
81
|
+
targetId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
82
|
+
name: "target_id";
|
|
83
|
+
tableName: "channel_assignments";
|
|
84
|
+
dataType: "string";
|
|
85
|
+
columnType: "SQLiteText";
|
|
86
|
+
data: string;
|
|
87
|
+
driverParam: string;
|
|
88
|
+
notNull: true;
|
|
89
|
+
hasDefault: false;
|
|
90
|
+
isPrimaryKey: false;
|
|
91
|
+
isAutoincrement: false;
|
|
92
|
+
hasRuntimeDefault: false;
|
|
93
|
+
enumValues: [string, ...string[]];
|
|
94
|
+
baseColumn: never;
|
|
95
|
+
identity: undefined;
|
|
96
|
+
generated: undefined;
|
|
97
|
+
}, {}, {
|
|
98
|
+
length: number | undefined;
|
|
99
|
+
}>;
|
|
100
|
+
createdAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
101
|
+
name: "created_at";
|
|
102
|
+
tableName: "channel_assignments";
|
|
103
|
+
dataType: "number";
|
|
104
|
+
columnType: "SQLiteInteger";
|
|
105
|
+
data: number;
|
|
106
|
+
driverParam: number;
|
|
107
|
+
notNull: true;
|
|
108
|
+
hasDefault: false;
|
|
109
|
+
isPrimaryKey: false;
|
|
110
|
+
isAutoincrement: false;
|
|
111
|
+
hasRuntimeDefault: false;
|
|
112
|
+
enumValues: undefined;
|
|
113
|
+
baseColumn: never;
|
|
114
|
+
identity: undefined;
|
|
115
|
+
generated: undefined;
|
|
116
|
+
}, {}, {}>;
|
|
117
|
+
};
|
|
118
|
+
dialect: "sqlite";
|
|
119
|
+
}>;
|
|
120
|
+
//# sourceMappingURL=channel-assignments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channel-assignments.d.ts","sourceRoot":"","sources":["../../src/schema/channel-assignments.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkB9B,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { sqliteTable, text, integer, index, uniqueIndex } from 'drizzle-orm/sqlite-core';
|
|
2
|
+
import { organization } from './auth/index.js';
|
|
3
|
+
import { channels } from './channels.js';
|
|
4
|
+
export const channelAssignments = sqliteTable('channel_assignments', {
|
|
5
|
+
id: text('id').primaryKey(),
|
|
6
|
+
tenantId: text('tenant_id')
|
|
7
|
+
.notNull()
|
|
8
|
+
.references(() => organization.id, { onDelete: 'cascade' }),
|
|
9
|
+
channelId: text('channel_id')
|
|
10
|
+
.notNull()
|
|
11
|
+
.references(() => channels.id, { onDelete: 'cascade' }),
|
|
12
|
+
targetType: text('target_type', { enum: ['user', 'session'] }).notNull(),
|
|
13
|
+
targetId: text('target_id').notNull(),
|
|
14
|
+
createdAt: integer('created_at').notNull(),
|
|
15
|
+
}, (t) => [
|
|
16
|
+
index('idx_channel_assign_channel').on(t.channelId),
|
|
17
|
+
uniqueIndex('channel_assign_uniq').on(t.channelId, t.targetType, t.targetId),
|
|
18
|
+
]);
|
|
19
|
+
//# sourceMappingURL=channel-assignments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channel-assignments.js","sourceRoot":"","sources":["../../src/schema/channel-assignments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACzF,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,CAAC,MAAM,kBAAkB,GAAG,WAAW,CAC3C,qBAAqB,EACrB;IACE,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE;IAC3B,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC;SACxB,OAAO,EAAE;SACT,UAAU,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IAC7D,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC;SAC1B,OAAO,EAAE;SACT,UAAU,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IACzD,UAAU,EAAE,IAAI,CAAC,aAAa,EAAE,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE;IACxE,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,OAAO,EAAE;IACrC,SAAS,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE;CAC3C,EACD,CAAC,CAAC,EAAE,EAAE,CAAC;IACL,KAAK,CAAC,4BAA4B,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IACnD,WAAW,CAAC,qBAAqB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,QAAQ,CAAC;CAC7E,CACF,CAAC"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Maps channel sender IDs (e.g. telegram:12345, discord:67890) to hub users.
|
|
3
|
+
* Used by the gateway to resolve user identity from channel messages.
|
|
4
|
+
*/
|
|
5
|
+
export declare const channelIdentities: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
6
|
+
name: "channel_identities";
|
|
7
|
+
schema: undefined;
|
|
8
|
+
columns: {
|
|
9
|
+
id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
10
|
+
name: "id";
|
|
11
|
+
tableName: "channel_identities";
|
|
12
|
+
dataType: "string";
|
|
13
|
+
columnType: "SQLiteText";
|
|
14
|
+
data: string;
|
|
15
|
+
driverParam: string;
|
|
16
|
+
notNull: true;
|
|
17
|
+
hasDefault: false;
|
|
18
|
+
isPrimaryKey: true;
|
|
19
|
+
isAutoincrement: false;
|
|
20
|
+
hasRuntimeDefault: false;
|
|
21
|
+
enumValues: [string, ...string[]];
|
|
22
|
+
baseColumn: never;
|
|
23
|
+
identity: undefined;
|
|
24
|
+
generated: undefined;
|
|
25
|
+
}, {}, {
|
|
26
|
+
length: number | undefined;
|
|
27
|
+
}>;
|
|
28
|
+
userId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
29
|
+
name: "user_id";
|
|
30
|
+
tableName: "channel_identities";
|
|
31
|
+
dataType: "string";
|
|
32
|
+
columnType: "SQLiteText";
|
|
33
|
+
data: string;
|
|
34
|
+
driverParam: string;
|
|
35
|
+
notNull: true;
|
|
36
|
+
hasDefault: false;
|
|
37
|
+
isPrimaryKey: false;
|
|
38
|
+
isAutoincrement: false;
|
|
39
|
+
hasRuntimeDefault: false;
|
|
40
|
+
enumValues: [string, ...string[]];
|
|
41
|
+
baseColumn: never;
|
|
42
|
+
identity: undefined;
|
|
43
|
+
generated: undefined;
|
|
44
|
+
}, {}, {
|
|
45
|
+
length: number | undefined;
|
|
46
|
+
}>;
|
|
47
|
+
channel: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
48
|
+
name: "channel";
|
|
49
|
+
tableName: "channel_identities";
|
|
50
|
+
dataType: "string";
|
|
51
|
+
columnType: "SQLiteText";
|
|
52
|
+
data: string;
|
|
53
|
+
driverParam: string;
|
|
54
|
+
notNull: true;
|
|
55
|
+
hasDefault: false;
|
|
56
|
+
isPrimaryKey: false;
|
|
57
|
+
isAutoincrement: false;
|
|
58
|
+
hasRuntimeDefault: false;
|
|
59
|
+
enumValues: [string, ...string[]];
|
|
60
|
+
baseColumn: never;
|
|
61
|
+
identity: undefined;
|
|
62
|
+
generated: undefined;
|
|
63
|
+
}, {}, {
|
|
64
|
+
length: number | undefined;
|
|
65
|
+
}>;
|
|
66
|
+
channelUserId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
67
|
+
name: "channel_user_id";
|
|
68
|
+
tableName: "channel_identities";
|
|
69
|
+
dataType: "string";
|
|
70
|
+
columnType: "SQLiteText";
|
|
71
|
+
data: string;
|
|
72
|
+
driverParam: string;
|
|
73
|
+
notNull: true;
|
|
74
|
+
hasDefault: false;
|
|
75
|
+
isPrimaryKey: false;
|
|
76
|
+
isAutoincrement: false;
|
|
77
|
+
hasRuntimeDefault: false;
|
|
78
|
+
enumValues: [string, ...string[]];
|
|
79
|
+
baseColumn: never;
|
|
80
|
+
identity: undefined;
|
|
81
|
+
generated: undefined;
|
|
82
|
+
}, {}, {
|
|
83
|
+
length: number | undefined;
|
|
84
|
+
}>;
|
|
85
|
+
displayName: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
86
|
+
name: "display_name";
|
|
87
|
+
tableName: "channel_identities";
|
|
88
|
+
dataType: "string";
|
|
89
|
+
columnType: "SQLiteText";
|
|
90
|
+
data: string;
|
|
91
|
+
driverParam: string;
|
|
92
|
+
notNull: false;
|
|
93
|
+
hasDefault: false;
|
|
94
|
+
isPrimaryKey: false;
|
|
95
|
+
isAutoincrement: false;
|
|
96
|
+
hasRuntimeDefault: false;
|
|
97
|
+
enumValues: [string, ...string[]];
|
|
98
|
+
baseColumn: never;
|
|
99
|
+
identity: undefined;
|
|
100
|
+
generated: undefined;
|
|
101
|
+
}, {}, {
|
|
102
|
+
length: number | undefined;
|
|
103
|
+
}>;
|
|
104
|
+
verifiedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
105
|
+
name: "verified_at";
|
|
106
|
+
tableName: "channel_identities";
|
|
107
|
+
dataType: "number";
|
|
108
|
+
columnType: "SQLiteInteger";
|
|
109
|
+
data: number;
|
|
110
|
+
driverParam: number;
|
|
111
|
+
notNull: false;
|
|
112
|
+
hasDefault: false;
|
|
113
|
+
isPrimaryKey: false;
|
|
114
|
+
isAutoincrement: false;
|
|
115
|
+
hasRuntimeDefault: false;
|
|
116
|
+
enumValues: undefined;
|
|
117
|
+
baseColumn: never;
|
|
118
|
+
identity: undefined;
|
|
119
|
+
generated: undefined;
|
|
120
|
+
}, {}, {}>;
|
|
121
|
+
createdAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
122
|
+
name: "created_at";
|
|
123
|
+
tableName: "channel_identities";
|
|
124
|
+
dataType: "number";
|
|
125
|
+
columnType: "SQLiteInteger";
|
|
126
|
+
data: number;
|
|
127
|
+
driverParam: number;
|
|
128
|
+
notNull: true;
|
|
129
|
+
hasDefault: false;
|
|
130
|
+
isPrimaryKey: false;
|
|
131
|
+
isAutoincrement: false;
|
|
132
|
+
hasRuntimeDefault: false;
|
|
133
|
+
enumValues: undefined;
|
|
134
|
+
baseColumn: never;
|
|
135
|
+
identity: undefined;
|
|
136
|
+
generated: undefined;
|
|
137
|
+
}, {}, {}>;
|
|
138
|
+
};
|
|
139
|
+
dialect: "sqlite";
|
|
140
|
+
}>;
|
|
141
|
+
//# sourceMappingURL=channel-identities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channel-identities.d.ts","sourceRoot":"","sources":["../../src/schema/channel-identities.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiB7B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { sqliteTable, text, integer, uniqueIndex, index } from 'drizzle-orm/sqlite-core';
|
|
2
|
+
import { user } from './auth/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Maps channel sender IDs (e.g. telegram:12345, discord:67890) to hub users.
|
|
5
|
+
* Used by the gateway to resolve user identity from channel messages.
|
|
6
|
+
*/
|
|
7
|
+
export const channelIdentities = sqliteTable('channel_identities', {
|
|
8
|
+
id: text('id').primaryKey(),
|
|
9
|
+
userId: text('user_id')
|
|
10
|
+
.notNull()
|
|
11
|
+
.references(() => user.id, { onDelete: 'cascade' }),
|
|
12
|
+
channel: text('channel').notNull(),
|
|
13
|
+
channelUserId: text('channel_user_id').notNull(),
|
|
14
|
+
displayName: text('display_name'),
|
|
15
|
+
verifiedAt: integer('verified_at'),
|
|
16
|
+
createdAt: integer('created_at').notNull(),
|
|
17
|
+
}, (t) => [
|
|
18
|
+
uniqueIndex('idx_channel_identity_unique').on(t.channel, t.channelUserId),
|
|
19
|
+
index('idx_channel_identity_user').on(t.userId),
|
|
20
|
+
]);
|
|
21
|
+
//# sourceMappingURL=channel-identities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channel-identities.js","sourceRoot":"","sources":["../../src/schema/channel-identities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AACzF,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEvC;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,WAAW,CAC1C,oBAAoB,EACpB;IACE,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE;IAC3B,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC;SACpB,OAAO,EAAE;SACT,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IACrD,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE;IAClC,aAAa,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC,OAAO,EAAE;IAChD,WAAW,EAAE,IAAI,CAAC,cAAc,CAAC;IACjC,UAAU,EAAE,OAAO,CAAC,aAAa,CAAC;IAClC,SAAS,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE;CAC3C,EACD,CAAC,CAAC,EAAE,EAAE,CAAC;IACL,WAAW,CAAC,6BAA6B,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,aAAa,CAAC;IACzE,KAAK,CAAC,2BAA2B,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;CAChD,CACF,CAAC"}
|