family-ai-agent 1.0.6 → 1.0.7
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/.letta/settings.local.json +3 -0
- package/dist/database/adapters/base-adapter.d.ts +81 -0
- package/dist/database/adapters/base-adapter.d.ts.map +1 -0
- package/dist/database/adapters/base-adapter.js +105 -0
- package/dist/database/adapters/base-adapter.js.map +1 -0
- package/dist/database/adapters/index.d.ts +49 -0
- package/dist/database/adapters/index.d.ts.map +1 -0
- package/dist/database/adapters/index.js +200 -0
- package/dist/database/adapters/index.js.map +1 -0
- package/dist/database/adapters/postgres-adapter.d.ts +75 -0
- package/dist/database/adapters/postgres-adapter.d.ts.map +1 -0
- package/dist/database/adapters/postgres-adapter.js +225 -0
- package/dist/database/adapters/postgres-adapter.js.map +1 -0
- package/dist/database/adapters/sqlite-adapter.d.ts +72 -0
- package/dist/database/adapters/sqlite-adapter.d.ts.map +1 -0
- package/dist/database/adapters/sqlite-adapter.js +368 -0
- package/dist/database/adapters/sqlite-adapter.js.map +1 -0
- package/dist/database/cache/cache-keys.d.ts +180 -0
- package/dist/database/cache/cache-keys.d.ts.map +1 -0
- package/dist/database/cache/cache-keys.js +107 -0
- package/dist/database/cache/cache-keys.js.map +1 -0
- package/dist/database/cache/index.d.ts +24 -0
- package/dist/database/cache/index.d.ts.map +1 -0
- package/dist/database/cache/index.js +34 -0
- package/dist/database/cache/index.js.map +1 -0
- package/dist/database/cache/query-cache.d.ts +67 -0
- package/dist/database/cache/query-cache.d.ts.map +1 -0
- package/dist/database/cache/query-cache.js +177 -0
- package/dist/database/cache/query-cache.js.map +1 -0
- package/dist/database/client.d.ts +63 -4
- package/dist/database/client.d.ts.map +1 -1
- package/dist/database/client.js +147 -59
- package/dist/database/client.js.map +1 -1
- package/dist/database/db-config.d.ts +104 -0
- package/dist/database/db-config.d.ts.map +1 -0
- package/dist/database/db-config.js +167 -0
- package/dist/database/db-config.js.map +1 -0
- package/dist/database/drizzle/index.d.ts +42 -0
- package/dist/database/drizzle/index.d.ts.map +1 -0
- package/dist/database/drizzle/index.js +48 -0
- package/dist/database/drizzle/index.js.map +1 -0
- package/dist/database/drizzle/schema/audit.d.ts +533 -0
- package/dist/database/drizzle/schema/audit.d.ts.map +1 -0
- package/dist/database/drizzle/schema/audit.js +71 -0
- package/dist/database/drizzle/schema/audit.js.map +1 -0
- package/dist/database/drizzle/schema/checkpoints.d.ts +665 -0
- package/dist/database/drizzle/schema/checkpoints.d.ts.map +1 -0
- package/dist/database/drizzle/schema/checkpoints.js +110 -0
- package/dist/database/drizzle/schema/checkpoints.js.map +1 -0
- package/dist/database/drizzle/schema/conversations.d.ts +449 -0
- package/dist/database/drizzle/schema/conversations.d.ts.map +1 -0
- package/dist/database/drizzle/schema/conversations.js +91 -0
- package/dist/database/drizzle/schema/conversations.js.map +1 -0
- package/dist/database/drizzle/schema/documents.d.ts +600 -0
- package/dist/database/drizzle/schema/documents.d.ts.map +1 -0
- package/dist/database/drizzle/schema/documents.js +100 -0
- package/dist/database/drizzle/schema/documents.js.map +1 -0
- package/dist/database/drizzle/schema/index.d.ts +3084 -0
- package/dist/database/drizzle/schema/index.d.ts.map +1 -0
- package/dist/database/drizzle/schema/index.js +46 -0
- package/dist/database/drizzle/schema/index.js.map +1 -0
- package/dist/database/drizzle/schema/memories.d.ts +435 -0
- package/dist/database/drizzle/schema/memories.d.ts.map +1 -0
- package/dist/database/drizzle/schema/memories.js +73 -0
- package/dist/database/drizzle/schema/memories.js.map +1 -0
- package/dist/database/drizzle/schema/tasks.d.ts +565 -0
- package/dist/database/drizzle/schema/tasks.d.ts.map +1 -0
- package/dist/database/drizzle/schema/tasks.js +84 -0
- package/dist/database/drizzle/schema/tasks.js.map +1 -0
- package/dist/database/health/circuit-breaker.d.ts +81 -0
- package/dist/database/health/circuit-breaker.d.ts.map +1 -0
- package/dist/database/health/circuit-breaker.js +184 -0
- package/dist/database/health/circuit-breaker.js.map +1 -0
- package/dist/database/health/health-monitor.d.ts +69 -0
- package/dist/database/health/health-monitor.d.ts.map +1 -0
- package/dist/database/health/health-monitor.js +174 -0
- package/dist/database/health/health-monitor.js.map +1 -0
- package/dist/database/health/index.d.ts +27 -0
- package/dist/database/health/index.d.ts.map +1 -0
- package/dist/database/health/index.js +23 -0
- package/dist/database/health/index.js.map +1 -0
- package/dist/database/index.d.ts +16 -0
- package/dist/database/index.d.ts.map +1 -0
- package/dist/database/index.js +41 -0
- package/dist/database/index.js.map +1 -0
- package/dist/database/migrations/index.d.ts +34 -0
- package/dist/database/migrations/index.d.ts.map +1 -0
- package/dist/database/migrations/index.js +45 -0
- package/dist/database/migrations/index.js.map +1 -0
- package/dist/database/migrations/migrator.d.ts +77 -0
- package/dist/database/migrations/migrator.d.ts.map +1 -0
- package/dist/database/migrations/migrator.js +258 -0
- package/dist/database/migrations/migrator.js.map +1 -0
- package/dist/database/migrations/versions/001_initial.d.ts +9 -0
- package/dist/database/migrations/versions/001_initial.d.ts.map +1 -0
- package/dist/database/migrations/versions/001_initial.js +183 -0
- package/dist/database/migrations/versions/001_initial.js.map +1 -0
- package/dist/database/types.d.ts +255 -0
- package/dist/database/types.d.ts.map +1 -0
- package/dist/database/types.js +8 -0
- package/dist/database/types.js.map +1 -0
- package/dist/database/vector/embedding-cache.d.ts +92 -0
- package/dist/database/vector/embedding-cache.d.ts.map +1 -0
- package/dist/database/vector/embedding-cache.js +185 -0
- package/dist/database/vector/embedding-cache.js.map +1 -0
- package/dist/database/vector/hnsw-index.d.ts +111 -0
- package/dist/database/vector/hnsw-index.d.ts.map +1 -0
- package/dist/database/vector/hnsw-index.js +337 -0
- package/dist/database/vector/hnsw-index.js.map +1 -0
- package/dist/database/vector/index.d.ts +75 -0
- package/dist/database/vector/index.d.ts.map +1 -0
- package/dist/database/vector/index.js +213 -0
- package/dist/database/vector/index.js.map +1 -0
- package/dist/database/vector/similarity.d.ts +67 -0
- package/dist/database/vector/similarity.d.ts.map +1 -0
- package/dist/database/vector/similarity.js +176 -0
- package/dist/database/vector/similarity.js.map +1 -0
- package/package.json +6 -3
- package/src/database/adapters/base-adapter.ts +171 -0
- package/src/database/adapters/index.ts +224 -0
- package/src/database/adapters/postgres-adapter.ts +285 -0
- package/src/database/adapters/sqlite-adapter.ts +420 -0
- package/src/database/cache/cache-keys.ts +150 -0
- package/src/database/cache/index.ts +44 -0
- package/src/database/cache/query-cache.ts +213 -0
- package/src/database/client.ts +166 -64
- package/src/database/db-config.ts +194 -0
- package/src/database/drizzle/index.ts +66 -0
- package/src/database/drizzle/schema/audit.ts +127 -0
- package/src/database/drizzle/schema/checkpoints.ts +164 -0
- package/src/database/drizzle/schema/conversations.ts +138 -0
- package/src/database/drizzle/schema/documents.ts +157 -0
- package/src/database/drizzle/schema/index.ts +139 -0
- package/src/database/drizzle/schema/memories.ts +127 -0
- package/src/database/drizzle/schema/tasks.ts +129 -0
- package/src/database/health/circuit-breaker.ts +214 -0
- package/src/database/health/health-monitor.ts +224 -0
- package/src/database/health/index.ts +41 -0
- package/src/database/index.ts +157 -0
- package/src/database/migrations/index.ts +52 -0
- package/src/database/migrations/migrator.ts +325 -0
- package/src/database/migrations/versions/001_initial.ts +198 -0
- package/src/database/types.ts +324 -0
- package/src/database/vector/embedding-cache.ts +234 -0
- package/src/database/vector/hnsw-index.ts +452 -0
- package/src/database/vector/index.ts +292 -0
- package/src/database/vector/similarity.ts +198 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checkpoints Schema
|
|
3
|
+
*
|
|
4
|
+
* Drizzle ORM schema for LangGraph checkpointing.
|
|
5
|
+
* Stores execution state for resumable workflows.
|
|
6
|
+
*/
|
|
7
|
+
import { pgTable, text, timestamp, jsonb, primaryKey, integer, } from 'drizzle-orm/pg-core';
|
|
8
|
+
import { sqliteTable, text as sqliteText, integer as sqliteInteger, primaryKey as sqlitePrimaryKey, } from 'drizzle-orm/sqlite-core';
|
|
9
|
+
// =============================================================================
|
|
10
|
+
// PostgreSQL Schema
|
|
11
|
+
// =============================================================================
|
|
12
|
+
/**
|
|
13
|
+
* Checkpoints table (PostgreSQL)
|
|
14
|
+
*/
|
|
15
|
+
export const checkpointsPg = pgTable('checkpoints', {
|
|
16
|
+
threadId: text('thread_id').notNull(),
|
|
17
|
+
checkpointNs: text('checkpoint_ns').default('').notNull(),
|
|
18
|
+
checkpointId: text('checkpoint_id').notNull(),
|
|
19
|
+
parentCheckpointId: text('parent_checkpoint_id'),
|
|
20
|
+
type: text('type'),
|
|
21
|
+
checkpoint: jsonb('checkpoint').notNull(),
|
|
22
|
+
metadata: jsonb('metadata').default({}).notNull(),
|
|
23
|
+
createdAt: timestamp('created_at', { withTimezone: true })
|
|
24
|
+
.defaultNow()
|
|
25
|
+
.notNull(),
|
|
26
|
+
}, (table) => ({
|
|
27
|
+
pk: primaryKey({
|
|
28
|
+
columns: [table.threadId, table.checkpointNs, table.checkpointId],
|
|
29
|
+
}),
|
|
30
|
+
}));
|
|
31
|
+
/**
|
|
32
|
+
* Checkpoint writes table (PostgreSQL)
|
|
33
|
+
*/
|
|
34
|
+
export const checkpointWritesPg = pgTable('checkpoint_writes', {
|
|
35
|
+
threadId: text('thread_id').notNull(),
|
|
36
|
+
checkpointNs: text('checkpoint_ns').default('').notNull(),
|
|
37
|
+
checkpointId: text('checkpoint_id').notNull(),
|
|
38
|
+
taskId: text('task_id').notNull(),
|
|
39
|
+
idx: integer('idx').notNull(),
|
|
40
|
+
channel: text('channel').notNull(),
|
|
41
|
+
type: text('type'),
|
|
42
|
+
value: jsonb('value'),
|
|
43
|
+
createdAt: timestamp('created_at', { withTimezone: true })
|
|
44
|
+
.defaultNow()
|
|
45
|
+
.notNull(),
|
|
46
|
+
}, (table) => ({
|
|
47
|
+
pk: primaryKey({
|
|
48
|
+
columns: [
|
|
49
|
+
table.threadId,
|
|
50
|
+
table.checkpointNs,
|
|
51
|
+
table.checkpointId,
|
|
52
|
+
table.taskId,
|
|
53
|
+
table.idx,
|
|
54
|
+
],
|
|
55
|
+
}),
|
|
56
|
+
}));
|
|
57
|
+
// =============================================================================
|
|
58
|
+
// SQLite Schema
|
|
59
|
+
// =============================================================================
|
|
60
|
+
/**
|
|
61
|
+
* Checkpoints table (SQLite)
|
|
62
|
+
*/
|
|
63
|
+
export const checkpointsSqlite = sqliteTable('checkpoints', {
|
|
64
|
+
threadId: sqliteText('thread_id').notNull(),
|
|
65
|
+
checkpointNs: sqliteText('checkpoint_ns').default('').notNull(),
|
|
66
|
+
checkpointId: sqliteText('checkpoint_id').notNull(),
|
|
67
|
+
parentCheckpointId: sqliteText('parent_checkpoint_id'),
|
|
68
|
+
type: sqliteText('type'),
|
|
69
|
+
checkpoint: sqliteText('checkpoint', { mode: 'json' })
|
|
70
|
+
.notNull()
|
|
71
|
+
.$type(),
|
|
72
|
+
metadata: sqliteText('metadata', { mode: 'json' })
|
|
73
|
+
.notNull()
|
|
74
|
+
.$type()
|
|
75
|
+
.default({}),
|
|
76
|
+
createdAt: sqliteInteger('created_at', { mode: 'timestamp' })
|
|
77
|
+
.notNull()
|
|
78
|
+
.$defaultFn(() => new Date()),
|
|
79
|
+
}, (table) => ({
|
|
80
|
+
pk: sqlitePrimaryKey({
|
|
81
|
+
columns: [table.threadId, table.checkpointNs, table.checkpointId],
|
|
82
|
+
}),
|
|
83
|
+
}));
|
|
84
|
+
/**
|
|
85
|
+
* Checkpoint writes table (SQLite)
|
|
86
|
+
*/
|
|
87
|
+
export const checkpointWritesSqlite = sqliteTable('checkpoint_writes', {
|
|
88
|
+
threadId: sqliteText('thread_id').notNull(),
|
|
89
|
+
checkpointNs: sqliteText('checkpoint_ns').default('').notNull(),
|
|
90
|
+
checkpointId: sqliteText('checkpoint_id').notNull(),
|
|
91
|
+
taskId: sqliteText('task_id').notNull(),
|
|
92
|
+
idx: sqliteInteger('idx').notNull(),
|
|
93
|
+
channel: sqliteText('channel').notNull(),
|
|
94
|
+
type: sqliteText('type'),
|
|
95
|
+
value: sqliteText('value', { mode: 'json' }).$type(),
|
|
96
|
+
createdAt: sqliteInteger('created_at', { mode: 'timestamp' })
|
|
97
|
+
.notNull()
|
|
98
|
+
.$defaultFn(() => new Date()),
|
|
99
|
+
}, (table) => ({
|
|
100
|
+
pk: sqlitePrimaryKey({
|
|
101
|
+
columns: [
|
|
102
|
+
table.threadId,
|
|
103
|
+
table.checkpointNs,
|
|
104
|
+
table.checkpointId,
|
|
105
|
+
table.taskId,
|
|
106
|
+
table.idx,
|
|
107
|
+
],
|
|
108
|
+
}),
|
|
109
|
+
}));
|
|
110
|
+
//# sourceMappingURL=checkpoints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkpoints.js","sourceRoot":"","sources":["../../../../src/database/drizzle/schema/checkpoints.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,OAAO,EACP,IAAI,EACJ,SAAS,EACT,KAAK,EACL,UAAU,EACV,OAAO,GACR,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,WAAW,EACX,IAAI,IAAI,UAAU,EAClB,OAAO,IAAI,aAAa,EACxB,UAAU,IAAI,gBAAgB,GAC/B,MAAM,yBAAyB,CAAC;AAEjC,gFAAgF;AAChF,oBAAoB;AACpB,gFAAgF;AAEhF;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,OAAO,CAClC,aAAa,EACb;IACE,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,OAAO,EAAE;IACrC,YAAY,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE;IACzD,YAAY,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC,OAAO,EAAE;IAC7C,kBAAkB,EAAE,IAAI,CAAC,sBAAsB,CAAC;IAChD,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;IAClB,UAAU,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE;IACzC,QAAQ,EAAE,KAA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,CAAC,CAAC,OAAO,EAAE;IAC3C,YAAY,EAAE,UAAU,CAAC,eAAe,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE;IAC/D,YAAY,EAAE,UAAU,CAAC,eAAe,CAAC,CAAC,OAAO,EAAE;IACnD,MAAM,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE;IACvC,GAAG,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE;IACnC,OAAO,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE;IACxC,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC;IACxB,KAAK,EAAE,UAAU,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,KAAK,EAAW;IAC7D,SAAS,EAAE,aAAa,CAAC,YAAY,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;SAC1D,OAAO,EAAE;SACT,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC;CAChC,EACD,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACV,EAAE,EAAE,gBAAgB,CAAC;QACnB,OAAO,EAAE;YACP,KAAK,CAAC,QAAQ;YACd,KAAK,CAAC,YAAY;YAClB,KAAK,CAAC,YAAY;YAClB,KAAK,CAAC,MAAM;YACZ,KAAK,CAAC,GAAG;SACV;KACF,CAAC;CACH,CAAC,CACH,CAAC"}
|
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Conversations Schema
|
|
3
|
+
*
|
|
4
|
+
* Drizzle ORM schema for conversations and messages tables.
|
|
5
|
+
* Supports both PostgreSQL and SQLite.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Conversations table (PostgreSQL)
|
|
9
|
+
*/
|
|
10
|
+
export declare const conversationsPg: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
11
|
+
name: "conversations";
|
|
12
|
+
schema: undefined;
|
|
13
|
+
columns: {
|
|
14
|
+
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
15
|
+
name: "id";
|
|
16
|
+
tableName: "conversations";
|
|
17
|
+
dataType: "string";
|
|
18
|
+
columnType: "PgUUID";
|
|
19
|
+
data: string;
|
|
20
|
+
driverParam: string;
|
|
21
|
+
notNull: true;
|
|
22
|
+
hasDefault: true;
|
|
23
|
+
isPrimaryKey: true;
|
|
24
|
+
isAutoincrement: false;
|
|
25
|
+
hasRuntimeDefault: false;
|
|
26
|
+
enumValues: undefined;
|
|
27
|
+
baseColumn: never;
|
|
28
|
+
identity: undefined;
|
|
29
|
+
generated: undefined;
|
|
30
|
+
}, {}, {}>;
|
|
31
|
+
threadId: import("drizzle-orm/pg-core").PgColumn<{
|
|
32
|
+
name: "thread_id";
|
|
33
|
+
tableName: "conversations";
|
|
34
|
+
dataType: "string";
|
|
35
|
+
columnType: "PgText";
|
|
36
|
+
data: string;
|
|
37
|
+
driverParam: string;
|
|
38
|
+
notNull: true;
|
|
39
|
+
hasDefault: false;
|
|
40
|
+
isPrimaryKey: false;
|
|
41
|
+
isAutoincrement: false;
|
|
42
|
+
hasRuntimeDefault: false;
|
|
43
|
+
enumValues: [string, ...string[]];
|
|
44
|
+
baseColumn: never;
|
|
45
|
+
identity: undefined;
|
|
46
|
+
generated: undefined;
|
|
47
|
+
}, {}, {}>;
|
|
48
|
+
userId: import("drizzle-orm/pg-core").PgColumn<{
|
|
49
|
+
name: "user_id";
|
|
50
|
+
tableName: "conversations";
|
|
51
|
+
dataType: "string";
|
|
52
|
+
columnType: "PgText";
|
|
53
|
+
data: string;
|
|
54
|
+
driverParam: string;
|
|
55
|
+
notNull: false;
|
|
56
|
+
hasDefault: false;
|
|
57
|
+
isPrimaryKey: false;
|
|
58
|
+
isAutoincrement: false;
|
|
59
|
+
hasRuntimeDefault: false;
|
|
60
|
+
enumValues: [string, ...string[]];
|
|
61
|
+
baseColumn: never;
|
|
62
|
+
identity: undefined;
|
|
63
|
+
generated: undefined;
|
|
64
|
+
}, {}, {}>;
|
|
65
|
+
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
66
|
+
name: "created_at";
|
|
67
|
+
tableName: "conversations";
|
|
68
|
+
dataType: "date";
|
|
69
|
+
columnType: "PgTimestamp";
|
|
70
|
+
data: Date;
|
|
71
|
+
driverParam: string;
|
|
72
|
+
notNull: true;
|
|
73
|
+
hasDefault: true;
|
|
74
|
+
isPrimaryKey: false;
|
|
75
|
+
isAutoincrement: false;
|
|
76
|
+
hasRuntimeDefault: false;
|
|
77
|
+
enumValues: undefined;
|
|
78
|
+
baseColumn: never;
|
|
79
|
+
identity: undefined;
|
|
80
|
+
generated: undefined;
|
|
81
|
+
}, {}, {}>;
|
|
82
|
+
updatedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
83
|
+
name: "updated_at";
|
|
84
|
+
tableName: "conversations";
|
|
85
|
+
dataType: "date";
|
|
86
|
+
columnType: "PgTimestamp";
|
|
87
|
+
data: Date;
|
|
88
|
+
driverParam: string;
|
|
89
|
+
notNull: true;
|
|
90
|
+
hasDefault: true;
|
|
91
|
+
isPrimaryKey: false;
|
|
92
|
+
isAutoincrement: false;
|
|
93
|
+
hasRuntimeDefault: false;
|
|
94
|
+
enumValues: undefined;
|
|
95
|
+
baseColumn: never;
|
|
96
|
+
identity: undefined;
|
|
97
|
+
generated: undefined;
|
|
98
|
+
}, {}, {}>;
|
|
99
|
+
};
|
|
100
|
+
dialect: "pg";
|
|
101
|
+
}>;
|
|
102
|
+
/**
|
|
103
|
+
* Messages table (PostgreSQL)
|
|
104
|
+
*/
|
|
105
|
+
export declare const messagesPg: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
106
|
+
name: "messages";
|
|
107
|
+
schema: undefined;
|
|
108
|
+
columns: {
|
|
109
|
+
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
110
|
+
name: "id";
|
|
111
|
+
tableName: "messages";
|
|
112
|
+
dataType: "string";
|
|
113
|
+
columnType: "PgUUID";
|
|
114
|
+
data: string;
|
|
115
|
+
driverParam: string;
|
|
116
|
+
notNull: true;
|
|
117
|
+
hasDefault: true;
|
|
118
|
+
isPrimaryKey: true;
|
|
119
|
+
isAutoincrement: false;
|
|
120
|
+
hasRuntimeDefault: false;
|
|
121
|
+
enumValues: undefined;
|
|
122
|
+
baseColumn: never;
|
|
123
|
+
identity: undefined;
|
|
124
|
+
generated: undefined;
|
|
125
|
+
}, {}, {}>;
|
|
126
|
+
conversationId: import("drizzle-orm/pg-core").PgColumn<{
|
|
127
|
+
name: "conversation_id";
|
|
128
|
+
tableName: "messages";
|
|
129
|
+
dataType: "string";
|
|
130
|
+
columnType: "PgUUID";
|
|
131
|
+
data: string;
|
|
132
|
+
driverParam: string;
|
|
133
|
+
notNull: true;
|
|
134
|
+
hasDefault: false;
|
|
135
|
+
isPrimaryKey: false;
|
|
136
|
+
isAutoincrement: false;
|
|
137
|
+
hasRuntimeDefault: false;
|
|
138
|
+
enumValues: undefined;
|
|
139
|
+
baseColumn: never;
|
|
140
|
+
identity: undefined;
|
|
141
|
+
generated: undefined;
|
|
142
|
+
}, {}, {}>;
|
|
143
|
+
role: import("drizzle-orm/pg-core").PgColumn<{
|
|
144
|
+
name: "role";
|
|
145
|
+
tableName: "messages";
|
|
146
|
+
dataType: "string";
|
|
147
|
+
columnType: "PgText";
|
|
148
|
+
data: string;
|
|
149
|
+
driverParam: string;
|
|
150
|
+
notNull: true;
|
|
151
|
+
hasDefault: false;
|
|
152
|
+
isPrimaryKey: false;
|
|
153
|
+
isAutoincrement: false;
|
|
154
|
+
hasRuntimeDefault: false;
|
|
155
|
+
enumValues: [string, ...string[]];
|
|
156
|
+
baseColumn: never;
|
|
157
|
+
identity: undefined;
|
|
158
|
+
generated: undefined;
|
|
159
|
+
}, {}, {}>;
|
|
160
|
+
content: import("drizzle-orm/pg-core").PgColumn<{
|
|
161
|
+
name: "content";
|
|
162
|
+
tableName: "messages";
|
|
163
|
+
dataType: "string";
|
|
164
|
+
columnType: "PgText";
|
|
165
|
+
data: string;
|
|
166
|
+
driverParam: string;
|
|
167
|
+
notNull: true;
|
|
168
|
+
hasDefault: false;
|
|
169
|
+
isPrimaryKey: false;
|
|
170
|
+
isAutoincrement: false;
|
|
171
|
+
hasRuntimeDefault: false;
|
|
172
|
+
enumValues: [string, ...string[]];
|
|
173
|
+
baseColumn: never;
|
|
174
|
+
identity: undefined;
|
|
175
|
+
generated: undefined;
|
|
176
|
+
}, {}, {}>;
|
|
177
|
+
metadata: import("drizzle-orm/pg-core").PgColumn<{
|
|
178
|
+
name: "metadata";
|
|
179
|
+
tableName: "messages";
|
|
180
|
+
dataType: "json";
|
|
181
|
+
columnType: "PgJsonb";
|
|
182
|
+
data: unknown;
|
|
183
|
+
driverParam: unknown;
|
|
184
|
+
notNull: true;
|
|
185
|
+
hasDefault: true;
|
|
186
|
+
isPrimaryKey: false;
|
|
187
|
+
isAutoincrement: false;
|
|
188
|
+
hasRuntimeDefault: false;
|
|
189
|
+
enumValues: undefined;
|
|
190
|
+
baseColumn: never;
|
|
191
|
+
identity: undefined;
|
|
192
|
+
generated: undefined;
|
|
193
|
+
}, {}, {}>;
|
|
194
|
+
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
195
|
+
name: "created_at";
|
|
196
|
+
tableName: "messages";
|
|
197
|
+
dataType: "date";
|
|
198
|
+
columnType: "PgTimestamp";
|
|
199
|
+
data: Date;
|
|
200
|
+
driverParam: string;
|
|
201
|
+
notNull: true;
|
|
202
|
+
hasDefault: true;
|
|
203
|
+
isPrimaryKey: false;
|
|
204
|
+
isAutoincrement: false;
|
|
205
|
+
hasRuntimeDefault: false;
|
|
206
|
+
enumValues: undefined;
|
|
207
|
+
baseColumn: never;
|
|
208
|
+
identity: undefined;
|
|
209
|
+
generated: undefined;
|
|
210
|
+
}, {}, {}>;
|
|
211
|
+
};
|
|
212
|
+
dialect: "pg";
|
|
213
|
+
}>;
|
|
214
|
+
/**
|
|
215
|
+
* Conversations table (SQLite)
|
|
216
|
+
*/
|
|
217
|
+
export declare const conversationsSqlite: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
218
|
+
name: "conversations";
|
|
219
|
+
schema: undefined;
|
|
220
|
+
columns: {
|
|
221
|
+
id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
222
|
+
name: "id";
|
|
223
|
+
tableName: "conversations";
|
|
224
|
+
dataType: "string";
|
|
225
|
+
columnType: "SQLiteText";
|
|
226
|
+
data: string;
|
|
227
|
+
driverParam: string;
|
|
228
|
+
notNull: true;
|
|
229
|
+
hasDefault: true;
|
|
230
|
+
isPrimaryKey: true;
|
|
231
|
+
isAutoincrement: false;
|
|
232
|
+
hasRuntimeDefault: true;
|
|
233
|
+
enumValues: [string, ...string[]];
|
|
234
|
+
baseColumn: never;
|
|
235
|
+
identity: undefined;
|
|
236
|
+
generated: undefined;
|
|
237
|
+
}, {}, {
|
|
238
|
+
length: number | undefined;
|
|
239
|
+
}>;
|
|
240
|
+
threadId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
241
|
+
name: "thread_id";
|
|
242
|
+
tableName: "conversations";
|
|
243
|
+
dataType: "string";
|
|
244
|
+
columnType: "SQLiteText";
|
|
245
|
+
data: string;
|
|
246
|
+
driverParam: string;
|
|
247
|
+
notNull: true;
|
|
248
|
+
hasDefault: false;
|
|
249
|
+
isPrimaryKey: false;
|
|
250
|
+
isAutoincrement: false;
|
|
251
|
+
hasRuntimeDefault: false;
|
|
252
|
+
enumValues: [string, ...string[]];
|
|
253
|
+
baseColumn: never;
|
|
254
|
+
identity: undefined;
|
|
255
|
+
generated: undefined;
|
|
256
|
+
}, {}, {
|
|
257
|
+
length: number | undefined;
|
|
258
|
+
}>;
|
|
259
|
+
userId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
260
|
+
name: "user_id";
|
|
261
|
+
tableName: "conversations";
|
|
262
|
+
dataType: "string";
|
|
263
|
+
columnType: "SQLiteText";
|
|
264
|
+
data: string;
|
|
265
|
+
driverParam: string;
|
|
266
|
+
notNull: false;
|
|
267
|
+
hasDefault: false;
|
|
268
|
+
isPrimaryKey: false;
|
|
269
|
+
isAutoincrement: false;
|
|
270
|
+
hasRuntimeDefault: false;
|
|
271
|
+
enumValues: [string, ...string[]];
|
|
272
|
+
baseColumn: never;
|
|
273
|
+
identity: undefined;
|
|
274
|
+
generated: undefined;
|
|
275
|
+
}, {}, {
|
|
276
|
+
length: number | undefined;
|
|
277
|
+
}>;
|
|
278
|
+
createdAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
279
|
+
name: "created_at";
|
|
280
|
+
tableName: "conversations";
|
|
281
|
+
dataType: "date";
|
|
282
|
+
columnType: "SQLiteTimestamp";
|
|
283
|
+
data: Date;
|
|
284
|
+
driverParam: number;
|
|
285
|
+
notNull: true;
|
|
286
|
+
hasDefault: true;
|
|
287
|
+
isPrimaryKey: false;
|
|
288
|
+
isAutoincrement: false;
|
|
289
|
+
hasRuntimeDefault: true;
|
|
290
|
+
enumValues: undefined;
|
|
291
|
+
baseColumn: never;
|
|
292
|
+
identity: undefined;
|
|
293
|
+
generated: undefined;
|
|
294
|
+
}, {}, {}>;
|
|
295
|
+
updatedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
296
|
+
name: "updated_at";
|
|
297
|
+
tableName: "conversations";
|
|
298
|
+
dataType: "date";
|
|
299
|
+
columnType: "SQLiteTimestamp";
|
|
300
|
+
data: Date;
|
|
301
|
+
driverParam: number;
|
|
302
|
+
notNull: true;
|
|
303
|
+
hasDefault: true;
|
|
304
|
+
isPrimaryKey: false;
|
|
305
|
+
isAutoincrement: false;
|
|
306
|
+
hasRuntimeDefault: true;
|
|
307
|
+
enumValues: undefined;
|
|
308
|
+
baseColumn: never;
|
|
309
|
+
identity: undefined;
|
|
310
|
+
generated: undefined;
|
|
311
|
+
}, {}, {}>;
|
|
312
|
+
};
|
|
313
|
+
dialect: "sqlite";
|
|
314
|
+
}>;
|
|
315
|
+
/**
|
|
316
|
+
* Messages table (SQLite)
|
|
317
|
+
*/
|
|
318
|
+
export declare const messagesSqlite: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
319
|
+
name: "messages";
|
|
320
|
+
schema: undefined;
|
|
321
|
+
columns: {
|
|
322
|
+
id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
323
|
+
name: "id";
|
|
324
|
+
tableName: "messages";
|
|
325
|
+
dataType: "string";
|
|
326
|
+
columnType: "SQLiteText";
|
|
327
|
+
data: string;
|
|
328
|
+
driverParam: string;
|
|
329
|
+
notNull: true;
|
|
330
|
+
hasDefault: true;
|
|
331
|
+
isPrimaryKey: true;
|
|
332
|
+
isAutoincrement: false;
|
|
333
|
+
hasRuntimeDefault: true;
|
|
334
|
+
enumValues: [string, ...string[]];
|
|
335
|
+
baseColumn: never;
|
|
336
|
+
identity: undefined;
|
|
337
|
+
generated: undefined;
|
|
338
|
+
}, {}, {
|
|
339
|
+
length: number | undefined;
|
|
340
|
+
}>;
|
|
341
|
+
conversationId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
342
|
+
name: "conversation_id";
|
|
343
|
+
tableName: "messages";
|
|
344
|
+
dataType: "string";
|
|
345
|
+
columnType: "SQLiteText";
|
|
346
|
+
data: string;
|
|
347
|
+
driverParam: string;
|
|
348
|
+
notNull: true;
|
|
349
|
+
hasDefault: false;
|
|
350
|
+
isPrimaryKey: false;
|
|
351
|
+
isAutoincrement: false;
|
|
352
|
+
hasRuntimeDefault: false;
|
|
353
|
+
enumValues: [string, ...string[]];
|
|
354
|
+
baseColumn: never;
|
|
355
|
+
identity: undefined;
|
|
356
|
+
generated: undefined;
|
|
357
|
+
}, {}, {
|
|
358
|
+
length: number | undefined;
|
|
359
|
+
}>;
|
|
360
|
+
role: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
361
|
+
name: "role";
|
|
362
|
+
tableName: "messages";
|
|
363
|
+
dataType: "string";
|
|
364
|
+
columnType: "SQLiteText";
|
|
365
|
+
data: string;
|
|
366
|
+
driverParam: string;
|
|
367
|
+
notNull: true;
|
|
368
|
+
hasDefault: false;
|
|
369
|
+
isPrimaryKey: false;
|
|
370
|
+
isAutoincrement: false;
|
|
371
|
+
hasRuntimeDefault: false;
|
|
372
|
+
enumValues: [string, ...string[]];
|
|
373
|
+
baseColumn: never;
|
|
374
|
+
identity: undefined;
|
|
375
|
+
generated: undefined;
|
|
376
|
+
}, {}, {
|
|
377
|
+
length: number | undefined;
|
|
378
|
+
}>;
|
|
379
|
+
content: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
380
|
+
name: "content";
|
|
381
|
+
tableName: "messages";
|
|
382
|
+
dataType: "string";
|
|
383
|
+
columnType: "SQLiteText";
|
|
384
|
+
data: string;
|
|
385
|
+
driverParam: string;
|
|
386
|
+
notNull: true;
|
|
387
|
+
hasDefault: false;
|
|
388
|
+
isPrimaryKey: false;
|
|
389
|
+
isAutoincrement: false;
|
|
390
|
+
hasRuntimeDefault: false;
|
|
391
|
+
enumValues: [string, ...string[]];
|
|
392
|
+
baseColumn: never;
|
|
393
|
+
identity: undefined;
|
|
394
|
+
generated: undefined;
|
|
395
|
+
}, {}, {
|
|
396
|
+
length: number | undefined;
|
|
397
|
+
}>;
|
|
398
|
+
metadata: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
399
|
+
name: "metadata";
|
|
400
|
+
tableName: "messages";
|
|
401
|
+
dataType: "json";
|
|
402
|
+
columnType: "SQLiteTextJson";
|
|
403
|
+
data: Record<string, unknown>;
|
|
404
|
+
driverParam: string;
|
|
405
|
+
notNull: true;
|
|
406
|
+
hasDefault: true;
|
|
407
|
+
isPrimaryKey: false;
|
|
408
|
+
isAutoincrement: false;
|
|
409
|
+
hasRuntimeDefault: false;
|
|
410
|
+
enumValues: undefined;
|
|
411
|
+
baseColumn: never;
|
|
412
|
+
identity: undefined;
|
|
413
|
+
generated: undefined;
|
|
414
|
+
}, {}, {
|
|
415
|
+
$type: Record<string, unknown>;
|
|
416
|
+
}>;
|
|
417
|
+
createdAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
418
|
+
name: "created_at";
|
|
419
|
+
tableName: "messages";
|
|
420
|
+
dataType: "date";
|
|
421
|
+
columnType: "SQLiteTimestamp";
|
|
422
|
+
data: Date;
|
|
423
|
+
driverParam: number;
|
|
424
|
+
notNull: true;
|
|
425
|
+
hasDefault: true;
|
|
426
|
+
isPrimaryKey: false;
|
|
427
|
+
isAutoincrement: false;
|
|
428
|
+
hasRuntimeDefault: true;
|
|
429
|
+
enumValues: undefined;
|
|
430
|
+
baseColumn: never;
|
|
431
|
+
identity: undefined;
|
|
432
|
+
generated: undefined;
|
|
433
|
+
}, {}, {}>;
|
|
434
|
+
};
|
|
435
|
+
dialect: "sqlite";
|
|
436
|
+
}>;
|
|
437
|
+
export type ConversationPg = typeof conversationsPg.$inferSelect;
|
|
438
|
+
export type NewConversationPg = typeof conversationsPg.$inferInsert;
|
|
439
|
+
export type MessagePg = typeof messagesPg.$inferSelect;
|
|
440
|
+
export type NewMessagePg = typeof messagesPg.$inferInsert;
|
|
441
|
+
export type ConversationSqlite = typeof conversationsSqlite.$inferSelect;
|
|
442
|
+
export type NewConversationSqlite = typeof conversationsSqlite.$inferInsert;
|
|
443
|
+
export type MessageSqlite = typeof messagesSqlite.$inferSelect;
|
|
444
|
+
export type NewMessageSqlite = typeof messagesSqlite.$inferInsert;
|
|
445
|
+
export type Conversation = ConversationPg | ConversationSqlite;
|
|
446
|
+
export type NewConversation = NewConversationPg | NewConversationSqlite;
|
|
447
|
+
export type Message = MessagePg | MessageSqlite;
|
|
448
|
+
export type NewMessage = NewMessagePg | NewMessageSqlite;
|
|
449
|
+
//# sourceMappingURL=conversations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversations.d.ts","sourceRoot":"","sources":["../../../../src/database/drizzle/schema/conversations.ts"],"names":[],"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,MAAM,YAAY,GAAG,cAAc,GAAG,kBAAkB,CAAC;AAC/D,MAAM,MAAM,eAAe,GAAG,iBAAiB,GAAG,qBAAqB,CAAC;AACxE,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,aAAa,CAAC;AAChD,MAAM,MAAM,UAAU,GAAG,YAAY,GAAG,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Conversations Schema
|
|
3
|
+
*
|
|
4
|
+
* Drizzle ORM schema for conversations and messages tables.
|
|
5
|
+
* Supports both PostgreSQL and SQLite.
|
|
6
|
+
*/
|
|
7
|
+
import { pgTable, uuid, text, timestamp, jsonb, index, } from 'drizzle-orm/pg-core';
|
|
8
|
+
import { sqliteTable, text as sqliteText, integer, } from 'drizzle-orm/sqlite-core';
|
|
9
|
+
import { sql } from 'drizzle-orm';
|
|
10
|
+
// =============================================================================
|
|
11
|
+
// PostgreSQL Schema
|
|
12
|
+
// =============================================================================
|
|
13
|
+
/**
|
|
14
|
+
* Conversations table (PostgreSQL)
|
|
15
|
+
*/
|
|
16
|
+
export const conversationsPg = pgTable('conversations', {
|
|
17
|
+
id: uuid('id')
|
|
18
|
+
.primaryKey()
|
|
19
|
+
.default(sql `gen_random_uuid()`),
|
|
20
|
+
threadId: text('thread_id').notNull(),
|
|
21
|
+
userId: text('user_id'),
|
|
22
|
+
createdAt: timestamp('created_at', { withTimezone: true })
|
|
23
|
+
.defaultNow()
|
|
24
|
+
.notNull(),
|
|
25
|
+
updatedAt: timestamp('updated_at', { withTimezone: true })
|
|
26
|
+
.defaultNow()
|
|
27
|
+
.notNull(),
|
|
28
|
+
}, (table) => ({
|
|
29
|
+
threadIdIdx: index('conversations_thread_id_idx').on(table.threadId),
|
|
30
|
+
userIdIdx: index('conversations_user_id_idx').on(table.userId),
|
|
31
|
+
}));
|
|
32
|
+
/**
|
|
33
|
+
* Messages table (PostgreSQL)
|
|
34
|
+
*/
|
|
35
|
+
export const messagesPg = pgTable('messages', {
|
|
36
|
+
id: uuid('id')
|
|
37
|
+
.primaryKey()
|
|
38
|
+
.default(sql `gen_random_uuid()`),
|
|
39
|
+
conversationId: uuid('conversation_id')
|
|
40
|
+
.notNull()
|
|
41
|
+
.references(() => conversationsPg.id, { onDelete: 'cascade' }),
|
|
42
|
+
role: text('role').notNull(), // 'user' | 'assistant' | 'system'
|
|
43
|
+
content: text('content').notNull(),
|
|
44
|
+
metadata: jsonb('metadata').default({}).notNull(),
|
|
45
|
+
createdAt: timestamp('created_at', { withTimezone: true })
|
|
46
|
+
.defaultNow()
|
|
47
|
+
.notNull(),
|
|
48
|
+
}, (table) => ({
|
|
49
|
+
conversationIdIdx: index('messages_conversation_id_idx').on(table.conversationId),
|
|
50
|
+
createdAtIdx: index('messages_created_at_idx').on(table.createdAt),
|
|
51
|
+
}));
|
|
52
|
+
// =============================================================================
|
|
53
|
+
// SQLite Schema
|
|
54
|
+
// =============================================================================
|
|
55
|
+
/**
|
|
56
|
+
* Conversations table (SQLite)
|
|
57
|
+
*/
|
|
58
|
+
export const conversationsSqlite = sqliteTable('conversations', {
|
|
59
|
+
id: sqliteText('id')
|
|
60
|
+
.primaryKey()
|
|
61
|
+
.$defaultFn(() => crypto.randomUUID()),
|
|
62
|
+
threadId: sqliteText('thread_id').notNull(),
|
|
63
|
+
userId: sqliteText('user_id'),
|
|
64
|
+
createdAt: integer('created_at', { mode: 'timestamp' })
|
|
65
|
+
.notNull()
|
|
66
|
+
.$defaultFn(() => new Date()),
|
|
67
|
+
updatedAt: integer('updated_at', { mode: 'timestamp' })
|
|
68
|
+
.notNull()
|
|
69
|
+
.$defaultFn(() => new Date()),
|
|
70
|
+
});
|
|
71
|
+
/**
|
|
72
|
+
* Messages table (SQLite)
|
|
73
|
+
*/
|
|
74
|
+
export const messagesSqlite = sqliteTable('messages', {
|
|
75
|
+
id: sqliteText('id')
|
|
76
|
+
.primaryKey()
|
|
77
|
+
.$defaultFn(() => crypto.randomUUID()),
|
|
78
|
+
conversationId: sqliteText('conversation_id')
|
|
79
|
+
.notNull()
|
|
80
|
+
.references(() => conversationsSqlite.id, { onDelete: 'cascade' }),
|
|
81
|
+
role: sqliteText('role').notNull(),
|
|
82
|
+
content: sqliteText('content').notNull(),
|
|
83
|
+
metadata: sqliteText('metadata', { mode: 'json' })
|
|
84
|
+
.notNull()
|
|
85
|
+
.$type()
|
|
86
|
+
.default({}),
|
|
87
|
+
createdAt: integer('created_at', { mode: 'timestamp' })
|
|
88
|
+
.notNull()
|
|
89
|
+
.$defaultFn(() => new Date()),
|
|
90
|
+
});
|
|
91
|
+
//# sourceMappingURL=conversations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversations.js","sourceRoot":"","sources":["../../../../src/database/drizzle/schema/conversations.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,SAAS,EACT,KAAK,EACL,KAAK,GACN,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,WAAW,EACX,IAAI,IAAI,UAAU,EAClB,OAAO,GACR,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC,gFAAgF;AAChF,oBAAoB;AACpB,gFAAgF;AAEhF;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,OAAO,CACpC,eAAe,EACf;IACE,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC;SACX,UAAU,EAAE;SACZ,OAAO,CAAC,GAAG,CAAA,mBAAmB,CAAC;IAClC,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,OAAO,EAAE;IACrC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC;IACvB,SAAS,EAAE,SAAS,CAAC,YAAY,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;SACvD,UAAU,EAAE;SACZ,OAAO,EAAE;IACZ,SAAS,EAAE,SAAS,CAAC,Y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