@book000/pixivts-db-mysql 0.60.0 → 0.60.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/dist/index.cjs +266 -136
- package/dist/index.d.cts +287 -309
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +287 -309
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +237 -131
- package/dist/index.js.map +1 -0
- package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { drizzle } from
|
|
2
|
-
import mysql from
|
|
3
|
-
import
|
|
4
|
-
import { ResponseInterceptor, ResponseRecord } from '@book000/pixivts';
|
|
1
|
+
import { drizzle } from "drizzle-orm/mysql2";
|
|
2
|
+
import mysql from "mysql2/promise";
|
|
3
|
+
import { ResponseInterceptor, ResponseRecord } from "@book000/pixivts";
|
|
5
4
|
|
|
5
|
+
//#region \0rolldown/runtime.js
|
|
6
|
+
declare namespace schema_d_exports {
|
|
7
|
+
export { NewResponse, ResponseRow, responsesTable };
|
|
8
|
+
}
|
|
6
9
|
/**
|
|
7
10
|
* Drizzle ORM schema for the `responses` table.
|
|
8
11
|
*
|
|
@@ -16,262 +19,257 @@ import { ResponseInterceptor, ResponseRecord } from '@book000/pixivts';
|
|
|
16
19
|
* that each unique request/response combination is stored only once, regardless
|
|
17
20
|
* of when it was recorded.
|
|
18
21
|
*/
|
|
19
|
-
declare const responsesTable:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
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
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
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
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
22
|
+
declare const responsesTable: import("drizzle-orm/mysql-core").MySqlTableWithColumns<{
|
|
23
|
+
name: "responses";
|
|
24
|
+
schema: undefined;
|
|
25
|
+
columns: {
|
|
26
|
+
id: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
27
|
+
name: "id";
|
|
28
|
+
tableName: "responses";
|
|
29
|
+
dataType: "number";
|
|
30
|
+
columnType: "MySqlInt";
|
|
31
|
+
data: number;
|
|
32
|
+
driverParam: string | number;
|
|
33
|
+
notNull: true;
|
|
34
|
+
hasDefault: true;
|
|
35
|
+
isPrimaryKey: true;
|
|
36
|
+
isAutoincrement: true;
|
|
37
|
+
hasRuntimeDefault: false;
|
|
38
|
+
enumValues: undefined;
|
|
39
|
+
baseColumn: never;
|
|
40
|
+
identity: undefined;
|
|
41
|
+
generated: undefined;
|
|
42
|
+
}, {}, {}>;
|
|
43
|
+
method: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
44
|
+
name: "method";
|
|
45
|
+
tableName: "responses";
|
|
46
|
+
dataType: "string";
|
|
47
|
+
columnType: "MySqlVarChar";
|
|
48
|
+
data: string;
|
|
49
|
+
driverParam: string | number;
|
|
50
|
+
notNull: true;
|
|
51
|
+
hasDefault: false;
|
|
52
|
+
isPrimaryKey: false;
|
|
53
|
+
isAutoincrement: false;
|
|
54
|
+
hasRuntimeDefault: false;
|
|
55
|
+
enumValues: [string, ...string[]];
|
|
56
|
+
baseColumn: never;
|
|
57
|
+
identity: undefined;
|
|
58
|
+
generated: undefined;
|
|
59
|
+
}, {}, {}>;
|
|
60
|
+
endpoint: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
61
|
+
name: "endpoint";
|
|
62
|
+
tableName: "responses";
|
|
63
|
+
dataType: "string";
|
|
64
|
+
columnType: "MySqlVarChar";
|
|
65
|
+
data: string;
|
|
66
|
+
driverParam: string | number;
|
|
67
|
+
notNull: true;
|
|
68
|
+
hasDefault: false;
|
|
69
|
+
isPrimaryKey: false;
|
|
70
|
+
isAutoincrement: false;
|
|
71
|
+
hasRuntimeDefault: false;
|
|
72
|
+
enumValues: [string, ...string[]];
|
|
73
|
+
baseColumn: never;
|
|
74
|
+
identity: undefined;
|
|
75
|
+
generated: undefined;
|
|
76
|
+
}, {}, {}>;
|
|
77
|
+
url: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
78
|
+
name: "url";
|
|
79
|
+
tableName: "responses";
|
|
80
|
+
dataType: "string";
|
|
81
|
+
columnType: "MySqlText";
|
|
82
|
+
data: string;
|
|
83
|
+
driverParam: string;
|
|
84
|
+
notNull: false;
|
|
85
|
+
hasDefault: false;
|
|
86
|
+
isPrimaryKey: false;
|
|
87
|
+
isAutoincrement: false;
|
|
88
|
+
hasRuntimeDefault: false;
|
|
89
|
+
enumValues: [string, ...string[]];
|
|
90
|
+
baseColumn: never;
|
|
91
|
+
identity: undefined;
|
|
92
|
+
generated: undefined;
|
|
93
|
+
}, {}, {}>;
|
|
94
|
+
urlHash: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
95
|
+
name: "url_hash";
|
|
96
|
+
tableName: "responses";
|
|
97
|
+
dataType: "string";
|
|
98
|
+
columnType: "MySqlVarChar";
|
|
99
|
+
data: string;
|
|
100
|
+
driverParam: string | number;
|
|
101
|
+
notNull: true;
|
|
102
|
+
hasDefault: false;
|
|
103
|
+
isPrimaryKey: false;
|
|
104
|
+
isAutoincrement: false;
|
|
105
|
+
hasRuntimeDefault: false;
|
|
106
|
+
enumValues: [string, ...string[]];
|
|
107
|
+
baseColumn: never;
|
|
108
|
+
identity: undefined;
|
|
109
|
+
generated: undefined;
|
|
110
|
+
}, {}, {}>;
|
|
111
|
+
requestHeaders: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
112
|
+
name: "request_headers";
|
|
113
|
+
tableName: "responses";
|
|
114
|
+
dataType: "string";
|
|
115
|
+
columnType: "MySqlText";
|
|
116
|
+
data: string;
|
|
117
|
+
driverParam: string;
|
|
118
|
+
notNull: false;
|
|
119
|
+
hasDefault: false;
|
|
120
|
+
isPrimaryKey: false;
|
|
121
|
+
isAutoincrement: false;
|
|
122
|
+
hasRuntimeDefault: false;
|
|
123
|
+
enumValues: [string, ...string[]];
|
|
124
|
+
baseColumn: never;
|
|
125
|
+
identity: undefined;
|
|
126
|
+
generated: undefined;
|
|
127
|
+
}, {}, {}>;
|
|
128
|
+
requestBody: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
129
|
+
name: "request_body";
|
|
130
|
+
tableName: "responses";
|
|
131
|
+
dataType: "string";
|
|
132
|
+
columnType: "MySqlText";
|
|
133
|
+
data: string;
|
|
134
|
+
driverParam: string;
|
|
135
|
+
notNull: false;
|
|
136
|
+
hasDefault: false;
|
|
137
|
+
isPrimaryKey: false;
|
|
138
|
+
isAutoincrement: false;
|
|
139
|
+
hasRuntimeDefault: false;
|
|
140
|
+
enumValues: [string, ...string[]];
|
|
141
|
+
baseColumn: never;
|
|
142
|
+
identity: undefined;
|
|
143
|
+
generated: undefined;
|
|
144
|
+
}, {}, {}>;
|
|
145
|
+
responseType: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
146
|
+
name: "response_type";
|
|
147
|
+
tableName: "responses";
|
|
148
|
+
dataType: "string";
|
|
149
|
+
columnType: "MySqlVarChar";
|
|
150
|
+
data: string;
|
|
151
|
+
driverParam: string | number;
|
|
152
|
+
notNull: true;
|
|
153
|
+
hasDefault: false;
|
|
154
|
+
isPrimaryKey: false;
|
|
155
|
+
isAutoincrement: false;
|
|
156
|
+
hasRuntimeDefault: false;
|
|
157
|
+
enumValues: [string, ...string[]];
|
|
158
|
+
baseColumn: never;
|
|
159
|
+
identity: undefined;
|
|
160
|
+
generated: undefined;
|
|
161
|
+
}, {}, {}>;
|
|
162
|
+
statusCode: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
163
|
+
name: "status_code";
|
|
164
|
+
tableName: "responses";
|
|
165
|
+
dataType: "number";
|
|
166
|
+
columnType: "MySqlInt";
|
|
167
|
+
data: number;
|
|
168
|
+
driverParam: string | number;
|
|
169
|
+
notNull: true;
|
|
170
|
+
hasDefault: false;
|
|
171
|
+
isPrimaryKey: false;
|
|
172
|
+
isAutoincrement: false;
|
|
173
|
+
hasRuntimeDefault: false;
|
|
174
|
+
enumValues: undefined;
|
|
175
|
+
baseColumn: never;
|
|
176
|
+
identity: undefined;
|
|
177
|
+
generated: undefined;
|
|
178
|
+
}, {}, {}>;
|
|
179
|
+
responseHeaders: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
180
|
+
name: "response_headers";
|
|
181
|
+
tableName: "responses";
|
|
182
|
+
dataType: "string";
|
|
183
|
+
columnType: "MySqlText";
|
|
184
|
+
data: string;
|
|
185
|
+
driverParam: string;
|
|
186
|
+
notNull: false;
|
|
187
|
+
hasDefault: false;
|
|
188
|
+
isPrimaryKey: false;
|
|
189
|
+
isAutoincrement: false;
|
|
190
|
+
hasRuntimeDefault: false;
|
|
191
|
+
enumValues: [string, ...string[]];
|
|
192
|
+
baseColumn: never;
|
|
193
|
+
identity: undefined;
|
|
194
|
+
generated: undefined;
|
|
195
|
+
}, {}, {}>;
|
|
196
|
+
responseBody: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
197
|
+
name: "response_body";
|
|
198
|
+
tableName: "responses";
|
|
199
|
+
dataType: "string";
|
|
200
|
+
columnType: "MySqlText";
|
|
201
|
+
data: string;
|
|
202
|
+
driverParam: string;
|
|
203
|
+
notNull: true;
|
|
204
|
+
hasDefault: false;
|
|
205
|
+
isPrimaryKey: false;
|
|
206
|
+
isAutoincrement: false;
|
|
207
|
+
hasRuntimeDefault: false;
|
|
208
|
+
enumValues: [string, ...string[]];
|
|
209
|
+
baseColumn: never;
|
|
210
|
+
identity: undefined;
|
|
211
|
+
generated: undefined;
|
|
212
|
+
}, {}, {}>;
|
|
213
|
+
createdAt: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
214
|
+
name: "created_at";
|
|
215
|
+
tableName: "responses";
|
|
216
|
+
dataType: "date";
|
|
217
|
+
columnType: "MySqlDateTime";
|
|
218
|
+
data: Date;
|
|
219
|
+
driverParam: string | number;
|
|
220
|
+
notNull: true;
|
|
221
|
+
hasDefault: false;
|
|
222
|
+
isPrimaryKey: false;
|
|
223
|
+
isAutoincrement: false;
|
|
224
|
+
hasRuntimeDefault: false;
|
|
225
|
+
enumValues: undefined;
|
|
226
|
+
baseColumn: never;
|
|
227
|
+
identity: undefined;
|
|
228
|
+
generated: undefined;
|
|
229
|
+
}, {}, {}>;
|
|
230
|
+
};
|
|
231
|
+
dialect: "mysql";
|
|
229
232
|
}>;
|
|
230
233
|
/** Type for inserting a new response record. */
|
|
231
234
|
type NewResponse = typeof responsesTable.$inferInsert;
|
|
232
235
|
/** Type for a selected response record. */
|
|
233
236
|
type ResponseRow = typeof responsesTable.$inferSelect;
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
* MySQL connection factory for @book000/pixivts-db-mysql.
|
|
237
|
-
*
|
|
238
|
-
* Creates a mysql2 connection pool and wraps it in a Drizzle ORM instance.
|
|
239
|
-
*/
|
|
240
|
-
|
|
237
|
+
//#endregion
|
|
238
|
+
//#region src/connection.d.ts
|
|
241
239
|
/** Options for establishing a MySQL connection. */
|
|
242
240
|
interface ConnectionOptions {
|
|
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
|
-
|
|
241
|
+
/**
|
|
242
|
+
* Database hostname.
|
|
243
|
+
* Falls back to the `RESPONSE_DB_HOSTNAME` environment variable.
|
|
244
|
+
*/
|
|
245
|
+
host?: string;
|
|
246
|
+
/**
|
|
247
|
+
* Database port.
|
|
248
|
+
* Falls back to the `RESPONSE_DB_PORT` environment variable (default: 3306).
|
|
249
|
+
*/
|
|
250
|
+
port?: number;
|
|
251
|
+
/**
|
|
252
|
+
* Database username.
|
|
253
|
+
* Falls back to the `RESPONSE_DB_USERNAME` environment variable.
|
|
254
|
+
*/
|
|
255
|
+
user?: string;
|
|
256
|
+
/**
|
|
257
|
+
* Database password.
|
|
258
|
+
* Falls back to the `RESPONSE_DB_PASSWORD` environment variable.
|
|
259
|
+
*/
|
|
260
|
+
password?: string;
|
|
261
|
+
/**
|
|
262
|
+
* Database name.
|
|
263
|
+
* Falls back to the `RESPONSE_DB_DATABASE` environment variable.
|
|
264
|
+
*/
|
|
265
|
+
database?: string;
|
|
268
266
|
}
|
|
269
267
|
/**
|
|
270
268
|
* The Drizzle ORM database instance type returned by `createConnection`.
|
|
271
269
|
*
|
|
272
270
|
* Typed with the `schema` so that relational queries are available.
|
|
273
271
|
*/
|
|
274
|
-
type DbInstance = ReturnType<typeof drizzle<typeof
|
|
272
|
+
type DbInstance = ReturnType<typeof drizzle<typeof schema_d_exports>>;
|
|
275
273
|
/**
|
|
276
274
|
* Creates a mysql2 connection pool and returns both the raw pool and the
|
|
277
275
|
* Drizzle ORM wrapper.
|
|
@@ -280,43 +278,32 @@ type DbInstance = ReturnType<typeof drizzle<typeof schema>>;
|
|
|
280
278
|
* @returns `{ pool, db }` — raw pool for `close()`, db for queries
|
|
281
279
|
*/
|
|
282
280
|
declare function createDbConnection(opts: ConnectionOptions): {
|
|
283
|
-
|
|
284
|
-
|
|
281
|
+
pool: mysql.Pool;
|
|
282
|
+
db: DbInstance;
|
|
285
283
|
};
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
* Response recorder for @book000/pixivts-db-mysql.
|
|
289
|
-
*
|
|
290
|
-
* `createResponseRecorder()` returns a `{ interceptor, db, close }` bundle:
|
|
291
|
-
* - `interceptor` — pass to `PixivClient.of(token, { onResponse: interceptor })`
|
|
292
|
-
* - `db` — the raw Drizzle instance for custom queries
|
|
293
|
-
* - `close()` — shuts down the connection pool
|
|
294
|
-
*
|
|
295
|
-
* The recorder uses Drizzle ORM's `onDuplicateKeyUpdate` to silently ignore
|
|
296
|
-
* duplicate entries (same method + endpoint + statusCode + urlHash).
|
|
297
|
-
*/
|
|
298
|
-
|
|
284
|
+
//#endregion
|
|
285
|
+
//#region src/recorder.d.ts
|
|
299
286
|
/** The object returned by `createResponseRecorder()`. */
|
|
300
287
|
interface RecorderBundle {
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
288
|
+
/**
|
|
289
|
+
* Response interceptor — pass directly to `PixivClient.of()` as
|
|
290
|
+
* the `onResponse` option.
|
|
291
|
+
*/
|
|
292
|
+
interceptor: ResponseInterceptor;
|
|
293
|
+
/** Drizzle ORM database instance for custom queries. */
|
|
294
|
+
db: DbInstance;
|
|
295
|
+
/** Closes the underlying connection pool. */
|
|
296
|
+
close(): Promise<void>;
|
|
310
297
|
}
|
|
311
298
|
/** Options for `createResponseRecorder()`. */
|
|
312
299
|
interface RecorderOptions extends ConnectionOptions {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
300
|
+
/**
|
|
301
|
+
* If `true`, runs `CREATE TABLE IF NOT EXISTS` before returning.
|
|
302
|
+
* Useful for first-run bootstrapping without a separate migration step.
|
|
303
|
+
*
|
|
304
|
+
* @default false
|
|
305
|
+
*/
|
|
306
|
+
bootstrap?: boolean;
|
|
320
307
|
}
|
|
321
308
|
/**
|
|
322
309
|
* Inserts a response record into the database.
|
|
@@ -358,19 +345,19 @@ declare function createRecorderBundle(db: DbInstance, close: () => Promise<void>
|
|
|
358
345
|
declare function createResponseRecorder(opts: RecorderOptions): Promise<RecorderBundle>;
|
|
359
346
|
/** Filter criteria for response queries. */
|
|
360
347
|
interface ResponseFilter {
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
348
|
+
/** HTTP method to filter by (e.g. `"GET"`). Omit to match all methods. */
|
|
349
|
+
method?: string;
|
|
350
|
+
/** API endpoint path to filter by (e.g. `"/v1/illust/detail"`). Omit to match all endpoints. */
|
|
351
|
+
endpoint?: string;
|
|
352
|
+
/** HTTP status code to filter by (e.g. `200`). Omit to match all status codes. */
|
|
353
|
+
statusCode?: number;
|
|
367
354
|
}
|
|
368
355
|
/** Pagination options for `getResponses`. */
|
|
369
356
|
interface RangeOptions {
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
357
|
+
/** 1-based page number (default: 1). */
|
|
358
|
+
page?: number;
|
|
359
|
+
/** Items per page (default: 100). */
|
|
360
|
+
limit?: number;
|
|
374
361
|
}
|
|
375
362
|
/**
|
|
376
363
|
* Retrieves response records from the last 90 days.
|
|
@@ -391,14 +378,14 @@ declare function getResponses(db: DbInstance, filter?: ResponseFilter, range?: R
|
|
|
391
378
|
declare function getResponseCount(db: DbInstance, filter?: ResponseFilter): Promise<number>;
|
|
392
379
|
/** An endpoint with its response count. */
|
|
393
380
|
interface EndpointWithCount {
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
381
|
+
/** HTTP method (e.g. `"GET"` or `"POST"`). */
|
|
382
|
+
method: string;
|
|
383
|
+
/** API endpoint path (e.g. `"/v1/illust/detail"`). */
|
|
384
|
+
endpoint: string;
|
|
385
|
+
/** HTTP status code returned by the endpoint. */
|
|
386
|
+
statusCode: number;
|
|
387
|
+
/** Number of recorded responses for this (method, endpoint, statusCode) combination. */
|
|
388
|
+
count: number;
|
|
402
389
|
}
|
|
403
390
|
/**
|
|
404
391
|
* Returns all unique (method, endpoint, statusCode) combinations seen in the
|
|
@@ -408,18 +395,8 @@ interface EndpointWithCount {
|
|
|
408
395
|
* @returns Endpoints sorted by count descending
|
|
409
396
|
*/
|
|
410
397
|
declare function getEndpoints(db: DbInstance): Promise<EndpointWithCount[]>;
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
* Schema bootstrapping for @book000/pixivts-db-mysql.
|
|
414
|
-
*
|
|
415
|
-
* Provides a `CREATE TABLE IF NOT EXISTS` helper that can be used at startup
|
|
416
|
-
* without requiring drizzle-kit to be installed in production.
|
|
417
|
-
*
|
|
418
|
-
* For full migrations, use:
|
|
419
|
-
* pnpm drizzle-kit generate
|
|
420
|
-
* pnpm drizzle-kit migrate
|
|
421
|
-
*/
|
|
422
|
-
|
|
398
|
+
//#endregion
|
|
399
|
+
//#region src/migrations.d.ts
|
|
423
400
|
/**
|
|
424
401
|
* Creates the `responses` table if it does not already exist.
|
|
425
402
|
*
|
|
@@ -429,5 +406,6 @@ declare function getEndpoints(db: DbInstance): Promise<EndpointWithCount[]>;
|
|
|
429
406
|
* @param db - Drizzle ORM database instance
|
|
430
407
|
*/
|
|
431
408
|
declare function bootstrapSchema(db: DbInstance): Promise<void>;
|
|
432
|
-
|
|
409
|
+
//#endregion
|
|
433
410
|
export { type ConnectionOptions, type DbInstance, type EndpointWithCount, type NewResponse, type RangeOptions, type RecorderBundle, type RecorderOptions, type ResponseFilter, type ResponseRow, addResponse, bootstrapSchema, createDbConnection, createRecorderBundle, createResponseRecorder, getEndpoints, getResponseCount, getResponses, responsesTable };
|
|
411
|
+
//# sourceMappingURL=index.d.cts.map
|