celitech-sdk 1.3.52 → 1.3.54

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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Celitech TypeScript SDK 1.3.52
1
+ # Celitech TypeScript SDK 1.3.54
2
2
 
3
3
  Welcome to the Celitech SDK documentation. This guide will help you get started with integrating and using the Celitech SDK in your project.
4
4
 
@@ -6,8 +6,8 @@ Welcome to the Celitech SDK documentation. This guide will help you get started
6
6
 
7
7
  ## Versions
8
8
 
9
- - API version: `1.3.52`
10
- - SDK version: `1.3.52`
9
+ - API version: `1.3.54`
10
+ - SDK version: `1.3.54`
11
11
 
12
12
  ## About the API
13
13
 
@@ -112,7 +112,6 @@ The SDK provides various services to interact with the API.
112
112
 
113
113
  | Name |
114
114
  | :------------------------------------------------------------------- |
115
- | [OAuthService](documentation/services/OAuthService.md) |
116
115
  | [DestinationsService](documentation/services/DestinationsService.md) |
117
116
  | [PackagesService](documentation/services/PackagesService.md) |
118
117
  | [PurchasesService](documentation/services/PurchasesService.md) |
@@ -130,8 +129,6 @@ The SDK includes several models that represent the data structures used in API r
130
129
 
131
130
  | Name | Description |
132
131
  | :------------------------------------------------------------------------------------------- | :---------- |
133
- | [GetAccessTokenRequest](documentation/models/GetAccessTokenRequest.md) | |
134
- | [GetAccessTokenOkResponse](documentation/models/GetAccessTokenOkResponse.md) | |
135
132
  | [ListDestinationsOkResponse](documentation/models/ListDestinationsOkResponse.md) | |
136
133
  | [\_\_](documentation/models/__.md) | |
137
134
  | [\_1](documentation/models/_1.md) | |
package/dist/index.d.ts CHANGED
@@ -92,6 +92,8 @@ interface CreateRequestParameters<Page = unknown[]> {
92
92
  validation: ValidationOptions;
93
93
  retry: RetryOptions;
94
94
  pagination?: RequestPagination<Page>;
95
+ filename?: string;
96
+ filenames?: string[];
95
97
  scopes?: Set<string>;
96
98
  tokenManager: OAuthTokenManager;
97
99
  }
