@squidcloud/client 1.0.178 → 1.0.180

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/cjs/index.js CHANGED
@@ -47058,7 +47058,8 @@ function getApplicationUrl(regionPrefix, appId, path) {
47058
47058
  }
47059
47059
  const url = parsedBaseUrl.toString();
47060
47060
  path = path.startsWith('/') ? path.slice(1) : path;
47061
- return (url.endsWith('/') ? url : url + '/') + path;
47061
+ const urlWithoutTrailingSlash = url.replace(/\/$/g, '');
47062
+ return path.length ? `${urlWithoutTrailingSlash}/${path}` : urlWithoutTrailingSlash;
47062
47063
  }
47063
47064
  function getApplicationHttpHeaders(regionPrefix, appId) {
47064
47065
  const headers = {};
@@ -50509,6 +50510,7 @@ async function performAxiosRequest(files, filesFieldName, body, url, headers, ex
50509
50510
  statusText: axiosResponse.statusText,
50510
50511
  };
50511
50512
  }
50513
+ /** @internal. */
50512
50514
  function tryDeserializing(text) {
50513
50515
  if (!text)
50514
50516
  return undefined;
@@ -51474,7 +51476,7 @@ class ApiClient {
51474
51476
  * In case of error (status code >= 400 or other error), the promise will be rejected with an RpcError.
51475
51477
  */
51476
51478
  async request(integrationId, endpointId, body, options, method) {
51477
- const optionsToSend = Object.assign(Object.assign({}, DEFAULT_OPTIONS), (options || {}));
51479
+ const optionsToSend = Object.assign(Object.assign({}, DEFAULT_OPTIONS), this.convertOptionsToStrings(options || {}));
51478
51480
  const apiRequest = {
51479
51481
  integrationId,
51480
51482
  endpointId,
@@ -51484,6 +51486,21 @@ class ApiClient {
51484
51486
  };
51485
51487
  return await this.rpcManager.rawPost('api/callApi', apiRequest, undefined, undefined, false);
51486
51488
  }
51489
+ convertOptionsToStrings(apiOptions) {
51490
+ return {
51491
+ headers: this.convertToStrings(apiOptions.headers),
51492
+ queryParams: this.convertToStrings(apiOptions.queryParams),
51493
+ pathParams: this.convertToStrings(apiOptions.pathParams),
51494
+ };
51495
+ }
51496
+ convertToStrings(items) {
51497
+ if (!items)
51498
+ return {};
51499
+ const entries = Object.entries(items)
51500
+ .filter(([, value]) => value !== undefined)
51501
+ .map(([key, value]) => [key, String(value)]);
51502
+ return Object.fromEntries(entries);
51503
+ }
51487
51504
  }
51488
51505
 
51489
51506
  ;// CONCATENATED MODULE: ./src/squid.ts
@@ -1,7 +1,7 @@
1
1
  import { ApiEndpointId, HttpMethod } from './integrations/api.public-types';
2
2
  import { IntegrationId } from './communication.public-types';
3
3
  /** The headers of an API call. */
4
- export type ApiHeaders = Record<string, string>;
4
+ export type ApiHeaders = Record<string, string | number | boolean>;
5
5
  /** The context of an API call. */
6
6
  export declare class ApiCallContext {
7
7
  readonly integrationId: IntegrationId;
@@ -12,9 +12,9 @@ export declare class ApiCallContext {
12
12
  readonly options: ApiOptions;
13
13
  }
14
14
  export interface ApiOptions {
15
- headers?: ApiHeaders;
16
- queryParams?: Record<string, string>;
17
- pathParams?: Record<string, string>;
15
+ headers?: Record<string, string | number | boolean>;
16
+ queryParams?: Record<string, string | number | boolean>;
17
+ pathParams?: Record<string, string | number | boolean>;
18
18
  }
19
19
  /** The options for calling an API. */
20
20
  export interface CallApiOptions {
@@ -36,6 +36,6 @@ export interface CallApiRequest {
36
36
  /** A native API call response. */
37
37
  export interface NativeApiCallResponse<T = unknown> {
38
38
  body: T;
39
- headers: ApiHeaders;
39
+ headers: Record<string, string>;
40
40
  status: number;
41
41
  }
@@ -15,4 +15,6 @@ export declare class ApiClient {
15
15
  * In case of error (status code >= 400 or other error), the promise will be rejected with an RpcError.
16
16
  */
17
17
  request<T = unknown>(integrationId: IntegrationId, endpointId: ApiEndpointId, body?: unknown, options?: ApiOptions, method?: HttpMethod): Promise<HttpResponse<T>>;
18
+ private convertOptionsToStrings;
19
+ private convertToStrings;
18
20
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squidcloud/client",
3
- "version": "1.0.178",
3
+ "version": "1.0.180",
4
4
  "description": "A typescript implementation of the Squid client",
5
5
  "main": "dist/cjs/index.js",
6
6
  "types": "dist/typescript-client/src/index.d.ts",