orcaq 1.1.5 → 1.1.6
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/.output/nitro.json +1 -1
- package/.output/public/_nuxt/27ZsWTm2.js +1 -0
- package/.output/public/_nuxt/{DKGci8Z9.js → 3jfBYqJb.js} +1 -1
- package/.output/public/_nuxt/{jwI3t-NN.js → 4LC09zKL.js} +1 -1
- package/.output/public/_nuxt/4OV_5qQE.js +1 -0
- package/.output/public/_nuxt/6NXhlm49.js +1 -0
- package/.output/public/_nuxt/6wO6CbCo.js +1 -0
- package/.output/public/_nuxt/{BqjI13AR.js → 7nPLTDFM.js} +1 -1
- package/.output/public/_nuxt/B10QBDL6.js +1 -0
- package/.output/public/_nuxt/{DyIuwJ7R.js → B3iNzG14.js} +1 -1
- package/.output/public/_nuxt/B5HZeat4.js +1 -0
- package/.output/public/_nuxt/B5rxJs06.js +1 -0
- package/.output/public/_nuxt/{CY5xaULp.js → BAasx5OS.js} +1 -1
- package/.output/public/_nuxt/{COm5WeiJ.js → BCa-NKh0.js} +1 -1
- package/.output/public/_nuxt/{_q4rKPCs.js → BCazdlgN.js} +1 -1
- package/.output/public/_nuxt/{2bjDg-PP.js → BEvswgw7.js} +1 -1
- package/.output/public/_nuxt/{CtcvFTZM.js → BJ8qQpib.js} +1 -1
- package/.output/public/_nuxt/{Ce7ha8Ij.js → BJoSd_uV.js} +1 -1
- package/.output/public/_nuxt/BKAEFZqP.js +1 -0
- package/.output/public/_nuxt/BTvOPFKG.js +1 -0
- package/.output/public/_nuxt/{CFLipT9o.js → BWg3wiuc.js} +3 -3
- package/.output/public/_nuxt/{B8-wNbMP.js → B_hWP06g.js} +1 -1
- package/.output/public/_nuxt/{MPvsaAca.js → Bap1X7GD.js} +1 -1
- package/.output/public/_nuxt/{DynamicTable.B3c2woGb.css → BaseDataGrid.C2ywM2-T.css} +1 -1
- package/.output/public/_nuxt/{hJtoF0XJ.js → BbLqUOHs.js} +1 -1
- package/.output/public/_nuxt/{BQfpgF4f.js → BbawOYVr.js} +1 -1
- package/.output/public/_nuxt/Bf2bW_MY.js +7 -0
- package/.output/public/_nuxt/{CUU4aZu3.js → Bgj8Q52i.js} +1 -1
- package/.output/public/_nuxt/BhzzQZRC.js +1 -0
- package/.output/public/_nuxt/{Dtfetpn0.js → Bibtvqd8.js} +1 -1
- package/.output/public/_nuxt/{BmDMzOju.js → BmEIj9l9.js} +1 -1
- package/.output/public/_nuxt/BnZ5qYkP.js +39 -0
- package/.output/public/_nuxt/{CQUEIz0K.js → BoUZO_NV.js} +1 -1
- package/.output/public/_nuxt/Bok35x_B.js +1 -0
- package/.output/public/_nuxt/{C6Cu0sLe.js → BuSZbOQO.js} +1 -1
- package/.output/public/_nuxt/BusLuQ4Q.js +1 -0
- package/.output/public/_nuxt/{CGewvTrI.js → BxZgIpkD.js} +1 -1
- package/.output/public/_nuxt/{B9FaYCWq.js → C4-wpUAK.js} +1 -1
- package/.output/public/_nuxt/{BYWbdMZt.js → C445d10Z.js} +1 -1
- package/.output/public/_nuxt/{LQx-wtAv.js → C6CFIGob.js} +1 -1
- package/.output/public/_nuxt/{Ds73uRhN.js → C6bwwZAc.js} +1 -1
- package/.output/public/_nuxt/C7C1kq_N.js +1 -0
- package/.output/public/_nuxt/{BX-UQU8e.js → C9ZBCJdc.js} +1 -1
- package/.output/public/_nuxt/{BEhaJXPi.js → CBjcd4cE.js} +1 -1
- package/.output/public/_nuxt/{CGW0AH4b.js → CCK1so3F.js} +1 -1
- package/.output/public/_nuxt/CCOlJAKS.js +2 -0
- package/.output/public/_nuxt/{CopwM-Pr.js → CE0zlNDo.js} +1 -1
- package/.output/public/_nuxt/CEoM97rJ.js +1 -0
- package/.output/public/_nuxt/CHAVZu6b.js +2 -0
- package/.output/public/_nuxt/CN8b9qPP.js +1 -0
- package/.output/public/_nuxt/{i2P9wHne.js → CNPNWuzz.js} +1 -1
- package/.output/public/_nuxt/{98JSO6jv.js → CO0Pa76w.js} +1 -1
- package/.output/public/_nuxt/CP-7VdtS.js +1 -0
- package/.output/public/_nuxt/{B1LoOOkn.js → CROH8wgk.js} +1 -1
- package/.output/public/_nuxt/CUws2Uv7.js +1 -0
- package/.output/public/_nuxt/CZLVBTJx.js +1 -0
- package/.output/public/_nuxt/{BiDM-4Ma.js → Cf6n9dsT.js} +1 -1
- package/.output/public/_nuxt/{Di03NGSO.js → Ci7hrFNN.js} +1 -1
- package/.output/public/_nuxt/{ZS8y2W5x.js → Cl3VX8Um.js} +1 -1
- package/.output/public/_nuxt/Cl5p4EQY.js +1 -0
- package/.output/public/_nuxt/CnQob-tn.js +1 -0
- package/.output/public/_nuxt/{DCaozlmM.js → CoQ_oOia.js} +2 -2
- package/.output/public/_nuxt/CoX1_N4R.js +1 -0
- package/.output/public/_nuxt/CvDZBOay.js +1 -0
- package/.output/public/_nuxt/{CdVERIz5.js → Cvkyd5iW.js} +1 -1
- package/.output/public/_nuxt/D29mzs5t.js +1 -0
- package/.output/public/_nuxt/D9MMtvTu.js +52 -0
- package/.output/public/_nuxt/{-lZvfnzr.js → D9Ycznwo.js} +1 -1
- package/.output/public/_nuxt/{CbANTWsS.js → DDsaDrGo.js} +1 -1
- package/.output/public/_nuxt/{Ba5PGSyB.js → DHyymmeR.js} +1 -1
- package/.output/public/_nuxt/{D0o3znGI.js → DLA-ioQ4.js} +1 -1
- package/.output/public/_nuxt/DM8LJTsg.js +1 -0
- package/.output/public/_nuxt/{XAHyd86s.js → DP6Az3fC.js} +1 -1
- package/.output/public/_nuxt/{DWkbgNG-.js → DRX1aIGD.js} +1 -1
- package/.output/public/_nuxt/{D4dXVtWp.js → DViCRsmA.js} +1 -1
- package/.output/public/_nuxt/{D2eDr3o2.js → DYPm3mWQ.js} +1 -1
- package/.output/public/_nuxt/{BzOiQq7V.js → DYqShb5v.js} +4 -4
- package/.output/public/_nuxt/DZFq5yqu.js +1 -0
- package/.output/public/_nuxt/DZVfXu09.js +1 -0
- package/.output/public/_nuxt/{DoIRSvuP.js → Dd89Vyx8.js} +1 -1
- package/.output/public/_nuxt/DdbhVPqD.js +1 -0
- package/.output/public/_nuxt/{lID_8ynt.js → DeVs4gEL.js} +1 -1
- package/.output/public/_nuxt/{BtWocXUF.js → Df4wU3r0.js} +1 -1
- package/.output/public/_nuxt/{BNM5p7H5.js → DgGwe7jd.js} +180 -180
- package/.output/public/_nuxt/DlymFQ5D.js +26 -0
- package/.output/public/_nuxt/DoNLWeqB.js +20 -0
- package/.output/public/_nuxt/Dpm6rnHk.js +1 -0
- package/.output/public/_nuxt/DsPClaxV.js +1 -0
- package/.output/public/_nuxt/DtOg0Asw.js +1 -0
- package/.output/public/_nuxt/DyDU0wFf.js +1 -0
- package/.output/public/_nuxt/{CZGnIeYQ.js → EZ0owjER.js} +1 -1
- package/.output/public/_nuxt/F8eHh68O.js +9 -0
- package/.output/public/_nuxt/{BptGnFIG.js → FHx3Ejt6.js} +1 -1
- package/.output/public/_nuxt/{default.B0xlD4Sl.css → FileTree.CtTH3U6l.css} +1 -1
- package/.output/public/_nuxt/G40WRC_L.js +1 -0
- package/.output/public/_nuxt/{CQzADP3y.js → Lh0RfwhV.js} +1 -1
- package/.output/public/_nuxt/NMm6Vanu.js +1 -0
- package/.output/public/_nuxt/ORit_vRp.js +1 -0
- package/.output/public/_nuxt/P_2SRa71.js +2 -0
- package/.output/public/_nuxt/PreviewRelationTable.BA0i90jA.css +1 -0
- package/.output/public/_nuxt/{DehrK61g.js → Un5zjlKE.js} +1 -1
- package/.output/public/_nuxt/W-4KVxy4.js +22 -0
- package/.output/public/_nuxt/XETGYn3c.js +1 -0
- package/.output/public/_nuxt/{BcuPgKcZ.js → ZNDxw-7x.js} +1 -1
- package/.output/public/_nuxt/ZVYA9HBl.js +1 -0
- package/.output/public/_nuxt/ZhP2FY6Y.js +1 -0
- package/.output/public/_nuxt/_TExiQQQ.js +3 -0
- package/.output/public/_nuxt/__PEYcIB.js +9 -0
- package/.output/public/_nuxt/builds/latest.json +1 -1
- package/.output/public/_nuxt/builds/meta/47c294b1-d6b3-4974-bd50-5046ae0a393e.json +1 -0
- package/.output/public/_nuxt/dDqgUqt5.js +16 -0
- package/.output/public/_nuxt/dSX5D8ur.js +28 -0
- package/.output/public/_nuxt/default.DixIpIal.css +1 -0
- package/.output/public/_nuxt/entry.CGwcggc4.css +1 -0
- package/.output/public/_nuxt/{D2uh44XM.js → habs8oz6.js} +1 -1
- package/.output/public/_nuxt/{index.P0q-dO_S.css → index.C4HrDOPM.css} +1 -1
- package/.output/public/_nuxt/o60RgyTd.js +1 -0
- package/.output/public/_nuxt/{Di0QgSJz.js → uDsvlLN0.js} +1 -1
- package/.output/public/_nuxt/{O78AcFB2.js → wH-P-_6A.js} +1 -1
- package/.output/public/_nuxt/{CWrGZxpH.js → wrneOCBW.js} +1 -1
- package/.output/public/_nuxt/{DcCuT_qB.js → x85BV7y_.js} +1 -1
- package/.output/public/_nuxt/{B6tZoMuV.js → yLATXAxG.js} +1 -1
- package/.output/server/chunks/_/db-connection.mjs +3 -0
- package/.output/server/chunks/_/db-connection.mjs.map +1 -1
- package/.output/server/chunks/_/sql-mutation-statements.mjs +496 -0
- package/.output/server/chunks/_/sql-mutation-statements.mjs.map +1 -0
- package/.output/server/chunks/_/tables.factory.mjs +57 -29
- package/.output/server/chunks/_/tables.factory.mjs.map +1 -1
- package/.output/server/chunks/build/client.manifest.mjs +815 -697
- package/.output/server/chunks/build/client.manifest.mjs.map +1 -1
- package/.output/server/chunks/nitro/nitro.mjs +694 -664
- package/.output/server/chunks/routes/api/tables/bulk-delete.post.mjs +18 -10
- package/.output/server/chunks/routes/api/tables/bulk-delete.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/tables/bulk-insert.post.mjs +90 -0
- package/.output/server/chunks/routes/api/tables/bulk-insert.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/tables/bulk-update.post.mjs +50 -9
- package/.output/server/chunks/routes/api/tables/bulk-update.post.mjs.map +1 -1
- package/.output/server/package.json +1 -2
- package/package.json +1 -1
- package/.output/public/_nuxt/0olA6U9-.js +0 -1
- package/.output/public/_nuxt/3MFLtJaB.js +0 -2
- package/.output/public/_nuxt/5eGdUlL5.js +0 -1
- package/.output/public/_nuxt/9N_axiMO.js +0 -1
- package/.output/public/_nuxt/B7-PqSUV.js +0 -1
- package/.output/public/_nuxt/BDMb-Pyv.js +0 -1
- package/.output/public/_nuxt/BN6ZmV2J.js +0 -1
- package/.output/public/_nuxt/BjdYdiyf.js +0 -1
- package/.output/public/_nuxt/By3LMj8D.js +0 -1
- package/.output/public/_nuxt/CAw6QK8a.js +0 -1
- package/.output/public/_nuxt/CGtwVe-7.js +0 -1
- package/.output/public/_nuxt/CJZf1MDD.js +0 -1
- package/.output/public/_nuxt/CKTZRDiI.js +0 -1
- package/.output/public/_nuxt/CQas_zLl.js +0 -20
- package/.output/public/_nuxt/CS5akSNT.js +0 -1
- package/.output/public/_nuxt/CTkQN1XK.js +0 -39
- package/.output/public/_nuxt/CUiGarir.js +0 -1
- package/.output/public/_nuxt/CYMhtSRb.js +0 -1
- package/.output/public/_nuxt/CYkdQXWd.js +0 -1
- package/.output/public/_nuxt/CZmkQ9aO.js +0 -2
- package/.output/public/_nuxt/Cc2igSge.js +0 -67
- package/.output/public/_nuxt/Cgf5py_m.js +0 -9
- package/.output/public/_nuxt/CpBFRs2a.js +0 -1
- package/.output/public/_nuxt/Cr2BKem3.js +0 -1
- package/.output/public/_nuxt/CuaktsoE.js +0 -1
- package/.output/public/_nuxt/D1veMm0L.js +0 -1
- package/.output/public/_nuxt/D3ZJP2ze.js +0 -1
- package/.output/public/_nuxt/DGuH4YHZ.js +0 -1
- package/.output/public/_nuxt/DJa6BJMa.js +0 -1
- package/.output/public/_nuxt/DTEzbo2c.js +0 -1
- package/.output/public/_nuxt/DUliC29v.js +0 -1
- package/.output/public/_nuxt/DW1m4Hxy.js +0 -1
- package/.output/public/_nuxt/DWnJMbXf.js +0 -1
- package/.output/public/_nuxt/DXQS6bj6.js +0 -2
- package/.output/public/_nuxt/Dah6izTx.js +0 -22
- package/.output/public/_nuxt/Dcz-n576.js +0 -1
- package/.output/public/_nuxt/DdUuVBMi.js +0 -1
- package/.output/public/_nuxt/Di_nUA-u.js +0 -7
- package/.output/public/_nuxt/DnPYRTtC.js +0 -1
- package/.output/public/_nuxt/DpyRXhd7.js +0 -1
- package/.output/public/_nuxt/DuMEW1lw.js +0 -1
- package/.output/public/_nuxt/DvATq7eC.js +0 -1
- package/.output/public/_nuxt/DwfS-MFd.js +0 -1
- package/.output/public/_nuxt/OMgXwGIN.js +0 -26
- package/.output/public/_nuxt/QuickQuery.CJ7tNjo4.css +0 -1
- package/.output/public/_nuxt/Th_o-5A0.js +0 -1
- package/.output/public/_nuxt/ZDrzZQNQ.js +0 -1
- package/.output/public/_nuxt/builds/meta/5680cb77-cc14-4e94-a235-c54fb463e1ca.json +0 -1
- package/.output/public/_nuxt/entry.CNXXuHFL.css +0 -1
- package/.output/public/_nuxt/fkIyRXiG.js +0 -1
- package/.output/public/_nuxt/nZnnkbcv.js +0 -3
- package/.output/public/_nuxt/s75xJ0Ts.js +0 -10
- package/.output/server/node_modules/ag-grid-community/dist/package/main.esm.mjs +0 -50065
- package/.output/server/node_modules/ag-grid-community/package.json +0 -113
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { d as defineEventHandler, r as readBody, c as createError } from '../../../nitro/nitro.mjs';
|
|
2
2
|
import { D as DatabaseClientType } from '../../../_/database-client-type.mjs';
|
|
3
|
+
import { b as buildDeleteStatements } from '../../../_/sql-mutation-statements.mjs';
|
|
3
4
|
import { c as createTableAdapter } from '../../../_/tables.factory.mjs';
|
|
4
5
|
import 'node:net';
|
|
5
6
|
import 'ssh2';
|
|
@@ -30,21 +31,28 @@ import '../../../_/type-alias.constants.mjs';
|
|
|
30
31
|
|
|
31
32
|
const bulkDelete_post = defineEventHandler(async (event) => {
|
|
32
33
|
const body = await readBody(event);
|
|
33
|
-
const {
|
|
34
|
-
if (!
|
|
34
|
+
const { tableName, schemaName, pKeys, pKeyValues } = body;
|
|
35
|
+
if (!tableName || !schemaName) {
|
|
35
36
|
throw createError({
|
|
36
37
|
statusCode: 400,
|
|
37
|
-
message: "
|
|
38
|
+
message: "tableName and schemaName are required"
|
|
38
39
|
});
|
|
39
40
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
});
|
|
46
|
-
}
|
|
41
|
+
if (!(pKeyValues == null ? void 0 : pKeyValues.length) || !Array.isArray(pKeyValues)) {
|
|
42
|
+
throw createError({
|
|
43
|
+
statusCode: 400,
|
|
44
|
+
message: "pKeyValues must be a non-empty array"
|
|
45
|
+
});
|
|
47
46
|
}
|
|
47
|
+
const sqlDeleteStatements = pKeyValues.map(
|
|
48
|
+
(row) => buildDeleteStatements({
|
|
49
|
+
tableName,
|
|
50
|
+
schemaName,
|
|
51
|
+
pKeys: pKeys != null ? pKeys : [],
|
|
52
|
+
pKeyValue: row,
|
|
53
|
+
dbType: body.type
|
|
54
|
+
}).sql
|
|
55
|
+
);
|
|
48
56
|
const adapter = await createTableAdapter(
|
|
49
57
|
body.type || DatabaseClientType.POSTGRES,
|
|
50
58
|
body
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bulk-delete.post.mjs","sources":["../../../../../../server/api/tables/bulk-delete.post.ts"],"sourcesContent":null,"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bulk-delete.post.mjs","sources":["../../../../../../server/api/tables/bulk-delete.post.ts"],"sourcesContent":null,"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,wBAAe,kBAAA,CAAmB,OAAM,KAAS,KAAA;AAC/C,EAAM,MAAA,IAAA,GAAO,MAAM,QAAA,CAchB,KAAK,CAAA;AAER,EAAA,MAAM,EAAE,SAAA,EAAW,UAAY,EAAA,KAAA,EAAO,YAAe,GAAA,IAAA;AAErD,EAAI,IAAA,CAAC,SAAa,IAAA,CAAC,UAAY,EAAA;AAC7B,IAAA,MAAM,WAAY,CAAA;AAAA,MAChB,UAAY,EAAA,GAAA;AAAA,MACZ,OAAS,EAAA;AAAA,KACV,CAAA;AAAA;AAGH,EAAA,IAAI,EAAC,UAAY,IAAA,IAAA,GAAA,MAAA,GAAA,UAAA,CAAA,MAAA,CAAA,IAAU,CAAC,KAAM,CAAA,OAAA,CAAQ,UAAU,CAAG,EAAA;AACrD,IAAA,MAAM,WAAY,CAAA;AAAA,MAChB,UAAY,EAAA,GAAA;AAAA,MACZ,OAAS,EAAA;AAAA,KACV,CAAA;AAAA;AAIH,EAAA,MAAM,sBAAsB,UAAW,CAAA,GAAA;AAAA,IACrC,SACE,qBAAsB,CAAA;AAAA,MACpB,SAAA;AAAA,MACA,UAAA;AAAA,MACA,KAAA,EAAO,wBAAS,EAAC;AAAA,MACjB,SAAW,EAAA,GAAA;AAAA,MACX,QAAQ,IAAK,CAAA;AAAA,KACd,CAAE,CAAA;AAAA,GACP;AAEA,EAAA,MAAM,UAAU,MAAM,kBAAA;AAAA,IACpB,IAAA,CAAK,QAAQ,kBAAmB,CAAA,QAAA;AAAA,IAChC;AAAA,GACF;AACA,EAAO,OAAA,MAAM,OAAQ,CAAA,iBAAA,CAAkB,mBAAmB,CAAA;AAC5D,CAAC,CAAA;;;;"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { d as defineEventHandler, r as readBody, c as createError } from '../../../nitro/nitro.mjs';
|
|
2
|
+
import { D as DatabaseClientType } from '../../../_/database-client-type.mjs';
|
|
3
|
+
import { a as buildInsertStatements } from '../../../_/sql-mutation-statements.mjs';
|
|
4
|
+
import { c as createTableAdapter } from '../../../_/tables.factory.mjs';
|
|
5
|
+
import 'node:net';
|
|
6
|
+
import 'ssh2';
|
|
7
|
+
import 'node:http';
|
|
8
|
+
import 'node:https';
|
|
9
|
+
import 'node:events';
|
|
10
|
+
import 'node:buffer';
|
|
11
|
+
import 'node:fs';
|
|
12
|
+
import 'node:path';
|
|
13
|
+
import 'node:crypto';
|
|
14
|
+
import 'node:url';
|
|
15
|
+
import '@iconify/utils';
|
|
16
|
+
import 'consola';
|
|
17
|
+
import '../../../_/create-adapter.mjs';
|
|
18
|
+
import '../../../_/db-connection.mjs';
|
|
19
|
+
import '../../../_/redis.client.mjs';
|
|
20
|
+
import 'redis';
|
|
21
|
+
import 'knex';
|
|
22
|
+
import 'node:stream';
|
|
23
|
+
import '@libsql/client/http';
|
|
24
|
+
import 'oracledb';
|
|
25
|
+
import 'pg';
|
|
26
|
+
import 'pg-copy-streams';
|
|
27
|
+
import 'pg-query-stream';
|
|
28
|
+
import '../../../_/error.mjs';
|
|
29
|
+
import '../../../_/database-error.mjs';
|
|
30
|
+
import '../../../_/type-alias.constants.mjs';
|
|
31
|
+
|
|
32
|
+
const BULK_CHUNK_SIZE = 500;
|
|
33
|
+
function chunkArray(arr, size) {
|
|
34
|
+
const chunks = [];
|
|
35
|
+
for (let i = 0; i < arr.length; i += size) {
|
|
36
|
+
chunks.push(arr.slice(i, i + size));
|
|
37
|
+
}
|
|
38
|
+
return chunks;
|
|
39
|
+
}
|
|
40
|
+
const bulkInsert_post = defineEventHandler(async (event) => {
|
|
41
|
+
const body = await readBody(event);
|
|
42
|
+
const { tableName, schemaName, insertItems } = body;
|
|
43
|
+
if (!tableName || !schemaName) {
|
|
44
|
+
throw createError({
|
|
45
|
+
statusCode: 400,
|
|
46
|
+
message: "tableName and schemaName are required"
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
if (!(insertItems == null ? void 0 : insertItems.length) || !Array.isArray(insertItems)) {
|
|
50
|
+
throw createError({
|
|
51
|
+
statusCode: 400,
|
|
52
|
+
message: "insertItems must be a non-empty array"
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
const allStatements = insertItems.map(
|
|
56
|
+
(item) => buildInsertStatements({
|
|
57
|
+
tableName,
|
|
58
|
+
schemaName,
|
|
59
|
+
insertData: item,
|
|
60
|
+
dbType: body.type
|
|
61
|
+
})
|
|
62
|
+
);
|
|
63
|
+
const adapter = await createTableAdapter(
|
|
64
|
+
body.type || DatabaseClientType.POSTGRES,
|
|
65
|
+
body
|
|
66
|
+
);
|
|
67
|
+
const chunks = chunkArray(allStatements, BULK_CHUNK_SIZE);
|
|
68
|
+
if (chunks.length === 1) {
|
|
69
|
+
return await adapter.executeBulkUpdate(chunks[0]);
|
|
70
|
+
}
|
|
71
|
+
const startTime = performance.now();
|
|
72
|
+
const aggregatedData = [];
|
|
73
|
+
for (const chunk of chunks) {
|
|
74
|
+
const result = await adapter.executeBulkUpdate(chunk);
|
|
75
|
+
if (!result.success) {
|
|
76
|
+
return result;
|
|
77
|
+
}
|
|
78
|
+
if (result.data) {
|
|
79
|
+
aggregatedData.push(...result.data);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
success: true,
|
|
84
|
+
data: aggregatedData,
|
|
85
|
+
queryTime: Number((performance.now() - startTime).toFixed(2))
|
|
86
|
+
};
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
export { bulkInsert_post as default };
|
|
90
|
+
//# sourceMappingURL=bulk-insert.post.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bulk-insert.post.mjs","sources":["../../../../../../server/api/tables/bulk-insert.post.ts"],"sourcesContent":null,"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,MAAM,eAAkB,GAAA,GAAA;AAExB,SAAS,UAAA,CAAc,KAAU,IAAqB,EAAA;AACpD,EAAA,MAAM,SAAgB,EAAC;AACvB,EAAA,KAAA,IAAS,IAAI,CAAG,EAAA,CAAA,GAAI,GAAI,CAAA,MAAA,EAAQ,KAAK,IAAM,EAAA;AACzC,IAAA,MAAA,CAAO,KAAK,GAAI,CAAA,KAAA,CAAM,CAAG,EAAA,CAAA,GAAI,IAAI,CAAC,CAAA;AAAA;AAEpC,EAAO,OAAA,MAAA;AACT;AAEA,wBAAe,kBAAA,CAAmB,OAAM,KAAS,KAAA;AAC/C,EAAM,MAAA,IAAA,GAAO,MAAM,QAAA,CAahB,KAAK,CAAA;AAER,EAAA,MAAM,EAAE,SAAA,EAAW,UAAY,EAAA,WAAA,EAAgB,GAAA,IAAA;AAE/C,EAAI,IAAA,CAAC,SAAa,IAAA,CAAC,UAAY,EAAA;AAC7B,IAAA,MAAM,WAAY,CAAA;AAAA,MAChB,UAAY,EAAA,GAAA;AAAA,MACZ,OAAS,EAAA;AAAA,KACV,CAAA;AAAA;AAGH,EAAA,IAAI,EAAC,WAAa,IAAA,IAAA,GAAA,MAAA,GAAA,WAAA,CAAA,MAAA,CAAA,IAAU,CAAC,KAAM,CAAA,OAAA,CAAQ,WAAW,CAAG,EAAA;AACvD,IAAA,MAAM,WAAY,CAAA;AAAA,MAChB,UAAY,EAAA,GAAA;AAAA,MACZ,OAAS,EAAA;AAAA,KACV,CAAA;AAAA;AAGH,EAAA,MAAM,gBAAgB,WAAY,CAAA,GAAA;AAAA,IAAI,UACpC,qBAAsB,CAAA;AAAA,MACpB,SAAA;AAAA,MACA,UAAA;AAAA,MACA,UAAY,EAAA,IAAA;AAAA,MACZ,QAAQ,IAAK,CAAA;AAAA,KACd;AAAA,GACH;AAEA,EAAA,MAAM,UAAU,MAAM,kBAAA;AAAA,IACpB,IAAA,CAAK,QAAQ,kBAAmB,CAAA,QAAA;AAAA,IAChC;AAAA,GACF;AAEA,EAAM,MAAA,MAAA,GAAS,UAAW,CAAA,aAAA,EAAe,eAAe,CAAA;AAExD,EAAI,IAAA,MAAA,CAAO,WAAW,CAAG,EAAA;AACvB,IAAA,OAAO,MAAM,OAAA,CAAQ,iBAAkB,CAAA,MAAA,CAAO,CAAC,CAAC,CAAA;AAAA;AAGlD,EAAM,MAAA,SAAA,GAAY,YAAY,GAAI,EAAA;AAClC,EAAA,MAAM,iBAA0D,EAAC;AAEjE,EAAA,KAAA,MAAW,SAAS,MAAQ,EAAA;AAC1B,IAAA,MAAM,MAAS,GAAA,MAAM,OAAQ,CAAA,iBAAA,CAAkB,KAAK,CAAA;AACpD,IAAI,IAAA,CAAC,OAAO,OAAS,EAAA;AACnB,MAAO,OAAA,MAAA;AAAA;AAET,IAAA,IAAI,OAAO,IAAM,EAAA;AACf,MAAe,cAAA,CAAA,IAAA,CAAK,GAAG,MAAA,CAAO,IAAI,CAAA;AAAA;AACpC;AAGF,EAAO,OAAA;AAAA,IACL,OAAS,EAAA,IAAA;AAAA,IACT,IAAM,EAAA,cAAA;AAAA,IACN,SAAA,EAAW,QAAQ,WAAY,CAAA,GAAA,KAAQ,SAAW,EAAA,OAAA,CAAQ,CAAC,CAAC;AAAA,GAC9D;AACF,CAAC,CAAA;;;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { d as defineEventHandler, r as readBody, c as createError } from '../../../nitro/nitro.mjs';
|
|
2
2
|
import { D as DatabaseClientType } from '../../../_/database-client-type.mjs';
|
|
3
|
+
import { c as buildUpdateStatements } from '../../../_/sql-mutation-statements.mjs';
|
|
3
4
|
import { c as createTableAdapter } from '../../../_/tables.factory.mjs';
|
|
4
5
|
import 'node:net';
|
|
5
6
|
import 'ssh2';
|
|
@@ -28,29 +29,69 @@ import '../../../_/error.mjs';
|
|
|
28
29
|
import '../../../_/database-error.mjs';
|
|
29
30
|
import '../../../_/type-alias.constants.mjs';
|
|
30
31
|
|
|
32
|
+
const BULK_CHUNK_SIZE = 500;
|
|
33
|
+
function chunkArray(arr, size) {
|
|
34
|
+
const chunks = [];
|
|
35
|
+
for (let i = 0; i < arr.length; i += size) {
|
|
36
|
+
chunks.push(arr.slice(i, i + size));
|
|
37
|
+
}
|
|
38
|
+
return chunks;
|
|
39
|
+
}
|
|
31
40
|
const bulkUpdate_post = defineEventHandler(async (event) => {
|
|
32
41
|
const body = await readBody(event);
|
|
33
|
-
const {
|
|
34
|
-
if (!
|
|
42
|
+
const { tableName, schemaName, pKeys, updates } = body;
|
|
43
|
+
if (!tableName || !schemaName) {
|
|
44
|
+
throw createError({
|
|
45
|
+
statusCode: 400,
|
|
46
|
+
message: "tableName and schemaName are required"
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
if (!(updates == null ? void 0 : updates.length) || !Array.isArray(updates)) {
|
|
35
50
|
throw createError({
|
|
36
51
|
statusCode: 400,
|
|
37
|
-
message: "
|
|
52
|
+
message: "updates must be a non-empty array"
|
|
38
53
|
});
|
|
39
54
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
if (typeof statement !== "string" || !isInsertOrUpdate) {
|
|
55
|
+
const allStatements = updates.map((item) => {
|
|
56
|
+
if (!item.pKeyValue || !item.update) {
|
|
43
57
|
throw createError({
|
|
44
58
|
statusCode: 400,
|
|
45
|
-
message: "
|
|
59
|
+
message: "Each update item requires pKeyValue and update fields"
|
|
46
60
|
});
|
|
47
61
|
}
|
|
48
|
-
|
|
62
|
+
return buildUpdateStatements({
|
|
63
|
+
tableName,
|
|
64
|
+
schemaName,
|
|
65
|
+
pKeys: pKeys != null ? pKeys : [],
|
|
66
|
+
pKeyValue: item.pKeyValue,
|
|
67
|
+
update: item.update,
|
|
68
|
+
dbType: body.type
|
|
69
|
+
}).sql;
|
|
70
|
+
});
|
|
49
71
|
const adapter = await createTableAdapter(
|
|
50
72
|
body.type || DatabaseClientType.POSTGRES,
|
|
51
73
|
body
|
|
52
74
|
);
|
|
53
|
-
|
|
75
|
+
const chunks = chunkArray(allStatements, BULK_CHUNK_SIZE);
|
|
76
|
+
if (chunks.length === 1) {
|
|
77
|
+
return await adapter.executeBulkUpdate(chunks[0]);
|
|
78
|
+
}
|
|
79
|
+
const startTime = performance.now();
|
|
80
|
+
const aggregatedData = [];
|
|
81
|
+
for (const chunk of chunks) {
|
|
82
|
+
const result = await adapter.executeBulkUpdate(chunk);
|
|
83
|
+
if (!result.success) {
|
|
84
|
+
return result;
|
|
85
|
+
}
|
|
86
|
+
if (result.data) {
|
|
87
|
+
aggregatedData.push(...result.data);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
success: true,
|
|
92
|
+
data: aggregatedData,
|
|
93
|
+
queryTime: Number((performance.now() - startTime).toFixed(2))
|
|
94
|
+
};
|
|
54
95
|
});
|
|
55
96
|
|
|
56
97
|
export { bulkUpdate_post as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bulk-update.post.mjs","sources":["../../../../../../server/api/tables/bulk-update.post.ts"],"sourcesContent":null,"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bulk-update.post.mjs","sources":["../../../../../../server/api/tables/bulk-update.post.ts"],"sourcesContent":null,"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,MAAM,eAAkB,GAAA,GAAA;AAOxB,SAAS,UAAA,CAAc,KAAU,IAAqB,EAAA;AACpD,EAAA,MAAM,SAAgB,EAAC;AACvB,EAAA,KAAA,IAAS,IAAI,CAAG,EAAA,CAAA,GAAI,GAAI,CAAA,MAAA,EAAQ,KAAK,IAAM,EAAA;AACzC,IAAA,MAAA,CAAO,KAAK,GAAI,CAAA,KAAA,CAAM,CAAG,EAAA,CAAA,GAAI,IAAI,CAAC,CAAA;AAAA;AAEpC,EAAO,OAAA,MAAA;AACT;AAEA,wBAAe,kBAAA,CAAmB,OAAM,KAAS,KAAA;AAC/C,EAAM,MAAA,IAAA,GAAO,MAAM,QAAA,CAchB,KAAK,CAAA;AAER,EAAA,MAAM,EAAE,SAAA,EAAW,UAAY,EAAA,KAAA,EAAO,SAAY,GAAA,IAAA;AAElD,EAAI,IAAA,CAAC,SAAa,IAAA,CAAC,UAAY,EAAA;AAC7B,IAAA,MAAM,WAAY,CAAA;AAAA,MAChB,UAAY,EAAA,GAAA;AAAA,MACZ,OAAS,EAAA;AAAA,KACV,CAAA;AAAA;AAGH,EAAA,IAAI,EAAC,OAAS,IAAA,IAAA,GAAA,MAAA,GAAA,OAAA,CAAA,MAAA,CAAA,IAAU,CAAC,KAAM,CAAA,OAAA,CAAQ,OAAO,CAAG,EAAA;AAC/C,IAAA,MAAM,WAAY,CAAA;AAAA,MAChB,UAAY,EAAA,GAAA;AAAA,MACZ,OAAS,EAAA;AAAA,KACV,CAAA;AAAA;AAGH,EAAM,MAAA,aAAA,GAAgB,OAAQ,CAAA,GAAA,CAAI,CAAQ,IAAA,KAAA;AACxC,IAAA,IAAI,CAAC,IAAA,CAAK,SAAa,IAAA,CAAC,KAAK,MAAQ,EAAA;AACnC,MAAA,MAAM,WAAY,CAAA;AAAA,QAChB,UAAY,EAAA,GAAA;AAAA,QACZ,OAAS,EAAA;AAAA,OACV,CAAA;AAAA;AAEH,IAAA,OAAO,qBAAsB,CAAA;AAAA,MAC3B,SAAA;AAAA,MACA,UAAA;AAAA,MACA,KAAA,EAAO,wBAAS,EAAC;AAAA,MACjB,WAAW,IAAK,CAAA,SAAA;AAAA,MAChB,QAAQ,IAAK,CAAA,MAAA;AAAA,MACb,QAAQ,IAAK,CAAA;AAAA,KACd,CAAE,CAAA,GAAA;AAAA,GACJ,CAAA;AAED,EAAA,MAAM,UAAU,MAAM,kBAAA;AAAA,IACpB,IAAA,CAAK,QAAQ,kBAAmB,CAAA,QAAA;AAAA,IAChC;AAAA,GACF;AAEA,EAAM,MAAA,MAAA,GAAS,UAAW,CAAA,aAAA,EAAe,eAAe,CAAA;AAExD,EAAI,IAAA,MAAA,CAAO,WAAW,CAAG,EAAA;AACvB,IAAA,OAAO,MAAM,OAAA,CAAQ,iBAAkB,CAAA,MAAA,CAAO,CAAC,CAAC,CAAA;AAAA;AAGlD,EAAM,MAAA,SAAA,GAAY,YAAY,GAAI,EAAA;AAClC,EAAA,MAAM,iBAA0D,EAAC;AAEjE,EAAA,KAAA,MAAW,SAAS,MAAQ,EAAA;AAC1B,IAAA,MAAM,MAAS,GAAA,MAAM,OAAQ,CAAA,iBAAA,CAAkB,KAAK,CAAA;AACpD,IAAI,IAAA,CAAC,OAAO,OAAS,EAAA;AACnB,MAAO,OAAA,MAAA;AAAA;AAET,IAAA,IAAI,OAAO,IAAM,EAAA;AACf,MAAe,cAAA,CAAA,IAAA,CAAK,GAAG,MAAA,CAAO,IAAI,CAAA;AAAA;AACpC;AAGF,EAAO,OAAA;AAAA,IACL,OAAS,EAAA,IAAA;AAAA,IACT,IAAM,EAAA,cAAA;AAAA,IACN,SAAA,EAAW,QAAQ,WAAY,CAAA,GAAA,KAAQ,SAAW,EAAA,OAAA,CAAQ,CAAC,CAAC;AAAA,GAC9D;AACF,CAAC,CAAA;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "orcaq-prod",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": true,
|
|
6
6
|
"dependencies": {
|
|
@@ -36,7 +36,6 @@
|
|
|
36
36
|
"@vue/runtime-dom": "3.5.13",
|
|
37
37
|
"@vue/server-renderer": "3.5.13",
|
|
38
38
|
"@vue/shared": "3.5.13",
|
|
39
|
-
"ag-grid-community": "33.2.4",
|
|
40
39
|
"ai": "6.0.116",
|
|
41
40
|
"asn1": "0.2.6",
|
|
42
41
|
"aws-ssl-profiles": "1.1.2",
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as t,a2 as a,t as s,g as n}from"./BNM5p7H5.js";const c=t({__name:"index",setup(r){const e=a();return(o,i)=>s(n(e).activeTab)}});export{c as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{d as D,aa as ht,r as O,aK as _t,k as A,l as V,g as o,o as S,w as l,D as R,ak as kt,aJ as yt,e as B,m as I,n as j,j as z,u as Ie,a as je,dz as Ve,az as bt,A as L,c as oe,b as We,aq as Ke,f as i,a0 as F,z as W,F as Y,s as ne,q as Ye,t as U,aY as Ct,a_ as xt,a$ as $t,v as Ge,N as St,O as Et,Q as Tt,R as It,S as Wt,T as Mt,U as At,V as Bt,a5 as ge,dA as Dt,a6 as Lt,a3 as Me,a1 as ve,W as we,p as $e,aS as Ne,dB as Nt,at as Pt,aT as Ot,bm as Rt,aN as Ht,dC as Ft,dD as he,dE as Ae,K as Pe,aG as Q,aH as Qe,X as Be,Y as De,bn as Je,$ as Xe,dF as zt,bs as qt,Z as Ut,i as te,_ as jt,bj as Vt,x as Kt,y as Yt,C as Gt,B as Qt,dG as Jt,dH as Xt,dI as Zt,aP as eo,cY as to,dr as oo}from"./BNM5p7H5.js";import{i as Ze,g as et,a as se}from"./BN6ZmV2J.js";import{_ as tt}from"./DpyRXhd7.js";import{i as no,_ as Se}from"./DW1m4Hxy.js";import{F as so,u as ro,a as io,b as ao,c as lo,E as co,d as uo,t as po,e as _e}from"./CFLipT9o.js";import{_ as mo,a as fo,b as vo,e as wo,c as go}from"./Th_o-5A0.js";import{_ as ho}from"./CZGnIeYQ.js";import{_ as _o,j as ko,k as yo}from"./DGuH4YHZ.js";import{_ as bo}from"./CKTZRDiI.js";import"./CYMhtSRb.js";import"./BjdYdiyf.js";var Co=D({__name:"AvatarFallback",props:{delayMs:{type:Number,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"span"}},setup(e){const t=e,s=no();ht();const r=O(t.delayMs===void 0);return _t(n=>{if(t.delayMs&&yt){const a=window.setTimeout(()=>{r.value=!0},t.delayMs);n(()=>{window.clearTimeout(a)})}}),(n,a)=>r.value&&o(s).imageLoadingStatus.value!=="loaded"?(S(),A(o(kt),{key:0,"as-child":n.asChild,as:n.as},{default:l(()=>[R(n.$slots,"default")]),_:3},8,["as-child","as"])):V("v-if",!0)}}),xo=Co;const $o={"data-slot":"table-container",class:"relative w-full overflow-auto"},So=D({__name:"Table",props:{class:{}},setup(e){const t=e;return(s,r)=>(S(),B("div",$o,[I("table",{"data-slot":"table",class:j(o(z)("w-full caption-bottom text-sm",t.class))},[R(s.$slots,"default")],2)]))}}),Eo=D({__name:"TableBody",props:{class:{}},setup(e){const t=e;return(s,r)=>(S(),B("tbody",{"data-slot":"table-body",class:j(o(z)("[&_tr:last-child]:border-0",t.class))},[R(s.$slots,"default")],2))}}),ae=D({__name:"TableCell",props:{class:{}},setup(e){const t=e;return(s,r)=>(S(),B("td",{"data-slot":"table-cell",class:j(o(z)("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t.class))},[R(s.$slots,"default")],2))}}),Oe=D({__name:"TableRow",props:{class:{}},setup(e){const t=e;return(s,r)=>(S(),B("tr",{"data-slot":"table-row",class:j(o(z)("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",t.class))},[R(s.$slots,"default")],2))}}),le=D({__name:"TableHead",props:{class:{}},setup(e){const t=e;return(s,r)=>(S(),B("th",{"data-slot":"table-head",class:j(o(z)("text-muted-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t.class))},[R(s.$slots,"default")],2))}}),To=D({__name:"TableHeader",props:{class:{}},setup(e){const t=e;return(s,r)=>(S(),B("thead",{"data-slot":"table-header",class:j(o(z)("[&_tr]:border-b",t.class))},[R(s.$slots,"default")],2))}}),Io={key:1,class:"rounded-md border border-border w-full"},Wo={class:"flex items-center gap-2 truncate"},Mo={class:"w-80"},Ao={class:"text-muted-foreground truncate"},Bo={class:"flex flex-wrap gap-1"},Do={class:"flex items-center justify-end gap-1"},Lo=D({__name:"ConnectionsList",props:{connections:{}},emits:["edit","delete","create"],setup(e,{emit:t}){const{openWorkspaceWithConnection:s}=Ie(),r=je(),{checkAndConfirm:n}=Ve(),a=We(),v=e,w=t,u=O(null),c=bt(L,{name:"hugeicons:database"}),d=oe(()=>Ze(a.public.sqlite3ConnectionsEnabled)),E=_=>{if(_.method!==ge.STRING||!_.connectionString)return null;try{return Dt(_.connectionString)}catch{return null}},p=_=>_.type===Lt.ORACLE?_.serviceName:_.database,g=_=>{if(_.method===ge.FILE){const k=_.filePath||"SQLite file not selected";return{summary:k,tooltip:k}}if(_.method===ge.STRING){const k=E(_),T=_.connectionString||"Invalid connection string";return k?{summary:`${k.host}${k.database?`:${k.database}`:""}`,tooltip:`${k.host}${k.port?`:${k.port}`:""}${k.database?`/${k.database}`:""}`}:{summary:T,tooltip:T}}const m=_.host||"Host not set",x=p(_);return{summary:`${m}${x?`:${x}`:""}`,tooltip:`${m}${_.port?`:${_.port}`:""}${x?`/${x}`:""}`}},f=oe(()=>v.connections.map(_=>{var m;return{connection:_,details:g(_),icon:((m=et(_.type))==null?void 0:m.icon)??c}})),$=_=>{u.value=_},b=()=>{u.value&&(w("delete",u.value),u.value=null)},C=async _=>{se(_,d.value)||!await n(_)||s({connId:_.id,wsId:_.workspaceId})};return(_,m)=>{const x=Ke;return v.connections.length===0?(S(),A(x,{key:0,title:"No connections yet",desc:"Click Add Connection to create your first database connection."},{default:l(()=>[i(o(F),{size:"sm",variant:"outline",onClick:m[0]||(m[0]=k=>w("create"))},{default:l(()=>[i(o(L),{name:"hugeicons:plus-sign",class:"size-4!"}),m[3]||(m[3]=W(" Add Connection "))]),_:1})]),_:1})):(S(),B("div",Io,[i(o(So),null,{default:l(()=>[i(o(To),null,{default:l(()=>[i(o(Oe),{class:"hover:bg-transparent"},{default:l(()=>[i(o(le),null,{default:l(()=>m[4]||(m[4]=[W("Name")])),_:1}),i(o(le),null,{default:l(()=>m[5]||(m[5]=[W("Connection Details")])),_:1}),i(o(le),null,{default:l(()=>m[6]||(m[6]=[W("Tag Envs")])),_:1}),i(o(le),{class:"text-right"},{default:l(()=>m[7]||(m[7]=[W("Actions")])),_:1})]),_:1})]),_:1}),i(o(Eo),null,{default:l(()=>[(S(!0),B(Y,null,ne(f.value,k=>(S(),A(o(Oe),{key:k.connection.id,class:"hover:bg-muted/30 w-full"},{default:l(()=>[i(o(ae),null,{default:l(()=>[I("div",Wo,[(S(),A(Ye(k.icon),{class:"size-5!"})),W(" "+U(k.connection.name),1)])]),_:2},1024),i(o(ae),null,{default:l(()=>[i(o(Ct),null,{default:l(()=>[i(o(xt),{"as-child":""},{default:l(()=>[I("div",Mo,[I("div",Ao,U(k.details.summary),1)])]),_:2},1024),i(o($t),null,{default:l(()=>[I("p",null,U(k.details.tooltip),1)]),_:2},1024)]),_:2},1024)]),_:2},1024),i(o(ae),null,{default:l(()=>[I("div",Bo,[(S(!0),B(Y,null,ne(o(r).getTagsByIds(k.connection.tagIds??[]),T=>(S(),A(o(Ge),{key:T.id,tag:T},null,8,["tag"]))),128))])]),_:2},1024),i(o(ae),{class:"text-right"},{default:l(()=>[I("div",Do,[i(o(F),{variant:"outline",size:"iconMd",onClick:T=>_.$emit("edit",k.connection)},{default:l(()=>[i(o(L),{name:"hugeicons:edit-02"})]),_:2},1032,["onClick"]),i(o(F),{variant:"outline",size:"iconMd",onClick:T=>$(k.connection.id)},{default:l(()=>[i(o(L),{name:"hugeicons:delete-02"})]),_:2},1032,["onClick"]),i(o(F),{variant:"default",size:"sm",disabled:o(se)(k.connection,d.value),onClick:T=>C(k.connection)},{default:l(()=>[i(o(L),{name:"hugeicons:square-arrow-up-right"}),W(" "+U(o(se)(k.connection,d.value)?"Disabled":"Connect"),1)]),_:2},1032,["disabled","onClick"])])]),_:2},1024)]),_:2},1024))),128))]),_:1})]),_:1}),i(o(St),{open:!!u.value,"onUpdate:open":m[2]||(m[2]=k=>!k)},{default:l(()=>[i(o(Et),{class:"border"},{default:l(()=>[i(o(Tt),null,{default:l(()=>[i(o(It),null,{default:l(()=>m[8]||(m[8]=[W("Are you sure?")])),_:1}),i(o(Wt),null,{default:l(()=>m[9]||(m[9]=[W(" This will permanently delete this database connection. This action cannot be undone. ")])),_:1})]),_:1}),i(o(Mt),null,{default:l(()=>[i(o(At),{class:"border",onClick:m[1]||(m[1]=k=>u.value=null)},{default:l(()=>m[10]||(m[10]=[W("Cancel")])),_:1}),i(o(Bt),{class:"border bg-red-600 hover:bg-red-700",onClick:b},{default:l(()=>m[11]||(m[11]=[W(" Delete ")])),_:1})]),_:1})]),_:1})]),_:1},8,["open"])]))}}}),No=D({__name:"CardFooter",props:{class:{}},setup(e){const t=e;return(s,r)=>(S(),B("div",{"data-slot":"card-footer",class:j(o(z)("flex items-center px-6 [.border-t]:pt-6",t.class))},[R(s.$slots,"default")],2))}}),Po=D({__name:"CardHeader",props:{class:{}},setup(e){const t=e;return(s,r)=>(S(),B("div",{"data-slot":"card-header",class:j(o(z)("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",t.class))},[R(s.$slots,"default")],2))}}),Oo=D({__name:"CardTitle",props:{class:{}},setup(e){const t=e;return(s,r)=>(S(),B("h3",{"data-slot":"card-title",class:j(o(z)("leading-none font-semibold",t.class))},[R(s.$slots,"default")],2))}}),Ro={class:"flex flex-col items-center"},Ho={class:"w-full"},Fo={class:"flex items-center justify-between rounded-md bg-card py-4"},zo=D({__name:"ManagementConnection",props:{connections:{},workspaceId:{}},setup(e){const t=O(!1),{createConnection:s}=Ie(),r=Me(),n=O(null),a=()=>{n.value=null,t.value=!0},v=d=>{s(d)},w=d=>{r.updateConnection(d)},u=d=>{n.value=d,t.value=!0},c=d=>{r.onDeleteConnection(d)};return(d,E)=>{const p=L;return S(),B("div",Ro,[I("div",Ho,[I("div",Fo,[E[2]||(E[2]=I("div",null,[I("h1",{class:"text-xl font-medium"},"Management Connections"),I("p",{class:"text-muted-foreground"}," Manage your database connections in one place ")],-1)),i(o(F),{id:"tour-add-connection-btn",size:"sm",variant:"outline",onClick:a},{default:l(()=>[i(p,{name:"lucide:plus",class:"size-4!"}),E[1]||(E[1]=W(" Add Connection "))]),_:1})]),i(Lo,{connections:d.connections,onEdit:u,onDelete:c,onCreate:a},null,8,["connections"]),i(tt,{open:t.value,"editing-connection":n.value,"onUpdate:open":E[0]||(E[0]=g=>t.value=g),onAddNew:v,onUpdate:w,workspaceId:d.workspaceId},null,8,["open","editing-connection","workspaceId"])])])}}}),qo={class:"w-full overflow-x-auto"},Uo=D({__name:"ManagementConnectionModal",props:{open:{},connections:{},workspaceId:{}},emits:["update:open"],setup(e,{emit:t}){const s=t;return(r,n)=>(S(),A(o(ve),{open:!!r.open,"onUpdate:open":n[0]||(n[0]=a=>s("update:open",a))},{default:l(()=>[i(o(we),{class:"w-[95vw]! max-w-[55vw]!"},{default:l(()=>[I("div",qo,[i(zo,{connections:r.connections,"workspace-id":r.workspaceId},null,8,["connections","workspace-id"])])]),_:1})]),_:1},8,["open"]))}}),Ee=D({__name:"AvatarFallback",props:{delayMs:{},asChild:{type:Boolean},as:{},class:{}},setup(e){const t=e,s=oe(()=>{const{class:r,...n}=t;return n});return(r,n)=>(S(),A(o(xo),$e({"data-slot":"avatar-fallback"},s.value,{class:o(z)("bg-muted flex size-full items-center justify-center rounded-full",t.class)}),{default:l(()=>[R(r.$slots,"default")]),_:3},16,["class"]))}}),ot=Symbol();function Le(){const e=Ne(so),t=Ne(ot);if(!e)throw new Error("useFormField should be used within <FormField>");const{name:s}=e,r=t,n={valid:lo(s),isDirty:ao(s),isTouched:io(s),error:ro(s)};return{id:r,name:s,formItemId:`${r}-form-item`,formDescriptionId:`${r}-form-item-description`,formMessageId:`${r}-form-item-message`,...n}}const ke=D({__name:"FormControl",setup(e){const{error:t,formItemId:s,formDescriptionId:r,formMessageId:n}=Le();return(a,v)=>(S(),A(o(Nt),{id:o(s),"data-slot":"form-control","aria-describedby":o(t)?`${o(r)} ${o(n)}`:`${o(r)}`,"aria-invalid":!!o(t)},{default:l(()=>[R(a.$slots,"default")]),_:3},8,["id","aria-describedby","aria-invalid"]))}}),ye=D({__name:"FormItem",props:{class:{}},setup(e){const t=e,s=Pt();return Ot(ot,s),(r,n)=>(S(),B("div",{"data-slot":"form-item",class:j(o(z)("grid gap-2",t.class))},[R(r.$slots,"default")],2))}}),be=D({__name:"FormLabel",props:{for:{},asChild:{type:Boolean},as:{},class:{}},setup(e){const t=e,{error:s,formItemId:r}=Le();return(n,a)=>(S(),A(o(Rt),{"data-slot":"form-label","data-error":!!o(s),class:j(o(z)("data-[error=true]:text-destructive-foreground",t.class)),for:o(r)},{default:l(()=>[R(n.$slots,"default")]),_:3},8,["data-error","class","for"]))}}),Ce=D({__name:"FormMessage",props:{class:{}},setup(e){const t=e,{name:s,formMessageId:r}=Le();return(n,a)=>(S(),A(o(co),{id:o(r),"data-slot":"form-message",as:"p",name:Ht(o(s)),class:j(o(z)("text-destructive-foreground text-sm",t.class))},null,8,["id","name","class"]))}}),nt=["lucide:badge","lucide:building-2","lucide:bone","lucide:book","hugeicons:ai-brain-05","lucide:circle-dashed","lucide:chess-bishop","lucide:chess-king","lucide:chess-pawn","lucide:chess-queen","lucide:chess-rook","lucide:fan","lucide:skull","lucide:ship-wheel","lucide:bug","lucide:hamburger"],pe=nt[0],jo=Ft({name:he({message:"Workspace name is required."}),desc:he().optional(),icon:he().default(pe)});function Vo(e){const t=Ae(),s=uo({validationSchema:po(jo),initialValues:e.workspace?{name:e.workspace.name,desc:e.workspace.desc,icon:e.workspace.icon||pe}:{name:`My workspace ${(e==null?void 0:e.workspaceSeq)||0}`,icon:pe},name:"workspace-form"}),r=s.handleSubmit(n=>{!!e.workspace?(t.updateWorkspace({...e.workspace,desc:(n==null?void 0:n.desc)||void 0,name:n.name,icon:n.icon}),Pe("Workspace has been updated",{description:Q().toString()})):(t.createWorkspace({desc:(n==null?void 0:n.desc)||void 0,id:Qe(),name:n.name,icon:n.icon,createdAt:Q().toISOString()}),Pe("Workspace has been created",{description:Q().toString()})),e.onClose()});return{form:s,onSubmit:r}}const Ko={class:"grid grid-cols-8 gap-2"},st=D({__name:"CreateWorkspaceModal",props:{open:{},workspace:{},workspaceSeq:{}},emits:["update:open"],setup(e,{emit:t}){const s=e,r=t,n=()=>{r("update:open",!1)},{onSubmit:a}=Vo({workspace:s.workspace,workspaceSeq:s.workspaceSeq,onClose:n});return(v,w)=>{const u=L;return S(),A(o(ve),{open:!!v.open,"onUpdate:open":w[1]||(w[1]=c=>r("update:open",c))},{default:l(()=>[i(o(we),null,{default:l(()=>[i(o(Be),null,{default:l(()=>[i(o(De),null,{default:l(()=>[W(U(v.workspace?"Update workspace":"New workspace"),1)]),_:1})]),_:1}),I("form",{class:"space-y-4",onSubmit:w[0]||(w[0]=(...c)=>o(a)&&o(a)(...c))},[i(o(_e),{name:"icon"},{default:l(({componentField:c})=>[i(o(ye),null,{default:l(()=>[i(o(be),null,{default:l(()=>w[2]||(w[2]=[W("Icon")])),_:1}),i(o(ke),null,{default:l(()=>[i(o(mo),null,{default:l(()=>[i(o(fo),{"as-child":""},{default:l(()=>[i(o(Se),{id:"tour-workspace-icon",class:"cursor-pointer focus:ring-2 focus:ring-primary focus:outline-none",tabindex:"0",role:"button","aria-label":"Select workspace icon"},{default:l(()=>[i(o(Ee),null,{default:l(()=>[i(u,{name:c.modelValue||"hugeicons:folder-01",class:"size-5!"},null,8,["name"])]),_:2},1024)]),_:2},1024)]),_:2},1024),i(o(vo),{class:"w-full p-4"},{default:l(()=>[I("div",Ko,[(S(!0),B(Y,null,ne(o(nt),d=>(S(),A(o(Se),{onClick:E=>c.onChange(d),key:d,class:"cursor-pointer"},{default:l(()=>[i(o(Ee),null,{default:l(()=>[i(u,{name:d,class:"size-5!"},null,8,["name"])]),_:2},1024)]),_:2},1032,["onClick"]))),128))])]),_:2},1024)]),_:2},1024)]),_:2},1024),i(o(Ce))]),_:2},1024)]),_:1}),i(o(_e),{name:"name"},{default:l(({componentField:c})=>[i(o(ye),null,{default:l(()=>[i(o(be),{class:"gap-1"},{default:l(()=>w[3]||(w[3]=[W("Name "),I("span",{class:"text-red-500"},"*",-1)])),_:1}),i(o(ke),null,{default:l(()=>[i(o(Je),$e({id:"tour-workspace-name",type:"text",placeholder:"Workspace name"},c),null,16)]),_:2},1024),i(o(Ce))]),_:2},1024)]),_:1}),i(o(_e),{name:"desc"},{default:l(({componentField:c})=>[i(o(ye),null,{default:l(()=>[i(o(be),null,{default:l(()=>w[4]||(w[4]=[W("Description")])),_:1}),i(o(ke),null,{default:l(()=>[i(o(ho),$e({id:"tour-workspace-desc",placeholder:"Workspace description ..."},c),null,16)]),_:2},1024),i(o(Ce))]),_:2},1024)]),_:1}),i(o(Xe),{class:"mt-4"},{default:l(()=>[i(o(F),{id:"tour-workspace-create",type:"submit"},{default:l(()=>[W(U(v.workspace?"Update":"Create"),1)]),_:1})]),_:1})],32)]),_:1})]),_:1},8,["open"])}}}),Yo=D({__name:"RestoreDataModal",props:{open:{type:Boolean}},emits:["update:open"],setup(e,{emit:t}){const s=t,r=O(null),n=()=>{var a;r.value&&!r.value.canClose()||((a=r.value)==null||a.resetState(),s("update:open",!1))};return(a,v)=>{const w=L;return S(),A(o(ve),{open:a.open,"onUpdate:open":n},{default:l(()=>[i(o(we),{class:"sm:max-w-2xl flex flex-col"},{default:l(()=>[i(o(Be),null,{default:l(()=>[i(o(De),{class:"flex items-center gap-2"},{default:l(()=>[i(w,{name:"hugeicons:file-download",class:"size-4!"}),v[0]||(v[0]=W(" Restore Data "))]),_:1})]),_:1}),i(o(zt),{ref_key:"importPanelRef",ref:r,layout:"modal","success-action-label":"Close","success-action-mode":"emit",onSuccessAction:n},null,512)]),_:1})]),_:1},8,["open"])}}});var ue={exports:{}},Go=ue.exports,Re;function Qo(){return Re||(Re=1,function(e,t){(function(s,r){e.exports=r()})(Go,function(){return function(s,r,n){s=s||{};var a=r.prototype,v={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function w(c,d,E,p){return a.fromToBase(c,d,E,p)}n.en.relativeTime=v,a.fromToBase=function(c,d,E,p,g){for(var f,$,b,C=E.$locale().relativeTime||v,_=s.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],m=_.length,x=0;x<m;x+=1){var k=_[x];k.d&&(f=p?n(c).diff(E,k.d,!0):E.diff(c,k.d,!0));var T=(s.rounding||Math.round)(Math.abs(f));if(b=f>0,T<=k.r||!k.r){T<=1&&x>0&&(k=_[x-1]);var P=C[k.l];g&&(T=g(""+T)),$=typeof P=="string"?P.replace("%d",T):P(T,d,k.l,b);break}}if(d)return $;var q=b?C.future:C.past;return typeof q=="function"?q($):q.replace("%s",$)},a.to=function(c,d){return w(c,d,this,!0)},a.from=function(c,d){return w(c,d,this)};var u=function(c){return c.$u?n.utc():n()};a.toNow=function(c){return this.to(u(this),c)},a.fromNow=function(c){return this.from(u(this),c)}}})}(ue)),ue.exports}var Jo=Qo();const Xo=qt(Jo);function Zo(e){const{createConnection:t,openWorkspaceWithConnection:s}=Ie(),r=Ae(),n=Me(),{checkAndConfirm:a}=Ve(),v=O(!1),w=O(!1),u=O(!1),c=O(),d=O(!1),E=()=>{w.value=!1,r.deleteWorkspace(e.workspace.id)},p=oe(()=>n.getConnectionsByWorkspaceId(e.workspace.id));return{workspaceStore:r,isOpenEditModal:v,isOpenDeleteModal:w,isOpenConnectionSelector:u,dropdownTriggerRef:c,isModalCreateConnectionOpen:d,connections:p,onConfirmDelete:E,onOpenWorkspace:()=>{var C;(C=e.onSelectWorkspace)==null||C.call(e,e.workspace.id)},onOpenConnectionSelector:()=>{u.value=!0},onOpenWorkspaceWithConnection:async C=>{u.value=!1;const _=p.value.find(m=>m.id===C);_&&!await a(_)||await s({connId:C,wsId:e.workspace.id})},handleAddConnection:C=>{t(C)}}}const en=D({__name:"DeleteWorkspaceModal",props:{open:{},onConfirm:{type:Function}},emits:["update:open"],setup(e,{emit:t}){const s=t;return(r,n)=>{const a=F,v=we;return S(),A(o(ve),{open:!!r.open,"onUpdate:open":n[0]||(n[0]=w=>s("update:open",w))},{default:l(()=>[i(v,null,{default:l(()=>[i(o(Be),null,{default:l(()=>[i(o(De),null,{default:l(()=>n[1]||(n[1]=[W("Delete workspace")])),_:1}),i(o(Ut),null,{default:l(()=>n[2]||(n[2]=[W(" Are you sure you want to delete this workspace? "),I("br",null,null,-1),W(" All data will be permanently deleted this action cannot be undone. ")])),_:1})]),_:1}),i(o(Xe),null,{default:l(()=>[i(a,{type:"submit",onClick:r.onConfirm,variant:"default"},{default:l(()=>n[3]||(n[3]=[W(" Delete ")])),_:1},8,["onClick"])]),_:1})]),_:1})]),_:1},8,["open"])}}}),tn={class:"flex items-center space-x-2"},on={class:"space-y-1"},nn={class:"text-sm line-clamp-2 break-words break-all text-left"},sn={class:"flex items-center pt-2"},rn={class:"text-xs text-muted-foreground"},an={class:"flex items-center pt-2"},ln={key:0,class:"text-xs text-muted-foreground"},dn={key:1,class:"text-xs text-muted-foreground"},cn={class:"flex items-center pt-2"},un={class:"text-xs text-muted-foreground"},pn={class:"flex items-center gap-1"},mn={class:"flex items-center gap-2 min-w-0"},fn={class:"truncate"},vn={key:0,class:"flex items-center gap-1 ml-auto flex-shrink-0"},wn={key:1,class:"ml-auto text-xs text-muted-foreground"},gn=D({__name:"WorkspaceCard",props:{workspace:{},onOpenWorkspace:{type:Function}},emits:["onSelectWorkspace"],setup(e,{emit:t}){Q.extend(Xo);const s=je(),r=We(),n=oe(()=>Ze(r.public.sqlite3ConnectionsEnabled)),a=e,v=t,{workspaceStore:w,isOpenEditModal:u,isOpenDeleteModal:c,isOpenConnectionSelector:d,dropdownTriggerRef:E,isModalCreateConnectionOpen:p,connections:g,onConfirmDelete:f,onOpenWorkspace:$,onOpenConnectionSelector:b,onOpenWorkspaceWithConnection:C,handleAddConnection:_}=Zo({workspace:a.workspace,onSelectWorkspace:m=>v("onSelectWorkspace",m)});return(m,x)=>{const k=Ee,T=Se,P=ko,q=bo,X=yo,Z=_o,G=Gt,ee=Yt;return S(),B(Y,null,[o(p)?(S(),A(o(tt),{key:0,open:o(p),"editing-connection":null,"onUpdate:open":x[0]||(x[0]=M=>p.value=M),onAddNew:o(_),workspaceId:m.workspace.id},null,8,["open","onAddNew","workspaceId"])):V("",!0),o(u)?(S(),A(st,{key:1,open:o(u),"onUpdate:open":x[1]||(x[1]=M=>te(u)?u.value=M:null),workspace:m.workspace,workspaceSeq:o(w).workspaces.length},null,8,["open","workspace","workspaceSeq"])):V("",!0),o(c)?(S(),A(en,{key:2,open:o(c),"onUpdate:open":x[2]||(x[2]=M=>te(c)?c.value=M:null),onConfirm:o(f)},null,8,["open","onConfirm"])):V("",!0),i(o(go),{class:"gap-4 justify-between!"},{default:l(()=>[i(o(Po),{class:"flex justify-between px-4"},{default:l(()=>[I("div",tn,[i(T,null,{default:l(()=>[i(k,null,{default:l(()=>[i(o(L),{name:m.workspace.icon,class:"size-5!"},null,8,["name"])]),_:1})]),_:1}),I("div",null,[i(o(Oo),{class:"line-clamp-1"},{default:l(()=>[W(U(m.workspace.name),1)]),_:1})])]),i(Z,null,{default:l(()=>[i(P,null,{default:l(()=>[i(o(F),{size:"icon",variant:"ghost"},{default:l(()=>[i(o(L),{name:"hugeicons:more-vertical-circle-01",class:"size-4!"})]),_:1})]),_:1}),i(X,null,{default:l(()=>[i(q,{class:"cursor-pointer flex items-center",onClick:x[3]||(x[3]=M=>u.value=!0)},{default:l(()=>[i(o(L),{name:"hugeicons:pencil-edit-02",class:"size-4! min-w-4"}),x[9]||(x[9]=W(" Edit workspace "))]),_:1}),i(q,{class:"cursor-pointer flex items-center",disabled:""},{default:l(()=>[i(o(L),{name:"hugeicons:link-04",class:"size-4! min-w-4"}),x[10]||(x[10]=W(" Invite "))]),_:1}),i(q,{class:"cursor-pointer flex items-center",onClick:x[4]||(x[4]=M=>c.value=!0)},{default:l(()=>[i(o(L),{name:"hugeicons:delete-02",class:"size-4! min-w-4"}),x[11]||(x[11]=W(" Delete workspace "))]),_:1})]),_:1})]),_:1})]),_:1}),i(o(wo),{class:"grid gap-4 overflow-hidden px-4"},{default:l(()=>[I("div",on,[I("p",nn,U(m.workspace.desc),1),I("div",sn,[i(o(L),{name:"hugeicons:connect",class:"mr-2 h-4 w-4 opacity-70"}),I("span",rn," Connection : "+U(o(g).length),1)]),I("div",an,[i(o(L),{name:"hugeicons:clock-05",class:"mr-2 h-4 w-4 opacity-70"}),m.workspace.lastOpened?(S(),B("span",ln," Last opened : "+U(o(Q)(m.workspace.lastOpened).fromNow()),1)):(S(),B("span",dn," Last opened : -/- "))]),I("div",cn,[i(o(L),{name:"hugeicons:clock-01",class:"mr-2 h-4 w-4 opacity-70"}),I("span",un," Created : "+U(o(Q)(m.workspace.createdAt).fromNow()),1)])])]),_:1}),i(o(No),{class:"px-4"},{default:l(()=>[i(o(jt),{open:o(d),"onUpdate:open":x[8]||(x[8]=M=>te(d)?d.value=M:null)},{default:l(()=>[i(o(F),{id:`tour-open-workspace-${m.workspace.id}`,ref_key:"dropdownTriggerRef",ref:E,variant:"default",class:"w-full flex items-center justify-between",onClick:x[6]||(x[6]=M=>o($)()),size:"sm"},{default:l(()=>[I("div",pn,[i(o(L),{name:"hugeicons:square-arrow-up-right",class:"h-4 w-4"}),x[12]||(x[12]=W(" Open workspace "))]),i(o(F),{size:"iconSm",variant:"ghost",onClick:x[5]||(x[5]=Vt(M=>o(b)(),["stop"]))},{default:l(()=>[i(o(L),{name:"hugeicons:arrow-down-01",class:"size-5!"})]),_:1})]),_:1},8,["id"]),i(o(Kt),{reference:o(E)},{default:l(()=>[i(ee,null,{default:l(()=>[I("div",{class:"flex px-2 py-0.5 h-8 hover:bg-muted rounded-md font-normal text-sm items-center gap-1 cursor-pointer",onClick:x[7]||(x[7]=M=>p.value=!0)},[i(o(L),{name:"hugeicons:plus-sign"}),x[13]||(x[13]=W(" Add new connection "))]),o(g).length?(S(),A(G,{key:0})):V("",!0),(S(!0),B(Y,null,ne(o(g),M=>(S(),A(o(Qt),{class:"cursor-pointer",value:M.id,key:M.id,disabled:o(se)(M,o(n)),onSelect:K=>o(C)(M.id)},{default:l(()=>{var K;return[I("div",mn,[(S(),A(Ye((K=o(et)(M.type))==null?void 0:K.icon),{class:"size-4! shrink-0"})),I("span",fn,U(M.name),1),(M.tagIds??[]).length?(S(),B("div",vn,[(S(!0),B(Y,null,ne(o(s).getTagsByIds(M.tagIds??[]),ie=>(S(),A(o(Ge),{key:ie.id,tag:ie},null,8,["tag"]))),128))])):V("",!0),o(se)(M,o(n))?(S(),B("span",wn," Disabled ")):V("",!0)])]}),_:2},1032,["value","disabled","onSelect"]))),128))]),_:1})]),_:1},8,["reference"])]),_:1},8,["open"])]),_:1})]),_:1})],64)}}}),hn={class:"flex items-center justify-between mt-2"},_n={class:"container flex flex-col items-start gap-1 py-2"},kn={class:"text-3xl flex items-center gap-2 font-bold leading-tight tracking-tighter lg:leading-[1.1]"},yn={class:"flex items-center gap-2 shrink-0"},bn=D({__name:"WorkspaceHeader",props:{isShowButtonCreate:{type:Boolean},isShowButtonRestore:{type:Boolean}},emits:["create","restore"],setup(e,{emit:t}){const s=t;return(r,n)=>{const a=L;return S(),B("div",hn,[I("div",_n,[I("h1",kn,[n[2]||(n[2]=W(" Hello ")),i(a,{name:"hugeicons:waving-hand-01"})]),n[3]||(n[3]=I("p",{class:"max-w-2xl text-lg font-light text-foreground"}," Welcome to your workspaces ",-1))]),I("div",yn,[r.isShowButtonRestore?(S(),A(o(F),{key:0,type:"button",variant:"outline",size:"sm",onClick:n[0]||(n[0]=v=>s("restore"))},{default:l(()=>[i(a,{name:"lucide:upload"}),n[4]||(n[4]=W(" Restore Data "))]),_:1})):V("",!0),r.isShowButtonCreate?(S(),A(o(F),{key:1,id:"tour-new-workspace-btn",variant:"outline",size:"sm",onClick:n[1]||(n[1]=v=>s("create"))},{default:l(()=>[i(a,{name:"lucide:plus"}),n[5]||(n[5]=W(" New Workspace "))]),_:1})):V("",!0)])])}}});let Te={},rt;function xe(e={}){Te={animate:!0,allowClose:!0,overlayClickBehavior:"close",overlayOpacity:.7,smoothScroll:!1,disableActiveInteraction:!1,showProgress:!1,stagePadding:10,stageRadius:5,popoverOffset:10,showButtons:["next","previous","close"],disableButtons:[],overlayColor:"#000",...e}}function h(e){return e?Te[e]:Te}function Cn(e){rt=e}function H(){return rt}let me={};function de(e,t){me[e]=t}function J(e){var t;(t=me[e])==null||t.call(me)}function xn(){me={}}function ce(e,t,s,r){return(e/=r/2)<1?s/2*e*e+t:-s/2*(--e*(e-2)-1)+t}function it(e){const t='a[href]:not([disabled]), button:not([disabled]), textarea:not([disabled]), input[type="text"]:not([disabled]), input[type="radio"]:not([disabled]), input[type="checkbox"]:not([disabled]), select:not([disabled])';return e.flatMap(s=>{const r=s.matches(t),n=Array.from(s.querySelectorAll(t));return[...r?[s]:[],...n]}).filter(s=>getComputedStyle(s).pointerEvents!=="none"&&En(s))}function at(e){if(!e||Sn(e))return;const t=h("smoothScroll"),s=e.offsetHeight>window.innerHeight;e.scrollIntoView({behavior:!t||$n(e)?"auto":"smooth",inline:"center",block:s?"start":"center"})}function $n(e){if(!e||!e.parentElement)return;const t=e.parentElement;return t.scrollHeight>t.clientHeight}function Sn(e){const t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)}function En(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)}let fe={};function N(e,t){fe[e]=t}function y(e){return e?fe[e]:fe}function He(){fe={}}function Tn(e,t,s,r){let n=y("__activeStagePosition");const a=n||s.getBoundingClientRect(),v=r.getBoundingClientRect(),w=ce(e,a.x,v.x-a.x,t),u=ce(e,a.y,v.y-a.y,t),c=ce(e,a.width,v.width-a.width,t),d=ce(e,a.height,v.height-a.height,t);n={x:w,y:u,width:c,height:d},dt(n),N("__activeStagePosition",n)}function lt(e){if(!e)return;const t=e.getBoundingClientRect(),s={x:t.x,y:t.y,width:t.width,height:t.height};N("__activeStagePosition",s),dt(s)}function In(){const e=y("__activeStagePosition"),t=y("__overlaySvg");if(!e)return;if(!t){console.warn("No stage svg found.");return}const s=window.innerWidth,r=window.innerHeight;t.setAttribute("viewBox",`0 0 ${s} ${r}`)}function Wn(e){const t=Mn(e);document.body.appendChild(t),pt(t,s=>{s.target.tagName==="path"&&J("overlayClick")}),N("__overlaySvg",t)}function dt(e){const t=y("__overlaySvg");if(!t){Wn(e);return}const s=t.firstElementChild;if((s==null?void 0:s.tagName)!=="path")throw new Error("no path element found in stage svg");s.setAttribute("d",ct(e))}function Mn(e){const t=window.innerWidth,s=window.innerHeight,r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.classList.add("driver-overlay","driver-overlay-animated"),r.setAttribute("viewBox",`0 0 ${t} ${s}`),r.setAttribute("xmlSpace","preserve"),r.setAttribute("xmlnsXlink","http://www.w3.org/1999/xlink"),r.setAttribute("version","1.1"),r.setAttribute("preserveAspectRatio","xMinYMin slice"),r.style.fillRule="evenodd",r.style.clipRule="evenodd",r.style.strokeLinejoin="round",r.style.strokeMiterlimit="2",r.style.zIndex="10000",r.style.position="fixed",r.style.top="0",r.style.left="0",r.style.width="100%",r.style.height="100%";const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d",ct(e)),n.style.fill=h("overlayColor")||"rgb(0,0,0)",n.style.opacity=`${h("overlayOpacity")}`,n.style.pointerEvents="auto",n.style.cursor="auto",r.appendChild(n),r}function ct(e){const t=window.innerWidth,s=window.innerHeight,r=h("stagePadding")||0,n=h("stageRadius")||0,a=e.width+r*2,v=e.height+r*2,w=Math.min(n,a/2,v/2),u=Math.floor(Math.max(w,0)),c=e.x-r+u,d=e.y-r,E=a-u*2,p=v-u*2;return`M${t},0L0,0L0,${s}L${t},${s}L${t},0Z
|
|
2
|
-
M${c},${d} h${E} a${u},${u} 0 0 1 ${u},${u} v${p} a${u},${u} 0 0 1 -${u},${u} h-${E} a${u},${u} 0 0 1 -${u},-${u} v-${p} a${u},${u} 0 0 1 ${u},-${u} z`}function An(){const e=y("__overlaySvg");e&&e.remove()}function Bn(){const e=document.getElementById("driver-dummy-element");if(e)return e;let t=document.createElement("div");return t.id="driver-dummy-element",t.style.width="0",t.style.height="0",t.style.pointerEvents="none",t.style.opacity="0",t.style.position="fixed",t.style.top="50%",t.style.left="50%",document.body.appendChild(t),t}function Fe(e){const{element:t}=e;let s=typeof t=="function"?t():typeof t=="string"?document.querySelector(t):t;s||(s=Bn()),Ln(s,e)}function Dn(){const e=y("__activeElement"),t=y("__activeStep");e&&(lt(e),In(),ft(e,t))}function Ln(e,t){var s;const r=Date.now(),n=y("__activeStep"),a=y("__activeElement")||e,v=!a||a===e,w=e.id==="driver-dummy-element",u=a.id==="driver-dummy-element",c=h("animate"),d=t.onHighlightStarted||h("onHighlightStarted"),E=(t==null?void 0:t.onHighlighted)||h("onHighlighted"),p=(n==null?void 0:n.onDeselected)||h("onDeselected"),g=h(),f=y();!v&&p&&p(u?void 0:a,n,{config:g,state:f,driver:H()}),d&&d(w?void 0:e,t,{config:g,state:f,driver:H()});const $=!v&&c;let b=!1;Hn(),N("previousStep",n),N("previousElement",a),N("activeStep",t),N("activeElement",e);const C=()=>{if(y("__transitionCallback")!==C)return;const _=Date.now()-r,m=400-_<=400/2;t.popover&&m&&!b&&$&&(ze(e,t),b=!0),h("animate")&&_<400?Tn(_,400,a,e):(lt(e),E&&E(w?void 0:e,t,{config:h(),state:y(),driver:H()}),N("__transitionCallback",void 0),N("__previousStep",n),N("__previousElement",a),N("__activeStep",t),N("__activeElement",e)),window.requestAnimationFrame(C)};N("__transitionCallback",C),window.requestAnimationFrame(C),at(e),!$&&t.popover&&ze(e,t),a.classList.remove("driver-active-element","driver-no-interaction"),a.removeAttribute("aria-haspopup"),a.removeAttribute("aria-expanded"),a.removeAttribute("aria-controls"),((s=t.disableActiveInteraction)!=null?s:h("disableActiveInteraction"))&&e.classList.add("driver-no-interaction"),e.classList.add("driver-active-element"),e.setAttribute("aria-haspopup","dialog"),e.setAttribute("aria-expanded","true"),e.setAttribute("aria-controls","driver-popover-content")}function Nn(){var e;(e=document.getElementById("driver-dummy-element"))==null||e.remove(),document.querySelectorAll(".driver-active-element").forEach(t=>{t.classList.remove("driver-active-element","driver-no-interaction"),t.removeAttribute("aria-haspopup"),t.removeAttribute("aria-expanded"),t.removeAttribute("aria-controls")})}function re(){const e=y("__resizeTimeout");e&&window.cancelAnimationFrame(e),N("__resizeTimeout",window.requestAnimationFrame(Dn))}function Pn(e){var t;if(!y("isInitialized")||!(e.key==="Tab"||e.keyCode===9))return;const s=y("__activeElement"),r=(t=y("popover"))==null?void 0:t.wrapper,n=it([...r?[r]:[],...s?[s]:[]]),a=n[0],v=n[n.length-1];if(e.preventDefault(),e.shiftKey){const w=n[n.indexOf(document.activeElement)-1]||v;w==null||w.focus()}else{const w=n[n.indexOf(document.activeElement)+1]||a;w==null||w.focus()}}function ut(e){var t;((t=h("allowKeyboardControl"))==null||t)&&(e.key==="Escape"?J("escapePress"):e.key==="ArrowRight"?J("arrowRightPress"):e.key==="ArrowLeft"&&J("arrowLeftPress"))}function pt(e,t,s){const r=(n,a)=>{const v=n.target;e.contains(v)&&((!s||s(v))&&(n.preventDefault(),n.stopPropagation(),n.stopImmediatePropagation()),a==null||a(n))};document.addEventListener("pointerdown",r,!0),document.addEventListener("mousedown",r,!0),document.addEventListener("pointerup",r,!0),document.addEventListener("mouseup",r,!0),document.addEventListener("click",n=>{r(n,t)},!0)}function On(){window.addEventListener("keyup",ut,!1),window.addEventListener("keydown",Pn,!1),window.addEventListener("resize",re),window.addEventListener("scroll",re)}function Rn(){window.removeEventListener("keyup",ut),window.removeEventListener("resize",re),window.removeEventListener("scroll",re)}function Hn(){const e=y("popover");e&&(e.wrapper.style.display="none")}function ze(e,t){var s,r;let n=y("popover");n&&document.body.removeChild(n.wrapper),n=zn(),document.body.appendChild(n.wrapper);const{title:a,description:v,showButtons:w,disableButtons:u,showProgress:c,nextBtnText:d=h("nextBtnText")||"Next →",prevBtnText:E=h("prevBtnText")||"← Previous",progressText:p=h("progressText")||"{current} of {total}"}=t.popover||{};n.nextButton.innerHTML=d,n.previousButton.innerHTML=E,n.progress.innerHTML=p,a?(n.title.innerHTML=a,n.title.style.display="block"):n.title.style.display="none",v?(n.description.innerHTML=v,n.description.style.display="block"):n.description.style.display="none";const g=w||h("showButtons"),f=c||h("showProgress")||!1,$=(g==null?void 0:g.includes("next"))||(g==null?void 0:g.includes("previous"))||f;n.closeButton.style.display=g.includes("close")?"block":"none",$?(n.footer.style.display="flex",n.progress.style.display=f?"block":"none",n.nextButton.style.display=g.includes("next")?"block":"none",n.previousButton.style.display=g.includes("previous")?"block":"none"):n.footer.style.display="none";const b=u||h("disableButtons")||[];b!=null&&b.includes("next")&&(n.nextButton.disabled=!0,n.nextButton.classList.add("driver-popover-btn-disabled")),b!=null&&b.includes("previous")&&(n.previousButton.disabled=!0,n.previousButton.classList.add("driver-popover-btn-disabled")),b!=null&&b.includes("close")&&(n.closeButton.disabled=!0,n.closeButton.classList.add("driver-popover-btn-disabled"));const C=n.wrapper;C.style.display="block",C.style.left="",C.style.top="",C.style.bottom="",C.style.right="",C.id="driver-popover-content",C.setAttribute("role","dialog"),C.setAttribute("aria-labelledby","driver-popover-title"),C.setAttribute("aria-describedby","driver-popover-description");const _=n.arrow;_.className="driver-popover-arrow";const m=((s=t.popover)==null?void 0:s.popoverClass)||h("popoverClass")||"";C.className=`driver-popover ${m}`.trim(),pt(n.wrapper,P=>{var q,X,Z;const G=P.target,ee=((q=t.popover)==null?void 0:q.onNextClick)||h("onNextClick"),M=((X=t.popover)==null?void 0:X.onPrevClick)||h("onPrevClick"),K=((Z=t.popover)==null?void 0:Z.onCloseClick)||h("onCloseClick");if(G.closest(".driver-popover-next-btn"))return ee?ee(e,t,{config:h(),state:y(),driver:H()}):J("nextClick");if(G.closest(".driver-popover-prev-btn"))return M?M(e,t,{config:h(),state:y(),driver:H()}):J("prevClick");if(G.closest(".driver-popover-close-btn"))return K?K(e,t,{config:h(),state:y(),driver:H()}):J("closeClick")},P=>!(n!=null&&n.description.contains(P))&&!(n!=null&&n.title.contains(P))&&typeof P.className=="string"&&P.className.includes("driver-popover")),N("popover",n);const x=((r=t.popover)==null?void 0:r.onPopoverRender)||h("onPopoverRender");x&&x(n,{config:h(),state:y(),driver:H()}),ft(e,t),at(C);const k=e.classList.contains("driver-dummy-element"),T=it([C,...k?[]:[e]]);T.length>0&&T[0].focus()}function mt(){const e=y("popover");if(!(e!=null&&e.wrapper))return;const t=e.wrapper.getBoundingClientRect(),s=h("stagePadding")||0,r=h("popoverOffset")||0;return{width:t.width+s+r,height:t.height+s+r,realWidth:t.width,realHeight:t.height}}function qe(e,t){const{elementDimensions:s,popoverDimensions:r,popoverPadding:n,popoverArrowDimensions:a}=t;return e==="start"?Math.max(Math.min(s.top-n,window.innerHeight-r.realHeight-a.width),a.width):e==="end"?Math.max(Math.min(s.top-(r==null?void 0:r.realHeight)+s.height+n,window.innerHeight-(r==null?void 0:r.realHeight)-a.width),a.width):e==="center"?Math.max(Math.min(s.top+s.height/2-(r==null?void 0:r.realHeight)/2,window.innerHeight-(r==null?void 0:r.realHeight)-a.width),a.width):0}function Ue(e,t){const{elementDimensions:s,popoverDimensions:r,popoverPadding:n,popoverArrowDimensions:a}=t;return e==="start"?Math.max(Math.min(s.left-n,window.innerWidth-r.realWidth-a.width),a.width):e==="end"?Math.max(Math.min(s.left-(r==null?void 0:r.realWidth)+s.width+n,window.innerWidth-(r==null?void 0:r.realWidth)-a.width),a.width):e==="center"?Math.max(Math.min(s.left+s.width/2-(r==null?void 0:r.realWidth)/2,window.innerWidth-(r==null?void 0:r.realWidth)-a.width),a.width):0}function ft(e,t){const s=y("popover");if(!s)return;const{align:r="start",side:n="left"}=(t==null?void 0:t.popover)||{},a=r,v=e.id==="driver-dummy-element"?"over":n,w=h("stagePadding")||0,u=mt(),c=s.arrow.getBoundingClientRect(),d=e.getBoundingClientRect(),E=d.top-u.height;let p=E>=0;const g=window.innerHeight-(d.bottom+u.height);let f=g>=0;const $=d.left-u.width;let b=$>=0;const C=window.innerWidth-(d.right+u.width);let _=C>=0;const m=!p&&!f&&!b&&!_;let x=v;if(v==="top"&&p?_=b=f=!1:v==="bottom"&&f?_=b=p=!1:v==="left"&&b?_=p=f=!1:v==="right"&&_&&(b=p=f=!1),v==="over"){const k=window.innerWidth/2-u.realWidth/2,T=window.innerHeight/2-u.realHeight/2;s.wrapper.style.left=`${k}px`,s.wrapper.style.right="auto",s.wrapper.style.top=`${T}px`,s.wrapper.style.bottom="auto"}else if(m){const k=window.innerWidth/2-(u==null?void 0:u.realWidth)/2,T=10;s.wrapper.style.left=`${k}px`,s.wrapper.style.right="auto",s.wrapper.style.bottom=`${T}px`,s.wrapper.style.top="auto"}else if(b){const k=Math.min($,window.innerWidth-(u==null?void 0:u.realWidth)-c.width),T=qe(a,{elementDimensions:d,popoverDimensions:u,popoverPadding:w,popoverArrowDimensions:c});s.wrapper.style.left=`${k}px`,s.wrapper.style.top=`${T}px`,s.wrapper.style.bottom="auto",s.wrapper.style.right="auto",x="left"}else if(_){const k=Math.min(C,window.innerWidth-(u==null?void 0:u.realWidth)-c.width),T=qe(a,{elementDimensions:d,popoverDimensions:u,popoverPadding:w,popoverArrowDimensions:c});s.wrapper.style.right=`${k}px`,s.wrapper.style.top=`${T}px`,s.wrapper.style.bottom="auto",s.wrapper.style.left="auto",x="right"}else if(p){const k=Math.min(E,window.innerHeight-u.realHeight-c.width);let T=Ue(a,{elementDimensions:d,popoverDimensions:u,popoverPadding:w,popoverArrowDimensions:c});s.wrapper.style.top=`${k}px`,s.wrapper.style.left=`${T}px`,s.wrapper.style.bottom="auto",s.wrapper.style.right="auto",x="top"}else if(f){const k=Math.min(g,window.innerHeight-(u==null?void 0:u.realHeight)-c.width);let T=Ue(a,{elementDimensions:d,popoverDimensions:u,popoverPadding:w,popoverArrowDimensions:c});s.wrapper.style.left=`${T}px`,s.wrapper.style.bottom=`${k}px`,s.wrapper.style.top="auto",s.wrapper.style.right="auto",x="bottom"}m?s.arrow.classList.add("driver-popover-arrow-none"):Fn(a,x,e)}function Fn(e,t,s){const r=y("popover");if(!r)return;const n=s.getBoundingClientRect(),a=mt(),v=r.arrow,w=a.width,u=window.innerWidth,c=n.width,d=n.left,E=a.height,p=window.innerHeight,g=n.top,f=n.height;v.className="driver-popover-arrow";let $=t,b=e;if(t==="top"?(d+c<=0?($="right",b="end"):d+c-w<=0&&($="top",b="start"),d>=u?($="left",b="end"):d+w>=u&&($="top",b="end")):t==="bottom"?(d+c<=0?($="right",b="start"):d+c-w<=0&&($="bottom",b="start"),d>=u?($="left",b="start"):d+w>=u&&($="bottom",b="end")):t==="left"?(g+f<=0?($="bottom",b="end"):g+f-E<=0&&($="left",b="start"),g>=p?($="top",b="end"):g+E>=p&&($="left",b="end")):t==="right"&&(g+f<=0?($="bottom",b="start"):g+f-E<=0&&($="right",b="start"),g>=p?($="top",b="start"):g+E>=p&&($="right",b="end")),!$)v.classList.add("driver-popover-arrow-none");else{v.classList.add(`driver-popover-arrow-side-${$}`),v.classList.add(`driver-popover-arrow-align-${b}`);const C=s.getBoundingClientRect(),_=v.getBoundingClientRect(),m=h("stagePadding")||0,x=C.left-m<window.innerWidth&&C.right+m>0&&C.top-m<window.innerHeight&&C.bottom+m>0;t==="bottom"&&x&&(_.x>C.x&&_.x+_.width<C.x+C.width?r.wrapper.style.transform="translateY(0)":(v.classList.remove(`driver-popover-arrow-align-${b}`),v.classList.add("driver-popover-arrow-none"),r.wrapper.style.transform=`translateY(-${m/2}px)`))}}function zn(){const e=document.createElement("div");e.classList.add("driver-popover");const t=document.createElement("div");t.classList.add("driver-popover-arrow");const s=document.createElement("header");s.id="driver-popover-title",s.classList.add("driver-popover-title"),s.style.display="none",s.innerText="Popover Title";const r=document.createElement("div");r.id="driver-popover-description",r.classList.add("driver-popover-description"),r.style.display="none",r.innerText="Popover description is here";const n=document.createElement("button");n.type="button",n.classList.add("driver-popover-close-btn"),n.setAttribute("aria-label","Close"),n.innerHTML="×";const a=document.createElement("footer");a.classList.add("driver-popover-footer");const v=document.createElement("span");v.classList.add("driver-popover-progress-text"),v.innerText="";const w=document.createElement("span");w.classList.add("driver-popover-navigation-btns");const u=document.createElement("button");u.type="button",u.classList.add("driver-popover-prev-btn"),u.innerHTML="← Previous";const c=document.createElement("button");return c.type="button",c.classList.add("driver-popover-next-btn"),c.innerHTML="Next →",w.appendChild(u),w.appendChild(c),a.appendChild(v),a.appendChild(w),e.appendChild(n),e.appendChild(t),e.appendChild(s),e.appendChild(r),e.appendChild(a),{wrapper:e,arrow:t,title:s,description:r,footer:a,previousButton:u,nextButton:c,closeButton:n,footerButtons:w,progress:v}}function qn(){var e;const t=y("popover");t&&((e=t.wrapper.parentElement)==null||e.removeChild(t.wrapper))}function Un(e={}){xe(e);function t(){h("allowClose")&&d()}function s(){const p=h("overlayClickBehavior");if(h("allowClose")&&p==="close"){d();return}if(typeof p=="function"){const g=y("__activeStep"),f=y("__activeElement");p(f,g,{config:h(),state:y(),driver:H()});return}p==="nextStep"&&r()}function r(){const p=y("activeIndex"),g=h("steps")||[];if(typeof p>"u")return;const f=p+1;g[f]?c(f):d()}function n(){const p=y("activeIndex"),g=h("steps")||[];if(typeof p>"u")return;const f=p-1;g[f]?c(f):d()}function a(p){(h("steps")||[])[p]?c(p):d()}function v(){var p;if(y("__transitionCallback"))return;const g=y("activeIndex"),f=y("__activeStep"),$=y("__activeElement");if(typeof g>"u"||typeof f>"u"||typeof y("activeIndex")>"u")return;const b=((p=f.popover)==null?void 0:p.onPrevClick)||h("onPrevClick");if(b)return b($,f,{config:h(),state:y(),driver:H()});n()}function w(){var p;if(y("__transitionCallback"))return;const g=y("activeIndex"),f=y("__activeStep"),$=y("__activeElement");if(typeof g>"u"||typeof f>"u")return;const b=((p=f.popover)==null?void 0:p.onNextClick)||h("onNextClick");if(b)return b($,f,{config:h(),state:y(),driver:H()});r()}function u(){y("isInitialized")||(N("isInitialized",!0),document.body.classList.add("driver-active",h("animate")?"driver-fade":"driver-simple"),On(),de("overlayClick",s),de("escapePress",t),de("arrowLeftPress",v),de("arrowRightPress",w))}function c(p=0){var g,f,$,b,C,_,m,x;const k=h("steps");if(!k){console.error("No steps to drive through"),d();return}if(!k[p]){d();return}N("__activeOnDestroyed",document.activeElement),N("activeIndex",p);const T=k[p],P=k[p+1],q=k[p-1],X=((g=T.popover)==null?void 0:g.doneBtnText)||h("doneBtnText")||"Done",Z=h("allowClose"),G=typeof((f=T.popover)==null?void 0:f.showProgress)<"u"?($=T.popover)==null?void 0:$.showProgress:h("showProgress"),ee=(((b=T.popover)==null?void 0:b.progressText)||h("progressText")||"{{current}} of {{total}}").replace("{{current}}",`${p+1}`).replace("{{total}}",`${k.length}`),M=((C=T.popover)==null?void 0:C.showButtons)||h("showButtons"),K=["next","previous",...Z?["close"]:[]].filter(gt=>!(M!=null&&M.length)||M.includes(gt)),ie=((_=T.popover)==null?void 0:_.onNextClick)||h("onNextClick"),vt=((m=T.popover)==null?void 0:m.onPrevClick)||h("onPrevClick"),wt=((x=T.popover)==null?void 0:x.onCloseClick)||h("onCloseClick");Fe({...T,popover:{showButtons:K,nextBtnText:P?void 0:X,disableButtons:[...q?[]:["previous"]],showProgress:G,progressText:ee,onNextClick:ie||(()=>{P?c(p+1):d()}),onPrevClick:vt||(()=>{c(p-1)}),onCloseClick:wt||(()=>{d()}),...(T==null?void 0:T.popover)||{}}})}function d(p=!0){const g=y("__activeElement"),f=y("__activeStep"),$=y("__activeOnDestroyed"),b=h("onDestroyStarted");if(p&&b){const m=!g||(g==null?void 0:g.id)==="driver-dummy-element";b(m?void 0:g,f,{config:h(),state:y(),driver:H()});return}const C=(f==null?void 0:f.onDeselected)||h("onDeselected"),_=h("onDestroyed");if(document.body.classList.remove("driver-active","driver-fade","driver-simple"),Rn(),qn(),Nn(),An(),xn(),He(),g&&f){const m=g.id==="driver-dummy-element";C&&C(m?void 0:g,f,{config:h(),state:y(),driver:H()}),_&&_(m?void 0:g,f,{config:h(),state:y(),driver:H()})}$&&$.focus()}const E={isActive:()=>y("isInitialized")||!1,refresh:re,drive:(p=0)=>{u(),c(p)},setConfig:xe,setSteps:p=>{He(),xe({...h(),steps:p})},getConfig:h,getState:y,getActiveIndex:()=>y("activeIndex"),isFirstStep:()=>y("activeIndex")===0,isLastStep:()=>{const p=h("steps")||[],g=y("activeIndex");return g!==void 0&&g===p.length-1},getActiveStep:()=>y("activeStep"),getActiveElement:()=>y("activeElement"),getPreviousElement:()=>y("previousElement"),getPreviousStep:()=>y("previousStep"),moveNext:r,movePrevious:n,moveTo:a,hasNextStep:()=>{const p=h("steps")||[],g=y("activeIndex");return g!==void 0&&!!p[g+1]},hasPreviousStep:()=>{const p=h("steps")||[],g=y("activeIndex");return g!==void 0&&!!p[g-1]},highlight:p=>{u(),Fe({...p,popover:p.popover?{showButtons:[],showProgress:!1,progressText:"",...p.popover}:void 0})},destroy:()=>{d(!1)}};return Cn(E),E}function jn({isOpenCreateWSModal:e,isOpenSelectConnectionModal:t,workspaceId:s,workspaceStore:r,onSelectWorkspace:n}){const a=Jt(Xt.HAS_SEEN_TOUR,!1,Zt());return{startTour:()=>{a.value=!0;const w=document.getElementById("tour-new-workspace-btn")?"#tour-new-workspace-btn":"#tour-new-workspace-btn-empty",c=Un({popoverClass:"driver-theme-system",showProgress:!0,allowClose:!0,steps:[{popover:{title:"Welcome to OrcaQ!",description:"Let us take a quick tour to get you familiar with the app."}},{element:"#tour-workspace-area",popover:{title:"Workspaces",description:"This is where you manage your workspaces."}},{element:w,popover:{title:"Create Workspace",description:"Click here to create a new workspace.",onNextClick:()=>{e.value=!0,setTimeout(()=>c.moveNext(),500)}}},{element:"#tour-workspace-icon",popover:{title:"Workspace Icon",description:"Choose an icon to identify your workspace."}},{element:"#tour-workspace-name",popover:{title:"Workspace Name",description:"Enter a unique name for your workspace."}},{element:"#tour-workspace-desc",popover:{title:"Workspace Description",description:"Provide a brief description."}},{element:"#tour-workspace-create",popover:{title:"Save Workspace",description:"After filling out the form, click here to create it.",onNextClick:()=>{const d=Qe();r.createWorkspace({desc:"My first workspace created from tour",id:d,name:"My Tour Workspace",icon:pe,createdAt:Q().toISOString()}),e.value=!1,s.value=d,setTimeout(()=>{c.moveNext()},600)}}},{element:document.getElementById(`tour-open-workspace-${s.value}`)||"#tour-workspace-area",popover:{title:"New Workspace Card",description:'Your new workspace appears here. Click "Open workspace" to manage its connections.',onNextClick:()=>{const d=document.getElementById(`tour-open-workspace-${s.value}`);d?d.click():(n(s.value),t.value=!0),setTimeout(()=>{c.moveNext()},800)}}},{element:"#tour-add-connection-btn",popover:{title:"Add Connection",description:"Inside a workspace, you can manage and add database connections.",onNextClick:()=>{var d;(d=document.getElementById("tour-add-connection-btn"))==null||d.click(),setTimeout(()=>c.moveNext(),600)}}},{element:"#tour-database-type-cards",popover:{title:"Select Database",description:"First, choose the database engine you want to connect to."}},{element:"#tour-database-type-next",popover:{title:"Next Step",description:"Click Next after selecting your database engine.",onNextClick:()=>{const d=document.querySelector("#tour-database-type-cards > div");d?(d.click(),setTimeout(()=>{var E;(E=document.getElementById("tour-database-type-next"))==null||E.click(),setTimeout(()=>c.moveNext(),600)},100)):c.moveNext()}}},{element:"#tour-connection-method-tabs",popover:{title:"Connection Method",description:"You can choose between connection string or form based setup."}},{element:"#tour-connection-string-tab",popover:{title:"Connection String Method",description:"Click here to use the connection string option.",onNextClick:()=>{var d;(d=document.getElementById("tour-connection-string-tab"))==null||d.click(),setTimeout(()=>c.moveNext(),300)}}},{element:"#connection-string",popover:{title:"Enter URI",description:"Paste your database URI here for quick access."}},{element:"#tour-connection-form-tab",popover:{title:"Connection Form Method",description:"Or click here to manually enter host, port, username, and password.",onNextClick:()=>{var d;(d=document.getElementById("tour-connection-form-tab"))==null||d.click(),setTimeout(()=>c.moveNext(),300)}}},{element:"#tour-create-update-connection-btn",popover:{title:"Create Connection",description:"After filling out the connection details, click here to save it."}},{popover:{title:"Tour Completed!",description:"You are now ready to use OrcaQ! Happy querying.",onNextClick:()=>{c.destroy()}}}],onDestroyStarted:()=>{e.value=!1,t.value=!1,document.querySelectorAll('[role="dialog"]').forEach(E=>{const p=E.querySelector('button[aria-label="Close"]');p&&p.click()}),document.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape"})),c.destroy()}});c.drive()}}}function Vn(){const e=Ae(),t=Me(),s=eo(""),r=O(""),n=to(s,oo),a=oe(()=>(e.workspaces||[]).filter(c=>c.name.toLowerCase().includes(n.value.toLowerCase()))),v=O(!1),w=O(!1);return{workspaceStore:e,connectionStore:t,search:s,workspaceId:r,mappedWorkspaces:a,isOpenSelectConnectionModal:v,isOpenCreateWSModal:w,onSelectWorkspace:c=>{v.value=!0,r.value=c}}}const Kn={id:"tour-workspace-area",class:"flex flex-col h-full overflow-y-auto p-4 pt-0 space-y-4 relative"},Yn={class:"flex items-center gap-2"},Gn={class:"relative flex-1"},Qn={key:0,class:"grid grid-cols-3 gap-4 overflow-y-auto"},Jn={class:"flex items-center gap-2"},Xn=["href"],Zn=D({__name:"Workspaces",setup(e){const{workspaceStore:t,connectionStore:s,search:r,workspaceId:n,mappedWorkspaces:a,isOpenSelectConnectionModal:v,isOpenCreateWSModal:w,onSelectWorkspace:u}=Vn(),{startTour:c}=jn({isOpenCreateWSModal:w,isOpenSelectConnectionModal:v,workspaceId:n,workspaceStore:t,onSelectWorkspace:u}),d=O(!1),p=We().public.ggFormLink;return(g,f)=>{const $=L,b=Je,C=F,_=Ke;return S(),B(Y,null,[o(w)?(S(),A(st,{key:0,open:o(w),"onUpdate:open":f[0]||(f[0]=m=>te(w)?w.value=m:null),workspaceSeq:o(t).workspaces.length},null,8,["open","workspaceSeq"])):V("",!0),i(Yo,{open:d.value,"onUpdate:open":f[1]||(f[1]=m=>d.value=m)},null,8,["open"]),i(o(Uo),{open:o(v),"onUpdate:open":f[2]||(f[2]=m=>te(v)?v.value=m:null),connections:o(s).getConnectionsByWorkspaceId(o(n)),"workspace-id":o(n)},null,8,["open","connections","workspace-id"]),I("div",Kn,[i(bn,{onCreate:f[3]||(f[3]=m=>w.value=!0),onRestore:f[4]||(f[4]=m=>d.value=!0),"is-show-button-create":!!o(a).length,"is-show-button-restore":!!o(a).length},null,8,["is-show-button-create","is-show-button-restore"]),I("div",Yn,[I("div",Gn,[i($,{name:"hugeicons:search-01",class:"absolute left-2.5 -translate-y-1/2 top-1/2 size-4"}),i(b,{type:"text",modelValue:o(r),"onUpdate:modelValue":f[5]||(f[5]=m=>te(r)?r.value=m:null),placeholder:"Search workspaces...",class:"pl-10 w-full"},null,8,["modelValue"])])]),o(a).length?(S(),B("div",Qn,[(S(!0),B(Y,null,ne(o(a),m=>(S(),A(gn,{workspace:m,onOnSelectWorkspace:o(u)},null,8,["workspace","onOnSelectWorkspace"]))),256))])):(S(),A(_,{key:1,title:"No workspaces found",desc:"There is nothing here to show. Let's create your first workspace."},{default:l(()=>[I("div",Jn,[i(C,{id:"tour-new-workspace-btn-empty",variant:"default",size:"sm",onClick:f[6]||(f[6]=m=>w.value=!0)},{default:l(()=>[i($,{name:"hugeicons:plus-sign"}),f[8]||(f[8]=W(" New Workspace "))]),_:1}),i(C,{variant:"outline",size:"sm",onClick:f[7]||(f[7]=m=>d.value=!0)},{default:l(()=>[i($,{name:"lucide:upload"}),f[9]||(f[9]=W(" Restore Data "))]),_:1}),i(C,{variant:"secondary",size:"sm",onClick:o(c)},{default:l(()=>[i($,{name:"hugeicons:book-open-02"}),f[10]||(f[10]=W(" Take a tour "))]),_:1},8,["onClick"])])]),_:1})),i(C,{class:"fixed bottom-0 right-4 z-10",variant:"secondary"},{default:l(()=>[I("a",{href:o(p),target:"_blank"},[i($,{name:"hugeicons:chat-feedback-01"}),f[11]||(f[11]=W(" Give me Feedback "))],8,Xn)]),_:1}),i(C,{class:"fixed bottom-16 right-4",variant:"secondary",onClick:o(c),title:"Start Tour"},{default:l(()=>[i($,{name:"hugeicons:book-open-02"}),f[12]||(f[12]=W(" Take a tour "))]),_:1},8,["onClick"])])],64)}}}),us=D({__name:"index",setup(e){return(t,s)=>(S(),A(o(Zn)))}});export{us as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b1 as $,r as m,aP as O,c as p,K as E,aB as C,au as K,ap as _,d as F,e as V,o as R,n as P,k as N,l as U,f as B,w as D,z as A,t as w,g as x,bm as W,_ as j,h as q,m as g,x as z,F as L,s as H,B as M}from"./BNM5p7H5.js";var G=(a=>(a.Tree="tree",a.List="list",a))(G||{});const Y=(a,s=0)=>({connectionId:a,selectedDatabaseIndex:s,viewMode:"tree",keyPattern:"*",keyTypeFilter:[],selectedKey:null,activeTool:"browser"}),J=$("redis-workspace",()=>{const a=m({}),s=(d,n=0)=>(a.value[d]||(a.value[d]=Y(d,n)),a.value[d]);return{sessions:a,ensureSession:s,patchSession:(d,n)=>{Object.assign(s(d),n)}}}),Q=a=>{const s=Number.parseInt(a||"0",10);return Number.isFinite(s)?s:0},X=a=>{var s,t,d;if(typeof a=="string")return a;if(a&&typeof a=="object"){const n=a;return((s=n.data)==null?void 0:s.message)||((d=(t=n.response)==null?void 0:t._data)==null?void 0:d.message)||n.message||"Request failed."}return"Request failed."},Z=(a,s)=>{const t=X(a);return/READONLY/i.test(t)?"This Redis endpoint is read-only. Value updates are unavailable.":/NOPERM|NOAUTH|WRONGPASS|ACL/i.test(t)?"The connected Redis account does not have permission to edit values.":""},T=a=>({method:a.method,stringConnection:a.connectionString,host:a.host,port:a.port,username:a.username,password:a.password,database:a.database,ssl:a.ssl,ssh:a.ssh});function ee({connection:a,session:s,store:t}){const d=m([]),n=m([]),r=O(null),v=m(!1),f=m(!1),l=m(!1),o=m("");let e=0;const c=p(()=>!!r.value&&!o.value),y=async()=>{if(!a.value||!s.value){d.value=[],n.value=[],r.value=null;return}v.value=!0;try{const i=await $fetch("/api/redis/browser",{method:"POST",body:{...T(a.value),databaseIndex:s.value.selectedDatabaseIndex,keyPattern:s.value.keyPattern}});d.value=i.keys,n.value=i.databases,o.value=""}finally{v.value=!1}},b=async()=>{if(!a.value||!s.value){n.value=[];return}n.value=await $fetch("/api/redis/browser/databases",{method:"POST",body:{...T(a.value),databaseIndex:s.value.selectedDatabaseIndex}})},u=async(i=(k=>(k=s.value)==null?void 0:k.selectedKey)())=>{if(!a.value||!s.value||!i){r.value=null,o.value="",f.value=!1;return}const S=++e;r.value=null,f.value=!0;try{const I=await $fetch("/api/redis/browser/value",{method:"POST",body:{...T(a.value),databaseIndex:s.value.selectedDatabaseIndex,key:i}});if(S!==e)return;r.value=I,o.value=""}finally{S===e&&(f.value=!1)}},h=async i=>{s.value&&t.patchSession(s.value.connectionId,{selectedKey:i,activeTool:"browser"})};return{keys:d,databases:n,selectedKeyDetail:r,loadingKeys:v,loadingSelectedKeyDetail:f,savingValue:l,editUnavailableReason:o,canEditSelectedValue:c,refreshKeys:y,refreshDatabases:b,refreshSelectedKeyDetail:u,openKey:h,focusKey:async i=>{s.value&&(await h(i),await u(i))},saveSelectedValue:async i=>{var k;if(!(!a.value||!((k=s.value)!=null&&k.selectedKey))){l.value=!0;try{r.value=await $fetch("/api/redis/browser/value",{method:"PATCH",body:{...T(a.value),databaseIndex:s.value.selectedDatabaseIndex,key:s.value.selectedKey,previewKind:i.previewKind,stringFormat:i.stringFormat,tableKind:i.tableKind,ttlSeconds:i.ttlSeconds,value:i.value}}),o.value="",E.success("Redis key saved successfully",{description:`Updated ${s.value.selectedKey}`})}catch(S){const I=Z(S);if(I){o.value=I;return}console.error("[useRedisWorkspace] Failed to save Redis value",S)}finally{l.value=!1}}}}}function ue(a){const s=C(a.connection),t=a.tabInfo?C(a.tabInfo):void 0,d=a.mode??"browser",n=J(),r=p(()=>{var e;return(e=s.value)!=null&&e.id?n.ensureSession(s.value.id,Q(s.value.database)):null}),v=p({get:()=>{var e;return((e=r.value)==null?void 0:e.selectedDatabaseIndex)??0},set:e=>{r.value&&n.patchSession(r.value.connectionId,{selectedDatabaseIndex:e})}}),f=p({get:()=>{var e;return((e=r.value)==null?void 0:e.keyPattern)??"*"},set:e=>{r.value&&n.patchSession(r.value.connectionId,{keyPattern:e||"*"})}}),l=ee({connection:s,session:r,store:n}),o=m(!1);return K(()=>t==null?void 0:t.value,async e=>{var c,y,b,u;if(!(!r.value||!e)){if(e.type===_.RedisPubSub){n.patchSession(r.value.connectionId,{activeTool:"pubsub",selectedDatabaseIndex:typeof((c=e.metadata)==null?void 0:c.databaseIndex)=="number"?e.metadata.databaseIndex:r.value.selectedDatabaseIndex}),l.refreshDatabases();return}o.value=!0;try{n.patchSession(r.value.connectionId,{activeTool:"browser",selectedDatabaseIndex:typeof((y=e.metadata)==null?void 0:y.databaseIndex)=="number"?e.metadata.databaseIndex:r.value.selectedDatabaseIndex,keyPattern:typeof((b=e.metadata)==null?void 0:b.keyPattern)=="string"?e.metadata.keyPattern:r.value.keyPattern,selectedKey:typeof((u=e.metadata)==null?void 0:u.selectedKey)=="string"?e.metadata.selectedKey:r.value.selectedKey}),await l.refreshKeys(),l.refreshSelectedKeyDetail()}finally{o.value=!1}}},{immediate:!0}),K(()=>{var e,c;return[(e=r.value)==null?void 0:e.selectedDatabaseIndex,(c=r.value)==null?void 0:c.keyPattern]},([e,c],y)=>{if(!(t!=null&&t.value)||t.value.type!==_.RedisBrowser||o.value)return;const[b,u]=y??[];e===b&&c===u||l.refreshKeys()}),K(()=>{var e;return(e=r.value)==null?void 0:e.selectedKey},(e,c)=>{!(t!=null&&t.value)||t.value.type!==_.RedisBrowser||o.value||e===c||l.refreshSelectedKeyDetail(e)}),K(()=>{var e;return(e=r.value)==null?void 0:e.selectedDatabaseIndex},(e,c)=>{if(e!==c){if(t!=null&&t.value){t.value.type===_.RedisPubSub&&l.refreshDatabases();return}d==="meta"&&l.refreshDatabases()}}),K(()=>{var e;return(e=s.value)==null?void 0:e.id},e=>{if(!(!e||t!=null&&t.value)){if(d==="meta"){l.refreshDatabases();return}l.refreshKeys()}},{immediate:!0}),{session:r,keys:l.keys,databases:l.databases,selectedKeyDetail:l.selectedKeyDetail,loadingKeys:l.loadingKeys,loadingSelectedKeyDetail:l.loadingSelectedKeyDetail,savingValue:l.savingValue,selectedDatabaseIndex:v,keyPattern:f,canEditSelectedValue:l.canEditSelectedValue,editUnavailableReason:l.editUnavailableReason,refreshKeys:l.refreshKeys,openKey:l.openKey,focusKey:l.focusKey,saveSelectedValue:l.saveSelectedValue}}const ae={class:"flex min-w-0 items-center gap-1.5 pr-5 text-left"},te={class:"flex min-w-0 items-center gap-2"},se={class:"truncate"},le={class:"text-xxs text-muted-foreground"},ie=F({__name:"RedisDBSelector",props:{databases:{},databaseIndex:{},compact:{type:Boolean},label:{},triggerId:{},triggerClass:{}},emits:["update:databaseIndex"],setup(a,{emit:s}){const t=a,d=s,n=p(()=>t.databases.length>0?t.databases:[{index:t.databaseIndex,label:`DB ${t.databaseIndex}`,keyCount:0,expires:0,avgTtl:null}]),r=p(()=>t.triggerId||"redis-db-index"),v=p(()=>n.value.find(l=>l.index===t.databaseIndex)??n.value[0]),f=p(()=>t.compact?["h-6! w-fit gap-1 px-2 text-xs",t.triggerClass].filter(Boolean).join(" "):["w-full",t.triggerClass].filter(Boolean).join(" "));return(l,o)=>{const e=q,c=M,y=z,b=j;return R(),V("div",{class:P(l.compact?"w-[132px]":"space-y-1")},[l.compact?U("",!0):(R(),N(x(W),{key:0,for:x(r)},{default:D(()=>[A(w(l.label||"Databases"),1)]),_:1},8,["for"])),B(b,{"model-value":String(l.databaseIndex),"onUpdate:modelValue":o[0]||(o[0]=u=>d("update:databaseIndex",Number(u)||0))},{default:D(()=>[B(e,{id:x(r),size:"sm",class:P(x(f))},{default:D(()=>{var u,h;return[g("div",ae,[g("span",{class:P(l.compact?"truncate text-xs":"truncate text-sm")},w(((u=x(v))==null?void 0:u.label)||"Select DB"),3),g("span",{class:P(["shrink-0 text-muted-foreground",(l.compact,"text-xxs")])},w(((h=x(v))==null?void 0:h.keyCount)??0)+" keys ",3)])]}),_:1},8,["id","class"]),B(y,null,{default:D(()=>[(R(!0),V(L,null,H(x(n),u=>(R(),N(c,{key:u.index,value:String(u.index)},{default:D(()=>[g("div",te,[g("span",se,w(u.label),1),g("span",le,w(u.keyCount)+" keys ",1)])]),_:2},1032,["value"]))),128))]),_:1})]),_:1},8,["model-value"])],2)}}});export{G as R,ie as _,ue as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as r,a8 as m,c as a,e as c,k as p,g as o,f as l,m as u,o as e,A as _}from"./BNM5p7H5.js";import"./Dcz-n576.js";import{_ as d}from"./DnPYRTtC.js";import"./D4dXVtWp.js";import"./ZS8y2W5x.js";import"./DehrK61g.js";import"./BN6ZmV2J.js";import"./DpyRXhd7.js";import"./Th_o-5A0.js";import"./CYMhtSRb.js";import"./BjdYdiyf.js";import"./CZGnIeYQ.js";import"./Cgf5py_m.js";import"./CS5akSNT.js";import"./CbANTWsS.js";const f={class:"h-full"},x={key:0,class:"h-full p-4 flex flex-col items-center justify-center text-muted-foreground"},R=r({__name:"index",setup(k){const s=m(),t=a(()=>String(s.params.connectionId||""));return(g,n)=>{const i=_;return e(),c("div",f,[o(t)?(e(),p(o(d),{key:1,"source-connection-id":o(t)},null,8,["source-connection-id"])):(e(),c("div",x,[l(i,{name:"hugeicons:plug-socket",class:"size-12 mb-2 opacity-50"}),n[0]||(n[0]=u("p",{class:"text-sm"},"Select a connection to open Schema Diff",-1))]))])}}});export{R as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as f,k as d,o as $,w as e,f as a,W as g,X as w,Y as D,z as t,t as s,Z as k,$ as v,a0 as y,a1 as B}from"./BNM5p7H5.js";const Q=f({__name:"QuickQueryErrorPopup",props:{open:{type:Boolean},title:{default:"Query error!"},message:{},actionLabel:{default:"OK"}},emits:["update:open"],setup(C){return(o,n)=>{const i=D,p=w,_=k,c=y,r=v,m=g,u=B;return $(),d(u,{open:!!o.open,"onUpdate:open":n[1]||(n[1]=l=>o.$emit("update:open",l))},{default:e(()=>[a(m,{class:"w-[30vw] min-w-96"},{default:e(()=>[a(p,{class:"pb-0"},{default:e(()=>[a(i,null,{default:e(()=>[t(s(o.title),1)]),_:1})]),_:1}),a(_,{class:"decoration-wavy underline decoration-red-600 overflow-auto max-h-[30vh]"},{default:e(()=>[t(s(o.message),1)]),_:1}),a(r,{class:"pt-0"},{default:e(()=>[a(c,{onClick:n[0]||(n[0]=l=>o.$emit("update:open",!1)),class:"w-full"},{default:e(()=>[t(s(o.actionLabel),1)]),_:1})]),_:1})]),_:1})]),_:1},8,["open"])}}});export{Q as _};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as e}from"./Di_nUA-u.js";import{d as r,a8 as c,c as n,k as m,g as o,o as p}from"./BNM5p7H5.js";import"./BN6ZmV2J.js";import"./D4dXVtWp.js";import"./ZS8y2W5x.js";import"./Dcz-n576.js";import"./Cgf5py_m.js";import"./CS5akSNT.js";import"./CbANTWsS.js";import"./DyIuwJ7R.js";const C=r({__name:"[name]",setup(s){const t=c(),i=n(()=>t.params.connectionId),a=n(()=>t.params.name);return(_,u)=>(p(),m(o(e),{"connection-id":o(i),"initial-tab":o(a)},null,8,["connection-id","initial-tab"]))}});export{C as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{az as m,a6 as a,A as f,aA as ie,a4 as le,a5 as r,aB as N,r as E,aC as G,aD as y,aE as B,aF as T,a as ce,c as v,ah as ue,au as O,aG as de,aH as he,aI as D}from"./BNM5p7H5.js";const Se=[{type:a.POSTGRES,name:"PostgreSQL",icon:m(f,{name:"logos:postgresql"}),isSupport:!0,description:"Relational SQL workflows"},{type:a.MYSQL,name:"MySQL",icon:m(f,{name:"logos:mysql"}),isSupport:!0,isBeta:!0,description:"Relational SQL workflows"},{type:a.MARIADB,name:"MariaDB",icon:m(f,{name:"logos:mariadb-icon"}),isSupport:!0,isBeta:!0,description:"Relational SQL workflows"},{type:a.ORACLE,name:"Oracle",icon:m(f,{name:"simple-icons:oracle",class:"text-red-500"}),isSupport:!1,unsupportedLabel:"Coming soon",description:"Relational SQL workflows"},{type:a.SQLITE3,name:"SQLite",icon:m(f,{name:"file-icons:sqlite"}),isSupport:!0,isBeta:!0,description:"Local file, Cloudflare D1, Turso"},{type:a.REDIS,name:"Redis",icon:m(f,{name:"logos:redis"}),isSupport:!0,isBeta:!0,description:"Browser, workbench, analysis"},{type:a.MSSQL,name:"SQL Server",icon:m(f,{name:"simple-icons:microsoftsqlserver"}),isSupport:!1,unsupportedLabel:"Coming soon"},{type:a.SNOWFLAKE,name:"Snowflake",icon:m(f,{name:"simple-icons:snowflake"}),isSupport:!1,unsupportedLabel:"Coming soon"}],ve={[a.MYSQL2]:a.MYSQL,[a.BETTER_SQLITE3]:a.SQLITE3},pe={[a.POSTGRES]:"5432",[a.MYSQL]:"3306",[a.MARIADB]:"3306",[a.MYSQL2]:"3306",[a.REDIS]:"6379",[a.MSSQL]:"1433",[a.ORACLE]:"1521",[a.BETTER_SQLITE3]:"0",[a.SQLITE3]:"0",[a.SNOWFLAKE]:"443"},Te=t=>{const u=ve[t]??t;return Se.find(d=>d.type===u)},Ae=t=>t!==!1&&t!=="false"&&t!=="0",Re=(t,u)=>t.type===a.SQLITE3&&!u;function me(t){const u=ie({type:t.type,method:t.method,providerKind:"providerKind"in t?t.providerKind:void 0,managedSqlite:"managedSqlite"in t?t.managedSqlite:void 0}),d=le({type:t.type,method:t.method,providerKind:u,managedSqlite:"managedSqlite"in t?t.managedSqlite:void 0});return t.method===r.MANAGED?{...t,providerKind:u,family:d}:{...t,providerKind:u,family:d}}const fe={healthCheck:t=>$fetch("/api/managment-connection/health-check",{method:"POST",body:me(t)})},Ee=new Set([r.STRING,r.FORM]),_=t=>t?t===a.SQLITE3?[r.FILE,r.MANAGED]:[r.STRING,r.FORM]:[],R=()=>({provider:T.CLOUDFLARE_D1,accountId:"",databaseId:"",databaseName:"",apiToken:"",url:"",authToken:"",branchName:""}),Y=t=>t===T.TURSO?D.TURSO:D.CLOUDFLARE_D1,ge=t=>t===a.ORACLE?"serviceName":"database",Le=t=>{switch(t){case a.POSTGRES:return"postgresql";case a.MARIADB:return"mariadb";case a.ORACLE:return"oracledb";case a.REDIS:return"redis";case a.SNOWFLAKE:return"snowflake";case a.MYSQL:case a.MYSQL2:return"mysql";default:return""}},Ie=t=>{const u=t.replace(/\\/g,"/");return`sqlite3://${u.startsWith("/")?"":"/"}${u}`},be=t=>{const u=t.split(/[\\/]/).pop()||"";return u.replace(/\.(sqlite3?|db3?)$/i,"")||u};function Ce(t){const u=N(t.open),d=N(t.editingConnection),$=N(t.workspaceId),I=E(1),c=E(a.POSTGRES),g=E("my-abc-db"),l=E(r.STRING),b=E(""),e=G({host:"",port:"",username:"",password:"",database:"",serviceName:"",filePath:"",sslEnabled:!1,sslMode:B.DISABLE,sslCA:"",sslCert:"",sslKey:"",sslRejectUnauthorized:!0,sshEnabled:!1,sshHost:"",sshPort:22,sshUsername:"",sshAuthMethod:y.PASSWORD,sshPassword:"",sshPrivateKey:"",sshStoreInKeychain:!0,sshUseKey:!1}),i=G(R()),C=E([]),h=E("idle"),p=E(""),j=ce(),H=v(()=>_(c.value)),w=v(()=>ue()),W=v(()=>l.value===r.FILE),K=v(()=>{var n;return c.value===a.SQLITE3&&w.value&&typeof window<"u"&&typeof((n=window.electronAPI)==null?void 0:n.window.pickSqliteFile)=="function"}),A=v(()=>ge(c.value)==="serviceName"),z=v(()=>A.value?"Service Name":"Database"),x=v(()=>A.value?"ORCLPDB1":"my_database"),M=v(()=>Ee.has(l.value)),L=n=>n&&pe[n]||"",V=()=>{const n=j.tags.find(o=>o.name==="dev");return n?[n.id]:[]},J=()=>{if(!(!e.sslEnabled||!M.value))return{mode:e.sslMode,ca:e.sslCA,cert:e.sslCert,key:e.sslKey,rejectUnauthorized:e.sslRejectUnauthorized}},X=()=>{if(!(!e.sshEnabled||!M.value))return{enabled:!0,host:e.sshHost,port:e.sshPort,username:e.sshUsername,authMethod:e.sshUseKey?y.KEY:y.PASSWORD,password:e.sshPassword,privateKey:e.sshPrivateKey,storeInKeychain:e.sshStoreInKeychain,useSshKey:e.sshUseKey}},k=()=>{const n={host:e.host,port:e.port||L(c.value),username:e.username,password:e.password,ssl:J(),ssh:X()};return A.value?n.serviceName=e.serviceName:n.database=e.database,n},q=()=>i.provider===T.TURSO?{provider:T.TURSO,url:i.url,authToken:i.authToken,branchName:i.branchName}:{provider:T.CLOUDFLARE_D1,accountId:i.accountId,databaseId:i.databaseId,databaseName:i.databaseName,apiToken:i.apiToken},Z=()=>{const n=Le(c.value),o=e.port||L(c.value),s=A.value?e.serviceName:e.database;if(!n||!e.host||!e.username||!s)return;const P=e.password?`${e.username}:${e.password}`:e.username;return`${n}://${P}@${e.host}${o?`:${o}`:""}/${s}`},ee=()=>{const n=c.value;if(!n)throw new Error("Database type is required.");return l.value===r.STRING?{type:n,method:r.STRING,stringConnection:b.value}:l.value===r.FILE?{type:a.SQLITE3,method:r.FILE,filePath:e.filePath}:l.value===r.MANAGED?{type:a.SQLITE3,method:r.MANAGED,providerKind:Y(i.provider),managedSqlite:q()}:{type:n,method:r.FORM,...k()}},Q=()=>{I.value=1,c.value=a.POSTGRES,g.value="my-abc-db",l.value=r.STRING,b.value="",e.host="",e.port=L(a.POSTGRES),e.username="",e.password="",e.database="",e.serviceName="",e.filePath="",e.sslEnabled=!1,e.sslMode=B.DISABLE,e.sslCA="",e.sslCert="",e.sslKey="",e.sslRejectUnauthorized=!0,e.sshEnabled=!1,e.sshHost="",e.sshPort=22,e.sshUsername="",e.sshAuthMethod=y.PASSWORD,e.sshPassword="",e.sshPrivateKey="",e.sshStoreInKeychain=!0,e.sshUseKey=!1,Object.assign(i,R()),C.value=V(),h.value="idle",p.value=""},se=()=>{I.value===1&&c.value&&(I.value=2)},ae=()=>{I.value=1,h.value="idle",p.value=""},F=async()=>{var n;if(l.value===r.FILE&&!w.value)return h.value="error",p.value="SQLite file connections are available only in the desktop app.",!1;h.value="testing",p.value="";try{const o=await fe.healthCheck(ee());return o.isConnectedSuccess?(h.value="success",p.value="",!0):(h.value="error",p.value=o.message||"Connection failed. Please check your details and try again.",!1)}catch(o){return h.value="error",p.value=((n=o==null?void 0:o.data)==null?void 0:n.message)||(o==null?void 0:o.message)||"Connection failed. Please check your details and try again.",!1}},te=async()=>{var P,U;const o=!!!d.value;if(o&&!await F())return;const s={workspaceId:$.value,id:((P=d.value)==null?void 0:P.id)||he(),name:g.value,type:c.value,method:l.value,createdAt:((U=d.value)==null?void 0:U.createdAt)||de().toISOString(),tagIds:[...C.value]};if(l.value===r.STRING)s.connectionString=b.value;else if(l.value===r.FILE)s.filePath=e.filePath,s.connectionString=Ie(e.filePath),s.providerKind=D.SQLITE_FILE;else if(l.value===r.MANAGED)s.providerKind=Y(i.provider),s.managedSqlite=q();else{const S=k();s.host=S.host,s.port=S.port,s.username=S.username,s.password=S.password,s.database=S.database,s.serviceName=S.serviceName,s.ssl=S.ssl,s.ssh=S.ssh,s.connectionString=Z()}o?t.onAddNew(s):t.onUpdate(s),t.onClose()},ne=()=>{switch(c.value){case a.POSTGRES:return"postgresql://username:password@localhost:5432/database";case a.MYSQL:case a.MYSQL2:return"mysql://username:password@localhost:3306/database";case a.MARIADB:return"mariadb://username:password@localhost:3306/database";case a.ORACLE:return"oracledb://username:password@localhost:1521/ORCLPDB1";case a.REDIS:return"redis://username:password@localhost:6379";case a.SNOWFLAKE:return"snowflake://username:password@account.snowflakecomputing.com:443/database";case a.SQLITE3:return"/Users/you/data/app.sqlite";default:return""}},oe=async()=>{var o;if(!K.value)return;const n=await((o=window.electronAPI)==null?void 0:o.window.pickSqliteFile());n&&(e.filePath=n,!d.value&&g.value==="my-abc-db"&&(g.value=be(n)),h.value="idle")},re=v(()=>g.value?l.value===r.STRING?!!b.value:l.value===r.FILE?w.value&&!!e.filePath:l.value===r.MANAGED?i.provider===T.TURSO?!!(i.url&&i.authToken):!!(i.accountId&&i.databaseId&&i.apiToken):A.value?!!(e.host&&(e.port||L(c.value))&&e.username&&e.password&&e.serviceName):!!(e.host&&(e.port||L(c.value))&&e.username&&e.database):!1);return O(c,n=>{const o=_(n);o.length>0&&!o.includes(l.value)&&(l.value=o[0]),n===a.SQLITE3?(e.host="",e.port="",e.username="",e.password="",e.database="",e.serviceName="",e.sslEnabled=!1,e.sshEnabled=!1):(e.filePath="",Object.assign(i,R()),n!==a.ORACLE&&(e.serviceName=""),d.value||(e.port=L(n))),h.value="idle"}),O(l,n=>{n!==r.FILE&&(e.filePath=""),n!==r.MANAGED&&Object.assign(i,R()),h.value="idle"}),O(u,n=>{var o;if(n)if(d.value){const s=d.value;g.value=s.name,c.value=s.type,l.value=s.method,b.value=s.connectionString||"",e.host=s.host||"",e.port=s.port||"",e.username=s.username||"",e.password=s.password||"",e.database=s.database||"",e.serviceName=s.serviceName||"",e.filePath=s.filePath||"",Object.assign(i,{...R(),...s.managedSqlite??{}}),e.sslEnabled=!!s.ssl,s.ssl&&(e.sslMode=s.ssl.mode,e.sslCA=s.ssl.ca||"",e.sslCert=s.ssl.cert||"",e.sslKey=s.ssl.key||"",e.sslRejectUnauthorized=s.ssl.rejectUnauthorized??!0),e.sshEnabled=!!((o=s.ssh)!=null&&o.enabled),s.ssh&&(e.sshHost=s.ssh.host||"",e.sshPort=s.ssh.port||22,e.sshUsername=s.ssh.username||"",e.sshAuthMethod=s.ssh.authMethod||y.PASSWORD,e.sshPassword=s.ssh.password||"",e.sshPrivateKey=s.ssh.privateKey||"",e.sshStoreInKeychain=s.ssh.storeInKeychain??!0,e.sshUseKey=s.ssh.useSshKey??s.ssh.authMethod===y.KEY),C.value=[...s.tagIds??[]],I.value=2}else Q()},{immediate:!0}),{step:I,dbType:c,connectionName:g,connectionMethod:l,connectionString:b,formData:e,managedSqlite:i,tagIds:C,testStatus:h,testErrorMessage:p,handleNext:se,handleBack:ae,handleTestConnection:F,handleCreateConnection:te,getDefaultPort:()=>L(c.value),getConnectionPlaceholder:ne,availableConnectionMethods:H,structuredTargetLabel:z,structuredTargetPlaceholder:x,canUseNetworkOptions:M,canPickSqliteFile:K,isFileMethod:W,isFormValid:re,pickSqliteFile:oe,resetForm:Q}}export{Re as a,Se as d,Te as g,Ae as i,Ce as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as b,ar as N,as as T,aj as D,aa as C,k as h,o as y,w as v,D as g,g as e,ak as k,at as $,r as u,c as w,au as A,av as F,aw as I,f as M,p as H,l as P,ax as V,ay as E}from"./BNM5p7H5.js";const[O,j]=D("CollapsibleRoot");var S=b({__name:"CollapsibleRoot",props:{defaultOpen:{type:Boolean,required:!1,default:!1},open:{type:Boolean,required:!1,default:void 0},disabled:{type:Boolean,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["update:open"],setup(i,{expose:d,emit:s}){const o=i,n=N(o,"open",s,{defaultValue:o.defaultOpen,passive:o.open===void 0}),{disabled:l,unmountOnHide:p}=T(o);return j({contentId:"",disabled:l,open:n,unmountOnHide:p,onOpenToggle:()=>{l.value||(n.value=!n.value)}}),d({open:n}),C(),(r,f)=>(y(),h(e(k),{as:r.as,"as-child":o.asChild,"data-state":e(n)?"open":"closed","data-disabled":e(l)?"":void 0},{default:v(()=>[g(r.$slots,"default",{open:e(n)})]),_:3},8,["as","as-child","data-state","data-disabled"]))}}),J=S,L=b({inheritAttrs:!1,__name:"CollapsibleContent",props:{forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["contentFound"],setup(i,{emit:d}){const s=i,o=d,t=O();t.contentId||(t.contentId=$(void 0,"reka-collapsible-content"));const n=u(),{forwardRef:l,currentElement:p}=C(),r=u(0),f=u(0),q=w(()=>t.open.value),m=u(q.value),c=u();A(()=>{var a;return[q.value,(a=n.value)==null?void 0:a.present]},async()=>{await E();const a=p.value;if(!a)return;c.value=c.value||{transitionDuration:a.style.transitionDuration,animationName:a.style.animationName},a.style.transitionDuration="0s",a.style.animationName="none";const _=a.getBoundingClientRect();f.value=_.height,r.value=_.width,m.value||(a.style.transitionDuration=c.value.transitionDuration,a.style.animationName=c.value.animationName)},{immediate:!0});const x=w(()=>m.value&&t.open.value);return F(()=>{requestAnimationFrame(()=>{m.value=!1})}),I(p,"beforematch",a=>{requestAnimationFrame(()=>{t.onOpenToggle(),o("contentFound")})}),(a,_)=>(y(),h(e(V),{ref_key:"presentRef",ref:n,present:a.forceMount||e(t).open.value,"force-mount":!0},{default:v(({present:B})=>{var R;return[M(e(k),H(a.$attrs,{id:e(t).contentId,ref:e(l),"as-child":s.asChild,as:a.as,hidden:B?void 0:e(t).unmountOnHide.value?"":"until-found","data-state":x.value?void 0:e(t).open.value?"open":"closed","data-disabled":(R=e(t).disabled)!=null&&R.value?"":void 0,style:{"--reka-collapsible-content-height":`${f.value}px`,"--reka-collapsible-content-width":`${r.value}px`}}),{default:v(()=>[!e(t).unmountOnHide.value||B?g(a.$slots,"default",{key:0}):P("v-if",!0)]),_:2},1040,["id","as-child","as","hidden","data-state","data-disabled","style"])]}),_:3},8,["present"]))}}),K=L,z=b({__name:"CollapsibleTrigger",props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"button"}},setup(i){const d=i;C();const s=O();return(o,t)=>{var n,l;return y(),h(e(k),{type:o.as==="button"?"button":void 0,as:o.as,"as-child":d.asChild,"aria-controls":e(s).contentId,"aria-expanded":e(s).open.value,"data-state":e(s).open.value?"open":"closed","data-disabled":(n=e(s).disabled)!=null&&n.value?"":void 0,disabled:(l=e(s).disabled)==null?void 0:l.value,onClick:e(s).onOpenToggle},{default:v(()=>[g(o.$slots,"default")]),_:3},8,["type","as","as-child","aria-controls","aria-expanded","data-state","data-disabled","disabled","onClick"])}}}),Q=z;export{J as C,K as a,Q as b};
|