@kumori/aurora-backend-handler 1.0.97 → 1.0.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.
@@ -1,6 +1,4 @@
1
- import {
2
- ComponentSpec,
3
- } from "@kumori/kumori-module-generator";
1
+ import { ComponentSpec } from "@kumori/kumori-module-generator";
4
2
  import { Parameter } from "@kumori/kumori-module-generator/dist/types";
5
3
  import { getReferenceDomain } from "../websocket-manager";
6
4
 
@@ -10,14 +8,19 @@ import {
10
8
  ComponentSpec as ComponentSpecDSL,
11
9
  ServiceSpec as ServiceSpecDSL,
12
10
  } from "@kumori/kumori-dsl-generator";
13
- import { MarketplaceService, Resource, Service } from "@kumori/aurora-interfaces";
11
+ import {
12
+ MarketplaceService,
13
+ Resource,
14
+ Service,
15
+ } from "@kumori/aurora-interfaces";
14
16
 
15
17
  export type ResourceBundle =
16
18
  | { secret: { name: string; configResource: string } }
17
19
  | { volume: { name: string; configResource: string } }
18
20
  | { certificate: { name: string; configResource: string } }
19
21
  | { domain: { name: string; configResource: string } }
20
- | { port: { name: string; configResource: string } };
22
+ | { port: { name: string; configResource: string } }
23
+ | { ca: { name: string; configResource: string } };
21
24
 
