@http-client-toolkit/store-sqlite 0.0.1 → 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/lib/index.cjs +467 -291
- package/lib/index.d.cts +573 -492
- package/lib/index.d.ts +573 -492
- package/lib/index.js +445 -284
- package/package.json +2 -2
package/lib/index.d.ts
CHANGED
|
@@ -1,537 +1,618 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
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,
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
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
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
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
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
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,
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
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
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
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
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
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
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
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
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
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
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
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 {
|
|
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
|
+
};
|