@kumori/aurora-backend-handler 1.1.105 → 1.1.106

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,4 +1,4 @@
1
- import { Account, errors, Notification } from "@kumori/aurora-interfaces";
1
+ import { Account, getWuiErrorCode, Notification } from "@kumori/aurora-interfaces";
2
2
  import {
3
3
  initializeGlobalWebSocketClient,
4
4
  getWebSocketStatus,
@@ -637,14 +637,14 @@ export const createAccount = async (account: Account, security: Security) => {
637
637
 
638
638
  const accountErrorNotification: Notification = {
639
639
  type: "error",
640
- subtype: errors.account.creationError.subtype,
640
+ subtype: getWuiErrorCode("account", "createAccount", code) ?? "account-creation-error",
641
641
  info_content: {
642
642
  code,
643
643
  message,
644
644
  },
645
645
  date: Date.now().toString(),
646
646
  status: "unread",
647
- callToAction: false,
647
+ notificationType: "regular",
648
648
  data: {
649
649
  account: account.name,
650
650
  tenant: account.tenant,
@@ -736,10 +736,10 @@ export const deleteAccount = async (account: Account, security: Security) => {
736
736
 
737
737
  const accountNotification: Notification = {
738
738
  type: "success",
739
- subtype: errors.account.deleting.subtype,
739
+ subtype: "account-deleting",
740
740
  date: Date.now().toString(),
741
741
  status: "unread",
742
- callToAction: false,
742
+ notificationType: "regular",
743
743
  data: {
744
744
  account: account.name,
745
745
  tenant: account.tenant,
@@ -754,14 +754,14 @@ export const deleteAccount = async (account: Account, security: Security) => {
754
754
 
755
755
  const accountErrorNotification: Notification = {
756
756
  type: "error",
757
- subtype: errors.account.deletionError.subtype,
757
+ subtype: getWuiErrorCode("account", "deleteAccount", code) ?? "account-deletion-error",
758
758
  date: Date.now().toString(),
759
759
  info_content: {
760
760
  code,
761
761
  message,
762
762
  },
763
763
  status: "unread",
764
- callToAction: false,
764
+ notificationType: "regular",
765
765
  data: {
766
766
  account: account.name,
767
767
  tenant: account.tenant,
@@ -797,10 +797,10 @@ export const clearAccount = async (account: Account, security: Security) => {
797
797
  eventHelper.account.publish.cleaned(updatedAccount);
798
798
  const accountNotification: Notification = {
799
799
  type: "success",
800
- subtype: errors.account.cleaned.subtype,
800
+ subtype: "account-cleaned",
801
801
  date: Date.now().toString(),
802
802
  status: "unread",
803
- callToAction: false,
803
+ notificationType: "regular",
804
804
  data: {
805
805
  account: account.name,
806
806
  tenant: account.tenant,
@@ -815,14 +815,14 @@ export const clearAccount = async (account: Account, security: Security) => {
815
815
 
816
816
  const accountErrorNotification: Notification = {
817
817
  type: "error",
818
- subtype: errors.account.cleanError.subtype,
818
+ subtype: getWuiErrorCode("account", "deleteAccount", code) ?? "account-clean-error",
819
819
  date: Date.now().toString(),
820
820
  info_content: {
821
821
  code,
822
822
  message,
823
823
  },
824
824
  status: "unread",
825
- callToAction: false,
825
+ notificationType: "regular",
826
826
  data: {
827
827
  account: account.name,
828
828
  tenant: account.tenant,
@@ -1433,14 +1433,14 @@ export const updateAccount = async (account: Account, security: Security) => {
1433
1433
 
1434
1434
  const accountErrorNotification: Notification = {
1435
1435
  type: "error",
1436
- subtype: errors.account.updateError.subtype,
1436
+ subtype: getWuiErrorCode("account", "updateAccount", code) ?? "account-update-error",
1437
1437
  date: Date.now().toString(),
1438
1438
  info_content: {
1439
1439
  code,
1440
1440
  message,
1441
1441
  },
1442
1442
  status: "unread",
1443
- callToAction: false,
1443
+ notificationType: "regular",
1444
1444
  data: {
1445
1445
  account: account.name,
1446
1446
  tenant: account.tenant,
@@ -227,21 +227,13 @@ interface Port<VARIANT> {
227
227
  interface Certificate<VARIANT> {
228
228
  certificate: VARIANT;
229
229
  }
230
- type ComponentFilesystemDto =
231
- | FilesystemVolumeDto
232
- | FilesystemSecretDto
233
- | FilesystemFileDto;
230
+ type ComponentFilesystemDto = FilesystemVolumeDto | FilesystemFileDto;
234
231
 
235
232
  interface FilesystemVolumeDto {
236
233
  path: string;
237
234
  resourceVolume: string;
238
235
  }
239
236
 
240
- interface FilesystemSecretDto {
241
- path: string;
242
- resourceSecret: string;
243
- }
244
-
245
237
  interface FilesystemFileDto {
246
238
  path: string;
247
239
  param?: string;
@@ -420,17 +412,10 @@ export function handleParametersToGenerateData(
420
412
  switch (resource.type) {
421
413
  case "secret":
422
414
  resourcesResult.push({ secret: { name: resource.name } });
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
- }
415
+ environmentResult.push({
416
+ varName: resource.name,
417
+ secret: resource.name as string,
418
+ });
434
419
  break;
435
420
  case "volume":
436
421
  resourcesResult.push({ volume: { name: resource.name } });
@@ -518,20 +503,12 @@ export function transformServiceToForm(service: Service): ServiceSpecForm {
518
503
  })),
519
504
  },
520
505
  environment: [service.environment],
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
- ],
506
+ fileSystem: service.resources
507
+ .filter((resource) => resource.type === "volume")
508
+ .map((resource) => ({
509
+ path: resource.key,
510
+ resourceVolume: resource.name,
511
+ })),
535
512
  scaling: service.role[0].scalling,
536
513
  hsize: service.role[0].hsize
537
514
  };
@@ -1,5 +1,5 @@
1
1
 
2
- import { Environment, errors, Notification } from "@kumori/aurora-interfaces";
2
+ import { Environment, getWuiErrorCode, Notification } from "@kumori/aurora-interfaces";
3
3
  import { eventHelper } from "../backend-handler";
4
4
  import {
5
5
  initializeGlobalWebSocketClient,
@@ -132,14 +132,14 @@ export const createEnvironment = async (
132
132
  }
133
133
  const envErrorNotification: Notification = {
134
134
  type: "error",
135
- subtype: errors.environment.creationError.subtype,
135
+ subtype: getWuiErrorCode("environment", "createEnvironment", contentMessage) ?? "environment-creation-error",
136
136
  info_content: {
137
137
  code: contentMessage,
138
138
  message: errorContent,
139
139
  },
140
140
  date: Date.now().toString(),
141
141
  status: "unread",
142
- callToAction: false,
142
+ notificationType: "regular",
143
143
  data: {
144
144
  environment: env.name,
145
145
  account: env.account,
@@ -182,10 +182,10 @@ export const deleteEnvironment = async (
182
182
  // eventHelper.environment.publish.deleted(updatedEnv);
183
183
  const envNotification: Notification = {
184
184
  type: "success",
185
- subtype: errors.environment.deleting.subtype,
185
+ subtype: "environment-deleting",
186
186
  date: Date.now().toString(),
187
187
  status: "unread",
188
- callToAction: false,
188
+ notificationType: "regular",
189
189
  data: {
190
190
  environment: env.name,
191
191
  account: env.account,
@@ -222,14 +222,14 @@ export const deleteEnvironment = async (
222
222
  }
223
223
  const envErrorNotification: Notification = {
224
224
  type: "error",
225
- subtype: errors.environment.deletionError.subtype,
225
+ subtype: getWuiErrorCode("environment", "deleteEnvironment", contentMessage) ?? "environment-deletion-error",
226
226
  info_content: {
227
227
  code: contentMessage,
228
228
  message: errorContent,
229
229
  },
230
230
  date: Date.now().toString(),
231
231
  status: "unread",
232
- callToAction: false,
232
+ notificationType: "regular",
233
233
  data: {
234
234
  environment: env.name,
235
235
  account: env.account,
@@ -249,10 +249,10 @@ export const clearEnvironment = async (
249
249
  try {
250
250
  const envNotification: Notification = {
251
251
  type: "info",
252
- subtype: errors.environment.purging.subtype,
252
+ subtype: "environment-cleaning",
253
253
  date: Date.now().toString(),
254
254
  status: "unread",
255
- callToAction: false,
255
+ notificationType: "regular",
256
256
  data: {
257
257
  environment: env.name,
258
258
  account: env.account,
@@ -314,14 +314,14 @@ export const clearEnvironment = async (
314
314
  }
315
315
  const envErrorNotification: Notification = {
316
316
  type: "error",
317
- subtype: errors.environment.purgeError.subtype,
317
+ subtype: getWuiErrorCode("environment", "deleteEnvironment", contentMessage) ?? "environment-cleaning-error",
318
318
  info_content: {
319
319
  code: contentMessage,
320
320
  message: errorContent,
321
321
  },
322
322
  date: Date.now().toString(),
323
323
  status: "unread",
324
- callToAction: false,
324
+ notificationType: "regular",
325
325
  data: {
326
326
  environment: env.name,
327
327
  account: env.account,
@@ -412,10 +412,10 @@ export const updateEnvironment = async (
412
412
  eventHelper.environment.publish.updated(updatedEnv);
413
413
  const envNotification: Notification = {
414
414
  type: "success",
415
- subtype: errors.environment.updated.subtype,
415
+ subtype: "environment-updated",
416
416
  date: Date.now().toString(),
417
417
  status: "unread",
418
- callToAction: false,
418
+ notificationType: "regular",
419
419
  data: {
420
420
  environment: env.name,
421
421
  account: env.account,
@@ -452,14 +452,14 @@ export const updateEnvironment = async (
452
452
  }
453
453
  const envErrorNotification: Notification = {
454
454
  type: "error",
455
- subtype: errors.environment.updateError.subtype,
455
+ subtype: getWuiErrorCode("environment", "updateEnvironment", contentMessage) ?? "environment-update-error",
456
456
  info_content: {
457
457
  code: contentMessage,
458
458
  message: errorContent,
459
459
  },
460
460
  date: Date.now().toString(),
461
461
  status: "unread",
462
- callToAction: false,
462
+ notificationType: "regular",
463
463
  data: {
464
464
  environment: env.name,
465
465
  account: env.account,
@@ -497,10 +497,10 @@ export const scaleEnvironment = async (
497
497
  eventHelper.environment.publish.scaled(env);
498
498
  const envNotification: Notification = {
499
499
  type: "success",
500
- subtype: errors.environment.scaled.subtype,
500
+ subtype: "environment-scaled",
501
501
  date: Date.now().toString(),
502
502
  status: "unread",
503
- callToAction: false,
503
+ notificationType: "regular",
504
504
  data: {
505
505
  environment: env.name,
506
506
  account: env.account,
@@ -531,14 +531,14 @@ export const scaleEnvironment = async (
531
531
  }
532
532
  const envErrorNotification: Notification = {
533
533
  type: "error",
534
- subtype: errors.environment.scaleError.subtype,
534
+ subtype: getWuiErrorCode("environment", "scaleEnvironment", contentMessage) ?? "environment-scale-error",
535
535
  info_content: {
536
536
  code: contentMessage,
537
537
  message: errorContent,
538
538
  },
539
539
  date: Date.now().toString(),
540
540
  status: "unread",
541
- callToAction: false,
541
+ notificationType: "regular",
542
542
  data: {
543
543
  environment: env.name,
544
544
  account: env.account,
@@ -1,5 +1,5 @@
1
1
  import {
2
- errors,
2
+ getWuiErrorCode,
3
3
  Link,
4
4
  MarketplaceItem,
5
5
  MarketplaceService,
@@ -939,10 +939,10 @@ const linkPendingServices = async (service: Service, token: string) => {
939
939
 
940
940
  const notification: Notification = {
941
941
  type: "success",
942
- subtype: errors.service.linked.subtype,
942
+ subtype: "service-linked",
943
943
  date: Date.now().toString(),
944
944
  status: "unread",
945
- callToAction: false,
945
+ notificationType: "regular",
946
946
  data: {
947
947
  service: service.name,
948
948
  tenant: service.tenant,
@@ -954,14 +954,14 @@ const linkPendingServices = async (service: Service, token: string) => {
954
954
  } catch (linkErr) {
955
955
  const notification: Notification = {
956
956
  type: "error",
957
- subtype: errors.service.linkError.subtype,
957
+ subtype: getWuiErrorCode("service", "linkService", (linkErr as any).error.code) ?? "error-service-link",
958
958
  date: Date.now().toString(),
959
959
  info_content: {
960
960
  code: (linkErr as any).error.code,
961
961
  message: (linkErr as any).error.content,
962
962
  },
963
963
  status: "unread",
964
- callToAction: false,
964
+ notificationType: "regular",
965
965
  data: {
966
966
  service: service.name,
967
967
  tenant: service.tenant,
@@ -1,4 +1,4 @@
1
- import { errors, Notification, Resource } from "@kumori/aurora-interfaces";
1
+ import { getWuiErrorCode, Notification, Resource } from "@kumori/aurora-interfaces";
2
2
  import { eventHelper } from "../backend-handler";
3
3
 
4
4
  import {
@@ -50,10 +50,10 @@ export const createDomain = async (
50
50
  // eventHelper.resource.publish.created(domain);
51
51
  const resourceNotification: Notification = {
52
52
  type: "success",
53
- subtype: errors.resource.created.subtype,
53
+ subtype: "resource-created",
54
54
  date: Date.now().toString(),
55
55
  status: "unread",
56
- callToAction: false,
56
+ notificationType: "regular",
57
57
  data: {
58
58
  resource: domain.name,
59
59
  tenant: tenant
@@ -87,14 +87,14 @@ export const createDomain = async (
87
87
  }
88
88
  const resourceErrorNotification: Notification = {
89
89
  type: "error",
90
- subtype: errors.resource.creationError.subtype,
90
+ subtype: getWuiErrorCode("resource", "createResource", contentMessage) ?? "resource-creation-error",
91
91
  info_content: {
92
92
  code: contentMessage,
93
93
  message: errorContent,
94
94
  },
95
95
  date: Date.now().toString(),
96
96
  status: "unread",
97
- callToAction: false,
97
+ notificationType: "regular",
98
98
  data: {
99
99
  resource: domain.name,
100
100
  tenant: tenant
@@ -130,10 +130,10 @@ export const createPort = async (
130
130
  eventHelper.resource.publish.created(port);
131
131
  const resourceNotification: Notification = {
132
132
  type: "success",
133
- subtype: errors.resource.created.subtype,
133
+ subtype: "resource-created",
134
134
  date: Date.now().toString(),
135
135
  status: "unread",
136
- callToAction: false,
136
+ notificationType: "regular",
137
137
  data: {
138
138
  resource: port.name,
139
139
  tenant: tenant
@@ -167,14 +167,14 @@ export const createPort = async (
167
167
  }
168
168
  const resourceErrorNotification: Notification = {
169
169
  type: "error",
170
- subtype: errors.resource.creationError.subtype,
170
+ subtype: getWuiErrorCode("resource", "createResource", contentMessage) ?? "resource-creation-error",
171
171
  info_content: {
172
172
  code: contentMessage,
173
173
  message: errorContent,
174
174
  },
175
175
  date: Date.now().toString(),
176
176
  status: "unread",
177
- callToAction: false,
177
+ notificationType: "regular",
178
178
  data: {
179
179
  resource: port.name,
180
180
  tenant: tenant
@@ -210,10 +210,10 @@ export const createCA = async (
210
210
  eventHelper.resource.publish.created(ca);
211
211
  const resourceNotification: Notification = {
212
212
  type: "success",
213
- subtype: errors.resource.created.subtype,
213
+ subtype: "resource-created",
214
214
  date: Date.now().toString(),
215
215
  status: "unread",
216
- callToAction: false,
216
+ notificationType: "regular",
217
217
  data: {
218
218
  resource: ca.name,
219
219
  tenant: tenant
@@ -247,14 +247,14 @@ export const createCA = async (
247
247
  }
248
248
  const resourceErrorNotification: Notification = {
249
249
  type: "error",
250
- subtype: errors.resource.creationError.subtype,
250
+ subtype: getWuiErrorCode("resource", "createResource", contentMessage) ?? "resource-creation-error",
251
251
  info_content: {
252
252
  code: contentMessage,
253
253
  message: errorContent,
254
254
  },
255
255
  date: Date.now().toString(),
256
256
  status: "unread",
257
- callToAction: false,
257
+ notificationType: "regular",
258
258
  data: {
259
259
  resource: ca.name,
260
260
  tenant: tenant
@@ -303,10 +303,10 @@ export const createCertificate = async (
303
303
  eventHelper.resource.publish.created(certificate);
304
304
  const resourceNotification: Notification = {
305
305
  type: "success",
306
- subtype: errors.resource.created.subtype,
306
+ subtype: "resource-created",
307
307
  date: Date.now().toString(),
308
308
  status: "unread",
309
- callToAction: false,
309
+ notificationType: "regular",
310
310
  data: {
311
311
  resource: certificate.name,
312
312
  tenant: tenant
@@ -340,14 +340,14 @@ export const createCertificate = async (
340
340
  }
341
341
  const resourceErrorNotification: Notification = {
342
342
  type: "error",
343
- subtype: errors.resource.creationError.subtype,
343
+ subtype: getWuiErrorCode("resource", "createResource", contentMessage) ?? "resource-creation-error",
344
344
  info_content: {
345
345
  code: contentMessage,
346
346
  message: errorContent,
347
347
  },
348
348
  date: Date.now().toString(),
349
349
  status: "unread",
350
- callToAction: false,
350
+ notificationType: "regular",
351
351
  data: {
352
352
  resource: certificate.name,
353
353
  tenant: tenant
@@ -383,10 +383,10 @@ export const createSecret = async (
383
383
  eventHelper.resource.publish.created(secret);
384
384
  const resourceNotification: Notification = {
385
385
  type: "success",
386
- subtype: errors.resource.created.subtype,
386
+ subtype: "resource-created",
387
387
  date: Date.now().toString(),
388
388
  status: "unread",
389
- callToAction: false,
389
+ notificationType: "regular",
390
390
  data: {
391
391
  resource: secret.name,
392
392
  tenant: tenant
@@ -420,14 +420,14 @@ export const createSecret = async (
420
420
  }
421
421
  const resourceErrorNotification: Notification = {
422
422
  type: "error",
423
- subtype: errors.resource.creationError.subtype,
423
+ subtype: getWuiErrorCode("resource", "createResource", contentMessage) ?? "resource-creation-error",
424
424
  info_content: {
425
425
  code: contentMessage,
426
426
  message: errorContent,
427
427
  },
428
428
  date: Date.now().toString(),
429
429
  status: "unread",
430
- callToAction: false,
430
+ notificationType: "regular",
431
431
  data: {
432
432
  resource: secret.name,
433
433
  tenant: tenant
@@ -483,10 +483,10 @@ export const createVolume = async (
483
483
  eventHelper.resource.publish.created(volume);
484
484
  const resourceNotification: Notification = {
485
485
  type: "success",
486
- subtype: errors.resource.created.subtype,
486
+ subtype: "resource-created",
487
487
  date: Date.now().toString(),
488
488
  status: "unread",
489
- callToAction: false,
489
+ notificationType: "regular",
490
490
  data: {
491
491
  resource: volume.name,
492
492
  tenant: tenant
@@ -520,14 +520,14 @@ export const createVolume = async (
520
520
  }
521
521
  const resourceErrorNotification: Notification = {
522
522
  type: "error",
523
- subtype: errors.resource.creationError.subtype,
523
+ subtype: getWuiErrorCode("resource", "createResource", contentMessage) ?? "resource-creation-error",
524
524
  info_content: {
525
525
  code: contentMessage,
526
526
  message: errorContent,
527
527
  },
528
528
  date: Date.now().toString(),
529
529
  status: "unread",
530
- callToAction: false,
530
+ notificationType: "regular",
531
531
  data: {
532
532
  resource: volume.name,
533
533
  tenant: tenant
@@ -593,10 +593,10 @@ const deleteResourceBase = async (
593
593
  //eventHelper.resource.publish.deleted(resource);
594
594
  const resourceNotification: Notification = {
595
595
  type: "success",
596
- subtype: errors.resource.deleting.subtype,
596
+ subtype: "resource-deleting",
597
597
  date: Date.now().toString(),
598
598
  status: "unread",
599
- callToAction: false,
599
+ notificationType: "regular",
600
600
  data: {
601
601
  resource: resource.name,
602
602
  type: resource.type,
@@ -626,14 +626,14 @@ const deleteResourceBase = async (
626
626
  }
627
627
  const resourceErrorNotification: Notification = {
628
628
  type: "error",
629
- subtype: errors.resource.deletionError.subtype,
629
+ subtype: getWuiErrorCode("resource", "deleteResource", contentMessage) ?? "resource-deletion-error",
630
630
  info_content: {
631
631
  code: contentMessage,
632
632
  message: errorContent,
633
633
  },
634
634
  date: Date.now().toString(),
635
635
  status: "unread",
636
- callToAction: false,
636
+ notificationType: "regular",
637
637
  data: {
638
638
  resource: resource.name,
639
639
  type: resource.type,
@@ -688,10 +688,10 @@ const updateResourceBase = async (
688
688
  // eventHelper.resource.publish.updated(resource);
689
689
  const resourceNotification: Notification = {
690
690
  type: "success",
691
- subtype: errors.resource.updated.subtype,
691
+ subtype: "resource-updated",
692
692
  date: Date.now().toString(),
693
693
  status: "unread",
694
- callToAction: false,
694
+ notificationType: "regular",
695
695
  data: {
696
696
  resource: resource.name,
697
697
  type: resource.type,
@@ -721,14 +721,14 @@ const updateResourceBase = async (
721
721
  }
722
722
  const resourceErrorNotification: Notification = {
723
723
  type: "error",
724
- subtype: errors.resource.updateError.subtype,
724
+ subtype: getWuiErrorCode("resource", "updateResource", contentMessage) ?? "resource-update-error",
725
725
  info_content: {
726
726
  code: contentMessage,
727
727
  message: errorContent,
728
728
  },
729
729
  date: Date.now().toString(),
730
730
  status: "unread",
731
- callToAction: false,
731
+ notificationType: "regular",
732
732
  data: {
733
733
  resource: resource.name,
734
734
  type: resource.type,