@odata2ts/odata2ts 0.39.0 → 0.39.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.
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
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.39.1](https://github.com/odata2ts/odata2ts/compare/@odata2ts/odata2ts@0.39.0...@odata2ts/odata2ts@0.39.1) (2024-12-18)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **odata2ts:** add Accept header for metadata downloads ([#340](https://github.com/odata2ts/odata2ts/issues/340)) ([dcdd997](https://github.com/odata2ts/odata2ts/commit/dcdd9975ee9f34bf0474c22372db39fcb80e9bae))
|
|
11
|
+
|
|
6
12
|
# [0.39.0](https://github.com/odata2ts/odata2ts/compare/@odata2ts/odata2ts@0.38.1...@odata2ts/odata2ts@0.39.0) (2024-10-28)
|
|
7
13
|
|
|
8
14
|
### Features
|
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
import { __awaiter, __rest } from "tslib";
|
|
2
2
|
import axios from "axios";
|
|
3
|
+
import deepmerge from "deepmerge";
|
|
3
4
|
const METADATA_PATH = "$metadata";
|
|
4
5
|
const PWD_BLIND_TEXT = { password: "xxx hidden xxx" };
|
|
5
6
|
function evaluateRequestConfig(url, config) {
|
|
6
|
-
const defaultReqConfig = {
|
|
7
|
+
const defaultReqConfig = {
|
|
8
|
+
url: url,
|
|
9
|
+
method: "GET",
|
|
10
|
+
headers: {
|
|
11
|
+
// Added Accept: "application/xml" to ensure OData API servers
|
|
12
|
+
// return metadata in XML format, as axios defaults to application/json.
|
|
13
|
+
Accept: "application/xml",
|
|
14
|
+
},
|
|
15
|
+
};
|
|
7
16
|
const reqConfig = config.custom
|
|
8
17
|
? config.custom
|
|
9
18
|
: typeof config.username === "string" && typeof (config === null || config === void 0 ? void 0 : config.password) === "string"
|
|
10
19
|
? { auth: { username: config.username, password: config.password } }
|
|
11
20
|
: {};
|
|
12
|
-
return
|
|
21
|
+
return deepmerge(defaultReqConfig, reqConfig);
|
|
13
22
|
}
|
|
14
23
|
/**
|
|
15
24
|
* Retrieves the metadata from the given URL using the given configuration.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"downloadMetadata.js","sourceRoot":"","sources":["../../src/download/downloadMetadata.ts"],"names":[],"mappings":";AAAA,OAAO,KAA6B,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"downloadMetadata.js","sourceRoot":"","sources":["../../src/download/downloadMetadata.ts"],"names":[],"mappings":";AAAA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAClD,OAAO,SAAS,MAAM,WAAW,CAAC;AAGlC,MAAM,aAAa,GAAG,WAAW,CAAC;AAClC,MAAM,cAAc,GAAG,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAC;AAEtD,SAAS,qBAAqB,CAAC,GAAW,EAAE,MAA8B;IACxE,MAAM,gBAAgB,GAAuB;QAC3C,GAAG,EAAE,GAAG;QACR,MAAM,EAAE,KAAK;QACb,OAAO,EAAE;YACP,8DAA8D;YAC9D,wEAAwE;YACxE,MAAM,EAAE,iBAAiB;SAC1B;KACF,CAAC;IACF,MAAM,SAAS,GAAuB,MAAM,CAAC,MAAM;QACjD,CAAC,CAAC,MAAM,CAAC,MAAM;QACf,CAAC,CAAC,OAAO,MAAM,CAAC,QAAQ,KAAK,QAAQ,IAAI,OAAO,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,QAAQ,CAAA,KAAK,QAAQ;YAC3E,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,EAAE;YACpE,CAAC,CAAC,EAAE,CAAC;IACT,OAAO,SAAS,CAAC,gBAAgB,EAAE,SAAS,CAAC,CAAC;AAChD,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAgB,gBAAgB,CACpC,SAAiB,EACjB,eAAuC,EAAE,EACzC,QAAiB,KAAK;;QAEtB,2BAA2B;QAC3B,MAAM,GAAG,GAAG,SAAS,CAAC,QAAQ,CAAC,aAAa,CAAC;YAC3C,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,SAAS,GAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC;QACrE,OAAO,CAAC,GAAG,CAAC,4BAA4B,EAAE,GAAG,CAAC,CAAC;QAE/C,6CAA6C;QAC7C,MAAM,MAAM,GAAG,qBAAqB,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;QAExD,6CAA6C;QAC7C,IAAI,KAAK,EAAE;YACT,MAAM,EAAE,IAAI,KAAkB,MAAM,EAAnB,QAAQ,UAAK,MAAM,EAA9B,QAAqB,CAAS,CAAC;YACrC,MAAM,UAAU,GAAG,IAAI,CAAC,CAAC,iCAAM,QAAQ,KAAE,IAAI,kCAAO,IAAI,GAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC;YAClH,OAAO,CAAC,GAAG,CAAC,wBAAwB,EAAE,UAAU,CAAC,CAAC;SACnD;QAED,6CAA6C;QAC7C,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC7C,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;CAAA","sourcesContent":["import axios, { AxiosRequestConfig } from \"axios\";\r\nimport deepmerge from \"deepmerge\";\r\nimport { UrlSourceConfiguration } from \"../OptionModel.js\";\r\n\r\nconst METADATA_PATH = \"$metadata\";\r\nconst PWD_BLIND_TEXT = { password: \"xxx hidden xxx\" };\r\n\r\nfunction evaluateRequestConfig(url: string, config: UrlSourceConfiguration): AxiosRequestConfig {\r\n const defaultReqConfig: AxiosRequestConfig = {\r\n url: url,\r\n method: \"GET\",\r\n headers: {\r\n // Added Accept: \"application/xml\" to ensure OData API servers\r\n // return metadata in XML format, as axios defaults to application/json.\r\n Accept: \"application/xml\",\r\n },\r\n };\r\n const reqConfig: AxiosRequestConfig = config.custom\r\n ? config.custom\r\n : typeof config.username === \"string\" && typeof config?.password === \"string\"\r\n ? { auth: { username: config.username, password: config.password } }\r\n : {};\r\n return deepmerge(defaultReqConfig, reqConfig);\r\n}\r\n\r\n/**\r\n * Retrieves the metadata from the given URL using the given configuration.\r\n *\r\n * Failure handling must be implemented by consumer.\r\n * Exception is thrown for failed requests (400, 401, ...).\r\n *\r\n * @param sourceUrl\r\n * @param sourceConfig\r\n * @param debug\r\n */\r\nexport async function downloadMetadata(\r\n sourceUrl: string,\r\n sourceConfig: UrlSourceConfiguration = {},\r\n debug: boolean = false,\r\n): Promise<string> {\r\n // add the $metadata suffix\r\n const url = sourceUrl.endsWith(METADATA_PATH)\r\n ? sourceUrl\r\n : sourceUrl + (sourceUrl.endsWith(\"/\") ? \"\" : \"/\") + METADATA_PATH;\r\n console.log(`Reading metadata from URL:`, url);\r\n\r\n // evaluate configured request config options\r\n const config = evaluateRequestConfig(url, sourceConfig);\r\n\r\n // log request configuration without password\r\n if (debug) {\r\n const { auth, ...loggable } = config;\r\n const safeConfig = auth ? { ...loggable, auth: { ...auth, ...(auth.password ? PWD_BLIND_TEXT : {}) } } : loggable;\r\n console.log(`Request configuration:`, safeConfig);\r\n }\r\n\r\n // execute the request & return response data\r\n const response = await axios.request(config);\r\n return response.data;\r\n}\r\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@odata2ts/odata2ts",
|
|
3
|
-
"version": "0.39.
|
|
3
|
+
"version": "0.39.1",
|
|
4
4
|
"description": "Flexible generator to produce various TypeScript artefacts (from simple model interfaces to complete odata clients) from OData metadata files",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"odata2ts",
|
|
@@ -69,19 +69,19 @@
|
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@odata2ts/converter-v2-to-v4": "^0.5.1",
|
|
72
|
-
"@odata2ts/odata-query-objects": "^0.
|
|
73
|
-
"@odata2ts/odata-service": "^0.22.
|
|
72
|
+
"@odata2ts/odata-query-objects": "^0.27.0",
|
|
73
|
+
"@odata2ts/odata-service": "^0.22.1",
|
|
74
74
|
"@odata2ts/test-converters": "^0.5.0",
|
|
75
75
|
"@types/node": "^22.4.0"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
|
-
"@odata2ts/odata-query-objects": "^0.
|
|
79
|
-
"@odata2ts/odata-service": "^0.22.
|
|
78
|
+
"@odata2ts/odata-query-objects": "^0.27.0",
|
|
79
|
+
"@odata2ts/odata-service": "^0.22.1",
|
|
80
80
|
"typescript": ">= 4.7"
|
|
81
81
|
},
|
|
82
82
|
"publishConfig": {
|
|
83
83
|
"access": "public"
|
|
84
84
|
},
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "49e2baafde845055e04903c7b0fcd42787d9441e",
|
|
86
86
|
"readme": "README.md"
|
|
87
87
|
}
|