@http-client-toolkit/store-sqlite 0.0.1 → 0.1.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/lib/index.d.cts CHANGED
@@ -1,537 +1,618 @@
1
- import { CacheStore, DedupeStore, RateLimitStore, RateLimitConfig, AdaptiveRateLimitStore, AdaptiveConfigSchema, RequestPriority } from '@http-client-toolkit/core';
2
- export { AdaptiveConfig, AdaptiveRateLimitStore, CacheStore, DedupeStore, RateLimitConfig, RateLimitStore, RequestPriority } from '@http-client-toolkit/core';
1
+ import {
2
+ CacheStore,
3
+ DedupeStore,
4
+ RateLimitStore,
5
+ RateLimitConfig,
6
+ AdaptiveRateLimitStore,
7
+ AdaptiveConfigSchema,
8
+ RequestPriority,
9
+ } from '@http-client-toolkit/core';
10
+ export {
11
+ AdaptiveConfig,
12
+ AdaptiveRateLimitStore,
13
+ CacheStore,
14
+ DedupeStore,
15
+ RateLimitConfig,
16
+ RateLimitStore,
17
+ RequestPriority,
18
+ } from '@http-client-toolkit/core';
3
19
  import Database from 'better-sqlite3';
4
20
  import { z } from 'zod';
5
21
  import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
6
22
 
7
23
  interface SQLiteCacheStoreOptions {
8
- /** File path or existing `better-sqlite3` connection. Defaults to `':memory:'`. */
9
- database?: string | InstanceType<typeof Database>;
10
- cleanupIntervalMs?: number;
11
- maxEntrySizeBytes?: number;
24
+ /** File path or existing `better-sqlite3` connection. Defaults to `':memory:'`. */
25
+ database?: string | InstanceType<typeof Database>;
26
+ cleanupIntervalMs?: number;
27
+ maxEntrySizeBytes?: number;
12
28
  }
13
29
  declare class SQLiteCacheStore<T = unknown> implements CacheStore<T> {
14
- private db;
15
- private sqlite;
16
- /** Indicates whether this store is responsible for managing (and therefore closing) the SQLite connection */
17
- private readonly isConnectionManaged;
18
- private cleanupInterval?;
19
- private readonly cleanupIntervalMs;
20
- /**
21
- * Maximum allowed size (in bytes) for a single cache entry. If the serialized
22
- * value exceeds this limit the entry will be **silently skipped** to avoid
23
- * breaching SQLite's max length limits which could otherwise throw at write
24
- * time. Defaults to `5 MiB`, which is well under SQLiteʼs compiled
25
- * `SQLITE_MAX_LENGTH` (usually 1 GiB) yet large enough for typical Comic Vine
26
- * responses.
27
- */
28
- private readonly maxEntrySizeBytes;
29
- private isDestroyed;
30
- constructor({
30
+ private db;
31
+ private sqlite;
32
+ /** Indicates whether this store is responsible for managing (and therefore closing) the SQLite connection */
33
+ private readonly isConnectionManaged;
34
+ private cleanupInterval?;
35
+ private readonly cleanupIntervalMs;
36
+ /**
37
+ * Maximum allowed size (in bytes) for a single cache entry. If the serialized
38
+ * value exceeds this limit the entry will be **silently skipped** to avoid
39
+ * breaching SQLite's max length limits which could otherwise throw at write
40
+ * time. Defaults to `5 MiB`, which is well under SQLiteʼs compiled
41
+ * `SQLITE_MAX_LENGTH` (usually 1 GiB) yet large enough for typical Comic Vine
42
+ * responses.
43
+ */
44
+ private readonly maxEntrySizeBytes;
45
+ private isDestroyed;
46
+ constructor({
31
47
  /** File path or existing `better-sqlite3` connection. Defaults to `':memory:'`. */
32
- database,
48
+ database,
33
49
  /** Cleanup interval in milliseconds. Defaults to 1 minute. */
34
- cleanupIntervalMs,
50
+ cleanupIntervalMs,
35
51
  /** Maximum allowed size (in bytes) for a single cache entry. Defaults to 5 MiB. */
36
- maxEntrySizeBytes, }?: SQLiteCacheStoreOptions);
37
- get(hash: string): Promise<T | undefined>;
38
- set(hash: string, value: T, ttlSeconds: number): Promise<void>;
39
- delete(hash: string): Promise<void>;
40
- clear(): Promise<void>;
41
- /**
42
- * Get cache statistics
43
- */
44
- getStats(): Promise<{
45
- totalItems: number;
46
- expiredItems: number;
47
- databaseSizeKB: number;
48
- }>;
49
- /**
50
- * Manually trigger cleanup of expired items
51
- */
52
- cleanup(): Promise<void>;
53
- /**
54
- * Close the database connection
55
- */
56
- close(): Promise<void>;
57
- /**
58
- * Alias for close() to match test expectations
59
- */
60
- destroy(): void;
61
- private initializeDatabase;
62
- private startCleanupInterval;
63
- private cleanupExpiredItems;
52
+ maxEntrySizeBytes,
53
+ }?: SQLiteCacheStoreOptions);
54
+ get(hash: string): Promise<T | undefined>;
55
+ set(hash: string, value: T, ttlSeconds: number): Promise<void>;
56
+ delete(hash: string): Promise<void>;
57
+ clear(): Promise<void>;
58
+ /**
59
+ * Get cache statistics
60
+ */
61
+ getStats(): Promise<{
62
+ totalItems: number;
63
+ expiredItems: number;
64
+ databaseSizeKB: number;
65
+ }>;
66
+ /**
67
+ * Manually trigger cleanup of expired items
68
+ */
69
+ cleanup(): Promise<void>;
70
+ /**
71
+ * Close the database connection
72
+ */
73
+ close(): Promise<void>;
74
+ /**
75
+ * Alias for close() to match test expectations
76
+ */
77
+ destroy(): void;
78
+ private initializeDatabase;
79
+ private startCleanupInterval;
80
+ private cleanupExpiredItems;
64
81
  }
