@trilogy-data/trilogy-studio-components 0.1.26 → 0.1.28
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/AssetAutoImporter-C_7Ms9xe.js +403 -0
- package/dist/{ChatCreatorModal-CL-jBnc3.js → ChatCreatorModal-Cd40SvdM.js} +3 -3
- package/dist/{ChatModelSelect-Do-VRUFc.js → ChatModelSelect-Cz7axWjP.js} +1 -1
- package/dist/{CodeBlock-PT4no49I.js → CodeBlock-Dj-GfTbW.js} +4 -4
- package/dist/{CommunityModels-Cmro0hV3.js → CommunityModels-lX2RhHCG.js} +7 -7
- package/dist/{ConnectionErrorPopup-FSs7U-Yl.js → ConnectionErrorPopup-7vpqgF0s.js} +1 -1
- package/dist/{ConnectionView-COnTTuA4.js → ConnectionView-CZ06qjjE.js} +49 -49
- package/dist/{CreateEditorFromDatasourcePopup-snOh1d5h.js → CreateEditorFromDatasourcePopup-DwA938kf.js} +4 -4
- package/dist/{Dashboard-BH9ZwMVJ.js → Dashboard-CQsIqWZC.js} +276 -280
- package/dist/{DashboardImportSelector-DQSvu9T-.js → DashboardImportSelector-CkqH52FX.js} +2 -2
- package/dist/{DashboardMobile-BUPtdN2V.js → DashboardMobile-DWFlel5p.js} +39 -39
- package/dist/{DrilldownPane-CBs5ZojS.js → DrilldownPane-BheRHJMs.js} +5 -7
- package/dist/{Editor-DQsYpkwl.js → Editor-DQ66Vp6v.js} +105 -103
- package/dist/{ErrorMessage-XMn_08gJ.js → ErrorMessage-D5JeF3Iz.js} +4 -4
- package/dist/{GlobalChatPanel-DhnOaige.js → GlobalChatPanel-B_s3COHE.js} +20 -21
- package/dist/{IDE-HLa8vybk.js → IDE-4-Jg6gsM.js} +200 -203
- package/dist/{JobsView-B97HBoIE.js → JobsView-B5NWDUgP.js} +13 -14
- package/dist/{LLMChat-CxJcPLEG.js → LLMChat-eKgEc-I3.js} +3 -3
- package/dist/{LLMView-C1MUf0c2.js → LLMView-CdTwMLVV.js} +23 -23
- package/dist/{LoadingView-s1uznGwG.js → LoadingView-Bu3wLJ7J.js} +2 -2
- package/dist/{MarkdownRenderer-BNDuEyG-.js → MarkdownRenderer-B6lqdkgc.js} +531 -430
- package/dist/{MobileIDE-BpqXoaMR.js → MobileIDE-CZlg20oa.js} +179 -182
- package/dist/{ModelCard-BhN25jaV.js → ModelCard-Bs_d7Jis.js} +12 -13
- package/dist/{ModelView-DUDA_PtZ.js → ModelView-BP5yyecx.js} +7 -7
- package/dist/PageLoading-DKFeqkmK.js +5937 -0
- package/dist/{ResultComponent-CAn_r3BL.js → ResultComponent-BaDheojB.js} +8 -8
- package/dist/{Results-BJtlwebY.js → Results-CrpHB101.js} +17 -19
- package/dist/{StatusIcon-BylPx2EO.js → StatusIcon-Clfyy-Yn.js} +2 -2
- package/dist/{StoreTokenModal-zCSYhfrw.js → StoreTokenModal-CO5hXMs3.js} +2 -2
- package/dist/{SymbolsPane-KYSwN9Sv.js → SymbolsPane-XFVErDFb.js} +6 -3
- package/dist/{TrilogyEmbedProvider-WA_dlv9e.js → TrilogyEmbedProvider-D3h0gYnX.js} +9 -9
- package/dist/{TutorialPage-NRcee6Dx.js → TutorialPage-CMcTYDOV.js} +27 -28
- package/dist/{VegaLiteChart-D1slfOUY.js → VegaLiteChart-DX_LbF3g.js} +12131 -10947
- package/dist/{WelcomePage-D5mU2x1L.js → WelcomePage-B6E35FUa.js} +5 -5
- package/dist/{embedTheme-Bub46ILG.js → _plugin-vue_export-helper-f9Rw-Il4.js} +14 -6
- package/dist/assets/{css.worker-9aDGcEUy.js → css.worker-niORQtzO.js} +14 -14
- package/dist/assets/{html.worker-D2LKDpnG.js → html.worker-CO5LvJpF.js} +17 -17
- package/dist/assets/json.worker-BezHzWUV.js +58 -0
- package/dist/assets/{ts.worker-Bz0-EaKK.js → ts.worker-CYhxGg0r.js} +107 -107
- package/dist/{results-DTgAKr5j.js → base-DuKnVD-A.js} +216 -45
- package/dist/components/FeedbackBanner.vue.d.ts +4 -0
- package/dist/components/FeedbackBanner.vue.d.ts.map +1 -0
- package/dist/components/dashboard/DashboardCreatorIcon.vue.d.ts +54 -0
- package/dist/components/dashboard/DashboardCreatorIcon.vue.d.ts.map +1 -0
- package/dist/components/dashboard/DashboardProvenance.vue.d.ts +30 -0
- package/dist/components/dashboard/DashboardProvenance.vue.d.ts.map +1 -0
- package/dist/components/dashboard/ReportLayout.vue.d.ts +19 -0
- package/dist/components/dashboard/ReportLayout.vue.d.ts.map +1 -0
- package/dist/components/editor/Editor.vue.d.ts +3 -3
- package/dist/components/editor/EditorCreatorIcon.vue.d.ts +62 -0
- package/dist/components/editor/EditorCreatorIcon.vue.d.ts.map +1 -0
- package/dist/components/editor/ValidationComponent.vue.d.ts +50 -0
- package/dist/components/editor/ValidationComponent.vue.d.ts.map +1 -0
- package/dist/components/model/ModelCard.vue.d.ts +3 -3
- package/dist/components/sidebar/LLMConnectionList.vue.d.ts.map +1 -1
- package/dist/components/sidebar/Sidebar.vue.d.ts.map +1 -1
- package/dist/components/tutorial/TutorialPrompt.vue.d.ts +3 -3
- package/dist/components/tutorial/TutorialPrompt.vue.d.ts.map +1 -1
- package/dist/{remoteWorker-Dkv3TJ0j.js → connections-CWH3zwH2.js} +4544 -4126
- package/dist/connections.js +3 -4
- package/dist/{cssMode-D4Rzr1Cu.js → cssMode-zpO2ap2B.js} +5 -6
- package/dist/dashboard.js +28 -31
- package/dist/dashboards/dashboardQueryExecutor.d.ts +9 -0
- package/dist/dashboards/dashboardQueryExecutor.d.ts.map +1 -1
- package/dist/{dist-CXoL8kXK.js → dist-1z5KURzS.js} +55 -50
- package/dist/{dist-DKkuvbPb.js → dist-Bv3D2p5A.js} +20 -18
- package/dist/{editor.main-Cl8i7rHY.js → editor.main-BQh6DxDB.js} +33 -33
- package/dist/{editorRefinementRuntime-DoP9P5J2.js → editorStore-CiWH_nGN.js} +1692 -575
- package/dist/embed.js +2 -2
- package/dist/{freemarker2-fW5NBILf.js → freemarker2-DQBqlEXc.js} +1 -1
- package/dist/{globalChatRuntime-DWZxeS57.js → globalChatRuntime-DAERmOdu.js} +16 -16
- package/dist/{handlebars-dG4w8UUY.js → handlebars-tgYxaM70.js} +1 -1
- package/dist/{helpers-BLQAgX3C.js → helpers-C2pARJoZ.js} +34 -35
- package/dist/{html-1Dq70BdU.js → html-jJahD3Mi.js} +1 -1
- package/dist/{htmlMode--IQmLBeh.js → htmlMode-BA1-8l2e.js} +5 -6
- package/dist/{javascript-CTzBM4sF.js → javascript-Cypfo7va.js} +1 -1
- package/dist/{jsonMode-DzeJjIEH.js → jsonMode-xJye8PWS.js} +25 -25
- package/dist/{liquid-DlHThiki.js → liquid-BGDrv5da.js} +1 -1
- package/dist/llm/data/prompts.d.ts +1 -1
- package/dist/llm/data/prompts.d.ts.map +1 -1
- package/dist/llm/data/trilogySyntax.generated.d.ts +3 -3
- package/dist/llm/data/trilogySyntax.generated.d.ts.map +1 -1
- package/dist/llm-Wf4Etiu9.js +18493 -0
- package/dist/llm.js +2 -3
- package/dist/{localStorage-D9uyOFEO.js → localStorage-C3xms-ab.js} +40 -43
- package/dist/{lspLanguageFeatures-Cdfs3EKq.js → lspLanguageFeatures-V3e_p9oN.js} +32 -32
- package/dist/{mdx-fn3g4PH5.js → mdx-BUR1aImW.js} +1 -1
- package/dist/monaco.js +4 -4
- package/dist/{python-CCVj0pFt.js → python-YLkl0pc6.js} +1 -1
- package/dist/{razor-Cj3flYnk.js → razor-BP8TRMDY.js} +1 -1
- package/dist/{reconcile-Dyf4UZmj.js → reconcile-BH_ReGDR.js} +1 -1
- package/dist/{remoteStoreSync-Z-yjlYtI.js → remoteStoreSync-B0K8QScO.js} +3 -3
- package/dist/{rolldown-runtime-Dqa2HsxW.js → rolldown-runtime-B0aSnxlc.js} +2 -2
- package/dist/static/test_import.vue.d.ts +4 -0
- package/dist/static/test_import.vue.d.ts.map +1 -0
- package/dist/stores-DTGQZ4_B.js +2612 -0
- package/dist/stores.js +4 -7
- package/dist/trilogy-studio-components.css +1 -1
- package/dist/{tsMode-GI4xMYAl.js → tsMode-BH9HS_sH.js} +64 -66
- package/dist/{typescript-CPibXi3J.js → typescript-BM-ynfk9.js} +1 -1
- package/dist/{useChatWithTools-B0HZ_DVh.js → useChatWithTools-BSrzJtYI.js} +11 -11
- package/dist/{useDashboard-CdSnPe_6.js → useDashboard-CGeIdDuX.js} +1014 -1022
- package/dist/{tabulator_esm-CxLvGDp8.js → useGlobalChatPanel-D9kMZLeF.js} +1729 -711
- package/dist/{useResizableDialog-B0ePSts4.js → useResizableDialog-Cs90WJdF.js} +2 -2
- package/dist/views/ModelView.vue.d.ts +6 -6
- package/dist/views/ModelView.vue.d.ts.map +1 -1
- package/dist/views/TutorialPage.vue.d.ts +9 -9
- package/dist/views/TutorialPage.vue.d.ts.map +1 -1
- package/dist/views.js +192 -194
- package/dist/{vocabulary-CKLGILtR.js → vocabulary-DQK5jB7m.js} +3 -1
- package/dist/{editor.api2-ClD5pp8H.js → workers-B9Eybl-M.js} +16252 -15926
- package/dist/{xml-BNyphceI.js → xml-M5WFPSpA.js} +1 -1
- package/dist/{yaml-DE5Vz0PH.js → yaml-CEeFwjz9.js} +1 -1
- package/package.json +29 -20
- package/dist/AssetAutoImporter-CBzvBaOt.js +0 -405
- package/dist/DashboardCreatorInline-CDU7kLy3.js +0 -129
- package/dist/DataTable-DoRDynP1.js +0 -365
- package/dist/EditorCreatorInline-D6_y1H_h.js +0 -125
- package/dist/LoadingButton-OH3frQuO.js +0 -138
- package/dist/ModalDialog-D1EOG4rl.js +0 -42
- package/dist/ModelCreator-CCdC7EXt.js +0 -253
- package/dist/PageLoading-BzniJM0C.js +0 -2669
- package/dist/Tooltip-Dihir4zs.js +0 -103
- package/dist/_plugin-vue_export-helper-B3ysoDQm.js +0 -8
- package/dist/assets/json.worker-CJ5MmO5Q.js +0 -58
- package/dist/base-C8IuZWqY.js +0 -164
- package/dist/connectionHistoryStorage-DKJHiKJY.js +0 -111
- package/dist/connectionHistoryStore-DQeBvStZ.js +0 -61
- package/dist/connections-CJSb1TZl.js +0 -229
- package/dist/constants-DgFEYN2b.js +0 -7
- package/dist/dashboardStore-ppM6nGks.js +0 -641
- package/dist/demoSetup-mwa-RDC6.js +0 -2942
- package/dist/editorRefinementToolExecutor-CVY3FA7k.js +0 -4624
- package/dist/editorStore-BhhmXbi-.js +0 -1019
- package/dist/formatting-BbJ5ICgh.js +0 -6
- package/dist/llm-BBOVWb-F.js +0 -11967
- package/dist/llmStore-DJM2JhzY.js +0 -153
- package/dist/monaco.contribution-ikesdolO.js +0 -128
- package/dist/stores-BT9hTLny.js +0 -1708
- package/dist/trilogy-BroD2Qmp.js +0 -4
- package/dist/urlStore-52HG6lsX.js +0 -55
- package/dist/useGlobalChatPanel-D_0luajQ.js +0 -85
- package/dist/useIsMobile-CNpUQAvk.js +0 -8
- package/dist/usePrismHighlight-DVyDiDAL.js +0 -183
- package/dist/workers-Br7ThUKL.js +0 -47
package/dist/base-C8IuZWqY.js
DELETED
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
//#region connections/base.ts
|
|
2
|
-
var e = /* @__PURE__ */ function(e) {
|
|
3
|
-
return e.TABLE = "table", e.VIEW = "view", e;
|
|
4
|
-
}({}), t = class {
|
|
5
|
-
name;
|
|
6
|
-
type;
|
|
7
|
-
trilogyType;
|
|
8
|
-
nullable;
|
|
9
|
-
primary;
|
|
10
|
-
unique;
|
|
11
|
-
default;
|
|
12
|
-
autoincrement;
|
|
13
|
-
description = null;
|
|
14
|
-
constructor(e, t, n, r, i, a, o, s, c = null) {
|
|
15
|
-
this.name = e, this.type = t, this.trilogyType = n, this.nullable = r, this.primary = i, this.unique = a, this.default = o, this.autoincrement = s, this.description = c;
|
|
16
|
-
}
|
|
17
|
-
}, n = class {
|
|
18
|
-
name;
|
|
19
|
-
schema;
|
|
20
|
-
database;
|
|
21
|
-
columns;
|
|
22
|
-
description = null;
|
|
23
|
-
assetType = "table";
|
|
24
|
-
constructor(e, t, n, r, i = null, a = "table") {
|
|
25
|
-
this.name = e, this.columns = r, this.description = i, this.assetType = a, this.schema = t, this.database = n;
|
|
26
|
-
}
|
|
27
|
-
}, r = class {
|
|
28
|
-
name;
|
|
29
|
-
tables;
|
|
30
|
-
database;
|
|
31
|
-
description = null;
|
|
32
|
-
constructor(e, t, n, r = null) {
|
|
33
|
-
this.name = e, this.tables = t, this.database = n, this.description = r;
|
|
34
|
-
}
|
|
35
|
-
}, i = class {
|
|
36
|
-
name;
|
|
37
|
-
schemas;
|
|
38
|
-
constructor(e, t) {
|
|
39
|
-
this.name = e, this.schemas = t;
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
function a(e) {
|
|
43
|
-
return e.storage === "remote" ? `remote:${e.remoteStoreId || "unknown"}:${e.name}` : `local:${e.name}`;
|
|
44
|
-
}
|
|
45
|
-
var o = class {
|
|
46
|
-
id;
|
|
47
|
-
name;
|
|
48
|
-
type;
|
|
49
|
-
storage;
|
|
50
|
-
model = null;
|
|
51
|
-
connected;
|
|
52
|
-
error = null;
|
|
53
|
-
query_type = "abstract";
|
|
54
|
-
running = !1;
|
|
55
|
-
databases = null;
|
|
56
|
-
secureFields = [];
|
|
57
|
-
saveCredential = !1;
|
|
58
|
-
initialPollingIntervalMs = 1e3;
|
|
59
|
-
maxPollingIntervalMs = 6e4;
|
|
60
|
-
maxTotalWaitTimeMs = 36e5;
|
|
61
|
-
backoffFactor = 1.5;
|
|
62
|
-
changed = !1;
|
|
63
|
-
deleted = !1;
|
|
64
|
-
hasSchema = !0;
|
|
65
|
-
constructor(e, t, n = !0, r, i = !1) {
|
|
66
|
-
this.name = e, this.type = t, this.model = r || null, this.storage = "local", this.id = a({
|
|
67
|
-
name: e,
|
|
68
|
-
storage: this.storage
|
|
69
|
-
}), this.query_type = "abstract", this.saveCredential = i, this.connected = !1, n && this.connect().then((e) => {
|
|
70
|
-
e && (this.connected = !0);
|
|
71
|
-
}).catch((e) => {
|
|
72
|
-
throw e instanceof Error && (this.error = e.message), e;
|
|
73
|
-
}), this.secureFields = [], this.changed = !1;
|
|
74
|
-
}
|
|
75
|
-
setAttribute(e, t) {
|
|
76
|
-
if (!(e in this)) throw Error(`Attribute "${e}" does not exist on BaseConnection.`);
|
|
77
|
-
this[e] !== t && (this.changed = !0, this[e] = t, (e === "name" || e === "storage" || e === "remoteStoreId") && this.recomputeId());
|
|
78
|
-
}
|
|
79
|
-
recomputeId() {
|
|
80
|
-
let e = this.remoteStoreId;
|
|
81
|
-
this.id = a({
|
|
82
|
-
name: this.name,
|
|
83
|
-
storage: this.storage,
|
|
84
|
-
remoteStoreId: e
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
getSecret() {
|
|
88
|
-
return null;
|
|
89
|
-
}
|
|
90
|
-
delete() {
|
|
91
|
-
this.deleted = !0, this.changed = !0;
|
|
92
|
-
}
|
|
93
|
-
setSecret(e) {}
|
|
94
|
-
getSecretName() {
|
|
95
|
-
return `trilogy-connection-${this.type}-${this.name}`;
|
|
96
|
-
}
|
|
97
|
-
listRegisteredFiles() {
|
|
98
|
-
return [];
|
|
99
|
-
}
|
|
100
|
-
async refreshDatabase(e) {
|
|
101
|
-
let t = this.databases?.find((t) => t.name === e), n = await this.getSchemas(e);
|
|
102
|
-
return t ? (t.schemas = n, n) : null;
|
|
103
|
-
}
|
|
104
|
-
async refreshSchema(e, t) {
|
|
105
|
-
let n = this.databases?.find((t) => t.name === e);
|
|
106
|
-
n || (n = new i(e, []), this.databases?.push(n));
|
|
107
|
-
let a = await this.getSchemas(e), o = a.find((e) => e.name === t);
|
|
108
|
-
o || (o = new r(t, [], e), a.push(o));
|
|
109
|
-
let s = await this.getTables(e, t);
|
|
110
|
-
return n ? (n.schemas = a, o.tables = s.filter((e) => e.schema === t), o) : null;
|
|
111
|
-
}
|
|
112
|
-
async refreshColumns(e, t, n) {
|
|
113
|
-
let r = this.getLocalTable(e, t, n);
|
|
114
|
-
if (!r && (r = await this.getTable(e, n, t), !r)) throw Error(`Table ${n} not found in schema ${t} of database ${e}.`);
|
|
115
|
-
let i = await this.getColumns(e, t, r?.name || "");
|
|
116
|
-
return r.columns = i, i;
|
|
117
|
-
}
|
|
118
|
-
async getTableSample(e, t, n, r = 100) {
|
|
119
|
-
let i = n;
|
|
120
|
-
t && t !== e && (i = `${t}.${i}`), e && (i = `${e}.${i}`);
|
|
121
|
-
let a = `SELECT * FROM ${i} LIMIT ${r}`;
|
|
122
|
-
return this.query(a);
|
|
123
|
-
}
|
|
124
|
-
getLocalTable(e, t, n) {
|
|
125
|
-
if (!this.databases) return null;
|
|
126
|
-
let r = this.databases.find((t) => t.name === e);
|
|
127
|
-
return !r || !r.schemas ? null : r.schemas.find((e) => e.name === t)?.tables.find((e) => e.name === n) || null;
|
|
128
|
-
}
|
|
129
|
-
replaceEscapedStrings(e) {
|
|
130
|
-
return e.replace(/* @__PURE__ */ RegExp("!`", "g"), "''");
|
|
131
|
-
}
|
|
132
|
-
async runScript(e) {
|
|
133
|
-
await this.query(e);
|
|
134
|
-
}
|
|
135
|
-
async query(e, t = null, n = null) {
|
|
136
|
-
if (!e) throw Error("Query is empty.");
|
|
137
|
-
if (!this.connected) throw console.error(`Cannot execute query. ${this.name} is not connected.`), Error("Connection not established.");
|
|
138
|
-
this.running = !0;
|
|
139
|
-
try {
|
|
140
|
-
let r = await this.query_core(this.replaceEscapedStrings(e), t, n);
|
|
141
|
-
return this.running = !1, r;
|
|
142
|
-
} catch (e) {
|
|
143
|
-
throw this.running = !1, e;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
setModel(e) {
|
|
147
|
-
this.setAttribute("model", e);
|
|
148
|
-
}
|
|
149
|
-
async reset() {
|
|
150
|
-
try {
|
|
151
|
-
this.connected = !1, this.error = null, await this.connect(), this.connected = !0;
|
|
152
|
-
} catch (e) {
|
|
153
|
-
throw e instanceof Error && (this.error = e.message), e;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
async setError(e) {
|
|
157
|
-
this.error = e, this.connected = !1;
|
|
158
|
-
}
|
|
159
|
-
static fromJSON(e) {
|
|
160
|
-
throw Error("Method not implemented.");
|
|
161
|
-
}
|
|
162
|
-
};
|
|
163
|
-
//#endregion
|
|
164
|
-
export { r as a, i, o as n, n as o, t as r, a as s, e as t };
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
//#region data/connectionHistoryStorage.ts
|
|
2
|
-
var e = class {
|
|
3
|
-
dbName;
|
|
4
|
-
storeName;
|
|
5
|
-
db;
|
|
6
|
-
constructor() {
|
|
7
|
-
this.dbName = "sqlEditorDB", this.storeName = "queryHistory", this.db = null, this._initDB();
|
|
8
|
-
}
|
|
9
|
-
async _initDB() {
|
|
10
|
-
return new Promise((e, t) => {
|
|
11
|
-
let n = indexedDB.open(this.dbName, 1);
|
|
12
|
-
n.onerror = (e) => {
|
|
13
|
-
console.error("Error opening IndexedDB:", e.target.error), t(e.target.error);
|
|
14
|
-
}, n.onupgradeneeded = (e) => {
|
|
15
|
-
let t = e.target.result;
|
|
16
|
-
if (!t.objectStoreNames.contains(this.storeName)) {
|
|
17
|
-
let e = t.createObjectStore(this.storeName, {
|
|
18
|
-
keyPath: "id",
|
|
19
|
-
autoIncrement: !0
|
|
20
|
-
});
|
|
21
|
-
e.createIndex("connectionName", "connectionName", { unique: !1 }), e.createIndex("timestamp", "timestamp", { unique: !1 });
|
|
22
|
-
}
|
|
23
|
-
}, n.onsuccess = (t) => {
|
|
24
|
-
this.db = t.target.result, e();
|
|
25
|
-
};
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
async addQuery(e, t) {
|
|
29
|
-
this.db || await this._initDB();
|
|
30
|
-
let n = {
|
|
31
|
-
connectionName: e,
|
|
32
|
-
query: t.query,
|
|
33
|
-
generatedQuery: t.generatedQuery || null,
|
|
34
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
35
|
-
executionTime: t.executionTime,
|
|
36
|
-
status: t.status,
|
|
37
|
-
errorMessage: t.errorMessage || null,
|
|
38
|
-
resultSize: t.resultSize || 0,
|
|
39
|
-
resultColumns: t.resultColumns || 0
|
|
40
|
-
};
|
|
41
|
-
return new Promise((t, r) => {
|
|
42
|
-
if (!this.db) {
|
|
43
|
-
r(/* @__PURE__ */ Error("Database not initialized"));
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
let i = this.db.transaction([this.storeName], "readwrite").objectStore(this.storeName).add(n);
|
|
47
|
-
i.onsuccess = () => {
|
|
48
|
-
this._enforceHistorySizeLimit(e).then(() => t(i.result)).catch(r);
|
|
49
|
-
}, i.onerror = (e) => {
|
|
50
|
-
console.error("Error adding query to history:", e.target.error), r(e.target.error);
|
|
51
|
-
};
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
async getQueriesForConnection(e, t = 100) {
|
|
55
|
-
return this.db || await this._initDB(), new Promise((n, r) => {
|
|
56
|
-
if (!this.db) {
|
|
57
|
-
r(/* @__PURE__ */ Error("Database not initialized"));
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
let i = this.db.transaction([this.storeName], "readonly").objectStore(this.storeName).index("connectionName").openCursor(IDBKeyRange.only(e), "prev"), a = [];
|
|
61
|
-
i.onsuccess = (e) => {
|
|
62
|
-
let r = e.target.result;
|
|
63
|
-
r && a.length < t ? (a.push(r.value), r.continue()) : n(a);
|
|
64
|
-
}, i.onerror = (e) => {
|
|
65
|
-
console.error("Error retrieving query history:", e.target.error), r(e.target.error);
|
|
66
|
-
};
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
async clearConnectionHistory(e) {
|
|
70
|
-
return this.db || await this._initDB(), new Promise((t, n) => {
|
|
71
|
-
if (!this.db) {
|
|
72
|
-
n(/* @__PURE__ */ Error("Database not initialized"));
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
let r = this.db.transaction([this.storeName], "readwrite").objectStore(this.storeName).index("connectionName").openCursor(IDBKeyRange.only(e));
|
|
76
|
-
r.onsuccess = (e) => {
|
|
77
|
-
let n = e.target.result;
|
|
78
|
-
n ? (n.delete(), n.continue()) : t();
|
|
79
|
-
}, r.onerror = (e) => {
|
|
80
|
-
console.error("Error clearing history:", e.target.error), n(e.target.error);
|
|
81
|
-
};
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
async _enforceHistorySizeLimit(e) {
|
|
85
|
-
return new Promise((t, n) => {
|
|
86
|
-
if (!this.db) {
|
|
87
|
-
n(/* @__PURE__ */ Error("Database not initialized"));
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
let r = this.db.transaction([this.storeName], "readwrite").objectStore(this.storeName).index("connectionName"), i = r.count(IDBKeyRange.only(e));
|
|
91
|
-
i.onsuccess = () => {
|
|
92
|
-
let a = i.result;
|
|
93
|
-
if (a <= 100) {
|
|
94
|
-
t();
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
let o = a - 100, s = r.openCursor(IDBKeyRange.only(e)), c = 0;
|
|
98
|
-
s.onsuccess = (e) => {
|
|
99
|
-
let n = e.target.result;
|
|
100
|
-
n && c < o ? (n.delete(), c++, n.continue()) : t();
|
|
101
|
-
}, s.onerror = (e) => {
|
|
102
|
-
console.error("Error trimming history:", e.target.error), n(e.target.error);
|
|
103
|
-
};
|
|
104
|
-
}, i.onerror = (e) => {
|
|
105
|
-
console.error("Error counting history records:", e.target.error), n(e.target.error);
|
|
106
|
-
};
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
//#endregion
|
|
111
|
-
export { e as t };
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./connectionHistoryStorage-DKJHiKJY.js";
|
|
2
|
-
import { ref as t } from "vue";
|
|
3
|
-
//#region stores/connectionHistoryStore.ts
|
|
4
|
-
var n = null, r = () => (n ||= new e(), n);
|
|
5
|
-
function i(e) {
|
|
6
|
-
let n = t([]), i = t(!0), a = t(null), o = async () => {
|
|
7
|
-
i.value = !0;
|
|
8
|
-
try {
|
|
9
|
-
let t = await r().getQueriesForConnection(e);
|
|
10
|
-
n.value = t, a.value = null;
|
|
11
|
-
} catch (e) {
|
|
12
|
-
console.error("Failed to load query history:", e), a.value = "Failed to load query history";
|
|
13
|
-
} finally {
|
|
14
|
-
i.value = !1;
|
|
15
|
-
}
|
|
16
|
-
}, s = async (t) => {
|
|
17
|
-
try {
|
|
18
|
-
await r().addQuery(e, t), await o();
|
|
19
|
-
} catch (e) {
|
|
20
|
-
console.error("Failed to record query:", e), a.value = "Failed to record query";
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
return o(), {
|
|
24
|
-
history: n,
|
|
25
|
-
isLoading: i,
|
|
26
|
-
error: a,
|
|
27
|
-
recordQuery: s,
|
|
28
|
-
clearHistory: async () => {
|
|
29
|
-
i.value = !0;
|
|
30
|
-
try {
|
|
31
|
-
await r().clearConnectionHistory(e), n.value = [], a.value = null;
|
|
32
|
-
} catch (e) {
|
|
33
|
-
console.error("Failed to clear query history:", e), a.value = "Failed to clear query history";
|
|
34
|
-
} finally {
|
|
35
|
-
i.value = !1;
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
executeWithHistory: async (e, t) => {
|
|
39
|
-
let n = performance.now(), r = "success", i = null, a = 0, o = 0, c = null;
|
|
40
|
-
try {
|
|
41
|
-
c = await e(t), c && Array.isArray(c) && (a = c.length, a > 0 && typeof c[0] == "object" && (o = Object.keys(c[0]).length));
|
|
42
|
-
} catch (e) {
|
|
43
|
-
throw r = "error", i = e instanceof Error ? e.message : String(e), e;
|
|
44
|
-
} finally {
|
|
45
|
-
let e = performance.now() - n;
|
|
46
|
-
await s({
|
|
47
|
-
query: t,
|
|
48
|
-
executionTime: e,
|
|
49
|
-
status: r,
|
|
50
|
-
errorMessage: i,
|
|
51
|
-
resultSize: a,
|
|
52
|
-
resultColumns: o
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
return c;
|
|
56
|
-
},
|
|
57
|
-
refreshHistory: o
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
//#endregion
|
|
61
|
-
export { i as t };
|
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
import { r as e, t } from "./results-DTgAKr5j.js";
|
|
2
|
-
import { a as n, i as r, n as i, o as a, r as o, t as s } from "./base-C8IuZWqY.js";
|
|
3
|
-
//#region connections/motherduck.ts
|
|
4
|
-
var c = class n extends i {
|
|
5
|
-
connection;
|
|
6
|
-
mdToken;
|
|
7
|
-
saveCredential;
|
|
8
|
-
constructor(e, t, n, r = !1) {
|
|
9
|
-
super(e, "motherduck", !0, n, r), this.mdToken = t, this.query_type = "duckdb", this.secureFields = ["mdToken"], this.saveCredential = r;
|
|
10
|
-
}
|
|
11
|
-
toJSON() {
|
|
12
|
-
return {
|
|
13
|
-
id: this.id,
|
|
14
|
-
name: this.name,
|
|
15
|
-
type: this.type,
|
|
16
|
-
model: this.model,
|
|
17
|
-
mdToken: this.saveCredential ? "saved" : ""
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
getSecret() {
|
|
21
|
-
return this.mdToken;
|
|
22
|
-
}
|
|
23
|
-
setSecret(e) {
|
|
24
|
-
this.mdToken = e;
|
|
25
|
-
}
|
|
26
|
-
static async fromJSON(e) {
|
|
27
|
-
let t = new n(e.name, "");
|
|
28
|
-
return e.model && (t.model = e.model), t;
|
|
29
|
-
}
|
|
30
|
-
async connect() {
|
|
31
|
-
if (!this.mdToken) return console.log("Missing MotherDuck token."), this.error = "Missing MotherDuck token.", !1;
|
|
32
|
-
let { MDConnection: e } = await import("@motherduck/wasm-client");
|
|
33
|
-
return this.connection = e.create({ mdToken: this.mdToken }), this.error = null, !0;
|
|
34
|
-
}
|
|
35
|
-
async query(n, r = null, i = null) {
|
|
36
|
-
let a = this.replaceEscapedStrings(n);
|
|
37
|
-
r && Object.keys(r).length > 0 && (a = a.replace(/(?<!:):([a-zA-Z_]\w*)/g, (e, t) => {
|
|
38
|
-
if (!(t in r)) return `:${t}`;
|
|
39
|
-
let n = r[t];
|
|
40
|
-
return typeof n == "string" ? `'${n.replace(/'/g, "''")}'` : String(n);
|
|
41
|
-
}));
|
|
42
|
-
let o = await this.connection.evaluateQuery(a);
|
|
43
|
-
return new e(new Map(o.data.columnNames().map((e) => [e, {
|
|
44
|
-
name: e,
|
|
45
|
-
type: t.STRING,
|
|
46
|
-
description: ""
|
|
47
|
-
}])), o.data.toRows());
|
|
48
|
-
}
|
|
49
|
-
}, l = null;
|
|
50
|
-
function u(e) {
|
|
51
|
-
l = e;
|
|
52
|
-
}
|
|
53
|
-
var d = {};
|
|
54
|
-
async function f() {
|
|
55
|
-
return (await import("sql.js")).default;
|
|
56
|
-
}
|
|
57
|
-
async function p(e = "default") {
|
|
58
|
-
if (d[e]) return d[e];
|
|
59
|
-
let t = await f(), n = {};
|
|
60
|
-
l?.wasmUrl && (n.locateFile = () => l.wasmUrl);
|
|
61
|
-
let r = await t(n), i = new r.Database();
|
|
62
|
-
return d[e] = {
|
|
63
|
-
sql: r,
|
|
64
|
-
db: i
|
|
65
|
-
}, {
|
|
66
|
-
sql: r,
|
|
67
|
-
db: i
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
var m = class c extends i {
|
|
71
|
-
db;
|
|
72
|
-
sql;
|
|
73
|
-
static fromJSON(e) {
|
|
74
|
-
let t = new c(e.name);
|
|
75
|
-
return e.model && (t.model = e.model), t;
|
|
76
|
-
}
|
|
77
|
-
toJSON() {
|
|
78
|
-
return {
|
|
79
|
-
id: this.id,
|
|
80
|
-
name: this.name,
|
|
81
|
-
type: this.type,
|
|
82
|
-
model: this.model
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
async connect() {
|
|
86
|
-
let e = await p(this.name);
|
|
87
|
-
return this.db = e.db, this.sql = e.sql, !0;
|
|
88
|
-
}
|
|
89
|
-
constructor(e, t) {
|
|
90
|
-
super(e, "sqlite", !1, t), this.query_type = "sqlite", this.hasSchema = !1;
|
|
91
|
-
}
|
|
92
|
-
sanitizeTableName(e) {
|
|
93
|
-
let t = e.replace(/[^a-zA-Z0-9]/g, "_");
|
|
94
|
-
return /^\d/.test(t) ? `t_${t}` : t;
|
|
95
|
-
}
|
|
96
|
-
getFileType(e) {
|
|
97
|
-
return e.type === "text/csv" || e.name.endsWith(".csv") ? "csv" : "db";
|
|
98
|
-
}
|
|
99
|
-
inferColumnType(e) {
|
|
100
|
-
let t = e.filter((e) => e !== null && e !== "");
|
|
101
|
-
return t.length === 0 ? "TEXT" : t.every((e) => /^-?\d+$/.test(e)) ? "INTEGER" : t.every((e) => /^-?\d+\.?\d*([eE][+-]?\d+)?$/.test(e)) ? "REAL" : "TEXT";
|
|
102
|
-
}
|
|
103
|
-
parseCSV(e) {
|
|
104
|
-
let t = e.split(/\r?\n/).filter((e) => e.trim() !== "");
|
|
105
|
-
if (t.length === 0) return {
|
|
106
|
-
headers: [],
|
|
107
|
-
rows: []
|
|
108
|
-
};
|
|
109
|
-
let n = (e) => {
|
|
110
|
-
let t = [], n = "", r = !1;
|
|
111
|
-
for (let i = 0; i < e.length; i++) {
|
|
112
|
-
let a = e[i];
|
|
113
|
-
r ? a === "\"" && e[i + 1] === "\"" ? (n += "\"", i++) : a === "\"" ? r = !1 : n += a : a === "\"" ? r = !0 : a === "," ? (t.push(n.trim()), n = "") : n += a;
|
|
114
|
-
}
|
|
115
|
-
return t.push(n.trim()), t;
|
|
116
|
-
};
|
|
117
|
-
return {
|
|
118
|
-
headers: n(t[0]),
|
|
119
|
-
rows: t.slice(1).map(n)
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
async processCSV(e, t, n) {
|
|
123
|
-
n?.("Analyzing CSV structure...");
|
|
124
|
-
let r = await e.text(), { headers: i, rows: a } = this.parseCSV(r);
|
|
125
|
-
if (i.length === 0) throw Error("CSV file has no columns");
|
|
126
|
-
let o = a.slice(0, 100), s = i.map((e, t) => {
|
|
127
|
-
let n = o.map((e) => e[t] ?? null);
|
|
128
|
-
return this.inferColumnType(n);
|
|
129
|
-
}), c = i.map((e, t) => `"${e.replace(/[^a-zA-Z0-9_]/g, "_")}" ${s[t]}`).join(", ");
|
|
130
|
-
this.db.run(`DROP TABLE IF EXISTS ${t}`), this.db.run(`CREATE TABLE ${t} (${c})`), n?.("Importing CSV data...");
|
|
131
|
-
let l = `INSERT INTO ${t} VALUES (${i.map((e, t) => `:v${t}`).join(", ")})`;
|
|
132
|
-
this.db.run("BEGIN TRANSACTION");
|
|
133
|
-
try {
|
|
134
|
-
for (let e of a) {
|
|
135
|
-
let t = {};
|
|
136
|
-
i.forEach((n, r) => {
|
|
137
|
-
let i = e[r];
|
|
138
|
-
i === void 0 || i === "" ? t[`:v${r}`] = null : s[r] === "INTEGER" ? t[`:v${r}`] = parseInt(i, 10) : s[r] === "REAL" ? t[`:v${r}`] = parseFloat(i) : t[`:v${r}`] = i;
|
|
139
|
-
}), this.db.run(l, t);
|
|
140
|
-
}
|
|
141
|
-
this.db.run("COMMIT");
|
|
142
|
-
} catch (e) {
|
|
143
|
-
throw this.db.run("ROLLBACK"), e;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
async processSQLiteFile(e, t) {
|
|
147
|
-
t?.(`Loading database ${e.name}...`);
|
|
148
|
-
let n = await e.arrayBuffer(), r = new Uint8Array(n);
|
|
149
|
-
return this.db.close(), this.db = new this.sql.Database(r), d[this.name] = {
|
|
150
|
-
sql: this.sql,
|
|
151
|
-
db: this.db
|
|
152
|
-
}, "main";
|
|
153
|
-
}
|
|
154
|
-
async importFile(e, t) {
|
|
155
|
-
if (t?.(`Processing ${e.name}...`), this.getFileType(e) === "db") return await this.processSQLiteFile(e, t), await this.getDatabases(), {
|
|
156
|
-
type: "database",
|
|
157
|
-
name: "main"
|
|
158
|
-
};
|
|
159
|
-
{
|
|
160
|
-
let n = e.name.replace(".csv", ""), r = this.sanitizeTableName(n);
|
|
161
|
-
return t?.(`Creating table ${r}...`), await this.processCSV(e, r, t), await this.refreshDatabase("main"), {
|
|
162
|
-
type: "table",
|
|
163
|
-
name: r
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
async query_core(t, n = null, r = null) {
|
|
168
|
-
let i = this.db.exec(t, n ?? void 0);
|
|
169
|
-
if (i.length === 0) return new e(/* @__PURE__ */ new Map(), []);
|
|
170
|
-
let a = i[0], o = /* @__PURE__ */ new Map();
|
|
171
|
-
return a.columns.forEach((e) => {
|
|
172
|
-
o.set(e, {
|
|
173
|
-
name: e,
|
|
174
|
-
type: this.inferColumnTypeFromValues(a.values, a.columns.indexOf(e)),
|
|
175
|
-
description: ""
|
|
176
|
-
});
|
|
177
|
-
}), new e(o, a.values.map((e) => {
|
|
178
|
-
let t = {};
|
|
179
|
-
return a.columns.forEach((n, r) => {
|
|
180
|
-
t[n] = e[r];
|
|
181
|
-
}), t;
|
|
182
|
-
}));
|
|
183
|
-
}
|
|
184
|
-
inferColumnTypeFromValues(e, n) {
|
|
185
|
-
for (let r of e) {
|
|
186
|
-
let e = r[n];
|
|
187
|
-
if (e != null) return typeof e == "number" ? Number.isInteger(e) ? t.INTEGER : t.FLOAT : typeof e == "boolean" ? t.BOOLEAN : t.STRING;
|
|
188
|
-
}
|
|
189
|
-
return t.STRING;
|
|
190
|
-
}
|
|
191
|
-
async cancelQuery(e) {
|
|
192
|
-
return !1;
|
|
193
|
-
}
|
|
194
|
-
async getDatabases() {
|
|
195
|
-
let e = [new r("main", [])];
|
|
196
|
-
return this.databases = e, e;
|
|
197
|
-
}
|
|
198
|
-
async getSchemas(e) {
|
|
199
|
-
return [new n("main", [], "main")];
|
|
200
|
-
}
|
|
201
|
-
async getTables(e, t) {
|
|
202
|
-
let n = this.db.exec("SELECT name, type FROM sqlite_master WHERE type IN ('table', 'view') AND name NOT LIKE 'sqlite_%' ORDER BY name");
|
|
203
|
-
return n.length === 0 ? [] : n[0].values.map((e) => new a(e[0], "main", "main", [], null, e[1] === "view" ? s.VIEW : s.TABLE));
|
|
204
|
-
}
|
|
205
|
-
async getColumns(e, t, n) {
|
|
206
|
-
let r = this.db.exec(`PRAGMA table_info("${n}")`);
|
|
207
|
-
return r.length === 0 ? [] : r[0].values.map((e) => {
|
|
208
|
-
let t = e[1], n = e[2] || "TEXT", r = e[3], i = e[4], a = e[5];
|
|
209
|
-
return new o(t, n, this.mapSQLiteTypeToColumnType(n), r === 0, a > 0, !1, i, !1);
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
async getTable(e, t, n) {
|
|
213
|
-
let r = n || "main", i = this.getLocalTable(e, r, t);
|
|
214
|
-
if (i) return i;
|
|
215
|
-
let a = (await this.getTables(e, r)).find((e) => e.name === t);
|
|
216
|
-
if (!a) throw Error(`Table ${t} not found in database ${e}`);
|
|
217
|
-
return a.columns = await this.getColumns(e, r, t), a;
|
|
218
|
-
}
|
|
219
|
-
async getTableSample(e, t, n, r = 100) {
|
|
220
|
-
let i = `SELECT * FROM "${n}" LIMIT ${r}`;
|
|
221
|
-
return this.query(i);
|
|
222
|
-
}
|
|
223
|
-
mapSQLiteTypeToColumnType(e) {
|
|
224
|
-
let n = e.toUpperCase();
|
|
225
|
-
return n.includes("INT") ? t.INTEGER : n.includes("REAL") || n.includes("FLOAT") || n.includes("DOUBLE") ? t.FLOAT : n.includes("BOOL") ? t.BOOLEAN : n.includes("DATE") && n.includes("TIME") ? t.DATETIME : n.includes("DATE") ? t.DATE : n.includes("NUMERIC") || n.includes("DECIMAL") ? t.NUMERIC : t.STRING;
|
|
226
|
-
}
|
|
227
|
-
};
|
|
228
|
-
//#endregion
|
|
229
|
-
export { u as n, c as r, m as t };
|