sql-dashboard 1.0.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.
Files changed (52) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +494 -0
  3. package/dist/base.driver-BKzf8BxS.d.mts +102 -0
  4. package/dist/base.driver-BdK7obt0.d.ts +102 -0
  5. package/dist/chunk-7YLO3OSN.mjs +19513 -0
  6. package/dist/chunk-BPXOTU3D.js +76 -0
  7. package/dist/chunk-HIQUIRDJ.mjs +76 -0
  8. package/dist/chunk-MTCZXLV5.mjs +232 -0
  9. package/dist/chunk-OCL5Y3AH.mjs +51 -0
  10. package/dist/chunk-OQJUWTZV.js +51 -0
  11. package/dist/chunk-P4QE6SGC.mjs +69 -0
  12. package/dist/chunk-TNHUK2FI.mjs +1033 -0
  13. package/dist/chunk-YGKUVVJT.mjs +5494 -0
  14. package/dist/connection-CzduPMhl.d.mts +68 -0
  15. package/dist/connection-CzduPMhl.d.ts +68 -0
  16. package/dist/dashboard-CkGz4ID-.d.mts +45 -0
  17. package/dist/dashboard-D9xSb-hQ.d.ts +45 -0
  18. package/dist/drivers/mssql.driver.d.mts +26 -0
  19. package/dist/drivers/mssql.driver.d.ts +26 -0
  20. package/dist/drivers/mssql.driver.js +64824 -0
  21. package/dist/drivers/mssql.driver.mjs +8 -0
  22. package/dist/drivers/mysql.driver.d.mts +29 -0
  23. package/dist/drivers/mysql.driver.d.ts +29 -0
  24. package/dist/drivers/mysql.driver.js +19672 -0
  25. package/dist/drivers/mysql.driver.mjs +9 -0
  26. package/dist/drivers/postgres.driver.d.mts +29 -0
  27. package/dist/drivers/postgres.driver.d.ts +29 -0
  28. package/dist/drivers/postgres.driver.js +5588 -0
  29. package/dist/drivers/postgres.driver.mjs +8 -0
  30. package/dist/export/index.d.mts +23 -0
  31. package/dist/export/index.d.ts +23 -0
  32. package/dist/export/index.js +102 -0
  33. package/dist/export/index.mjs +75 -0
  34. package/dist/index.d.mts +579 -0
  35. package/dist/index.d.ts +579 -0
  36. package/dist/index.js +26694 -0
  37. package/dist/index.mjs +26694 -0
  38. package/dist/middleware/express.d.mts +11 -0
  39. package/dist/middleware/express.d.ts +11 -0
  40. package/dist/middleware/express.js +90896 -0
  41. package/dist/middleware/express.mjs +91 -0
  42. package/dist/middleware/fastify.d.mts +10 -0
  43. package/dist/middleware/fastify.d.ts +10 -0
  44. package/dist/middleware/fastify.js +90860 -0
  45. package/dist/middleware/fastify.mjs +54 -0
  46. package/dist/open-JHAWMLA2.mjs +602 -0
  47. package/dist/open-T3PIT3AO.js +602 -0
  48. package/dist/query-BFhJHNeb.d.mts +16 -0
  49. package/dist/query-BFhJHNeb.d.ts +16 -0
  50. package/dist/tedious-LLE7JVQC.js +63830 -0
  51. package/dist/tedious-PHHFLMLD.mjs +63830 -0
  52. package/package.json +131 -0
