@empathyco/x-adapter 8.0.3-alpha.1 → 8.1.0-alpha.1

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.
@@ -13,11 +13,14 @@ const utils_1 = require("./utils");
13
13
  *
14
14
  * @public
15
15
  */
16
- const fetchHttpClient = (endpoint, { id = endpoint, cancelable = true, parameters = {}, properties, sendParamsInBody = false } = {}) => {
16
+ const fetchHttpClient = (endpoint, { id = endpoint, cancelable = true, parameters = {}, properties, sendParamsInBody = false, sendEmptyParams = false } = {}) => {
17
17
  const signal = cancelable ? { signal: abortAndGetNewAbortSignal(id) } : {};
18
+ if (!sendEmptyParams) {
19
+ parameters = (0, x_utils_1.cleanEmpty)(parameters);
20
+ }
18
21
  const flatParameters = (0, x_utils_1.flatObject)(parameters);
19
- const url = sendParamsInBody ? endpoint : (0, utils_1.buildUrl)(endpoint, (0, x_utils_1.cleanEmpty)(flatParameters));
20
- const bodyParameters = sendParamsInBody ? { body: JSON.stringify((0, x_utils_1.cleanEmpty)(parameters)) } : {};
22
+ const url = sendParamsInBody ? endpoint : (0, utils_1.buildUrl)(endpoint, flatParameters);
23
+ const bodyParameters = sendParamsInBody ? { body: JSON.stringify(parameters) } : {};
21
24
  return fetch(url, {
22
25
  ...properties,
23
26
  ...bodyParameters,
@@ -1 +1 @@
1
- {"version":3,"file":"fetch.http-client.js","sourceRoot":"","sources":["../../../src/http-clients/fetch.http-client.ts"],"names":[],"mappings":";;;AAAA,gDAAwE;AAExE,mCAA2C;AAE3C;;;;;;;;;GASG;AACI,MAAM,eAAe,GAAe,CACzC,QAAQ,EACR,EAAE,EAAE,GAAG,QAAQ,EAAE,UAAU,GAAG,IAAI,EAAE,UAAU,GAAG,EAAE,EAAE,UAAU,EAAE,gBAAgB,GAAG,KAAK,EAAE,GAAG,EAAE,EAChG,EAAE;IACF,MAAM,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,yBAAyB,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3E,MAAM,cAAc,GAAG,IAAA,oBAAU,EAAC,UAAU,CAAC,CAAC;IAC9C,MAAM,GAAG,GAAG,gBAAgB,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAA,gBAAQ,EAAC,QAAQ,EAAE,IAAA,oBAAU,EAAC,cAAc,CAAC,CAAC,CAAC;IACzF,MAAM,cAAc,GAAG,gBAAgB,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAA,oBAAU,EAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAEhG,OAAO,KAAK,CAAC,GAAG,EAAE;QAChB,GAAG,UAAU;QACb,GAAG,cAAc;QACjB,GAAG,MAAM;KACV,CAAC,CAAC,IAAI,CAAC,cAAM,CAAC,CAAC;AAClB,CAAC,CAAC;AAdW,QAAA,eAAe,mBAc1B;AAEF;;GAEG;AACH,MAAM,uBAAuB,GAAgC,EAAE,CAAC;AAEhE;;;;;;;GAOG;AACH,SAAS,yBAAyB,CAAC,EAAU;;IAC3C,MAAA,uBAAuB,CAAC,EAAE,CAAC,0CAAE,KAAK,EAAE,CAAC;IACrC,uBAAuB,CAAC,EAAE,CAAC,GAAG,IAAI,eAAe,EAAE,CAAC;IACpD,OAAO,uBAAuB,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC;AAC5C,CAAC","sourcesContent":["import { Dictionary, cleanEmpty, flatObject } from '@empathyco/x-utils';\nimport { HttpClient } from './types';\nimport { buildUrl, toJson } from './utils';\n\n/**\n * The `fetchHttpClient()` function is a http client implementation using the `fetch` WebAPI.\n *\n * @param endpoint - The endpoint to make the request to.\n * @param options - The request options.\n *\n * @returns A `Promise` object.\n *\n * @public\n */\nexport const fetchHttpClient: HttpClient = (\n endpoint,\n { id = endpoint, cancelable = true, parameters = {}, properties, sendParamsInBody = false } = {}\n) => {\n const signal = cancelable ? { signal: abortAndGetNewAbortSignal(id) } : {};\n const flatParameters = flatObject(parameters);\n const url = sendParamsInBody ? endpoint : buildUrl(endpoint, cleanEmpty(flatParameters));\n const bodyParameters = sendParamsInBody ? { body: JSON.stringify(cleanEmpty(parameters)) } : {};\n\n return fetch(url, {\n ...properties,\n ...bodyParameters,\n ...signal\n }).then(toJson);\n};\n\n/**\n * Dictionary with the request id as key and an `AbortController` as value.\n */\nconst requestAbortControllers: Dictionary<AbortController> = {};\n\n/**\n * Function that cancels previous request with the same `id` and returns a new `AbortSignal` for\n * the new request.\n *\n * @param id - The identifier of the request to cancel and create a new `AbortSignal`.\n *\n * @returns The new `AbortSignal`.\n */\nfunction abortAndGetNewAbortSignal(id: string): AbortSignal {\n requestAbortControllers[id]?.abort();\n requestAbortControllers[id] = new AbortController();\n return requestAbortControllers[id].signal;\n}\n"]}
1
+ {"version":3,"file":"fetch.http-client.js","sourceRoot":"","sources":["../../../src/http-clients/fetch.http-client.ts"],"names":[],"mappings":";;;AAAA,gDAAwE;AAExE,mCAA2C;AAE3C;;;;;;;;;GASG;AACI,MAAM,eAAe,GAAe,CACzC,QAAQ,EACR,EACE,EAAE,GAAG,QAAQ,EACb,UAAU,GAAG,IAAI,EACjB,UAAU,GAAG,EAAE,EACf,UAAU,EACV,gBAAgB,GAAG,KAAK,EACxB,eAAe,GAAG,KAAK,EACxB,GAAG,EAAE,EACN,EAAE;IACF,MAAM,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,yBAAyB,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3E,IAAI,CAAC,eAAe,EAAE;QACpB,UAAU,GAAG,IAAA,oBAAU,EAAC,UAAU,CAAC,CAAC;KACrC;IACD,MAAM,cAAc,GAAG,IAAA,oBAAU,EAAC,UAAU,CAAC,CAAC;IAC9C,MAAM,GAAG,GAAG,gBAAgB,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAA,gBAAQ,EAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;IAC7E,MAAM,cAAc,GAAG,gBAAgB,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAEpF,OAAO,KAAK,CAAC,GAAG,EAAE;QAChB,GAAG,UAAU;QACb,GAAG,cAAc;QACjB,GAAG,MAAM;KACV,CAAC,CAAC,IAAI,CAAC,cAAM,CAAC,CAAC;AAClB,CAAC,CAAC;AAxBW,QAAA,eAAe,mBAwB1B;AAEF;;GAEG;AACH,MAAM,uBAAuB,GAAgC,EAAE,CAAC;AAEhE;;;;;;;GAOG;AACH,SAAS,yBAAyB,CAAC,EAAU;;IAC3C,MAAA,uBAAuB,CAAC,EAAE,CAAC,0CAAE,KAAK,EAAE,CAAC;IACrC,uBAAuB,CAAC,EAAE,CAAC,GAAG,IAAI,eAAe,EAAE,CAAC;IACpD,OAAO,uBAAuB,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC;AAC5C,CAAC","sourcesContent":["import { Dictionary, cleanEmpty, flatObject } from '@empathyco/x-utils';\nimport { HttpClient } from './types';\nimport { buildUrl, toJson } from './utils';\n\n/**\n * The `fetchHttpClient()` function is a http client implementation using the `fetch` WebAPI.\n *\n * @param endpoint - The endpoint to make the request to.\n * @param options - The request options.\n *\n * @returns A `Promise` object.\n *\n * @public\n */\nexport const fetchHttpClient: HttpClient = (\n endpoint,\n {\n id = endpoint,\n cancelable = true,\n parameters = {},\n properties,\n sendParamsInBody = false,\n sendEmptyParams = false\n } = {}\n) => {\n const signal = cancelable ? { signal: abortAndGetNewAbortSignal(id) } : {};\n if (!sendEmptyParams) {\n parameters = cleanEmpty(parameters);\n }\n const flatParameters = flatObject(parameters);\n const url = sendParamsInBody ? endpoint : buildUrl(endpoint, flatParameters);\n const bodyParameters = sendParamsInBody ? { body: JSON.stringify(parameters) } : {};\n\n return fetch(url, {\n ...properties,\n ...bodyParameters,\n ...signal\n }).then(toJson);\n};\n\n/**\n * Dictionary with the request id as key and an `AbortController` as value.\n */\nconst requestAbortControllers: Dictionary<AbortController> = {};\n\n/**\n * Function that cancels previous request with the same `id` and returns a new `AbortSignal` for\n * the new request.\n *\n * @param id - The identifier of the request to cancel and create a new `AbortSignal`.\n *\n * @returns The new `AbortSignal`.\n */\nfunction abortAndGetNewAbortSignal(id: string): AbortSignal {\n requestAbortControllers[id]?.abort();\n requestAbortControllers[id] = new AbortController();\n return requestAbortControllers[id].signal;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/http-clients/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Dictionary } from '@empathyco/x-utils';\n\n/**\n * Makes a request to a backend API using the given parameters.\n *\n * @param endpoint - The endpoint to use.\n * @param options - Additional options to make the request with.\n * @returns A promise wrapped object containing the response.\n * @public\n */\nexport type HttpClient = <Response = unknown>(\n endpoint: string,\n options?: Omit<RequestOptions, 'endpoint'>\n) => Promise<Readonly<Response>>;\n\n/**\n * A record of options to make the request with.\n *\n * @public\n */\nexport interface RequestOptions {\n /**\n * A unique identifier for this request. Can be used to abort requests with same id.\n */\n id?: string;\n /**\n * True if the request can be cancelled.\n */\n cancelable?: boolean;\n /**\n * A flag to send parameters in the body if true or in the url QueryString if false.\n */\n sendParamsInBody?: boolean;\n /**\n * A list of parameters to send to the API.\n */\n parameters?: Dictionary<unknown>;\n /**\n * The RequestInit object to create the request with.\n */\n properties?: RequestInit;\n /**\n * The base endpoint that the request should use.\n */\n endpoint?: string;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/http-clients/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Dictionary } from '@empathyco/x-utils';\n\n/**\n * Makes a request to a backend API using the given parameters.\n *\n * @param endpoint - The endpoint to use.\n * @param options - Additional options to make the request with.\n * @returns A promise wrapped object containing the response.\n * @public\n */\nexport type HttpClient = <Response = unknown>(\n endpoint: string,\n options?: Omit<RequestOptions, 'endpoint'>\n) => Promise<Readonly<Response>>;\n\n/**\n * A record of options to make the request with.\n *\n * @public\n */\nexport interface RequestOptions {\n /**\n * A unique identifier for this request. Can be used to abort requests with same id.\n */\n id?: string;\n /**\n * True if the request can be cancelled.\n */\n cancelable?: boolean;\n /**\n * A flag to send parameters in the body if true or in the url QueryString if false.\n */\n sendParamsInBody?: boolean;\n /**\n * A flag to always send the parameters even if their values are empty.\n */\n sendEmptyParams?: boolean;\n /**\n * A list of parameters to send to the API.\n */\n parameters?: Dictionary<unknown>;\n /**\n * The RequestInit object to create the request with.\n */\n properties?: RequestInit;\n /**\n * The base endpoint that the request should use.\n */\n endpoint?: string;\n}\n"]}
@@ -10,11 +10,14 @@ import { buildUrl, toJson } from './utils';
10
10
  *
11
11
  * @public
12
12
  */
13
- export const fetchHttpClient = (endpoint, { id = endpoint, cancelable = true, parameters = {}, properties, sendParamsInBody = false } = {}) => {
13
+ export const fetchHttpClient = (endpoint, { id = endpoint, cancelable = true, parameters = {}, properties, sendParamsInBody = false, sendEmptyParams = false } = {}) => {
14
14
  const signal = cancelable ? { signal: abortAndGetNewAbortSignal(id) } : {};
15
+ if (!sendEmptyParams) {
16
+ parameters = cleanEmpty(parameters);
17
+ }
15
18
  const flatParameters = flatObject(parameters);
16
- const url = sendParamsInBody ? endpoint : buildUrl(endpoint, cleanEmpty(flatParameters));
17
- const bodyParameters = sendParamsInBody ? { body: JSON.stringify(cleanEmpty(parameters)) } : {};
19
+ const url = sendParamsInBody ? endpoint : buildUrl(endpoint, flatParameters);
20
+ const bodyParameters = sendParamsInBody ? { body: JSON.stringify(parameters) } : {};
18
21
  return fetch(url, {
19
22
  ...properties,
20
23
  ...bodyParameters,
@@ -1 +1 @@
1
- {"version":3,"file":"fetch.http-client.js","sourceRoot":"","sources":["../../../src/http-clients/fetch.http-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAExE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAE3C;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,eAAe,GAAe,CACzC,QAAQ,EACR,EAAE,EAAE,GAAG,QAAQ,EAAE,UAAU,GAAG,IAAI,EAAE,UAAU,GAAG,EAAE,EAAE,UAAU,EAAE,gBAAgB,GAAG,KAAK,EAAE,GAAG,EAAE,EAChG,EAAE;IACF,MAAM,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,yBAAyB,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3E,MAAM,cAAc,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;IAC9C,MAAM,GAAG,GAAG,gBAAgB,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC;IACzF,MAAM,cAAc,GAAG,gBAAgB,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAEhG,OAAO,KAAK,CAAC,GAAG,EAAE;QAChB,GAAG,UAAU;QACb,GAAG,cAAc;QACjB,GAAG,MAAM;KACV,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAClB,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,uBAAuB,GAAgC,EAAE,CAAC;AAEhE;;;;;;;GAOG;AACH,SAAS,yBAAyB,CAAC,EAAU;;IAC3C,MAAA,uBAAuB,CAAC,EAAE,CAAC,0CAAE,KAAK,EAAE,CAAC;IACrC,uBAAuB,CAAC,EAAE,CAAC,GAAG,IAAI,eAAe,EAAE,CAAC;IACpD,OAAO,uBAAuB,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC;AAC5C,CAAC","sourcesContent":["import { Dictionary, cleanEmpty, flatObject } from '@empathyco/x-utils';\nimport { HttpClient } from './types';\nimport { buildUrl, toJson } from './utils';\n\n/**\n * The `fetchHttpClient()` function is a http client implementation using the `fetch` WebAPI.\n *\n * @param endpoint - The endpoint to make the request to.\n * @param options - The request options.\n *\n * @returns A `Promise` object.\n *\n * @public\n */\nexport const fetchHttpClient: HttpClient = (\n endpoint,\n { id = endpoint, cancelable = true, parameters = {}, properties, sendParamsInBody = false } = {}\n) => {\n const signal = cancelable ? { signal: abortAndGetNewAbortSignal(id) } : {};\n const flatParameters = flatObject(parameters);\n const url = sendParamsInBody ? endpoint : buildUrl(endpoint, cleanEmpty(flatParameters));\n const bodyParameters = sendParamsInBody ? { body: JSON.stringify(cleanEmpty(parameters)) } : {};\n\n return fetch(url, {\n ...properties,\n ...bodyParameters,\n ...signal\n }).then(toJson);\n};\n\n/**\n * Dictionary with the request id as key and an `AbortController` as value.\n */\nconst requestAbortControllers: Dictionary<AbortController> = {};\n\n/**\n * Function that cancels previous request with the same `id` and returns a new `AbortSignal` for\n * the new request.\n *\n * @param id - The identifier of the request to cancel and create a new `AbortSignal`.\n *\n * @returns The new `AbortSignal`.\n */\nfunction abortAndGetNewAbortSignal(id: string): AbortSignal {\n requestAbortControllers[id]?.abort();\n requestAbortControllers[id] = new AbortController();\n return requestAbortControllers[id].signal;\n}\n"]}
1
+ {"version":3,"file":"fetch.http-client.js","sourceRoot":"","sources":["../../../src/http-clients/fetch.http-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAExE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAE3C;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,eAAe,GAAe,CACzC,QAAQ,EACR,EACE,EAAE,GAAG,QAAQ,EACb,UAAU,GAAG,IAAI,EACjB,UAAU,GAAG,EAAE,EACf,UAAU,EACV,gBAAgB,GAAG,KAAK,EACxB,eAAe,GAAG,KAAK,EACxB,GAAG,EAAE,EACN,EAAE;IACF,MAAM,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,yBAAyB,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3E,IAAI,CAAC,eAAe,EAAE;QACpB,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;KACrC;IACD,MAAM,cAAc,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;IAC9C,MAAM,GAAG,GAAG,gBAAgB,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;IAC7E,MAAM,cAAc,GAAG,gBAAgB,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAEpF,OAAO,KAAK,CAAC,GAAG,EAAE;QAChB,GAAG,UAAU;QACb,GAAG,cAAc;QACjB,GAAG,MAAM;KACV,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAClB,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,uBAAuB,GAAgC,EAAE,CAAC;AAEhE;;;;;;;GAOG;AACH,SAAS,yBAAyB,CAAC,EAAU;;IAC3C,MAAA,uBAAuB,CAAC,EAAE,CAAC,0CAAE,KAAK,EAAE,CAAC;IACrC,uBAAuB,CAAC,EAAE,CAAC,GAAG,IAAI,eAAe,EAAE,CAAC;IACpD,OAAO,uBAAuB,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC;AAC5C,CAAC","sourcesContent":["import { Dictionary, cleanEmpty, flatObject } from '@empathyco/x-utils';\nimport { HttpClient } from './types';\nimport { buildUrl, toJson } from './utils';\n\n/**\n * The `fetchHttpClient()` function is a http client implementation using the `fetch` WebAPI.\n *\n * @param endpoint - The endpoint to make the request to.\n * @param options - The request options.\n *\n * @returns A `Promise` object.\n *\n * @public\n */\nexport const fetchHttpClient: HttpClient = (\n endpoint,\n {\n id = endpoint,\n cancelable = true,\n parameters = {},\n properties,\n sendParamsInBody = false,\n sendEmptyParams = false\n } = {}\n) => {\n const signal = cancelable ? { signal: abortAndGetNewAbortSignal(id) } : {};\n if (!sendEmptyParams) {\n parameters = cleanEmpty(parameters);\n }\n const flatParameters = flatObject(parameters);\n const url = sendParamsInBody ? endpoint : buildUrl(endpoint, flatParameters);\n const bodyParameters = sendParamsInBody ? { body: JSON.stringify(parameters) } : {};\n\n return fetch(url, {\n ...properties,\n ...bodyParameters,\n ...signal\n }).then(toJson);\n};\n\n/**\n * Dictionary with the request id as key and an `AbortController` as value.\n */\nconst requestAbortControllers: Dictionary<AbortController> = {};\n\n/**\n * Function that cancels previous request with the same `id` and returns a new `AbortSignal` for\n * the new request.\n *\n * @param id - The identifier of the request to cancel and create a new `AbortSignal`.\n *\n * @returns The new `AbortSignal`.\n */\nfunction abortAndGetNewAbortSignal(id: string): AbortSignal {\n requestAbortControllers[id]?.abort();\n requestAbortControllers[id] = new AbortController();\n return requestAbortControllers[id].signal;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/http-clients/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Dictionary } from '@empathyco/x-utils';\n\n/**\n * Makes a request to a backend API using the given parameters.\n *\n * @param endpoint - The endpoint to use.\n * @param options - Additional options to make the request with.\n * @returns A promise wrapped object containing the response.\n * @public\n */\nexport type HttpClient = <Response = unknown>(\n endpoint: string,\n options?: Omit<RequestOptions, 'endpoint'>\n) => Promise<Readonly<Response>>;\n\n/**\n * A record of options to make the request with.\n *\n * @public\n */\nexport interface RequestOptions {\n /**\n * A unique identifier for this request. Can be used to abort requests with same id.\n */\n id?: string;\n /**\n * True if the request can be cancelled.\n */\n cancelable?: boolean;\n /**\n * A flag to send parameters in the body if true or in the url QueryString if false.\n */\n sendParamsInBody?: boolean;\n /**\n * A list of parameters to send to the API.\n */\n parameters?: Dictionary<unknown>;\n /**\n * The RequestInit object to create the request with.\n */\n properties?: RequestInit;\n /**\n * The base endpoint that the request should use.\n */\n endpoint?: string;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/http-clients/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Dictionary } from '@empathyco/x-utils';\n\n/**\n * Makes a request to a backend API using the given parameters.\n *\n * @param endpoint - The endpoint to use.\n * @param options - Additional options to make the request with.\n * @returns A promise wrapped object containing the response.\n * @public\n */\nexport type HttpClient = <Response = unknown>(\n endpoint: string,\n options?: Omit<RequestOptions, 'endpoint'>\n) => Promise<Readonly<Response>>;\n\n/**\n * A record of options to make the request with.\n *\n * @public\n */\nexport interface RequestOptions {\n /**\n * A unique identifier for this request. Can be used to abort requests with same id.\n */\n id?: string;\n /**\n * True if the request can be cancelled.\n */\n cancelable?: boolean;\n /**\n * A flag to send parameters in the body if true or in the url QueryString if false.\n */\n sendParamsInBody?: boolean;\n /**\n * A flag to always send the parameters even if their values are empty.\n */\n sendEmptyParams?: boolean;\n /**\n * A list of parameters to send to the API.\n */\n parameters?: Dictionary<unknown>;\n /**\n * The RequestInit object to create the request with.\n */\n properties?: RequestInit;\n /**\n * The base endpoint that the request should use.\n */\n endpoint?: string;\n}\n"]}
@@ -26,6 +26,10 @@ export interface RequestOptions {
26
26
  * A flag to send parameters in the body if true or in the url QueryString if false.
27
27
  */
28
28
  sendParamsInBody?: boolean;
29
+ /**
30
+ * A flag to always send the parameters even if their values are empty.
31
+ */
32
+ sendEmptyParams?: boolean;
29
33
  /**
30
34
  * A list of parameters to send to the API.
31
35
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empathyco/x-adapter",
3
- "version": "8.0.3-alpha.1",
3
+ "version": "8.1.0-alpha.1",
4
4
  "description": "A utils library to create a client for any API",
5
5
  "author": "Empathy Systems Corporation S.L.",
6
6
  "license": "Apache-2.0",
@@ -37,20 +37,20 @@
37
37
  "prepublishOnly": "pnpm run build"
38
38
  },
39
39
  "dependencies": {
40
- "@empathyco/x-deep-merge": "^2.0.3-alpha.1",
41
- "@empathyco/x-utils": "^1.0.3-alpha.1",
40
+ "@empathyco/x-deep-merge": "^2.0.3-alpha.2",
41
+ "@empathyco/x-utils": "^1.0.3-alpha.2",
42
42
  "tslib": "~2.6.0"
43
43
  },
44
44
  "devDependencies": {
45
- "@types/jest": "~27.5.0",
46
- "concurrently": "~8.2.0",
47
- "jest": "~27.5.0",
48
- "rimraf": "~3.0.2",
49
- "ts-jest": "~27.1.0",
50
- "typescript": "~4.9.4"
45
+ "@types/jest": "27.5.0",
46
+ "concurrently": "8.2.0",
47
+ "jest": "27.5.0",
48
+ "rimraf": "3.0.2",
49
+ "ts-jest": "27.1.0",
50
+ "typescript": "4.9.4"
51
51
  },
52
52
  "publishConfig": {
53
53
  "access": "public"
54
54
  },
55
- "gitHead": "217bcad29251fc880b421caf2dcb48e89f52d26f"
55
+ "gitHead": "782271b380929cc378d5414ebeaa98d1e4cd7858"
56
56
  }