65
82
 
66
83
  interface SQLiteDedupeStoreOptions {
67
- database?: string | InstanceType<typeof Database>;
68
- jobTimeoutMs?: number;
69
- timeoutMs?: number;
70
- cleanupIntervalMs?: number;
71
- pollIntervalMs?: number;
84
+ database?: string | InstanceType<typeof Database>;
85
+ jobTimeoutMs?: number;
86
+ timeoutMs?: number;
87
+ cleanupIntervalMs?: number;
88
+ pollIntervalMs?: number;
72
89
  }
73
90
  declare class SQLiteDedupeStore<T = unknown> implements DedupeStore<T> {
74
- private db;
75
- private sqlite;
76
- /** Indicates whether this store manages (and should close) the SQLite connection */
77
- private readonly isConnectionManaged;
78
- private jobPromises;
79
- private jobSettlers;
80
- private readonly jobTimeoutMs;
81
- private readonly pollIntervalMs;
82
- private cleanupInterval?;
83
- private readonly cleanupIntervalMs;
84
- private isDestroyed;
85
- constructor({
91
+ private db;
92
+ private sqlite;
93
+ /** Indicates whether this store manages (and should close) the SQLite connection */
94
+ private readonly isConnectionManaged;
95
+ private jobPromises;
96
+ private jobSettlers;
97
+ private readonly jobTimeoutMs;
98
+ private readonly pollIntervalMs;
99
+ private cleanupInterval?;
100
+ private readonly cleanupIntervalMs;
101
+ private isDestroyed;
102
+ constructor({
86
103
  /** File path or existing `better-sqlite3` Database instance. Defaults to `':memory:'`. */
87
- database,
104
+ database,
88
105
  /** Job timeout in milliseconds. Preferred over timeoutMs. */
89
- jobTimeoutMs,
106
+ jobTimeoutMs,
90
107
  /** Legacy alias for jobTimeoutMs. */
91
- timeoutMs,
108
+ timeoutMs,
92
109
  /** Cleanup interval in milliseconds. Defaults to 1 minute. */
93
- cleanupIntervalMs,
110
+ cleanupIntervalMs,
94
111
  /** Poll interval for checking pending jobs in milliseconds. Defaults to 100ms. */
95
- pollIntervalMs, }?: SQLiteDedupeStoreOptions);
96
- private startCleanupInterval;
97
- private cleanupExpiredJobs;
98
- waitFor(hash: string): Promise<T | undefined>;
99
- register(hash: string): Promise<string>;
100
- registerOrJoin(hash: string): Promise<{
101
- jobId: string;
102
- isOwner: boolean;
103
- }>;
104
- complete(hash: string, value: T | undefined): Promise<void>;
105
- fail(hash: string, error: Error): Promise<void>;
106
- isInProgress(hash: string): Promise<boolean>;
107
- getResult(hash: string): Promise<T | undefined>;
108
- /**
109
- * Get statistics about dedupe jobs
110
- */
111
- getStats(): Promise<{
112
- totalJobs: number;
113
- pendingJobs: number;
114
- completedJobs: number;
115
- failedJobs: number;
116
- expiredJobs: number;
117
- }>;
118
- /**
119
- * Clean up expired jobs
120
- */
121
- cleanup(): Promise<void>;
122
- /**
123
- * Clear all jobs
124
- */
125
- clear(): Promise<void>;
126
- /**
127
- * Close the database connection
128
- */
129
- close(): Promise<void>;
130
- /**
131
- * Alias for close() to match test expectations
132
- */
133
- destroy(): void;
134
- private deserializeResult;
135
- private initializeDatabase;
112
+ pollIntervalMs,
113
+ }?: SQLiteDedupeStoreOptions);
114
+ private startCleanupInterval;
115
+ private cleanupExpiredJobs;
116
+ waitFor(hash: string): Promise<T | undefined>;
117
+ register(hash: string): Promise<string>;
118
+ registerOrJoin(hash: string): Promise<{
119
+ jobId: string;
120
+ isOwner: boolean;
121
+ }>;
122
+ complete(hash: string, value: T | undefined): Promise<void>;
123
+ fail(hash: string, error: Error): Promise<void>;
124
+ isInProgress(hash: string): Promise<boolean>;
125
+ getResult(hash: string): Promise<T | undefined>;
126
+ /**
127
+ * Get statistics about dedupe jobs
128
+ */
129
+ getStats(): Promise<{
130
+ totalJobs: number;
131
+ pendingJobs: number;
132
+ completedJobs: number;
133
+ failedJobs: number;
134
+ expiredJobs: number;
135
+ }>;
136
+ /**
137
+ * Clean up expired jobs
138
+ */
139
+ cleanup(): Promise<void>;
140
+ /**
141
+ * Clear all jobs
142
+ */
143
+ clear(): Promise<void>;
144
+ /**
145
+ * Close the database connection
146
+ */
147
+ close(): Promise<void>;
148
+ /**
149
+ * Alias for close() to match test expectations
150
+ */
151
+ destroy(): void;
152
+ private deserializeResult;
153
+ private initializeDatabase;
136
154
  }
