@cobaltcore-dev/aurora 0.6.0 → 0.8.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.
Files changed (102) hide show
  1. package/README.md +160 -20
  2. package/dist/client/AuroraApp.d.ts +38 -0
  3. package/dist/client/{ContentHeader-kx1Th5Sq.mjs → ContentHeader-DqsGNvtD.mjs} +17 -17
  4. package/dist/client/{ContentHeader-kx1Th5Sq.mjs.map → ContentHeader-DqsGNvtD.mjs.map} +1 -1
  5. package/dist/client/{DeleteFlavorModal-C3cb7YiJ.mjs → DeleteFlavorModal-C3m7bQJu.mjs} +163 -163
  6. package/dist/client/{DeleteFlavorModal-C3cb7YiJ.mjs.map → DeleteFlavorModal-C3m7bQJu.mjs.map} +1 -1
  7. package/dist/client/{EditSecurityGroupModal-CpP54WIK.mjs → EditSecurityGroupModal-DKusxfta.mjs} +18 -18
  8. package/dist/client/{EditSecurityGroupModal-CpP54WIK.mjs.map → EditSecurityGroupModal-DKusxfta.mjs.map} +1 -1
  9. package/dist/client/{FiltersInput-DxcyR6Bp.mjs → FiltersInput-GzR4D0q6.mjs} +21 -21
  10. package/dist/client/{FiltersInput-DxcyR6Bp.mjs.map → FiltersInput-GzR4D0q6.mjs.map} +1 -1
  11. package/dist/client/{FloatingIpActionModals-BP8RWHbu.mjs → FloatingIpActionModals-CRvROJ3H.mjs} +51 -51
  12. package/dist/client/{FloatingIpActionModals-BP8RWHbu.mjs.map → FloatingIpActionModals-CRvROJ3H.mjs.map} +1 -1
  13. package/dist/client/{ImageToastNotifications-TZ3EfQg-.mjs → ImageToastNotifications-BuDXpTkl.mjs} +344 -344
  14. package/dist/client/{ImageToastNotifications-TZ3EfQg-.mjs.map → ImageToastNotifications-BuDXpTkl.mjs.map} +1 -1
  15. package/dist/client/{RouteError-QSV7qOoJ.mjs → RouteError-DVAiT0mT.mjs} +2 -2
  16. package/dist/client/{RouteError-QSV7qOoJ.mjs.map → RouteError-DVAiT0mT.mjs.map} +1 -1
  17. package/dist/client/{SortInput-CYv2_Pur.mjs → SortInput-VK7IYqQv.mjs} +6 -6
  18. package/dist/client/{SortInput-CYv2_Pur.mjs.map → SortInput-VK7IYqQv.mjs.map} +1 -1
  19. package/dist/client/_auth-DXJkv9QO.mjs.map +1 -1
  20. package/dist/client/{_flavorId-C2x43-6S.mjs → _flavorId-B9Vqkraj.mjs} +8 -8
  21. package/dist/client/{_flavorId-C2x43-6S.mjs.map → _flavorId-B9Vqkraj.mjs.map} +1 -1
  22. package/dist/client/{_flavorId-CR8ZUI-P.mjs → _flavorId-CFpNGz52.mjs} +62 -62
  23. package/dist/client/{_flavorId-CR8ZUI-P.mjs.map → _flavorId-CFpNGz52.mjs.map} +1 -1
  24. package/dist/client/{_floatingIpId-BCk41_Lb.mjs → _floatingIpId-B5GMSLeQ.mjs} +2 -2
  25. package/dist/client/{_floatingIpId-BCk41_Lb.mjs.map → _floatingIpId-B5GMSLeQ.mjs.map} +1 -1
  26. package/dist/client/{_floatingIpId-BGrOAmPT.mjs → _floatingIpId-C2-BeRmF.mjs} +27 -27
  27. package/dist/client/{_floatingIpId-BGrOAmPT.mjs.map → _floatingIpId-C2-BeRmF.mjs.map} +1 -1
  28. package/dist/client/_imageId-9NZytfNs.mjs +534 -0
  29. package/dist/client/{_imageId-CvfD832b.mjs.map → _imageId-9NZytfNs.mjs.map} +1 -1
  30. package/dist/client/_pcaId-BwTvJJgh.mjs +479 -0
  31. package/dist/client/_pcaId-BwTvJJgh.mjs.map +1 -0
  32. package/dist/client/{_pcaId-DOHycvCf.mjs → _pcaId-DUHQd0rB.mjs} +2 -2
  33. package/dist/client/{_pcaId-DOHycvCf.mjs.map → _pcaId-DUHQd0rB.mjs.map} +1 -1
  34. package/dist/client/{_projectId-DOgwFiqD.mjs → _projectId-B_2sZKk-.mjs} +2 -2
  35. package/dist/client/{_projectId-DOgwFiqD.mjs.map → _projectId-B_2sZKk-.mjs.map} +1 -1
  36. package/dist/client/{_projectId-MxcHrXW4.mjs → _projectId-CLgClx24.mjs} +3 -3
  37. package/dist/client/{_projectId-MxcHrXW4.mjs.map → _projectId-CLgClx24.mjs.map} +1 -1
  38. package/dist/client/_projectId-cW9aQ4Ag.mjs +271 -0
  39. package/dist/client/_projectId-cW9aQ4Ag.mjs.map +1 -0
  40. package/dist/client/{_securityGroupId-KKw4RPdH.mjs → _securityGroupId-DYxmXUOP.mjs} +319 -319
  41. package/dist/client/{_securityGroupId-KKw4RPdH.mjs.map → _securityGroupId-DYxmXUOP.mjs.map} +1 -1
  42. package/dist/client/{_securityGroupId-CJJanWiY.mjs → _securityGroupId-fhK1CuZh.mjs} +2 -2
  43. package/dist/client/{_securityGroupId-CJJanWiY.mjs.map → _securityGroupId-fhK1CuZh.mjs.map} +1 -1
  44. package/dist/client/{_storageType-DYjo-6ej.mjs → _storageType-2_fau4B5.mjs} +698 -698
  45. package/dist/client/{_storageType-DYjo-6ej.mjs.map → _storageType-2_fau4B5.mjs.map} +1 -1
  46. package/dist/client/{_storageType-4wSxI__0.mjs → _storageType-dRTFMKG3.mjs} +2 -2
  47. package/dist/client/{_storageType-4wSxI__0.mjs.map → _storageType-dRTFMKG3.mjs.map} +1 -1
  48. package/dist/client/{about-Bo9vxGHy.mjs → about-Nsxkyh9U.mjs} +2 -2
  49. package/dist/client/{about-Bo9vxGHy.mjs.map → about-Nsxkyh9U.mjs.map} +1 -1
  50. package/dist/client/{build-DeJcDjPi.mjs → build-BdRRmNf5.mjs} +3290 -3274
  51. package/dist/client/{build-DeJcDjPi.mjs.map → build-BdRRmNf5.mjs.map} +1 -1
  52. package/dist/client/{constants-BmcGYeR-.mjs → constants-J5nm9hbP.mjs} +15 -15
  53. package/dist/client/{constants-BmcGYeR-.mjs.map → constants-J5nm9hbP.mjs.map} +1 -1
  54. package/dist/client/{flavors-BxFVqgnb.mjs → flavors-_P7R-CeT.mjs} +2 -2
  55. package/dist/client/{flavors-BxFVqgnb.mjs.map → flavors-_P7R-CeT.mjs.map} +1 -1
  56. package/dist/client/{flavors-CfdgjsZY.mjs → flavors-m1qDHzeS.mjs} +238 -221
  57. package/dist/client/flavors-m1qDHzeS.mjs.map +1 -0
  58. package/dist/client/{floatingips-ByRb82wS.mjs → floatingips-Dq4DXQYb.mjs} +90 -90
  59. package/dist/client/{floatingips-ByRb82wS.mjs.map → floatingips-Dq4DXQYb.mjs.map} +1 -1
  60. package/dist/client/{images-CenluYV8.mjs → images-CpM-T_jM.mjs} +2 -2
  61. package/dist/client/{images-CenluYV8.mjs.map → images-CpM-T_jM.mjs.map} +1 -1
  62. package/dist/client/images-DHmVgQAh2.mjs +1890 -0
  63. package/dist/client/images-DHmVgQAh2.mjs.map +1 -0
  64. package/dist/client/{images-C_dX7nY6.mjs → images-Dbjo4yKn.mjs} +2 -2
  65. package/dist/client/{images-C_dX7nY6.mjs.map → images-Dbjo4yKn.mjs.map} +1 -1
  66. package/dist/client/index.d.ts +1 -1
  67. package/dist/client/index.js +390 -356
  68. package/dist/client/index.js.map +1 -1
  69. package/dist/client/{objects-gxSjvbvF.mjs → objects-DKWp9RtR.mjs} +2 -2
  70. package/dist/client/{objects-gxSjvbvF.mjs.map → objects-DKWp9RtR.mjs.map} +1 -1
  71. package/dist/client/{objects-BJM6YeuF.mjs → objects-DaCuy_CB.mjs} +1156 -1156
  72. package/dist/client/{objects-BJM6YeuF.mjs.map → objects-DaCuy_CB.mjs.map} +1 -1
  73. package/dist/client/{pca-Bl8NmoVZ.mjs → pca-C8zWTSSt.mjs} +2 -2
  74. package/dist/client/{pca-Bl8NmoVZ.mjs.map → pca-C8zWTSSt.mjs.map} +1 -1
  75. package/dist/client/pca-CK5-j7Kk.mjs +202 -0
  76. package/dist/client/pca-CK5-j7Kk.mjs.map +1 -0
  77. package/dist/client/{projects-pe2_dCnV.mjs → projects-CHYn7L5e.mjs} +2 -2
  78. package/dist/client/{projects-pe2_dCnV.mjs.map → projects-CHYn7L5e.mjs.map} +1 -1
  79. package/dist/client/{projects-D2iewAzu.mjs → projects-CeLhtLvf.mjs} +2 -2
  80. package/dist/client/{projects-D2iewAzu.mjs.map → projects-CeLhtLvf.mjs.map} +1 -1
  81. package/dist/client/{projects-CgclWI16.mjs → projects-ClViaUuv.mjs} +11 -11
  82. package/dist/client/{projects-CgclWI16.mjs.map → projects-ClViaUuv.mjs.map} +1 -1
  83. package/dist/client/{_projectId-BDSWnMGj.mjs → routeInfo-DlDJZnpg.mjs} +34 -8
  84. package/dist/client/routeInfo-DlDJZnpg.mjs.map +1 -0
  85. package/dist/client/{securitygroups-DahZkVYQ.mjs → securitygroups-CNFLu9zS.mjs} +112 -112
  86. package/dist/client/{securitygroups-DahZkVYQ.mjs.map → securitygroups-CNFLu9zS.mjs.map} +1 -1
  87. package/dist/client/{useListWithFiltering-DaYcu5AB.mjs → useListWithFiltering-v2A0-SZb.mjs} +9 -9
  88. package/dist/client/{useListWithFiltering-DaYcu5AB.mjs.map → useListWithFiltering-v2A0-SZb.mjs.map} +1 -1
  89. package/dist/server/index.d.ts +576 -2
  90. package/dist/server/index.js +59 -217
  91. package/package.json +4 -5
  92. package/dist/client/_imageId-CvfD832b.mjs +0 -534
  93. package/dist/client/_pcaId-BxBt5DXi.mjs +0 -459
  94. package/dist/client/_pcaId-BxBt5DXi.mjs.map +0 -1
  95. package/dist/client/_projectId-BDSWnMGj.mjs.map +0 -1
  96. package/dist/client/_projectId-DS4nR59B.mjs +0 -299
  97. package/dist/client/_projectId-DS4nR59B.mjs.map +0 -1
  98. package/dist/client/flavors-CfdgjsZY.mjs.map +0 -1
  99. package/dist/client/images-CKqIXUq52.mjs +0 -1873
  100. package/dist/client/images-CKqIXUq52.mjs.map +0 -1
  101. package/dist/client/pca-RSiWpJs9.mjs +0 -182
  102. package/dist/client/pca-RSiWpJs9.mjs.map +0 -1
