@smallwebco/tinypivot-server 1.0.57

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 ADDED
@@ -0,0 +1,635 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ createTinyPivotHandler: () => createTinyPivotHandler,
34
+ ensureLimit: () => ensureLimit,
35
+ extractTableNames: () => extractTableNames,
36
+ sanitizeTableName: () => sanitizeTableName,
37
+ validateSQL: () => validateSQL
38
+ });
39
+ module.exports = __toCommonJS(index_exports);
40
+
41
+ // src/validation.ts
42
+ var FORBIDDEN_KEYWORDS = [
43
+ "INSERT",
44
+ "UPDATE",
45
+ "DELETE",
46
+ "DROP",
47
+ "ALTER",
48
+ "TRUNCATE",
49
+ "CREATE",
50
+ "GRANT",
51
+ "REVOKE",
52
+ "EXEC",
53
+ "EXECUTE",
54
+ "MERGE",
55
+ "UPSERT",
56
+ "REPLACE",
57
+ "CALL",
58
+ "SET",
59
+ "LOCK",
60
+ "UNLOCK"
61
+ ];
62
+ var DANGEROUS_PATTERNS = [
63
+ /INTO\s+(?:OUTFILE|DUMPFILE)/i,
64
+ // File operations
65
+ /LOAD\s+DATA/i,
66
+ // File loading
67
+ /;\s*(?:INSERT|UPDATE|DELETE|DROP)/i
68
+ // Statement injection
69
+ ];
70
+ function validateSQL(sql, allowedTables) {
71
+ const trimmedSQL = sql.trim();
72
+ const upperSQL = trimmedSQL.toUpperCase();
73
+ if (!upperSQL.startsWith("SELECT") && !upperSQL.startsWith("WITH")) {
74
+ return {
75
+ valid: false,
76
+ error: "Only SELECT queries (including CTEs with WITH) are allowed"
77
+ };
78
+ }
79
+ if (upperSQL.startsWith("WITH")) {
80
+ if (!upperSQL.includes("SELECT")) {
81
+ return {
82
+ valid: false,
83
+ error: "CTE queries must include a final SELECT statement"
84
+ };
85
+ }
86
+ }
87
+ for (const keyword of FORBIDDEN_KEYWORDS) {
88
+ const regex = new RegExp(`\\b${keyword}\\b`, "i");
89
+ if (regex.test(trimmedSQL)) {
90
+ return {
91
+ valid: false,
92
+ error: `Query contains forbidden keyword: ${keyword}`
93
+ };
94
+ }
95
+ }
96
+ for (const pattern of DANGEROUS_PATTERNS) {
97
+ if (pattern.test(trimmedSQL)) {
98
+ return {
99
+ valid: false,
100
+ error: "Query contains dangerous pattern"
101
+ };
102
+ }
103
+ }
104
+ const statements = trimmedSQL.split(";").filter((s) => s.trim().length > 0);
105
+ if (statements.length > 1) {
106
+ return {
107
+ valid: false,
108
+ error: "Multiple statements are not allowed"
109
+ };
110
+ }
111
+ if (/--/.test(trimmedSQL) || /\/\*/.test(trimmedSQL)) {
112
+ return {
113
+ valid: false,
114
+ error: "SQL comments are not allowed"
115
+ };
116
+ }
117
+ const extractedTables = extractTableNames(trimmedSQL);
118
+ const normalizedAllowed = allowedTables.map((t) => t.toLowerCase());
119
+ for (const table of extractedTables) {
120
+ if (!normalizedAllowed.includes(table.toLowerCase())) {
121
+ return {
122
+ valid: false,
123
+ error: `Table "${table}" is not in the allowed list`
124
+ };
125
+ }
126
+ }
127
+ return { valid: true };
128
+ }
129
+ function extractTableNames(sql) {
130
+ const tables = [];
131
+ const fromMatch = sql.match(/\bFROM\s+([a-z_]\w*(?:\s*,\s*[a-z_]\w*)*)/i);
132
+ if (fromMatch) {
133
+ const fromTables = fromMatch[1].split(",").map((t) => t.trim());
134
+ tables.push(...fromTables);
135
+ }
136
+ const joinRegex = /\b(?:LEFT|RIGHT|INNER|OUTER|CROSS|FULL)?\s*JOIN\s+([a-z_]\w*)/gi;
137
+ let match;
138
+ while ((match = joinRegex.exec(sql)) !== null) {
139
+ tables.push(match[1]);
140
+ }
141
+ return [...new Set(tables.map((t) => t.replace(/["`]/g, "")))];
142
+ }
143
+ function sanitizeTableName(name) {
144
+ return name.replace(/\W/g, "");
145
+ }
146
+ function ensureLimit(sql, maxRows) {
147
+ if (/\bLIMIT\s+\d+/i.test(sql)) {
148
+ const limitMatch = sql.match(/\bLIMIT\s+(\d+)/i);
149
+ if (limitMatch) {
150
+ const existingLimit = Number.parseInt(limitMatch[1], 10);
151
+ if (existingLimit > maxRows) {
152
+ return sql.replace(/\bLIMIT\s+\d+/i, `LIMIT ${maxRows}`);
153
+ }
154
+ }
155
+ return sql;
156
+ }
157
+ const trimmed = sql.replace(/;\s*$/, "").trim();
158
+ return `${trimmed} LIMIT ${maxRows}`;
159
+ }
160
+
161
+ // src/unified-handler.ts
162
+ function detectProvider(apiKey) {
163
+ if (apiKey.startsWith("sk-ant-")) {
164
+ return "anthropic";
165
+ }
166
+ if (apiKey.startsWith("sk-or-")) {
167
+ return "openrouter";
168
+ }
169
+ return "openai";
170
+ }
171
+ function getProviderConfig(provider) {
172
+ switch (provider) {
173
+ case "anthropic":
174
+ return {
175
+ provider: "anthropic",
176
+ endpoint: "https://api.anthropic.com/v1/messages",
177
+ defaultModel: "claude-3-haiku-20240307",
178
+ buildHeaders: (apiKey) => ({
179
+ "Content-Type": "application/json",
180
+ "x-api-key": apiKey,
181
+ "anthropic-version": "2023-06-01"
182
+ }),
183
+ extractContent: (data) => {
184
+ const d = data;
185
+ return d.content?.[0]?.text || "";
186
+ }
187
+ };
188
+ case "openrouter":
189
+ return {
190
+ provider: "openrouter",
191
+ endpoint: "https://openrouter.ai/api/v1/chat/completions",
192
+ defaultModel: "anthropic/claude-3-haiku",
193
+ buildHeaders: (apiKey) => ({
194
+ "Content-Type": "application/json",
195
+ "Authorization": `Bearer ${apiKey}`,
196
+ "HTTP-Referer": "https://tiny-pivot.com",
197
+ "X-Title": "TinyPivot AI Data Analyst"
198
+ }),
199
+ extractContent: (data) => {
200
+ const d = data;
201
+ return d.choices?.[0]?.message?.content || "";
202
+ }
203
+ };
204
+ case "openai":
205
+ default:
206
+ return {
207
+ provider: "openai",
208
+ endpoint: "https://api.openai.com/v1/chat/completions",
209
+ defaultModel: "gpt-4o-mini",
210
+ buildHeaders: (apiKey) => ({
211
+ "Content-Type": "application/json",
212
+ "Authorization": `Bearer ${apiKey}`
213
+ }),
214
+ extractContent: (data) => {
215
+ const d = data;
216
+ return d.choices?.[0]?.message?.content || "";
217
+ }
218
+ };
219
+ }
220
+ }
221
+ function normalizeModelForOpenRouter(model) {
222
+ if (model.includes("/")) {
223
+ return model;
224
+ }
225
+ if (model.startsWith("claude")) {
226
+ return `anthropic/${model}`;
227
+ }
228
+ if (model.startsWith("gpt-") || model.startsWith("o1") || model.startsWith("o3")) {
229
+ return `openai/${model}`;
230
+ }
231
+ if (model.startsWith("gemini")) {
232
+ return `google/${model}`;
233
+ }
234
+ if (model.startsWith("llama") || model.startsWith("codellama")) {
235
+ return `meta-llama/${model}`;
236
+ }
237
+ if (model.startsWith("mistral") || model.startsWith("mixtral") || model.startsWith("codestral")) {
238
+ return `mistralai/${model}`;
239
+ }
240
+ if (model.startsWith("deepseek")) {
241
+ return `deepseek/${model}`;
242
+ }
243
+ if (model.startsWith("qwen")) {
244
+ return `qwen/${model}`;
245
+ }
246
+ return model;
247
+ }
248
+ var PG_TYPE_MAP = {
249
+ "character varying": "string",
250
+ "varchar": "string",
251
+ "character": "string",
252
+ "char": "string",
253
+ "text": "string",
254
+ "uuid": "string",
255
+ "name": "string",
256
+ "citext": "string",
257
+ "integer": "number",
258
+ "int": "number",
259
+ "int2": "number",
260
+ "int4": "number",
261
+ "int8": "number",
262
+ "smallint": "number",
263
+ "bigint": "number",
264
+ "decimal": "number",
265
+ "numeric": "number",
266
+ "real": "number",
267
+ "double precision": "number",
268
+ "float4": "number",
269
+ "float8": "number",
270
+ "money": "number",
271
+ "serial": "number",
272
+ "bigserial": "number",
273
+ "boolean": "boolean",
274
+ "bool": "boolean",
275
+ "date": "date",
276
+ "timestamp": "date",
277
+ "timestamp without time zone": "date",
278
+ "timestamp with time zone": "date",
279
+ "timestamptz": "date",
280
+ "time": "date",
281
+ "time without time zone": "date",
282
+ "time with time zone": "date",
283
+ "timetz": "date",
284
+ "interval": "date"
285
+ };
286
+ function matchesPattern(tableName, pattern) {
287
+ if (typeof pattern === "string") {
288
+ return tableName.toLowerCase() === pattern.toLowerCase();
289
+ }
290
+ return pattern.test(tableName);
291
+ }
292
+ function filterTables(tables, options) {
293
+ let filtered = tables;
294
+ if (options.include && options.include.length > 0) {
295
+ filtered = filtered.filter(
296
+ (table) => options.include.some((pattern) => matchesPattern(table, pattern))
297
+ );
298
+ }
299
+ if (options.exclude && options.exclude.length > 0) {
300
+ filtered = filtered.filter(
301
+ (table) => !options.exclude.some((pattern) => matchesPattern(table, pattern))
302
+ );
303
+ }
304
+ return filtered;
305
+ }
306
+ function createTinyPivotHandler(options = {}) {
307
+ const {
308
+ connectionString = process.env.DATABASE_URL,
309
+ apiKey = process.env.AI_API_KEY,
310
+ tables: tableOptions = {},
311
+ maxRows,
312
+ timeout,
313
+ maxTokens = 2048,
314
+ onError
315
+ } = options;
316
+ const modelOverride = options.model || process.env.AI_MODEL;
317
+ const schemas = tableOptions.schemas || ["public"];
318
+ const descriptions = tableOptions.descriptions || {};
319
+ return async (req) => {
320
+ try {
321
+ const body = await req.json();
322
+ const { action } = body;
323
+ if (!action) {
324
+ return createErrorResponse("Missing action parameter", 400);
325
+ }
326
+ switch (action) {
327
+ case "list-tables":
328
+ return handleListTables(connectionString, schemas, tableOptions, descriptions, onError);
329
+ case "get-schema":
330
+ return handleGetSchema(body.tables || [], connectionString, schemas, tableOptions, onError);
331
+ case "query":
332
+ return handleQuery(
333
+ body.sql,
334
+ body.table,
335
+ connectionString,
336
+ schemas,
337
+ tableOptions,
338
+ maxRows,
339
+ timeout,
340
+ onError
341
+ );
342
+ case "chat":
343
+ return handleChat(body.messages || [], apiKey, modelOverride, maxTokens, onError);
344
+ default:
345
+ return createErrorResponse(`Unknown action: ${action}`, 400);
346
+ }
347
+ } catch (error) {
348
+ const err = error instanceof Error ? error : new Error(String(error));
349
+ onError?.(err);
350
+ return createErrorResponse(err.message, 500);
351
+ }
352
+ };
353
+ }
354
+ async function handleListTables(connectionString, schemas, tableOptions, descriptions, onError) {
355
+ let Pool;
356
+ try {
357
+ const pg = await import("pg");
358
+ Pool = pg.Pool;
359
+ } catch {
360
+ return createErrorResponse(
361
+ "PostgreSQL driver (pg) is not installed. Install it with: pnpm add pg",
362
+ 500
363
+ );
364
+ }
365
+ if (!connectionString) {
366
+ return createErrorResponse(
367
+ "Database connection not configured. Set DATABASE_URL environment variable.",
368
+ 500
369
+ );
370
+ }
371
+ const pool = new Pool({ connectionString });
372
+ try {
373
+ const schemaPlaceholders = schemas.map((_, i) => `$${i + 1}`).join(", ");
374
+ const result = await pool.query(
375
+ `
376
+ SELECT table_name, table_schema
377
+ FROM information_schema.tables
378
+ WHERE table_schema IN (${schemaPlaceholders})
379
+ AND table_type = 'BASE TABLE'
380
+ ORDER BY table_schema, table_name
381
+ `,
382
+ schemas
383
+ );
384
+ let tableNames = result.rows.map((row) => row.table_name);
385
+ tableNames = filterTables(tableNames, tableOptions);
386
+ const response = {
387
+ tables: tableNames.map((name) => ({
388
+ name,
389
+ description: descriptions[name]
390
+ }))
391
+ };
392
+ return new Response(JSON.stringify(response), {
393
+ status: 200,
394
+ headers: { "Content-Type": "application/json" }
395
+ });
396
+ } catch (error) {
397
+ const err = error instanceof Error ? error : new Error(String(error));
398
+ onError?.(err);
399
+ return createErrorResponse(`Failed to list tables: ${err.message}`, 500);
400
+ } finally {
401
+ await pool.end();
402
+ }
403
+ }
404
+ async function handleGetSchema(tables, connectionString, schemas, tableOptions, onError) {
405
+ if (!tables || !Array.isArray(tables) || tables.length === 0) {
406
+ return createErrorResponse("Missing or invalid tables array", 400);
407
+ }
408
+ let Pool;
409
+ try {
410
+ const pg = await import("pg");
411
+ Pool = pg.Pool;
412
+ } catch {
413
+ return createErrorResponse(
414
+ "PostgreSQL driver (pg) is not installed. Install it with: pnpm add pg",
415
+ 500
416
+ );
417
+ }
418
+ if (!connectionString) {
419
+ return createErrorResponse(
420
+ "Database connection not configured. Set DATABASE_URL environment variable.",
421
+ 500
422
+ );
423
+ }
424
+ const pool = new Pool({ connectionString });
425
+ try {
426
+ const schemaPlaceholders = schemas.map((_, i) => `$${i + 1}`).join(", ");
427
+ const tablesResult = await pool.query(
428
+ `
429
+ SELECT table_name
430
+ FROM information_schema.tables
431
+ WHERE table_schema IN (${schemaPlaceholders})
432
+ AND table_type = 'BASE TABLE'
433
+ `,
434
+ schemas
435
+ );
436
+ let allowedTables = tablesResult.rows.map((row) => row.table_name);
437
+ allowedTables = filterTables(allowedTables, tableOptions);
438
+ const filteredTables = tables.filter(
439
+ (t) => allowedTables.map((a) => a.toLowerCase()).includes(t.toLowerCase())
440
+ );
441
+ if (filteredTables.length === 0) {
442
+ return createErrorResponse("None of the requested tables are allowed", 403);
443
+ }
444
+ const tableSchemas = [];
445
+ for (const table of filteredTables) {
446
+ const columnsResult = await pool.query(
447
+ `
448
+ SELECT
449
+ column_name,
450
+ data_type,
451
+ is_nullable
452
+ FROM information_schema.columns
453
+ WHERE table_name = $1
454
+ AND table_schema = ANY($2::text[])
455
+ ORDER BY ordinal_position
456
+ `,
457
+ [table, schemas]
458
+ );
459
+ if (columnsResult.rows.length > 0) {
460
+ const columns = columnsResult.rows.map((row) => ({
461
+ name: row.column_name,
462
+ type: PG_TYPE_MAP[row.data_type.toLowerCase()] || "unknown",
463
+ nullable: row.is_nullable === "YES"
464
+ }));
465
+ tableSchemas.push({ table, columns });
466
+ }
467
+ }
468
+ const response = { schemas: tableSchemas };
469
+ return new Response(JSON.stringify(response), {
470
+ status: 200,
471
+ headers: { "Content-Type": "application/json" }
472
+ });
473
+ } catch (error) {
474
+ const err = error instanceof Error ? error : new Error(String(error));
475
+ onError?.(err);
476
+ return createErrorResponse(`Failed to get schema: ${err.message}`, 500);
477
+ } finally {
478
+ await pool.end();
479
+ }
480
+ }
481
+ async function handleQuery(sql, table, connectionString, schemas, tableOptions, maxRows, timeout, onError) {
482
+ if (!sql || typeof sql !== "string") {
483
+ return createErrorResponse("Missing or invalid SQL query", 400);
484
+ }
485
+ if (!table || typeof table !== "string") {
486
+ return createErrorResponse("Missing or invalid table name", 400);
487
+ }
488
+ let Pool;
489
+ try {
490
+ const pg = await import("pg");
491
+ Pool = pg.Pool;
492
+ } catch {
493
+ return createErrorResponse(
494
+ "PostgreSQL driver (pg) is not installed. Install it with: pnpm add pg",
495
+ 500
496
+ );
497
+ }
498
+ if (!connectionString) {
499
+ return createErrorResponse(
500
+ "Database connection not configured. Set DATABASE_URL environment variable.",
501
+ 500
502
+ );
503
+ }
504
+ const poolConfig = { connectionString };
505
+ if (timeout !== void 0) {
506
+ poolConfig.statement_timeout = timeout;
507
+ }
508
+ const pool = new Pool(poolConfig);
509
+ try {
510
+ const schemaPlaceholders = schemas.map((_, i) => `$${i + 1}`).join(", ");
511
+ const tablesResult = await pool.query(
512
+ `
513
+ SELECT table_name
514
+ FROM information_schema.tables
515
+ WHERE table_schema IN (${schemaPlaceholders})
516
+ AND table_type = 'BASE TABLE'
517
+ `,
518
+ schemas
519
+ );
520
+ let allowedTables = tablesResult.rows.map((row) => row.table_name);
521
+ allowedTables = filterTables(allowedTables, tableOptions);
522
+ if (!allowedTables.map((t) => t.toLowerCase()).includes(table.toLowerCase())) {
523
+ return createErrorResponse(`Table "${table}" is not allowed`, 403);
524
+ }
525
+ const validation = validateSQL(sql, allowedTables);
526
+ if (!validation.valid) {
527
+ return createErrorResponse(validation.error || "Invalid SQL", 400);
528
+ }
529
+ const finalSQL = maxRows !== void 0 ? ensureLimit(sql, maxRows) : sql;
530
+ const startTime = Date.now();
531
+ const result = await pool.query(finalSQL);
532
+ const duration = Date.now() - startTime;
533
+ const truncated = maxRows !== void 0 && result.rows.length >= maxRows;
534
+ const response = {
535
+ success: true,
536
+ data: result.rows,
537
+ rowCount: result.rows.length,
538
+ truncated,
539
+ duration
540
+ };
541
+ return new Response(JSON.stringify(response), {
542
+ status: 200,
543
+ headers: { "Content-Type": "application/json" }
544
+ });
545
+ } catch (error) {
546
+ const err = error instanceof Error ? error : new Error(String(error));
547
+ onError?.(err);
548
+ return createErrorResponse(sanitizeErrorMessage(err.message), 500);
549
+ } finally {
550
+ await pool.end();
551
+ }
552
+ }
553
+ async function handleChat(messages, apiKey, modelOverride, maxTokens, onError) {
554
+ if (!messages || !Array.isArray(messages) || messages.length === 0) {
555
+ return createErrorResponse("Missing or invalid messages array", 400);
556
+ }
557
+ if (!apiKey) {
558
+ return createErrorResponse(
559
+ "AI API key not configured. Set AI_API_KEY environment variable.",
560
+ 500
561
+ );
562
+ }
563
+ const provider = detectProvider(apiKey);
564
+ const config = getProviderConfig(provider);
565
+ let model = modelOverride || config.defaultModel;
566
+ if (provider === "openrouter") {
567
+ model = normalizeModelForOpenRouter(model);
568
+ }
569
+ try {
570
+ let requestBody;
571
+ if (provider === "anthropic") {
572
+ requestBody = {
573
+ model,
574
+ max_tokens: maxTokens,
575
+ messages: messages.map((m) => ({
576
+ role: m.role === "system" ? "user" : m.role,
577
+ content: m.content
578
+ }))
579
+ };
580
+ } else {
581
+ requestBody = {
582
+ model,
583
+ max_tokens: maxTokens,
584
+ messages
585
+ };
586
+ }
587
+ const response = await fetch(config.endpoint, {
588
+ method: "POST",
589
+ headers: config.buildHeaders(apiKey),
590
+ body: JSON.stringify(requestBody)
591
+ });
592
+ if (!response.ok) {
593
+ const errorText = await response.text();
594
+ throw new Error(`AI provider error (${response.status}): ${errorText}`);
595
+ }
596
+ const data = await response.json();
597
+ const content = config.extractContent(data);
598
+ const aiResponse = { content };
599
+ return new Response(JSON.stringify(aiResponse), {
600
+ status: 200,
601
+ headers: { "Content-Type": "application/json" }
602
+ });
603
+ } catch (error) {
604
+ const err = error instanceof Error ? error : new Error(String(error));
605
+ onError?.(err);
606
+ const response = { content: "", error: err.message };
607
+ return new Response(JSON.stringify(response), {
608
+ status: 500,
609
+ headers: { "Content-Type": "application/json" }
610
+ });
611
+ }
612
+ }
613
+ function sanitizeErrorMessage(message) {
614
+ let sanitized = message.replace(/postgresql?:\/\/\S+/gi, "[DATABASE_URL]");
615
+ sanitized = sanitized.replace(/\/[^\s:]+\.(js|ts|mjs|cjs)/g, "[FILE]");
616
+ sanitized = sanitized.replace(/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/g, "[IP]");
617
+ if (sanitized.length > 200) {
618
+ sanitized = `${sanitized.slice(0, 200)}...`;
619
+ }
620
+ return sanitized;
621
+ }
622
+ function createErrorResponse(error, status) {
623
+ return new Response(JSON.stringify({ error }), {
624
+ status,
625
+ headers: { "Content-Type": "application/json" }
626
+ });
627
+ }
628
+ // Annotate the CommonJS export names for ESM import in node:
629
+ 0 && (module.exports = {
630
+ createTinyPivotHandler,
631
+ ensureLimit,
632
+ extractTableNames,
633
+ sanitizeTableName,
634
+ validateSQL
635
+ });