137
155
 
138
156
  interface SQLiteRateLimitStoreOptions {
139
- /** File path or existing `better-sqlite3` Database instance. Defaults to `':memory:'`. */
140
- database?: string | InstanceType<typeof Database>;
141
- /** Global/default rate-limit config applied when a resource-specific override is not provided. */
142
- defaultConfig?: RateLimitConfig;
143
- /** Optional per-resource overrides. */
144
- resourceConfigs?: Map<string, RateLimitConfig>;
157
+ /** File path or existing `better-sqlite3` Database instance. Defaults to `':memory:'`. */
158
+ database?: string | InstanceType<typeof Database>;
159
+ /** Global/default rate-limit config applied when a resource-specific override is not provided. */
160
+ defaultConfig?: RateLimitConfig;
161
+ /** Optional per-resource overrides. */
162
+ resourceConfigs?: Map<string, RateLimitConfig>;
145
163
  }
146
164
  declare class SQLiteRateLimitStore implements RateLimitStore {
147
- private db;
148
- private sqlite;
149
- /** Indicates whether this store manages (and should close) the SQLite connection */
150
- private readonly isConnectionManaged;
151
- private defaultConfig;
152
- private resourceConfigs;
153
- private isDestroyed;
154
- constructor({
165
+ private db;
166
+ private sqlite;
167
+ /** Indicates whether this store manages (and should close) the SQLite connection */
168
+ private readonly isConnectionManaged;
169
+ private defaultConfig;
170
+ private resourceConfigs;
171
+ private isDestroyed;
172
+ constructor({
155
173
  /** File path or existing `better-sqlite3` Database instance. Defaults to `':memory:'`. */
156
- database,
174
+ database,
157
175
  /** Global/default rate-limit config applied when a resource-specific override is not provided. */
158
- defaultConfig,
176
+ defaultConfig,
159
177
  /** Optional per-resource overrides. */
160
- resourceConfigs, }?: SQLiteRateLimitStoreOptions);
161
- canProceed(resource: string): Promise<boolean>;
162
- record(resource: string): Promise<void>;
163
- getStatus(resource: string): Promise<{
164
- remaining: number;
165
- resetTime: Date;
166
- limit: number;
167
- }>;
168
- reset(resource: string): Promise<void>;
169
- getWaitTime(resource: string): Promise<number>;
170
- /**
171
- * Set rate limit configuration for a specific resource
172
- */
173
- setResourceConfig(resource: string, config: RateLimitConfig): void;
174
- /**
175
- * Get rate limit configuration for a resource
176
- */
177
- getResourceConfig(resource: string): RateLimitConfig;
178
- /**
179
- * Get statistics for all resources
180
- */
181
- getStats(): Promise<{
182
- totalRequests: number;
183
- uniqueResources: number;
184
- rateLimitedResources: Array<string>;
185
- }>;
186
- /**
187
- * Clean up all rate limit data
188
- */
189
- clear(): Promise<void>;
190
- /**
191
- * Clean up expired requests for all resources
192
- */
193
- cleanup(): Promise<void>;
194
- /**
195
- * Close the database connection
196
- */
197
- close(): Promise<void>;
198
- /**
199
- * Alias for close() to match test expectations
200
- */
201
- destroy(): void;
202
- private cleanupExpiredRequests;
203
- private initializeDatabase;
178
+ resourceConfigs,
179
+ }?: SQLiteRateLimitStoreOptions);
180
+ canProceed(resource: string): Promise<boolean>;
181
+ record(resource: string): Promise<void>;
182
+ getStatus(resource: string): Promise<{
183
+ remaining: number;
184
+ resetTime: Date;
185
+ limit: number;
186
+ }>;
187
+ reset(resource: string): Promise<void>;
188
+ getWaitTime(resource: string): Promise<number>;
189
+ /**
190
+ * Set rate limit configuration for a specific resource
191
+ */
192
+ setResourceConfig(resource: string, config: RateLimitConfig): void;
193
+ /**
194
+ * Get rate limit configuration for a resource
195
+ */
196
+ getResourceConfig(resource: string): RateLimitConfig;
197
+ /**
198
+ * Get statistics for all resources
199
+ */
200
+ getStats(): Promise<{
201
+ totalRequests: number;
202
+ uniqueResources: number;
203
+ rateLimitedResources: Array<string>;
204
+ }>;
205
+ /**
206
+ * Clean up all rate limit data
207
+ */
208
+ clear(): Promise<void>;
209
+ /**
210
+ * Clean up expired requests for all resources
211
+ */
212
+ cleanup(): Promise<void>;
213
+ /**
214
+ * Close the database connection
215
+ */
216
+ close(): Promise<void>;
217
+ /**
218
+ * Alias for close() to match test expectations
219
+ */
220
+ destroy(): void;
221
+ private cleanupExpiredRequests;
222
+ private initializeDatabase;
204
223
  }
