@pipeline-builder/pipeline-data 0.0.1
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 +202 -0
- package/README.md +61 -0
- package/drizzle.config.ts +17 -0
- package/lib/api/access-control-builder.d.ts +148 -0
- package/lib/api/access-control-builder.js +199 -0
- package/lib/api/crud-service.d.ts +343 -0
- package/lib/api/crud-service.js +849 -0
- package/lib/api/query-builders.d.ts +82 -0
- package/lib/api/query-builders.js +460 -0
- package/lib/api/reporting-service.d.ts +685 -0
- package/lib/api/reporting-service.js +1564 -0
- package/lib/api/soft-delete-sweep.d.ts +65 -0
- package/lib/api/soft-delete-sweep.js +124 -0
- package/lib/api/viewer-context.d.ts +29 -0
- package/lib/api/viewer-context.js +63 -0
- package/lib/core/query-filters.d.ts +263 -0
- package/lib/core/query-filters.js +4 -0
- package/lib/database/drizzle-schema.d.ts +7357 -0
- package/lib/database/drizzle-schema.js +66 -0
- package/lib/database/index.d.ts +5 -0
- package/lib/database/index.js +8 -0
- package/lib/database/migrator.d.ts +20 -0
- package/lib/database/migrator.js +80 -0
- package/lib/database/postgres-connection.d.ts +201 -0
- package/lib/database/postgres-connection.js +413 -0
- package/lib/database/retry-strategy.d.ts +68 -0
- package/lib/database/retry-strategy.js +122 -0
- package/lib/database/schema/alert.d.ts +588 -0
- package/lib/database/schema/alert.js +130 -0
- package/lib/database/schema/compliance.d.ts +3319 -0
- package/lib/database/schema/compliance.js +377 -0
- package/lib/database/schema/dashboard.d.ts +474 -0
- package/lib/database/schema/dashboard.js +129 -0
- package/lib/database/schema/message-attachment.d.ts +183 -0
- package/lib/database/schema/message-attachment.js +40 -0
- package/lib/database/schema/message.d.ts +411 -0
- package/lib/database/schema/message.js +114 -0
- package/lib/database/schema/pipeline-template.d.ts +466 -0
- package/lib/database/schema/pipeline-template.js +80 -0
- package/lib/database/schema/pipeline.d.ts +1613 -0
- package/lib/database/schema/pipeline.js +332 -0
- package/lib/database/schema/plugin.d.ts +749 -0
- package/lib/database/schema/plugin.js +166 -0
- package/lib/database/tenancy.d.ts +103 -0
- package/lib/database/tenancy.js +167 -0
- package/lib/index.d.ts +32 -0
- package/lib/index.js +38 -0
- package/package.json +161 -0
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File/image attachments for messages.
|
|
3
|
+
*
|
|
4
|
+
* The blob itself lives in S3-compatible object storage (MinIO); this table
|
|
5
|
+
* holds only the METADATA + the storage key. A row is created on upload with
|
|
6
|
+
* `message_id = NULL` (pending) and linked to a message when that message is
|
|
7
|
+
* sent — so an upload that's never attached is a harmless orphan the retention
|
|
8
|
+
* sweep can reap. Tenant-scoped by `org_id` (RLS); visibility of the blob is
|
|
9
|
+
* gated at the API layer by whether the caller can read the parent message.
|
|
10
|
+
*
|
|
11
|
+
* @table message_attachments
|
|
12
|
+
*/
|
|
13
|
+
export declare const messageAttachment: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
14
|
+
name: "message_attachments";
|
|
15
|
+
schema: undefined;
|
|
16
|
+
columns: {
|
|
17
|
+
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
18
|
+
name: "id";
|
|
19
|
+
tableName: "message_attachments";
|
|
20
|
+
dataType: "string";
|
|
21
|
+
columnType: "PgUUID";
|
|
22
|
+
data: string;
|
|
23
|
+
driverParam: string;
|
|
24
|
+
notNull: true;
|
|
25
|
+
hasDefault: true;
|
|
26
|
+
isPrimaryKey: true;
|
|
27
|
+
isAutoincrement: false;
|
|
28
|
+
hasRuntimeDefault: false;
|
|
29
|
+
enumValues: undefined;
|
|
30
|
+
baseColumn: never;
|
|
31
|
+
identity: undefined;
|
|
32
|
+
generated: undefined;
|
|
33
|
+
}, {}, {}>;
|
|
34
|
+
orgId: import("drizzle-orm/pg-core").PgColumn<{
|
|
35
|
+
name: "org_id";
|
|
36
|
+
tableName: "message_attachments";
|
|
37
|
+
dataType: "string";
|
|
38
|
+
columnType: "PgVarchar";
|
|
39
|
+
data: string;
|
|
40
|
+
driverParam: string;
|
|
41
|
+
notNull: true;
|
|
42
|
+
hasDefault: false;
|
|
43
|
+
isPrimaryKey: false;
|
|
44
|
+
isAutoincrement: false;
|
|
45
|
+
hasRuntimeDefault: false;
|
|
46
|
+
enumValues: [string, ...string[]];
|
|
47
|
+
baseColumn: never;
|
|
48
|
+
identity: undefined;
|
|
49
|
+
generated: undefined;
|
|
50
|
+
}, {}, {
|
|
51
|
+
length: 255;
|
|
52
|
+
}>;
|
|
53
|
+
messageId: import("drizzle-orm/pg-core").PgColumn<{
|
|
54
|
+
name: "message_id";
|
|
55
|
+
tableName: "message_attachments";
|
|
56
|
+
dataType: "string";
|
|
57
|
+
columnType: "PgUUID";
|
|
58
|
+
data: string;
|
|
59
|
+
driverParam: string;
|
|
60
|
+
notNull: false;
|
|
61
|
+
hasDefault: false;
|
|
62
|
+
isPrimaryKey: false;
|
|
63
|
+
isAutoincrement: false;
|
|
64
|
+
hasRuntimeDefault: false;
|
|
65
|
+
enumValues: undefined;
|
|
66
|
+
baseColumn: never;
|
|
67
|
+
identity: undefined;
|
|
68
|
+
generated: undefined;
|
|
69
|
+
}, {}, {}>;
|
|
70
|
+
uploadedBy: import("drizzle-orm/pg-core").PgColumn<{
|
|
71
|
+
name: "uploaded_by";
|
|
72
|
+
tableName: "message_attachments";
|
|
73
|
+
dataType: "string";
|
|
74
|
+
columnType: "PgText";
|
|
75
|
+
data: string;
|
|
76
|
+
driverParam: string;
|
|
77
|
+
notNull: true;
|
|
78
|
+
hasDefault: false;
|
|
79
|
+
isPrimaryKey: false;
|
|
80
|
+
isAutoincrement: false;
|
|
81
|
+
hasRuntimeDefault: false;
|
|
82
|
+
enumValues: [string, ...string[]];
|
|
83
|
+
baseColumn: never;
|
|
84
|
+
identity: undefined;
|
|
85
|
+
generated: undefined;
|
|
86
|
+
}, {}, {}>;
|
|
87
|
+
filename: import("drizzle-orm/pg-core").PgColumn<{
|
|
88
|
+
name: "filename";
|
|
89
|
+
tableName: "message_attachments";
|
|
90
|
+
dataType: "string";
|
|
91
|
+
columnType: "PgVarchar";
|
|
92
|
+
data: string;
|
|
93
|
+
driverParam: string;
|
|
94
|
+
notNull: true;
|
|
95
|
+
hasDefault: false;
|
|
96
|
+
isPrimaryKey: false;
|
|
97
|
+
isAutoincrement: false;
|
|
98
|
+
hasRuntimeDefault: false;
|
|
99
|
+
enumValues: [string, ...string[]];
|
|
100
|
+
baseColumn: never;
|
|
101
|
+
identity: undefined;
|
|
102
|
+
generated: undefined;
|
|
103
|
+
}, {}, {
|
|
104
|
+
length: 255;
|
|
105
|
+
}>;
|
|
106
|
+
contentType: import("drizzle-orm/pg-core").PgColumn<{
|
|
107
|
+
name: "content_type";
|
|
108
|
+
tableName: "message_attachments";
|
|
109
|
+
dataType: "string";
|
|
110
|
+
columnType: "PgVarchar";
|
|
111
|
+
data: string;
|
|
112
|
+
driverParam: string;
|
|
113
|
+
notNull: true;
|
|
114
|
+
hasDefault: false;
|
|
115
|
+
isPrimaryKey: false;
|
|
116
|
+
isAutoincrement: false;
|
|
117
|
+
hasRuntimeDefault: false;
|
|
118
|
+
enumValues: [string, ...string[]];
|
|
119
|
+
baseColumn: never;
|
|
120
|
+
identity: undefined;
|
|
121
|
+
generated: undefined;
|
|
122
|
+
}, {}, {
|
|
123
|
+
length: 128;
|
|
124
|
+
}>;
|
|
125
|
+
sizeBytes: import("drizzle-orm/pg-core").PgColumn<{
|
|
126
|
+
name: "size_bytes";
|
|
127
|
+
tableName: "message_attachments";
|
|
128
|
+
dataType: "number";
|
|
129
|
+
columnType: "PgInteger";
|
|
130
|
+
data: number;
|
|
131
|
+
driverParam: string | number;
|
|
132
|
+
notNull: true;
|
|
133
|
+
hasDefault: false;
|
|
134
|
+
isPrimaryKey: false;
|
|
135
|
+
isAutoincrement: false;
|
|
136
|
+
hasRuntimeDefault: false;
|
|
137
|
+
enumValues: undefined;
|
|
138
|
+
baseColumn: never;
|
|
139
|
+
identity: undefined;
|
|
140
|
+
generated: undefined;
|
|
141
|
+
}, {}, {}>;
|
|
142
|
+
storageKey: import("drizzle-orm/pg-core").PgColumn<{
|
|
143
|
+
name: "storage_key";
|
|
144
|
+
tableName: "message_attachments";
|
|
145
|
+
dataType: "string";
|
|
146
|
+
columnType: "PgVarchar";
|
|
147
|
+
data: string;
|
|
148
|
+
driverParam: string;
|
|
149
|
+
notNull: true;
|
|
150
|
+
hasDefault: false;
|
|
151
|
+
isPrimaryKey: false;
|
|
152
|
+
isAutoincrement: false;
|
|
153
|
+
hasRuntimeDefault: false;
|
|
154
|
+
enumValues: [string, ...string[]];
|
|
155
|
+
baseColumn: never;
|
|
156
|
+
identity: undefined;
|
|
157
|
+
generated: undefined;
|
|
158
|
+
}, {}, {
|
|
159
|
+
length: 512;
|
|
160
|
+
}>;
|
|
161
|
+
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
162
|
+
name: "created_at";
|
|
163
|
+
tableName: "message_attachments";
|
|
164
|
+
dataType: "date";
|
|
165
|
+
columnType: "PgTimestamp";
|
|
166
|
+
data: Date;
|
|
167
|
+
driverParam: string;
|
|
168
|
+
notNull: true;
|
|
169
|
+
hasDefault: true;
|
|
170
|
+
isPrimaryKey: false;
|
|
171
|
+
isAutoincrement: false;
|
|
172
|
+
hasRuntimeDefault: false;
|
|
173
|
+
enumValues: undefined;
|
|
174
|
+
baseColumn: never;
|
|
175
|
+
identity: undefined;
|
|
176
|
+
generated: undefined;
|
|
177
|
+
}, {}, {}>;
|
|
178
|
+
};
|
|
179
|
+
dialect: 'pg';
|
|
180
|
+
}>;
|
|
181
|
+
/** TypeScript row types. */
|
|
182
|
+
export type MessageAttachment = typeof messageAttachment.$inferSelect;
|
|
183
|
+
export type MessageAttachmentInsert = typeof messageAttachment.$inferInsert;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Copyright 2026 Pipeline Builder Contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { varchar, pgTable, text, timestamp, uuid, integer, index } from 'drizzle-orm/pg-core';
|
|
4
|
+
/**
|
|
5
|
+
* File/image attachments for messages.
|
|
6
|
+
*
|
|
7
|
+
* The blob itself lives in S3-compatible object storage (MinIO); this table
|
|
8
|
+
* holds only the METADATA + the storage key. A row is created on upload with
|
|
9
|
+
* `message_id = NULL` (pending) and linked to a message when that message is
|
|
10
|
+
* sent — so an upload that's never attached is a harmless orphan the retention
|
|
11
|
+
* sweep can reap. Tenant-scoped by `org_id` (RLS); visibility of the blob is
|
|
12
|
+
* gated at the API layer by whether the caller can read the parent message.
|
|
13
|
+
*
|
|
14
|
+
* @table message_attachments
|
|
15
|
+
*/
|
|
16
|
+
export const messageAttachment = pgTable('message_attachments', {
|
|
17
|
+
id: uuid('id').primaryKey().defaultRandom(),
|
|
18
|
+
// Tenancy — the uploader's org. RLS-scoped like every other tenant table.
|
|
19
|
+
orgId: varchar('org_id', { length: 255 }).notNull(),
|
|
20
|
+
// The message this attachment belongs to. NULL while an upload is pending
|
|
21
|
+
// (uploaded but not yet attached to a sent message).
|
|
22
|
+
messageId: uuid('message_id'),
|
|
23
|
+
// Who uploaded it (user id) — for audit + the pending-upload owner check.
|
|
24
|
+
uploadedBy: text('uploaded_by').notNull(),
|
|
25
|
+
// Original client filename (display + Content-Disposition on download).
|
|
26
|
+
filename: varchar('filename', { length: 255 }).notNull(),
|
|
27
|
+
// Validated MIME type (allow-list enforced at upload).
|
|
28
|
+
contentType: varchar('content_type', { length: 128 }).notNull(),
|
|
29
|
+
// Size in bytes (bounded at upload).
|
|
30
|
+
sizeBytes: integer('size_bytes').notNull(),
|
|
31
|
+
// Object key in the attachments bucket (e.g. `<orgId>/<uuid>/<filename>`).
|
|
32
|
+
storageKey: varchar('storage_key', { length: 512 }).notNull(),
|
|
33
|
+
createdAt: timestamp('created_at', { withTimezone: true }).defaultNow().notNull(),
|
|
34
|
+
}, (table) => ({
|
|
35
|
+
// Fetch a message's attachments.
|
|
36
|
+
messageIdIdx: index('message_attachment_message_id_idx').on(table.messageId),
|
|
37
|
+
// Tenant scoping + pending-upload lookups by owner.
|
|
38
|
+
orgIdIdx: index('message_attachment_org_id_idx').on(table.orgId),
|
|
39
|
+
}));
|
|
40
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWVzc2FnZS1hdHRhY2htZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2RhdGFiYXNlL3NjaGVtYS9tZXNzYWdlLWF0dGFjaG1lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsK0NBQStDO0FBQy9DLHNDQUFzQztBQUV0QyxPQUFPLEVBQUUsT0FBTyxFQUFFLE9BQU8sRUFBRSxJQUFJLEVBQUUsU0FBUyxFQUFFLElBQUksRUFBRSxPQUFPLEVBQUUsS0FBSyxFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFFOUY7Ozs7Ozs7Ozs7O0dBV0c7QUFDSCxNQUFNLENBQUMsTUFBTSxpQkFBaUIsR0FBRyxPQUFPLENBQUMscUJBQXFCLEVBQUU7SUFDOUQsRUFBRSxFQUFFLElBQUksQ0FBQyxJQUFJLENBQUMsQ0FBQyxVQUFVLEVBQUUsQ0FBQyxhQUFhLEVBQUU7SUFFM0MsMEVBQTBFO0lBQzFFLEtBQUssRUFBRSxPQUFPLENBQUMsUUFBUSxFQUFFLEVBQUUsTUFBTSxFQUFFLEdBQUcsRUFBRSxDQUFDLENBQUMsT0FBTyxFQUFFO0lBRW5ELDBFQUEwRTtJQUMxRSxxREFBcUQ7SUFDckQsU0FBUyxFQUFFLElBQUksQ0FBQyxZQUFZLENBQUM7SUFFN0IsMEVBQTBFO0lBQzFFLFVBQVUsRUFBRSxJQUFJLENBQUMsYUFBYSxDQUFDLENBQUMsT0FBTyxFQUFFO0lBRXpDLHdFQUF3RTtJQUN4RSxRQUFRLEVBQUUsT0FBTyxDQUFDLFVBQVUsRUFBRS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Z0lkPi88dXVpZD4vPGZpbGVuYW1lPmApLlxuICBzdG9yYWdlS2V5OiB2YXJjaGFyKCdzdG9yYWdlX2tleScsIHsgbGVuZ3RoOiA1MTIgfSkubm90TnVsbCgpLFxuXG4gIGNyZWF0ZWRBdDogdGltZXN0YW1wKCdjcmVhdGVkX2F0JywgeyB3aXRoVGltZXpvbmU6IHRydWUgfSkuZGVmYXVsdE5vdygpLm5vdE51bGwoKSxcbn0sICh0YWJsZSkgPT4gKHtcbiAgLy8gRmV0Y2ggYSBtZXNzYWdlJ3MgYXR0YWNobWVudHMuXG4gIG1lc3NhZ2VJZElkeDogaW5kZXgoJ21lc3NhZ2VfYXR0YWNobWVudF9tZXNzYWdlX2lkX2lkeCcpLm9uKHRhYmxlLm1lc3NhZ2VJZCksXG4gIC8vIFRlbmFudCBzY29waW5nICsgcGVuZGluZy11cGxvYWQgbG9va3VwcyBieSBvd25lci5cbiAgb3JnSWRJZHg6IGluZGV4KCdtZXNzYWdlX2F0dGFjaG1lbnRfb3JnX2lkX2lkeCcpLm9uKHRhYmxlLm9yZ0lkKSxcbn0pKTtcblxuLyoqIFR5cGVTY3JpcHQgcm93IHR5cGVzLiAqL1xuZXhwb3J0IHR5cGUgTWVzc2FnZUF0dGFjaG1lbnQgPSB0eXBlb2YgbWVzc2FnZUF0dGFjaG1lbnQuJGluZmVyU2VsZWN0O1xuZXhwb3J0IHR5cGUgTWVzc2FnZUF0dGFjaG1lbnRJbnNlcnQgPSB0eXBlb2YgbWVzc2FnZUF0dGFjaG1lbnQuJGluZmVySW5zZXJ0O1xuIl19
|
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Message type identifiers
|
|
3
|
+
*/
|
|
4
|
+
export type MessageType = 'announcement' | 'conversation';
|
|
5
|
+
/**
|
|
6
|
+
* Message priority levels
|
|
7
|
+
*/
|
|
8
|
+
export type MessagePriority = 'normal' | 'high' | 'urgent';
|
|
9
|
+
/**
|
|
10
|
+
* Table for storing internal messages between organizations and the system org.
|
|
11
|
+
*
|
|
12
|
+
* Features * - Announcements: System org broadcasts to all orgs (recipientOrgId = '*')
|
|
13
|
+
* - Conversations: Two-way threaded messaging between an org and system org
|
|
14
|
+
* - Thread support via threadId (null for root messages, references root for replies)
|
|
15
|
+
* - Read tracking per message
|
|
16
|
+
* - Priority levels (normal, high, urgent)
|
|
17
|
+
* - Soft delete support
|
|
18
|
+
*
|
|
19
|
+
* @table messages
|
|
20
|
+
*/
|
|
21
|
+
export declare const message: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
22
|
+
name: "messages";
|
|
23
|
+
schema: undefined;
|
|
24
|
+
columns: {
|
|
25
|
+
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
26
|
+
name: "id";
|
|
27
|
+
tableName: "messages";
|
|
28
|
+
dataType: "string";
|
|
29
|
+
columnType: "PgUUID";
|
|
30
|
+
data: string;
|
|
31
|
+
driverParam: string;
|
|
32
|
+
notNull: true;
|
|
33
|
+
hasDefault: true;
|
|
34
|
+
isPrimaryKey: true;
|
|
35
|
+
isAutoincrement: false;
|
|
36
|
+
hasRuntimeDefault: false;
|
|
37
|
+
enumValues: undefined;
|
|
38
|
+
baseColumn: never;
|
|
39
|
+
identity: undefined;
|
|
40
|
+
generated: undefined;
|
|
41
|
+
}, {}, {}>;
|
|
42
|
+
orgId: import("drizzle-orm/pg-core").PgColumn<{
|
|
43
|
+
name: "org_id";
|
|
44
|
+
tableName: "messages";
|
|
45
|
+
dataType: "string";
|
|
46
|
+
columnType: "PgVarchar";
|
|
47
|
+
data: string;
|
|
48
|
+
driverParam: string;
|
|
49
|
+
notNull: true;
|
|
50
|
+
hasDefault: true;
|
|
51
|
+
isPrimaryKey: false;
|
|
52
|
+
isAutoincrement: false;
|
|
53
|
+
hasRuntimeDefault: false;
|
|
54
|
+
enumValues: [string, ...string[]];
|
|
55
|
+
baseColumn: never;
|
|
56
|
+
identity: undefined;
|
|
57
|
+
generated: undefined;
|
|
58
|
+
}, {}, {
|
|
59
|
+
length: 255;
|
|
60
|
+
}>;
|
|
61
|
+
createdBy: import("drizzle-orm/pg-core").PgColumn<{
|
|
62
|
+
name: "created_by";
|
|
63
|
+
tableName: "messages";
|
|
64
|
+
dataType: "string";
|
|
65
|
+
columnType: "PgText";
|
|
66
|
+
data: string;
|
|
67
|
+
driverParam: string;
|
|
68
|
+
notNull: true;
|
|
69
|
+
hasDefault: true;
|
|
70
|
+
isPrimaryKey: false;
|
|
71
|
+
isAutoincrement: false;
|
|
72
|
+
hasRuntimeDefault: false;
|
|
73
|
+
enumValues: [string, ...string[]];
|
|
74
|
+
baseColumn: never;
|
|
75
|
+
identity: undefined;
|
|
76
|
+
generated: undefined;
|
|
77
|
+
}, {}, {}>;
|
|
78
|
+
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
79
|
+
name: "created_at";
|
|
80
|
+
tableName: "messages";
|
|
81
|
+
dataType: "date";
|
|
82
|
+
columnType: "PgTimestamp";
|
|
83
|
+
data: Date;
|
|
84
|
+
driverParam: string;
|
|
85
|
+
notNull: true;
|
|
86
|
+
hasDefault: true;
|
|
87
|
+
isPrimaryKey: false;
|
|
88
|
+
isAutoincrement: false;
|
|
89
|
+
hasRuntimeDefault: false;
|
|
90
|
+
enumValues: undefined;
|
|
91
|
+
baseColumn: never;
|
|
92
|
+
identity: undefined;
|
|
93
|
+
generated: undefined;
|
|
94
|
+
}, {}, {}>;
|
|
95
|
+
updatedBy: import("drizzle-orm/pg-core").PgColumn<{
|
|
96
|
+
name: "updated_by";
|
|
97
|
+
tableName: "messages";
|
|
98
|
+
dataType: "string";
|
|
99
|
+
columnType: "PgText";
|
|
100
|
+
data: string;
|
|
101
|
+
driverParam: string;
|
|
102
|
+
notNull: true;
|
|
103
|
+
hasDefault: true;
|
|
104
|
+
isPrimaryKey: false;
|
|
105
|
+
isAutoincrement: false;
|
|
106
|
+
hasRuntimeDefault: false;
|
|
107
|
+
enumValues: [string, ...string[]];
|
|
108
|
+
baseColumn: never;
|
|
109
|
+
identity: undefined;
|
|
110
|
+
generated: undefined;
|
|
111
|
+
}, {}, {}>;
|
|
112
|
+
updatedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
113
|
+
name: "updated_at";
|
|
114
|
+
tableName: "messages";
|
|
115
|
+
dataType: "date";
|
|
116
|
+
columnType: "PgTimestamp";
|
|
117
|
+
data: Date;
|
|
118
|
+
driverParam: string;
|
|
119
|
+
notNull: true;
|
|
120
|
+
hasDefault: true;
|
|
121
|
+
isPrimaryKey: false;
|
|
122
|
+
isAutoincrement: false;
|
|
123
|
+
hasRuntimeDefault: false;
|
|
124
|
+
enumValues: undefined;
|
|
125
|
+
baseColumn: never;
|
|
126
|
+
identity: undefined;
|
|
127
|
+
generated: undefined;
|
|
128
|
+
}, {}, {}>;
|
|
129
|
+
threadId: import("drizzle-orm/pg-core").PgColumn<{
|
|
130
|
+
name: "thread_id";
|
|
131
|
+
tableName: "messages";
|
|
132
|
+
dataType: "string";
|
|
133
|
+
columnType: "PgUUID";
|
|
134
|
+
data: string;
|
|
135
|
+
driverParam: string;
|
|
136
|
+
notNull: false;
|
|
137
|
+
hasDefault: false;
|
|
138
|
+
isPrimaryKey: false;
|
|
139
|
+
isAutoincrement: false;
|
|
140
|
+
hasRuntimeDefault: false;
|
|
141
|
+
enumValues: undefined;
|
|
142
|
+
baseColumn: never;
|
|
143
|
+
identity: undefined;
|
|
144
|
+
generated: undefined;
|
|
145
|
+
}, {}, {}>;
|
|
146
|
+
recipientOrgId: import("drizzle-orm/pg-core").PgColumn<{
|
|
147
|
+
name: "recipient_org_id";
|
|
148
|
+
tableName: "messages";
|
|
149
|
+
dataType: "string";
|
|
150
|
+
columnType: "PgVarchar";
|
|
151
|
+
data: string;
|
|
152
|
+
driverParam: string;
|
|
153
|
+
notNull: true;
|
|
154
|
+
hasDefault: false;
|
|
155
|
+
isPrimaryKey: false;
|
|
156
|
+
isAutoincrement: false;
|
|
157
|
+
hasRuntimeDefault: false;
|
|
158
|
+
enumValues: [string, ...string[]];
|
|
159
|
+
baseColumn: never;
|
|
160
|
+
identity: undefined;
|
|
161
|
+
generated: undefined;
|
|
162
|
+
}, {}, {
|
|
163
|
+
length: 255;
|
|
164
|
+
}>;
|
|
165
|
+
recipientUserId: import("drizzle-orm/pg-core").PgColumn<{
|
|
166
|
+
name: "recipient_user_id";
|
|
167
|
+
tableName: "messages";
|
|
168
|
+
dataType: "string";
|
|
169
|
+
columnType: "PgVarchar";
|
|
170
|
+
data: string;
|
|
171
|
+
driverParam: string;
|
|
172
|
+
notNull: false;
|
|
173
|
+
hasDefault: false;
|
|
174
|
+
isPrimaryKey: false;
|
|
175
|
+
isAutoincrement: false;
|
|
176
|
+
hasRuntimeDefault: false;
|
|
177
|
+
enumValues: [string, ...string[]];
|
|
178
|
+
baseColumn: never;
|
|
179
|
+
identity: undefined;
|
|
180
|
+
generated: undefined;
|
|
181
|
+
}, {}, {
|
|
182
|
+
length: 255;
|
|
183
|
+
}>;
|
|
184
|
+
messageType: import("drizzle-orm/pg-core").PgColumn<{
|
|
185
|
+
name: "message_type";
|
|
186
|
+
tableName: "messages";
|
|
187
|
+
dataType: "string";
|
|
188
|
+
columnType: "PgVarchar";
|
|
189
|
+
data: MessageType;
|
|
190
|
+
driverParam: string;
|
|
191
|
+
notNull: true;
|
|
192
|
+
hasDefault: true;
|
|
193
|
+
isPrimaryKey: false;
|
|
194
|
+
isAutoincrement: false;
|
|
195
|
+
hasRuntimeDefault: false;
|
|
196
|
+
enumValues: [string, ...string[]];
|
|
197
|
+
baseColumn: never;
|
|
198
|
+
identity: undefined;
|
|
199
|
+
generated: undefined;
|
|
200
|
+
}, {}, {
|
|
201
|
+
length: 20;
|
|
202
|
+
$type: MessageType;
|
|
203
|
+
}>;
|
|
204
|
+
channel: import("drizzle-orm/pg-core").PgColumn<{
|
|
205
|
+
name: "channel";
|
|
206
|
+
tableName: "messages";
|
|
207
|
+
dataType: "string";
|
|
208
|
+
columnType: "PgVarchar";
|
|
209
|
+
data: string;
|
|
210
|
+
driverParam: string;
|
|
211
|
+
notNull: false;
|
|
212
|
+
hasDefault: false;
|
|
213
|
+
isPrimaryKey: false;
|
|
214
|
+
isAutoincrement: false;
|
|
215
|
+
hasRuntimeDefault: false;
|
|
216
|
+
enumValues: [string, ...string[]];
|
|
217
|
+
baseColumn: never;
|
|
218
|
+
identity: undefined;
|
|
219
|
+
generated: undefined;
|
|
220
|
+
}, {}, {
|
|
221
|
+
length: 50;
|
|
222
|
+
}>;
|
|
223
|
+
subject: import("drizzle-orm/pg-core").PgColumn<{
|
|
224
|
+
name: "subject";
|
|
225
|
+
tableName: "messages";
|
|
226
|
+
dataType: "string";
|
|
227
|
+
columnType: "PgVarchar";
|
|
228
|
+
data: string;
|
|
229
|
+
driverParam: string;
|
|
230
|
+
notNull: true;
|
|
231
|
+
hasDefault: false;
|
|
232
|
+
isPrimaryKey: false;
|
|
233
|
+
isAutoincrement: false;
|
|
234
|
+
hasRuntimeDefault: false;
|
|
235
|
+
enumValues: [string, ...string[]];
|
|
236
|
+
baseColumn: never;
|
|
237
|
+
identity: undefined;
|
|
238
|
+
generated: undefined;
|
|
239
|
+
}, {}, {
|
|
240
|
+
length: 500;
|
|
241
|
+
}>;
|
|
242
|
+
content: import("drizzle-orm/pg-core").PgColumn<{
|
|
243
|
+
name: "content";
|
|
244
|
+
tableName: "messages";
|
|
245
|
+
dataType: "string";
|
|
246
|
+
columnType: "PgText";
|
|
247
|
+
data: string;
|
|
248
|
+
driverParam: string;
|
|
249
|
+
notNull: true;
|
|
250
|
+
hasDefault: false;
|
|
251
|
+
isPrimaryKey: false;
|
|
252
|
+
isAutoincrement: false;
|
|
253
|
+
hasRuntimeDefault: false;
|
|
254
|
+
enumValues: [string, ...string[]];
|
|
255
|
+
baseColumn: never;
|
|
256
|
+
identity: undefined;
|
|
257
|
+
generated: undefined;
|
|
258
|
+
}, {}, {}>;
|
|
259
|
+
editedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
260
|
+
name: "edited_at";
|
|
261
|
+
tableName: "messages";
|
|
262
|
+
dataType: "date";
|
|
263
|
+
columnType: "PgTimestamp";
|
|
264
|
+
data: Date;
|
|
265
|
+
driverParam: string;
|
|
266
|
+
notNull: false;
|
|
267
|
+
hasDefault: false;
|
|
268
|
+
isPrimaryKey: false;
|
|
269
|
+
isAutoincrement: false;
|
|
270
|
+
hasRuntimeDefault: false;
|
|
271
|
+
enumValues: undefined;
|
|
272
|
+
baseColumn: never;
|
|
273
|
+
identity: undefined;
|
|
274
|
+
generated: undefined;
|
|
275
|
+
}, {}, {}>;
|
|
276
|
+
readBy: import("drizzle-orm/pg-core").PgColumn<{
|
|
277
|
+
name: "read_by";
|
|
278
|
+
tableName: "messages";
|
|
279
|
+
dataType: "json";
|
|
280
|
+
columnType: "PgJsonb";
|
|
281
|
+
data: Record<string, string>;
|
|
282
|
+
driverParam: unknown;
|
|
283
|
+
notNull: true;
|
|
284
|
+
hasDefault: true;
|
|
285
|
+
isPrimaryKey: false;
|
|
286
|
+
isAutoincrement: false;
|
|
287
|
+
hasRuntimeDefault: false;
|
|
288
|
+
enumValues: undefined;
|
|
289
|
+
baseColumn: never;
|
|
290
|
+
identity: undefined;
|
|
291
|
+
generated: undefined;
|
|
292
|
+
}, {}, {
|
|
293
|
+
$type: Record<string, string>;
|
|
294
|
+
}>;
|
|
295
|
+
priority: import("drizzle-orm/pg-core").PgColumn<{
|
|
296
|
+
name: "priority";
|
|
297
|
+
tableName: "messages";
|
|
298
|
+
dataType: "string";
|
|
299
|
+
columnType: "PgVarchar";
|
|
300
|
+
data: MessagePriority;
|
|
301
|
+
driverParam: string;
|
|
302
|
+
notNull: true;
|
|
303
|
+
hasDefault: true;
|
|
304
|
+
isPrimaryKey: false;
|
|
305
|
+
isAutoincrement: false;
|
|
306
|
+
hasRuntimeDefault: false;
|
|
307
|
+
enumValues: [string, ...string[]];
|
|
308
|
+
baseColumn: never;
|
|
309
|
+
identity: undefined;
|
|
310
|
+
generated: undefined;
|
|
311
|
+
}, {}, {
|
|
312
|
+
length: 20;
|
|
313
|
+
$type: MessagePriority;
|
|
314
|
+
}>;
|
|
315
|
+
isDefault: import("drizzle-orm/pg-core").PgColumn<{
|
|
316
|
+
name: "is_default";
|
|
317
|
+
tableName: "messages";
|
|
318
|
+
dataType: "boolean";
|
|
319
|
+
columnType: "PgBoolean";
|
|
320
|
+
data: boolean;
|
|
321
|
+
driverParam: boolean;
|
|
322
|
+
notNull: true;
|
|
323
|
+
hasDefault: true;
|
|
324
|
+
isPrimaryKey: false;
|
|
325
|
+
isAutoincrement: false;
|
|
326
|
+
hasRuntimeDefault: false;
|
|
327
|
+
enumValues: undefined;
|
|
328
|
+
baseColumn: never;
|
|
329
|
+
identity: undefined;
|
|
330
|
+
generated: undefined;
|
|
331
|
+
}, {}, {}>;
|
|
332
|
+
isActive: import("drizzle-orm/pg-core").PgColumn<{
|
|
333
|
+
name: "is_active";
|
|
334
|
+
tableName: "messages";
|
|
335
|
+
dataType: "boolean";
|
|
336
|
+
columnType: "PgBoolean";
|
|
337
|
+
data: boolean;
|
|
338
|
+
driverParam: boolean;
|
|
339
|
+
notNull: true;
|
|
340
|
+
hasDefault: true;
|
|
341
|
+
isPrimaryKey: false;
|
|
342
|
+
isAutoincrement: false;
|
|
343
|
+
hasRuntimeDefault: false;
|
|
344
|
+
enumValues: undefined;
|
|
345
|
+
baseColumn: never;
|
|
346
|
+
identity: undefined;
|
|
347
|
+
generated: undefined;
|
|
348
|
+
}, {}, {}>;
|
|
349
|
+
deletedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
350
|
+
name: "deleted_at";
|
|
351
|
+
tableName: "messages";
|
|
352
|
+
dataType: "date";
|
|
353
|
+
columnType: "PgTimestamp";
|
|
354
|
+
data: Date;
|
|
355
|
+
driverParam: string;
|
|
356
|
+
notNull: false;
|
|
357
|
+
hasDefault: false;
|
|
358
|
+
isPrimaryKey: false;
|
|
359
|
+
isAutoincrement: false;
|
|
360
|
+
hasRuntimeDefault: false;
|
|
361
|
+
enumValues: undefined;
|
|
362
|
+
baseColumn: never;
|
|
363
|
+
identity: undefined;
|
|
364
|
+
generated: undefined;
|
|
365
|
+
}, {}, {}>;
|
|
366
|
+
deletedBy: import("drizzle-orm/pg-core").PgColumn<{
|
|
367
|
+
name: "deleted_by";
|
|
368
|
+
tableName: "messages";
|
|
369
|
+
dataType: "string";
|
|
370
|
+
columnType: "PgText";
|
|
371
|
+
data: string;
|
|
372
|
+
driverParam: string;
|
|
373
|
+
notNull: false;
|
|
374
|
+
hasDefault: false;
|
|
375
|
+
isPrimaryKey: false;
|
|
376
|
+
isAutoincrement: false;
|
|
377
|
+
hasRuntimeDefault: false;
|
|
378
|
+
enumValues: [string, ...string[]];
|
|
379
|
+
baseColumn: never;
|
|
380
|
+
identity: undefined;
|
|
381
|
+
generated: undefined;
|
|
382
|
+
}, {}, {}>;
|
|
383
|
+
purgeAfter: import("drizzle-orm/pg-core").PgColumn<{
|
|
384
|
+
name: "purge_after";
|
|
385
|
+
tableName: "messages";
|
|
386
|
+
dataType: "date";
|
|
387
|
+
columnType: "PgTimestamp";
|
|
388
|
+
data: Date;
|
|
389
|
+
driverParam: string;
|
|
390
|
+
notNull: false;
|
|
391
|
+
hasDefault: false;
|
|
392
|
+
isPrimaryKey: false;
|
|
393
|
+
isAutoincrement: false;
|
|
394
|
+
hasRuntimeDefault: false;
|
|
395
|
+
enumValues: undefined;
|
|
396
|
+
baseColumn: never;
|
|
397
|
+
identity: undefined;
|
|
398
|
+
generated: undefined;
|
|
399
|
+
}, {}, {}>;
|
|
400
|
+
};
|
|
401
|
+
dialect: 'pg';
|
|
402
|
+
}>;
|
|
403
|
+
/**
|
|
404
|
+
* TypeScript types representing database rows
|
|
405
|
+
*/
|
|
406
|
+
export type Message = typeof message.$inferSelect;
|
|
407
|
+
export type MessageInsert = typeof message.$inferInsert;
|
|
408
|
+
/**
|
|
409
|
+
* Helper types for working with partial updates
|
|
410
|
+
*/
|
|
411
|
+
export type MessageUpdate = Partial<Omit<MessageInsert, 'id' | 'createdAt' | 'createdBy'>>;
|