@odata2ts/http-client-axios 0.8.1 → 0.9.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,20 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [0.9.0](https://github.com/odata2ts/http-client/compare/@odata2ts/http-client-axios@0.8.1...@odata2ts/http-client-axios@0.9.0) (2023-08-03)
7
+
8
+ ### Code Refactoring
9
+
10
+ * **axios:** remove default headers ([7fcff0c](https://github.com/odata2ts/http-client/commit/7fcff0c8f1a0962abc60da84cde57e0469cc0bc2))
11
+
12
+ ### Features
13
+
14
+ * allow for additional headers for all operations ([#10](https://github.com/odata2ts/http-client/issues/10)) ([75eedd3](https://github.com/odata2ts/http-client/commit/75eedd3ebb8534188a5a644aee9e69e17f1f0c80))
15
+
16
+ ### BREAKING CHANGES
17
+
18
+ * **axios:** removed default accept & content-type headers; removed merge & retrieveBigNumbersAsString methods (base-lib); all of these settings can now be configured per operation via the `additionalHeaders` option.
19
+
6
20
  ## [0.8.1](https://github.com/odata2ts/http-client/compare/@odata2ts/http-client-axios@0.8.0...@odata2ts/http-client-axios@0.8.1) (2023-07-26)
7
21
 
8
22
  **Note:** Version bump only for package @odata2ts/http-client-axios
@@ -19,10 +19,10 @@ class AxiosClient extends http_client_base_1.BaseHttpClient {
19
19
  constructor(config, clientOptions) {
20
20
  super(clientOptions);
21
21
  this.clientOptions = clientOptions;
22
- this.client = axios_1.default.create((0, AxiosRequestConfig_1.getDefaultConfig)(config));
22
+ this.client = axios_1.default.create(config);
23
23
  }
24
24
  addHeaderToRequestConfig(headers, config) {
25
- return (0, AxiosRequestConfig_1.mergeConfig)(config, { headers });
25
+ return (0, AxiosRequestConfig_1.mergeConfig)({ headers }, config);
26
26
  }
27
27
  executeRequest(method, url, data, requestConfig = {}) {
28
28
  return tslib_1.__awa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ttpClientOptions, HttpMethods } from \"@odata2ts/http-client-base\";\r\nimport axios, {\r\n AxiosError,\r\n AxiosInstance,\r\n AxiosResponseHeaders,\r\n AxiosRequestConfig as OriginalRequestConfig,\r\n RawAxiosResponseHeaders,\r\n} from \"axios\";\r\n\r\nimport { AxiosClientError } from \"./AxiosClientError\";\r\nimport { AxiosRequestConfig, getDefaultConfig, mergeConfig } from \"./AxiosRequestConfig\";\r\n\r\nexport interface ClientOptions extends BaseHttpClientOptions {}\r\n\r\nexport const DEFAULT_ERROR_MESSAGE = \"No error message!\";\r\nconst FAILURE_NO_RESPONSE = \"No response from server! Failure: \";\r\nconst FAILURE_NO_REQUEST = \"No request was sent! Failure: \";\r\nconst FAILURE_RESPONSE_MESSAGE = \"OData server responded with error: \";\r\nconst FAILURE_AXIOS = \"Fatal Axios failure: \";\r\n\r\nfunction buildErrorMessage(prefix: string, error: any) {\r\n const msg = typeof error === \"string\" ? error : (error as Error)?.message;\r\n return prefix + (msg || DEFAULT_ERROR_MESSAGE);\r\n}\r\n\r\nexport class AxiosClient extends BaseHttpClient<AxiosRequestConfig> {\r\n protected readonly client: AxiosInstance;\r\n\r\n constructor(config?: AxiosRequestConfig, private clientOptions?: ClientOptions) {\r\n super(clientOptions);\r\n this.client = axios.create(getDefaultConfig(config));\r\n }\r\n\r\n protected addHeaderToRequestConfig(\r\n headers: Record<string, string>,\r\n config: AxiosRequestConfig | undefined\r\n ): AxiosRequestConfig {\r\n return mergeConfig(config, { headers });\r\n }\r\n\r\n protected async executeRequest<ResponseModel>(\r\n method: HttpMethods,\r\n url: string,\r\n data: any,\r\n requestConfig: AxiosRequestConfig | undefined = {}\r\n ): Promise<HttpResponseModel<ResponseModel>> {\r\n // add URL and HTTP method to the request config\r\n const config: OriginalRequestConfig = mergeConfig(requestConfig, { url, method });\r\n if (typeof data !== \"undefined\") {\r\n config.data = data;\r\n }\r\n\r\n try {\r\n return await this.client.request(config);\r\n } catch (error: any) {\r\n if ((error as AxiosError).isAxiosError) {\r\n const axiosError = error as AxiosError;\r\n\r\n // regular failure handling\r\n if (axiosError.response) {\r\n const errMsg = this.retrieveErrorMessage(axiosError.response.data);\r\n const msg = buildErrorMessage(FAILURE_RESPONSE_MESSAGE, errMsg);\r\n throw new AxiosClientError(\r\n msg,\r\n axiosError.response.status,\r\n this.mapHeaders(axiosError.response.headers),\r\n new Error(errMsg || DEFAULT_ERROR_MESSAGE),\r\n axiosError\r\n );\r\n }\r\n // fatal failure without response\r\n else {\r\n throw new AxiosClientError(\r\n buildErrorMessage(axiosError.request ? FAILURE_NO_RESPONSE : FAILURE_NO_REQUEST, axiosError),\r\n undefined,\r\n undefined,\r\n error,\r\n axiosError\r\n );\r\n }\r\n }\r\n // not an Axios error\r\n throw new AxiosClientError(buildErrorMessage(FAILURE_AXIOS, error), undefined, undefined, error);\r\n }\r\n }\r\n\r\n protected mapHeaders(headers: AxiosResponseHeaders | RawAxiosResponseHeaders): Record<string, string> {\r\n return headers as Record<string, string>;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"AxiosClient.js","sourceRoot":"","sources":["../src/AxiosClient.ts"],"names":[],"mappings":";;;;AACA,iEAAgG;AAChG,0DAMe;AAEf,yDAAsD;AACtD,6DAAuE;AAI1D,QAAA,qBAAqB,GAAG,mBAAmB,CAAC;AACzD,MAAM,mBAAmB,GAAG,oCAAoC,CAAC;AACjE,MAAM,kBAAkB,GAAG,gCAAgC,CAAC;AAC5D,MAAM,wBAAwB,GAAG,qCAAqC,CAAC;AACvE,MAAM,aAAa,GAAG,uBAAuB,CAAC;AAE9C,SAAS,iBAAiB,CAAC,MAAc,EAAE,KAAU;IACnD,MAAM,GAAG,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAE,KAAe,aAAf,KAAK,uBAAL,KAAK,CAAY,OAAO,CAAC;IAC1E,OAAO,MAAM,GAAG,CAAC,GAAG,IAAI,6BAAqB,CAAC,CAAC;AACjD,CAAC;AA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AC,EAC1C,UAAU,CACX,CAAC;qBACH;oBACD,iCAAiC;yBAC5B;wBACH,MAAM,IAAI,mCAAgB,CACxB,iBAAiB,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,kBAAkB,EAAE,UAAU,CAAC,EAC5F,SAAS,EACT,SAAS,EACT,KAAK,EACL,UAAU,CACX,CAAC;qBACH;iBACF;gBACD,qBAAqB;gBACrB,MAAM,IAAI,mCAAgB,CAAC,iBAAiB,CAAC,aAAa,EAAE,KAAK,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;aAClG;QACH,CAAC;KAAA;IAES,UAAU,CAAC,OAAuD;QAC1E,OAAO,OAAiC,CAAC;IAC3C,CAAC;CACF;AAhED,kCAgEC","sourcesContent":["import { HttpResponseModel } from \"@odata2ts/http-client-api\";\nimport { BaseHttpClient, BaseHttpClientOptions, HttpMethods } from \"@odata2ts/http-client-base\";\nimport axios, {\n AxiosError,\n AxiosInstance,\n AxiosResponseHeaders,\n AxiosRequestConfig as OriginalRequestConfig,\n RawAxiosResponseHeaders,\n} from \"axios\";\n\nimport { AxiosClientError } from \"./AxiosClientError\";\nimport { AxiosRequestConfig, mergeConfig } from \"./AxiosRequestConfig\";\n\nexport interface ClientOptions extends BaseHttpClientOptions {}\n\nexport const DEFAULT_ERROR_MESSAGE = \"No error message!\";\nconst FAILURE_NO_RESPONSE = \"No response from server! Failure: \";\nconst FAILURE_NO_REQUEST = \"No request was sent! Failure: \";\nconst FAILURE_RESPONSE_MESSAGE = \"OData server responded with error: \";\nconst FAILURE_AXIOS = \"Fatal Axios failure: \";\n\nfunction buildErrorMessage(prefix: string, error: any) {\n const msg = typeof error === \"string\" ? error : (error as Error)?.message;\n return prefix + (msg || DEFAULT_ERROR_MESSAGE);\n}\n\nexport class AxiosClient extends BaseHttpClient<AxiosRequestConfig> {\n protected readonly client: AxiosInstance;\n\n constructor(config?: AxiosRequestConfig, private clientOptions?: ClientOptions) {\n super(clientOptions);\n this.client = axios.create(config);\n }\n\n protected addHeaderToRequestConfig(\n headers: Record<string, string>,\n config: AxiosRequestConfig | undefined\n ): AxiosRequestConfig {\n return mergeConfig({ headers }, config);\n }\n\n protected async executeRequest<ResponseModel>(\n method: HttpMethods,\n url: string,\n data: any,\n requestConfig: AxiosRequestConfig | undefined = {}\n ): Promise<HttpResponseModel<ResponseModel>> {\n // add URL and HTTP method to the request config\n const config: OriginalRequestConfig = mergeConfig(requestConfig, { url, method });\n if (typeof data !== \"undefined\") {\n config.data = data;\n }\n\n try {\n return await this.client.request(config);\n } catch (error: any) {\n if ((error as AxiosError).isAxiosError) {\n const axiosError = error as AxiosError;\n\n // regular failure handling\n if (axiosError.response) {\n const errMsg = this.retrieveErrorMessage(axiosError.response.data);\n const msg = buildErrorMessage(FAILURE_RESPONSE_MESSAGE, errMsg);\n throw new AxiosClientError(\n msg,\n axiosError.response.status,\n this.mapHeaders(axiosError.response.headers),\n new Error(errMsg || DEFAULT_ERROR_MESSAGE),\n axiosError\n );\n }\n // fatal failure without response\n else {\n throw new AxiosClientError(\n buildErrorMessage(axiosError.request ? FAILURE_NO_RESPONSE : FAILURE_NO_REQUEST, axiosError),\n undefined,\n undefined,\n error,\n axiosError\n );\n }\n }\n // not an Axios error\n throw new AxiosClientError(buildErrorMessage(FAILURE_AXIOS, error), undefined, undefined, error);\n }\n }\n\n protected mapHeaders(headers: AxiosResponseHeaders | RawAxiosResponseHeaders): Record<string, string> {\n return headers as Record<string, string>;\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { CreateAxiosDefaults, AxiosRequestConfig as OriginalRequestConfig } from "axios";
1
+ import { AxiosRequestConfig as OriginalRequestConfig } from "axios";
2
2
  export interface AxiosRequestConfig extends Omit<OriginalRequestConfig, "method" | "url" | "headers"> {
3
3
  headers?: Record<string, string>;
4
4
  }
@@ -6,6 +6,5 @@ export interface InternalRequestConfig extends Omit<OriginalRequestConfig, "head
6
6
  url?: string;
7
7
  headers?: Record<string, string>;
8
8
  }
9
- export declare function getDefaultConfig(config?: AxiosRequestConfig | undefined): CreateAxiosDefaults;
10
9
  export declare function mergeConfig(): undefined;
11
10
  export declare function mergeConfig(...configs: Array<InternalRequestConfig | undefined>): InternalRequestConfig;
@@ -1,14 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mergeConfig = exports.getDefaultConfig = void 0;
3
+ exports.mergeConfig = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const DEFAULT_CONFIG = {
6
- headers: { Accept: "application/json", "Content-Type": "application/json" },
7
- };
8
- function getDefaultConfig(config) {
9
- return mergeConfig(DEFAULT_CONFIG, config);
10
- }
11
- exports.getDefaultConfig = getDefaultConfig;
12
5
  function mergeConfig(...configs) {
13
6
  if (!configs.length) {
14
7
  return undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"AxiosRequestConfig.js","sourceRoot":"","sources":["../src/AxiosRequestConfig.ts"],"names":[],"mappings":";;;;AAWA,MAAM,cAAc,GAA0B;IAC5C,OAAO,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE,cAAc,EAAE,kBAAkB,EAAE;CAC5E,CAAC;AAEF,SAAgB,gBAAgB,CAAC,MAAuC;IACtE,OAAO,WAAW,CAAC,cAAc,EAAE,MAA+B,CAAwB,CAAC;AAC7F,CAAC;AAFD,4CAEC;AAID,SAAgB,WAAW,CAAC,GAAG,OAAiD;IAC9E,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;QACnB,OAAO,SAAS,CAAC;KAClB;IAED,OAAO,OAAO;SACX,MAAM,CAAC,CAAC,CAAC,EAA8B,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;SAC9C,MAAM,CACL,CAAC,SAAS,EAAE,OAAO,EAAE,EAAE;QACrB,MAAM,EAAE,OAAO,KAAqB,OAAO,EAAvB,WAAW,kBAAK,OAAO,EAArC,WAA2B,CAAU,CAAC;QAE5C,IAAI,OAAO,EAAE;YACX,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,OAAQ,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;SAClF;QACD,uCAAY,SAAS,GAAK,WAAW,EAAG;IAC1C,CAAC,EACD,EAAE,OAAO,EAAE,EAAE,EAAE,CAChB,CAAC;AACN,CAAC;AAlBD,kCAkBC","sourcesContent":["import { CreateAxiosDefaults, AxiosRequestConfig as OriginalRequestConfig } from \"axios\";\n\nexport interface AxiosRequestConfig extends Omit<OriginalRequestConfig, \"method\" | \"url\" | \"headers\"> {\n headers?: Record<string, string>;\n}\n\nexport interface InternalRequestConfig extends Omit<OriginalRequestConfig, \"headers\"> {\n url?: string;\n headers?: Record<string, string>;\n}\n\nconst DEFAULT_CONFIG: InternalRequestConfig = {\n headers: { Accept: \"application/json\", \"Content-Type\": \"application/json\" },\n};\n\nexport function getDefaultConfig(config?: AxiosRequestConfig | undefined): CreateAxiosDefaults {\n return mergeConfig(DEFAULT_CONFIG, config as InternalRequestConfig) as CreateAxiosDefaults;\n}\n\nexport function mergeConfig(): undefined;\nexport function mergeConfig(...configs: Array<InternalRequestConfig | undefined>): InternalRequestConfig;\nexport function mergeConfig(...configs: Array<InternalRequestConfig | undefined>) {\n if (!configs.length) {\n return undefined;\n }\n\n return configs\n .filter((c): c is InternalRequestConfig => !!c)\n .reduce<InternalRequestConfig>(\n (collector, current) => {\n const { headers, ...passThrough } = current;\n\n if (headers) {\n Object.entries(headers).forEach(([key, val]) => (collector.headers![key] = val));\n }\n return { ...collector, ...passThrough };\n },\n { headers: {} }\n );\n}\n"]}
1
+ {"version":3,"file":"AxiosRequestConfig.js","sourceRoot":"","sources":["../src/AxiosRequestConfig.ts"],"names":[],"mappings":";;;;AAaA,SAAgB,WAAW,CAAC,GAAG,OAAiD;IAC9E,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;QACnB,OAAO,SAAS,CAAC;KAClB;IAED,OAAO,OAAO;SACX,MAAM,CAAC,CAAC,CAAC,EAA8B,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;SAC9C,MAAM,CACL,CAAC,SAAS,EAAE,OAAO,EAAE,EAAE;QACrB,MAAM,EAAE,OAAO,KAAqB,OAAO,EAAvB,WAAW,kBAAK,OAAO,EAArC,WAA2B,CAAU,CAAC;QAE5C,IAAI,OAAO,EAAE;YACX,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,OAAQ,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;SAClF;QACD,uCAAY,SAAS,GAAK,WAAW,EAAG;IAC1C,CAAC,EACD,EAAE,OAAO,EAAE,EAAE,EAAE,CAChB,CAAC;AACN,CAAC;AAlBD,kCAkBC","sourcesContent":["import { CreateAxiosDefaults, AxiosRequestConfig as OriginalRequestConfig } from \"axios\";\n\nexport interface AxiosRequestConfig extends Omit<OriginalRequestConfig, \"method\" | \"url\" | \"headers\"> {\n headers?: Record<string, string>;\n}\n\nexport interface InternalRequestConfig extends Omit<OriginalRequestConfig, \"headers\"> {\n url?: string;\n headers?: Record<string, string>;\n}\n\nexport function mergeConfig(): undefined;\nexport function mergeConfig(...configs: Array<InternalRequestConfig | undefined>): InternalRequestConfig;\nexport function mergeConfig(...configs: Array<InternalRequestConfig | undefined>) {\n if (!configs.length) {\n return undefined;\n }\n\n return configs\n .filter((c): c is InternalRequestConfig => !!c)\n .reduce<InternalRequestConfig>(\n (collector, current) => {\n const { headers, ...passThrough } = current;\n\n if (headers) {\n Object.entries(headers).forEach(([key, val]) => (collector.headers![key] = val));\n }\n return { ...collector, ...passThrough };\n },\n { headers: {} }\n );\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odata2ts/http-client-axios",
3
- "version": "0.8.1",
3
+ "version": "0.9.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -34,7 +34,7 @@
34
34
  "axios": "^0.27.0 || ^1.0.0"
35
35
  },
36
36
  "dependencies": {
37
- "@odata2ts/http-client-base": "^0.2.0"
37
+ "@odata2ts/http-client-base": "^0.3.0"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/jest": "^27.4.1",
@@ -47,5 +47,5 @@
47
47
  "typescript": "5.0.4"
48
48
  },
49
49
  "types": "./lib/index.d.ts",
50
- "gitHead": "9babd2df3010673249e7e3fa26705a8ba84f2cef"
50
+ "gitHead": "dc6e29cef27b2f5fca6e838e4a22766b90249e8e"
51
51
  }