@odata2ts/http-client-jquery 0.9.2 → 0.10.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 +45 -0
- package/LICENSE +21 -21
- package/lib/JQueryClient.d.ts +1 -1
- package/lib/JQueryClient.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/package.json +7 -8
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,51 @@
|
|
|
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.10.0](https://github.com/odata2ts/http-client/compare/@odata2ts/jquery-v0.9.3...@odata2ts/jquery-v0.10.0) (2025-03-26)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### ⚠ BREAKING CHANGES
|
|
10
|
+
|
|
11
|
+
* switch to ESM tends to break stuff
|
|
12
|
+
* additional headers are now part of the config parameter
|
|
13
|
+
* **jquery:** removed default accept & content-type headers as well as `dataType=json`; removed merge & retrieveBigNumbersAsString methods (base-lib); all of these settings can now be configured per operation via the `additionalHeaders` option.
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* 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))
|
|
18
|
+
* blob and stream support ([#12](https://github.com/odata2ts/http-client/issues/12)) ([ae6f062](https://github.com/odata2ts/http-client/commit/ae6f062371a0ad11707fa3f9edff9571998edb5b))
|
|
19
|
+
* conventionalize client errors ([#5](https://github.com/odata2ts/http-client/issues/5)) ([a8e8912](https://github.com/odata2ts/http-client/commit/a8e89125eeda47436d48507d6a71efc90953f878))
|
|
20
|
+
* **jquery:** allow for query params ([afd13a8](https://github.com/odata2ts/http-client/commit/afd13a862dc07485c0f619a3e39521f7ce6fc65e))
|
|
21
|
+
* **jquery:** copy over jquery-client and rename ([#3](https://github.com/odata2ts/http-client/issues/3)) ([55deb6c](https://github.com/odata2ts/http-client/commit/55deb6c75159bfc46b0ae87cb3c0ec3afda9508e))
|
|
22
|
+
* switch to http-client-api ([52d1b86](https://github.com/odata2ts/http-client/commit/52d1b868ee82dbaf45486da6b22fdcf4c773dfb8))
|
|
23
|
+
* switch to http-client-api ([5a6da23](https://github.com/odata2ts/http-client/commit/5a6da23053b3ea5adb866bb7e30b469f1b8ed260))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Bug Fixes
|
|
27
|
+
|
|
28
|
+
* add ".js" suffix for all relative imports ([#20](https://github.com/odata2ts/http-client/issues/20)) ([961c910](https://github.com/odata2ts/http-client/commit/961c91002c8b1e9a7a6256cccd6b6d0ec9c142cd))
|
|
29
|
+
* always build all packages before release ([#26](https://github.com/odata2ts/http-client/issues/26)) ([a316f6c](https://github.com/odata2ts/http-client/commit/a316f6ce54c4360c8d6f87799ba6fd9c53bff52c))
|
|
30
|
+
* delete requests with Accept json header ([ea1b06d](https://github.com/odata2ts/http-client/commit/ea1b06d509b490e1e899e96a62a10eac3f65da8e))
|
|
31
|
+
* deploy with code ([#25](https://github.com/odata2ts/http-client/issues/25)) ([3e0e78c](https://github.com/odata2ts/http-client/commit/3e0e78cd2e0b0c3215bc0ed97dd62c75d8b6c5ea))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Code Refactoring
|
|
35
|
+
|
|
36
|
+
* expand additionalHeaders param to internalConfig ([#15](https://github.com/odata2ts/http-client/issues/15)) ([7fe1d73](https://github.com/odata2ts/http-client/commit/7fe1d73a7436f64b84a060bd1dbf9e121ef901ce))
|
|
37
|
+
* **jquery:** remove default headers ([3106d97](https://github.com/odata2ts/http-client/commit/3106d9768765e7cc228097ed1270439d47ff0e0c))
|
|
38
|
+
* switch to vitest & ESM ([#18](https://github.com/odata2ts/http-client/issues/18)) ([748558f](https://github.com/odata2ts/http-client/commit/748558f1e3f699085ade1058b1459c843f60994f))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### Dependencies
|
|
42
|
+
|
|
43
|
+
* The following workspace dependencies were updated
|
|
44
|
+
* dependencies
|
|
45
|
+
* @odata2ts/http-client-base bumped from ^0.5.3 to ^0.5.4
|
|
46
|
+
|
|
47
|
+
## [0.9.3](https://github.com/odata2ts/http-client/compare/@odata2ts/http-client-jquery@0.9.2...@odata2ts/http-client-jquery@0.9.3) (2024-08-24)
|
|
48
|
+
|
|
49
|
+
**Note:** Version bump only for package @odata2ts/http-client-jquery
|
|
50
|
+
|
|
6
51
|
## [0.9.2](https://github.com/odata2ts/http-client/compare/@odata2ts/http-client-jquery@0.9.1...@odata2ts/http-client-jquery@0.9.2) (2024-08-22)
|
|
7
52
|
|
|
8
53
|
**Note:** Version bump only for package @odata2ts/http-client-jquery
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2021 odata2ts
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 odata2ts
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/lib/JQueryClient.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/// <reference types="jquery/
|
|
1
|
+
/// <reference types="jquery/JQueryStatic" />
|
|
2
2
|
import { HttpResponseModel, ODataHttpClient } from "@odata2ts/http-client-api";
|
|
3
3
|
import { BaseHttpClient, BaseHttpClientOptions, HttpMethods, InternalHttpClientConfig } from "@odata2ts/http-client-base";
|
|
4
4
|
import { AjaxRequestConfig } from "./AjaxRequestConfig";
|
package/lib/JQueryClient.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JQueryClient.js","sourceRoot":"","sources":["../src/JQueryClient.ts"],"names":[],"mappings":";AAAA,8EAA8E;;;;AAG9E,iEAKoC;AACpC,2DAA2F;AAC3F,2DAAwD;AAI3C,QAAA,qBAAqB,GAAG,mBAAmB,CAAC;AAIzD,MAAa,YAAa,SAAQ,iCAAiC;IAIjE,YAAY,MAAoB,EAAE,MAA0B,EAAE,aAA6B;QACzF,KAAK,CAAC,aAAa,CAAC,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,IAAA,oCAAgB,EAAC,MAAM,CAAC,CAAC;IACzC,CAAC;IAES,UAAU,CAAC,KAAY;QAC/B,OAAO,KAAK;aACT,qBAAqB,EAAE;aACvB,IAAI,EAAE;aACN,KAAK,CAAC,SAAS,CAAC;aAChB,MAAM,CAAC,CAAC,SAAiC,EAAE,IAAY,EAAE,EAAE;YAC1D,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAC/B,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC;YAC7B,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAE/B,IAAI,MAAM,EAAE;gBACV,SAAS,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,GAAG,KAAK,CAAC;aACzC;YACD,OAAO,SAAS,CAAC;QACnB,CAAC,EAAE,EAAE,CAAC,CAAC;IACX,CAAC;IAEe,cAAc,CAC5B,MAAmB,EACnB,GAAW,EACX,IAAS,EACT,aAAmC,EACnC,iBAA2C,EAAE;;YAE7C,MAAM,kBAAkB,GAAG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C,UAAU,CAAC,KAAK,CAAC;4BAC/B,IAAI,EAAE,QAAQ;yBACf,CAAC,CAAC;oBACL,CAAC,EACD,KAAK,EAAE,CAAC,KAAmB,EAAE,UAAkB,EAAE,WAAmB,EAAE,EAAE;wBACtE,MAAM,eAAe,GAAG,IAAI,CAAC,oBAAoB,CAAC,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,YAAY,CAAC,CAAC;wBACvE,MAAM,OAAO,GAAG,eAAe,IAAI,WAAW,IAAI,6BAAqB,CAAC;wBACxE,MAAM,YAAY,GAAG,eAAe,CAAC,CAAC,CAAC,qCAAqC,GAAG,eAAe,CAAC,CAAC,CAAC,OAAO,CAAC;wBACzG,MAAM,eAAe,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;wBAC/C,MAAM,CAAC,IAAI,qCAAiB,CAAC,YAAY,EAAE,KAAK,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;oBACxG,CAAC,IACD,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC;KAAA;CACF;AA1ED,oCA0EC","sourcesContent":["/// <reference path=\"../../../node_modules/@types/jquery/JQueryStatic.d.ts\" />\
|
|
1
|
+
{"version":3,"file":"JQueryClient.js","sourceRoot":"","sources":["../src/JQueryClient.ts"],"names":[],"mappings":";AAAA,8EAA8E;;;;AAG9E,iEAKoC;AACpC,2DAA2F;AAC3F,2DAAwD;AAI3C,QAAA,qBAAqB,GAAG,mBAAmB,CAAC;AAIzD,MAAa,YAAa,SAAQ,iCAAiC;IAIjE,YAAY,MAAoB,EAAE,MAA0B,EAAE,aAA6B;QACzF,KAAK,CAAC,aAAa,CAAC,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,IAAA,oCAAgB,EAAC,MAAM,CAAC,CAAC;IACzC,CAAC;IAES,UAAU,CAAC,KAAY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AAC,CAAC,CAAC;oBACxG,CAAC,IACD,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC;KAAA;CACF;AA1ED,oCA0EC","sourcesContent":["/// <reference path=\"../../../node_modules/@types/jquery/JQueryStatic.d.ts\" />\n\nimport { HttpResponseModel, ODataHttpClient } from \"@odata2ts/http-client-api\";\nimport {\n BaseHttpClient,\n BaseHttpClientOptions,\n HttpMethods,\n InternalHttpClientConfig,\n} from \"@odata2ts/http-client-base\";\nimport { AjaxRequestConfig, getDefaultConfig, mergeAjaxConfig } from \"./AjaxRequestConfig\";\nimport { JQueryClientError } from \"./JQueryClientError\";\n\nimport jqXHR = JQuery.jqXHR;\n\nexport const DEFAULT_ERROR_MESSAGE = \"No error message!\";\n\nexport interface ClientOptions extends BaseHttpClientOptions {}\n\nexport class JQueryClient extends BaseHttpClient<AjaxRequestConfig> implements ODataHttpClient<AjaxRequestConfig> {\n private readonly client: JQueryStatic;\n private readonly config: JQuery.AjaxSettings;\n\n constructor(jquery: JQueryStatic, config?: AjaxRequestConfig, clientOptions?: ClientOptions) {\n super(clientOptions);\n this.client = jquery;\n this.config = getDefaultConfig(config);\n }\n\n protected mapHeaders(jqXhr: jqXHR): Record<string, string> {\n return jqXhr\n .getAllResponseHeaders()\n .trim()\n .split(/[\\r\\n]+/)\n .reduce((collector: Record<string, string>, line: string) => {\n const parts = line.split(\": \");\n const header = parts.shift();\n const value = parts.join(\": \");\n\n if (header) {\n collector[header.toLowerCase()] = value;\n }\n return collector;\n }, {});\n }\n\n protected async executeRequest<ResponseModel>(\n method: HttpMethods,\n url: string,\n data: any,\n requestConfig?: JQuery.AjaxSettings,\n internalConfig: InternalHttpClientConfig = {},\n ): Promise<HttpResponseModel<ResponseModel>> {\n const withInternalConfig = mergeAjaxConfig({ headers: internalConfig.headers }, requestConfig);\n const { params, ...mergedConfig } = mergeAjaxConfig(this.config, withInternalConfig);\n mergedConfig.method = method;\n mergedConfig.data = JSON.stringify(data);\n mergedConfig.url = url;\n if (params && Object.values(params).length) {\n mergedConfig.url +=\n (url.match(/\\?/) ? \"&\" : \"?\") +\n // @ts-ignore\n new URLSearchParams(params).toString();\n }\n\n if (internalConfig.dataType === \"blob\") {\n mergedConfig.xhrFields = { responseType: \"blob\" };\n } else if (internalConfig.dataType === \"stream\") {\n throw new Error(\"Streaming is not supported by the JqueryClient!\");\n }\n\n // the actual request\n return new Promise((resolve, reject) => {\n this.client.ajax({\n ...mergedConfig,\n success: (response: any, textStatus: string, jqXHR: JQuery.jqXHR) => {\n resolve({\n status: jqXHR.status,\n statusText: jqXHR.statusText,\n headers: this.mapHeaders(jqXHR),\n data: response,\n });\n },\n error: (jqXHR: JQuery.jqXHR, textStatus: string, thrownError: string) => {\n const responseMessage = this.retrieveErrorMessage(jqXHR?.responseJSON);\n const failMsg = responseMessage || thrownError || DEFAULT_ERROR_MESSAGE;\n const errorMessage = responseMessage ? \"OData server responded with error: \" + responseMessage : failMsg;\n const responseHeaders = this.mapHeaders(jqXHR);\n reject(new JQueryClientError(errorMessage, jqXHR.status, responseHeaders, new Error(failMsg), jqXHR));\n },\n });\n });\n }\n}\n"]}
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AACA,yDAA+B;AAC/B,yDAAwD;AAA/C,sHAAA,iBAAiB,OAAA","sourcesContent":["export { AjaxRequestConfig } from \"./AjaxRequestConfig\";\
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AACA,yDAA+B;AAC/B,yDAAwD;AAA/C,sHAAA,iBAAiB,OAAA","sourcesContent":["export { AjaxRequestConfig } from \"./AjaxRequestConfig\";\nexport * from \"./JQueryClient\";\nexport { JQueryClientError } from \"./JQueryClientError\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@odata2ts/http-client-jquery",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "JQuery based http client usable by odata2ts",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"http client",
|
|
@@ -26,12 +26,12 @@
|
|
|
26
26
|
"check-circular-deps": "madge ./src --extensions ts --circular",
|
|
27
27
|
"clean": "rimraf lib coverage",
|
|
28
28
|
"compile": "tsc",
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"test": "vitest run
|
|
29
|
+
"unit-test": "vitest run --dir test",
|
|
30
|
+
"int-test": "vitest run --dir int-test",
|
|
31
|
+
"test": "vitest run"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@odata2ts/http-client-base": "^0.5.
|
|
34
|
+
"@odata2ts/http-client-base": "^0.5.4"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/jquery": "^3.5.16",
|
|
@@ -45,6 +45,5 @@
|
|
|
45
45
|
},
|
|
46
46
|
"publishConfig": {
|
|
47
47
|
"access": "public"
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
}
|
|
48
|
+
}
|
|
49
|
+
}
|