@@ -126,6 +128,8 @@ declare class Request<PageSchema = unknown[]> {
126
128
  validation: ValidationOptions;
127
129
  retry: RetryOptions;
128
130
  pagination?: RequestPagination<PageSchema>;
131
+ filename?: string;
132
+ filenames?: string[];
129
133
  scopes?: Set<string>;
130
134
  tokenManager: OAuthTokenManager;
131
135
  private readonly pathPattern;
@@ -239,69 +243,6 @@ declare class BaseService {
239
243
  set accessToken(accessToken: string);
240
244
  }
241
245
 
242
- /**
243
- * The shape of the model inside the application code - what the users use
244
- */
245
- declare const getAccessTokenRequest: z.ZodLazy<z.ZodObject<{
246
- grantType: z.ZodOptional<z.ZodString>;
247
- clientId: z.ZodOptional<z.ZodString>;
248
- clientSecret: z.ZodOptional<z.ZodString>;
249
- }, "strip", z.ZodTypeAny, {
250
- grantType?: string | undefined;
251
- clientId?: string | undefined;
252
- clientSecret?: string | undefined;
253
- }, {
254
- grantType?: string | undefined;
255
- clientId?: string | undefined;
256
- clientSecret?: string | undefined;
257
- }>>;
258
- /**
259
- *
260
- * @typedef {GetAccessTokenRequest} getAccessTokenRequest
261
- * @property {GrantType}
262
- * @property {string}
263
- * @property {string}
264
- */
265
- type GetAccessTokenRequest = z.infer<typeof getAccessTokenRequest>;
266
-
267
- /**
268
- * The shape of the model inside the application code - what the users use
269
- */
270
- declare const getAccessTokenOkResponse: z.ZodLazy<z.ZodObject<{
271
- accessToken: z.ZodOptional<z.ZodString>;
272
- tokenType: z.ZodOptional<z.ZodString>;
273
- expiresIn: z.ZodOptional<z.ZodNumber>;
274
- }, "strip", z.ZodTypeAny, {
275
- accessToken?: string | undefined;
276
- tokenType?: string | undefined;
277
- expiresIn?: number | undefined;
278
- }, {
279
- accessToken?: string | undefined;
280
- tokenType?: string | undefined;
281
- expiresIn?: number | undefined;
282
- }>>;
283
- /**
284
- *
285
- * @typedef {GetAccessTokenOkResponse} getAccessTokenOkResponse
286
- * @property {string}
287
- * @property {string}
288
- * @property {number}
289
- */
290
- type GetAccessTokenOkResponse = z.infer<typeof getAccessTokenOkResponse>;
291
-
292
- declare class OAuthService extends BaseService {
293
- /**
294
- * This endpoint was added by liblab
295
- * @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
296
- * @returns {Promise<HttpResponse<GetAccessTokenOkResponse>>} Successful Response
297
- */
298
- getAccessToken(body: GetAccessTokenRequest, requestConfig?: RequestConfig): Promise<HttpResponse<GetAccessTokenOkResponse>>;
299
- }
300
-
301
- declare enum GrantType {
302
- CLIENT_CREDENTIALS = "client_credentials"
303
- }
304
-
305
246
  /**
306
247
  * The shape of the model inside the application code - what the users use
307
248
  */
@@ -2078,9 +2019,71 @@ declare class _25 extends ThrowableError {
2078
2019
  throw(): void;
2079
2020
  }
2080
2021
 
2022
+ /**
2023
+ * The shape of the model inside the application code - what the users use
2024
+ */
2025
+ declare const getAccessTokenRequest: z.ZodLazy<z.ZodObject<{
2026
+ grantType: z.ZodOptional<z.ZodString>;
2027
+ clientId: z.ZodOptional<z.ZodString>;
2028
+ clientSecret: z.ZodOptional<z.ZodString>;
2029
+ }, "strip", z.ZodTypeAny, {
2030
+ grantType?: string | undefined;
2031
+ clientId?: string | undefined;
2032
+ clientSecret?: string | undefined;
2033
+ }, {
2034
+ grantType?: string | undefined;
2035
+ clientId?: string | undefined;
2036
+ clientSecret?: string | undefined;
2037
+ }>>;
2038
+ /**
2039
+ *
2040
+ * @typedef {GetAccessTokenRequest} getAccessTokenRequest
2041
+ * @property {GrantType}
2042
+ * @property {string}
2043
+ * @property {string}
2044
+ */
2045
+ type GetAccessTokenRequest = z.infer<typeof getAccessTokenRequest>;
2046
+
2047
+ /**
2048
+ * The shape of the model inside the application code - what the users use
2049
+ */
2050
+ declare const getAccessTokenOkResponse: z.ZodLazy<z.ZodObject<{
2051
+ accessToken: z.ZodOptional<z.ZodString>;
2052
+ tokenType: z.ZodOptional<z.ZodString>;
2053
+ expiresIn: z.ZodOptional<z.ZodNumber>;
2054
+ }, "strip", z.ZodTypeAny, {
2055
+ accessToken?: string | undefined;
2056
+ tokenType?: string | undefined;
2057
+ expiresIn?: number | undefined;
2058
+ }, {
2059
+ accessToken?: string | undefined;
2060
+ tokenType?: string | undefined;
2061
+ expiresIn?: number | undefined;
2062
+ }>>;
2063
+ /**
2064
+ *
2065
+ * @typedef {GetAccessTokenOkResponse} getAccessTokenOkResponse
2066
+ * @property {string}
2067
+ * @property {string}
2068
+ * @property {number}
2069
+ */
2070
+ type GetAccessTokenOkResponse = z.infer<typeof getAccessTokenOkResponse>;
2071
+
2072
+ declare class OAuthService extends BaseService {
2073
+ /**
2074
+ * This endpoint was added by liblab
2075
+ * @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
2076
+ * @returns {Promise<HttpResponse<GetAccessTokenOkResponse>>} Successful Response
2077
+ */
2078
+ getAccessToken(body: GetAccessTokenRequest, requestConfig?: RequestConfig): Promise<HttpResponse<GetAccessTokenOkResponse>>;
2079
+ }
2080
+
2081
+ declare enum GrantType {
2082
+ CLIENT_CREDENTIALS = "client_credentials"
2083
+ }
2084
+
2081
2085
  declare class Celitech {
2082
2086
  config: SdkConfig;
2083
- readonly oAuth: OAuthService;
2084
2087
  readonly destinations: DestinationsService;
2085
2088
  readonly packages: PackagesService;
2086
2089
  readonly purchases: PurchasesService;
package/dist/index.js CHANGED
@@ -248,25 +248,26 @@ var TransportHookAdapter = class {
248
248
 
249
249
  // src/http/utils/content-type.ts
250
250
  function getContentTypeDefinition(contentType) {
251
- if (contentType.startsWith("application/") && contentType.includes("xml")) {
251
+ const ct = contentType.toLowerCase();
252
+ if (ct.startsWith("application/") && ct.includes("xml")) {
252
253
  return "xml" /* Xml */;
253
254
  }
254
- if (contentType.toLowerCase() === "application/x-www-form-urlencoded") {
255
+ if (ct === "application/x-www-form-urlencoded") {
255
256
  return "form" /* FormUrlEncoded */;
256
257
  }
257
- if (contentType.toLowerCase() === "text/event-stream") {
258
+ if (ct === "text/event-stream") {
258
259
  return "eventStream" /* EventStream */;
259
260
  }
260
- if (contentType.toLowerCase().startsWith("text/")) {
261
+ if (ct.startsWith("text/")) {
261
262
  return "text" /* Text */;
262
263
  }
263
- if (contentType.toLowerCase().startsWith("image/")) {
264
+ if (ct.startsWith("image/")) {
264
265
  return "image" /* Image */;
265
266
  }
266
- if (contentType.toLowerCase() === "application/octet-stream") {
267
+ if (ct === "application/octet-stream" || ct === "application/pdf") {
267
268
  return "binary" /* Binary */;
268
269
  }
269
- if (contentType.toLowerCase() === "application/json") {
270
+ if (ct === "application/json") {
270
271
  return "json" /* Json */;
271
272
  }
272
273
  return "json" /* Json */;
@@ -379,7 +380,7 @@ var ResponseValidationHandler = class {
379
380
  const encoder = new TextEncoder();
380
381
  return text.split("\n").filter((line) => line.startsWith("data: ")).map((part) => ({
381
382
  ...response,
382
- raw: encoder.encode(part)
383
+ raw: encoder.encode(part).buffer
383
384
  }));
384
385
  }
385
386
  decodeBody(request, response) {
@@ -549,7 +550,7 @@ var RequestValidationHandler = class {
549
550
  } else if (request.requestContentType === "form" /* FormUrlEncoded */) {
550
551
  request.body = this.toFormUrlEncoded(request);
551
552
  } else if (request.requestContentType === "multipartFormData" /* MultipartFormData */) {
552
- request.body = this.toFormData(request.body);
553
+ request.body = this.toFormData(request.body, request.filename, request.filenames);
553
554
  } else {
554
555
  request.body = JSON.stringify((_b = request.requestSchema) == null ? void 0 : _b.parse(request.body));
555
556
  }
@@ -586,14 +587,22 @@ var RequestValidationHandler = class {
586
587
  }
587
588
  return "";
588
589
  }
589
- toFormData(body) {
590
+ toFormData(body, filename, filenames) {
590
591
  const formData = new FormData();
591
592
  Object.keys(body).forEach((key) => {
592
593
  const value = body[key];
593
594
  if (Array.isArray(value)) {
594
- value.forEach((v, i) => formData.append(`${key}[${i}]`, v));
595
+ value.forEach((v, i) => {
596
+ if (v instanceof ArrayBuffer) {
597
+ const fileFilename = filenames && filenames[i] ? filenames[i] : `${key}[${i}]`;
598
+ formData.append(`${key}[${i}]`, new Blob([v]), fileFilename);
599
+ } else {
600
+ formData.append(`${key}[${i}]`, v);
601
+ }
602
+ });
595
603
  } else if (value instanceof ArrayBuffer) {
596
- formData.append(key, new Blob([value]));
604
+ const fileFilename = filename || key;
605
+ formData.append(key, new Blob([value]), fileFilename);
597
606
  } else {
598
607
  formData.append(key, value);
599
608
  }
@@ -685,14 +694,14 @@ var RequestFetchAdapter = class {
685
694
  for (const line of lineDecoder.splitLines(value)) {
686
695
  yield {
687
696
  metadata,
688
- raw: line
697
+ raw: this.toArrayBuffer(line)
689
698
  };
690
699
  }
691
700
  }
692
701
  for (const line of lineDecoder.flush()) {
693
702
  yield {
694
703
  metadata,
695
- raw: line
704
+ raw: this.toArrayBuffer(line)
696
705
  };
697
706
  }
698
707
  }
@@ -739,6 +748,9 @@ var RequestFetchAdapter = class {
739
748
  });
740
749
  return headers;
741
750
  }
751
+ toArrayBuffer(uint8Array) {
752
+ return uint8Array.buffer.slice(uint8Array.byteOffset, uint8Array.byteOffset + uint8Array.byteLength);
753
+ }
742
754
  };
743
755
 
744
756
  // src/http/handlers/terminating-handler.ts
@@ -997,6 +1009,8 @@ var Request = class {
997
1009
  this.retry = params.retry;
998
1010
  this.validation = params.validation;
999
1011
  this.pagination = params.pagination;
1012
+ this.filename = params.filename;
1013
+ this.filenames = params.filenames;
1000
1014
  this.scopes = params.scopes;
1001
1015
  this.tokenManager = params.tokenManager;
1002
1016
  }
@@ -1064,7 +1078,7 @@ var Request = class {
1064
1078
  return `${baseUrl}${path}${queryString}`;
1065
1079
  }
1066
1080
  copy(overrides) {
1067
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
1081
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
1068
1082
  const createRequestParams = {
1069
1083
  baseUrl: (_a = overrides == null ? void 0 : overrides.baseUrl) != null ? _a : this.baseUrl,
1070
1084
  errors: (_b = overrides == null ? void 0 : overrides.errors) != null ? _b : this.errors,
@@ -1080,6 +1094,8 @@ var Request = class {
1080
1094
  requestContentType: (_l = overrides == null ? void 0 : overrides.requestContentType) != null ? _l : this.requestContentType,
1081
1095
  retry: (_m = overrides == null ? void 0 : overrides.retry) != null ? _m : this.retry,
1082
1096
  validation: (_n = overrides == null ? void 0 : overrides.validation) != null ? _n : this.validation,
1097
+ filename: (_o = overrides == null ? void 0 : overrides.filename) != null ? _o : this.filename,
1098
+ filenames: (_p = overrides == null ? void 0 : overrides.filenames) != null ? _p : this.filenames,
1083
1099
  scopes: overrides == null ? void 0 : overrides.scopes,
1084
1100
  tokenManager: this.tokenManager
1085
1101
  };
@@ -1210,6 +1226,18 @@ var RequestBuilder = class {
1210
1226
  this.params.requestSchema = requestSchema;
1211
1227
  return this;
1212
1228
  }
1229
+ setFilename(filename) {
1230
+ if (filename !== void 0) {
1231
+ this.params.filename = filename;
1232
+ }
1233
+ return this;
1234
+ }
1235
+ setFilenames(filenames) {
1236
+ if (filenames !== void 0) {
1237
+ this.params.filenames = filenames;
1238
+ }
1239
+ return this;
1240
+ }
1213
1241
  setPagination(pagination) {
1214
1242
  this.params.pagination = pagination;
1215
1243
  return this;
@@ -1447,7 +1475,7 @@ var OAuthToken = class {
1447
1475
  var OAuthTokenManager = class {
1448
1476
  async getToken(scopes, config) {
1449
1477
  var _a, _b, _c, _d, _e, _f;
1450
- if (((_a = this.token) == null ? void 0 : _a.hasAllScopes(scopes)) && ((_b = this.token) == null ? void 0 : _b.expiresAt) && this.token.expiresAt - Date.now() > 1e3) {
1478
+ if (((_a = this.token) == null ? void 0 : _a.hasAllScopes(scopes)) && ((_b = this.token) == null ? void 0 : _b.expiresAt) && this.token.expiresAt - Date.now() > 5e3) {
1451
1479
  return this.token;
1452
1480
  }
1453
1481
  if (!config.clientId || !config.clientSecret) {
@@ -3681,7 +3709,6 @@ var Celitech = class {
3681
3709
  constructor(config) {
3682
3710
  this.config = config;
3683
3711
  this.tokenManager = new OAuthTokenManager();
3684
- this.oAuth = new OAuthService(this.config, this.tokenManager);
3685
3712
  this.destinations = new DestinationsService(this.config, this.tokenManager);
3686
3713
  this.packages = new PackagesService(this.config, this.tokenManager);
3687
3714
  this.purchases = new PurchasesService(this.config, this.tokenManager);
@@ -3689,7 +3716,6 @@ var Celitech = class {
3689
3716
  this.iFrame = new IFrameService(this.config, this.tokenManager);
3690
3717
  }
3691
3718
  set baseUrl(baseUrl) {
3692
- this.oAuth.baseUrl = baseUrl;
3693
3719
  this.destinations.baseUrl = baseUrl;
3694
3720
  this.packages.baseUrl = baseUrl;
3695
3721
  this.purchases.baseUrl = baseUrl;
@@ -3697,7 +3723,6 @@ var Celitech = class {
3697
3723
  this.iFrame.baseUrl = baseUrl;
3698
3724
  }
3699
3725
  set environment(environment) {
3700
- this.oAuth.baseUrl = environment;
3701
3726
  this.destinations.baseUrl = environment;
3702
3727
  this.packages.baseUrl = environment;
3703
3728
  this.purchases.baseUrl = environment;
@@ -3705,7 +3730,6 @@ var Celitech = class {
3705
3730
  this.iFrame.baseUrl = environment;
3706
3731
  }
3707
3732
  set timeoutMs(timeoutMs) {
3708
- this.oAuth.timeoutMs = timeoutMs;
3709
3733
  this.destinations.timeoutMs = timeoutMs;
3710
3734
  this.packages.timeoutMs = timeoutMs;
3711
3735
  this.purchases.timeoutMs = timeoutMs;
@@ -3713,7 +3737,6 @@ var Celitech = class {
3713
3737
  this.iFrame.timeoutMs = timeoutMs;
3714
3738
  }
3715
3739
  set clientId(clientId) {
3716
- this.oAuth.clientId = clientId;
3717
3740
  this.destinations.clientId = clientId;
3718
3741
  this.packages.clientId = clientId;
3719
3742
  this.purchases.clientId = clientId;
@@ -3721,7 +3744,6 @@ var Celitech = class {
3721
3744
  this.iFrame.clientId = clientId;
3722
3745
  }
3723
3746
  set clientSecret(clientSecret) {
3724
- this.oAuth.clientSecret = clientSecret;
3725
3747
  this.destinations.clientSecret = clientSecret;
3726
3748
  this.packages.clientSecret = clientSecret;
3727
3749
  this.purchases.clientSecret = clientSecret;
@@ -3729,7 +3751,6 @@ var Celitech = class {
3729
3751
  this.iFrame.clientSecret = clientSecret;
3730
3752
  }
3731
3753
  set oAuthBaseUrl(oAuthBaseUrl) {
3732
- this.oAuth.oAuthBaseUrl = oAuthBaseUrl;
3733
3754
  this.destinations.oAuthBaseUrl = oAuthBaseUrl;
3734
3755
  this.packages.oAuthBaseUrl = oAuthBaseUrl;
3735
3756
  this.purchases.oAuthBaseUrl = oAuthBaseUrl;
@@ -3737,7 +3758,6 @@ var Celitech = class {
3737
3758
  this.iFrame.oAuthBaseUrl = oAuthBaseUrl;
3738
3759
  }
3739
3760
  set accessToken(accessToken) {
3740
- this.oAuth.accessToken = accessToken;
3741
3761
  this.destinations.accessToken = accessToken;
3742
3762
  this.packages.accessToken = accessToken;
3743
3763
  this.purchases.accessToken = accessToken;
package/dist/index.mjs CHANGED
@@ -204,25 +204,26 @@ var TransportHookAdapter = class {
204
204
 
205
205
  // src/http/utils/content-type.ts
206
206
  function getContentTypeDefinition(contentType) {
207
- if (contentType.startsWith("application/") && contentType.includes("xml")) {
207
+ const ct = contentType.toLowerCase();
208
+ if (ct.startsWith("application/") && ct.includes("xml")) {
208
209
  return "xml" /* Xml */;
209
210
  }
210
- if (contentType.toLowerCase() === "application/x-www-form-urlencoded") {
211
+ if (ct === "application/x-www-form-urlencoded") {
211
212
  return "form" /* FormUrlEncoded */;
212
213
  }
213
- if (contentType.toLowerCase() === "text/event-stream") {
214
+ if (ct === "text/event-stream") {
214
215
  return "eventStream" /* EventStream */;
215
216
  }
216
- if (contentType.toLowerCase().startsWith("text/")) {
217
+ if (ct.startsWith("text/")) {
217
218
  return "text" /* Text */;
218
219
  }
219
- if (contentType.toLowerCase().startsWith("image/")) {
220
+ if (ct.startsWith("image/")) {
220
221
  return "image" /* Image */;
221
222
  }
222
- if (contentType.toLowerCase() === "application/octet-stream") {
223
+ if (ct === "application/octet-stream" || ct === "application/pdf") {
223
224
  return "binary" /* Binary */;
224
225
  }
225
- if (contentType.toLowerCase() === "application/json") {
226
+ if (ct === "application/json") {
226
227
  return "json" /* Json */;
227
228
  }
228
229
  return "json" /* Json */;
@@ -335,7 +336,7 @@ var ResponseValidationHandler = class {
335
336
  const encoder = new TextEncoder();
336
337
  return text.split("\n").filter((line) => line.startsWith("data: ")).map((part) => ({
337
338
  ...response,
338
- raw: encoder.encode(part)
339
+ raw: encoder.encode(part).buffer
339
340
  }));
340
341
  }
341
342
  decodeBody(request, response) {
@@ -505,7 +506,7 @@ var RequestValidationHandler = class {
505
506
  } else if (request.requestContentType === "form" /* FormUrlEncoded */) {
506
507
  request.body = this.toFormUrlEncoded(request);
507
508
  } else if (request.requestContentType === "multipartFormData" /* MultipartFormData */) {
508
- request.body = this.toFormData(request.body);
509
+ request.body = this.toFormData(request.body, request.filename, request.filenames);
509
510
  } else {
510
511
  request.body = JSON.stringify((_b = request.requestSchema) == null ? void 0 : _b.parse(request.body));
511
512
  }
@@ -542,14 +543,22 @@ var RequestValidationHandler = class {
542
543
  }
543
544
  return "";
544
545
  }
545
- toFormData(body) {
546
+ toFormData(body, filename, filenames) {
546
547
  const formData = new FormData();
547
548
  Object.keys(body).forEach((key) => {
548
549
  const value = body[key];
549
550
  if (Array.isArray(value)) {
550
- value.forEach((v, i) => formData.append(`${key}[${i}]`, v));
551
+ value.forEach((v, i) => {
552
+ if (v instanceof ArrayBuffer) {
553
+ const fileFilename = filenames && filenames[i] ? filenames[i] : `${key}[${i}]`;
554
+ formData.append(`${key}[${i}]`, new Blob([v]), fileFilename);
555
+ } else {
556
+ formData.append(`${key}[${i}]`, v);
557
+ }
558
+ });
551
559
  } else if (value instanceof ArrayBuffer) {
552
- formData.append(key, new Blob([value]));
560
+ const fileFilename = filename || key;
561
+ formData.append(key, new Blob([value]), fileFilename);
553
562
  } else {
554
563
  formData.append(key, value);
555
564
  }
@@ -641,14 +650,14 @@ var RequestFetchAdapter = class {
641
650
  for (const line of lineDecoder.splitLines(value)) {
642
651
  yield {
643
652
  metadata,
644
- raw: line
653
+ raw: this.toArrayBuffer(line)
645
654
  };
646
655
  }
647
656
  }
648
657
  for (const line of lineDecoder.flush()) {
649
658
  yield {
650
659
  metadata,
651
- raw: line
660
+ raw: this.toArrayBuffer(line)
652
661
  };
653
662
  }
654
663
  }
@@ -695,6 +704,9 @@ var RequestFetchAdapter = class {
695
704
  });
696
705
  return headers;
697
706
  }
707
+ toArrayBuffer(uint8Array) {
708
+ return uint8Array.buffer.slice(uint8Array.byteOffset, uint8Array.byteOffset + uint8Array.byteLength);
709
+ }
698
710
  };
699
711
 
700
712
  // src/http/handlers/terminating-handler.ts
@@ -953,6 +965,8 @@ var Request = class {
953
965
  this.retry = params.retry;
954
966
  this.validation = params.validation;
955
967
  this.pagination = params.pagination;
968
+ this.filename = params.filename;
969
+ this.filenames = params.filenames;
956
970
  this.scopes = params.scopes;
957
971
  this.tokenManager = params.tokenManager;
958
972
  }
@@ -1020,7 +1034,7 @@ var Request = class {
1020
1034
  return `${baseUrl}${path}${queryString}`;
1021
1035
  }
1022
1036
  copy(overrides) {
1023
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
1037
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
1024
1038
  const createRequestParams = {
1025
1039
  baseUrl: (_a = overrides == null ? void 0 : overrides.baseUrl) != null ? _a : this.baseUrl,
1026
1040
  errors: (_b = overrides == null ? void 0 : overrides.errors) != null ? _b : this.errors,
@@ -1036,6 +1050,8 @@ var Request = class {
1036
1050
  requestContentType: (_l = overrides == null ? void 0 : overrides.requestContentType) != null ? _l : this.requestContentType,
1037
1051
  retry: (_m = overrides == null ? void 0 : overrides.retry) != null ? _m : this.retry,
1038
1052
  validation: (_n = overrides == null ? void 0 : overrides.validation) != null ? _n : this.validation,
1053
+ filename: (_o = overrides == null ? void 0 : overrides.filename) != null ? _o : this.filename,
1054
+ filenames: (_p = overrides == null ? void 0 : overrides.filenames) != null ? _p : this.filenames,
1039
1055
  scopes: overrides == null ? void 0 : overrides.scopes,
1040
1056
  tokenManager: this.tokenManager
1041
1057
  };
@@ -1166,6 +1182,18 @@ var RequestBuilder = class {
1166
1182
  this.params.requestSchema = requestSchema;
1167
1183
  return this;
1168
1184
  }
1185
+ setFilename(filename) {
1186
+ if (filename !== void 0) {
1187
+ this.params.filename = filename;
1188
+ }
1189
+ return this;
1190
+ }
1191
+ setFilenames(filenames) {
1192
+ if (filenames !== void 0) {
1193
+ this.params.filenames = filenames;
1194
+ }
1195
+ return this;
1196
+ }
1169
1197
  setPagination(pagination) {
1170
1198
  this.params.pagination = pagination;
1171
1199
  return this;
@@ -1403,7 +1431,7 @@ var OAuthToken = class {
1403
1431
  var OAuthTokenManager = class {
1404
1432
  async getToken(scopes, config) {
1405
1433
  var _a, _b, _c, _d, _e, _f;
1406
- if (((_a = this.token) == null ? void 0 : _a.hasAllScopes(scopes)) && ((_b = this.token) == null ? void 0 : _b.expiresAt) && this.token.expiresAt - Date.now() > 1e3) {
1434
+ if (((_a = this.token) == null ? void 0 : _a.hasAllScopes(scopes)) && ((_b = this.token) == null ? void 0 : _b.expiresAt) && this.token.expiresAt - Date.now() > 5e3) {
1407
1435
  return this.token;
1408
1436
  }
1409
1437
  if (!config.clientId || !config.clientSecret) {
@@ -3637,7 +3665,6 @@ var Celitech = class {
3637
3665
  constructor(config) {
3638
3666
  this.config = config;
3639
3667
  this.tokenManager = new OAuthTokenManager();
3640
- this.oAuth = new OAuthService(this.config, this.tokenManager);
3641
3668
  this.destinations = new DestinationsService(this.config, this.tokenManager);
3642
3669
  this.packages = new PackagesService(this.config, this.tokenManager);
3643
3670
  this.purchases = new PurchasesService(this.config, this.tokenManager);
@@ -3645,7 +3672,6 @@ var Celitech = class {
3645
3672
  this.iFrame = new IFrameService(this.config, this.tokenManager);
3646
3673
  }
3647
3674
  set baseUrl(baseUrl) {
3648
- this.oAuth.baseUrl = baseUrl;
3649
3675
  this.destinations.baseUrl = baseUrl;
3650
3676
  this.packages.baseUrl = baseUrl;
3651
3677
  this.purchases.baseUrl = baseUrl;
@@ -3653,7 +3679,6 @@ var Celitech = class {
3653
3679
  this.iFrame.baseUrl = baseUrl;
3654
3680
  }
3655
3681
  set environment(environment) {
3656
- this.oAuth.baseUrl = environment;
3657
3682
  this.destinations.baseUrl = environment;
3658
3683
  this.packages.baseUrl = environment;
3659
3684
  this.purchases.baseUrl = environment;
@@ -3661,7 +3686,6 @@ var Celitech = class {
3661
3686
  this.iFrame.baseUrl = environment;
3662
3687
  }
3663
3688
  set timeoutMs(timeoutMs) {
3664
- this.oAuth.timeoutMs = timeoutMs;
3665
3689
  this.destinations.timeoutMs = timeoutMs;
3666
3690
  this.packages.timeoutMs = timeoutMs;
3667
3691
  this.purchases.timeoutMs = timeoutMs;
@@ -3669,7 +3693,6 @@ var Celitech = class {
3669
3693
  this.iFrame.timeoutMs = timeoutMs;
3670
3694
  }
3671
3695
  set clientId(clientId) {
3672
- this.oAuth.clientId = clientId;
3673
3696
  this.destinations.clientId = clientId;
3674
3697
  this.packages.clientId = clientId;
3675
3698
  this.purchases.clientId = clientId;
@@ -3677,7 +3700,6 @@ var Celitech = class {
3677
3700
  this.iFrame.clientId = clientId;
3678
3701
  }
3679
3702
  set clientSecret(clientSecret) {
3680
- this.oAuth.clientSecret = clientSecret;
3681
3703
  this.destinations.clientSecret = clientSecret;
3682
3704
  this.packages.clientSecret = clientSecret;
3683
3705
  this.purchases.clientSecret = clientSecret;
@@ -3685,7 +3707,6 @@ var Celitech = class {
3685
3707
  this.iFrame.clientSecret = clientSecret;
3686
3708
  }
3687
3709
  set oAuthBaseUrl(oAuthBaseUrl) {
3688
- this.oAuth.oAuthBaseUrl = oAuthBaseUrl;
3689
3710
  this.destinations.oAuthBaseUrl = oAuthBaseUrl;
3690
3711
  this.packages.oAuthBaseUrl = oAuthBaseUrl;
3691
3712
  this.purchases.oAuthBaseUrl = oAuthBaseUrl;
@@ -3693,7 +3714,6 @@ var Celitech = class {
3693
3714
  this.iFrame.oAuthBaseUrl = oAuthBaseUrl;
3694
3715
  }
3695
3716
  set accessToken(accessToken) {
3696
- this.oAuth.accessToken = accessToken;
3697
3717
  this.destinations.accessToken = accessToken;
3698
3718
  this.packages.accessToken = accessToken;
3699
3719
  this.purchases.accessToken = accessToken;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "celitech-sdk",
3
- "version": "1.3.52",
3
+ "version": "1.3.54",
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
6
  "main": "./dist/index.js",