rebilly-js-sdk 62.244.0 → 62.246.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.
@@ -217,13 +217,13 @@ function C({ options: t }) {
217
217
  "Rebilly",
218
218
  t.appName,
219
219
  "js-sdk"
220
- ].filter((i) => i).join("/")}@4807401` };
220
+ ].filter((i) => i).join("/")}@9dcce3e` };
221
221
  return t.apiKey && (c["REB-APIKEY"] = t.apiKey), c;
222
222
  }
223
223
  function o() {
224
224
  return S(e.defaults.headers);
225
225
  }
226
- function a(c) {
226
+ function g(c) {
227
227
  t.requestTimeout = Number(c), e.defaults.timeout = t.requestTimeout;
228
228
  }
229
229
  function $(c = t.jwt) {
@@ -234,19 +234,19 @@ function C({ options: t }) {
234
234
  const i = o();
235
235
  t.publishableKey = c, i.common.Authorization = `${c}`, e.defaults.headers = i;
236
236
  }
237
- function d({ host: c, port: i, auth: g }) {
237
+ function d({ host: c, port: i, auth: a }) {
238
238
  e.defaults.proxy = {
239
239
  host: c,
240
240
  port: i,
241
- auth: g
241
+ auth: a
242
242
  };
243
243
  }
244
244
  function T({ live: c = null, sandbox: i = null }) {
245
245
  c && (t.apiEndpoints.live = c), i && (t.apiEndpoints.sandbox = i), e.defaults.baseURL = u();
246
246
  }
247
- function M(c, { thenDelegate: i, catchDelegate: g = () => {
247
+ function M(c, { thenDelegate: i, catchDelegate: a = () => {
248
248
  } }) {
249
- return U(c) && e.interceptors[R[c]].use(i, g);
249
+ return U(c) && e.interceptors[R[c]].use(i, a);
250
250
  }
251
251
  function j(c, i) {
252
252
  return U(c) && e.interceptors[R[c]].eject(i);
@@ -271,8 +271,8 @@ function C({ options: t }) {
271
271
  function G(c) {
272
272
  j(R.response, c);
273
273
  }
274
- function b({ request: c, isCollection: i, config: g }) {
275
- const m = F(g), { id: f, cancelToken: re } = v.save();
274
+ function b({ request: c, isCollection: i, config: a }) {
275
+ const m = F(a), { id: f, cancelToken: re } = v.save();
276
276
  m.cancelToken = re;
277
277
  const z = async function() {
278
278
  try {
@@ -292,8 +292,8 @@ function C({ options: t }) {
292
292
  }();
293
293
  return z.cancel = (E) => W.cancelById(f, E), z;
294
294
  }
295
- function X({ response: c, isCollection: i, config: g }) {
296
- return i ? new ue(c, g) : new J(c, g);
295
+ function X({ response: c, isCollection: i, config: a }) {
296
+ return i ? new ue(c, a) : new J(c, a);
297
297
  }
298
298
  function O({ error: c }) {
299
299
  if (I.isCancel(c)) throw new h.RebillyCanceledError(c);
@@ -316,9 +316,9 @@ function C({ options: t }) {
316
316
  throw c.code === "ECONNABORTED" ? new h.RebillyTimeoutError(c) : new h.RebillyRequestError(c);
317
317
  }
318
318
  function Z(c) {
319
- return c.params !== void 0 && (c.params = Object.keys(c.params).filter((i) => c.params[i] !== null && (be.has(i) || c.params[i] !== "") && !(i === "sort" && c.params[i]?.length === 0)).reduce((i, g) => {
320
- const m = c.params[g];
321
- return i[g] = g === "sort" && Array.isArray(m) ? m.join(",") : m, i;
319
+ return c.params !== void 0 && (c.params = Object.keys(c.params).filter((i) => c.params[i] !== null && (be.has(i) || c.params[i] !== "") && !(i === "sort" && c.params[i]?.length === 0)).reduce((i, a) => {
320
+ const m = c.params[a];
321
+ return i[a] = a === "sort" && Array.isArray(m) ? m.join(",") : m, i;
322
322
  }, {})), c;
323
323
  }
324
324
  function F(c = {}) {
@@ -326,63 +326,63 @@ function C({ options: t }) {
326
326
  }
327
327
  function N(c, i = {}) {
328
328
  return b({
329
- request: (g) => e.get(c, g),
329
+ request: (a) => e.get(c, a),
330
330
  config: { params: i }
331
331
  });
332
332
  }
333
333
  function H(c, i) {
334
334
  return b({
335
- request: (g) => e.get(c, g),
335
+ request: (a) => e.get(c, a),
336
336
  config: { params: i },
337
337
  isCollection: !0
338
338
  });
339
339
  }
340
- function B(c, i, g = {}) {
340
+ function B(c, i, a = {}) {
341
341
  let m = {};
342
- return g.authenticate === !1 && (m = { headers: o() }, delete m.headers.common["REB-APIKEY"], delete m.headers.common.Authorization), g.params && (m.params = { ...g.params }), b({
342
+ return a.authenticate === !1 && (m = { headers: o() }, delete m.headers.common["REB-APIKEY"], delete m.headers.common.Authorization), a.params && (m.params = { ...a.params }), b({
343
343
  request: (f) => e.post(c, i, f),
344
344
  config: m
345
345
  });
346
346
  }
347
- function K(c, i, g = {}) {
347
+ function K(c, i, a = {}) {
348
348
  return b({
349
349
  request: (m) => e.put(c, i, m),
350
- config: { params: g }
350
+ config: { params: a }
351
351
  });
352
352
  }
353
353
  function ee(c, i) {
354
354
  return b({
355
- request: (g) => e.patch(c, i, g),
355
+ request: (a) => e.patch(c, i, a),
356
356
  config: {}
357
357
  });
358
358
  }
359
359
  function L(c, i = null) {
360
360
  return b({
361
- request: (g) => e.delete(c, g),
361
+ request: (a) => e.delete(c, a),
362
362
  config: i != null ? { data: i } : {}
363
363
  });
364
364
  }
365
365
  function te(c, i) {
366
366
  return L(c, i);
367
367
  }
368
- async function se(c, i, g, m = {}) {
369
- if (i === "") return B(c, g, { params: m });
368
+ async function se(c, i, a, m = {}) {
369
+ if (i === "") return B(c, a, { params: m });
370
370
  try {
371
371
  if ((await N(c)).response.status === 200) throw new h.RebillyConflictError({ message: "A resource already exists with this ID. Please use a different ID." });
372
372
  } catch (f) {
373
- if (f.name === "RebillyNotFoundError") return K(c, g, m);
373
+ if (f.name === "RebillyNotFoundError") return K(c, a, m);
374
374
  throw f;
375
375
  }
376
376
  }
377
377
  async function ne(c, i) {
378
- const g = F(i);
378
+ const a = F(i);
379
379
  try {
380
- const m = await e.get(c, g);
381
- return new le(m, g);
380
+ const m = await e.get(c, a);
381
+ return new le(m, a);
382
382
  } catch (m) {
383
383
  return O({
384
384
  error: m,
385
- config: g
385
+ config: a
386
386
  });
387
387
  }
388
388
  }
@@ -392,7 +392,7 @@ function C({ options: t }) {
392
392
  removeRequestInterceptor: Y,
393
393
  addResponseInterceptor: Q,
394
394
  removeResponseInterceptor: G,
395
- setTimeout: a,
395
+ setTimeout: g,
396
396
  setProxyAgent: d,
397
397
  setSessionToken: $,
398
398
  setPublishableKey: w,
@@ -518,7 +518,7 @@ function Ee({ apiHandler: t }) {
518
518
  function Ie({ apiHandler: t }) {
519
519
  return {
520
520
  getAll({ limit: e = null, offset: s = null, filter: n = null, q: r = null, expand: u = null, fields: l = null, sort: o = null } = {}) {
521
- const a = {
521
+ const g = {
522
522
  limit: e,
523
523
  offset: s,
524
524
  filter: n,
@@ -527,7 +527,7 @@ function Ie({ apiHandler: t }) {
527
527
  fields: l,
528
528
  sort: o
529
529
  };
530
- return t.getAll("applications", a);
530
+ return t.getAll("applications", g);
531
531
  },
532
532
  create({ data: e }) {
533
533
  return t.post("applications", e);
@@ -887,17 +887,18 @@ function Be({ apiHandler: t }) {
887
887
  }
888
888
  function Ke({ apiHandler: t }) {
889
889
  return {
890
- getAll({ limit: e = null, offset: s = null, filter: n = null, q: r = null, expand: u = null, fields: l = null, sort: o = null } = {}) {
891
- const a = {
890
+ getAll({ limit: e = null, offset: s = null, filter: n = null, q: r = null, expand: u = null, fields: l = null, sort: o = null, links: g = null } = {}) {
891
+ const $ = {
892
892
  limit: e,
893
893
  offset: s,
894
894
  filter: n,
895
895
  q: r,
896
896
  expand: u,
897
897
  fields: l,
898
- sort: o
898
+ sort: o,
899
+ links: g
899
900
  };
900
- return t.getAll("customers", a);
901
+ return t.getAll("customers", $);
901
902
  },
902
903
  create({ id: e = "", data: s, expand: n = null }) {
903
904
  const r = { expand: n };
@@ -1154,7 +1155,7 @@ function Ye({ apiHandler: t }) {
1154
1155
  return t.delete(`events/${e}/timeline/${s}`);
1155
1156
  },
1156
1157
  getRulesHistory({ eventType: e, limit: s = null, offset: n = null, filter: r = null, q: u = null, sort: l = null, fields: o = null }) {
1157
- const a = {
1158
+ const g = {
1158
1159
  limit: s,
1159
1160
  offset: n,
1160
1161
  filter: r,
@@ -1162,7 +1163,7 @@ function Ye({ apiHandler: t }) {
1162
1163
  sort: l,
1163
1164
  fields: o
1164
1165
  };
1165
- return t.getAll(`events/${e}/rules/history`, a);
1166
+ return t.getAll(`events/${e}/rules/history`, g);
1166
1167
  },
1167
1168
  getRulesVersionNumber({ eventType: e, version: s, fields: n = null }) {
1168
1169
  const r = { fields: n };
@@ -1173,7 +1174,7 @@ function Ye({ apiHandler: t }) {
1173
1174
  return t.get(`events/${e}/rules/versions/${s}`, r);
1174
1175
  },
1175
1176
  getAllDraftRulesets({ eventType: e, limit: s = null, offset: n = null, filter: r = null, q: u = null, sort: l = null, fields: o = null }) {
1176
- const a = {
1177
+ const g = {
1177
1178
  limit: s,
1178
1179
  offset: n,
1179
1180
  filter: r,
@@ -1181,7 +1182,7 @@ function Ye({ apiHandler: t }) {
1181
1182
  sort: l,
1182
1183
  fields: o
1183
1184
  };
1184
- return t.getAll(`events/${e}/rules/drafts`, a);
1185
+ return t.getAll(`events/${e}/rules/drafts`, g);
1185
1186
  },
1186
1187
  createDraftRuleset({ eventType: e, data: s }) {
1187
1188
  return t.post(`events/${e}/rules/drafts`, s);
@@ -1311,8 +1312,8 @@ function Ze({ apiHandler: t }) {
1311
1312
  n.push(l);
1312
1313
  const o = (await l).items.map(($) => this.detach({ id: $.fields.id }));
1313
1314
  n = [...n, o], await Promise.all(o);
1314
- const a = t.delete(`files/${e}`);
1315
- return n.push(a), a;
1315
+ const g = t.delete(`files/${e}`);
1316
+ return n.push(g), g;
1316
1317
  })();
1317
1318
  return u.cancel = () => {
1318
1319
  n.forEach((l) => l.cancel());
@@ -1331,11 +1332,11 @@ function Ze({ apiHandler: t }) {
1331
1332
  description: s.description,
1332
1333
  tags: s.tags,
1333
1334
  url: ""
1334
- }, a = this.update({
1335
+ }, g = this.update({
1335
1336
  id: l.fields.id,
1336
1337
  data: o
1337
1338
  });
1338
- return n.push(a), a;
1339
+ return n.push(g), g;
1339
1340
  })();
1340
1341
  return u.cancel = () => {
1341
1342
  n.forEach((l) => l.cancel());
@@ -1459,16 +1460,17 @@ function et({ apiHandler: t }) {
1459
1460
  }
1460
1461
  function tt({ apiHandler: t }) {
1461
1462
  return {
1462
- getAll({ filter: e = null, sort: s = null, limit: n = null, offset: r = null, q: u = null, expand: l = null } = {}) {
1463
- const o = {
1463
+ getAll({ filter: e = null, sort: s = null, limit: n = null, offset: r = null, q: u = null, expand: l = null, links: o = null } = {}) {
1464
+ const g = {
1464
1465
  filter: e,
1465
1466
  sort: s,
1466
1467
  limit: n,
1467
1468
  offset: r,
1468
1469
  q: u,
1469
- expand: l
1470
+ expand: l,
1471
+ links: o
1470
1472
  };
1471
- return t.getAll("invoices", o);
1473
+ return t.getAll("invoices", g);
1472
1474
  },
1473
1475
  create({ id: e = "", data: s }) {
1474
1476
  return t.create(`invoices/${e}`, e, s);
@@ -1628,15 +1630,16 @@ function rt({ apiHandler: t }) {
1628
1630
  }
1629
1631
  function ut({ apiHandler: t }) {
1630
1632
  return {
1631
- getAll({ limit: e = null, offset: s = null, filter: n = null, sort: r = null, expand: u = null } = {}) {
1632
- const l = {
1633
+ getAll({ limit: e = null, offset: s = null, filter: n = null, sort: r = null, expand: u = null, links: l = null } = {}) {
1634
+ const o = {
1633
1635
  limit: e,
1634
1636
  offset: s,
1635
1637
  filter: n,
1636
1638
  sort: r,
1637
- expand: u
1639
+ expand: u,
1640
+ links: l
1638
1641
  };
1639
- return t.getAll("kyc-documents", l);
1642
+ return t.getAll("kyc-documents", o);
1640
1643
  },
1641
1644
  create({ id: e = "", data: s }) {
1642
1645
  return t.create(`kyc-documents/${e}`, e, s);
@@ -1835,16 +1838,17 @@ function mt({ apiHandler: t }) {
1835
1838
  }
1836
1839
  function $t({ apiHandler: t }) {
1837
1840
  return {
1838
- getAll({ filter: e = null, sort: s = null, limit: n = null, offset: r = null, q: u = null, expand: l = null } = {}) {
1839
- const o = {
1841
+ getAll({ filter: e = null, sort: s = null, limit: n = null, offset: r = null, q: u = null, expand: l = null, links: o = null } = {}) {
1842
+ const g = {
1840
1843
  filter: e,
1841
1844
  sort: s,
1842
1845
  limit: n,
1843
1846
  offset: r,
1844
1847
  q: u,
1845
- expand: l
1848
+ expand: l,
1849
+ links: o
1846
1850
  };
1847
- return t.getAll("orders", o);
1851
+ return t.getAll("orders", g);
1848
1852
  },
1849
1853
  create({ id: e = "", data: s, expand: n = null }) {
1850
1854
  const r = { expand: n };
@@ -2426,14 +2430,14 @@ function Vt({ apiHandler: t }) {
2426
2430
  update({ type: e, id: s, data: n }) {
2427
2431
  return t.patch(`service-credentials/${e}/${s}`, n);
2428
2432
  },
2429
- getItems({ type: e, id: s, limit: n = null, offset: r = null, filter: u = null, q: l = null, fields: o = null, sort: a = null }) {
2433
+ getItems({ type: e, id: s, limit: n = null, offset: r = null, filter: u = null, q: l = null, fields: o = null, sort: g = null }) {
2430
2434
  const $ = {
2431
2435
  limit: n,
2432
2436
  offset: r,
2433
2437
  filter: u,
2434
2438
  q: l,
2435
2439
  fields: o,
2436
- sort: a
2440
+ sort: g
2437
2441
  };
2438
2442
  return t.getAll(`service-credentials/${e}/${s}/items`, $);
2439
2443
  }
@@ -2541,16 +2545,17 @@ function Yt({ apiHandler: t }) {
2541
2545
  }
2542
2546
  function Qt({ apiHandler: t }) {
2543
2547
  return {
2544
- getAll({ filter: e = null, sort: s = null, limit: n = null, offset: r = null, q: u = null, expand: l = null } = {}) {
2545
- const o = {
2548
+ getAll({ filter: e = null, sort: s = null, limit: n = null, offset: r = null, q: u = null, expand: l = null, links: o = null } = {}) {
2549
+ const g = {
2546
2550
  filter: e,
2547
2551
  sort: s,
2548
2552
  limit: n,
2549
2553
  offset: r,
2550
2554
  q: u,
2551
- expand: l
2555
+ expand: l,
2556
+ links: o
2552
2557
  };
2553
- return t.getAll("subscriptions", o);
2558
+ return t.getAll("subscriptions", g);
2554
2559
  },
2555
2560
  create({ id: e = "", data: s, expand: n = null }) {
2556
2561
  const r = { expand: n };
@@ -2761,7 +2766,7 @@ function Zt({ apiHandler: t }) {
2761
2766
  }
2762
2767
  function Ht({ apiHandler: t }) {
2763
2768
  return {
2764
- getAll({ limit: e = null, offset: s = null, filter: n = null, q: r = null, sort: u = null, expand: l = null, fields: o = null, links: a = null } = {}) {
2769
+ getAll({ limit: e = null, offset: s = null, filter: n = null, q: r = null, sort: u = null, expand: l = null, fields: o = null, links: g = null } = {}) {
2765
2770
  const $ = {
2766
2771
  limit: e,
2767
2772
  offset: s,
@@ -2770,7 +2775,7 @@ function Ht({ apiHandler: t }) {
2770
2775
  sort: u,
2771
2776
  expand: l,
2772
2777
  fields: o,
2773
- links: a
2778
+ links: g
2774
2779
  };
2775
2780
  return t.getAll("transactions", $);
2776
2781
  },
@@ -2946,7 +2951,7 @@ function ls({ apiHandler: t }) {
2946
2951
  function os({ apiHandler: t }) {
2947
2952
  return {
2948
2953
  getAll({ limit: e = null, offset: s = null, sort: n = null, expand: r = null, filter: u = null, q: l = null, criteria: o = null } = {}) {
2949
- const a = {
2954
+ const g = {
2950
2955
  limit: e,
2951
2956
  offset: s,
2952
2957
  sort: n,
@@ -2955,7 +2960,7 @@ function os({ apiHandler: t }) {
2955
2960
  q: l,
2956
2961
  criteria: o
2957
2962
  };
2958
- return t.getAll("data-exports", a);
2963
+ return t.getAll("data-exports", g);
2959
2964
  },
2960
2965
  queue({ id: e = "", data: s, expand: n = null }) {
2961
2966
  const r = { expand: n };
@@ -3127,7 +3132,7 @@ function is({ apiHandler: t }) {
3127
3132
  };
3128
3133
  return t.get("reports/future-renewals", u);
3129
3134
  },
3130
- getJournal({ currency: e = null, bookedFrom: s = null, bookedTo: n = null, recognizedAt: r = null, aggregationField: u = null, limit: l = null, offset: o = null, filter: a = null }) {
3135
+ getJournal({ currency: e = null, bookedFrom: s = null, bookedTo: n = null, recognizedAt: r = null, aggregationField: u = null, limit: l = null, offset: o = null, filter: g = null }) {
3131
3136
  const $ = {
3132
3137
  currency: e,
3133
3138
  bookedFrom: s,
@@ -3136,7 +3141,7 @@ function is({ apiHandler: t }) {
3136
3141
  aggregationField: u,
3137
3142
  limit: l,
3138
3143
  offset: o,
3139
- filter: a
3144
+ filter: g
3140
3145
  };
3141
3146
  return t.get("reports/journal", $);
3142
3147
  },
@@ -3201,7 +3206,7 @@ function is({ apiHandler: t }) {
3201
3206
  };
3202
3207
  return t.get("reports/renewal-sales", u);
3203
3208
  },
3204
- getRetentionPercentage({ aggregationField: e = null, aggregationPeriod: s = null, includeSwitchedSubscriptions: n = null, periodStart: r = null, periodEnd: u = null, limit: l = null, offset: o = null, filter: a = null, criteria: $ = null }) {
3209
+ getRetentionPercentage({ aggregationField: e = null, aggregationPeriod: s = null, includeSwitchedSubscriptions: n = null, periodStart: r = null, periodEnd: u = null, limit: l = null, offset: o = null, filter: g = null, criteria: $ = null }) {
3205
3210
  const w = {
3206
3211
  aggregationField: e,
3207
3212
  aggregationPeriod: s,
@@ -3210,12 +3215,12 @@ function is({ apiHandler: t }) {
3210
3215
  periodEnd: u,
3211
3216
  limit: l,
3212
3217
  offset: o,
3213
- filter: a,
3218
+ filter: g,
3214
3219
  criteria: $
3215
3220
  };
3216
3221
  return t.get("reports/retention-percentage", w);
3217
3222
  },
3218
- getRetentionValue({ aggregationField: e = null, aggregationPeriod: s = null, includeRefunds: n = null, includeDisputes: r = null, periodStart: u = null, periodEnd: l = null, limit: o = null, offset: a = null, filter: $ = null, sort: w = null, criteria: d = null }) {
3223
+ getRetentionValue({ aggregationField: e = null, aggregationPeriod: s = null, includeRefunds: n = null, includeDisputes: r = null, periodStart: u = null, periodEnd: l = null, limit: o = null, offset: g = null, filter: $ = null, sort: w = null, criteria: d = null }) {
3219
3224
  const T = {
3220
3225
  aggregationField: e,
3221
3226
  aggregationPeriod: s,
@@ -3224,7 +3229,7 @@ function is({ apiHandler: t }) {
3224
3229
  periodStart: u,
3225
3230
  periodEnd: l,
3226
3231
  limit: o,
3227
- offset: a,
3232
+ offset: g,
3228
3233
  filter: $,
3229
3234
  sort: w,
3230
3235
  criteria: d
@@ -3817,8 +3822,8 @@ function Gs({ publishableKey: t = null, jwt: e = null, sandbox: s = !1, timeout:
3817
3822
  requestTimeout: n,
3818
3823
  organizationId: r,
3819
3824
  appName: l?.appName ?? null
3820
- }, a = C({ options: o });
3821
- return a.setSessionToken(o.jwt), Us({ apiHandler: a });
3825
+ }, g = C({ options: o });
3826
+ return g.setSessionToken(o.jwt), Us({ apiHandler: g });
3822
3827
  }
3823
3828
  export {
3824
3829
  Ys as RebillyAPI,