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