@kumori/aurora-backend-handler 1.0.111 → 1.0.112
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/account-api-service.ts +13 -13
- package/api/environment-api-service.ts +19 -19
- package/api/marketplace-api-service.ts +5 -5
- package/api/resources-api-service.ts +33 -33
- package/api/service-api-service.ts +28 -28
- package/api/tenant-api-service.ts +60 -60
- package/api/user-api-service.ts +10 -10
- package/backend-handler.ts +20 -21
- package/helpers/account-helper.ts +10 -9
- package/helpers/environment-helper.ts +7 -6
- package/helpers/token-helper.ts +3 -3
- package/helpers/user-helper.ts +4 -5
- package/package.json +2 -2
- package/websocket-manager.ts +5 -6
package/api/user-api-service.ts
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
Account,
|
|
9
9
|
Container,
|
|
10
10
|
Environment,
|
|
11
|
-
|
|
11
|
+
getWuiErrorCode,
|
|
12
12
|
Instance,
|
|
13
13
|
MarketplaceItem,
|
|
14
14
|
Organization,
|
|
@@ -1049,7 +1049,7 @@ export const updateUser = async (user: User) => {
|
|
|
1049
1049
|
spec: {
|
|
1050
1050
|
name: user.name,
|
|
1051
1051
|
surname: user.surname,
|
|
1052
|
-
discoveryMethod:
|
|
1052
|
+
discoveryMethod: user.discoveryMethod,
|
|
1053
1053
|
companyName: user.companyName,
|
|
1054
1054
|
companyRole: user.rol,
|
|
1055
1055
|
},
|
|
@@ -1064,10 +1064,10 @@ export const updateUser = async (user: User) => {
|
|
|
1064
1064
|
eventHelper.user.publish.updated(user);
|
|
1065
1065
|
eventHelper.notification.publish.creation({
|
|
1066
1066
|
type: "success",
|
|
1067
|
-
subtype:
|
|
1067
|
+
subtype: "user-updated",
|
|
1068
1068
|
date: Date.now().toString(),
|
|
1069
1069
|
status: "unread",
|
|
1070
|
-
|
|
1070
|
+
notificationType: "regular",
|
|
1071
1071
|
data: { user: user.name },
|
|
1072
1072
|
});
|
|
1073
1073
|
} catch (error) {
|
|
@@ -1079,10 +1079,10 @@ export const updateUser = async (user: User) => {
|
|
|
1079
1079
|
eventHelper.user.publish.updateError(user);
|
|
1080
1080
|
eventHelper.notification.publish.creation({
|
|
1081
1081
|
type: "error",
|
|
1082
|
-
subtype:
|
|
1082
|
+
subtype: getWuiErrorCode("user", "modifyUserInfo", (error as any).error.code) ?? "user-update-error",
|
|
1083
1083
|
date: Date.now().toString(),
|
|
1084
1084
|
status: "unread",
|
|
1085
|
-
|
|
1085
|
+
notificationType: "regular",
|
|
1086
1086
|
info_content: {
|
|
1087
1087
|
code: (error as any).error.code,
|
|
1088
1088
|
message: (error as any).error.content,
|
|
@@ -1107,10 +1107,10 @@ export const deleteUSer = async (user: User, security: string) => {
|
|
|
1107
1107
|
);
|
|
1108
1108
|
eventHelper.notification.publish.creation({
|
|
1109
1109
|
type: "success",
|
|
1110
|
-
subtype:
|
|
1110
|
+
subtype: "user-deleted",
|
|
1111
1111
|
date: Date.now().toString(),
|
|
1112
1112
|
status: "unread",
|
|
1113
|
-
|
|
1113
|
+
notificationType: "regular",
|
|
1114
1114
|
data: { user: user.name },
|
|
1115
1115
|
});
|
|
1116
1116
|
return response;
|
|
@@ -1118,10 +1118,10 @@ export const deleteUSer = async (user: User, security: string) => {
|
|
|
1118
1118
|
console.error("Error deleting user:", error);
|
|
1119
1119
|
eventHelper.notification.publish.creation({
|
|
1120
1120
|
type: "error",
|
|
1121
|
-
subtype:
|
|
1121
|
+
subtype: getWuiErrorCode("user", "deleteUser", (error as any).error.code) ?? "user-delete-error",
|
|
1122
1122
|
date: Date.now().toString(),
|
|
1123
1123
|
status: "unread",
|
|
1124
|
-
|
|
1124
|
+
notificationType: "regular",
|
|
1125
1125
|
info_content: {
|
|
1126
1126
|
code: (error as any).error.code,
|
|
1127
1127
|
message: (error as any).error.content,
|
package/backend-handler.ts
CHANGED
|
@@ -68,7 +68,6 @@ import { getPlanProviders } from "./api/planProvider-api-service";
|
|
|
68
68
|
import {
|
|
69
69
|
Account,
|
|
70
70
|
Environment,
|
|
71
|
-
errors,
|
|
72
71
|
Link,
|
|
73
72
|
MarketplaceItem,
|
|
74
73
|
MarketplaceService,
|
|
@@ -612,10 +611,10 @@ export class BackendHandler {
|
|
|
612
611
|
const updatedCb = (data: string) => {
|
|
613
612
|
const upgradeNotification: Notification = {
|
|
614
613
|
type: "success",
|
|
615
|
-
subtype:
|
|
614
|
+
subtype: "plan-upgrade",
|
|
616
615
|
date: Date.now().toString(),
|
|
617
616
|
status: "unread",
|
|
618
|
-
|
|
617
|
+
notificationType: "regular",
|
|
619
618
|
data: {
|
|
620
619
|
plan: data,
|
|
621
620
|
},
|
|
@@ -642,10 +641,10 @@ export class BackendHandler {
|
|
|
642
641
|
const downgradedCb = (data: string) => {
|
|
643
642
|
const downgradeNotification: Notification = {
|
|
644
643
|
type: "success",
|
|
645
|
-
subtype:
|
|
644
|
+
subtype: "plan-downgrade",
|
|
646
645
|
date: Date.now().toString(),
|
|
647
646
|
status: "unread",
|
|
648
|
-
|
|
647
|
+
notificationType: "regular",
|
|
649
648
|
data: {
|
|
650
649
|
plan: data,
|
|
651
650
|
},
|
|
@@ -678,10 +677,10 @@ export class BackendHandler {
|
|
|
678
677
|
const createdCb = (data: Environment) => {
|
|
679
678
|
const envNotification: Notification = {
|
|
680
679
|
type: "success",
|
|
681
|
-
subtype:
|
|
680
|
+
subtype: "environment-created",
|
|
682
681
|
date: Date.now().toString(),
|
|
683
682
|
status: "unread",
|
|
684
|
-
|
|
683
|
+
notificationType: "regular",
|
|
685
684
|
data: {
|
|
686
685
|
environment: data.name,
|
|
687
686
|
account: data.account,
|
|
@@ -762,10 +761,10 @@ export class BackendHandler {
|
|
|
762
761
|
const deployedCb = (data: Service) => {
|
|
763
762
|
const deploymentSuccessNotification: Notification = {
|
|
764
763
|
type: "success",
|
|
765
|
-
subtype:
|
|
764
|
+
subtype: "deployment-success",
|
|
766
765
|
date: Date.now().toString(),
|
|
767
766
|
status: "unread",
|
|
768
|
-
|
|
767
|
+
notificationType: "regular",
|
|
769
768
|
data: {
|
|
770
769
|
service: data.name,
|
|
771
770
|
tenant: data.tenant,
|
|
@@ -777,7 +776,7 @@ export class BackendHandler {
|
|
|
777
776
|
const deploymentErrorCb = (data: Service) => {
|
|
778
777
|
const deploymentErrorNotification: Notification = {
|
|
779
778
|
type: "error",
|
|
780
|
-
subtype:
|
|
779
|
+
subtype: "deployment-error",
|
|
781
780
|
date: Date.now().toString(),
|
|
782
781
|
status: "unread",
|
|
783
782
|
info_content: {
|
|
@@ -785,7 +784,7 @@ export class BackendHandler {
|
|
|
785
784
|
message: data.error?.message || "",
|
|
786
785
|
timestamp: data.error?.timestamp || "",
|
|
787
786
|
},
|
|
788
|
-
|
|
787
|
+
notificationType: "regular",
|
|
789
788
|
data: {
|
|
790
789
|
service: data.name,
|
|
791
790
|
tenant: data.tenant,
|
|
@@ -798,10 +797,10 @@ export class BackendHandler {
|
|
|
798
797
|
deployService(data, token);
|
|
799
798
|
const deploymentSuccessNotification: Notification = {
|
|
800
799
|
type: "info",
|
|
801
|
-
subtype:
|
|
800
|
+
subtype: "deployment-in-progress",
|
|
802
801
|
date: Date.now().toString(),
|
|
803
802
|
status: "unread",
|
|
804
|
-
|
|
803
|
+
notificationType: "regular",
|
|
805
804
|
data: {
|
|
806
805
|
service: data.name,
|
|
807
806
|
tenant: data.tenant,
|
|
@@ -829,10 +828,10 @@ export class BackendHandler {
|
|
|
829
828
|
const updatedCb = (data: Service) => {
|
|
830
829
|
const deploymentNotification: Notification = {
|
|
831
830
|
type: "success",
|
|
832
|
-
subtype:
|
|
831
|
+
subtype: "deployment-updated",
|
|
833
832
|
date: Date.now().toString(),
|
|
834
833
|
status: "unread",
|
|
835
|
-
|
|
834
|
+
notificationType: "regular",
|
|
836
835
|
data: {
|
|
837
836
|
service: data.name,
|
|
838
837
|
tenant: data.tenant,
|
|
@@ -854,10 +853,10 @@ export class BackendHandler {
|
|
|
854
853
|
const deleteCb = (data: Service) => {
|
|
855
854
|
const deploymentNotification: Notification = {
|
|
856
855
|
type: "info",
|
|
857
|
-
subtype:
|
|
856
|
+
subtype: "deployment-deleting",
|
|
858
857
|
date: Date.now().toString(),
|
|
859
858
|
status: "unread",
|
|
860
|
-
|
|
859
|
+
notificationType: "regular",
|
|
861
860
|
data: {
|
|
862
861
|
service: data.name,
|
|
863
862
|
tenant: data.tenant,
|
|
@@ -874,10 +873,10 @@ export class BackendHandler {
|
|
|
874
873
|
const deletedCb = (data: Service) => {
|
|
875
874
|
const deploymentNotification: Notification = {
|
|
876
875
|
type: "success",
|
|
877
|
-
subtype:
|
|
876
|
+
subtype: "deployment-deleted",
|
|
878
877
|
date: Date.now().toString(),
|
|
879
878
|
status: "unread",
|
|
880
|
-
|
|
879
|
+
notificationType: "regular",
|
|
881
880
|
data: {
|
|
882
881
|
service: data.name,
|
|
883
882
|
tenant: data.tenant,
|
|
@@ -1090,10 +1089,10 @@ export class BackendHandler {
|
|
|
1090
1089
|
const deletedCb = (data: Resource) => {
|
|
1091
1090
|
const resourceNotification: Notification = {
|
|
1092
1091
|
type: "success",
|
|
1093
|
-
subtype:
|
|
1092
|
+
subtype: "resource-deleted",
|
|
1094
1093
|
date: Date.now().toString(),
|
|
1095
1094
|
status: "unread",
|
|
1096
|
-
|
|
1095
|
+
notificationType: "regular",
|
|
1097
1096
|
data: {
|
|
1098
1097
|
resource: data.name,
|
|
1099
1098
|
type: data.type,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Account,
|
|
1
|
+
import { Account, getWuiErrorCode, Notification } from "@kumori/aurora-interfaces";
|
|
2
2
|
const CREDENTIAL_ERROR_CODES = new Set([
|
|
3
3
|
"_error_retrieving_credentials_",
|
|
4
4
|
"_invalid_account_credentials_",
|
|
@@ -289,10 +289,10 @@ export const handleAccountOperationSuccess = ({
|
|
|
289
289
|
shouldDelete: true,
|
|
290
290
|
notification: {
|
|
291
291
|
type: "success",
|
|
292
|
-
subtype:
|
|
292
|
+
subtype: "account-deleted",
|
|
293
293
|
date: Date.now().toString(),
|
|
294
294
|
status: "unread",
|
|
295
|
-
|
|
295
|
+
notificationType: "regular",
|
|
296
296
|
data: { account: originalData.name, tenant: originalData.tenant },
|
|
297
297
|
},
|
|
298
298
|
eventType: "deleted",
|
|
@@ -308,10 +308,10 @@ export const handleAccountOperationSuccess = ({
|
|
|
308
308
|
shouldDelete: false,
|
|
309
309
|
notification: {
|
|
310
310
|
type: "success",
|
|
311
|
-
subtype: isCreate ?
|
|
311
|
+
subtype: isCreate ? "account-created" : "account-updated",
|
|
312
312
|
date: Date.now().toString(),
|
|
313
313
|
status: "unread",
|
|
314
|
-
|
|
314
|
+
notificationType: "regular",
|
|
315
315
|
data: { account: updatedAccount.name, tenant: updatedAccount.tenant },
|
|
316
316
|
},
|
|
317
317
|
eventType: isCreate ? "created" : "updated",
|
|
@@ -326,7 +326,7 @@ export const handleAccountOperationSuccess = ({
|
|
|
326
326
|
subtype: "account-unknown",
|
|
327
327
|
date: Date.now().toString(),
|
|
328
328
|
status: "unread",
|
|
329
|
-
|
|
329
|
+
notificationType: "regular",
|
|
330
330
|
data: {},
|
|
331
331
|
},
|
|
332
332
|
eventType: null,
|
|
@@ -357,10 +357,11 @@ export const handleAccountOperationError = ({
|
|
|
357
357
|
const errorCode: string = error?.error?.code ?? error?.code ?? "";
|
|
358
358
|
const errorStatus = resolveErrorStatus(errorCode);
|
|
359
359
|
|
|
360
|
-
const
|
|
360
|
+
const errSubtype = isCreate ? "account-creation-error" : isUpdate ? "account-update-error" : "account-deletion-error";
|
|
361
|
+
const errMethod = isCreate ? "createAccount" : isUpdate ? "updateAccount" : "deleteAccount";
|
|
361
362
|
const notification: Notification = {
|
|
362
363
|
type: "error",
|
|
363
|
-
subtype:
|
|
364
|
+
subtype: getWuiErrorCode("account", errMethod, errorCode) ?? errSubtype,
|
|
364
365
|
date: Date.now().toString(),
|
|
365
366
|
status: "unread",
|
|
366
367
|
info_content: {
|
|
@@ -369,7 +370,7 @@ export const handleAccountOperationError = ({
|
|
|
369
370
|
error?.error?.content ?? error?.error?.message ?? "Unknown error",
|
|
370
371
|
timestamp: error?.error?.timestamp ?? Date.now().toString(),
|
|
371
372
|
},
|
|
372
|
-
|
|
373
|
+
notificationType: "regular",
|
|
373
374
|
data: {
|
|
374
375
|
account:
|
|
375
376
|
entityName || originalData?.name || originalData?.account || "unknown",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Account, Environment,
|
|
1
|
+
import { Account, Environment, getWuiErrorCode, Notification } from "@kumori/aurora-interfaces";
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
@@ -184,10 +184,10 @@ export const handleEnvironmentOperationSuccess = ({
|
|
|
184
184
|
|
|
185
185
|
const envNotification: Notification = {
|
|
186
186
|
type: "success",
|
|
187
|
-
subtype:
|
|
187
|
+
subtype: "environment-cleaned",
|
|
188
188
|
date: Date.now().toString(),
|
|
189
189
|
status: "unread",
|
|
190
|
-
|
|
190
|
+
notificationType: "regular",
|
|
191
191
|
data: {
|
|
192
192
|
environment: envData.name,
|
|
193
193
|
account: envData.account,
|
|
@@ -249,10 +249,11 @@ export const handleEnvironmentOperationError = ({
|
|
|
249
249
|
? "updateError"
|
|
250
250
|
: "deletionError";
|
|
251
251
|
|
|
252
|
-
const
|
|
252
|
+
const envErrSubtype = action === "CREATE" ? "environment-creation-error" : action === "UPDATE" ? "environment-update-error" : "environment-deletion-error";
|
|
253
|
+
const envErrMethod = action === "CREATE" ? "createEnvironment" : action === "UPDATE" ? "updateEnvironment" : "deleteEnvironment";
|
|
253
254
|
const envErrorNotification: Notification = {
|
|
254
255
|
type: "error",
|
|
255
|
-
subtype:
|
|
256
|
+
subtype: getWuiErrorCode("environment", envErrMethod, error?.error?.code || "UNKNOWN_ERROR") ?? envErrSubtype,
|
|
256
257
|
date: Date.now().toString(),
|
|
257
258
|
status: "unread",
|
|
258
259
|
info_content: {
|
|
@@ -260,7 +261,7 @@ export const handleEnvironmentOperationError = ({
|
|
|
260
261
|
message: error?.error?.content || error?.error?.message || "Unknown error",
|
|
261
262
|
timestamp: error?.error?.timestamp || "",
|
|
262
263
|
},
|
|
263
|
-
|
|
264
|
+
notificationType: "regular",
|
|
264
265
|
data: {
|
|
265
266
|
environment: originalData.name,
|
|
266
267
|
account: originalData.account,
|
package/helpers/token-helper.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ClusterToken,
|
|
1
|
+
import { ClusterToken, Notification, Token, UserData } from "@kumori/aurora-interfaces";
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
interface HandleTokenEventParams {
|
|
@@ -161,10 +161,10 @@ export const handleTokenDeletion = ({
|
|
|
161
161
|
|
|
162
162
|
const notification: Notification = {
|
|
163
163
|
type: "success",
|
|
164
|
-
subtype:
|
|
164
|
+
subtype: "token-deleted",
|
|
165
165
|
date: Date.now().toString(),
|
|
166
166
|
status: "unread",
|
|
167
|
-
|
|
167
|
+
notificationType: "regular",
|
|
168
168
|
data: {
|
|
169
169
|
tokenName: deletedToken.name,
|
|
170
170
|
tenant: deletedToken.tenant,
|
package/helpers/user-helper.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
errors,
|
|
3
2
|
Notification,
|
|
4
3
|
Plan,
|
|
5
4
|
Tenant,
|
|
@@ -62,9 +61,9 @@ export const handleUserEvent = ({
|
|
|
62
61
|
eventHelper.tenant.publish.deleted(tenantToDelete);
|
|
63
62
|
const tenantDeletedNotification: Notification = {
|
|
64
63
|
type: "success",
|
|
65
|
-
subtype:
|
|
64
|
+
subtype: "tenant-deleted",
|
|
66
65
|
date: Date.now().toString(),
|
|
67
|
-
|
|
66
|
+
notificationType: "regular",
|
|
68
67
|
status: "unread",
|
|
69
68
|
data: {
|
|
70
69
|
tenant: tenantToDelete.name,
|
|
@@ -76,9 +75,9 @@ export const handleUserEvent = ({
|
|
|
76
75
|
} else {
|
|
77
76
|
const userRemovedNotification: Notification = {
|
|
78
77
|
type: "info",
|
|
79
|
-
subtype:
|
|
78
|
+
subtype: "user-removed-from-tenant",
|
|
80
79
|
date: Date.now().toString(),
|
|
81
|
-
|
|
80
|
+
notificationType: "regular",
|
|
82
81
|
status: "unread",
|
|
83
82
|
data: {
|
|
84
83
|
tenant: tenantToDelete.name,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kumori/aurora-backend-handler",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.112",
|
|
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.
|
|
14
|
+
"@kumori/aurora-interfaces": "^1.0.31",
|
|
15
15
|
"@kumori/kumori-dsl-generator": "1.0.10",
|
|
16
16
|
"@kumori/kumori-module-generator": "^1.1.6",
|
|
17
17
|
"ts-node": "^10.9.2",
|
package/websocket-manager.ts
CHANGED
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
Channel,
|
|
7
7
|
ClusterToken,
|
|
8
8
|
Environment,
|
|
9
|
-
errors,
|
|
10
9
|
Instance,
|
|
11
10
|
MarketplaceItem,
|
|
12
11
|
Notification,
|
|
@@ -963,7 +962,7 @@ const handleEvent = async (message: WSMessage) => {
|
|
|
963
962
|
) {
|
|
964
963
|
const roleNotification: Notification = {
|
|
965
964
|
type: "info",
|
|
966
|
-
subtype:
|
|
965
|
+
subtype: "tenant-role-changed",
|
|
967
966
|
date: Date.now().toString(),
|
|
968
967
|
status: "unread",
|
|
969
968
|
callToAction: false,
|
|
@@ -1784,7 +1783,7 @@ const handleDeleteEvent = async (message: WSMessage) => {
|
|
|
1784
1783
|
eventHelper.environment.publish.deleted(deletedEnv);
|
|
1785
1784
|
const envNotification: Notification = {
|
|
1786
1785
|
type: "success",
|
|
1787
|
-
subtype:
|
|
1786
|
+
subtype: "environment-deleted",
|
|
1788
1787
|
date: Date.now().toString(),
|
|
1789
1788
|
callToAction: false,
|
|
1790
1789
|
status: "unread",
|
|
@@ -1804,7 +1803,7 @@ const handleDeleteEvent = async (message: WSMessage) => {
|
|
|
1804
1803
|
eventHelper.account.publish.deleted(deletedAccount);
|
|
1805
1804
|
const accountNotification: Notification = {
|
|
1806
1805
|
type: "success",
|
|
1807
|
-
subtype:
|
|
1806
|
+
subtype: "account-deleted",
|
|
1808
1807
|
date: Date.now().toString(),
|
|
1809
1808
|
callToAction: false,
|
|
1810
1809
|
status: "unread",
|
|
@@ -1942,7 +1941,7 @@ const handleDeleteEvent = async (message: WSMessage) => {
|
|
|
1942
1941
|
tenantsMap.set(tenantName, registryTenant);
|
|
1943
1942
|
const registryNotification: Notification = {
|
|
1944
1943
|
type: "success",
|
|
1945
|
-
subtype:
|
|
1944
|
+
subtype: "registry-deleted",
|
|
1946
1945
|
date: Date.now().toString(),
|
|
1947
1946
|
status: "unread",
|
|
1948
1947
|
callToAction: false,
|
|
@@ -1998,7 +1997,7 @@ const handleDeleteEvent = async (message: WSMessage) => {
|
|
|
1998
1997
|
if (deletedLinkInfo) {
|
|
1999
1998
|
const unlinkNotification: Notification = {
|
|
2000
1999
|
type: "success",
|
|
2001
|
-
subtype:
|
|
2000
|
+
subtype: "service-unlinked",
|
|
2002
2001
|
date: Date.now().toString(),
|
|
2003
2002
|
status: "unread",
|
|
2004
2003
|
callToAction: false,
|