celitech-sdk 1.1.87 → 1.1.89

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.mjs CHANGED
@@ -21,15 +21,6 @@ var RequestHandlerChain = class {
21
21
  }
22
22
  };
23
23
 
24
- // src/http/error.ts
25
- var HttpError = class extends Error {
26
- constructor(metadata, error) {
27
- super(error);
28
- this.error = metadata.statusText;
29
- this.metadata = metadata;
30
- }
31
- };
32
-
33
24
  // src/http/hooks/custom-hook.ts
34
25
  var CURRENT_TOKEN = "";
35
26
  var CURRENT_EXPIRY = -1;
@@ -195,7 +186,8 @@ var TransportHookAdapter = class {
195
186
  path: newRequest.path,
196
187
  body: newRequest.body,
197
188
  queryParams: this.hookParamsToTransportParams(newRequest.queryParams, request.queryParams, true),
198
- headers: this.hookParamsToTransportParams(newRequest.headers, request.headers, false)
189
+ headers: this.hookParamsToTransportParams(newRequest.headers, request.headers, false),
190
+ pathParams: this.hookParamsToTransportParams(newRequest.pathParams, request.headers, false)
199
191
  });
200
192
  return newTransportRequest;
201
193
  }
@@ -216,27 +208,34 @@ var TransportHookAdapter = class {
216
208
  request.queryParams.forEach((queryParam, key) => {
217
209
  hookQueryParams.set(key, queryParam.value);
218
210
  });
211
+ const hookPathParams = /* @__PURE__ */ new Map();
212
+ request.pathParams.forEach((pathParam, key) => {
213
+ hookPathParams.set(key, pathParam.value);
214
+ });
219
215
  const hookRequest = {
220
216
  baseUrl: request.baseUrl,
221
217
  method: request.method,
222
218
  path: request.path,
223
219
  headers: hookHeaders,
224
220
  body: request.body,
225
- queryParams: hookQueryParams
221
+ queryParams: hookQueryParams,
222
+ pathParams: hookPathParams
226
223
  };
227
224
  return hookRequest;
228
225
  }
229
226
  hookParamsToTransportParams(hookParams, originalTransportParams, encode) {
230
227
  const transportParams = /* @__PURE__ */ new Map();
231
228
  hookParams.forEach((hookParamValue, hookParamKey) => {
232
- var _a, _b;
229
+ var _a, _b, _c, _d;
233
230
  const requestParam = originalTransportParams.get(hookParamKey);
234
231
  transportParams.set(hookParamKey, {
235
232
  key: hookParamKey,
236
233
  value: hookParamValue,
237
234
  encode: (_a = requestParam == null ? void 0 : requestParam.encode) != null ? _a : false,
238
235
  style: (requestParam == null ? void 0 : requestParam.style) || "none" /* NONE */,
239
- explode: (_b = requestParam == null ? void 0 : requestParam.explode) != null ? _b : false
236
+ explode: (_b = requestParam == null ? void 0 : requestParam.explode) != null ? _b : false,
237
+ isLimit: (_c = requestParam == null ? void 0 : requestParam.isLimit) != null ? _c : false,
238
+ isOffset: (_d = requestParam == null ? void 0 : requestParam.isOffset) != null ? _d : false
240
239
  });
241
240
  });
242
241
  return transportParams;
@@ -259,8 +258,7 @@ var HookHandler = class {
259
258
  if (response.metadata.status < 400) {
260
259
  return await hook.afterResponse(nextRequest, response, hookParams);
261
260
  }
262
- const error = await hook.onError(nextRequest, response, hookParams);
263
- throw new HttpError(error.metadata, error.error);
261
+ throw await hook.onError(nextRequest, response, hookParams);
264
262
  }
265
263
  getHookParams(request) {
266
264
  const hookParams = /* @__PURE__ */ new Map();
@@ -393,6 +391,13 @@ var RequestValidationHandler = class {
393
391
  });
394
392
  return params.toString();
395
393
  }
