@ws-ui/http-handlers-editor 1.11.3-rc3 → 1.11.3-rc4
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/Standalone/index.d.ts +5 -3
- package/dist/index.cjs.js +4 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +452 -416
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import { jsx as e, jsxs as o, Fragment as
|
|
2
|
-
import { useSensors as
|
|
3
|
-
import { useSortable as
|
|
4
|
-
import { FdWarningDanger as q, FdRegex as
|
|
5
|
-
import { useAppDispatch as
|
|
6
|
-
import { createContext as
|
|
7
|
-
import { generate as
|
|
1
|
+
import { jsx as e, jsxs as o, Fragment as O } from "react/jsx-runtime";
|
|
2
|
+
import { useSensors as fe, useSensor as Z, PointerSensor as ye, KeyboardSensor as ve, DndContext as be, closestCenter as Ne, DragOverlay as we } from "@dnd-kit/core";
|
|
3
|
+
import { useSortable as Ee, sortableKeyboardCoordinates as Ce, SortableContext as Te, verticalListSortingStrategy as De, arrayMove as He } from "@dnd-kit/sortable";
|
|
4
|
+
import { FdWarningDanger as q, FdRegex as Se, FdUnRegex as Pe, FdDuplicate as re, FdPen as Re, FdTrash as Ie, FdCloseNaked as B, FdInfoCircle as ae, FdCheckCircle as Ae, FdClose as ke, FdDragHandle as _e, FdDown as Q, FdEmpty as X, FdCode as Le, FdPlus as ee } from "@ws-ui/icons";
|
|
5
|
+
import { useAppDispatch as $, switchEditor as Oe, useAppSelector as M, selectCatalog as se, openModal as le, selectTabByPath as ie, setContent as oe, selectModals as Fe, editModal as $e, closeModal as je, ReduxProvider as Ge, getStore as Me } from "@ws-ui/store";
|
|
6
|
+
import { createContext as qe, useReducer as Be, useEffect as F, useContext as Ue, useState as _, Fragment as de, useMemo as ze } from "react";
|
|
7
|
+
import { generate as W } from "short-uuid";
|
|
8
8
|
import { z as k } from "zod";
|
|
9
|
-
import { ToolbarIcon as
|
|
10
|
-
import { CSS as
|
|
11
|
-
import { Combobox as
|
|
9
|
+
import { ToolbarIcon as Je, Tooltip as E, ModalColor as ce, ModalType as pe, useHotkeys as Ke, ControlledSwitch as We, Modal as Ve, TipsProvider as Qe, HTTP_HANDLERS_TAB_PATH as K, useDidMountEffect as Xe } from "@ws-ui/shared";
|
|
10
|
+
import { CSS as Ye } from "@dnd-kit/utilities";
|
|
11
|
+
import { Combobox as R, Transition as ue } from "@headlessui/react";
|
|
12
12
|
import C from "classnames";
|
|
13
|
-
import { useMultipleSelection as
|
|
14
|
-
import { omit as
|
|
15
|
-
import { Subject as
|
|
16
|
-
import
|
|
17
|
-
import { HTTP_HANDLERS_EDITOR_SCOPE_CLASS as
|
|
18
|
-
const
|
|
13
|
+
import { useMultipleSelection as j, useCombobox as L } from "downshift";
|
|
14
|
+
import { omit as he, isEqual as V } from "lodash";
|
|
15
|
+
import { Subject as Ze } from "rxjs";
|
|
16
|
+
import te from "randexp";
|
|
17
|
+
import { HTTP_HANDLERS_EDITOR_SCOPE_CLASS as et } from "./common.es.js";
|
|
18
|
+
const tt = ({
|
|
19
19
|
label: t,
|
|
20
20
|
Icon: a,
|
|
21
|
-
tab:
|
|
22
|
-
editor:
|
|
21
|
+
tab: n,
|
|
22
|
+
editor: s,
|
|
23
23
|
onBeforeClick: d
|
|
24
24
|
}) => {
|
|
25
|
-
const
|
|
25
|
+
const p = $();
|
|
26
26
|
return /* @__PURE__ */ e(
|
|
27
|
-
|
|
27
|
+
Je,
|
|
28
28
|
{
|
|
29
29
|
label: t,
|
|
30
30
|
Icon: a,
|
|
31
31
|
as: "button",
|
|
32
32
|
onClick: () => {
|
|
33
|
-
d == null || d(),
|
|
34
|
-
|
|
35
|
-
tab:
|
|
36
|
-
editor:
|
|
33
|
+
d == null || d(), p(
|
|
34
|
+
Oe({
|
|
35
|
+
tab: n,
|
|
36
|
+
editor: s
|
|
37
37
|
})
|
|
38
38
|
);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
);
|
|
42
|
-
},
|
|
42
|
+
}, me = qe(void 0), G = new Ze(), nt = (t, a) => {
|
|
43
43
|
switch (a.type) {
|
|
44
44
|
case "UPDATE_HANDLERS":
|
|
45
45
|
return {
|
|
@@ -48,15 +48,15 @@ const Ze = ({
|
|
|
48
48
|
};
|
|
49
49
|
case "SET_EDITING_HANDLER": {
|
|
50
50
|
if (a.payload && a.payload !== t.editing) {
|
|
51
|
-
const
|
|
52
|
-
(
|
|
51
|
+
const n = t.content.find(
|
|
52
|
+
(s) => s.id === t.editing
|
|
53
53
|
);
|
|
54
|
-
if (
|
|
55
|
-
|
|
56
|
-
).some(Boolean) &&
|
|
54
|
+
if (n && !Object.values(
|
|
55
|
+
he(n, ["id", "verbs", "asRegex", "isExpanded"])
|
|
56
|
+
).some(Boolean) && n.verbs.length === 0)
|
|
57
57
|
return {
|
|
58
58
|
...t,
|
|
59
|
-
content: t.content.filter((d) => d.id !==
|
|
59
|
+
content: t.content.filter((d) => d.id !== n.id),
|
|
60
60
|
editing: a.payload
|
|
61
61
|
};
|
|
62
62
|
}
|
|
@@ -66,112 +66,112 @@ const Ze = ({
|
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
68
|
case "ADD_HANDLER": {
|
|
69
|
-
const
|
|
69
|
+
const n = W();
|
|
70
70
|
return {
|
|
71
71
|
...t,
|
|
72
|
-
content: [...t.content, { ...a.payload, id:
|
|
73
|
-
editing:
|
|
74
|
-
newlyCreatedHandlerID:
|
|
72
|
+
content: [...t.content, { ...a.payload, id: n }],
|
|
73
|
+
editing: n,
|
|
74
|
+
newlyCreatedHandlerID: n
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
77
|
case "UPDATE_HANDLER":
|
|
78
78
|
return {
|
|
79
79
|
...t,
|
|
80
80
|
content: t.content.map(
|
|
81
|
-
(
|
|
81
|
+
(n) => n.id === a.id ? { ...n, ...a.payload } : n
|
|
82
82
|
),
|
|
83
83
|
newlyCreatedHandlerID: null
|
|
84
84
|
};
|
|
85
85
|
case "DELETE_HANDLER":
|
|
86
86
|
return {
|
|
87
87
|
...t,
|
|
88
|
-
content: t.content.filter((
|
|
88
|
+
content: t.content.filter((n) => n.id !== a.id)
|
|
89
89
|
};
|
|
90
90
|
case "TOGGLE_EXPANDED":
|
|
91
91
|
return {
|
|
92
92
|
...t,
|
|
93
93
|
content: t.content.map(
|
|
94
|
-
(
|
|
94
|
+
(n) => n.id === a.id ? { ...n, isExpanded: !n.isExpanded } : n
|
|
95
95
|
)
|
|
96
96
|
};
|
|
97
97
|
case "DUPLICATE_HANDLER": {
|
|
98
|
-
const
|
|
99
|
-
(
|
|
98
|
+
const n = t.content.find(
|
|
99
|
+
(s) => s.id === a.id
|
|
100
100
|
);
|
|
101
|
-
return
|
|
101
|
+
return n ? {
|
|
102
102
|
...t,
|
|
103
103
|
content: [
|
|
104
104
|
...t.content,
|
|
105
|
-
{ ...
|
|
105
|
+
{ ...n, id: W(), isExpanded: !0 }
|
|
106
106
|
]
|
|
107
107
|
} : t;
|
|
108
108
|
}
|
|
109
109
|
case "TOGGLE_ALL_EXPANDED":
|
|
110
110
|
return {
|
|
111
111
|
...t,
|
|
112
|
-
content: t.content.map((
|
|
113
|
-
...
|
|
112
|
+
content: t.content.map((n) => ({
|
|
113
|
+
...n,
|
|
114
114
|
isExpanded: a.payload
|
|
115
115
|
}))
|
|
116
116
|
};
|
|
117
117
|
case "SYNC_DATA":
|
|
118
118
|
return {
|
|
119
119
|
...t,
|
|
120
|
-
content: a.payload.map((
|
|
121
|
-
const
|
|
122
|
-
return
|
|
123
|
-
...
|
|
124
|
-
...
|
|
125
|
-
} :
|
|
120
|
+
content: a.payload.map((n) => {
|
|
121
|
+
const s = t.content.find((d) => d.id === n.id);
|
|
122
|
+
return s ? {
|
|
123
|
+
...n,
|
|
124
|
+
...s
|
|
125
|
+
} : n;
|
|
126
126
|
})
|
|
127
127
|
};
|
|
128
128
|
default:
|
|
129
129
|
throw new Error("Unknown action type");
|
|
130
130
|
}
|
|
131
|
-
},
|
|
131
|
+
}, rt = ({
|
|
132
132
|
children: t,
|
|
133
133
|
content: a
|
|
134
134
|
}) => {
|
|
135
|
-
const
|
|
135
|
+
const n = {
|
|
136
136
|
content: a,
|
|
137
137
|
editing: null,
|
|
138
138
|
newlyCreatedHandlerID: null
|
|
139
|
-
}, [
|
|
140
|
-
return
|
|
139
|
+
}, [s, d] = Be(nt, n);
|
|
140
|
+
return F(() => {
|
|
141
141
|
d({
|
|
142
142
|
type: "SYNC_DATA",
|
|
143
143
|
payload: a
|
|
144
144
|
});
|
|
145
|
-
}, [a]), /* @__PURE__ */ e(
|
|
146
|
-
},
|
|
147
|
-
const t =
|
|
145
|
+
}, [a]), /* @__PURE__ */ e(me.Provider, { value: { state: s, dispatch: d }, children: t });
|
|
146
|
+
}, Y = () => {
|
|
147
|
+
const t = Ue(me);
|
|
148
148
|
if (!t)
|
|
149
149
|
throw new Error("useHTTPHandlers must be used within a HandlerProvider");
|
|
150
150
|
return t;
|
|
151
|
-
},
|
|
151
|
+
}, at = ({ initialSelectedItems: t, onChange: a, touched: n, onBlur: s }) => {
|
|
152
152
|
const d = ["GET", "POST", "PUT", "DELETE"];
|
|
153
|
-
function
|
|
154
|
-
const N =
|
|
155
|
-
return d.filter(function(
|
|
156
|
-
return !
|
|
153
|
+
function p(g, h) {
|
|
154
|
+
const N = h.toLowerCase();
|
|
155
|
+
return d.filter(function(l) {
|
|
156
|
+
return !g.includes(l) && l.toLowerCase().includes(N);
|
|
157
157
|
});
|
|
158
158
|
}
|
|
159
|
-
const [
|
|
160
|
-
|
|
161
|
-
|
|
159
|
+
const [m, f] = _(""), [c, r] = _(t);
|
|
160
|
+
F(() => {
|
|
161
|
+
r(t);
|
|
162
162
|
}, [t]);
|
|
163
|
-
const
|
|
164
|
-
() =>
|
|
165
|
-
[c,
|
|
166
|
-
), { getSelectedItemProps:
|
|
163
|
+
const i = ze(
|
|
164
|
+
() => p(c, m),
|
|
165
|
+
[c, m]
|
|
166
|
+
), { getSelectedItemProps: u, getDropdownProps: v, removeSelectedItem: b } = j({
|
|
167
167
|
selectedItems: c,
|
|
168
|
-
onStateChange({ selectedItems:
|
|
169
|
-
switch (
|
|
170
|
-
case
|
|
171
|
-
case
|
|
172
|
-
case
|
|
173
|
-
case
|
|
174
|
-
|
|
168
|
+
onStateChange({ selectedItems: g = [], type: h }) {
|
|
169
|
+
switch (h) {
|
|
170
|
+
case j.stateChangeTypes.SelectedItemKeyDownBackspace:
|
|
171
|
+
case j.stateChangeTypes.SelectedItemKeyDownDelete:
|
|
172
|
+
case j.stateChangeTypes.DropdownKeyDownBackspace:
|
|
173
|
+
case j.stateChangeTypes.FunctionRemoveSelectedItem:
|
|
174
|
+
r(g);
|
|
175
175
|
break;
|
|
176
176
|
}
|
|
177
177
|
}
|
|
@@ -179,22 +179,22 @@ const Ze = ({
|
|
|
179
179
|
isOpen: y,
|
|
180
180
|
getToggleButtonProps: w,
|
|
181
181
|
getMenuProps: I,
|
|
182
|
-
getInputProps:
|
|
183
|
-
highlightedIndex:
|
|
182
|
+
getInputProps: T,
|
|
183
|
+
highlightedIndex: D,
|
|
184
184
|
getItemProps: H,
|
|
185
|
-
selectedItem:
|
|
185
|
+
selectedItem: S
|
|
186
186
|
} = L({
|
|
187
|
-
items:
|
|
188
|
-
itemToString(
|
|
189
|
-
return
|
|
187
|
+
items: i,
|
|
188
|
+
itemToString(g) {
|
|
189
|
+
return g || "";
|
|
190
190
|
},
|
|
191
191
|
defaultHighlightedIndex: 0,
|
|
192
192
|
// after selection, highlight the first item.
|
|
193
193
|
selectedItem: null,
|
|
194
|
-
inputValue:
|
|
195
|
-
stateReducer(
|
|
196
|
-
const { changes: N, type:
|
|
197
|
-
switch (
|
|
194
|
+
inputValue: m,
|
|
195
|
+
stateReducer(g, h) {
|
|
196
|
+
const { changes: N, type: P } = h;
|
|
197
|
+
switch (P) {
|
|
198
198
|
case L.stateChangeTypes.InputKeyDownEnter:
|
|
199
199
|
case L.stateChangeTypes.ItemClick:
|
|
200
200
|
return {
|
|
@@ -209,23 +209,23 @@ const Ze = ({
|
|
|
209
209
|
}
|
|
210
210
|
},
|
|
211
211
|
onStateChange({
|
|
212
|
-
inputValue:
|
|
213
|
-
type:
|
|
212
|
+
inputValue: g = "",
|
|
213
|
+
type: h,
|
|
214
214
|
selectedItem: N
|
|
215
215
|
}) {
|
|
216
|
-
switch (
|
|
216
|
+
switch (h) {
|
|
217
217
|
case L.stateChangeTypes.InputKeyDownEnter:
|
|
218
218
|
case L.stateChangeTypes.ItemClick:
|
|
219
219
|
case L.stateChangeTypes.InputBlur:
|
|
220
|
-
N && (
|
|
220
|
+
N && (r([...c, N]), f(""));
|
|
221
221
|
break;
|
|
222
222
|
case L.stateChangeTypes.InputChange:
|
|
223
|
-
g
|
|
223
|
+
f(g);
|
|
224
224
|
break;
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
227
|
});
|
|
228
|
-
return
|
|
228
|
+
return F(() => {
|
|
229
229
|
a(c);
|
|
230
230
|
}, [c]), /* @__PURE__ */ o("div", { className: "relative flex-1", children: [
|
|
231
231
|
/* @__PURE__ */ o(
|
|
@@ -234,51 +234,51 @@ const Ze = ({
|
|
|
234
234
|
className: C(
|
|
235
235
|
"bg-grey-300 focus-within:ring-1 focus-within:ring-primary-dark relative flex items-center w-full cursor-default overflow-hidden rounded p-px text-left focus:outline-none",
|
|
236
236
|
{
|
|
237
|
-
"ring-1 ring-primary-dark rounded-b-none": y &&
|
|
238
|
-
"ring-1 ring-red-400 overflow-visible": c.length === 0 &&
|
|
237
|
+
"ring-1 ring-primary-dark rounded-b-none": y && i.length,
|
|
238
|
+
"ring-1 ring-red-400 overflow-visible": c.length === 0 && n
|
|
239
239
|
}
|
|
240
240
|
),
|
|
241
|
-
onBlur:
|
|
241
|
+
onBlur: s,
|
|
242
242
|
children: [
|
|
243
|
-
c.length === 0 && !y &&
|
|
243
|
+
c.length === 0 && !y && n && /* @__PURE__ */ e("div", { className: "absolute inset-x-0 top-[25px] z-[1] rounded-b-sm bg-red-200 px-1 text-xs text-red-600 ring-1 ring-red-600", children: c.length === 0 && "At least one HTTP verb is required" }),
|
|
244
244
|
c.map(
|
|
245
|
-
function(
|
|
245
|
+
function(h, N) {
|
|
246
246
|
return /* @__PURE__ */ o(
|
|
247
247
|
"span",
|
|
248
248
|
{
|
|
249
249
|
className: C(
|
|
250
250
|
"bg-grey-600 text-s mr-1 flex items-center rounded px-1 py-0.5 uppercase",
|
|
251
251
|
{
|
|
252
|
-
"bg-red-400": !d.includes(
|
|
252
|
+
"bg-red-400": !d.includes(h)
|
|
253
253
|
}
|
|
254
254
|
),
|
|
255
|
-
...
|
|
256
|
-
selectedItem:
|
|
255
|
+
...u({
|
|
256
|
+
selectedItem: h,
|
|
257
257
|
index: N
|
|
258
258
|
}),
|
|
259
259
|
children: [
|
|
260
|
-
|
|
260
|
+
h,
|
|
261
261
|
/* @__PURE__ */ e(
|
|
262
262
|
"span",
|
|
263
263
|
{
|
|
264
|
-
onClick: (
|
|
265
|
-
|
|
264
|
+
onClick: (P) => {
|
|
265
|
+
P.stopPropagation(), b(h);
|
|
266
266
|
},
|
|
267
267
|
className: "hover:bg-primary-hover ml-2 inline-block cursor-pointer rounded p-0.5 text-gray-100 hover:text-white active:outline-none",
|
|
268
|
-
children: /* @__PURE__ */ e(
|
|
268
|
+
children: /* @__PURE__ */ e(B, {})
|
|
269
269
|
}
|
|
270
270
|
)
|
|
271
271
|
]
|
|
272
272
|
},
|
|
273
|
-
`selected-item-${N}-${
|
|
273
|
+
`selected-item-${N}-${h}`
|
|
274
274
|
);
|
|
275
275
|
}
|
|
276
276
|
),
|
|
277
277
|
/* @__PURE__ */ e(
|
|
278
278
|
"input",
|
|
279
279
|
{
|
|
280
|
-
...
|
|
281
|
-
|
|
280
|
+
...T(
|
|
281
|
+
v(
|
|
282
282
|
{ preventKeyAction: y },
|
|
283
283
|
{ suppressRefError: !0 }
|
|
284
284
|
)
|
|
@@ -294,7 +294,7 @@ const Ze = ({
|
|
|
294
294
|
className: "absolute inset-y-0 right-0 flex items-center pr-2",
|
|
295
295
|
type: "button",
|
|
296
296
|
...w(),
|
|
297
|
-
children: /* @__PURE__ */ e(
|
|
297
|
+
children: /* @__PURE__ */ e(Q, { className: "h-3 w-3 text-gray-50", "aria-hidden": "true" })
|
|
298
298
|
}
|
|
299
299
|
)
|
|
300
300
|
]
|
|
@@ -303,76 +303,76 @@ const Ze = ({
|
|
|
303
303
|
/* @__PURE__ */ e(
|
|
304
304
|
"ul",
|
|
305
305
|
{
|
|
306
|
-
className: `ring-primary-dark bg-grey-900 text-s absolute z-10 w-full rounded-b ring-1 p-1 text-white ${!(y &&
|
|
306
|
+
className: `ring-primary-dark bg-grey-900 text-s absolute z-10 w-full rounded-b ring-1 p-1 text-white ${!(y && i.length) && "hidden"}`,
|
|
307
307
|
...I(),
|
|
308
|
-
children: y &&
|
|
308
|
+
children: y && i.map((g, h) => /* @__PURE__ */ e(
|
|
309
309
|
"li",
|
|
310
310
|
{
|
|
311
311
|
className: C(
|
|
312
|
-
|
|
313
|
-
|
|
312
|
+
D === h && "bg-primary-hover",
|
|
313
|
+
S === g && "font-bold",
|
|
314
314
|
"flex flex-col p-1 shadow-sm"
|
|
315
315
|
),
|
|
316
|
-
...H({ item:
|
|
317
|
-
children: /* @__PURE__ */ e("span", { children:
|
|
316
|
+
...H({ item: g, index: h }),
|
|
317
|
+
children: /* @__PURE__ */ e("span", { children: g })
|
|
318
318
|
},
|
|
319
|
-
`${
|
|
319
|
+
`${g}${h}`
|
|
320
320
|
))
|
|
321
321
|
}
|
|
322
322
|
)
|
|
323
323
|
] });
|
|
324
|
-
},
|
|
324
|
+
}, st = ({
|
|
325
325
|
value: t,
|
|
326
326
|
options: a,
|
|
327
|
-
errorMessage:
|
|
328
|
-
onChange:
|
|
327
|
+
errorMessage: n = "",
|
|
328
|
+
onChange: s,
|
|
329
329
|
onBlur: d
|
|
330
330
|
}) => {
|
|
331
|
-
const [
|
|
331
|
+
const [p, m] = _(""), f = a.find((r) => r.name === t), c = p === "" ? a : a.filter((r) => r.name.toLowerCase().includes(p.toLowerCase()));
|
|
332
332
|
return /* @__PURE__ */ e(
|
|
333
|
-
|
|
333
|
+
R,
|
|
334
334
|
{
|
|
335
335
|
value: { name: t },
|
|
336
|
-
onChange: (
|
|
337
|
-
children: ({ open:
|
|
336
|
+
onChange: (r) => s(r.name),
|
|
337
|
+
children: ({ open: r }) => /* @__PURE__ */ o("div", { className: "relative w-full", children: [
|
|
338
338
|
/* @__PURE__ */ o(
|
|
339
339
|
"div",
|
|
340
340
|
{
|
|
341
341
|
className: C(
|
|
342
342
|
"bg-grey-300 focus-within:ring-1 focus-within:ring-primary-dark relative w-full cursor-default overflow-hidden rounded text-left inline-flex",
|
|
343
343
|
{
|
|
344
|
-
"ring-1 ring-red-400": !
|
|
345
|
-
"ring-1 ring-primary-dark rounded-b-none":
|
|
346
|
-
"overflow-visible": !
|
|
344
|
+
"ring-1 ring-red-400": !f && t || n,
|
|
345
|
+
"ring-1 ring-primary-dark rounded-b-none": r,
|
|
346
|
+
"overflow-visible": !f && !r && n
|
|
347
347
|
}
|
|
348
348
|
),
|
|
349
349
|
children: [
|
|
350
350
|
/* @__PURE__ */ e(
|
|
351
|
-
|
|
351
|
+
R.Input,
|
|
352
352
|
{
|
|
353
353
|
className: C(
|
|
354
354
|
"bg-grey-300 text-s w-full border-none py-1 px-2 focus:outline-none rounded",
|
|
355
355
|
{
|
|
356
|
-
"!text-red-400": !
|
|
356
|
+
"!text-red-400": !f
|
|
357
357
|
}
|
|
358
358
|
),
|
|
359
|
-
displayValue: (
|
|
360
|
-
onChange: (
|
|
359
|
+
displayValue: (i) => i.name,
|
|
360
|
+
onChange: (i) => m(i.target.value),
|
|
361
361
|
style: { caretColor: "white" },
|
|
362
362
|
onBlur: d
|
|
363
363
|
}
|
|
364
364
|
),
|
|
365
365
|
/* @__PURE__ */ o("span", { className: "inset-y-0 right-0 flex items-center gap-1 pr-2", children: [
|
|
366
|
-
!
|
|
367
|
-
t ? /* @__PURE__ */ o(
|
|
366
|
+
!f && !r && n && /* @__PURE__ */ e("div", { className: "absolute inset-x-0 top-[25px] z-[1] rounded-b-sm bg-red-200 px-1 text-xs text-red-600 ring-1 ring-red-600", children: n }),
|
|
367
|
+
t ? /* @__PURE__ */ o(O, { children: [
|
|
368
368
|
/* @__PURE__ */ e(
|
|
369
369
|
"button",
|
|
370
370
|
{
|
|
371
371
|
onClick: () => {
|
|
372
|
-
|
|
372
|
+
m(""), s("");
|
|
373
373
|
},
|
|
374
374
|
children: /* @__PURE__ */ e(
|
|
375
|
-
|
|
375
|
+
B,
|
|
376
376
|
{
|
|
377
377
|
className: "text-grey-50 h-3 w-3",
|
|
378
378
|
"aria-hidden": "true"
|
|
@@ -382,36 +382,36 @@ const Ze = ({
|
|
|
382
382
|
),
|
|
383
383
|
/* @__PURE__ */ e("span", { className: "bg-grey-50 h-3 w-[1px] rounded-full" })
|
|
384
384
|
] }) : null,
|
|
385
|
-
/* @__PURE__ */ e(
|
|
385
|
+
/* @__PURE__ */ e(R.Button, { children: /* @__PURE__ */ e(Q, { className: "text-grey-50 h-3 w-3", "aria-hidden": "true" }) })
|
|
386
386
|
] })
|
|
387
387
|
]
|
|
388
388
|
}
|
|
389
389
|
),
|
|
390
390
|
/* @__PURE__ */ e(
|
|
391
|
-
|
|
391
|
+
ue,
|
|
392
392
|
{
|
|
393
|
-
as:
|
|
393
|
+
as: de,
|
|
394
394
|
leave: "transition ease-in durati pb-0.5on-100",
|
|
395
395
|
leaveFrom: "opacity-100",
|
|
396
396
|
leaveTo: "opacity-0",
|
|
397
|
-
afterLeave: () =>
|
|
398
|
-
children: /* @__PURE__ */ e(
|
|
399
|
-
/* @__PURE__ */ e(
|
|
397
|
+
afterLeave: () => m(""),
|
|
398
|
+
children: /* @__PURE__ */ e(R.Options, { className: "bg-grey-900 text-s text-grey-100 sm:text-s absolute z-50 max-h-60 w-full overflow-auto rounded-b ring-1 ring-primary-dark p-1 focus:outline-none", children: c.length === 0 ? /* @__PURE__ */ o("div", { className: "text-s text-grey-200 relative cursor-default select-none px-0.5 py-0.5 ", children: [
|
|
399
|
+
/* @__PURE__ */ e(X, { className: "inline h-4 w-4" }),
|
|
400
400
|
" Nothing found."
|
|
401
|
-
] }) : c.map((
|
|
402
|
-
|
|
401
|
+
] }) : c.map((i, u) => /* @__PURE__ */ e(
|
|
402
|
+
R.Option,
|
|
403
403
|
{
|
|
404
|
-
className: ({ active:
|
|
405
|
-
value:
|
|
406
|
-
children: ({ selected:
|
|
404
|
+
className: ({ active: v }) => `relative cursor-default select-none ${v ? "bg-primary-hover" : ""}`,
|
|
405
|
+
value: i,
|
|
406
|
+
children: ({ selected: v }) => /* @__PURE__ */ e(O, { children: /* @__PURE__ */ e(
|
|
407
407
|
"span",
|
|
408
408
|
{
|
|
409
|
-
className: `block truncate p-2 py-1 ${
|
|
410
|
-
children:
|
|
409
|
+
className: `block truncate p-2 py-1 ${v ? "bg-primary-dark font-medium text-white" : "font-normal"}`,
|
|
410
|
+
children: i.name
|
|
411
411
|
}
|
|
412
412
|
) })
|
|
413
413
|
},
|
|
414
|
-
|
|
414
|
+
u
|
|
415
415
|
)) })
|
|
416
416
|
}
|
|
417
417
|
)
|
|
@@ -419,64 +419,64 @@ const Ze = ({
|
|
|
419
419
|
},
|
|
420
420
|
t
|
|
421
421
|
);
|
|
422
|
-
},
|
|
422
|
+
}, lt = ({
|
|
423
423
|
value: t,
|
|
424
424
|
options: a,
|
|
425
|
-
onChange:
|
|
426
|
-
errorMessage:
|
|
425
|
+
onChange: n,
|
|
426
|
+
errorMessage: s,
|
|
427
427
|
onBlur: d
|
|
428
428
|
}) => {
|
|
429
|
-
const [
|
|
430
|
-
return /* @__PURE__ */ e(
|
|
429
|
+
const [p, m] = _(""), f = a.find((i) => i.name === t), c = f && f.exposed, r = p === "" ? a : a.filter((i) => i.name.toLowerCase().includes(p.toLowerCase()));
|
|
430
|
+
return /* @__PURE__ */ e(R, { value: { name: t }, onChange: (i) => n(i.name), children: ({ open: i }) => /* @__PURE__ */ o("div", { className: "relative", children: [
|
|
431
431
|
/* @__PURE__ */ o(
|
|
432
432
|
"div",
|
|
433
433
|
{
|
|
434
434
|
className: C(
|
|
435
435
|
"bg-grey-300 focus-within:ring-1 focus-within:ring-primary-dark relative w-full cursor-default overflow-hidden rounded text-left inline-flex",
|
|
436
436
|
{
|
|
437
|
-
"ring-1 ring-red-400":
|
|
437
|
+
"ring-1 ring-red-400": s,
|
|
438
438
|
"ring-1 ring-yellow-500": c,
|
|
439
|
-
"ring-1 ring-primary-dark rounded-b-none":
|
|
440
|
-
"overflow-visible": !
|
|
439
|
+
"ring-1 ring-primary-dark rounded-b-none": i,
|
|
440
|
+
"overflow-visible": !i && s
|
|
441
441
|
}
|
|
442
442
|
),
|
|
443
443
|
children: [
|
|
444
444
|
/* @__PURE__ */ e(
|
|
445
|
-
|
|
445
|
+
R.Input,
|
|
446
446
|
{
|
|
447
447
|
className: C(
|
|
448
448
|
"bg-grey-300 text-s w-full border-none py-1 px-2 focus:outline-none truncate rounded",
|
|
449
449
|
{
|
|
450
|
-
"!text-red-400":
|
|
450
|
+
"!text-red-400": s,
|
|
451
451
|
"!text-yellow-500": c
|
|
452
452
|
}
|
|
453
453
|
),
|
|
454
454
|
style: { caretColor: "white" },
|
|
455
|
-
displayValue: (
|
|
456
|
-
onChange: (
|
|
455
|
+
displayValue: (u) => u.name,
|
|
456
|
+
onChange: (u) => m(u.target.value),
|
|
457
457
|
onBlur: d
|
|
458
458
|
}
|
|
459
459
|
),
|
|
460
|
-
!
|
|
460
|
+
!i && s && /* @__PURE__ */ e(
|
|
461
461
|
"div",
|
|
462
462
|
{
|
|
463
463
|
className: C(
|
|
464
464
|
"absolute inset-x-0 top-[25px] z-[1] rounded-b-sm bg-red-200 px-1 text-xs text-red-600 ring-1 ring-red-600",
|
|
465
465
|
{ "!text-yellow-500 ring-yellow-500 bg-white": c }
|
|
466
466
|
),
|
|
467
|
-
children:
|
|
467
|
+
children: s
|
|
468
468
|
}
|
|
469
469
|
),
|
|
470
470
|
/* @__PURE__ */ o("span", { className: "inset-y-0 right-0 flex items-center gap-1 pr-2", children: [
|
|
471
|
-
t ? /* @__PURE__ */ o(
|
|
471
|
+
t ? /* @__PURE__ */ o(O, { children: [
|
|
472
472
|
/* @__PURE__ */ e(
|
|
473
473
|
"button",
|
|
474
474
|
{
|
|
475
475
|
onClick: () => {
|
|
476
|
-
|
|
476
|
+
m(""), n("");
|
|
477
477
|
},
|
|
478
478
|
children: /* @__PURE__ */ e(
|
|
479
|
-
|
|
479
|
+
B,
|
|
480
480
|
{
|
|
481
481
|
className: "text-grey-50 h-3 w-3",
|
|
482
482
|
"aria-hidden": "true"
|
|
@@ -486,91 +486,91 @@ const Ze = ({
|
|
|
486
486
|
),
|
|
487
487
|
/* @__PURE__ */ e("span", { className: "bg-grey-50 h-3 w-[1px] rounded-full" })
|
|
488
488
|
] }) : null,
|
|
489
|
-
/* @__PURE__ */ e(
|
|
489
|
+
/* @__PURE__ */ e(R.Button, { children: /* @__PURE__ */ e(Q, { className: "text-grey-50 h-3 w-3", "aria-hidden": "true" }) })
|
|
490
490
|
] })
|
|
491
491
|
]
|
|
492
492
|
}
|
|
493
493
|
),
|
|
494
494
|
/* @__PURE__ */ e(
|
|
495
|
-
|
|
495
|
+
ue,
|
|
496
496
|
{
|
|
497
|
-
as:
|
|
497
|
+
as: de,
|
|
498
498
|
leave: "transition ease-in duration-100",
|
|
499
499
|
leaveFrom: "opacity-100",
|
|
500
500
|
leaveTo: "opacity-0",
|
|
501
|
-
afterLeave: () =>
|
|
502
|
-
children: /* @__PURE__ */ e(
|
|
503
|
-
|
|
501
|
+
afterLeave: () => m(""),
|
|
502
|
+
children: /* @__PURE__ */ e(R.Options, { className: "bg-grey-900 text-s text-grey-100 sm:text-s absolute z-50 max-h-60 w-full overflow-auto rounded-b ring-1 ring-primary-dark p-1 focus:outline-none", children: r.length ? r.map((u, v) => /* @__PURE__ */ e(
|
|
503
|
+
R.Option,
|
|
504
504
|
{
|
|
505
|
-
className: ({ active:
|
|
506
|
-
value:
|
|
507
|
-
children: ({ selected:
|
|
505
|
+
className: ({ active: b }) => `relative cursor-default select-none ${b ? "bg-primary-hover" : ""}`,
|
|
506
|
+
value: u,
|
|
507
|
+
children: ({ selected: b }) => /* @__PURE__ */ e(O, { children: /* @__PURE__ */ o(
|
|
508
508
|
"span",
|
|
509
509
|
{
|
|
510
|
-
className: `text-s flex items-center gap-2 truncate p-2 py-1 ${
|
|
510
|
+
className: `text-s flex items-center gap-2 truncate p-2 py-1 ${b ? "bg-primary-dark font-medium text-white" : "font-normal"}`,
|
|
511
511
|
children: [
|
|
512
|
-
|
|
513
|
-
/* @__PURE__ */ e("span", { className: "flex-1 truncate", title:
|
|
512
|
+
u.exposed && /* @__PURE__ */ e(q, { className: "text-yellow-500" }),
|
|
513
|
+
/* @__PURE__ */ e("span", { className: "flex-1 truncate", title: u.name, children: u.name })
|
|
514
514
|
]
|
|
515
515
|
}
|
|
516
516
|
) })
|
|
517
517
|
},
|
|
518
|
-
|
|
518
|
+
v
|
|
519
519
|
)) : /* @__PURE__ */ o("div", { className: "text-s text-grey-200 relative cursor-default select-none px-0.5 py-0.5", children: [
|
|
520
|
-
/* @__PURE__ */ e(
|
|
520
|
+
/* @__PURE__ */ e(X, { className: "inline h-4 w-4" }),
|
|
521
521
|
" Nothing found."
|
|
522
522
|
] }) })
|
|
523
523
|
}
|
|
524
524
|
)
|
|
525
525
|
] }) });
|
|
526
|
-
},
|
|
527
|
-
var
|
|
526
|
+
}, ge = ({ listeners: t, attributes: a }) => /* @__PURE__ */ e("button", { ...a, ...t, children: /* @__PURE__ */ e(_e, {}) }), xe = (t) => {
|
|
527
|
+
var n;
|
|
528
528
|
if (!t) return "";
|
|
529
529
|
let a;
|
|
530
|
-
|
|
530
|
+
te.prototype.max = 8;
|
|
531
531
|
try {
|
|
532
|
-
a = (
|
|
532
|
+
a = (n = new te(t)) == null ? void 0 : n.gen();
|
|
533
533
|
} catch {
|
|
534
534
|
a = "";
|
|
535
535
|
}
|
|
536
536
|
return `Requests matching regex will be handled example: ${a}`;
|
|
537
|
-
},
|
|
537
|
+
}, it = ({
|
|
538
538
|
id: t,
|
|
539
539
|
class: a,
|
|
540
|
-
method:
|
|
541
|
-
pattern:
|
|
540
|
+
method: n,
|
|
541
|
+
pattern: s,
|
|
542
542
|
verbs: d,
|
|
543
|
-
regexPattern:
|
|
544
|
-
asRegex:
|
|
545
|
-
listeners:
|
|
543
|
+
regexPattern: p,
|
|
544
|
+
asRegex: m,
|
|
545
|
+
listeners: f,
|
|
546
546
|
attributes: c
|
|
547
547
|
}) => {
|
|
548
|
-
var
|
|
549
|
-
const [
|
|
548
|
+
var P;
|
|
549
|
+
const [r, i] = _({
|
|
550
550
|
className: a,
|
|
551
|
-
method:
|
|
552
|
-
pattern:
|
|
551
|
+
method: n,
|
|
552
|
+
pattern: s,
|
|
553
553
|
verbs: d,
|
|
554
|
-
asRegex:
|
|
555
|
-
regexPattern:
|
|
556
|
-
}),
|
|
554
|
+
asRegex: m,
|
|
555
|
+
regexPattern: p
|
|
556
|
+
}), u = M(se), v = Object.values((u == null ? void 0 : u.singletons) || {}), b = (P = v.find((l) => l.name === r.className)) == null ? void 0 : P.methods.map(({ name: l, exposed: x }) => ({ name: l, exposed: x })), {
|
|
557
557
|
dispatch: y,
|
|
558
558
|
state: { newlyCreatedHandlerID: w }
|
|
559
|
-
} =
|
|
560
|
-
function D() {
|
|
561
|
-
const { className: s, method: m, asRegex: A, regexPattern: U, pattern: z, verbs: V } = n;
|
|
562
|
-
return !!(s && m && (A ? U : !z.endsWith("/")) && V.length);
|
|
563
|
-
}
|
|
559
|
+
} = Y(), I = $();
|
|
564
560
|
function T() {
|
|
565
|
-
|
|
566
|
-
|
|
561
|
+
const { className: l, method: x, asRegex: A, regexPattern: U, pattern: z, verbs: J } = r;
|
|
562
|
+
return !!(l && x && (A ? U : !z.endsWith("/")) && J.length);
|
|
563
|
+
}
|
|
564
|
+
function D() {
|
|
565
|
+
if (T()) {
|
|
566
|
+
const { className: l, method: x, asRegex: A, regexPattern: U, pattern: z, verbs: J } = r;
|
|
567
567
|
y({
|
|
568
568
|
type: "UPDATE_HANDLER",
|
|
569
569
|
id: t,
|
|
570
570
|
payload: {
|
|
571
|
-
class:
|
|
572
|
-
method:
|
|
573
|
-
verbs:
|
|
571
|
+
class: l,
|
|
572
|
+
method: x,
|
|
573
|
+
verbs: J,
|
|
574
574
|
asRegex: A,
|
|
575
575
|
...A ? { regexPattern: U } : { pattern: z }
|
|
576
576
|
}
|
|
@@ -578,23 +578,23 @@ const Ze = ({
|
|
|
578
578
|
}
|
|
579
579
|
}
|
|
580
580
|
const H = async () => {
|
|
581
|
-
const
|
|
581
|
+
const l = {
|
|
582
582
|
className: a,
|
|
583
|
-
method:
|
|
584
|
-
pattern:
|
|
585
|
-
regexPattern:
|
|
583
|
+
method: n,
|
|
584
|
+
pattern: s,
|
|
585
|
+
regexPattern: p,
|
|
586
586
|
verbs: d
|
|
587
|
-
},
|
|
588
|
-
if (!
|
|
587
|
+
}, x = he(r, ["id", "isExpanded"]);
|
|
588
|
+
if (!T()) {
|
|
589
589
|
y({ type: "DELETE_HANDLER", id: `${w}` }), y({ type: "SET_EDITING_HANDLER", payload: null });
|
|
590
590
|
return;
|
|
591
591
|
}
|
|
592
|
-
if (!
|
|
592
|
+
if (!V(l, x)) {
|
|
593
593
|
const { confirmed: A } = await I(
|
|
594
|
-
|
|
594
|
+
le({
|
|
595
595
|
title: "Cancel Changes",
|
|
596
|
-
type:
|
|
597
|
-
color:
|
|
596
|
+
type: pe.CONFIRM,
|
|
597
|
+
color: ce.DANGER,
|
|
598
598
|
message: "Are you sure you want to cancel changes made to this Handler?",
|
|
599
599
|
icon: "FdWarningDanger"
|
|
600
600
|
})
|
|
@@ -605,7 +605,7 @@ const Ze = ({
|
|
|
605
605
|
}
|
|
606
606
|
}
|
|
607
607
|
};
|
|
608
|
-
|
|
608
|
+
Ke(
|
|
609
609
|
"esc",
|
|
610
610
|
() => {
|
|
611
611
|
setTimeout(() => {
|
|
@@ -613,74 +613,74 @@ const Ze = ({
|
|
|
613
613
|
}, 100);
|
|
614
614
|
},
|
|
615
615
|
[]
|
|
616
|
-
),
|
|
617
|
-
|
|
618
|
-
|
|
616
|
+
), F(() => {
|
|
617
|
+
G.subscribe((l) => {
|
|
618
|
+
l === t && D();
|
|
619
619
|
});
|
|
620
|
-
}, [
|
|
621
|
-
const [
|
|
622
|
-
if (
|
|
620
|
+
}, [r, t]);
|
|
621
|
+
const [S, g] = _({ className: !1, method: !1, pattern: !1, verbs: !1 }), h = () => {
|
|
622
|
+
if (S.method && !r.method)
|
|
623
623
|
return "Method is required";
|
|
624
|
-
if (
|
|
625
|
-
const
|
|
626
|
-
(
|
|
624
|
+
if (b) {
|
|
625
|
+
const l = b == null ? void 0 : b.find(
|
|
626
|
+
(x) => x.name === r.method
|
|
627
627
|
);
|
|
628
|
-
if (
|
|
629
|
-
return `The method "${
|
|
630
|
-
if (
|
|
631
|
-
return `Method "${
|
|
628
|
+
if (r.method && !l)
|
|
629
|
+
return `The method "${r.method}" doesn't exist.`;
|
|
630
|
+
if (l && l.exposed)
|
|
631
|
+
return `Method "${r.method}" is already exposed`;
|
|
632
632
|
}
|
|
633
633
|
}, N = () => {
|
|
634
|
-
if (
|
|
635
|
-
if (
|
|
634
|
+
if (S.pattern) {
|
|
635
|
+
if (r.asRegex && !r.regexPattern)
|
|
636
636
|
return "Pattern is required";
|
|
637
|
-
if (!
|
|
637
|
+
if (!r.asRegex && r.pattern.endsWith("/"))
|
|
638
638
|
return 'Pattern should not end with a "/"';
|
|
639
639
|
}
|
|
640
640
|
};
|
|
641
641
|
return /* @__PURE__ */ o("div", { className: "flex items-center gap-2 rounded-b py-2", children: [
|
|
642
642
|
/* @__PURE__ */ o("div", { className: "flex w-60 flex-shrink-0 items-center gap-1", children: [
|
|
643
643
|
/* @__PURE__ */ e(
|
|
644
|
-
|
|
644
|
+
ge,
|
|
645
645
|
{
|
|
646
|
-
listeners:
|
|
646
|
+
listeners: f,
|
|
647
647
|
attributes: c
|
|
648
648
|
},
|
|
649
649
|
"grab-handle"
|
|
650
650
|
),
|
|
651
651
|
/* @__PURE__ */ e(
|
|
652
|
-
|
|
652
|
+
st,
|
|
653
653
|
{
|
|
654
|
-
value:
|
|
655
|
-
onChange: (
|
|
656
|
-
|
|
654
|
+
value: r.className,
|
|
655
|
+
onChange: (l) => {
|
|
656
|
+
i((x) => ({ ...x, className: l }));
|
|
657
657
|
},
|
|
658
|
-
onBlur: () =>
|
|
659
|
-
options:
|
|
660
|
-
errorMessage:
|
|
658
|
+
onBlur: () => g((l) => ({ ...l, className: !0 })),
|
|
659
|
+
options: v,
|
|
660
|
+
errorMessage: S.className && !r.className ? "Class name is required" : r.className !== "" && !v.find((l) => l.name === r.className) ? `The singleton "${r.className}" doesn't exist.` : void 0
|
|
661
661
|
},
|
|
662
662
|
a
|
|
663
663
|
)
|
|
664
664
|
] }),
|
|
665
665
|
/* @__PURE__ */ e("div", { className: "w-60 flex-shrink-0", children: /* @__PURE__ */ e(
|
|
666
|
-
|
|
666
|
+
lt,
|
|
667
667
|
{
|
|
668
|
-
value:
|
|
669
|
-
onChange: (
|
|
670
|
-
|
|
668
|
+
value: r.method,
|
|
669
|
+
onChange: (l) => {
|
|
670
|
+
i((x) => ({ ...x, method: l }));
|
|
671
671
|
},
|
|
672
|
-
options:
|
|
673
|
-
errorMessage:
|
|
674
|
-
onBlur: () =>
|
|
672
|
+
options: b || [],
|
|
673
|
+
errorMessage: h(),
|
|
674
|
+
onBlur: () => g((l) => ({ ...l, method: !0 }))
|
|
675
675
|
}
|
|
676
676
|
) }),
|
|
677
677
|
/* @__PURE__ */ o("div", { className: "relative w-60 flex-shrink-0 flex items-center gap-1 overflow-visible", children: [
|
|
678
678
|
/* @__PURE__ */ e(
|
|
679
679
|
E,
|
|
680
680
|
{
|
|
681
|
-
label:
|
|
681
|
+
label: r.asRegex ? xe(r.regexPattern) : r.pattern && !r.pattern.endsWith("/") ? `Requests starting with /${r.pattern}/ will be handled` : "",
|
|
682
682
|
children: /* @__PURE__ */ o("div", { className: "relative w-full", children: [
|
|
683
|
-
!
|
|
683
|
+
!r.asRegex && /* @__PURE__ */ e("span", { className: "absolute text-s inset-y-0 left-1 flex items-center gap-2", children: "/" }),
|
|
684
684
|
/* @__PURE__ */ e(
|
|
685
685
|
"input",
|
|
686
686
|
{
|
|
@@ -688,36 +688,36 @@ const Ze = ({
|
|
|
688
688
|
className: C(
|
|
689
689
|
"bg-grey-300 text-s block w-full rounded p-1 pl-3 focus:outline-none focus:ring-1 focus:ring-primary-dark",
|
|
690
690
|
{
|
|
691
|
-
"focus:ring-red-400 ring-1 ring-red-400":
|
|
691
|
+
"focus:ring-red-400 ring-1 ring-red-400": S.pattern && r.asRegex && !r.regexPattern
|
|
692
692
|
}
|
|
693
693
|
),
|
|
694
|
-
value:
|
|
695
|
-
onChange: (
|
|
696
|
-
|
|
697
|
-
...
|
|
698
|
-
[
|
|
694
|
+
value: r.asRegex ? r.regexPattern : r.pattern,
|
|
695
|
+
onChange: (l) => {
|
|
696
|
+
i((x) => ({
|
|
697
|
+
...x,
|
|
698
|
+
[r.asRegex ? "regexPattern" : "pattern"]: l.target.value
|
|
699
699
|
}));
|
|
700
700
|
},
|
|
701
|
-
onBlur: () =>
|
|
702
|
-
placeholder:
|
|
701
|
+
onBlur: () => g((l) => ({ ...l, pattern: !0 })),
|
|
702
|
+
placeholder: r.asRegex ? "Required" : ""
|
|
703
703
|
}
|
|
704
704
|
),
|
|
705
705
|
N() && /* @__PURE__ */ e("div", { className: "absolute inset-x-0 top-[25px] z-[1] rounded-b-sm bg-red-200 px-1 text-xs text-red-600 ring-1 ring-red-600", children: N() })
|
|
706
706
|
] })
|
|
707
707
|
}
|
|
708
708
|
),
|
|
709
|
-
(
|
|
709
|
+
(m ? p : s) && /* @__PURE__ */ e(
|
|
710
710
|
"button",
|
|
711
711
|
{
|
|
712
|
-
onClick: (
|
|
713
|
-
|
|
714
|
-
...
|
|
715
|
-
[
|
|
712
|
+
onClick: (l) => {
|
|
713
|
+
l.stopPropagation(), i((x) => ({
|
|
714
|
+
...x,
|
|
715
|
+
[r.asRegex ? "regexPattern" : "pattern"]: ""
|
|
716
716
|
}));
|
|
717
717
|
},
|
|
718
718
|
className: "absolute inset-y-0 right-6 flex items-center gap-2 pr-2",
|
|
719
719
|
children: /* @__PURE__ */ e(
|
|
720
|
-
|
|
720
|
+
B,
|
|
721
721
|
{
|
|
722
722
|
className: "text-grey-200 h-3 w-3",
|
|
723
723
|
"aria-hidden": "true"
|
|
@@ -728,28 +728,28 @@ const Ze = ({
|
|
|
728
728
|
/* @__PURE__ */ e(
|
|
729
729
|
E,
|
|
730
730
|
{
|
|
731
|
-
label:
|
|
731
|
+
label: r.asRegex ? "Requests matching this regex will be handled. Check the match with the __[Match regex command](https://developer.4d.com/docs/commands/match-regex)__" : `Prefixes are considered as regular expressions already containing starting and ending /
|
|
732
732
|
|
|
733
733
|
__[documentation](https://developer.qodly.com/docs/studio/httpHandlers)__`,
|
|
734
|
-
children: /* @__PURE__ */ e("span", { className: "rounded hover:bg-gray-400/30 w-6 h-6 flex items-center content-center justify-center", children: /* @__PURE__ */ e(
|
|
734
|
+
children: /* @__PURE__ */ e("span", { className: "rounded hover:bg-gray-400/30 w-6 h-6 flex items-center content-center justify-center", children: /* @__PURE__ */ e(ae, { className: "inline h-4 w-4 text-gray-100" }) })
|
|
735
735
|
}
|
|
736
736
|
)
|
|
737
737
|
] }),
|
|
738
738
|
/* @__PURE__ */ e("div", { className: "w-20 px-2 flex justify-center", children: /* @__PURE__ */ e(
|
|
739
|
-
|
|
739
|
+
We,
|
|
740
740
|
{
|
|
741
|
-
value: !!
|
|
742
|
-
onChange: (
|
|
743
|
-
const
|
|
744
|
-
|
|
741
|
+
value: !!r.asRegex,
|
|
742
|
+
onChange: (l) => {
|
|
743
|
+
const x = l ? { regexPattern: s, asRegex: l } : { pattern: p, asRegex: l };
|
|
744
|
+
i((A) => ({ ...A, ...x }));
|
|
745
745
|
},
|
|
746
|
-
className: `${
|
|
746
|
+
className: `${r.asRegex ? "bg-primary-dark" : "bg-grey-300"}
|
|
747
747
|
relative inline-flex h-5 w-8 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75`,
|
|
748
748
|
children: /* @__PURE__ */ e(
|
|
749
749
|
"span",
|
|
750
750
|
{
|
|
751
751
|
"aria-hidden": "true",
|
|
752
|
-
className: `${
|
|
752
|
+
className: `${r.asRegex ? "translate-x-3" : "translate-x-0"}
|
|
753
753
|
pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0 transition duration-200 ease-in-out`
|
|
754
754
|
}
|
|
755
755
|
)
|
|
@@ -757,14 +757,14 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
|
|
|
757
757
|
) }),
|
|
758
758
|
/* @__PURE__ */ o("div", { className: "flex flex-1 items-center", children: [
|
|
759
759
|
/* @__PURE__ */ e(
|
|
760
|
-
|
|
760
|
+
at,
|
|
761
761
|
{
|
|
762
|
-
initialSelectedItems:
|
|
763
|
-
onChange: (
|
|
764
|
-
|
|
762
|
+
initialSelectedItems: r.verbs || [],
|
|
763
|
+
onChange: (l) => {
|
|
764
|
+
i((x) => ({ ...x, verbs: l }));
|
|
765
765
|
},
|
|
766
|
-
touched:
|
|
767
|
-
onBlur: () =>
|
|
766
|
+
touched: S.verbs,
|
|
767
|
+
onBlur: () => g((l) => ({ ...l, verbs: !0 }))
|
|
768
768
|
}
|
|
769
769
|
),
|
|
770
770
|
/* @__PURE__ */ o("div", { className: "flex items-center gap-0.5 px-2", children: [
|
|
@@ -774,7 +774,7 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
|
|
|
774
774
|
className: C(
|
|
775
775
|
"hover:bg-primary-hover rounded p-1 text-gray-100 hover:text-white active:outline-none opacity-50 cursor-not-allowed"
|
|
776
776
|
),
|
|
777
|
-
children: /* @__PURE__ */ e(
|
|
777
|
+
children: /* @__PURE__ */ e(re, {})
|
|
778
778
|
}
|
|
779
779
|
) }),
|
|
780
780
|
/* @__PURE__ */ e(E, { label: "Confirm Changes", className: "px-1 py-3", children: /* @__PURE__ */ e(
|
|
@@ -783,11 +783,11 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
|
|
|
783
783
|
className: C(
|
|
784
784
|
"hover:bg-primary-hover rounded p-1 text-gray-100 hover:text-white active:outline-none",
|
|
785
785
|
{
|
|
786
|
-
"opacity-50 cursor-not-allowed": !
|
|
786
|
+
"opacity-50 cursor-not-allowed": !T()
|
|
787
787
|
}
|
|
788
788
|
),
|
|
789
|
-
onClick:
|
|
790
|
-
children: /* @__PURE__ */ e(
|
|
789
|
+
onClick: D,
|
|
790
|
+
children: /* @__PURE__ */ e(Ae, {})
|
|
791
791
|
}
|
|
792
792
|
) }),
|
|
793
793
|
/* @__PURE__ */ e(E, { label: "Cancel Changes", className: "px-1 py-3", children: /* @__PURE__ */ e(
|
|
@@ -795,44 +795,44 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
|
|
|
795
795
|
{
|
|
796
796
|
className: "hover:bg-primary-hover rounded p-1 text-gray-100 hover:text-white active:outline-none",
|
|
797
797
|
onClick: H,
|
|
798
|
-
children: /* @__PURE__ */ e(
|
|
798
|
+
children: /* @__PURE__ */ e(ke, {})
|
|
799
799
|
}
|
|
800
800
|
) })
|
|
801
801
|
] })
|
|
802
802
|
] })
|
|
803
803
|
] });
|
|
804
|
-
},
|
|
804
|
+
}, ne = ({
|
|
805
805
|
id: t,
|
|
806
806
|
class: a,
|
|
807
|
-
method:
|
|
808
|
-
pattern:
|
|
807
|
+
method: n,
|
|
808
|
+
pattern: s,
|
|
809
809
|
verbs: d,
|
|
810
|
-
isExpanded:
|
|
811
|
-
regexPattern:
|
|
812
|
-
asRegex:
|
|
810
|
+
isExpanded: p,
|
|
811
|
+
regexPattern: m,
|
|
812
|
+
asRegex: f
|
|
813
813
|
}) => {
|
|
814
|
-
var
|
|
815
|
-
const { attributes: c, listeners:
|
|
816
|
-
transform:
|
|
817
|
-
transition:
|
|
814
|
+
var P;
|
|
815
|
+
const { attributes: c, listeners: r, setNodeRef: i, transform: u, transition: v } = Ee({ id: t }), b = {
|
|
816
|
+
transform: Ye.Transform.toString(u),
|
|
817
|
+
transition: v
|
|
818
818
|
}, {
|
|
819
819
|
dispatch: y,
|
|
820
820
|
state: { editing: w }
|
|
821
|
-
} =
|
|
822
|
-
(
|
|
823
|
-
),
|
|
824
|
-
return /* @__PURE__ */ e("div", { className: "odd:bg-grey-500", ref:
|
|
825
|
-
|
|
821
|
+
} = Y(), I = $(), T = f ? m : s, D = M(se), H = Object.values((D == null ? void 0 : D.singletons) || {}), S = (P = H == null ? void 0 : H.find((l) => l.name === a)) == null ? void 0 : P.methods.map(({ name: l, exposed: x }) => ({ name: l, exposed: x })), g = H == null ? void 0 : H.find(
|
|
822
|
+
(l) => l.name === a
|
|
823
|
+
), h = S == null ? void 0 : S.find((l) => l.name === n), N = h && h.exposed;
|
|
824
|
+
return /* @__PURE__ */ e("div", { className: "odd:bg-grey-500", ref: i, style: b, children: w === t ? /* @__PURE__ */ e(
|
|
825
|
+
it,
|
|
826
826
|
{
|
|
827
827
|
id: t,
|
|
828
828
|
class: a,
|
|
829
|
-
method:
|
|
830
|
-
pattern:
|
|
829
|
+
method: n,
|
|
830
|
+
pattern: s,
|
|
831
831
|
verbs: d,
|
|
832
|
-
isExpanded:
|
|
833
|
-
regexPattern:
|
|
834
|
-
asRegex:
|
|
835
|
-
listeners:
|
|
832
|
+
isExpanded: p,
|
|
833
|
+
regexPattern: m,
|
|
834
|
+
asRegex: f,
|
|
835
|
+
listeners: r,
|
|
836
836
|
attributes: c
|
|
837
837
|
}
|
|
838
838
|
) : /* @__PURE__ */ o(
|
|
@@ -840,14 +840,14 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
|
|
|
840
840
|
{
|
|
841
841
|
className: "flex items-center gap-2 rounded-b py-2.5 text-grey-50",
|
|
842
842
|
onDoubleClick: () => {
|
|
843
|
-
|
|
843
|
+
G.next(w), y({ type: "SET_EDITING_HANDLER", payload: t });
|
|
844
844
|
},
|
|
845
845
|
children: [
|
|
846
846
|
/* @__PURE__ */ o("div", { className: "flex w-60 flex-shrink-0 items-center gap-1 ", children: [
|
|
847
847
|
/* @__PURE__ */ e(
|
|
848
|
-
|
|
848
|
+
ge,
|
|
849
849
|
{
|
|
850
|
-
listeners:
|
|
850
|
+
listeners: r,
|
|
851
851
|
attributes: c
|
|
852
852
|
},
|
|
853
853
|
"grab-handle"
|
|
@@ -857,10 +857,10 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
|
|
|
857
857
|
{
|
|
858
858
|
className: C(
|
|
859
859
|
"flex items-center gap-2",
|
|
860
|
-
!
|
|
860
|
+
!g && "text-red-400"
|
|
861
861
|
),
|
|
862
862
|
children: [
|
|
863
|
-
!
|
|
863
|
+
!g && /* @__PURE__ */ e(
|
|
864
864
|
E,
|
|
865
865
|
{
|
|
866
866
|
label: `The singleton "${a}" doesn't exist.`,
|
|
@@ -874,19 +874,19 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
|
|
|
874
874
|
}
|
|
875
875
|
) : /* @__PURE__ */ e("span", { className: "text-grey-200 italic", children: "undefined" }) })
|
|
876
876
|
] }),
|
|
877
|
-
/* @__PURE__ */ e("div", { className: "w-60 flex-shrink-0 ", children: /* @__PURE__ */ e("div", { className: "text-s w-full", children:
|
|
877
|
+
/* @__PURE__ */ e("div", { className: "w-60 flex-shrink-0 ", children: /* @__PURE__ */ e("div", { className: "text-s w-full", children: n ? /* @__PURE__ */ o(
|
|
878
878
|
"div",
|
|
879
879
|
{
|
|
880
880
|
className: C(
|
|
881
881
|
"flex items-center gap-2",
|
|
882
|
-
!
|
|
882
|
+
!h && "text-red-400",
|
|
883
883
|
N && "text-yellow-400"
|
|
884
884
|
),
|
|
885
885
|
children: [
|
|
886
|
-
!
|
|
886
|
+
!h && /* @__PURE__ */ e(
|
|
887
887
|
E,
|
|
888
888
|
{
|
|
889
|
-
label: `The method "${
|
|
889
|
+
label: `The method "${n}" doesn't exist.`,
|
|
890
890
|
className: "!bg-red-300 !text-red-400",
|
|
891
891
|
children: /* @__PURE__ */ e("span", { className: "rounded p-0.5 hover:bg-red-400/30 pt-0.5 h-5 w-5 flex justify-center content-center", children: /* @__PURE__ */ e(q, { className: "inline h-4 w-4 pb-0.5 text-red-400" }) })
|
|
892
892
|
}
|
|
@@ -895,24 +895,24 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
|
|
|
895
895
|
N && /* @__PURE__ */ e(
|
|
896
896
|
E,
|
|
897
897
|
{
|
|
898
|
-
label: `Method "${
|
|
898
|
+
label: `Method "${n}" is already exposed`,
|
|
899
899
|
className: "!bg-yellow-100 !text-yellow-500",
|
|
900
900
|
children: /* @__PURE__ */ e("span", { className: "rounded p-0.5 hover:bg-red-400/30 pt-0.5 h-5 w-5 flex justify-center content-center", children: /* @__PURE__ */ e(q, { className: "inline h-4 w-4 pb-0.5 text-yellow-500" }) })
|
|
901
901
|
}
|
|
902
902
|
),
|
|
903
903
|
" ",
|
|
904
|
-
|
|
904
|
+
n
|
|
905
905
|
]
|
|
906
906
|
}
|
|
907
907
|
) : /* @__PURE__ */ e("span", { className: "text-grey-200 italic", children: "undefined" }) }) }),
|
|
908
|
-
/* @__PURE__ */ e("div", { className: "text-s relative w-60 flex-shrink-0 ", children:
|
|
908
|
+
/* @__PURE__ */ e("div", { className: "text-s relative w-60 flex-shrink-0 ", children: T ? /* @__PURE__ */ e(
|
|
909
909
|
E,
|
|
910
910
|
{
|
|
911
|
-
label:
|
|
912
|
-
children: /* @__PURE__ */ e("span", { children:
|
|
911
|
+
label: f ? xe(T) : `Requests starting with /${T}/ will be handled`,
|
|
912
|
+
children: /* @__PURE__ */ e("span", { children: T })
|
|
913
913
|
}
|
|
914
914
|
) : /* @__PURE__ */ e("span", { className: "text-grey-200 italic", children: "/" }) }),
|
|
915
|
-
/* @__PURE__ */ e("div", { className: "px-5 w-20 flex justify-center text-grey-200", children:
|
|
915
|
+
/* @__PURE__ */ e("div", { className: "px-5 w-20 flex justify-center text-grey-200", children: f ? /* @__PURE__ */ e(Se, {}) : /* @__PURE__ */ e(Pe, {}) }),
|
|
916
916
|
/* @__PURE__ */ o("div", { className: "flex flex-1 items-center", children: [
|
|
917
917
|
/* @__PURE__ */ e("div", { className: "text-s w-full", children: d.length ? d.join(",") : /* @__PURE__ */ e("span", { className: "text-grey-200 italic", children: "undefined" }) }),
|
|
918
918
|
/* @__PURE__ */ o("div", { className: "flex items-center gap-0.5 px-2", children: [
|
|
@@ -921,7 +921,7 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
|
|
|
921
921
|
{
|
|
922
922
|
className: "hover:bg-primary-hover rounded p-1 text-gray-100 hover:text-white active:outline-none",
|
|
923
923
|
onClick: () => y({ type: "DUPLICATE_HANDLER", id: t }),
|
|
924
|
-
children: /* @__PURE__ */ e(
|
|
924
|
+
children: /* @__PURE__ */ e(re, {})
|
|
925
925
|
}
|
|
926
926
|
) }),
|
|
927
927
|
/* @__PURE__ */ e(E, { label: "Edit Handler", className: "px-1 py-3", children: /* @__PURE__ */ e(
|
|
@@ -929,9 +929,9 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
|
|
|
929
929
|
{
|
|
930
930
|
className: "hover:bg-primary-hover rounded p-1 text-gray-100 hover:text-white active:outline-none",
|
|
931
931
|
onClick: () => {
|
|
932
|
-
|
|
932
|
+
G.next(w), y({ type: "SET_EDITING_HANDLER", payload: t });
|
|
933
933
|
},
|
|
934
|
-
children: /* @__PURE__ */ e(
|
|
934
|
+
children: /* @__PURE__ */ e(Re, {})
|
|
935
935
|
}
|
|
936
936
|
) }),
|
|
937
937
|
/* @__PURE__ */ e(E, { label: "Delete Handler", className: "px-1 py-3", placement: "top-end", children: /* @__PURE__ */ e(
|
|
@@ -939,18 +939,18 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
|
|
|
939
939
|
{
|
|
940
940
|
className: "hover:bg-primary-hover rounded p-1 text-gray-100 hover:text-white active:outline-none",
|
|
941
941
|
onClick: async () => {
|
|
942
|
-
const { confirmed:
|
|
943
|
-
|
|
942
|
+
const { confirmed: l } = await I(
|
|
943
|
+
le({
|
|
944
944
|
title: "Delete Handler",
|
|
945
|
-
type:
|
|
946
|
-
color:
|
|
945
|
+
type: pe.CONFIRM,
|
|
946
|
+
color: ce.DANGER,
|
|
947
947
|
message: "Are you sure you want to remove this Handler?",
|
|
948
948
|
icon: "FdWarningDanger"
|
|
949
949
|
})
|
|
950
950
|
).unwrap();
|
|
951
|
-
|
|
951
|
+
l && y({ type: "DELETE_HANDLER", id: t });
|
|
952
952
|
},
|
|
953
|
-
children: /* @__PURE__ */ e(
|
|
953
|
+
children: /* @__PURE__ */ e(Ie, {})
|
|
954
954
|
}
|
|
955
955
|
) })
|
|
956
956
|
] })
|
|
@@ -958,52 +958,52 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
|
|
|
958
958
|
]
|
|
959
959
|
}
|
|
960
960
|
) });
|
|
961
|
-
},
|
|
961
|
+
}, ot = k.object({
|
|
962
962
|
class: k.string().optional(),
|
|
963
963
|
method: k.string().optional(),
|
|
964
964
|
verbs: k.string().optional(),
|
|
965
965
|
id: k.string().optional(),
|
|
966
966
|
pattern: k.string().optional(),
|
|
967
967
|
regexPattern: k.string().optional()
|
|
968
|
-
}),
|
|
969
|
-
const a =
|
|
970
|
-
dispatch:
|
|
971
|
-
state: { content:
|
|
972
|
-
} =
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
coordinateGetter:
|
|
968
|
+
}), dt = k.array(ot), ct = ({ path: t }) => {
|
|
969
|
+
const a = M(ie(t)), {
|
|
970
|
+
dispatch: n,
|
|
971
|
+
state: { content: s, editing: d }
|
|
972
|
+
} = Y(), p = fe(
|
|
973
|
+
Z(ye),
|
|
974
|
+
Z(ve, {
|
|
975
|
+
coordinateGetter: Ce
|
|
976
976
|
})
|
|
977
|
-
), [
|
|
978
|
-
return
|
|
979
|
-
const
|
|
980
|
-
|
|
981
|
-
({ isExpanded:
|
|
982
|
-
var
|
|
983
|
-
const
|
|
977
|
+
), [m, f] = _(null), c = s.find((i) => i.id === m), r = $();
|
|
978
|
+
return F(() => {
|
|
979
|
+
const i = JSON.stringify(
|
|
980
|
+
s.map(
|
|
981
|
+
({ isExpanded: v, asRegex: b, pattern: y, regexPattern: w, ...I }) => {
|
|
982
|
+
var D;
|
|
983
|
+
const T = b ? { regexPattern: w } : { pattern: y };
|
|
984
984
|
return {
|
|
985
985
|
...I,
|
|
986
|
-
verbs: (
|
|
987
|
-
...
|
|
986
|
+
verbs: (D = I.verbs) == null ? void 0 : D.join(","),
|
|
987
|
+
...T
|
|
988
988
|
};
|
|
989
989
|
}
|
|
990
990
|
),
|
|
991
991
|
null,
|
|
992
992
|
2
|
|
993
|
-
),
|
|
994
|
-
|
|
995
|
-
|
|
993
|
+
), u = typeof (a == null ? void 0 : a.content) == "string" ? a.content : JSON.stringify(a == null ? void 0 : a.content, null, 2);
|
|
994
|
+
i !== u && r(
|
|
995
|
+
oe({
|
|
996
996
|
path: t,
|
|
997
|
-
content:
|
|
997
|
+
content: i
|
|
998
998
|
})
|
|
999
999
|
);
|
|
1000
|
-
}, [
|
|
1000
|
+
}, [s]), /* @__PURE__ */ o("div", { className: "bg-grey-700 flex h-full w-full flex-col text-white", children: [
|
|
1001
1001
|
/* @__PURE__ */ o("div", { className: "flex items-center justify-between border-b border-black p-2", children: [
|
|
1002
1002
|
a && /* @__PURE__ */ e(
|
|
1003
|
-
|
|
1003
|
+
tt,
|
|
1004
1004
|
{
|
|
1005
1005
|
label: "Switch to text Editor",
|
|
1006
|
-
Icon:
|
|
1006
|
+
Icon: Le,
|
|
1007
1007
|
tab: a,
|
|
1008
1008
|
editor: {
|
|
1009
1009
|
config: { language: "json" },
|
|
@@ -1012,11 +1012,11 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
|
|
|
1012
1012
|
}
|
|
1013
1013
|
),
|
|
1014
1014
|
/* @__PURE__ */ o("p", { className: "text-grey-100 text-s flex items-center gap-1", children: [
|
|
1015
|
-
/* @__PURE__ */ e(
|
|
1015
|
+
/* @__PURE__ */ e(ae, { className: "inline text-base text-white" }),
|
|
1016
1016
|
" HTTP handlers are evaluated in the order they are declared"
|
|
1017
1017
|
] })
|
|
1018
1018
|
] }),
|
|
1019
|
-
/* @__PURE__ */ e("div", { className: "mt-1 flex flex-1 flex-col overflow-x-auto px-4", children:
|
|
1019
|
+
/* @__PURE__ */ e("div", { className: "mt-1 flex flex-1 flex-col overflow-x-auto px-4", children: s.length ? /* @__PURE__ */ o("div", { className: "flex h-full min-w-[1200px] flex-1 flex-col", children: [
|
|
1020
1020
|
/* @__PURE__ */ o("div", { className: "mb-3 flex items-center gap-2 border-b", children: [
|
|
1021
1021
|
/* @__PURE__ */ e("div", { className: "w-60 flex-shrink-0 text-xs", children: /* @__PURE__ */ e("span", { className: "pl-6", children: "Class" }) }),
|
|
1022
1022
|
/* @__PURE__ */ e("div", { className: "w-60 flex-shrink-0 text-xs", children: "Method" }),
|
|
@@ -1029,7 +1029,7 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
|
|
|
1029
1029
|
{
|
|
1030
1030
|
disabled: !!d,
|
|
1031
1031
|
onClick: () => {
|
|
1032
|
-
|
|
1032
|
+
G.next(d), n({
|
|
1033
1033
|
type: "ADD_HANDLER",
|
|
1034
1034
|
payload: {
|
|
1035
1035
|
class: "",
|
|
@@ -1042,44 +1042,44 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
|
|
|
1042
1042
|
});
|
|
1043
1043
|
},
|
|
1044
1044
|
className: "hover:bg-primary-hover rounded p-1 text-gray-100 hover:text-white active:outline-none disabled:cursor-not-allowed disabled:opacity-30",
|
|
1045
|
-
children: /* @__PURE__ */ e(
|
|
1045
|
+
children: /* @__PURE__ */ e(ee, { className: "h-5 w-5" })
|
|
1046
1046
|
}
|
|
1047
1047
|
) }) })
|
|
1048
1048
|
] })
|
|
1049
1049
|
] }),
|
|
1050
1050
|
/* @__PURE__ */ e("div", { className: "py-3", children: /* @__PURE__ */ o(
|
|
1051
|
-
|
|
1051
|
+
be,
|
|
1052
1052
|
{
|
|
1053
|
-
sensors:
|
|
1054
|
-
collisionDetection:
|
|
1055
|
-
onDragStart: (
|
|
1056
|
-
|
|
1053
|
+
sensors: p,
|
|
1054
|
+
collisionDetection: Ne,
|
|
1055
|
+
onDragStart: (i) => {
|
|
1056
|
+
f(i.active.id);
|
|
1057
1057
|
},
|
|
1058
|
-
onDragEnd: (
|
|
1059
|
-
const { active:
|
|
1060
|
-
if (
|
|
1061
|
-
const
|
|
1062
|
-
|
|
1058
|
+
onDragEnd: (i) => {
|
|
1059
|
+
const { active: u, over: v } = i;
|
|
1060
|
+
if (f(null), !(!u || !v) && u.id !== (v == null ? void 0 : v.id)) {
|
|
1061
|
+
const b = s.map((w) => w.id).indexOf(u.id), y = s.map((w) => w.id).indexOf(v.id);
|
|
1062
|
+
n({
|
|
1063
1063
|
type: "UPDATE_HANDLERS",
|
|
1064
|
-
payload:
|
|
1064
|
+
payload: He(s, b, y)
|
|
1065
1065
|
});
|
|
1066
1066
|
}
|
|
1067
1067
|
},
|
|
1068
1068
|
children: [
|
|
1069
1069
|
/* @__PURE__ */ e(
|
|
1070
|
-
|
|
1070
|
+
Te,
|
|
1071
1071
|
{
|
|
1072
|
-
items:
|
|
1073
|
-
strategy:
|
|
1074
|
-
children:
|
|
1072
|
+
items: s,
|
|
1073
|
+
strategy: De,
|
|
1074
|
+
children: s.map(({ id: i, ...u }) => /* @__PURE__ */ e(ne, { id: i, ...u }, i))
|
|
1075
1075
|
}
|
|
1076
1076
|
),
|
|
1077
|
-
/* @__PURE__ */ e(
|
|
1077
|
+
/* @__PURE__ */ e(we, { children: m && c ? /* @__PURE__ */ e("div", { className: "opacity-10", children: /* @__PURE__ */ e(ne, { ...c }) }) : null })
|
|
1078
1078
|
]
|
|
1079
1079
|
}
|
|
1080
1080
|
) })
|
|
1081
1081
|
] }) : /* @__PURE__ */ o("div", { className: "mt-6", children: [
|
|
1082
|
-
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
|
|
1082
|
+
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(X, { className: "text-grey-200 mx-auto h-9 w-9" }) }),
|
|
1083
1083
|
/* @__PURE__ */ o("div", { className: "text-s text-grey-200 mx-auto mt-3 max-w-sm text-center", children: [
|
|
1084
1084
|
"There are no http handlers configured yet ",
|
|
1085
1085
|
/* @__PURE__ */ e("br", {}),
|
|
@@ -1089,7 +1089,7 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
|
|
|
1089
1089
|
"button",
|
|
1090
1090
|
{
|
|
1091
1091
|
onClick: () => {
|
|
1092
|
-
|
|
1092
|
+
G.next(d), n({
|
|
1093
1093
|
type: "ADD_HANDLER",
|
|
1094
1094
|
payload: {
|
|
1095
1095
|
class: "",
|
|
@@ -1103,65 +1103,101 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
|
|
|
1103
1103
|
},
|
|
1104
1104
|
className: "bg-primary-dark text-s rounded px-2 py-1 flex items-center gap-1",
|
|
1105
1105
|
children: [
|
|
1106
|
-
/* @__PURE__ */ e(
|
|
1106
|
+
/* @__PURE__ */ e(ee, { className: "inline text-white h-4 w-4" }),
|
|
1107
1107
|
" Add New Handler"
|
|
1108
1108
|
]
|
|
1109
1109
|
}
|
|
1110
1110
|
) })
|
|
1111
1111
|
] }) })
|
|
1112
1112
|
] });
|
|
1113
|
-
},
|
|
1114
|
-
const [
|
|
1113
|
+
}, pt = ({ content: t, path: a }) => {
|
|
1114
|
+
const [n, s] = _(null);
|
|
1115
1115
|
function d(c) {
|
|
1116
|
-
let
|
|
1116
|
+
let r;
|
|
1117
1117
|
try {
|
|
1118
|
-
|
|
1118
|
+
r = JSON.parse(c);
|
|
1119
1119
|
} catch {
|
|
1120
|
-
|
|
1120
|
+
s("HTTP Handler JSON is invalid"), r = [];
|
|
1121
1121
|
}
|
|
1122
|
-
return
|
|
1122
|
+
return r;
|
|
1123
1123
|
}
|
|
1124
|
-
const
|
|
1125
|
-
if (!
|
|
1124
|
+
const p = typeof t == "string" ? d(t) : t;
|
|
1125
|
+
if (!dt.safeParse(p).success || n)
|
|
1126
1126
|
throw new Error("Invalid JSON");
|
|
1127
|
-
const
|
|
1128
|
-
var
|
|
1129
|
-
const
|
|
1127
|
+
const f = p.map((c) => {
|
|
1128
|
+
var i;
|
|
1129
|
+
const r = !!c.regexPattern;
|
|
1130
1130
|
return {
|
|
1131
1131
|
...c,
|
|
1132
|
-
id: c.id ??
|
|
1133
|
-
verbs: (
|
|
1134
|
-
asRegex:
|
|
1132
|
+
id: c.id ?? W(),
|
|
1133
|
+
verbs: (i = c.verbs) == null ? void 0 : i.split(",").map((u) => u.toLocaleUpperCase()).filter(Boolean),
|
|
1134
|
+
asRegex: r
|
|
1135
1135
|
};
|
|
1136
1136
|
});
|
|
1137
|
-
return /* @__PURE__ */ e(
|
|
1138
|
-
},
|
|
1139
|
-
const t =
|
|
1140
|
-
return /* @__PURE__ */ e(
|
|
1141
|
-
|
|
1137
|
+
return /* @__PURE__ */ e(rt, { content: f, children: /* @__PURE__ */ e(ct, { path: a }) });
|
|
1138
|
+
}, ut = () => document.querySelector(`.${et}`) || document.body, ht = () => {
|
|
1139
|
+
const t = M(Fe), a = $();
|
|
1140
|
+
return /* @__PURE__ */ e(O, { children: t.map((n, s) => /* @__PURE__ */ e(
|
|
1141
|
+
Ve,
|
|
1142
1142
|
{
|
|
1143
|
-
hasOverlay:
|
|
1144
|
-
...
|
|
1145
|
-
onClose: (d) => a(
|
|
1146
|
-
onEdit: (d) => a(
|
|
1147
|
-
container:
|
|
1143
|
+
hasOverlay: s === 0,
|
|
1144
|
+
...n,
|
|
1145
|
+
onClose: (d) => a(je(d)),
|
|
1146
|
+
onEdit: (d) => a($e(d)),
|
|
1147
|
+
container: ut()
|
|
1148
1148
|
},
|
|
1149
|
-
|
|
1149
|
+
n.id
|
|
1150
1150
|
)) });
|
|
1151
|
-
},
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
)
|
|
1160
|
-
|
|
1161
|
-
|
|
1151
|
+
}, mt = ({
|
|
1152
|
+
initialValue: t = [],
|
|
1153
|
+
onChange: a,
|
|
1154
|
+
...n
|
|
1155
|
+
}) => {
|
|
1156
|
+
const s = M(
|
|
1157
|
+
ie(K),
|
|
1158
|
+
(p, m) => V(p, m)
|
|
1159
|
+
), d = $();
|
|
1160
|
+
return F(() => {
|
|
1161
|
+
if (t)
|
|
1162
|
+
try {
|
|
1163
|
+
const p = typeof t == "string" ? JSON.parse(t) : t;
|
|
1164
|
+
if (V(p, s == null ? void 0 : s.content))
|
|
1165
|
+
return;
|
|
1166
|
+
d(
|
|
1167
|
+
oe({
|
|
1168
|
+
path: K,
|
|
1169
|
+
content: p
|
|
1170
|
+
})
|
|
1171
|
+
);
|
|
1172
|
+
} catch (p) {
|
|
1173
|
+
console.error(
|
|
1174
|
+
"[HTTP Handlers Editor Standalone] Error while parsing the initial value:",
|
|
1175
|
+
p
|
|
1176
|
+
);
|
|
1177
|
+
}
|
|
1178
|
+
}, [t]), Xe(() => {
|
|
1179
|
+
if (s != null && s.flags.touched && a)
|
|
1180
|
+
try {
|
|
1181
|
+
const p = JSON.stringify(s == null ? void 0 : s.content, null, 2);
|
|
1182
|
+
a(p);
|
|
1183
|
+
} catch (p) {
|
|
1184
|
+
console.error("[HTTP Handlers Editor Standalone] Error on value stringify:", p);
|
|
1185
|
+
}
|
|
1186
|
+
}, [s == null ? void 0 : s.content]), /* @__PURE__ */ o(O, { children: [
|
|
1187
|
+
/* @__PURE__ */ e("div", { className: "h-screen bg-grey-900", children: /* @__PURE__ */ e(
|
|
1188
|
+
pt,
|
|
1189
|
+
{
|
|
1190
|
+
path: K,
|
|
1191
|
+
content: t,
|
|
1192
|
+
...n
|
|
1193
|
+
}
|
|
1194
|
+
) }),
|
|
1195
|
+
/* @__PURE__ */ e(ht, {})
|
|
1196
|
+
] });
|
|
1197
|
+
}, kt = (t) => /* @__PURE__ */ e(Ge, { store: Me(), children: /* @__PURE__ */ e(Qe, { children: /* @__PURE__ */ e(mt, { ...t }) }) });
|
|
1162
1198
|
export {
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1199
|
+
pt as HTTPHandlersEditor,
|
|
1200
|
+
et as HTTP_HANDLERS_EDITOR_SCOPE_CLASS,
|
|
1201
|
+
kt as Standalone
|
|
1166
1202
|
};
|
|
1167
1203
|
//# sourceMappingURL=index.es.js.map
|