@intx/db 0.1.2 → 0.2.2
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 +176 -0
- package/README.md +21 -2
- package/dist/asset-resolution.d.ts +52 -0
- package/dist/asset-resolution.js +66 -0
- package/dist/catalog-resolution.d.ts +76 -0
- package/dist/catalog-resolution.js +151 -0
- package/dist/client.d.ts +9 -0
- package/dist/client.js +18 -0
- package/dist/config.d.ts +11 -0
- package/dist/config.js +16 -0
- package/dist/connection.d.ts +3 -0
- package/dist/connection.js +23 -0
- package/dist/credential-resolution.d.ts +110 -0
- package/dist/credential-resolution.js +116 -0
- package/dist/grant-store.d.ts +3 -0
- package/dist/grant-store.js +37 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +12 -0
- package/dist/migrate.d.ts +36 -0
- package/dist/migrate.js +135 -0
- package/dist/model-source-resolution.d.ts +69 -0
- package/dist/model-source-resolution.js +165 -0
- package/dist/parse-row.d.ts +193 -0
- package/dist/parse-row.js +141 -0
- package/dist/pg-error.d.ts +3 -0
- package/dist/pg-error.js +19 -0
- package/dist/pricing.d.ts +15 -0
- package/dist/pricing.js +24 -0
- package/dist/schema/agent-assets.d.ts +109 -0
- package/dist/schema/agent-assets.js +15 -0
- package/dist/schema/agents.d.ts +405 -0
- package/dist/schema/agents.js +57 -0
- package/dist/schema/assets.d.ts +143 -0
- package/{src/schema/assets.ts → dist/schema/assets.js} +7 -16
- package/dist/schema/auth.d.ts +606 -0
- package/dist/schema/auth.js +47 -0
- package/dist/schema/catalog.d.ts +794 -0
- package/dist/schema/catalog.js +102 -0
- package/dist/schema/column-types.d.ts +26 -0
- package/dist/schema/column-types.js +15 -0
- package/dist/schema/credentials.d.ts +305 -0
- package/{src/schema/credentials.ts → dist/schema/credentials.js} +16 -22
- package/dist/schema/git-tokens.d.ts +256 -0
- package/{src/schema/git-tokens.ts → dist/schema/git-tokens.js} +15 -38
- package/dist/schema/grants.d.ts +211 -0
- package/dist/schema/grants.js +24 -0
- package/dist/schema/index.d.ts +21 -0
- package/dist/schema/index.js +21 -0
- package/dist/schema/instances.d.ts +262 -0
- package/dist/schema/instances.js +39 -0
- package/dist/schema/messages.d.ts +414 -0
- package/dist/schema/messages.js +71 -0
- package/dist/schema/oauth-clients.d.ts +246 -0
- package/{src/schema/oauth-clients.ts → dist/schema/oauth-clients.js} +8 -14
- package/dist/schema/offerings.d.ts +160 -0
- package/dist/schema/offerings.js +18 -0
- package/dist/schema/principals.d.ts +128 -0
- package/{src/schema/principals.ts → dist/schema/principals.js} +7 -14
- package/dist/schema/providers.d.ts +220 -0
- package/{src/schema/providers.ts → dist/schema/providers.js} +5 -11
- package/dist/schema/roles.d.ts +242 -0
- package/dist/schema/roles.js +33 -0
- package/dist/schema/session-assets.d.ts +129 -0
- package/dist/schema/session-assets.js +28 -0
- package/dist/schema/sessions.d.ts +143 -0
- package/dist/schema/sessions.js +24 -0
- package/dist/schema/sidecar.d.ts +128 -0
- package/dist/schema/sidecar.js +18 -0
- package/dist/schema/tenants.d.ts +235 -0
- package/{src/schema/tenants.ts → dist/schema/tenants.js} +10 -27
- package/dist/schema/wallets.d.ts +354 -0
- package/dist/schema/wallets.js +41 -0
- package/dist/schema/workflow-deployments.d.ts +129 -0
- package/dist/schema/workflow-deployments.js +37 -0
- package/dist/tenant-hierarchy.d.ts +22 -0
- package/dist/tenant-hierarchy.js +55 -0
- package/migrations/0029_loose_warlock.sql +1 -0
- package/migrations/0030_session_asset_audit_split.sql +5 -0
- package/migrations/0031_gigantic_nicolaos.sql +68 -0
- package/migrations/0032_lethal_misty_knight.sql +1 -0
- package/migrations/0033_old_payback.sql +1 -0
- package/migrations/0034_sleepy_songbird.sql +11 -0
- package/migrations/0035_violet_giant_man.sql +3 -0
- package/migrations/0036_sharp_the_executioner.sql +2 -0
- package/migrations/meta/0029_snapshot.json +2664 -0
- package/migrations/meta/0030_snapshot.json +2670 -0
- package/migrations/meta/0031_snapshot.json +3100 -0
- package/migrations/meta/0032_snapshot.json +3106 -0
- package/migrations/meta/0033_snapshot.json +3112 -0
- package/migrations/meta/0034_snapshot.json +3198 -0
- package/migrations/meta/0035_snapshot.json +3225 -0
- package/migrations/meta/0036_snapshot.json +3237 -0
- package/migrations/meta/_journal.json +56 -0
- package/package.json +22 -11
- package/drizzle.config.ts +0 -23
- package/src/client.ts +0 -24
- package/src/config.ts +0 -19
- package/src/connection.ts +0 -27
- package/src/credential-resolution.ts +0 -378
- package/src/grant-store.ts +0 -51
- package/src/index.ts +0 -32
- package/src/migrate.test.ts +0 -35
- package/src/migrate.ts +0 -168
- package/src/parse-row.test.ts +0 -113
- package/src/parse-row.ts +0 -185
- package/src/schema/agent-assets.ts +0 -21
- package/src/schema/agents.ts +0 -49
- package/src/schema/auth.ts +0 -51
- package/src/schema/grants.ts +0 -26
- package/src/schema/index.ts +0 -19
- package/src/schema/instances.ts +0 -36
- package/src/schema/messages.ts +0 -108
- package/src/schema/offerings.ts +0 -20
- package/src/schema/roles.ts +0 -51
- package/src/schema/session-assets.ts +0 -49
- package/src/schema/sessions.ts +0 -26
- package/src/schema/sidecar.ts +0 -14
- package/src/schema/wallets.ts +0 -44
- package/src/tenant-hierarchy.ts +0 -34
- package/tsconfig.json +0 -4
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
export declare const wallet: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
2
|
+
name: "wallet";
|
|
3
|
+
schema: undefined;
|
|
4
|
+
columns: {
|
|
5
|
+
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
6
|
+
name: "id";
|
|
7
|
+
tableName: "wallet";
|
|
8
|
+
dataType: "string";
|
|
9
|
+
columnType: "PgText";
|
|
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
|
+
tenantId: import("drizzle-orm/pg-core").PgColumn<{
|
|
23
|
+
name: "tenant_id";
|
|
24
|
+
tableName: "wallet";
|
|
25
|
+
dataType: "string";
|
|
26
|
+
columnType: "PgText";
|
|
27
|
+
data: string;
|
|
28
|
+
driverParam: string;
|
|
29
|
+
notNull: true;
|
|
30
|
+
hasDefault: false;
|
|
31
|
+
isPrimaryKey: false;
|
|
32
|
+
isAutoincrement: false;
|
|
33
|
+
hasRuntimeDefault: false;
|
|
34
|
+
enumValues: [string, ...string[]];
|
|
35
|
+
baseColumn: never;
|
|
36
|
+
identity: undefined;
|
|
37
|
+
generated: undefined;
|
|
38
|
+
}, {}, {}>;
|
|
39
|
+
name: import("drizzle-orm/pg-core").PgColumn<{
|
|
40
|
+
name: "name";
|
|
41
|
+
tableName: "wallet";
|
|
42
|
+
dataType: "string";
|
|
43
|
+
columnType: "PgText";
|
|
44
|
+
data: string;
|
|
45
|
+
driverParam: string;
|
|
46
|
+
notNull: true;
|
|
47
|
+
hasDefault: false;
|
|
48
|
+
isPrimaryKey: false;
|
|
49
|
+
isAutoincrement: false;
|
|
50
|
+
hasRuntimeDefault: false;
|
|
51
|
+
enumValues: [string, ...string[]];
|
|
52
|
+
baseColumn: never;
|
|
53
|
+
identity: undefined;
|
|
54
|
+
generated: undefined;
|
|
55
|
+
}, {}, {}>;
|
|
56
|
+
backendType: import("drizzle-orm/pg-core").PgColumn<{
|
|
57
|
+
name: "backend_type";
|
|
58
|
+
tableName: "wallet";
|
|
59
|
+
dataType: "string";
|
|
60
|
+
columnType: "PgText";
|
|
61
|
+
data: "crypto" | "fiat" | "credits";
|
|
62
|
+
driverParam: string;
|
|
63
|
+
notNull: true;
|
|
64
|
+
hasDefault: false;
|
|
65
|
+
isPrimaryKey: false;
|
|
66
|
+
isAutoincrement: false;
|
|
67
|
+
hasRuntimeDefault: false;
|
|
68
|
+
enumValues: ["crypto", "fiat", "credits"];
|
|
69
|
+
baseColumn: never;
|
|
70
|
+
identity: undefined;
|
|
71
|
+
generated: undefined;
|
|
72
|
+
}, {}, {}>;
|
|
73
|
+
currency: import("drizzle-orm/pg-core").PgColumn<{
|
|
74
|
+
name: "currency";
|
|
75
|
+
tableName: "wallet";
|
|
76
|
+
dataType: "string";
|
|
77
|
+
columnType: "PgText";
|
|
78
|
+
data: string;
|
|
79
|
+
driverParam: string;
|
|
80
|
+
notNull: true;
|
|
81
|
+
hasDefault: false;
|
|
82
|
+
isPrimaryKey: false;
|
|
83
|
+
isAutoincrement: false;
|
|
84
|
+
hasRuntimeDefault: false;
|
|
85
|
+
enumValues: [string, ...string[]];
|
|
86
|
+
baseColumn: never;
|
|
87
|
+
identity: undefined;
|
|
88
|
+
generated: undefined;
|
|
89
|
+
}, {}, {}>;
|
|
90
|
+
balance: import("drizzle-orm/pg-core").PgColumn<{
|
|
91
|
+
name: "balance";
|
|
92
|
+
tableName: "wallet";
|
|
93
|
+
dataType: "string";
|
|
94
|
+
columnType: "PgText";
|
|
95
|
+
data: string;
|
|
96
|
+
driverParam: string;
|
|
97
|
+
notNull: true;
|
|
98
|
+
hasDefault: true;
|
|
99
|
+
isPrimaryKey: false;
|
|
100
|
+
isAutoincrement: false;
|
|
101
|
+
hasRuntimeDefault: false;
|
|
102
|
+
enumValues: [string, ...string[]];
|
|
103
|
+
baseColumn: never;
|
|
104
|
+
identity: undefined;
|
|
105
|
+
generated: undefined;
|
|
106
|
+
}, {}, {}>;
|
|
107
|
+
config: import("drizzle-orm/pg-core").PgColumn<{
|
|
108
|
+
name: "config";
|
|
109
|
+
tableName: "wallet";
|
|
110
|
+
dataType: "json";
|
|
111
|
+
columnType: "PgJsonb";
|
|
112
|
+
data: unknown;
|
|
113
|
+
driverParam: unknown;
|
|
114
|
+
notNull: false;
|
|
115
|
+
hasDefault: false;
|
|
116
|
+
isPrimaryKey: false;
|
|
117
|
+
isAutoincrement: false;
|
|
118
|
+
hasRuntimeDefault: false;
|
|
119
|
+
enumValues: undefined;
|
|
120
|
+
baseColumn: never;
|
|
121
|
+
identity: undefined;
|
|
122
|
+
generated: undefined;
|
|
123
|
+
}, {}, {}>;
|
|
124
|
+
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
125
|
+
name: "created_at";
|
|
126
|
+
tableName: "wallet";
|
|
127
|
+
dataType: "date";
|
|
128
|
+
columnType: "PgTimestamp";
|
|
129
|
+
data: Date;
|
|
130
|
+
driverParam: string;
|
|
131
|
+
notNull: true;
|
|
132
|
+
hasDefault: true;
|
|
133
|
+
isPrimaryKey: false;
|
|
134
|
+
isAutoincrement: false;
|
|
135
|
+
hasRuntimeDefault: false;
|
|
136
|
+
enumValues: undefined;
|
|
137
|
+
baseColumn: never;
|
|
138
|
+
identity: undefined;
|
|
139
|
+
generated: undefined;
|
|
140
|
+
}, {}, {}>;
|
|
141
|
+
updatedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
142
|
+
name: "updated_at";
|
|
143
|
+
tableName: "wallet";
|
|
144
|
+
dataType: "date";
|
|
145
|
+
columnType: "PgTimestamp";
|
|
146
|
+
data: Date;
|
|
147
|
+
driverParam: string;
|
|
148
|
+
notNull: true;
|
|
149
|
+
hasDefault: true;
|
|
150
|
+
isPrimaryKey: false;
|
|
151
|
+
isAutoincrement: false;
|
|
152
|
+
hasRuntimeDefault: false;
|
|
153
|
+
enumValues: undefined;
|
|
154
|
+
baseColumn: never;
|
|
155
|
+
identity: undefined;
|
|
156
|
+
generated: undefined;
|
|
157
|
+
}, {}, {}>;
|
|
158
|
+
};
|
|
159
|
+
dialect: "pg";
|
|
160
|
+
}>;
|
|
161
|
+
export declare const transaction: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
162
|
+
name: "transaction";
|
|
163
|
+
schema: undefined;
|
|
164
|
+
columns: {
|
|
165
|
+
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
166
|
+
name: "id";
|
|
167
|
+
tableName: "transaction";
|
|
168
|
+
dataType: "string";
|
|
169
|
+
columnType: "PgText";
|
|
170
|
+
data: string;
|
|
171
|
+
driverParam: string;
|
|
172
|
+
notNull: true;
|
|
173
|
+
hasDefault: false;
|
|
174
|
+
isPrimaryKey: true;
|
|
175
|
+
isAutoincrement: false;
|
|
176
|
+
hasRuntimeDefault: false;
|
|
177
|
+
enumValues: [string, ...string[]];
|
|
178
|
+
baseColumn: never;
|
|
179
|
+
identity: undefined;
|
|
180
|
+
generated: undefined;
|
|
181
|
+
}, {}, {}>;
|
|
182
|
+
walletId: import("drizzle-orm/pg-core").PgColumn<{
|
|
183
|
+
name: "wallet_id";
|
|
184
|
+
tableName: "transaction";
|
|
185
|
+
dataType: "string";
|
|
186
|
+
columnType: "PgText";
|
|
187
|
+
data: string;
|
|
188
|
+
driverParam: string;
|
|
189
|
+
notNull: true;
|
|
190
|
+
hasDefault: false;
|
|
191
|
+
isPrimaryKey: false;
|
|
192
|
+
isAutoincrement: false;
|
|
193
|
+
hasRuntimeDefault: false;
|
|
194
|
+
enumValues: [string, ...string[]];
|
|
195
|
+
baseColumn: never;
|
|
196
|
+
identity: undefined;
|
|
197
|
+
generated: undefined;
|
|
198
|
+
}, {}, {}>;
|
|
199
|
+
agentId: import("drizzle-orm/pg-core").PgColumn<{
|
|
200
|
+
name: "agent_id";
|
|
201
|
+
tableName: "transaction";
|
|
202
|
+
dataType: "string";
|
|
203
|
+
columnType: "PgText";
|
|
204
|
+
data: string;
|
|
205
|
+
driverParam: string;
|
|
206
|
+
notNull: false;
|
|
207
|
+
hasDefault: false;
|
|
208
|
+
isPrimaryKey: false;
|
|
209
|
+
isAutoincrement: false;
|
|
210
|
+
hasRuntimeDefault: false;
|
|
211
|
+
enumValues: [string, ...string[]];
|
|
212
|
+
baseColumn: never;
|
|
213
|
+
identity: undefined;
|
|
214
|
+
generated: undefined;
|
|
215
|
+
}, {}, {}>;
|
|
216
|
+
direction: import("drizzle-orm/pg-core").PgColumn<{
|
|
217
|
+
name: "direction";
|
|
218
|
+
tableName: "transaction";
|
|
219
|
+
dataType: "string";
|
|
220
|
+
columnType: "PgText";
|
|
221
|
+
data: "inbound" | "outbound";
|
|
222
|
+
driverParam: string;
|
|
223
|
+
notNull: true;
|
|
224
|
+
hasDefault: false;
|
|
225
|
+
isPrimaryKey: false;
|
|
226
|
+
isAutoincrement: false;
|
|
227
|
+
hasRuntimeDefault: false;
|
|
228
|
+
enumValues: ["inbound", "outbound"];
|
|
229
|
+
baseColumn: never;
|
|
230
|
+
identity: undefined;
|
|
231
|
+
generated: undefined;
|
|
232
|
+
}, {}, {}>;
|
|
233
|
+
amount: import("drizzle-orm/pg-core").PgColumn<{
|
|
234
|
+
name: "amount";
|
|
235
|
+
tableName: "transaction";
|
|
236
|
+
dataType: "string";
|
|
237
|
+
columnType: "PgText";
|
|
238
|
+
data: string;
|
|
239
|
+
driverParam: string;
|
|
240
|
+
notNull: true;
|
|
241
|
+
hasDefault: false;
|
|
242
|
+
isPrimaryKey: false;
|
|
243
|
+
isAutoincrement: false;
|
|
244
|
+
hasRuntimeDefault: false;
|
|
245
|
+
enumValues: [string, ...string[]];
|
|
246
|
+
baseColumn: never;
|
|
247
|
+
identity: undefined;
|
|
248
|
+
generated: undefined;
|
|
249
|
+
}, {}, {}>;
|
|
250
|
+
currency: import("drizzle-orm/pg-core").PgColumn<{
|
|
251
|
+
name: "currency";
|
|
252
|
+
tableName: "transaction";
|
|
253
|
+
dataType: "string";
|
|
254
|
+
columnType: "PgText";
|
|
255
|
+
data: string;
|
|
256
|
+
driverParam: string;
|
|
257
|
+
notNull: true;
|
|
258
|
+
hasDefault: false;
|
|
259
|
+
isPrimaryKey: false;
|
|
260
|
+
isAutoincrement: false;
|
|
261
|
+
hasRuntimeDefault: false;
|
|
262
|
+
enumValues: [string, ...string[]];
|
|
263
|
+
baseColumn: never;
|
|
264
|
+
identity: undefined;
|
|
265
|
+
generated: undefined;
|
|
266
|
+
}, {}, {}>;
|
|
267
|
+
recipientId: import("drizzle-orm/pg-core").PgColumn<{
|
|
268
|
+
name: "recipient_id";
|
|
269
|
+
tableName: "transaction";
|
|
270
|
+
dataType: "string";
|
|
271
|
+
columnType: "PgText";
|
|
272
|
+
data: string;
|
|
273
|
+
driverParam: string;
|
|
274
|
+
notNull: false;
|
|
275
|
+
hasDefault: false;
|
|
276
|
+
isPrimaryKey: false;
|
|
277
|
+
isAutoincrement: false;
|
|
278
|
+
hasRuntimeDefault: false;
|
|
279
|
+
enumValues: [string, ...string[]];
|
|
280
|
+
baseColumn: never;
|
|
281
|
+
identity: undefined;
|
|
282
|
+
generated: undefined;
|
|
283
|
+
}, {}, {}>;
|
|
284
|
+
senderId: import("drizzle-orm/pg-core").PgColumn<{
|
|
285
|
+
name: "sender_id";
|
|
286
|
+
tableName: "transaction";
|
|
287
|
+
dataType: "string";
|
|
288
|
+
columnType: "PgText";
|
|
289
|
+
data: string;
|
|
290
|
+
driverParam: string;
|
|
291
|
+
notNull: false;
|
|
292
|
+
hasDefault: false;
|
|
293
|
+
isPrimaryKey: false;
|
|
294
|
+
isAutoincrement: false;
|
|
295
|
+
hasRuntimeDefault: false;
|
|
296
|
+
enumValues: [string, ...string[]];
|
|
297
|
+
baseColumn: never;
|
|
298
|
+
identity: undefined;
|
|
299
|
+
generated: undefined;
|
|
300
|
+
}, {}, {}>;
|
|
301
|
+
requestId: import("drizzle-orm/pg-core").PgColumn<{
|
|
302
|
+
name: "request_id";
|
|
303
|
+
tableName: "transaction";
|
|
304
|
+
dataType: "string";
|
|
305
|
+
columnType: "PgText";
|
|
306
|
+
data: string;
|
|
307
|
+
driverParam: string;
|
|
308
|
+
notNull: false;
|
|
309
|
+
hasDefault: false;
|
|
310
|
+
isPrimaryKey: false;
|
|
311
|
+
isAutoincrement: false;
|
|
312
|
+
hasRuntimeDefault: false;
|
|
313
|
+
enumValues: [string, ...string[]];
|
|
314
|
+
baseColumn: never;
|
|
315
|
+
identity: undefined;
|
|
316
|
+
generated: undefined;
|
|
317
|
+
}, {}, {}>;
|
|
318
|
+
status: import("drizzle-orm/pg-core").PgColumn<{
|
|
319
|
+
name: "status";
|
|
320
|
+
tableName: "transaction";
|
|
321
|
+
dataType: "string";
|
|
322
|
+
columnType: "PgText";
|
|
323
|
+
data: "failed" | "pending" | "completed";
|
|
324
|
+
driverParam: string;
|
|
325
|
+
notNull: true;
|
|
326
|
+
hasDefault: true;
|
|
327
|
+
isPrimaryKey: false;
|
|
328
|
+
isAutoincrement: false;
|
|
329
|
+
hasRuntimeDefault: false;
|
|
330
|
+
enumValues: ["pending", "completed", "failed"];
|
|
331
|
+
baseColumn: never;
|
|
332
|
+
identity: undefined;
|
|
333
|
+
generated: undefined;
|
|
334
|
+
}, {}, {}>;
|
|
335
|
+
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
336
|
+
name: "created_at";
|
|
337
|
+
tableName: "transaction";
|
|
338
|
+
dataType: "date";
|
|
339
|
+
columnType: "PgTimestamp";
|
|
340
|
+
data: Date;
|
|
341
|
+
driverParam: string;
|
|
342
|
+
notNull: true;
|
|
343
|
+
hasDefault: true;
|
|
344
|
+
isPrimaryKey: false;
|
|
345
|
+
isAutoincrement: false;
|
|
346
|
+
hasRuntimeDefault: false;
|
|
347
|
+
enumValues: undefined;
|
|
348
|
+
baseColumn: never;
|
|
349
|
+
identity: undefined;
|
|
350
|
+
generated: undefined;
|
|
351
|
+
}, {}, {}>;
|
|
352
|
+
};
|
|
353
|
+
dialect: "pg";
|
|
354
|
+
}>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsonb, pgTable, text, timestamp } from "drizzle-orm/pg-core";
|
|
2
|
+
import { agent } from "./agents.js";
|
|
3
|
+
import { tenant } from "./tenants.js";
|
|
4
|
+
export const wallet = pgTable("wallet", {
|
|
5
|
+
id: text("id").primaryKey(),
|
|
6
|
+
tenantId: text("tenant_id")
|
|
7
|
+
.notNull()
|
|
8
|
+
.references(() => tenant.id, { onDelete: "cascade" }),
|
|
9
|
+
name: text("name").notNull(),
|
|
10
|
+
backendType: text("backend_type", {
|
|
11
|
+
enum: ["crypto", "fiat", "credits"],
|
|
12
|
+
}).notNull(),
|
|
13
|
+
currency: text("currency").notNull(),
|
|
14
|
+
balance: text("balance").notNull().default("0"),
|
|
15
|
+
config: jsonb("config"),
|
|
16
|
+
createdAt: timestamp("created_at").notNull().defaultNow(),
|
|
17
|
+
updatedAt: timestamp("updated_at").notNull().defaultNow(),
|
|
18
|
+
});
|
|
19
|
+
export const transaction = pgTable("transaction", {
|
|
20
|
+
id: text("id").primaryKey(),
|
|
21
|
+
walletId: text("wallet_id")
|
|
22
|
+
.notNull()
|
|
23
|
+
.references(() => wallet.id, { onDelete: "cascade" }),
|
|
24
|
+
agentId: text("agent_id").references(() => agent.id, {
|
|
25
|
+
onDelete: "set null",
|
|
26
|
+
}),
|
|
27
|
+
direction: text("direction", {
|
|
28
|
+
enum: ["inbound", "outbound"],
|
|
29
|
+
}).notNull(),
|
|
30
|
+
amount: text("amount").notNull(),
|
|
31
|
+
currency: text("currency").notNull(),
|
|
32
|
+
recipientId: text("recipient_id"),
|
|
33
|
+
senderId: text("sender_id"),
|
|
34
|
+
requestId: text("request_id"),
|
|
35
|
+
status: text("status", {
|
|
36
|
+
enum: ["pending", "completed", "failed"],
|
|
37
|
+
})
|
|
38
|
+
.notNull()
|
|
39
|
+
.default("pending"),
|
|
40
|
+
createdAt: timestamp("created_at").notNull().defaultNow(),
|
|
41
|
+
});
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
export type WorkflowDeploymentStatus = "deployed" | "error";
|
|
2
|
+
export declare const workflowDeployment: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
3
|
+
name: "workflow_deployment";
|
|
4
|
+
schema: undefined;
|
|
5
|
+
columns: {
|
|
6
|
+
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
7
|
+
name: "id";
|
|
8
|
+
tableName: "workflow_deployment";
|
|
9
|
+
dataType: "string";
|
|
10
|
+
columnType: "PgText";
|
|
11
|
+
data: string;
|
|
12
|
+
driverParam: string;
|
|
13
|
+
notNull: true;
|
|
14
|
+
hasDefault: false;
|
|
15
|
+
isPrimaryKey: true;
|
|
16
|
+
isAutoincrement: false;
|
|
17
|
+
hasRuntimeDefault: false;
|
|
18
|
+
enumValues: [string, ...string[]];
|
|
19
|
+
baseColumn: never;
|
|
20
|
+
identity: undefined;
|
|
21
|
+
generated: undefined;
|
|
22
|
+
}, {}, {}>;
|
|
23
|
+
tenantId: import("drizzle-orm/pg-core").PgColumn<{
|
|
24
|
+
name: "tenant_id";
|
|
25
|
+
tableName: "workflow_deployment";
|
|
26
|
+
dataType: "string";
|
|
27
|
+
columnType: "PgText";
|
|
28
|
+
data: string;
|
|
29
|
+
driverParam: string;
|
|
30
|
+
notNull: true;
|
|
31
|
+
hasDefault: false;
|
|
32
|
+
isPrimaryKey: false;
|
|
33
|
+
isAutoincrement: false;
|
|
34
|
+
hasRuntimeDefault: false;
|
|
35
|
+
enumValues: [string, ...string[]];
|
|
36
|
+
baseColumn: never;
|
|
37
|
+
identity: undefined;
|
|
38
|
+
generated: undefined;
|
|
39
|
+
}, {}, {}>;
|
|
40
|
+
definitionAssetId: import("drizzle-orm/pg-core").PgColumn<{
|
|
41
|
+
name: "definition_asset_id";
|
|
42
|
+
tableName: "workflow_deployment";
|
|
43
|
+
dataType: "string";
|
|
44
|
+
columnType: "PgText";
|
|
45
|
+
data: string;
|
|
46
|
+
driverParam: string;
|
|
47
|
+
notNull: true;
|
|
48
|
+
hasDefault: false;
|
|
49
|
+
isPrimaryKey: false;
|
|
50
|
+
isAutoincrement: false;
|
|
51
|
+
hasRuntimeDefault: false;
|
|
52
|
+
enumValues: [string, ...string[]];
|
|
53
|
+
baseColumn: never;
|
|
54
|
+
identity: undefined;
|
|
55
|
+
generated: undefined;
|
|
56
|
+
}, {}, {}>;
|
|
57
|
+
address: import("drizzle-orm/pg-core").PgColumn<{
|
|
58
|
+
name: "address";
|
|
59
|
+
tableName: "workflow_deployment";
|
|
60
|
+
dataType: "string";
|
|
61
|
+
columnType: "PgText";
|
|
62
|
+
data: string;
|
|
63
|
+
driverParam: string;
|
|
64
|
+
notNull: true;
|
|
65
|
+
hasDefault: false;
|
|
66
|
+
isPrimaryKey: false;
|
|
67
|
+
isAutoincrement: false;
|
|
68
|
+
hasRuntimeDefault: false;
|
|
69
|
+
enumValues: [string, ...string[]];
|
|
70
|
+
baseColumn: never;
|
|
71
|
+
identity: undefined;
|
|
72
|
+
generated: undefined;
|
|
73
|
+
}, {}, {}>;
|
|
74
|
+
publicKey: import("drizzle-orm/pg-core").PgColumn<{
|
|
75
|
+
name: "public_key";
|
|
76
|
+
tableName: "workflow_deployment";
|
|
77
|
+
dataType: "string";
|
|
78
|
+
columnType: "PgText";
|
|
79
|
+
data: string;
|
|
80
|
+
driverParam: string;
|
|
81
|
+
notNull: false;
|
|
82
|
+
hasDefault: false;
|
|
83
|
+
isPrimaryKey: false;
|
|
84
|
+
isAutoincrement: false;
|
|
85
|
+
hasRuntimeDefault: false;
|
|
86
|
+
enumValues: [string, ...string[]];
|
|
87
|
+
baseColumn: never;
|
|
88
|
+
identity: undefined;
|
|
89
|
+
generated: undefined;
|
|
90
|
+
}, {}, {}>;
|
|
91
|
+
status: import("drizzle-orm/pg-core").PgColumn<{
|
|
92
|
+
name: "status";
|
|
93
|
+
tableName: "workflow_deployment";
|
|
94
|
+
dataType: "string";
|
|
95
|
+
columnType: "PgText";
|
|
96
|
+
data: WorkflowDeploymentStatus;
|
|
97
|
+
driverParam: string;
|
|
98
|
+
notNull: true;
|
|
99
|
+
hasDefault: true;
|
|
100
|
+
isPrimaryKey: false;
|
|
101
|
+
isAutoincrement: false;
|
|
102
|
+
hasRuntimeDefault: false;
|
|
103
|
+
enumValues: [string, ...string[]];
|
|
104
|
+
baseColumn: never;
|
|
105
|
+
identity: undefined;
|
|
106
|
+
generated: undefined;
|
|
107
|
+
}, {}, {
|
|
108
|
+
$type: WorkflowDeploymentStatus;
|
|
109
|
+
}>;
|
|
110
|
+
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
111
|
+
name: "created_at";
|
|
112
|
+
tableName: "workflow_deployment";
|
|
113
|
+
dataType: "date";
|
|
114
|
+
columnType: "PgTimestamp";
|
|
115
|
+
data: Date;
|
|
116
|
+
driverParam: string;
|
|
117
|
+
notNull: true;
|
|
118
|
+
hasDefault: true;
|
|
119
|
+
isPrimaryKey: false;
|
|
120
|
+
isAutoincrement: false;
|
|
121
|
+
hasRuntimeDefault: false;
|
|
122
|
+
enumValues: undefined;
|
|
123
|
+
baseColumn: never;
|
|
124
|
+
identity: undefined;
|
|
125
|
+
generated: undefined;
|
|
126
|
+
}, {}, {}>;
|
|
127
|
+
};
|
|
128
|
+
dialect: "pg";
|
|
129
|
+
}>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { index, pgTable, text, timestamp, uniqueIndex, } from "drizzle-orm/pg-core";
|
|
2
|
+
import { asset } from "./assets.js";
|
|
3
|
+
import { tenant } from "./tenants.js";
|
|
4
|
+
export const workflowDeployment = pgTable("workflow_deployment", {
|
|
5
|
+
id: text("id").primaryKey(),
|
|
6
|
+
tenantId: text("tenant_id")
|
|
7
|
+
.notNull()
|
|
8
|
+
.references(() => tenant.id, { onDelete: "cascade" }),
|
|
9
|
+
definitionAssetId: text("definition_asset_id")
|
|
10
|
+
.notNull()
|
|
11
|
+
.references(() => asset.id, { onDelete: "cascade" }),
|
|
12
|
+
// The deployment's routable address (`ins_<id>@<domain>`), stored rather
|
|
13
|
+
// than re-derived at read time so the reconnect ownership challenge can
|
|
14
|
+
// look up the deployment's public key by address, symmetrically with the
|
|
15
|
+
// `agent_instance` path. Unique so a double-insert fails loud.
|
|
16
|
+
//
|
|
17
|
+
// Added NOT NULL with no default and no backfill. Like the repo's other
|
|
18
|
+
// such adds (e.g. `credential.provider_id`), the migration relies on the
|
|
19
|
+
// table being empty when it runs: this table and the `address` column
|
|
20
|
+
// land one migration apart, both unreleased, so no populated row predates
|
|
21
|
+
// the column and none needs a backfilled address.
|
|
22
|
+
address: text("address").notNull(),
|
|
23
|
+
// The Ed25519 public key the sidecar minted for this deployment address,
|
|
24
|
+
// persisted at deploy-ack. Nullable by design: the row is written at
|
|
25
|
+
// deploy-start and the key arrives at ack, so a not-yet-acked deployment
|
|
26
|
+
// reads `null` and its reconnect challenge fails closed -- the address
|
|
27
|
+
// stays unrouted rather than routing without ownership proof.
|
|
28
|
+
publicKey: text("public_key"),
|
|
29
|
+
status: text("status")
|
|
30
|
+
.$type()
|
|
31
|
+
.notNull()
|
|
32
|
+
.default("deployed"),
|
|
33
|
+
createdAt: timestamp("created_at").notNull().defaultNow(),
|
|
34
|
+
}, (t) => [
|
|
35
|
+
index("workflow_deployment_tenant_idx").on(t.tenantId, t.createdAt),
|
|
36
|
+
uniqueIndex("workflow_deployment_address_idx").on(t.address),
|
|
37
|
+
]);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { DB } from "./client.js";
|
|
2
|
+
/**
|
|
3
|
+
* Walks the tenant parentId chain from the given tenant up to the root.
|
|
4
|
+
* Returns an ordered array of tenant IDs: [tenantId, parentId, grandparentId, ...rootId].
|
|
5
|
+
*
|
|
6
|
+
* Protects against cycles with a depth limit.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getAncestorChain(db: DB["db"], tenantId: string): Promise<string[]>;
|
|
9
|
+
/**
|
|
10
|
+
* Returns the tenant and every distinct tenant in its subtree (children,
|
|
11
|
+
* their children, and so on), discovered breadth-first. Used to find every
|
|
12
|
+
* tenant whose resolved catalog a change at `tenantId` affects — descendants
|
|
13
|
+
* inherit the ancestor's catalog, so a catalog edit must reach their running
|
|
14
|
+
* agents too.
|
|
15
|
+
*
|
|
16
|
+
* Each level queries children by `parentId` membership rather than walking
|
|
17
|
+
* one tenant at a time. A `visited` set both deduplicates the result and
|
|
18
|
+
* guarantees termination: a tenant enters the frontier at most once, so even
|
|
19
|
+
* a malformed cyclic hierarchy drains the frontier instead of looping. No
|
|
20
|
+
* depth cap is imposed, so an arbitrarily deep tree is returned in full.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getDescendantTenants(db: DB["db"], tenantId: string): Promise<string[]>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { eq, inArray } from "drizzle-orm";
|
|
2
|
+
import { tenant } from "./schema/tenants.js";
|
|
3
|
+
const MAX_DEPTH = 20;
|
|
4
|
+
/**
|
|
5
|
+
* Walks the tenant parentId chain from the given tenant up to the root.
|
|
6
|
+
* Returns an ordered array of tenant IDs: [tenantId, parentId, grandparentId, ...rootId].
|
|
7
|
+
*
|
|
8
|
+
* Protects against cycles with a depth limit.
|
|
9
|
+
*/
|
|
10
|
+
export async function getAncestorChain(db, tenantId) {
|
|
11
|
+
const chain = [tenantId];
|
|
12
|
+
let currentId = tenantId;
|
|
13
|
+
for (let depth = 0; depth < MAX_DEPTH; depth++) {
|
|
14
|
+
const row = await db.query.tenant.findFirst({
|
|
15
|
+
where: eq(tenant.id, currentId),
|
|
16
|
+
columns: { parentId: true },
|
|
17
|
+
});
|
|
18
|
+
if (!row?.parentId)
|
|
19
|
+
break;
|
|
20
|
+
chain.push(row.parentId);
|
|
21
|
+
currentId = row.parentId;
|
|
22
|
+
}
|
|
23
|
+
return chain;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Returns the tenant and every distinct tenant in its subtree (children,
|
|
27
|
+
* their children, and so on), discovered breadth-first. Used to find every
|
|
28
|
+
* tenant whose resolved catalog a change at `tenantId` affects — descendants
|
|
29
|
+
* inherit the ancestor's catalog, so a catalog edit must reach their running
|
|
30
|
+
* agents too.
|
|
31
|
+
*
|
|
32
|
+
* Each level queries children by `parentId` membership rather than walking
|
|
33
|
+
* one tenant at a time. A `visited` set both deduplicates the result and
|
|
34
|
+
* guarantees termination: a tenant enters the frontier at most once, so even
|
|
35
|
+
* a malformed cyclic hierarchy drains the frontier instead of looping. No
|
|
36
|
+
* depth cap is imposed, so an arbitrarily deep tree is returned in full.
|
|
37
|
+
*/
|
|
38
|
+
export async function getDescendantTenants(db, tenantId) {
|
|
39
|
+
const visited = new Set([tenantId]);
|
|
40
|
+
let frontier = [tenantId];
|
|
41
|
+
while (frontier.length > 0) {
|
|
42
|
+
const children = await db.query.tenant.findMany({
|
|
43
|
+
where: inArray(tenant.parentId, frontier),
|
|
44
|
+
columns: { id: true },
|
|
45
|
+
});
|
|
46
|
+
frontier = [];
|
|
47
|
+
for (const child of children) {
|
|
48
|
+
if (visited.has(child.id))
|
|
49
|
+
continue;
|
|
50
|
+
visited.add(child.id);
|
|
51
|
+
frontier.push(child.id);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return [...visited];
|
|
55
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE "agent" ADD COLUMN "tool_packages" jsonb DEFAULT '[]'::jsonb NOT NULL;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
ALTER TABLE "session_asset" DROP CONSTRAINT "session_asset_instance_id_agent_asset_id_pk";--> statement-breakpoint
|
|
2
|
+
ALTER TABLE "session_asset" ALTER COLUMN "agent_asset_id" DROP NOT NULL;--> statement-breakpoint
|
|
3
|
+
ALTER TABLE "session_asset" ADD CONSTRAINT "session_asset_instance_id_mount_path_pk" PRIMARY KEY("instance_id","mount_path");--> statement-breakpoint
|
|
4
|
+
ALTER TABLE "session_asset" ADD COLUMN "source" text NOT NULL DEFAULT 'direct';--> statement-breakpoint
|
|
5
|
+
ALTER TABLE "session_asset" ALTER COLUMN "source" DROP DEFAULT;
|