22
25
  export interface Role {
23
26
  name: string;
@@ -90,6 +93,11 @@ export interface ServiceSpecForm {
90
93
  protocol: "HTTPS" | "TCP";
91
94
  publicPort?: string;
92
95
  domain?: string;
96
+ certificate?: string;
97
+ ca?: string;
98
+ certificateResource?: string;
99
+ withMtls?: boolean;
100
+ caResource?: string;
93
101
  }>;
94
102
  clientChannelsExtra?: Array<{ name: string }>;
95
103
  defaultExecutable: { cmd?: string; entryPoint?: string };
@@ -236,7 +244,7 @@ interface ServiceSpecDSLWithLocalComponent extends ServiceSpecDSL {
236
244
  */
237
245
  export function withDefaultValue<T>(
238
246
  value: T | null | undefined,
239
- defaultValue: T
247
+ defaultValue: T,
240
248
  ): T {
241
249
  return value != null ? value : defaultValue;
242
250
  }
@@ -261,7 +269,7 @@ export function handleParametersToGenerateData(
261
269
  content?: string;
262
270
  kind?: string;
263
271
  key?: string;
264
- }>
272
+ }>,
265
273
  ): {
266
274
  parameters: any[];
267
275
  environment: any[];
@@ -285,25 +293,25 @@ export function handleParametersToGenerateData(
285
293
 
286
294
  case "file":
287
295
  parametersResult.push({
288
- name: 'CONFIG_FILE_'+index,
296
+ name: "CONFIG_FILE_" + index,
289
297
  type: "string",
290
298
  defaultValue: (parameter.value as string) || "",
291
299
  });
292
300
  fileSystemResult.push({
293
301
  path: `${parameter.name}`,
294
- param: 'CONFIG_FILE_'+index,
302
+ param: "CONFIG_FILE_" + index,
295
303
  });
296
304
  break;
297
305
 
298
306
  case "fileContent":
299
307
  parametersResult.push({
300
- name: 'CONFIG_FILE_'+index,
308
+ name: "CONFIG_FILE_" + index,
301
309
  type: "string",
302
310
  defaultValue: parameter.content || (parameter.value as string) || "",
303
311
  });
304
312
  fileSystemResult.push({
305
313
  path: (parameter.value as string) || `${parameter.name}`,
306
- param: 'CONFIG_FILE_'+index,
314
+ param: "CONFIG_FILE_" + index,
307
315
  });
308
316
  break;
309
317
 
@@ -396,9 +404,9 @@ export function handleParametersToGenerateData(
396
404
  case "volume":
397
405
  resourcesResult.push({ volume: { name: resource.name } });
398
406
  fileSystemResult.push({
399
- path: resource.key || '',
400
- resourceVolume: resource.name,
401
- });
407
+ path: resource.key || "",
408
+ resourceVolume: resource.name,
409
+ });
402
410
  break;
403
411
  // case "certificate":
404
412
  // resourcesResult.push({ certificate: { name: resource.name } });
@@ -428,6 +436,7 @@ export function handleParametersToGenerateData(
428
436
  * @returns A ServiceSpecForm object with the data of the service.
429
437
  */
430
438
  export function transformServiceToForm(service: Service): ServiceSpecForm {
439
+ console.log('--- TRANSFORM SERVICE TO FORM ---', service.name);
431
440
  return {
432
441
  tenantId: service.tenant,
433
442
  accountId: service.account,
@@ -446,10 +455,13 @@ export function transformServiceToForm(service: Service): ServiceSpecForm {
446
455
  ch.protocol === "http"
447
456
  ? "HTTPS"
448
457
  : ch.protocol === "tcp"
449
- ? "TCP"
450
- : "TCP",
458
+ ? "TCP"
459
+ : "TCP",
451
460
  publicPort: ch.portNum?.toString() || "",
452
461
  domain: ch.portNum?.toString() || "",
462
+ certificateResource: ch.certificateResource,
463
+ withMtls: ch.withMtls,
464
+ caResource: ch.caResource,
453
465
  })),
454
466
  clientChannelsExtra: service.duplexChannels.map((ch) => ({
455
467
  name: ch.name,
@@ -490,7 +502,7 @@ export function transformServiceToForm(service: Service): ServiceSpecForm {
490
502
  */
491
503
  export async function generateServiceSpec(
492
504
  form: ServiceSpecForm,
493
- marketplaceItem?: MarketplaceService
505
+ marketplaceItem?: MarketplaceService,
494
506
  ): Promise<ServiceWithLocalComponentSpec> {
495
507
  const formParams = form.config.parameters;
496
508
  const formResources = form.config.resources;
@@ -500,22 +512,49 @@ export async function generateServiceSpec(
500
512
  fileSystem,
501
513
  resources: componentResources,
502
514
  } = handleParametersToGenerateData(formParams, formResources);
515
+
516
+ console.log('--- GENERATE SERVICE SPEC ---', form.serviceId);
517
+ console.log('Channels from Form:', JSON.stringify(form.channels));
518
+
503
519
  const serverConfigDomainResources: ArtifactConfigResource[] = form.channels
504
520
  .filter((channel) => channel.protocol === "HTTPS" && channel.isPublic)
505
521
  .map((channel) => ({ domain: { name: `${channel.channelName}_domain` } }));
506
- if (serverConfigDomainResources.length) {
522
+
523
+ const hasDefaultCertChannel = form.channels.some(
524
+ (ch) => ch.protocol === "HTTPS" && ch.isPublic && !ch.certificateResource
525
+ );
526
+ if (hasDefaultCertChannel) {
507
527
  serverConfigDomainResources.push({
508
528
  certificate: { name: "main_inbound_servercert" },
509
529
  });
510
530
  }
511
531
 
532
+ const customCertResources: ArtifactConfigResource[] = form.channels
533
+ .filter(
534
+ (ch) => ch.protocol === "HTTPS" && ch.isPublic && ch.certificateResource
535
+ )
536
+ .map((ch) => ({ certificate: { name: `${ch.channelName}_cert` } }));
537
+
538
+ const customCaResources: ArtifactConfigResource[] = form.channels
539
+ .filter(
540
+ (ch) =>
541
+ ch.protocol === "HTTPS" && ch.isPublic && ch.withMtls && ch.caResource
542
+ )
543
+ .map((ch) => ({ ca: { name: `${ch.channelName}_ca` } }));
544
+
545
+ console.log('Generated Resources Spec:', {
546
+ serverConfigDomainResources,
547
+ customCertResources,
548
+ customCaResources
549
+ });
550
+
512
551
  const serviceConfigPortResources: ArtifactConfigResource[] = form.channels
513
552
  .filter((channel) => channel.protocol === "TCP" && channel.isPublic)
514
553
  .map((channel) => ({ port: { name: `${channel.channelName}_port` } }));
515
554
 
516
555
  const serviceConfigResources: ArtifactConfigResource[] = form.config.resources
517
556
  .filter(
518
- (resource) => resource.type === "volume" || resource.type === "secret"
557
+ (resource) => resource.type === "volume" || resource.type === "secret",
519
558
  )
520
559
  .map((resource) => {
521
560
  if (resource.type === "secret") {
@@ -543,7 +582,7 @@ export async function generateServiceSpec(
543
582
  resource.type === "string" ||
544
583
  resource.type === "boolean" ||
545
584
  resource.type === "number" ||
546
- resource.type === "fileContent"
585
+ resource.type === "fileContent",
547
586
  )
548
587
  .map((resource) => {
549
588
  if (resource.type === "string" || resource.type === "fileContent") {
@@ -576,7 +615,7 @@ export async function generateServiceSpec(
576
615
 
577
616
  const rolesResources: ResourceBundle[] = form.config.resources
578
617
  .filter(
579
- (resource) => resource.type === "volume" || resource.type === "secret"
618
+ (resource) => resource.type === "volume" || resource.type === "secret",
580
619
  )
581
620
  .map((resource) => {
582
621
  if (resource.type === "secret") {
@@ -613,7 +652,9 @@ export async function generateServiceSpec(
613
652
  {
614
653
  certificate: {
615
654
  name: "servercert",
616
- configResource: "main_inbound_servercert",
655
+ configResource: channel.certificateResource
656
+ ? `${channel.channelName}_cert`
657
+ : "main_inbound_servercert",
617
658
  },
618
659
  },
619
660
  {
@@ -622,6 +663,16 @@ export async function generateServiceSpec(
622
663
  configResource: `${channel.channelName}_domain`,
623
664
  },
624
665
  },
666
+ ...(channel.withMtls && channel.caResource
667
+ ? [
668
+ {
669
+ ca: {
670
+ name: "clientcertca",
671
+ configResource: `${channel.channelName}_ca`,
672
+ },
673
+ },
674
+ ]
675
+ : []),
625
676
  ],
626
677
  },
627
678
  },
@@ -669,7 +720,7 @@ export async function generateServiceSpec(
669
720
  });
670
721
  }
671
722
  return result;
672
- }
723
+ },
673
724
  );
674
725
  const topologyClientsChannels: Connector[] = (form.clientChannels || []).map(
675
726
  (channel) => ({
@@ -677,7 +728,7 @@ export async function generateServiceSpec(
677
728
  clientChannel: channel.name,
678
729
  serverRole: "self",
679
730
  serverChannel: channel.name,
680
- })
731
+ }),
681
732
  );
682
733
  const topology: Connector[] = [
683
734
  ...topologyServerChannels,
@@ -691,7 +742,7 @@ export async function generateServiceSpec(
691
742
  resource.type === "string" ||
692
743
  resource.type === "number" ||
693
744
  resource.type === "boolean" ||
694
- resource.type === "fileContent"
745
+ resource.type === "fileContent",
695
746
  )
696
747
  .map((resource) => {
697
748
  if (resource.type === "string") {
@@ -723,7 +774,7 @@ export async function generateServiceSpec(
723
774
  (resource) =>
724
775
  resource.type === "volume" &&
725
776
  resource.kind === "volatile" &&
726
- resource.size
777
+ resource.size,
727
778
  );
728
779
 
729
780
  for (const resource of volatileResources) {
@@ -741,7 +792,7 @@ export async function generateServiceSpec(
741
792
  } catch (error) {
742
793
  console.error(
743
794
  `Error creating volatile volume for ${resource.name}:`,
744
- error
795
+ error,
745
796
  );
746
797
  throw error;
747
798
  }
@@ -750,7 +801,7 @@ export async function generateServiceSpec(
750
801
 
751
802
  const deploymentConfigResources: DeploymentResource[] = form.config.resources
752
803
  .filter(
753
- (resource) => resource.type === "secret" || resource.type === "volume"
804
+ (resource) => resource.type === "secret" || resource.type === "volume",
754
805
  )
755
806
  .map((resource) => {
756
807
  if (resource.type === "secret") {
@@ -838,7 +889,11 @@ export async function generateServiceSpec(
838
889
  resource: withDefaultValue(channel.domain, ""),
839
890
  },
840
891
  }));
841
- if (deploymentConfigDomain.length) {
892
+
893
+ const hasDefaultCertChannelDeployment = form.channels.some(
894
+ (ch) => ch.protocol === "HTTPS" && ch.isPublic && !ch.certificateResource
895
+ );
896
+ if (hasDefaultCertChannelDeployment) {
842
897
  deploymentConfigDomain.push({
843
898
  certificate: {
844
899
  name: "main_inbound_servercert",
@@ -846,6 +901,29 @@ export async function generateServiceSpec(
846
901
  },
847
902
  });
848
903
  }
904
+
905
+ const customCertDeploymentResources: DeploymentResource[] = form.channels
906
+ .filter(
907
+ (ch) => ch.protocol === "HTTPS" && ch.isPublic && ch.certificateResource
908
+ )
909
+ .map((ch) => ({
910
+ certificate: {
911
+ name: `${ch.channelName}_cert`,
912
+ resource: ch.certificateResource!,
913
+ },
914
+ }));
915
+
916
+ const customCaDeploymentResources: DeploymentResource[] = form.channels
917
+ .filter(
918
+ (ch) =>
919
+ ch.protocol === "HTTPS" && ch.isPublic && ch.withMtls && ch.caResource
920
+ )
921
+ .map((ch) => ({
922
+ ca: {
923
+ name: `${ch.channelName}_ca`,
924
+ resource: ch.caResource!,
925
+ },
926
+ }));
849
927
  const deploymentConfigPort: DeploymentResource[] = form.channels
850
928
  .filter((channel) => channel.protocol === "TCP" && channel.isPublic)
851
929
  .map((channel) => ({
@@ -897,7 +975,7 @@ export async function generateServiceSpec(
897
975
  cmd: withDefaultValue(form.defaultExecutable.cmd, undefined),
898
976
  entrypoint: withDefaultValue(
899
977
  form.defaultExecutable.entryPoint,
900
- undefined
978
+ undefined,
901
979
  ),
902
980
  },
903
981
  };
@@ -957,6 +1035,8 @@ export async function generateServiceSpec(
957
1035
  parameters,
958
1036
  resources: [
959
1037
  ...serverConfigDomainResources,
1038
+ ...customCertResources,
1039
+ ...customCaResources,
960
1040
  ...serviceConfigPortResources,
961
1041
  ...serviceConfigResources,
962
1042
  ...volatileVolumeResources,
@@ -987,7 +1067,7 @@ export async function generateServiceSpec(
987
1067
  ...acc,
988
1068
  [withDefaultValue(role, "")]: 1,
989
1069
  }),
990
- {}
1070
+ {},
991
1071
  ),
992
1072
  },
993
1073
  }),
@@ -1021,6 +1101,8 @@ export async function generateServiceSpec(
1021
1101
  parameters: [...deploymentConfigParameters],
1022
1102
  resources: [
1023
1103
  ...deploymentConfigDomain,
1104
+ ...customCertDeploymentResources,
1105
+ ...customCaDeploymentResources,
1024
1106
  ...deploymentConfigPort,
1025
1107
  ...deploymentConfigResources,
1026
1108
  ],
@@ -1047,7 +1129,7 @@ export async function generateServiceSpec(
1047
1129
  */
1048
1130
  async function generateServiceSpecDSL(
1049
1131
  form: ServiceSpecForm,
1050
- marketplaceItem?: MarketplaceService
1132
+ marketplaceItem?: MarketplaceService,
1051
1133
  ): Promise<ServiceSpecDSLWithLocalComponent> {
1052
1134
  const formParams = form.config.parameters;
1053
1135
  const formResources = form.config.resources;
@@ -1061,19 +1143,42 @@ async function generateServiceSpecDSL(
1061
1143
  const serverConfigDomainResources: ArtifactConfigResource[] = form.channels
1062
1144
  .filter((channel) => channel.protocol === "HTTPS" && channel.isPublic)
1063
1145
  .map((channel) => ({ domain: { name: `${channel.channelName}_domain` } }));
1064
- if (serverConfigDomainResources.length) {
1146
+
1147
+ const hasDefaultCertChannel = form.channels.some(
1148
+ (ch) => ch.protocol === "HTTPS" && ch.isPublic && !ch.certificateResource
1149
+ );
1150
+ if (hasDefaultCertChannel) {
1065
1151
  serverConfigDomainResources.push({
1066
1152
  certificate: { name: "main_inbound_servercert" },
1067
1153
  });
1068
1154
  }
1069
1155
 
1156
+ const customCertResources: ArtifactConfigResource[] = form.channels
1157
+ .filter(
1158
+ (ch) => ch.protocol === "HTTPS" && ch.isPublic && ch.certificateResource
1159
+ )
1160
+ .map((ch) => ({ certificate: { name: `${ch.channelName}_cert` } }));
1161
+
1162
+ const customCaResources: ArtifactConfigResource[] = form.channels
1163
+ .filter(
1164
+ (ch) =>
1165
+ ch.protocol === "HTTPS" && ch.isPublic && ch.withMtls && ch.caResource
1166
+ )
1167
+ .map((ch) => ({ ca: { name: `${ch.channelName}_ca` } }));
1168
+
1169
+ console.log('Generated Resources Config:', {
1170
+ serverConfigDomainResources,
1171
+ customCertResources,
1172
+ customCaResources
1173
+ });
1174
+
1070
1175
  const serviceConfigPortResources: ArtifactConfigResource[] = form.channels
1071
1176
  .filter((channel) => channel.protocol === "TCP" && channel.isPublic)
1072
1177
  .map((channel) => ({ port: { name: `${channel.channelName}_port` } }));
1073
1178
 
1074
1179
  const serviceConfigResources: ArtifactConfigResource[] = form.config.resources
1075
1180
  .filter(
1076
- (resource) => resource.type === "volume" || resource.type === "secret"
1181
+ (resource) => resource.type === "volume" || resource.type === "secret",
1077
1182
  )
1078
1183
  .map((resource) => {
1079
1184
  if (resource.type === "secret") {
@@ -1090,29 +1195,27 @@ async function generateServiceSpecDSL(
1090
1195
  .filter((param) => param.type === "volume" && param.size)
1091
1196
  .map((param) => ({ volume: { name: param.name } }));
1092
1197
 
1093
-
1094
-
1095
1198
  const rolesParameters: Parameter[] = form.config.parameters
1096
1199
  .filter(
1097
1200
  (resource) =>
1098
1201
  resource.type === "string" ||
1099
1202
  resource.type === "boolean" ||
1100
1203
  resource.type === "number" ||
1101
- resource.type === "file"
1204
+ resource.type === "file",
1102
1205
  )
1103
1206
  .map((resource, index) => {
1104
- if (resource.type === "string" ) {
1207
+ if (resource.type === "string") {
1105
1208
  return {
1106
1209
  name: resource.name,
1107
1210
  type: "string",
1108
1211
  configParam: resource.name,
1109
1212
  };
1110
1213
  }
1111
- if(resource.type === "file") {
1214
+ if (resource.type === "file") {
1112
1215
  return {
1113
- name: "CONFIG_FILE_"+index,
1216
+ name: "CONFIG_FILE_" + index,
1114
1217
  type: "string",
1115
- configParam: "CONFIG_FILE_"+index,
1218
+ configParam: "CONFIG_FILE_" + index,
1116
1219
  };
1117
1220
  }
1118
1221
  if (resource.type === "boolean" || resource.type === "bool") {
@@ -1138,12 +1241,12 @@ async function generateServiceSpecDSL(
1138
1241
 
1139
1242
  const rolesResources: ResourceBundle[] = form.config.resources
1140
1243
  .filter(
1141
- (resource) => resource.type === "volume" || resource.type === "secret"
1244
+ (resource) => resource.type === "volume" || resource.type === "secret",
1142
1245
  )
1143
1246
  .map((resource) => {
1144
1247
  if (resource.type === "secret") {
1145
1248
  return {
1146
- secret: { name: resource.name, configResource: resource.name || '' },
1249
+ secret: { name: resource.name, configResource: resource.name || "" },
1147
1250
  };
1148
1251
  }
1149
1252
  return { volume: { name: resource.name, configResource: resource.name } };
@@ -1169,7 +1272,9 @@ async function generateServiceSpecDSL(
1169
1272
  {
1170
1273
  certificate: {
1171
1274
  name: "servercert",
1172
- configResource: "main_inbound_servercert",
1275
+ configResource: channel.certificateResource
1276
+ ? `${channel.channelName}_cert`
1277
+ : "main_inbound_servercert",
1173
1278
  },
1174
1279
  },
1175
1280
  {
@@ -1178,6 +1283,16 @@ async function generateServiceSpecDSL(
1178
1283
  configResource: `${channel.channelName}_domain`,
1179
1284
  },
1180
1285
  },
1286
+ ...(channel.withMtls && channel.caResource
1287
+ ? [
1288
+ {
1289
+ ca: {
1290
+ name: "clientcertca",
1291
+ configResource: `${channel.channelName}_ca`,
1292
+ },
1293
+ },
1294
+ ]
1295
+ : []),
1181
1296
  ],
1182
1297
  },
1183
1298
  },
@@ -1186,14 +1301,16 @@ async function generateServiceSpecDSL(
1186
1301
  return {
1187
1302
  name: `${channel.channelName}_inbound`,
1188
1303
  artifact: {
1189
- artifactKind: "service" as const,
1304
+ artifactKind: "service" as const,
1190
1305
  moduleDomain: "kumori",
1191
1306
  moduleName: "builtin",
1192
- moduleVersion: [1, 3, 0] as [number, number, number],
1307
+ moduleVersion: [1, 3, 0] as [number, number, number],
1193
1308
  artifactName: "TCPInbound",
1194
1309
  packageLocation: "",
1195
1310
  config: {
1196
- parameters: [{ name: "type", value: "tcp", type: "string" as const }],
1311
+ parameters: [
1312
+ { name: "type", value: "tcp", type: "string" as const },
1313
+ ],
1197
1314
  resources: [
1198
1315
  {
1199
1316
  port: {
@@ -1232,7 +1349,7 @@ async function generateServiceSpecDSL(
1232
1349
  clientChannel: channel.name,
1233
1350
  serverRole: "self",
1234
1351
  serverChannel: channel.name,
1235
- })
1352
+ }),
1236
1353
  );
1237
1354
 
1238
1355
  const topology = [...topologyServerChannels, ...topologyClientsChannels];
@@ -1245,7 +1362,7 @@ async function generateServiceSpecDSL(
1245
1362
  resource.type === "number" ||
1246
1363
  resource.type === "boolean" ||
1247
1364
  resource.type === "bool" ||
1248
- resource.type === "file"
1365
+ resource.type === "file",
1249
1366
  )
1250
1367
  .map((resource, index) => {
1251
1368
  if (resource.type === "string") {
@@ -1271,12 +1388,9 @@ async function generateServiceSpecDSL(
1271
1388
  return { name: resource.name, value: resource.value, type: "string" };
1272
1389
  });
1273
1390
 
1274
-
1275
-
1276
-
1277
1391
  const deploymentConfigResources: DeploymentResource[] = form.config.resources
1278
1392
  .filter(
1279
- (resource) => resource.type === "secret" || resource.type === "volume"
1393
+ (resource) => resource.type === "secret" || resource.type === "volume",
1280
1394
  )
1281
1395
  .map((resource) => {
1282
1396
  if (resource.type === "secret") {
@@ -1342,7 +1456,11 @@ async function generateServiceSpecDSL(
1342
1456
  resource: withDefaultValue(channel.domain, ""),
1343
1457
  },
1344
1458
  }));
1345
- if (deploymentConfigDomain.length) {
1459
+
1460
+ const hasDefaultCertChannelDeployment = form.channels.some(
1461
+ (ch) => ch.protocol === "HTTPS" && ch.isPublic && !ch.certificateResource
1462
+ );
1463
+ if (hasDefaultCertChannelDeployment) {
1346
1464
  deploymentConfigDomain.push({
1347
1465
  certificate: {
1348
1466
  name: "main_inbound_servercert",
@@ -1351,6 +1469,35 @@ async function generateServiceSpecDSL(
1351
1469
  });
1352
1470
  }
1353
1471
 
1472
+ const customCertDeploymentResources: DeploymentResource[] = form.channels
1473
+ .filter(
1474
+ (ch) => ch.protocol === "HTTPS" && ch.isPublic && ch.certificateResource
1475
+ )
1476
+ .map((ch) => ({
1477
+ certificate: {
1478
+ name: `${ch.channelName}_cert`,
1479
+ resource: ch.certificateResource!,
1480
+ },
1481
+ }));
1482
+
1483
+ const customCaDeploymentResources: DeploymentResource[] = form.channels
1484
+ .filter(
1485
+ (ch) =>
1486
+ ch.protocol === "HTTPS" && ch.isPublic && ch.withMtls && ch.caResource
1487
+ )
1488
+ .map((ch) => ({
1489
+ ca: {
1490
+ name: `${ch.channelName}_ca`,
1491
+ resource: ch.caResource!,
1492
+ },
1493
+ }));
1494
+
1495
+ console.log('Generated Deployment Resources:', {
1496
+ deploymentConfigDomain,
1497
+ customCertDeploymentResources,
1498
+ customCaDeploymentResources
1499
+ });
1500
+
1354
1501
  const deploymentConfigPort: DeploymentResource[] = form.channels
1355
1502
  .filter((channel) => channel.protocol === "TCP" && channel.isPublic)
1356
1503
  .map((channel) => ({
@@ -1396,7 +1543,7 @@ async function generateServiceSpecDSL(
1396
1543
  packageLocation: "deployment",
1397
1544
  artifactName: withDefaultValue(
1398
1545
  marketplaceItem?.artifact || form.serviceId + "_service",
1399
- ""
1546
+ "",
1400
1547
  ),
1401
1548
  tenantId: withDefaultValue(form.tenantId, ""),
1402
1549
  accountId: withDefaultValue(form.accountId, ""),
@@ -1424,6 +1571,8 @@ async function generateServiceSpecDSL(
1424
1571
  parameters,
1425
1572
  resources: [
1426
1573
  ...serverConfigDomainResources,
1574
+ ...customCertResources,
1575
+ ...customCaResources,
1427
1576
  ...serviceConfigPortResources,
1428
1577
  ...serviceConfigResources,
1429
1578
  ...volatileVolumeResources,
@@ -1433,7 +1582,7 @@ async function generateServiceSpecDSL(
1433
1582
  {
1434
1583
  name: withDefaultValue(
1435
1584
  marketplaceItem?.deploymentData?.name || form.serviceId,
1436
- ""
1585
+ "",
1437
1586
  ),
1438
1587
  artifact: {
1439
1588
  artifactKind:
@@ -1445,18 +1594,18 @@ async function generateServiceSpecDSL(
1445
1594
  : "mod.local",
1446
1595
  moduleName: withDefaultValue(
1447
1596
  marketplaceItem?.module || form.serviceId,
1448
- ""
1597
+ "",
1449
1598
  ),
1450
1599
  moduleVersion: marketplaceItem?.version
1451
1600
  ? (marketplaceItem.version.split(".").map(Number) as [
1452
1601
  number,
1453
1602
  number,
1454
- number
1603
+ number,
1455
1604
  ])
1456
1605
  : ([0, 0, 1] as [number, number, number]),
1457
1606
  artifactName: withDefaultValue(
1458
1607
  marketplaceItem?.artifact || form.serviceId + "_component",
1459
- ""
1608
+ "",
1460
1609
  ),
1461
1610
  packageLocation: hasMarketplacePackage
1462
1611
  ? marketplaceItem?.package || ""
@@ -1474,6 +1623,8 @@ async function generateServiceSpecDSL(
1474
1623
  parameters: [...deploymentConfigParameters],
1475
1624
  resources: [
1476
1625
  ...deploymentConfigDomain,
1626
+ ...customCertDeploymentResources,
1627
+ ...customCaDeploymentResources,
1477
1628
  ...deploymentConfigPort,
1478
1629
  ...deploymentConfigResources,
1479
1630
  ],
@@ -1539,7 +1690,7 @@ async function generateServiceSpecDSL(
1539
1690
  cmd: withDefaultValue(form.defaultExecutable.cmd, undefined),
1540
1691
  entrypoint: withDefaultValue(
1541
1692
  form.defaultExecutable.entryPoint,
1542
- undefined
1693
+ undefined,
1543
1694
  ),
1544
1695
  },
1545
1696
  };
@@ -1558,15 +1709,16 @@ async function generateServiceSpecDSL(
1558
1709
  */
1559
1710
  export async function deployServiceHelper(
1560
1711
  service: Service,
1561
- marketplaceItem?: MarketplaceService
1712
+ marketplaceItem?: MarketplaceService,
1562
1713
  ): Promise<FormData> {
1563
1714
  const serviceForm: ServiceSpecForm = transformServiceToForm(service);
1564
1715
 
1565
1716
  let CUEBundle;
1566
1717
  const serviceSpecDSL = await generateServiceSpecDSL(
1567
1718
  serviceForm,
1568
- marketplaceItem
1719
+ marketplaceItem,
1569
1720
  );
1721
+ console.log('Final generated ServiceSpecDSL:', JSON.stringify(serviceSpecDSL, null, 2));
1570
1722
  CUEBundle = buildServiceDeploymentModule(serviceSpecDSL);
1571
1723
 
1572
1724
  // if (marketplaceItem?.package) {
@@ -1589,11 +1741,11 @@ export async function deployServiceHelper(
1589
1741
  JSON.stringify({
1590
1742
  targetAccount: withDefaultValue(serviceForm.accountId, ""),
1591
1743
  targetEnvironment: withDefaultValue(serviceForm.environmentId, ""),
1592
- })
1744
+ }),
1593
1745
  );
1594
1746
  formData.append(
1595
1747
  "labels",
1596
- JSON.stringify({ project: withDefaultValue(service.project, "") })
1748
+ JSON.stringify({ project: withDefaultValue(service.project, "") }),
1597
1749
  );
1598
1750
  formData.append("comment", " ");
1599
1751
  return formData;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kumori/aurora-backend-handler",
3
- "version": "1.0.97",
3
+ "version": "1.0.99",
4
4
  "description": "backend handler",
5
5
  "main": "backend-handler.ts",
6
6
  "scripts": {
@@ -11,7 +11,7 @@
11
11
  "glob": "^11.0.0"
12
12
  },
13
13
  "dependencies": {
14
- "@kumori/aurora-interfaces": "^1.0.11",
14
+ "@kumori/aurora-interfaces": "^1.0.12",
15
15
  "@kumori/kumori-dsl-generator": "^1.0.4",
16
16
  "@kumori/kumori-module-generator": "^1.1.6",
17
17
  "ts-node": "^10.9.2",