@code.store/arcxp-sdk-ts 5.3.3 → 5.5.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
@@ -104,12 +104,27 @@ class ArcAuthor extends ArcAbstractAPI {
104
104
  constructor(options) {
105
105
  super({ ...options, apiPath: 'author' });
106
106
  }
107
+ async getAuthor(params) {
108
+ const { data } = await this.client.get('/v1/author-service', { params });
109
+ return data;
110
+ }
107
111
  async listAuthors(params) {
108
112
  const { data } = await this.client.get('/v2/author-service', { params });
109
113
  return data;
110
114
  }
111
- async delete(userId) {
112
- const { data } = await this.client.delete(`/v2/author-service/${userId}`);
115
+ async createAuthor(payload) {
116
+ const { data } = await this.client.post('/v2/author-service', payload);
117
+ return data;
118
+ }
119
+ async updateAuthor(id, payload) {
120
+ const { data } = await this.client.post(`/v2/author-service/${id}`, payload);
121
+ return data;
122
+ }
123
+ async deleteAuthor(id) {
124
+ await this.client.delete(`/v2/author-service/${id}`);
125
+ }
126
+ async getConfiguration() {
127
+ const { data } = await this.client.get('/v1/configuration');
113
128
  return data;
114
129
  }
115
130
  }
@@ -419,9 +434,22 @@ class ArcIFX extends ArcAbstractAPI {
419
434
  constructor(options) {
420
435
  super({ ...options, apiPath: 'ifx/api/v1' });
421
436
  }
437
+ // ---------------------------------------------------------------------------
438
+ // Integrations
439
+ // ---------------------------------------------------------------------------
422
440
  async createIntegration(payload) {
423
441
  await this.client.post('/admin/integration', payload);
424
442
  }
443
+ async getIntegration(integrationName) {
444
+ const { data } = await this.client.get(`/admin/integration/${integrationName}`);
445
+ return data;
446
+ }
447
+ async getIntegrations(page = 1, pageSize = 50) {
448
+ const { data } = await this.client.get('/admin/integration', {
449
+ params: { page, pageSize },
450
+ });
451
+ return data;
452
+ }
425
453
  async updateIntegration(integrationName, payload) {
426
454
  await this.client.put(`/admin/integration/${integrationName}`, payload);
427
455
  }
@@ -429,29 +457,45 @@ class ArcIFX extends ArcAbstractAPI {
429
457
  await this.client.delete(`/admin/integration/${integrationName}`, { params: { token } });
430
458
  }
431
459
  async generateDeleteIntegrationToken(integrationName) {
432
- const response = await this.client.get(`/admin/integration/${integrationName}/token`);
433
- return response.data;
460
+ const { data } = await this.client.get(`/admin/integration/${integrationName}/token`);
461
+ return data;
434
462
  }
435
- async getIntegrations() {
436
- const { data } = await this.client.get('/admin/integrations');
463
+ // ---------------------------------------------------------------------------
464
+ // Bundles
465
+ // ---------------------------------------------------------------------------
466
+ async getBundles(integrationName) {
467
+ const { data } = await this.client.get(`/admin/bundles/${integrationName}`);
437
468
  return data;
438
469
  }
439
- async getJobs(integrationName) {
440
- const { data } = await this.client.get(`/admin/jobs/status/${integrationName}`);
470
+ async uploadBundle(integrationName, name, bundlePath) {
471
+ const fs = await platform.fs();
472
+ const FormData = await platform.form_data();
473
+ const form = new FormData();
474
+ const bundle = fs.createReadStream(bundlePath);
475
+ form.append('bundle', bundle);
476
+ form.append('name', name);
477
+ const { data } = await this.client.post(`/admin/bundles/${integrationName}`, form, {
478
+ headers: form.getHeaders(),
479
+ });
441
480
  return data;
442
481
  }
443
- async getStatus(integrationName) {
444
- const { data } = await this.client.get(`/admin/integration/${integrationName}/provisionStatus`);
482
+ async deployBundle(integrationName, bundleName) {
483
+ const { data } = await this.client.post(`/admin/bundles/${integrationName}/deploy/${bundleName}`);
445
484
  return data;
446
485
  }
447
- async initializeQuery(integrationName, query) {
448
- const { data } = await this.client.get(`/admin/logs/integration/${integrationName}?${query}`);
486
+ async downloadBundle(integrationName, bundleName) {
487
+ const { data } = await this.client.get(`/admin/bundles/${integrationName}/download/${bundleName}`, {
488
+ responseType: 'arraybuffer',
489
+ });
449
490
  return data;
450
491
  }
451
- async getLogs(queryId, raw = true) {
452
- const { data } = await this.client.get('/admin/logs/results', { params: { queryId, raw } });
492
+ async promoteBundle(integrationName, version) {
493
+ const { data } = await this.client.post(`/admin/bundles/${integrationName}/promote/${version}`);
453
494
  return data;
454
495
  }
496
+ // ---------------------------------------------------------------------------
497
+ // Event Subscriptions
498
+ // ---------------------------------------------------------------------------
455
499
  async subscribe(payload) {
456
500
  const { data } = await this.client.post('/admin/events/subscriptions', payload);
457
501
  return data;
@@ -464,6 +508,69 @@ class ArcIFX extends ArcAbstractAPI {
464
508
  const { data } = await this.client.get('/admin/events/subscriptions');
465
509
  return data;
466
510
  }
511
+ // ---------------------------------------------------------------------------
512
+ // Events
513
+ // ---------------------------------------------------------------------------
514
+ async getEventPayload(integrationName, invocationId) {
515
+ const { data } = await this.client.get(`/eventdata/${integrationName}/${invocationId}`);
516
+ return data;
517
+ }
518
+ async getEventHistory(integrationName, params) {
519
+ const { data } = await this.client.get(`/admin/events/${integrationName}/history`, { params });
520
+ return data;
521
+ }
522
+ // ---------------------------------------------------------------------------
523
+ // Custom Events
524
+ // ---------------------------------------------------------------------------
525
+ async getCustomEvents(page = 1, pageSize = 50) {
526
+ const { data } = await this.client.get('/admin/events/custom', {
527
+ params: { page, pageSize },
528
+ });
529
+ return data;
530
+ }
531
+ async createCustomEvent(payload) {
532
+ const { data } = await this.client.post('/admin/events/custom', payload);
533
+ return data;
534
+ }
535
+ async updateCustomEvent(eventName, payload) {
536
+ const { data } = await this.client.put(`/admin/events/custom/${eventName}`, payload);
537
+ return data;
538
+ }
539
+ async deleteCustomEvent(eventName) {
540
+ const { data } = await this.client.delete(`/admin/events/custom/${eventName}`);
541
+ return data;
542
+ }
543
+ async deleteCustomEventSchedule(eventName) {
544
+ const { data } = await this.client.delete(`/admin/events/custom/${eventName}/schedule`);
545
+ return data;
546
+ }
547
+ // ---------------------------------------------------------------------------
548
+ // Webhooks
549
+ // ---------------------------------------------------------------------------
550
+ async getWebhooks(page = 1, pageSize = 50) {
551
+ const { data } = await this.client.get('/admin/events/custom/webhooks', {
552
+ params: { page, pageSize },
553
+ });
554
+ return data;
555
+ }
556
+ async createWebhook(eventName, payload) {
557
+ const { data } = await this.client.post(`/admin/events/custom/${eventName}/webhooks`, payload ?? {});
558
+ return data;
559
+ }
560
+ async updateWebhook(eventName, payload) {
561
+ const { data } = await this.client.put(`/admin/events/custom/${eventName}/webhooks`, payload);
562
+ return data;
563
+ }
564
+ async deleteWebhook(eventName) {
565
+ const { data } = await this.client.delete(`/admin/events/custom/${eventName}/webhooks`);
566
+ return data;
567
+ }
568
+ async triggerWebhook(uuid, payload) {
569
+ await this.client.post(`/webhook/${uuid}`, payload);
570
+ }
571
+ // ---------------------------------------------------------------------------
572
+ // Secrets
573
+ // ---------------------------------------------------------------------------
467
574
  async addSecret(payload) {
468
575
  const { data } = await this.client.post(`/admin/secret?integrationName=${payload.integrationName}`, {
469
576
  secretName: payload.secretName,
@@ -471,34 +578,40 @@ class ArcIFX extends ArcAbstractAPI {
471
578
  });
472
579
  return data;
473
580
  }
581
+ async updateSecret(payload) {
582
+ const { data } = await this.client.put(`/admin/secret?integrationName=${payload.integrationName}`, {
583
+ secretName: payload.secretName,
584
+ secretValue: payload.secretValue,
585
+ });
586
+ return data;
587
+ }
474
588
  async getSecrets(integrationName) {
475
- const { data } = await this.client.get(`/admin/secret?integrationName=${integrationName}`);
589
+ const { data } = await this.client.get(`/admin/secret`, { params: { integrationName } });
476
590
  return data;
477
591
  }
478
- async getBundles(integrationName) {
479
- const { data } = await this.client.get(`/admin/bundles/${integrationName}`);
592
+ // ---------------------------------------------------------------------------
593
+ // Logs
594
+ // ---------------------------------------------------------------------------
595
+ async initializeLogQuery(integrationName, params) {
596
+ const { data } = await this.client.get(`/admin/logs/integration/${integrationName}`, { params });
480
597
  return data;
481
598
  }
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(),
599
+ async getLogs(queryId, raw = false) {
600
+ const { data } = await this.client.get('/admin/logs/results', {
601
+ params: { queryId, raw },
493
602
  });
494
603
  return data;
495
604
  }
496
- async deployBundle(integrationName, name) {
497
- const { data } = await this.client.post(`/admin/bundles/${integrationName}/deploy/${name}`);
605
+ async cancelLogQuery(queryId) {
606
+ const { data } = await this.client.delete('/admin/logs/cancel', {
607
+ params: { queryId },
608
+ });
498
609
  return data;
499
610
  }
500
- async promoteBundle(integrationName, version) {
501
- const { data } = await this.client.post(`/admin/bundles/${integrationName}/promote/${version}`);
611
+ async getLogQueries(page, pageSize) {
612
+ const { data } = await this.client.get('/admin/logs/queries', {
613
+ params: { page, pageSize },
614
+ });
502
615
  return data;
503
616
  }
504
617
  }