@bluefields/db 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/dist/client.d.ts +6 -0
- package/dist/client.js +13 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/migrate.d.ts +11 -0
- package/dist/migrate.js +48 -0
- package/dist/migrate.js.map +1 -0
- package/dist/schema/api-keys.d.ts +145 -0
- package/dist/schema/api-keys.js +18 -0
- package/dist/schema/api-keys.js.map +1 -0
- package/dist/schema/audit-log.d.ts +228 -0
- package/dist/schema/audit-log.js +49 -0
- package/dist/schema/audit-log.js.map +1 -0
- package/dist/schema/cost-records.d.ts +190 -0
- package/dist/schema/cost-records.js +55 -0
- package/dist/schema/cost-records.js.map +1 -0
- package/dist/schema/crawl-job-pages.d.ts +186 -0
- package/dist/schema/crawl-job-pages.js +31 -0
- package/dist/schema/crawl-job-pages.js.map +1 -0
- package/dist/schema/crawl-jobs.d.ts +271 -0
- package/dist/schema/crawl-jobs.js +40 -0
- package/dist/schema/crawl-jobs.js.map +1 -0
- package/dist/schema/customers.d.ts +145 -0
- package/dist/schema/customers.js +19 -0
- package/dist/schema/customers.js.map +1 -0
- package/dist/schema/event-feedback.d.ts +170 -0
- package/dist/schema/event-feedback.js +35 -0
- package/dist/schema/event-feedback.js.map +1 -0
- package/dist/schema/events.d.ts +291 -0
- package/dist/schema/events.js +58 -0
- package/dist/schema/events.js.map +1 -0
- package/dist/schema/extractions.d.ts +327 -0
- package/dist/schema/extractions.js +56 -0
- package/dist/schema/extractions.js.map +1 -0
- package/dist/schema/host-extractors.d.ts +131 -0
- package/dist/schema/host-extractors.js +18 -0
- package/dist/schema/host-extractors.js.map +1 -0
- package/dist/schema/host-records.d.ts +237 -0
- package/dist/schema/host-records.js +42 -0
- package/dist/schema/host-records.js.map +1 -0
- package/dist/schema/notification-preferences.d.ts +195 -0
- package/dist/schema/notification-preferences.js +49 -0
- package/dist/schema/notification-preferences.js.map +1 -0
- package/dist/schema/scrape-cache.d.ts +136 -0
- package/dist/schema/scrape-cache.js +23 -0
- package/dist/schema/scrape-cache.js.map +1 -0
- package/dist/schema/sessions.d.ts +153 -0
- package/dist/schema/sessions.js +27 -0
- package/dist/schema/sessions.js.map +1 -0
- package/dist/schema/snapshots.d.ts +382 -0
- package/dist/schema/snapshots.js +60 -0
- package/dist/schema/snapshots.js.map +1 -0
- package/dist/schema/subscriptions.d.ts +604 -0
- package/dist/schema/subscriptions.js +79 -0
- package/dist/schema/subscriptions.js.map +1 -0
- package/dist/schema/usage-periods.d.ts +446 -0
- package/dist/schema/usage-periods.js +71 -0
- package/dist/schema/usage-periods.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +54 -0
- package/src/migrations/0001_initial.sql +398 -0
- package/src/migrations/0002_pg_cron.sql +109 -0
- package/src/migrations/0003_webhook_secret_cleanup.sql +55 -0
- package/src/migrations/0004_events_pg_notify.sql +39 -0
- package/src/migrations/0005_subscription_consecutive_failures.sql +19 -0
- package/src/migrations/0006_notification_preferences.sql +27 -0
- package/src/migrations/0007_crawl_jobs.sql +65 -0
- package/src/migrations/0008_sessions.sql +38 -0
- package/src/migrations/0009_scrape_cache.sql +34 -0
- package/src/migrations/0010_neon_defaults.sql +99 -0
- package/src/migrations/0011_credits_consumed_numeric.sql +12 -0
- package/src/migrations/0012_crawl_page_attestation.sql +10 -0
- package/src/migrations/0013_customer_deleted_at.sql +5 -0
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extractions — the interpreted layer.
|
|
3
|
+
*
|
|
4
|
+
* Cross-customer cache via the unique index on
|
|
5
|
+
* (content_hash, schema_hash, extractor_version) — same content + same schema
|
|
6
|
+
* + same extractor version is extracted exactly once (Review #6).
|
|
7
|
+
*
|
|
8
|
+
* SPEC DEVIATION: `snapshot_id` is NOT a foreign key. The spec wrote
|
|
9
|
+
* `REFERENCES snapshots(id)` but `snapshots` is partitioned with a composite
|
|
10
|
+
* primary key, so a DB-level FK to `snapshots(id)` alone is not expressible.
|
|
11
|
+
* Referential integrity for snapshot_id is enforced by application code.
|
|
12
|
+
*/
|
|
13
|
+
export declare const extractions: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
14
|
+
name: "extractions";
|
|
15
|
+
schema: undefined;
|
|
16
|
+
columns: {
|
|
17
|
+
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
18
|
+
name: "id";
|
|
19
|
+
tableName: "extractions";
|
|
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
|
+
snapshotId: import("drizzle-orm/pg-core").PgColumn<{
|
|
35
|
+
name: "snapshot_id";
|
|
36
|
+
tableName: "extractions";
|
|
37
|
+
dataType: "string";
|
|
38
|
+
columnType: "PgUUID";
|
|
39
|
+
data: string;
|
|
40
|
+
driverParam: string;
|
|
41
|
+
notNull: true;
|
|
42
|
+
hasDefault: false;
|
|
43
|
+
isPrimaryKey: false;
|
|
44
|
+
isAutoincrement: false;
|
|
45
|
+
hasRuntimeDefault: false;
|
|
46
|
+
enumValues: undefined;
|
|
47
|
+
baseColumn: never;
|
|
48
|
+
identity: undefined;
|
|
49
|
+
generated: undefined;
|
|
50
|
+
}, {}, {}>;
|
|
51
|
+
subscriptionId: import("drizzle-orm/pg-core").PgColumn<{
|
|
52
|
+
name: "subscription_id";
|
|
53
|
+
tableName: "extractions";
|
|
54
|
+
dataType: "string";
|
|
55
|
+
columnType: "PgUUID";
|
|
56
|
+
data: string;
|
|
57
|
+
driverParam: string;
|
|
58
|
+
notNull: false;
|
|
59
|
+
hasDefault: false;
|
|
60
|
+
isPrimaryKey: false;
|
|
61
|
+
isAutoincrement: false;
|
|
62
|
+
hasRuntimeDefault: false;
|
|
63
|
+
enumValues: undefined;
|
|
64
|
+
baseColumn: never;
|
|
65
|
+
identity: undefined;
|
|
66
|
+
generated: undefined;
|
|
67
|
+
}, {}, {}>;
|
|
68
|
+
customerId: import("drizzle-orm/pg-core").PgColumn<{
|
|
69
|
+
name: "customer_id";
|
|
70
|
+
tableName: "extractions";
|
|
71
|
+
dataType: "string";
|
|
72
|
+
columnType: "PgUUID";
|
|
73
|
+
data: string;
|
|
74
|
+
driverParam: string;
|
|
75
|
+
notNull: true;
|
|
76
|
+
hasDefault: false;
|
|
77
|
+
isPrimaryKey: false;
|
|
78
|
+
isAutoincrement: false;
|
|
79
|
+
hasRuntimeDefault: false;
|
|
80
|
+
enumValues: undefined;
|
|
81
|
+
baseColumn: never;
|
|
82
|
+
identity: undefined;
|
|
83
|
+
generated: undefined;
|
|
84
|
+
}, {}, {}>;
|
|
85
|
+
contentHash: import("drizzle-orm/pg-core").PgColumn<{
|
|
86
|
+
name: "content_hash";
|
|
87
|
+
tableName: "extractions";
|
|
88
|
+
dataType: "string";
|
|
89
|
+
columnType: "PgText";
|
|
90
|
+
data: string;
|
|
91
|
+
driverParam: string;
|
|
92
|
+
notNull: true;
|
|
93
|
+
hasDefault: false;
|
|
94
|
+
isPrimaryKey: false;
|
|
95
|
+
isAutoincrement: false;
|
|
96
|
+
hasRuntimeDefault: false;
|
|
97
|
+
enumValues: [string, ...string[]];
|
|
98
|
+
baseColumn: never;
|
|
99
|
+
identity: undefined;
|
|
100
|
+
generated: undefined;
|
|
101
|
+
}, {}, {}>;
|
|
102
|
+
schemaHash: import("drizzle-orm/pg-core").PgColumn<{
|
|
103
|
+
name: "schema_hash";
|
|
104
|
+
tableName: "extractions";
|
|
105
|
+
dataType: "string";
|
|
106
|
+
columnType: "PgText";
|
|
107
|
+
data: string;
|
|
108
|
+
driverParam: string;
|
|
109
|
+
notNull: false;
|
|
110
|
+
hasDefault: false;
|
|
111
|
+
isPrimaryKey: false;
|
|
112
|
+
isAutoincrement: false;
|
|
113
|
+
hasRuntimeDefault: false;
|
|
114
|
+
enumValues: [string, ...string[]];
|
|
115
|
+
baseColumn: never;
|
|
116
|
+
identity: undefined;
|
|
117
|
+
generated: undefined;
|
|
118
|
+
}, {}, {}>;
|
|
119
|
+
extractorVersion: import("drizzle-orm/pg-core").PgColumn<{
|
|
120
|
+
name: "extractor_version";
|
|
121
|
+
tableName: "extractions";
|
|
122
|
+
dataType: "string";
|
|
123
|
+
columnType: "PgText";
|
|
124
|
+
data: string;
|
|
125
|
+
driverParam: string;
|
|
126
|
+
notNull: true;
|
|
127
|
+
hasDefault: false;
|
|
128
|
+
isPrimaryKey: false;
|
|
129
|
+
isAutoincrement: false;
|
|
130
|
+
hasRuntimeDefault: false;
|
|
131
|
+
enumValues: [string, ...string[]];
|
|
132
|
+
baseColumn: never;
|
|
133
|
+
identity: undefined;
|
|
134
|
+
generated: undefined;
|
|
135
|
+
}, {}, {}>;
|
|
136
|
+
markdown: import("drizzle-orm/pg-core").PgColumn<{
|
|
137
|
+
name: "markdown";
|
|
138
|
+
tableName: "extractions";
|
|
139
|
+
dataType: "string";
|
|
140
|
+
columnType: "PgText";
|
|
141
|
+
data: string;
|
|
142
|
+
driverParam: string;
|
|
143
|
+
notNull: false;
|
|
144
|
+
hasDefault: false;
|
|
145
|
+
isPrimaryKey: false;
|
|
146
|
+
isAutoincrement: false;
|
|
147
|
+
hasRuntimeDefault: false;
|
|
148
|
+
enumValues: [string, ...string[]];
|
|
149
|
+
baseColumn: never;
|
|
150
|
+
identity: undefined;
|
|
151
|
+
generated: undefined;
|
|
152
|
+
}, {}, {}>;
|
|
153
|
+
structuredData: import("drizzle-orm/pg-core").PgColumn<{
|
|
154
|
+
name: "structured_data";
|
|
155
|
+
tableName: "extractions";
|
|
156
|
+
dataType: "json";
|
|
157
|
+
columnType: "PgJsonb";
|
|
158
|
+
data: unknown;
|
|
159
|
+
driverParam: unknown;
|
|
160
|
+
notNull: false;
|
|
161
|
+
hasDefault: false;
|
|
162
|
+
isPrimaryKey: false;
|
|
163
|
+
isAutoincrement: false;
|
|
164
|
+
hasRuntimeDefault: false;
|
|
165
|
+
enumValues: undefined;
|
|
166
|
+
baseColumn: never;
|
|
167
|
+
identity: undefined;
|
|
168
|
+
generated: undefined;
|
|
169
|
+
}, {}, {}>;
|
|
170
|
+
extractionStatus: import("drizzle-orm/pg-core").PgColumn<{
|
|
171
|
+
name: "extraction_status";
|
|
172
|
+
tableName: "extractions";
|
|
173
|
+
dataType: "string";
|
|
174
|
+
columnType: "PgText";
|
|
175
|
+
data: string;
|
|
176
|
+
driverParam: string;
|
|
177
|
+
notNull: true;
|
|
178
|
+
hasDefault: false;
|
|
179
|
+
isPrimaryKey: false;
|
|
180
|
+
isAutoincrement: false;
|
|
181
|
+
hasRuntimeDefault: false;
|
|
182
|
+
enumValues: [string, ...string[]];
|
|
183
|
+
baseColumn: never;
|
|
184
|
+
identity: undefined;
|
|
185
|
+
generated: undefined;
|
|
186
|
+
}, {}, {}>;
|
|
187
|
+
statusDetail: import("drizzle-orm/pg-core").PgColumn<{
|
|
188
|
+
name: "status_detail";
|
|
189
|
+
tableName: "extractions";
|
|
190
|
+
dataType: "string";
|
|
191
|
+
columnType: "PgText";
|
|
192
|
+
data: string;
|
|
193
|
+
driverParam: string;
|
|
194
|
+
notNull: false;
|
|
195
|
+
hasDefault: false;
|
|
196
|
+
isPrimaryKey: false;
|
|
197
|
+
isAutoincrement: false;
|
|
198
|
+
hasRuntimeDefault: false;
|
|
199
|
+
enumValues: [string, ...string[]];
|
|
200
|
+
baseColumn: never;
|
|
201
|
+
identity: undefined;
|
|
202
|
+
generated: undefined;
|
|
203
|
+
}, {}, {}>;
|
|
204
|
+
encryptionKeyId: import("drizzle-orm/pg-core").PgColumn<{
|
|
205
|
+
name: "encryption_key_id";
|
|
206
|
+
tableName: "extractions";
|
|
207
|
+
dataType: "string";
|
|
208
|
+
columnType: "PgText";
|
|
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
|
+
llmModel: import("drizzle-orm/pg-core").PgColumn<{
|
|
222
|
+
name: "llm_model";
|
|
223
|
+
tableName: "extractions";
|
|
224
|
+
dataType: "string";
|
|
225
|
+
columnType: "PgText";
|
|
226
|
+
data: string;
|
|
227
|
+
driverParam: string;
|
|
228
|
+
notNull: false;
|
|
229
|
+
hasDefault: false;
|
|
230
|
+
isPrimaryKey: false;
|
|
231
|
+
isAutoincrement: false;
|
|
232
|
+
hasRuntimeDefault: false;
|
|
233
|
+
enumValues: [string, ...string[]];
|
|
234
|
+
baseColumn: never;
|
|
235
|
+
identity: undefined;
|
|
236
|
+
generated: undefined;
|
|
237
|
+
}, {}, {}>;
|
|
238
|
+
llmInputTokens: import("drizzle-orm/pg-core").PgColumn<{
|
|
239
|
+
name: "llm_input_tokens";
|
|
240
|
+
tableName: "extractions";
|
|
241
|
+
dataType: "number";
|
|
242
|
+
columnType: "PgInteger";
|
|
243
|
+
data: number;
|
|
244
|
+
driverParam: string | number;
|
|
245
|
+
notNull: false;
|
|
246
|
+
hasDefault: false;
|
|
247
|
+
isPrimaryKey: false;
|
|
248
|
+
isAutoincrement: false;
|
|
249
|
+
hasRuntimeDefault: false;
|
|
250
|
+
enumValues: undefined;
|
|
251
|
+
baseColumn: never;
|
|
252
|
+
identity: undefined;
|
|
253
|
+
generated: undefined;
|
|
254
|
+
}, {}, {}>;
|
|
255
|
+
llmOutputTokens: import("drizzle-orm/pg-core").PgColumn<{
|
|
256
|
+
name: "llm_output_tokens";
|
|
257
|
+
tableName: "extractions";
|
|
258
|
+
dataType: "number";
|
|
259
|
+
columnType: "PgInteger";
|
|
260
|
+
data: number;
|
|
261
|
+
driverParam: string | number;
|
|
262
|
+
notNull: false;
|
|
263
|
+
hasDefault: false;
|
|
264
|
+
isPrimaryKey: false;
|
|
265
|
+
isAutoincrement: false;
|
|
266
|
+
hasRuntimeDefault: false;
|
|
267
|
+
enumValues: undefined;
|
|
268
|
+
baseColumn: never;
|
|
269
|
+
identity: undefined;
|
|
270
|
+
generated: undefined;
|
|
271
|
+
}, {}, {}>;
|
|
272
|
+
costMicroUsd: import("drizzle-orm/pg-core").PgColumn<{
|
|
273
|
+
name: "cost_micro_usd";
|
|
274
|
+
tableName: "extractions";
|
|
275
|
+
dataType: "number";
|
|
276
|
+
columnType: "PgInteger";
|
|
277
|
+
data: number;
|
|
278
|
+
driverParam: string | number;
|
|
279
|
+
notNull: true;
|
|
280
|
+
hasDefault: false;
|
|
281
|
+
isPrimaryKey: false;
|
|
282
|
+
isAutoincrement: false;
|
|
283
|
+
hasRuntimeDefault: false;
|
|
284
|
+
enumValues: undefined;
|
|
285
|
+
baseColumn: never;
|
|
286
|
+
identity: undefined;
|
|
287
|
+
generated: undefined;
|
|
288
|
+
}, {}, {}>;
|
|
289
|
+
durationMs: import("drizzle-orm/pg-core").PgColumn<{
|
|
290
|
+
name: "duration_ms";
|
|
291
|
+
tableName: "extractions";
|
|
292
|
+
dataType: "number";
|
|
293
|
+
columnType: "PgInteger";
|
|
294
|
+
data: number;
|
|
295
|
+
driverParam: string | number;
|
|
296
|
+
notNull: true;
|
|
297
|
+
hasDefault: true;
|
|
298
|
+
isPrimaryKey: false;
|
|
299
|
+
isAutoincrement: false;
|
|
300
|
+
hasRuntimeDefault: false;
|
|
301
|
+
enumValues: undefined;
|
|
302
|
+
baseColumn: never;
|
|
303
|
+
identity: undefined;
|
|
304
|
+
generated: undefined;
|
|
305
|
+
}, {}, {}>;
|
|
306
|
+
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
307
|
+
name: "created_at";
|
|
308
|
+
tableName: "extractions";
|
|
309
|
+
dataType: "date";
|
|
310
|
+
columnType: "PgTimestamp";
|
|
311
|
+
data: Date;
|
|
312
|
+
driverParam: string;
|
|
313
|
+
notNull: true;
|
|
314
|
+
hasDefault: true;
|
|
315
|
+
isPrimaryKey: false;
|
|
316
|
+
isAutoincrement: false;
|
|
317
|
+
hasRuntimeDefault: false;
|
|
318
|
+
enumValues: undefined;
|
|
319
|
+
baseColumn: never;
|
|
320
|
+
identity: undefined;
|
|
321
|
+
generated: undefined;
|
|
322
|
+
}, {}, {}>;
|
|
323
|
+
};
|
|
324
|
+
dialect: "pg";
|
|
325
|
+
}>;
|
|
326
|
+
export type Extraction = typeof extractions.$inferSelect;
|
|
327
|
+
export type NewExtraction = typeof extractions.$inferInsert;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
import { index, integer, jsonb, pgTable, text, timestamp, uniqueIndex, uuid, } from 'drizzle-orm/pg-core';
|
|
3
|
+
import { customers } from './customers.js';
|
|
4
|
+
import { subscriptions } from './subscriptions.js';
|
|
5
|
+
/**
|
|
6
|
+
* Extractions — the interpreted layer.
|
|
7
|
+
*
|
|
8
|
+
* Cross-customer cache via the unique index on
|
|
9
|
+
* (content_hash, schema_hash, extractor_version) — same content + same schema
|
|
10
|
+
* + same extractor version is extracted exactly once (Review #6).
|
|
11
|
+
*
|
|
12
|
+
* SPEC DEVIATION: `snapshot_id` is NOT a foreign key. The spec wrote
|
|
13
|
+
* `REFERENCES snapshots(id)` but `snapshots` is partitioned with a composite
|
|
14
|
+
* primary key, so a DB-level FK to `snapshots(id)` alone is not expressible.
|
|
15
|
+
* Referential integrity for snapshot_id is enforced by application code.
|
|
16
|
+
*/
|
|
17
|
+
export const extractions = pgTable('extractions', {
|
|
18
|
+
id: uuid('id').primaryKey().defaultRandom(),
|
|
19
|
+
// No FK — see spec-deviation note above.
|
|
20
|
+
snapshotId: uuid('snapshot_id').notNull(),
|
|
21
|
+
// null for one-shot scrapes
|
|
22
|
+
subscriptionId: uuid('subscription_id').references(() => subscriptions.id),
|
|
23
|
+
// denormalized for isolation enforcement (Review #2 multi-tenant invariants)
|
|
24
|
+
customerId: uuid('customer_id')
|
|
25
|
+
.notNull()
|
|
26
|
+
.references(() => customers.id),
|
|
27
|
+
// denormalized from snapshot for cache lookup (Review #6)
|
|
28
|
+
contentHash: text('content_hash').notNull(),
|
|
29
|
+
// null for markdown-only extractions (Review #6)
|
|
30
|
+
schemaHash: text('schema_hash'),
|
|
31
|
+
// composite e.g. 'mkdn-v3+sonnet-4.6+schema-conv-v2' (Review #6)
|
|
32
|
+
extractorVersion: text('extractor_version').notNull(),
|
|
33
|
+
markdown: text('markdown'),
|
|
34
|
+
structuredData: jsonb('structured_data'),
|
|
35
|
+
// 'ok', 'js_shell_detected', 'truncated', 'llm_failed', etc. (Review #6)
|
|
36
|
+
extractionStatus: text('extraction_status').notNull(),
|
|
37
|
+
// optional explanation when status != 'ok' (Review #6)
|
|
38
|
+
statusDetail: text('status_detail'),
|
|
39
|
+
// per-customer key for sensitive extractions (v2; Review #2)
|
|
40
|
+
encryptionKeyId: text('encryption_key_id'),
|
|
41
|
+
// e.g. 'claude-haiku-4-5' or 'claude-sonnet-4-6'; null for deterministic
|
|
42
|
+
llmModel: text('llm_model'),
|
|
43
|
+
llmInputTokens: integer('llm_input_tokens'),
|
|
44
|
+
llmOutputTokens: integer('llm_output_tokens'),
|
|
45
|
+
costMicroUsd: integer('cost_micro_usd').notNull(),
|
|
46
|
+
// end-to-end extraction latency (Review #6)
|
|
47
|
+
durationMs: integer('duration_ms').notNull().default(0),
|
|
48
|
+
createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
|
|
49
|
+
}, (table) => [
|
|
50
|
+
index('idx_ext_sub_time').on(table.subscriptionId, table.createdAt.desc()),
|
|
51
|
+
index('idx_ext_customer').on(table.customerId),
|
|
52
|
+
index('idx_ext_snap').on(table.snapshotId),
|
|
53
|
+
// Cache lookup index — hot path. Cross-snapshot dedup keys on content, not snapshot.
|
|
54
|
+
uniqueIndex('idx_ext_cache').on(table.contentHash, table.schemaHash, table.extractorVersion),
|
|
55
|
+
]);
|
|
56
|
+
//# sourceMappingURL=extractions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractions.js","sourceRoot":"","sources":["../../src/schema/extractions.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,EACL,KAAK,EACL,OAAO,EACP,KAAK,EACL,OAAO,EACP,IAAI,EACJ,SAAS,EACT,WAAW,EACX,IAAI,GACL,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAChC,aAAa,EACb;IACE,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC,aAAa,EAAE;IAC3C,yCAAyC;IACzC,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC,OAAO,EAAE;IACzC,4BAA4B;IAC5B,cAAc,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC;IAC1E,6EAA6E;IAC7E,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC;SAC5B,OAAO,EAAE;SACT,UAAU,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC;IACjC,0DAA0D;IAC1D,WAAW,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC,OAAO,EAAE;IAC3C,iDAAiD;IACjD,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC;IAC/B,iEAAiE;IACjE,gBAAgB,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC,OAAO,EAAE;IACrD,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC;IAC1B,cAAc,EAAE,KAAK,CAAC,iBAAiB,CAAC;IACxC,yEAAyE;IACzE,gBAAgB,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC,OAAO,EAAE;IACrD,uDAAuD;IACvD,YAAY,EAAE,IAAI,CAAC,eAAe,CAAC;IACnC,6DAA6D;IAC7D,eAAe,EAAE,IAAI,CAAC,mBAAmB,CAAC;IAC1C,yEAAyE;IACzE,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC;IAC3B,cAAc,EAAE,OAAO,CAAC,kBAAkB,CAAC;IAC3C,eAAe,EAAE,OAAO,CAAC,mBAAmB,CAAC;IAC7C,YAAY,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC,OAAO,EAAE;IACjD,4CAA4C;IAC5C,UAAU,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IACvD,SAAS,EAAE,SAAS,CAAC,YAAY,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,UAAU,EAAE;CAClF,EACD,CAAC,KAAK,EAAE,EAAE,CAAC;IACT,KAAK,CAAC,kBAAkB,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;IAC1E,KAAK,CAAC,kBAAkB,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC;IAC9C,KAAK,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC;IAC1C,qFAAqF;IACrF,WAAW,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,gBAAgB,CAAC;CAC7F,CACF,CAAC"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host-specific extractor overrides (Review #6).
|
|
3
|
+
* Reserved for v2 build — table exists in v1 but is empty.
|
|
4
|
+
*/
|
|
5
|
+
export declare const hostExtractors: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
6
|
+
name: "host_extractors";
|
|
7
|
+
schema: undefined;
|
|
8
|
+
columns: {
|
|
9
|
+
host: import("drizzle-orm/pg-core").PgColumn<{
|
|
10
|
+
name: "host";
|
|
11
|
+
tableName: "host_extractors";
|
|
12
|
+
dataType: "string";
|
|
13
|
+
columnType: "PgText";
|
|
14
|
+
data: string;
|
|
15
|
+
driverParam: string;
|
|
16
|
+
notNull: true;
|
|
17
|
+
hasDefault: false;
|
|
18
|
+
isPrimaryKey: true;
|
|
19
|
+
isAutoincrement: false;
|
|
20
|
+
hasRuntimeDefault: false;
|
|
21
|
+
enumValues: [string, ...string[]];
|
|
22
|
+
baseColumn: never;
|
|
23
|
+
identity: undefined;
|
|
24
|
+
generated: undefined;
|
|
25
|
+
}, {}, {}>;
|
|
26
|
+
extractorId: import("drizzle-orm/pg-core").PgColumn<{
|
|
27
|
+
name: "extractor_id";
|
|
28
|
+
tableName: "host_extractors";
|
|
29
|
+
dataType: "string";
|
|
30
|
+
columnType: "PgText";
|
|
31
|
+
data: string;
|
|
32
|
+
driverParam: string;
|
|
33
|
+
notNull: true;
|
|
34
|
+
hasDefault: false;
|
|
35
|
+
isPrimaryKey: false;
|
|
36
|
+
isAutoincrement: false;
|
|
37
|
+
hasRuntimeDefault: false;
|
|
38
|
+
enumValues: [string, ...string[]];
|
|
39
|
+
baseColumn: never;
|
|
40
|
+
identity: undefined;
|
|
41
|
+
generated: undefined;
|
|
42
|
+
}, {}, {}>;
|
|
43
|
+
enabled: import("drizzle-orm/pg-core").PgColumn<{
|
|
44
|
+
name: "enabled";
|
|
45
|
+
tableName: "host_extractors";
|
|
46
|
+
dataType: "boolean";
|
|
47
|
+
columnType: "PgBoolean";
|
|
48
|
+
data: boolean;
|
|
49
|
+
driverParam: boolean;
|
|
50
|
+
notNull: true;
|
|
51
|
+
hasDefault: true;
|
|
52
|
+
isPrimaryKey: false;
|
|
53
|
+
isAutoincrement: false;
|
|
54
|
+
hasRuntimeDefault: false;
|
|
55
|
+
enumValues: undefined;
|
|
56
|
+
baseColumn: never;
|
|
57
|
+
identity: undefined;
|
|
58
|
+
generated: undefined;
|
|
59
|
+
}, {}, {}>;
|
|
60
|
+
schemaCompatibility: import("drizzle-orm/pg-core").PgColumn<{
|
|
61
|
+
name: "schema_compatibility";
|
|
62
|
+
tableName: "host_extractors";
|
|
63
|
+
dataType: "array";
|
|
64
|
+
columnType: "PgArray";
|
|
65
|
+
data: string[];
|
|
66
|
+
driverParam: string | string[];
|
|
67
|
+
notNull: false;
|
|
68
|
+
hasDefault: false;
|
|
69
|
+
isPrimaryKey: false;
|
|
70
|
+
isAutoincrement: false;
|
|
71
|
+
hasRuntimeDefault: false;
|
|
72
|
+
enumValues: [string, ...string[]];
|
|
73
|
+
baseColumn: import("drizzle-orm").Column<{
|
|
74
|
+
name: "schema_compatibility";
|
|
75
|
+
tableName: "host_extractors";
|
|
76
|
+
dataType: "string";
|
|
77
|
+
columnType: "PgText";
|
|
78
|
+
data: string;
|
|
79
|
+
driverParam: string;
|
|
80
|
+
notNull: false;
|
|
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
|
+
}, object, object>;
|
|
90
|
+
identity: undefined;
|
|
91
|
+
generated: undefined;
|
|
92
|
+
}, {}, {}>;
|
|
93
|
+
notes: import("drizzle-orm/pg-core").PgColumn<{
|
|
94
|
+
name: "notes";
|
|
95
|
+
tableName: "host_extractors";
|
|
96
|
+
dataType: "string";
|
|
97
|
+
columnType: "PgText";
|
|
98
|
+
data: string;
|
|
99
|
+
driverParam: string;
|
|
100
|
+
notNull: false;
|
|
101
|
+
hasDefault: false;
|
|
102
|
+
isPrimaryKey: false;
|
|
103
|
+
isAutoincrement: false;
|
|
104
|
+
hasRuntimeDefault: false;
|
|
105
|
+
enumValues: [string, ...string[]];
|
|
106
|
+
baseColumn: never;
|
|
107
|
+
identity: undefined;
|
|
108
|
+
generated: undefined;
|
|
109
|
+
}, {}, {}>;
|
|
110
|
+
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
111
|
+
name: "created_at";
|
|
112
|
+
tableName: "host_extractors";
|
|
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
|
+
}>;
|
|
130
|
+
export type HostExtractor = typeof hostExtractors.$inferSelect;
|
|
131
|
+
export type NewHostExtractor = typeof hostExtractors.$inferInsert;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
import { boolean, pgTable, text, timestamp } from 'drizzle-orm/pg-core';
|
|
3
|
+
/**
|
|
4
|
+
* Host-specific extractor overrides (Review #6).
|
|
5
|
+
* Reserved for v2 build — table exists in v1 but is empty.
|
|
6
|
+
*/
|
|
7
|
+
export const hostExtractors = pgTable('host_extractors', {
|
|
8
|
+
// e.g. 'amazon.com', 'github.com'
|
|
9
|
+
host: text('host').primaryKey(),
|
|
10
|
+
// references code in src/extractors/<id>.ts
|
|
11
|
+
extractorId: text('extractor_id').notNull(),
|
|
12
|
+
enabled: boolean('enabled').notNull().default(true),
|
|
13
|
+
// schema shapes this extractor handles; null = all
|
|
14
|
+
schemaCompatibility: text('schema_compatibility').array(),
|
|
15
|
+
notes: text('notes'),
|
|
16
|
+
createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
|
|
17
|
+
});
|
|
18
|
+
//# sourceMappingURL=host-extractors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-extractors.js","sourceRoot":"","sources":["../../src/schema/host-extractors.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAExE;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,OAAO,CAAC,iBAAiB,EAAE;IACvD,kCAAkC;IAClC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE;IAC/B,4CAA4C;IAC5C,WAAW,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC,OAAO,EAAE;IAC3C,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IACnD,mDAAmD;IACnD,mBAAmB,EAAE,IAAI,CAAC,sBAAsB,CAAC,CAAC,KAAK,EAAE;IACzD,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC;IACpB,SAAS,EAAE,SAAS,CAAC,YAAY,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,UAAU,EAAE;CAClF,CAAC,CAAC"}
|