205
224
 
206
225
  interface SqliteAdaptiveRateLimitStoreOptions {
207
- /** File path or existing `better-sqlite3` Database instance. Defaults to `':memory:'`. */
208
- database?: string | InstanceType<typeof Database>;
209
- /** Global/default rate-limit config applied when a resource-specific override is not provided. */
210
- defaultConfig?: RateLimitConfig;
211
- /** Optional per-resource overrides. */
212
- resourceConfigs?: Map<string, RateLimitConfig>;
213
- /** Adaptive configuration for priority-based rate limiting */
214
- adaptiveConfig?: Partial<z.input<typeof AdaptiveConfigSchema>>;
226
+ /** File path or existing `better-sqlite3` Database instance. Defaults to `':memory:'`. */
227
+ database?: string | InstanceType<typeof Database>;
228
+ /** Global/default rate-limit config applied when a resource-specific override is not provided. */
229
+ defaultConfig?: RateLimitConfig;
230
+ /** Optional per-resource overrides. */
231
+ resourceConfigs?: Map<string, RateLimitConfig>;
232
+ /** Adaptive configuration for priority-based rate limiting */
233
+ adaptiveConfig?: Partial<z.input<typeof AdaptiveConfigSchema>>;
215
234
  }
216
235
  declare class SqliteAdaptiveRateLimitStore implements AdaptiveRateLimitStore {
217
- private db;
218
- private sqlite;
219
- /** Indicates whether this store manages (and should close) the SQLite connection */
220
- private readonly isConnectionManaged;
221
- private defaultConfig;
222
- private resourceConfigs;
223
- private isDestroyed;
224
- private capacityCalculator;
225
- private activityMetrics;
226
- private lastCapacityUpdate;
227
- private cachedCapacity;
228
- constructor({ database, defaultConfig, resourceConfigs, adaptiveConfig, }?: SqliteAdaptiveRateLimitStoreOptions);
229
- canProceed(resource: string, priority?: RequestPriority): Promise<boolean>;
230
- record(resource: string, priority?: RequestPriority): Promise<void>;
231
- getStatus(resource: string): Promise<{
232
- remaining: number;
233
- resetTime: Date;
234
- limit: number;
235
- adaptive?: {
236
- userReserved: number;
237
- backgroundMax: number;
238
- backgroundPaused: boolean;
239
- recentUserActivity: number;
240
- reason: string;
241
- };
242
- }>;
243
- reset(resource: string): Promise<void>;
244
- getWaitTime(resource: string, priority?: RequestPriority): Promise<number>;
245
- /**
246
- * Set rate limit configuration for a specific resource
247
- */
248
- setResourceConfig(resource: string, config: RateLimitConfig): void;
249
- /**
250
- * Get rate limit configuration for a resource
251
- */
252
- getResourceConfig(resource: string): RateLimitConfig;
253
- /**
254
- * Get statistics for all resources
255
- */
256
- getStats(): Promise<{
257
- totalRequests: number;
258
- uniqueResources: number;
259
- rateLimitedResources: Array<string>;
260
- }>;
261
- /**
262
- * Clean up all rate limit data
263
- */
264
- clear(): Promise<void>;
265
- /**
266
- * Clean up expired requests for all resources
267
- */
268
- cleanup(): Promise<void>;
269
- /**
270
- * Close the database connection
271
- */
272
- close(): Promise<void>;
273
- /**
274
- * Alias for close() to match test expectations
275
- */
276
- destroy(): void;
277
- private calculateCurrentCapacity;
278
- private getOrCreateActivityMetrics;
279
- private ensureActivityMetrics;
280
- private getCurrentUsage;
281
- private cleanupOldRequests;
282
- private getResourceLimit;
283
- private getDefaultCapacity;
284
- private cleanupExpiredRequests;
285
- private initializeDatabase;
236
+ private db;
237
+ private sqlite;
238
+ /** Indicates whether this store manages (and should close) the SQLite connection */
239
+ private readonly isConnectionManaged;
240
+ private defaultConfig;
241
+ private resourceConfigs;
242
+ private isDestroyed;
243
+ private capacityCalculator;
244
+ private activityMetrics;
245
+ private lastCapacityUpdate;
246
+ private cachedCapacity;
247
+ constructor({
248
+ database,
249
+ defaultConfig,
250
+ resourceConfigs,
251
+ adaptiveConfig,
252
+ }?: SqliteAdaptiveRateLimitStoreOptions);
253
+ canProceed(resource: string, priority?: RequestPriority): Promise<boolean>;
254
+ record(resource: string, priority?: RequestPriority): Promise<void>;
255
+ getStatus(resource: string): Promise<{
256
+ remaining: number;
257
+ resetTime: Date;
258
+ limit: number;
259
+ adaptive?: {
260
+ userReserved: number;
261
+ backgroundMax: number;
262
+ backgroundPaused: boolean;
263
+ recentUserActivity: number;
264
+ reason: string;
265
+ };
266
+ }>;
267
+ reset(resource: string): Promise<void>;
268
+ getWaitTime(resource: string, priority?: RequestPriority): Promise<number>;
269
+ /**
270
+ * Set rate limit configuration for a specific resource
271
+ */
272
+ setResourceConfig(resource: string, config: RateLimitConfig): void;
273
+ /**
274
+ * Get rate limit configuration for a resource
275
+ */
276
+ getResourceConfig(resource: string): RateLimitConfig;
277
+ /**
278
+ * Get statistics for all resources
279
+ */
280
+ getStats(): Promise<{
281
+ totalRequests: number;
282
+ uniqueResources: number;
283
+ rateLimitedResources: Array<string>;
284
+ }>;
285
+ /**
286
+ * Clean up all rate limit data
287
+ */
288
+ clear(): Promise<void>;
289
+ /**
290
+ * Clean up expired requests for all resources
291
+ */
292
+ cleanup(): Promise<void>;
293
+ /**
294
+ * Close the database connection
295
+ */
296
+ close(): Promise<void>;
297
+ /**
298
+ * Alias for close() to match test expectations
299
+ */
300
+ destroy(): void;
301
+ private calculateCurrentCapacity;
302
+ private getOrCreateActivityMetrics;
303
+ private ensureActivityMetrics;
304
+ private getCurrentUsage;
305
+ private cleanupOldRequests;
306
+ private getResourceLimit;
307
+ private getDefaultCapacity;
308
+ private cleanupExpiredRequests;
309
+ private initializeDatabase;
286
310
  }
