@code.store/arcxp-sdk-ts 5.3.2 → 5.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -419,9 +419,22 @@ class ArcIFX extends ArcAbstractAPI {
419
419
  constructor(options) {
420
420
  super({ ...options, apiPath: 'ifx/api/v1' });
421
421
  }
422
+ // ---------------------------------------------------------------------------
423
+ // Integrations
424
+ // ---------------------------------------------------------------------------
422
425
  async createIntegration(payload) {
423
426
  await this.client.post('/admin/integration', payload);
424
427
  }
428
+ async getIntegration(integrationName) {
429
+ const { data } = await this.client.get(`/admin/integration/${integrationName}`);
430
+ return data;
431
+ }
432
+ async getIntegrations(page = 1, pageSize = 50) {
433
+ const { data } = await this.client.get('/admin/integration', {
434
+ params: { page, pageSize },
435
+ });
436
+ return data;
437
+ }
425
438
  async updateIntegration(integrationName, payload) {
426
439
  await this.client.put(`/admin/integration/${integrationName}`, payload);
427
440
  }
@@ -429,29 +442,45 @@ class ArcIFX extends ArcAbstractAPI {
429
442
  await this.client.delete(`/admin/integration/${integrationName}`, { params: { token } });
430
443
  }
431
444
  async generateDeleteIntegrationToken(integrationName) {
432
- const response = await this.client.get(`/admin/integration/${integrationName}/token`);
433
- return response.data;
445
+ const { data } = await this.client.get(`/admin/integration/${integrationName}/token`);
446
+ return data;
434
447
  }
435
- async getIntegrations() {
436
- const { data } = await this.client.get('/admin/integrations');
448
+ // ---------------------------------------------------------------------------
449
+ // Bundles
450
+ // ---------------------------------------------------------------------------
451
+ async getBundles(integrationName) {
452
+ const { data } = await this.client.get(`/admin/bundles/${integrationName}`);
437
453
  return data;
438
454
  }
439
- async getJobs(integrationName) {
440
- const { data } = await this.client.get(`/admin/jobs/status/${integrationName}`);
455
+ async uploadBundle(integrationName, name, bundlePath) {
456
+ const fs = await platform.fs();
457
+ const FormData = await platform.form_data();
458
+ const form = new FormData();
459
+ const bundle = fs.createReadStream(bundlePath);
460
+ form.append('bundle', bundle);
461
+ form.append('name', name);
462
+ const { data } = await this.client.post(`/admin/bundles/${integrationName}`, form, {
463
+ headers: form.getHeaders(),
464
+ });
441
465
  return data;
442
466
  }
443
- async getStatus(integrationName) {
444
- const { data } = await this.client.get(`/admin/integration/${integrationName}/provisionStatus`);
467
+ async deployBundle(integrationName, bundleName) {
468
+ const { data } = await this.client.post(`/admin/bundles/${integrationName}/deploy/${bundleName}`);
445
469
  return data;
446
470
  }
447
- async initializeQuery(integrationName, query) {
448
- const { data } = await this.client.get(`/admin/logs/integration/${integrationName}?${query}`);
471
+ async downloadBundle(integrationName, bundleName) {
472
+ const { data } = await this.client.get(`/admin/bundles/${integrationName}/download/${bundleName}`, {
473
+ responseType: 'arraybuffer',
474
+ });
449
475
  return data;
450
476
  }
451
- async getLogs(queryId, raw = true) {
452
- const { data } = await this.client.get('/admin/logs/results', { params: { queryId, raw } });
477
+ async promoteBundle(integrationName, version) {
478
+ const { data } = await this.client.post(`/admin/bundles/${integrationName}/promote/${version}`);
453
479
  return data;
454
480
  }
481
+ // ---------------------------------------------------------------------------
482
+ // Event Subscriptions
483
+ // ---------------------------------------------------------------------------
455
484
  async subscribe(payload) {
456
485
  const { data } = await this.client.post('/admin/events/subscriptions', payload);
457
486
  return data;
@@ -464,6 +493,69 @@ class ArcIFX extends ArcAbstractAPI {
464
493
  const { data } = await this.client.get('/admin/events/subscriptions');
465
494
  return data;
466
495
  }
496
+ // ---------------------------------------------------------------------------
497
+ // Events
498
+ // ---------------------------------------------------------------------------
499
+ async getEventPayload(integrationName, invocationId) {
500
+ const { data } = await this.client.get(`/eventdata/${integrationName}/${invocationId}`);
501
+ return data;
502
+ }
503
+ async getEventHistory(integrationName, params) {
504
+ const { data } = await this.client.get(`/admin/events/${integrationName}/history`, { params });
505
+ return data;
506
+ }
507
+ // ---------------------------------------------------------------------------
508
+ // Custom Events
509
+ // ---------------------------------------------------------------------------
510
+ async getCustomEvents(page = 1, pageSize = 50) {
511
+ const { data } = await this.client.get('/admin/events/custom', {
512
+ params: { page, pageSize },
513
+ });
514
+ return data;
515
+ }
516
+ async createCustomEvent(payload) {
517
+ const { data } = await this.client.post('/admin/events/custom', payload);
518
+ return data;
519
+ }
520
+ async updateCustomEvent(eventName, payload) {
521
+ const { data } = await this.client.put(`/admin/events/custom/${eventName}`, payload);
522
+ return data;
523
+ }
524
+ async deleteCustomEvent(eventName) {
525
+ const { data } = await this.client.delete(`/admin/events/custom/${eventName}`);
526
+ return data;
527
+ }
528
+ async deleteCustomEventSchedule(eventName) {
529
+ const { data } = await this.client.delete(`/admin/events/custom/${eventName}/schedule`);
530
+ return data;
531
+ }
532
+ // ---------------------------------------------------------------------------
533
+ // Webhooks
534
+ // ---------------------------------------------------------------------------
535
+ async getWebhooks(page = 1, pageSize = 50) {
536
+ const { data } = await this.client.get('/admin/events/custom/webhooks', {
537
+ params: { page, pageSize },
538
+ });
539
+ return data;
540
+ }
541
+ async createWebhook(eventName, payload) {
542
+ const { data } = await this.client.post(`/admin/events/custom/${eventName}/webhooks`, payload ?? {});
543
+ return data;
544
+ }
545
+ async updateWebhook(eventName, payload) {
546
+ const { data } = await this.client.put(`/admin/events/custom/${eventName}/webhooks`, payload);
547
+ return data;
548
+ }
549
+ async deleteWebhook(eventName) {
550
+ const { data } = await this.client.delete(`/admin/events/custom/${eventName}/webhooks`);
551
+ return data;
552
+ }
553
+ async triggerWebhook(uuid, payload) {
554
+ await this.client.post(`/webhook/${uuid}`, payload);
555
+ }
556
+ // ---------------------------------------------------------------------------
557
+ // Secrets
558
+ // ---------------------------------------------------------------------------
467
559
  async addSecret(payload) {
468
560
  const { data } = await this.client.post(`/admin/secret?integrationName=${payload.integrationName}`, {
469
561
  secretName: payload.secretName,
@@ -471,34 +563,40 @@ class ArcIFX extends ArcAbstractAPI {
471
563
  });
472
564
  return data;
473
565
  }
566
+ async updateSecret(payload) {
567
+ const { data } = await this.client.put(`/admin/secret?integrationName=${payload.integrationName}`, {
568
+ secretName: payload.secretName,
569
+ secretValue: payload.secretValue,
570
+ });
571
+ return data;
572
+ }
474
573
  async getSecrets(integrationName) {
475
- const { data } = await this.client.get(`/admin/secret?integrationName=${integrationName}`);
574
+ const { data } = await this.client.get(`/admin/secret`, { params: { integrationName } });
476
575
  return data;
477
576
  }
478
- async getBundles(integrationName) {
479
- const { data } = await this.client.get(`/admin/bundles/${integrationName}`);
577
+ // ---------------------------------------------------------------------------
578
+ // Logs
579
+ // ---------------------------------------------------------------------------
580
+ async initializeLogQuery(integrationName, params) {
581
+ const { data } = await this.client.get(`/admin/logs/integration/${integrationName}`, { params });
480
582
  return data;
481
583
  }
482
- async uploadBundle(integrationName, name, bundlePath) {
483
- const fs = await platform.fs();
484
- const FormData = await platform.form_data();
485
- const form = new FormData();
486
- console.log('platform', platform);
487
- console.log(form);
488
- const bundle = fs.createReadStream(bundlePath);
489
- form.append('bundle', bundle);
490
- form.append('name', name);
491
- const { data } = await this.client.post(`/admin/bundles/${integrationName}`, form, {
492
- headers: form.getHeaders(),
584
+ async getLogs(queryId, raw = false) {
585
+ const { data } = await this.client.get('/admin/logs/results', {
586
+ params: { queryId, raw },
493
587
  });
494
588
  return data;
495
589
  }
496
- async deployBundle(integrationName, name) {
497
- const { data } = await this.client.post(`/admin/bundles/${integrationName}/deploy/${name}`);
590
+ async cancelLogQuery(queryId) {
591
+ const { data } = await this.client.delete('/admin/logs/cancel', {
592
+ params: { queryId },
593
+ });
498
594
  return data;
499
595
  }
500
- async promoteBundle(integrationName, version) {
501
- const { data } = await this.client.post(`/admin/bundles/${integrationName}/promote/${version}`);
596
+ async getLogQueries(page, pageSize) {
597
+ const { data } = await this.client.get('/admin/logs/queries', {
598
+ params: { page, pageSize },
599
+ });
502
600
  return data;
503
601
  }
504
602
  }