@cobaltcore-dev/aurora 2.1.1 → 2.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.
Files changed (173) hide show
  1. package/README.md +31 -25
  2. package/dist/client/AuroraApp.d.ts +9 -2
  3. package/dist/client/context/AppConfigContext.d.ts +44 -0
  4. package/dist/client/index.d.ts +2 -0
  5. package/dist/client/index.js +41221 -845
  6. package/dist/client/index.js.map +1 -1
  7. package/dist/client/trpcClient.d.ts +314 -0
  8. package/dist/client/utils/appConfigGating.d.ts +21 -0
  9. package/dist/server/index.d.ts +694 -3
  10. package/dist/server/index.js +1748 -722
  11. package/package.json +3 -3
  12. package/dist/client/AuthProvider-CVSAwW9f.mjs +0 -83
  13. package/dist/client/AuthProvider-CVSAwW9f.mjs.map +0 -1
  14. package/dist/client/ContentHeader-fKKZVu-o.mjs +0 -116
  15. package/dist/client/ContentHeader-fKKZVu-o.mjs.map +0 -1
  16. package/dist/client/DeleteFlavorModal-C4nAi7gY.mjs +0 -724
  17. package/dist/client/DeleteFlavorModal-C4nAi7gY.mjs.map +0 -1
  18. package/dist/client/DynamicBreadcrumbContext-CVcUQFou.mjs +0 -26
  19. package/dist/client/DynamicBreadcrumbContext-CVcUQFou.mjs.map +0 -1
  20. package/dist/client/FiltersInput-Becwxo_J.mjs +0 -85
  21. package/dist/client/FiltersInput-Becwxo_J.mjs.map +0 -1
  22. package/dist/client/FloatingIpActionModals-Cq10WljB.mjs +0 -466
  23. package/dist/client/FloatingIpActionModals-Cq10WljB.mjs.map +0 -1
  24. package/dist/client/RouteIdLevelDefaultError-DPF_x2tG.mjs +0 -26
  25. package/dist/client/RouteIdLevelDefaultError-DPF_x2tG.mjs.map +0 -1
  26. package/dist/client/Slot-CWb612-_.mjs +0 -28
  27. package/dist/client/Slot-CWb612-_.mjs.map +0 -1
  28. package/dist/client/SortInput-4g7nSTHW.mjs +0 -34
  29. package/dist/client/SortInput-4g7nSTHW.mjs.map +0 -1
  30. package/dist/client/StorageNotFound-B-zVinVD.mjs +0 -30
  31. package/dist/client/StorageNotFound-B-zVinVD.mjs.map +0 -1
  32. package/dist/client/TwoColumnDescriptionList-DKS42RKa.mjs +0 -28
  33. package/dist/client/TwoColumnDescriptionList-DKS42RKa.mjs.map +0 -1
  34. package/dist/client/_-CAsCx-Ay.mjs +0 -6
  35. package/dist/client/_-CAsCx-Ay.mjs.map +0 -1
  36. package/dist/client/_auth-SrDjHL6j.mjs +0 -12
  37. package/dist/client/_auth-SrDjHL6j.mjs.map +0 -1
  38. package/dist/client/_flavorId-BPvssEzn.mjs +0 -277
  39. package/dist/client/_flavorId-BPvssEzn.mjs.map +0 -1
  40. package/dist/client/_flavorId-CFUBcU-l.mjs +0 -27
  41. package/dist/client/_flavorId-CFUBcU-l.mjs.map +0 -1
  42. package/dist/client/_flavorId-CZcIp0Ih.mjs +0 -22
  43. package/dist/client/_flavorId-CZcIp0Ih.mjs.map +0 -1
  44. package/dist/client/_floatingIpId-B8r64AL9.mjs +0 -196
  45. package/dist/client/_floatingIpId-B8r64AL9.mjs.map +0 -1
  46. package/dist/client/_floatingIpId-lEobpOER.mjs +0 -26
  47. package/dist/client/_floatingIpId-lEobpOER.mjs.map +0 -1
  48. package/dist/client/_imageId-BAezmV0Y.mjs +0 -526
  49. package/dist/client/_imageId-BAezmV0Y.mjs.map +0 -1
  50. package/dist/client/_imageId-D-jqz3e3.mjs +0 -40
  51. package/dist/client/_imageId-D-jqz3e3.mjs.map +0 -1
  52. package/dist/client/_imageId-gMdrdnVt.mjs +0 -22
  53. package/dist/client/_imageId-gMdrdnVt.mjs.map +0 -1
  54. package/dist/client/_projectId-BYccdAtX.mjs +0 -77
  55. package/dist/client/_projectId-BYccdAtX.mjs.map +0 -1
  56. package/dist/client/_projectId-CBjZC1tv.mjs +0 -283
  57. package/dist/client/_projectId-CBjZC1tv.mjs.map +0 -1
  58. package/dist/client/_projectId-CLEa1zgw.mjs +0 -30
  59. package/dist/client/_projectId-CLEa1zgw.mjs.map +0 -1
  60. package/dist/client/_projectId-D3VOH5lN.mjs +0 -94
  61. package/dist/client/_projectId-D3VOH5lN.mjs.map +0 -1
  62. package/dist/client/_securityGroupId-BwgZnoiR.mjs +0 -29
  63. package/dist/client/_securityGroupId-BwgZnoiR.mjs.map +0 -1
  64. package/dist/client/_securityGroupId-Cz2NUHdB.mjs +0 -1819
  65. package/dist/client/_securityGroupId-Cz2NUHdB.mjs.map +0 -1
  66. package/dist/client/_serviceType-DS8DxsrP.mjs +0 -20
  67. package/dist/client/_serviceType-DS8DxsrP.mjs.map +0 -1
  68. package/dist/client/_serviceType-M8d9rOT6.mjs +0 -6
  69. package/dist/client/_serviceType-M8d9rOT6.mjs.map +0 -1
  70. package/dist/client/_storageType-BNpP1A2N.mjs +0 -13
  71. package/dist/client/_storageType-BNpP1A2N.mjs.map +0 -1
  72. package/dist/client/_storageType-BxSGKhAI.mjs +0 -15
  73. package/dist/client/_storageType-BxSGKhAI.mjs.map +0 -1
  74. package/dist/client/_storageType-DZYCmiLt.mjs +0 -30
  75. package/dist/client/_storageType-DZYCmiLt.mjs.map +0 -1
  76. package/dist/client/_storageType-UqAMP-8d.mjs +0 -859
  77. package/dist/client/_storageType-UqAMP-8d.mjs.map +0 -1
  78. package/dist/client/_storageType-u51_7OwJ.mjs +0 -7
  79. package/dist/client/_storageType-u51_7OwJ.mjs.map +0 -1
  80. package/dist/client/about-BmQTyLWc.mjs +0 -92
  81. package/dist/client/about-BmQTyLWc.mjs.map +0 -1
  82. package/dist/client/assets/__mocks__/svgMock.d.ts +0 -3
  83. package/dist/client/aurora-CIml-f2f.mjs +0 -19
  84. package/dist/client/aurora-CIml-f2f.mjs.map +0 -1
  85. package/dist/client/build-WuxXRAqf.mjs +0 -14530
  86. package/dist/client/build-WuxXRAqf.mjs.map +0 -1
  87. package/dist/client/cn-DM4Cy3jv.mjs +0 -10
  88. package/dist/client/cn-DM4Cy3jv.mjs.map +0 -1
  89. package/dist/client/flavors-CJVSNz6R.mjs +0 -15
  90. package/dist/client/flavors-CJVSNz6R.mjs.map +0 -1
  91. package/dist/client/flavors-CflJDIEH.mjs +0 -667
  92. package/dist/client/flavors-CflJDIEH.mjs.map +0 -1
  93. package/dist/client/flavors-DWMZ6TuJ.mjs +0 -8
  94. package/dist/client/flavors-DWMZ6TuJ.mjs.map +0 -1
  95. package/dist/client/floatingips-Cz9k80cc.mjs +0 -8
  96. package/dist/client/floatingips-Cz9k80cc.mjs.map +0 -1
  97. package/dist/client/floatingips-DXnRlLvV.mjs +0 -551
  98. package/dist/client/floatingips-DXnRlLvV.mjs.map +0 -1
  99. package/dist/client/floatingips-HRbuLxiN.mjs +0 -22
  100. package/dist/client/floatingips-HRbuLxiN.mjs.map +0 -1
  101. package/dist/client/floatingips-nN1kQmsu.mjs +0 -14
  102. package/dist/client/floatingips-nN1kQmsu.mjs.map +0 -1
  103. package/dist/client/formatBytes-CZv_XyCY.mjs +0 -38
  104. package/dist/client/formatBytes-CZv_XyCY.mjs.map +0 -1
  105. package/dist/client/helpers-1PpYf-fC.mjs +0 -6
  106. package/dist/client/helpers-1PpYf-fC.mjs.map +0 -1
  107. package/dist/client/hooks-D0yKIumu.mjs +0 -22
  108. package/dist/client/hooks-D0yKIumu.mjs.map +0 -1
  109. package/dist/client/imageHelpers-DBhL2ebL.mjs +0 -1272
  110. package/dist/client/imageHelpers-DBhL2ebL.mjs.map +0 -1
  111. package/dist/client/images-BsylWUiH.mjs +0 -2011
  112. package/dist/client/images-BsylWUiH.mjs.map +0 -1
  113. package/dist/client/images-NBf2bV43.mjs +0 -8
  114. package/dist/client/images-NBf2bV43.mjs.map +0 -1
  115. package/dist/client/images-zQq1nSVv.mjs +0 -15
  116. package/dist/client/images-zQq1nSVv.mjs.map +0 -1
  117. package/dist/client/md-kvaGCNAK.mjs +0 -336
  118. package/dist/client/md-kvaGCNAK.mjs.map +0 -1
  119. package/dist/client/network-DuZm76BZ.mjs +0 -8
  120. package/dist/client/network-DuZm76BZ.mjs.map +0 -1
  121. package/dist/client/objects-BudUAfWY.mjs +0 -12909
  122. package/dist/client/objects-BudUAfWY.mjs.map +0 -1
  123. package/dist/client/objects-Dc7sKUr8.mjs +0 -67
  124. package/dist/client/objects-Dc7sKUr8.mjs.map +0 -1
  125. package/dist/client/objects-Dw7oeTq2.mjs +0 -80
  126. package/dist/client/objects-Dw7oeTq2.mjs.map +0 -1
  127. package/dist/client/objects-_g7nGIn5.mjs +0 -25
  128. package/dist/client/objects-_g7nGIn5.mjs.map +0 -1
  129. package/dist/client/objects-eBxvY6_n.mjs +0 -78
  130. package/dist/client/objects-eBxvY6_n.mjs.map +0 -1
  131. package/dist/client/projects-yiK0HGSA.mjs +0 -7
  132. package/dist/client/projects-yiK0HGSA.mjs.map +0 -1
  133. package/dist/client/routeInfo-DP3v74Wg.mjs +0 -19
  134. package/dist/client/routeInfo-DP3v74Wg.mjs.map +0 -1
  135. package/dist/client/routes-CJj7SR_K.mjs +0 -10
  136. package/dist/client/routes-CJj7SR_K.mjs.map +0 -1
  137. package/dist/client/routes-xofA3ksU.mjs +0 -110
  138. package/dist/client/routes-xofA3ksU.mjs.map +0 -1
  139. package/dist/client/securitygroups-CSmsBzUb.mjs +0 -581
  140. package/dist/client/securitygroups-CSmsBzUb.mjs.map +0 -1
  141. package/dist/client/securitygroups-CtKne8UQ.mjs +0 -8
  142. package/dist/client/securitygroups-CtKne8UQ.mjs.map +0 -1
  143. package/dist/client/securitygroups-T7kaNFEp.mjs +0 -15
  144. package/dist/client/securitygroups-T7kaNFEp.mjs.map +0 -1
  145. package/dist/client/securitygroups-WLB1_IM6.mjs +0 -22
  146. package/dist/client/securitygroups-WLB1_IM6.mjs.map +0 -1
  147. package/dist/client/securitygroups-o0IXZM6S.mjs +0 -14
  148. package/dist/client/securitygroups-o0IXZM6S.mjs.map +0 -1
  149. package/dist/client/serviceCatalog-B3lKWC9V.mjs +0 -6
  150. package/dist/client/serviceCatalog-B3lKWC9V.mjs.map +0 -1
  151. package/dist/client/services-D1PbooD1.mjs +0 -6
  152. package/dist/client/services-D1PbooD1.mjs.map +0 -1
  153. package/dist/client/services-DEMVtFyn.mjs +0 -9
  154. package/dist/client/services-DEMVtFyn.mjs.map +0 -1
  155. package/dist/client/storageProviders-CJ5rOh13.mjs +0 -15
  156. package/dist/client/storageProviders-CJ5rOh13.mjs.map +0 -1
  157. package/dist/client/trpcClient-D7gpR7YG.mjs +0 -71
  158. package/dist/client/trpcClient-D7gpR7YG.mjs.map +0 -1
  159. package/dist/client/useBreadcrumbs-ha3IlaxX.mjs +0 -54
  160. package/dist/client/useBreadcrumbs-ha3IlaxX.mjs.map +0 -1
  161. package/dist/client/useErrorTranslation-Dc0eE8Zt.mjs +0 -83
  162. package/dist/client/useErrorTranslation-Dc0eE8Zt.mjs.map +0 -1
  163. package/dist/client/useModal-DCs1OJh7.mjs +0 -12
  164. package/dist/client/useModal-DCs1OJh7.mjs.map +0 -1
  165. package/dist/client/useModalTracking-BYd37pXm.mjs +0 -37
  166. package/dist/client/useModalTracking-BYd37pXm.mjs.map +0 -1
  167. package/dist/client/useProjectId-DBc5lpoU.mjs +0 -11
  168. package/dist/client/useProjectId-DBc5lpoU.mjs.map +0 -1
  169. package/dist/client/useSecurityGroupPermissions--hK4aR8Y.mjs +0 -294
  170. package/dist/client/useSecurityGroupPermissions--hK4aR8Y.mjs.map +0 -1
  171. package/dist/client/useSetBreadcrumb-tn7lBaQV.mjs +0 -19
  172. package/dist/client/useSetBreadcrumb-tn7lBaQV.mjs.map +0 -1
  173. package/dist/client/utils/trpcErrors.d.ts +0 -13
@@ -260,7 +260,7 @@ var require_error = __commonJS({
260
260
  }
261
261
  };
262
262
  exports2.SignalOpenstackError = SignalOpenstackError4;
263
- var SignalOpenstackApiError2 = class SignalOpenstackApiError extends Error {
263
+ var SignalOpenstackApiError4 = class SignalOpenstackApiError extends Error {
264
264
  static {
265
265
  __name(this, "SignalOpenstackApiError");
266
266
  }
@@ -271,7 +271,7 @@ var require_error = __commonJS({
271
271
  this.statusCode = statusCode;
272
272
  }
273
273
  };
274
- exports2.SignalOpenstackApiError = SignalOpenstackApiError2;
274
+ exports2.SignalOpenstackApiError = SignalOpenstackApiError4;
275
275
  }
276
276
  });
277
277
 
@@ -2699,16 +2699,16 @@ var require_request = __commonJS({
2699
2699
  });
2700
2700
  }
2701
2701
  }
