@duke333/builder-ui 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -3
- package/dist/admin/index.d.ts +243 -1
- package/dist/admin/index.js +1565 -44
- package/dist/admin/index.js.map +1 -1
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.js +9 -0
- package/dist/hooks/index.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1654 -86
- package/dist/index.js.map +1 -1
- package/dist/integration/index.d.ts +27 -0
- package/dist/integration/index.js +435 -0
- package/dist/integration/index.js.map +1 -0
- package/package.json +5 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BuilderApiContracts, BuilderApiClient, BuilderApiTransport } from '../api/index.js';
|
|
2
|
+
import { BuilderHooks } from '../hooks/index.js';
|
|
3
|
+
import '@tanstack/react-query';
|
|
4
|
+
|
|
5
|
+
type BuilderIntegrationRoutes = {
|
|
6
|
+
adminBasePath: string;
|
|
7
|
+
adminHomePath: string;
|
|
8
|
+
formsPath: string;
|
|
9
|
+
newFormPath: string;
|
|
10
|
+
editFormPath(id?: string): string;
|
|
11
|
+
listsPath: string;
|
|
12
|
+
newListPath: string;
|
|
13
|
+
editListPath(id?: string): string;
|
|
14
|
+
viewsPath: string;
|
|
15
|
+
};
|
|
16
|
+
type BuilderIntegrationConfig = {
|
|
17
|
+
transport: BuilderApiTransport;
|
|
18
|
+
adminBasePath?: string;
|
|
19
|
+
};
|
|
20
|
+
type BuilderIntegration<C extends BuilderApiContracts> = {
|
|
21
|
+
api: BuilderApiClient<C>;
|
|
22
|
+
hooks: BuilderHooks<C>;
|
|
23
|
+
routes: BuilderIntegrationRoutes;
|
|
24
|
+
};
|
|
25
|
+
declare function createBuilderIntegration<C extends BuilderApiContracts>(config: BuilderIntegrationConfig): BuilderIntegration<C>;
|
|
26
|
+
|
|
27
|
+
export { type BuilderIntegration, type BuilderIntegrationConfig, type BuilderIntegrationRoutes, createBuilderIntegration };
|
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
// src/api/createBuilderApiClient.ts
|
|
2
|
+
function queryParams(query) {
|
|
3
|
+
return { ...query };
|
|
4
|
+
}
|
|
5
|
+
function fieldOptionsQueryParams(query) {
|
|
6
|
+
const flatQuery = { search: query.search };
|
|
7
|
+
for (const [key, value] of Object.entries(query.depends ?? {})) {
|
|
8
|
+
flatQuery[`depends.${key}`] = value;
|
|
9
|
+
}
|
|
10
|
+
return flatQuery;
|
|
11
|
+
}
|
|
12
|
+
function createBuilderApiClient(transport) {
|
|
13
|
+
return {
|
|
14
|
+
listBuilderForms: (query) => transport.get("/builder/forms", {
|
|
15
|
+
query: queryParams(query)
|
|
16
|
+
}),
|
|
17
|
+
listBuilderDbTables: () => transport.get("/builder/datasources/tables"),
|
|
18
|
+
listBuilderFormOptions: () => transport.get("/builder/forms/options"),
|
|
19
|
+
getBuilderForm: (id) => transport.get(`/builder/forms/${encodeURIComponent(id)}`),
|
|
20
|
+
createBuilderForm: (input) => transport.post("/builder/forms", input),
|
|
21
|
+
updateBuilderForm: (id, input) => transport.patch(`/builder/forms/${encodeURIComponent(id)}`, input),
|
|
22
|
+
replicateBuilderForm: (id, input) => transport.post(`/builder/forms/${encodeURIComponent(id)}/replicate`, input),
|
|
23
|
+
deleteBuilderForm: (id) => transport.delete(`/builder/forms/${encodeURIComponent(id)}`),
|
|
24
|
+
listBuilderLists: (query) => transport.get("/builder/lists", {
|
|
25
|
+
query: queryParams(query)
|
|
26
|
+
}),
|
|
27
|
+
listBuilderListOptions: () => transport.get("/builder/lists/options"),
|
|
28
|
+
getBuilderList: (id) => transport.get(`/builder/lists/${encodeURIComponent(id)}`),
|
|
29
|
+
createBuilderList: (input) => transport.post("/builder/lists", input),
|
|
30
|
+
updateBuilderList: (id, input) => transport.patch(`/builder/lists/${encodeURIComponent(id)}`, input),
|
|
31
|
+
replicateBuilderList: (id, input) => transport.post(`/builder/lists/${encodeURIComponent(id)}/replicate`, input),
|
|
32
|
+
deleteBuilderList: (id) => transport.delete(`/builder/lists/${encodeURIComponent(id)}`),
|
|
33
|
+
listBuilderViews: (query) => transport.get("/builder/views", {
|
|
34
|
+
query: queryParams(query)
|
|
35
|
+
}),
|
|
36
|
+
getBuilderView: (id) => transport.get(`/builder/views/${encodeURIComponent(id)}`),
|
|
37
|
+
createBuilderView: (input) => transport.post("/builder/views", input),
|
|
38
|
+
updateBuilderView: (id, input) => transport.patch(`/builder/views/${encodeURIComponent(id)}`, input),
|
|
39
|
+
replicateBuilderView: (id, input) => transport.post(`/builder/views/${encodeURIComponent(id)}/replicate`, input),
|
|
40
|
+
deleteBuilderView: (id) => transport.delete(`/builder/views/${encodeURIComponent(id)}`),
|
|
41
|
+
getRuntimeBuilderForm: (id) => transport.get(`/builder/runtime/forms/${encodeURIComponent(id)}`),
|
|
42
|
+
createRuntimeBuilderFormEntry: (formId, input) => transport.post(
|
|
43
|
+
`/builder/runtime/forms/${encodeURIComponent(formId)}/entries`,
|
|
44
|
+
input
|
|
45
|
+
),
|
|
46
|
+
listRuntimeBuilderFormFieldOptions: (formId, fieldKey, query) => transport.get(
|
|
47
|
+
`/builder/runtime/forms/${encodeURIComponent(formId)}/fields/${encodeURIComponent(fieldKey)}/options`,
|
|
48
|
+
{ query: fieldOptionsQueryParams(query) }
|
|
49
|
+
),
|
|
50
|
+
runRuntimeBuilderFormFieldTrigger: (formId, fieldKey, event, input) => transport.post(
|
|
51
|
+
`/builder/runtime/forms/${encodeURIComponent(formId)}/fields/${encodeURIComponent(fieldKey)}/triggers/${encodeURIComponent(event)}`,
|
|
52
|
+
input
|
|
53
|
+
),
|
|
54
|
+
getRuntimeBuilderList: (id) => transport.get(`/builder/runtime/lists/${encodeURIComponent(id)}`),
|
|
55
|
+
listRuntimeBuilderListEntries: (listId, query) => transport.get(
|
|
56
|
+
`/builder/runtime/lists/${encodeURIComponent(listId)}/entries`,
|
|
57
|
+
{ query: queryParams(query) }
|
|
58
|
+
),
|
|
59
|
+
getRuntimeBuilderView: (id) => transport.get(`/builder/runtime/views/${encodeURIComponent(id)}`),
|
|
60
|
+
runRuntimeBuilderViewFieldTrigger: (viewId, fieldKey, event, input) => transport.post(
|
|
61
|
+
`/builder/runtime/views/${encodeURIComponent(viewId)}/fields/${encodeURIComponent(fieldKey)}/triggers/${encodeURIComponent(event)}`,
|
|
62
|
+
input
|
|
63
|
+
),
|
|
64
|
+
listBuilderViewEntries: (viewId, query) => transport.get(
|
|
65
|
+
`/builder/runtime/views/${encodeURIComponent(viewId)}/entries`,
|
|
66
|
+
{ query: queryParams(query) }
|
|
67
|
+
),
|
|
68
|
+
createBuilderViewEntry: (viewId, input) => transport.post(
|
|
69
|
+
`/builder/runtime/views/${encodeURIComponent(viewId)}/entries`,
|
|
70
|
+
input
|
|
71
|
+
),
|
|
72
|
+
createCompositeBuilderViewEntry: (viewId, input) => transport.post(
|
|
73
|
+
`/builder/runtime/views/${encodeURIComponent(viewId)}/composite-entries`,
|
|
74
|
+
input
|
|
75
|
+
),
|
|
76
|
+
updateCompositeBuilderViewEntry: (viewId, id, input) => transport.patch(
|
|
77
|
+
`/builder/runtime/views/${encodeURIComponent(viewId)}/composite-entries/${encodeURIComponent(id)}`,
|
|
78
|
+
input
|
|
79
|
+
),
|
|
80
|
+
updateBuilderViewEntry: (viewId, id, input) => transport.patch(
|
|
81
|
+
`/builder/runtime/views/${encodeURIComponent(viewId)}/entries/${encodeURIComponent(id)}`,
|
|
82
|
+
input
|
|
83
|
+
),
|
|
84
|
+
deleteBuilderViewEntry: (viewId, id) => transport.delete(
|
|
85
|
+
`/builder/runtime/views/${encodeURIComponent(viewId)}/entries/${encodeURIComponent(id)}`
|
|
86
|
+
)
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// src/hooks/createBuilderHooks.ts
|
|
91
|
+
import { keepPreviousData, useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
92
|
+
function createBuilderKeys() {
|
|
93
|
+
const builderKeys = {
|
|
94
|
+
forms: ["builder", "forms"],
|
|
95
|
+
dbTables: () => ["builder", "datasources", "tables"],
|
|
96
|
+
formList: (query) => [...builderKeys.forms, "list", query],
|
|
97
|
+
form: (id) => [...builderKeys.forms, "detail", id],
|
|
98
|
+
formOptions: () => [...builderKeys.forms, "options"],
|
|
99
|
+
lists: ["builder", "lists"],
|
|
100
|
+
listList: (query) => [...builderKeys.lists, "list", query],
|
|
101
|
+
list: (id) => [...builderKeys.lists, "detail", id],
|
|
102
|
+
listOptions: () => [...builderKeys.lists, "options"],
|
|
103
|
+
views: ["builder", "views"],
|
|
104
|
+
viewList: (query) => [...builderKeys.views, "list", query],
|
|
105
|
+
view: (id) => [...builderKeys.views, "detail", id],
|
|
106
|
+
runtimeForm: (id) => ["builder", "runtime", "form", id],
|
|
107
|
+
runtimeFieldOptions: (formId, fieldKey, query) => [...builderKeys.runtimeForm(formId), "fields", fieldKey, "options", query],
|
|
108
|
+
runtimeFormEntries: (id) => [...builderKeys.runtimeForm(id), "entries"],
|
|
109
|
+
runtimeList: (id) => ["builder", "runtime", "list", id],
|
|
110
|
+
runtimeListEntries: (id, query) => [...builderKeys.runtimeList(id), "entries", query],
|
|
111
|
+
runtimeView: (id) => ["builder", "runtime", "view", id],
|
|
112
|
+
entries: (id, query) => [...builderKeys.runtimeView(id), "entries", query]
|
|
113
|
+
};
|
|
114
|
+
return builderKeys;
|
|
115
|
+
}
|
|
116
|
+
function createBuilderHooks(client) {
|
|
117
|
+
const builderKeys = createBuilderKeys();
|
|
118
|
+
function invalidateRuntimeViewEntries(queryClient, viewId) {
|
|
119
|
+
return Promise.all([
|
|
120
|
+
queryClient.invalidateQueries({ queryKey: builderKeys.runtimeView(viewId) }),
|
|
121
|
+
queryClient.invalidateQueries({ queryKey: [...builderKeys.runtimeView(viewId), "entries"] })
|
|
122
|
+
]);
|
|
123
|
+
}
|
|
124
|
+
function useBuilderDbTables() {
|
|
125
|
+
return useQuery({ queryKey: builderKeys.dbTables(), queryFn: client.listBuilderDbTables });
|
|
126
|
+
}
|
|
127
|
+
function useBuilderForms(query) {
|
|
128
|
+
return useQuery({
|
|
129
|
+
queryKey: builderKeys.formList(query),
|
|
130
|
+
queryFn: () => client.listBuilderForms(query),
|
|
131
|
+
placeholderData: keepPreviousData
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
function useBuilderFormOptions() {
|
|
135
|
+
return useQuery({
|
|
136
|
+
queryKey: builderKeys.formOptions(),
|
|
137
|
+
queryFn: client.listBuilderFormOptions
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
function useBuilderForm(id) {
|
|
141
|
+
return useQuery({
|
|
142
|
+
queryKey: builderKeys.form(id ?? ""),
|
|
143
|
+
queryFn: () => client.getBuilderForm(id ?? ""),
|
|
144
|
+
enabled: Boolean(id)
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
function useSaveBuilderForm() {
|
|
148
|
+
const queryClient = useQueryClient();
|
|
149
|
+
return useMutation({
|
|
150
|
+
mutationFn: ({ id, input }) => id ? client.updateBuilderForm(id, input) : client.createBuilderForm(input),
|
|
151
|
+
onSuccess: (form) => {
|
|
152
|
+
queryClient.invalidateQueries({ queryKey: builderKeys.forms });
|
|
153
|
+
queryClient.invalidateQueries({ queryKey: builderKeys.form(form.id) });
|
|
154
|
+
queryClient.invalidateQueries({ queryKey: builderKeys.runtimeForm(form.id) });
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
function useReplicateBuilderForm() {
|
|
159
|
+
const queryClient = useQueryClient();
|
|
160
|
+
return useMutation({
|
|
161
|
+
mutationFn: ({ id, input }) => client.replicateBuilderForm(id, input),
|
|
162
|
+
onSuccess: () => queryClient.invalidateQueries({ queryKey: builderKeys.forms })
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
function useDeleteBuilderForm() {
|
|
166
|
+
const queryClient = useQueryClient();
|
|
167
|
+
return useMutation({
|
|
168
|
+
mutationFn: client.deleteBuilderForm,
|
|
169
|
+
onSuccess: () => queryClient.invalidateQueries({ queryKey: builderKeys.forms })
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
function useBuilderLists(query) {
|
|
173
|
+
return useQuery({
|
|
174
|
+
queryKey: builderKeys.listList(query),
|
|
175
|
+
queryFn: () => client.listBuilderLists(query),
|
|
176
|
+
placeholderData: keepPreviousData
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
function useBuilderListOptions() {
|
|
180
|
+
return useQuery({
|
|
181
|
+
queryKey: builderKeys.listOptions(),
|
|
182
|
+
queryFn: client.listBuilderListOptions
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
function useBuilderList(id) {
|
|
186
|
+
return useQuery({
|
|
187
|
+
queryKey: builderKeys.list(id ?? ""),
|
|
188
|
+
queryFn: () => client.getBuilderList(id ?? ""),
|
|
189
|
+
enabled: Boolean(id)
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
function useSaveBuilderList() {
|
|
193
|
+
const queryClient = useQueryClient();
|
|
194
|
+
return useMutation({
|
|
195
|
+
mutationFn: ({ id, input }) => id ? client.updateBuilderList(id, input) : client.createBuilderList(input),
|
|
196
|
+
onSuccess: (list) => {
|
|
197
|
+
queryClient.invalidateQueries({ queryKey: builderKeys.lists });
|
|
198
|
+
queryClient.invalidateQueries({ queryKey: builderKeys.list(list.id) });
|
|
199
|
+
queryClient.invalidateQueries({ queryKey: builderKeys.runtimeList(list.id) });
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
function useReplicateBuilderList() {
|
|
204
|
+
const queryClient = useQueryClient();
|
|
205
|
+
return useMutation({
|
|
206
|
+
mutationFn: ({ id, input }) => client.replicateBuilderList(id, input),
|
|
207
|
+
onSuccess: () => queryClient.invalidateQueries({ queryKey: builderKeys.lists })
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
function useDeleteBuilderList() {
|
|
211
|
+
const queryClient = useQueryClient();
|
|
212
|
+
return useMutation({
|
|
213
|
+
mutationFn: client.deleteBuilderList,
|
|
214
|
+
onSuccess: () => queryClient.invalidateQueries({ queryKey: builderKeys.lists })
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
function useBuilderViews(query) {
|
|
218
|
+
return useQuery({
|
|
219
|
+
queryKey: builderKeys.viewList(query),
|
|
220
|
+
queryFn: () => client.listBuilderViews(query),
|
|
221
|
+
placeholderData: keepPreviousData
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
function useBuilderView(id) {
|
|
225
|
+
return useQuery({
|
|
226
|
+
queryKey: builderKeys.view(id ?? ""),
|
|
227
|
+
queryFn: () => client.getBuilderView(id ?? ""),
|
|
228
|
+
enabled: Boolean(id)
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
function useSaveBuilderView() {
|
|
232
|
+
const queryClient = useQueryClient();
|
|
233
|
+
return useMutation({
|
|
234
|
+
mutationFn: ({ id, input }) => id ? client.updateBuilderView(id, input) : client.createBuilderView(input),
|
|
235
|
+
onSuccess: () => queryClient.invalidateQueries({ queryKey: builderKeys.views })
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
function useReplicateBuilderView() {
|
|
239
|
+
const queryClient = useQueryClient();
|
|
240
|
+
return useMutation({
|
|
241
|
+
mutationFn: ({ id, input }) => client.replicateBuilderView(id, input),
|
|
242
|
+
onSuccess: () => queryClient.invalidateQueries({ queryKey: builderKeys.views })
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
function useDeleteBuilderView() {
|
|
246
|
+
const queryClient = useQueryClient();
|
|
247
|
+
return useMutation({
|
|
248
|
+
mutationFn: client.deleteBuilderView,
|
|
249
|
+
onSuccess: () => queryClient.invalidateQueries({ queryKey: builderKeys.views })
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
function useRuntimeBuilderForm(id) {
|
|
253
|
+
return useQuery({
|
|
254
|
+
queryKey: builderKeys.runtimeForm(id),
|
|
255
|
+
queryFn: () => client.getRuntimeBuilderForm(id)
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
function useRuntimeBuilderFormFieldOptions(formId, fieldKey, query, enabled = true) {
|
|
259
|
+
return useQuery({
|
|
260
|
+
queryKey: builderKeys.runtimeFieldOptions(formId ?? "", fieldKey, query),
|
|
261
|
+
queryFn: () => client.listRuntimeBuilderFormFieldOptions(formId ?? "", fieldKey, query),
|
|
262
|
+
enabled: Boolean(formId) && enabled
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
function useRunRuntimeBuilderFieldTrigger() {
|
|
266
|
+
return useMutation({
|
|
267
|
+
mutationFn: (args) => {
|
|
268
|
+
if (args.viewId) {
|
|
269
|
+
return client.runRuntimeBuilderViewFieldTrigger(
|
|
270
|
+
args.viewId,
|
|
271
|
+
args.fieldKey,
|
|
272
|
+
args.event,
|
|
273
|
+
args.input
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
if (args.formId) {
|
|
277
|
+
return client.runRuntimeBuilderFormFieldTrigger(
|
|
278
|
+
args.formId,
|
|
279
|
+
args.fieldKey,
|
|
280
|
+
args.event,
|
|
281
|
+
args.input
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
throw new Error("formId \u044D\u0441\u0432\u044D\u043B viewId \u0448\u0430\u0430\u0440\u0434\u043B\u0430\u0433\u0430\u0442\u0430\u0439");
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
function useRuntimeBuilderList(id) {
|
|
289
|
+
return useQuery({
|
|
290
|
+
queryKey: builderKeys.runtimeList(id),
|
|
291
|
+
queryFn: () => client.getRuntimeBuilderList(id)
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
function useRuntimeBuilderListEntries(id, query) {
|
|
295
|
+
return useQuery({
|
|
296
|
+
queryKey: builderKeys.runtimeListEntries(id, query),
|
|
297
|
+
queryFn: () => client.listRuntimeBuilderListEntries(id, query),
|
|
298
|
+
placeholderData: keepPreviousData
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
function useSaveRuntimeBuilderFormEntry(formId) {
|
|
302
|
+
const queryClient = useQueryClient();
|
|
303
|
+
return useMutation({
|
|
304
|
+
mutationFn: (input) => client.createRuntimeBuilderFormEntry(formId, input),
|
|
305
|
+
onSuccess: () => {
|
|
306
|
+
queryClient.invalidateQueries({ queryKey: builderKeys.runtimeFormEntries(formId) });
|
|
307
|
+
queryClient.invalidateQueries({ queryKey: builderKeys.runtimeForm(formId) });
|
|
308
|
+
queryClient.invalidateQueries({ queryKey: ["builder", "runtime", "list"] });
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
function useRuntimeBuilderView(id, enabled = true) {
|
|
313
|
+
return useQuery({
|
|
314
|
+
queryKey: builderKeys.runtimeView(id),
|
|
315
|
+
queryFn: () => client.getRuntimeBuilderView(id),
|
|
316
|
+
enabled: Boolean(id) && enabled
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
function useBuilderViewEntries(id, query, enabled = true) {
|
|
320
|
+
return useQuery({
|
|
321
|
+
queryKey: builderKeys.entries(id, query),
|
|
322
|
+
queryFn: () => client.listBuilderViewEntries(id, query),
|
|
323
|
+
placeholderData: keepPreviousData,
|
|
324
|
+
enabled: Boolean(id) && enabled
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
function useSaveBuilderViewEntry(viewId) {
|
|
328
|
+
const queryClient = useQueryClient();
|
|
329
|
+
return useMutation({
|
|
330
|
+
mutationFn: ({ id, input }) => id ? client.updateBuilderViewEntry(viewId, id, input) : client.createBuilderViewEntry(
|
|
331
|
+
viewId,
|
|
332
|
+
input
|
|
333
|
+
),
|
|
334
|
+
onSuccess: () => invalidateRuntimeViewEntries(queryClient, viewId)
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
function useCreateCompositeBuilderViewEntry(viewId) {
|
|
338
|
+
const queryClient = useQueryClient();
|
|
339
|
+
return useMutation({
|
|
340
|
+
mutationFn: (input) => client.createCompositeBuilderViewEntry(viewId, input),
|
|
341
|
+
onSuccess: () => invalidateRuntimeViewEntries(queryClient, viewId)
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
function useUpdateCompositeBuilderViewEntry(viewId) {
|
|
345
|
+
const queryClient = useQueryClient();
|
|
346
|
+
return useMutation({
|
|
347
|
+
mutationFn: ({
|
|
348
|
+
id,
|
|
349
|
+
input
|
|
350
|
+
}) => client.updateCompositeBuilderViewEntry(viewId, id, input),
|
|
351
|
+
onSuccess: () => invalidateRuntimeViewEntries(queryClient, viewId)
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
function useDeleteBuilderViewEntry(id) {
|
|
355
|
+
const queryClient = useQueryClient();
|
|
356
|
+
return useMutation({
|
|
357
|
+
mutationFn: (entryId) => client.deleteBuilderViewEntry(id, entryId),
|
|
358
|
+
onSuccess: () => invalidateRuntimeViewEntries(queryClient, id)
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
return {
|
|
362
|
+
builderKeys,
|
|
363
|
+
useBuilderDbTables,
|
|
364
|
+
useBuilderForm,
|
|
365
|
+
useBuilderFormOptions,
|
|
366
|
+
useBuilderForms,
|
|
367
|
+
useBuilderList,
|
|
368
|
+
useBuilderListOptions,
|
|
369
|
+
useBuilderLists,
|
|
370
|
+
useBuilderViewEntries,
|
|
371
|
+
useBuilderView,
|
|
372
|
+
useBuilderViews,
|
|
373
|
+
useDeleteBuilderForm,
|
|
374
|
+
useDeleteBuilderList,
|
|
375
|
+
useDeleteBuilderView,
|
|
376
|
+
useDeleteBuilderViewEntry,
|
|
377
|
+
useCreateCompositeBuilderViewEntry,
|
|
378
|
+
useReplicateBuilderForm,
|
|
379
|
+
useReplicateBuilderList,
|
|
380
|
+
useReplicateBuilderView,
|
|
381
|
+
useRuntimeBuilderForm,
|
|
382
|
+
useRuntimeBuilderFormFieldOptions,
|
|
383
|
+
useRuntimeBuilderList,
|
|
384
|
+
useRuntimeBuilderListEntries,
|
|
385
|
+
useRuntimeBuilderView,
|
|
386
|
+
useRunRuntimeBuilderFieldTrigger,
|
|
387
|
+
useSaveBuilderForm,
|
|
388
|
+
useSaveBuilderList,
|
|
389
|
+
useSaveBuilderView,
|
|
390
|
+
useSaveBuilderViewEntry,
|
|
391
|
+
useSaveRuntimeBuilderFormEntry,
|
|
392
|
+
useUpdateCompositeBuilderViewEntry
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
// src/integration/createBuilderIntegration.ts
|
|
397
|
+
function normalizeBasePath(path) {
|
|
398
|
+
const trimmed = path.trim().replace(/\/+$/g, "");
|
|
399
|
+
if (!trimmed) return "/builder";
|
|
400
|
+
return trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
|
|
401
|
+
}
|
|
402
|
+
function withQuery(path, query) {
|
|
403
|
+
const params = new URLSearchParams();
|
|
404
|
+
for (const [key, value] of Object.entries(query)) {
|
|
405
|
+
if (value) params.set(key, value);
|
|
406
|
+
}
|
|
407
|
+
const queryString = params.toString();
|
|
408
|
+
return queryString ? `${path}?${queryString}` : path;
|
|
409
|
+
}
|
|
410
|
+
function createBuilderIntegration(config) {
|
|
411
|
+
const adminBasePath = normalizeBasePath(config.adminBasePath ?? "/admin/dev/builder");
|
|
412
|
+
const api = createBuilderApiClient(config.transport);
|
|
413
|
+
const hooks = createBuilderHooks(api);
|
|
414
|
+
const formsPath = `${adminBasePath}/forms`;
|
|
415
|
+
const listsPath = `${adminBasePath}/lists`;
|
|
416
|
+
return {
|
|
417
|
+
api,
|
|
418
|
+
hooks,
|
|
419
|
+
routes: {
|
|
420
|
+
adminBasePath,
|
|
421
|
+
adminHomePath: adminBasePath,
|
|
422
|
+
formsPath,
|
|
423
|
+
newFormPath: `${formsPath}/new`,
|
|
424
|
+
editFormPath: (id) => withQuery(`${formsPath}/edit`, { id }),
|
|
425
|
+
listsPath,
|
|
426
|
+
newListPath: `${listsPath}/new`,
|
|
427
|
+
editListPath: (id) => withQuery(`${listsPath}/edit`, { id }),
|
|
428
|
+
viewsPath: `${adminBasePath}/views`
|
|
429
|
+
}
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
export {
|
|
433
|
+
createBuilderIntegration
|
|
434
|
+
};
|
|
435
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/api/createBuilderApiClient.ts","../../src/hooks/createBuilderHooks.ts","../../src/integration/createBuilderIntegration.ts"],"sourcesContent":["export type BuilderApiQueryValue = string | number | boolean | null | undefined;\nexport type BuilderApiQuery = Record<string, BuilderApiQueryValue>;\n\nexport type BuilderApiTransport = {\n get<T>(path: string, options?: { query?: BuilderApiQuery }): Promise<T>;\n post<T>(path: string, body?: unknown, options?: { query?: BuilderApiQuery }): Promise<T>;\n patch<T>(path: string, body?: unknown, options?: { query?: BuilderApiQuery }): Promise<T>;\n delete<T>(path: string, options?: { query?: BuilderApiQuery }): Promise<T>;\n};\n\nexport type BuilderFieldOptionsQuery = {\n search?: string;\n depends?: Record<string, string | undefined>;\n};\n\nexport type BuilderApiContracts = {\n BuilderDbTable: unknown;\n BuilderForm: { id: string };\n BuilderList: { id: string };\n BuilderView: { id: string };\n BuilderViewEntry: { id: string };\n ListBuilderFormsQuery: object;\n ListBuilderFormsResponse: unknown;\n CreateBuilderFormInput: unknown;\n UpdateBuilderFormInput: unknown;\n ListBuilderListsQuery: object;\n ListBuilderListsResponse: unknown;\n CreateBuilderListInput: unknown;\n UpdateBuilderListInput: unknown;\n ListBuilderViewsQuery: object;\n ListBuilderViewsResponse: unknown;\n CreateBuilderViewInput: unknown;\n UpdateBuilderViewInput: unknown;\n ReplicateBuilderEntityInput: unknown;\n CreateBuilderViewEntryInput: unknown;\n CreateCompositeBuilderViewEntryInput: unknown;\n UpdateCompositeBuilderViewEntryInput: unknown;\n UpdateBuilderViewEntryInput: unknown;\n ListBuilderFieldOptionsQuery: BuilderFieldOptionsQuery;\n ListBuilderFieldOptionsResponse: unknown;\n RunBuilderFieldTriggerInput: unknown;\n BuilderFieldTriggerEvent: string;\n BuilderFieldTriggerResponse: unknown;\n ListBuilderViewEntriesQuery: object;\n ListBuilderViewEntriesResponse: unknown;\n};\n\nfunction queryParams(query: object): BuilderApiQuery {\n return { ...query } as BuilderApiQuery;\n}\n\nfunction fieldOptionsQueryParams(query: BuilderFieldOptionsQuery): BuilderApiQuery {\n const flatQuery: BuilderApiQuery = { search: query.search };\n for (const [key, value] of Object.entries(query.depends ?? {})) {\n flatQuery[`depends.${key}`] = value;\n }\n return flatQuery;\n}\n\nexport function createBuilderApiClient<C extends BuilderApiContracts>(\n transport: BuilderApiTransport,\n) {\n return {\n listBuilderForms: (query: C[\"ListBuilderFormsQuery\"]) =>\n transport.get<C[\"ListBuilderFormsResponse\"]>(\"/builder/forms\", {\n query: queryParams(query),\n }),\n\n listBuilderDbTables: () => transport.get<C[\"BuilderDbTable\"][]>(\"/builder/datasources/tables\"),\n\n listBuilderFormOptions: () => transport.get<C[\"BuilderForm\"][]>(\"/builder/forms/options\"),\n\n getBuilderForm: (id: string) =>\n transport.get<C[\"BuilderForm\"]>(`/builder/forms/${encodeURIComponent(id)}`),\n\n createBuilderForm: (input: C[\"CreateBuilderFormInput\"]) =>\n transport.post<C[\"BuilderForm\"]>(\"/builder/forms\", input),\n\n updateBuilderForm: (id: string, input: C[\"UpdateBuilderFormInput\"]) =>\n transport.patch<C[\"BuilderForm\"]>(`/builder/forms/${encodeURIComponent(id)}`, input),\n\n replicateBuilderForm: (id: string, input: C[\"ReplicateBuilderEntityInput\"]) =>\n transport.post<C[\"BuilderForm\"]>(`/builder/forms/${encodeURIComponent(id)}/replicate`, input),\n\n deleteBuilderForm: (id: string) =>\n transport.delete<void>(`/builder/forms/${encodeURIComponent(id)}`),\n\n listBuilderLists: (query: C[\"ListBuilderListsQuery\"]) =>\n transport.get<C[\"ListBuilderListsResponse\"]>(\"/builder/lists\", {\n query: queryParams(query),\n }),\n\n listBuilderListOptions: () => transport.get<C[\"BuilderList\"][]>(\"/builder/lists/options\"),\n\n getBuilderList: (id: string) =>\n transport.get<C[\"BuilderList\"]>(`/builder/lists/${encodeURIComponent(id)}`),\n\n createBuilderList: (input: C[\"CreateBuilderListInput\"]) =>\n transport.post<C[\"BuilderList\"]>(\"/builder/lists\", input),\n\n updateBuilderList: (id: string, input: C[\"UpdateBuilderListInput\"]) =>\n transport.patch<C[\"BuilderList\"]>(`/builder/lists/${encodeURIComponent(id)}`, input),\n\n replicateBuilderList: (id: string, input: C[\"ReplicateBuilderEntityInput\"]) =>\n transport.post<C[\"BuilderList\"]>(`/builder/lists/${encodeURIComponent(id)}/replicate`, input),\n\n deleteBuilderList: (id: string) =>\n transport.delete<void>(`/builder/lists/${encodeURIComponent(id)}`),\n\n listBuilderViews: (query: C[\"ListBuilderViewsQuery\"]) =>\n transport.get<C[\"ListBuilderViewsResponse\"]>(\"/builder/views\", {\n query: queryParams(query),\n }),\n\n getBuilderView: (id: string) =>\n transport.get<C[\"BuilderView\"]>(`/builder/views/${encodeURIComponent(id)}`),\n\n createBuilderView: (input: C[\"CreateBuilderViewInput\"]) =>\n transport.post<C[\"BuilderView\"]>(\"/builder/views\", input),\n\n updateBuilderView: (id: string, input: C[\"UpdateBuilderViewInput\"]) =>\n transport.patch<C[\"BuilderView\"]>(`/builder/views/${encodeURIComponent(id)}`, input),\n\n replicateBuilderView: (id: string, input: C[\"ReplicateBuilderEntityInput\"]) =>\n transport.post<C[\"BuilderView\"]>(`/builder/views/${encodeURIComponent(id)}/replicate`, input),\n\n deleteBuilderView: (id: string) =>\n transport.delete<void>(`/builder/views/${encodeURIComponent(id)}`),\n\n getRuntimeBuilderForm: (id: string) =>\n transport.get<C[\"BuilderForm\"]>(`/builder/runtime/forms/${encodeURIComponent(id)}`),\n\n createRuntimeBuilderFormEntry: (formId: string, input: C[\"CreateBuilderViewEntryInput\"]) =>\n transport.post<C[\"BuilderViewEntry\"]>(\n `/builder/runtime/forms/${encodeURIComponent(formId)}/entries`,\n input,\n ),\n\n listRuntimeBuilderFormFieldOptions: (\n formId: string,\n fieldKey: string,\n query: C[\"ListBuilderFieldOptionsQuery\"],\n ) =>\n transport.get<C[\"ListBuilderFieldOptionsResponse\"]>(\n `/builder/runtime/forms/${encodeURIComponent(formId)}/fields/${encodeURIComponent(fieldKey)}/options`,\n { query: fieldOptionsQueryParams(query) },\n ),\n\n runRuntimeBuilderFormFieldTrigger: (\n formId: string,\n fieldKey: string,\n event: C[\"BuilderFieldTriggerEvent\"],\n input: C[\"RunBuilderFieldTriggerInput\"],\n ) =>\n transport.post<C[\"BuilderFieldTriggerResponse\"]>(\n `/builder/runtime/forms/${encodeURIComponent(formId)}/fields/${encodeURIComponent(fieldKey)}/triggers/${encodeURIComponent(event)}`,\n input,\n ),\n\n getRuntimeBuilderList: (id: string) =>\n transport.get<C[\"BuilderList\"]>(`/builder/runtime/lists/${encodeURIComponent(id)}`),\n\n listRuntimeBuilderListEntries: (listId: string, query: C[\"ListBuilderViewEntriesQuery\"]) =>\n transport.get<C[\"ListBuilderViewEntriesResponse\"]>(\n `/builder/runtime/lists/${encodeURIComponent(listId)}/entries`,\n { query: queryParams(query) },\n ),\n\n getRuntimeBuilderView: (id: string) =>\n transport.get<C[\"BuilderView\"]>(`/builder/runtime/views/${encodeURIComponent(id)}`),\n\n runRuntimeBuilderViewFieldTrigger: (\n viewId: string,\n fieldKey: string,\n event: C[\"BuilderFieldTriggerEvent\"],\n input: C[\"RunBuilderFieldTriggerInput\"],\n ) =>\n transport.post<C[\"BuilderFieldTriggerResponse\"]>(\n `/builder/runtime/views/${encodeURIComponent(viewId)}/fields/${encodeURIComponent(fieldKey)}/triggers/${encodeURIComponent(event)}`,\n input,\n ),\n\n listBuilderViewEntries: (viewId: string, query: C[\"ListBuilderViewEntriesQuery\"]) =>\n transport.get<C[\"ListBuilderViewEntriesResponse\"]>(\n `/builder/runtime/views/${encodeURIComponent(viewId)}/entries`,\n { query: queryParams(query) },\n ),\n\n createBuilderViewEntry: (viewId: string, input: C[\"CreateBuilderViewEntryInput\"]) =>\n transport.post<C[\"BuilderViewEntry\"]>(\n `/builder/runtime/views/${encodeURIComponent(viewId)}/entries`,\n input,\n ),\n\n createCompositeBuilderViewEntry: (\n viewId: string,\n input: C[\"CreateCompositeBuilderViewEntryInput\"],\n ) =>\n transport.post<C[\"BuilderViewEntry\"]>(\n `/builder/runtime/views/${encodeURIComponent(viewId)}/composite-entries`,\n input,\n ),\n\n updateCompositeBuilderViewEntry: (\n viewId: string,\n id: string,\n input: C[\"UpdateCompositeBuilderViewEntryInput\"],\n ) =>\n transport.patch<C[\"BuilderViewEntry\"]>(\n `/builder/runtime/views/${encodeURIComponent(viewId)}/composite-entries/${encodeURIComponent(id)}`,\n input,\n ),\n\n updateBuilderViewEntry: (viewId: string, id: string, input: C[\"UpdateBuilderViewEntryInput\"]) =>\n transport.patch<C[\"BuilderViewEntry\"]>(\n `/builder/runtime/views/${encodeURIComponent(viewId)}/entries/${encodeURIComponent(id)}`,\n input,\n ),\n\n deleteBuilderViewEntry: (viewId: string, id: string) =>\n transport.delete<void>(\n `/builder/runtime/views/${encodeURIComponent(viewId)}/entries/${encodeURIComponent(id)}`,\n ),\n };\n}\n\nexport type BuilderApiClient<C extends BuilderApiContracts> = ReturnType<\n typeof createBuilderApiClient<C>\n>;\n","\"use client\";\n\nimport { keepPreviousData, useMutation, useQuery, useQueryClient } from \"@tanstack/react-query\";\nimport type { BuilderApiClient, BuilderApiContracts } from \"../api\";\n\nexport function createBuilderKeys<C extends BuilderApiContracts>() {\n const builderKeys = {\n forms: [\"builder\", \"forms\"] as const,\n dbTables: () => [\"builder\", \"datasources\", \"tables\"] as const,\n formList: (query: C[\"ListBuilderFormsQuery\"]) => [...builderKeys.forms, \"list\", query] as const,\n form: (id: string) => [...builderKeys.forms, \"detail\", id] as const,\n formOptions: () => [...builderKeys.forms, \"options\"] as const,\n lists: [\"builder\", \"lists\"] as const,\n listList: (query: C[\"ListBuilderListsQuery\"]) => [...builderKeys.lists, \"list\", query] as const,\n list: (id: string) => [...builderKeys.lists, \"detail\", id] as const,\n listOptions: () => [...builderKeys.lists, \"options\"] as const,\n views: [\"builder\", \"views\"] as const,\n viewList: (query: C[\"ListBuilderViewsQuery\"]) => [...builderKeys.views, \"list\", query] as const,\n view: (id: string) => [...builderKeys.views, \"detail\", id] as const,\n runtimeForm: (id: string) => [\"builder\", \"runtime\", \"form\", id] as const,\n runtimeFieldOptions: (\n formId: string,\n fieldKey: string,\n query: C[\"ListBuilderFieldOptionsQuery\"],\n ) => [...builderKeys.runtimeForm(formId), \"fields\", fieldKey, \"options\", query] as const,\n runtimeFormEntries: (id: string) => [...builderKeys.runtimeForm(id), \"entries\"] as const,\n runtimeList: (id: string) => [\"builder\", \"runtime\", \"list\", id] as const,\n runtimeListEntries: (id: string, query: C[\"ListBuilderViewEntriesQuery\"]) =>\n [...builderKeys.runtimeList(id), \"entries\", query] as const,\n runtimeView: (id: string) => [\"builder\", \"runtime\", \"view\", id] as const,\n entries: (id: string, query: C[\"ListBuilderViewEntriesQuery\"]) =>\n [...builderKeys.runtimeView(id), \"entries\", query] as const,\n };\n\n return builderKeys;\n}\n\nexport function createBuilderHooks<C extends BuilderApiContracts>(client: BuilderApiClient<C>) {\n const builderKeys = createBuilderKeys<C>();\n\n function invalidateRuntimeViewEntries(\n queryClient: ReturnType<typeof useQueryClient>,\n viewId: string,\n ) {\n return Promise.all([\n queryClient.invalidateQueries({ queryKey: builderKeys.runtimeView(viewId) }),\n queryClient.invalidateQueries({ queryKey: [...builderKeys.runtimeView(viewId), \"entries\"] }),\n ]);\n }\n\n function useBuilderDbTables() {\n return useQuery({ queryKey: builderKeys.dbTables(), queryFn: client.listBuilderDbTables });\n }\n\n function useBuilderForms(query: C[\"ListBuilderFormsQuery\"]) {\n return useQuery({\n queryKey: builderKeys.formList(query),\n queryFn: () => client.listBuilderForms(query),\n placeholderData: keepPreviousData,\n });\n }\n\n function useBuilderFormOptions() {\n return useQuery({\n queryKey: builderKeys.formOptions(),\n queryFn: client.listBuilderFormOptions,\n });\n }\n\n function useBuilderForm(id?: string) {\n return useQuery({\n queryKey: builderKeys.form(id ?? \"\"),\n queryFn: () => client.getBuilderForm(id ?? \"\"),\n enabled: Boolean(id),\n });\n }\n\n function useSaveBuilderForm() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, input }: { id?: string; input: C[\"UpdateBuilderFormInput\"] }) =>\n id\n ? client.updateBuilderForm(id, input)\n : client.createBuilderForm(input as unknown as C[\"CreateBuilderFormInput\"]),\n onSuccess: (form) => {\n queryClient.invalidateQueries({ queryKey: builderKeys.forms });\n queryClient.invalidateQueries({ queryKey: builderKeys.form(form.id) });\n queryClient.invalidateQueries({ queryKey: builderKeys.runtimeForm(form.id) });\n },\n });\n }\n\n function useReplicateBuilderForm() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, input }: { id: string; input: C[\"ReplicateBuilderEntityInput\"] }) =>\n client.replicateBuilderForm(id, input),\n onSuccess: () => queryClient.invalidateQueries({ queryKey: builderKeys.forms }),\n });\n }\n\n function useDeleteBuilderForm() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: client.deleteBuilderForm,\n onSuccess: () => queryClient.invalidateQueries({ queryKey: builderKeys.forms }),\n });\n }\n\n function useBuilderLists(query: C[\"ListBuilderListsQuery\"]) {\n return useQuery({\n queryKey: builderKeys.listList(query),\n queryFn: () => client.listBuilderLists(query),\n placeholderData: keepPreviousData,\n });\n }\n\n function useBuilderListOptions() {\n return useQuery({\n queryKey: builderKeys.listOptions(),\n queryFn: client.listBuilderListOptions,\n });\n }\n\n function useBuilderList(id?: string) {\n return useQuery({\n queryKey: builderKeys.list(id ?? \"\"),\n queryFn: () => client.getBuilderList(id ?? \"\"),\n enabled: Boolean(id),\n });\n }\n\n function useSaveBuilderList() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, input }: { id?: string; input: C[\"UpdateBuilderListInput\"] }) =>\n id\n ? client.updateBuilderList(id, input)\n : client.createBuilderList(input as unknown as C[\"CreateBuilderListInput\"]),\n onSuccess: (list) => {\n queryClient.invalidateQueries({ queryKey: builderKeys.lists });\n queryClient.invalidateQueries({ queryKey: builderKeys.list(list.id) });\n queryClient.invalidateQueries({ queryKey: builderKeys.runtimeList(list.id) });\n },\n });\n }\n\n function useReplicateBuilderList() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, input }: { id: string; input: C[\"ReplicateBuilderEntityInput\"] }) =>\n client.replicateBuilderList(id, input),\n onSuccess: () => queryClient.invalidateQueries({ queryKey: builderKeys.lists }),\n });\n }\n\n function useDeleteBuilderList() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: client.deleteBuilderList,\n onSuccess: () => queryClient.invalidateQueries({ queryKey: builderKeys.lists }),\n });\n }\n\n function useBuilderViews(query: C[\"ListBuilderViewsQuery\"]) {\n return useQuery({\n queryKey: builderKeys.viewList(query),\n queryFn: () => client.listBuilderViews(query),\n placeholderData: keepPreviousData,\n });\n }\n\n function useBuilderView(id?: string) {\n return useQuery({\n queryKey: builderKeys.view(id ?? \"\"),\n queryFn: () => client.getBuilderView(id ?? \"\"),\n enabled: Boolean(id),\n });\n }\n\n function useSaveBuilderView() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, input }: { id?: string; input: C[\"UpdateBuilderViewInput\"] }) =>\n id\n ? client.updateBuilderView(id, input)\n : client.createBuilderView(input as unknown as C[\"CreateBuilderViewInput\"]),\n onSuccess: () => queryClient.invalidateQueries({ queryKey: builderKeys.views }),\n });\n }\n\n function useReplicateBuilderView() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, input }: { id: string; input: C[\"ReplicateBuilderEntityInput\"] }) =>\n client.replicateBuilderView(id, input),\n onSuccess: () => queryClient.invalidateQueries({ queryKey: builderKeys.views }),\n });\n }\n\n function useDeleteBuilderView() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: client.deleteBuilderView,\n onSuccess: () => queryClient.invalidateQueries({ queryKey: builderKeys.views }),\n });\n }\n\n function useRuntimeBuilderForm(id: string) {\n return useQuery({\n queryKey: builderKeys.runtimeForm(id),\n queryFn: () => client.getRuntimeBuilderForm(id),\n });\n }\n\n function useRuntimeBuilderFormFieldOptions(\n formId: string | undefined,\n fieldKey: string,\n query: C[\"ListBuilderFieldOptionsQuery\"],\n enabled = true,\n ) {\n return useQuery({\n queryKey: builderKeys.runtimeFieldOptions(formId ?? \"\", fieldKey, query),\n queryFn: () => client.listRuntimeBuilderFormFieldOptions(formId ?? \"\", fieldKey, query),\n enabled: Boolean(formId) && enabled,\n });\n }\n\n function useRunRuntimeBuilderFieldTrigger() {\n return useMutation({\n mutationFn: (args: {\n formId?: string;\n viewId?: string;\n fieldKey: string;\n event: C[\"BuilderFieldTriggerEvent\"];\n input: C[\"RunBuilderFieldTriggerInput\"];\n }) => {\n if (args.viewId) {\n return client.runRuntimeBuilderViewFieldTrigger(\n args.viewId,\n args.fieldKey,\n args.event,\n args.input,\n );\n }\n if (args.formId) {\n return client.runRuntimeBuilderFormFieldTrigger(\n args.formId,\n args.fieldKey,\n args.event,\n args.input,\n );\n }\n throw new Error(\"formId эсвэл viewId шаардлагатай\");\n },\n });\n }\n\n function useRuntimeBuilderList(id: string) {\n return useQuery({\n queryKey: builderKeys.runtimeList(id),\n queryFn: () => client.getRuntimeBuilderList(id),\n });\n }\n\n function useRuntimeBuilderListEntries(id: string, query: C[\"ListBuilderViewEntriesQuery\"]) {\n return useQuery({\n queryKey: builderKeys.runtimeListEntries(id, query),\n queryFn: () => client.listRuntimeBuilderListEntries(id, query),\n placeholderData: keepPreviousData,\n });\n }\n\n function useSaveRuntimeBuilderFormEntry(formId: string) {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (input: C[\"CreateBuilderViewEntryInput\"]) =>\n client.createRuntimeBuilderFormEntry(formId, input),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: builderKeys.runtimeFormEntries(formId) });\n queryClient.invalidateQueries({ queryKey: builderKeys.runtimeForm(formId) });\n queryClient.invalidateQueries({ queryKey: [\"builder\", \"runtime\", \"list\"] });\n },\n });\n }\n\n function useRuntimeBuilderView(id: string, enabled = true) {\n return useQuery({\n queryKey: builderKeys.runtimeView(id),\n queryFn: () => client.getRuntimeBuilderView(id),\n enabled: Boolean(id) && enabled,\n });\n }\n\n function useBuilderViewEntries(\n id: string,\n query: C[\"ListBuilderViewEntriesQuery\"],\n enabled = true,\n ) {\n return useQuery({\n queryKey: builderKeys.entries(id, query),\n queryFn: () => client.listBuilderViewEntries(id, query),\n placeholderData: keepPreviousData,\n enabled: Boolean(id) && enabled,\n });\n }\n\n function useSaveBuilderViewEntry(viewId: string) {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, input }: { id?: string; input: C[\"UpdateBuilderViewEntryInput\"] }) =>\n id\n ? client.updateBuilderViewEntry(viewId, id, input)\n : client.createBuilderViewEntry(\n viewId,\n input as unknown as C[\"CreateBuilderViewEntryInput\"],\n ),\n onSuccess: () => invalidateRuntimeViewEntries(queryClient, viewId),\n });\n }\n\n function useCreateCompositeBuilderViewEntry(viewId: string) {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (input: C[\"CreateCompositeBuilderViewEntryInput\"]) =>\n client.createCompositeBuilderViewEntry(viewId, input),\n onSuccess: () => invalidateRuntimeViewEntries(queryClient, viewId),\n });\n }\n\n function useUpdateCompositeBuilderViewEntry(viewId: string) {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({\n id,\n input,\n }: {\n id: string;\n input: C[\"UpdateCompositeBuilderViewEntryInput\"];\n }) => client.updateCompositeBuilderViewEntry(viewId, id, input),\n onSuccess: () => invalidateRuntimeViewEntries(queryClient, viewId),\n });\n }\n\n function useDeleteBuilderViewEntry(id: string) {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (entryId: string) => client.deleteBuilderViewEntry(id, entryId),\n onSuccess: () => invalidateRuntimeViewEntries(queryClient, id),\n });\n }\n\n return {\n builderKeys,\n useBuilderDbTables,\n useBuilderForm,\n useBuilderFormOptions,\n useBuilderForms,\n useBuilderList,\n useBuilderListOptions,\n useBuilderLists,\n useBuilderViewEntries,\n useBuilderView,\n useBuilderViews,\n useDeleteBuilderForm,\n useDeleteBuilderList,\n useDeleteBuilderView,\n useDeleteBuilderViewEntry,\n useCreateCompositeBuilderViewEntry,\n useReplicateBuilderForm,\n useReplicateBuilderList,\n useReplicateBuilderView,\n useRuntimeBuilderForm,\n useRuntimeBuilderFormFieldOptions,\n useRuntimeBuilderList,\n useRuntimeBuilderListEntries,\n useRuntimeBuilderView,\n useRunRuntimeBuilderFieldTrigger,\n useSaveBuilderForm,\n useSaveBuilderList,\n useSaveBuilderView,\n useSaveBuilderViewEntry,\n useSaveRuntimeBuilderFormEntry,\n useUpdateCompositeBuilderViewEntry,\n };\n}\n\nexport type BuilderHooks<C extends BuilderApiContracts> = ReturnType<typeof createBuilderHooks<C>>;\n","\"use client\";\n\nimport {\n type BuilderApiClient,\n type BuilderApiContracts,\n type BuilderApiTransport,\n createBuilderApiClient,\n} from \"../api\";\nimport { type BuilderHooks, createBuilderHooks } from \"../hooks\";\n\nexport type BuilderIntegrationRoutes = {\n adminBasePath: string;\n adminHomePath: string;\n formsPath: string;\n newFormPath: string;\n editFormPath(id?: string): string;\n listsPath: string;\n newListPath: string;\n editListPath(id?: string): string;\n viewsPath: string;\n};\n\nexport type BuilderIntegrationConfig = {\n transport: BuilderApiTransport;\n adminBasePath?: string;\n};\n\nexport type BuilderIntegration<C extends BuilderApiContracts> = {\n api: BuilderApiClient<C>;\n hooks: BuilderHooks<C>;\n routes: BuilderIntegrationRoutes;\n};\n\nfunction normalizeBasePath(path: string) {\n const trimmed = path.trim().replace(/\\/+$/g, \"\");\n if (!trimmed) return \"/builder\";\n return trimmed.startsWith(\"/\") ? trimmed : `/${trimmed}`;\n}\n\nfunction withQuery(path: string, query: Record<string, string | undefined>) {\n const params = new URLSearchParams();\n for (const [key, value] of Object.entries(query)) {\n if (value) params.set(key, value);\n }\n const queryString = params.toString();\n return queryString ? `${path}?${queryString}` : path;\n}\n\nexport function createBuilderIntegration<C extends BuilderApiContracts>(\n config: BuilderIntegrationConfig,\n): BuilderIntegration<C> {\n const adminBasePath = normalizeBasePath(config.adminBasePath ?? \"/admin/dev/builder\");\n const api = createBuilderApiClient<C>(config.transport);\n const hooks = createBuilderHooks<C>(api);\n\n const formsPath = `${adminBasePath}/forms`;\n const listsPath = `${adminBasePath}/lists`;\n\n return {\n api,\n hooks,\n routes: {\n adminBasePath,\n adminHomePath: adminBasePath,\n formsPath,\n newFormPath: `${formsPath}/new`,\n editFormPath: (id) => withQuery(`${formsPath}/edit`, { id }),\n listsPath,\n newListPath: `${listsPath}/new`,\n editListPath: (id) => withQuery(`${listsPath}/edit`, { id }),\n viewsPath: `${adminBasePath}/views`,\n },\n };\n}\n"],"mappings":";AA+CA,SAAS,YAAY,OAAgC;AACnD,SAAO,EAAE,GAAG,MAAM;AACpB;AAEA,SAAS,wBAAwB,OAAkD;AACjF,QAAM,YAA6B,EAAE,QAAQ,MAAM,OAAO;AAC1D,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,MAAM,WAAW,CAAC,CAAC,GAAG;AAC9D,cAAU,WAAW,GAAG,EAAE,IAAI;AAAA,EAChC;AACA,SAAO;AACT;AAEO,SAAS,uBACd,WACA;AACA,SAAO;AAAA,IACL,kBAAkB,CAAC,UACjB,UAAU,IAAmC,kBAAkB;AAAA,MAC7D,OAAO,YAAY,KAAK;AAAA,IAC1B,CAAC;AAAA,IAEH,qBAAqB,MAAM,UAAU,IAA2B,6BAA6B;AAAA,IAE7F,wBAAwB,MAAM,UAAU,IAAwB,wBAAwB;AAAA,IAExF,gBAAgB,CAAC,OACf,UAAU,IAAsB,kBAAkB,mBAAmB,EAAE,CAAC,EAAE;AAAA,I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,OAAO,SAAS;AACpC,SAAO,cAAc,GAAG,IAAI,IAAI,WAAW,KAAK;AAClD;AAEO,SAAS,yBACd,QACuB;AACvB,QAAM,gBAAgB,kBAAkB,OAAO,iBAAiB,oBAAoB;AACpF,QAAM,MAAM,uBAA0B,OAAO,SAAS;AACtD,QAAM,QAAQ,mBAAsB,GAAG;AAEvC,QAAM,YAAY,GAAG,aAAa;AAClC,QAAM,YAAY,GAAG,aAAa;AAElC,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,MACN;AAAA,MACA,eAAe;AAAA,MACf;AAAA,MACA,aAAa,GAAG,SAAS;AAAA,MACzB,cAAc,CAAC,OAAO,UAAU,GAAG,SAAS,SAAS,EAAE,GAAG,CAAC;AAAA,MAC3D;AAAA,MACA,aAAa,GAAG,SAAS;AAAA,MACzB,cAAc,CAAC,OAAO,UAAU,GAAG,SAAS,SAAS,EAAE,GAAG,CAAC;AAAA,MAC3D,WAAW,GAAG,aAAa;AAAA,IAC7B;AAAA,EACF;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@duke333/builder-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "React UI, hooks, and runtime helpers for Winu Builder.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -33,6 +33,10 @@
|
|
|
33
33
|
"types": "./dist/hooks/index.d.ts",
|
|
34
34
|
"import": "./dist/hooks/index.js"
|
|
35
35
|
},
|
|
36
|
+
"./integration": {
|
|
37
|
+
"types": "./dist/integration/index.d.ts",
|
|
38
|
+
"import": "./dist/integration/index.js"
|
|
39
|
+
},
|
|
36
40
|
"./runtime": {
|
|
37
41
|
"types": "./dist/runtime/index.d.ts",
|
|
38
42
|
"import": "./dist/runtime/index.js"
|