@kumori/aurora-backend-handler 1.1.97 → 1.1.99

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.
@@ -227,13 +227,21 @@ interface Port<VARIANT> {
227
227
  interface Certificate<VARIANT> {
228
228
  certificate: VARIANT;
229
229
  }
230
- type ComponentFilesystemDto = FilesystemVolumeDto | FilesystemFileDto;
230
+ type ComponentFilesystemDto =
231
+ | FilesystemVolumeDto
232
+ | FilesystemSecretDto
233
+ | FilesystemFileDto;
231
234
 
232
235
  interface FilesystemVolumeDto {
233
236
  path: string;
234
237
  resourceVolume: string;
235
238
  }
236
239
 
240
+ interface FilesystemSecretDto {
241
+ path: string;
242
+ resourceSecret: string;
243
+ }
244
+
237
245
  interface FilesystemFileDto {
238
246
  path: string;
239
247
  param?: string;
@@ -412,10 +420,17 @@ export function handleParametersToGenerateData(
412
420
  switch (resource.type) {
413
421
  case "secret":
414
422
  resourcesResult.push({ secret: { name: resource.name } });
415
- environmentResult.push({
416
- varName: resource.name,
417
- secret: resource.name as string,
418
- });
423
+ if (resource.key) {
424
+ fileSystemResult.push({
425
+ path: resource.key,
426
+ resourceSecret: resource.name,
427
+ });
428
+ } else {
429
+ environmentResult.push({
430
+ varName: resource.name,
431
+ secret: resource.name as string,
432
+ });
433
+ }
419
434
  break;
420
435
  case "volume":
421
436
  resourcesResult.push({ volume: { name: resource.name } });
@@ -503,12 +518,20 @@ export function transformServiceToForm(service: Service): ServiceSpecForm {
503
518
  })),
504
519
  },
505
520
  environment: [service.environment],
506
- fileSystem: service.resources
507
- .filter((resource) => resource.type === "volume")
508
- .map((resource) => ({
509
- path: resource.key,
510
- resourceVolume: resource.name,
511
- })),
521
+ fileSystem: [
522
+ ...service.resources
523
+ .filter((resource) => resource.type === "volume")
524
+ .map((resource) => ({
525
+ path: resource.key,
526
+ resourceVolume: resource.name,
527
+ })),
528
+ ...service.resources
529
+ .filter((resource) => resource.type === "secret" && resource.key)
530
+ .map((resource) => ({
531
+ path: resource.key,
532
+ resourceSecret: resource.name,
533
+ })),
534
+ ],
512
535
  scaling: service.role[0].scalling,
513
536
  hsize: service.role[0].hsize
514
537
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kumori/aurora-backend-handler",
3
- "version": "1.1.97",
3
+ "version": "1.1.99",
4
4
  "description": "backend handler",
5
5
  "main": "backend-handler.ts",
6
6
  "scripts": {
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "dependencies": {
14
14
  "@kumori/aurora-interfaces": "^1.0.21",
15
- "@kumori/kumori-dsl-generator": "1.0.7",
15
+ "@kumori/kumori-dsl-generator": "1.0.8",
16
16
  "@kumori/kumori-module-generator": "^1.1.6",
17
17
  "ts-node": "^10.9.2",
18
18
  "uuid": "^11.1.0",
@@ -196,6 +196,15 @@ describe("handleParametersToGenerateData", () => {
196
196
  expect(result.environment).toContainEqual({ varName: "res1", secret: "res1" });
197
197
  });
198
198
 
199
+ it("maneja formResources de tipo secret con key (montado en path)", () => {
200
+ const result = handleParametersToGenerateData([], [
201
+ { name: "mySuperSecretSecret", type: "secret", key: "/mysecret" },
202
+ ]);
203
+ expect(result.resources).toContainEqual({ secret: { name: "mySuperSecretSecret" } });
204
+ expect(result.fileSystem).toContainEqual({ path: "/mysecret", resourceSecret: "mySuperSecretSecret" });
205
+ expect(result.environment).not.toContainEqual({ varName: "mySuperSecretSecret", secret: "mySuperSecretSecret" });
206
+ });
207
+
199
208
  it("maneja formResources de tipo volume", () => {
200
209
  const result = handleParametersToGenerateData([], [
201
210
  { name: "vol1", type: "volume", key: "/mnt/data" },