odsl-javascript-sdk 1.1.10 → 1.1.11
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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "odsl-javascript-sdk",
|
|
3
3
|
"type": "commonjs",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.11",
|
|
5
5
|
"description": "Javascript SDK for OpenDataDSL",
|
|
6
6
|
"main": "src/odsl.js",
|
|
7
7
|
"scripts": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@azure/identity": "^4.13.0",
|
|
30
30
|
"@azure/msal-node": "^2.6.6",
|
|
31
31
|
"@azure/service-bus": "^7.9.5",
|
|
32
|
-
"
|
|
32
|
+
"axios": "^1.13.6",
|
|
33
33
|
"xmlhttprequest": "^1.8.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
package/src/odsl.js
CHANGED
|
@@ -3,6 +3,7 @@ const { ConfidentialClientApplication } = require("@azure/msal-node");
|
|
|
3
3
|
const { PublicClientApplication } = require("@azure/msal-browser");
|
|
4
4
|
const { XMLHttpRequest } = require("xmlhttprequest");
|
|
5
5
|
const PROCESS = require("./process.js");
|
|
6
|
+
const axios = require("axios");
|
|
6
7
|
|
|
7
8
|
const msalConfig = {
|
|
8
9
|
"auth": {
|
|
@@ -112,7 +113,7 @@ module.exports = class ODSL_SDK {
|
|
|
112
113
|
console.log("GET request Failed: " + err);
|
|
113
114
|
}
|
|
114
115
|
}
|
|
115
|
-
|
|
116
|
+
updateold(service, source, body) {
|
|
116
117
|
try {
|
|
117
118
|
var xhttp = new XMLHttpRequest();
|
|
118
119
|
var url = new URL(this.host + service + "/v1/" + source);
|
|
@@ -128,4 +129,24 @@ module.exports = class ODSL_SDK {
|
|
|
128
129
|
console.log("GET request Failed: " + err);
|
|
129
130
|
}
|
|
130
131
|
}
|
|
132
|
+
async update(service, source, body) {
|
|
133
|
+
try {
|
|
134
|
+
var options = {
|
|
135
|
+
method: 'POST',
|
|
136
|
+
url: this.host + service + "/v1/" + source,
|
|
137
|
+
headers: {
|
|
138
|
+
Authorization: "Bearer " + this.token
|
|
139
|
+
},
|
|
140
|
+
data: body
|
|
141
|
+
}
|
|
142
|
+
const response = await axios(options);
|
|
143
|
+
|
|
144
|
+
if (response.status < 200 || response.status >= 300) {
|
|
145
|
+
throw response.headers("x-odsl-error");
|
|
146
|
+
}
|
|
147
|
+
return response.data;
|
|
148
|
+
} catch (err) {
|
|
149
|
+
console.log("UPDATE request Failed: " + err);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
131
152
|
}
|
|
File without changes
|
|
File without changes
|