394
+ if (typeof body === "object" && !Array.isArray(body)) {
395
+ const params = new URLSearchParams();
396
+ for (const [key, value] of Object.entries(body)) {
397
+ params.append(key, value.toString());
398
+ }
399
+ return params.toString();
400
+ }
396
401
  return "";
397
402
  }
398
403
  toFormData(body) {
@@ -411,95 +416,87 @@ var RequestValidationHandler = class {
411
416
  }
412
417
  };
413
418
 
414
- // src/http/transport/request-axios-adapter.ts
415
- import axios, { isAxiosError } from "axios";
416
- var RequestAxiosAdapter = class {
419
+ // src/http/transport/request-fetch-adapter.ts
420
+ var RequestFetchAdapter = class {
417
421
  constructor(request) {
418
422
  this.request = request;
419
- this.config = {
420
- responseType: "arraybuffer"
421
- };
422
- this.setHeaders();
423
- this.setTimeout();
423
+ this.requestInit = {};
424
+ this.setMethod(request.method);
425
+ this.setHeaders(request.getHeaders());
426
+ this.setBody(request.body);
427
+ this.setTimeout(request.config.timeoutMs);
424
428
  }
425
429
  async send() {
426
- const method = this.getMethod();
427
- const { body } = this.request;
428
- let axiosResponse;
429
- try {
430
- if (this.request.method === "POST" || this.request.method === "PUT" || this.request.method === "PATCH") {
431
- axiosResponse = await method(this.request.constructFullUrl(), body, this.config);
432
- } else {
433
- axiosResponse = await method(this.request.constructFullUrl(), this.config);
434
- }
435
- } catch (err) {
436
- if (isAxiosError(err) && err.response) {
437
- axiosResponse = err.response;
438
- } else {
439
- throw err;
440
- }
441
- }
442
- const headerRecord = {};
443
- Object.keys(axiosResponse.headers).forEach((key) => {
444
- headerRecord[key] = axiosResponse.headers[key];
445
- });
430
+ const response = await fetch(this.request.constructFullUrl(), this.requestInit);
446
431
  const metadata = {
447
- status: axiosResponse.status,
448
- statusText: axiosResponse.statusText || "",
449
- headers: headerRecord
432
+ status: response.status,
433
+ statusText: response.statusText || "",
434
+ headers: this.getHeaders(response)
450
435
  };
451
- if (metadata.status >= 400) {
452
- throw new HttpError(metadata);
453
- }
454
436
  return {
455
437
  metadata,
456
- raw: axiosResponse.data.buffer.slice(
457
- axiosResponse.data.byteOffset,
458
- axiosResponse.data.byteOffset + axiosResponse.data.byteLength
459
- )
438
+ raw: await response.clone().arrayBuffer()
460
439
  };
461
440
  }
462
- getMethod() {
463
- if (this.request.method === "POST") {
464
- return axios.post;
465
- } else if (this.request.method === "GET") {
466
- return axios.get;
467
- } else if (this.request.method === "PUT") {
468
- return axios.put;
469
- } else if (this.request.method === "DELETE") {
470
- return axios.delete;
471
- } else if (this.request.method === "PATCH") {
472
- return axios.patch;
473
- } else if (this.request.method === "HEAD") {
474
- return axios.head;
441
+ setMethod(method) {
442
+ if (!method) {
443
+ return;
475
444
  }
476
- throw new Error("invalid method!!!!");
445
+ this.requestInit = {
446
+ ...this.requestInit,
447
+ method
448
+ };
477
449
  }
478
- setHeaders() {
479
- if (!this.request.headers) {
450
+ setBody(body) {
451
+ if (!body) {
480
452
  return;
481
453
  }
482
- const headersRecord = {};
483
- new Headers(this.request.getHeaders()).forEach((value, key) => {
484
- headersRecord[key] = value;
485
- });
486
- this.config = {
487
- ...this.config,
488
- headers: headersRecord
454
+ this.requestInit = {
455
+ ...this.requestInit,
456
+ body
489
457
  };
490
458
  }
491
- setTimeout() {
492
- this.config = {
493
- ...this.config,
494
- timeout: this.request.config.timeout
459
+ setHeaders(headers) {
460
+ if (!headers) {
461
+ return;
462
+ }
463
+ this.requestInit = {
464
+ ...this.requestInit,
465
+ headers
495
466
  };
496
467
  }
468
+ setTimeout(timeoutMs) {
469
+ if (!timeoutMs) {
470
+ return;
471
+ }
472
+ this.requestInit = {
473
+ ...this.requestInit,
474
+ signal: AbortSignal.timeout(timeoutMs)
475
+ };
476
+ }
477
+ getHeaders(response) {
478
+ const headers = {};
479
+ response.headers.forEach((value, key) => {
480
+ headers[key] = value;
481
+ });
482
+ return headers;
483
+ }
497
484
  };
498
485
 
499
486
  // src/http/handlers/terminating-handler.ts
500
487
  var TerminatingHandler = class {
501
488
  async handle(request) {
502
- return new RequestAxiosAdapter(request).send();
489
+ return new RequestFetchAdapter(request).send();
490
+ }
491
+ };
492
+
493
+ // src/http/error.ts
494
+ var HttpError = class extends Error {
495
+ constructor(metadata, raw, error) {
496
+ super(error);
497
+ this.error = metadata.statusText;
498
+ this.metadata = metadata;
499
+ this.raw = raw;
503
500
  }
504
501
  };
505
502
 
@@ -548,12 +545,39 @@ var HttpClient = class {
548
545
  call(request) {
549
546
  return this.requestHandlerChain.callChain(request);
550
547
  }
548
+ async callPaginated(request) {
549
+ const response = await this.call(request);
550
+ if (!response.data) {
551
+ throw new Error("no response data to paginate through");
552
+ }
553
+ return {
554
+ ...response,
555
+ data: this.getPage(request, response.data)
556
+ };
557
+ }
551
558
  setBaseUrl(url) {
552
559
  this.config.baseUrl = url;
553
560
  }
554
561
  setConfig(config) {
555
562
  this.config = config;
556
563
  }
564
+ getPage(request, data) {
565
+ var _a, _b, _c, _d;
566
+ if (!request.pagination) {
567
+ throw new Error("getPage called for request without pagination property");
568
+ }
569
+ let curr = data;
570
+ for (const segment of ((_a = request.pagination) == null ? void 0 : _a.pagePath) || []) {
571
+ curr = curr[segment];
572
+ }
573
+ const page = (_c = (_b = request.pagination) == null ? void 0 : _b.pageSchema) == null ? void 0 : _c.parse(curr);
574
+ if (!page) {
575
+ throw new Error(
576
+ `error getting page data. Curr: ${JSON.stringify(curr)}. PagePath: ${(_d = request.pagination) == null ? void 0 : _d.pagePath}. Data: ${JSON.stringify(data)}`
577
+ );
578
+ }
579
+ return page;
580
+ }
557
581
  };
558
582
 
559
583
  // src/services/base-service.ts
@@ -568,8 +592,8 @@ var BaseService = class {
568
592
  set environment(environment) {
569
593
  this.config.environment = environment;
570
594
  }
571
- set timeout(timeout) {
572
- this.config.timeout = timeout;
595
+ set timeoutMs(timeoutMs) {
596
+ this.config.timeoutMs = timeoutMs;
573
597
  }
574
598
  set clientId(clientId) {
575
599
  this.config.clientId = clientId;
@@ -648,6 +672,7 @@ var Request = class {
648
672
  this.responseContentType = params.responseContentType;
649
673
  this.retry = params.retry;
650
674
  this.validation = params.validation;
675
+ this.pagination = params.pagination;
651
676
  }
652
677
  addHeaderParam(key, param) {
653
678
  if (param.value === void 0) {
@@ -706,16 +731,6 @@ var Request = class {
706
731
  this.path = hookRequest.path;
707
732
  this.body = hookRequest.body;
708
733
  }
709
- toHookRequest() {
710
- return {
711
- baseUrl: this.baseUrl,
712
- method: this.method,
713
- path: this.path,
714
- headers: this.headers,
715
- body: this.body,
716
- queryParams: this.queryParams
717
- };
718
- }
719
734
  constructFullUrl() {
720
735
  const queryString = new QuerySerializer().serialize(this.queryParams);
721
736
  const path = this.constructPath();
@@ -750,9 +765,36 @@ var Request = class {
750
765
  }
751
766
  return new HeaderSerializer().serialize(this.headers);
752
767
  }
768
+ nextPage() {
769
+ if (!this.pagination) {
770
+ return;
771
+ }
772
+ const offsetParam = this.getOffsetParam();
773
+ if (!offsetParam) {
774
+ return;
775
+ }
776
+ offsetParam.value = Number(offsetParam.value) + this.pagination.pageSize;
777
+ }
753
778
  constructPath() {
754
779
  return new PathSerializer().serialize(this.pathPattern, this.pathParams);
755
780
  }
781
+ getOffsetParam() {
782
+ const offsetParam = this.getAllParams().find((param) => param.isOffset);
783
+ return offsetParam;
784
+ }
785
+ getAllParams() {
786
+ const allParams = [];
787
+ this.headers.forEach((val, key) => {
788
+ allParams.push(val);
789
+ });
790
+ this.queryParams.forEach((val, key) => {
791
+ allParams.push(val);
792
+ });
793
+ this.pathParams.forEach((val, key) => {
794
+ allParams.push(val);
795
+ });
796
+ return allParams;
797
+ }
756
798
  };
757
799
 
758
800
  // src/http/transport/request-builder.ts
@@ -840,6 +882,10 @@ var RequestBuilder = class {
840
882
  this.params.responseSchema = responseSchema;
841
883
  return this;
842
884
  }
885
+ setPagination(pagination) {
886
+ this.params.pagination = pagination;
887
+ return this;
888
+ }
843
889
  addBody(body) {
844
890
  if (body !== void 0) {
845
891
  this.params.body = body;
@@ -856,7 +902,9 @@ var RequestBuilder = class {
856
902
  value: param.value,
857
903
  explode: (_a = param.explode) != null ? _a : true,
858
904
  style: (_b = param.style) != null ? _b : "simple" /* SIMPLE */,
859
- encode: (_c = param.encode) != null ? _c : true
905
+ encode: (_c = param.encode) != null ? _c : true,
906
+ isLimit: !!param.isLimit,
907
+ isOffset: !!param.isOffset
860
908
  });
861
909
  return this;
862
910
  }
@@ -870,7 +918,9 @@ var RequestBuilder = class {
870
918
  value: param.value,
871
919
  explode: (_a = param.explode) != null ? _a : true,
872
920
  style: (_b = param.style) != null ? _b : "form" /* FORM */,
873
- encode: (_c = param.encode) != null ? _c : true
921
+ encode: (_c = param.encode) != null ? _c : true,
922
+ isLimit: !!param.isLimit,
923
+ isOffset: !!param.isOffset
874
924
  });
875
925
  return this;
876
926
  }
@@ -884,7 +934,9 @@ var RequestBuilder = class {
884
934
  value: param.value,
885
935
  explode: (_a = param.explode) != null ? _a : true,
886
936
  style: (_b = param.style) != null ? _b : "simple" /* SIMPLE */,
887
- encode: (_c = param.encode) != null ? _c : false
937
+ encode: (_c = param.encode) != null ? _c : false,
938
+ isLimit: !!param.isLimit,
939
+ isOffset: !!param.isOffset
888
940
  });
889
941
  return this;
890
942
  }
@@ -954,7 +1006,7 @@ var DestinationsService = class extends BaseService {
954
1006
  * @returns {Promise<HttpResponse<ListDestinationsOkResponse>>} Successful Response
955
1007
  */
956
1008
  async listDestinations(requestConfig) {
957
- const request = new RequestBuilder().setConfig(this.config).setBaseUrl(this.config).setMethod("GET").setPath("/destinations").setRequestSchema(z4.any()).setResponseSchema(listDestinationsOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).build();
1009
+ const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/destinations").setRequestSchema(z4.any()).setResponseSchema(listDestinationsOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).build();
958
1010
  return this.client.call(request);
959
1011
  }
960
1012
  };
@@ -1050,7 +1102,7 @@ var PackagesService = class extends BaseService {
1050
1102
  * @returns {Promise<HttpResponse<ListPackagesOkResponse>>} Successful Response
1051
1103
  */
1052
1104
  async listPackages(params, requestConfig) {
1053
- const request = new RequestBuilder().setConfig(this.config).setBaseUrl(this.config).setMethod("GET").setPath("/packages").setRequestSchema(z7.any()).setResponseSchema(listPackagesOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addQueryParam({
1105
+ const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/packages").setRequestSchema(z7.any()).setResponseSchema(listPackagesOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addQueryParam({
1054
1106
  key: "destination",
1055
1107
  value: params == null ? void 0 : params.destination
1056
1108
  }).addQueryParam({
@@ -1366,22 +1418,30 @@ import { z as z14 } from "zod";
1366
1418
  var createPurchaseOkResponseProfile = z14.lazy(() => {
1367
1419
  return z14.object({
1368
1420
  iccid: z14.string().min(18).max(22).optional(),
1369
- activationCode: z14.string().min(1e3).max(8e3).optional()
1421
+ activationCode: z14.string().min(1e3).max(8e3).optional(),
1422
+ manualActivationCode: z14.string().optional()
1370
1423
  });
1371
1424
  });
1372
1425
  var createPurchaseOkResponseProfileResponse = z14.lazy(() => {
1373
1426
  return z14.object({
1374
1427
  iccid: z14.string().min(18).max(22).optional(),
1375
- activationCode: z14.string().min(1e3).max(8e3).optional()
1428
+ activationCode: z14.string().min(1e3).max(8e3).optional(),
1429
+ manualActivationCode: z14.string().optional()
1376
1430
  }).transform((data) => ({
1377
1431
  iccid: data["iccid"],
1378
- activationCode: data["activationCode"]
1432
+ activationCode: data["activationCode"],
1433
+ manualActivationCode: data["manualActivationCode"]
1379
1434
  }));
1380
1435
  });
1381
1436
  var createPurchaseOkResponseProfileRequest = z14.lazy(() => {
1382
- return z14.object({ iccid: z14.string().nullish(), activationCode: z14.string().nullish() }).transform((data) => ({
1437
+ return z14.object({
1438
+ iccid: z14.string().nullish(),
1439
+ activationCode: z14.string().nullish(),
1440
+ manualActivationCode: z14.string().nullish()
1441
+ }).transform((data) => ({
1383
1442
  iccid: data["iccid"],
1384
- activationCode: data["activationCode"]
1443
+ activationCode: data["activationCode"],
1444
+ manualActivationCode: data["manualActivationCode"]
1385
1445
  }));
1386
1446
  });
1387
1447
 
@@ -1692,7 +1752,7 @@ var PurchasesService = class extends BaseService {
1692
1752
  * @returns {Promise<HttpResponse<ListPurchasesOkResponse>>} Successful Response
1693
1753
  */
1694
1754
  async listPurchases(params, requestConfig) {
1695
- const request = new RequestBuilder().setConfig(this.config).setBaseUrl(this.config).setMethod("GET").setPath("/purchases").setRequestSchema(z23.any()).setResponseSchema(listPurchasesOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addQueryParam({
1755
+ const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/purchases").setRequestSchema(z23.any()).setResponseSchema(listPurchasesOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addQueryParam({
1696
1756
  key: "iccid",
1697
1757
  value: params == null ? void 0 : params.iccid
1698
1758
  }).addQueryParam({
@@ -1724,7 +1784,7 @@ var PurchasesService = class extends BaseService {
1724
1784
  * @returns {Promise<HttpResponse<CreatePurchaseOkResponse>>} Successful Response
1725
1785
  */
1726
1786
  async createPurchase(body, requestConfig) {
1727
- const request = new RequestBuilder().setConfig(this.config).setBaseUrl(this.config).setMethod("POST").setPath("/purchases").setRequestSchema(createPurchaseRequestRequest).setResponseSchema(createPurchaseOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
1787
+ const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("POST").setPath("/purchases").setRequestSchema(createPurchaseRequestRequest).setResponseSchema(createPurchaseOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
1728
1788
  return this.client.call(request);
1729
1789
  }
1730
1790
  /**
@@ -1732,7 +1792,7 @@ var PurchasesService = class extends BaseService {
1732
1792
  * @returns {Promise<HttpResponse<TopUpEsimOkResponse>>} Successful Response
1733
1793
  */
1734
1794
  async topUpEsim(body, requestConfig) {
1735
- const request = new RequestBuilder().setConfig(this.config).setBaseUrl(this.config).setMethod("POST").setPath("/purchases/topup").setRequestSchema(topUpEsimRequestRequest).setResponseSchema(topUpEsimOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
1795
+ const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("POST").setPath("/purchases/topup").setRequestSchema(topUpEsimRequestRequest).setResponseSchema(topUpEsimOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
1736
1796
  return this.client.call(request);
1737
1797
  }
1738
1798
  /**
@@ -1740,7 +1800,7 @@ var PurchasesService = class extends BaseService {
1740
1800
  * @returns {Promise<HttpResponse<EditPurchaseOkResponse>>} Successful Response
1741
1801
  */
1742
1802
  async editPurchase(body, requestConfig) {
1743
- const request = new RequestBuilder().setConfig(this.config).setBaseUrl(this.config).setMethod("POST").setPath("/purchases/edit").setRequestSchema(editPurchaseRequestRequest).setResponseSchema(editPurchaseOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
1803
+ const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("POST").setPath("/purchases/edit").setRequestSchema(editPurchaseRequestRequest).setResponseSchema(editPurchaseOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
1744
1804
  return this.client.call(request);
1745
1805
  }
1746
1806
  /**
@@ -1749,7 +1809,7 @@ var PurchasesService = class extends BaseService {
1749
1809
  * @returns {Promise<HttpResponse<GetPurchaseConsumptionOkResponse>>} Successful Response
1750
1810
  */
1751
1811
  async getPurchaseConsumption(purchaseId, requestConfig) {
1752
- const request = new RequestBuilder().setConfig(this.config).setBaseUrl(this.config).setMethod("GET").setPath("/purchases/{purchaseId}/consumption").setRequestSchema(z23.any()).setResponseSchema(getPurchaseConsumptionOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
1812
+ const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/purchases/{purchaseId}/consumption").setRequestSchema(z23.any()).setResponseSchema(getPurchaseConsumptionOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
1753
1813
  key: "purchaseId",
1754
1814
  value: purchaseId
1755
1815
  }).build();
@@ -2016,7 +2076,7 @@ var ESimService = class extends BaseService {
2016
2076
  * @returns {Promise<HttpResponse<GetEsimOkResponse>>} Successful Response
2017
2077
  */
2018
2078
  async getEsim(params, requestConfig) {
2019
- const request = new RequestBuilder().setConfig(this.config).setBaseUrl(this.config).setMethod("GET").setPath("/esim").setRequestSchema(z33.any()).setResponseSchema(getEsimOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addQueryParam({
2079
+ const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/esim").setRequestSchema(z33.any()).setResponseSchema(getEsimOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addQueryParam({
2020
2080
  key: "iccid",
2021
2081
  value: params == null ? void 0 : params.iccid
2022
2082
  }).build();
@@ -2028,7 +2088,7 @@ var ESimService = class extends BaseService {
2028
2088
  * @returns {Promise<HttpResponse<GetEsimDeviceOkResponse>>} Successful Response
2029
2089
  */
2030
2090
  async getEsimDevice(iccid, requestConfig) {
2031
- const request = new RequestBuilder().setConfig(this.config).setBaseUrl(this.config).setMethod("GET").setPath("/esim/{iccid}/device").setRequestSchema(z33.any()).setResponseSchema(getEsimDeviceOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
2091
+ const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/esim/{iccid}/device").setRequestSchema(z33.any()).setResponseSchema(getEsimDeviceOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
2032
2092
  key: "iccid",
2033
2093
  value: iccid
2034
2094
  }).build();
@@ -2040,7 +2100,7 @@ var ESimService = class extends BaseService {
2040
2100
  * @returns {Promise<HttpResponse<GetEsimHistoryOkResponse>>} Successful Response
2041
2101
  */
2042
2102
  async getEsimHistory(iccid, requestConfig) {
2043
- const request = new RequestBuilder().setConfig(this.config).setBaseUrl(this.config).setMethod("GET").setPath("/esim/{iccid}/history").setRequestSchema(z33.any()).setResponseSchema(getEsimHistoryOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
2103
+ const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/esim/{iccid}/history").setRequestSchema(z33.any()).setResponseSchema(getEsimHistoryOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
2044
2104
  key: "iccid",
2045
2105
  value: iccid
2046
2106
  }).build();
@@ -2052,7 +2112,7 @@ var ESimService = class extends BaseService {
2052
2112
  * @returns {Promise<HttpResponse<GetEsimMacOkResponse>>} Successful Response
2053
2113
  */
2054
2114
  async getEsimMac(iccid, requestConfig) {
2055
- const request = new RequestBuilder().setConfig(this.config).setBaseUrl(this.config).setMethod("GET").setPath("/esim/{iccid}/mac").setRequestSchema(z33.any()).setResponseSchema(getEsimMacOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
2115
+ const request = new RequestBuilder().setBaseUrl(this.config).setConfig(this.config).setMethod("GET").setPath("/esim/{iccid}/mac").setRequestSchema(z33.any()).setResponseSchema(getEsimMacOkResponseResponse).setRequestContentType("json" /* Json */).setResponseContentType("json" /* Json */).setRetryAttempts(this.config, requestConfig).setRetryDelayMs(this.config, requestConfig).setResponseValidation(this.config, requestConfig).addPathParam({
2056
2116
  key: "iccid",
2057
2117
  value: iccid
2058
2118
  }).build();
@@ -2086,11 +2146,11 @@ var Celitech = class {
2086
2146
  this.purchases.baseUrl = environment;
2087
2147
  this.eSim.baseUrl = environment;
2088
2148
  }
2089
- set timeout(timeout) {
2090
- this.destinations.timeout = timeout;
2091
- this.packages.timeout = timeout;
2092
- this.purchases.timeout = timeout;
2093
- this.eSim.timeout = timeout;
2149
+ set timeoutMs(timeoutMs) {
2150
+ this.destinations.timeoutMs = timeoutMs;
2151
+ this.packages.timeoutMs = timeoutMs;
2152
+ this.purchases.timeoutMs = timeoutMs;
2153
+ this.eSim.timeoutMs = timeoutMs;
2094
2154
  }
2095
2155
  set clientId(clientId) {
2096
2156
  this.destinations.clientId = clientId;
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "celitech-sdk",
3
- "version": "1.1.87",
3
+ "version": "1.1.89",
4
4
  "description": "Welcome to the CELITECH API documentation! Useful links: [Homepage](https://www.celitech.com) | [Support email](mailto:support@celitech.com) | [Blog](https://www.celitech.com/blog/) ",
5
5
  "source": "./src/index.ts",
6
- "main": "./dist/commonjs/index.js",
7
- "module": "./dist/esm/index.js",
8
- "browser": "./dist/index.umd.js",
9
- "unpkg": "./dist/index.umd.js",
10
- "types": "./dist/commonjs/index.d.ts",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.mjs",
8
+ "browser": "./dist/index.js",
9
+ "unpkg": "./dist/index.js",
10
+ "types": "./dist/index.d.ts",
11
11
  "scripts": {
12
12
  "test": "tsc --noEmit",
13
13
  "build": "tsup-node src/index.ts --format cjs,esm --dts --clean",
@@ -30,8 +30,7 @@
30
30
  "tsup": "^6.7.0"
31
31
  },
32
32
  "dependencies": {
33
- "zod": "3.22.0",
34
- "axios": "^1.7.4"
33
+ "zod": "3.22.0"
35
34
  },
36
35
  "exports": {
37
36
  ".": {