@kumori/aurora-backend-handler 1.1.23 → 1.1.25

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