@@ -27669,7 +27669,14 @@ var require_esm2 = __commonJS({
27669
27669
  // src/server/index.ts
27670
27670
  var server_exports = {};
27671
27671
  __export(server_exports, {
27672
- createServer: () => createServer
27672
+ auroraRouter: () => auroraRouter,
27673
+ createServer: () => createServer,
27674
+ domainScopedInputSchema: () => domainScopedInputSchema,
27675
+ domainScopedProcedure: () => domainScopedProcedure,
27676
+ projectScopedInputSchema: () => projectScopedInputSchema,
27677
+ projectScopedProcedure: () => projectScopedProcedure,
27678
+ protectedProcedure: () => protectedProcedure,
27679
+ publicProcedure: () => publicProcedure
27673
27680
  });
27674
27681
  module.exports = __toCommonJS(server_exports);
27675
27682
 
@@ -36819,18 +36826,31 @@ var CertificateAuthoritySchema = import_zod24.z.object({
36819
36826
  /** Current operational state of Certificate Authority. */
36820
36827
  state: CertificateAuthorityStateSchema
36821
36828
  });
36829
+ var LinkSchema = import_zod24.z.object({
36830
+ href: import_zod24.z.string(),
36831
+ rel: import_zod24.z.string()
36832
+ });
36822
36833
  var CertificateAuthoritiesListSchema = import_zod24.z.object({
36823
- certificate_authorities: import_zod24.z.array(CertificateAuthoritySchema)
36834
+ certificate_authorities: import_zod24.z.array(CertificateAuthoritySchema),
36835
+ links: import_zod24.z.array(LinkSchema),
36836
+ next_page_marker: import_zod24.z.string().optional()
36837
+ });
36838
+ var CertificateAuthoritiesListInputSchema = projectScopedInputSchema.extend({
36839
+ limit: import_zod24.z.number().int().min(1).max(1e3).optional(),
36840
+ next_page_marker: import_zod24.z.string().trim().min(1).optional()
36824
36841
  });
36825
36842
  var CertificateAuthorityCreateSchema = import_zod24.z.object({
36826
36843
  configuration: import_zod24.z.object({
36827
36844
  subject: CertificateAuthoritySubjectSchema
36828
36845
  })
36829
36846
  });
36830
- var CertificateAuthorityIdInputSchema = import_zod24.z.object({
36831
- project_id: import_zod24.z.string(),
36847
+ var CertificateAuthorityIdInputSchema = projectScopedInputSchema.extend({
36832
36848
  certificate_authority_id: import_zod24.z.string().min(1)
36833
36849
  });
36850
+ var CertificateAuthorityCertificatesListInputSchema = CertificateAuthorityIdInputSchema.extend({
36851
+ limit: import_zod24.z.number().int().min(1).max(1e3).optional(),
36852
+ next_page_marker: import_zod24.z.string().trim().min(1).optional()
36853
+ });
36834
36854
  var CertificateAuthorityImportInputSchema = CertificateAuthorityIdInputSchema.extend({
36835
36855
  imported_certificate_chain: import_zod24.z.string().min(1)
36836
36856
  });
@@ -36840,8 +36860,7 @@ var CertificateIdInputSchema = CertificateAuthorityIdInputSchema.extend({
36840
36860
  var CertificateConfigurationSchema = import_zod24.z.object({
36841
36861
  validity: CertificateValiditySchema
36842
36862
  });
36843
- var CreateCertificateInputSchema = import_zod24.z.object({
36844
- project_id: import_zod24.z.string(),
36863
+ var CreateCertificateInputSchema = projectScopedInputSchema.extend({
36845
36864
  certificate_authority_id: import_zod24.z.string().min(1),
36846
36865
  csr: import_zod24.z.string().min(1),
36847
36866
  configuration: CertificateConfigurationSchema
@@ -36856,19 +36875,26 @@ var CertificateSchema = import_zod24.z.object({
36856
36875
  project_id: import_zod24.z.string()
36857
36876
  });
36858
36877
  var CertificatesListSchema = import_zod24.z.object({
36859
- certificates: import_zod24.z.array(CertificateSchema)
36878
+ certificates: import_zod24.z.array(CertificateSchema),
36879
+ links: import_zod24.z.array(LinkSchema),
36880
+ next_page_marker: import_zod24.z.string().optional()
36860
36881
  });
36861
36882
 
36862
36883
  // src/server/Services/routers/pcaRouter.ts
36863
36884
  var PCA_BASE_URL = "certificate-authorities";
36864
36885
  var pcaRouter = {
36865
- list: projectScopedProcedure.query(async ({ ctx }) => {
36886
+ list: projectScopedProcedure.input(CertificateAuthoritiesListInputSchema).query(async ({ input, ctx }) => {
36866
36887
  return withErrorHandling3(async () => {
36867
36888
  const pca = ctx.openstack?.service("pca");
36868
36889
  validateOpenstackService(pca, "pca");
36869
- const response = await pca.get(PCA_BASE_URL);
36890
+ const queryParams = new URLSearchParams();
36891
+ if (input.limit !== void 0) queryParams.set("limit", String(input.limit));
36892
+ if (input.next_page_marker !== void 0) queryParams.set("next_page_marker", input.next_page_marker);
36893
+ const queryString = queryParams.toString();
36894
+ const url = queryString ? `${PCA_BASE_URL}?${queryString}` : PCA_BASE_URL;
36895
+ const response = await pca.get(url);
36870
36896
  const data = await response.json();
36871
- return parseOrThrow(CertificateAuthoritiesListSchema, data, "pcaRouter.list").certificate_authorities;
36897
+ return parseOrThrow(CertificateAuthoritiesListSchema, data, "pcaRouter.list");
36872
36898
  }, "list certificate authorities");
36873
36899
  }),
36874
36900
  /**
@@ -36921,14 +36947,19 @@ var pcaRouter = {
36921
36947
  return parseOrThrow(CertificateAuthoritySchema, data, "pcaRouter.import");
36922
36948
  }, "import certificate of certificate authority");
36923
36949
  }),
36924
- listCertificates: projectScopedProcedure.input(CertificateAuthorityIdInputSchema).query(async ({ input, ctx }) => {
36950
+ listCertificates: projectScopedProcedure.input(CertificateAuthorityCertificatesListInputSchema).query(async ({ input, ctx }) => {
36925
36951
  return withErrorHandling3(async () => {
36926
36952
  const pca = ctx.openstack?.service("pca");
36927
36953
  validateOpenstackService(pca, "pca");
36928
- const url = `${PCA_BASE_URL}/${input.certificate_authority_id}/certificates`;
36954
+ const queryParams = new URLSearchParams();
36955
+ if (input.limit !== void 0) queryParams.set("limit", String(input.limit));
36956
+ if (input.next_page_marker !== void 0) queryParams.set("next_page_marker", input.next_page_marker);
36957
+ const queryString = queryParams.toString();
36958
+ const baseUrl = `${PCA_BASE_URL}/${input.certificate_authority_id}/certificates`;
36959
+ const url = queryString ? `${baseUrl}?${queryString}` : baseUrl;
36929
36960
  const response = await pca.get(url);
36930
36961
  const data = await response.json();
36931
- return parseOrThrow(CertificatesListSchema, data, "pcaRouter.listCertificates").certificates;
36962
+ return parseOrThrow(CertificatesListSchema, data, "pcaRouter.listCertificates");
36932
36963
  }, "list certificates for certificate authority");
36933
36964
  }),
36934
36965
  createCertificate: projectScopedProcedure.input(CreateCertificateInputSchema).mutation(async ({ input, ctx }) => {
@@ -36961,7 +36992,11 @@ var serviceRouters = {
36961
36992
  };
36962
36993
 
36963
36994
  // src/server/routers.ts
36964
- var buildAppRouter = /* @__PURE__ */ __name((policyDir) => mergeRouters(auroraRouter(authRouters), auroraRouter(buildComputeRouters(policyDir)), auroraRouter(buildObjectStorageRouters(policyDir)), auroraRouter(projectRouters), auroraRouter(buildNetworkRouters(policyDir)), auroraRouter(serviceRouters)), "buildAppRouter");
36995
+ var buildBaseRouter = /* @__PURE__ */ __name((policyDir) => mergeRouters(auroraRouter(authRouters), auroraRouter(buildComputeRouters(policyDir)), auroraRouter(buildObjectStorageRouters(policyDir)), auroraRouter(projectRouters), auroraRouter(buildNetworkRouters(policyDir)), auroraRouter(serviceRouters)), "buildBaseRouter");
36996
+ var buildAppRouter = /* @__PURE__ */ __name((policyDir, extraRouters = []) => {
36997
+ if (extraRouters.length === 0) return buildBaseRouter(policyDir);
36998
+ return mergeRouters(buildBaseRouter(policyDir), ...extraRouters);
36999
+ }, "buildAppRouter");
36965
37000
 
36966
37001
  // src/server/context.ts
36967
37002
  var import_signal_openstack2 = __toESM(require_esm2());
@@ -37256,6 +37291,7 @@ async function createContext(opts, config) {
37256
37291
  }, "terminateSession");
37257
37292
  return {
37258
37293
  req: opts.req,
37294
+ res: opts.res,
37259
37295
  signal: abortController.signal,
37260
37296
  identityEndpoint: normalizedEndpoint,
37261
37297
  cephRegion: config.cephRegion,
@@ -37342,195 +37378,7 @@ var csrfProtection_default = (0, import_fastify_plugin.default)(csrfPlugin, {
37342
37378
  fastify: "5.x"
37343
37379
  });
37344
37380
 
37345
- // src/server/aurora-fastify-plugins/httpMetricsCollector.ts
37346
- var import_fastify_plugin2 = __toESM(require("fastify-plugin"));
37347
- var import_prom_client = require("prom-client");
37348
- var LABEL_NAMES = [
37349
- "status_code",
37350
- "method",
37351
- "route",
37352
- "endpoint_type",
37353
- "project_id"
37354
- ];
37355
- var EXCLUDE_PATHS = [
37356
- "/metrics"
37357
- ];
37358
- async function httpMetricsCollectorPlugin(fastify, options) {
37359
- const prefix = options.prefix || "aurora";
37360
- const excludePaths = options.excludePaths || EXCLUDE_PATHS;
37361
- const registry = options.registry || new import_prom_client.Registry();
37362
- const bffEndpoint = options.bffEndpoint || "/polaris-bff";
37363
- const requestsTotal = new import_prom_client.Counter({
37364
- name: `${prefix}_requests_total`,
37365
- help: "The total number of HTTP requests handled by the application",
37366
- labelNames: LABEL_NAMES,
37367
- registers: [
37368
- registry
37369
- ]
37370
- });
37371
- const requestDurationSeconds = new import_prom_client.Histogram({
37372
- name: `${prefix}_request_duration_seconds`,
37373
- help: "The HTTP response duration of the application",
37374
- labelNames: LABEL_NAMES,
37375
- registers: [
37376
- registry
37377
- ]
37378
- });
37379
- const exceptionsTotal = new import_prom_client.Counter({
37380
- name: `${prefix}_exceptions_total`,
37381
- help: "The total number of exceptions raised by the application",
37382
- labelNames: [
37383
- "exception"
37384
- ],
37385
- registers: [
37386
- registry
37387
- ]
37388
- });
37389
- fastify.addHook("onRequest", async (request) => {
37390
- request.metricsStartTime = process.hrtime.bigint();
37391
- });
37392
- fastify.addHook("onResponse", async (request, reply) => {
37393
- const path3 = request.url.split("?")[0];
37394
- if (excludePaths.some((excludePath) => path3.startsWith(excludePath))) {
37395
- return;
37396
- }
37397
- if (!request.metricsStartTime) {
37398
- fastify.log.debug({
37399
- url: request.url
37400
- }, "Metrics start time missing, skipping metric collection");
37401
- return;
37402
- }
37403
- const endTime = process.hrtime.bigint();
37404
- const duration = Number(endTime - request.metricsStartTime) / 1e9;
37405
- const labels = extractLabels(request, reply, bffEndpoint);
37406
- try {
37407
- requestsTotal.inc(labels);
37408
- requestDurationSeconds.observe(labels, duration);
37409
- } catch (error) {
37410
- fastify.log.error({
37411
- err: error
37412
- }, "Failed to record HTTP metrics");
37413
- }
37414
- });
37415
- fastify.addHook("onError", async (_request, _reply, error) => {
37416
- try {
37417
- exceptionsTotal.inc({
37418
- exception: error.constructor.name
37419
- });
37420
- } catch (err) {
37421
- fastify.log.error({
37422
- err
37423
- }, "Failed to record exception metric");
37424
- }
37425
- });
37426
- fastify.decorate("metricsRegistry", registry);
37427
- }
37428
- __name(httpMetricsCollectorPlugin, "httpMetricsCollectorPlugin");
37429
- function extractLabels(request, reply, bffEndpoint) {
37430
- const urlPath = request.url.split("?")[0];
37431
- let endpointType;
37432
- let route = urlPath;
37433
- let projectId = "";
37434
- if (urlPath.includes(bffEndpoint)) {
37435
- endpointType = "trpc";
37436
- const procedurePath = urlPath.split(bffEndpoint + "/")[1];
37437
- if (procedurePath) {
37438
- const cleanPath = procedurePath.split("?")[0];
37439
- const parts = cleanPath.split(".");
37440
- if (parts.length >= 2) {
37441
- const service = parts[0];
37442
- const action = parts.slice(1).join(".");
37443
- route = `${service}/${action}`;
37444
- } else {
37445
- route = cleanPath;
37446
- }
37447
- }
37448
- const url = new URL(request.url, "http://localhost");
37449
- const inputParam = url.searchParams.get("input");
37450
- if (inputParam) {
37451
- try {
37452
- const input = JSON.parse(inputParam);
37453
- if (input.project_id) {
37454
- projectId = input.project_id;
37455
- } else if (typeof input === "object") {
37456
- const firstKey = Object.keys(input)[0];
37457
- if (firstKey && input[firstKey]?.project_id) {
37458
- projectId = input[firstKey].project_id;
37459
- }
37460
- }
37461
- } catch {
37462
- }
37463
- }
37464
- } else if (urlPath.startsWith("/api/")) {
37465
- endpointType = "api";
37466
- route = normalizeApiPath(urlPath);
37467
- } else if (urlPath.startsWith("/@")) {
37468
- endpointType = "vite-dev";
37469
- route = "vite-dev";
37470
- } else if (urlPath.match(/\.(js|jsx|ts|tsx|mjs|css|json|map)$/)) {
37471
- endpointType = "module";
37472
- const ext = urlPath.split(".").pop() || "unknown";
37473
- route = `*.${ext}`;
37474
- } else if (urlPath.match(/\.(png|jpg|jpeg|gif|svg|woff|woff2|ttf|eot|ico|webp)$/)) {
37475
- endpointType = "asset";
37476
- const ext = urlPath.split(".").pop() || "unknown";
37477
- route = `*.${ext}`;
37478
- } else if (urlPath === "/" || urlPath === "/index.html") {
37479
- endpointType = "spa";
37480
- route = "/";
37481
- } else {
37482
- endpointType = "spa";
37483
- route = normalizeSpaRoute(urlPath);
37484
- const projectMatch = urlPath.match(/^\/projects\/([^/?]+)/);
37485
- if (projectMatch) {
37486
- projectId = projectMatch[1];
37487
- }
37488
- }
37489
- return {
37490
- status_code: reply.statusCode.toString(),
37491
- method: request.method.toLowerCase(),
37492
- route,
37493
- endpoint_type: endpointType,
37494
- project_id: projectId
37495
- };
37496
- }
37497
- __name(extractLabels, "extractLabels");
37498
- function normalizeSpaRoute(path3) {
37499
- const segments = path3.split("/").filter(Boolean);
37500
- if (segments[0] === "projects" && segments.length >= 3) {
37501
- const service = segments[2];
37502
- return `/projects/:id/${service}`;
37503
- }
37504
- if (segments[0] === "accounts" && segments.length >= 2) {
37505
- return "/accounts/:id";
37506
- }
37507
- return "/" + segments.map((segment) => {
37508
- if (segment.match(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i)) {
37509
- return ":id";
37510
- }
37511
- if (segment.match(/^[a-zA-Z0-9_-]{20,}$/)) {
37512
- return ":id";
37513
- }
37514
- return segment;
37515
- }).join("/");
37516
- }
37517
- __name(normalizeSpaRoute, "normalizeSpaRoute");
37518
- function normalizeApiPath(path3) {
37519
- return path3.split("/").map((segment) => {
37520
- if (segment.match(/^\d+$/) || segment.match(/^[0-9a-f-]{36}$/i)) {
37521
- return ":id";
37522
- }
37523
- return segment;
37524
- }).join("/");
37525
- }
37526
- __name(normalizeApiPath, "normalizeApiPath");
37527
- var AuroraHttpMetricsCollector = (0, import_fastify_plugin2.default)(httpMetricsCollectorPlugin, {
37528
- name: "aurora-http-metrics-collector",
37529
- fastify: "5.x"
37530
- });
37531
-
37532
37381
  // src/server/server.ts
37533
- var import_prom_client2 = require("prom-client");
37534
37382
  async function createServer(config) {
37535
37383
  const isProduction = process.env.NODE_ENV === "production";
37536
37384
  const rawBffEndpoint = config.bffEndpoint ?? "/polaris-bff";
@@ -37546,7 +37394,7 @@ async function createServer(config) {
37546
37394
  crossDomainCookie: config.crossDomainCookie,
37547
37395
  insecureCookies: config.insecureCookies
37548
37396
  };
37549
- const appRouter = buildAppRouter(config.policyDir);
37397
+ const appRouter = buildAppRouter(config.policyDir, config.routers ?? []);
37550
37398
  const server = (0, import_fastify.default)({
37551
37399
  logger: true,
37552
37400
  bodyLimit: 1 * 1024 * 1024,
@@ -37559,19 +37407,6 @@ async function createServer(config) {
37559
37407
  server.register(import_cookie2.default, {
37560
37408
  secret: void 0
37561
37409
  });
37562
- const metricsRegistry = new import_prom_client2.Registry();
37563
- await server.register(AuroraHttpMetricsCollector, {
37564
- prefix: "aurora",
37565
- excludePaths: [
37566
- "/metrics"
37567
- ],
37568
- registry: metricsRegistry,
37569
- bffEndpoint
37570
- });
37571
- server.get("/metrics", async (_request, reply) => {
37572
- reply.header("Content-Type", metricsRegistry.contentType);
37573
- return reply.send(await metricsRegistry.metrics());
37574
- });
37575
37410
  await server.register(import_rate_limit.default, {
37576
37411
  max: 200,
37577
37412
  timeWindow: "1 minute"
@@ -37731,7 +37566,14 @@ async function createServer(config) {
37731
37566
  __name(createServer, "createServer");
37732
37567
  // Annotate the CommonJS export names for ESM import in node:
37733
37568
  0 && (module.exports = {
37734
- createServer
37569
+ auroraRouter,
37570
+ createServer,
37571
+ domainScopedInputSchema,
37572
+ domainScopedProcedure,
37573
+ projectScopedInputSchema,
37574
+ projectScopedProcedure,
37575
+ protectedProcedure,
37576
+ publicProcedure
37735
37577
  });
37736
37578
  /*! Bundled license information:
37737
37579
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cobaltcore-dev/aurora",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "private": false,
5
5
  "description": "Aurora OpenStack dashboard — server and client library",
6
6
  "license": "Apache-2.0",
@@ -64,14 +64,13 @@
64
64
  "fastify-plugin": "^5.1.0",
65
65
  "focus-trap-react": "^12.0.0",
66
66
  "node-fetch": "^3.3.2",
67
- "prom-client": "^15.1.3",
68
67
  "react-error-boundary": "^6.1.0",
69
68
  "react-icons": "^5.6.0",
70
69
  "tailwind-merge": "^3.2.0",
71
70
  "zod": "^4.0.0"
72
71
  },
73
72
  "devDependencies": {
74
- "@cloudoperators/juno-ui-components": "8.1.0",
73
+ "@cloudoperators/juno-ui-components": "9.0.1",
75
74
  "@fastify/vite": "^8.4.1",
76
75
  "@lingui/cli": "^5.9.5",
77
76
  "@lingui/format-po": "^5.9.5",
@@ -110,8 +109,8 @@
110
109
  "vite-tsconfig-paths": "^6.1.1",
111
110
  "vitest": "^4.1.2",
112
111
  "@cobaltcore-dev/aurora-config": "0.0.1",
113
- "@cobaltcore-dev/policy-engine": "2.0.0",
114
- "@cobaltcore-dev/signal-openstack": "1.0.0"
112
+ "@cobaltcore-dev/signal-openstack": "1.0.0",
113
+ "@cobaltcore-dev/policy-engine": "2.0.0"
115
114
  },
116
115
  "scripts": {
117
116
  "build": "pnpm build:server && pnpm build:client",