287
311
 
288
312
  declare const cacheTable: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
289
- name: "cache";
290
- schema: undefined;
291
- columns: {
292
- hash: drizzle_orm_sqlite_core.SQLiteColumn<{
293
- name: "hash";
294
- tableName: "cache";
295
- dataType: "string";
296
- columnType: "SQLiteText";
297
- data: string;
298
- driverParam: string;
299
- notNull: true;
300
- hasDefault: false;
301
- isPrimaryKey: true;
302
- isAutoincrement: false;
303
- hasRuntimeDefault: false;
304
- enumValues: [string, ...string[]];
305
- baseColumn: never;
306
- generated: undefined;
307
- }, object>;
308
- value: drizzle_orm_sqlite_core.SQLiteColumn<{
309
- name: "value";
310
- tableName: "cache";
311
- dataType: "json";
312
- columnType: "SQLiteBlobJson";
313
- data: unknown;
314
- driverParam: Buffer<ArrayBufferLike>;
315
- notNull: true;
316
- hasDefault: false;
317
- isPrimaryKey: false;
318
- isAutoincrement: false;
319
- hasRuntimeDefault: false;
320
- enumValues: undefined;
321
- baseColumn: never;
322
- generated: undefined;
323
- }, object>;
324
- expiresAt: drizzle_orm_sqlite_core.SQLiteColumn<{
325
- name: "expires_at";
326
- tableName: "cache";
327
- dataType: "number";
328
- columnType: "SQLiteInteger";
329
- data: number;
330
- driverParam: number;
331
- notNull: true;
332
- hasDefault: false;
333
- isPrimaryKey: false;
334
- isAutoincrement: false;
335
- hasRuntimeDefault: false;
336
- enumValues: undefined;
337
- baseColumn: never;
338
- generated: undefined;
339
- }, object>;
340
- createdAt: drizzle_orm_sqlite_core.SQLiteColumn<{
341
- name: "created_at";
342
- tableName: "cache";
343
- dataType: "number";
344
- columnType: "SQLiteInteger";
345
- data: number;
346
- driverParam: number;
347
- notNull: true;
348
- hasDefault: false;
349
- isPrimaryKey: false;
350
- isAutoincrement: false;
351
- hasRuntimeDefault: false;
352
- enumValues: undefined;
353
- baseColumn: never;
354
- generated: undefined;
355
- }, object>;
356
- };
357
- dialect: "sqlite";
313
+ name: 'cache';
314
+ schema: undefined;
315
+ columns: {
316
+ hash: drizzle_orm_sqlite_core.SQLiteColumn<
317
+ {
318
+ name: 'hash';
319
+ tableName: 'cache';
320
+ dataType: 'string';
321
+ columnType: 'SQLiteText';
322
+ data: string;
323
+ driverParam: string;
324
+ notNull: true;
325
+ hasDefault: false;
326
+ isPrimaryKey: true;
327
+ isAutoincrement: false;
328
+ hasRuntimeDefault: false;
329
+ enumValues: [string, ...string[]];
330
+ baseColumn: never;
331
+ generated: undefined;
332
+ },
333
+ object
334
+ >;
335
+ value: drizzle_orm_sqlite_core.SQLiteColumn<
336
+ {
337
+ name: 'value';
338
+ tableName: 'cache';
339
+ dataType: 'json';
340
+ columnType: 'SQLiteBlobJson';
341
+ data: unknown;
342
+ driverParam: Buffer<ArrayBufferLike>;
343
+ notNull: true;
344
+ hasDefault: false;
345
+ isPrimaryKey: false;
346
+ isAutoincrement: false;
347
+ hasRuntimeDefault: false;
348
+ enumValues: undefined;
349
+ baseColumn: never;
350
+ generated: undefined;
351
+ },
352
+ object
353
+ >;
354
+ expiresAt: drizzle_orm_sqlite_core.SQLiteColumn<
355
+ {
356
+ name: 'expires_at';
357
+ tableName: 'cache';
358
+ dataType: 'number';
359
+ columnType: 'SQLiteInteger';
360
+ data: number;
361
+ driverParam: number;
362
+ notNull: true;
363
+ hasDefault: false;
364
+ isPrimaryKey: false;
365
+ isAutoincrement: false;
366
+ hasRuntimeDefault: false;
367
+ enumValues: undefined;
368
+ baseColumn: never;
369
+ generated: undefined;
370
+ },
371
+ object
372
+ >;
373
+ createdAt: drizzle_orm_sqlite_core.SQLiteColumn<
374
+ {
375
+ name: 'created_at';
376
+ tableName: 'cache';
377
+ dataType: 'number';
378
+ columnType: 'SQLiteInteger';
379
+ data: number;
380
+ driverParam: number;
381
+ notNull: true;
382
+ hasDefault: false;
383
+ isPrimaryKey: false;
384
+ isAutoincrement: false;
385
+ hasRuntimeDefault: false;
386
+ enumValues: undefined;
387
+ baseColumn: never;
388
+ generated: undefined;
389
+ },
390
+ object
391
+ >;
392
+ };
393
+ dialect: 'sqlite';
358
394
  }>;
