@kumori/aurora-backend-handler 1.0.98 → 1.0.100
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.
- package/api/deploy-service-helper.ts +43 -41
- package/helpers/user-helper.ts +4 -5
- package/package.json +1 -1
- package/websocket-manager.ts +21 -0
|
@@ -436,7 +436,6 @@ export function handleParametersToGenerateData(
|
|
|
436
436
|
* @returns A ServiceSpecForm object with the data of the service.
|
|
437
437
|
*/
|
|
438
438
|
export function transformServiceToForm(service: Service): ServiceSpecForm {
|
|
439
|
-
console.log('--- TRANSFORM SERVICE TO FORM ---', service.name);
|
|
440
439
|
return {
|
|
441
440
|
tenantId: service.tenant,
|
|
442
441
|
accountId: service.account,
|
|
@@ -513,15 +512,12 @@ export async function generateServiceSpec(
|
|
|
513
512
|
resources: componentResources,
|
|
514
513
|
} = handleParametersToGenerateData(formParams, formResources);
|
|
515
514
|
|
|
516
|
-
console.log('--- GENERATE SERVICE SPEC ---', form.serviceId);
|
|
517
|
-
console.log('Channels from Form:', JSON.stringify(form.channels));
|
|
518
|
-
|
|
519
515
|
const serverConfigDomainResources: ArtifactConfigResource[] = form.channels
|
|
520
516
|
.filter((channel) => channel.protocol === "HTTPS" && channel.isPublic)
|
|
521
517
|
.map((channel) => ({ domain: { name: `${channel.channelName}_domain` } }));
|
|
522
518
|
|
|
523
519
|
const hasDefaultCertChannel = form.channels.some(
|
|
524
|
-
(ch) => ch.protocol === "HTTPS" && ch.isPublic && !ch.certificateResource
|
|
520
|
+
(ch) => ch.protocol === "HTTPS" && ch.isPublic && !ch.certificateResource,
|
|
525
521
|
);
|
|
526
522
|
if (hasDefaultCertChannel) {
|
|
527
523
|
serverConfigDomainResources.push({
|
|
@@ -531,23 +527,17 @@ export async function generateServiceSpec(
|
|
|
531
527
|
|
|
532
528
|
const customCertResources: ArtifactConfigResource[] = form.channels
|
|
533
529
|
.filter(
|
|
534
|
-
(ch) => ch.protocol === "HTTPS" && ch.isPublic && ch.certificateResource
|
|
530
|
+
(ch) => ch.protocol === "HTTPS" && ch.isPublic && ch.certificateResource,
|
|
535
531
|
)
|
|
536
532
|
.map((ch) => ({ certificate: { name: `${ch.channelName}_cert` } }));
|
|
537
533
|
|
|
538
534
|
const customCaResources: ArtifactConfigResource[] = form.channels
|
|
539
535
|
.filter(
|
|
540
536
|
(ch) =>
|
|
541
|
-
ch.protocol === "HTTPS" && ch.isPublic && ch.withMtls && ch.caResource
|
|
537
|
+
ch.protocol === "HTTPS" && ch.isPublic && ch.withMtls && ch.caResource,
|
|
542
538
|
)
|
|
543
539
|
.map((ch) => ({ ca: { name: `${ch.channelName}_ca` } }));
|
|
544
540
|
|
|
545
|
-
console.log('Generated Resources Spec:', {
|
|
546
|
-
serverConfigDomainResources,
|
|
547
|
-
customCertResources,
|
|
548
|
-
customCaResources
|
|
549
|
-
});
|
|
550
|
-
|
|
551
541
|
const serviceConfigPortResources: ArtifactConfigResource[] = form.channels
|
|
552
542
|
.filter((channel) => channel.protocol === "TCP" && channel.isPublic)
|
|
553
543
|
.map((channel) => ({ port: { name: `${channel.channelName}_port` } }));
|
|
@@ -646,9 +636,6 @@ export async function generateServiceSpec(
|
|
|
646
636
|
config: {
|
|
647
637
|
parameters: [
|
|
648
638
|
{ name: "type", value: "https", type: "string" },
|
|
649
|
-
...(channel.withMtls && channel.caResource
|
|
650
|
-
? [{ name: "mtls", value: "true", type: "bool" as const }]
|
|
651
|
-
: []),
|
|
652
639
|
// { name: "websocket", value: "true", type: "bool", configParam: "websocket" },
|
|
653
640
|
],
|
|
654
641
|
resources: [
|
|
@@ -670,7 +657,7 @@ export async function generateServiceSpec(
|
|
|
670
657
|
? [
|
|
671
658
|
{
|
|
672
659
|
ca: {
|
|
673
|
-
name: "
|
|
660
|
+
name: "clientcertca",
|
|
674
661
|
configResource: `${channel.channelName}_ca`,
|
|
675
662
|
},
|
|
676
663
|
},
|
|
@@ -892,7 +879,11 @@ export async function generateServiceSpec(
|
|
|
892
879
|
resource: withDefaultValue(channel.domain, ""),
|
|
893
880
|
},
|
|
894
881
|
}));
|
|
895
|
-
|
|
882
|
+
|
|
883
|
+
const hasDefaultCertChannelDeployment = form.channels.some(
|
|
884
|
+
(ch) => ch.protocol === "HTTPS" && ch.isPublic && !ch.certificateResource,
|
|
885
|
+
);
|
|
886
|
+
if (hasDefaultCertChannelDeployment) {
|
|
896
887
|
deploymentConfigDomain.push({
|
|
897
888
|
certificate: {
|
|
898
889
|
name: "main_inbound_servercert",
|
|
@@ -900,6 +891,29 @@ export async function generateServiceSpec(
|
|
|
900
891
|
},
|
|
901
892
|
});
|
|
902
893
|
}
|
|
894
|
+
|
|
895
|
+
const customCertDeploymentResources: DeploymentResource[] = form.channels
|
|
896
|
+
.filter(
|
|
897
|
+
(ch) => ch.protocol === "HTTPS" && ch.isPublic && ch.certificateResource,
|
|
898
|
+
)
|
|
899
|
+
.map((ch) => ({
|
|
900
|
+
certificate: {
|
|
901
|
+
name: `${ch.channelName}_cert`,
|
|
902
|
+
resource: ch.certificateResource!,
|
|
903
|
+
},
|
|
904
|
+
}));
|
|
905
|
+
|
|
906
|
+
const customCaDeploymentResources: DeploymentResource[] = form.channels
|
|
907
|
+
.filter(
|
|
908
|
+
(ch) =>
|
|
909
|
+
ch.protocol === "HTTPS" && ch.isPublic && ch.withMtls && ch.caResource,
|
|
910
|
+
)
|
|
911
|
+
.map((ch) => ({
|
|
912
|
+
ca: {
|
|
913
|
+
name: `${ch.channelName}_ca`,
|
|
914
|
+
resource: ch.caResource!,
|
|
915
|
+
},
|
|
916
|
+
}));
|
|
903
917
|
const deploymentConfigPort: DeploymentResource[] = form.channels
|
|
904
918
|
.filter((channel) => channel.protocol === "TCP" && channel.isPublic)
|
|
905
919
|
.map((channel) => ({
|
|
@@ -1077,6 +1091,8 @@ export async function generateServiceSpec(
|
|
|
1077
1091
|
parameters: [...deploymentConfigParameters],
|
|
1078
1092
|
resources: [
|
|
1079
1093
|
...deploymentConfigDomain,
|
|
1094
|
+
...customCertDeploymentResources,
|
|
1095
|
+
...customCaDeploymentResources,
|
|
1080
1096
|
...deploymentConfigPort,
|
|
1081
1097
|
...deploymentConfigResources,
|
|
1082
1098
|
],
|
|
@@ -1119,7 +1135,7 @@ async function generateServiceSpecDSL(
|
|
|
1119
1135
|
.map((channel) => ({ domain: { name: `${channel.channelName}_domain` } }));
|
|
1120
1136
|
|
|
1121
1137
|
const hasDefaultCertChannel = form.channels.some(
|
|
1122
|
-
(ch) => ch.protocol === "HTTPS" && ch.isPublic && !ch.certificateResource
|
|
1138
|
+
(ch) => ch.protocol === "HTTPS" && ch.isPublic && !ch.certificateResource,
|
|
1123
1139
|
);
|
|
1124
1140
|
if (hasDefaultCertChannel) {
|
|
1125
1141
|
serverConfigDomainResources.push({
|
|
@@ -1129,23 +1145,17 @@ async function generateServiceSpecDSL(
|
|
|
1129
1145
|
|
|
1130
1146
|
const customCertResources: ArtifactConfigResource[] = form.channels
|
|
1131
1147
|
.filter(
|
|
1132
|
-
(ch) => ch.protocol === "HTTPS" && ch.isPublic && ch.certificateResource
|
|
1148
|
+
(ch) => ch.protocol === "HTTPS" && ch.isPublic && ch.certificateResource,
|
|
1133
1149
|
)
|
|
1134
1150
|
.map((ch) => ({ certificate: { name: `${ch.channelName}_cert` } }));
|
|
1135
1151
|
|
|
1136
1152
|
const customCaResources: ArtifactConfigResource[] = form.channels
|
|
1137
1153
|
.filter(
|
|
1138
1154
|
(ch) =>
|
|
1139
|
-
ch.protocol === "HTTPS" && ch.isPublic && ch.withMtls && ch.caResource
|
|
1155
|
+
ch.protocol === "HTTPS" && ch.isPublic && ch.withMtls && ch.caResource,
|
|
1140
1156
|
)
|
|
1141
1157
|
.map((ch) => ({ ca: { name: `${ch.channelName}_ca` } }));
|
|
1142
1158
|
|
|
1143
|
-
console.log('Generated Resources Config:', {
|
|
1144
|
-
serverConfigDomainResources,
|
|
1145
|
-
customCertResources,
|
|
1146
|
-
customCaResources
|
|
1147
|
-
});
|
|
1148
|
-
|
|
1149
1159
|
const serviceConfigPortResources: ArtifactConfigResource[] = form.channels
|
|
1150
1160
|
.filter((channel) => channel.protocol === "TCP" && channel.isPublic)
|
|
1151
1161
|
.map((channel) => ({ port: { name: `${channel.channelName}_port` } }));
|
|
@@ -1241,9 +1251,6 @@ async function generateServiceSpecDSL(
|
|
|
1241
1251
|
config: {
|
|
1242
1252
|
parameters: [
|
|
1243
1253
|
{ name: "type", value: "https", type: "string" as const },
|
|
1244
|
-
...(channel.withMtls && channel.caResource
|
|
1245
|
-
? [{ name: "mtls", value: "true", type: "bool" as const }]
|
|
1246
|
-
: []),
|
|
1247
1254
|
],
|
|
1248
1255
|
resources: [
|
|
1249
1256
|
{
|
|
@@ -1264,7 +1271,7 @@ async function generateServiceSpecDSL(
|
|
|
1264
1271
|
? [
|
|
1265
1272
|
{
|
|
1266
1273
|
ca: {
|
|
1267
|
-
name: "
|
|
1274
|
+
name: "clientcertca",
|
|
1268
1275
|
configResource: `${channel.channelName}_ca`,
|
|
1269
1276
|
},
|
|
1270
1277
|
},
|
|
@@ -1435,7 +1442,7 @@ async function generateServiceSpecDSL(
|
|
|
1435
1442
|
}));
|
|
1436
1443
|
|
|
1437
1444
|
const hasDefaultCertChannelDeployment = form.channels.some(
|
|
1438
|
-
(ch) => ch.protocol === "HTTPS" && ch.isPublic && !ch.certificateResource
|
|
1445
|
+
(ch) => ch.protocol === "HTTPS" && ch.isPublic && !ch.certificateResource,
|
|
1439
1446
|
);
|
|
1440
1447
|
if (hasDefaultCertChannelDeployment) {
|
|
1441
1448
|
deploymentConfigDomain.push({
|
|
@@ -1448,7 +1455,7 @@ async function generateServiceSpecDSL(
|
|
|
1448
1455
|
|
|
1449
1456
|
const customCertDeploymentResources: DeploymentResource[] = form.channels
|
|
1450
1457
|
.filter(
|
|
1451
|
-
(ch) => ch.protocol === "HTTPS" && ch.isPublic && ch.certificateResource
|
|
1458
|
+
(ch) => ch.protocol === "HTTPS" && ch.isPublic && ch.certificateResource,
|
|
1452
1459
|
)
|
|
1453
1460
|
.map((ch) => ({
|
|
1454
1461
|
certificate: {
|
|
@@ -1460,7 +1467,7 @@ async function generateServiceSpecDSL(
|
|
|
1460
1467
|
const customCaDeploymentResources: DeploymentResource[] = form.channels
|
|
1461
1468
|
.filter(
|
|
1462
1469
|
(ch) =>
|
|
1463
|
-
ch.protocol === "HTTPS" && ch.isPublic && ch.withMtls && ch.caResource
|
|
1470
|
+
ch.protocol === "HTTPS" && ch.isPublic && ch.withMtls && ch.caResource,
|
|
1464
1471
|
)
|
|
1465
1472
|
.map((ch) => ({
|
|
1466
1473
|
ca: {
|
|
@@ -1469,12 +1476,6 @@ async function generateServiceSpecDSL(
|
|
|
1469
1476
|
},
|
|
1470
1477
|
}));
|
|
1471
1478
|
|
|
1472
|
-
console.log('Generated Deployment Resources:', {
|
|
1473
|
-
deploymentConfigDomain,
|
|
1474
|
-
customCertDeploymentResources,
|
|
1475
|
-
customCaDeploymentResources
|
|
1476
|
-
});
|
|
1477
|
-
|
|
1478
1479
|
const deploymentConfigPort: DeploymentResource[] = form.channels
|
|
1479
1480
|
.filter((channel) => channel.protocol === "TCP" && channel.isPublic)
|
|
1480
1481
|
.map((channel) => ({
|
|
@@ -1600,6 +1601,8 @@ async function generateServiceSpecDSL(
|
|
|
1600
1601
|
parameters: [...deploymentConfigParameters],
|
|
1601
1602
|
resources: [
|
|
1602
1603
|
...deploymentConfigDomain,
|
|
1604
|
+
...customCertDeploymentResources,
|
|
1605
|
+
...customCaDeploymentResources,
|
|
1603
1606
|
...deploymentConfigPort,
|
|
1604
1607
|
...deploymentConfigResources,
|
|
1605
1608
|
],
|
|
@@ -1693,7 +1696,6 @@ export async function deployServiceHelper(
|
|
|
1693
1696
|
serviceForm,
|
|
1694
1697
|
marketplaceItem,
|
|
1695
1698
|
);
|
|
1696
|
-
console.log('Final generated ServiceSpecDSL:', JSON.stringify(serviceSpecDSL, null, 2));
|
|
1697
1699
|
CUEBundle = buildServiceDeploymentModule(serviceSpecDSL);
|
|
1698
1700
|
|
|
1699
1701
|
// if (marketplaceItem?.package) {
|
package/helpers/user-helper.ts
CHANGED
|
@@ -38,10 +38,9 @@ export const handleUserEvent = ({
|
|
|
38
38
|
if (!userTenants.includes(key)) {
|
|
39
39
|
const tenantToDelete = tenantsMap.get(key);
|
|
40
40
|
if (tenantToDelete) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
subtype: "tenant-deleted",
|
|
41
|
+
const userRemovedNotification: Notification = {
|
|
42
|
+
type: "info",
|
|
43
|
+
subtype: "user-removed-from-tenant",
|
|
45
44
|
date: Date.now().toString(),
|
|
46
45
|
callToAction: false,
|
|
47
46
|
status: "unread",
|
|
@@ -49,7 +48,7 @@ export const handleUserEvent = ({
|
|
|
49
48
|
tenant: tenantToDelete.name,
|
|
50
49
|
},
|
|
51
50
|
};
|
|
52
|
-
eventHelper.notification.publish.creation(
|
|
51
|
+
eventHelper.notification.publish.creation(userRemovedNotification);
|
|
53
52
|
deletedTenantKeys.push(key);
|
|
54
53
|
}
|
|
55
54
|
}
|
package/package.json
CHANGED
package/websocket-manager.ts
CHANGED
|
@@ -804,6 +804,27 @@ const handleEvent = async (message: WSMessage) => {
|
|
|
804
804
|
eventData,
|
|
805
805
|
userData,
|
|
806
806
|
);
|
|
807
|
+
|
|
808
|
+
if (
|
|
809
|
+
existingTenant &&
|
|
810
|
+
existingTenant.role &&
|
|
811
|
+
newTenant.role &&
|
|
812
|
+
existingTenant.role !== newTenant.role
|
|
813
|
+
) {
|
|
814
|
+
const roleNotification: Notification = {
|
|
815
|
+
type: "info",
|
|
816
|
+
subtype: "tenant-role-changed",
|
|
817
|
+
date: Date.now().toString(),
|
|
818
|
+
status: "unread",
|
|
819
|
+
callToAction: false,
|
|
820
|
+
data: {
|
|
821
|
+
tenant: newTenant.name,
|
|
822
|
+
oldRole: existingTenant.role,
|
|
823
|
+
newRole: newTenant.role,
|
|
824
|
+
},
|
|
825
|
+
};
|
|
826
|
+
eventHelper.notification.publish.creation(roleNotification);
|
|
827
|
+
}
|
|
807
828
|
if (existingTenant) {
|
|
808
829
|
if (
|
|
809
830
|
!newTenant.resources?.length &&
|