@vegamo/loom 0.1.5 → 0.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/README.md +9 -0
- package/dist/agents/core/agent.d.ts.map +1 -1
- package/dist/agents/core/agent.js +3 -1
- package/dist/agents/core/agent.js.map +1 -1
- package/dist/agents/core/prompt.d.ts +2 -1
- package/dist/agents/core/prompt.d.ts.map +1 -1
- package/dist/agents/core/prompt.js +3 -2
- package/dist/agents/core/prompt.js.map +1 -1
- package/dist/mocks/router.d.ts.map +1 -1
- package/dist/mocks/router.js +16 -2
- package/dist/mocks/router.js.map +1 -1
- package/dist/serve.d.ts.map +1 -1
- package/dist/serve.js +2 -0
- package/dist/serve.js.map +1 -1
- package/dist/shared/mock-store.d.ts +59 -0
- package/dist/shared/mock-store.d.ts.map +1 -0
- package/dist/shared/mock-store.js +146 -0
- package/dist/shared/mock-store.js.map +1 -0
- package/dist/shared/mock-template.d.ts +11 -0
- package/dist/shared/mock-template.d.ts.map +1 -0
- package/dist/shared/mock-template.js +21 -0
- package/dist/shared/mock-template.js.map +1 -0
- package/dist/shared/requirement.d.ts +27 -0
- package/dist/shared/requirement.d.ts.map +1 -0
- package/dist/shared/requirement.js +70 -0
- package/dist/shared/requirement.js.map +1 -0
- package/dist/shared/schema-utils.d.ts.map +1 -1
- package/dist/shared/schema-utils.js +3 -1
- package/dist/shared/schema-utils.js.map +1 -1
- package/dist/tui/app.d.ts.map +1 -1
- package/dist/tui/app.js +18 -0
- package/dist/tui/app.js.map +1 -1
- package/dist/tui/components/Input.d.ts.map +1 -1
- package/dist/tui/components/Input.js +1 -0
- package/dist/tui/components/Input.js.map +1 -1
- package/dist/view/public/bundle.js +705 -327
- package/dist/view/public/bundle.js.map +4 -4
- package/dist/view/routes/mocks.d.ts +19 -0
- package/dist/view/routes/mocks.d.ts.map +1 -0
- package/dist/view/routes/mocks.js +165 -0
- package/dist/view/routes/mocks.js.map +1 -0
- package/package.json +3 -1
|
@@ -1330,7 +1330,7 @@
|
|
|
1330
1330
|
return dispatcher;
|
|
1331
1331
|
}
|
|
1332
1332
|
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
1333
|
-
var
|
|
1333
|
+
var React23 = require_react(), Internals = {
|
|
1334
1334
|
d: {
|
|
1335
1335
|
f: noop,
|
|
1336
1336
|
r: function() {
|
|
@@ -1348,7 +1348,7 @@
|
|
|
1348
1348
|
},
|
|
1349
1349
|
p: 0,
|
|
1350
1350
|
findDOMNode: null
|
|
1351
|
-
}, REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for("react.portal"), ReactSharedInternals =
|
|
1351
|
+
}, REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for("react.portal"), ReactSharedInternals = React23.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
|
|
1352
1352
|
"function" === typeof Map && null != Map.prototype && "function" === typeof Map.prototype.forEach && "function" === typeof Set && null != Set.prototype && "function" === typeof Set.prototype.clear && "function" === typeof Set.prototype.forEach || console.error(
|
|
1353
1353
|
"React depends on Map and Set built-in types. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"
|
|
1354
1354
|
);
|
|
@@ -2883,7 +2883,7 @@
|
|
|
2883
2883
|
"number" === type && getActiveElement(node.ownerDocument) === node || node.defaultValue === "" + value || (node.defaultValue = "" + value);
|
|
2884
2884
|
}
|
|
2885
2885
|
function validateOptionProps(element, props) {
|
|
2886
|
-
null == props.value && ("object" === typeof props.children && null !== props.children ?
|
|
2886
|
+
null == props.value && ("object" === typeof props.children && null !== props.children ? React23.Children.forEach(props.children, function(child) {
|
|
2887
2887
|
null == child || "string" === typeof child || "number" === typeof child || "bigint" === typeof child || didWarnInvalidChild || (didWarnInvalidChild = true, console.error(
|
|
2888
2888
|
"Cannot infer the option value of complex children. Pass a `value` prop or use a plain string as children to <option>."
|
|
2889
2889
|
));
|
|
@@ -18515,14 +18515,14 @@
|
|
|
18515
18515
|
));
|
|
18516
18516
|
}
|
|
18517
18517
|
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
18518
|
-
var Scheduler = require_scheduler(),
|
|
18518
|
+
var Scheduler = require_scheduler(), React23 = require_react(), ReactDOM = require_react_dom(), assign = Object.assign, REACT_LEGACY_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.element"), REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = /* @__PURE__ */ Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = /* @__PURE__ */ Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = /* @__PURE__ */ Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = /* @__PURE__ */ Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = /* @__PURE__ */ Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = /* @__PURE__ */ Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = /* @__PURE__ */ Symbol.for("react.memo"), REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
|
|
18519
18519
|
/* @__PURE__ */ Symbol.for("react.scope");
|
|
18520
18520
|
var REACT_ACTIVITY_TYPE = /* @__PURE__ */ Symbol.for("react.activity");
|
|
18521
18521
|
/* @__PURE__ */ Symbol.for("react.legacy_hidden");
|
|
18522
18522
|
/* @__PURE__ */ Symbol.for("react.tracing_marker");
|
|
18523
18523
|
var REACT_MEMO_CACHE_SENTINEL = /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel");
|
|
18524
18524
|
/* @__PURE__ */ Symbol.for("react.view_transition");
|
|
18525
|
-
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator, REACT_CLIENT_REFERENCE = /* @__PURE__ */ Symbol.for("react.client.reference"), isArrayImpl = Array.isArray, ReactSharedInternals =
|
|
18525
|
+
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator, REACT_CLIENT_REFERENCE = /* @__PURE__ */ Symbol.for("react.client.reference"), isArrayImpl = Array.isArray, ReactSharedInternals = React23.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, ReactDOMSharedInternals = ReactDOM.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, NotPending = Object.freeze({
|
|
18526
18526
|
pending: false,
|
|
18527
18527
|
data: null,
|
|
18528
18528
|
method: null,
|
|
@@ -21310,7 +21310,7 @@
|
|
|
21310
21310
|
}
|
|
21311
21311
|
};
|
|
21312
21312
|
(function() {
|
|
21313
|
-
var isomorphicReactPackageVersion =
|
|
21313
|
+
var isomorphicReactPackageVersion = React23.version;
|
|
21314
21314
|
if ("19.2.4" !== isomorphicReactPackageVersion)
|
|
21315
21315
|
throw Error(
|
|
21316
21316
|
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' + (isomorphicReactPackageVersion + "\n - react-dom: 19.2.4\nLearn more: https://react.dev/warnings/version-mismatch")
|
|
@@ -21664,18 +21664,18 @@
|
|
|
21664
21664
|
function isValidElement2(object) {
|
|
21665
21665
|
return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
21666
21666
|
}
|
|
21667
|
-
var
|
|
21667
|
+
var React23 = require_react(), REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = /* @__PURE__ */ Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = /* @__PURE__ */ Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = /* @__PURE__ */ Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = /* @__PURE__ */ Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = /* @__PURE__ */ Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = /* @__PURE__ */ Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = /* @__PURE__ */ Symbol.for("react.memo"), REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = /* @__PURE__ */ Symbol.for("react.activity"), REACT_CLIENT_REFERENCE = /* @__PURE__ */ Symbol.for("react.client.reference"), ReactSharedInternals = React23.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, hasOwnProperty = Object.prototype.hasOwnProperty, isArrayImpl = Array.isArray, createTask = console.createTask ? console.createTask : function() {
|
|
21668
21668
|
return null;
|
|
21669
21669
|
};
|
|
21670
|
-
|
|
21670
|
+
React23 = {
|
|
21671
21671
|
react_stack_bottom_frame: function(callStackForError) {
|
|
21672
21672
|
return callStackForError();
|
|
21673
21673
|
}
|
|
21674
21674
|
};
|
|
21675
21675
|
var specialPropKeyWarningShown;
|
|
21676
21676
|
var didWarnAboutElementRef = {};
|
|
21677
|
-
var unknownOwnerDebugStack =
|
|
21678
|
-
|
|
21677
|
+
var unknownOwnerDebugStack = React23.react_stack_bottom_frame.bind(
|
|
21678
|
+
React23,
|
|
21679
21679
|
UnknownOwner
|
|
21680
21680
|
)();
|
|
21681
21681
|
var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
|
|
@@ -21720,7 +21720,7 @@
|
|
|
21720
21720
|
});
|
|
21721
21721
|
|
|
21722
21722
|
// src/view/frontend/index.tsx
|
|
21723
|
-
var
|
|
21723
|
+
var import_react11 = __toESM(require_react(), 1);
|
|
21724
21724
|
var import_client = __toESM(require_client(), 1);
|
|
21725
21725
|
|
|
21726
21726
|
// node_modules/react-router-dom/node_modules/react-router/dist/development/chunk-LFPYN7LY.mjs
|
|
@@ -24432,6 +24432,31 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
|
|
|
24432
24432
|
if (!res.ok) throw new Error(`Failed to fetch entity ${filename}: ${res.statusText}`);
|
|
24433
24433
|
return await res.json();
|
|
24434
24434
|
}
|
|
24435
|
+
function mockUrl(filename, method, endpointPath, status) {
|
|
24436
|
+
const trimmed = endpointPath.replace(/^\/+/, "");
|
|
24437
|
+
const enc = trimmed.split("/").map(encodeURIComponent).join("/");
|
|
24438
|
+
const qs = status ? `?status=${encodeURIComponent(status)}` : "";
|
|
24439
|
+
return `${API_BASE}/mocks/${filename}/${method}/${enc}${qs}`;
|
|
24440
|
+
}
|
|
24441
|
+
async function fetchMock(filename, method, endpointPath, status) {
|
|
24442
|
+
const res = await fetch(mockUrl(filename, method, endpointPath, status));
|
|
24443
|
+
if (!res.ok) throw new Error(`Failed to fetch mock: ${res.statusText}`);
|
|
24444
|
+
return await res.json();
|
|
24445
|
+
}
|
|
24446
|
+
async function saveMock(filename, method, endpointPath, data2, status) {
|
|
24447
|
+
const res = await fetch(mockUrl(filename, method, endpointPath, status), {
|
|
24448
|
+
method: "PUT",
|
|
24449
|
+
headers: { "Content-Type": "application/json" },
|
|
24450
|
+
body: JSON.stringify({ data: data2 })
|
|
24451
|
+
});
|
|
24452
|
+
if (!res.ok) throw new Error(`Failed to save mock: ${res.statusText}`);
|
|
24453
|
+
}
|
|
24454
|
+
async function deleteMock(filename, method, endpointPath, status) {
|
|
24455
|
+
const res = await fetch(mockUrl(filename, method, endpointPath, status), {
|
|
24456
|
+
method: "DELETE"
|
|
24457
|
+
});
|
|
24458
|
+
if (!res.ok) throw new Error(`Failed to delete mock: ${res.statusText}`);
|
|
24459
|
+
}
|
|
24435
24460
|
|
|
24436
24461
|
// src/view/frontend/components/App.tsx
|
|
24437
24462
|
var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
|
|
@@ -24777,14 +24802,32 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
|
|
|
24777
24802
|
marginRight: "0.75rem"
|
|
24778
24803
|
}, children: endpoint.method }),
|
|
24779
24804
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("code", { style: { fontSize: "1rem", fontWeight: "600" }, children: endpoint.path }),
|
|
24780
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.
|
|
24781
|
-
|
|
24782
|
-
|
|
24783
|
-
|
|
24784
|
-
|
|
24785
|
-
|
|
24786
|
-
|
|
24787
|
-
|
|
24805
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { style: { marginLeft: "auto", display: "flex", flexDirection: "column", alignItems: "flex-end", gap: "0.25rem" }, children: [
|
|
24806
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
24807
|
+
Link,
|
|
24808
|
+
{
|
|
24809
|
+
to: `/modules/${moduleFilename}/endpoints/${encodeURIComponent(endpoint.path)}?method=${endpoint.method}`,
|
|
24810
|
+
style: { color: "#4a6bff", textDecoration: "none", fontSize: "0.9rem" },
|
|
24811
|
+
children: "View details \u2192"
|
|
24812
|
+
}
|
|
24813
|
+
),
|
|
24814
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
24815
|
+
Link,
|
|
24816
|
+
{
|
|
24817
|
+
to: `/modules/${moduleFilename}/endpoints/${encodeURIComponent(endpoint.path)}/mock?method=${endpoint.method}`,
|
|
24818
|
+
style: { color: "#4a6bff", textDecoration: "none", fontSize: "0.85rem" },
|
|
24819
|
+
children: "Mock view \u2192"
|
|
24820
|
+
}
|
|
24821
|
+
),
|
|
24822
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
24823
|
+
Link,
|
|
24824
|
+
{
|
|
24825
|
+
to: `/modules/${moduleFilename}/endpoints/${encodeURIComponent(endpoint.path)}/mock/edit?method=${endpoint.method}`,
|
|
24826
|
+
style: { color: "#4a6bff", textDecoration: "none", fontSize: "0.85rem" },
|
|
24827
|
+
children: "Mock edit \u2192"
|
|
24828
|
+
}
|
|
24829
|
+
)
|
|
24830
|
+
] })
|
|
24788
24831
|
] }),
|
|
24789
24832
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { style: { marginBottom: "0.5rem" }, children: endpoint.summary }),
|
|
24790
24833
|
endpoint.description && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { style: { color: "#666", fontSize: "0.95rem" }, children: endpoint.description }),
|
|
@@ -24801,111 +24844,11 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
|
|
|
24801
24844
|
var ModuleDetailPage_default = ModuleDetailPage;
|
|
24802
24845
|
|
|
24803
24846
|
// src/view/frontend/components/EndpointDetailPage.tsx
|
|
24804
|
-
var
|
|
24847
|
+
var import_react5 = __toESM(require_react(), 1);
|
|
24805
24848
|
|
|
24806
|
-
// src/view/frontend/components/
|
|
24849
|
+
// src/view/frontend/components/SchemaTableViewer.tsx
|
|
24807
24850
|
var import_react4 = __toESM(require_react(), 1);
|
|
24808
24851
|
var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
|
|
24809
|
-
var JsonViewer = ({ data: data2, defaultExpanded = true, maxDepth = 3 }) => {
|
|
24810
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { fontFamily: "Monaco, Consolas, monospace", fontSize: "13px" }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(JsonNode, { value: data2, expanded: defaultExpanded, depth: 0, maxDepth }) });
|
|
24811
|
-
};
|
|
24812
|
-
var JsonNode = ({ value, expanded, depth, maxDepth }) => {
|
|
24813
|
-
const [isExpanded, setIsExpanded] = (0, import_react4.useState)(expanded);
|
|
24814
|
-
if (value === null) {
|
|
24815
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { color: "#999" }, children: "null" });
|
|
24816
|
-
}
|
|
24817
|
-
if (typeof value === "boolean") {
|
|
24818
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { color: "#ff79c6" }, children: String(value) });
|
|
24819
|
-
}
|
|
24820
|
-
if (typeof value === "number") {
|
|
24821
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { color: "#bd93f9" }, children: value });
|
|
24822
|
-
}
|
|
24823
|
-
if (typeof value === "string") {
|
|
24824
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { style: { color: "#f1fa8c" }, children: [
|
|
24825
|
-
'"',
|
|
24826
|
-
value,
|
|
24827
|
-
'"'
|
|
24828
|
-
] });
|
|
24829
|
-
}
|
|
24830
|
-
if (Array.isArray(value)) {
|
|
24831
|
-
if (value.length === 0) {
|
|
24832
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { color: "#999" }, children: "[]" });
|
|
24833
|
-
}
|
|
24834
|
-
if (depth >= maxDepth || !isExpanded) {
|
|
24835
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { children: [
|
|
24836
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { color: "#999" }, children: "[" }),
|
|
24837
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { style: { color: "#999" }, children: [
|
|
24838
|
-
"\u2026 ",
|
|
24839
|
-
value.length,
|
|
24840
|
-
" items"
|
|
24841
|
-
] }),
|
|
24842
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { color: "#999" }, children: "]" }),
|
|
24843
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ToggleButton, { expanded: isExpanded, onToggle: () => setIsExpanded(!isExpanded) })
|
|
24844
|
-
] });
|
|
24845
|
-
}
|
|
24846
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
24847
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { color: "#999" }, children: "[" }),
|
|
24848
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ToggleButton, { expanded: isExpanded, onToggle: () => setIsExpanded(!isExpanded) }),
|
|
24849
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { marginLeft: `${depth + 1}em` }, children: value.map((item, idx) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
24850
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(JsonNode, { value: item, expanded, depth: depth + 1, maxDepth }),
|
|
24851
|
-
idx < value.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { color: "#999" }, children: "," })
|
|
24852
|
-
] }, idx)) }),
|
|
24853
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { color: "#999" }, children: "]" })
|
|
24854
|
-
] });
|
|
24855
|
-
}
|
|
24856
|
-
if (typeof value === "object") {
|
|
24857
|
-
const obj = value;
|
|
24858
|
-
const keys = Object.keys(obj);
|
|
24859
|
-
if (keys.length === 0) {
|
|
24860
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { color: "#999" }, children: "{}" });
|
|
24861
|
-
}
|
|
24862
|
-
if (depth >= maxDepth || !isExpanded) {
|
|
24863
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { children: [
|
|
24864
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { color: "#999" }, children: "{" }),
|
|
24865
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { style: { color: "#999" }, children: [
|
|
24866
|
-
"\u2026 ",
|
|
24867
|
-
keys.length,
|
|
24868
|
-
" keys"
|
|
24869
|
-
] }),
|
|
24870
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { color: "#999" }, children: "}" }),
|
|
24871
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ToggleButton, { expanded: isExpanded, onToggle: () => setIsExpanded(!isExpanded) })
|
|
24872
|
-
] });
|
|
24873
|
-
}
|
|
24874
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
24875
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { color: "#999" }, children: "{" }),
|
|
24876
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ToggleButton, { expanded: isExpanded, onToggle: () => setIsExpanded(!isExpanded) }),
|
|
24877
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { marginLeft: `${depth + 1}em` }, children: keys.map((key, idx) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
24878
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { color: "#8be9fd" }, children: key }),
|
|
24879
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { color: "#999" }, children: ": " }),
|
|
24880
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(JsonNode, { value: obj[key], expanded, depth: depth + 1, maxDepth }),
|
|
24881
|
-
idx < keys.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { color: "#999" }, children: "," })
|
|
24882
|
-
] }, key)) }),
|
|
24883
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { color: "#999" }, children: "}" })
|
|
24884
|
-
] });
|
|
24885
|
-
}
|
|
24886
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { color: "#999" }, children: String(value) });
|
|
24887
|
-
};
|
|
24888
|
-
var ToggleButton = ({ expanded, onToggle }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
24889
|
-
"button",
|
|
24890
|
-
{
|
|
24891
|
-
onClick: onToggle,
|
|
24892
|
-
style: {
|
|
24893
|
-
background: "none",
|
|
24894
|
-
border: "none",
|
|
24895
|
-
color: "#8be9fd",
|
|
24896
|
-
cursor: "pointer",
|
|
24897
|
-
fontSize: "12px",
|
|
24898
|
-
marginLeft: "4px",
|
|
24899
|
-
padding: "0 2px"
|
|
24900
|
-
},
|
|
24901
|
-
children: expanded ? "\u2212" : "+"
|
|
24902
|
-
}
|
|
24903
|
-
);
|
|
24904
|
-
var JsonViewer_default = JsonViewer;
|
|
24905
|
-
|
|
24906
|
-
// src/view/frontend/components/SchemaTableViewer.tsx
|
|
24907
|
-
var import_react5 = __toESM(require_react(), 1);
|
|
24908
|
-
var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1);
|
|
24909
24852
|
function isObject(value) {
|
|
24910
24853
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
24911
24854
|
}
|
|
@@ -25021,12 +24964,12 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
|
|
|
25021
24964
|
};
|
|
25022
24965
|
var TypeBadge = ({ type }) => {
|
|
25023
24966
|
const theme = typePillTheme[type] || typePillTheme.unknown;
|
|
25024
|
-
return /* @__PURE__ */ (0,
|
|
24967
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { ...typeBadgeStyle, background: theme.bg, color: theme.color }, children: type });
|
|
25025
24968
|
};
|
|
25026
24969
|
var ConstraintLine = ({ schema }) => {
|
|
25027
24970
|
const extra = constraints(schema);
|
|
25028
24971
|
if (!extra) return null;
|
|
25029
|
-
return /* @__PURE__ */ (0,
|
|
24972
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { marginTop: "4px", fontSize: "12px", color: "#7c889b" }, children: extra });
|
|
25030
24973
|
};
|
|
25031
24974
|
var textWrapStyle = {
|
|
25032
24975
|
whiteSpace: "pre-wrap",
|
|
@@ -25046,18 +24989,18 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
|
|
|
25046
24989
|
cursor: "pointer"
|
|
25047
24990
|
};
|
|
25048
24991
|
var Disclosure = ({ defaultOpen, label, children }) => {
|
|
25049
|
-
const [open, setOpen] = (0,
|
|
25050
|
-
return /* @__PURE__ */ (0,
|
|
25051
|
-
/* @__PURE__ */ (0,
|
|
25052
|
-
/* @__PURE__ */ (0,
|
|
25053
|
-
/* @__PURE__ */ (0,
|
|
24992
|
+
const [open, setOpen] = (0, import_react4.useState)(defaultOpen);
|
|
24993
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
24994
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("button", { type: "button", onClick: () => setOpen((v) => !v), style: disclosureButtonStyle, children: [
|
|
24995
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { fontSize: "11px", color: "#6e7b90" }, children: open ? "\u25BC" : "\u25B6" }),
|
|
24996
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: label })
|
|
25054
24997
|
] }),
|
|
25055
|
-
open && /* @__PURE__ */ (0,
|
|
24998
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { marginTop: "8px" }, children })
|
|
25056
24999
|
] });
|
|
25057
25000
|
};
|
|
25058
25001
|
var FieldMetaBadges = ({ flags }) => {
|
|
25059
25002
|
if (flags.length === 0) return null;
|
|
25060
|
-
return /* @__PURE__ */ (0,
|
|
25003
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { marginLeft: "8px", display: "inline-flex", gap: "4px", flexWrap: "wrap" }, children: flags.map((flag) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: metaBadgeStyle, children: flag }, flag)) });
|
|
25061
25004
|
};
|
|
25062
25005
|
var SchemaNodeTable = ({ schema, detailsControl, depth = 0, title, path = "root" }) => {
|
|
25063
25006
|
const properties = isObject(schema.properties) ? schema.properties : void 0;
|
|
@@ -25067,70 +25010,70 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
|
|
|
25067
25010
|
const isTop = depth === 0;
|
|
25068
25011
|
const indent = Math.min(depth * 12, 28);
|
|
25069
25012
|
if (nodeType === "array" && isObject(schema.items)) {
|
|
25070
|
-
return /* @__PURE__ */ (0,
|
|
25071
|
-
/* @__PURE__ */ (0,
|
|
25072
|
-
title && /* @__PURE__ */ (0,
|
|
25073
|
-
/* @__PURE__ */ (0,
|
|
25013
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { marginLeft: indent }, children: [
|
|
25014
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { marginBottom: "8px", display: "flex", alignItems: "center", gap: "8px" }, children: [
|
|
25015
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { fontSize: "13px", fontWeight: 600, color: "#4a5a72" }, children: title }),
|
|
25016
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(TypeBadge, { type: "array" })
|
|
25074
25017
|
] }),
|
|
25075
|
-
typeof schema.description === "string" && /* @__PURE__ */ (0,
|
|
25076
|
-
/* @__PURE__ */ (0,
|
|
25077
|
-
example && /* @__PURE__ */ (0,
|
|
25018
|
+
typeof schema.description === "string" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { color: "#5b6b81", fontSize: "13px", marginBottom: "4px" }, children: schema.description }),
|
|
25019
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ConstraintLine, { schema }),
|
|
25020
|
+
example && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { marginTop: "6px", fontSize: "12px", color: "#5e6d84" }, children: [
|
|
25078
25021
|
"Example: ",
|
|
25079
|
-
/* @__PURE__ */ (0,
|
|
25022
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("code", { children: example })
|
|
25080
25023
|
] }),
|
|
25081
|
-
/* @__PURE__ */ (0,
|
|
25024
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { marginTop: "8px" }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Disclosure, { defaultOpen: detailsControl.open, label: "items", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { borderLeft: "2px solid #dbe7ff", paddingLeft: "12px" }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SchemaNodeTable, { schema: schema.items, detailsControl, depth: depth + 1, path: `${path}.items` }) }) }, `${detailsControl.seed}:${path}:items`) })
|
|
25082
25025
|
] });
|
|
25083
25026
|
}
|
|
25084
25027
|
if (Array.isArray(schema.oneOf) || Array.isArray(schema.anyOf) || Array.isArray(schema.allOf)) {
|
|
25085
25028
|
const key = Array.isArray(schema.oneOf) ? "oneOf" : Array.isArray(schema.anyOf) ? "anyOf" : "allOf";
|
|
25086
25029
|
const list = schema[key];
|
|
25087
|
-
return /* @__PURE__ */ (0,
|
|
25088
|
-
/* @__PURE__ */ (0,
|
|
25089
|
-
title && /* @__PURE__ */ (0,
|
|
25090
|
-
/* @__PURE__ */ (0,
|
|
25030
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { marginLeft: indent }, children: [
|
|
25031
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { marginBottom: "8px", display: "flex", alignItems: "center", gap: "8px" }, children: [
|
|
25032
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { fontSize: "13px", fontWeight: 600, color: "#4a5a72" }, children: title }),
|
|
25033
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(TypeBadge, { type: key })
|
|
25091
25034
|
] }),
|
|
25092
|
-
/* @__PURE__ */ (0,
|
|
25093
|
-
/* @__PURE__ */ (0,
|
|
25035
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { display: "grid", gap: "10px" }, children: list.map((item, idx) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { border: "1px solid #e6ecf5", borderRadius: "6px", padding: "10px" }, children: [
|
|
25036
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { fontSize: "12px", color: "#607089", marginBottom: "6px" }, children: [
|
|
25094
25037
|
"Option ",
|
|
25095
25038
|
idx + 1
|
|
25096
25039
|
] }),
|
|
25097
|
-
isObject(item) ? /* @__PURE__ */ (0,
|
|
25040
|
+
isObject(item) ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SchemaNodeTable, { schema: item, detailsControl, depth: depth + 1, path: `${path}.${key}.${idx}` }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("code", { children: String(item) })
|
|
25098
25041
|
] }, idx)) })
|
|
25099
25042
|
] });
|
|
25100
25043
|
}
|
|
25101
25044
|
if (!properties) {
|
|
25102
|
-
return /* @__PURE__ */ (0,
|
|
25103
|
-
/* @__PURE__ */ (0,
|
|
25104
|
-
title && /* @__PURE__ */ (0,
|
|
25105
|
-
/* @__PURE__ */ (0,
|
|
25045
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { marginLeft: indent }, children: [
|
|
25046
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { marginBottom: "6px", display: "flex", alignItems: "center", gap: "8px" }, children: [
|
|
25047
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { fontSize: "13px", fontWeight: 600, color: "#4a5a72" }, children: title }),
|
|
25048
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(TypeBadge, { type: nodeType })
|
|
25106
25049
|
] }),
|
|
25107
|
-
typeof schema.description === "string" && /* @__PURE__ */ (0,
|
|
25108
|
-
/* @__PURE__ */ (0,
|
|
25109
|
-
example && /* @__PURE__ */ (0,
|
|
25050
|
+
typeof schema.description === "string" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { color: "#5b6b81", fontSize: "13px", marginBottom: "6px" }, children: schema.description }),
|
|
25051
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ConstraintLine, { schema }),
|
|
25052
|
+
example && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { marginTop: "6px", fontSize: "12px", color: "#5e6d84" }, children: [
|
|
25110
25053
|
"Example: ",
|
|
25111
|
-
/* @__PURE__ */ (0,
|
|
25054
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("code", { children: example })
|
|
25112
25055
|
] })
|
|
25113
25056
|
] });
|
|
25114
25057
|
}
|
|
25115
25058
|
const entries = Object.entries(properties).filter(([, value]) => isObject(value));
|
|
25116
|
-
return /* @__PURE__ */ (0,
|
|
25117
|
-
/* @__PURE__ */ (0,
|
|
25118
|
-
title && /* @__PURE__ */ (0,
|
|
25119
|
-
/* @__PURE__ */ (0,
|
|
25059
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { marginLeft: indent }, children: [
|
|
25060
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { marginBottom: "8px", display: "flex", alignItems: "center", gap: "8px" }, children: [
|
|
25061
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { fontSize: "13px", fontWeight: 600, color: "#4a5a72" }, children: title }),
|
|
25062
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(TypeBadge, { type: "object" })
|
|
25120
25063
|
] }),
|
|
25121
|
-
typeof schema.description === "string" && /* @__PURE__ */ (0,
|
|
25122
|
-
isTop && /* @__PURE__ */ (0,
|
|
25123
|
-
/* @__PURE__ */ (0,
|
|
25064
|
+
typeof schema.description === "string" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { color: "#5b6b81", fontSize: "13px", marginBottom: "8px" }, children: schema.description }),
|
|
25065
|
+
isTop && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { marginBottom: "8px", fontSize: "12px", color: "#7b8598" }, children: [
|
|
25066
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { color: "#d0392e", fontWeight: 700 }, children: "*" }),
|
|
25124
25067
|
" required"
|
|
25125
25068
|
] }),
|
|
25126
|
-
/* @__PURE__ */ (0,
|
|
25127
|
-
/* @__PURE__ */ (0,
|
|
25128
|
-
/* @__PURE__ */ (0,
|
|
25129
|
-
/* @__PURE__ */ (0,
|
|
25130
|
-
/* @__PURE__ */ (0,
|
|
25131
|
-
/* @__PURE__ */ (0,
|
|
25069
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { overflowX: "auto", width: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("table", { style: { width: "100%", minWidth: `${TABLE_MIN_WIDTH}px`, tableLayout: "fixed", borderCollapse: "separate", borderSpacing: 0, border: "1px solid #e6ecf5", borderRadius: "8px" }, children: [
|
|
25070
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("tr", { style: { background: "#f8fbff" }, children: [
|
|
25071
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("th", { style: { ...cellStyle, textAlign: "left", width: "20%" }, children: "Field" }),
|
|
25072
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("th", { style: { ...cellStyle, textAlign: "left", width: "16%" }, children: "Type" }),
|
|
25073
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("th", { style: { ...cellStyle, textAlign: "left", width: "44%" }, children: "Description" }),
|
|
25074
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("th", { style: { ...cellStyle, textAlign: "left", width: "20%" }, children: "Example" })
|
|
25132
25075
|
] }) }),
|
|
25133
|
-
/* @__PURE__ */ (0,
|
|
25076
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("tbody", { children: entries.map(([name, value]) => {
|
|
25134
25077
|
const required = requiredList.includes(name);
|
|
25135
25078
|
const extra = constraints(value);
|
|
25136
25079
|
const valueExample = schemaExample(value);
|
|
@@ -25143,21 +25086,21 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
|
|
|
25143
25086
|
].filter(Boolean);
|
|
25144
25087
|
const hoverText = hoverParts.join("\n");
|
|
25145
25088
|
const nested = isObject(value.properties) || value.items !== void 0 || Array.isArray(value.oneOf) || Array.isArray(value.anyOf) || Array.isArray(value.allOf);
|
|
25146
|
-
return /* @__PURE__ */ (0,
|
|
25147
|
-
/* @__PURE__ */ (0,
|
|
25148
|
-
/* @__PURE__ */ (0,
|
|
25149
|
-
/* @__PURE__ */ (0,
|
|
25150
|
-
required && /* @__PURE__ */ (0,
|
|
25151
|
-
/* @__PURE__ */ (0,
|
|
25089
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react4.default.Fragment, { children: [
|
|
25090
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("tr", { style: rowStyle, title: hoverText, children: [
|
|
25091
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("td", { style: cellStyle, children: [
|
|
25092
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("code", { style: textWrapStyle, children: name }),
|
|
25093
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { marginLeft: "6px", color: "#d0392e", fontSize: "12px" }, children: "*" }),
|
|
25094
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FieldMetaBadges, { flags })
|
|
25152
25095
|
] }),
|
|
25153
|
-
/* @__PURE__ */ (0,
|
|
25154
|
-
/* @__PURE__ */ (0,
|
|
25155
|
-
/* @__PURE__ */ (0,
|
|
25156
|
-
extra && /* @__PURE__ */ (0,
|
|
25096
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("td", { style: cellStyle, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(TypeBadge, { type: schemaType(value) }) }),
|
|
25097
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("td", { style: cellStyle, children: [
|
|
25098
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { color: "#39485d", ...textWrapStyle }, children: typeof value.description === "string" ? value.description : "-" }),
|
|
25099
|
+
extra && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { marginTop: "4px", fontSize: "12px", color: "#7c889b" }, children: extra })
|
|
25157
25100
|
] }),
|
|
25158
|
-
/* @__PURE__ */ (0,
|
|
25101
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("td", { style: cellStyle, children: valueExample ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("code", { style: textWrapStyle, children: valueExample }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { color: "#9aa4b5" }, children: "-" }) })
|
|
25159
25102
|
] }),
|
|
25160
|
-
nested && /* @__PURE__ */ (0,
|
|
25103
|
+
nested && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("tr", { style: rowStyle, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("td", { style: { ...cellStyle, paddingTop: 0 }, colSpan: 4, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Disclosure, { defaultOpen: detailsControl.open, label: "Nested schema", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { overflowX: "auto" }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SchemaNodeTable, { schema: value, detailsControl, depth: depth + 1, path: `${path}.${name}` }) }) }, `${detailsControl.seed}:${path}.${name}:nested`) }) })
|
|
25161
25104
|
] }, name);
|
|
25162
25105
|
}) })
|
|
25163
25106
|
] }) })
|
|
@@ -25174,41 +25117,41 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
|
|
|
25174
25117
|
cursor: "pointer"
|
|
25175
25118
|
});
|
|
25176
25119
|
var SchemaTableViewer = ({ schema, title = "Schema" }) => {
|
|
25177
|
-
const [mode, setMode] = (0,
|
|
25178
|
-
const [detailsControl, setDetailsControl] = (0,
|
|
25120
|
+
const [mode, setMode] = (0, import_react4.useState)("table");
|
|
25121
|
+
const [detailsControl, setDetailsControl] = (0, import_react4.useState)({ open: true, seed: 0 });
|
|
25179
25122
|
const isSchemaObject = isObject(schema);
|
|
25180
25123
|
const canExpandCollapse = isSchemaObject && hasExpandableContent(schema);
|
|
25181
25124
|
const resetDetails = (open) => {
|
|
25182
25125
|
setDetailsControl((prev) => ({ open, seed: prev.seed + 1 }));
|
|
25183
25126
|
};
|
|
25184
|
-
return /* @__PURE__ */ (0,
|
|
25185
|
-
/* @__PURE__ */ (0,
|
|
25186
|
-
/* @__PURE__ */ (0,
|
|
25187
|
-
/* @__PURE__ */ (0,
|
|
25188
|
-
/* @__PURE__ */ (0,
|
|
25127
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
25128
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: "10px", gap: "12px", flexWrap: "wrap" }, children: [
|
|
25129
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { display: "flex", gap: "8px" }, children: [
|
|
25130
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { style: toolbarButton(mode === "table"), onClick: () => setMode("table"), children: "Table" }),
|
|
25131
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { style: toolbarButton(mode === "json"), onClick: () => setMode("json"), children: "JSON" })
|
|
25189
25132
|
] }),
|
|
25190
|
-
mode === "table" && canExpandCollapse && /* @__PURE__ */ (0,
|
|
25191
|
-
/* @__PURE__ */ (0,
|
|
25192
|
-
/* @__PURE__ */ (0,
|
|
25133
|
+
mode === "table" && canExpandCollapse && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { display: "flex", gap: "8px" }, children: [
|
|
25134
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { style: toolbarButton(false), onClick: () => resetDetails(true), children: "Expand all" }),
|
|
25135
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { style: toolbarButton(false), onClick: () => resetDetails(false), children: "Collapse all" })
|
|
25193
25136
|
] })
|
|
25194
25137
|
] }),
|
|
25195
|
-
mode === "json" && /* @__PURE__ */ (0,
|
|
25196
|
-
mode === "table" && isSchemaObject && /* @__PURE__ */ (0,
|
|
25197
|
-
mode === "table" && !isSchemaObject && /* @__PURE__ */ (0,
|
|
25138
|
+
mode === "json" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("pre", { style: { margin: 0, fontSize: "12px", lineHeight: 1.5, padding: "12px", borderRadius: "8px", background: "#f7f9fc", border: "1px solid #e3e9f3", overflow: "auto" }, children: JSON.stringify(schema, null, 2) }),
|
|
25139
|
+
mode === "table" && isSchemaObject && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SchemaNodeTable, { schema, detailsControl, title }),
|
|
25140
|
+
mode === "table" && !isSchemaObject && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("pre", { style: { margin: 0, fontSize: "12px", lineHeight: 1.5, padding: "12px", borderRadius: "8px", background: "#f7f9fc", border: "1px solid #e3e9f3", overflow: "auto" }, children: JSON.stringify(schema, null, 2) })
|
|
25198
25141
|
] });
|
|
25199
25142
|
};
|
|
25200
25143
|
var SchemaTableViewer_default = SchemaTableViewer;
|
|
25201
25144
|
|
|
25202
25145
|
// src/view/frontend/components/EndpointDetailPage.tsx
|
|
25203
|
-
var
|
|
25146
|
+
var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1);
|
|
25204
25147
|
var EndpointDetailPage = () => {
|
|
25205
25148
|
const { filename, endpointPath } = useParams();
|
|
25206
25149
|
const [searchParams] = useSearchParams();
|
|
25207
25150
|
const method = searchParams.get("method") || "GET";
|
|
25208
|
-
const [endpoint, setEndpoint] = (0,
|
|
25209
|
-
const [loading, setLoading] = (0,
|
|
25210
|
-
const [error, setError] = (0,
|
|
25211
|
-
(0,
|
|
25151
|
+
const [endpoint, setEndpoint] = (0, import_react5.useState)(null);
|
|
25152
|
+
const [loading, setLoading] = (0, import_react5.useState)(true);
|
|
25153
|
+
const [error, setError] = (0, import_react5.useState)(null);
|
|
25154
|
+
(0, import_react5.useEffect)(() => {
|
|
25212
25155
|
if (!filename) return;
|
|
25213
25156
|
fetchModuleDetail(filename).then((data2) => {
|
|
25214
25157
|
const found = data2.endpoints.find(
|
|
@@ -25225,17 +25168,17 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
|
|
|
25225
25168
|
setLoading(false);
|
|
25226
25169
|
});
|
|
25227
25170
|
}, [filename, endpointPath, method]);
|
|
25228
|
-
if (loading) return /* @__PURE__ */ (0,
|
|
25229
|
-
if (error) return /* @__PURE__ */ (0,
|
|
25171
|
+
if (loading) return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { children: "Loading endpoint details..." });
|
|
25172
|
+
if (error) return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { color: "#d32f2f" }, children: [
|
|
25230
25173
|
"Error: ",
|
|
25231
25174
|
error
|
|
25232
25175
|
] });
|
|
25233
|
-
if (!endpoint) return /* @__PURE__ */ (0,
|
|
25234
|
-
return /* @__PURE__ */ (0,
|
|
25235
|
-
/* @__PURE__ */ (0,
|
|
25236
|
-
/* @__PURE__ */ (0,
|
|
25237
|
-
/* @__PURE__ */ (0,
|
|
25238
|
-
/* @__PURE__ */ (0,
|
|
25176
|
+
if (!endpoint) return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { children: "Endpoint not found" });
|
|
25177
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
|
|
25178
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("nav", { style: { marginBottom: "1.5rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Link, { to: `/modules/${filename}`, style: { color: "#4a6bff", textDecoration: "none" }, children: "\u2190 Back to Module" }) }),
|
|
25179
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("header", { style: { marginBottom: "2rem" }, children: [
|
|
25180
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "flex", alignItems: "center", marginBottom: "0.5rem" }, children: [
|
|
25181
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: {
|
|
25239
25182
|
background: methodColor2[endpoint.method] || "#999",
|
|
25240
25183
|
color: "#fff",
|
|
25241
25184
|
fontWeight: "bold",
|
|
@@ -25244,25 +25187,20 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
|
|
|
25244
25187
|
borderRadius: "4px",
|
|
25245
25188
|
marginRight: "1rem"
|
|
25246
25189
|
}, children: endpoint.method }),
|
|
25247
|
-
/* @__PURE__ */ (0,
|
|
25190
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("code", { style: { fontSize: "1.5rem", fontWeight: "600" }, children: endpoint.path })
|
|
25248
25191
|
] }),
|
|
25249
|
-
/* @__PURE__ */ (0,
|
|
25250
|
-
endpoint.description && /* @__PURE__ */ (0,
|
|
25192
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h1", { style: { marginBottom: "0.5rem" }, children: endpoint.summary }),
|
|
25193
|
+
endpoint.description && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { style: { color: "#666", fontSize: "1.1rem" }, children: endpoint.description })
|
|
25251
25194
|
] }),
|
|
25252
|
-
/* @__PURE__ */ (0,
|
|
25253
|
-
/* @__PURE__ */ (0,
|
|
25254
|
-
/* @__PURE__ */ (0,
|
|
25255
|
-
/* @__PURE__ */ (0,
|
|
25195
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: "2rem" }, children: [
|
|
25196
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
|
|
25197
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h2", { children: "Request" }),
|
|
25198
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(RequestDetails, { endpoint })
|
|
25256
25199
|
] }),
|
|
25257
|
-
/* @__PURE__ */ (0,
|
|
25258
|
-
/* @__PURE__ */ (0,
|
|
25259
|
-
/* @__PURE__ */ (0,
|
|
25200
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
|
|
25201
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h2", { children: "Response" }),
|
|
25202
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ResponseDetails, { endpoint })
|
|
25260
25203
|
] })
|
|
25261
|
-
] }),
|
|
25262
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("section", { style: { marginTop: "3rem" }, children: [
|
|
25263
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h2", { children: "Mock Testing" }),
|
|
25264
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { children: "Test this endpoint with generated mock data." }),
|
|
25265
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { style: { background: "#f8f9fa", padding: "1.5rem", borderRadius: "8px" }, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MockTestInterface, { endpoint, filename }) })
|
|
25266
25204
|
] })
|
|
25267
25205
|
] });
|
|
25268
25206
|
};
|
|
@@ -25275,98 +25213,536 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
|
|
|
25275
25213
|
};
|
|
25276
25214
|
var RequestDetails = ({ endpoint }) => {
|
|
25277
25215
|
const { request } = endpoint;
|
|
25278
|
-
if (!request) return /* @__PURE__ */ (0,
|
|
25279
|
-
return /* @__PURE__ */ (0,
|
|
25280
|
-
request.headers && /* @__PURE__ */ (0,
|
|
25281
|
-
/* @__PURE__ */ (0,
|
|
25282
|
-
/* @__PURE__ */ (0,
|
|
25216
|
+
if (!request) return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { children: "No request details defined." });
|
|
25217
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
|
|
25218
|
+
request.headers && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { marginBottom: "1.5rem" }, children: [
|
|
25219
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h4", { children: "Headers" }),
|
|
25220
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { background: "#fff", padding: "1rem", borderRadius: "4px", border: "1px solid #eee" }, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SchemaTableViewer_default, { schema: request.headers }) })
|
|
25283
25221
|
] }),
|
|
25284
|
-
request.params && /* @__PURE__ */ (0,
|
|
25285
|
-
/* @__PURE__ */ (0,
|
|
25286
|
-
/* @__PURE__ */ (0,
|
|
25222
|
+
request.params && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { marginBottom: "1.5rem" }, children: [
|
|
25223
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h4", { children: "Path Parameters" }),
|
|
25224
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { background: "#fff", padding: "1rem", borderRadius: "4px", border: "1px solid #eee" }, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SchemaTableViewer_default, { schema: request.params }) })
|
|
25287
25225
|
] }),
|
|
25288
|
-
request.query && /* @__PURE__ */ (0,
|
|
25289
|
-
/* @__PURE__ */ (0,
|
|
25290
|
-
/* @__PURE__ */ (0,
|
|
25226
|
+
request.query && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { marginBottom: "1.5rem" }, children: [
|
|
25227
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h4", { children: "Query Parameters" }),
|
|
25228
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { background: "#fff", padding: "1rem", borderRadius: "4px", border: "1px solid #eee" }, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SchemaTableViewer_default, { schema: request.query }) })
|
|
25291
25229
|
] }),
|
|
25292
|
-
request.body && /* @__PURE__ */ (0,
|
|
25293
|
-
/* @__PURE__ */ (0,
|
|
25294
|
-
/* @__PURE__ */ (0,
|
|
25230
|
+
request.body && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { marginBottom: "1.5rem" }, children: [
|
|
25231
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h4", { children: "Request Body" }),
|
|
25232
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { background: "#fff", padding: "1rem", borderRadius: "4px", border: "1px solid #eee" }, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SchemaTableViewer_default, { schema: request.body }) })
|
|
25295
25233
|
] })
|
|
25296
25234
|
] });
|
|
25297
25235
|
};
|
|
25298
25236
|
var ResponseDetails = ({ endpoint }) => {
|
|
25299
25237
|
const { response } = endpoint;
|
|
25300
|
-
if (!response) return /* @__PURE__ */ (0,
|
|
25301
|
-
return /* @__PURE__ */ (0,
|
|
25302
|
-
/* @__PURE__ */ (0,
|
|
25238
|
+
if (!response) return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { children: "No response details defined." });
|
|
25239
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { children: Object.entries(response).map(([statusCode, schema]) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { marginBottom: "1.5rem" }, children: [
|
|
25240
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("h4", { children: [
|
|
25303
25241
|
"Status ",
|
|
25304
25242
|
statusCode
|
|
25305
25243
|
] }),
|
|
25306
|
-
/* @__PURE__ */ (0,
|
|
25244
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { background: "#fff", padding: "1rem", borderRadius: "4px", border: "1px solid #eee" }, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SchemaTableViewer_default, { schema }) })
|
|
25307
25245
|
] }, statusCode)) });
|
|
25308
25246
|
};
|
|
25309
|
-
var
|
|
25310
|
-
|
|
25311
|
-
|
|
25312
|
-
|
|
25313
|
-
|
|
25247
|
+
var EndpointDetailPage_default = EndpointDetailPage;
|
|
25248
|
+
|
|
25249
|
+
// src/view/frontend/components/MockViewPage.tsx
|
|
25250
|
+
var import_react7 = __toESM(require_react(), 1);
|
|
25251
|
+
|
|
25252
|
+
// src/view/frontend/components/JsonViewer.tsx
|
|
25253
|
+
var import_react6 = __toESM(require_react(), 1);
|
|
25254
|
+
var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1);
|
|
25255
|
+
var JsonViewer = ({ data: data2, defaultExpanded = true, maxDepth = 3 }) => {
|
|
25256
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { style: { fontFamily: "Monaco, Consolas, monospace", fontSize: "13px" }, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(JsonNode, { value: data2, expanded: defaultExpanded, depth: 0, maxDepth }) });
|
|
25257
|
+
};
|
|
25258
|
+
var JsonNode = ({ value, expanded, depth, maxDepth }) => {
|
|
25259
|
+
const [isExpanded, setIsExpanded] = (0, import_react6.useState)(expanded);
|
|
25260
|
+
if (value === null) {
|
|
25261
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { style: { color: "#999" }, children: "null" });
|
|
25262
|
+
}
|
|
25263
|
+
if (typeof value === "boolean") {
|
|
25264
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { style: { color: "#ff79c6" }, children: String(value) });
|
|
25265
|
+
}
|
|
25266
|
+
if (typeof value === "number") {
|
|
25267
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { style: { color: "#bd93f9" }, children: value });
|
|
25268
|
+
}
|
|
25269
|
+
if (typeof value === "string") {
|
|
25270
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { style: { color: "#f1fa8c" }, children: [
|
|
25271
|
+
'"',
|
|
25272
|
+
value,
|
|
25273
|
+
'"'
|
|
25274
|
+
] });
|
|
25275
|
+
}
|
|
25276
|
+
if (Array.isArray(value)) {
|
|
25277
|
+
if (value.length === 0) {
|
|
25278
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { style: { color: "#999" }, children: "[]" });
|
|
25279
|
+
}
|
|
25280
|
+
if (depth >= maxDepth || !isExpanded) {
|
|
25281
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { children: [
|
|
25282
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { style: { color: "#999" }, children: "[" }),
|
|
25283
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { style: { color: "#999" }, children: [
|
|
25284
|
+
"\u2026 ",
|
|
25285
|
+
value.length,
|
|
25286
|
+
" items"
|
|
25287
|
+
] }),
|
|
25288
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { style: { color: "#999" }, children: "]" }),
|
|
25289
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ToggleButton, { expanded: isExpanded, onToggle: () => setIsExpanded(!isExpanded) })
|
|
25290
|
+
] });
|
|
25291
|
+
}
|
|
25292
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { children: [
|
|
25293
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { style: { color: "#999" }, children: "[" }),
|
|
25294
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ToggleButton, { expanded: isExpanded, onToggle: () => setIsExpanded(!isExpanded) }),
|
|
25295
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { style: { marginLeft: `${depth + 1}em` }, children: value.map((item, idx) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { children: [
|
|
25296
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(JsonNode, { value: item, expanded, depth: depth + 1, maxDepth }),
|
|
25297
|
+
idx < value.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { style: { color: "#999" }, children: "," })
|
|
25298
|
+
] }, idx)) }),
|
|
25299
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { style: { color: "#999" }, children: "]" })
|
|
25300
|
+
] });
|
|
25301
|
+
}
|
|
25302
|
+
if (typeof value === "object") {
|
|
25303
|
+
const obj = value;
|
|
25304
|
+
const keys = Object.keys(obj);
|
|
25305
|
+
if (keys.length === 0) {
|
|
25306
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { style: { color: "#999" }, children: "{}" });
|
|
25307
|
+
}
|
|
25308
|
+
if (depth >= maxDepth || !isExpanded) {
|
|
25309
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { children: [
|
|
25310
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { style: { color: "#999" }, children: "{" }),
|
|
25311
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { style: { color: "#999" }, children: [
|
|
25312
|
+
"\u2026 ",
|
|
25313
|
+
keys.length,
|
|
25314
|
+
" keys"
|
|
25315
|
+
] }),
|
|
25316
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { style: { color: "#999" }, children: "}" }),
|
|
25317
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ToggleButton, { expanded: isExpanded, onToggle: () => setIsExpanded(!isExpanded) })
|
|
25318
|
+
] });
|
|
25319
|
+
}
|
|
25320
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { children: [
|
|
25321
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { style: { color: "#999" }, children: "{" }),
|
|
25322
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ToggleButton, { expanded: isExpanded, onToggle: () => setIsExpanded(!isExpanded) }),
|
|
25323
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { style: { marginLeft: `${depth + 1}em` }, children: keys.map((key, idx) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { children: [
|
|
25324
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { style: { color: "#8be9fd" }, children: key }),
|
|
25325
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { style: { color: "#999" }, children: ": " }),
|
|
25326
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(JsonNode, { value: obj[key], expanded, depth: depth + 1, maxDepth }),
|
|
25327
|
+
idx < keys.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { style: { color: "#999" }, children: "," })
|
|
25328
|
+
] }, key)) }),
|
|
25329
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { style: { color: "#999" }, children: "}" })
|
|
25330
|
+
] });
|
|
25331
|
+
}
|
|
25332
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { style: { color: "#999" }, children: String(value) });
|
|
25333
|
+
};
|
|
25334
|
+
var ToggleButton = ({ expanded, onToggle }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
25335
|
+
"button",
|
|
25336
|
+
{
|
|
25337
|
+
onClick: onToggle,
|
|
25338
|
+
style: {
|
|
25339
|
+
background: "none",
|
|
25340
|
+
border: "none",
|
|
25341
|
+
color: "#8be9fd",
|
|
25342
|
+
cursor: "pointer",
|
|
25343
|
+
fontSize: "12px",
|
|
25344
|
+
marginLeft: "4px",
|
|
25345
|
+
padding: "0 2px"
|
|
25346
|
+
},
|
|
25347
|
+
children: expanded ? "\u2212" : "+"
|
|
25348
|
+
}
|
|
25349
|
+
);
|
|
25350
|
+
var JsonViewer_default = JsonViewer;
|
|
25351
|
+
|
|
25352
|
+
// src/view/frontend/components/MockViewPage.tsx
|
|
25353
|
+
var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
|
|
25354
|
+
var MockViewPage = () => {
|
|
25355
|
+
const { filename, endpointPath } = useParams();
|
|
25356
|
+
const [searchParams] = useSearchParams();
|
|
25357
|
+
const navigate = useNavigate();
|
|
25358
|
+
const method = searchParams.get("method") || "GET";
|
|
25359
|
+
const status = searchParams.get("status") || void 0;
|
|
25360
|
+
const [mock, setMock] = (0, import_react7.useState)(null);
|
|
25361
|
+
const [loading, setLoading] = (0, import_react7.useState)(true);
|
|
25362
|
+
const [error, setError] = (0, import_react7.useState)(null);
|
|
25363
|
+
const [copied, setCopied] = (0, import_react7.useState)(false);
|
|
25364
|
+
(0, import_react7.useEffect)(() => {
|
|
25365
|
+
if (!filename || !endpointPath) return;
|
|
25314
25366
|
setLoading(true);
|
|
25315
|
-
|
|
25367
|
+
fetchMock(filename, method, endpointPath, status).then((data2) => {
|
|
25368
|
+
setMock(data2);
|
|
25369
|
+
setLoading(false);
|
|
25370
|
+
}).catch((err) => {
|
|
25371
|
+
setError(err.message);
|
|
25372
|
+
setLoading(false);
|
|
25373
|
+
});
|
|
25374
|
+
}, [filename, endpointPath, method, status]);
|
|
25375
|
+
if (loading) return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { children: "Loading mock..." });
|
|
25376
|
+
if (error) return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: { color: "#d32f2f" }, children: [
|
|
25377
|
+
"Error: ",
|
|
25378
|
+
error
|
|
25379
|
+
] });
|
|
25380
|
+
if (!mock) return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { children: "No mock data" });
|
|
25381
|
+
const decodedPath = endpointPath || "";
|
|
25382
|
+
const encodedPath = encodeURIComponent(decodedPath);
|
|
25383
|
+
const editHref = `/modules/${filename}/endpoints/${encodedPath}/mock/edit?method=${method}&status=${mock.status}`;
|
|
25384
|
+
const moduleHref = `/modules/${filename}`;
|
|
25385
|
+
const onChangeStatus = (next) => {
|
|
25386
|
+
navigate(`/modules/${filename}/endpoints/${encodedPath}/mock?method=${method}&status=${next}`);
|
|
25387
|
+
};
|
|
25388
|
+
const curlCmd = mock.curl;
|
|
25389
|
+
const copyCurl = async () => {
|
|
25316
25390
|
try {
|
|
25317
|
-
|
|
25318
|
-
|
|
25319
|
-
|
|
25320
|
-
|
|
25321
|
-
|
|
25322
|
-
|
|
25323
|
-
|
|
25324
|
-
|
|
25325
|
-
|
|
25326
|
-
|
|
25391
|
+
await navigator.clipboard.writeText(curlCmd);
|
|
25392
|
+
setCopied(true);
|
|
25393
|
+
setTimeout(() => setCopied(false), 1500);
|
|
25394
|
+
} catch {
|
|
25395
|
+
}
|
|
25396
|
+
};
|
|
25397
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { children: [
|
|
25398
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("nav", { style: { marginBottom: "1.5rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Link, { to: moduleHref, style: { color: "#4a6bff", textDecoration: "none" }, children: "\u2190 Back to Module" }) }),
|
|
25399
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("header", { style: { marginBottom: "1.5rem" }, children: [
|
|
25400
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("h1", { style: { marginBottom: "0.25rem" }, children: "Mock View" }),
|
|
25401
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("code", { style: { color: "#666" }, children: [
|
|
25402
|
+
method,
|
|
25403
|
+
" ",
|
|
25404
|
+
decodedPath
|
|
25405
|
+
] }),
|
|
25406
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: { marginTop: "0.75rem", display: "flex", alignItems: "center", gap: "0.5rem" }, children: [
|
|
25407
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("label", { style: { fontSize: "0.9rem", color: "#444" }, children: "Status:" }),
|
|
25408
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
25409
|
+
"select",
|
|
25410
|
+
{
|
|
25411
|
+
value: mock.status,
|
|
25412
|
+
onChange: (e) => onChangeStatus(e.target.value),
|
|
25413
|
+
style: { padding: "4px 8px", borderRadius: "4px", border: "1px solid #ccc" },
|
|
25414
|
+
children: Object.entries(mock.availableStatuses).map(([code, kind]) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("option", { value: code, children: [
|
|
25415
|
+
code,
|
|
25416
|
+
" \u2014 ",
|
|
25417
|
+
kind === "override" ? "saved" : "default"
|
|
25418
|
+
] }, code))
|
|
25419
|
+
}
|
|
25420
|
+
)
|
|
25421
|
+
] }),
|
|
25422
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: { marginTop: "0.5rem" }, children: [
|
|
25423
|
+
mock.isDefault ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
25424
|
+
"span",
|
|
25425
|
+
{
|
|
25426
|
+
style: {
|
|
25427
|
+
background: "#fff3cd",
|
|
25428
|
+
color: "#856404",
|
|
25429
|
+
padding: "2px 8px",
|
|
25430
|
+
borderRadius: "4px",
|
|
25431
|
+
fontSize: "0.85rem"
|
|
25432
|
+
},
|
|
25433
|
+
children: "Auto-generated (no saved override)"
|
|
25434
|
+
}
|
|
25435
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
25436
|
+
"span",
|
|
25437
|
+
{
|
|
25438
|
+
style: {
|
|
25439
|
+
background: "#d4edda",
|
|
25440
|
+
color: "#155724",
|
|
25441
|
+
padding: "2px 8px",
|
|
25442
|
+
borderRadius: "4px",
|
|
25443
|
+
fontSize: "0.85rem"
|
|
25444
|
+
},
|
|
25445
|
+
children: "Saved override"
|
|
25446
|
+
}
|
|
25447
|
+
),
|
|
25448
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
25449
|
+
Link,
|
|
25450
|
+
{
|
|
25451
|
+
to: editHref,
|
|
25452
|
+
style: { marginLeft: "1rem", color: "#4a6bff", textDecoration: "none", fontSize: "0.9rem" },
|
|
25453
|
+
children: "Edit \u2192"
|
|
25454
|
+
}
|
|
25455
|
+
)
|
|
25456
|
+
] })
|
|
25457
|
+
] }),
|
|
25458
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { style: { background: "#fff", padding: "1rem", borderRadius: "4px", border: "1px solid #eee" }, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(JsonViewer_default, { data: mock.data, defaultExpanded: true }) }),
|
|
25459
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("section", { style: { marginTop: "2rem" }, children: [
|
|
25460
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: "0.5rem" }, children: [
|
|
25461
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("h3", { style: { margin: 0 }, children: "cURL" }),
|
|
25462
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
25463
|
+
"button",
|
|
25464
|
+
{
|
|
25465
|
+
onClick: copyCurl,
|
|
25466
|
+
style: {
|
|
25467
|
+
background: copied ? "#28a745" : "#4a6bff",
|
|
25468
|
+
color: "#fff",
|
|
25469
|
+
border: "none",
|
|
25470
|
+
padding: "4px 12px",
|
|
25471
|
+
borderRadius: "4px",
|
|
25472
|
+
cursor: "pointer",
|
|
25473
|
+
fontSize: "0.85rem"
|
|
25474
|
+
},
|
|
25475
|
+
children: copied ? "Copied!" : "Copy"
|
|
25476
|
+
}
|
|
25477
|
+
)
|
|
25478
|
+
] }),
|
|
25479
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
25480
|
+
"pre",
|
|
25481
|
+
{
|
|
25482
|
+
style: {
|
|
25483
|
+
background: "#1e1e1e",
|
|
25484
|
+
color: "#d4d4d4",
|
|
25485
|
+
padding: "1rem",
|
|
25486
|
+
borderRadius: "4px",
|
|
25487
|
+
overflowX: "auto",
|
|
25488
|
+
fontSize: "0.85rem",
|
|
25489
|
+
lineHeight: 1.5,
|
|
25490
|
+
margin: 0
|
|
25491
|
+
},
|
|
25492
|
+
children: curlCmd
|
|
25493
|
+
}
|
|
25494
|
+
),
|
|
25495
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { style: { marginTop: "0.5rem", fontSize: "0.8rem", color: "#888" }, children: "Path params, query, headers and body are filled with examples generated from the endpoint's request schema. Tweak before running." })
|
|
25496
|
+
] })
|
|
25497
|
+
] });
|
|
25498
|
+
};
|
|
25499
|
+
var MockViewPage_default = MockViewPage;
|
|
25500
|
+
|
|
25501
|
+
// src/view/frontend/components/MockEditPage.tsx
|
|
25502
|
+
var import_react8 = __toESM(require_react(), 1);
|
|
25503
|
+
var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
|
|
25504
|
+
var MockEditPage = () => {
|
|
25505
|
+
const { filename, endpointPath } = useParams();
|
|
25506
|
+
const [searchParams] = useSearchParams();
|
|
25507
|
+
const navigate = useNavigate();
|
|
25508
|
+
const method = searchParams.get("method") || "GET";
|
|
25509
|
+
const status = searchParams.get("status") || void 0;
|
|
25510
|
+
const [text, setText] = (0, import_react8.useState)("");
|
|
25511
|
+
const [isDefault, setIsDefault] = (0, import_react8.useState)(true);
|
|
25512
|
+
const [activeStatus, setActiveStatus] = (0, import_react8.useState)("200");
|
|
25513
|
+
const [availableStatuses, setAvailableStatuses] = (0, import_react8.useState)({});
|
|
25514
|
+
const [loading, setLoading] = (0, import_react8.useState)(true);
|
|
25515
|
+
const [saving, setSaving] = (0, import_react8.useState)(false);
|
|
25516
|
+
const [error, setError] = (0, import_react8.useState)(null);
|
|
25517
|
+
const [parseError, setParseError] = (0, import_react8.useState)(null);
|
|
25518
|
+
const [statusMessage, setStatusMessage] = (0, import_react8.useState)(null);
|
|
25519
|
+
(0, import_react8.useEffect)(() => {
|
|
25520
|
+
if (!filename || !endpointPath) return;
|
|
25521
|
+
setLoading(true);
|
|
25522
|
+
fetchMock(filename, method, endpointPath, status).then((data2) => {
|
|
25523
|
+
setText(JSON.stringify(data2.template ?? data2.data, null, 2));
|
|
25524
|
+
setIsDefault(data2.isDefault);
|
|
25525
|
+
setActiveStatus(data2.status);
|
|
25526
|
+
setAvailableStatuses(data2.availableStatuses);
|
|
25527
|
+
setLoading(false);
|
|
25528
|
+
}).catch((err) => {
|
|
25327
25529
|
setError(err.message);
|
|
25328
|
-
} finally {
|
|
25329
25530
|
setLoading(false);
|
|
25531
|
+
});
|
|
25532
|
+
}, [filename, endpointPath, method, status]);
|
|
25533
|
+
const handleSave = async () => {
|
|
25534
|
+
setParseError(null);
|
|
25535
|
+
setStatusMessage(null);
|
|
25536
|
+
let parsed;
|
|
25537
|
+
try {
|
|
25538
|
+
parsed = JSON.parse(text);
|
|
25539
|
+
} catch (e) {
|
|
25540
|
+
setParseError(`Invalid JSON: ${e.message}`);
|
|
25541
|
+
return;
|
|
25542
|
+
}
|
|
25543
|
+
setSaving(true);
|
|
25544
|
+
try {
|
|
25545
|
+
await saveMock(filename, method, endpointPath, parsed, activeStatus);
|
|
25546
|
+
setIsDefault(false);
|
|
25547
|
+
setAvailableStatuses((prev) => ({ ...prev, [activeStatus]: "override" }));
|
|
25548
|
+
setStatusMessage("Saved.");
|
|
25549
|
+
} catch (e) {
|
|
25550
|
+
setError(e.message);
|
|
25551
|
+
} finally {
|
|
25552
|
+
setSaving(false);
|
|
25330
25553
|
}
|
|
25331
25554
|
};
|
|
25332
|
-
|
|
25333
|
-
|
|
25334
|
-
|
|
25555
|
+
const handleReset = async () => {
|
|
25556
|
+
if (!confirm("Delete the saved mock and fall back to generator default?")) return;
|
|
25557
|
+
setSaving(true);
|
|
25558
|
+
setStatusMessage(null);
|
|
25559
|
+
try {
|
|
25560
|
+
await deleteMock(filename, method, endpointPath, activeStatus);
|
|
25561
|
+
const fresh = await fetchMock(filename, method, endpointPath, activeStatus);
|
|
25562
|
+
setText(JSON.stringify(fresh.template ?? fresh.data, null, 2));
|
|
25563
|
+
setIsDefault(fresh.isDefault);
|
|
25564
|
+
setAvailableStatuses(fresh.availableStatuses);
|
|
25565
|
+
setStatusMessage("Reset to generator default.");
|
|
25566
|
+
} catch (e) {
|
|
25567
|
+
setError(e.message);
|
|
25568
|
+
} finally {
|
|
25569
|
+
setSaving(false);
|
|
25570
|
+
}
|
|
25571
|
+
};
|
|
25572
|
+
if (loading) return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: "Loading mock..." });
|
|
25573
|
+
if (error) return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: { color: "#d32f2f" }, children: [
|
|
25574
|
+
"Error: ",
|
|
25575
|
+
error
|
|
25576
|
+
] });
|
|
25577
|
+
const decodedPath = endpointPath || "";
|
|
25578
|
+
const encodedPath = encodeURIComponent(decodedPath);
|
|
25579
|
+
const viewHref = `/modules/${filename}/endpoints/${encodedPath}/mock?method=${method}&status=${activeStatus}`;
|
|
25580
|
+
const moduleHref = `/modules/${filename}`;
|
|
25581
|
+
const onChangeStatus = (next) => {
|
|
25582
|
+
navigate(`/modules/${filename}/endpoints/${encodedPath}/mock/edit?method=${method}&status=${next}`);
|
|
25583
|
+
};
|
|
25584
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
25585
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("nav", { style: { marginBottom: "1.5rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Link, { to: moduleHref, style: { color: "#4a6bff", textDecoration: "none" }, children: "\u2190 Back to Module" }) }),
|
|
25586
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("header", { style: { marginBottom: "1rem" }, children: [
|
|
25587
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h1", { style: { marginBottom: "0.25rem" }, children: "Mock Edit" }),
|
|
25588
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("code", { style: { color: "#666" }, children: [
|
|
25589
|
+
method,
|
|
25590
|
+
" ",
|
|
25591
|
+
decodedPath
|
|
25592
|
+
] }),
|
|
25593
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: { marginTop: "0.75rem", display: "flex", alignItems: "center", gap: "0.5rem" }, children: [
|
|
25594
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("label", { style: { fontSize: "0.9rem", color: "#444" }, children: "Status:" }),
|
|
25595
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
25596
|
+
"select",
|
|
25597
|
+
{
|
|
25598
|
+
value: activeStatus,
|
|
25599
|
+
onChange: (e) => onChangeStatus(e.target.value),
|
|
25600
|
+
style: { padding: "4px 8px", borderRadius: "4px", border: "1px solid #ccc" },
|
|
25601
|
+
children: Object.entries(availableStatuses).map(([code, kind]) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("option", { value: code, children: [
|
|
25602
|
+
code,
|
|
25603
|
+
" \u2014 ",
|
|
25604
|
+
kind === "override" ? "saved" : "default"
|
|
25605
|
+
] }, code))
|
|
25606
|
+
}
|
|
25607
|
+
)
|
|
25608
|
+
] }),
|
|
25609
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { style: { marginTop: "0.5rem" }, children: isDefault ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
25610
|
+
"span",
|
|
25611
|
+
{
|
|
25612
|
+
style: {
|
|
25613
|
+
background: "#fff3cd",
|
|
25614
|
+
color: "#856404",
|
|
25615
|
+
padding: "2px 8px",
|
|
25616
|
+
borderRadius: "4px",
|
|
25617
|
+
fontSize: "0.85rem"
|
|
25618
|
+
},
|
|
25619
|
+
children: "Editing generator default (not yet saved)"
|
|
25620
|
+
}
|
|
25621
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
25622
|
+
"span",
|
|
25623
|
+
{
|
|
25624
|
+
style: {
|
|
25625
|
+
background: "#d4edda",
|
|
25626
|
+
color: "#155724",
|
|
25627
|
+
padding: "2px 8px",
|
|
25628
|
+
borderRadius: "4px",
|
|
25629
|
+
fontSize: "0.85rem"
|
|
25630
|
+
},
|
|
25631
|
+
children: "Saved override"
|
|
25632
|
+
}
|
|
25633
|
+
) })
|
|
25634
|
+
] }),
|
|
25635
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
25636
|
+
"div",
|
|
25335
25637
|
{
|
|
25336
|
-
onClick: handleTest,
|
|
25337
|
-
disabled: loading,
|
|
25338
25638
|
style: {
|
|
25339
|
-
background: "#
|
|
25340
|
-
|
|
25341
|
-
border: "none",
|
|
25342
|
-
padding: "0.75rem 1.5rem",
|
|
25639
|
+
background: "#f0f4ff",
|
|
25640
|
+
border: "1px solid #c7d2fe",
|
|
25343
25641
|
borderRadius: "4px",
|
|
25344
|
-
|
|
25345
|
-
|
|
25642
|
+
padding: "0.75rem 1rem",
|
|
25643
|
+
marginBottom: "0.75rem",
|
|
25644
|
+
fontSize: "0.85rem",
|
|
25645
|
+
color: "#3730a3",
|
|
25646
|
+
lineHeight: 1.6
|
|
25346
25647
|
},
|
|
25347
|
-
children:
|
|
25648
|
+
children: [
|
|
25649
|
+
"Mock.js expressions are supported. Examples:",
|
|
25650
|
+
" ",
|
|
25651
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("code", { children: '"@cname"' }),
|
|
25652
|
+
", ",
|
|
25653
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("code", { children: '"@integer(1,100)"' }),
|
|
25654
|
+
", ",
|
|
25655
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("code", { children: '"@email"' }),
|
|
25656
|
+
",",
|
|
25657
|
+
" ",
|
|
25658
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("code", { children: `"@date('yyyy-MM-dd')"` }),
|
|
25659
|
+
", ",
|
|
25660
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("code", { children: `"list|1-5": [{ "id": "@id" }]` }),
|
|
25661
|
+
". Templates are stored as-is and expanded each time the mock is requested."
|
|
25662
|
+
]
|
|
25348
25663
|
}
|
|
25349
25664
|
),
|
|
25350
|
-
|
|
25351
|
-
"
|
|
25352
|
-
|
|
25353
|
-
|
|
25354
|
-
|
|
25355
|
-
|
|
25356
|
-
|
|
25665
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
25666
|
+
"textarea",
|
|
25667
|
+
{
|
|
25668
|
+
value: text,
|
|
25669
|
+
onChange: (e) => setText(e.target.value),
|
|
25670
|
+
spellCheck: false,
|
|
25671
|
+
style: {
|
|
25672
|
+
width: "100%",
|
|
25673
|
+
minHeight: "420px",
|
|
25674
|
+
fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace",
|
|
25675
|
+
fontSize: "0.9rem",
|
|
25676
|
+
padding: "1rem",
|
|
25677
|
+
border: "1px solid #ddd",
|
|
25678
|
+
borderRadius: "4px",
|
|
25679
|
+
background: "#fff"
|
|
25680
|
+
}
|
|
25681
|
+
}
|
|
25682
|
+
),
|
|
25683
|
+
parseError && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { style: { marginTop: "0.5rem", color: "#d32f2f" }, children: parseError }),
|
|
25684
|
+
statusMessage && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { style: { marginTop: "0.5rem", color: "#155724" }, children: statusMessage }),
|
|
25685
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: { marginTop: "1rem", display: "flex", gap: "0.75rem" }, children: [
|
|
25686
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
25687
|
+
"button",
|
|
25688
|
+
{
|
|
25689
|
+
onClick: handleSave,
|
|
25690
|
+
disabled: saving,
|
|
25691
|
+
style: {
|
|
25692
|
+
background: "#4a6bff",
|
|
25693
|
+
color: "#fff",
|
|
25694
|
+
border: "none",
|
|
25695
|
+
padding: "0.6rem 1.25rem",
|
|
25696
|
+
borderRadius: "4px",
|
|
25697
|
+
cursor: "pointer"
|
|
25698
|
+
},
|
|
25699
|
+
children: saving ? "Saving..." : "Save"
|
|
25700
|
+
}
|
|
25701
|
+
),
|
|
25702
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
25703
|
+
"button",
|
|
25704
|
+
{
|
|
25705
|
+
onClick: handleReset,
|
|
25706
|
+
disabled: saving || isDefault,
|
|
25707
|
+
style: {
|
|
25708
|
+
background: "#fff",
|
|
25709
|
+
color: "#d32f2f",
|
|
25710
|
+
border: "1px solid #d32f2f",
|
|
25711
|
+
padding: "0.6rem 1.25rem",
|
|
25712
|
+
borderRadius: "4px",
|
|
25713
|
+
cursor: isDefault ? "not-allowed" : "pointer"
|
|
25714
|
+
},
|
|
25715
|
+
children: "Reset to default"
|
|
25716
|
+
}
|
|
25717
|
+
),
|
|
25718
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
25719
|
+
"button",
|
|
25720
|
+
{
|
|
25721
|
+
onClick: () => navigate(viewHref),
|
|
25722
|
+
style: {
|
|
25723
|
+
background: "#fff",
|
|
25724
|
+
color: "#4a6bff",
|
|
25725
|
+
border: "1px solid #4a6bff",
|
|
25726
|
+
padding: "0.6rem 1.25rem",
|
|
25727
|
+
borderRadius: "4px",
|
|
25728
|
+
cursor: "pointer"
|
|
25729
|
+
},
|
|
25730
|
+
children: "View"
|
|
25731
|
+
}
|
|
25732
|
+
)
|
|
25357
25733
|
] })
|
|
25358
25734
|
] });
|
|
25359
25735
|
};
|
|
25360
|
-
var
|
|
25736
|
+
var MockEditPage_default = MockEditPage;
|
|
25361
25737
|
|
|
25362
25738
|
// src/view/frontend/components/EntitiesPage.tsx
|
|
25363
|
-
var
|
|
25364
|
-
var
|
|
25739
|
+
var import_react9 = __toESM(require_react(), 1);
|
|
25740
|
+
var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
|
|
25365
25741
|
var EntitiesPage = () => {
|
|
25366
|
-
const [entities, setEntities] = (0,
|
|
25367
|
-
const [loading, setLoading] = (0,
|
|
25368
|
-
const [error, setError] = (0,
|
|
25369
|
-
(0,
|
|
25742
|
+
const [entities, setEntities] = (0, import_react9.useState)([]);
|
|
25743
|
+
const [loading, setLoading] = (0, import_react9.useState)(true);
|
|
25744
|
+
const [error, setError] = (0, import_react9.useState)(null);
|
|
25745
|
+
(0, import_react9.useEffect)(() => {
|
|
25370
25746
|
fetchEntities().then((data2) => {
|
|
25371
25747
|
setEntities(data2);
|
|
25372
25748
|
setLoading(false);
|
|
@@ -25375,15 +25751,15 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
|
|
|
25375
25751
|
setLoading(false);
|
|
25376
25752
|
});
|
|
25377
25753
|
}, []);
|
|
25378
|
-
if (loading) return /* @__PURE__ */ (0,
|
|
25379
|
-
if (error) return /* @__PURE__ */ (0,
|
|
25754
|
+
if (loading) return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { children: "Loading entities..." });
|
|
25755
|
+
if (error) return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { color: "#d32f2f" }, children: [
|
|
25380
25756
|
"Error: ",
|
|
25381
25757
|
error
|
|
25382
25758
|
] });
|
|
25383
|
-
return /* @__PURE__ */ (0,
|
|
25384
|
-
/* @__PURE__ */ (0,
|
|
25385
|
-
/* @__PURE__ */ (0,
|
|
25386
|
-
/* @__PURE__ */ (0,
|
|
25759
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
|
|
25760
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h1", { children: "Entities" }),
|
|
25761
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { children: "Reusable schema entities referenced by API endpoints." }),
|
|
25762
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
25387
25763
|
"div",
|
|
25388
25764
|
{
|
|
25389
25765
|
style: {
|
|
@@ -25392,7 +25768,7 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
|
|
|
25392
25768
|
gap: "1.5rem",
|
|
25393
25769
|
marginTop: "2rem"
|
|
25394
25770
|
},
|
|
25395
|
-
children: entities.map((entity) => /* @__PURE__ */ (0,
|
|
25771
|
+
children: entities.map((entity) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
25396
25772
|
"div",
|
|
25397
25773
|
{
|
|
25398
25774
|
style: {
|
|
@@ -25403,7 +25779,7 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
|
|
|
25403
25779
|
borderLeft: "4px solid #25b199"
|
|
25404
25780
|
},
|
|
25405
25781
|
children: [
|
|
25406
|
-
/* @__PURE__ */ (0,
|
|
25782
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h3", { style: { marginTop: 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
25407
25783
|
Link,
|
|
25408
25784
|
{
|
|
25409
25785
|
to: `/entities/${entity.filename}`,
|
|
@@ -25411,8 +25787,8 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
|
|
|
25411
25787
|
children: entity.title
|
|
25412
25788
|
}
|
|
25413
25789
|
) }),
|
|
25414
|
-
/* @__PURE__ */ (0,
|
|
25415
|
-
/* @__PURE__ */ (0,
|
|
25790
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { style: { color: "#666", fontSize: "0.95rem", minHeight: "40px" }, children: entity.description || "No description" }),
|
|
25791
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
25416
25792
|
"div",
|
|
25417
25793
|
{
|
|
25418
25794
|
style: {
|
|
@@ -25422,13 +25798,13 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
|
|
|
25422
25798
|
marginTop: "0.9rem"
|
|
25423
25799
|
},
|
|
25424
25800
|
children: [
|
|
25425
|
-
/* @__PURE__ */ (0,
|
|
25426
|
-
/* @__PURE__ */ (0,
|
|
25801
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { style: { fontSize: "0.85rem", color: "#666" }, children: [
|
|
25802
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("i", { className: "fas fa-list" }),
|
|
25427
25803
|
" ",
|
|
25428
25804
|
entity.fieldCount,
|
|
25429
25805
|
" field(s)"
|
|
25430
25806
|
] }),
|
|
25431
|
-
/* @__PURE__ */ (0,
|
|
25807
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
25432
25808
|
Link,
|
|
25433
25809
|
{
|
|
25434
25810
|
to: `/entities/${entity.filename}`,
|
|
@@ -25452,9 +25828,9 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
|
|
|
25452
25828
|
))
|
|
25453
25829
|
}
|
|
25454
25830
|
),
|
|
25455
|
-
entities.length === 0 && /* @__PURE__ */ (0,
|
|
25831
|
+
entities.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { marginTop: "1.5rem", color: "#666" }, children: [
|
|
25456
25832
|
"No entity files found in ",
|
|
25457
|
-
/* @__PURE__ */ (0,
|
|
25833
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("code", { children: "docs/entities" }),
|
|
25458
25834
|
"."
|
|
25459
25835
|
] })
|
|
25460
25836
|
] });
|
|
@@ -25462,14 +25838,14 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
|
|
|
25462
25838
|
var EntitiesPage_default = EntitiesPage;
|
|
25463
25839
|
|
|
25464
25840
|
// src/view/frontend/components/EntityDetailPage.tsx
|
|
25465
|
-
var
|
|
25466
|
-
var
|
|
25841
|
+
var import_react10 = __toESM(require_react(), 1);
|
|
25842
|
+
var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
|
|
25467
25843
|
var EntityDetailPage = () => {
|
|
25468
25844
|
const { filename } = useParams();
|
|
25469
|
-
const [detail, setDetail] = (0,
|
|
25470
|
-
const [loading, setLoading] = (0,
|
|
25471
|
-
const [error, setError] = (0,
|
|
25472
|
-
(0,
|
|
25845
|
+
const [detail, setDetail] = (0, import_react10.useState)(null);
|
|
25846
|
+
const [loading, setLoading] = (0, import_react10.useState)(true);
|
|
25847
|
+
const [error, setError] = (0, import_react10.useState)(null);
|
|
25848
|
+
(0, import_react10.useEffect)(() => {
|
|
25473
25849
|
if (!filename) return;
|
|
25474
25850
|
fetchEntityDetail(filename).then((data2) => {
|
|
25475
25851
|
setDetail(data2);
|
|
@@ -25479,25 +25855,25 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
|
|
|
25479
25855
|
setLoading(false);
|
|
25480
25856
|
});
|
|
25481
25857
|
}, [filename]);
|
|
25482
|
-
if (loading) return /* @__PURE__ */ (0,
|
|
25483
|
-
if (error) return /* @__PURE__ */ (0,
|
|
25858
|
+
if (loading) return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { children: "Loading entity details..." });
|
|
25859
|
+
if (error) return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { color: "#d32f2f" }, children: [
|
|
25484
25860
|
"Error: ",
|
|
25485
25861
|
error
|
|
25486
25862
|
] });
|
|
25487
|
-
if (!detail) return /* @__PURE__ */ (0,
|
|
25863
|
+
if (!detail) return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { children: "Entity not found" });
|
|
25488
25864
|
const entity = detail.entity;
|
|
25489
25865
|
const title = typeof entity.title === "string" ? entity.title : detail.filename;
|
|
25490
25866
|
const description = typeof entity.description === "string" ? entity.description : "No description";
|
|
25491
|
-
return /* @__PURE__ */ (0,
|
|
25492
|
-
/* @__PURE__ */ (0,
|
|
25493
|
-
/* @__PURE__ */ (0,
|
|
25494
|
-
/* @__PURE__ */ (0,
|
|
25495
|
-
/* @__PURE__ */ (0,
|
|
25496
|
-
/* @__PURE__ */ (0,
|
|
25867
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { children: [
|
|
25868
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("nav", { style: { marginBottom: "1.25rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Link, { to: "/entities", style: { color: "#4a6bff", textDecoration: "none" }, children: "\u2190 Back to Entities" }) }),
|
|
25869
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("header", { style: { marginBottom: "1.5rem" }, children: [
|
|
25870
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h1", { style: { marginBottom: "0.5rem" }, children: title }),
|
|
25871
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { style: { color: "#666", marginBottom: "0.5rem" }, children: description }),
|
|
25872
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("code", { style: { color: "#506076" }, children: detail.filename })
|
|
25497
25873
|
] }),
|
|
25498
|
-
/* @__PURE__ */ (0,
|
|
25499
|
-
/* @__PURE__ */ (0,
|
|
25500
|
-
/* @__PURE__ */ (0,
|
|
25874
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("section", { children: [
|
|
25875
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h2", { children: "Entity Schema" }),
|
|
25876
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
25501
25877
|
"div",
|
|
25502
25878
|
{
|
|
25503
25879
|
style: {
|
|
@@ -25506,7 +25882,7 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
|
|
|
25506
25882
|
borderRadius: "8px",
|
|
25507
25883
|
border: "1px solid #e6ecf5"
|
|
25508
25884
|
},
|
|
25509
|
-
children: /* @__PURE__ */ (0,
|
|
25885
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SchemaTableViewer_default, { schema: entity, title })
|
|
25510
25886
|
}
|
|
25511
25887
|
)
|
|
25512
25888
|
] })
|
|
@@ -25515,22 +25891,24 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
|
|
|
25515
25891
|
var EntityDetailPage_default = EntityDetailPage;
|
|
25516
25892
|
|
|
25517
25893
|
// src/view/frontend/index.tsx
|
|
25518
|
-
var
|
|
25894
|
+
var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
|
|
25519
25895
|
var container = document.getElementById("root");
|
|
25520
25896
|
if (!container) throw new Error("Root element not found");
|
|
25521
25897
|
var root = (0, import_client.createRoot)(container);
|
|
25522
25898
|
root.render(
|
|
25523
|
-
/* @__PURE__ */ (0,
|
|
25524
|
-
/* @__PURE__ */ (0,
|
|
25525
|
-
/* @__PURE__ */ (0,
|
|
25526
|
-
/* @__PURE__ */ (0,
|
|
25527
|
-
/* @__PURE__ */ (0,
|
|
25528
|
-
/* @__PURE__ */ (0,
|
|
25529
|
-
/* @__PURE__ */ (0,
|
|
25530
|
-
/* @__PURE__ */ (0,
|
|
25531
|
-
/* @__PURE__ */ (0,
|
|
25899
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react11.default.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BrowserRouter, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Routes, { children: [
|
|
25900
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Route, { path: "/", element: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(App_default, {}), children: [
|
|
25901
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Route, { index: true, element: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(HomePage_default, {}) }),
|
|
25902
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Route, { path: "modules", element: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ModulesPage_default, {}) }),
|
|
25903
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Route, { path: "modules/:filename", element: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ModuleDetailPage_default, {}) }),
|
|
25904
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Route, { path: "modules/:filename/endpoints/:endpointPath", element: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(EndpointDetailPage_default, {}) }),
|
|
25905
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Route, { path: "modules/:filename/endpoints/:endpointPath/mock", element: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(MockViewPage_default, {}) }),
|
|
25906
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Route, { path: "modules/:filename/endpoints/:endpointPath/mock/edit", element: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(MockEditPage_default, {}) }),
|
|
25907
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Route, { path: "entities", element: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(EntitiesPage_default, {}) }),
|
|
25908
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Route, { path: "entities/:filename", element: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(EntityDetailPage_default, {}) }),
|
|
25909
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Route, { path: "search", element: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { children: "Search (coming soon)" }) })
|
|
25532
25910
|
] }),
|
|
25533
|
-
/* @__PURE__ */ (0,
|
|
25911
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Route, { path: "*", element: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { children: "Not Found" }) })
|
|
25534
25912
|
] }) }) })
|
|
25535
25913
|
);
|
|
25536
25914
|
})();
|