359
395
  declare const dedupeTable: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
360
- name: "dedupe_jobs";
361
- schema: undefined;
362
- columns: {
363
- hash: drizzle_orm_sqlite_core.SQLiteColumn<{
364
- name: "hash";
365
- tableName: "dedupe_jobs";
366
- dataType: "string";
367
- columnType: "SQLiteText";
368
- data: string;
369
- driverParam: string;
370
- notNull: true;
371
- hasDefault: false;
372
- isPrimaryKey: true;
373
- isAutoincrement: false;
374
- hasRuntimeDefault: false;
375
- enumValues: [string, ...string[]];
376
- baseColumn: never;
377
- generated: undefined;
378
- }, object>;
379
- jobId: drizzle_orm_sqlite_core.SQLiteColumn<{
380
- name: "job_id";
381
- tableName: "dedupe_jobs";
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
- generated: undefined;
394
- }, object>;
395
- status: drizzle_orm_sqlite_core.SQLiteColumn<{
396
- name: "status";
397
- tableName: "dedupe_jobs";
398
- dataType: "string";
399
- columnType: "SQLiteText";
400
- data: string;
401
- driverParam: string;
402
- notNull: true;
403
- hasDefault: false;
404
- isPrimaryKey: false;
405
- isAutoincrement: false;
406
- hasRuntimeDefault: false;
407
- enumValues: [string, ...string[]];
408
- baseColumn: never;
409
- generated: undefined;
410
- }, object>;
411
- result: drizzle_orm_sqlite_core.SQLiteColumn<{
412
- name: "result";
413
- tableName: "dedupe_jobs";
414
- dataType: "json";
415
- columnType: "SQLiteBlobJson";
416
- data: unknown;
417
- driverParam: Buffer<ArrayBufferLike>;
418
- notNull: false;
419
- hasDefault: false;
420
- isPrimaryKey: false;
421
- isAutoincrement: false;
422
- hasRuntimeDefault: false;
423
- enumValues: undefined;
424
- baseColumn: never;
425
- generated: undefined;
426
- }, object>;
427
- error: drizzle_orm_sqlite_core.SQLiteColumn<{
428
- name: "error";
429
- tableName: "dedupe_jobs";
430
- dataType: "string";
431
- columnType: "SQLiteText";
432
- data: string;
433
- driverParam: string;
434
- notNull: false;
435
- hasDefault: false;
436
- isPrimaryKey: false;
437
- isAutoincrement: false;
438
- hasRuntimeDefault: false;
439
- enumValues: [string, ...string[]];
440
- baseColumn: never;
441
- generated: undefined;
442
- }, object>;
443
- createdAt: drizzle_orm_sqlite_core.SQLiteColumn<{
444
- name: "created_at";
445
- tableName: "dedupe_jobs";
446
- dataType: "number";
447
- columnType: "SQLiteInteger";
448
- data: number;
449
- driverParam: number;
450
- notNull: true;
451
- hasDefault: false;
452
- isPrimaryKey: false;
453
- isAutoincrement: false;
454
- hasRuntimeDefault: false;
455
- enumValues: undefined;
456
- baseColumn: never;
457
- generated: undefined;
458
- }, object>;
459
- updatedAt: drizzle_orm_sqlite_core.SQLiteColumn<{
460
- name: "updated_at";
461
- tableName: "dedupe_jobs";
462
- dataType: "number";
463
- columnType: "SQLiteInteger";
464
- data: number;
465
- driverParam: number;
466
- notNull: true;
467
- hasDefault: false;
468
- isPrimaryKey: false;
469
- isAutoincrement: false;
470
- hasRuntimeDefault: false;
471
- enumValues: undefined;
472
- baseColumn: never;
473
- generated: undefined;
474
- }, object>;
475
- };
476
- dialect: "sqlite";
396
+ name: 'dedupe_jobs';
397
+ schema: undefined;
398
+ columns: {
399
+ hash: drizzle_orm_sqlite_core.SQLiteColumn<
400
+ {
401
+ name: 'hash';
402
+ tableName: 'dedupe_jobs';
403
+ dataType: 'string';
404
+ columnType: 'SQLiteText';
405
+ data: string;
406
+ driverParam: string;
407
+ notNull: true;
408
+ hasDefault: false;
409
+ isPrimaryKey: true;
410
+ isAutoincrement: false;
411
+ hasRuntimeDefault: false;
412
+ enumValues: [string, ...string[]];
413
+ baseColumn: never;
414
+ generated: undefined;
415
+ },
416
+ object
417
+ >;
418
+ jobId: drizzle_orm_sqlite_core.SQLiteColumn<
419
+ {
420
+ name: 'job_id';
421
+ tableName: 'dedupe_jobs';
422
+ dataType: 'string';
423
+ columnType: 'SQLiteText';
424
+ data: string;
425
+ driverParam: string;
426
+ notNull: true;
427
+ hasDefault: false;
428
+ isPrimaryKey: false;
429
+ isAutoincrement: false;
430
+ hasRuntimeDefault: false;
431
+ enumValues: [string, ...string[]];
432
+ baseColumn: never;
433
+ generated: undefined;
434
+ },
435
+ object
436
+ >;
437
+ status: drizzle_orm_sqlite_core.SQLiteColumn<
438
+ {
439
+ name: 'status';
440
+ tableName: 'dedupe_jobs';
441
+ dataType: 'string';
442
+ columnType: 'SQLiteText';
443
+ data: string;
444
+ driverParam: string;
445
+ notNull: true;
446
+ hasDefault: false;
447
+ isPrimaryKey: false;
448
+ isAutoincrement: false;
449
+ hasRuntimeDefault: false;
450
+ enumValues: [string, ...string[]];
451
+ baseColumn: never;
452
+ generated: undefined;
453
+ },
454
+ object
455
+ >;
456
+ result: drizzle_orm_sqlite_core.SQLiteColumn<
457
+ {
458
+ name: 'result';
459
+ tableName: 'dedupe_jobs';
460
+ dataType: 'json';
461
+ columnType: 'SQLiteBlobJson';
462
+ data: unknown;
463
+ driverParam: Buffer<ArrayBufferLike>;
464
+ notNull: false;
465
+ hasDefault: false;
466
+ isPrimaryKey: false;
467
+ isAutoincrement: false;
468
+ hasRuntimeDefault: false;
469
+ enumValues: undefined;
470
+ baseColumn: never;
471
+ generated: undefined;
472
+ },
473
+ object
474
+ >;
475
+ error: drizzle_orm_sqlite_core.SQLiteColumn<
476
+ {
477
+ name: 'error';
478
+ tableName: 'dedupe_jobs';
479
+ dataType: 'string';
480
+ columnType: 'SQLiteText';
481
+ data: string;
482
+ driverParam: string;
483
+ notNull: false;
484
+ hasDefault: false;
485
+ isPrimaryKey: false;
486
+ isAutoincrement: false;
487
+ hasRuntimeDefault: false;
488
+ enumValues: [string, ...string[]];
489
+ baseColumn: never;
490
+ generated: undefined;
491
+ },
492
+ object
493
+ >;
494
+ createdAt: drizzle_orm_sqlite_core.SQLiteColumn<
495
+ {
496
+ name: 'created_at';
497
+ tableName: 'dedupe_jobs';
498
+ dataType: 'number';
499
+ columnType: 'SQLiteInteger';
500
+ data: number;
501
+ driverParam: number;
502
+ notNull: true;
503
+ hasDefault: false;
504
+ isPrimaryKey: false;
505
+ isAutoincrement: false;
506
+ hasRuntimeDefault: false;
507
+ enumValues: undefined;
508
+ baseColumn: never;
509
+ generated: undefined;
510
+ },
511
+ object
512
+ >;
513
+ updatedAt: drizzle_orm_sqlite_core.SQLiteColumn<
514
+ {
515
+ name: 'updated_at';
516
+ tableName: 'dedupe_jobs';
517
+ dataType: 'number';
518
+ columnType: 'SQLiteInteger';
519
+ data: number;
520
+ driverParam: number;
521
+ notNull: true;
522
+ hasDefault: false;
523
+ isPrimaryKey: false;
524
+ isAutoincrement: false;
525
+ hasRuntimeDefault: false;
526
+ enumValues: undefined;
527
+ baseColumn: never;
528
+ generated: undefined;
529
+ },
530
+ object
531
+ >;
532
+ };
533
+ dialect: 'sqlite';
477
534
  }>;
