@axazure/pcf-proxy-dynamics 1.0.17 → 1.0.20
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/README.md +4 -4
- package/dist/server.js +9 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,11 +20,11 @@ component logic in real time, avoiding the heavy deploy-test cycle.
|
|
|
20
20
|
|
|
21
21
|
## 1. Installation
|
|
22
22
|
```js
|
|
23
|
-
npm
|
|
23
|
+
npm i @axazure/pcf-proxy-dynamics
|
|
24
24
|
```
|
|
25
25
|
Add the backend script if it’s missing:
|
|
26
26
|
```js
|
|
27
|
-
"start:backend": "node ./node_modules/@
|
|
27
|
+
"start:backend": "node ./node_modules/@axazure/pcf-proxy-dynamics/dist/server.js"
|
|
28
28
|
```
|
|
29
29
|
Start your local dev environment:
|
|
30
30
|
```{r, engine='bash', count_lines}
|
|
@@ -39,7 +39,7 @@ Proxy base URL: http://localhost:3001
|
|
|
39
39
|
var _userSettings, _recordId, _entityName;
|
|
40
40
|
|
|
41
41
|
if (document.location.host.includes('localhost')) {
|
|
42
|
-
const { WebApiProxy } = require("@
|
|
42
|
+
const { WebApiProxy } = require("@axazure/pcf-proxy-dynamics");
|
|
43
43
|
_api = new WebApiProxy("http://localhost:3001");
|
|
44
44
|
_userSettings = {} as ComponentFramework.UserSettings;
|
|
45
45
|
_userSettings.userId = "00000000-0000-0000-0000-000000000000";
|
|
@@ -92,7 +92,7 @@ Proxy base URL: http://localhost:3001
|
|
|
92
92
|
var _userSettings, _recordId, _entityName = null;
|
|
93
93
|
|
|
94
94
|
if (document.location.host.includes('localhost')) {
|
|
95
|
-
const { WebApiProxy } = require("@
|
|
95
|
+
const { WebApiProxy } = require("@axazure/pcf-proxy-dynamics");
|
|
96
96
|
_api = new WebApiProxy("http://localhost:3001");
|
|
97
97
|
_userSettings = {} as ComponentFramework.UserSettings;
|
|
98
98
|
_userSettings.userId = "00000000-0000-0000-0000-000000000000";
|
package/dist/server.js
CHANGED
|
@@ -170,7 +170,15 @@ app.get('/api/data/v9.2/:entityType\\(:id\\)', (req, res) => __awaiter(void 0, v
|
|
|
170
170
|
method: 'GET',
|
|
171
171
|
headers: _headers
|
|
172
172
|
});
|
|
173
|
-
const data = yield response
|
|
173
|
+
const data = yield response;
|
|
174
|
+
if (data == null) {
|
|
175
|
+
res.status(500).json({ error: 'No data retrieved' });
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
if (!response.ok) {
|
|
179
|
+
res.status(500).json({ error: 'Error retrieving records', details: response.statusText });
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
174
182
|
res.json(data);
|
|
175
183
|
}
|
|
176
184
|
catch (error) {
|
|
@@ -191,7 +199,6 @@ app.get('/api/data/v9.2/:entityType', (req, res) => __awaiter(void 0, void 0, vo
|
|
|
191
199
|
method: 'GET',
|
|
192
200
|
headers: _headers
|
|
193
201
|
});
|
|
194
|
-
console.log('Data retrieved : ' + JSON.stringify(response));
|
|
195
202
|
const data = yield response;
|
|
196
203
|
if (data == null) {
|
|
197
204
|
res.status(500).json({ error: 'No data retrieved' });
|
|
@@ -201,7 +208,6 @@ app.get('/api/data/v9.2/:entityType', (req, res) => __awaiter(void 0, void 0, vo
|
|
|
201
208
|
res.status(500).json({ error: 'Error retrieving records', details: response.statusText });
|
|
202
209
|
return;
|
|
203
210
|
}
|
|
204
|
-
console.log('Data retrieved:', data);
|
|
205
211
|
res.json(data);
|
|
206
212
|
}));
|
|
207
213
|
// Execute operation
|