@betterportal/config-manager 10.1.57 → 10.1.59

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.
Files changed (25) hide show
  1. package/lib/.bsb/clients/service-betterportal-config-manager.d.ts +1 -1
  2. package/lib/.bsb/clients/service-betterportal-config-manager.js +1 -1
  3. package/lib/bp-contracts/org.betterportal.config-manager.json +7 -1
  4. package/lib/plugins/service-betterportal-config-manager/adminApi.d.ts +2 -2
  5. package/lib/plugins/service-betterportal-config-manager/adminApi.d.ts.map +1 -1
  6. package/lib/plugins/service-betterportal-config-manager/adminApi.js +21 -4
  7. package/lib/plugins/service-betterportal-config-manager/adminApi.js.map +1 -1
  8. package/lib/plugins/service-betterportal-config-manager/bp-routes/routes/_renderer.bootstrap5/GET.d.ts.map +1 -1
  9. package/lib/plugins/service-betterportal-config-manager/bp-routes/routes/_renderer.bootstrap5/GET.js +7 -3
  10. package/lib/plugins/service-betterportal-config-manager/bp-routes/routes/_renderer.bootstrap5/GET.js.map +1 -1
  11. package/lib/plugins/service-betterportal-config-manager/bp-routes/routes/route.impl.d.ts +2 -0
  12. package/lib/plugins/service-betterportal-config-manager/bp-routes/routes/route.impl.d.ts.map +1 -1
  13. package/lib/plugins/service-betterportal-config-manager/bp-routes/routes/route.impl.js +1 -0
  14. package/lib/plugins/service-betterportal-config-manager/bp-routes/routes/route.impl.js.map +1 -1
  15. package/lib/plugins/service-betterportal-config-manager/bp-routes/tenants/route.impl.d.ts +4 -4
  16. package/lib/plugins/service-betterportal-config-manager/index.d.ts +1 -1
  17. package/lib/plugins/service-betterportal-config-manager/index.d.ts.map +1 -1
  18. package/lib/plugins/service-betterportal-config-manager/index.js +3 -1
  19. package/lib/plugins/service-betterportal-config-manager/index.js.map +1 -1
  20. package/lib/plugins/service-betterportal-config-manager/syncApi.d.ts.map +1 -1
  21. package/lib/plugins/service-betterportal-config-manager/syncApi.js +62 -8
  22. package/lib/plugins/service-betterportal-config-manager/syncApi.js.map +1 -1
  23. package/lib/schemas/service-betterportal-config-manager.json +1 -1
  24. package/lib/schemas/service-betterportal-config-manager.plugin.json +1 -1
  25. package/package.json +3 -3
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Auto-generated BSB virtual client for service-betterportal-config-manager
3
3
  * DO NOT EDIT - Regenerated on every build
4
- * @version 10.1.57
4
+ * @version 10.1.59
5
5
  */
6
6
  import { ServiceClient, BSBService } from "@bsb/base";
7
7
  import type { Observable, BSBServiceClientDefinition, EventInputType } from "@bsb/base";
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Auto-generated BSB virtual client for service-betterportal-config-manager
3
3
  * DO NOT EDIT - Regenerated on every build
4
- * @version 10.1.57
4
+ * @version 10.1.59
5
5
  */
6
6
  import { ServiceClient, bsb, createBroadcastEvent, createEventSchemas } from "@bsb/base";
