@code.store/arcxp-sdk-ts 5.1.3 → 5.1.6

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
@@ -2,7 +2,6 @@ import axios from 'axios';
2
2
  import * as rateLimit from 'axios-rate-limit';
3
3
  import axiosRetry from 'axios-retry';
4
4
  import * as ws from 'ws';
5
- import FormData from 'form-data';
6
5
  import encode from 'base32-encode';
7
6
  import { v5 } from 'uuid';
8
7
  import assert from 'node:assert';
@@ -67,7 +66,7 @@ class ArcAbstractAPI {
67
66
  // apply retry
68
67
  const retry = typeof axiosRetry === 'function' ? axiosRetry : axiosRetry.default;
69
68
  retry(this.client, {
70
- retries: 5,
69
+ retries: options.maxRetries || 10,
71
70
  retryDelay: axiosRetry.exponentialDelay,
72
71
  retryCondition: (err) => this.retryCondition(err),
73
72
  });
@@ -687,6 +686,7 @@ class ArcSales extends ArcAbstractAPI {
687
686
  super({ ...options, apiPath: 'sales/api/v1' });
688
687
  }
689
688
  async migrate(params, payload) {
689
+ const FormData = await platform.form_data();
690
690
  const form = new FormData();
691
691
  form.append('file', JSON.stringify(payload), { filename: 'subs.json', contentType: 'application/json' });
692
692
  const { data } = await this.client.post('/migrate', form, {
@@ -702,8 +702,26 @@ class ArcSalesV2 extends ArcAbstractAPI {
702
702
  constructor(options) {
703
703
  super({ ...options, apiPath: 'sales/api/v2' });
704
704
  }
705
- async createEnterpriseGroup(payload) {
706
- const { data } = await this.client.post('/subscriptions/enterprise', payload);
705
+ async getEnterpriseGroups(params) {
706
+ const { data } = await this.client.get('/subscriptions/enterprise', {
707
+ params: {
708
+ 'arc-site': params.site,
709
+ },
710
+ });
711
+ return data;
712
+ }
713
+ async createEnterpriseGroup(params, payload) {
714
+ const { data } = await this.client.post('/subscriptions/enterprise', payload, {
715
+ params: {
716
+ 'arc-site': params.site,
717
+ },
718
+ });
719
+ return data;
720
+ }
721
+ async createNonce(website, enterpriseGroupId) {
722
+ const { data } = await this.client.get(`/subscriptions/enterprise/${enterpriseGroupId}`, {
723
+ params: { 'arc-site': website },
724
+ });
707
725
  return data;
708
726
  }
709
727
  }