@@ -0,0 +1,8 @@
1
+ import {
2
+ PostgresDriver
3
+ } from "../chunk-YGKUVVJT.mjs";
4
+ import "../chunk-P4QE6SGC.mjs";
5
+ import "../chunk-OCL5Y3AH.mjs";
6
+ export {
7
+ PostgresDriver
8
+ };
@@ -0,0 +1,23 @@
1
+ import { Q as QueryResult } from '../query-BFhJHNeb.mjs';
2
+
3
+ interface CSVExportOptions {
4
+ delimiter?: string;
5
+ includeHeader?: boolean;
6
+ quoteAll?: boolean;
7
+ encoding?: string;
8
+ nullValue?: string;
9
+ }
10
+ declare function toCSV(result: QueryResult, options?: CSVExportOptions): string;
11
+ declare function toCSVStream(result: QueryResult, options?: CSVExportOptions): NodeJS.ReadableStream;
12
+
13
+ interface JSONExportOptions {
14
+ pretty?: boolean;
15
+ indent?: number;
16
+ dateFormat?: 'iso' | 'timestamp';
17
+ includeMeta?: boolean;
18
+ }
19
+ declare function toJSON(result: QueryResult, options?: JSONExportOptions): string;
20
+ declare function toJSONLines(result: QueryResult): string;
21
+ declare function toJSONArray(result: QueryResult): string;
22
+
23
+ export { type CSVExportOptions, type JSONExportOptions, toCSV, toCSVStream, toJSON, toJSONArray, toJSONLines };
@@ -0,0 +1,23 @@
1
+ import { Q as QueryResult } from '../query-BFhJHNeb.js';
2
+
3
+ interface CSVExportOptions {
4
+ delimiter?: string;
5
+ includeHeader?: boolean;
6
+ quoteAll?: boolean;
7
+ encoding?: string;
8
+ nullValue?: string;
9
+ }
10
+ declare function toCSV(result: QueryResult, options?: CSVExportOptions): string;
11
+ declare function toCSVStream(result: QueryResult, options?: CSVExportOptions): NodeJS.ReadableStream;
12
+
13
+ interface JSONExportOptions {
14
+ pretty?: boolean;
15
+ indent?: number;
16
+ dateFormat?: 'iso' | 'timestamp';
17
+ includeMeta?: boolean;
18
+ }
19
+ declare function toJSON(result: QueryResult, options?: JSONExportOptions): string;
20
+ declare function toJSONLines(result: QueryResult): string;
21
+ declare function toJSONArray(result: QueryResult): string;
22
+
23
+ export { type CSVExportOptions, type JSONExportOptions, toCSV, toCSVStream, toJSON, toJSONArray, toJSONLines };
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/export/index.ts
21
+ var export_exports = {};
22
+ __export(export_exports, {
23
+ toCSV: () => toCSV,
24
+ toCSVStream: () => toCSVStream,
25
+ toJSON: () => toJSON,
26
+ toJSONArray: () => toJSONArray,
27
+ toJSONLines: () => toJSONLines
28
+ });
29
+ module.exports = __toCommonJS(export_exports);
30
+
31
+ // src/export/csv.ts
32
+ function toCSV(result, options = {}) {
33
+ const {
34
+ delimiter = ",",
35
+ includeHeader = true,
36
+ quoteAll = true,
37
+ nullValue = "NULL"
38
+ } = options;
39
+ const lines = [];
40
+ if (includeHeader && result.columns.length > 0) {
41
+ lines.push(result.columns.map((col) => formatCSVField(col, delimiter, quoteAll)).join(delimiter));
42
+ }
43
+ for (const row of result.rows) {
44
+ const line = result.columns.map((col) => {
45
+ const value = row[col];
46
+ if (value === null || value === void 0) return nullValue;
47
+ return formatCSVField(String(value), delimiter, quoteAll);
48
+ });
49
+ lines.push(line.join(delimiter));
50
+ }
51
+ return lines.join("\r\n");
52
+ }
53
+ function formatCSVField(value, delimiter, quoteAll) {
54
+ const needsQuoting = quoteAll || value.includes(delimiter) || value.includes('"') || value.includes("\n") || value.includes("\r");
55
+ if (needsQuoting) {
56
+ return `"${value.replace(/"/g, '""')}"`;
57
+ }
58
+ return value;
59
+ }
60
+ function toCSVStream(result, options = {}) {
61
+ const { Readable } = require("stream");
62
+ const csv = toCSV(result, options);
63
+ const stream = new Readable();
64
+ stream.push(csv);
65
+ stream.push(null);
66
+ return stream;
67
+ }
68
+
69
+ // src/export/json.ts
70
+ function toJSON(result, options = {}) {
71
+ const {
72
+ pretty = true,
73
+ indent = 2,
74
+ includeMeta = false
75
+ } = options;
76
+ if (includeMeta) {
77
+ return JSON.stringify({
78
+ meta: {
79
+ rowCount: result.rowCount,
80
+ columns: result.columns,
81
+ duration: result.duration,
82
+ status: result.status
83
+ },
84
+ data: result.rows
85
+ }, null, pretty ? indent : void 0);
86
+ }
87
+ return JSON.stringify(result.rows, null, pretty ? indent : void 0);
88
+ }
89
+ function toJSONLines(result) {
90
+ return result.rows.map((row) => JSON.stringify(row)).join("\n");
91
+ }
92
+ function toJSONArray(result) {
93
+ return JSON.stringify(result.rows);
94
+ }
95
+ // Annotate the CommonJS export names for ESM import in node:
96
+ 0 && (module.exports = {
97
+ toCSV,
98
+ toCSVStream,
99
+ toJSON,
100
+ toJSONArray,
101
+ toJSONLines
102
+ });
@@ -0,0 +1,75 @@
1
+ import {
2
+ __require
3
+ } from "../chunk-OCL5Y3AH.mjs";
4
+
5
+ // src/export/csv.ts
6
+ function toCSV(result, options = {}) {
7
+ const {
8
+ delimiter = ",",
9
+ includeHeader = true,
10
+ quoteAll = true,
11
+ nullValue = "NULL"
12
+ } = options;
13
+ const lines = [];
14
+ if (includeHeader && result.columns.length > 0) {
15
+ lines.push(result.columns.map((col) => formatCSVField(col, delimiter, quoteAll)).join(delimiter));
16
+ }
17
+ for (const row of result.rows) {
18
+ const line = result.columns.map((col) => {
19
+ const value = row[col];
20
+ if (value === null || value === void 0) return nullValue;
21
+ return formatCSVField(String(value), delimiter, quoteAll);
22
+ });
23
+ lines.push(line.join(delimiter));
24
+ }
25
+ return lines.join("\r\n");
26
+ }
27
+ function formatCSVField(value, delimiter, quoteAll) {
28
+ const needsQuoting = quoteAll || value.includes(delimiter) || value.includes('"') || value.includes("\n") || value.includes("\r");
29
+ if (needsQuoting) {
30
+ return `"${value.replace(/"/g, '""')}"`;
31
+ }
32
+ return value;
33
+ }
34
+ function toCSVStream(result, options = {}) {
35
+ const { Readable } = __require("stream");
36
+ const csv = toCSV(result, options);
37
+ const stream = new Readable();
38
+ stream.push(csv);
39
+ stream.push(null);
40
+ return stream;
41
+ }
42
+
43
+ // src/export/json.ts
44
+ function toJSON(result, options = {}) {
45
+ const {
46
+ pretty = true,
47
+ indent = 2,
48
+ includeMeta = false
49
+ } = options;
50
+ if (includeMeta) {
51
+ return JSON.stringify({
52
+ meta: {
53
+ rowCount: result.rowCount,
54
+ columns: result.columns,
55
+ duration: result.duration,
56
+ status: result.status
57
+ },
58
+ data: result.rows
59
+ }, null, pretty ? indent : void 0);
60
+ }
61
+ return JSON.stringify(result.rows, null, pretty ? indent : void 0);
62
+ }
63
+ function toJSONLines(result) {
64
+ return result.rows.map((row) => JSON.stringify(row)).join("\n");
65
+ }
66
+ function toJSONArray(result) {
67
+ return JSON.stringify(result.rows);
68
+ }
69
+ export {
70
+ toCSV,
71
+ toCSVStream,
72
+ toJSON,
73
+ toJSONArray,
74
+ toJSONLines
75
+ };