7
7
  const _platformConfigChangedSchema = bsb.object({
@@ -4,7 +4,7 @@
4
4
  "pluginId": "org.betterportal.config-manager",
5
5
  "title": "BetterPortal Config Manager",
6
6
  "description": "Admin-facing BetterPortal service for discovering and managing service config surfaces.",
7
- "version": "10.1.57",
7
+ "version": "10.1.59",
8
8
  "category": "service",
9
9
  "deploymentModes": [
10
10
  "self-hosted"
@@ -1251,6 +1251,12 @@
1251
1251
  "kind": "string"
1252
1252
  }
1253
1253
  },
1254
+ "openApiServiceId": {
1255
+ "kind": "optional",
1256
+ "inner": {
1257
+ "kind": "string"
1258
+ }
1259
+ },
1254
1260
  "routes": {
1255
1261
  "kind": "array",
1256
1262
  "items": {
@@ -28,7 +28,7 @@ declare function automationServiceCatalog(config: BetterPortalConfig, appDef: Be
28
28
  title: string;
29
29
  description: string;
30
30
  scope: "tenant" | "app";
31
- visibility: "public" | "protected" | "secret";
31
+ visibility: "secret" | "public" | "protected";
32
32
  ownership: "bp" | "plugin" | "mixed";
33
33
  sourceOfTruth: "bp" | "plugin" | "external";
34
34
  required: boolean;
@@ -118,7 +118,7 @@ declare function automationServiceCatalog(config: BetterPortalConfig, appDef: Be
118
118
  title: string;
119
119
  description: string;
120
120
  scope: "tenant" | "app";
121
- visibility: "public" | "protected" | "secret";
121
+ visibility: "secret" | "public" | "protected";
122
122
  ownership: "bp" | "plugin" | "mixed";
123
123
  sourceOfTruth: "bp" | "plugin" | "external";
124
124
  required: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"adminApi.d.ts","sourceRoot":"","sources":["../../../src/plugins/service-betterportal-config-manager/adminApi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EAEjB,mBAAmB,EACnB,SAAS,EACV,MAAM,yBAAyB,CAAC;AAYjC,OAAO,KAAK,EAAuE,kBAAkB,EAAE,eAAe,EAA0C,MAAM,yBAAyB,CAAC;AAChM,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAoQzD,iBAAS,wBAAwB,CAAC,MAAM,EAAE,kBAAkB,EAAE,MAAM,EAAE,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiEpF;AAGD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,UAAU,CAAC,OAAO,wBAAwB,CAAC,GAAG,MAAM,CA2CpG;AA0TD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG;IACvG,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiEpF;AAGD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,UAAU,CAAC,OAAO,wBAAwB,CAAC,GAAG,MAAM,CA2CpG;AA0TD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG;IACvG,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;CACzB,CAwEA;AAiPD,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,iBAAiB,EACtB,KAAK,EAAE,mBAAmB,EAC1B,OAAO,EAAE,gBAAgB,GACxB,IAAI,CA0/CN;AA8VD,wBAAgB,uBAAuB,CAAC,CAAC,EAAE;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAClD,GAAG,MAAM,CA0aT"}
@@ -90,6 +90,9 @@ function requiredRouteString(body, key, label) {
90
90
  return { error: `${label} is required.` };
91
91
  return { value };
92
92
  }
93
+ function routesReloadPath(appId, apiServiceId) {
94
+ return `/routes?appId=${encodeURIComponent(appId)}${apiServiceId ? `&apiServiceId=${encodeURIComponent(apiServiceId)}` : ""}`;
95
+ }
93
96
  function routeParamNames(path) {
94
97
  return [...new Set(path.split("/").flatMap((segment) => {
95
98
  const match = segment.match(/^:([A-Za-z_][A-Za-z0-9_]*)$/);
@@ -1898,6 +1901,8 @@ export function registerAdminApiRoutes(app, store, cpState) {
1898
1901
  const parsed = parseRouteCreateBody(body);
1899
1902
  if (parsed.error || !parsed.route)
1900
1903
  return validationError(event, parsed.error ?? "Invalid route.");
1904
+ if (parsed.route.kind === "api")
1905
+ return validationError(event, "Service/API routes are created by service manifest sync.");
1901
1906
  const serviceError = validateRegisteredRouteService(config, appDef, parsed.route.serviceId);
1902
1907
  if (serviceError)
1903
1908
  return validationError(event, serviceError);
@@ -1909,7 +1914,7 @@ export function registerAdminApiRoutes(app, store, cpState) {
1909
1914
  addRouteDependencies(appDef, route);
1910
1915
  await store.saveConfig(config);
1911
1916
  if (wantsHtmx(event))
1912
- return htmxReload(`/routes?appId=${encodeURIComponent(appId)}`);
1917
+ return htmxReload(routesReloadPath(appId));
1913
1918
  return jsonResponse({ ok: true, id: route.id }, 201);
1914
1919
  });
1915
1920
  app.put(`${API_BASE}/apps/:appId/routes/:routeId`, async (event) => {
@@ -1925,6 +1930,9 @@ export function registerAdminApiRoutes(app, store, cpState) {
1925
1930
  const route = appDef.routes.find((r) => r.id === routeId);
1926
1931
  if (!route)
1927
1932
  return wantsHtmx(event) ? htmxError("Route not found", 404) : jsonResponse({ error: "Route not found" }, 404);
1933
+ if (route.kind === "api" && Object.keys(body).some((key) => key !== "enabled")) {
1934
+ return validationError(event, "Service/API route identity and metadata are managed by service manifest sync.");
1935
+ }
1928
1936
  if (body.path !== undefined) {
1929
1937
  const path = trimmedString(body, "path");
1930
1938
  if (!path)
@@ -2024,7 +2032,7 @@ export function registerAdminApiRoutes(app, store, cpState) {
2024
2032
  }
2025
2033
  await store.saveConfig(config);
2026
2034
  if (wantsHtmx(event))
2027
- return htmxReload(`/routes?appId=${encodeURIComponent(appId)}`);
2035
+ return htmxReload(routesReloadPath(appId, route.kind === "api" ? route.serviceId : undefined));
2028
2036
  return jsonResponse({ ok: true });
2029
2037
  });
2030
2038
  app.delete(`${API_BASE}/apps/:appId/routes/:routeId`, async (event) => {
@@ -2039,6 +2047,10 @@ export function registerAdminApiRoutes(app, store, cpState) {
2039
2047
  const route = appDef.routes.find((r) => r.id === routeId);
2040
2048
  if (!route)
2041
2049
  return wantsHtmx(event) ? htmxAlert("Route not found.") : jsonResponse({ error: "Route not found" }, 404);
2050
+ if (route.kind === "api") {
2051
+ const message = "Service/API routes are managed by service manifest sync and cannot be deleted manually.";
2052
+ return wantsHtmx(event) ? htmxAlert(message, "warning") : jsonResponse({ error: message }, 409);
2053
+ }
2042
2054
  const menuReferenceCount = countMenuRouteReferences(appDef.menu, routeId);
2043
2055
  if (menuReferenceCount > 0) {
2044
2056
  const message = `Cannot delete route "${route.title ?? route.path}" because ${menuReferenceCount} menu item${menuReferenceCount === 1 ? "" : "s"} reference it. Remove the menu reference first.`;
@@ -2162,6 +2174,7 @@ export function registerAdminApiRoutes(app, store, cpState) {
2162
2174
  let capabilities = [];
2163
2175
  let serviceRoutes = [];
2164
2176
  let viewMeta = new Map();
2177
+ let dependencyViewIds = new Set();
2165
2178
  const schemaText = typeof body.schema === "string" ? body.schema : "";
2166
2179
  if (schemaText) {
2167
2180
  try {
@@ -2169,7 +2182,11 @@ export function registerAdminApiRoutes(app, store, cpState) {
2169
2182
  serviceId = schema.manifest?.pluginId;
2170
2183
  capabilities = Array.isArray(schema.manifest?.capabilities) ? schema.manifest.capabilities.filter((value) => typeof value === "string") : [];
2171
2184
  serviceRoutes = schema.routes ?? [];
2172
- viewMeta = new Map((schema.manifest?.views ?? []).map((v) => [v.viewId, {
2185
+ const manifestViews = schema.manifest?.views ?? [];
2186
+ dependencyViewIds = new Set(manifestViews.flatMap((view) => Array.isArray(view.dependencies)
2187
+ ? view.dependencies.filter((value) => typeof value === "string")
2188
+ : []));
2189
+ viewMeta = new Map(manifestViews.map((v) => [v.viewId, {
2173
2190
  title: v.title,
2174
2191
  renderable: v.renderable !== false,
2175
2192
  pageRenderable: hasPageRenderer(v),
@@ -2223,7 +2240,7 @@ export function registerAdminApiRoutes(app, store, cpState) {
2223
2240
  viewId: r.viewId,
2224
2241
  targetPath: r.path,
2225
2242
  title: routeTitle,
2226
- enabled: true,
2243
+ enabled: renderable || dependencyViewIds.has(r.viewId),
2227
2244
  methods: routeMethodsFromManifest(r.methods)
2228
2245
  });
2229
2246
  existingPaths.add(mountPath);