478
535
  declare const rateLimitTable: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
479
- name: "rate_limits";
480
- schema: undefined;
481
- columns: {
482
- resource: drizzle_orm_sqlite_core.SQLiteColumn<{
483
- name: "resource";
484
- tableName: "rate_limits";
485
- dataType: "string";
486
- columnType: "SQLiteText";
487
- data: string;
488
- driverParam: string;
489
- notNull: true;
490
- hasDefault: false;
491
- isPrimaryKey: false;
492
- isAutoincrement: false;
493
- hasRuntimeDefault: false;
494
- enumValues: [string, ...string[]];
495
- baseColumn: never;
496
- generated: undefined;
497
- }, object>;
498
- timestamp: drizzle_orm_sqlite_core.SQLiteColumn<{
499
- name: "timestamp";
500
- tableName: "rate_limits";
501
- dataType: "number";
502
- columnType: "SQLiteInteger";
503
- data: number;
504
- driverParam: number;
505
- notNull: true;
506
- hasDefault: false;
507
- isPrimaryKey: false;
508
- isAutoincrement: false;
509
- hasRuntimeDefault: false;
510
- enumValues: undefined;
511
- baseColumn: never;
512
- generated: undefined;
513
- }, object>;
514
- id: drizzle_orm_sqlite_core.SQLiteColumn<{
515
- name: "id";
516
- tableName: "rate_limits";
517
- dataType: "number";
518
- columnType: "SQLiteInteger";
519
- data: number;
520
- driverParam: number;
521
- notNull: true;
522
- hasDefault: true;
523
- isPrimaryKey: true;
524
- isAutoincrement: false;
525
- hasRuntimeDefault: false;
526
- enumValues: undefined;
527
- baseColumn: never;
528
- generated: undefined;
529
- }, object>;
530
- };
531
- dialect: "sqlite";
536
+ name: 'rate_limits';
537
+ schema: undefined;
538
+ columns: {
539
+ resource: drizzle_orm_sqlite_core.SQLiteColumn<
540
+ {
541
+ name: 'resource';
542
+ tableName: 'rate_limits';
543
+ dataType: 'string';
544
+ columnType: 'SQLiteText';
545
+ data: string;
546
+ driverParam: string;
547
+ notNull: true;
548
+ hasDefault: false;
549
+ isPrimaryKey: false;
550
+ isAutoincrement: false;
551
+ hasRuntimeDefault: false;
552
+ enumValues: [string, ...string[]];
553
+ baseColumn: never;
554
+ generated: undefined;
555
+ },
556
+ object
557
+ >;
558
+ timestamp: drizzle_orm_sqlite_core.SQLiteColumn<
559
+ {
560
+ name: 'timestamp';
561
+ tableName: 'rate_limits';
562
+ dataType: 'number';
563
+ columnType: 'SQLiteInteger';
564
+ data: number;
565
+ driverParam: number;
566
+ notNull: true;
567
+ hasDefault: false;
568
+ isPrimaryKey: false;
569
+ isAutoincrement: false;
570
+ hasRuntimeDefault: false;
571
+ enumValues: undefined;
572
+ baseColumn: never;
573
+ generated: undefined;
574
+ },
575
+ object
576
+ >;
577
+ id: drizzle_orm_sqlite_core.SQLiteColumn<
578
+ {
579
+ name: 'id';
580
+ tableName: 'rate_limits';
581
+ dataType: 'number';
582
+ columnType: 'SQLiteInteger';
583
+ data: number;
584
+ driverParam: number;
585
+ notNull: true;
586
+ hasDefault: true;
587
+ isPrimaryKey: true;
588
+ isAutoincrement: false;
589
+ hasRuntimeDefault: false;
590
+ enumValues: undefined;
591
+ baseColumn: never;
592
+ generated: undefined;
593
+ },
594
+ object
595
+ >;
596
+ };
597
+ dialect: 'sqlite';
532
598
  }>;
