@kumori/aurora-backend-handler 1.1.56 → 1.1.57

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, Notification } from "@kumori/aurora-interfaces";
1
+ import { Account, errors, Notification } from "@kumori/aurora-interfaces";
2
2
  import {
3
3
  initializeGlobalWebSocketClient,
4
4
  getWebSocketStatus,
@@ -630,7 +630,7 @@ export const createAccount = async (account: Account, security: Security) => {
630
630
 
631
631
  const accountErrorNotification: Notification = {
632
632
  type: "error",
633
- subtype: "account-creation-error",
633
+ subtype: errors.account.creationError.subtype,
634
634
  info_content: {
635
635
  code,
636
636
  message,
@@ -729,7 +729,7 @@ export const deleteAccount = async (account: Account, security: Security) => {
729
729
 
730
730
  const accountNotification: Notification = {
731
731
  type: "success",
732
- subtype: "account-deleteing",
732
+ subtype: errors.account.deleting.subtype,
733
733
  date: Date.now().toString(),
734
734
  status: "unread",
735
735
  callToAction: false,
@@ -747,7 +747,7 @@ export const deleteAccount = async (account: Account, security: Security) => {
747
747
 
748
748
  const accountErrorNotification: Notification = {
749
749
  type: "error",
750
- subtype: "account-deletion-error",
750
+ subtype: errors.account.deletionError.subtype,
751
751
  date: Date.now().toString(),
752
752
  info_content: {
753
753
  code,
@@ -790,7 +790,7 @@ export const clearAccount = async (account: Account, security: Security) => {
790
790
  eventHelper.account.publish.cleaned(updatedAccount);
791
791
  const accountNotification: Notification = {
792
792
  type: "success",
793
- subtype: "account-cleaned",
793
+ subtype: errors.account.cleaned.subtype,
794
794
  date: Date.now().toString(),
795
795
  status: "unread",
796
796
  callToAction: false,
@@ -808,7 +808,7 @@ export const clearAccount = async (account: Account, security: Security) => {
808
808
 
809
809
  const accountErrorNotification: Notification = {
810
810
  type: "error",
811
- subtype: "account-clean-error",
811
+ subtype: errors.account.cleanError.subtype,
812
812
  date: Date.now().toString(),
813
813
  info_content: {
814
814
  code,
@@ -1422,24 +1422,25 @@ export const updateAccount = async (account: Account, security: Security) => {
1422
1422
  provider: account.cloudProvider?.name,
1423
1423
  });
1424
1424
  eventHelper.account.publish.updateError(account);
1425
- // const { code, message } = extractErrorInfo(error);
1425
+ const { code, message } = extractErrorInfo(error);
1426
1426
 
1427
- // const accountErrorNotification: Notification = {
1428
- // type: "error",
1429
- // subtype: "account-update-error",
1430
- // date: Date.now().toString(),
1431
- // info_content: {
1432
- // code,
1433
- // message,
1434
- // },
1435
- // status: "unread",
1436
- // callToAction: false,
1437
- // data: {
1438
- // account: account.name,
1439
- // tenant: account.tenant,
1440
- // },
1441
- // };
1442
- // eventHelper.notification.publish.creation(accountErrorNotification);
1427
+ const accountErrorNotification: Notification = {
1428
+ type: "error",
1429
+ subtype: errors.account.updateError.subtype,
1430
+ date: Date.now().toString(),
1431
+ info_content: {
1432
+ code,
1433
+ message,
1434
+ },
1435
+ status: "unread",
1436
+ callToAction: false,
1437
+ data: {
1438
+ account: account.name,
1439
+ tenant: account.tenant,
1440
+ },
1441
+ userError: true,
1442
+ };
1443
+ eventHelper.notification.publish.creation(accountErrorNotification);
1443
1444
  throw error;
1444
1445
  }
1445
1446
  };
@@ -1,5 +1,5 @@
1
1
 
2
- import { Environment, Notification } from "@kumori/aurora-interfaces";
2
+ import { Environment, errors, Notification } from "@kumori/aurora-interfaces";
3
3
  import { eventHelper } from "../backend-handler";
4
4
  import {
5
5
  initializeGlobalWebSocketClient,
@@ -131,7 +131,7 @@ export const createEnvironment = async (
131
131
  }
132
132
  const envErrorNotification: Notification = {
133
133
  type: "error",
134
- subtype: "environment-creation-error",
134
+ subtype: errors.environment.creationError.subtype,
135
135
  info_content: {
136
136
  code: contentMessage,
137
137
  message: errorContent,
@@ -181,7 +181,7 @@ export const deleteEnvironment = async (
181
181
  // eventHelper.environment.publish.deleted(updatedEnv);
182
182
  const envNotification: Notification = {
183
183
  type: "success",
184
- subtype: "environment-deleting",
184
+ subtype: errors.environment.deleting.subtype,
185
185
  date: Date.now().toString(),
186
186
  status: "unread",
187
187
  callToAction: false,
@@ -221,7 +221,7 @@ export const deleteEnvironment = async (
221
221
  }
222
222
  const envErrorNotification: Notification = {
223
223
  type: "error",
224
- subtype: "environment-deletion-error",
224
+ subtype: errors.environment.deletionError.subtype,
225
225
  info_content: {
226
226
  code: contentMessage,
227
227
  message: errorContent,
@@ -248,7 +248,7 @@ export const clearEnvironment = async (
248
248
  try {
249
249
  const envNotification: Notification = {
250
250
  type: "info",
251
- subtype: "environment-cleaning",
251
+ subtype: errors.environment.purging.subtype,
252
252
  date: Date.now().toString(),
253
253
  status: "unread",
254
254
  callToAction: false,
@@ -309,7 +309,7 @@ export const clearEnvironment = async (
309
309
  }
310
310
  const envErrorNotification: Notification = {
311
311
  type: "error",
312
- subtype: "environment-cleaning-error",
312
+ subtype: errors.environment.purgeError.subtype,
313
313
  info_content: {
314
314
  code: contentMessage,
315
315
  message: errorContent,
@@ -407,7 +407,7 @@ export const updateEnvironment = async (
407
407
  eventHelper.environment.publish.updated(updatedEnv);
408
408
  const envNotification: Notification = {
409
409
  type: "success",
410
- subtype: "environment-updated",
410
+ subtype: errors.environment.updated.subtype,
411
411
  date: Date.now().toString(),
412
412
  status: "unread",
413
413
  callToAction: false,
@@ -447,7 +447,7 @@ export const updateEnvironment = async (
447
447
  }
448
448
  const envErrorNotification: Notification = {
449
449
  type: "error",
450
- subtype: "environment-update-error",
450
+ subtype: errors.environment.updateError.subtype,
451
451
  info_content: {
452
452
  code: contentMessage,
453
453
  message: errorContent,
@@ -492,7 +492,7 @@ export const scaleEnvironment = async (
492
492
  eventHelper.environment.publish.scaled(env);
493
493
  const envNotification: Notification = {
494
494
  type: "success",
495
- subtype: "environment-scaled",
495
+ subtype: errors.environment.scaled.subtype,
496
496
  date: Date.now().toString(),
497
497
  status: "unread",
498
498
  callToAction: false,
@@ -526,7 +526,7 @@ export const scaleEnvironment = async (
526
526
  }
527
527
  const envErrorNotification: Notification = {
528
528
  type: "error",
529
- subtype: "environment-scale-error",
529
+ subtype: errors.environment.scaleError.subtype,
530
530
  info_content: {
531
531
  code: contentMessage,
532
532
  message: errorContent,
@@ -1,4 +1,5 @@
1
1
  import {
2
+ errors,
2
3
  Link,
3
4
  MarketplaceItem,
4
5
  MarketplaceService,
@@ -938,7 +939,7 @@ const linkPendingServices = async (service: Service, token: string) => {
938
939
 
939
940
  const notification: Notification = {
940
941
  type: "success",
941
- subtype: "service-linked",
942
+ subtype: errors.service.linked.subtype,
942
943
  date: Date.now().toString(),
943
944
  status: "unread",
944
945
  callToAction: false,
@@ -953,7 +954,7 @@ const linkPendingServices = async (service: Service, token: string) => {
953
954
  } catch (linkErr) {
954
955
  const notification: Notification = {
955
956
  type: "error",
956
- subtype: "error-service-link",
957
+ subtype: errors.service.linkError.subtype,
957
958
  date: Date.now().toString(),
958
959
  info_content: {
959
960
  code: (linkErr as any).error.code,
@@ -1020,4 +1021,4 @@ export const loadMarketplaceItemsForTenant = async (
1020
1021
  );
1021
1022
  return [];
1022
1023
  }
1023
- };
1024
+ };
@@ -1,4 +1,4 @@
1
- import { Notification, Resource } from "@kumori/aurora-interfaces";
1
+ import { errors, Notification, Resource } from "@kumori/aurora-interfaces";
2
2
  import { eventHelper } from "../backend-handler";
3
3
 
4
4
  import {
@@ -50,7 +50,7 @@ export const createDomain = async (
50
50
  // eventHelper.resource.publish.created(domain);
51
51
  const resourceNotification: Notification = {
52
52
  type: "success",
53
- subtype: "resource-created",
53
+ subtype: errors.resource.created.subtype,
54
54
  date: Date.now().toString(),
55
55
  status: "unread",
56
56
  callToAction: false,
@@ -87,7 +87,7 @@ export const createDomain = async (
87
87
  }
88
88
  const resourceErrorNotification: Notification = {
89
89
  type: "error",
90
- subtype: "resource-creation-error",
90
+ subtype: errors.resource.creationError.subtype,
91
91
  info_content: {
92
92
  code: contentMessage,
93
93
  message: errorContent,
@@ -130,7 +130,7 @@ export const createPort = async (
130
130
  eventHelper.resource.publish.created(port);
131
131
  const resourceNotification: Notification = {
132
132
  type: "success",
133
- subtype: "resource-created",
133
+ subtype: errors.resource.created.subtype,
134
134
  date: Date.now().toString(),
135
135
  status: "unread",
136
136
  callToAction: false,
@@ -167,7 +167,7 @@ export const createPort = async (
167
167
  }
168
168
  const resourceErrorNotification: Notification = {
169
169
  type: "error",
170
- subtype: "resource-creation-error",
170
+ subtype: errors.resource.creationError.subtype,
171
171
  info_content: {
172
172
  code: contentMessage,
173
173
  message: errorContent,
@@ -210,7 +210,7 @@ export const createCA = async (
210
210
  eventHelper.resource.publish.created(ca);
211
211
  const resourceNotification: Notification = {
212
212
  type: "success",
213
- subtype: "resource-created",
213
+ subtype: errors.resource.created.subtype,
214
214
  date: Date.now().toString(),
215
215
  status: "unread",
216
216
  callToAction: false,
@@ -247,7 +247,7 @@ export const createCA = async (
247
247
  }
248
248
  const resourceErrorNotification: Notification = {
249
249
  type: "error",
250
- subtype: "resource-creation-error",
250
+ subtype: errors.resource.creationError.subtype,
251
251
  info_content: {
252
252
  code: contentMessage,
253
253
  message: errorContent,
@@ -303,7 +303,7 @@ export const createCertificate = async (
303
303
  eventHelper.resource.publish.created(certificate);
304
304
  const resourceNotification: Notification = {
305
305
  type: "success",
306
- subtype: "resource-created",
306
+ subtype: errors.resource.created.subtype,
307
307
  date: Date.now().toString(),
308
308
  status: "unread",
309
309
  callToAction: false,
@@ -340,7 +340,7 @@ export const createCertificate = async (
340
340
  }
341
341
  const resourceErrorNotification: Notification = {
342
342
  type: "error",
343
- subtype: "resource-creation-error",
343
+ subtype: errors.resource.creationError.subtype,
344
344
  info_content: {
345
345
  code: contentMessage,
346
346
  message: errorContent,
@@ -383,7 +383,7 @@ export const createSecret = async (
383
383
  eventHelper.resource.publish.created(secret);
384
384
  const resourceNotification: Notification = {
385
385
  type: "success",
386
- subtype: "resource-created",
386
+ subtype: errors.resource.created.subtype,
387
387
  date: Date.now().toString(),
388
388
  status: "unread",
389
389
  callToAction: false,
@@ -420,7 +420,7 @@ export const createSecret = async (
420
420
  }
421
421
  const resourceErrorNotification: Notification = {
422
422
  type: "error",
423
- subtype: "resource-creation-error",
423
+ subtype: errors.resource.creationError.subtype,
424
424
  info_content: {
425
425
  code: contentMessage,
426
426
  message: errorContent,
@@ -483,7 +483,7 @@ export const createVolume = async (
483
483
  eventHelper.resource.publish.created(volume);
484
484
  const resourceNotification: Notification = {
485
485
  type: "success",
486
- subtype: "resource-created",
486
+ subtype: errors.resource.created.subtype,
487
487
  date: Date.now().toString(),
488
488
  status: "unread",
489
489
  callToAction: false,
@@ -520,7 +520,7 @@ export const createVolume = async (
520
520
  }
521
521
  const resourceErrorNotification: Notification = {
522
522
  type: "error",
523
- subtype: "resource-creation-error",
523
+ subtype: errors.resource.creationError.subtype,
524
524
  info_content: {
525
525
  code: contentMessage,
526
526
  message: errorContent,
@@ -593,7 +593,7 @@ const deleteResourceBase = async (
593
593
  //eventHelper.resource.publish.deleted(resource);
594
594
  const resourceNotification: Notification = {
595
595
  type: "success",
596
- subtype: "resource-deleting",
596
+ subtype: errors.resource.deleting.subtype,
597
597
  date: Date.now().toString(),
598
598
  status: "unread",
599
599
  callToAction: false,
@@ -626,7 +626,7 @@ const deleteResourceBase = async (
626
626
  }
627
627
  const resourceErrorNotification: Notification = {
628
628
  type: "error",
629
- subtype: "resource-deletion-error",
629
+ subtype: errors.resource.deletionError.subtype,
630
630
  info_content: {
631
631
  code: contentMessage,
632
632
  message: errorContent,
@@ -688,7 +688,7 @@ const updateResourceBase = async (
688
688
  // eventHelper.resource.publish.updated(resource);
689
689
  const resourceNotification: Notification = {
690
690
  type: "success",
691
- subtype: "resource-updated",
691
+ subtype: errors.resource.updated.subtype,
692
692
  date: Date.now().toString(),
693
693
  status: "unread",
694
694
  callToAction: false,
@@ -721,7 +721,7 @@ const updateResourceBase = async (
721
721
  }
722
722
  const resourceErrorNotification: Notification = {
723
723
  type: "error",
724
- subtype: "resource-update-error",
724
+ subtype: errors.resource.updateError.subtype,
725
725
  info_content: {
726
726
  code: contentMessage,
727
727
  message: errorContent,
@@ -830,4 +830,4 @@ export const updateResource = async (
830
830
  default:
831
831
  throw new Error(`Unsupported resource type: ${resource.type}`);
832
832
  }
833
- };
833
+ };
@@ -6,7 +6,7 @@ import {
6
6
  getWebSocketStatus,
7
7
  makeGlobalWebSocketRequest,
8
8
  } from "../websocket-manager";
9
- import { Link, Notification, Service } from "@kumori/aurora-interfaces";
9
+ import { errors, Link, Notification, Service } from "@kumori/aurora-interfaces";
10
10
  import { Revision } from "@kumori/aurora-interfaces/interfaces/revision-interface";
11
11
  let pendingLinks = new Map<string, Link[]>();
12
12
  /**
@@ -349,7 +349,7 @@ export const linkPendingServices = async (service: Service, token: string) => {
349
349
 
350
350
  const notification: Notification = {
351
351
  type: "success",
352
- subtype: "service-linked",
352
+ subtype: errors.service.linked.subtype,
353
353
  date: Date.now().toString(),
354
354
  status: "unread",
355
355
  callToAction: false,
@@ -364,7 +364,7 @@ export const linkPendingServices = async (service: Service, token: string) => {
364
364
  } catch (linkErr) {
365
365
  const notification: Notification = {
366
366
  type: "error",
367
- subtype: "error-service-link",
367
+ subtype: errors.service.linkError.subtype,
368
368
  date: Date.now().toString(),
369
369
  info_content: {
370
370
  code: (linkErr as any).error.code,
@@ -612,7 +612,7 @@ export const updateService = async (
612
612
 
613
613
  const updateNotification: Notification = {
614
614
  type: "success",
615
- subtype: "service-updated",
615
+ subtype: errors.service.updated.subtype,
616
616
  date: Date.now().toString(),
617
617
  status: "unread",
618
618
  callToAction: false,
@@ -629,7 +629,7 @@ export const updateService = async (
629
629
  console.error("Error updating service configuration via WebSocket:", err);
630
630
  const notification: Notification = {
631
631
  type: "error",
632
- subtype: "service-update-error",
632
+ subtype: errors.service.updateError.subtype,
633
633
  date: Date.now().toString(),
634
634
  info_content: {
635
635
  code: (err as any).error.code,
@@ -670,7 +670,7 @@ export const unlinkServices = async (service: Service, token: string) => {
670
670
 
671
671
  const unlinkNotification: Notification = {
672
672
  type: "success",
673
- subtype: "service-unlinking",
673
+ subtype: errors.service.unlinking.subtype,
674
674
  date: Date.now().toString(),
675
675
  status: "unread",
676
676
  callToAction: false,
@@ -686,7 +686,7 @@ export const unlinkServices = async (service: Service, token: string) => {
686
686
 
687
687
  const notification: Notification = {
688
688
  type: "error",
689
- subtype: "service-unlink-error",
689
+ subtype: errors.service.unlinkError.subtype,
690
690
  date: Date.now().toString(),
691
691
  info_content: {
692
692
  code: (unlinkErr as any).error.code,
@@ -748,7 +748,7 @@ export const updateServiceLinks = async (link: Link, token: string) => {
748
748
 
749
749
  const notification: Notification = {
750
750
  type: "error",
751
- subtype: "service-unlink-error",
751
+ subtype: errors.service.unlinkError.subtype,
752
752
  date: Date.now().toString(),
753
753
  info_content: {
754
754
  code: (unlinkErr as any).error.code,
@@ -779,7 +779,7 @@ export const updateServiceLinks = async (link: Link, token: string) => {
779
779
 
780
780
  const notification: Notification = {
781
781
  type: "success",
782
- subtype: "service-linked",
782
+ subtype: errors.service.linked.subtype,
783
783
  date: Date.now().toString(),
784
784
  status: "unread",
785
785
  callToAction: false,
@@ -794,7 +794,7 @@ export const updateServiceLinks = async (link: Link, token: string) => {
794
794
  } catch (linkErr) {
795
795
  const notification: Notification = {
796
796
  type: "error",
797
- subtype: "error-service-link",
797
+ subtype: errors.service.linkError.subtype,
798
798
  date: Date.now().toString(),
799
799
  info_content: {
800
800
  code: (linkErr as any).error.code,
@@ -835,7 +835,7 @@ export const changeRevision = async (data: Service, token: string) => {
835
835
  );
836
836
  const notification: Notification = {
837
837
  type: "success",
838
- subtype: "revision-updated",
838
+ subtype: errors.deployment.revisionUpdated.subtype,
839
839
  date: Date.now().toString(),
840
840
  status: "unread",
841
841
  callToAction: false,
@@ -848,7 +848,7 @@ export const changeRevision = async (data: Service, token: string) => {
848
848
  } catch (error) {
849
849
  const notification: Notification = {
850
850
  type: "error",
851
- subtype: "error-revision-update",
851
+ subtype: errors.deployment.revisionUpdateError.subtype,
852
852
  date: Date.now().toString(),
853
853
  info_content: {
854
854
  code: (error as any).error.code,
@@ -894,7 +894,7 @@ export async function restartInstance(
894
894
  );
895
895
  const notification: Notification = {
896
896
  type: "success",
897
- subtype: "instance-restarted",
897
+ subtype: errors.deployment.instanceRestarted.subtype,
898
898
  date: Date.now().toString(),
899
899
  status: "unread",
900
900
  callToAction: false,
@@ -907,7 +907,7 @@ export async function restartInstance(
907
907
  } catch (error) {
908
908
  const notification: Notification = {
909
909
  type: "error",
910
- subtype: "error-instance-update",
910
+ subtype: errors.deployment.instanceUpdateError.subtype,
911
911
  date: Date.now().toString(),
912
912
  info_content: {
913
913
  code: (error as any).error.code,
@@ -1,4 +1,4 @@
1
- import { Notification, Registry, Tenant, tenantRole } from "@kumori/aurora-interfaces";
1
+ import { errors, Notification, Registry, Tenant, tenantRole } from "@kumori/aurora-interfaces";
2
2
  import { eventHelper } from "../backend-handler";
3
3
  import { environment } from "../environment";
4
4
  import {
@@ -62,7 +62,7 @@ export const createTenant = async (tenant: Tenant, security: Security) => {
62
62
  eventHelper.tenant.publish.created(updatedTenant);
63
63
  const tenantCreatedNotification: Notification = {
64
64
  type: "success",
65
- subtype: "tenant-created",
65
+ subtype: errors.tenant.created.subtype,
66
66
  date: Date.now().toString(),
67
67
  status: "unread",
68
68
  callToAction: false,
@@ -98,7 +98,7 @@ export const createTenant = async (tenant: Tenant, security: Security) => {
98
98
  }
99
99
  const tenantCreationErrorNotification: Notification = {
100
100
  type: "error",
101
- subtype: "tenant-creation-error",
101
+ subtype: errors.tenant.creationError.subtype,
102
102
  info_content: {
103
103
  code: contentMessage,
104
104
  message: errorContent,
@@ -166,7 +166,7 @@ export const deleteTenant = async (tenant: Tenant, security: string) => {
166
166
  }
167
167
  const tenantDeletionErrorNotification: Notification = {
168
168
  type: "error",
169
- subtype: "tenant-deletion-error",
169
+ subtype: errors.tenant.deletionError.subtype,
170
170
  info_content: {
171
171
  code: contentMessage,
172
172
  message: errorContent,
@@ -224,7 +224,7 @@ export const updateTenant = async (tenant: Tenant, security: string) => {
224
224
  eventHelper.tenant.publish.updated(updatedTenant);
225
225
  const tenantCreatedNotification: Notification = {
226
226
  type: "success",
227
- subtype: "tenant-updated",
227
+ subtype: errors.tenant.updated.subtype,
228
228
  date: Date.now().toString(),
229
229
  status: "unread",
230
230
  callToAction: false,
@@ -256,7 +256,7 @@ export const updateTenant = async (tenant: Tenant, security: string) => {
256
256
  }
257
257
  const tenantUpdateErrorNotification: Notification = {
258
258
  type: "error",
259
- subtype: "tenant-update-error",
259
+ subtype: errors.tenant.updateError.subtype,
260
260
  info_content: {
261
261
  code: contentMessage,
262
262
  message: errorContent,
@@ -324,7 +324,7 @@ export const createTenantHTTP = async (tenant: Tenant) => {
324
324
  eventHelper.tenant.publish.created(updatedTenant);
325
325
  const tenantCreatedNotification: Notification = {
326
326
  type: "success",
327
- subtype: "tenant-created",
327
+ subtype: errors.tenant.created.subtype,
328
328
  date: Date.now().toString(),
329
329
  status: "unread",
330
330
  callToAction: false,
@@ -356,7 +356,7 @@ export const createTenantHTTP = async (tenant: Tenant) => {
356
356
 
357
357
  const tenantCreationErrorNotification: Notification = {
358
358
  type: "error",
359
- subtype: "tenant-creation-error",
359
+ subtype: errors.tenant.creationError.subtype,
360
360
  info_content: {
361
361
  code: errorCode,
362
362
  message: errorMessage,
@@ -387,7 +387,7 @@ export const deleteTenantHTTP = async (tenant: Tenant) => {
387
387
  if (response.ok) {
388
388
  const tenantDeletedNotification: Notification = {
389
389
  type: "success",
390
- subtype: "tenant-deleting",
390
+ subtype: errors.tenant.deleting.subtype,
391
391
  date: Date.now().toString(),
392
392
  status: "unread",
393
393
  callToAction: false,
@@ -416,7 +416,7 @@ export const deleteTenantHTTP = async (tenant: Tenant) => {
416
416
 
417
417
  const tenantDeletionErrorNotification: Notification = {
418
418
  type: "error",
419
- subtype: "tenant-deletion-error",
419
+ subtype: errors.tenant.deletionError.subtype,
420
420
  info_content: {
421
421
  code: errorCode,
422
422
  message: errorMessage,
@@ -479,7 +479,7 @@ export const updateTenantHTTP = async (tenant: Tenant) => {
479
479
  eventHelper.tenant.publish.updated(updatedTenant);
480
480
  const tenantCreatedNotification: Notification = {
481
481
  type: "success",
482
- subtype: "tenant-updated",
482
+ subtype: errors.tenant.updated.subtype,
483
483
  date: Date.now().toString(),
484
484
  status: "unread",
485
485
  callToAction: false,
@@ -508,7 +508,7 @@ export const updateTenantHTTP = async (tenant: Tenant) => {
508
508
 
509
509
  const tenantUpdateErrorNotification: Notification = {
510
510
  type: "error",
511
- subtype: "tenant-update-error",
511
+ subtype: errors.tenant.updateError.subtype,
512
512
  info_content: {
513
513
  code: errorCode,
514
514
  message: errorMessage,
@@ -558,11 +558,12 @@ export const createRegistry = async (
558
558
 
559
559
  const dregistryCreatedNotification: Notification = {
560
560
  type: "success",
561
- subtype: "registry-created",
561
+ subtype: errors.registry.created.subtype,
562
562
  date: Date.now().toString(),
563
563
  status: "unread",
564
564
  callToAction: false,
565
565
  data: {
566
+ registry: registry.name,
566
567
  tenant: tenant.name,
567
568
  },
568
569
  };
@@ -597,7 +598,7 @@ export const createRegistry = async (
597
598
 
598
599
  const dregistryCreationErrorNotification: Notification = {
599
600
  type: "error",
600
- subtype: "registry-creation-error",
601
+ subtype: errors.registry.creationError.subtype,
601
602
  info_content: {
602
603
  code: contentMessage,
603
604
  message: errorContent,
@@ -658,11 +659,12 @@ export const updateRegistry = async (
658
659
  );
659
660
  const dregistryUpdatedNotification: Notification = {
660
661
  type: "success",
661
- subtype: "registry-updated",
662
+ subtype: errors.registry.updated.subtype,
662
663
  date: Date.now().toString(),
663
664
  status: "unread",
664
665
  callToAction: false,
665
666
  data: {
667
+ registry: registry.name,
666
668
  tenant: tenant.name,
667
669
  },
668
670
  };
@@ -699,7 +701,7 @@ export const updateRegistry = async (
699
701
 
700
702
  const dregistryUpdateErrorNotification: Notification = {
701
703
  type: "error",
702
- subtype: "registry-update-error",
704
+ subtype: errors.registry.updateError.subtype,
703
705
  info_content: {
704
706
  code: contentMessage,
705
707
  message: errorContent,
@@ -742,11 +744,12 @@ export const deleteRegistry = async (
742
744
 
743
745
  const dregistryDeletedNotification: Notification = {
744
746
  type: "success",
745
- subtype: "registry-deleted",
747
+ subtype: errors.registry.deleted.subtype,
746
748
  date: Date.now().toString(),
747
749
  status: "unread",
748
750
  callToAction: false,
749
751
  data: {
752
+ registry: registry.name,
750
753
  tenant: tenant.name,
751
754
  },
752
755
  };
@@ -782,7 +785,7 @@ export const deleteRegistry = async (
782
785
 
783
786
  const dregistryDeletionErrorNotification: Notification = {
784
787
  type: "error",
785
- subtype: "registry-deletion-error",
788
+ subtype: errors.registry.deletionError.subtype,
786
789
  info_content: {
787
790
  code: contentMessage,
788
791
  message: errorContent,
@@ -826,7 +829,7 @@ export const inviteUser = async (
826
829
  );
827
830
  const tenantInvitedNotification: Notification = {
828
831
  type: "success",
829
- subtype: "tenant-user-invited",
832
+ subtype: errors.tenant.userInvited.subtype,
830
833
  date: Date.now().toString(),
831
834
  status: "unread",
832
835
  callToAction: false,
@@ -867,7 +870,7 @@ export const inviteUser = async (
867
870
  }
868
871
  const tenantInviteErrorNotification: Notification = {
869
872
  type: "error",
870
- subtype: "tenant-user-invite-error",
873
+ subtype: errors.tenant.userInviteError.subtype,
871
874
  info_content: {
872
875
  code: contentMessage,
873
876
  message: errorContent,
@@ -908,7 +911,7 @@ export const removeUser = async (
908
911
  );
909
912
  const tenantUserRemovedNotification: Notification = {
910
913
  type: "success",
911
- subtype: "tenant-user-removed",
914
+ subtype: errors.tenant.userRemoved.subtype,
912
915
  date: Date.now().toString(),
913
916
  status: "unread",
914
917
  callToAction: false,
@@ -946,7 +949,7 @@ export const removeUser = async (
946
949
  }
947
950
  const tenantUserRemovedErrorNotification: Notification = {
948
951
  type: "error",
949
- subtype: "tenant-user-removed-error",
952
+ subtype: errors.tenant.userRemovedError.subtype,
950
953
  info_content: {
951
954
  code: contentMessage,
952
955
  message: errorContent,
@@ -989,7 +992,7 @@ export const updateUserRole = async (
989
992
  );
990
993
  const tenantUserUpdatedNotification: Notification = {
991
994
  type: "success",
992
- subtype: "user-role-updated",
995
+ subtype: errors.tenant.roleUpdated.subtype,
993
996
  date: Date.now().toString(),
994
997
  status: "unread",
995
998
  callToAction: false,
@@ -1029,7 +1032,7 @@ export const updateUserRole = async (
1029
1032
  }
1030
1033
  const tenantUserUpdatedErrorNotification: Notification = {
1031
1034
  type: "error",
1032
- subtype: "user-role-updated-error",
1035
+ subtype: errors.tenant.roleUpdateError.subtype,
1033
1036
  info_content: {
1034
1037
  code: contentMessage,
1035
1038
  message: errorContent,
@@ -1064,7 +1067,7 @@ export const acceptInvite = async (tenant: string, security: string) => {
1064
1067
  );
1065
1068
  const tenantInviteAcceptedNotification: Notification = {
1066
1069
  type: "success",
1067
- subtype: "tenant-invite-accepted",
1070
+ subtype: errors.tenant.inviteAccepted.subtype,
1068
1071
  date: Date.now().toString(),
1069
1072
  status: "unread",
1070
1073
  callToAction: false,
@@ -1100,7 +1103,7 @@ export const acceptInvite = async (tenant: string, security: string) => {
1100
1103
  }
1101
1104
  const tenantInviteAcceptedErrorNotification: Notification = {
1102
1105
  type: "error",
1103
- subtype: "tenant-invite-accepted-error",
1106
+ subtype: errors.tenant.inviteAcceptError.subtype,
1104
1107
  info_content: {
1105
1108
  code: contentMessage,
1106
1109
  message: errorContent,
@@ -1134,7 +1137,7 @@ export const rejectInvite = async (tenant: string, security: string, leave: bool
1134
1137
  if(leave){
1135
1138
  const tenantInviteRejectedNotification: Notification = {
1136
1139
  type: "success",
1137
- subtype: "tenant-leave",
1140
+ subtype: errors.tenant.leave.subtype,
1138
1141
  date: Date.now().toString(),
1139
1142
  status: "unread",
1140
1143
  callToAction: false,
@@ -1147,7 +1150,7 @@ export const rejectInvite = async (tenant: string, security: string, leave: bool
1147
1150
  else{
1148
1151
  const tenantInviteRejectedNotification: Notification = {
1149
1152
  type: "success",
1150
- subtype: "tenant-invite-rejected",
1153
+ subtype: errors.tenant.inviteRejected.subtype,
1151
1154
  date: Date.now().toString(),
1152
1155
  status: "unread",
1153
1156
  callToAction: false,
@@ -1185,7 +1188,7 @@ export const rejectInvite = async (tenant: string, security: string, leave: bool
1185
1188
  }
1186
1189
  const tenantInviteRejectedErrorNotification: Notification = {
1187
1190
  type: "error",
1188
- subtype: "tenant-invite-rejected-error",
1191
+ subtype: errors.tenant.inviteRejectError.subtype,
1189
1192
  info_content: {
1190
1193
  code: contentMessage,
1191
1194
  message: errorContent,
@@ -1238,7 +1241,7 @@ export const createToken = async (
1238
1241
 
1239
1242
  const tenantTokenCreatedNotification: Notification = {
1240
1243
  type: "success",
1241
- subtype: "token-created",
1244
+ subtype: errors.user.tokenCreated.subtype,
1242
1245
  date: Date.now().toString(),
1243
1246
  status: "unread",
1244
1247
  callToAction: false,
@@ -8,9 +8,9 @@ import {
8
8
  Account,
9
9
  Container,
10
10
  Environment,
11
+ errors,
11
12
  Instance,
12
13
  MarketplaceItem,
13
- Notification,
14
14
  Organization,
15
15
  Platform,
16
16
  Registry,
@@ -1063,7 +1063,7 @@ export const updateUser = async (user: User) => {
1063
1063
  eventHelper.user.publish.updated(user);
1064
1064
  eventHelper.notification.publish.creation({
1065
1065
  type: "success",
1066
- subtype: "user-updated",
1066
+ subtype: errors.user.updated.subtype,
1067
1067
  date: Date.now().toString(),
1068
1068
  status: "unread",
1069
1069
  callToAction: false,
@@ -1078,7 +1078,7 @@ export const updateUser = async (user: User) => {
1078
1078
  eventHelper.user.publish.updateError(user);
1079
1079
  eventHelper.notification.publish.creation({
1080
1080
  type: "error",
1081
- subtype: "tenant-update-error",
1081
+ subtype: errors.user.updateError.subtype,
1082
1082
  date: Date.now().toString(),
1083
1083
  status: "unread",
1084
1084
  callToAction: false,
@@ -1106,7 +1106,7 @@ export const deleteUSer = async (user: User, security: string) => {
1106
1106
  );
1107
1107
  eventHelper.notification.publish.creation({
1108
1108
  type: "success",
1109
- subtype: "user-deleted",
1109
+ subtype: errors.user.deleted.subtype,
1110
1110
  date: Date.now().toString(),
1111
1111
  status: "unread",
1112
1112
  callToAction: false,
@@ -1117,7 +1117,7 @@ export const deleteUSer = async (user: User, security: string) => {
1117
1117
  console.error("Error deleting user:", error);
1118
1118
  eventHelper.notification.publish.creation({
1119
1119
  type: "error",
1120
- subtype: "user-delete-error",
1120
+ subtype: errors.user.deleteError.subtype,
1121
1121
  date: Date.now().toString(),
1122
1122
  status: "unread",
1123
1123
  callToAction: false,
@@ -1148,4 +1148,4 @@ export const getUserHTTP = async () => {
1148
1148
  console.error("Error fetching user data:", error);
1149
1149
  throw error;
1150
1150
  }
1151
- };
1151
+ };
@@ -68,6 +68,7 @@ import { getPlanProviders } from "./api/planProvider-api-service";
68
68
  import {
69
69
  Account,
70
70
  Environment,
71
+ errors,
71
72
  Link,
72
73
  MarketplaceItem,
73
74
  MarketplaceService,
@@ -611,7 +612,7 @@ export class BackendHandler {
611
612
  const updatedCb = (data: string) => {
612
613
  const upgradeNotification: Notification = {
613
614
  type: "success",
614
- subtype: "plan-upgrade",
615
+ subtype: errors.user.planUpgraded.subtype,
615
616
  date: Date.now().toString(),
616
617
  status: "unread",
617
618
  callToAction: false,
@@ -641,7 +642,7 @@ export class BackendHandler {
641
642
  const downgradedCb = (data: string) => {
642
643
  const downgradeNotification: Notification = {
643
644
  type: "success",
644
- subtype: "plan-downgrade",
645
+ subtype: errors.user.planDowngraded.subtype,
645
646
  date: Date.now().toString(),
646
647
  status: "unread",
647
648
  callToAction: false,
@@ -677,7 +678,7 @@ export class BackendHandler {
677
678
  const createdCb = (data: Environment) => {
678
679
  const envNotification: Notification = {
679
680
  type: "success",
680
- subtype: "environment-created",
681
+ subtype: errors.environment.created.subtype,
681
682
  date: Date.now().toString(),
682
683
  status: "unread",
683
684
  callToAction: false,
@@ -762,7 +763,7 @@ export class BackendHandler {
762
763
  const deployedCb = (data: Service) => {
763
764
  const deploymentSuccessNotification: Notification = {
764
765
  type: "success",
765
- subtype: "deployment-success",
766
+ subtype: errors.deployment.success.subtype,
766
767
  date: Date.now().toString(),
767
768
  status: "unread",
768
769
  callToAction: false,
@@ -777,7 +778,7 @@ export class BackendHandler {
777
778
  const deploymentErrorCb = (data: Service) => {
778
779
  const deploymentErrorNotification: Notification = {
779
780
  type: "error",
780
- subtype: "deployment-error",
781
+ subtype: errors.deployment.error.subtype,
781
782
  date: Date.now().toString(),
782
783
  status: "unread",
783
784
  info_content: {
@@ -798,7 +799,7 @@ export class BackendHandler {
798
799
  deployService(data, token);
799
800
  const deploymentSuccessNotification: Notification = {
800
801
  type: "info",
801
- subtype: "deployment-in-progress",
802
+ subtype: errors.deployment.inProgress.subtype,
802
803
  date: Date.now().toString(),
803
804
  status: "unread",
804
805
  callToAction: false,
@@ -829,7 +830,7 @@ export class BackendHandler {
829
830
  const updatedCb = (data: Service) => {
830
831
  const deploymentNotification: Notification = {
831
832
  type: "success",
832
- subtype: "deployment-updated",
833
+ subtype: errors.deployment.updated.subtype,
833
834
  date: Date.now().toString(),
834
835
  status: "unread",
835
836
  callToAction: false,
@@ -854,7 +855,7 @@ export class BackendHandler {
854
855
  const deleteCb = (data: Service) => {
855
856
  const deploymentNotification: Notification = {
856
857
  type: "info",
857
- subtype: "deployment-deleting",
858
+ subtype: errors.deployment.deleting.subtype,
858
859
  date: Date.now().toString(),
859
860
  status: "unread",
860
861
  callToAction: false,
@@ -874,7 +875,7 @@ export class BackendHandler {
874
875
  const deletedCb = (data: Service) => {
875
876
  const deploymentNotification: Notification = {
876
877
  type: "success",
877
- subtype: "deployment-deleted",
878
+ subtype: errors.deployment.deleted.subtype,
878
879
  date: Date.now().toString(),
879
880
  status: "unread",
880
881
  callToAction: false,
@@ -1090,7 +1091,7 @@ export class BackendHandler {
1090
1091
  const deletedCb = (data: Resource) => {
1091
1092
  const resourceNotification: Notification = {
1092
1093
  type: "success",
1093
- subtype: "resource-deleted",
1094
+ subtype: errors.resource.deleted.subtype,
1094
1095
  date: Date.now().toString(),
1095
1096
  status: "unread",
1096
1097
  callToAction: false,
@@ -1,4 +1,4 @@
1
- import { Account, Notification } from "@kumori/aurora-interfaces";
1
+ import { Account, errors, Notification } from "@kumori/aurora-interfaces";
2
2
  const CREDENTIAL_ERROR_CODES = new Set([
3
3
  "_error_retrieving_credentials_",
4
4
  "_invalid_account_credentials_",
@@ -285,7 +285,7 @@ export const handleAccountOperationSuccess = ({
285
285
  shouldDelete: true,
286
286
  notification: {
287
287
  type: "success",
288
- subtype: "account-deleted",
288
+ subtype: errors.account.deleted.subtype,
289
289
  date: Date.now().toString(),
290
290
  status: "unread",
291
291
  callToAction: false,
@@ -304,7 +304,7 @@ export const handleAccountOperationSuccess = ({
304
304
  shouldDelete: false,
305
305
  notification: {
306
306
  type: "success",
307
- subtype: isCreate ? "account-created" : "account-updated",
307
+ subtype: isCreate ? errors.account.created.subtype : errors.account.updated.subtype,
308
308
  date: Date.now().toString(),
309
309
  status: "unread",
310
310
  callToAction: false,
@@ -345,12 +345,6 @@ export const handleAccountOperationError = ({
345
345
  const isCreate = action === "CREATE";
346
346
  const isUpdate = action === "UPDATE";
347
347
 
348
- const subtype = isCreate
349
- ? "account-creation-error"
350
- : isUpdate
351
- ? "account-update-error"
352
- : "account-deletion-error";
353
-
354
348
  const eventType: "creationError" | "updateError" | "deletionError" = isCreate
355
349
  ? "creationError"
356
350
  : isUpdate
@@ -359,9 +353,11 @@ export const handleAccountOperationError = ({
359
353
  const errorCode: string = error?.error?.code ?? error?.code ?? "";
360
354
  const errorStatus = resolveErrorStatus(errorCode);
361
355
 
356
+ const errEntry = isCreate ? errors.account.creationError : isUpdate ? errors.account.updateError : errors.account.deletionError;
362
357
  const notification: Notification = {
363
358
  type: "error",
364
- subtype,
359
+ subtype: errEntry.subtype,
360
+ title: errEntry.title,
365
361
  date: Date.now().toString(),
366
362
  status: "unread",
367
363
  info_content: {
@@ -1,4 +1,4 @@
1
- import { Account, Environment, Notification } from "@kumori/aurora-interfaces";
1
+ import { Account, Environment, errors, Notification } from "@kumori/aurora-interfaces";
2
2
 
3
3
 
4
4
 
@@ -181,7 +181,7 @@ export const handleEnvironmentOperationSuccess = ({
181
181
 
182
182
  const envNotification: Notification = {
183
183
  type: "success",
184
- subtype: "environment-cleaned",
184
+ subtype: errors.environment.purged.subtype,
185
185
  date: Date.now().toString(),
186
186
  status: "unread",
187
187
  callToAction: false,
@@ -240,23 +240,17 @@ export const handleEnvironmentOperationError = ({
240
240
  originalData,
241
241
  error,
242
242
  }: HandleEnvironmentOperationErrorParams): HandleEnvironmentOperationErrorResult => {
243
- let subtype: string;
244
- let eventType: "creationError" | "updateError" | "deletionError";
245
-
246
- if (action === "CREATE") {
247
- subtype = "environment-creation-error";
248
- eventType = "creationError";
249
- } else if (action === "UPDATE") {
250
- subtype = "environment-update-error";
251
- eventType = "updateError";
252
- } else {
253
- subtype = "environment-deletion-error";
254
- eventType = "deletionError";
255
- }
243
+ const eventType: "creationError" | "updateError" | "deletionError" = action === "CREATE"
244
+ ? "creationError"
245
+ : action === "UPDATE"
246
+ ? "updateError"
247
+ : "deletionError";
256
248
 
249
+ const envErrEntry = action === "CREATE" ? errors.environment.creationError : action === "UPDATE" ? errors.environment.updateError : errors.environment.deletionError;
257
250
  const envErrorNotification: Notification = {
258
251
  type: "error",
259
- subtype,
252
+ subtype: envErrEntry.subtype,
253
+ title: envErrEntry.title,
260
254
  date: Date.now().toString(),
261
255
  status: "unread",
262
256
  info_content: {
@@ -1,4 +1,5 @@
1
1
  import {
2
+ errors,
2
3
  Notification,
3
4
  Plan,
4
5
  Tenant,
@@ -60,7 +61,7 @@ export const handleUserEvent = ({
60
61
  eventHelper.tenant.publish.deleted(tenantToDelete);
61
62
  const tenantDeletedNotification: Notification = {
62
63
  type: "success",
63
- subtype: "tenant-deleted",
64
+ subtype: errors.tenant.deleted.subtype,
64
65
  date: Date.now().toString(),
65
66
  callToAction: false,
66
67
  status: "unread",
@@ -74,7 +75,7 @@ export const handleUserEvent = ({
74
75
  } else {
75
76
  const userRemovedNotification: Notification = {
76
77
  type: "info",
77
- subtype: "user-removed-from-tenant",
78
+ subtype: errors.tenant.accessRevoked.subtype,
78
79
  date: Date.now().toString(),
79
80
  callToAction: false,
80
81
  status: "unread",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kumori/aurora-backend-handler",
3
- "version": "1.1.56",
3
+ "version": "1.1.57",
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.13",
14
+ "@kumori/aurora-interfaces": "1.0.15",
15
15
  "@kumori/kumori-dsl-generator": "1.0.6",
16
16
  "@kumori/kumori-module-generator": "^1.1.6",
17
17
  "ts-node": "^10.9.2",
@@ -5,6 +5,7 @@ import {
5
5
  Channel,
6
6
  ClusterToken,
7
7
  Environment,
8
+ errors,
8
9
  Instance,
9
10
  MarketplaceItem,
10
11
  Notification,
@@ -827,7 +828,7 @@ const handleEvent = async (message: WSMessage) => {
827
828
  ) {
828
829
  const roleNotification: Notification = {
829
830
  type: "info",
830
- subtype: "tenant-role-changed",
831
+ subtype: errors.tenant.roleChanged.subtype,
831
832
  date: Date.now().toString(),
832
833
  status: "unread",
833
834
  callToAction: false,
@@ -1591,7 +1592,7 @@ const handleDeleteEvent = async (message: WSMessage) => {
1591
1592
  eventHelper.environment.publish.deleted(deletedEnv);
1592
1593
  const envNotification: Notification = {
1593
1594
  type: "success",
1594
- subtype: "environment-deleted",
1595
+ subtype: errors.environment.deleted.subtype,
1595
1596
  date: Date.now().toString(),
1596
1597
  callToAction: false,
1597
1598
  status: "unread",
@@ -1610,7 +1611,7 @@ const handleDeleteEvent = async (message: WSMessage) => {
1610
1611
  eventHelper.account.publish.deleted(deletedAccount);
1611
1612
  const accountNotification: Notification = {
1612
1613
  type: "success",
1613
- subtype: "account-deleted",
1614
+ subtype: errors.account.deleted.subtype,
1614
1615
  date: Date.now().toString(),
1615
1616
  callToAction: false,
1616
1617
  status: "unread",
@@ -1748,7 +1749,7 @@ const handleDeleteEvent = async (message: WSMessage) => {
1748
1749
  tenantsMap.set(tenantName, registryTenant);
1749
1750
  const registryNotification: Notification = {
1750
1751
  type: "success",
1751
- subtype: "registry-deleted",
1752
+ subtype: errors.registry.deleted.subtype,
1752
1753
  date: Date.now().toString(),
1753
1754
  status: "unread",
1754
1755
  callToAction: false,
@@ -1804,7 +1805,7 @@ const handleDeleteEvent = async (message: WSMessage) => {
1804
1805
  if (deletedLinkInfo) {
1805
1806
  const unlinkNotification: Notification = {
1806
1807
  type: "success",
1807
- subtype: "service-unlinked",
1808
+ subtype: errors.service.unlinked.subtype,
1808
1809
  date: Date.now().toString(),
1809
1810
  status: "unread",
1810
1811
  callToAction: false,
@@ -1829,7 +1830,7 @@ const handleDeleteEvent = async (message: WSMessage) => {
1829
1830
  tokenMap.delete(tokenId);
1830
1831
  const tokenNotification: Notification = {
1831
1832
  type: "success",
1832
- subtype: "token-deleted",
1833
+ subtype: errors.user.tokenDeleted.subtype,
1833
1834
  date: Date.now().toString(),
1834
1835
  status: "unread",
1835
1836
  callToAction: false,
@@ -2094,4 +2095,4 @@ export const fetchAndStoreMarketplaceSchema = async (
2094
2095
 
2095
2096
  rebuildHierarchy();
2096
2097
  await updateUserWithPlatformInfo();
2097
- };
2098
+ };