2702
- onBodySent(chunk) {
2702
+ onBodySent(chunk2) {
2703
2703
  if (channels.bodyChunkSent.hasSubscribers) {
2704
2704
  channels.bodyChunkSent.publish({
2705
2705
  request: this,
2706
- chunk
2706
+ chunk: chunk2
2707
2707
  });
2708
2708
  }
2709
2709
  if (this[kHandler].onBodySent) {
2710
2710
  try {
2711
- return this[kHandler].onBodySent(chunk);
2711
+ return this[kHandler].onBodySent(chunk2);
2712
2712
  } catch (err) {
2713
2713
  this.abort(err);
2714
2714
  }
@@ -2760,17 +2760,17 @@ var require_request = __commonJS({
2760
2760
  this.abort(err);
2761
2761
  }
2762
2762
  }
2763
- onData(chunk) {
2763
+ onData(chunk2) {
2764
2764
  assert(!this.aborted);
2765
2765
  assert(!this.completed);
2766
2766
  if (channels.bodyChunkReceived.hasSubscribers) {
2767
2767
  channels.bodyChunkReceived.publish({
2768
2768
  request: this,
2769
- chunk
2769
+ chunk: chunk2
2770
2770
  });
2771
2771
  }
2772
2772
  try {
2773
- return this[kHandler].onData(chunk);
2773
+ return this[kHandler].onData(chunk2);
2774
2774
  } catch (err) {
2775
2775
  this.abort(err);
2776
2776
  return false;
@@ -6084,17 +6084,17 @@ var require_util2 = __commonJS({
6084
6084
  const bytes = [];
6085
6085
  let byteLength = 0;
6086
6086
  do {
6087
- const { done, value: chunk } = await reader.read();
6087
+ const { done, value: chunk2 } = await reader.read();
6088
6088
  if (done) {
6089
6089
  successSteps(Buffer.concat(bytes, byteLength));
6090
6090
  return;
6091
6091
  }
6092
- if (!isUint8Array(chunk)) {
6092
+ if (!isUint8Array(chunk2)) {
6093
6093
  failureSteps(new TypeError("Received non-Uint8Array chunk"));
6094
6094
  return;
6095
6095
  }
6096
- bytes.push(chunk);
6097
- byteLength += chunk.length;
6096
+ bytes.push(chunk2);
6097
+ byteLength += chunk2.length;
6098
6098
  } while (true);
6099
6099
  } catch (e) {
6100
6100
  failureSteps(e);
@@ -6190,18 +6190,18 @@ var require_util2 = __commonJS({
6190
6190
  super();
6191
6191
  this.#zlibOptions = zlibOptions;
6192
6192
  }
6193
- _transform(chunk, encoding, callback) {
6193
+ _transform(chunk2, encoding, callback) {
6194
6194
  if (!this._inflateStream) {
6195
- if (chunk.length === 0) {
6195
+ if (chunk2.length === 0) {
6196
6196
  callback();
6197
6197
  return;
6198
6198
  }
6199
- this._inflateStream = (chunk[0] & 15) === 8 ? zlib.createInflate(this.#zlibOptions) : zlib.createInflateRaw(this.#zlibOptions);
6199
+ this._inflateStream = (chunk2[0] & 15) === 8 ? zlib.createInflate(this.#zlibOptions) : zlib.createInflateRaw(this.#zlibOptions);
6200
6200
  this._inflateStream.on("data", this.push.bind(this));
6201
6201
  this._inflateStream.on("end", () => this.push(null));
6202
6202
  this._inflateStream.on("error", (err) => this.destroy(err));
6203
6203
  }
6204
- this._inflateStream.write(chunk, encoding, callback);
6204
+ this._inflateStream.write(chunk2, encoding, callback);
6205
6205
  }
6206
6206
  _final(callback) {
6207
6207
  if (this._inflateStream) {
@@ -6957,29 +6957,29 @@ Content-Disposition: form-data`;
6957
6957
  let hasUnknownSizeValue = false;
6958
6958
  for (const [name, value] of object) {
6959
6959
  if (typeof value === "string") {
6960
- const chunk2 = textEncoder.encode(prefix + `; name="${formdataEscape(normalizeLinefeeds(name))}"\r
6960
+ const chunk3 = textEncoder.encode(prefix + `; name="${formdataEscape(normalizeLinefeeds(name))}"\r
6961
6961
  \r
6962
6962
  ${normalizeLinefeeds(value)}\r
6963
6963
  `);
6964
- blobParts.push(chunk2);
6965
- length += chunk2.byteLength;
6964
+ blobParts.push(chunk3);
6965
+ length += chunk3.byteLength;
6966
6966
  } else {
6967
- const chunk2 = textEncoder.encode(`${prefix}; name="${formdataEscape(normalizeLinefeeds(name))}"` + (value.name ? `; filename="${formdataEscape(value.name)}"` : "") + `\r
6967
+ const chunk3 = textEncoder.encode(`${prefix}; name="${formdataEscape(normalizeLinefeeds(name))}"` + (value.name ? `; filename="${formdataEscape(value.name)}"` : "") + `\r
6968
6968
  Content-Type: ${value.type || "application/octet-stream"}\r
6969
6969
  \r
6970
6970
  `);
6971
- blobParts.push(chunk2, value, rn);
6971
+ blobParts.push(chunk3, value, rn);
6972
6972
  if (typeof value.size === "number") {
6973
- length += chunk2.byteLength + value.size + rn.byteLength;
6973
+ length += chunk3.byteLength + value.size + rn.byteLength;
6974
6974
  } else {
6975
6975
  hasUnknownSizeValue = true;
6976
6976
  }
6977
6977
  }
6978
6978
  }
6979
- const chunk = textEncoder.encode(`--${boundary}--\r
6979
+ const chunk2 = textEncoder.encode(`--${boundary}--\r
6980
6980
  `);
6981
- blobParts.push(chunk);
6982
- length += chunk.byteLength;
6981
+ blobParts.push(chunk2);
6982
+ length += chunk2.byteLength;
6983
6983
  if (hasUnknownSizeValue) {
6984
6984
  length = null;
6985
6985
  }
@@ -7385,41 +7385,41 @@ var require_client_h1 = __commonJS({
7385
7385
  }
7386
7386
  readMore() {
7387
7387
  while (!this.paused && this.ptr) {
7388
- const chunk = this.socket.read();
7389
- if (chunk === null) {
7388
+ const chunk2 = this.socket.read();
7389
+ if (chunk2 === null) {
7390
7390
  break;
7391
7391
  }
7392
- this.execute(chunk);
7392
+ this.execute(chunk2);
7393
7393
  }
7394
7394
  }
7395
7395
  /**
7396
7396
  * @param {Buffer} chunk
7397
7397
  */
7398
- execute(chunk) {
7398
+ execute(chunk2) {
7399
7399
  assert(currentParser === null);
7400
7400
  assert(this.ptr != null);
7401
7401
  assert(!this.paused);
7402
7402
  const { socket, llhttp } = this;
7403
- if (chunk.length > currentBufferSize) {
7403
+ if (chunk2.length > currentBufferSize) {
7404
7404
  if (currentBufferPtr) {
7405
7405
  llhttp.free(currentBufferPtr);
7406
7406
  }
7407
- currentBufferSize = Math.ceil(chunk.length / 4096) * 4096;
7407
+ currentBufferSize = Math.ceil(chunk2.length / 4096) * 4096;
7408
7408
  currentBufferPtr = llhttp.malloc(currentBufferSize);
7409
7409
  }
7410
- new Uint8Array(llhttp.memory.buffer, currentBufferPtr, currentBufferSize).set(chunk);
7410
+ new Uint8Array(llhttp.memory.buffer, currentBufferPtr, currentBufferSize).set(chunk2);
7411
7411
  try {
7412
7412
  let ret;
7413
7413
  try {
7414
- currentBufferRef = chunk;
7414
+ currentBufferRef = chunk2;
7415
7415
  currentParser = this;
7416
- ret = llhttp.llhttp_execute(this.ptr, currentBufferPtr, chunk.length);
7416
+ ret = llhttp.llhttp_execute(this.ptr, currentBufferPtr, chunk2.length);
7417
7417
  } finally {
7418
7418
  currentParser = null;
7419
7419
  currentBufferRef = null;
7420
7420
  }
7421
7421
  if (ret !== constants.ERROR.OK) {
7422
- const data = chunk.subarray(llhttp.llhttp_get_error_pos(this.ptr) - currentBufferPtr);
7422
+ const data = chunk2.subarray(llhttp.llhttp_get_error_pos(this.ptr) - currentBufferPtr);
7423
7423
  if (ret === constants.ERROR.PAUSED_UPGRADE) {
7424
7424
  this.onUpgrade(data);
7425
7425
  } else if (ret === constants.ERROR.PAUSED) {
@@ -8149,12 +8149,12 @@ upgrade: ${upgrade}\r
8149
8149
  expectsPayload,
8150
8150
  header
8151
8151
  });
8152
- const onData = /* @__PURE__ */ __name(function(chunk) {
8152
+ const onData = /* @__PURE__ */ __name(function(chunk2) {
8153
8153
  if (finished) {
8154
8154
  return;
8155
8155
  }
8156
8156
  try {
8157
- if (!writer.write(chunk) && this.pause) {
8157
+ if (!writer.write(chunk2) && this.pause) {
8158
8158
  this.pause();
8159
8159
  }
8160
8160
  } catch (err) {
@@ -8301,11 +8301,11 @@ upgrade: ${upgrade}\r
8301
8301
  header
8302
8302
  });
8303
8303
  try {
8304
- for await (const chunk of body) {
8304
+ for await (const chunk2 of body) {
8305
8305
  if (socket[kError]) {
8306
8306
  throw socket[kError];
8307
8307
  }
8308
- if (!writer.write(chunk)) {
8308
+ if (!writer.write(chunk2)) {
8309
8309
  await waitForDrain();
8310
8310
  }
8311
8311
  }
@@ -8347,7 +8347,7 @@ upgrade: ${upgrade}\r
8347
8347
  * @param {Buffer} chunk
8348
8348
  * @returns
8349
8349
  */
8350
- write(chunk) {
8350
+ write(chunk2) {
8351
8351
  const { socket, request, contentLength, client, bytesWritten, expectsPayload, header } = this;
8352
8352
  if (socket[kError]) {
8353
8353
  throw socket[kError];
@@ -8355,7 +8355,7 @@ upgrade: ${upgrade}\r
8355
8355
  if (socket.destroyed) {
8356
8356
  return false;
8357
8357
  }
8358
- const len = Buffer.byteLength(chunk);
8358
+ const len = Buffer.byteLength(chunk2);
8359
8359
  if (!len) {
8360
8360
  return true;
8361
8361
  }
@@ -8385,9 +8385,9 @@ ${len.toString(16)}\r
8385
8385
  `, "latin1");
8386
8386
  }
8387
8387
  this.bytesWritten += len;
8388
- const ret = socket.write(chunk);
8388
+ const ret = socket.write(chunk2);
8389
8389
  socket.uncork();
8390
- request.onBodySent(chunk);
8390
+ request.onBodySent(chunk2);
8391
8391
  if (!ret) {
8392
8392
  if (socket[kParser].timeout && socket[kParser].timeoutType === TIMEOUT_HEADERS) {
8393
8393
  if (socket[kParser].timeout.refresh) {
@@ -8961,11 +8961,11 @@ var require_client_h2 = __commonJS({
8961
8961
  if (request.onHeaders(Number(statusCode), parseH2Headers(realHeaders), stream.resume.bind(stream), "") === false) {
8962
8962
  stream.pause();
8963
8963
  }
8964
- stream.on("data", (chunk) => {
8964
+ stream.on("data", (chunk2) => {
8965
8965
  if (request.aborted || request.completed) {
8966
8966
  return;
8967
8967
  }
8968
- if (request.onData(chunk) === false) {
8968
+ if (request.onData(chunk2) === false) {
8969
8969
  stream.pause();
8970
8970
  }
8971
8971
  });
@@ -9080,8 +9080,8 @@ var require_client_h2 = __commonJS({
9080
9080
  }
9081
9081
  });
9082
9082
  util.addListener(pipe, "data", onPipeData);
9083
- function onPipeData(chunk) {
9084
- request.onBodySent(chunk);
9083
+ function onPipeData(chunk2) {
9084
+ request.onBodySent(chunk2);
9085
9085
  }
9086
9086
  __name(onPipeData, "onPipeData");
9087
9087
  }
@@ -9129,12 +9129,12 @@ var require_client_h2 = __commonJS({
9129
9129
  }), "waitForDrain");
9130
9130
  h2stream.on("close", onDrain).on("drain", onDrain);
9131
9131
  try {
9132
- for await (const chunk of body) {
9132
+ for await (const chunk2 of body) {
9133
9133
  if (socket[kError]) {
9134
9134
  throw socket[kError];
9135
9135
  }
9136
- const res = h2stream.write(chunk);
9137
- request.onBodySent(chunk);
9136
+ const res = h2stream.write(chunk2);
9137
+ request.onBodySent(chunk2);
9138
9138
  if (!res) {
9139
9139
  await waitForDrain();
9140
9140
  }
@@ -11898,12 +11898,12 @@ var require_retry_handler = __commonJS({
11898
11898
  });
11899
11899
  }
11900
11900
  }
11901
- onResponseData(controller, chunk) {
11901
+ onResponseData(controller, chunk2) {
11902
11902
  if (this.error) {
11903
11903
  return;
11904
11904
  }
11905
- this.start += chunk.length;
11906
- this.handler.onResponseData?.(controller, chunk);
11905
+ this.start += chunk2.length;
11906
+ this.handler.onResponseData?.(controller, chunk2);
11907
11907
  }
11908
11908
  onResponseEnd(controller, trailers) {
11909
11909
  if (this.error && this.retryOpts.throwOnError) {
@@ -12167,15 +12167,15 @@ var require_readable = __commonJS({
12167
12167
  * @param {Buffer|null} chunk
12168
12168
  * @returns {boolean}
12169
12169
  */
12170
- push(chunk) {
12171
- if (chunk) {
12172
- this[kBytesRead] += chunk.length;
12170
+ push(chunk2) {
12171
+ if (chunk2) {
12172
+ this[kBytesRead] += chunk2.length;
12173
12173
  if (this[kConsume]) {
12174
- consumePush(this[kConsume], chunk);
12175
- return this[kReading] ? super.push(chunk) : true;
12174
+ consumePush(this[kConsume], chunk2);
12175
+ return this[kReading] ? super.push(chunk2) : true;
12176
12176
  }
12177
12177
  }
12178
- return super.push(chunk);
12178
+ return super.push(chunk2);
12179
12179
  }
12180
12180
  /**
12181
12181
  * Consumes and returns the body as a string.
@@ -12369,8 +12369,8 @@ var require_readable = __commonJS({
12369
12369
  consumePush(consume2, state.buffer[n]);
12370
12370
  }
12371
12371
  } else {
12372
- for (const chunk of state.buffer) {
12373
- consumePush(consume2, chunk);
12372
+ for (const chunk2 of state.buffer) {
12373
+ consumePush(consume2, chunk2);
12374
12374
  }
12375
12375
  }
12376
12376
  if (state.endEmitted) {
@@ -12409,9 +12409,9 @@ var require_readable = __commonJS({
12409
12409
  const buffer = new Uint8Array(Buffer.allocUnsafeSlow(length).buffer);
12410
12410
  let offset = 0;
12411
12411
  for (let i = 0; i < chunks.length; ++i) {
12412
- const chunk = chunks[i];
12413
- buffer.set(chunk, offset);
12414
- offset += chunk.length;
12412
+ const chunk2 = chunks[i];
12413
+ buffer.set(chunk2, offset);
12414
+ offset += chunk2.length;
12415
12415
  }
12416
12416
  return buffer;
12417
12417
  }
@@ -12438,9 +12438,9 @@ var require_readable = __commonJS({
12438
12438
  }
12439
12439
  }
12440
12440
  __name(consumeEnd, "consumeEnd");
12441
- function consumePush(consume2, chunk) {
12442
- consume2.length += chunk.length;
12443
- consume2.body.push(chunk);
12441
+ function consumePush(consume2, chunk2) {
12442
+ consume2.length += chunk2.length;
12443
+ consume2.body.push(chunk2);
12444
12444
  }
12445
12445
  __name(consumePush, "consumePush");
12446
12446
  function consumeFinish(consume2, err) {
@@ -12594,8 +12594,8 @@ var require_api_request = __commonJS({
12594
12594
  }
12595
12595
  }
12596
12596
  }
12597
- onData(chunk) {
12598
- return this.res.push(chunk);
12597
+ onData(chunk2) {
12598
+ return this.res.push(chunk2);
12599
12599
  }
12600
12600
  onComplete(trailers) {
12601
12601
  util.parseHeaders(trailers, this.trailers);
@@ -12830,9 +12830,9 @@ var require_api_stream = __commonJS({
12830
12830
  const needDrain = res.writableNeedDrain !== void 0 ? res.writableNeedDrain : res._writableState?.needDrain;
12831
12831
  return needDrain !== true;
12832
12832
  }
12833
- onData(chunk) {
12833
+ onData(chunk2) {
12834
12834
  const { res } = this;
12835
- return res ? res.write(chunk) : true;
12835
+ return res ? res.write(chunk2) : true;
12836
12836
  }
12837
12837
  onComplete(trailers) {
12838
12838
  const { res } = this;
@@ -12984,9 +12984,9 @@ var require_api_pipeline = __commonJS({
12984
12984
  body.resume();
12985
12985
  }
12986
12986
  }, "read"),
12987
- write: /* @__PURE__ */ __name((chunk, encoding, callback) => {
12987
+ write: /* @__PURE__ */ __name((chunk2, encoding, callback) => {
12988
12988
  const { req } = this;
12989
- if (req.push(chunk, encoding) || req._readableState.destroyed) {
12989
+ if (req.push(chunk2, encoding) || req._readableState.destroyed) {
12990
12990
  callback();
12991
12991
  } else {
12992
12992
  req[kResume] = callback;
@@ -13054,9 +13054,9 @@ var require_api_pipeline = __commonJS({
13054
13054
  if (!body || typeof body.on !== "function") {
13055
13055
  throw new InvalidReturnValueError("expected Readable");
13056
13056
  }
13057
- body.on("data", (chunk) => {
13057
+ body.on("data", (chunk2) => {
13058
13058
  const { ret, body: body2 } = this;
13059
- if (!ret.push(chunk) && body2.pause) {
13059
+ if (!ret.push(chunk2) && body2.pause) {
13060
13060
  body2.pause();
13061
13061
  }
13062
13062
  }).on("error", (err) => {
@@ -13073,9 +13073,9 @@ var require_api_pipeline = __commonJS({
13073
13073
  });
13074
13074
  this.body = body;
13075
13075
  }
13076
- onData(chunk) {
13076
+ onData(chunk2) {
13077
13077
  const { res } = this;
13078
- return res.push(chunk);
13078
+ return res.push(chunk2);
13079
13079
  }
13080
13080
  onComplete(trailers) {
13081
13081
  const { res } = this;
@@ -14371,8 +14371,8 @@ var require_pending_interceptors_formatter = __commonJS({
14371
14371
  }
14372
14372
  constructor({ disableColors } = {}) {
14373
14373
  this.transform = new Transform4({
14374
- transform(chunk, _enc, cb) {
14375
- cb(null, chunk);
14374
+ transform(chunk2, _enc, cb) {
14375
+ cb(null, chunk2);
14376
14376
  }
14377
14377
  });
14378
14378
  this.logger = new Console({
@@ -15183,9 +15183,9 @@ var require_snapshot_agent = __commonJS({
15183
15183
  responseData.headers = headers;
15184
15184
  return handler.onResponseStart(controller, statusCode, headers, statusMessage);
15185
15185
  },
15186
- onResponseData(controller, chunk) {
15187
- responseData.body.push(chunk);
15188
- return handler.onResponseData(controller, chunk);
15186
+ onResponseData(controller, chunk2) {
15187
+ responseData.body.push(chunk2);
15188
+ return handler.onResponseData(controller, chunk2);
15189
15189
  },
15190
15190
  onResponseEnd(controller, trailers) {
15191
15191
  responseData.trailers = trailers;
@@ -15588,10 +15588,10 @@ var require_redirect_handler = __commonJS({
15588
15588
  this.opts.origin = origin;
15589
15589
  this.opts.query = null;
15590
15590
  }
15591
- onResponseData(controller, chunk) {
15591
+ onResponseData(controller, chunk2) {
15592
15592
  if (this.location) {
15593
15593
  } else {
15594
- this.handler.onResponseData?.(controller, chunk);
15594
+ this.handler.onResponseData?.(controller, chunk2);
15595
15595
  }
15596
15596
  }
15597
15597
  onResponseEnd(controller, trailers) {
@@ -15709,11 +15709,11 @@ var require_response_error = __commonJS({
15709
15709
  this.#decoder = new TextDecoder("utf-8");
15710
15710
  }
15711
15711
  }
15712
- onResponseData(controller, chunk) {
15712
+ onResponseData(controller, chunk2) {
15713
15713
  if (this.#statusCode < 400) {
15714
- return super.onResponseData(controller, chunk);
15714
+ return super.onResponseData(controller, chunk2);
15715
15715
  }
15716
- this.#body += this.#decoder?.decode(chunk, {
15716
+ this.#body += this.#decoder?.decode(chunk2, {
15717
15717
  stream: true
15718
15718
  }) ?? "";
15719
15719
  }
@@ -15827,8 +15827,8 @@ var require_dump = __commonJS({
15827
15827
  onResponseError(controller, err) {
15828
15828
  super.onResponseError(controller, this.aborted === true ? this.reason : err);
15829
15829
  }
15830
- onResponseData(controller, chunk) {
15831
- this.#size = this.#size + chunk.length;
15830
+ onResponseData(controller, chunk2) {
15831
+ this.#size = this.#size + chunk2.length;
15832
15832
  if (this.#size > this.#maxSize) {
15833
15833
  throw new RequestAbortedError(`Response size (${this.#size}) larger than maxSize (${this.#maxSize})`);
15834
15834
  }
@@ -15868,7 +15868,7 @@ var require_dump = __commonJS({
15868
15868
  var require_dns = __commonJS({
15869
15869
  "../../node_modules/.pnpm/undici@7.29.1/node_modules/undici/lib/interceptor/dns.js"(exports2, module2) {
15870
15870
  "use strict";
15871
- var { isIP } = require("net");
15871
+ var { isIP: isIP2 } = require("net");
15872
15872
  var { lookup } = require("dns");
15873
15873
  var DecoratorHandler = require_decorator_handler();
15874
15874
  var { InvalidArgumentError, InformationalError } = require_errors();
@@ -16284,7 +16284,7 @@ var require_dns = __commonJS({
16284
16284
  return (dispatch) => {
16285
16285
  return /* @__PURE__ */ __name(function dnsInterceptor(origDispatchOpts, handler) {
16286
16286
  const origin = origDispatchOpts.origin.constructor === URL ? origDispatchOpts.origin : new URL(origDispatchOpts.origin);
16287
- if (isIP(origin.hostname) !== 0) {
16287
+ if (isIP2(origin.hostname) !== 0) {
16288
16288
  return dispatch(origDispatchOpts, handler);
16289
16289
  }
16290
16290
  instance.runLookup(origin, origDispatchOpts, (err, newOrigin) => {
@@ -17616,9 +17616,9 @@ var require_cache_handler = __commonJS({
17616
17616
  if (typeof cachedValue.body.values === "function") {
17617
17617
  const bodyIterator = cachedValue.body.values();
17618
17618
  const streamCachedBody = /* @__PURE__ */ __name(() => {
17619
- for (const chunk of bodyIterator) {
17620
- const full = this.#writeStream.write(chunk) === false;
17621
- this.#handler.onResponseData?.(controller, chunk);
17619
+ for (const chunk2 of bodyIterator) {
17620
+ const full = this.#writeStream.write(chunk2) === false;
17621
+ this.#handler.onResponseData?.(controller, chunk2);
17622
17622
  if (full) {
17623
17623
  break;
17624
17624
  }
@@ -17636,9 +17636,9 @@ var require_cache_handler = __commonJS({
17636
17636
  });
17637
17637
  streamCachedBody();
17638
17638
  } else if (typeof cachedValue.body.on === "function") {
17639
- cachedValue.body.on("data", (chunk) => {
17640
- this.#writeStream.write(chunk);
17641
- this.#handler.onResponseData?.(controller, chunk);
17639
+ cachedValue.body.on("data", (chunk2) => {
17640
+ this.#writeStream.write(chunk2);
17641
+ this.#handler.onResponseData?.(controller, chunk2);
17642
17642
  }).on("end", () => {
17643
17643
  this.#writeStream.end();
17644
17644
  }).on("error", () => {
@@ -17681,11 +17681,11 @@ var require_cache_handler = __commonJS({
17681
17681
  downstreamOnHeaders();
17682
17682
  }
17683
17683
  }
17684
- onResponseData(controller, chunk) {
17685
- if (this.#writeStream?.write(chunk) === false) {
17684
+ onResponseData(controller, chunk2) {
17685
+ if (this.#writeStream?.write(chunk2) === false) {
17686
17686
  controller.pause();
17687
17687
  }
17688
- this.#handler.onResponseData?.(controller, chunk);
17688
+ this.#handler.onResponseData?.(controller, chunk2);
17689
17689
  }
17690
17690
  onResponseEnd(controller, trailers) {
17691
17691
  this.#writeStream?.end();
@@ -17999,15 +17999,15 @@ var require_memory_cache_store = __commonJS({
17999
17999
  size: 0
18000
18000
  };
18001
18001
  return new Writable({
18002
- write(chunk, encoding, callback) {
18003
- if (typeof chunk === "string") {
18004
- chunk = Buffer.from(chunk, encoding);
18002
+ write(chunk2, encoding, callback) {
18003
+ if (typeof chunk2 === "string") {
18004
+ chunk2 = Buffer.from(chunk2, encoding);
18005
18005
  }
18006
- entry.size += chunk.byteLength;
18006
+ entry.size += chunk2.byteLength;
18007
18007
  if (entry.size >= store.#maxEntrySize) {
18008
18008
  this.destroy();
18009
18009
  } else {
18010
- entry.body.push(chunk);
18010
+ entry.body.push(chunk2);
18011
18011
  }
18012
18012
  callback(null);
18013
18013
  },
@@ -18169,11 +18169,11 @@ var require_cache_revalidation_handler = __commonJS({
18169
18169
  this.#handler.onRequestStart?.(controller, this.#context);
18170
18170
  this.#handler.onResponseStart?.(controller, statusCode, headers, statusMessage);
18171
18171
  }
18172
- onResponseData(controller, chunk) {
18172
+ onResponseData(controller, chunk2) {
18173
18173
  if (this.#successful) {
18174
18174
  return;
18175
18175
  }
18176
- return this.#handler.onResponseData?.(controller, chunk);
18176
+ return this.#handler.onResponseData?.(controller, chunk2);
18177
18177
  }
18178
18178
  onResponseEnd(controller, trailers) {
18179
18179
  if (this.#successful) {
@@ -18441,8 +18441,8 @@ var require_cache2 = __commonJS({
18441
18441
  if (opts.method === "HEAD") {
18442
18442
  stream.destroy();
18443
18443
  } else {
18444
- stream.on("data", function(chunk) {
18445
- handler.onResponseData?.(controller, chunk);
18444
+ stream.on("data", function(chunk2) {
18445
+ handler.onResponseData?.(controller, chunk2);
18446
18446
  });
18447
18447
  }
18448
18448
  }
@@ -18642,14 +18642,14 @@ var require_decompress = __commonJS({
18642
18642
  function createMaxSizeLimiter(maxSize) {
18643
18643
  let size = 0;
18644
18644
  return new TransformStream2({
18645
- transform(chunk, _encoding, callback) {
18646
- const decompressedSize = size + chunk.length;
18645
+ transform(chunk2, _encoding, callback) {
18646
+ const decompressedSize = size + chunk2.length;
18647
18647
  if (decompressedSize > maxSize) {
18648
18648
  callback(new ResponseExceededMaxSizeError(`Decompressed response size (${decompressedSize}) exceeded maxSize (${maxSize})`));
18649
18649
  return;
18650
18650
  }
18651
18651
  size = decompressedSize;
18652
- callback(null, chunk);
18652
+ callback(null, chunk2);
18653
18653
  }
18654
18654
  });
18655
18655
  }
@@ -18761,15 +18761,15 @@ var require_decompress = __commonJS({
18761
18761
  if (this.#terminated) {
18762
18762
  return;
18763
18763
  }
18764
- let chunk;
18765
- while ((chunk = decompressor.read()) !== null) {
18766
- const decompressedSize = this.#decompressedSize + chunk.length;
18764
+ let chunk2;
18765
+ while ((chunk2 = decompressor.read()) !== null) {
18766
+ const decompressedSize = this.#decompressedSize + chunk2.length;
18767
18767
  if (decompressedSize > this.#maxSize) {
18768
18768
  this.#fail(controller, new ResponseExceededMaxSizeError(`Decompressed response size (${decompressedSize}) exceeded maxSize (${this.#maxSize})`));
18769
18769
  return;
18770
18770
  }
18771
18771
  this.#decompressedSize = decompressedSize;
18772
- const result = super.onResponseData(controller, chunk);
18772
+ const result = super.onResponseData(controller, chunk2);
18773
18773
  if (result === false) {
18774
18774
  break;
18775
18775
  }
@@ -18878,12 +18878,12 @@ var require_decompress = __commonJS({
18878
18878
  * @param {Buffer} chunk
18879
18879
  * @returns {void}
18880
18880
  */
18881
- onResponseData(controller, chunk) {
18881
+ onResponseData(controller, chunk2) {
18882
18882
  if (this.#decompressors.length > 0) {
18883
- this.#decompressors[0].write(chunk);
18883
+ this.#decompressors[0].write(chunk2);
18884
18884
  return;
18885
18885
  }
18886
- super.onResponseData(controller, chunk);
18886
+ super.onResponseData(controller, chunk2);
18887
18887
  }
18888
18888
  /**
18889
18889
  * @param {Controller} controller
@@ -19081,12 +19081,12 @@ var require_deduplication_handler = __commonJS({
19081
19081
  * @param {import('../../types/dispatcher.d.ts').default.DispatchController} controller
19082
19082
  * @param {Buffer} chunk
19083
19083
  */
19084
- onResponseData(controller, chunk) {
19084
+ onResponseData(controller, chunk2) {
19085
19085
  if (this.#aborted || this.#completed) {
19086
19086
  return;
19087
19087
  }
19088
19088
  this.#responseDataStarted = true;
19089
- this.#primaryHandler.onResponseData?.(controller, chunk);
19089
+ this.#primaryHandler.onResponseData?.(controller, chunk2);
19090
19090
  for (const waitingHandler of this.#waitingHandlers) {
19091
19091
  const { handler, controller: waitingController } = waitingHandler;
19092
19092
  if (waitingHandler.done || waitingController.aborted) {
@@ -19094,11 +19094,11 @@ var require_deduplication_handler = __commonJS({
19094
19094
  continue;
19095
19095
  }
19096
19096
  if (waitingController.paused) {
19097
- this.#bufferWaitingChunk(waitingHandler, chunk);
19097
+ this.#bufferWaitingChunk(waitingHandler, chunk2);
19098
19098
  continue;
19099
19099
  }
19100
19100
  try {
19101
- handler.onResponseData?.(waitingController, chunk);
19101
+ handler.onResponseData?.(waitingController, chunk2);
19102
19102
  } catch {
19103
19103
  }
19104
19104
  if (waitingController.aborted) {
@@ -19223,14 +19223,14 @@ var require_deduplication_handler = __commonJS({
19223
19223
  * @param {WaitingHandler} waitingHandler
19224
19224
  * @param {Buffer} chunk
19225
19225
  */
19226
- #bufferWaitingChunk(waitingHandler, chunk) {
19226
+ #bufferWaitingChunk(waitingHandler, chunk2) {
19227
19227
  if (waitingHandler.done || waitingHandler.controller.aborted) {
19228
19228
  waitingHandler.done = true;
19229
19229
  waitingHandler.bufferedChunks = [];
19230
19230
  waitingHandler.bufferedBytes = 0;
19231
19231
  return;
19232
19232
  }
19233
- const bufferedChunk = Buffer.from(chunk);
19233
+ const bufferedChunk = Buffer.from(chunk2);
19234
19234
  waitingHandler.bufferedChunks.push(bufferedChunk);
19235
19235
  waitingHandler.bufferedBytes += bufferedChunk.length;
19236
19236
  if (waitingHandler.bufferedBytes > this.#maxBufferSize) {
@@ -19594,10 +19594,10 @@ var require_sqlite_cache_store = __commonJS({
19594
19594
  const store = this;
19595
19595
  return new Writable({
19596
19596
  decodeStrings: true,
19597
- write(chunk, encoding, callback) {
19598
- size += chunk.byteLength;
19597
+ write(chunk2, encoding, callback) {
19598
+ size += chunk2.byteLength;
19599
19599
  if (size < store.#maxEntrySize) {
19600
- body.push(chunk);
19600
+ body.push(chunk2);
19601
19601
  } else {
19602
19602
  this.destroy();
19603
19603
  }
@@ -22588,11 +22588,11 @@ var require_fetch = __commonJS({
22588
22588
  });
22589
22589
  return true;
22590
22590
  },
22591
- onData(chunk) {
22591
+ onData(chunk2) {
22592
22592
  if (fetchParams.controller.dump) {
22593
22593
  return;
22594
22594
  }
22595
- const bytes = chunk;
22595
+ const bytes = chunk2;
22596
22596
  timingInfo.encodedBodySize += bytes.byteLength;
22597
22597
  return this.body.push(bytes);
22598
22598
  },
@@ -24724,7 +24724,7 @@ var require_permessage_deflate = __commonJS({
24724
24724
  * @param {boolean} fin Final fragment flag
24725
24725
  * @param {Function} callback Callback function
24726
24726
  */
24727
- decompress(chunk, fin, callback) {
24727
+ decompress(chunk2, fin, callback) {
24728
24728
  if (!this.#inflate) {
24729
24729
  let windowBits = Z_DEFAULT_WINDOWBITS;
24730
24730
  if (this.#options.serverMaxWindowBits) {
@@ -24760,7 +24760,7 @@ var require_permessage_deflate = __commonJS({
24760
24760
  callback(err);
24761
24761
  });
24762
24762
  }
24763
- this.#inflate.write(chunk);
24763
+ this.#inflate.write(chunk2);
24764
24764
  if (fin) {
24765
24765
  this.#inflate.write(tail);
24766
24766
  }
@@ -24831,9 +24831,9 @@ var require_receiver = __commonJS({
24831
24831
  * @param {Buffer} chunk
24832
24832
  * @param {() => void} callback
24833
24833
  */
24834
- _write(chunk, _, callback) {
24835
- this.#buffers.push(chunk);
24836
- this.#byteOffset += chunk.length;
24834
+ _write(chunk2, _, callback) {
24835
+ this.#buffers.push(chunk2);
24836
+ this.#byteOffset += chunk2.length;
24837
24837
  this.#loop = true;
24838
24838
  this.run(callback);
24839
24839
  }
@@ -25285,8 +25285,8 @@ var require_websocket = __commonJS({
25285
25285
  onMessage: /* @__PURE__ */ __name((opcode, data) => this.#onMessage(opcode, data), "onMessage"),
25286
25286
  onParserError: /* @__PURE__ */ __name((err) => failWebsocketConnection(this.#handler, null, err.message), "onParserError"),
25287
25287
  onParserDrain: /* @__PURE__ */ __name(() => this.#onParserDrain(), "onParserDrain"),
25288
- onSocketData: /* @__PURE__ */ __name((chunk) => {
25289
- if (!this.#parser.write(chunk)) {
25288
+ onSocketData: /* @__PURE__ */ __name((chunk2) => {
25289
+ if (!this.#parser.write(chunk2)) {
25290
25290
  this.#handler.socket.pause();
25291
25291
  }
25292
25292
  }, "onSocketData"),
@@ -25855,8 +25855,8 @@ var require_websocketstream = __commonJS({
25855
25855
  onMessage: /* @__PURE__ */ __name((opcode, data) => this.#onMessage(opcode, data), "onMessage"),
25856
25856
  onParserError: /* @__PURE__ */ __name((err) => failWebsocketConnection(this.#handler, null, err.message), "onParserError"),
25857
25857
  onParserDrain: /* @__PURE__ */ __name(() => this.#handler.socket.resume(), "onParserDrain"),
25858
- onSocketData: /* @__PURE__ */ __name((chunk) => {
25859
- if (!this.#parser.write(chunk)) {
25858
+ onSocketData: /* @__PURE__ */ __name((chunk2) => {
25859
+ if (!this.#parser.write(chunk2)) {
25860
25860
  this.#handler.socket.pause();
25861
25861
  }
25862
25862
  }, "onSocketData"),
@@ -25947,18 +25947,18 @@ var require_websocketstream = __commonJS({
25947
25947
  const reason = closeInfo.reason;
25948
25948
  closeWebSocketConnection(this.#handler, code, reason, true);
25949
25949
  }
25950
- #write(chunk) {
25951
- chunk = webidl.converters.WebSocketStreamWrite(chunk);
25950
+ #write(chunk2) {
25951
+ chunk2 = webidl.converters.WebSocketStreamWrite(chunk2);
25952
25952
  const promise = createDeferredPromise();
25953
25953
  let data = null;
25954
25954
  let opcode = null;
25955
- if (webidl.is.BufferSource(chunk)) {
25956
- data = new Uint8Array(ArrayBuffer.isView(chunk) ? new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength) : chunk.slice());
25955
+ if (webidl.is.BufferSource(chunk2)) {
25956
+ data = new Uint8Array(ArrayBuffer.isView(chunk2) ? new Uint8Array(chunk2.buffer, chunk2.byteOffset, chunk2.byteLength) : chunk2.slice());
25957
25957
  opcode = opcodes.BINARY;
25958
25958
  } else {
25959
25959
  let string;
25960
25960
  try {
25961
- string = webidl.converters.DOMString(chunk);
25961
+ string = webidl.converters.DOMString(chunk2);
25962
25962
  } catch (e) {
25963
25963
  promise.reject(e);
25964
25964
  return promise.promise;
@@ -25999,7 +25999,7 @@ var require_websocketstream = __commonJS({
25999
25999
  start: /* @__PURE__ */ __name((controller) => {
26000
26000
  this.#writableStreamController = controller;
26001
26001
  }, "start"),
26002
- write: /* @__PURE__ */ __name((chunk) => this.#write(chunk), "write"),
26002
+ write: /* @__PURE__ */ __name((chunk2) => this.#write(chunk2), "write"),
26003
26003
  close: /* @__PURE__ */ __name(() => closeWebSocketConnection(this.#handler, null, null), "close"),
26004
26004
  abort: /* @__PURE__ */ __name((reason) => this.#closeUsingReason(reason), "abort")
26005
26005
  });
@@ -26016,18 +26016,18 @@ var require_websocketstream = __commonJS({
26016
26016
  if (this.#handler.readyState !== states.OPEN) {
26017
26017
  return;
26018
26018
  }
26019
- let chunk;
26019
+ let chunk2;
26020
26020
  if (type === opcodes.TEXT) {
26021
26021
  try {
26022
- chunk = utf8Decode(data);
26022
+ chunk2 = utf8Decode(data);
26023
26023
  } catch {
26024
26024
  failWebsocketConnection(this.#handler, 1007, "Received invalid UTF-8 in text frame.");
26025
26025
  return;
26026
26026
  }
26027
26027
  } else if (type === opcodes.BINARY) {
26028
- chunk = new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
26028
+ chunk2 = new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
26029
26029
  }
26030
- this.#readableStreamController.enqueue(chunk);
26030
+ this.#readableStreamController.enqueue(chunk2);
26031
26031
  }
26032
26032
  /** @type {import('../websocket').Handler['onSocketClose']} */
26033
26033
  #onSocketClose() {
@@ -26250,12 +26250,12 @@ var require_eventsource_stream = __commonJS({
26250
26250
  * @param {Function} callback
26251
26251
  * @returns {void}
26252
26252
  */
26253
- _transform(chunk, _encoding, callback) {
26254
- if (chunk.length === 0) {
26253
+ _transform(chunk2, _encoding, callback) {
26254
+ if (chunk2.length === 0) {
26255
26255
  callback();
26256
26256
  return;
26257
26257
  }
26258
- this.chunks.push(chunk);
26258
+ this.chunks.push(chunk2);
26259
26259
  if (this.checkBOM) {
26260
26260
  if (this.handleBOM()) {
26261
26261
  callback();
@@ -26423,10 +26423,10 @@ ${value}`;
26423
26423
  const chunks = [];
26424
26424
  let length = 0;
26425
26425
  for (let i = this.lineChunkIndex; i <= this.chunkIndex; i++) {
26426
- const chunk = this.chunks[i];
26426
+ const chunk2 = this.chunks[i];
26427
26427
  const start = i === this.lineChunkIndex ? this.linePos : 0;
26428
- const end = i === this.chunkIndex ? this.pos : chunk.length;
26429
- const slice = chunk.subarray(start, end);
26428
+ const end = i === this.chunkIndex ? this.pos : chunk2.length;
26429
+ const slice = chunk2.subarray(start, end);
26430
26430
  length += slice.length;
26431
26431
  chunks.push(slice);
26432
26432
  }
@@ -26436,10 +26436,10 @@ ${value}`;
26436
26436
  let chunkIndex = this.lineChunkIndex;
26437
26437
  let pos = this.linePos;
26438
26438
  while (chunkIndex < this.chunks.length) {
26439
- const chunk = this.chunks[chunkIndex];
26440
- const remaining = chunk.length - pos;
26439
+ const chunk2 = this.chunks[chunkIndex];
26440
+ const remaining = chunk2.length - pos;
26441
26441
  if (offset < remaining) {
26442
- return chunk[pos + offset];
26442
+ return chunk2[pos + offset];
26443
26443
  }
26444
26444
  offset -= remaining;
26445
26445
  chunkIndex++;
@@ -26448,8 +26448,8 @@ ${value}`;
26448
26448
  }
26449
26449
  discardLeadingBytes(count) {
26450
26450
  while (count > 0 && this.lineChunkIndex < this.chunks.length) {
26451
- const chunk = this.chunks[this.lineChunkIndex];
26452
- const remaining = chunk.length - this.linePos;
26451
+ const chunk2 = this.chunks[this.lineChunkIndex];
26452
+ const remaining = chunk2.length - this.linePos;
26453
26453
  if (count < remaining) {
26454
26454
  this.linePos += count;
26455
26455
  count = 0;
@@ -27594,7 +27594,7 @@ var require_pathHelpers = __commonJS({
27594
27594
  });
27595
27595
  exports2.encodeOpenstackPathSegment = encodeOpenstackPathSegment2;
27596
27596
  exports2.encodeOpenstackPath = encodeOpenstackPath;
27597
- exports2.validateAndEncodeResourceId = validateAndEncodeResourceId8;
27597
+ exports2.validateAndEncodeResourceId = validateAndEncodeResourceId9;
27598
27598
  var error_1 = require_error();
27599
27599
  function encodeOpenstackPathSegment2(segment, label = "Path segment") {
27600
27600
  if (!segment || typeof segment !== "string") {
@@ -27616,10 +27616,10 @@ var require_pathHelpers = __commonJS({
27616
27616
  return segments.map((seg, idx) => encodeOpenstackPathSegment2(seg, `Path segment ${idx}`)).join("/");
27617
27617
  }
27618
27618
  __name(encodeOpenstackPath, "encodeOpenstackPath");
27619
- function validateAndEncodeResourceId8(id, resourceType = "Resource") {
27619
+ function validateAndEncodeResourceId9(id, resourceType = "Resource") {
27620
27620
  return encodeOpenstackPathSegment2(id, `${resourceType} ID`);
27621
27621
  }
27622
- __name(validateAndEncodeResourceId8, "validateAndEncodeResourceId");
27622
+ __name(validateAndEncodeResourceId9, "validateAndEncodeResourceId");
27623
27623
  }
27624
27624
  });
27625
27625
 
@@ -28855,6 +28855,8 @@ var require_esm2 = __commonJS({
28855
28855
  // src/server/index.ts
28856
28856
  var server_exports = {};
28857
28857
  __export(server_exports, {
28858
+ SLOT_NAMES: () => SLOT_NAMES,
28859
+ auroraAppConfigSchema: () => auroraAppConfigSchema,
28858
28860
  auroraRouter: () => auroraRouter,
28859
28861
  createServer: () => createServer,
28860
28862
  domainScopedInputSchema: () => domainScopedInputSchema,
@@ -28864,6 +28866,7 @@ __export(server_exports, {
28864
28866
  projectScopedProcedure: () => projectScopedProcedure,
28865
28867
  protectedProcedure: () => protectedProcedure,
28866
28868
  publicProcedure: () => publicProcedure,
28869
+ resolveAppConfig: () => resolveAppConfig,
28867
28870
  validateOpenstackService: () => validateOpenstackService
28868
28871
  });
28869
28872
  module.exports = __toCommonJS(server_exports);
@@ -29893,8 +29896,8 @@ async function processBulkOperation(items, processor, options = {}) {
29893
29896
  if (chunkSize && chunkSize > 0) {
29894
29897
  const chunks = chunkArray(items, chunkSize);
29895
29898
  for (let i = 0; i < chunks.length; i++) {
29896
- const chunk = chunks[i];
29897
- const chunkPromises = chunk.map(async (item) => {
29899
+ const chunk2 = chunks[i];
29900
+ const chunkPromises = chunk2.map(async (item) => {
29898
29901
  try {
29899
29902
  await processor(item);
29900
29903
  return {
@@ -30529,19 +30532,19 @@ var imageRouter = {
30529
30532
  try {
30530
30533
  const progress = uploadProgress.get(scopedUploadId);
30531
30534
  const progressTracker = new import_node_stream.Transform({
30532
- transform(chunk, _encoding, callback) {
30533
- progress.uploaded += chunk.length;
30535
+ transform(chunk2, _encoding, callback) {
30536
+ progress.uploaded += chunk2.length;
30534
30537
  uploadProgressEmitter.emit(`progress:${scopedUploadId}`, {
30535
30538
  uploaded: progress.uploaded,
30536
30539
  total: progress.total,
30537
30540
  percent: progress.total > 0 ? Math.round(progress.uploaded / progress.total * 100) : 0
30538
30541
  });
30539
- callback(null, chunk);
30542
+ callback(null, chunk2);
30540
30543
  }
30541
30544
  });
30542
30545
  const passthrough = new import_node_stream.Transform({
30543
- transform(chunk, _enc, cb) {
30544
- cb(null, chunk);
30546
+ transform(chunk2, _enc, cb) {
30547
+ cb(null, chunk2);
30545
30548
  }
30546
30549
  });
30547
30550
  const pipelinePromise = (0, import_promises.pipeline)(validatedFile, progressTracker, passthrough);
@@ -32394,6 +32397,7 @@ Pass an absolute path via the policyDir option in createServer.`);
32394
32397
  }, "loadPolicyEngine");
32395
32398
 
32396
32399
  // src/server/policies/createPermissionRouter.ts
32400
+ var MISSING_RULE_MESSAGE = /not found and no _default rule available/;
32397
32401
  var getPolicy = /* @__PURE__ */ __name((ctx, engine) => {
32398
32402
  const openstackSession = ctx.openstack;
32399
32403
  const token = openstackSession?.getToken();
@@ -32438,7 +32442,15 @@ function createPermissionRouter(config) {
32438
32442
  });
32439
32443
  }
32440
32444
  const policy = getPolicy(ctx, engine);
32441
- return policy.check(mapping.rule);
32445
+ try {
32446
+ return policy.check(mapping.rule);
32447
+ } catch (error) {
32448
+ if (error instanceof Error && MISSING_RULE_MESSAGE.test(error.message)) {
32449
+ console.warn(`Permission '${String(permission)}' denied: rule '${mapping.rule}' is not defined in the loaded policy file, which also has no '_default' rule.`);
32450
+ return false;
32451
+ }
32452
+ throw error;
32453
+ }
32442
32454
  }, "checkSinglePermission");
32443
32455
  return {
32444
32456
  /**
@@ -32455,6 +32467,8 @@ function createPermissionRouter(config) {
32455
32467
  *
32456
32468
  * Invalid keys are rejected with a `BAD_REQUEST` error before the handler runs.
32457
32469
  * Empty array input returns an empty array (`[]`).
32470
+ * A key whose rule is missing from the loaded policy file (and that file has no `_default`
32471
+ * rule) evaluates to `false` for that key alone — the rest of the batch is unaffected.
32458
32472
  * Always returns `boolean[]` for consistent destructuring on the client.
32459
32473
  */
32460
32474
  canUser: projectScopedProcedure.input(projectScopedInputSchema.extend({
@@ -34458,14 +34472,14 @@ var swiftRouter = {
34458
34472
  try {
34459
34473
  const progress = uploadProgressMap.get(scopedUploadId);
34460
34474
  const progressTracker = new import_node_stream2.Transform({
34461
- async transform(chunk, _encoding, callback) {
34462
- progress.uploaded += chunk.length;
34475
+ async transform(chunk2, _encoding, callback) {
34476
+ progress.uploaded += chunk2.length;
34463
34477
  progress.percent = progress.total > 0 ? Math.round(progress.uploaded / progress.total * 100) : 0;
34464
34478
  uploadProgressEmitter2.emit(`progress:${scopedUploadId}`, {
34465
34479
  ...progress
34466
34480
  });
34467
34481
  await new Promise((resolve) => setTimeout(resolve, 0));
34468
- callback(null, chunk);
34482
+ callback(null, chunk2);
34469
34483
  }
34470
34484
  });
34471
34485
  const isAbortLike = /* @__PURE__ */ __name((err) => {
@@ -34850,7 +34864,8 @@ async function resolveEC2Credential(ctx) {
34850
34864
  return null;
34851
34865
  }
34852
34866
  const data = await response.json();
34853
- const ec2Cred = data.credentials?.find((c) => c.type === "ec2" && c.project_id === projectId);
34867
+ const ec2Creds = (data.credentials ?? []).filter((c) => c.type === "ec2" && c.project_id === projectId).sort((a, b) => a.id.localeCompare(b.id));
34868
+ const ec2Cred = ec2Creds[0];
34854
34869
  if (!ec2Cred) {
34855
34870
  return null;
34856
34871
  }
@@ -34941,6 +34956,7 @@ var cephCredentialMiddleware = projectScopedProcedure.use(/* @__PURE__ */ __name
34941
34956
  ...ctx,
34942
34957
  cephCredentials: credentials,
34943
34958
  cephRegion: region,
34959
+ cephEndpoint: endpoint,
34944
34960
  getCephClient: /* @__PURE__ */ __name(() => {
34945
34961
  if (!credentials) {
34946
34962
  throw new import_server12.TRPCError({
@@ -35001,6 +35017,7 @@ var cephUploadProcedure = protectedProcedure.use(/* @__PURE__ */ __name(async fu
35001
35017
  ...scopedCtx,
35002
35018
  cephCredentials: credentials,
35003
35019
  cephRegion: region,
35020
+ cephEndpoint: endpoint,
35004
35021
  getCephClient: /* @__PURE__ */ __name(() => createS3Client(credentials.access, credentials.secret, endpoint, region), "getCephClient")
35005
35022
  }
35006
35023
  });
@@ -35093,7 +35110,7 @@ var ec2CredentialSchema = import_zod13.z.object({
35093
35110
  var ec2CredentialWithSecretSchema = ec2CredentialSchema.extend({
35094
35111
  secret: import_zod13.z.string()
35095
35112
  });
35096
- var deleteEc2CredentialInputSchema = projectScopedInputSchema.extend({
35113
+ var ec2CredentialIdInputSchema = projectScopedInputSchema.extend({
35097
35114
  credentialId: import_zod13.z.string().min(1)
35098
35115
  });
35099
35116
  var containerSchema = import_zod13.z.object({
@@ -35173,7 +35190,11 @@ var bucketStateOutputSchema = import_zod13.z.object({
35173
35190
  isPartialScan: import_zod13.z.boolean()
35174
35191
  });
35175
35192
  var s3StatusSchema = import_zod13.z.object({
35176
- hasCredentials: import_zod13.z.boolean()
35193
+ hasCredentials: import_zod13.z.boolean(),
35194
+ /** Base S3 endpoint of the Ceph RGW for this region (Swift path suffix stripped). */
35195
+ endpoint: import_zod13.z.string(),
35196
+ /** Ceph-compatible region identifier the S3 client signs with. */
35197
+ region: import_zod13.z.string()
35177
35198
  });
35178
35199
  var s3ObjectSchema = import_zod13.z.object({
35179
35200
  key: import_zod13.z.string(),
@@ -35714,9 +35735,17 @@ var deleteLifecycleInputSchema = projectScopedInputSchema.extend({
35714
35735
 
35715
35736
  // src/server/Storage/routers/ceph/containerRouter.ts
35716
35737
  var containerRouter = {
35738
+ /**
35739
+ * Reports whether the user has EC2 credentials in this project, plus the S3 endpoint/region
35740
+ * they'd use if they did. Deliberately built on `cephProcedure` (not `cephProtectedProcedure`):
35741
+ * the UI needs endpoint/region to render Connection Details even when `hasCredentials` is
35742
+ * false (e.g. the empty state in ManageCredentialsModal, or CredentialPrompt).
35743
+ */
35717
35744
  status: cephProcedure.input(projectScopedInputSchema).query(async ({ ctx }) => {
35718
35745
  return {
35719
- hasCredentials: !!ctx.cephCredentials
35746
+ hasCredentials: !!ctx.cephCredentials,
35747
+ endpoint: ctx.cephEndpoint,
35748
+ region: ctx.cephRegion
35720
35749
  };
35721
35750
  }),
35722
35751
  /**
@@ -36136,12 +36165,12 @@ async function bulkDeleteItems(s3, containerName, items, abortSignal, operation)
36136
36165
  const errors = [];
36137
36166
  for (let offset = 0; offset < items.length; offset += S3_MAX_KEYS_PER_REQUEST) {
36138
36167
  if (abortSignal?.aborted) break;
36139
- const chunk = items.slice(offset, offset + S3_MAX_KEYS_PER_REQUEST);
36168
+ const chunk2 = items.slice(offset, offset + S3_MAX_KEYS_PER_REQUEST);
36140
36169
  try {
36141
36170
  const response = await s3.send(new import_client_s33.DeleteObjectsCommand({
36142
36171
  Bucket: containerName,
36143
36172
  Delete: {
36144
- Objects: chunk.map((item) => ({
36173
+ Objects: chunk2.map((item) => ({
36145
36174
  Key: item.key,
36146
36175
  ...item.versionId && {
36147
36176
  VersionId: item.versionId
@@ -36179,7 +36208,7 @@ async function bulkDeleteItems(s3, containerName, items, abortSignal, operation)
36179
36208
  });
36180
36209
  }
36181
36210
  const message = error instanceof Error ? error.message : String(error);
36182
- for (const item of chunk) {
36211
+ for (const item of chunk2) {
36183
36212
  errors.push({
36184
36213
  key: item.key,
36185
36214
  versionId: item.versionId,
@@ -37300,14 +37329,14 @@ var objectRouter = {
37300
37329
  const progress = uploadProgressMap2.get(scopedUploadId);
37301
37330
  const fileStream = import_node_stream3.Readable.fromWeb(input);
37302
37331
  const progressTracker = new import_node_stream3.Transform({
37303
- async transform(chunk, _encoding, callback) {
37304
- progress.uploaded += chunk.length;
37332
+ async transform(chunk2, _encoding, callback) {
37333
+ progress.uploaded += chunk2.length;
37305
37334
  progress.percent = progress.total > 0 ? Math.round(progress.uploaded / progress.total * 100) : 0;
37306
37335
  uploadProgressEmitter3.emit(`progress:${scopedUploadId}`, {
37307
37336
  ...progress
37308
37337
  });
37309
37338
  await new Promise((resolve) => setImmediate(resolve));
37310
- callback(null, chunk);
37339
+ callback(null, chunk2);
37311
37340
  }
37312
37341
  });
37313
37342
  const isAbortLike = /* @__PURE__ */ __name((err) => {
@@ -37433,9 +37462,141 @@ var objectRouter = {
37433
37462
  };
37434
37463
 
37435
37464
  // src/server/Storage/routers/ceph/ec2CredentialRouter.ts
37436
- var import_server15 = require("@trpc/server");
37437
- var import_zod15 = require("zod");
37465
+ var import_server16 = require("@trpc/server");
37466
+ var import_signal_openstack5 = __toESM(require_esm());
37438
37467
  var import_crypto = require("crypto");
37468
+
37469
+ // src/server/Storage/helpers/ec2CredentialMapper.ts
37470
+ var import_server15 = require("@trpc/server");
37471
+ function toEc2Credential(raw) {
37472
+ const blob = parseBlob(raw);
37473
+ const result = ec2CredentialSchema.safeParse({
37474
+ id: raw.id,
37475
+ access: blob.access,
37476
+ user_id: raw.user_id,
37477
+ project_id: raw.project_id
37478
+ });
37479
+ if (!result.success) {
37480
+ throw invalidFormat(raw.id);
37481
+ }
37482
+ return result.data;
37483
+ }
37484
+ __name(toEc2Credential, "toEc2Credential");
37485
+ function toEc2CredentialWithSecret(raw) {
37486
+ const blob = parseBlob(raw);
37487
+ const result = ec2CredentialWithSecretSchema.safeParse({
37488
+ id: raw.id,
37489
+ access: blob.access,
37490
+ secret: blob.secret,
37491
+ user_id: raw.user_id,
37492
+ project_id: raw.project_id
37493
+ });
37494
+ if (!result.success) {
37495
+ throw invalidFormat(raw.id);
37496
+ }
37497
+ return result.data;
37498
+ }
37499
+ __name(toEc2CredentialWithSecret, "toEc2CredentialWithSecret");
37500
+ function parseBlob(raw) {
37501
+ let parsed;
37502
+ try {
37503
+ parsed = JSON.parse(raw.blob);
37504
+ } catch {
37505
+ throw parseFailed(raw.id);
37506
+ }
37507
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
37508
+ throw parseFailed(raw.id);
37509
+ }
37510
+ return parsed;
37511
+ }
37512
+ __name(parseBlob, "parseBlob");
37513
+ function parseFailed(credentialId) {
37514
+ return new import_server15.TRPCError({
37515
+ code: "INTERNAL_SERVER_ERROR",
37516
+ message: `Failed to parse EC2 credential blob for credential ${credentialId}`
37517
+ });
37518
+ }
37519
+ __name(parseFailed, "parseFailed");
37520
+ function invalidFormat(credentialId) {
37521
+ return new import_server15.TRPCError({
37522
+ code: "INTERNAL_SERVER_ERROR",
37523
+ message: `Invalid EC2 credential format for credential ${credentialId}`
37524
+ });
37525
+ }
37526
+ __name(invalidFormat, "invalidFormat");
37527
+
37528
+ // src/server/Storage/routers/ceph/ec2CredentialRouter.ts
37529
+ function rejectForIdentityStatus(status, whatFailed) {
37530
+ if (status === 401) {
37531
+ throw new import_server16.TRPCError({
37532
+ code: "UNAUTHORIZED",
37533
+ message: "Authentication failed"
37534
+ });
37535
+ }
37536
+ if (status === 403) {
37537
+ throw new import_server16.TRPCError({
37538
+ code: "FORBIDDEN",
37539
+ message: "Access denied"
37540
+ });
37541
+ }
37542
+ throw new import_server16.TRPCError({
37543
+ code: "INTERNAL_SERVER_ERROR",
37544
+ message: whatFailed
37545
+ });
37546
+ }
37547
+ __name(rejectForIdentityStatus, "rejectForIdentityStatus");
37548
+ function credentialNotFound() {
37549
+ return new import_server16.TRPCError({
37550
+ code: "NOT_FOUND",
37551
+ message: "Credential not found"
37552
+ });
37553
+ }
37554
+ __name(credentialNotFound, "credentialNotFound");
37555
+ async function fetchOwnedCredential(ctx, credentialId) {
37556
+ const userId = ctx.openstack.getToken()?.tokenData.user?.id;
37557
+ const projectId = ctx.openstack.getToken()?.tokenData.project?.id;
37558
+ if (!userId) {
37559
+ throw new import_server16.TRPCError({
37560
+ code: "UNAUTHORIZED",
37561
+ message: "User ID not found in token"
37562
+ });
37563
+ }
37564
+ if (!projectId) {
37565
+ throw new import_server16.TRPCError({
37566
+ code: "UNAUTHORIZED",
37567
+ message: "Project ID not found in token"
37568
+ });
37569
+ }
37570
+ const identityService = ctx.openstack.service("identity");
37571
+ let getResponse;
37572
+ try {
37573
+ getResponse = await identityService.get(`credentials/${credentialId}`);
37574
+ } catch (error) {
37575
+ if (error instanceof import_signal_openstack5.SignalOpenstackApiError) {
37576
+ if (error.statusCode === 404) {
37577
+ return null;
37578
+ }
37579
+ rejectForIdentityStatus(error.statusCode, "Failed to fetch credential for verification");
37580
+ }
37581
+ throw error;
37582
+ }
37583
+ if (!getResponse.ok) {
37584
+ if (getResponse.status === 404) {
37585
+ return null;
37586
+ }
37587
+ rejectForIdentityStatus(getResponse.status, "Failed to fetch credential for verification");
37588
+ }
37589
+ const credentialData = await getResponse.json();
37590
+ const credential = credentialData.credential;
37591
+ if (credential.user_id !== userId || credential.project_id !== projectId) {
37592
+ throw credentialNotFound();
37593
+ }
37594
+ if (credential.type !== "ec2") {
37595
+ return null;
37596
+ }
37597
+ return credential;
37598
+ }
37599
+ __name(fetchOwnedCredential, "fetchOwnedCredential");
37439
37600
  var ec2CredentialRouter = {
37440
37601
  /**
37441
37602
  * Lists EC2 credentials for the current user scoped to the given project.
@@ -37444,7 +37605,7 @@ var ec2CredentialRouter = {
37444
37605
  list: projectScopedProcedure.input(projectScopedInputSchema).query(async ({ ctx, input }) => {
37445
37606
  const userId = ctx.openstack.getToken()?.tokenData.user?.id;
37446
37607
  if (!userId) {
37447
- throw new import_server15.TRPCError({
37608
+ throw new import_server16.TRPCError({
37448
37609
  code: "UNAUTHORIZED",
37449
37610
  message: "User ID not found in token"
37450
37611
  });
@@ -37457,48 +37618,31 @@ var ec2CredentialRouter = {
37457
37618
  }
37458
37619
  });
37459
37620
  if (!response.ok) {
37460
- throw new import_server15.TRPCError({
37621
+ throw new import_server16.TRPCError({
37461
37622
  code: "INTERNAL_SERVER_ERROR",
37462
37623
  message: "Failed to list EC2 credentials"
37463
37624
  });
37464
37625
  }
37465
37626
  const data = await response.json();
37466
37627
  const ec2Creds = (data.credentials ?? []).filter((c) => c.type === "ec2" && c.project_id === input.project_id);
37467
- return ec2Creds.map((c) => {
37468
- try {
37469
- const blob = JSON.parse(c.blob);
37470
- const result = ec2CredentialSchema.safeParse({
37471
- id: c.id,
37472
- access: blob.access,
37473
- user_id: c.user_id,
37474
- project_id: c.project_id
37475
- });
37476
- if (!result.success) {
37477
- throw new import_server15.TRPCError({
37478
- code: "INTERNAL_SERVER_ERROR",
37479
- message: `Invalid EC2 credential format for credential ${c.id}`
37480
- });
37481
- }
37482
- return result.data;
37483
- } catch (error) {
37484
- if (error instanceof import_server15.TRPCError) {
37485
- throw error;
37486
- }
37487
- throw new import_server15.TRPCError({
37488
- code: "INTERNAL_SERVER_ERROR",
37489
- message: `Failed to parse EC2 credential blob for credential ${c.id}`
37490
- });
37491
- }
37492
- });
37628
+ return ec2Creds.map(toEc2Credential);
37493
37629
  }),
37494
37630
  /**
37495
37631
  * Creates a new EC2 credential for the current user scoped to the given project.
37496
- * The secret key is returned exactly once in this response and never stored.
37632
+ *
37633
+ * The secret is generated here and handed to Keystone, but deliberately not returned: the UI
37634
+ * shows a new key concealed like any other and reads it through `reveal`, so a secret in this
37635
+ * response would be a value crossing the wire that nothing consumes. `reveal` remains the one
37636
+ * procedure that hands a secret out.
37637
+ *
37638
+ * No ceiling on how many a user may hold: neither Keystone nor RGW imposes one, and all of a
37639
+ * user's keys in a project map to the same RGW identity, so an extra key grants no extra access
37640
+ * and costs no quota. A limit here would only be this router refusing what the backend allows.
37497
37641
  */
37498
37642
  create: projectScopedProcedure.input(projectScopedInputSchema).mutation(async ({ ctx, input }) => {
37499
37643
  const userId = ctx.openstack.getToken()?.tokenData.user?.id;
37500
37644
  if (!userId) {
37501
- throw new import_server15.TRPCError({
37645
+ throw new import_server16.TRPCError({
37502
37646
  code: "UNAUTHORIZED",
37503
37647
  message: "User ID not found in token"
37504
37648
  });
@@ -37518,98 +37662,76 @@ var ec2CredentialRouter = {
37518
37662
  }
37519
37663
  }));
37520
37664
  if (!response.ok) {
37521
- throw new import_server15.TRPCError({
37665
+ throw new import_server16.TRPCError({
37522
37666
  code: "INTERNAL_SERVER_ERROR",
37523
37667
  message: "Failed to create EC2 credentials. Please try again or contact your administrator."
37524
37668
  });
37525
37669
  }
37526
37670
  const data = await response.json();
37527
- try {
37528
- const blob = JSON.parse(data.credential.blob);
37529
- const result = ec2CredentialWithSecretSchema.safeParse({
37530
- id: data.credential.id,
37531
- access: blob.access,
37532
- secret: blob.secret,
37533
- user_id: data.credential.user_id,
37534
- project_id: data.credential.project_id
37535
- });
37536
- if (!result.success) {
37537
- throw new import_server15.TRPCError({
37538
- code: "INTERNAL_SERVER_ERROR",
37539
- message: "Created credential has invalid format"
37540
- });
37541
- }
37542
- return result.data;
37543
- } catch (error) {
37544
- if (error instanceof import_server15.TRPCError) {
37545
- throw error;
37546
- }
37547
- throw new import_server15.TRPCError({
37548
- code: "INTERNAL_SERVER_ERROR",
37549
- message: "Failed to parse created credential response"
37550
- });
37671
+ return toEc2Credential(data.credential);
37672
+ }),
37673
+ /**
37674
+ * Returns one credential including its secret key.
37675
+ *
37676
+ * EC2 credentials in Keystone are reversible by design: the blob is stored encrypted and
37677
+ * decrypted on every read, so `GET /v3/credentials/{id}` hands back {"access","secret"}.
37678
+ * This is NOT an Application Credential (whose secret is hashed and unrecoverable) — the
37679
+ * BFF already reads this exact secret on every single Ceph request
37680
+ * (`middleware/resolveEC2Credential.ts`), so exposing it to its own owner adds no new
37681
+ * disclosure surface.
37682
+ *
37683
+ * Modelled as a mutation rather than a query on purpose: a query is the shape React Query
37684
+ * caches by default, and a secret in that cache would outlive the modal that asked for it and
37685
+ * show up in devtools. Same trick as `objects.generatePresignedUrl`. A mutation is not a cache
37686
+ * guarantee on its own, though - `useMutation` keeps its answer in the MutationCache for
37687
+ * `gcTime` after the observer lets go - so the client calls this one through the vanilla tRPC
37688
+ * client, which caches nothing. See `ManageCredentialsModal`.
37689
+ */
37690
+ reveal: projectScopedProcedure.input(ec2CredentialIdInputSchema).mutation(async ({ ctx, input }) => {
37691
+ const credential = await fetchOwnedCredential(ctx, input.credentialId);
37692
+ if (!credential) {
37693
+ throw credentialNotFound();
37551
37694
  }
37695
+ return toEc2CredentialWithSecret(credential);
37552
37696
  }),
37553
37697
  /**
37554
37698
  * Deletes an EC2 credential by ID.
37555
37699
  * Verifies ownership before deletion to prevent IDOR attacks.
37700
+ *
37701
+ * Deliberately NOT idempotent: a credential that is not there answers NOT_FOUND rather than
37702
+ * success. Reporting a deletion this procedure did not perform is a lie the UI then repeats in a
37703
+ * toast naming a key nobody deleted, and it hides the one case worth seeing — someone else
37704
+ * removing that key while this screen was open. The caller is told what the identity service
37705
+ * actually said, and the UI refreshes the list either way, so the table stops showing the key
37706
+ * regardless of which answer came back.
37707
+ *
37708
+ * NOT_FOUND here is the same answer `fetchOwnedCredential` gives for a credential owned by
37709
+ * somebody else, which keeps the two indistinguishable (the anti-enumeration property from
37710
+ * #1182) — it is not weakened by this change, only extended to one more case.
37556
37711
  */
37557
- delete: projectScopedProcedure.input(projectScopedInputSchema.extend({
37558
- credentialId: import_zod15.z.string().min(1)
37559
- })).mutation(async ({ ctx, input }) => {
37560
- const userId = ctx.openstack.getToken()?.tokenData.user?.id;
37561
- const projectId = ctx.openstack.getToken()?.tokenData.project?.id;
37562
- if (!userId) {
37563
- throw new import_server15.TRPCError({
37564
- code: "UNAUTHORIZED",
37565
- message: "User ID not found in token"
37566
- });
37567
- }
37568
- if (!projectId) {
37569
- throw new import_server15.TRPCError({
37570
- code: "UNAUTHORIZED",
37571
- message: "Project ID not found in token"
37572
- });
37712
+ delete: projectScopedProcedure.input(ec2CredentialIdInputSchema).mutation(async ({ ctx, input }) => {
37713
+ const credential = await fetchOwnedCredential(ctx, input.credentialId);
37714
+ if (!credential) {
37715
+ throw credentialNotFound();
37573
37716
  }
37574
37717
  const identityService = ctx.openstack.service("identity");
37575
- const getResponse = await identityService.get(`credentials/${input.credentialId}`);
37576
- if (!getResponse.ok) {
37577
- if (getResponse.status === 404) {
37578
- return {
37579
- success: true
37580
- };
37581
- }
37582
- if (getResponse.status === 401) {
37583
- throw new import_server15.TRPCError({
37584
- code: "UNAUTHORIZED",
37585
- message: "Authentication failed"
37586
- });
37587
- }
37588
- if (getResponse.status === 403) {
37589
- throw new import_server15.TRPCError({
37590
- code: "FORBIDDEN",
37591
- message: "Access denied"
37592
- });
37718
+ let deleteResponse;
37719
+ try {
37720
+ deleteResponse = await identityService.del(`credentials/${input.credentialId}`);
37721
+ } catch (error) {
37722
+ if (error instanceof import_signal_openstack5.SignalOpenstackApiError) {
37723
+ if (error.statusCode === 404) {
37724
+ throw credentialNotFound();
37725
+ }
37726
+ rejectForIdentityStatus(error.statusCode, "Failed to delete EC2 credential");
37593
37727
  }
37594
- throw new import_server15.TRPCError({
37595
- code: "INTERNAL_SERVER_ERROR",
37596
- message: "Failed to fetch credential for verification"
37597
- });
37598
- }
37599
- const credentialData = await getResponse.json();
37600
- const credential = credentialData.credential;
37601
- if (credential.user_id !== userId || credential.project_id !== projectId) {
37602
- throw new import_server15.TRPCError({
37603
- code: "NOT_FOUND",
37604
- message: "Credential not found"
37605
- });
37728
+ throw error;
37606
37729
  }
37607
- const deleteResponse = await identityService.del(`credentials/${input.credentialId}`);
37608
- if (!deleteResponse.ok && deleteResponse.status !== 404) {
37609
- throw new import_server15.TRPCError({
37610
- code: "INTERNAL_SERVER_ERROR",
37611
- message: "Failed to delete EC2 credential"
37612
- });
37730
+ if (!deleteResponse.ok) {
37731
+ if (deleteResponse.status === 404) {
37732
+ throw credentialNotFound();
37733
+ }
37734
+ rejectForIdentityStatus(deleteResponse.status, "Failed to delete EC2 credential");
37613
37735
  }
37614
37736
  return {
37615
37737
  success: true
@@ -37621,80 +37743,80 @@ var ec2CredentialRouter = {
37621
37743
  var import_client_s34 = require("@aws-sdk/client-s3");
37622
37744
 
37623
37745
  // src/server/Storage/types/versioning.ts
37624
- var import_zod16 = require("zod");
37625
- var versioningStatusSchema = import_zod16.z.object({
37626
- status: import_zod16.z.enum([
37746
+ var import_zod15 = require("zod");
37747
+ var versioningStatusSchema = import_zod15.z.object({
37748
+ status: import_zod15.z.enum([
37627
37749
  "Enabled",
37628
37750
  "Suspended",
37629
37751
  "Unversioned"
37630
37752
  ]),
37631
- mfaDelete: import_zod16.z.enum([
37753
+ mfaDelete: import_zod15.z.enum([
37632
37754
  "Enabled",
37633
37755
  "Disabled"
37634
37756
  ]).optional()
37635
37757
  });
37636
37758
  var setVersioningInputSchema = projectScopedInputSchema.extend({
37637
- bucket: import_zod16.z.string().min(1),
37638
- status: import_zod16.z.enum([
37759
+ bucket: import_zod15.z.string().min(1),
37760
+ status: import_zod15.z.enum([
37639
37761
  "Enabled",
37640
37762
  "Suspended"
37641
37763
  ])
37642
37764
  });
37643
37765
  var getVersioningStatusInputSchema = projectScopedInputSchema.extend({
37644
- bucket: import_zod16.z.string().min(1)
37645
- });
37646
- var objectVersionSchema = import_zod16.z.object({
37647
- key: import_zod16.z.string(),
37648
- versionId: import_zod16.z.string(),
37649
- isLatest: import_zod16.z.boolean(),
37650
- lastModified: import_zod16.z.string(),
37651
- size: import_zod16.z.number(),
37652
- storageClass: import_zod16.z.string().optional(),
37653
- owner: import_zod16.z.object({
37654
- displayName: import_zod16.z.string().optional(),
37655
- id: import_zod16.z.string().optional()
37766
+ bucket: import_zod15.z.string().min(1)
37767
+ });
37768
+ var objectVersionSchema = import_zod15.z.object({
37769
+ key: import_zod15.z.string(),
37770
+ versionId: import_zod15.z.string(),
37771
+ isLatest: import_zod15.z.boolean(),
37772
+ lastModified: import_zod15.z.string(),
37773
+ size: import_zod15.z.number(),
37774
+ storageClass: import_zod15.z.string().optional(),
37775
+ owner: import_zod15.z.object({
37776
+ displayName: import_zod15.z.string().optional(),
37777
+ id: import_zod15.z.string().optional()
37656
37778
  }).optional(),
37657
- etag: import_zod16.z.string().optional(),
37658
- isDeleteMarker: import_zod16.z.boolean().default(false)
37779
+ etag: import_zod15.z.string().optional(),
37780
+ isDeleteMarker: import_zod15.z.boolean().default(false)
37659
37781
  });
37660
37782
  var listVersionsInputSchema = projectScopedInputSchema.extend({
37661
- bucket: import_zod16.z.string().min(1),
37662
- prefix: import_zod16.z.string().optional(),
37663
- keyMarker: import_zod16.z.string().optional(),
37664
- versionIdMarker: import_zod16.z.string().optional(),
37665
- maxKeys: import_zod16.z.number().int().positive().max(1e3).optional()
37666
- });
37667
- var listVersionsOutputSchema = import_zod16.z.object({
37668
- versions: import_zod16.z.array(objectVersionSchema),
37669
- deleteMarkers: import_zod16.z.array(objectVersionSchema),
37670
- isTruncated: import_zod16.z.boolean(),
37671
- nextKeyMarker: import_zod16.z.string().optional(),
37672
- nextVersionIdMarker: import_zod16.z.string().optional(),
37673
- prefix: import_zod16.z.string().optional(),
37674
- maxKeys: import_zod16.z.number().optional()
37783
+ bucket: import_zod15.z.string().min(1),
37784
+ prefix: import_zod15.z.string().optional(),
37785
+ keyMarker: import_zod15.z.string().optional(),
37786
+ versionIdMarker: import_zod15.z.string().optional(),
37787
+ maxKeys: import_zod15.z.number().int().positive().max(1e3).optional()
37788
+ });
37789
+ var listVersionsOutputSchema = import_zod15.z.object({
37790
+ versions: import_zod15.z.array(objectVersionSchema),
37791
+ deleteMarkers: import_zod15.z.array(objectVersionSchema),
37792
+ isTruncated: import_zod15.z.boolean(),
37793
+ nextKeyMarker: import_zod15.z.string().optional(),
37794
+ nextVersionIdMarker: import_zod15.z.string().optional(),
37795
+ prefix: import_zod15.z.string().optional(),
37796
+ maxKeys: import_zod15.z.number().optional()
37675
37797
  });
37676
37798
  var deleteVersionInputSchema = projectScopedInputSchema.extend({
37677
- bucket: import_zod16.z.string().min(1),
37678
- key: import_zod16.z.string().min(1),
37679
- versionId: import_zod16.z.string().min(1)
37799
+ bucket: import_zod15.z.string().min(1),
37800
+ key: import_zod15.z.string().min(1),
37801
+ versionId: import_zod15.z.string().min(1)
37680
37802
  });
37681
37803
  var restoreVersionInputSchema = projectScopedInputSchema.extend({
37682
- bucket: import_zod16.z.string().min(1),
37683
- key: import_zod16.z.string().min(1),
37684
- versionId: import_zod16.z.string().min(1)
37804
+ bucket: import_zod15.z.string().min(1),
37805
+ key: import_zod15.z.string().min(1),
37806
+ versionId: import_zod15.z.string().min(1)
37685
37807
  });
37686
- var restoreVersionOutputSchema = import_zod16.z.object({
37687
- success: import_zod16.z.boolean(),
37688
- versionId: import_zod16.z.string()
37808
+ var restoreVersionOutputSchema = import_zod15.z.object({
37809
+ success: import_zod15.z.boolean(),
37810
+ versionId: import_zod15.z.string()
37689
37811
  });
37690
37812
  var listObjectVersionsInputSchema = projectScopedInputSchema.extend({
37691
- bucket: import_zod16.z.string().min(1),
37692
- key: import_zod16.z.string().min(1)
37813
+ bucket: import_zod15.z.string().min(1),
37814
+ key: import_zod15.z.string().min(1)
37693
37815
  });
37694
37816
  var checkDeletedContentInputSchema = projectScopedInputSchema.extend({
37695
- bucket: import_zod16.z.string().min(1),
37696
- prefix: import_zod16.z.string().optional(),
37697
- folders: import_zod16.z.array(import_zod16.z.string()).max(1e3).optional()
37817
+ bucket: import_zod15.z.string().min(1),
37818
+ prefix: import_zod15.z.string().optional(),
37819
+ folders: import_zod15.z.array(import_zod15.z.string()).max(1e3).optional()
37698
37820
  }).refine((input) => input.prefix !== void 0 || (input.folders?.length ?? 0) > 0, {
37699
37821
  message: "Either prefix or a non-empty folders array is required",
37700
37822
  path: [
@@ -37706,13 +37828,13 @@ var checkDeletedContentInputSchema = projectScopedInputSchema.extend({
37706
37828
  "folders"
37707
37829
  ]
37708
37830
  });
37709
- var checkDeletedContentOutputSchema = import_zod16.z.array(import_zod16.z.object({
37710
- prefix: import_zod16.z.string(),
37711
- hasDeletedContent: import_zod16.z.boolean(),
37712
- isFolderDeleted: import_zod16.z.boolean(),
37713
- folderDeleteMarkerVersionId: import_zod16.z.string().optional(),
37714
- folderMarkerVersionId: import_zod16.z.string().optional(),
37715
- isPartialScan: import_zod16.z.boolean()
37831
+ var checkDeletedContentOutputSchema = import_zod15.z.array(import_zod15.z.object({
37832
+ prefix: import_zod15.z.string(),
37833
+ hasDeletedContent: import_zod15.z.boolean(),
37834
+ isFolderDeleted: import_zod15.z.boolean(),
37835
+ folderDeleteMarkerVersionId: import_zod15.z.string().optional(),
37836
+ folderMarkerVersionId: import_zod15.z.string().optional(),
37837
+ isPartialScan: import_zod15.z.boolean()
37716
37838
  }));
37717
37839
 
37718
37840
  // src/server/Storage/helpers/versionScan.ts
@@ -38138,8 +38260,8 @@ var versioningRouter = {
38138
38260
 
38139
38261
  // src/server/Storage/routers/ceph/bucketPolicyRouter.ts
38140
38262
  var import_client_s35 = require("@aws-sdk/client-s3");
38141
- var import_server16 = require("@trpc/server");
38142
- var import_zod17 = require("zod");
38263
+ var import_server17 = require("@trpc/server");
38264
+ var import_zod16 = require("zod");
38143
38265
  var policySetRateLimits = /* @__PURE__ */ new Map();
38144
38266
  function checkPolicySetRateLimit(bucketName, projectId) {
38145
38267
  const key = `${projectId}:${bucketName}`;
@@ -38160,7 +38282,7 @@ function checkPolicySetRateLimit(bucketName, projectId) {
38160
38282
  return;
38161
38283
  }
38162
38284
  if (limit.count >= 10) {
38163
- throw new import_server16.TRPCError({
38285
+ throw new import_server17.TRPCError({
38164
38286
  code: "TOO_MANY_REQUESTS",
38165
38287
  message: "Policy modification rate limit exceeded. Maximum 10 policy changes per 5 minutes per bucket."
38166
38288
  });
@@ -38178,13 +38300,13 @@ function validateResourceARNsMatchBucket(policy, bucketName) {
38178
38300
  const arnRegex = /^arn:aws:s3::[^:/]*:([^/]+)/;
38179
38301
  const match = resource.match(arnRegex);
38180
38302
  if (!match) {
38181
- throw new import_server16.TRPCError({
38303
+ throw new import_server17.TRPCError({
38182
38304
  code: "BAD_REQUEST",
38183
38305
  message: `Policy Resource '${resource}' is not a valid S3 bucket ARN for bucket '${bucketName}'. Expected: arn:aws:s3:::${bucketName}, arn:aws:s3:::${bucketName}/* or arn:aws:s3::TENANT:${bucketName}`
38184
38306
  });
38185
38307
  }
38186
38308
  if (match[1] !== bucketName) {
38187
- throw new import_server16.TRPCError({
38309
+ throw new import_server17.TRPCError({
38188
38310
  code: "BAD_REQUEST",
38189
38311
  message: `Policy Resource ARN '${resource}' does not match bucket '${bucketName}'`
38190
38312
  });
@@ -38195,7 +38317,7 @@ function validateResourceARNsMatchBucket(policy, bucketName) {
38195
38317
  __name(validateResourceARNsMatchBucket, "validateResourceARNsMatchBucket");
38196
38318
  function validatePolicySemantics(policy) {
38197
38319
  if (policy.Statement.length > 100) {
38198
- throw new import_server16.TRPCError({
38320
+ throw new import_server17.TRPCError({
38199
38321
  code: "BAD_REQUEST",
38200
38322
  message: "Policy exceeds maximum of 100 statements"
38201
38323
  });
@@ -38208,7 +38330,7 @@ function validatePolicySemantics(policy) {
38208
38330
  return actions.some((a) => a === "*" || a === "s3:*");
38209
38331
  });
38210
38332
  if (denyAllStatement) {
38211
- throw new import_server16.TRPCError({
38333
+ throw new import_server17.TRPCError({
38212
38334
  code: "BAD_REQUEST",
38213
38335
  message: "Policy contains 'Deny *' or 'Deny s3:*' which may lock out all access including the bucket owner. Please use more specific deny rules."
38214
38336
  });
@@ -38282,14 +38404,14 @@ var bucketPolicyRouter = {
38282
38404
  const { bucketName, policy } = input;
38283
38405
  checkPolicySetRateLimit(bucketName, input.project_id);
38284
38406
  if (policy.length > 20480) {
38285
- throw new import_server16.TRPCError({
38407
+ throw new import_server17.TRPCError({
38286
38408
  code: "PAYLOAD_TOO_LARGE",
38287
38409
  message: "Policy document exceeds maximum size of 20KB"
38288
38410
  });
38289
38411
  }
38290
38412
  const openBrackets = (policy.match(/[{[]/g) || []).length;
38291
38413
  if (openBrackets > 50) {
38292
- throw new import_server16.TRPCError({
38414
+ throw new import_server17.TRPCError({
38293
38415
  code: "BAD_REQUEST",
38294
38416
  message: "Policy JSON is too deeply nested (maximum 50 levels)"
38295
38417
  });
@@ -38307,16 +38429,16 @@ var bucketPolicyRouter = {
38307
38429
  return true;
38308
38430
  } catch (error) {
38309
38431
  if (error instanceof SyntaxError) {
38310
- throw new import_server16.TRPCError({
38432
+ throw new import_server17.TRPCError({
38311
38433
  code: "BAD_REQUEST",
38312
38434
  message: "Invalid JSON format"
38313
38435
  });
38314
38436
  }
38315
- if (error instanceof import_zod17.z.ZodError) {
38437
+ if (error instanceof import_zod16.z.ZodError) {
38316
38438
  const zodError = error;
38317
38439
  const firstError = zodError.issues?.[0];
38318
38440
  if (!firstError) {
38319
- throw new import_server16.TRPCError({
38441
+ throw new import_server17.TRPCError({
38320
38442
  code: "BAD_REQUEST",
38321
38443
  message: "Invalid policy structure"
38322
38444
  });
@@ -38333,7 +38455,7 @@ var bucketPolicyRouter = {
38333
38455
  }, "formatPath");
38334
38456
  const path3 = formatPath(firstError.path);
38335
38457
  const message = firstError.message || "Invalid policy structure";
38336
- throw new import_server16.TRPCError({
38458
+ throw new import_server17.TRPCError({
38337
38459
  code: "BAD_REQUEST",
38338
38460
  message: `${path3}${message}`
38339
38461
  });
@@ -38376,7 +38498,7 @@ var bucketPolicyRouter = {
38376
38498
 
38377
38499
  // src/server/Storage/routers/ceph/corsRouter.ts
38378
38500
  var import_client_s36 = require("@aws-sdk/client-s3");
38379
- var import_server17 = require("@trpc/server");
38501
+ var import_server18 = require("@trpc/server");
38380
38502
  var corsSetRateLimits = /* @__PURE__ */ new Map();
38381
38503
  function checkCorsSetRateLimit(bucketName, projectId) {
38382
38504
  const key = `${projectId}:${bucketName}`;
@@ -38397,7 +38519,7 @@ function checkCorsSetRateLimit(bucketName, projectId) {
38397
38519
  return;
38398
38520
  }
38399
38521
  if (limit.count >= 10) {
38400
- throw new import_server17.TRPCError({
38522
+ throw new import_server18.TRPCError({
38401
38523
  code: "TOO_MANY_REQUESTS",
38402
38524
  message: "CORS modification rate limit exceeded. Maximum 10 CORS changes per minute per bucket."
38403
38525
  });
@@ -38514,7 +38636,7 @@ var corsRouter = {
38514
38636
 
38515
38637
  // src/server/Storage/routers/ceph/lifecycleRouter.ts
38516
38638
  var import_client_s37 = require("@aws-sdk/client-s3");
38517
- var import_server18 = require("@trpc/server");
38639
+ var import_server19 = require("@trpc/server");
38518
38640
 
38519
38641
  // src/server/Storage/helpers/lifecycleMapper.ts
38520
38642
  function toMidnightUTC(date) {
@@ -38631,7 +38753,7 @@ function checkLifecycleSetRateLimit(bucketName, projectId) {
38631
38753
  return;
38632
38754
  }
38633
38755
  if (limit.count >= 10) {
38634
- throw new import_server18.TRPCError({
38756
+ throw new import_server19.TRPCError({
38635
38757
  code: "TOO_MANY_REQUESTS",
38636
38758
  message: "Lifecycle modification rate limit exceeded. Maximum 10 lifecycle changes per minute per bucket."
38637
38759
  });
@@ -38913,6 +39035,10 @@ var STORAGE_MAPPINGS = {
38913
39035
  "storage:credentials:create": {
38914
39036
  engine: "storage",
38915
39037
  rule: "storage:credential_create"
39038
+ },
39039
+ "storage:credentials:delete": {
39040
+ engine: "storage",
39041
+ rule: "storage:credential_delete"
38916
39042
  }
38917
39043
  };
38918
39044
  var buildStoragePermissionRouter = /* @__PURE__ */ __name((policyDir) => createPermissionRouter({
@@ -38959,48 +39085,48 @@ var buildObjectStorageRouters = /* @__PURE__ */ __name((policyDir) => ({
38959
39085
  }), "buildObjectStorageRouters");
38960
39086
 
38961
39087
  // src/server/Project/routers/projectRouter.ts
38962
- var import_zod19 = require("zod");
38963
- var import_server19 = require("@trpc/server");
39088
+ var import_zod18 = require("zod");
39089
+ var import_server20 = require("@trpc/server");
38964
39090
 
38965
39091
  // src/server/Project/types/models.ts
38966
- var import_zod18 = require("zod");
38967
- var baseProjectSchema = import_zod18.z.object({
38968
- id: import_zod18.z.string(),
38969
- name: import_zod18.z.string(),
38970
- enabled: import_zod18.z.boolean(),
38971
- domain_id: import_zod18.z.string().nullable().optional(),
38972
- parent_id: import_zod18.z.string().nullable().optional(),
38973
- is_domain: import_zod18.z.boolean().nullable().optional(),
38974
- tags: import_zod18.z.array(import_zod18.z.string()).nullable().optional(),
38975
- options: import_zod18.z.record(import_zod18.z.string(), import_zod18.z.string().or(import_zod18.z.boolean())).nullable().optional(),
38976
- description: import_zod18.z.string().nullable().optional(),
38977
- links: import_zod18.z.object({
38978
- self: import_zod18.z.string().url().nullable().optional()
39092
+ var import_zod17 = require("zod");
39093
+ var baseProjectSchema = import_zod17.z.object({
39094
+ id: import_zod17.z.string(),
39095
+ name: import_zod17.z.string(),
39096
+ enabled: import_zod17.z.boolean(),
39097
+ domain_id: import_zod17.z.string().nullable().optional(),
39098
+ parent_id: import_zod17.z.string().nullable().optional(),
39099
+ is_domain: import_zod17.z.boolean().nullable().optional(),
39100
+ tags: import_zod17.z.array(import_zod17.z.string()).nullable().optional(),
39101
+ options: import_zod17.z.record(import_zod17.z.string(), import_zod17.z.string().or(import_zod17.z.boolean())).nullable().optional(),
39102
+ description: import_zod17.z.string().nullable().optional(),
39103
+ links: import_zod17.z.object({
39104
+ self: import_zod17.z.string().url().nullable().optional()
38979
39105
  }).optional()
38980
39106
  });
38981
39107
  var projectSchema = baseProjectSchema.extend({
38982
- domain_name: import_zod18.z.string().optional(),
38983
- parents: import_zod18.z.array(import_zod18.z.object({
39108
+ domain_name: import_zod17.z.string().optional(),
39109
+ parents: import_zod17.z.array(import_zod17.z.object({
38984
39110
  project: baseProjectSchema
38985
39111
  })).optional()
38986
39112
  });
38987
- var projectResponseSchema = import_zod18.z.object({
39113
+ var projectResponseSchema = import_zod17.z.object({
38988
39114
  project: projectSchema
38989
39115
  });
38990
- var projectsResponseSchema = import_zod18.z.object({
38991
- projects: import_zod18.z.array(projectSchema),
38992
- links: import_zod18.z.object({
38993
- self: import_zod18.z.string().url().optional(),
38994
- previous: import_zod18.z.string().url().nullable().optional(),
38995
- next: import_zod18.z.string().url().nullable().optional()
39116
+ var projectsResponseSchema = import_zod17.z.object({
39117
+ projects: import_zod17.z.array(projectSchema),
39118
+ links: import_zod17.z.object({
39119
+ self: import_zod17.z.string().url().optional(),
39120
+ previous: import_zod17.z.string().url().nullable().optional(),
39121
+ next: import_zod17.z.string().url().nullable().optional()
38996
39122
  }).optional()
38997
39123
  });
38998
39124
 
38999
39125
  // src/server/Project/routers/projectRouter.ts
39000
- var import_signal_openstack5 = __toESM(require_esm());
39126
+ var import_signal_openstack6 = __toESM(require_esm());
39001
39127
  async function callIdentityAPI(identityEndpoint, authToken, path3) {
39002
39128
  if (!identityEndpoint) {
39003
- throw new import_server19.TRPCError({
39129
+ throw new import_server20.TRPCError({
39004
39130
  code: "INTERNAL_SERVER_ERROR",
39005
39131
  message: "Identity endpoint not configured"
39006
39132
  });
@@ -39016,7 +39142,7 @@ async function callIdentityAPI(identityEndpoint, authToken, path3) {
39016
39142
  }
39017
39143
  });
39018
39144
  if (!response.ok) {
39019
- throw new import_server19.TRPCError({
39145
+ throw new import_server20.TRPCError({
39020
39146
  code: "INTERNAL_SERVER_ERROR",
39021
39147
  message: `Identity API call failed: ${response.status} ${response.statusText}`
39022
39148
  });
@@ -39056,14 +39182,14 @@ var projectRouter = {
39056
39182
  */
39057
39183
  getAuthProjects: protectedProcedure.query(async ({ ctx }) => {
39058
39184
  if (!ctx.openstack) {
39059
- throw new import_server19.TRPCError({
39185
+ throw new import_server20.TRPCError({
39060
39186
  code: "UNAUTHORIZED",
39061
39187
  message: "No authenticated session"
39062
39188
  });
39063
39189
  }
39064
39190
  const token = ctx.openstack.getToken();
39065
39191
  if (!token?.authToken) {
39066
- throw new import_server19.TRPCError({
39192
+ throw new import_server20.TRPCError({
39067
39193
  code: "UNAUTHORIZED",
39068
39194
  message: "No auth token available"
39069
39195
  });
@@ -39079,10 +39205,10 @@ var projectRouter = {
39079
39205
  return void 0;
39080
39206
  }
39081
39207
  const domainsData = domainsResponse ? await domainsResponse.json().catch(() => null) : null;
39082
- const domainsResponseSchema = import_zod19.z.object({
39083
- domains: import_zod19.z.array(import_zod19.z.object({
39084
- id: import_zod19.z.string(),
39085
- name: import_zod19.z.string()
39208
+ const domainsResponseSchema = import_zod18.z.object({
39209
+ domains: import_zod18.z.array(import_zod18.z.object({
39210
+ id: import_zod18.z.string(),
39211
+ name: import_zod18.z.string()
39086
39212
  }))
39087
39213
  });
39088
39214
  const parsedDomains = domainsResponseSchema.safeParse(domainsData);
@@ -39102,18 +39228,18 @@ var projectRouter = {
39102
39228
  * filtered by the optional search term. Uses the OpenStack /v3/auth/projects
39103
39229
  * endpoint which works with any valid token.
39104
39230
  */
39105
- searchProjects: protectedProcedure.input(import_zod19.z.object({
39106
- search: import_zod19.z.string().optional()
39231
+ searchProjects: protectedProcedure.input(import_zod18.z.object({
39232
+ search: import_zod18.z.string().optional()
39107
39233
  }).optional()).query(async ({ ctx, input }) => {
39108
39234
  if (!ctx.openstack) {
39109
- throw new import_server19.TRPCError({
39235
+ throw new import_server20.TRPCError({
39110
39236
  code: "UNAUTHORIZED",
39111
39237
  message: "No authenticated session"
39112
39238
  });
39113
39239
  }
39114
39240
  const token = ctx.openstack.getToken();
39115
39241
  if (!token?.authToken) {
39116
- throw new import_server19.TRPCError({
39242
+ throw new import_server20.TRPCError({
39117
39243
  code: "UNAUTHORIZED",
39118
39244
  message: "No auth token available"
39119
39245
  });
@@ -39140,18 +39266,18 @@ var projectRouter = {
39140
39266
  * filtered by ID, name, and description using the standard filterBySearchParams helper.
39141
39267
  * This endpoint provides consistent search behavior with other resources in the system.
39142
39268
  */
39143
- listProjectsWithSearch: protectedProcedure.input(import_zod19.z.object({
39144
- searchTerm: import_zod19.z.string().optional()
39269
+ listProjectsWithSearch: protectedProcedure.input(import_zod18.z.object({
39270
+ searchTerm: import_zod18.z.string().optional()
39145
39271
  })).query(async ({ ctx, input }) => {
39146
39272
  if (!ctx.openstack) {
39147
- throw new import_server19.TRPCError({
39273
+ throw new import_server20.TRPCError({
39148
39274
  code: "UNAUTHORIZED",
39149
39275
  message: "No authenticated session"
39150
39276
  });
39151
39277
  }
39152
39278
  const token = ctx.openstack.getToken();
39153
39279
  if (!token?.authToken) {
39154
- throw new import_server19.TRPCError({
39280
+ throw new import_server20.TRPCError({
39155
39281
  code: "UNAUTHORIZED",
39156
39282
  message: "No auth token available"
39157
39283
  });
@@ -39167,10 +39293,10 @@ var projectRouter = {
39167
39293
  return void 0;
39168
39294
  }
39169
39295
  const domainsData = domainsResponse ? await domainsResponse.json().catch(() => null) : null;
39170
- const domainsResponseSchema = import_zod19.z.object({
39171
- domains: import_zod19.z.array(import_zod19.z.object({
39172
- id: import_zod19.z.string(),
39173
- name: import_zod19.z.string()
39296
+ const domainsResponseSchema = import_zod18.z.object({
39297
+ domains: import_zod18.z.array(import_zod18.z.object({
39298
+ id: import_zod18.z.string(),
39299
+ name: import_zod18.z.string()
39174
39300
  }))
39175
39301
  });
39176
39302
  const parsedDomains = domainsResponseSchema.safeParse(domainsData);
@@ -39190,25 +39316,25 @@ var projectRouter = {
39190
39316
  "domain_id"
39191
39317
  ]);
39192
39318
  }),
39193
- getProject: protectedProcedure.input(import_zod19.z.object({
39194
- projectId: import_zod19.z.string()
39319
+ getProject: protectedProcedure.input(import_zod18.z.object({
39320
+ projectId: import_zod18.z.string()
39195
39321
  })).query(async ({ ctx, input }) => {
39196
39322
  if (!ctx.openstack) {
39197
- throw new import_server19.TRPCError({
39323
+ throw new import_server20.TRPCError({
39198
39324
  code: "UNAUTHORIZED",
39199
39325
  message: "No authenticated session"
39200
39326
  });
39201
39327
  }
39202
39328
  const token = ctx.openstack.getToken();
39203
39329
  if (!token?.authToken) {
39204
- throw new import_server19.TRPCError({
39330
+ throw new import_server20.TRPCError({
39205
39331
  code: "UNAUTHORIZED",
39206
39332
  message: "No auth token available"
39207
39333
  });
39208
39334
  }
39209
39335
  let encodedId;
39210
39336
  try {
39211
- encodedId = (0, import_signal_openstack5.validateAndEncodeResourceId)(input.projectId, "Project");
39337
+ encodedId = (0, import_signal_openstack6.validateAndEncodeResourceId)(input.projectId, "Project");
39212
39338
  } catch {
39213
39339
  return null;
39214
39340
  }
@@ -39228,24 +39354,24 @@ var projectRouters = {
39228
39354
  };
39229
39355
 
39230
39356
  // src/server/Network/routers/floatingIpRouter.ts
39231
- var import_server24 = require("@trpc/server");
39357
+ var import_server25 = require("@trpc/server");
39232
39358
 
39233
39359
  // src/server/helpers/errorHandling.ts
39234
- var import_server20 = require("@trpc/server");
39235
- var import_signal_openstack6 = __toESM(require_esm());
39360
+ var import_server21 = require("@trpc/server");
39361
+ var import_signal_openstack7 = __toESM(require_esm());
39236
39362
  function wrapError3(error, operation) {
39237
- if (error instanceof import_server20.TRPCError) {
39363
+ if (error instanceof import_server21.TRPCError) {
39238
39364
  return error;
39239
39365
  }
39240
- if (error instanceof import_signal_openstack6.SignalOpenstackError) {
39241
- return new import_server20.TRPCError({
39366
+ if (error instanceof import_signal_openstack7.SignalOpenstackError) {
39367
+ return new import_server21.TRPCError({
39242
39368
  code: "BAD_REQUEST",
39243
39369
  message: error.message,
39244
39370
  cause: error
39245
39371
  });
39246
39372
  }
39247
39373
  const baseErrorMessage = `Error during ${operation}`;
39248
- return new import_server20.TRPCError({
39374
+ return new import_server21.TRPCError({
39249
39375
  code: "INTERNAL_SERVER_ERROR",
39250
39376
  message: typeof error !== "string" && error.message ? `${baseErrorMessage}: ${error.message}` : baseErrorMessage,
39251
39377
  cause: error
@@ -39285,11 +39411,11 @@ function appendQueryParamsFromObject(source, options) {
39285
39411
  __name(appendQueryParamsFromObject, "appendQueryParamsFromObject");
39286
39412
 
39287
39413
  // src/server/helpers/validateOpenstackService.ts
39288
- var import_server21 = require("@trpc/server");
39414
+ var import_server22 = require("@trpc/server");
39289
39415
  var capitalize = /* @__PURE__ */ __name((str) => str.charAt(0).toUpperCase() + str.slice(1), "capitalize");
39290
39416
  function validateOpenstackService(service, serviceName) {
39291
39417
  if (!service) {
39292
- throw new import_server21.TRPCError({
39418
+ throw new import_server22.TRPCError({
39293
39419
  code: "INTERNAL_SERVER_ERROR",
39294
39420
  message: `${capitalize(serviceName)} service is not available`
39295
39421
  });
@@ -39298,19 +39424,19 @@ function validateOpenstackService(service, serviceName) {
39298
39424
  __name(validateOpenstackService, "validateOpenstackService");
39299
39425
 
39300
39426
  // src/server/Network/routers/floatingIpRouter.ts
39301
- var import_signal_openstack7 = __toESM(require_esm());
39427
+ var import_signal_openstack8 = __toESM(require_esm());
39302
39428
 
39303
39429
  // src/server/Network/types/floatingIp.ts
39304
- var import_zod21 = require("zod");
39430
+ var import_zod20 = require("zod");
39305
39431
 
39306
39432
  // src/server/Network/types/index.ts
39307
- var import_zod20 = require("zod");
39308
- var ISO8601TimestampSchema = import_zod20.z.string().brand("ISO8601Timestamp");
39309
- var SortDirSchema = import_zod20.z.enum([
39433
+ var import_zod19 = require("zod");
39434
+ var ISO8601TimestampSchema = import_zod19.z.string().brand("ISO8601Timestamp");
39435
+ var SortDirSchema = import_zod19.z.enum([
39310
39436
  "asc",
39311
39437
  "desc"
39312
39438
  ]);
39313
- var NetworkPortStatusSchema = import_zod20.z.enum([
39439
+ var NetworkPortStatusSchema = import_zod19.z.enum([
39314
39440
  "ACTIVE",
39315
39441
  "DOWN",
39316
39442
  "BUILD",
@@ -39318,153 +39444,153 @@ var NetworkPortStatusSchema = import_zod20.z.enum([
39318
39444
  ]);
39319
39445
 
39320
39446
  // src/server/Network/types/floatingIp.ts
39321
- var FloatingIpStatusSchema = import_zod21.z.enum([
39447
+ var FloatingIpStatusSchema = import_zod20.z.enum([
39322
39448
  "ACTIVE",
39323
39449
  "DOWN",
39324
39450
  "ERROR"
39325
39451
  ]);
39326
- var PortDetailsSchema = import_zod21.z.object({
39452
+ var PortDetailsSchema = import_zod20.z.object({
39327
39453
  /** The status of the port */
39328
39454
  status: FloatingIpStatusSchema,
39329
39455
  /** The name of the port */
39330
- name: import_zod21.z.string(),
39456
+ name: import_zod20.z.string(),
39331
39457
  /** Administrative state of the port (true = UP, false = DOWN) */
39332
- admin_state_up: import_zod21.z.boolean(),
39458
+ admin_state_up: import_zod20.z.boolean(),
39333
39459
  /** The ID of the network the port is attached to */
39334
- network_id: import_zod21.z.string(),
39460
+ network_id: import_zod20.z.string(),
39335
39461
  /** The owner of the port device */
39336
- device_owner: import_zod21.z.string(),
39462
+ device_owner: import_zod20.z.string(),
39337
39463
  /** The MAC address of the port */
39338
- mac_address: import_zod21.z.string(),
39464
+ mac_address: import_zod20.z.string(),
39339
39465
  /** The ID of the device the port is attached to */
39340
- device_id: import_zod21.z.string()
39466
+ device_id: import_zod20.z.string()
39341
39467
  });
39342
- var PortForwardingSchema = import_zod21.z.object({
39468
+ var PortForwardingSchema = import_zod20.z.object({
39343
39469
  /** Port forwarding protocol */
39344
- protocol: import_zod21.z.enum([
39470
+ protocol: import_zod20.z.enum([
39345
39471
  "tcp",
39346
39472
  "udp"
39347
39473
  ]),
39348
39474
  /** The internal fixed IP address associated with the port forwarding */
39349
- internal_ip_address: import_zod21.z.string(),
39475
+ internal_ip_address: import_zod20.z.string(),
39350
39476
  /** The internal port number or starting port of the range */
39351
- internal_port: import_zod21.z.number().optional(),
39477
+ internal_port: import_zod20.z.number().optional(),
39352
39478
  /** The internal port range (e.g., "1024:2048") */
39353
- internal_port_range: import_zod21.z.string().optional(),
39479
+ internal_port_range: import_zod20.z.string().optional(),
39354
39480
  /** The internal port ID for the port forwarding (requires floating-ip-port-forwarding-detail extension) */
39355
- internal_port_id: import_zod21.z.string().optional(),
39481
+ internal_port_id: import_zod20.z.string().optional(),
39356
39482
  /** The external port number or starting port of the range */
39357
- external_port: import_zod21.z.number().optional(),
39483
+ external_port: import_zod20.z.number().optional(),
39358
39484
  /** The external port range (e.g., "8000:9000") */
39359
- external_port_range: import_zod21.z.string().optional(),
39485
+ external_port_range: import_zod20.z.string().optional(),
39360
39486
  /** The ID of the port forwarding resource */
39361
- id: import_zod21.z.string(),
39487
+ id: import_zod20.z.string(),
39362
39488
  /** Description of the port forwarding rule (requires floating-ip-port-forwarding-description extension) */
39363
- description: import_zod21.z.string().nullable().optional()
39489
+ description: import_zod20.z.string().nullable().optional()
39364
39490
  });
39365
- var FloatingIpSchema = import_zod21.z.object({
39491
+ var FloatingIpSchema = import_zod20.z.object({
39366
39492
  /** The ID of the router for the floating IP (null if not associated) */
39367
- router_id: import_zod21.z.string().nullable(),
39493
+ router_id: import_zod20.z.string().nullable(),
39368
39494
  /** A human-readable description for the resource */
39369
- description: import_zod21.z.string().nullable().optional(),
39495
+ description: import_zod20.z.string().nullable().optional(),
39370
39496
  /** Whether this is a distributed floating IP (requires floating-ip-distributed extension) */
39371
- distributed: import_zod21.z.boolean().optional(),
39497
+ distributed: import_zod20.z.boolean().optional(),
39372
39498
  /** A valid DNS domain (requires dns-integration extension) */
39373
- dns_domain: import_zod21.z.string().optional(),
39499
+ dns_domain: import_zod20.z.string().optional(),
39374
39500
  /** A valid DNS name (requires dns-integration extension) */
39375
- dns_name: import_zod21.z.string().optional(),
39501
+ dns_name: import_zod20.z.string().optional(),
39376
39502
  /** Time at which the resource was created (UTC ISO8601 format, requires standard-attr-timestamp extension) */
39377
39503
  created_at: ISO8601TimestampSchema.optional(),
39378
39504
  /** Time at which the resource was last updated (UTC ISO8601 format, requires standard-attr-timestamp extension) */
39379
39505
  updated_at: ISO8601TimestampSchema.optional(),
39380
39506
  /** The revision number of the resource (set by server, for concurrency control) */
39381
- revision_number: import_zod21.z.number(),
39507
+ revision_number: import_zod20.z.number(),
39382
39508
  /** The ID of the project that owns the floating IP */
39383
- project_id: import_zod21.z.string(),
39509
+ project_id: import_zod20.z.string(),
39384
39510
  /** The ID of the tenant (deprecated, use project_id) */
39385
- tenant_id: import_zod21.z.string(),
39511
+ tenant_id: import_zod20.z.string(),
39386
39512
  /** The ID of the network associated with the floating IP */
39387
- floating_network_id: import_zod21.z.string(),
39513
+ floating_network_id: import_zod20.z.string(),
39388
39514
  /** The fixed IP address associated with the floating IP (null if not associated) */
39389
- fixed_ip_address: import_zod21.z.string().nullable(),
39515
+ fixed_ip_address: import_zod20.z.string().nullable(),
39390
39516
  /** The floating IP address */
39391
- floating_ip_address: import_zod21.z.string(),
39517
+ floating_ip_address: import_zod20.z.string(),
39392
39518
  /** The ID of the port associated with the floating IP (null if not associated) */
39393
- port_id: import_zod21.z.string().nullable(),
39519
+ port_id: import_zod20.z.string().nullable(),
39394
39520
  /** The ID of the floating IP address */
39395
- id: import_zod21.z.string(),
39521
+ id: import_zod20.z.string(),
39396
39522
  /** The status of the floating IP */
39397
39523
  status: FloatingIpStatusSchema,
39398
39524
  /** The information of the associated port (null if not associated, requires fip-port-details extension) */
39399
39525
  port_details: PortDetailsSchema.nullable().optional(),
39400
39526
  /** The list of tags on the resource (requires standard-attr-tag extension) */
39401
- tags: import_zod21.z.array(import_zod21.z.string()).optional(),
39527
+ tags: import_zod20.z.array(import_zod20.z.string()).optional(),
39402
39528
  /** The associated port forwarding resources for the floating IP (requires expose-port-forwarding-in-fip extension) */
39403
- port_forwardings: import_zod21.z.array(PortForwardingSchema).nullish(),
39529
+ port_forwardings: import_zod20.z.array(PortForwardingSchema).nullish(),
39404
39530
  /** The ID of the QoS policy of the network where this floating IP is plugged (requires qos-fip extension) */
39405
- qos_network_policy_id: import_zod21.z.string().optional(),
39531
+ qos_network_policy_id: import_zod20.z.string().optional(),
39406
39532
  /** The ID of the QoS policy associated with the floating IP (requires qos extension) */
39407
- qos_policy_id: import_zod21.z.string().optional()
39408
- });
39409
- var FloatingIpIdInputSchema = import_zod21.z.object({
39410
- project_id: import_zod21.z.string(),
39411
- floatingip_id: import_zod21.z.string()
39412
- });
39413
- var FloatingIpCreateRequestSchema = import_zod21.z.object({
39414
- project_id: import_zod21.z.string().trim().min(1, "project_id must be a non-empty string"),
39415
- floating_network_id: import_zod21.z.string(),
39416
- fixed_ip_address: import_zod21.z.string().optional(),
39417
- floating_ip_address: import_zod21.z.string().optional(),
39418
- port_id: import_zod21.z.string().optional(),
39419
- subnet_id: import_zod21.z.string().optional(),
39420
- distributed: import_zod21.z.boolean().optional(),
39421
- description: import_zod21.z.string().optional(),
39422
- dns_domain: import_zod21.z.string().optional(),
39423
- dns_name: import_zod21.z.string().optional(),
39424
- qos_policy_id: import_zod21.z.string().optional()
39425
- });
39426
- var FloatingIpUpdateRequestSchema = import_zod21.z.object({
39427
- project_id: import_zod21.z.string(),
39428
- floatingip_id: import_zod21.z.string(),
39429
- port_id: import_zod21.z.string().nullable(),
39430
- fixed_ip_address: import_zod21.z.string().optional(),
39431
- description: import_zod21.z.string().optional(),
39432
- distributed: import_zod21.z.boolean().optional()
39433
- });
39434
- var FloatingIpResponseSchema = import_zod21.z.object({
39533
+ qos_policy_id: import_zod20.z.string().optional()
39534
+ });
39535
+ var FloatingIpIdInputSchema = import_zod20.z.object({
39536
+ project_id: import_zod20.z.string(),
39537
+ floatingip_id: import_zod20.z.string()
39538
+ });
39539
+ var FloatingIpCreateRequestSchema = import_zod20.z.object({
39540
+ project_id: import_zod20.z.string().trim().min(1, "project_id must be a non-empty string"),
39541
+ floating_network_id: import_zod20.z.string(),
39542
+ fixed_ip_address: import_zod20.z.string().optional(),
39543
+ floating_ip_address: import_zod20.z.string().optional(),
39544
+ port_id: import_zod20.z.string().optional(),
39545
+ subnet_id: import_zod20.z.string().optional(),
39546
+ distributed: import_zod20.z.boolean().optional(),
39547
+ description: import_zod20.z.string().optional(),
39548
+ dns_domain: import_zod20.z.string().optional(),
39549
+ dns_name: import_zod20.z.string().optional(),
39550
+ qos_policy_id: import_zod20.z.string().optional()
39551
+ });
39552
+ var FloatingIpUpdateRequestSchema = import_zod20.z.object({
39553
+ project_id: import_zod20.z.string(),
39554
+ floatingip_id: import_zod20.z.string(),
39555
+ port_id: import_zod20.z.string().nullable(),
39556
+ fixed_ip_address: import_zod20.z.string().optional(),
39557
+ description: import_zod20.z.string().optional(),
39558
+ distributed: import_zod20.z.boolean().optional()
39559
+ });
39560
+ var FloatingIpResponseSchema = import_zod20.z.object({
39435
39561
  floatingip: FloatingIpSchema
39436
39562
  });
39437
- var FloatingIpListResponseSchema = import_zod21.z.object({
39563
+ var FloatingIpListResponseSchema = import_zod20.z.object({
39438
39564
  /** A list of floating IP objects */
39439
- floatingips: import_zod21.z.array(FloatingIpSchema)
39565
+ floatingips: import_zod20.z.array(FloatingIpSchema)
39440
39566
  });
39441
- var FloatingIpQueryParametersSchema = import_zod21.z.object({
39567
+ var FloatingIpQueryParametersSchema = import_zod20.z.object({
39442
39568
  /** Project ID for rescoping (required for projectScopedProcedure) */
39443
- project_id: import_zod21.z.string(),
39569
+ project_id: import_zod20.z.string(),
39444
39570
  /** Filter by the ID of the floating IP */
39445
- id: import_zod21.z.string().optional(),
39571
+ id: import_zod20.z.string().optional(),
39446
39572
  /** Filter by the ID of the router for the floating IP */
39447
- router_id: import_zod21.z.string().nullable().optional(),
39573
+ router_id: import_zod20.z.string().nullable().optional(),
39448
39574
  /** Filter by the status of the floating IP */
39449
39575
  status: FloatingIpStatusSchema.optional(),
39450
39576
  /** Filter by the ID of the project that owns the resource */
39451
- tenant_id: import_zod21.z.string().optional(),
39577
+ tenant_id: import_zod20.z.string().optional(),
39452
39578
  /** Filter by the revision number of the resource */
39453
- revision_number: import_zod21.z.number().optional(),
39579
+ revision_number: import_zod20.z.number().optional(),
39454
39580
  /** Filter by the human-readable description of the resource */
39455
- description: import_zod21.z.string().nullable().optional(),
39581
+ description: import_zod20.z.string().nullable().optional(),
39456
39582
  /** Filter by the ID of the network associated with the floating IP */
39457
- floating_network_id: import_zod21.z.string().optional(),
39583
+ floating_network_id: import_zod20.z.string().optional(),
39458
39584
  /** Filter by the fixed IP address associated with the floating IP */
39459
- fixed_ip_address: import_zod21.z.string().optional(),
39585
+ fixed_ip_address: import_zod20.z.string().optional(),
39460
39586
  /** Filter by the floating IP address */
39461
- floating_ip_address: import_zod21.z.string().optional(),
39587
+ floating_ip_address: import_zod20.z.string().optional(),
39462
39588
  /** Filter by the ID of a port associated with the floating IP */
39463
- port_id: import_zod21.z.string().nullable().optional(),
39589
+ port_id: import_zod20.z.string().nullable().optional(),
39464
39590
  /** Sort direction (asc or desc) */
39465
39591
  sort_dir: SortDirSchema.optional(),
39466
39592
  /** Sort key - valid keys: fixed_ip_address, floating_ip_address, floating_network_id, id, router_id, status, tenant_id, project_id */
39467
- sort_key: import_zod21.z.enum([
39593
+ sort_key: import_zod20.z.enum([
39468
39594
  "fixed_ip_address",
39469
39595
  "floating_ip_address",
39470
39596
  "floating_network_id",
@@ -39475,80 +39601,80 @@ var FloatingIpQueryParametersSchema = import_zod21.z.object({
39475
39601
  "project_id"
39476
39602
  ]).optional(),
39477
39603
  /** Filter by tags (comma-separated, resources must match all tags) - requires standard-attr-tag extension */
39478
- tags: import_zod21.z.array(import_zod21.z.string()).optional(),
39604
+ tags: import_zod20.z.array(import_zod20.z.string()).optional(),
39479
39605
  /** Filter by tags with OR logic (comma-separated, resources match any tag) */
39480
- "tags-any": import_zod21.z.string().optional(),
39606
+ "tags-any": import_zod20.z.string().optional(),
39481
39607
  /** Exclude resources with these tags (comma-separated, resources must match all excluded tags) */
39482
- "not-tags": import_zod21.z.string().optional(),
39608
+ "not-tags": import_zod20.z.string().optional(),
39483
39609
  /** Exclude resources with these tags using OR logic (comma-separated, resources match any excluded tag) */
39484
- "not-tags-any": import_zod21.z.string().optional(),
39610
+ "not-tags-any": import_zod20.z.string().optional(),
39485
39611
  /** Specific fields to return (can be repeated) */
39486
- fields: import_zod21.z.union([
39487
- import_zod21.z.string(),
39488
- import_zod21.z.array(import_zod21.z.string())
39612
+ fields: import_zod20.z.union([
39613
+ import_zod20.z.string(),
39614
+ import_zod20.z.array(import_zod20.z.string())
39489
39615
  ]).optional(),
39490
39616
  /** Pagination limit */
39491
- limit: import_zod21.z.number().optional(),
39617
+ limit: import_zod20.z.number().optional(),
39492
39618
  /** Pagination marker (ID of the last item in the previous list) */
39493
- marker: import_zod21.z.string().optional(),
39619
+ marker: import_zod20.z.string().optional(),
39494
39620
  /** Pagination direction (false = ascending, true = descending) */
39495
- page_reverse: import_zod21.z.boolean().optional(),
39621
+ page_reverse: import_zod20.z.boolean().optional(),
39496
39622
  // BFF-side search (filtered in BFF layer, not sent to OpenStack)
39497
- searchTerm: import_zod21.z.string().optional()
39498
- });
39499
- var ExternalNetworksQuerySchema = import_zod21.z.object({
39500
- project_id: import_zod21.z.string(),
39501
- "router:external": import_zod21.z.literal(true).default(true)
39502
- });
39503
- var ExternalNetworkSchema = import_zod21.z.object({
39504
- id: import_zod21.z.string(),
39505
- name: import_zod21.z.string(),
39506
- project_id: import_zod21.z.string(),
39507
- "router:external": import_zod21.z.boolean().optional(),
39508
- shared: import_zod21.z.boolean(),
39623
+ searchTerm: import_zod20.z.string().optional()
39624
+ });
39625
+ var ExternalNetworksQuerySchema = import_zod20.z.object({
39626
+ project_id: import_zod20.z.string(),
39627
+ "router:external": import_zod20.z.literal(true).default(true)
39628
+ });
39629
+ var ExternalNetworkSchema = import_zod20.z.object({
39630
+ id: import_zod20.z.string(),
39631
+ name: import_zod20.z.string(),
39632
+ project_id: import_zod20.z.string(),
39633
+ "router:external": import_zod20.z.boolean().optional(),
39634
+ shared: import_zod20.z.boolean(),
39509
39635
  status: NetworkPortStatusSchema,
39510
39636
  updated_at: ISO8601TimestampSchema.optional(),
39511
- is_default: import_zod21.z.boolean().optional()
39637
+ is_default: import_zod20.z.boolean().optional()
39512
39638
  });
39513
- var ExternalNetworksResponseSchema = import_zod21.z.object({
39514
- networks: import_zod21.z.array(ExternalNetworkSchema)
39639
+ var ExternalNetworksResponseSchema = import_zod20.z.object({
39640
+ networks: import_zod20.z.array(ExternalNetworkSchema)
39515
39641
  });
39516
- var DnsDomainSchema = import_zod21.z.object({
39517
- id: import_zod21.z.string(),
39518
- name: import_zod21.z.string()
39642
+ var DnsDomainSchema = import_zod20.z.object({
39643
+ id: import_zod20.z.string(),
39644
+ name: import_zod20.z.string()
39519
39645
  });
39520
- var DnsDomainResponseSchema = import_zod21.z.object({
39521
- zones: import_zod21.z.array(DnsDomainSchema)
39646
+ var DnsDomainResponseSchema = import_zod20.z.object({
39647
+ zones: import_zod20.z.array(DnsDomainSchema)
39522
39648
  });
39523
- var AvailablePortsQuerySchema = import_zod21.z.object({
39524
- project_id: import_zod21.z.string(),
39649
+ var AvailablePortsQuerySchema = import_zod20.z.object({
39650
+ project_id: import_zod20.z.string(),
39525
39651
  /** Only ACTIVE ports are eligible for floating IP association */
39526
- status: import_zod21.z.literal("ACTIVE").default("ACTIVE"),
39652
+ status: import_zod20.z.literal("ACTIVE").default("ACTIVE"),
39527
39653
  /** Only administratively UP ports are eligible for floating IP association */
39528
- admin_state_up: import_zod21.z.literal(true).default(true)
39654
+ admin_state_up: import_zod20.z.literal(true).default(true)
39529
39655
  });
39530
- var AvailablePortSchema = import_zod21.z.object({
39656
+ var AvailablePortSchema = import_zod20.z.object({
39531
39657
  /** The ID of the port */
39532
- id: import_zod21.z.string(),
39658
+ id: import_zod20.z.string(),
39533
39659
  /** Human-readable name of the port */
39534
- name: import_zod21.z.string().nullable().optional(),
39660
+ name: import_zod20.z.string().nullable().optional(),
39535
39661
  /** List of fixed IPs assigned to the port, each entry pairs an IP address with its subnet. */
39536
- fixed_ips: import_zod21.z.array(import_zod21.z.object({
39662
+ fixed_ips: import_zod20.z.array(import_zod20.z.object({
39537
39663
  /** The fixed IP address assigned to the port */
39538
- ip_address: import_zod21.z.string(),
39664
+ ip_address: import_zod20.z.string(),
39539
39665
  /** The ID of the subnet the IP belongs to */
39540
- subnet_id: import_zod21.z.string().optional()
39666
+ subnet_id: import_zod20.z.string().optional()
39541
39667
  })).optional()
39542
39668
  });
39543
- var AvailablePortsResponseSchema = import_zod21.z.object({
39544
- ports: import_zod21.z.array(AvailablePortSchema)
39669
+ var AvailablePortsResponseSchema = import_zod20.z.object({
39670
+ ports: import_zod20.z.array(AvailablePortSchema)
39545
39671
  });
39546
39672
 
39547
39673
  // src/server/Network/helpers/errorHandling.ts
39548
- var import_server23 = require("@trpc/server");
39674
+ var import_server24 = require("@trpc/server");
39549
39675
 
39550
39676
  // src/server/Network/helpers/index.ts
39551
- var import_server22 = require("@trpc/server");
39677
+ var import_server23 = require("@trpc/server");
39552
39678
  var HTTP_STATUS_ERROR_MAP = {
39553
39679
  400: "BAD_REQUEST",
39554
39680
  401: "UNAUTHORIZED",
@@ -39568,7 +39694,7 @@ var parseOrThrow = /* @__PURE__ */ __name((schema, data, context) => {
39568
39694
  const parsed = schema.safeParse(data);
39569
39695
  if (!parsed.success) {
39570
39696
  console.error(`Zod Parsing Error in ${context}:`, parsed.error.issues);
39571
- throw new import_server22.TRPCError({
39697
+ throw new import_server23.TRPCError({
39572
39698
  code: "PARSE_ERROR",
39573
39699
  message: `Failed to parse response in ${context}`
39574
39700
  });
@@ -39578,27 +39704,27 @@ var parseOrThrow = /* @__PURE__ */ __name((schema, data, context) => {
39578
39704
 
39579
39705
  // src/server/Network/helpers/errorHandling.ts
39580
39706
  var DEFAULT_HANDLERS = {
39581
- 400: (response, resourceLabel) => new import_server23.TRPCError({
39707
+ 400: (response, resourceLabel) => new import_server24.TRPCError({
39582
39708
  code: HTTP_STATUS_ERROR_MAP[400],
39583
39709
  message: `Invalid request data for ${resourceLabel}: ${response.statusText || "Unknown error"}`
39584
39710
  }),
39585
- 401: (response, resourceLabel) => new import_server23.TRPCError({
39711
+ 401: (response, resourceLabel) => new import_server24.TRPCError({
39586
39712
  code: HTTP_STATUS_ERROR_MAP[401],
39587
39713
  message: `Unauthorized access to ${resourceLabel}: ${response.statusText || "Unknown error"}`
39588
39714
  }),
39589
- 403: (response, resourceLabel) => new import_server23.TRPCError({
39715
+ 403: (response, resourceLabel) => new import_server24.TRPCError({
39590
39716
  code: HTTP_STATUS_ERROR_MAP[403],
39591
39717
  message: `Access forbidden to ${resourceLabel}: ${response.statusText || "Unknown error"}`
39592
39718
  }),
39593
- 404: (response, resourceLabel) => new import_server23.TRPCError({
39719
+ 404: (response, resourceLabel) => new import_server24.TRPCError({
39594
39720
  code: HTTP_STATUS_ERROR_MAP[404],
39595
39721
  message: `${resourceLabel} not found: ${response.statusText || "Unknown error"}`
39596
39722
  }),
39597
- 409: (response, resourceLabel) => new import_server23.TRPCError({
39723
+ 409: (response, resourceLabel) => new import_server24.TRPCError({
39598
39724
  code: HTTP_STATUS_ERROR_MAP[409],
39599
39725
  message: `Conflict - ${resourceLabel} is in use: ${response.statusText || "Unknown error"}`
39600
39726
  }),
39601
- 412: (response, resourceLabel) => new import_server23.TRPCError({
39727
+ 412: (response, resourceLabel) => new import_server24.TRPCError({
39602
39728
  code: HTTP_STATUS_ERROR_MAP[412],
39603
39729
  message: `Precondition failed - revision number mismatch in ${resourceLabel}: ${response.statusText || "Unknown error"}`
39604
39730
  })
@@ -39613,7 +39739,7 @@ var ErrorHandler = /* @__PURE__ */ __name((resourceName, customHandlers) => {
39613
39739
  if (response.status && handlers[response.status]) {
39614
39740
  return handlers[response.status](response, resourceLabel);
39615
39741
  }
39616
- return new import_server23.TRPCError({
39742
+ return new import_server24.TRPCError({
39617
39743
  code: DEFAULT_ERROR_NAME,
39618
39744
  message: `Failed to process ${resourceLabel}: ${response.statusText || "Unknown error"}`
39619
39745
  });
@@ -39663,7 +39789,7 @@ var floatingIpRouter = {
39663
39789
  const token = ctx.openstack?.getToken();
39664
39790
  const projectId = token?.tokenData.project?.id;
39665
39791
  if (!projectId) {
39666
- throw new import_server24.TRPCError({
39792
+ throw new import_server25.TRPCError({
39667
39793
  code: "UNAUTHORIZED",
39668
39794
  message: "No project scope in session"
39669
39795
  });
@@ -39714,7 +39840,7 @@ var floatingIpRouter = {
39714
39840
  return withErrorHandling3(async () => {
39715
39841
  const { floatingip_id } = input;
39716
39842
  const network = getNetworkService(ctx);
39717
- const encodedId = (0, import_signal_openstack7.validateAndEncodeResourceId)(floatingip_id, "Floating IP");
39843
+ const encodedId = (0, import_signal_openstack8.validateAndEncodeResourceId)(floatingip_id, "Floating IP");
39718
39844
  const response = await network.get(`${FLOATING_IPS_BASE_URL}/${encodedId}`);
39719
39845
  if (!response.ok) {
39720
39846
  throw FloatingIpErrorHandlers.get(response, floatingip_id);
@@ -39741,7 +39867,7 @@ var floatingIpRouter = {
39741
39867
  }
39742
39868
  }
39743
39869
  };
39744
- const encodedId = (0, import_signal_openstack7.validateAndEncodeResourceId)(floatingip_id, "Floating IP");
39870
+ const encodedId = (0, import_signal_openstack8.validateAndEncodeResourceId)(floatingip_id, "Floating IP");
39745
39871
  const response = await network.put(`${FLOATING_IPS_BASE_URL}/${encodedId}`, requestBody);
39746
39872
  if (!response.ok) {
39747
39873
  throw FloatingIpErrorHandlers.update(response, floatingip_id);
@@ -39754,7 +39880,7 @@ var floatingIpRouter = {
39754
39880
  return withErrorHandling3(async () => {
39755
39881
  const { floatingip_id } = input;
39756
39882
  const network = getNetworkService(ctx);
39757
- const encodedId = (0, import_signal_openstack7.validateAndEncodeResourceId)(floatingip_id, "Floating IP");
39883
+ const encodedId = (0, import_signal_openstack8.validateAndEncodeResourceId)(floatingip_id, "Floating IP");
39758
39884
  const response = await network.del(`${FLOATING_IPS_BASE_URL}/${encodedId}`);
39759
39885
  if (!response.ok) {
39760
39886
  throw FloatingIpErrorHandlers.delete(response, floatingip_id);
@@ -39803,115 +39929,115 @@ var floatingIpRouter = {
39803
39929
  };
39804
39930
 
39805
39931
  // src/server/Network/types/securityGroup.ts
39806
- var import_zod22 = require("zod");
39807
- var securityGroupRuleSchema = import_zod22.z.object({
39808
- id: import_zod22.z.string(),
39809
- direction: import_zod22.z.enum([
39932
+ var import_zod21 = require("zod");
39933
+ var securityGroupRuleSchema = import_zod21.z.object({
39934
+ id: import_zod21.z.string(),
39935
+ direction: import_zod21.z.enum([
39810
39936
  "ingress",
39811
39937
  "egress"
39812
39938
  ]).optional(),
39813
- ethertype: import_zod22.z.enum([
39939
+ ethertype: import_zod21.z.enum([
39814
39940
  "IPv4",
39815
39941
  "IPv6"
39816
39942
  ]).optional(),
39817
- description: import_zod22.z.string().nullable().optional(),
39818
- security_group_id: import_zod22.z.string().optional(),
39819
- protocol: import_zod22.z.string().nullable().optional(),
39820
- port_range_min: import_zod22.z.number().nullable().optional(),
39821
- port_range_max: import_zod22.z.number().nullable().optional(),
39822
- remote_ip_prefix: import_zod22.z.string().nullable().optional(),
39823
- remote_group_id: import_zod22.z.string().nullable().optional(),
39824
- remote_address_group_id: import_zod22.z.string().nullable().optional(),
39825
- tenant_id: import_zod22.z.string().nullable().optional(),
39826
- project_id: import_zod22.z.string().nullable().optional(),
39827
- revision_number: import_zod22.z.number().optional(),
39828
- tags: import_zod22.z.array(import_zod22.z.string()).optional(),
39829
- created_at: import_zod22.z.string().optional(),
39830
- updated_at: import_zod22.z.string().nullable().optional()
39943
+ description: import_zod21.z.string().nullable().optional(),
39944
+ security_group_id: import_zod21.z.string().optional(),
39945
+ protocol: import_zod21.z.string().nullable().optional(),
39946
+ port_range_min: import_zod21.z.number().nullable().optional(),
39947
+ port_range_max: import_zod21.z.number().nullable().optional(),
39948
+ remote_ip_prefix: import_zod21.z.string().nullable().optional(),
39949
+ remote_group_id: import_zod21.z.string().nullable().optional(),
39950
+ remote_address_group_id: import_zod21.z.string().nullable().optional(),
39951
+ tenant_id: import_zod21.z.string().nullable().optional(),
39952
+ project_id: import_zod21.z.string().nullable().optional(),
39953
+ revision_number: import_zod21.z.number().optional(),
39954
+ tags: import_zod21.z.array(import_zod21.z.string()).optional(),
39955
+ created_at: import_zod21.z.string().optional(),
39956
+ updated_at: import_zod21.z.string().nullable().optional()
39831
39957
  });
39832
- var securityGroupSchema = import_zod22.z.object({
39833
- id: import_zod22.z.string(),
39834
- name: import_zod22.z.string().nullable().optional(),
39835
- description: import_zod22.z.string().nullable().optional(),
39836
- tenant_id: import_zod22.z.string().nullable().optional(),
39837
- project_id: import_zod22.z.string().nullable().optional(),
39838
- stateful: import_zod22.z.boolean().optional(),
39839
- shared: import_zod22.z.boolean().optional(),
39840
- tags: import_zod22.z.array(import_zod22.z.string()).optional(),
39841
- security_group_rules: import_zod22.z.array(securityGroupRuleSchema).optional(),
39842
- revision_number: import_zod22.z.number().optional(),
39843
- created_at: import_zod22.z.string().optional(),
39844
- updated_at: import_zod22.z.string().nullable().optional()
39845
- });
39846
- var securityGroupsResponseSchema = import_zod22.z.object({
39847
- security_groups: import_zod22.z.array(securityGroupSchema)
39848
- });
39849
- var securityGroupResponseSchema = import_zod22.z.object({
39958
+ var securityGroupSchema = import_zod21.z.object({
39959
+ id: import_zod21.z.string(),
39960
+ name: import_zod21.z.string().nullable().optional(),
39961
+ description: import_zod21.z.string().nullable().optional(),
39962
+ tenant_id: import_zod21.z.string().nullable().optional(),
39963
+ project_id: import_zod21.z.string().nullable().optional(),
39964
+ stateful: import_zod21.z.boolean().optional(),
39965
+ shared: import_zod21.z.boolean().optional(),
39966
+ tags: import_zod21.z.array(import_zod21.z.string()).optional(),
39967
+ security_group_rules: import_zod21.z.array(securityGroupRuleSchema).optional(),
39968
+ revision_number: import_zod21.z.number().optional(),
39969
+ created_at: import_zod21.z.string().optional(),
39970
+ updated_at: import_zod21.z.string().nullable().optional()
39971
+ });
39972
+ var securityGroupsResponseSchema = import_zod21.z.object({
39973
+ security_groups: import_zod21.z.array(securityGroupSchema)
39974
+ });
39975
+ var securityGroupResponseSchema = import_zod21.z.object({
39850
39976
  security_group: securityGroupSchema
39851
39977
  });
39852
- var securityGroupRuleResponseSchema = import_zod22.z.object({
39978
+ var securityGroupRuleResponseSchema = import_zod21.z.object({
39853
39979
  security_group_rule: securityGroupRuleSchema
39854
39980
  });
39855
39981
  var listSecurityGroupsInputSchema = projectScopedInputSchema.extend({
39856
39982
  // Sorting
39857
- sort_key: import_zod22.z.string().optional(),
39983
+ sort_key: import_zod21.z.string().optional(),
39858
39984
  sort_dir: SortDirSchema.optional(),
39859
39985
  // Basic filtering
39860
- name: import_zod22.z.string().optional(),
39861
- description: import_zod22.z.string().optional(),
39862
- shared: import_zod22.z.boolean().optional(),
39986
+ name: import_zod21.z.string().optional(),
39987
+ description: import_zod21.z.string().optional(),
39988
+ shared: import_zod21.z.boolean().optional(),
39863
39989
  // Tag-based filtering (string values follow Neutron semantics)
39864
- tags: import_zod22.z.string().optional(),
39865
- tags_any: import_zod22.z.string().optional(),
39866
- not_tags: import_zod22.z.string().optional(),
39867
- not_tags_any: import_zod22.z.string().optional(),
39990
+ tags: import_zod21.z.string().optional(),
39991
+ tags_any: import_zod21.z.string().optional(),
39992
+ not_tags: import_zod21.z.string().optional(),
39993
+ not_tags_any: import_zod21.z.string().optional(),
39868
39994
  // Filtered in the BFF layer, not forwarded to Neutron
39869
- stateful: import_zod22.z.boolean().optional(),
39995
+ stateful: import_zod21.z.boolean().optional(),
39870
39996
  // BFF-side search (filtered in BFF layer, not sent to OpenStack)
39871
- searchTerm: import_zod22.z.string().optional()
39997
+ searchTerm: import_zod21.z.string().optional()
39872
39998
  });
39873
39999
  var getSecurityGroupByIdInputSchema = projectScopedInputSchema.extend({
39874
- securityGroupId: import_zod22.z.string()
40000
+ securityGroupId: import_zod21.z.string()
39875
40001
  });
39876
40002
  var createSecurityGroupInputSchema = projectScopedInputSchema.extend({
39877
- name: import_zod22.z.string().min(1, "Name is required"),
39878
- description: import_zod22.z.string().optional(),
39879
- stateful: import_zod22.z.boolean().optional()
40003
+ name: import_zod21.z.string().min(1, "Name is required"),
40004
+ description: import_zod21.z.string().optional(),
40005
+ stateful: import_zod21.z.boolean().optional()
39880
40006
  });
39881
40007
  var deleteSecurityGroupInputSchema = projectScopedInputSchema.extend({
39882
- securityGroupId: import_zod22.z.string()
40008
+ securityGroupId: import_zod21.z.string()
39883
40009
  });
39884
40010
  var updateSecurityGroupInputSchema = projectScopedInputSchema.extend({
39885
- securityGroupId: import_zod22.z.string(),
39886
- name: import_zod22.z.string().min(1, "Name is required").optional(),
39887
- description: import_zod22.z.string().optional(),
39888
- stateful: import_zod22.z.boolean().optional()
40011
+ securityGroupId: import_zod21.z.string(),
40012
+ name: import_zod21.z.string().min(1, "Name is required").optional(),
40013
+ description: import_zod21.z.string().optional(),
40014
+ stateful: import_zod21.z.boolean().optional()
39889
40015
  });
39890
40016
  var deleteSecurityGroupRuleInputSchema = projectScopedInputSchema.extend({
39891
- ruleId: import_zod22.z.string()
40017
+ ruleId: import_zod21.z.string()
39892
40018
  });
39893
40019
  var createSecurityGroupRuleInputSchema = projectScopedInputSchema.extend({
39894
- security_group_id: import_zod22.z.string(),
39895
- direction: import_zod22.z.enum([
40020
+ security_group_id: import_zod21.z.string(),
40021
+ direction: import_zod21.z.enum([
39896
40022
  "ingress",
39897
40023
  "egress"
39898
40024
  ]),
39899
- ethertype: import_zod22.z.enum([
40025
+ ethertype: import_zod21.z.enum([
39900
40026
  "IPv4",
39901
40027
  "IPv6"
39902
40028
  ]).default("IPv4"),
39903
- description: import_zod22.z.string().optional(),
39904
- protocol: import_zod22.z.string().nullable().optional(),
39905
- port_range_min: import_zod22.z.number().int().max(65535).nullable().optional(),
39906
- port_range_max: import_zod22.z.number().int().max(65535).nullable().optional(),
40029
+ description: import_zod21.z.string().optional(),
40030
+ protocol: import_zod21.z.string().nullable().optional(),
40031
+ port_range_min: import_zod21.z.number().int().max(65535).nullable().optional(),
40032
+ port_range_max: import_zod21.z.number().int().max(65535).nullable().optional(),
39907
40033
  // Transform empty strings to undefined for proper validation
39908
- remote_ip_prefix: import_zod22.z.string().nullable().optional().transform((val) => val === "" ? void 0 : val),
39909
- remote_group_id: import_zod22.z.string().nullable().optional().transform((val) => val === "" ? void 0 : val),
39910
- remote_address_group_id: import_zod22.z.string().nullable().optional().transform((val) => val === "" ? void 0 : val)
40034
+ remote_ip_prefix: import_zod21.z.string().nullable().optional().transform((val) => val === "" ? void 0 : val),
40035
+ remote_group_id: import_zod21.z.string().nullable().optional().transform((val) => val === "" ? void 0 : val),
40036
+ remote_address_group_id: import_zod21.z.string().nullable().optional().transform((val) => val === "" ? void 0 : val)
39911
40037
  });
39912
40038
 
39913
40039
  // src/server/Network/helpers/securityGroupHelpers.ts
39914
- var import_server25 = require("@trpc/server");
40040
+ var import_server26 = require("@trpc/server");
39915
40041
  var SecurityGroupErrorHandlers = {
39916
40042
  /**
39917
40043
  * Handles errors specific to security group list operations
@@ -39921,17 +40047,17 @@ var SecurityGroupErrorHandlers = {
39921
40047
  list: /* @__PURE__ */ __name((response) => {
39922
40048
  switch (response.status) {
39923
40049
  case 401:
39924
- return new import_server25.TRPCError({
40050
+ return new import_server26.TRPCError({
39925
40051
  code: HTTP_STATUS_ERROR_MAP[401],
39926
40052
  message: "Unauthorized access"
39927
40053
  });
39928
40054
  case 403:
39929
- return new import_server25.TRPCError({
40055
+ return new import_server26.TRPCError({
39930
40056
  code: HTTP_STATUS_ERROR_MAP[403],
39931
40057
  message: `Access forbidden: ${response.statusText || "Unknown error"}`
39932
40058
  });
39933
40059
  default:
39934
- return new import_server25.TRPCError({
40060
+ return new import_server26.TRPCError({
39935
40061
  code: DEFAULT_ERROR_NAME,
39936
40062
  message: `Failed to list security groups: ${response.statusText || "Unknown error"}`
39937
40063
  });
@@ -39946,22 +40072,22 @@ var SecurityGroupErrorHandlers = {
39946
40072
  getById: /* @__PURE__ */ __name((response, securityGroupId) => {
39947
40073
  switch (response.status) {
39948
40074
  case 401:
39949
- return new import_server25.TRPCError({
40075
+ return new import_server26.TRPCError({
39950
40076
  code: HTTP_STATUS_ERROR_MAP[401],
39951
40077
  message: "Unauthorized access"
39952
40078
  });
39953
40079
  case 403:
39954
- return new import_server25.TRPCError({
40080
+ return new import_server26.TRPCError({
39955
40081
  code: HTTP_STATUS_ERROR_MAP[403],
39956
40082
  message: `Access forbidden: ${response.statusText || "Unknown error"}`
39957
40083
  });
39958
40084
  case 404:
39959
- return new import_server25.TRPCError({
40085
+ return new import_server26.TRPCError({
39960
40086
  code: HTTP_STATUS_ERROR_MAP[404],
39961
40087
  message: `Security group not found: ${securityGroupId}`
39962
40088
  });
39963
40089
  default:
39964
- return new import_server25.TRPCError({
40090
+ return new import_server26.TRPCError({
39965
40091
  code: DEFAULT_ERROR_NAME,
39966
40092
  message: `Failed to fetch security group: ${response.statusText || "Unknown error"}`
39967
40093
  });
@@ -39975,32 +40101,32 @@ var SecurityGroupErrorHandlers = {
39975
40101
  create: /* @__PURE__ */ __name((response) => {
39976
40102
  switch (response.status) {
39977
40103
  case 401:
39978
- return new import_server25.TRPCError({
40104
+ return new import_server26.TRPCError({
39979
40105
  code: HTTP_STATUS_ERROR_MAP[401],
39980
40106
  message: "Unauthorized access"
39981
40107
  });
39982
40108
  case 403:
39983
- return new import_server25.TRPCError({
40109
+ return new import_server26.TRPCError({
39984
40110
  code: HTTP_STATUS_ERROR_MAP[403],
39985
40111
  message: `Access forbidden: ${response.statusText || "Unknown error"}`
39986
40112
  });
39987
40113
  case 409:
39988
- return new import_server25.TRPCError({
40114
+ return new import_server26.TRPCError({
39989
40115
  code: HTTP_STATUS_ERROR_MAP[409],
39990
40116
  message: `Conflict: ${response.statusText || "Security group already exists"}`
39991
40117
  });
39992
40118
  case 413:
39993
- return new import_server25.TRPCError({
40119
+ return new import_server26.TRPCError({
39994
40120
  code: "BAD_REQUEST",
39995
40121
  message: `Quota exceeded for security groups. Please delete an existing security group or contact your administrator to increase your quota.`
39996
40122
  });
39997
40123
  case 400:
39998
- return new import_server25.TRPCError({
40124
+ return new import_server26.TRPCError({
39999
40125
  code: "BAD_REQUEST",
40000
40126
  message: `Invalid request: ${response.statusText || "Unknown error"}`
40001
40127
  });
40002
40128
  default:
40003
- return new import_server25.TRPCError({
40129
+ return new import_server26.TRPCError({
40004
40130
  code: "INTERNAL_SERVER_ERROR",
40005
40131
  message: `Failed to create security group: ${response.statusText || "Unknown error"}`
40006
40132
  });
@@ -40015,22 +40141,22 @@ var SecurityGroupErrorHandlers = {
40015
40141
  delete: /* @__PURE__ */ __name((response, securityGroupId) => {
40016
40142
  switch (response.status) {
40017
40143
  case 401:
40018
- return new import_server25.TRPCError({
40144
+ return new import_server26.TRPCError({
40019
40145
  code: HTTP_STATUS_ERROR_MAP[401],
40020
40146
  message: "Unauthorized access"
40021
40147
  });
40022
40148
  case 404:
40023
- return new import_server25.TRPCError({
40149
+ return new import_server26.TRPCError({
40024
40150
  code: HTTP_STATUS_ERROR_MAP[404],
40025
40151
  message: `Security group not found: ${securityGroupId}`
40026
40152
  });
40027
40153
  case 409:
40028
- return new import_server25.TRPCError({
40154
+ return new import_server26.TRPCError({
40029
40155
  code: HTTP_STATUS_ERROR_MAP[409],
40030
40156
  message: "Cannot delete security group because it is in use by one or more ports. Please remove all associations before deleting."
40031
40157
  });
40032
40158
  default:
40033
- return new import_server25.TRPCError({
40159
+ return new import_server26.TRPCError({
40034
40160
  code: DEFAULT_ERROR_NAME,
40035
40161
  message: `Failed to delete security group: ${response.statusText || "Unknown error"}`
40036
40162
  });
@@ -40045,39 +40171,39 @@ var SecurityGroupErrorHandlers = {
40045
40171
  update: /* @__PURE__ */ __name((response, securityGroupId) => {
40046
40172
  const errorMessage = response.statusText || "";
40047
40173
  if (errorMessage.toLowerCase().includes("stateful") && errorMessage.toLowerCase().includes("in use")) {
40048
- return new import_server25.TRPCError({
40174
+ return new import_server26.TRPCError({
40049
40175
  code: "CONFLICT",
40050
40176
  message: "Cannot update the 'stateful' attribute because this security group is in use by one or more ports."
40051
40177
  });
40052
40178
  }
40053
40179
  switch (response.status) {
40054
40180
  case 401:
40055
- return new import_server25.TRPCError({
40181
+ return new import_server26.TRPCError({
40056
40182
  code: HTTP_STATUS_ERROR_MAP[401],
40057
40183
  message: "Unauthorized access"
40058
40184
  });
40059
40185
  case 403:
40060
- return new import_server25.TRPCError({
40186
+ return new import_server26.TRPCError({
40061
40187
  code: HTTP_STATUS_ERROR_MAP[403],
40062
40188
  message: `Access forbidden: ${errorMessage || "Unknown error"}`
40063
40189
  });
40064
40190
  case 404:
40065
- return new import_server25.TRPCError({
40191
+ return new import_server26.TRPCError({
40066
40192
  code: HTTP_STATUS_ERROR_MAP[404],
40067
40193
  message: `Security group not found: ${securityGroupId}`
40068
40194
  });
40069
40195
  case 409:
40070
- return new import_server25.TRPCError({
40196
+ return new import_server26.TRPCError({
40071
40197
  code: HTTP_STATUS_ERROR_MAP[409],
40072
40198
  message: `Conflict: ${errorMessage || "Security group conflict"}`
40073
40199
  });
40074
40200
  case 400:
40075
- return new import_server25.TRPCError({
40201
+ return new import_server26.TRPCError({
40076
40202
  code: HTTP_STATUS_ERROR_MAP[400],
40077
40203
  message: `Invalid request: ${errorMessage || "Unknown error"}`
40078
40204
  });
40079
40205
  default:
40080
- return new import_server25.TRPCError({
40206
+ return new import_server26.TRPCError({
40081
40207
  code: DEFAULT_ERROR_NAME,
40082
40208
  message: `Failed to update security group: ${errorMessage || "Unknown error"}`
40083
40209
  });
@@ -40095,48 +40221,48 @@ var SecurityGroupRuleErrorHandlers = {
40095
40221
  switch (response.status) {
40096
40222
  case 400:
40097
40223
  if (statusText.toLowerCase().includes("cidr")) {
40098
- return new import_server25.TRPCError({
40224
+ return new import_server26.TRPCError({
40099
40225
  code: "BAD_REQUEST",
40100
40226
  message: "Invalid CIDR format. Please provide a valid IP address block (e.g., 0.0.0.0/0)"
40101
40227
  });
40102
40228
  }
40103
40229
  if (statusText.toLowerCase().includes("port")) {
40104
- return new import_server25.TRPCError({
40230
+ return new import_server26.TRPCError({
40105
40231
  code: "BAD_REQUEST",
40106
40232
  message: "Invalid port range. Ports must be between 1 and 65535, and min must be <= max"
40107
40233
  });
40108
40234
  }
40109
- return new import_server25.TRPCError({
40235
+ return new import_server26.TRPCError({
40110
40236
  code: "BAD_REQUEST",
40111
40237
  message: `Invalid request: ${statusText}`
40112
40238
  });
40113
40239
  case 401:
40114
- return new import_server25.TRPCError({
40240
+ return new import_server26.TRPCError({
40115
40241
  code: "UNAUTHORIZED",
40116
40242
  message: "Unauthorized access"
40117
40243
  });
40118
40244
  case 403:
40119
- return new import_server25.TRPCError({
40245
+ return new import_server26.TRPCError({
40120
40246
  code: "FORBIDDEN",
40121
40247
  message: `Access forbidden: ${statusText}`
40122
40248
  });
40123
40249
  case 404:
40124
- return new import_server25.TRPCError({
40250
+ return new import_server26.TRPCError({
40125
40251
  code: "NOT_FOUND",
40126
40252
  message: "Security group not found"
40127
40253
  });
40128
40254
  case 409:
40129
- return new import_server25.TRPCError({
40255
+ return new import_server26.TRPCError({
40130
40256
  code: "CONFLICT",
40131
40257
  message: "A rule with these parameters already exists in this security group"
40132
40258
  });
40133
40259
  case 413:
40134
- return new import_server25.TRPCError({
40260
+ return new import_server26.TRPCError({
40135
40261
  code: "BAD_REQUEST",
40136
40262
  message: "Quota exceeded for security group rules. Please delete existing rules or contact your administrator."
40137
40263
  });
40138
40264
  default:
40139
- return new import_server25.TRPCError({
40265
+ return new import_server26.TRPCError({
40140
40266
  code: "INTERNAL_SERVER_ERROR",
40141
40267
  message: `Failed to create security group rule: ${statusText}`
40142
40268
  });
@@ -40155,22 +40281,22 @@ var SecurityGroupRuleErrorHandlers = {
40155
40281
  delete: /* @__PURE__ */ __name((response, ruleId) => {
40156
40282
  switch (response.status) {
40157
40283
  case 401:
40158
- return new import_server25.TRPCError({
40284
+ return new import_server26.TRPCError({
40159
40285
  code: "UNAUTHORIZED",
40160
40286
  message: "Unauthorized access"
40161
40287
  });
40162
40288
  case 404:
40163
- return new import_server25.TRPCError({
40289
+ return new import_server26.TRPCError({
40164
40290
  code: "NOT_FOUND",
40165
40291
  message: `Security group rule not found: ${ruleId}`
40166
40292
  });
40167
40293
  case 412:
40168
- return new import_server25.TRPCError({
40294
+ return new import_server26.TRPCError({
40169
40295
  code: "PRECONDITION_FAILED",
40170
40296
  message: `Cannot delete security group rule: precondition failed`
40171
40297
  });
40172
40298
  default:
40173
- return new import_server25.TRPCError({
40299
+ return new import_server26.TRPCError({
40174
40300
  code: "INTERNAL_SERVER_ERROR",
40175
40301
  message: `Failed to delete security group rule: ${response.statusText || "Unknown error"}`
40176
40302
  });
@@ -40181,7 +40307,7 @@ var parseOpenStackResponse = /* @__PURE__ */ __name((data, schema, operation, er
40181
40307
  const parsed = schema.safeParse(data);
40182
40308
  if (!parsed.success) {
40183
40309
  console.error(`Zod Parsing Error in ${operation}:`, parsed.error.format());
40184
- throw new import_server25.TRPCError({
40310
+ throw new import_server26.TRPCError({
40185
40311
  code: "INTERNAL_SERVER_ERROR",
40186
40312
  message: errorMessage
40187
40313
  });
@@ -40240,7 +40366,7 @@ var sortSecurityGroups = /* @__PURE__ */ __name((items, sortKey, sortDir = "asc"
40240
40366
  }, "sortSecurityGroups");
40241
40367
 
40242
40368
  // src/server/Network/routers/securityGroupRouter.ts
40243
- var import_signal_openstack8 = __toESM(require_esm());
40369
+ var import_signal_openstack9 = __toESM(require_esm());
40244
40370
  var SECURITY_GROUPS_BASE_URL = "v2.0/security-groups";
40245
40371
  var LIST_SECURITY_GROUPS_QUERY_KEY_MAP = {
40246
40372
  tags_any: "tags-any",
@@ -40296,7 +40422,7 @@ var securityGroupRouter = {
40296
40422
  return withErrorHandling3(async () => {
40297
40423
  const { securityGroupId } = input;
40298
40424
  const network = getNetworkService(ctx);
40299
- const encodedId = (0, import_signal_openstack8.validateAndEncodeResourceId)(securityGroupId, "Security group");
40425
+ const encodedId = (0, import_signal_openstack9.validateAndEncodeResourceId)(securityGroupId, "Security group");
40300
40426
  const response = await network.get(`${SECURITY_GROUPS_BASE_URL}/${encodedId}`);
40301
40427
  if (!response.ok) {
40302
40428
  throw SecurityGroupErrorHandlers.getById(response, securityGroupId);
@@ -40332,7 +40458,7 @@ var securityGroupRouter = {
40332
40458
  return withErrorHandling3(async () => {
40333
40459
  const { securityGroupId } = input;
40334
40460
  const network = getNetworkService(ctx);
40335
- const encodedId = (0, import_signal_openstack8.validateAndEncodeResourceId)(securityGroupId, "Security group");
40461
+ const encodedId = (0, import_signal_openstack9.validateAndEncodeResourceId)(securityGroupId, "Security group");
40336
40462
  const response = await network.del(`${SECURITY_GROUPS_BASE_URL}/${encodedId}`);
40337
40463
  if (!response?.ok) {
40338
40464
  throw SecurityGroupErrorHandlers.delete(response, securityGroupId);
@@ -40356,7 +40482,7 @@ var securityGroupRouter = {
40356
40482
  }
40357
40483
  }
40358
40484
  };
40359
- const encodedId = (0, import_signal_openstack8.validateAndEncodeResourceId)(securityGroupId, "Security group");
40485
+ const encodedId = (0, import_signal_openstack9.validateAndEncodeResourceId)(securityGroupId, "Security group");
40360
40486
  const response = await network.put(`${SECURITY_GROUPS_BASE_URL}/${encodedId}`, requestBody);
40361
40487
  if (!response.ok) {
40362
40488
  throw SecurityGroupErrorHandlers.update(response, securityGroupId);
@@ -40368,14 +40494,14 @@ var securityGroupRouter = {
40368
40494
  };
40369
40495
 
40370
40496
  // src/server/Network/routers/securityGroupRuleRouter.ts
40371
- var import_signal_openstack9 = __toESM(require_esm());
40497
+ var import_signal_openstack10 = __toESM(require_esm());
40372
40498
  var SECURITY_GROUP_RULES_BASE_URL = "v2.0/security-group-rules";
40373
40499
  var securityGroupRuleRouter = {
40374
40500
  delete: projectScopedProcedure.input(deleteSecurityGroupRuleInputSchema).mutation(async ({ input, ctx }) => {
40375
40501
  return withErrorHandling3(async () => {
40376
40502
  const { ruleId } = input;
40377
40503
  const network = getNetworkService(ctx);
40378
- const encodedRuleId = (0, import_signal_openstack9.validateAndEncodeResourceId)(ruleId, "Security group rule");
40504
+ const encodedRuleId = (0, import_signal_openstack10.validateAndEncodeResourceId)(ruleId, "Security group rule");
40379
40505
  const response = await network.del(`${SECURITY_GROUP_RULES_BASE_URL}/${encodedRuleId}`);
40380
40506
  if (!response?.ok) {
40381
40507
  throw SecurityGroupRuleErrorHandlers.delete(response, ruleId);
@@ -40424,46 +40550,46 @@ var securityGroupRuleRouter = {
40424
40550
  };
40425
40551
 
40426
40552
  // src/server/Network/types/rbacPolicy.ts
40427
- var import_zod23 = require("zod");
40428
- var rbacPolicySchema = import_zod23.z.object({
40429
- id: import_zod23.z.string(),
40430
- object_type: import_zod23.z.enum([
40553
+ var import_zod22 = require("zod");
40554
+ var rbacPolicySchema = import_zod22.z.object({
40555
+ id: import_zod22.z.string(),
40556
+ object_type: import_zod22.z.enum([
40431
40557
  "qos_policy",
40432
40558
  "network",
40433
40559
  "security_group"
40434
40560
  ]),
40435
- object_id: import_zod23.z.string(),
40436
- action: import_zod23.z.enum([
40561
+ object_id: import_zod22.z.string(),
40562
+ action: import_zod22.z.enum([
40437
40563
  "access_as_shared",
40438
40564
  "access_as_external"
40439
40565
  ]),
40440
- target_tenant: import_zod23.z.string(),
40441
- tenant_id: import_zod23.z.string().nullable().optional(),
40442
- project_id: import_zod23.z.string().nullable().optional()
40566
+ target_tenant: import_zod22.z.string(),
40567
+ tenant_id: import_zod22.z.string().nullable().optional(),
40568
+ project_id: import_zod22.z.string().nullable().optional()
40443
40569
  });
40444
- var rbacPoliciesResponseSchema = import_zod23.z.object({
40445
- rbac_policies: import_zod23.z.array(rbacPolicySchema)
40570
+ var rbacPoliciesResponseSchema = import_zod22.z.object({
40571
+ rbac_policies: import_zod22.z.array(rbacPolicySchema)
40446
40572
  });
40447
- var rbacPolicyResponseSchema = import_zod23.z.object({
40573
+ var rbacPolicyResponseSchema = import_zod22.z.object({
40448
40574
  rbac_policy: rbacPolicySchema
40449
40575
  });
40450
40576
  var listRBACPoliciesForSecurityGroupInputSchema = projectScopedInputSchema.extend({
40451
- securityGroupId: import_zod23.z.string()
40577
+ securityGroupId: import_zod22.z.string()
40452
40578
  });
40453
40579
  var createRBACPolicyInputSchema = projectScopedInputSchema.extend({
40454
- securityGroupId: import_zod23.z.string(),
40455
- targetTenant: import_zod23.z.string().trim().min(1, "Target project ID is required")
40580
+ securityGroupId: import_zod22.z.string(),
40581
+ targetTenant: import_zod22.z.string().trim().min(1, "Target project ID is required")
40456
40582
  });
40457
40583
  var updateRBACPolicyInputSchema = projectScopedInputSchema.extend({
40458
- policyId: import_zod23.z.string(),
40459
- targetTenant: import_zod23.z.string().trim().min(1, "Target project ID is required")
40584
+ policyId: import_zod22.z.string(),
40585
+ targetTenant: import_zod22.z.string().trim().min(1, "Target project ID is required")
40460
40586
  });
40461
40587
  var deleteRBACPolicyInputSchema = projectScopedInputSchema.extend({
40462
- policyId: import_zod23.z.string()
40588
+ policyId: import_zod22.z.string()
40463
40589
  });
40464
40590
 
40465
40591
  // src/server/Network/helpers/rbacPolicyHelpers.ts
40466
- var import_server26 = require("@trpc/server");
40592
+ var import_server27 = require("@trpc/server");
40467
40593
  var RBACPolicyErrorHandlers = {
40468
40594
  /**
40469
40595
  * Handles errors specific to RBAC policy list operations
@@ -40473,17 +40599,17 @@ var RBACPolicyErrorHandlers = {
40473
40599
  list: /* @__PURE__ */ __name((response) => {
40474
40600
  switch (response.status) {
40475
40601
  case 401:
40476
- return new import_server26.TRPCError({
40602
+ return new import_server27.TRPCError({
40477
40603
  code: HTTP_STATUS_ERROR_MAP[401],
40478
40604
  message: "Unauthorized access"
40479
40605
  });
40480
40606
  case 403:
40481
- return new import_server26.TRPCError({
40607
+ return new import_server27.TRPCError({
40482
40608
  code: HTTP_STATUS_ERROR_MAP[403],
40483
40609
  message: `Access forbidden: ${response.statusText || "Unknown error"}`
40484
40610
  });
40485
40611
  default:
40486
- return new import_server26.TRPCError({
40612
+ return new import_server27.TRPCError({
40487
40613
  code: DEFAULT_ERROR_NAME,
40488
40614
  message: `Failed to list RBAC policies: ${response.statusText || "Unknown error"}`
40489
40615
  });
@@ -40497,32 +40623,32 @@ var RBACPolicyErrorHandlers = {
40497
40623
  create: /* @__PURE__ */ __name((response) => {
40498
40624
  switch (response.status) {
40499
40625
  case 400:
40500
- return new import_server26.TRPCError({
40626
+ return new import_server27.TRPCError({
40501
40627
  code: HTTP_STATUS_ERROR_MAP[400],
40502
40628
  message: `Invalid request: ${response.statusText || "Unknown error"}`
40503
40629
  });
40504
40630
  case 401:
40505
- return new import_server26.TRPCError({
40631
+ return new import_server27.TRPCError({
40506
40632
  code: HTTP_STATUS_ERROR_MAP[401],
40507
40633
  message: "Unauthorized access"
40508
40634
  });
40509
40635
  case 403:
40510
- return new import_server26.TRPCError({
40636
+ return new import_server27.TRPCError({
40511
40637
  code: HTTP_STATUS_ERROR_MAP[403],
40512
40638
  message: "You don't have permission to share this security group"
40513
40639
  });
40514
40640
  case 404:
40515
- return new import_server26.TRPCError({
40641
+ return new import_server27.TRPCError({
40516
40642
  code: HTTP_STATUS_ERROR_MAP[404],
40517
40643
  message: "Security group not found or target project does not exist"
40518
40644
  });
40519
40645
  case 409:
40520
- return new import_server26.TRPCError({
40646
+ return new import_server27.TRPCError({
40521
40647
  code: HTTP_STATUS_ERROR_MAP[409],
40522
40648
  message: "This security group is already shared with the specified project"
40523
40649
  });
40524
40650
  default:
40525
- return new import_server26.TRPCError({
40651
+ return new import_server27.TRPCError({
40526
40652
  code: "INTERNAL_SERVER_ERROR",
40527
40653
  message: `Failed to create RBAC policy: ${response.statusText || "Unknown error"}`
40528
40654
  });
@@ -40537,27 +40663,27 @@ var RBACPolicyErrorHandlers = {
40537
40663
  update: /* @__PURE__ */ __name((response, policyId) => {
40538
40664
  switch (response.status) {
40539
40665
  case 400:
40540
- return new import_server26.TRPCError({
40666
+ return new import_server27.TRPCError({
40541
40667
  code: HTTP_STATUS_ERROR_MAP[400],
40542
40668
  message: `Invalid request: ${response.statusText || "Unknown error"}`
40543
40669
  });
40544
40670
  case 401:
40545
- return new import_server26.TRPCError({
40671
+ return new import_server27.TRPCError({
40546
40672
  code: HTTP_STATUS_ERROR_MAP[401],
40547
40673
  message: "Unauthorized access"
40548
40674
  });
40549
40675
  case 403:
40550
- return new import_server26.TRPCError({
40676
+ return new import_server27.TRPCError({
40551
40677
  code: HTTP_STATUS_ERROR_MAP[403],
40552
40678
  message: `Access forbidden: ${response.statusText || "Unknown error"}`
40553
40679
  });
40554
40680
  case 404:
40555
- return new import_server26.TRPCError({
40681
+ return new import_server27.TRPCError({
40556
40682
  code: HTTP_STATUS_ERROR_MAP[404],
40557
40683
  message: `RBAC policy not found: ${policyId}`
40558
40684
  });
40559
40685
  default:
40560
- return new import_server26.TRPCError({
40686
+ return new import_server27.TRPCError({
40561
40687
  code: "INTERNAL_SERVER_ERROR",
40562
40688
  message: `Failed to update RBAC policy: ${response.statusText || "Unknown error"}`
40563
40689
  });
@@ -40572,22 +40698,22 @@ var RBACPolicyErrorHandlers = {
40572
40698
  delete: /* @__PURE__ */ __name((response, policyId) => {
40573
40699
  switch (response.status) {
40574
40700
  case 401:
40575
- return new import_server26.TRPCError({
40701
+ return new import_server27.TRPCError({
40576
40702
  code: HTTP_STATUS_ERROR_MAP[401],
40577
40703
  message: "Unauthorized access"
40578
40704
  });
40579
40705
  case 404:
40580
- return new import_server26.TRPCError({
40706
+ return new import_server27.TRPCError({
40581
40707
  code: HTTP_STATUS_ERROR_MAP[404],
40582
40708
  message: `RBAC policy not found: ${policyId}`
40583
40709
  });
40584
40710
  case 409:
40585
- return new import_server26.TRPCError({
40711
+ return new import_server27.TRPCError({
40586
40712
  code: HTTP_STATUS_ERROR_MAP[409],
40587
40713
  message: "Cannot delete RBAC policy because it is in use"
40588
40714
  });
40589
40715
  default:
40590
- return new import_server26.TRPCError({
40716
+ return new import_server27.TRPCError({
40591
40717
  code: DEFAULT_ERROR_NAME,
40592
40718
  message: `Failed to delete RBAC policy: ${response.statusText || "Unknown error"}`
40593
40719
  });
@@ -40598,7 +40724,7 @@ var parseOpenStackResponse2 = /* @__PURE__ */ __name((data, schema, operation, e
40598
40724
  const parsed = schema.safeParse(data);
40599
40725
  if (!parsed.success) {
40600
40726
  console.error(`Zod Parsing Error in ${operation}:`, parsed.error.format());
40601
- throw new import_server26.TRPCError({
40727
+ throw new import_server27.TRPCError({
40602
40728
  code: "INTERNAL_SERVER_ERROR",
40603
40729
  message: errorMessage
40604
40730
  });
@@ -40617,7 +40743,7 @@ function parseRBACPoliciesListResponse(data, operation) {
40617
40743
  __name(parseRBACPoliciesListResponse, "parseRBACPoliciesListResponse");
40618
40744
 
40619
40745
  // src/server/Network/routers/rbacPolicyRouter.ts
40620
- var import_signal_openstack10 = __toESM(require_esm());
40746
+ var import_signal_openstack11 = __toESM(require_esm());
40621
40747
  var RBAC_POLICIES_BASE_URL = "v2.0/rbac-policies";
40622
40748
  var rbacPolicyRouter = {
40623
40749
  list: projectScopedProcedure.input(listRBACPoliciesForSecurityGroupInputSchema).query(async ({ input, ctx }) => {
@@ -40666,7 +40792,7 @@ var rbacPolicyRouter = {
40666
40792
  target_tenant: targetTenant
40667
40793
  }
40668
40794
  };
40669
- const encodedPolicyId = (0, import_signal_openstack10.validateAndEncodeResourceId)(policyId, "RBAC policy");
40795
+ const encodedPolicyId = (0, import_signal_openstack11.validateAndEncodeResourceId)(policyId, "RBAC policy");
40670
40796
  const response = await network.put(`${RBAC_POLICIES_BASE_URL}/${encodedPolicyId}`, requestBody);
40671
40797
  if (!response.ok) {
40672
40798
  throw RBACPolicyErrorHandlers.update(response, policyId);
@@ -40679,7 +40805,7 @@ var rbacPolicyRouter = {
40679
40805
  return withErrorHandling3(async () => {
40680
40806
  const { policyId } = input;
40681
40807
  const network = getNetworkService(ctx);
40682
- const encodedPolicyId = (0, import_signal_openstack10.validateAndEncodeResourceId)(policyId, "RBAC policy");
40808
+ const encodedPolicyId = (0, import_signal_openstack11.validateAndEncodeResourceId)(policyId, "RBAC policy");
40683
40809
  const response = await network.del(`${RBAC_POLICIES_BASE_URL}/${encodedPolicyId}`);
40684
40810
  if (!response.ok) {
40685
40811
  throw RBACPolicyErrorHandlers.delete(response, policyId);
@@ -40688,6 +40814,725 @@ var rbacPolicyRouter = {
40688
40814
  })
40689
40815
  };
40690
40816
 
40817
+ // src/server/Network/routers/routersRouter.ts
40818
+ var import_server29 = require("@trpc/server");
40819
+ var import_signal_openstack13 = __toESM(require_esm());
40820
+
40821
+ // src/server/Network/types/router.ts
40822
+ var import_zod23 = require("zod");
40823
+ var import_node_net = require("net");
40824
+ var isValidIpAddress = /* @__PURE__ */ __name((value) => (0, import_node_net.isIP)(value) !== 0, "isValidIpAddress");
40825
+ var isValidCidr = /* @__PURE__ */ __name((value) => {
40826
+ const parts = value.split("/");
40827
+ if (parts.length !== 2) return false;
40828
+ const [address, prefix] = parts;
40829
+ if (!/^\d{1,3}$/.test(prefix)) return false;
40830
+ const version = (0, import_node_net.isIP)(address);
40831
+ if (version === 0) return false;
40832
+ const prefixLength = Number(prefix);
40833
+ return version === 4 ? prefixLength <= 32 : prefixLength <= 128;
40834
+ }, "isValidCidr");
40835
+ var resourceIdSchema = import_zod23.z.string().trim().min(1, "ID is required");
40836
+ var ipAddressSchema = import_zod23.z.string().trim().refine(isValidIpAddress, {
40837
+ message: "Must be a valid IPv4 or IPv6 address"
40838
+ });
40839
+ var cidrSchema = import_zod23.z.string().trim().refine(isValidCidr, {
40840
+ message: "Must be a valid CIDR, e.g. 10.0.0.0/24"
40841
+ });
40842
+ var nameSchema = import_zod23.z.string().trim().max(255, "Name must be at most 255 characters");
40843
+ var descriptionSchema = import_zod23.z.string().max(255, "Description must be at most 255 characters");
40844
+ var ExternalFixedIpSchema = import_zod23.z.object({
40845
+ subnet_id: import_zod23.z.string(),
40846
+ ip_address: import_zod23.z.string()
40847
+ });
40848
+ var ExternalGatewayInfoSchema = import_zod23.z.object({
40849
+ network_id: import_zod23.z.string(),
40850
+ enable_snat: import_zod23.z.boolean().optional(),
40851
+ external_fixed_ips: import_zod23.z.array(ExternalFixedIpSchema).optional(),
40852
+ qos_policy_id: import_zod23.z.string().nullish()
40853
+ });
40854
+ var ExtraRouteSchema = import_zod23.z.object({
40855
+ destination: import_zod23.z.string(),
40856
+ nexthop: import_zod23.z.string()
40857
+ });
40858
+ var RouterSchema = import_zod23.z.object({
40859
+ id: import_zod23.z.string(),
40860
+ name: import_zod23.z.string().default(""),
40861
+ description: import_zod23.z.string().optional().default(""),
40862
+ status: import_zod23.z.string(),
40863
+ admin_state_up: import_zod23.z.boolean(),
40864
+ // Neutron returns `null` when no gateway is set
40865
+ external_gateway_info: ExternalGatewayInfoSchema.nullish(),
40866
+ // Only present when the `extraroute` extension is enabled
40867
+ routes: import_zod23.z.array(ExtraRouteSchema).optional().default([]),
40868
+ // Only present when the corresponding extensions are enabled (dvr, l3-ha, ...)
40869
+ distributed: import_zod23.z.boolean().nullish(),
40870
+ ha: import_zod23.z.boolean().nullish(),
40871
+ enable_ndp_proxy: import_zod23.z.boolean().nullish(),
40872
+ enable_default_route_bfd: import_zod23.z.boolean().nullish(),
40873
+ enable_default_route_ecmp: import_zod23.z.boolean().nullish(),
40874
+ availability_zone_hints: import_zod23.z.array(import_zod23.z.string()).optional(),
40875
+ availability_zones: import_zod23.z.array(import_zod23.z.string()).optional(),
40876
+ flavor_id: import_zod23.z.string().nullish(),
40877
+ project_id: import_zod23.z.string(),
40878
+ tenant_id: import_zod23.z.string().optional(),
40879
+ revision_number: import_zod23.z.number().optional(),
40880
+ tags: import_zod23.z.array(import_zod23.z.string()).optional(),
40881
+ created_at: ISO8601TimestampSchema.optional(),
40882
+ updated_at: ISO8601TimestampSchema.optional()
40883
+ });
40884
+ var RouterListResponseSchema = import_zod23.z.object({
40885
+ routers: import_zod23.z.array(RouterSchema)
40886
+ });
40887
+ var RouterResponseSchema = import_zod23.z.object({
40888
+ router: RouterSchema
40889
+ });
40890
+ var RouterInterfaceInfoSchema = import_zod23.z.object({
40891
+ id: import_zod23.z.string(),
40892
+ subnet_id: import_zod23.z.string().optional(),
40893
+ subnet_ids: import_zod23.z.array(import_zod23.z.string()).optional(),
40894
+ port_id: import_zod23.z.string(),
40895
+ network_id: import_zod23.z.string().optional(),
40896
+ project_id: import_zod23.z.string().optional(),
40897
+ tenant_id: import_zod23.z.string().optional(),
40898
+ tags: import_zod23.z.array(import_zod23.z.string()).optional()
40899
+ });
40900
+ var RouterPortSchema = import_zod23.z.object({
40901
+ id: import_zod23.z.string(),
40902
+ name: import_zod23.z.string().optional().default(""),
40903
+ network_id: import_zod23.z.string(),
40904
+ device_owner: import_zod23.z.string(),
40905
+ status: NetworkPortStatusSchema,
40906
+ admin_state_up: import_zod23.z.boolean().optional(),
40907
+ mac_address: import_zod23.z.string().optional(),
40908
+ fixed_ips: import_zod23.z.array(ExternalFixedIpSchema).optional().default([])
40909
+ });
40910
+ var RouterPortListResponseSchema = import_zod23.z.object({
40911
+ ports: import_zod23.z.array(RouterPortSchema)
40912
+ });
40913
+ var SubnetSummarySchema = import_zod23.z.object({
40914
+ id: import_zod23.z.string(),
40915
+ name: import_zod23.z.string().optional().default(""),
40916
+ cidr: import_zod23.z.string().optional()
40917
+ });
40918
+ var SubnetSummaryListResponseSchema = import_zod23.z.object({
40919
+ subnets: import_zod23.z.array(SubnetSummarySchema)
40920
+ });
40921
+ var RouterInterfacePortSummarySchema = import_zod23.z.object({
40922
+ id: import_zod23.z.string(),
40923
+ /** The ID of the router owning the interface */
40924
+ device_id: import_zod23.z.string(),
40925
+ device_owner: import_zod23.z.string(),
40926
+ network_id: import_zod23.z.string()
40927
+ });
40928
+ var RouterInterfacePortSummaryListResponseSchema = import_zod23.z.object({
40929
+ ports: import_zod23.z.array(RouterInterfacePortSummarySchema)
40930
+ });
40931
+ var NetworkSummarySchema = import_zod23.z.object({
40932
+ id: import_zod23.z.string(),
40933
+ name: import_zod23.z.string().nullable().optional()
40934
+ });
40935
+ var NetworkSummaryListResponseSchema = import_zod23.z.object({
40936
+ networks: import_zod23.z.array(NetworkSummarySchema)
40937
+ });
40938
+ var ExtensionListResponseSchema = import_zod23.z.object({
40939
+ extensions: import_zod23.z.array(import_zod23.z.object({
40940
+ alias: import_zod23.z.string(),
40941
+ name: import_zod23.z.string().optional()
40942
+ }))
40943
+ });
40944
+ var RouterSortKeySchema = import_zod23.z.enum([
40945
+ "admin_state_up",
40946
+ "flavor_id",
40947
+ "id",
40948
+ "name",
40949
+ "status",
40950
+ "project_id",
40951
+ "tenant_id"
40952
+ ]);
40953
+ var RouterQueryParametersSchema = projectScopedInputSchema.extend({
40954
+ // Passed through to Neutron
40955
+ name: import_zod23.z.string().optional(),
40956
+ description: import_zod23.z.string().optional(),
40957
+ admin_state_up: import_zod23.z.boolean().optional(),
40958
+ sort_key: RouterSortKeySchema.optional(),
40959
+ sort_dir: SortDirSchema.optional(),
40960
+ // Comma-separated tag lists, as Neutron expects
40961
+ tags: import_zod23.z.string().optional(),
40962
+ tags_any: import_zod23.z.string().optional(),
40963
+ not_tags: import_zod23.z.string().optional(),
40964
+ not_tags_any: import_zod23.z.string().optional(),
40965
+ // Applied BFF-side
40966
+ searchTerm: import_zod23.z.string().trim().optional(),
40967
+ status: import_zod23.z.string().optional(),
40968
+ has_gateway: import_zod23.z.boolean().optional()
40969
+ });
40970
+ var RouterIdInputSchema = projectScopedInputSchema.extend({
40971
+ router_id: resourceIdSchema
40972
+ });
40973
+ var GatewayFixedIpInputSchema = import_zod23.z.object({
40974
+ subnet_id: resourceIdSchema.optional(),
40975
+ ip_address: ipAddressSchema.optional()
40976
+ }).refine((value) => Boolean(value.subnet_id || value.ip_address), {
40977
+ message: "Either subnet_id or ip_address is required"
40978
+ });
40979
+ var ExternalGatewayInfoInputSchema = import_zod23.z.object({
40980
+ network_id: resourceIdSchema,
40981
+ // Note: setting enable_snat is admin-only in the default Neutron policy
40982
+ enable_snat: import_zod23.z.boolean().optional(),
40983
+ external_fixed_ips: import_zod23.z.array(GatewayFixedIpInputSchema).optional()
40984
+ });
40985
+ var ExtraRouteInputSchema = import_zod23.z.object({
40986
+ destination: cidrSchema,
40987
+ nexthop: ipAddressSchema
40988
+ });
40989
+ var RouterCreateRequestSchema = projectScopedInputSchema.extend({
40990
+ name: nameSchema.min(1, "Name is required"),
40991
+ description: descriptionSchema.optional(),
40992
+ admin_state_up: import_zod23.z.boolean().optional(),
40993
+ external_gateway_info: ExternalGatewayInfoInputSchema.optional(),
40994
+ distributed: import_zod23.z.boolean().optional(),
40995
+ ha: import_zod23.z.boolean().optional(),
40996
+ availability_zone_hints: import_zod23.z.array(import_zod23.z.string().trim().min(1)).optional(),
40997
+ enable_ndp_proxy: import_zod23.z.boolean().optional()
40998
+ });
40999
+ var RouterUpdateRequestSchema = projectScopedInputSchema.extend({
41000
+ router_id: resourceIdSchema,
41001
+ name: nameSchema.optional(),
41002
+ description: descriptionSchema.optional(),
41003
+ admin_state_up: import_zod23.z.boolean().optional(),
41004
+ // Replaces the FULL list of extra routes (requires `extraroute` extension)
41005
+ routes: import_zod23.z.array(ExtraRouteInputSchema).optional(),
41006
+ // Changing distributed / ha requires the router to be admin_state_up=false first
41007
+ distributed: import_zod23.z.boolean().optional(),
41008
+ ha: import_zod23.z.boolean().optional(),
41009
+ enable_ndp_proxy: import_zod23.z.boolean().optional()
41010
+ });
41011
+ var RouterSetGatewayRequestSchema = projectScopedInputSchema.extend({
41012
+ router_id: resourceIdSchema,
41013
+ external_gateway_info: ExternalGatewayInfoInputSchema
41014
+ });
41015
+ var RouterInterfaceRequestSchema = projectScopedInputSchema.extend({
41016
+ router_id: resourceIdSchema,
41017
+ subnet_id: resourceIdSchema.optional(),
41018
+ port_id: resourceIdSchema.optional()
41019
+ }).refine((value) => Boolean(value.subnet_id) !== Boolean(value.port_id), {
41020
+ message: "Provide exactly one of subnet_id or port_id",
41021
+ path: [
41022
+ "subnet_id"
41023
+ ]
41024
+ });
41025
+
41026
+ // src/server/Network/helpers/routerHelpers.ts
41027
+ var import_server28 = require("@trpc/server");
41028
+ var import_signal_openstack12 = __toESM(require_esm());
41029
+ var QUOTA_EXCEEDED_MESSAGE = "Router quota exceeded. Delete unused resources or contact an administrator to increase the quota.";
41030
+ var conflict = /* @__PURE__ */ __name((message) => (response) => new import_server28.TRPCError({
41031
+ code: HTTP_STATUS_ERROR_MAP[409],
41032
+ message: /quota/i.test(response.statusText ?? "") ? QUOTA_EXCEEDED_MESSAGE : message
41033
+ }), "conflict");
41034
+ var badRequest = /* @__PURE__ */ __name((message) => (response) => new import_server28.TRPCError({
41035
+ code: HTTP_STATUS_ERROR_MAP[400],
41036
+ message: `${message}${response.statusText ? ` (${response.statusText})` : ""}`
41037
+ }), "badRequest");
41038
+ var notFound = /* @__PURE__ */ __name((message) => (_response, resourceLabel) => new import_server28.TRPCError({
41039
+ code: HTTP_STATUS_ERROR_MAP[404],
41040
+ message: message(resourceLabel)
41041
+ }), "notFound");
41042
+ var RouterErrorHandlers = {
41043
+ list: ErrorHandler("Router"),
41044
+ get: ErrorHandler("Router", {
41045
+ 404: notFound((routerId) => `Router ${routerId} was not found.`)
41046
+ }),
41047
+ create: ErrorHandler("Router", {
41048
+ 404: notFound(() => "The selected external network or subnet was not found."),
41049
+ 409: conflict("The requested external IP address is already in use or the external network has no free IP addresses.")
41050
+ }),
41051
+ update: ErrorHandler("Router", {
41052
+ 404: notFound((routerId) => `Router ${routerId} was not found.`),
41053
+ 409: conflict("The router is in a state that doesn't allow this change. Distributed/HA mode can only be changed while the admin state is DOWN.")
41054
+ }),
41055
+ setGateway: ErrorHandler("Router", {
41056
+ 404: notFound((routerId) => `Router ${routerId} or the selected external network was not found.`),
41057
+ 409: conflict("The requested external IP address is already in use or the external network has no free IP addresses.")
41058
+ }),
41059
+ clearGateway: ErrorHandler("Router", {
41060
+ 404: notFound((routerId) => `Router ${routerId} was not found.`),
41061
+ 409: conflict("The gateway can't be cleared while floating IPs are still associated through this router. Disassociate them first.")
41062
+ }),
41063
+ addInterface: ErrorHandler("Router", {
41064
+ // Neutron returns 400 for: subnet already attached, no gateway IP, overlapping CIDRs
41065
+ 400: badRequest("The interface can't be added. The subnet may already be attached, have no gateway IP, or overlap with a subnet on this router"),
41066
+ 404: notFound((routerId) => `Router ${routerId} or the selected subnet/port was not found.`),
41067
+ 409: conflict("The subnet or port is already in use by another router, or its IP address is already allocated.")
41068
+ }),
41069
+ removeInterface: ErrorHandler("Router", {
41070
+ 404: notFound((routerId) => `The interface is not attached to router ${routerId}.`),
41071
+ 409: conflict("The interface can't be removed while floating IPs are still associated with ports on this subnet.")
41072
+ }),
41073
+ delete: ErrorHandler("Router", {
41074
+ 404: notFound((routerId) => `Router ${routerId} was not found.`),
41075
+ 409: conflict("The router still has attached interfaces. Remove all interfaces before deleting it.")
41076
+ }),
41077
+ listInterfaces: ErrorHandler("Router"),
41078
+ listExtensions: ErrorHandler("Router")
41079
+ };
41080
+ var requestOrThrow = /* @__PURE__ */ __name(async (request, handleError, resourceLabel) => {
41081
+ let response;
41082
+ try {
41083
+ response = await request();
41084
+ } catch (error) {
41085
+ if (error instanceof import_signal_openstack12.SignalOpenstackApiError) {
41086
+ throw handleError({
41087
+ status: error.statusCode,
41088
+ statusText: error.message
41089
+ }, resourceLabel);
41090
+ }
41091
+ throw error;
41092
+ }
41093
+ if (!response.ok) throw handleError(response, resourceLabel);
41094
+ return response;
41095
+ }, "requestOrThrow");
41096
+ var pickDefined = /* @__PURE__ */ __name((obj) => Object.fromEntries(Object.entries(obj).filter(([, value]) => value !== void 0)), "pickDefined");
41097
+ var buildExternalGatewayInfoBody = /* @__PURE__ */ __name((info) => ({
41098
+ network_id: info.network_id,
41099
+ ...info.enable_snat !== void 0 && {
41100
+ enable_snat: info.enable_snat
41101
+ },
41102
+ ...info.external_fixed_ips !== void 0 && {
41103
+ external_fixed_ips: info.external_fixed_ips.map((fixedIp) => pickDefined(fixedIp))
41104
+ }
41105
+ }), "buildExternalGatewayInfoBody");
41106
+ var filterRoutersByBffParams = /* @__PURE__ */ __name((routers, { status, has_gateway }) => routers.filter((router2) => {
41107
+ if (status && router2.status.toUpperCase() !== status.toUpperCase()) return false;
41108
+ if (has_gateway !== void 0 && Boolean(router2.external_gateway_info) !== has_gateway) return false;
41109
+ return true;
41110
+ }), "filterRoutersByBffParams");
41111
+ var collectGatewayIds = /* @__PURE__ */ __name((routers) => {
41112
+ const networkIds = /* @__PURE__ */ new Set();
41113
+ const subnetIds = /* @__PURE__ */ new Set();
41114
+ for (const router2 of routers) {
41115
+ const gateway = router2.external_gateway_info;
41116
+ if (!gateway) continue;
41117
+ networkIds.add(gateway.network_id);
41118
+ for (const fixedIp of gateway.external_fixed_ips ?? []) {
41119
+ subnetIds.add(fixedIp.subnet_id);
41120
+ }
41121
+ }
41122
+ return {
41123
+ networkIds: [
41124
+ ...networkIds
41125
+ ],
41126
+ subnetIds: [
41127
+ ...subnetIds
41128
+ ]
41129
+ };
41130
+ }, "collectGatewayIds");
41131
+ var applyGatewayNames = /* @__PURE__ */ __name((routers, networks = [], subnets = []) => {
41132
+ const networkNames = new Map(networks.map((network) => [
41133
+ network.id,
41134
+ network.name || void 0
41135
+ ]));
41136
+ const subnetNames = new Map(subnets.map((subnet) => [
41137
+ subnet.id,
41138
+ subnet.name || void 0
41139
+ ]));
41140
+ return routers.map((router2) => {
41141
+ const gateway = router2.external_gateway_info;
41142
+ if (!gateway) return router2;
41143
+ return {
41144
+ ...router2,
41145
+ external_gateway_info: {
41146
+ ...gateway,
41147
+ network_name: networkNames.get(gateway.network_id),
41148
+ external_fixed_ips: gateway.external_fixed_ips?.map((fixedIp) => ({
41149
+ ...fixedIp,
41150
+ subnet_name: subnetNames.get(fixedIp.subnet_id)
41151
+ }))
41152
+ }
41153
+ };
41154
+ });
41155
+ }, "applyGatewayNames");
41156
+ var ROUTER_INTERFACE_DEVICE_OWNERS = /* @__PURE__ */ new Set([
41157
+ "network:router_interface",
41158
+ "network:router_interface_distributed",
41159
+ "network:ha_router_replicated_interface"
41160
+ ]);
41161
+ var isRouterInterfacePort = /* @__PURE__ */ __name((port) => ROUTER_INTERFACE_DEVICE_OWNERS.has(port.device_owner), "isRouterInterfacePort");
41162
+ var chunk = /* @__PURE__ */ __name((items, size) => {
41163
+ if (size < 1) throw new Error("Chunk size must be at least 1");
41164
+ const chunks = [];
41165
+ for (let i = 0; i < items.length; i += size) {
41166
+ chunks.push(items.slice(i, i + size));
41167
+ }
41168
+ return chunks;
41169
+ }, "chunk");
41170
+ var groupPrivateNetworkIdsByRouter = /* @__PURE__ */ __name((ports) => {
41171
+ const byRouter = /* @__PURE__ */ new Map();
41172
+ for (const port of ports) {
41173
+ if (!isRouterInterfacePort(port)) continue;
41174
+ const networkIds = byRouter.get(port.device_id) ?? /* @__PURE__ */ new Set();
41175
+ networkIds.add(port.network_id);
41176
+ byRouter.set(port.device_id, networkIds);
41177
+ }
41178
+ return new Map([
41179
+ ...byRouter
41180
+ ].map(([routerId, networkIds]) => [
41181
+ routerId,
41182
+ [
41183
+ ...networkIds
41184
+ ]
41185
+ ]));
41186
+ }, "groupPrivateNetworkIdsByRouter");
41187
+ var applyPrivateNetworks = /* @__PURE__ */ __name((routers, privateNetworkIdsByRouter, networks = []) => {
41188
+ if (!privateNetworkIdsByRouter) return routers;
41189
+ const networkNames = new Map(networks.map((network) => [
41190
+ network.id,
41191
+ network.name || void 0
41192
+ ]));
41193
+ return routers.map((router2) => ({
41194
+ ...router2,
41195
+ private_networks: (privateNetworkIdsByRouter.get(router2.id) ?? []).map((networkId) => ({
41196
+ network_id: networkId,
41197
+ network_name: networkNames.get(networkId)
41198
+ }))
41199
+ }));
41200
+ }, "applyPrivateNetworks");
41201
+ var collectSubnetIds = /* @__PURE__ */ __name((ports) => [
41202
+ ...new Set(ports.flatMap((port) => port.fixed_ips.map((fixedIp) => fixedIp.subnet_id)))
41203
+ ], "collectSubnetIds");
41204
+ var buildRouterInterfaces = /* @__PURE__ */ __name((ports, subnets = [], networks = []) => {
41205
+ const subnetsById = new Map(subnets.map((subnet) => [
41206
+ subnet.id,
41207
+ subnet
41208
+ ]));
41209
+ const networkNames = new Map(networks.map((network) => [
41210
+ network.id,
41211
+ network.name || void 0
41212
+ ]));
41213
+ return ports.filter(isRouterInterfacePort).map((port) => ({
41214
+ port_id: port.id,
41215
+ port_name: port.name,
41216
+ network_id: port.network_id,
41217
+ network_name: networkNames.get(port.network_id),
41218
+ device_owner: port.device_owner,
41219
+ status: port.status,
41220
+ admin_state_up: port.admin_state_up,
41221
+ mac_address: port.mac_address,
41222
+ fixed_ips: port.fixed_ips.map((fixedIp) => ({
41223
+ subnet_id: fixedIp.subnet_id,
41224
+ subnet_name: subnetsById.get(fixedIp.subnet_id)?.name,
41225
+ subnet_cidr: subnetsById.get(fixedIp.subnet_id)?.cidr,
41226
+ ip_address: fixedIp.ip_address
41227
+ }))
41228
+ }));
41229
+ }, "buildRouterInterfaces");
41230
+ var getRouterExtensionFlags = /* @__PURE__ */ __name((aliases) => {
41231
+ const enabled = new Set(aliases);
41232
+ return {
41233
+ dvr: enabled.has("dvr"),
41234
+ l3Ha: enabled.has("l3-ha"),
41235
+ extraRoute: enabled.has("extraroute"),
41236
+ extGwMode: enabled.has("ext-gw-mode"),
41237
+ ndpProxy: enabled.has("router-extend-ndp-proxy"),
41238
+ externalGatewayMultihoming: enabled.has("external-gateway-multihoming"),
41239
+ availabilityZone: enabled.has("router_availability_zone")
41240
+ };
41241
+ }, "getRouterExtensionFlags");
41242
+
41243
+ // src/server/Network/routers/routersRouter.ts
41244
+ var ROUTERS_BASE_URL = "v2.0/routers";
41245
+ var PORTS_BASE_URL = "v2.0/ports";
41246
+ var SUBNETS_BASE_URL = "v2.0/subnets";
41247
+ var NETWORKS_BASE_URL = "v2.0/networks";
41248
+ var ROUTER_INTERFACE_PORTS_CHUNK_SIZE = 50;
41249
+ var EXTENSIONS_BASE_URL = "v2.0/extensions";
41250
+ var LIST_ROUTERS_QUERY_KEY_MAP = {
41251
+ tags_any: "tags-any",
41252
+ not_tags: "not-tags",
41253
+ not_tags_any: "not-tags-any"
41254
+ };
41255
+ var withQuery = /* @__PURE__ */ __name((baseUrl, params) => {
41256
+ const queryString = params.toString();
41257
+ return queryString ? `${baseUrl}?${queryString}` : baseUrl;
41258
+ }, "withQuery");
41259
+ var routerUrl = /* @__PURE__ */ __name((routerId, action) => {
41260
+ const encodedId = (0, import_signal_openstack13.validateAndEncodeResourceId)(routerId, "Router");
41261
+ return action ? `${ROUTERS_BASE_URL}/${encodedId}/${action}` : `${ROUTERS_BASE_URL}/${encodedId}`;
41262
+ }, "routerUrl");
41263
+ var fetchNetworkSummaries = /* @__PURE__ */ __name(async (network, ids) => {
41264
+ if (ids.length === 0) return [];
41265
+ try {
41266
+ const params = appendQueryParamsFromObject({
41267
+ id: ids,
41268
+ fields: [
41269
+ "id",
41270
+ "name"
41271
+ ]
41272
+ });
41273
+ const response = await network.get(withQuery(NETWORKS_BASE_URL, params));
41274
+ if (!response.ok) return [];
41275
+ const data = await response.json();
41276
+ return parseOrThrow(NetworkSummaryListResponseSchema, data, "routersRouter.networks").networks;
41277
+ } catch {
41278
+ return [];
41279
+ }
41280
+ }, "fetchNetworkSummaries");
41281
+ var fetchSubnetSummaries = /* @__PURE__ */ __name(async (network, ids, fields = [
41282
+ "id",
41283
+ "name"
41284
+ ]) => {
41285
+ if (ids.length === 0) return [];
41286
+ try {
41287
+ const params = appendQueryParamsFromObject({
41288
+ id: ids,
41289
+ fields
41290
+ });
41291
+ const response = await network.get(withQuery(SUBNETS_BASE_URL, params));
41292
+ if (!response.ok) return [];
41293
+ const data = await response.json();
41294
+ return parseOrThrow(SubnetSummaryListResponseSchema, data, "routersRouter.subnets").subnets;
41295
+ } catch {
41296
+ return [];
41297
+ }
41298
+ }, "fetchSubnetSummaries");
41299
+ var fetchRouterInterfacePorts = /* @__PURE__ */ __name(async (network, routerIds) => {
41300
+ if (routerIds.length === 0) return [];
41301
+ try {
41302
+ const portChunks = await Promise.all(chunk(routerIds, ROUTER_INTERFACE_PORTS_CHUNK_SIZE).map(async (ids) => {
41303
+ const params = appendQueryParamsFromObject({
41304
+ device_id: ids,
41305
+ device_owner: [
41306
+ ...ROUTER_INTERFACE_DEVICE_OWNERS
41307
+ ],
41308
+ fields: [
41309
+ "id",
41310
+ "device_id",
41311
+ "device_owner",
41312
+ "network_id"
41313
+ ]
41314
+ });
41315
+ const response = await network.get(withQuery(PORTS_BASE_URL, params));
41316
+ if (!response.ok) throw new Error(`Failed to list router interface ports (HTTP ${response.status})`);
41317
+ const data = await response.json();
41318
+ return parseOrThrow(RouterInterfacePortSummaryListResponseSchema, data, "routersRouter.list.ports").ports;
41319
+ }));
41320
+ return portChunks.flat();
41321
+ } catch {
41322
+ return null;
41323
+ }
41324
+ }, "fetchRouterInterfacePorts");
41325
+ var routersRouter = {
41326
+ list: projectScopedProcedure.input(RouterQueryParametersSchema).query(async ({ input, ctx }) => {
41327
+ return withErrorHandling3(async () => {
41328
+ const { searchTerm, status, has_gateway, ...openstackFilters } = input;
41329
+ const network = getNetworkService(ctx);
41330
+ const queryParams = appendQueryParamsFromObject(openstackFilters, {
41331
+ keyMap: LIST_ROUTERS_QUERY_KEY_MAP
41332
+ });
41333
+ const response = await requestOrThrow(() => network.get(withQuery(ROUTERS_BASE_URL, queryParams)), RouterErrorHandlers.list);
41334
+ const data = await response.json();
41335
+ const { routers } = parseOrThrow(RouterListResponseSchema, data, "routersRouter.list");
41336
+ const filteredRouters = filterBySearchParams(filterRoutersByBffParams(routers, {
41337
+ status,
41338
+ has_gateway
41339
+ }), searchTerm, [
41340
+ "id",
41341
+ "name",
41342
+ "description"
41343
+ ]);
41344
+ const interfacePorts = await fetchRouterInterfacePorts(network, filteredRouters.map((router2) => router2.id));
41345
+ const privateNetworkIdsByRouter = interfacePorts ? groupPrivateNetworkIdsByRouter(interfacePorts) : null;
41346
+ const { networkIds: gatewayNetworkIds, subnetIds } = collectGatewayIds(filteredRouters);
41347
+ const privateNetworkIds = [
41348
+ ...privateNetworkIdsByRouter?.values() ?? []
41349
+ ].flat();
41350
+ const networkIds = [
41351
+ .../* @__PURE__ */ new Set([
41352
+ ...gatewayNetworkIds,
41353
+ ...privateNetworkIds
41354
+ ])
41355
+ ];
41356
+ const [networks, subnets] = await Promise.all([
41357
+ fetchNetworkSummaries(network, networkIds),
41358
+ fetchSubnetSummaries(network, subnetIds)
41359
+ ]);
41360
+ return applyPrivateNetworks(applyGatewayNames(filteredRouters, networks, subnets), privateNetworkIdsByRouter, networks);
41361
+ }, "list routers");
41362
+ }),
41363
+ getById: projectScopedProcedure.input(RouterIdInputSchema).query(async ({ input, ctx }) => {
41364
+ return withErrorHandling3(async () => {
41365
+ const { router_id } = input;
41366
+ const network = getNetworkService(ctx);
41367
+ const url = routerUrl(router_id);
41368
+ const response = await requestOrThrow(() => network.get(url), RouterErrorHandlers.get, router_id);
41369
+ const data = await response.json();
41370
+ const router2 = parseOrThrow(RouterResponseSchema, data, "routersRouter.getById").router;
41371
+ const { networkIds, subnetIds } = collectGatewayIds([
41372
+ router2
41373
+ ]);
41374
+ const [networks, subnets] = await Promise.all([
41375
+ fetchNetworkSummaries(network, networkIds),
41376
+ fetchSubnetSummaries(network, subnetIds)
41377
+ ]);
41378
+ const [routerWithNames] = applyGatewayNames([
41379
+ router2
41380
+ ], networks, subnets);
41381
+ return routerWithNames;
41382
+ }, "show router details");
41383
+ }),
41384
+ create: projectScopedProcedure.input(RouterCreateRequestSchema).mutation(async ({ input, ctx }) => {
41385
+ return withErrorHandling3(async () => {
41386
+ const network = getNetworkService(ctx);
41387
+ const { external_gateway_info, ...fields } = omit(input, "project_id");
41388
+ const requestBody = {
41389
+ router: {
41390
+ ...pickDefined(fields),
41391
+ ...external_gateway_info && {
41392
+ external_gateway_info: buildExternalGatewayInfoBody(external_gateway_info)
41393
+ }
41394
+ }
41395
+ };
41396
+ const response = await requestOrThrow(() => network.post(ROUTERS_BASE_URL, requestBody), RouterErrorHandlers.create);
41397
+ const data = await response.json();
41398
+ return parseOrThrow(RouterResponseSchema, data, "routersRouter.create").router;
41399
+ }, "create router");
41400
+ }),
41401
+ update: projectScopedProcedure.input(RouterUpdateRequestSchema).mutation(async ({ input, ctx }) => {
41402
+ return withErrorHandling3(async () => {
41403
+ const { router_id, ...fields } = omit(input, "project_id");
41404
+ const network = getNetworkService(ctx);
41405
+ const updateFields = pickDefined(fields);
41406
+ if (Object.keys(updateFields).length === 0) {
41407
+ throw new import_server29.TRPCError({
41408
+ code: "BAD_REQUEST",
41409
+ message: "No fields provided to update"
41410
+ });
41411
+ }
41412
+ const url = routerUrl(router_id);
41413
+ const response = await requestOrThrow(() => network.put(url, {
41414
+ router: updateFields
41415
+ }), RouterErrorHandlers.update, router_id);
41416
+ const data = await response.json();
41417
+ return parseOrThrow(RouterResponseSchema, data, "routersRouter.update").router;
41418
+ }, "update router");
41419
+ }),
41420
+ setGateway: projectScopedProcedure.input(RouterSetGatewayRequestSchema).mutation(async ({ input, ctx }) => {
41421
+ return withErrorHandling3(async () => {
41422
+ const { router_id, external_gateway_info } = input;
41423
+ const network = getNetworkService(ctx);
41424
+ const requestBody = {
41425
+ router: {
41426
+ external_gateway_info: buildExternalGatewayInfoBody(external_gateway_info)
41427
+ }
41428
+ };
41429
+ const url = routerUrl(router_id);
41430
+ const response = await requestOrThrow(() => network.put(url, requestBody), RouterErrorHandlers.setGateway, router_id);
41431
+ const data = await response.json();
41432
+ return parseOrThrow(RouterResponseSchema, data, "routersRouter.setGateway").router;
41433
+ }, "set router external gateway");
41434
+ }),
41435
+ clearGateway: projectScopedProcedure.input(RouterIdInputSchema).mutation(async ({ input, ctx }) => {
41436
+ return withErrorHandling3(async () => {
41437
+ const { router_id } = input;
41438
+ const network = getNetworkService(ctx);
41439
+ const url = routerUrl(router_id);
41440
+ const response = await requestOrThrow(() => network.put(url, {
41441
+ router: {
41442
+ external_gateway_info: {}
41443
+ }
41444
+ }), RouterErrorHandlers.clearGateway, router_id);
41445
+ const data = await response.json();
41446
+ return parseOrThrow(RouterResponseSchema, data, "routersRouter.clearGateway").router;
41447
+ }, "clear router external gateway");
41448
+ }),
41449
+ addInterface: projectScopedProcedure.input(RouterInterfaceRequestSchema).mutation(async ({ input, ctx }) => {
41450
+ return withErrorHandling3(async () => {
41451
+ const { router_id, subnet_id, port_id } = input;
41452
+ const network = getNetworkService(ctx);
41453
+ const requestBody = subnet_id ? {
41454
+ subnet_id
41455
+ } : {
41456
+ port_id
41457
+ };
41458
+ const url = routerUrl(router_id, "add_router_interface");
41459
+ const response = await requestOrThrow(() => network.put(url, requestBody), RouterErrorHandlers.addInterface, router_id);
41460
+ const data = await response.json();
41461
+ return parseOrThrow(RouterInterfaceInfoSchema, data, "routersRouter.addInterface");
41462
+ }, "add router interface");
41463
+ }),
41464
+ removeInterface: projectScopedProcedure.input(RouterInterfaceRequestSchema).mutation(async ({ input, ctx }) => {
41465
+ return withErrorHandling3(async () => {
41466
+ const { router_id, subnet_id, port_id } = input;
41467
+ const network = getNetworkService(ctx);
41468
+ const requestBody = subnet_id ? {
41469
+ subnet_id
41470
+ } : {
41471
+ port_id
41472
+ };
41473
+ const url = routerUrl(router_id, "remove_router_interface");
41474
+ const response = await requestOrThrow(() => network.put(url, requestBody), RouterErrorHandlers.removeInterface, router_id);
41475
+ const data = await response.json();
41476
+ return parseOrThrow(RouterInterfaceInfoSchema, data, "routersRouter.removeInterface");
41477
+ }, "remove router interface");
41478
+ }),
41479
+ delete: projectScopedProcedure.input(RouterIdInputSchema).mutation(async ({ input, ctx }) => {
41480
+ return withErrorHandling3(async () => {
41481
+ const { router_id } = input;
41482
+ const network = getNetworkService(ctx);
41483
+ const url = routerUrl(router_id);
41484
+ await requestOrThrow(() => network.del(url), RouterErrorHandlers.delete, router_id);
41485
+ return true;
41486
+ }, "delete router");
41487
+ }),
41488
+ listInterfaces: projectScopedProcedure.input(RouterIdInputSchema).query(async ({ input, ctx }) => {
41489
+ return withErrorHandling3(async () => {
41490
+ const { router_id } = input;
41491
+ const network = getNetworkService(ctx);
41492
+ (0, import_signal_openstack13.validateAndEncodeResourceId)(router_id, "Router");
41493
+ const portParams = appendQueryParamsFromObject({
41494
+ device_id: router_id,
41495
+ fields: [
41496
+ "id",
41497
+ "name",
41498
+ "network_id",
41499
+ "device_owner",
41500
+ "status",
41501
+ "admin_state_up",
41502
+ "mac_address",
41503
+ "fixed_ips"
41504
+ ]
41505
+ });
41506
+ const portsResponse = await requestOrThrow(() => network.get(withQuery(PORTS_BASE_URL, portParams)), RouterErrorHandlers.listInterfaces, router_id);
41507
+ const portsData = await portsResponse.json();
41508
+ const { ports } = parseOrThrow(RouterPortListResponseSchema, portsData, "routersRouter.listInterfaces");
41509
+ const interfacePorts = ports.filter(isRouterInterfacePort);
41510
+ const subnetIds = collectSubnetIds(interfacePorts);
41511
+ const networkIds = [
41512
+ ...new Set(interfacePorts.map((port) => port.network_id))
41513
+ ];
41514
+ const [subnets, networks] = await Promise.all([
41515
+ fetchSubnetSummaries(network, subnetIds, [
41516
+ "id",
41517
+ "name",
41518
+ "cidr"
41519
+ ]),
41520
+ fetchNetworkSummaries(network, networkIds)
41521
+ ]);
41522
+ return buildRouterInterfaces(interfacePorts, subnets, networks);
41523
+ }, "list router interfaces");
41524
+ }),
41525
+ listExtensions: projectScopedProcedure.input(projectScopedInputSchema).query(async ({ ctx }) => {
41526
+ return withErrorHandling3(async () => {
41527
+ const network = getNetworkService(ctx);
41528
+ const response = await requestOrThrow(() => network.get(EXTENSIONS_BASE_URL), RouterErrorHandlers.listExtensions);
41529
+ const data = await response.json();
41530
+ const { extensions } = parseOrThrow(ExtensionListResponseSchema, data, "routersRouter.listExtensions");
41531
+ return getRouterExtensionFlags(extensions.map((extension) => extension.alias));
41532
+ }, "list router-related network extensions");
41533
+ })
41534
+ };
41535
+
40691
41536
  // src/server/Network/routers/permissionRouter.ts
40692
41537
  var NETWORK_MAPPINGS = {
40693
41538
  // Network Operations
@@ -40909,19 +41754,27 @@ var buildNetworkRouters = /* @__PURE__ */ __name((policyDir) => ({
40909
41754
  securityGroup: securityGroupRouter,
40910
41755
  securityGroupRule: securityGroupRuleRouter,
40911
41756
  rbacPolicy: rbacPolicyRouter,
41757
+ routers: routersRouter,
40912
41758
  ...buildNetworkPermissionRouter(policyDir)
40913
41759
  })
40914
41760
  }), "buildNetworkRouters");
40915
41761
 
41762
+ // src/server/AppConfig/routers.ts
41763
+ var appConfigRouters = {
41764
+ appConfig: auroraRouter({
41765
+ get: publicProcedure.query(({ ctx }) => ctx.appConfig ?? {})
41766
+ })
41767
+ };
41768
+
40916
41769
  // src/server/routers.ts
40917
- var buildBaseRouter = /* @__PURE__ */ __name((policyDir) => mergeRouters(auroraRouter(authRouters), auroraRouter(buildComputeRouters(policyDir)), auroraRouter(buildObjectStorageRouters(policyDir)), auroraRouter(projectRouters), auroraRouter(buildNetworkRouters(policyDir))), "buildBaseRouter");
41770
+ var buildBaseRouter = /* @__PURE__ */ __name((policyDir) => mergeRouters(auroraRouter(authRouters), auroraRouter(buildComputeRouters(policyDir)), auroraRouter(buildObjectStorageRouters(policyDir)), auroraRouter(projectRouters), auroraRouter(buildNetworkRouters(policyDir)), auroraRouter(appConfigRouters)), "buildBaseRouter");
40918
41771
  var buildAppRouter = /* @__PURE__ */ __name((policyDir, extraRouters = []) => {
40919
41772
  if (extraRouters.length === 0) return buildBaseRouter(policyDir);
40920
41773
  return mergeRouters(buildBaseRouter(policyDir), ...extraRouters);
40921
41774
  }, "buildAppRouter");
40922
41775
 
40923
41776
  // src/server/context.ts
40924
- var import_signal_openstack11 = __toESM(require_esm());
41777
+ var import_signal_openstack14 = __toESM(require_esm());
40925
41778
 
40926
41779
  // src/server/sessionCookie.ts
40927
41780
  var import_cookie = require("@fastify/cookie");
@@ -40955,6 +41808,88 @@ function SessionCookie({ cookieName = DEFAULT_COOKIE_NAME, cookieDomain, insecur
40955
41808
  }
40956
41809
  __name(SessionCookie, "SessionCookie");
40957
41810
 
41811
+ // src/server/AppConfig/resolveAppConfig.ts
41812
+ function toRegExp(pattern) {
41813
+ return typeof pattern === "string" ? new RegExp(pattern) : pattern;
41814
+ }
41815
+ __name(toRegExp, "toRegExp");
41816
+ function isPlainObject(value) {
41817
+ return typeof value === "object" && value !== null && !Array.isArray(value);
41818
+ }
41819
+ __name(isPlainObject, "isPlainObject");
41820
+ function deepMerge(target, source) {
41821
+ const out = {
41822
+ ...target
41823
+ };
41824
+ for (const key of Object.keys(source)) {
41825
+ const sourceValue = source[key];
41826
+ if (sourceValue === void 0) continue;
41827
+ const targetValue = out[key];
41828
+ out[key] = isPlainObject(targetValue) && isPlainObject(sourceValue) ? deepMerge(targetValue, sourceValue) : sourceValue;
41829
+ }
41830
+ return out;
41831
+ }
41832
+ __name(deepMerge, "deepMerge");
41833
+ function mergeSettings(a, b) {
41834
+ if (!a && !b) return void 0;
41835
+ return deepMerge(a ?? {}, b ?? {});
41836
+ }
41837
+ __name(mergeSettings, "mergeSettings");
41838
+ function foldVisibility(base, delta) {
41839
+ if (!delta) return base;
41840
+ const enable = delta.enable ?? [];
41841
+ const disable = delta.disable ?? [];
41842
+ if (base?.mode === "allowlist") {
41843
+ const shown = new Set(base.allow);
41844
+ for (const key of enable) shown.add(key);
41845
+ for (const key of disable) shown.delete(key);
41846
+ return {
41847
+ mode: "allowlist",
41848
+ allow: [
41849
+ ...shown
41850
+ ]
41851
+ };
41852
+ }
41853
+ const hidden = new Set(base?.mode === "denylist" ? base.deny : []);
41854
+ for (const key of enable) hidden.delete(key);
41855
+ for (const key of disable) hidden.add(key);
41856
+ if (!base && hidden.size === 0) return void 0;
41857
+ return {
41858
+ mode: "denylist",
41859
+ deny: [
41860
+ ...hidden
41861
+ ]
41862
+ };
41863
+ }
41864
+ __name(foldVisibility, "foldVisibility");
41865
+ function pruneLayer(layer) {
41866
+ const out = {};
41867
+ if (layer.services) out.services = layer.services;
41868
+ if (layer.slots) out.slots = layer.slots;
41869
+ if (layer.serviceSettings) out.serviceSettings = layer.serviceSettings;
41870
+ if (layer.slotSettings) out.slotSettings = layer.slotSettings;
41871
+ if (layer.features) out.features = layer.features;
41872
+ return out;
41873
+ }
41874
+ __name(pruneLayer, "pruneLayer");
41875
+ function resolveAppConfig(config, domainName) {
41876
+ const { overrides = [], ...base } = config;
41877
+ let resolved = pruneLayer(base);
41878
+ if (!domainName) return resolved;
41879
+ for (const override of overrides) {
41880
+ if (!toRegExp(override.domain).test(domainName)) continue;
41881
+ resolved = pruneLayer({
41882
+ services: foldVisibility(resolved.services, override.services),
41883
+ slots: foldVisibility(resolved.slots, override.slots),
41884
+ serviceSettings: mergeSettings(resolved.serviceSettings, override.serviceSettings),
41885
+ slotSettings: mergeSettings(resolved.slotSettings, override.slotSettings),
41886
+ features: mergeSettings(resolved.features, override.features)
41887
+ });
41888
+ }
41889
+ return resolved;
41890
+ }
41891
+ __name(resolveAppConfig, "resolveAppConfig");
41892
+
40958
41893
  // src/server/context.ts
40959
41894
  var sessionRescopes = /* @__PURE__ */ new Map();
40960
41895
  async function createContext(opts, config) {
@@ -41009,7 +41944,7 @@ async function createContext(opts, config) {
41009
41944
  writable: false
41010
41945
  });
41011
41946
  if (currentAuthToken) {
41012
- openstackSession = await (0, import_signal_openstack11.SignalOpenstackSession)(normalizedEndpoint, {
41947
+ openstackSession = await (0, import_signal_openstack14.SignalOpenstackSession)(normalizedEndpoint, {
41013
41948
  auth: {
41014
41949
  identity: {
41015
41950
  methods: [
@@ -41027,6 +41962,7 @@ async function createContext(opts, config) {
41027
41962
  });
41028
41963
  }
41029
41964
  const validateSession = /* @__PURE__ */ __name(() => openstackSession?.isValid() || false, "validateSession");
41965
+ const appConfig = config.appConfig ? resolveAppConfig(config.appConfig, openstackSession?.getToken()?.tokenData?.user?.domain?.name) : void 0;
41030
41966
  let cachedUserInfo;
41031
41967
  let cachedUserId;
41032
41968
  const getUserInfo = /* @__PURE__ */ __name(async () => {
@@ -41072,7 +42008,7 @@ async function createContext(opts, config) {
41072
42008
  }
41073
42009
  }, "getUserInfo");
41074
42010
  const createSession = /* @__PURE__ */ __name(async (params) => {
41075
- openstackSession = await (0, import_signal_openstack11.SignalOpenstackSession)(normalizedEndpoint, {
42011
+ openstackSession = await (0, import_signal_openstack14.SignalOpenstackSession)(normalizedEndpoint, {
41076
42012
  auth: {
41077
42013
  identity: {
41078
42014
  methods: [
@@ -41203,6 +42139,7 @@ async function createContext(opts, config) {
41203
42139
  identityEndpoint: normalizedEndpoint,
41204
42140
  cephRegion: config.cephRegion,
41205
42141
  imageMetadataExcludedProperties: (config.imageMetadataExcludedProperties ?? "").split(",").map((s) => s.trim()).filter(Boolean),
42142
+ appConfig,
41206
42143
  createSession,
41207
42144
  rescopeSession,
41208
42145
  terminateSession,
@@ -41300,7 +42237,8 @@ async function createServer(config) {
41300
42237
  cookieName: config.cookieName,
41301
42238
  cookieDomain: config.cookieDomain,
41302
42239
  insecureCookies: config.insecureCookies,
41303
- debug: config.debug
42240
+ debug: config.debug,
42241
+ appConfig: config.appConfig
41304
42242
  };
41305
42243
  const appRouter = buildAppRouter(config.policyDir, config.routers ?? []);
41306
42244
  const server = (0, import_fastify.default)({
@@ -41476,8 +42414,95 @@ async function createServer(config) {
41476
42414
  return server;
41477
42415
  }
41478
42416
  __name(createServer, "createServer");
42417
+
42418
+ // src/server/AppConfig/appConfigSchema.ts
42419
+ var import_zod25 = require("zod");
42420
+
42421
+ // src/types/appConfig.ts
42422
+ var SLOT_NAMES = [
42423
+ "logo",
42424
+ "login",
42425
+ "pageFooter",
42426
+ "sideNavBanner",
42427
+ "serviceBadge",
42428
+ "servicePageActions",
42429
+ "projectsBanner",
42430
+ "serviceBanner"
42431
+ ];
42432
+
42433
+ // src/server/AppConfig/appConfigSchema.ts
42434
+ function auroraAppConfigSchema(featuresSchema = import_zod25.z.record(import_zod25.z.string(), import_zod25.z.unknown())) {
42435
+ const serviceVisibility = import_zod25.z.discriminatedUnion("mode", [
42436
+ import_zod25.z.strictObject({
42437
+ mode: import_zod25.z.literal("allowlist"),
42438
+ allow: import_zod25.z.array(import_zod25.z.string())
42439
+ }),
42440
+ import_zod25.z.strictObject({
42441
+ mode: import_zod25.z.literal("denylist"),
42442
+ deny: import_zod25.z.array(import_zod25.z.string())
42443
+ })
42444
+ ]).optional();
42445
+ const slotVisibility = import_zod25.z.discriminatedUnion("mode", [
42446
+ import_zod25.z.strictObject({
42447
+ mode: import_zod25.z.literal("allowlist"),
42448
+ allow: import_zod25.z.array(import_zod25.z.enum(SLOT_NAMES))
42449
+ }),
42450
+ import_zod25.z.strictObject({
42451
+ mode: import_zod25.z.literal("denylist"),
42452
+ deny: import_zod25.z.array(import_zod25.z.enum(SLOT_NAMES))
42453
+ })
42454
+ ]).optional();
42455
+ const serviceSettings = import_zod25.z.record(import_zod25.z.string(), import_zod25.z.record(import_zod25.z.string(), import_zod25.z.unknown())).optional();
42456
+ const slotSettingsShape = Object.fromEntries(SLOT_NAMES.map((name) => [
42457
+ name,
42458
+ import_zod25.z.record(import_zod25.z.string(), import_zod25.z.unknown()).optional()
42459
+ ]));
42460
+ const slotSettings = import_zod25.z.strictObject(slotSettingsShape).optional();
42461
+ const features = featuresSchema.optional();
42462
+ const base = {
42463
+ services: serviceVisibility,
42464
+ slots: slotVisibility,
42465
+ serviceSettings,
42466
+ slotSettings,
42467
+ features
42468
+ };
42469
+ const serviceDelta = import_zod25.z.strictObject({
42470
+ enable: import_zod25.z.array(import_zod25.z.string()).optional(),
42471
+ disable: import_zod25.z.array(import_zod25.z.string()).optional()
42472
+ }).optional();
42473
+ const slotDelta = import_zod25.z.strictObject({
42474
+ enable: import_zod25.z.array(import_zod25.z.enum(SLOT_NAMES)).optional(),
42475
+ disable: import_zod25.z.array(import_zod25.z.enum(SLOT_NAMES)).optional()
42476
+ }).optional();
42477
+ const domain = import_zod25.z.string().refine((pattern) => {
42478
+ try {
42479
+ new RegExp(pattern);
42480
+ return true;
42481
+ } catch {
42482
+ return false;
42483
+ }
42484
+ }, {
42485
+ message: "domain must be a valid regular expression pattern"
42486
+ });
42487
+ const override = import_zod25.z.strictObject({
42488
+ name: import_zod25.z.string().optional(),
42489
+ domain,
42490
+ services: serviceDelta,
42491
+ slots: slotDelta,
42492
+ serviceSettings,
42493
+ slotSettings,
42494
+ features
42495
+ });
42496
+ return import_zod25.z.strictObject({
42497
+ ...base,
42498
+ overrides: import_zod25.z.array(override).optional()
42499
+ });
42500
+ }
42501
+ __name(auroraAppConfigSchema, "auroraAppConfigSchema");
41479
42502
  // Annotate the CommonJS export names for ESM import in node:
41480
42503
  0 && (module.exports = {
42504
+ SLOT_NAMES,
42505
+ auroraAppConfigSchema,
41481
42506
  auroraRouter,
41482
42507
  createServer,
41483
42508
  domainScopedInputSchema,
@@ -41487,6 +42512,7 @@ __name(createServer, "createServer");
41487
42512
  projectScopedProcedure,
41488
42513
  protectedProcedure,
41489
42514
  publicProcedure,
42515
+ resolveAppConfig,
41490
42516
  validateOpenstackService
41491
42517
  });
41492
42518
  /*! Bundled license information: