@kumori/aurora-backend-handler 1.0.0
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/.gitlab-ci.yml +57 -0
- package/README.md +352 -0
- package/api/account-api-service.ts +1092 -0
- package/api/deploy-service-helper.ts +1611 -0
- package/api/environment-api-service.ts +542 -0
- package/api/marketplace-api-service.ts +1031 -0
- package/api/organizations-api-service.ts +0 -0
- package/api/planProvider-api-service.ts +24 -0
- package/api/reporting-api-service.ts +35 -0
- package/api/resources-api-service.ts +821 -0
- package/api/service-api-service.ts +796 -0
- package/api/tenant-api-service.ts +1260 -0
- package/api/user-api-service.ts +1161 -0
- package/backend-handler.ts +1127 -0
- package/environment.ts +7 -0
- package/event-helper.ts +577 -0
- package/event-names.ts +152 -0
- package/helpers/account-helper.ts +331 -0
- package/helpers/environment-helper.ts +289 -0
- package/helpers/link-helper.ts +114 -0
- package/helpers/plan-helper.ts +104 -0
- package/helpers/registry-helper.ts +134 -0
- package/helpers/resource-helper.ts +387 -0
- package/helpers/revision-helper.ts +899 -0
- package/helpers/service-helper.ts +627 -0
- package/helpers/tenant-helper.ts +191 -0
- package/helpers/token-helper.ts +107 -0
- package/helpers/user-helper.ts +140 -0
- package/jest.config.ts +40 -0
- package/jest.setup.js +4 -0
- package/package.json +50 -0
- package/test/backend-handler.test.ts +792 -0
- package/test/deploy-service-helper.test.ts +518 -0
- package/test/event-helper.test.ts +152 -0
- package/tsconfig.json +26 -0
- package/utils/utils.ts +78 -0
- package/websocket-manager.ts +1833 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
|
|
2
|
+
import { Tenant, tenantRole, User, UserData } from "@hestekumori/aurora-interfaces";
|
|
3
|
+
import { parseKeyPath } from "../utils/utils";
|
|
4
|
+
|
|
5
|
+
export const handleTenantEvent: (
|
|
6
|
+
entityId: string,
|
|
7
|
+
eventData: any,
|
|
8
|
+
userData: UserData,
|
|
9
|
+
) => Tenant = (entityId: string, eventData: any, userData: User) => {
|
|
10
|
+
const organizationIds = eventData.spec.organization
|
|
11
|
+
? Array.isArray(eventData.spec.organization)
|
|
12
|
+
? eventData.spec.organization.map((org: any) => org.name).filter(Boolean)
|
|
13
|
+
: [eventData.spec.organization.name].filter(Boolean)
|
|
14
|
+
: [];
|
|
15
|
+
const tenantUsers: { id: string; status: string; role: tenantRole }[] = [];
|
|
16
|
+
if (eventData.spec.users) {
|
|
17
|
+
Object.entries(eventData.spec.users).forEach(([userId, userRole]) => {
|
|
18
|
+
const userStatus = eventData.status?.users?.[userId] || "unknown";
|
|
19
|
+
let role: tenantRole;
|
|
20
|
+
switch (userRole as string) {
|
|
21
|
+
case "owner":
|
|
22
|
+
role = tenantRole.OWNER;
|
|
23
|
+
break;
|
|
24
|
+
case "admin":
|
|
25
|
+
role = tenantRole.ADMIN;
|
|
26
|
+
break;
|
|
27
|
+
case "plain":
|
|
28
|
+
role = tenantRole.PLAIN;
|
|
29
|
+
break;
|
|
30
|
+
default:
|
|
31
|
+
role = tenantRole.PLAIN;
|
|
32
|
+
}
|
|
33
|
+
tenantUsers.push({
|
|
34
|
+
id: userId,
|
|
35
|
+
status: userStatus,
|
|
36
|
+
role: role,
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const newTenant: Tenant = {
|
|
42
|
+
id: entityId,
|
|
43
|
+
name: entityId,
|
|
44
|
+
organizationsIds: organizationIds,
|
|
45
|
+
services: [],
|
|
46
|
+
accounts: [],
|
|
47
|
+
environments: [],
|
|
48
|
+
marketplaceItems: [],
|
|
49
|
+
resources: [],
|
|
50
|
+
role: Object.keys(eventData.spec.users).includes(userData.id)
|
|
51
|
+
? eventData.spec.users[userData.id]
|
|
52
|
+
: "",
|
|
53
|
+
status: eventData.meta?.deleted ? "deleting" : "",
|
|
54
|
+
users: tenantUsers,
|
|
55
|
+
registry: [],
|
|
56
|
+
created: eventData.meta.created,
|
|
57
|
+
freemium: eventData.spec.primary === "playground",
|
|
58
|
+
npmRegistry: {
|
|
59
|
+
endpoint: "",
|
|
60
|
+
domain: "",
|
|
61
|
+
credentials: "",
|
|
62
|
+
public: false,
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
if (eventData.spec.plan) {
|
|
67
|
+
const planParent = eventData.spec.plan.parent
|
|
68
|
+
? parseKeyPath(eventData.spec.plan.parent.name)
|
|
69
|
+
: {};
|
|
70
|
+
newTenant.plan = {
|
|
71
|
+
name: eventData.spec.plan.name,
|
|
72
|
+
provider: planParent.planprovider || "",
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const registries = eventData?.spec?.registries?.registries;
|
|
77
|
+
|
|
78
|
+
if (
|
|
79
|
+
registries &&
|
|
80
|
+
Object.keys(registries).length > 0 &&
|
|
81
|
+
newTenant.npmRegistry
|
|
82
|
+
) {
|
|
83
|
+
const tenantRegistry = Object.keys(registries)[0];
|
|
84
|
+
const tenantOptions = registries[tenantRegistry]?.options;
|
|
85
|
+
|
|
86
|
+
if (tenantOptions?.endpoint) {
|
|
87
|
+
newTenant.npmRegistry.endpoint = tenantOptions.endpoint;
|
|
88
|
+
}
|
|
89
|
+
if (tenantOptions?.credentials) {
|
|
90
|
+
newTenant.npmRegistry.credentials = tenantOptions.credentials;
|
|
91
|
+
}
|
|
92
|
+
if (typeof tenantOptions?.public === "boolean") {
|
|
93
|
+
newTenant.npmRegistry.public = tenantOptions.public;
|
|
94
|
+
}
|
|
95
|
+
if (
|
|
96
|
+
eventData?.spec?.domains &&
|
|
97
|
+
Object.keys(eventData.spec.domains).length > 0
|
|
98
|
+
) {
|
|
99
|
+
newTenant.npmRegistry.domain = Object.keys(eventData.spec.domains)[0];
|
|
100
|
+
}
|
|
101
|
+
} else {
|
|
102
|
+
console.warn(
|
|
103
|
+
`No se encontró información de registry en eventData para el tenant ${newTenant.name}`,
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
return newTenant;
|
|
107
|
+
};
|
|
108
|
+
export const handleTenantOperationSuccess: (
|
|
109
|
+
entityName: string,
|
|
110
|
+
eventData: any,
|
|
111
|
+
userData: UserData,
|
|
112
|
+
) => Tenant = (entityName: string, eventData: any, userData: UserData) => {
|
|
113
|
+
const tenantUsers: {
|
|
114
|
+
id: string;
|
|
115
|
+
status: string;
|
|
116
|
+
role: tenantRole;
|
|
117
|
+
}[] = [];
|
|
118
|
+
|
|
119
|
+
if (eventData.spec.users) {
|
|
120
|
+
Object.entries(eventData.spec.users).forEach(([userId, userRole]) => {
|
|
121
|
+
const userStatus = eventData.status?.users?.[userId] || "unknown";
|
|
122
|
+
let role: tenantRole;
|
|
123
|
+
switch (userRole as string) {
|
|
124
|
+
case "owner":
|
|
125
|
+
role = tenantRole.OWNER;
|
|
126
|
+
break;
|
|
127
|
+
case "admin":
|
|
128
|
+
role = tenantRole.ADMIN;
|
|
129
|
+
break;
|
|
130
|
+
case "plain":
|
|
131
|
+
role = tenantRole.PLAIN;
|
|
132
|
+
break;
|
|
133
|
+
default:
|
|
134
|
+
role = tenantRole.PLAIN;
|
|
135
|
+
}
|
|
136
|
+
tenantUsers.push({
|
|
137
|
+
id: userId,
|
|
138
|
+
status: userStatus,
|
|
139
|
+
role: role,
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
const newTenant: Tenant = {
|
|
144
|
+
id: entityName,
|
|
145
|
+
name: entityName,
|
|
146
|
+
organizationsIds: [],
|
|
147
|
+
services: [],
|
|
148
|
+
accounts: [],
|
|
149
|
+
environments: [],
|
|
150
|
+
marketplaceItems: [],
|
|
151
|
+
resources: [],
|
|
152
|
+
role: Object.keys(eventData.spec.users).includes(userData.id)
|
|
153
|
+
? eventData.spec.users[userData.id]
|
|
154
|
+
: "",
|
|
155
|
+
status: "active",
|
|
156
|
+
users: tenantUsers,
|
|
157
|
+
registry: [],
|
|
158
|
+
npmRegistry: {
|
|
159
|
+
endpoint: "",
|
|
160
|
+
domain: "",
|
|
161
|
+
credentials: "",
|
|
162
|
+
public: false,
|
|
163
|
+
},
|
|
164
|
+
};
|
|
165
|
+
const registries = eventData?.spec?.registries?.registries;
|
|
166
|
+
if (
|
|
167
|
+
registries &&
|
|
168
|
+
Object.keys(registries).length > 0 &&
|
|
169
|
+
newTenant.npmRegistry
|
|
170
|
+
) {
|
|
171
|
+
const tenantRegistry = Object.keys(registries)[0];
|
|
172
|
+
const tenantOptions = registries[tenantRegistry]?.options;
|
|
173
|
+
|
|
174
|
+
if (tenantOptions?.endpoint) {
|
|
175
|
+
newTenant.npmRegistry.endpoint = tenantOptions.endpoint;
|
|
176
|
+
}
|
|
177
|
+
if (tenantOptions?.credentials) {
|
|
178
|
+
newTenant.npmRegistry.credentials = tenantOptions.credentials;
|
|
179
|
+
}
|
|
180
|
+
if (typeof tenantOptions?.public === "boolean") {
|
|
181
|
+
newTenant.npmRegistry.public = tenantOptions.public;
|
|
182
|
+
}
|
|
183
|
+
if (
|
|
184
|
+
eventData?.spec?.domains &&
|
|
185
|
+
Object.keys(eventData.spec.domains).length > 0
|
|
186
|
+
) {
|
|
187
|
+
newTenant.npmRegistry.domain = Object.keys(eventData.spec.domains)[0];
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return newTenant;
|
|
191
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { ClusterToken, Token, UserData } from "@hestekumori/aurora-interfaces";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
interface HandleTokenEventParams {
|
|
5
|
+
eventData: any;
|
|
6
|
+
tokenMap: Map<string, Token>;
|
|
7
|
+
userData: UserData;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface HandleTokenEventResult {
|
|
11
|
+
isUserToken: boolean;
|
|
12
|
+
isClusterToken: boolean;
|
|
13
|
+
userToken: Token | null;
|
|
14
|
+
clusterToken: ClusterToken | null;
|
|
15
|
+
updatedUserTokens: Token[];
|
|
16
|
+
tokenId: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Handles the "token" event from WebSocket messages
|
|
21
|
+
* Processes both user tokens and cluster tokens
|
|
22
|
+
*/
|
|
23
|
+
export const handleTokenEvent = ({
|
|
24
|
+
eventData,
|
|
25
|
+
tokenMap,
|
|
26
|
+
userData,
|
|
27
|
+
}: HandleTokenEventParams): HandleTokenEventResult => {
|
|
28
|
+
const tokenParentKind = eventData.id.parent?.kind;
|
|
29
|
+
const tokenId = eventData.id.name;
|
|
30
|
+
|
|
31
|
+
if (tokenParentKind === "user") {
|
|
32
|
+
const tokenInMap = tokenMap.get(tokenId);
|
|
33
|
+
|
|
34
|
+
const newUserToken: Token = {
|
|
35
|
+
name: tokenId,
|
|
36
|
+
tenant: eventData.meta?.labels?.tenant || eventData.spec?.tenant || "",
|
|
37
|
+
description: eventData.meta?.description || "",
|
|
38
|
+
lastUsed: tokenInMap?.lastUsed || "",
|
|
39
|
+
expiration: eventData.meta?.expiration
|
|
40
|
+
? new Date(eventData.meta.expiration * 1000).toISOString()
|
|
41
|
+
: "",
|
|
42
|
+
token: tokenInMap?.token || "",
|
|
43
|
+
};
|
|
44
|
+
const updatedUserTokens = [...userData.tokens];
|
|
45
|
+
const existingTokenIndex = updatedUserTokens.findIndex(
|
|
46
|
+
(t) => t.name === tokenId
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
if (existingTokenIndex !== -1) {
|
|
50
|
+
updatedUserTokens[existingTokenIndex] = newUserToken;
|
|
51
|
+
} else {
|
|
52
|
+
updatedUserTokens.push(newUserToken);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return {
|
|
56
|
+
isUserToken: true,
|
|
57
|
+
isClusterToken: false,
|
|
58
|
+
userToken: newUserToken,
|
|
59
|
+
clusterToken: null,
|
|
60
|
+
updatedUserTokens,
|
|
61
|
+
tokenId,
|
|
62
|
+
};
|
|
63
|
+
} else {
|
|
64
|
+
const clusterTokenValue = eventData.spec.jwt;
|
|
65
|
+
const clusterToken: ClusterToken = {
|
|
66
|
+
token: clusterTokenValue,
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
return {
|
|
70
|
+
isUserToken: false,
|
|
71
|
+
isClusterToken: true,
|
|
72
|
+
userToken: null,
|
|
73
|
+
clusterToken,
|
|
74
|
+
updatedUserTokens: userData.tokens,
|
|
75
|
+
tokenId: clusterTokenValue,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
interface HandleTokenOperationSuccessParams {
|
|
81
|
+
responsePayload: any;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
interface HandleTokenOperationSuccessResult {
|
|
85
|
+
token: Token;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Handles successful token creation operation
|
|
90
|
+
* Returns the token with full data from the response
|
|
91
|
+
*/
|
|
92
|
+
export const handleTokenOperationSuccess = ({
|
|
93
|
+
responsePayload,
|
|
94
|
+
}: HandleTokenOperationSuccessParams): HandleTokenOperationSuccessResult => {
|
|
95
|
+
const tokenWithData: Token = {
|
|
96
|
+
name: responsePayload.data.jti,
|
|
97
|
+
tenant: "",
|
|
98
|
+
description: responsePayload.data.description || "",
|
|
99
|
+
expiration: "",
|
|
100
|
+
token: responsePayload.data.token,
|
|
101
|
+
lastUsed: new Date().toISOString(),
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
return {
|
|
105
|
+
token: tokenWithData,
|
|
106
|
+
};
|
|
107
|
+
};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { Notification, Plan, Tenant, UserData } from "@hestekumori/aurora-interfaces";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
interface HandleUserEventParams {
|
|
6
|
+
eventData: any;
|
|
7
|
+
tenantsMap: Map<string, Tenant>;
|
|
8
|
+
currentUserData: UserData;
|
|
9
|
+
currentUserNotifications: Notification[];
|
|
10
|
+
plansMap: Map<string, Plan>;
|
|
11
|
+
parseKeyPath: (key: string) => { [entity: string]: string };
|
|
12
|
+
eventHelper: any;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface HandleUserEventResult {
|
|
16
|
+
userData: UserData;
|
|
17
|
+
tempProviders: Record<string, string>;
|
|
18
|
+
deletedTenantKeys: string[];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Handles the "user" event from WebSocket messages
|
|
23
|
+
* Processes user data updates, tenant deletions, and plan assignments
|
|
24
|
+
*/
|
|
25
|
+
export const handleUserEvent = ({
|
|
26
|
+
eventData,
|
|
27
|
+
tenantsMap,
|
|
28
|
+
currentUserData,
|
|
29
|
+
currentUserNotifications,
|
|
30
|
+
plansMap,
|
|
31
|
+
parseKeyPath,
|
|
32
|
+
eventHelper,
|
|
33
|
+
}: HandleUserEventParams): HandleUserEventResult => {
|
|
34
|
+
const userId = eventData.id.name;
|
|
35
|
+
const userTenants = Object.keys(eventData.status.tenants);
|
|
36
|
+
const deletedTenantKeys: string[] = [];
|
|
37
|
+
for (const key of tenantsMap.keys()) {
|
|
38
|
+
if (!userTenants.includes(key)) {
|
|
39
|
+
const tenantToDelete = tenantsMap.get(key);
|
|
40
|
+
if (tenantToDelete) {
|
|
41
|
+
eventHelper.tenant.publish.deleted(tenantToDelete);
|
|
42
|
+
const tenantDeletedNotification: Notification = {
|
|
43
|
+
type: "success",
|
|
44
|
+
subtype: "tenant-deleted",
|
|
45
|
+
date: Date.now().toString(),
|
|
46
|
+
callToAction: false,
|
|
47
|
+
status: "unread",
|
|
48
|
+
data: {
|
|
49
|
+
tenant: tenantToDelete.name,
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
eventHelper.notification.publish.creation(tenantDeletedNotification);
|
|
53
|
+
deletedTenantKeys.push(key);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const existingNotifications =
|
|
59
|
+
currentUserData.notifications || currentUserNotifications || [];
|
|
60
|
+
const userPlans: Plan[] = [];
|
|
61
|
+
if (eventData.spec.plans) {
|
|
62
|
+
Object.entries(eventData.spec.plans).forEach(
|
|
63
|
+
([planPath, role]: [string, any]) => {
|
|
64
|
+
const planPathParts = parseKeyPath(planPath);
|
|
65
|
+
const planProvider = planPathParts.planprovider;
|
|
66
|
+
const planInstance = planPathParts.planinstance;
|
|
67
|
+
const planKey = `${planProvider}/${planInstance}`;
|
|
68
|
+
const plan = plansMap.get(planKey);
|
|
69
|
+
if (plan) {
|
|
70
|
+
userPlans.push({
|
|
71
|
+
...plan,
|
|
72
|
+
});
|
|
73
|
+
} else {
|
|
74
|
+
const basicPlan: Plan = {
|
|
75
|
+
name: planInstance,
|
|
76
|
+
provider: planProvider,
|
|
77
|
+
};
|
|
78
|
+
userPlans.push(basicPlan);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
const tempProviders: Record<string, string> = eventData.spec.providers || {};
|
|
84
|
+
const providers: { name: string; email: string; password?: string }[] = [];
|
|
85
|
+
|
|
86
|
+
const existingProvidersMap = new Map(
|
|
87
|
+
(currentUserData.provider || []).map((p) => [p.name, p])
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
for (const [providerName, providerId] of Object.entries(tempProviders)) {
|
|
91
|
+
const existingProvider = existingProvidersMap.get(providerName);
|
|
92
|
+
|
|
93
|
+
if (existingProvider && existingProvider.email) {
|
|
94
|
+
providers.push(existingProvider);
|
|
95
|
+
} else {
|
|
96
|
+
providers.push({
|
|
97
|
+
name: providerName,
|
|
98
|
+
email: existingProvider?.email || "",
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
const userData: UserData = {
|
|
103
|
+
id: userId,
|
|
104
|
+
name: eventData.spec.userinfo.name,
|
|
105
|
+
surname: eventData.spec.userinfo.surname,
|
|
106
|
+
provider: providers,
|
|
107
|
+
notificationsEnabled: "",
|
|
108
|
+
organizations: [],
|
|
109
|
+
clusterTokens: [],
|
|
110
|
+
tokens: [],
|
|
111
|
+
tenants: [],
|
|
112
|
+
axebowPlan: "freemium",
|
|
113
|
+
companyName: eventData.spec.userinfo.companyName,
|
|
114
|
+
rol: eventData.spec.userinfo.companyRole,
|
|
115
|
+
notifications: existingNotifications,
|
|
116
|
+
plans: userPlans,
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
return {
|
|
120
|
+
userData,
|
|
121
|
+
tempProviders,
|
|
122
|
+
deletedTenantKeys,
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
export const handleUserOperationError = (): UserData => {
|
|
126
|
+
return {
|
|
127
|
+
id: "",
|
|
128
|
+
name: "",
|
|
129
|
+
surname: "",
|
|
130
|
+
provider: [],
|
|
131
|
+
notificationsEnabled: "",
|
|
132
|
+
organizations: [],
|
|
133
|
+
clusterTokens: [],
|
|
134
|
+
tokens: [],
|
|
135
|
+
tenants: [],
|
|
136
|
+
axebowPlan: "freemium",
|
|
137
|
+
companyName: "",
|
|
138
|
+
rol: "",
|
|
139
|
+
};
|
|
140
|
+
};
|
package/jest.config.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Config } from '@jest/types';
|
|
2
|
+
|
|
3
|
+
const config: Config.InitialOptions = {
|
|
4
|
+
preset: 'ts-jest',
|
|
5
|
+
testEnvironment: 'node',
|
|
6
|
+
setupFiles: ['./jest.setup.js'],
|
|
7
|
+
extensionsToTreatAsEsm: ['.ts'],
|
|
8
|
+
transform: {
|
|
9
|
+
'^.+\\.[tj]sx?$': [
|
|
10
|
+
'ts-jest',
|
|
11
|
+
{
|
|
12
|
+
useESM: true,
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
},
|
|
16
|
+
transformIgnorePatterns: [
|
|
17
|
+
'/node_modules/(?!@lit|lit|@lit-labs)/',
|
|
18
|
+
],
|
|
19
|
+
moduleNameMapper: {
|
|
20
|
+
'^(\\.{1,2}/.*)\\.js$': '$1',
|
|
21
|
+
},
|
|
22
|
+
collectCoverage: true,
|
|
23
|
+
collectCoverageFrom: [
|
|
24
|
+
"**/backend-handler.ts",
|
|
25
|
+
"**/event-helper.ts",
|
|
26
|
+
"**/event-names.ts",
|
|
27
|
+
"**/deploy-service-helper.ts"
|
|
28
|
+
],
|
|
29
|
+
coverageReporters: ["html", "text", "text-summary", "cobertura"],
|
|
30
|
+
testMatch: ["**/*.test.ts"],
|
|
31
|
+
reporters: [
|
|
32
|
+
"default",
|
|
33
|
+
["jest-junit", {
|
|
34
|
+
outputDirectory: ".",
|
|
35
|
+
outputName: "report.xml"
|
|
36
|
+
}]
|
|
37
|
+
],
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export default config;
|
package/jest.setup.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"scripts": {
|
|
3
|
+
"test": "jest --config jest.config.ts"
|
|
4
|
+
},
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"@hestekumori/aurora-interfaces": "^1.0.17",
|
|
7
|
+
"@jest/globals": "^29.7.0",
|
|
8
|
+
"@kumori/kumori-dsl-generator": "^1.0.3",
|
|
9
|
+
"@kumori/kumori-module-generator": "^1.1.6",
|
|
10
|
+
"jest": "^29.7.0",
|
|
11
|
+
"ts-node": "^10.9.2",
|
|
12
|
+
"uuid": "^11.1.0",
|
|
13
|
+
"ws": "^8.18.2"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@types/jest": "^29.5.14",
|
|
17
|
+
"@types/ws": "^8.18.1",
|
|
18
|
+
"formdata-node": "^6.0.3",
|
|
19
|
+
"jest-junit": "^16.0.0",
|
|
20
|
+
"ts-jest": "^29.3.0",
|
|
21
|
+
"typescript": "~5.6.2",
|
|
22
|
+
"uuid": "^11.1.0",
|
|
23
|
+
"ws": "^8.18.2"
|
|
24
|
+
},
|
|
25
|
+
"name": "@kumori/aurora-backend-handler",
|
|
26
|
+
"version": "1.0.0",
|
|
27
|
+
"description": "backend handler",
|
|
28
|
+
"main": "backend-handler.ts",
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "https://gitlab.com/kumori/axebow/libraries/wui/backend-handler"
|
|
32
|
+
},
|
|
33
|
+
"author": "Hugo",
|
|
34
|
+
"license": "ISC",
|
|
35
|
+
"jest": {
|
|
36
|
+
"preset": "ts-jest",
|
|
37
|
+
"testEnvironment": "node",
|
|
38
|
+
"extensionsToTreatAsEsm": [
|
|
39
|
+
".ts"
|
|
40
|
+
],
|
|
41
|
+
"globals": {
|
|
42
|
+
"ts-jest": {
|
|
43
|
+
"useESM": true
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"moduleNameMapper": {
|
|
47
|
+
"^(\\.{1,2}/.*)\\.js$": "$1"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|