@duke333/builder-ui 0.1.5 → 0.2.0
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 +20 -39
- package/dist/api/index.d.ts +5 -2
- package/dist/api/index.js +9 -1
- package/dist/api/index.js.map +1 -1
- package/dist/index.d.ts +2211 -6
- package/dist/index.js +3499 -2793
- package/dist/index.js.map +1 -1
- package/dist/integration/index.d.ts +2 -0
- package/dist/integration/index.js +15 -2
- package/dist/integration/index.js.map +1 -1
- package/dist/styles.css +405 -0
- package/dist/styles.css.map +1 -0
- package/dist/styles.d.ts +2 -0
- package/package.json +10 -2
|
@@ -20,6 +20,7 @@ type BuilderIntegrationConfig = {
|
|
|
20
20
|
transport: BuilderApiTransport;
|
|
21
21
|
adminBasePath?: string;
|
|
22
22
|
runtimeBasePath?: string;
|
|
23
|
+
apiBasePath?: string;
|
|
23
24
|
adminPages?: Omit<BuilderAdminPagesOptions<BuilderAdminPageContracts>, "hooks" | "routes">;
|
|
24
25
|
permissions?: unknown;
|
|
25
26
|
triggers?: unknown;
|
|
@@ -46,6 +47,7 @@ declare function createBuilderPortalIntegration<C extends BuilderApiContracts>(c
|
|
|
46
47
|
declare function validateBuilderFrontendSetup(config: {
|
|
47
48
|
adminBasePath?: string;
|
|
48
49
|
runtimeBasePath?: string;
|
|
50
|
+
apiBasePath?: string;
|
|
49
51
|
transport?: unknown;
|
|
50
52
|
}): BuilderFrontendSetupValidation;
|
|
51
53
|
|
|
@@ -9,7 +9,15 @@ function fieldOptionsQueryParams(query) {
|
|
|
9
9
|
}
|
|
10
10
|
return flatQuery;
|
|
11
11
|
}
|
|
12
|
-
function createBuilderApiClient(
|
|
12
|
+
function createBuilderApiClient(rootTransport, options = {}) {
|
|
13
|
+
const basePath = options.apiBasePath?.trim().replace(/\/+$/g, "") ?? "";
|
|
14
|
+
const path = (value) => `${basePath}${value}`;
|
|
15
|
+
const transport = {
|
|
16
|
+
get: (value, requestOptions) => rootTransport.get(path(value), requestOptions),
|
|
17
|
+
post: (value, body, requestOptions) => rootTransport.post(path(value), body, requestOptions),
|
|
18
|
+
patch: (value, body, requestOptions) => rootTransport.patch(path(value), body, requestOptions),
|
|
19
|
+
delete: (value, requestOptions) => rootTransport.delete(path(value), requestOptions)
|
|
20
|
+
};
|
|
13
21
|
return {
|
|
14
22
|
listBuilderForms: (query) => transport.get("/builder/forms", {
|
|
15
23
|
query: queryParams(query)
|
|
@@ -2232,7 +2240,7 @@ function withQuery(path, query) {
|
|
|
2232
2240
|
function createBuilderIntegration(config) {
|
|
2233
2241
|
const adminBasePath = normalizeBasePath(config.adminBasePath ?? "/admin/dev/builder");
|
|
2234
2242
|
const runtimeBasePath = normalizeBasePath(config.runtimeBasePath ?? "/admin/winu");
|
|
2235
|
-
const api = createBuilderApiClient(config.transport);
|
|
2243
|
+
const api = createBuilderApiClient(config.transport, { apiBasePath: config.apiBasePath });
|
|
2236
2244
|
const hooks = createBuilderHooks(api);
|
|
2237
2245
|
const formsPath = `${adminBasePath}/forms`;
|
|
2238
2246
|
const listsPath = `${adminBasePath}/lists`;
|
|
@@ -2282,6 +2290,11 @@ function validateBuilderFrontendSetup(config) {
|
|
|
2282
2290
|
name: "transport",
|
|
2283
2291
|
ok: Boolean(config.transport),
|
|
2284
2292
|
message: "API transport is required."
|
|
2293
|
+
},
|
|
2294
|
+
{
|
|
2295
|
+
name: "apiBasePath",
|
|
2296
|
+
ok: config.apiBasePath === void 0 || normalizeBasePath(config.apiBasePath).startsWith("/"),
|
|
2297
|
+
message: "apiBasePath must be an absolute API path."
|
|
2285
2298
|
}
|
|
2286
2299
|
].map((check) => check.ok ? { name: check.name, ok: true } : check);
|
|
2287
2300
|
return { ok: checks.every((check) => check.ok), checks };
|