@websublime/vite-plugin-open-api-devtools 0.8.0 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ModelsPage-DgFhUiBH.js +750 -0
- package/dist/ModelsPage-DgFhUiBH.js.map +1 -0
- package/dist/{RoutesPage-DJQFqkO5.js → RoutesPage-DpasQCnt.js} +4 -4
- package/dist/{RoutesPage-DJQFqkO5.js.map → RoutesPage-DpasQCnt.js.map} +1 -1
- package/dist/{SimulatorPage-DAwHHeu0.js → SimulatorPage-CDTgl8ax.js} +154 -149
- package/dist/SimulatorPage-CDTgl8ax.js.map +1 -0
- package/dist/{TimelinePage-DdznQBTd.js → TimelinePage-CLlD6uZ8.js} +7 -7
- package/dist/{TimelinePage-DdznQBTd.js.map → TimelinePage-CLlD6uZ8.js.map} +1 -1
- package/dist/{check-CZ-YsL8n.js → check-D8w72KaI.js} +2 -2
- package/dist/{check-CZ-YsL8n.js.map → check-D8w72KaI.js.map} +1 -1
- package/dist/devtools.css +1 -1
- package/dist/devtools.js +1 -1
- package/dist/devtools.umd.cjs +3 -3
- package/dist/devtools.umd.cjs.map +1 -1
- package/dist/{format-xvYNYz8d.js → format-Bs9S93C7.js} +2 -2
- package/dist/{format-xvYNYz8d.js.map → format-Bs9S93C7.js.map} +1 -1
- package/dist/{main-C-2gO_cM.js → main-DUNgny3E.js} +6 -6
- package/dist/{main-C-2gO_cM.js.map → main-DUNgny3E.js.map} +1 -1
- package/dist/spa/assets/ModelsPage-BslYlawu.css +1 -0
- package/dist/spa/assets/ModelsPage-Ef8Z_K5t.js +4 -0
- package/dist/spa/assets/ModelsPage-Ef8Z_K5t.js.map +1 -0
- package/dist/spa/assets/{RoutesPage-DVkEOssu.js → RoutesPage-Rs-CBlOu.js} +2 -2
- package/dist/spa/assets/{RoutesPage-DVkEOssu.js.map → RoutesPage-Rs-CBlOu.js.map} +1 -1
- package/dist/spa/assets/SimulatorPage-CNh6VflM.js +2 -0
- package/dist/spa/assets/SimulatorPage-CNh6VflM.js.map +1 -0
- package/dist/spa/assets/SimulatorPage-DGEq_rzM.css +1 -0
- package/dist/spa/assets/{TimelinePage-C_LK2wKS.js → TimelinePage-2YaDXdDB.js} +2 -2
- package/dist/spa/assets/{TimelinePage-C_LK2wKS.js.map → TimelinePage-2YaDXdDB.js.map} +1 -1
- package/dist/spa/assets/check-CLk5nWxQ.js +2 -0
- package/dist/spa/assets/{check-B_DaLrgB.js.map → check-CLk5nWxQ.js.map} +1 -1
- package/dist/spa/assets/{format-r8dlo_ab.js → format-YtVMCGJx.js} +2 -2
- package/dist/spa/assets/{format-r8dlo_ab.js.map → format-YtVMCGJx.js.map} +1 -1
- package/dist/spa/assets/index-BSvrS_tt.css +1 -0
- package/dist/spa/assets/{index-Dff2RvrN.js → index-sPgNGnaU.js} +3 -3
- package/dist/spa/assets/{index-Dff2RvrN.js.map → index-sPgNGnaU.js.map} +1 -1
- package/dist/spa/assets/{trash-2-6KJWHoOC.js → trash-2-DCsOAZPr.js} +2 -2
- package/dist/spa/assets/{trash-2-6KJWHoOC.js.map → trash-2-DCsOAZPr.js.map} +1 -1
- package/dist/spa/assets/{triangle-alert-Dx8lMHrF.js → triangle-alert-DD8Mz05K.js} +2 -2
- package/dist/spa/assets/{triangle-alert-Dx8lMHrF.js.map → triangle-alert-DD8Mz05K.js.map} +1 -1
- package/dist/spa/assets/x-5pbhNHo3.js +2 -0
- package/dist/spa/assets/{x-B6bG8oob.js.map → x-5pbhNHo3.js.map} +1 -1
- package/dist/spa/index.html +2 -2
- package/dist/{trash-2-BiCAm7lq.js → trash-2-BaiQpXqE.js} +2 -2
- package/dist/{trash-2-BiCAm7lq.js.map → trash-2-BaiQpXqE.js.map} +1 -1
- package/dist/{triangle-alert-C8PD5_Zo.js → triangle-alert-CIaC9iQP.js} +2 -2
- package/dist/{triangle-alert-C8PD5_Zo.js.map → triangle-alert-CIaC9iQP.js.map} +1 -1
- package/dist/{x-Boe7tiDp.js → x-BI73Bc0z.js} +2 -2
- package/dist/{x-Boe7tiDp.js.map → x-BI73Bc0z.js.map} +1 -1
- package/package.json +14 -14
- package/dist/ModelsPage-DEKnJYaY.js +0 -629
- package/dist/ModelsPage-DEKnJYaY.js.map +0 -1
- package/dist/SimulatorPage-DAwHHeu0.js.map +0 -1
- package/dist/spa/assets/ModelsPage-DQN_XP0u.css +0 -1
- package/dist/spa/assets/ModelsPage-Dlw4slrw.js +0 -4
- package/dist/spa/assets/ModelsPage-Dlw4slrw.js.map +0 -1
- package/dist/spa/assets/SimulatorPage-B1voZDRi.css +0 -1
- package/dist/spa/assets/SimulatorPage-C2EEtkx8.js +0 -2
- package/dist/spa/assets/SimulatorPage-C2EEtkx8.js.map +0 -1
- package/dist/spa/assets/check-B_DaLrgB.js +0 -2
- package/dist/spa/assets/index-CFIFFTBf.css +0 -1
- package/dist/spa/assets/x-B6bG8oob.js +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@websublime/vite-plugin-open-api-devtools",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.2",
|
|
4
4
|
"description": "DevTools SPA for vite-open-api-server - Vue-based debugging interface",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"devtools",
|
|
@@ -22,20 +22,20 @@
|
|
|
22
22
|
"directory": "packages/devtools-client"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"open-props": "^2.0.0-beta.5",
|
|
26
|
-
"vue-router": "^4.5.1",
|
|
27
25
|
"pinia": "^3.0.3",
|
|
28
|
-
"
|
|
29
|
-
"
|
|
26
|
+
"vue-router": "^4.5.1",
|
|
27
|
+
"open-props": "^2.0.0-beta.5",
|
|
28
|
+
"vue": "^3.5.17",
|
|
29
|
+
"lucide-vue-next": "^0.513.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@vitejs/plugin-vue": "^6.0.0",
|
|
33
|
-
"jsdom": "^26.1.0",
|
|
34
32
|
"vue-tsc": "^2.2.12",
|
|
35
|
-
"typescript": "^5.9.3",
|
|
36
|
-
"vitest": "^4.0.17",
|
|
37
33
|
"@ungap/structured-clone": "^1.3.0",
|
|
38
|
-
"
|
|
34
|
+
"vitest": "^4.0.17",
|
|
35
|
+
"typescript": "^5.9.3",
|
|
36
|
+
"@vitejs/plugin-vue": "^6.0.0",
|
|
37
|
+
"vite": "^7.0.0",
|
|
38
|
+
"jsdom": "^26.1.0"
|
|
39
39
|
},
|
|
40
40
|
"engines": {
|
|
41
41
|
"node": "^20.19.0 || >=22.12.0"
|
|
@@ -57,12 +57,12 @@
|
|
|
57
57
|
"./style.css": "./dist/style.css"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|
|
60
|
+
"build:spa": "vite build --config vite.config.spa.ts",
|
|
60
61
|
"preview": "vite preview",
|
|
61
|
-
"
|
|
62
|
+
"test": "vitest run",
|
|
63
|
+
"test:watch": "vitest",
|
|
62
64
|
"typecheck": "vue-tsc --noEmit",
|
|
63
65
|
"dev": "vite",
|
|
64
|
-
"
|
|
65
|
-
"build:spa": "vite build --config vite.config.spa.ts",
|
|
66
|
-
"test": "vitest run"
|
|
66
|
+
"build": "vue-tsc --noEmit && vite build && pnpm run build:spa"
|
|
67
67
|
}
|
|
68
68
|
}
|
|
@@ -1,629 +0,0 @@
|
|
|
1
|
-
import { ref as C, computed as $, toRaw as Q, defineComponent as H, watch as q, createElementBlock as y, openBlock as h, createElementVNode as s, Fragment as A, renderList as K, toDisplayString as S, normalizeStyle as Z, createCommentVNode as j, createVNode as T, unref as r, reactive as ee, onMounted as te, nextTick as se, createBlock as ae, normalizeClass as ne, Teleport as oe, withModifiers as le, createTextVNode as P } from "vue";
|
|
2
|
-
import { C as re } from "./check-CZ-YsL8n.js";
|
|
3
|
-
import { c as U, _ as W, u as ie, D as B } from "./main-C-2gO_cM.js";
|
|
4
|
-
import { defineStore as ce } from "pinia";
|
|
5
|
-
import { X as de } from "./x-Boe7tiDp.js";
|
|
6
|
-
import { T as ue } from "./trash-2-BiCAm7lq.js";
|
|
7
|
-
const me = U("circle-alert", [
|
|
8
|
-
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
9
|
-
["line", { x1: "12", x2: "12", y1: "8", y2: "12", key: "1pkeuh" }],
|
|
10
|
-
["line", { x1: "12", x2: "12.01", y1: "16", y2: "16", key: "4dfq90" }]
|
|
11
|
-
]);
|
|
12
|
-
const fe = U("refresh-cw", [
|
|
13
|
-
["path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8", key: "v9h5vc" }],
|
|
14
|
-
["path", { d: "M21 3v5h-5", key: "1q7to0" }],
|
|
15
|
-
["path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16", key: "3uifl3" }],
|
|
16
|
-
["path", { d: "M8 16H3v5", key: "1cv678" }]
|
|
17
|
-
]);
|
|
18
|
-
const ve = U("save", [
|
|
19
|
-
[
|
|
20
|
-
"path",
|
|
21
|
-
{
|
|
22
|
-
d: "M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",
|
|
23
|
-
key: "1c8476"
|
|
24
|
-
}
|
|
25
|
-
],
|
|
26
|
-
["path", { d: "M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7", key: "1ydtos" }],
|
|
27
|
-
["path", { d: "M7 3v4a1 1 0 0 0 1 1h7", key: "t51u73" }]
|
|
28
|
-
]);
|
|
29
|
-
function R(l) {
|
|
30
|
-
try {
|
|
31
|
-
return structuredClone(Q(l));
|
|
32
|
-
} catch {
|
|
33
|
-
return JSON.parse(JSON.stringify(l));
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
const he = ce("models", () => {
|
|
37
|
-
const l = C([]), e = C(null), d = C([]), u = C([]), m = C(!1), o = C(null), f = $(() => e.value ? l.value.find((a) => a.name === e.value) ?? null : null), _ = C(!1), i = $(() => _.value), v = $(() => l.value.length), k = $(() => l.value.reduce((a, p) => a + p.count, 0));
|
|
38
|
-
async function E() {
|
|
39
|
-
m.value = !0, o.value = null;
|
|
40
|
-
try {
|
|
41
|
-
const a = await fetch("/_api/store");
|
|
42
|
-
if (!a.ok)
|
|
43
|
-
throw new Error(`Failed to fetch schemas: ${a.statusText}`);
|
|
44
|
-
const p = await a.json();
|
|
45
|
-
l.value = p.schemas ?? [];
|
|
46
|
-
} catch (a) {
|
|
47
|
-
o.value = a instanceof Error ? a.message : "Failed to fetch schemas", console.error("[ModelsStore] Error fetching schemas:", a);
|
|
48
|
-
} finally {
|
|
49
|
-
m.value = !1;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
async function M(a) {
|
|
53
|
-
e.value !== a && (e.value = a, await x(a));
|
|
54
|
-
}
|
|
55
|
-
async function x(a) {
|
|
56
|
-
m.value = !0, o.value = null;
|
|
57
|
-
try {
|
|
58
|
-
const p = await fetch(`/_api/store/${encodeURIComponent(a)}`);
|
|
59
|
-
if (!p.ok)
|
|
60
|
-
throw new Error(`Failed to fetch schema data: ${p.statusText}`);
|
|
61
|
-
const I = await p.json(), N = I.items ?? [];
|
|
62
|
-
d.value = R(N), u.value = R(N), _.value = !1;
|
|
63
|
-
const L = l.value.findIndex((G) => G.name === a);
|
|
64
|
-
L !== -1 && (l.value[L].count = I.count);
|
|
65
|
-
} catch (p) {
|
|
66
|
-
o.value = p instanceof Error ? p.message : "Failed to fetch schema data", console.error("[ModelsStore] Error fetching schema data:", p);
|
|
67
|
-
} finally {
|
|
68
|
-
m.value = !1;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
function V(a) {
|
|
72
|
-
if (!Array.isArray(a)) {
|
|
73
|
-
o.value = "Invalid data: Expected an array of items", console.error("[ModelsStore] updateItems received non-array value:", typeof a);
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
d.value = a, o.value = null, _.value = !0;
|
|
77
|
-
}
|
|
78
|
-
async function c() {
|
|
79
|
-
if (!e.value)
|
|
80
|
-
return o.value = "No schema selected", !1;
|
|
81
|
-
m.value = !0, o.value = null;
|
|
82
|
-
try {
|
|
83
|
-
const a = await fetch(`/_api/store/${encodeURIComponent(e.value)}`, {
|
|
84
|
-
method: "POST",
|
|
85
|
-
headers: {
|
|
86
|
-
"Content-Type": "application/json"
|
|
87
|
-
},
|
|
88
|
-
body: JSON.stringify(d.value)
|
|
89
|
-
});
|
|
90
|
-
if (!a.ok) {
|
|
91
|
-
const N = await a.json().catch(() => ({}));
|
|
92
|
-
throw new Error(N.error || `Failed to save items: ${a.statusText}`);
|
|
93
|
-
}
|
|
94
|
-
const p = await a.json();
|
|
95
|
-
u.value = R(d.value), _.value = !1;
|
|
96
|
-
const I = l.value.findIndex((N) => N.name === e.value);
|
|
97
|
-
return I !== -1 && (l.value[I].count = p.created ?? d.value.length), !0;
|
|
98
|
-
} catch (a) {
|
|
99
|
-
return o.value = a instanceof Error ? a.message : "Failed to save items", console.error("[ModelsStore] Error saving items:", a), !1;
|
|
100
|
-
} finally {
|
|
101
|
-
m.value = !1;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
async function n() {
|
|
105
|
-
if (!e.value)
|
|
106
|
-
return o.value = "No schema selected", !1;
|
|
107
|
-
m.value = !0, o.value = null;
|
|
108
|
-
try {
|
|
109
|
-
const a = await fetch(`/_api/store/${encodeURIComponent(e.value)}`, {
|
|
110
|
-
method: "DELETE"
|
|
111
|
-
});
|
|
112
|
-
if (!a.ok)
|
|
113
|
-
throw new Error(`Failed to clear schema: ${a.statusText}`);
|
|
114
|
-
d.value = [], u.value = [], _.value = !1;
|
|
115
|
-
const p = l.value.findIndex((I) => I.name === e.value);
|
|
116
|
-
return p !== -1 && (l.value[p].count = 0), !0;
|
|
117
|
-
} catch (a) {
|
|
118
|
-
return o.value = a instanceof Error ? a.message : "Failed to clear schema", console.error("[ModelsStore] Error clearing schema:", a), !1;
|
|
119
|
-
} finally {
|
|
120
|
-
m.value = !1;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
function t() {
|
|
124
|
-
d.value = R(u.value), _.value = !1;
|
|
125
|
-
}
|
|
126
|
-
async function g() {
|
|
127
|
-
e.value ? await x(e.value) : await E();
|
|
128
|
-
}
|
|
129
|
-
function D() {
|
|
130
|
-
l.value = [], e.value = null, d.value = [], u.value = [], m.value = !1, o.value = null, _.value = !1;
|
|
131
|
-
}
|
|
132
|
-
function z(a) {
|
|
133
|
-
const p = l.value.findIndex((I) => I.name === a.schema);
|
|
134
|
-
p !== -1 && (l.value[p].count = a.count), e.value === a.schema && (i.value ? console.warn(
|
|
135
|
-
`[ModelsStore] Skipping auto-refresh for schema "${a.schema}" - unsaved changes exist`
|
|
136
|
-
) : x(a.schema));
|
|
137
|
-
}
|
|
138
|
-
function Y(a) {
|
|
139
|
-
a.success && (E(), e.value && (i.value ? console.warn(
|
|
140
|
-
`[ModelsStore] Skipping auto-refresh after reseed for schema "${e.value}" - unsaved changes exist`
|
|
141
|
-
) : x(e.value)));
|
|
142
|
-
}
|
|
143
|
-
return {
|
|
144
|
-
// State
|
|
145
|
-
schemas: l,
|
|
146
|
-
selectedSchema: e,
|
|
147
|
-
currentItems: d,
|
|
148
|
-
loading: m,
|
|
149
|
-
error: o,
|
|
150
|
-
// Computed
|
|
151
|
-
currentSchema: f,
|
|
152
|
-
isDirty: i,
|
|
153
|
-
schemaCount: v,
|
|
154
|
-
totalItems: k,
|
|
155
|
-
// Actions
|
|
156
|
-
fetchSchemas: E,
|
|
157
|
-
selectSchemaByName: M,
|
|
158
|
-
fetchSchemaData: x,
|
|
159
|
-
updateItems: V,
|
|
160
|
-
saveItems: c,
|
|
161
|
-
clearSchema: n,
|
|
162
|
-
discardChanges: t,
|
|
163
|
-
refresh: g,
|
|
164
|
-
reset: D,
|
|
165
|
-
handleStoreUpdate: z,
|
|
166
|
-
handleReseedComplete: Y
|
|
167
|
-
};
|
|
168
|
-
}), pe = { class: "json-editor" }, ye = { class: "json-editor__container" }, _e = {
|
|
169
|
-
class: "json-editor__lines",
|
|
170
|
-
"aria-hidden": "true"
|
|
171
|
-
}, ge = ["value", "readonly", "placeholder"], be = { class: "json-editor__status" }, Se = { class: "json-editor__status-left" }, Ce = {
|
|
172
|
-
key: 0,
|
|
173
|
-
class: "json-editor__valid"
|
|
174
|
-
}, we = {
|
|
175
|
-
key: 1,
|
|
176
|
-
class: "json-editor__error"
|
|
177
|
-
}, ke = { class: "json-editor__status-right" }, xe = { class: "json-editor__info" }, Ie = /* @__PURE__ */ H({
|
|
178
|
-
__name: "JsonEditor",
|
|
179
|
-
props: {
|
|
180
|
-
modelValue: {},
|
|
181
|
-
readonly: { type: Boolean, default: !1 },
|
|
182
|
-
placeholder: { default: "Enter JSON data..." },
|
|
183
|
-
minHeight: { default: 200 }
|
|
184
|
-
},
|
|
185
|
-
emits: ["update:modelValue"],
|
|
186
|
-
setup(l, { expose: e, emit: d }) {
|
|
187
|
-
const u = l, m = d, o = C(""), f = C(null), _ = $(() => f.value === null), i = $(() => o.value.split(`
|
|
188
|
-
`).length), v = $(() => Array.from({ length: i.value }, (c, n) => n + 1));
|
|
189
|
-
function k() {
|
|
190
|
-
try {
|
|
191
|
-
o.value = JSON.stringify(u.modelValue, null, 2), f.value = null;
|
|
192
|
-
} catch {
|
|
193
|
-
o.value = "", f.value = "Invalid initial value";
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
k(), q(
|
|
197
|
-
() => u.modelValue,
|
|
198
|
-
() => {
|
|
199
|
-
try {
|
|
200
|
-
const c = JSON.parse(o.value);
|
|
201
|
-
JSON.stringify(c) !== JSON.stringify(u.modelValue) && k();
|
|
202
|
-
} catch {
|
|
203
|
-
k();
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
);
|
|
207
|
-
function E(c) {
|
|
208
|
-
const n = c.target;
|
|
209
|
-
o.value = n.value, M();
|
|
210
|
-
}
|
|
211
|
-
function M() {
|
|
212
|
-
if (o.value.trim() === "") {
|
|
213
|
-
f.value = null, m("update:modelValue", []);
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
try {
|
|
217
|
-
const c = JSON.parse(o.value);
|
|
218
|
-
f.value = null, m("update:modelValue", c);
|
|
219
|
-
} catch (c) {
|
|
220
|
-
if (c instanceof Error) {
|
|
221
|
-
const n = c.message.match(/position (\d+)/);
|
|
222
|
-
if (n) {
|
|
223
|
-
const t = Number.parseInt(n[1], 10), g = o.value.substring(0, t).split(`
|
|
224
|
-
`), D = g.length, z = g[g.length - 1].length + 1;
|
|
225
|
-
f.value = `Line ${D}, Column ${z}: ${c.message}`;
|
|
226
|
-
} else
|
|
227
|
-
f.value = c.message;
|
|
228
|
-
} else
|
|
229
|
-
f.value = "Invalid JSON";
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
function x() {
|
|
233
|
-
try {
|
|
234
|
-
const c = JSON.parse(o.value);
|
|
235
|
-
o.value = JSON.stringify(c, null, 2), f.value = null, m("update:modelValue", c);
|
|
236
|
-
} catch {
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
function V(c) {
|
|
240
|
-
if (c.key === "Tab") {
|
|
241
|
-
c.preventDefault();
|
|
242
|
-
const n = c.target, t = n.selectionStart, g = n.selectionEnd, D = `${o.value.substring(0, t)} ${o.value.substring(g)}`;
|
|
243
|
-
o.value = D, setTimeout(() => {
|
|
244
|
-
n.selectionStart = n.selectionEnd = t + 2;
|
|
245
|
-
}, 0), M();
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
return e({
|
|
249
|
-
formatJson: x,
|
|
250
|
-
isValid: _
|
|
251
|
-
}), (c, n) => (h(), y("div", pe, [
|
|
252
|
-
s("div", ye, [
|
|
253
|
-
s("div", _e, [
|
|
254
|
-
(h(!0), y(A, null, K(v.value, (t) => (h(), y("div", {
|
|
255
|
-
key: t,
|
|
256
|
-
class: "json-editor__line-number"
|
|
257
|
-
}, S(t), 1))), 128))
|
|
258
|
-
]),
|
|
259
|
-
s("textarea", {
|
|
260
|
-
value: o.value,
|
|
261
|
-
readonly: l.readonly,
|
|
262
|
-
placeholder: l.placeholder,
|
|
263
|
-
style: Z({ minHeight: `${l.minHeight}px` }),
|
|
264
|
-
class: "json-editor__textarea",
|
|
265
|
-
spellcheck: "false",
|
|
266
|
-
onInput: E,
|
|
267
|
-
onKeydown: V
|
|
268
|
-
}, null, 44, ge)
|
|
269
|
-
]),
|
|
270
|
-
s("div", be, [
|
|
271
|
-
s("div", Se, [
|
|
272
|
-
_.value ? (h(), y("div", Ce, [
|
|
273
|
-
T(r(re), { size: 14 }),
|
|
274
|
-
n[0] || (n[0] = s("span", null, "Valid JSON", -1))
|
|
275
|
-
])) : f.value ? (h(), y("div", we, [
|
|
276
|
-
T(r(me), { size: 14 }),
|
|
277
|
-
s("span", null, S(f.value), 1)
|
|
278
|
-
])) : j("", !0)
|
|
279
|
-
]),
|
|
280
|
-
s("div", ke, [
|
|
281
|
-
s("span", xe, S(i.value) + " lines", 1)
|
|
282
|
-
])
|
|
283
|
-
])
|
|
284
|
-
]));
|
|
285
|
-
}
|
|
286
|
-
}), Te = /* @__PURE__ */ W(Ie, [["__scopeId", "data-v-dbd5ce20"]]), O = C([]), w = ee({
|
|
287
|
-
visible: !1,
|
|
288
|
-
title: "",
|
|
289
|
-
message: "",
|
|
290
|
-
confirmText: "Confirm",
|
|
291
|
-
cancelText: "Cancel",
|
|
292
|
-
onConfirm: null,
|
|
293
|
-
onCancel: null
|
|
294
|
-
}), J = /* @__PURE__ */ new Map();
|
|
295
|
-
let b = null, Ee = 0;
|
|
296
|
-
function $e() {
|
|
297
|
-
return `toast-${Date.now()}-${Ee++}`;
|
|
298
|
-
}
|
|
299
|
-
function F(l, e, d = 3e3) {
|
|
300
|
-
const u = $e(), m = {
|
|
301
|
-
id: u,
|
|
302
|
-
type: l,
|
|
303
|
-
message: e,
|
|
304
|
-
duration: d,
|
|
305
|
-
timestamp: Date.now()
|
|
306
|
-
};
|
|
307
|
-
if (O.value.push(m), d > 0) {
|
|
308
|
-
const o = setTimeout(() => {
|
|
309
|
-
X(u), J.delete(u);
|
|
310
|
-
}, d);
|
|
311
|
-
J.set(u, o);
|
|
312
|
-
}
|
|
313
|
-
return u;
|
|
314
|
-
}
|
|
315
|
-
function X(l) {
|
|
316
|
-
const e = J.get(l);
|
|
317
|
-
e !== void 0 && (clearTimeout(e), J.delete(l));
|
|
318
|
-
const d = O.value.findIndex((u) => u.id === l);
|
|
319
|
-
d !== -1 && O.value.splice(d, 1);
|
|
320
|
-
}
|
|
321
|
-
function Me() {
|
|
322
|
-
function l(i, v) {
|
|
323
|
-
return F("success", i, v);
|
|
324
|
-
}
|
|
325
|
-
function e(i, v) {
|
|
326
|
-
return F("error", i, v);
|
|
327
|
-
}
|
|
328
|
-
function d(i, v) {
|
|
329
|
-
return F("info", i, v);
|
|
330
|
-
}
|
|
331
|
-
function u(i, v) {
|
|
332
|
-
return F("warning", i, v);
|
|
333
|
-
}
|
|
334
|
-
function m(i, v) {
|
|
335
|
-
return new Promise((k) => {
|
|
336
|
-
b && (b(!1), b = null), b = k, w.visible = !0, w.title = v?.title || "Confirm", w.message = i, w.confirmText = v?.confirmText || "Confirm", w.cancelText = v?.cancelText || "Cancel", w.onConfirm = () => {
|
|
337
|
-
w.visible = !1, b && (b(!0), b = null);
|
|
338
|
-
}, w.onCancel = () => {
|
|
339
|
-
w.visible = !1, b && (b(!1), b = null);
|
|
340
|
-
};
|
|
341
|
-
});
|
|
342
|
-
}
|
|
343
|
-
function o() {
|
|
344
|
-
w.visible = !1, b && (b(!1), b = null);
|
|
345
|
-
}
|
|
346
|
-
function f(i) {
|
|
347
|
-
X(i);
|
|
348
|
-
}
|
|
349
|
-
function _() {
|
|
350
|
-
for (const i of J.values())
|
|
351
|
-
clearTimeout(i);
|
|
352
|
-
J.clear(), O.value = [];
|
|
353
|
-
}
|
|
354
|
-
return {
|
|
355
|
-
// State
|
|
356
|
-
toasts: O,
|
|
357
|
-
confirmDialog: w,
|
|
358
|
-
// Toast methods
|
|
359
|
-
success: l,
|
|
360
|
-
error: e,
|
|
361
|
-
info: d,
|
|
362
|
-
warning: u,
|
|
363
|
-
dismiss: f,
|
|
364
|
-
clearAll: _,
|
|
365
|
-
// Confirm methods
|
|
366
|
-
confirm: m,
|
|
367
|
-
closeConfirm: o
|
|
368
|
-
};
|
|
369
|
-
}
|
|
370
|
-
const De = { class: "models-page" }, Ne = { class: "models-sidebar" }, je = { class: "models-sidebar__header" }, Je = { class: "models-sidebar__badge" }, Ve = {
|
|
371
|
-
key: 0,
|
|
372
|
-
class: "models-sidebar__loading"
|
|
373
|
-
}, Oe = {
|
|
374
|
-
key: 1,
|
|
375
|
-
class: "models-sidebar__list"
|
|
376
|
-
}, Re = ["onClick"], Fe = { class: "models-sidebar__name" }, Ae = { class: "models-sidebar__count" }, ze = { class: "models-sidebar__footer" }, Ue = { class: "models-sidebar__stat" }, Le = { class: "font-mono" }, Pe = { class: "models-content" }, Be = { class: "models-toolbar" }, He = { class: "models-toolbar__title" }, qe = { class: "font-mono" }, Ke = { class: "text-muted" }, We = {
|
|
377
|
-
key: 0,
|
|
378
|
-
class: "models-toolbar__badge models-toolbar__badge--warning"
|
|
379
|
-
}, Xe = { class: "models-toolbar__actions" }, Ye = ["disabled"], Ge = ["disabled"], Qe = {
|
|
380
|
-
key: 0,
|
|
381
|
-
class: "models-error"
|
|
382
|
-
}, Ze = { class: "models-editor" }, et = {
|
|
383
|
-
key: 1,
|
|
384
|
-
class: "models-loading-overlay"
|
|
385
|
-
}, tt = {
|
|
386
|
-
key: 1,
|
|
387
|
-
class: "empty-state"
|
|
388
|
-
}, st = {
|
|
389
|
-
key: 0,
|
|
390
|
-
class: "models-error"
|
|
391
|
-
}, at = { class: "modal__body" }, nt = { class: "modal__footer" }, ot = /* @__PURE__ */ H({
|
|
392
|
-
__name: "ModelsPage",
|
|
393
|
-
setup(l) {
|
|
394
|
-
const e = he(), { send: d, on: u, connected: m } = ie(), { success: o, error: f, confirm: _ } = Me(), i = C(null), v = C(!1);
|
|
395
|
-
te(async () => {
|
|
396
|
-
try {
|
|
397
|
-
await e.fetchSchemas(), e.schemas.length > 0 && !e.selectedSchema && await e.selectSchemaByName(e.schemas[0].name);
|
|
398
|
-
} catch (n) {
|
|
399
|
-
e.error || (e.error = n instanceof Error ? n.message : "Failed to load schemas");
|
|
400
|
-
}
|
|
401
|
-
}), u("store:updated", (n) => {
|
|
402
|
-
const t = n;
|
|
403
|
-
if (typeof n != "object" || n === null || typeof t.schema != "string" || typeof t.action != "string" || typeof t.count != "number") {
|
|
404
|
-
console.warn("[ModelsPage] Invalid store:updated payload:", n);
|
|
405
|
-
return;
|
|
406
|
-
}
|
|
407
|
-
e.handleStoreUpdate(n);
|
|
408
|
-
}), u("reseeded", (n) => {
|
|
409
|
-
const t = n;
|
|
410
|
-
if (typeof n != "object" || n === null || typeof t.success != "boolean" || !Array.isArray(t.schemas)) {
|
|
411
|
-
console.warn("[ModelsPage] Invalid reseeded payload:", n);
|
|
412
|
-
return;
|
|
413
|
-
}
|
|
414
|
-
e.handleReseedComplete(n);
|
|
415
|
-
}), q(
|
|
416
|
-
() => e.selectedSchema,
|
|
417
|
-
async () => {
|
|
418
|
-
i.value && e.currentItems.length > 0 && (await se(), i.value?.formatJson());
|
|
419
|
-
}
|
|
420
|
-
);
|
|
421
|
-
async function k(n) {
|
|
422
|
-
e.isDirty && !await _(
|
|
423
|
-
"You have unsaved changes. Are you sure you want to switch schemas?",
|
|
424
|
-
{
|
|
425
|
-
title: "Unsaved Changes",
|
|
426
|
-
confirmText: "Switch Schema",
|
|
427
|
-
cancelText: "Cancel"
|
|
428
|
-
}
|
|
429
|
-
) || await e.selectSchemaByName(n);
|
|
430
|
-
}
|
|
431
|
-
async function E() {
|
|
432
|
-
if (!i.value?.isValid) {
|
|
433
|
-
f("Cannot save invalid JSON. Please fix the errors first.");
|
|
434
|
-
return;
|
|
435
|
-
}
|
|
436
|
-
if (await e.saveItems())
|
|
437
|
-
o("Items saved successfully");
|
|
438
|
-
else {
|
|
439
|
-
const t = e.error || "Failed to save items";
|
|
440
|
-
f(t);
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
async function M() {
|
|
444
|
-
if (!e.isDirty) return;
|
|
445
|
-
await _("Discard all changes and revert to saved data?", {
|
|
446
|
-
title: "Discard Changes",
|
|
447
|
-
confirmText: "Discard",
|
|
448
|
-
cancelText: "Cancel"
|
|
449
|
-
}) && (e.discardChanges(), o("Changes discarded"));
|
|
450
|
-
}
|
|
451
|
-
async function x() {
|
|
452
|
-
v.value = !1;
|
|
453
|
-
try {
|
|
454
|
-
if (await e.clearSchema())
|
|
455
|
-
o("Schema cleared successfully");
|
|
456
|
-
else {
|
|
457
|
-
const t = e.error || "Failed to clear schema";
|
|
458
|
-
f(t);
|
|
459
|
-
}
|
|
460
|
-
} catch (n) {
|
|
461
|
-
const t = n instanceof Error ? n.message : "Failed to clear schema";
|
|
462
|
-
f(t);
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
async function V() {
|
|
466
|
-
if (!m.value) {
|
|
467
|
-
f("WebSocket not connected. Cannot trigger reseed.");
|
|
468
|
-
return;
|
|
469
|
-
}
|
|
470
|
-
await _(
|
|
471
|
-
"This will regenerate all seed data and replace existing items. Continue?",
|
|
472
|
-
{
|
|
473
|
-
title: "Reseed All Schemas",
|
|
474
|
-
confirmText: "Reseed",
|
|
475
|
-
cancelText: "Cancel"
|
|
476
|
-
}
|
|
477
|
-
) && (d({ type: "reseed" }), o("Reseed command sent"));
|
|
478
|
-
}
|
|
479
|
-
function c(n) {
|
|
480
|
-
e.updateItems(n);
|
|
481
|
-
}
|
|
482
|
-
return (n, t) => (h(), y("div", De, [
|
|
483
|
-
s("aside", Ne, [
|
|
484
|
-
s("div", je, [
|
|
485
|
-
T(r(B), { size: 18 }),
|
|
486
|
-
t[4] || (t[4] = s("span", null, "Schemas", -1)),
|
|
487
|
-
s("span", Je, S(r(e).schemaCount), 1)
|
|
488
|
-
]),
|
|
489
|
-
r(e).loading && r(e).schemas.length === 0 ? (h(), y("div", Ve, [...t[5] || (t[5] = [
|
|
490
|
-
s("div", { class: "spinner" }, null, -1),
|
|
491
|
-
s("span", null, "Loading...", -1)
|
|
492
|
-
])])) : (h(), y("div", Oe, [
|
|
493
|
-
(h(!0), y(A, null, K(r(e).schemas, (g) => (h(), y("button", {
|
|
494
|
-
key: g.name,
|
|
495
|
-
class: ne([
|
|
496
|
-
"models-sidebar__item",
|
|
497
|
-
{ "models-sidebar__item--active": r(e).selectedSchema === g.name }
|
|
498
|
-
]),
|
|
499
|
-
onClick: (D) => k(g.name)
|
|
500
|
-
}, [
|
|
501
|
-
s("span", Fe, S(g.name), 1),
|
|
502
|
-
s("span", Ae, S(g.count), 1)
|
|
503
|
-
], 10, Re))), 128))
|
|
504
|
-
])),
|
|
505
|
-
s("div", ze, [
|
|
506
|
-
s("div", Ue, [
|
|
507
|
-
t[6] || (t[6] = s("span", { class: "text-muted" }, "Total Items:", -1)),
|
|
508
|
-
s("span", Le, S(r(e).totalItems), 1)
|
|
509
|
-
])
|
|
510
|
-
])
|
|
511
|
-
]),
|
|
512
|
-
s("main", Pe, [
|
|
513
|
-
r(e).selectedSchema ? (h(), y(A, { key: 0 }, [
|
|
514
|
-
s("div", Be, [
|
|
515
|
-
s("div", He, [
|
|
516
|
-
s("span", qe, S(r(e).selectedSchema), 1),
|
|
517
|
-
s("span", Ke, "(" + S(r(e).currentItems.length) + " items)", 1),
|
|
518
|
-
r(e).isDirty ? (h(), y("span", We, " Unsaved ")) : j("", !0)
|
|
519
|
-
]),
|
|
520
|
-
s("div", Xe, [
|
|
521
|
-
r(e).isDirty ? (h(), y("button", {
|
|
522
|
-
key: 0,
|
|
523
|
-
class: "btn btn--ghost",
|
|
524
|
-
title: "Discard changes",
|
|
525
|
-
onClick: M
|
|
526
|
-
}, [
|
|
527
|
-
T(r(de), { size: 16 }),
|
|
528
|
-
t[7] || (t[7] = s("span", null, "Discard", -1))
|
|
529
|
-
])) : j("", !0),
|
|
530
|
-
s("button", {
|
|
531
|
-
disabled: !r(e).isDirty || r(e).loading,
|
|
532
|
-
class: "btn btn--primary",
|
|
533
|
-
title: "Save changes",
|
|
534
|
-
onClick: E
|
|
535
|
-
}, [
|
|
536
|
-
T(r(ve), { size: 16 }),
|
|
537
|
-
t[8] || (t[8] = s("span", null, "Save", -1))
|
|
538
|
-
], 8, Ye),
|
|
539
|
-
s("button", {
|
|
540
|
-
class: "btn btn--danger",
|
|
541
|
-
title: "Clear all items",
|
|
542
|
-
onClick: t[0] || (t[0] = (g) => v.value = !0)
|
|
543
|
-
}, [
|
|
544
|
-
T(r(ue), { size: 16 }),
|
|
545
|
-
t[9] || (t[9] = s("span", null, "Clear", -1))
|
|
546
|
-
]),
|
|
547
|
-
s("button", {
|
|
548
|
-
disabled: !r(m),
|
|
549
|
-
class: "btn btn--secondary",
|
|
550
|
-
title: "Reseed all schemas with generated data",
|
|
551
|
-
onClick: V
|
|
552
|
-
}, [
|
|
553
|
-
T(r(fe), { size: 16 }),
|
|
554
|
-
t[10] || (t[10] = s("span", null, "Reseed All", -1))
|
|
555
|
-
], 8, Ge)
|
|
556
|
-
])
|
|
557
|
-
]),
|
|
558
|
-
r(e).error ? (h(), y("div", Qe, [
|
|
559
|
-
s("span", null, "⚠️ " + S(r(e).error), 1)
|
|
560
|
-
])) : j("", !0),
|
|
561
|
-
s("div", Ze, [
|
|
562
|
-
T(Te, {
|
|
563
|
-
ref_key: "jsonEditorRef",
|
|
564
|
-
ref: i,
|
|
565
|
-
"model-value": r(e).currentItems,
|
|
566
|
-
readonly: r(e).loading,
|
|
567
|
-
"min-height": 400,
|
|
568
|
-
"onUpdate:modelValue": c
|
|
569
|
-
}, null, 8, ["model-value", "readonly"])
|
|
570
|
-
]),
|
|
571
|
-
r(e).loading ? (h(), y("div", et, [...t[11] || (t[11] = [
|
|
572
|
-
s("div", { class: "spinner" }, null, -1),
|
|
573
|
-
s("span", null, "Loading...", -1)
|
|
574
|
-
])])) : j("", !0)
|
|
575
|
-
], 64)) : (h(), y("div", tt, [
|
|
576
|
-
r(e).error ? (h(), y("div", st, [
|
|
577
|
-
s("span", null, "⚠️ " + S(r(e).error), 1)
|
|
578
|
-
])) : (h(), y(A, { key: 1 }, [
|
|
579
|
-
T(r(B), {
|
|
580
|
-
size: 48,
|
|
581
|
-
class: "empty-state__icon"
|
|
582
|
-
}),
|
|
583
|
-
t[12] || (t[12] = s("h3", { class: "empty-state__title" }, "Select a schema", -1)),
|
|
584
|
-
t[13] || (t[13] = s("p", { class: "empty-state__description" }, " Choose a schema from the sidebar to view and edit its data. ", -1))
|
|
585
|
-
], 64))
|
|
586
|
-
]))
|
|
587
|
-
]),
|
|
588
|
-
(h(), ae(oe, { to: "body" }, [
|
|
589
|
-
v.value ? (h(), y("div", {
|
|
590
|
-
key: 0,
|
|
591
|
-
class: "modal-overlay",
|
|
592
|
-
onClick: t[3] || (t[3] = (g) => v.value = !1)
|
|
593
|
-
}, [
|
|
594
|
-
s("div", {
|
|
595
|
-
class: "modal",
|
|
596
|
-
onClick: t[2] || (t[2] = le(() => {
|
|
597
|
-
}, ["stop"]))
|
|
598
|
-
}, [
|
|
599
|
-
t[17] || (t[17] = s("div", { class: "modal__header" }, [
|
|
600
|
-
s("h3", null, "Clear Schema Data")
|
|
601
|
-
], -1)),
|
|
602
|
-
s("div", at, [
|
|
603
|
-
s("p", null, [
|
|
604
|
-
t[14] || (t[14] = P(" Are you sure you want to clear all items for ", -1)),
|
|
605
|
-
s("strong", null, S(r(e).selectedSchema), 1),
|
|
606
|
-
t[15] || (t[15] = P("? ", -1))
|
|
607
|
-
]),
|
|
608
|
-
t[16] || (t[16] = s("p", { class: "text-muted" }, "This action cannot be undone.", -1))
|
|
609
|
-
]),
|
|
610
|
-
s("div", nt, [
|
|
611
|
-
s("button", {
|
|
612
|
-
class: "btn btn--ghost",
|
|
613
|
-
onClick: t[1] || (t[1] = (g) => v.value = !1)
|
|
614
|
-
}, " Cancel "),
|
|
615
|
-
s("button", {
|
|
616
|
-
class: "btn btn--danger",
|
|
617
|
-
onClick: x
|
|
618
|
-
}, " Clear Schema ")
|
|
619
|
-
])
|
|
620
|
-
])
|
|
621
|
-
])) : j("", !0)
|
|
622
|
-
]))
|
|
623
|
-
]));
|
|
624
|
-
}
|
|
625
|
-
}), mt = /* @__PURE__ */ W(ot, [["__scopeId", "data-v-b06706f4"]]);
|
|
626
|
-
export {
|
|
627
|
-
mt as default
|
|
628
|
-
};
|
|
629
|
-
//# sourceMappingURL=ModelsPage-DEKnJYaY.js.map
|