533
599
  type CacheRow = typeof cacheTable.$inferSelect;
534
600
  type DedupeRow = typeof dedupeTable.$inferSelect;
535
601
  type RateLimitRow = typeof rateLimitTable.$inferSelect;
536
602
 
537
- export { type CacheRow, type DedupeRow, type RateLimitRow, SQLiteCacheStore, type SQLiteCacheStoreOptions, SQLiteDedupeStore, type SQLiteDedupeStoreOptions, SQLiteRateLimitStore, type SQLiteRateLimitStoreOptions, SqliteAdaptiveRateLimitStore, type SqliteAdaptiveRateLimitStoreOptions, cacheTable, dedupeTable, rateLimitTable };
603
+ export {
604
+ type CacheRow,
605
+ type DedupeRow,
606
+ type RateLimitRow,
607
+ SQLiteCacheStore,
608
+ type SQLiteCacheStoreOptions,
609
+ SQLiteDedupeStore,
610
+ type SQLiteDedupeStoreOptions,
611
+ SQLiteRateLimitStore,
612
+ type SQLiteRateLimitStoreOptions,
613
+ SqliteAdaptiveRateLimitStore,
614
+ type SqliteAdaptiveRateLimitStoreOptions,
615
+ cacheTable,
616
+ dedupeTable,
617
+ rateLimitTable,
618
+ };