@kumori/aurora-backend-handler 1.0.100 → 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.
@@ -1,4 +1,11 @@
1
- import { createUser, loadUser, isUserLogged, updateUser, deleteUSer } from "./api/user-api-service";
1
+ import {
2
+ createUser,
3
+ loadUser,
4
+ isUserLogged,
5
+ updateUser,
6
+ deleteUSer,
7
+ getUserHTTP,
8
+ } from "./api/user-api-service";
2
9
  import {
3
10
  changeRevision,
4
11
  deleteService,
@@ -13,6 +20,7 @@ import {
13
20
  import {
14
21
  deployMarketplaceItem,
15
22
  getMarketplaceItems,
23
+ getMarketplaceSchema,
16
24
  } from "./api/marketplace-api-service";
17
25
  import {
18
26
  clearAccount,
@@ -46,48 +54,67 @@ import {
46
54
  } from "./api/environment-api-service";
47
55
  import EventHelper, { RegistryUpdatePayload } from "./event-helper";
48
56
  import { environment } from "./environment";
49
- import { initializeGlobalWebSocketClient, updateUserComplete } from "./websocket-manager";
57
+ import {
58
+ fetchAndStoreMarketplaceSchema,
59
+ initializeGlobalWebSocketClient,
60
+ updateUserComplete,
61
+ } from "./websocket-manager";
50
62
  import {
51
63
  createResource,
52
64
  deleteResource,
53
65
  updateResource,
54
66
  } from "./api/resources-api-service";
55
- import { getPlanProviders } from './api/planProvider-api-service';
56
- import { Account, Environment, Link, MarketplaceService, Notification, Organization, Resource, Service, Tenant, tenantRole, UserData } from "@kumori/aurora-interfaces";
67
+ import { getPlanProviders } from "./api/planProvider-api-service";
68
+ import {
69
+ Account,
70
+ Environment,
71
+ Link,
72
+ MarketplaceItem,
73
+ MarketplaceService,
74
+ Notification,
75
+ Organization,
76
+ Resource,
77
+ Service,
78
+ Tenant,
79
+ tenantRole,
80
+ User,
81
+ UserData,
82
+ } from "@kumori/aurora-interfaces";
57
83
 
58
84
  export let eventHelper: EventHelper;
59
- const token =
60
- "";
85
+ const token = "";
61
86
  export class BackendHandler {
62
87
  private unsubscribeFunctions: (() => void)[] = [];
63
88
  constructor(
64
89
  route: string,
65
90
  globalEventHandler: any,
66
91
  baseUrl: string,
67
- apiVersion: string
92
+ apiVersion: string,
68
93
  ) {
69
94
  if (
70
95
  !globalEventHandler ||
71
96
  typeof globalEventHandler.subscribe !== "function"
72
97
  ) {
73
98
  throw new Error(
74
- "globalEventHandler inválido. Asegúrate de pasar una instancia correcta de EventHandler."
99
+ "globalEventHandler inválido. Asegúrate de pasar una instancia correcta de EventHandler.",
75
100
  );
76
101
  }
77
102
  eventHelper = new EventHelper(globalEventHandler);
78
- eventHelper.user.subscribe.load((data: UserData) => {
79
- initializeGlobalWebSocketClient(token, "", "", data);
80
- });
81
- const loadedCb = (data: UserData) => {
82
- updateUserComplete(data);
83
- };
84
- eventHelper.user.subscribe.loaded(loadedCb);
85
-
86
- this.changeRoute(route);
87
103
  environment.apiServer.baseUrl = baseUrl;
88
104
  environment.apiServer.apiVersion = apiVersion;
105
+ getUserHTTP().then(() => {
106
+ eventHelper.user.subscribe.load((data: UserData) => {
107
+ initializeGlobalWebSocketClient(token, "", "", data);
108
+ });
109
+ const loadedCb = (data: UserData) => {
110
+ updateUserComplete(data);
111
+ };
112
+ eventHelper.user.subscribe.loaded(loadedCb);
113
+ this.changeRoute(route);
114
+ eventHelper.user.publish.load({} as UserData);
115
+ })
89
116
  }
90
-
117
+
91
118
  /**
92
119
  * Function to change the route and subscribe to the new route events
93
120
  * @param newRoute string with the new route
@@ -135,7 +162,6 @@ export class BackendHandler {
135
162
  this.subscribeMarketplaceEvents();
136
163
  this.subscribeResourceEvents();
137
164
  this.subscribeOrganizationEvents();
138
-
139
165
  }
140
166
  public async isUserLoggedIn(): Promise<boolean> {
141
167
  const loggedIn = await isUserLogged(token);
@@ -157,21 +183,19 @@ export class BackendHandler {
157
183
  };
158
184
  eventHelper.tenant.subscribe.creation(creationCb);
159
185
  this.unsubscribeFunctions.push(() =>
160
- eventHelper.tenant.unsubscribe.creation(creationCb)
186
+ eventHelper.tenant.unsubscribe.creation(creationCb),
161
187
  );
162
188
 
163
- const createdCb = (data: Tenant) => {
164
- };
189
+ const createdCb = (data: Tenant) => {};
165
190
  eventHelper.tenant.subscribe.created(createdCb);
166
191
  this.unsubscribeFunctions.push(() =>
167
- eventHelper.tenant.unsubscribe.created(createdCb)
192
+ eventHelper.tenant.unsubscribe.created(createdCb),
168
193
  );
169
194
 
170
- const creationErrorCb = (data: Tenant) => {
171
- };
195
+ const creationErrorCb = (data: Tenant) => {};
172
196
  eventHelper.tenant.subscribe.creationError(creationErrorCb);
173
197
  this.unsubscribeFunctions.push(() =>
174
- eventHelper.tenant.unsubscribe.creationError(creationErrorCb)
198
+ eventHelper.tenant.unsubscribe.creationError(creationErrorCb),
175
199
  );
176
200
 
177
201
  const updateCb = (data: Tenant) => {
@@ -179,21 +203,19 @@ export class BackendHandler {
179
203
  };
180
204
  eventHelper.tenant.subscribe.update(updateCb);
181
205
  this.unsubscribeFunctions.push(() =>
182
- eventHelper.tenant.unsubscribe.update(updateCb)
206
+ eventHelper.tenant.unsubscribe.update(updateCb),
183
207
  );
184
208
 
185
- const updatedCb = (data: Tenant) => {
186
- };
209
+ const updatedCb = (data: Tenant) => {};
187
210
  eventHelper.tenant.subscribe.updated(updatedCb);
188
211
  this.unsubscribeFunctions.push(() =>
189
- eventHelper.tenant.unsubscribe.updated(updatedCb)
212
+ eventHelper.tenant.unsubscribe.updated(updatedCb),
190
213
  );
191
214
 
192
- const updateErrorCb = (data: Tenant) => {
193
- };
215
+ const updateErrorCb = (data: Tenant) => {};
194
216
  eventHelper.tenant.subscribe.updateError(updateErrorCb);
195
217
  this.unsubscribeFunctions.push(() =>
196
- eventHelper.tenant.unsubscribe.updateError(updateErrorCb)
218
+ eventHelper.tenant.unsubscribe.updateError(updateErrorCb),
197
219
  );
198
220
 
199
221
  const deleteCb = (data: Tenant) => {
@@ -202,196 +224,221 @@ export class BackendHandler {
202
224
  };
203
225
  eventHelper.tenant.subscribe.delete(deleteCb);
204
226
  this.unsubscribeFunctions.push(() =>
205
- eventHelper.tenant.unsubscribe.delete(deleteCb)
227
+ eventHelper.tenant.unsubscribe.delete(deleteCb),
206
228
  );
207
229
 
208
- const deletedCb = (data: Tenant) => {
209
- };
230
+ const deletedCb = (data: Tenant) => {};
210
231
  eventHelper.tenant.subscribe.deleted(deletedCb);
211
232
  this.unsubscribeFunctions.push(() =>
212
- eventHelper.tenant.unsubscribe.deleted(deletedCb)
233
+ eventHelper.tenant.unsubscribe.deleted(deletedCb),
213
234
  );
214
235
 
215
- const deletionErrorCb = (data: Tenant) => {
216
- };
236
+ const deletionErrorCb = (data: Tenant) => {};
217
237
  eventHelper.tenant.subscribe.deletionError(deletionErrorCb);
218
238
  this.unsubscribeFunctions.push(() =>
219
- eventHelper.tenant.unsubscribe.deletionError(deletionErrorCb)
239
+ eventHelper.tenant.unsubscribe.deletionError(deletionErrorCb),
220
240
  );
221
241
  const createRegistryCb = (payload: RegistryUpdatePayload) => {
222
242
  createRegistry(payload.tenant, token, payload.registry);
223
- }
243
+ };
224
244
  eventHelper.tenant.subscribe.createRegistry(createRegistryCb);
225
245
  this.unsubscribeFunctions.push(() =>
226
- eventHelper.tenant.unsubscribe.createRegistry(createRegistryCb)
246
+ eventHelper.tenant.unsubscribe.createRegistry(createRegistryCb),
227
247
  );
228
- const registryCreatedCb = (payload: RegistryUpdatePayload) => {
229
- }
248
+ const registryCreatedCb = (payload: RegistryUpdatePayload) => {};
230
249
  eventHelper.tenant.subscribe.registryCreated(registryCreatedCb);
231
250
  this.unsubscribeFunctions.push(() =>
232
- eventHelper.tenant.unsubscribe.registryCreated(registryCreatedCb)
251
+ eventHelper.tenant.unsubscribe.registryCreated(registryCreatedCb),
233
252
  );
234
- const registryCreationErrorCb = (payload: RegistryUpdatePayload) => {
235
- }
253
+ const registryCreationErrorCb = (payload: RegistryUpdatePayload) => {};
236
254
  eventHelper.tenant.subscribe.registryCreationError(registryCreationErrorCb);
237
255
  this.unsubscribeFunctions.push(() =>
238
- eventHelper.tenant.unsubscribe.registryCreationError(registryCreationErrorCb)
256
+ eventHelper.tenant.unsubscribe.registryCreationError(
257
+ registryCreationErrorCb,
258
+ ),
239
259
  );
240
260
  const updateRegistryCb = (payload: RegistryUpdatePayload) => {
241
261
  updateRegistry(payload.tenant, payload.registry, token);
242
- }
262
+ };
243
263
  eventHelper.tenant.subscribe.updateRegistry(updateRegistryCb);
244
264
  this.unsubscribeFunctions.push(() =>
245
- eventHelper.tenant.unsubscribe.updateRegistry(updateRegistryCb)
265
+ eventHelper.tenant.unsubscribe.updateRegistry(updateRegistryCb),
246
266
  );
247
- const registryUpdatedCb = (payload: RegistryUpdatePayload) => {
248
- }
267
+ const registryUpdatedCb = (payload: RegistryUpdatePayload) => {};
249
268
  eventHelper.tenant.subscribe.registryUpdated(registryUpdatedCb);
250
269
  this.unsubscribeFunctions.push(() =>
251
- eventHelper.tenant.unsubscribe.registryUpdated(registryUpdatedCb)
270
+ eventHelper.tenant.unsubscribe.registryUpdated(registryUpdatedCb),
252
271
  );
253
- const registryUpdateErrorCb = (payload: RegistryUpdatePayload) => {
254
- }
272
+ const registryUpdateErrorCb = (payload: RegistryUpdatePayload) => {};
255
273
  eventHelper.tenant.subscribe.registryUpdateError(registryUpdateErrorCb);
256
274
  this.unsubscribeFunctions.push(() =>
257
- eventHelper.tenant.unsubscribe.registryUpdateError(registryUpdateErrorCb)
275
+ eventHelper.tenant.unsubscribe.registryUpdateError(registryUpdateErrorCb),
258
276
  );
259
277
  const deleteRegistryCb = (payload: RegistryUpdatePayload) => {
260
278
  deleteRegistry(payload.tenant, payload.registry, token);
261
- }
279
+ };
262
280
  eventHelper.tenant.subscribe.deleteRegistry(deleteRegistryCb);
263
281
  this.unsubscribeFunctions.push(() =>
264
- eventHelper.tenant.unsubscribe.deleteRegistry(deleteRegistryCb)
282
+ eventHelper.tenant.unsubscribe.deleteRegistry(deleteRegistryCb),
265
283
  );
266
- const registryDeletedCb = (payload: RegistryUpdatePayload) => {
267
- }
284
+ const registryDeletedCb = (payload: RegistryUpdatePayload) => {};
268
285
  eventHelper.tenant.subscribe.registryDeleted(registryDeletedCb);
269
286
  this.unsubscribeFunctions.push(() =>
270
- eventHelper.tenant.unsubscribe.registryDeleted(registryDeletedCb)
287
+ eventHelper.tenant.unsubscribe.registryDeleted(registryDeletedCb),
271
288
  );
272
- const registryDeletionErrorCb = (payload: RegistryUpdatePayload) => {
273
- }
289
+ const registryDeletionErrorCb = (payload: RegistryUpdatePayload) => {};
274
290
  eventHelper.tenant.subscribe.registryDeletionError(registryDeletionErrorCb);
275
291
  this.unsubscribeFunctions.push(() =>
276
- eventHelper.tenant.unsubscribe.registryDeletionError(registryDeletionErrorCb)
292
+ eventHelper.tenant.unsubscribe.registryDeletionError(
293
+ registryDeletionErrorCb,
294
+ ),
277
295
  );
278
- const inviteUserCb = (payload: { user: string; tenant: string; role: tenantRole }) => {
296
+ const inviteUserCb = (payload: {
297
+ user: string;
298
+ tenant: string;
299
+ role: tenantRole;
300
+ }) => {
279
301
  inviteUser(payload.tenant, payload.user, payload.role, token);
280
302
  };
281
303
  eventHelper.tenant.subscribe.inviteUser(inviteUserCb);
282
304
  this.unsubscribeFunctions.push(() =>
283
- eventHelper.tenant.unsubscribe.inviteUser(inviteUserCb)
305
+ eventHelper.tenant.unsubscribe.inviteUser(inviteUserCb),
284
306
  );
285
- const userInvitedCb = (payload: { user: string; tenant: string; role: tenantRole }) => {
307
+ const userInvitedCb = (payload: {
308
+ user: string;
309
+ tenant: string;
310
+ role: tenantRole;
311
+ }) => {
286
312
  updateUserRole(payload.user, payload.tenant, payload.role, token);
287
313
  };
288
314
  eventHelper.tenant.subscribe.userInvited(userInvitedCb);
289
315
  this.unsubscribeFunctions.push(() =>
290
- eventHelper.tenant.unsubscribe.userInvited(userInvitedCb)
316
+ eventHelper.tenant.unsubscribe.userInvited(userInvitedCb),
291
317
  );
292
- const userInviteErrorCb = (payload: { user: string; tenant: string; role: tenantRole }) => {
293
- };
318
+ const userInviteErrorCb = (payload: {
319
+ user: string;
320
+ tenant: string;
321
+ role: tenantRole;
322
+ }) => {};
294
323
  eventHelper.tenant.subscribe.inviteError(userInviteErrorCb);
295
324
  this.unsubscribeFunctions.push(() =>
296
- eventHelper.tenant.unsubscribe.inviteError(userInviteErrorCb)
325
+ eventHelper.tenant.unsubscribe.inviteError(userInviteErrorCb),
297
326
  );
298
- const removeUserFromTenantCb = (payload: { user: string; tenant: string }) => {
299
- removeUser(payload.tenant,payload.user, token)
300
- }
327
+ const removeUserFromTenantCb = (payload: {
328
+ user: string;
329
+ tenant: string;
330
+ }) => {
331
+ removeUser(payload.tenant, payload.user, token);
332
+ };
301
333
  eventHelper.tenant.subscribe.removeUser(removeUserFromTenantCb);
302
334
  this.unsubscribeFunctions.push(() =>
303
- eventHelper.tenant.unsubscribe.removeUser(removeUserFromTenantCb)
335
+ eventHelper.tenant.unsubscribe.removeUser(removeUserFromTenantCb),
304
336
  );
305
- const userRemovedFromTenantCb = (payload: { user: string; tenant: string }) => {
306
- }
337
+ const userRemovedFromTenantCb = (payload: {
338
+ user: string;
339
+ tenant: string;
340
+ }) => {};
307
341
  eventHelper.tenant.subscribe.userRemoved(userRemovedFromTenantCb);
308
342
  this.unsubscribeFunctions.push(() =>
309
- eventHelper.tenant.unsubscribe.userRemoved(userRemovedFromTenantCb)
343
+ eventHelper.tenant.unsubscribe.userRemoved(userRemovedFromTenantCb),
310
344
  );
311
- const userRemoveErrorCb = (payload: { user: string; tenant: string }) => {
312
- }
345
+ const userRemoveErrorCb = (payload: { user: string; tenant: string }) => {};
313
346
  eventHelper.tenant.subscribe.removeUserError(userRemoveErrorCb);
314
347
  this.unsubscribeFunctions.push(() =>
315
- eventHelper.tenant.unsubscribe.removeUserError(userRemoveErrorCb)
348
+ eventHelper.tenant.unsubscribe.removeUserError(userRemoveErrorCb),
316
349
  );
317
- const updateInviteCb = (payload: { user: string; role: tenantRole; tenant: string }) => {
318
- updateUserRole(payload.tenant, payload.user, payload.role, token)
319
- }
350
+ const updateInviteCb = (payload: {
351
+ user: string;
352
+ role: tenantRole;
353
+ tenant: string;
354
+ }) => {
355
+ updateUserRole(payload.tenant, payload.user, payload.role, token);
356
+ };
320
357
  eventHelper.tenant.subscribe.updateInvite(updateInviteCb);
321
358
  this.unsubscribeFunctions.push(() =>
322
- eventHelper.tenant.unsubscribe.updateInvite(updateInviteCb)
359
+ eventHelper.tenant.unsubscribe.updateInvite(updateInviteCb),
323
360
  );
324
- const inviteUpdatedCb = (payload: { user: string; role: string; tenant: string }) => {
325
- }
361
+ const inviteUpdatedCb = (payload: {
362
+ user: string;
363
+ role: string;
364
+ tenant: string;
365
+ }) => {};
326
366
  eventHelper.tenant.subscribe.inviteUpdated(inviteUpdatedCb);
327
367
  this.unsubscribeFunctions.push(() =>
328
- eventHelper.tenant.unsubscribe.inviteUpdated(inviteUpdatedCb)
368
+ eventHelper.tenant.unsubscribe.inviteUpdated(inviteUpdatedCb),
329
369
  );
330
- const inviteUpdateErrorCb = (payload: { user: string; role: string; tenant: string }) => {
331
- }
370
+ const inviteUpdateErrorCb = (payload: {
371
+ user: string;
372
+ role: string;
373
+ tenant: string;
374
+ }) => {};
332
375
  eventHelper.tenant.subscribe.inviteUpdateError(inviteUpdateErrorCb);
333
376
  this.unsubscribeFunctions.push(() =>
334
- eventHelper.tenant.unsubscribe.inviteUpdateError(inviteUpdateErrorCb)
377
+ eventHelper.tenant.unsubscribe.inviteUpdateError(inviteUpdateErrorCb),
335
378
  );
336
379
  const acceptInviteCb = (payload: { tenant: string }) => {
337
380
  acceptInvite(payload.tenant, token);
338
- }
381
+ };
339
382
  eventHelper.tenant.subscribe.acceptInvite(acceptInviteCb);
340
383
  this.unsubscribeFunctions.push(() =>
341
- eventHelper.tenant.unsubscribe.acceptInvite(acceptInviteCb)
384
+ eventHelper.tenant.unsubscribe.acceptInvite(acceptInviteCb),
342
385
  );
343
- const inviteAcceptedCb = (payload: { tenant: string}) => {
344
- }
386
+ const inviteAcceptedCb = (payload: { tenant: string }) => {};
345
387
  eventHelper.tenant.subscribe.inviteAccepted(inviteAcceptedCb);
346
388
  this.unsubscribeFunctions.push(() =>
347
- eventHelper.tenant.unsubscribe.inviteAccepted(inviteAcceptedCb)
389
+ eventHelper.tenant.unsubscribe.inviteAccepted(inviteAcceptedCb),
348
390
  );
349
- const inviteAcceptErrorCb = (payload: { tenant: string }) => {
350
- }
391
+ const inviteAcceptErrorCb = (payload: { tenant: string }) => {};
351
392
  eventHelper.tenant.subscribe.acceptInviteError(inviteAcceptErrorCb);
352
393
  this.unsubscribeFunctions.push(() =>
353
- eventHelper.tenant.unsubscribe.acceptInviteError(inviteAcceptErrorCb)
394
+ eventHelper.tenant.unsubscribe.acceptInviteError(inviteAcceptErrorCb),
354
395
  );
355
- const rejectInviteCb = (payload: { tenant: string }) => {
356
- rejectInvite(payload.tenant, token);
357
- }
396
+ const rejectInviteCb = (payload: { tenant: string; leave: boolean }) => {
397
+ rejectInvite(payload.tenant, token, payload.leave);
398
+ };
358
399
  eventHelper.tenant.subscribe.rejectInvite(rejectInviteCb);
359
400
  this.unsubscribeFunctions.push(() =>
360
- eventHelper.tenant.unsubscribe.rejectInvite(rejectInviteCb)
401
+ eventHelper.tenant.unsubscribe.rejectInvite(rejectInviteCb),
361
402
  );
362
- const inviteRejectedCb = (payload: { user: string; tenant: string }) => {
363
- }
403
+ const inviteRejectedCb = (payload: { user: string; tenant: string }) => {};
364
404
  eventHelper.tenant.subscribe.inviteRejected(inviteRejectedCb);
365
405
  this.unsubscribeFunctions.push(() =>
366
- eventHelper.tenant.unsubscribe.inviteRejected(inviteRejectedCb)
406
+ eventHelper.tenant.unsubscribe.inviteRejected(inviteRejectedCb),
367
407
  );
368
- const inviteRejectErrorCb = (payload: { tenant: string }) => {
369
- }
408
+ const inviteRejectErrorCb = (payload: { tenant: string }) => {};
370
409
  eventHelper.tenant.subscribe.inviteRejectError(inviteRejectErrorCb);
371
410
  this.unsubscribeFunctions.push(() =>
372
- eventHelper.tenant.unsubscribe.inviteRejectError(inviteRejectErrorCb)
411
+ eventHelper.tenant.unsubscribe.inviteRejectError(inviteRejectErrorCb),
373
412
  );
374
413
  const getPlanProvidersCb = () => {
375
414
  getPlanProviders(token);
376
- }
415
+ };
377
416
  eventHelper.planProviders.subscribe.loadPlans(getPlanProvidersCb);
378
417
  this.unsubscribeFunctions.push(() =>
379
- eventHelper.planProviders.unsubscribe.loadPlans(getPlanProvidersCb)
380
- );
381
- const crateTokenCb = (payload: { tenant: string; expiration: string; description: string }) => {
382
- createToken(payload.tenant, payload.description, payload.expiration, token);
383
-
384
- }
418
+ eventHelper.planProviders.unsubscribe.loadPlans(getPlanProvidersCb),
419
+ );
420
+ const crateTokenCb = (payload: {
421
+ tenant: string;
422
+ expiration: string;
423
+ description: string;
424
+ }) => {
425
+ createToken(
426
+ payload.tenant,
427
+ payload.description,
428
+ payload.expiration,
429
+ token,
430
+ );
431
+ };
385
432
  eventHelper.tenant.subscribe.createToken(crateTokenCb);
386
433
  this.unsubscribeFunctions.push(() =>
387
- eventHelper.tenant.unsubscribe.createToken(crateTokenCb)
434
+ eventHelper.tenant.unsubscribe.createToken(crateTokenCb),
388
435
  );
389
436
  const deleteTokenCb = (payload: { tenant: string; token: string }) => {
390
437
  deleteToken(payload.tenant, payload.token, token);
391
- }
438
+ };
392
439
  eventHelper.tenant.subscribe.deleteToken(deleteTokenCb);
393
440
  this.unsubscribeFunctions.push(() =>
394
- eventHelper.tenant.unsubscribe.deleteToken(deleteTokenCb)
441
+ eventHelper.tenant.unsubscribe.deleteToken(deleteTokenCb),
395
442
  );
396
443
  }
397
444
  /**
@@ -403,21 +450,19 @@ export class BackendHandler {
403
450
  };
404
451
  eventHelper.user.subscribe.creation(creationCb);
405
452
  this.unsubscribeFunctions.push(() =>
406
- eventHelper.user.unsubscribe.creation(creationCb)
453
+ eventHelper.user.unsubscribe.creation(creationCb),
407
454
  );
408
455
 
409
- const createdCb = (data: UserData) => {
410
- };
456
+ const createdCb = (data: UserData) => {};
411
457
  eventHelper.user.subscribe.created(createdCb);
412
458
  this.unsubscribeFunctions.push(() =>
413
- eventHelper.user.unsubscribe.created(createdCb)
459
+ eventHelper.user.unsubscribe.created(createdCb),
414
460
  );
415
461
 
416
- const creationErrorCb = (data: UserData) => {
417
- };
462
+ const creationErrorCb = (data: UserData) => {};
418
463
  eventHelper.user.subscribe.creationError(creationErrorCb);
419
464
  this.unsubscribeFunctions.push(() =>
420
- eventHelper.user.unsubscribe.creationError(creationErrorCb)
465
+ eventHelper.user.unsubscribe.creationError(creationErrorCb),
421
466
  );
422
467
 
423
468
  const updateCb = (data: UserData) => {
@@ -425,21 +470,19 @@ export class BackendHandler {
425
470
  };
426
471
  eventHelper.user.subscribe.update(updateCb);
427
472
  this.unsubscribeFunctions.push(() =>
428
- eventHelper.user.unsubscribe.update(updateCb)
473
+ eventHelper.user.unsubscribe.update(updateCb),
429
474
  );
430
475
 
431
- const updatedCb = (data: UserData) => {
432
- };
476
+ const updatedCb = (data: UserData) => {};
433
477
  eventHelper.user.subscribe.updated(updatedCb);
434
478
  this.unsubscribeFunctions.push(() =>
435
- eventHelper.user.unsubscribe.updated(updatedCb)
479
+ eventHelper.user.unsubscribe.updated(updatedCb),
436
480
  );
437
481
 
438
- const updateErrorCb = (data: UserData) => {
439
- };
482
+ const updateErrorCb = (data: UserData) => {};
440
483
  eventHelper.user.subscribe.updateError(updateErrorCb);
441
484
  this.unsubscribeFunctions.push(() =>
442
- eventHelper.user.unsubscribe.updateError(updateErrorCb)
485
+ eventHelper.user.unsubscribe.updateError(updateErrorCb),
443
486
  );
444
487
 
445
488
  const loadCb = (data: UserData) => {
@@ -447,7 +490,7 @@ export class BackendHandler {
447
490
  };
448
491
  eventHelper.user.subscribe.load(loadCb);
449
492
  this.unsubscribeFunctions.push(() =>
450
- eventHelper.user.unsubscribe.load(loadCb)
493
+ eventHelper.user.unsubscribe.load(loadCb),
451
494
  );
452
495
 
453
496
  // const loadedCb = (data: UserData) => {
@@ -458,11 +501,10 @@ export class BackendHandler {
458
501
  // eventHelper.user.unsubscribe.loaded(loadedCb)
459
502
  // );
460
503
 
461
- const loadErrorCb = (data: UserData) => {
462
- };
504
+ const loadErrorCb = (data: UserData) => {};
463
505
  eventHelper.user.subscribe.loadError(loadErrorCb);
464
506
  this.unsubscribeFunctions.push(() =>
465
- eventHelper.user.unsubscribe.loadError(loadErrorCb)
507
+ eventHelper.user.unsubscribe.loadError(loadErrorCb),
466
508
  );
467
509
 
468
510
  const deleteCb = (data: UserData) => {
@@ -470,21 +512,19 @@ export class BackendHandler {
470
512
  };
471
513
  eventHelper.user.subscribe.delete(deleteCb);
472
514
  this.unsubscribeFunctions.push(() =>
473
- eventHelper.user.unsubscribe.delete(deleteCb)
515
+ eventHelper.user.unsubscribe.delete(deleteCb),
474
516
  );
475
517
 
476
- const deletedCb = (data: UserData) => {
477
- };
518
+ const deletedCb = (data: UserData) => {};
478
519
  eventHelper.user.subscribe.deleted(deletedCb);
479
520
  this.unsubscribeFunctions.push(() =>
480
- eventHelper.user.unsubscribe.deleted(deletedCb)
521
+ eventHelper.user.unsubscribe.deleted(deletedCb),
481
522
  );
482
523
 
483
- const deletionErrorCb = (data: UserData) => {
484
- };
524
+ const deletionErrorCb = (data: UserData) => {};
485
525
  eventHelper.user.subscribe.deletionError(deletionErrorCb);
486
526
  this.unsubscribeFunctions.push(() =>
487
- eventHelper.user.unsubscribe.deletionError(deletionErrorCb)
527
+ eventHelper.user.unsubscribe.deletionError(deletionErrorCb),
488
528
  );
489
529
  }
490
530
  /**
@@ -496,21 +536,19 @@ export class BackendHandler {
496
536
  };
497
537
  eventHelper.account.subscribe.creation(creationCb);
498
538
  this.unsubscribeFunctions.push(() =>
499
- eventHelper.account.unsubscribe.creation(creationCb)
539
+ eventHelper.account.unsubscribe.creation(creationCb),
500
540
  );
501
541
 
502
- const createdCb = (data: Account) => {
503
- };
542
+ const createdCb = (data: Account) => {};
504
543
  eventHelper.account.subscribe.created(createdCb);
505
544
  this.unsubscribeFunctions.push(() =>
506
- eventHelper.account.unsubscribe.created(createdCb)
545
+ eventHelper.account.unsubscribe.created(createdCb),
507
546
  );
508
547
 
509
- const creationErrorCb = (data: Account) => {
510
- };
548
+ const creationErrorCb = (data: Account) => {};
511
549
  eventHelper.account.subscribe.creationError(creationErrorCb);
512
550
  this.unsubscribeFunctions.push(() =>
513
- eventHelper.account.unsubscribe.creationError(creationErrorCb)
551
+ eventHelper.account.unsubscribe.creationError(creationErrorCb),
514
552
  );
515
553
 
516
554
  const updateCb = (data: Account) => {
@@ -518,21 +556,19 @@ export class BackendHandler {
518
556
  };
519
557
  eventHelper.account.subscribe.update(updateCb);
520
558
  this.unsubscribeFunctions.push(() =>
521
- eventHelper.account.unsubscribe.update(updateCb)
559
+ eventHelper.account.unsubscribe.update(updateCb),
522
560
  );
523
561
 
524
- const updatedCb = (data: Account) => {
525
- };
562
+ const updatedCb = (data: Account) => {};
526
563
  eventHelper.account.subscribe.updated(updatedCb);
527
564
  this.unsubscribeFunctions.push(() =>
528
- eventHelper.account.unsubscribe.updated(updatedCb)
565
+ eventHelper.account.unsubscribe.updated(updatedCb),
529
566
  );
530
567
 
531
- const updateErrorCb = (data: Account) => {
532
- };
568
+ const updateErrorCb = (data: Account) => {};
533
569
  eventHelper.account.subscribe.updateError(updateErrorCb);
534
570
  this.unsubscribeFunctions.push(() =>
535
- eventHelper.account.unsubscribe.updateError(updateErrorCb)
571
+ eventHelper.account.unsubscribe.updateError(updateErrorCb),
536
572
  );
537
573
 
538
574
  const deleteCb = (data: Account) => {
@@ -540,39 +576,36 @@ export class BackendHandler {
540
576
  };
541
577
  eventHelper.account.subscribe.delete(deleteCb);
542
578
  this.unsubscribeFunctions.push(() =>
543
- eventHelper.account.unsubscribe.delete(deleteCb)
579
+ eventHelper.account.unsubscribe.delete(deleteCb),
544
580
  );
545
581
 
546
- const deletedCb = (data: Account) => {
547
- };
582
+ const deletedCb = (data: Account) => {};
548
583
  eventHelper.account.subscribe.deleted(deletedCb);
549
584
  this.unsubscribeFunctions.push(() =>
550
- eventHelper.account.unsubscribe.deleted(deletedCb)
585
+ eventHelper.account.unsubscribe.deleted(deletedCb),
551
586
  );
552
587
 
553
- const deletionErrorCb = (data: Account) => {
554
- };
588
+ const deletionErrorCb = (data: Account) => {};
555
589
  eventHelper.account.subscribe.deletionError(deletionErrorCb);
556
590
  this.unsubscribeFunctions.push(() =>
557
- eventHelper.account.unsubscribe.deletionError(deletionErrorCb)
591
+ eventHelper.account.unsubscribe.deletionError(deletionErrorCb),
558
592
  );
559
593
  const cleanCb = (data: Account) => {
560
594
  clearAccount(data, token);
561
595
  };
562
596
  eventHelper.account.subscribe.clean(cleanCb);
563
597
  this.unsubscribeFunctions.push(() =>
564
- eventHelper.account.unsubscribe.clean(cleanCb)
598
+ eventHelper.account.unsubscribe.clean(cleanCb),
565
599
  );
566
600
  }
567
601
  /**
568
602
  * Function to subscribe to the plan events
569
603
  */
570
604
  private subscribePlanEvents(): void {
571
- const updateCb = (data: string) => {
572
- };
605
+ const updateCb = (data: string) => {};
573
606
  eventHelper.plan.subscribe.upgrade(updateCb);
574
607
  this.unsubscribeFunctions.push(() =>
575
- eventHelper.plan.unsubscribe.upgrade(updateCb)
608
+ eventHelper.plan.unsubscribe.upgrade(updateCb),
576
609
  );
577
610
 
578
611
  const updatedCb = (data: string) => {
@@ -581,30 +614,28 @@ export class BackendHandler {
581
614
  subtype: "plan-upgrade",
582
615
  date: Date.now().toString(),
583
616
  status: "unread",
584
- callToAction: false,
617
+ notificationType: "regular",
585
618
  data: {
586
- plan: data
587
- }
619
+ plan: data,
620
+ },
588
621
  };
589
622
  eventHelper.notification.publish.creation(upgradeNotification);
590
623
  };
591
624
  eventHelper.plan.subscribe.upgraded(updatedCb);
592
625
  this.unsubscribeFunctions.push(() =>
593
- eventHelper.plan.unsubscribe.upgraded(updatedCb)
626
+ eventHelper.plan.unsubscribe.upgraded(updatedCb),
594
627
  );
595
628
 
596
- const updateErrorCb = (data: string) => {
597
- };
629
+ const updateErrorCb = (data: string) => {};
598
630
  eventHelper.plan.subscribe.upgradeError(updateErrorCb);
599
631
  this.unsubscribeFunctions.push(() =>
600
- eventHelper.plan.unsubscribe.upgradeError(updateErrorCb)
632
+ eventHelper.plan.unsubscribe.upgradeError(updateErrorCb),
601
633
  );
602
634
 
603
- const downgradeCb = (data: string) => {
604
- };
635
+ const downgradeCb = (data: string) => {};
605
636
  eventHelper.plan.subscribe.downgrade(downgradeCb);
606
637
  this.unsubscribeFunctions.push(() =>
607
- eventHelper.plan.unsubscribe.downgrade(downgradeCb)
638
+ eventHelper.plan.unsubscribe.downgrade(downgradeCb),
608
639
  );
609
640
 
610
641
  const downgradedCb = (data: string) => {
@@ -613,23 +644,22 @@ export class BackendHandler {
613
644
  subtype: "plan-downgrade",
614
645
  date: Date.now().toString(),
615
646
  status: "unread",
616
- callToAction: false,
647
+ notificationType: "regular",
617
648
  data: {
618
- plan: data
619
- }
649
+ plan: data,
650
+ },
620
651
  };
621
652
  eventHelper.notification.publish.creation(downgradeNotification);
622
653
  };
623
654
  eventHelper.plan.subscribe.downgraded(downgradedCb);
624
655
  this.unsubscribeFunctions.push(() =>
625
- eventHelper.plan.unsubscribe.downgraded(downgradedCb)
656
+ eventHelper.plan.unsubscribe.downgraded(downgradedCb),
626
657
  );
627
658
 
628
- const downgradeErrorCb = (data: string) => {
629
- };
659
+ const downgradeErrorCb = (data: string) => {};
630
660
  eventHelper.plan.subscribe.downgradeError(downgradeErrorCb);
631
661
  this.unsubscribeFunctions.push(() =>
632
- eventHelper.plan.unsubscribe.downgradeError(downgradeErrorCb)
662
+ eventHelper.plan.unsubscribe.downgradeError(downgradeErrorCb),
633
663
  );
634
664
  }
635
665
  /**
@@ -641,7 +671,7 @@ export class BackendHandler {
641
671
  };
642
672
  eventHelper.environment.subscribe.creation(creationCb);
643
673
  this.unsubscribeFunctions.push(() =>
644
- eventHelper.environment.unsubscribe.creation(creationCb)
674
+ eventHelper.environment.unsubscribe.creation(creationCb),
645
675
  );
646
676
 
647
677
  const createdCb = (data: Environment) => {
@@ -650,25 +680,24 @@ export class BackendHandler {
650
680
  subtype: "environment-created",
651
681
  date: Date.now().toString(),
652
682
  status: "unread",
653
- callToAction: false,
654
- data : {
683
+ notificationType: "regular",
684
+ data: {
655
685
  environment: data.name,
656
686
  account: data.account,
657
- tenant: data.tenant
658
- }
687
+ tenant: data.tenant,
688
+ },
659
689
  };
660
690
  eventHelper.notification.publish.creation(envNotification);
661
691
  };
662
692
  eventHelper.environment.subscribe.created(createdCb);
663
693
  this.unsubscribeFunctions.push(() =>
664
- eventHelper.environment.unsubscribe.created(createdCb)
694
+ eventHelper.environment.unsubscribe.created(createdCb),
665
695
  );
666
696
 
667
- const creationErrorCb = (data: Environment) => {
668
- };
697
+ const creationErrorCb = (data: Environment) => {};
669
698
  eventHelper.environment.subscribe.creationError(creationErrorCb);
670
699
  this.unsubscribeFunctions.push(() =>
671
- eventHelper.environment.unsubscribe.creationError(creationErrorCb)
700
+ eventHelper.environment.unsubscribe.creationError(creationErrorCb),
672
701
  );
673
702
 
674
703
  const updateCb = (data: Environment) => {
@@ -676,21 +705,19 @@ export class BackendHandler {
676
705
  };
677
706
  eventHelper.environment.subscribe.update(updateCb);
678
707
  this.unsubscribeFunctions.push(() =>
679
- eventHelper.environment.unsubscribe.update(updateCb)
708
+ eventHelper.environment.unsubscribe.update(updateCb),
680
709
  );
681
710
 
682
- const updatedCb = (data: Environment) => {
683
- };
711
+ const updatedCb = (data: Environment) => {};
684
712
  eventHelper.environment.subscribe.updated(updatedCb);
685
713
  this.unsubscribeFunctions.push(() =>
686
- eventHelper.environment.unsubscribe.updated(updatedCb)
714
+ eventHelper.environment.unsubscribe.updated(updatedCb),
687
715
  );
688
716
 
689
- const updateErrorCb = (data: Environment) => {
690
- };
717
+ const updateErrorCb = (data: Environment) => {};
691
718
  eventHelper.environment.subscribe.updateError(updateErrorCb);
692
719
  this.unsubscribeFunctions.push(() =>
693
- eventHelper.environment.unsubscribe.updateError(updateErrorCb)
720
+ eventHelper.environment.unsubscribe.updateError(updateErrorCb),
694
721
  );
695
722
 
696
723
  const deleteCb = (data: Environment) => {
@@ -698,37 +725,34 @@ export class BackendHandler {
698
725
  };
699
726
  eventHelper.environment.subscribe.delete(deleteCb);
700
727
  this.unsubscribeFunctions.push(() =>
701
- eventHelper.environment.unsubscribe.delete(deleteCb)
728
+ eventHelper.environment.unsubscribe.delete(deleteCb),
702
729
  );
703
730
 
704
- const deletedCb = (data: Environment) => {
705
- };
731
+ const deletedCb = (data: Environment) => {};
706
732
  eventHelper.environment.subscribe.deleted(deletedCb);
707
733
  this.unsubscribeFunctions.push(() =>
708
- eventHelper.environment.unsubscribe.deleted(deletedCb)
734
+ eventHelper.environment.unsubscribe.deleted(deletedCb),
709
735
  );
710
736
 
711
- const deletionErrorCb = (data: Environment) => {
712
- };
737
+ const deletionErrorCb = (data: Environment) => {};
713
738
  eventHelper.environment.subscribe.deletionError(deletionErrorCb);
714
739
  this.unsubscribeFunctions.push(() =>
715
- eventHelper.environment.unsubscribe.deletionError(deletionErrorCb)
740
+ eventHelper.environment.unsubscribe.deletionError(deletionErrorCb),
716
741
  );
717
742
  const cleanCb = (data: Environment) => {
718
743
  clearEnvironment(data, token);
719
744
  };
720
745
  eventHelper.environment.subscribe.clean(cleanCb);
721
746
  this.unsubscribeFunctions.push(() =>
722
- eventHelper.environment.unsubscribe.clean(cleanCb)
747
+ eventHelper.environment.unsubscribe.clean(cleanCb),
723
748
  );
724
749
  const scaleCb = (data: Environment) => {
725
- console.log('Scale called', data)
726
750
  scaleEnvironment(data, token);
727
- }
751
+ };
728
752
  eventHelper.environment.subscribe.scale(scaleCb);
729
- this.unsubscribeFunctions.push(() =>
730
- eventHelper.environment.unsubscribe.scale(scaleCb)
731
- )
753
+ this.unsubscribeFunctions.push(() =>
754
+ eventHelper.environment.unsubscribe.scale(scaleCb),
755
+ );
732
756
  }
733
757
  /**
734
758
  * Function to subscribe to the service events
@@ -740,11 +764,11 @@ export class BackendHandler {
740
764
  subtype: "deployment-success",
741
765
  date: Date.now().toString(),
742
766
  status: "unread",
743
- callToAction: false,
767
+ notificationType: "regular",
744
768
  data: {
745
769
  service: data.name,
746
- tenant: data.tenant
747
- }
770
+ tenant: data.tenant,
771
+ },
748
772
  };
749
773
  eventHelper.notification.publish.creation(deploymentSuccessNotification);
750
774
  };
@@ -756,15 +780,15 @@ export class BackendHandler {
756
780
  date: Date.now().toString(),
757
781
  status: "unread",
758
782
  info_content: {
759
- code: data.error?.code || '',
760
- message: data.error?.message || '',
761
- timestamp: data.error?.timestamp || '',
783
+ code: data.error?.code || "",
784
+ message: data.error?.message || "",
785
+ timestamp: data.error?.timestamp || "",
762
786
  },
763
- callToAction: false,
787
+ notificationType: "regular",
764
788
  data: {
765
789
  service: data.name,
766
- tenant: data.tenant
767
- }
790
+ tenant: data.tenant,
791
+ },
768
792
  };
769
793
  eventHelper.notification.publish.creation(deploymentErrorNotification);
770
794
  };
@@ -776,26 +800,29 @@ export class BackendHandler {
776
800
  subtype: "deployment-in-progress",
777
801
  date: Date.now().toString(),
778
802
  status: "unread",
779
- callToAction: false,
803
+ notificationType: "regular",
780
804
  data: {
781
805
  service: data.name,
782
- tenant: data.tenant
783
- }
806
+ tenant: data.tenant,
807
+ },
784
808
  };
785
- data.download ? '' : eventHelper.notification.publish.creation(deploymentSuccessNotification);
809
+ data.download
810
+ ? ""
811
+ : eventHelper.notification.publish.creation(
812
+ deploymentSuccessNotification,
813
+ );
786
814
  };
787
815
  eventHelper.service.subscribe.deploy(deployCb);
788
816
  this.unsubscribeFunctions.push(() =>
789
- eventHelper.service.unsubscribe.deploy(deployCb)
817
+ eventHelper.service.unsubscribe.deploy(deployCb),
790
818
  );
791
819
 
792
-
793
820
  const updateCb = (data: Service) => {
794
821
  updateService(data, token);
795
822
  };
796
823
  eventHelper.service.subscribe.update(updateCb);
797
824
  this.unsubscribeFunctions.push(() =>
798
- eventHelper.service.unsubscribe.update(updateCb)
825
+ eventHelper.service.unsubscribe.update(updateCb),
799
826
  );
800
827
 
801
828
  const updatedCb = (data: Service) => {
@@ -804,24 +831,23 @@ export class BackendHandler {
804
831
  subtype: "deployment-updated",
805
832
  date: Date.now().toString(),
806
833
  status: "unread",
807
- callToAction: false,
834
+ notificationType: "regular",
808
835
  data: {
809
836
  service: data.name,
810
- tenant: data.tenant
811
- }
837
+ tenant: data.tenant,
838
+ },
812
839
  };
813
840
  eventHelper.notification.publish.creation(deploymentNotification);
814
841
  };
815
842
  eventHelper.service.subscribe.updated(updatedCb);
816
843
  this.unsubscribeFunctions.push(() =>
817
- eventHelper.service.unsubscribe.updated(updatedCb)
844
+ eventHelper.service.unsubscribe.updated(updatedCb),
818
845
  );
819
846
 
820
- const updateErrorCb = (data: Service) => {
821
- };
847
+ const updateErrorCb = (data: Service) => {};
822
848
  eventHelper.service.subscribe.updateError(updateErrorCb);
823
849
  this.unsubscribeFunctions.push(() =>
824
- eventHelper.service.unsubscribe.updateError(updateErrorCb)
850
+ eventHelper.service.unsubscribe.updateError(updateErrorCb),
825
851
  );
826
852
 
827
853
  const deleteCb = (data: Service) => {
@@ -830,18 +856,18 @@ export class BackendHandler {
830
856
  subtype: "deployment-deleting",
831
857
  date: Date.now().toString(),
832
858
  status: "unread",
833
- callToAction: false,
859
+ notificationType: "regular",
834
860
  data: {
835
861
  service: data.name,
836
- tenant: data.tenant
837
- }
862
+ tenant: data.tenant,
863
+ },
838
864
  };
839
865
  eventHelper.notification.publish.creation(deploymentNotification);
840
866
  deleteService(data, token);
841
867
  };
842
868
  eventHelper.service.subscribe.delete(deleteCb);
843
869
  this.unsubscribeFunctions.push(() =>
844
- eventHelper.service.unsubscribe.delete(deleteCb)
870
+ eventHelper.service.unsubscribe.delete(deleteCb),
845
871
  );
846
872
 
847
873
  const deletedCb = (data: Service) => {
@@ -850,66 +876,73 @@ export class BackendHandler {
850
876
  subtype: "deployment-deleted",
851
877
  date: Date.now().toString(),
852
878
  status: "unread",
853
- callToAction: false,
879
+ notificationType: "regular",
854
880
  data: {
855
881
  service: data.name,
856
- tenant: data.tenant
857
- }
882
+ tenant: data.tenant,
883
+ },
858
884
  };
859
885
  eventHelper.notification.publish.creation(deploymentNotification);
860
886
  };
861
887
  eventHelper.service.subscribe.deleted(deletedCb);
862
888
  this.unsubscribeFunctions.push(() =>
863
- eventHelper.service.unsubscribe.deleted(deletedCb)
889
+ eventHelper.service.unsubscribe.deleted(deletedCb),
864
890
  );
865
891
 
866
- const deletionErrorCb = (data: Service) => {
867
- };
892
+ const deletionErrorCb = (data: Service) => {};
868
893
  eventHelper.service.subscribe.deletionError(deletionErrorCb);
869
894
  this.unsubscribeFunctions.push(() =>
870
- eventHelper.service.unsubscribe.deletionError(deletionErrorCb)
895
+ eventHelper.service.unsubscribe.deletionError(deletionErrorCb),
871
896
  );
872
897
 
873
- const requestLogsCb = (data: Service) => {
874
- };
898
+ const requestLogsCb = (data: Service) => {};
875
899
  eventHelper.service.subscribe.requestLogs(requestLogsCb);
876
900
  this.unsubscribeFunctions.push(() =>
877
- eventHelper.service.unsubscribe.requestLogs(requestLogsCb)
901
+ eventHelper.service.unsubscribe.requestLogs(requestLogsCb),
878
902
  );
879
903
  const restartCb = (data: Service) => {
880
904
  restartService(data, token);
881
905
  };
882
906
  eventHelper.service.subscribe.restart(restartCb);
883
907
  this.unsubscribeFunctions.push(() =>
884
- eventHelper.service.unsubscribe.restart(restartCb)
908
+ eventHelper.service.unsubscribe.restart(restartCb),
885
909
  );
886
910
  const requestRevisionCb = (data: Service) => {
887
911
  requestRevisionData(data, token);
888
- }
912
+ };
889
913
  eventHelper.service.subscribe.requestRevisionData(requestRevisionCb);
890
914
  this.unsubscribeFunctions.push(() =>
891
- eventHelper.service.unsubscribe.requestRevisionData(requestRevisionCb)
915
+ eventHelper.service.unsubscribe.requestRevisionData(requestRevisionCb),
892
916
  );
893
917
  const updateServiceLinksCb = (data: Link) => {
894
918
  updateServiceLinks(data, token);
895
- }
919
+ };
896
920
  eventHelper.service.subscribe.updateServiceLinks(updateServiceLinksCb);
897
921
  this.unsubscribeFunctions.push(() =>
898
- eventHelper.service.unsubscribe.updateServiceLinks(updateServiceLinksCb)
922
+ eventHelper.service.unsubscribe.updateServiceLinks(updateServiceLinksCb),
899
923
  );
900
924
  const changeRevisionCb = (data: Service) => {
901
925
  changeRevision(data, token);
902
- }
926
+ };
903
927
  eventHelper.service.subscribe.changeRevision(changeRevisionCb);
904
928
  this.unsubscribeFunctions.push(() => {
905
929
  eventHelper.service.unsubscribe.changeRevision(changeRevisionCb);
906
- })
907
- const restartInstanceCb = (payload: { service: Service; roleId: string; instanceId: string; }) => {
908
- restartInstance(payload.service, payload.roleId, payload.instanceId, token);
909
- }
930
+ });
931
+ const restartInstanceCb = (payload: {
932
+ service: Service;
933
+ roleId: string;
934
+ instanceId: string;
935
+ }) => {
936
+ restartInstance(
937
+ payload.service,
938
+ payload.roleId,
939
+ payload.instanceId,
940
+ token,
941
+ );
942
+ };
910
943
  eventHelper.service.subscribe.restartInstance(restartInstanceCb);
911
944
  this.unsubscribeFunctions.push(() =>
912
- eventHelper.service.unsubscribe.restartInstance(restartInstanceCb)
945
+ eventHelper.service.unsubscribe.restartInstance(restartInstanceCb),
913
946
  );
914
947
  }
915
948
  /**
@@ -921,69 +954,60 @@ export class BackendHandler {
921
954
  };
922
955
  eventHelper.marketplace.subscribe.deployItem(deployItemCb);
923
956
  this.unsubscribeFunctions.push(() =>
924
- eventHelper.marketplace.unsubscribe.deployItem(deployItemCb)
957
+ eventHelper.marketplace.unsubscribe.deployItem(deployItemCb),
925
958
  );
926
959
 
927
- const itemDeployedCb = (data: Service) => {
928
- };
960
+ const itemDeployedCb = (data: Service) => {};
929
961
  eventHelper.marketplace.subscribe.itemDeployed(itemDeployedCb);
930
962
  this.unsubscribeFunctions.push(() =>
931
- eventHelper.marketplace.unsubscribe.itemDeployed(itemDeployedCb)
963
+ eventHelper.marketplace.unsubscribe.itemDeployed(itemDeployedCb),
932
964
  );
933
965
 
934
- const deploymentErrorCb = (data: Service) => {
935
- };
966
+ const deploymentErrorCb = (data: Service) => {};
936
967
  eventHelper.marketplace.subscribe.deploymentError(deploymentErrorCb);
937
968
  this.unsubscribeFunctions.push(() =>
938
- eventHelper.marketplace.unsubscribe.deploymentError(deploymentErrorCb)
969
+ eventHelper.marketplace.unsubscribe.deploymentError(deploymentErrorCb),
939
970
  );
940
971
 
941
- const updateItemCb = (data: Service) => {
942
- };
972
+ const updateItemCb = (data: Service) => {};
943
973
  eventHelper.marketplace.subscribe.updateItem(updateItemCb);
944
974
  this.unsubscribeFunctions.push(() =>
945
- eventHelper.marketplace.unsubscribe.updateItem(updateItemCb)
975
+ eventHelper.marketplace.unsubscribe.updateItem(updateItemCb),
946
976
  );
947
977
 
948
- const itemUpdatedCb = (data: Service) => {
949
- };
978
+ const itemUpdatedCb = (data: Service) => {};
950
979
  eventHelper.marketplace.subscribe.itemUpdated(itemUpdatedCb);
951
980
  this.unsubscribeFunctions.push(() =>
952
- eventHelper.marketplace.unsubscribe.itemUpdated(itemUpdatedCb)
981
+ eventHelper.marketplace.unsubscribe.itemUpdated(itemUpdatedCb),
953
982
  );
954
983
 
955
- const updateErrorCb = (data: Service) => {
956
- };
984
+ const updateErrorCb = (data: Service) => {};
957
985
  eventHelper.marketplace.subscribe.updateError(updateErrorCb);
958
986
  this.unsubscribeFunctions.push(() =>
959
- eventHelper.marketplace.unsubscribe.updateError(updateErrorCb)
987
+ eventHelper.marketplace.unsubscribe.updateError(updateErrorCb),
960
988
  );
961
989
 
962
- const deleteItemCb = (data: Service) => {
963
- };
990
+ const deleteItemCb = (data: Service) => {};
964
991
  eventHelper.marketplace.subscribe.deleteItem(deleteItemCb);
965
992
  this.unsubscribeFunctions.push(() =>
966
- eventHelper.marketplace.unsubscribe.deleteItem(deleteItemCb)
993
+ eventHelper.marketplace.unsubscribe.deleteItem(deleteItemCb),
967
994
  );
968
995
 
969
- const itemDeletedCb = (data: Service) => {
970
- };
996
+ const itemDeletedCb = (data: Service) => {};
971
997
  eventHelper.marketplace.subscribe.itemDeleted(itemDeletedCb);
972
998
  this.unsubscribeFunctions.push(() =>
973
- eventHelper.marketplace.unsubscribe.itemDeleted(itemDeletedCb)
999
+ eventHelper.marketplace.unsubscribe.itemDeleted(itemDeletedCb),
974
1000
  );
975
1001
 
976
- const deletionErrorCb = (data: Service) => {
977
- };
1002
+ const deletionErrorCb = (data: Service) => {};
978
1003
  eventHelper.marketplace.subscribe.deletionError(deletionErrorCb);
979
1004
  this.unsubscribeFunctions.push(() =>
980
- eventHelper.marketplace.unsubscribe.deletionError(deletionErrorCb)
1005
+ eventHelper.marketplace.unsubscribe.deletionError(deletionErrorCb),
981
1006
  );
982
1007
 
983
1008
  const loadItemsCb = (data: string[]) => {
984
1009
  // getMarketplaceItems(data, token)
985
1010
  // .then((result) => {
986
-
987
1011
  // eventHelper.marketplace.publish.itemsLoaded(result.items);
988
1012
  // })
989
1013
  // .catch((err) => {
@@ -992,7 +1016,22 @@ export class BackendHandler {
992
1016
  };
993
1017
  eventHelper.marketplace.subscribe.loadItems(loadItemsCb);
994
1018
  this.unsubscribeFunctions.push(() =>
995
- eventHelper.marketplace.unsubscribe.loadItems(loadItemsCb)
1019
+ eventHelper.marketplace.unsubscribe.loadItems(loadItemsCb),
1020
+ );
1021
+ const loadSchemaCb = async (payload: string) => {
1022
+ try {
1023
+ const { item } = JSON.parse(payload) as { item: MarketplaceItem };
1024
+ await fetchAndStoreMarketplaceSchema(item);
1025
+ eventHelper.marketplace.publish.schemaLoaded(item);
1026
+ } catch (error) {
1027
+ console.error(`Error loading schema for marketplace item:`, error);
1028
+ eventHelper.marketplace.publish.schemaLoadError(payload);
1029
+ }
1030
+ };
1031
+
1032
+ eventHelper.marketplace.subscribe.loadSchema(loadSchemaCb);
1033
+ this.unsubscribeFunctions.push(() =>
1034
+ eventHelper.marketplace.unsubscribe.loadSchema(loadSchemaCb),
996
1035
  );
997
1036
  }
998
1037
  /**
@@ -1004,21 +1043,19 @@ export class BackendHandler {
1004
1043
  };
1005
1044
  eventHelper.resource.subscribe.creation(creationCb);
1006
1045
  this.unsubscribeFunctions.push(() =>
1007
- eventHelper.resource.unsubscribe.creation(creationCb)
1046
+ eventHelper.resource.unsubscribe.creation(creationCb),
1008
1047
  );
1009
1048
 
1010
- const createdCb = (data: Resource) => {
1011
- };
1049
+ const createdCb = (data: Resource) => {};
1012
1050
  eventHelper.resource.subscribe.created(createdCb);
1013
1051
  this.unsubscribeFunctions.push(() =>
1014
- eventHelper.resource.unsubscribe.created(createdCb)
1052
+ eventHelper.resource.unsubscribe.created(createdCb),
1015
1053
  );
1016
1054
 
1017
- const creationErrorCb = (data: Resource) => {
1018
- };
1055
+ const creationErrorCb = (data: Resource) => {};
1019
1056
  eventHelper.resource.subscribe.creationError(creationErrorCb);
1020
1057
  this.unsubscribeFunctions.push(() =>
1021
- eventHelper.resource.unsubscribe.creationError(creationErrorCb)
1058
+ eventHelper.resource.unsubscribe.creationError(creationErrorCb),
1022
1059
  );
1023
1060
 
1024
1061
  const updateCb = (data: Resource) => {
@@ -1026,21 +1063,19 @@ export class BackendHandler {
1026
1063
  };
1027
1064
  eventHelper.resource.subscribe.update(updateCb);
1028
1065
  this.unsubscribeFunctions.push(() =>
1029
- eventHelper.resource.unsubscribe.update(updateCb)
1066
+ eventHelper.resource.unsubscribe.update(updateCb),
1030
1067
  );
1031
1068
 
1032
- const updatedCb = (data: Resource) => {
1033
- };
1069
+ const updatedCb = (data: Resource) => {};
1034
1070
  eventHelper.resource.subscribe.updated(updatedCb);
1035
1071
  this.unsubscribeFunctions.push(() =>
1036
- eventHelper.resource.unsubscribe.updated(updatedCb)
1072
+ eventHelper.resource.unsubscribe.updated(updatedCb),
1037
1073
  );
1038
1074
 
1039
- const updateErrorCb = (data: Resource) => {
1040
- };
1075
+ const updateErrorCb = (data: Resource) => {};
1041
1076
  eventHelper.resource.subscribe.updateError(updateErrorCb);
1042
1077
  this.unsubscribeFunctions.push(() =>
1043
- eventHelper.resource.unsubscribe.updateError(updateErrorCb)
1078
+ eventHelper.resource.unsubscribe.updateError(updateErrorCb),
1044
1079
  );
1045
1080
 
1046
1081
  const deleteCb = (data: Resource) => {
@@ -1048,101 +1083,91 @@ export class BackendHandler {
1048
1083
  };
1049
1084
  eventHelper.resource.subscribe.delete(deleteCb);
1050
1085
  this.unsubscribeFunctions.push(() =>
1051
- eventHelper.resource.unsubscribe.delete(deleteCb)
1086
+ eventHelper.resource.unsubscribe.delete(deleteCb),
1052
1087
  );
1053
1088
 
1054
1089
  const deletedCb = (data: Resource) => {
1055
1090
  const resourceNotification: Notification = {
1056
- type: "success",
1057
- subtype: "resource-deleted",
1058
- date: Date.now().toString(),
1059
- status: "unread",
1060
- callToAction: false,
1061
- data: {
1062
- resource: data.name,
1063
- type: data.type,
1064
- tenant: data.tenant
1065
- }
1066
- };
1067
- eventHelper.notification.publish.creation(resourceNotification);
1091
+ type: "success",
1092
+ subtype: "resource-deleted",
1093
+ date: Date.now().toString(),
1094
+ status: "unread",
1095
+ notificationType: "regular",
1096
+ data: {
1097
+ resource: data.name,
1098
+ type: data.type,
1099
+ tenant: data.tenant,
1100
+ },
1101
+ };
1102
+ eventHelper.notification.publish.creation(resourceNotification);
1068
1103
  };
1069
1104
  eventHelper.resource.subscribe.deleted(deletedCb);
1070
1105
  this.unsubscribeFunctions.push(() =>
1071
- eventHelper.resource.unsubscribe.deleted(deletedCb)
1106
+ eventHelper.resource.unsubscribe.deleted(deletedCb),
1072
1107
  );
1073
1108
 
1074
- const deletionErrorCb = (data: Resource) => {
1075
- };
1109
+ const deletionErrorCb = (data: Resource) => {};
1076
1110
  eventHelper.resource.subscribe.deletionError(deletionErrorCb);
1077
1111
  this.unsubscribeFunctions.push(() =>
1078
- eventHelper.resource.unsubscribe.deletionError(deletionErrorCb)
1112
+ eventHelper.resource.unsubscribe.deletionError(deletionErrorCb),
1079
1113
  );
1080
1114
  }
1081
1115
  /**
1082
1116
  * Function to subscribe to the organization events
1083
1117
  */
1084
1118
  private subscribeOrganizationEvents(): void {
1085
- const creationCb = (data: Organization) => {
1086
- };
1119
+ const creationCb = (data: Organization) => {};
1087
1120
  eventHelper.organization.subscribe.creation(creationCb);
1088
1121
  this.unsubscribeFunctions.push(() =>
1089
- eventHelper.organization.unsubscribe.creation(creationCb)
1122
+ eventHelper.organization.unsubscribe.creation(creationCb),
1090
1123
  );
1091
1124
 
1092
- const createdCb = (data: Organization) => {
1093
- };
1125
+ const createdCb = (data: Organization) => {};
1094
1126
  eventHelper.organization.subscribe.created(createdCb);
1095
1127
  this.unsubscribeFunctions.push(() =>
1096
- eventHelper.organization.unsubscribe.created(createdCb)
1128
+ eventHelper.organization.unsubscribe.created(createdCb),
1097
1129
  );
1098
1130
 
1099
- const creationErrorCb = (data: Organization) => {
1100
- };
1131
+ const creationErrorCb = (data: Organization) => {};
1101
1132
  eventHelper.organization.subscribe.creationError(creationErrorCb);
1102
1133
  this.unsubscribeFunctions.push(() =>
1103
- eventHelper.organization.unsubscribe.creationError(creationErrorCb)
1134
+ eventHelper.organization.unsubscribe.creationError(creationErrorCb),
1104
1135
  );
1105
1136
 
1106
- const updateCb = (data: Organization) => {
1107
- };
1137
+ const updateCb = (data: Organization) => {};
1108
1138
  eventHelper.organization.subscribe.update(updateCb);
1109
1139
  this.unsubscribeFunctions.push(() =>
1110
- eventHelper.organization.unsubscribe.update(updateCb)
1140
+ eventHelper.organization.unsubscribe.update(updateCb),
1111
1141
  );
1112
1142
 
1113
- const updatedCb = (data: Organization) => {
1114
- };
1143
+ const updatedCb = (data: Organization) => {};
1115
1144
  eventHelper.organization.subscribe.updated(updatedCb);
1116
1145
  this.unsubscribeFunctions.push(() =>
1117
- eventHelper.organization.unsubscribe.updated(updatedCb)
1146
+ eventHelper.organization.unsubscribe.updated(updatedCb),
1118
1147
  );
1119
1148
 
1120
- const updateErrorCb = (data: Organization) => {
1121
- };
1149
+ const updateErrorCb = (data: Organization) => {};
1122
1150
  eventHelper.organization.subscribe.updateError(updateErrorCb);
1123
1151
  this.unsubscribeFunctions.push(() =>
1124
- eventHelper.organization.unsubscribe.updateError(updateErrorCb)
1152
+ eventHelper.organization.unsubscribe.updateError(updateErrorCb),
1125
1153
  );
1126
1154
 
1127
- const deleteCb = (data: Organization) => {
1128
- };
1155
+ const deleteCb = (data: Organization) => {};
1129
1156
  eventHelper.organization.subscribe.delete(deleteCb);
1130
1157
  this.unsubscribeFunctions.push(() =>
1131
- eventHelper.organization.unsubscribe.delete(deleteCb)
1158
+ eventHelper.organization.unsubscribe.delete(deleteCb),
1132
1159
  );
1133
1160
 
1134
- const deletedCb = (data: Organization) => {
1135
- };
1161
+ const deletedCb = (data: Organization) => {};
1136
1162
  eventHelper.organization.subscribe.deleted(deletedCb);
1137
1163
  this.unsubscribeFunctions.push(() =>
1138
- eventHelper.organization.unsubscribe.deleted(deletedCb)
1164
+ eventHelper.organization.unsubscribe.deleted(deletedCb),
1139
1165
  );
1140
1166
 
1141
- const deletionErrorCb = (data: Organization) => {
1142
- };
1167
+ const deletionErrorCb = (data: Organization) => {};
1143
1168
  eventHelper.organization.subscribe.deletionError(deletionErrorCb);
1144
1169
  this.unsubscribeFunctions.push(() =>
1145
- eventHelper.organization.unsubscribe.deletionError(deletionErrorCb)
1170
+ eventHelper.organization.unsubscribe.deletionError(deletionErrorCb),
1146
1171
  );
1147
1172
  }
1148
1173
  }