node-red-contrib-mobius-flow-base 3.1.7 → 3.3.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/dist/engine-api-calls.d.ts +41 -34
- package/dist/engine-api-calls.js +361 -259
- package/dist/engine-api-client.d.ts +0 -1
- package/dist/engine-api-client.js +1 -1
- package/dist/nodes/common/mobsearch.js +7 -3
- package/dist/nodes/mobius-clear-resource.js +96 -65
- package/dist/nodes/mobius-connection-interface.d.ts +1 -1
- package/dist/nodes/mobius-connection.js +2 -2
- package/dist/nodes/mobius-discover.html +43 -19
- package/dist/nodes/mobius-discover.js +8 -0
- package/dist/nodes/mobius-filter-by-rid-value.js +51 -3
- package/dist/nodes/mobius-flow-inject.js +40 -12
- package/dist/nodes/mobius-get-multi-object.html +98 -76
- package/dist/nodes/mobius-get-multi-object.js +22 -19
- package/dist/nodes/mobius-get-multi-resource.html +99 -75
- package/dist/nodes/mobius-get-multi-resource.js +22 -19
- package/dist/nodes/mobius-get-object.js +39 -7
- package/dist/nodes/mobius-get-resource.js +39 -7
- package/dist/nodes/mobius-send-bcmd.js +22 -3
- package/dist/nodes/mobius-set-multi-resource.js +73 -53
- package/dist/nodes/mobius-set-resource.js +57 -11
- package/package.json +1 -1
package/dist/engine-api-calls.js
CHANGED
|
@@ -1,306 +1,408 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EngineApiCalls = void 0;
|
|
4
|
+
const maxQueueLength = 25;
|
|
4
5
|
class EngineApiCalls {
|
|
5
6
|
apiClient = null;
|
|
6
|
-
|
|
7
|
+
loggedIn = false;
|
|
8
|
+
// queue of callback functions
|
|
9
|
+
messageQueue = { maxLength: 100, timestep: 500, interval: null, queue: [] };
|
|
10
|
+
constructor() {
|
|
11
|
+
this.startQueueInterval();
|
|
12
|
+
}
|
|
13
|
+
startQueueInterval = () => {
|
|
14
|
+
this.messageQueue.interval = setInterval(() => {
|
|
15
|
+
if (this.messageQueue.queue.length > this.messageQueue.maxLength) {
|
|
16
|
+
this.messageQueue.queue = this.messageQueue.queue.slice(-this.messageQueue.maxLength);
|
|
17
|
+
console.log(`Node-RED Engine API Client: Maximum queue length ${this.messageQueue.maxLength} reached. Dropping oldest message.`);
|
|
18
|
+
}
|
|
19
|
+
if (this.loggedIn) {
|
|
20
|
+
const func = this.messageQueue.queue.shift();
|
|
21
|
+
if (func) {
|
|
22
|
+
func();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}, this.messageQueue.timestep);
|
|
26
|
+
};
|
|
27
|
+
stopQueueInterval = () => {
|
|
28
|
+
if (this.messageQueue.interval) {
|
|
29
|
+
clearInterval(this.messageQueue.interval);
|
|
30
|
+
this.messageQueue.interval = null;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
7
33
|
setApiClient = (apiClient) => {
|
|
8
34
|
this.apiClient = apiClient;
|
|
9
35
|
};
|
|
36
|
+
setLoggedIn = (loggedIn) => {
|
|
37
|
+
this.loggedIn = loggedIn;
|
|
38
|
+
};
|
|
10
39
|
discover = async (uri, callback) => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
40
|
+
const func = async () => {
|
|
41
|
+
try {
|
|
42
|
+
if (!this.apiClient)
|
|
43
|
+
throw new Error('No API client set');
|
|
44
|
+
const response = await this.apiClient({
|
|
45
|
+
method: 'get',
|
|
46
|
+
url: `/mobius/discover/${uri}`,
|
|
47
|
+
});
|
|
48
|
+
callback(null, response.data);
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
if (err.response?.status === 404) {
|
|
52
|
+
callback(null, { ts: new Date().toISOString(), uri, data: [] });
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
callback(err);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
this.loggedIn ? func() : this.messageQueue.queue.push(func);
|
|
23
60
|
};
|
|
24
61
|
writeResource = async (uri, value, priority, callback) => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
62
|
+
const func = async () => {
|
|
63
|
+
try {
|
|
64
|
+
if (!this.apiClient)
|
|
65
|
+
throw new Error('No API client set');
|
|
66
|
+
const response = await this.apiClient({
|
|
67
|
+
method: 'patch',
|
|
68
|
+
url: `/mobius/object/resource/${uri}`,
|
|
69
|
+
data: {
|
|
70
|
+
value,
|
|
71
|
+
priority,
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
callback(null, response.data);
|
|
75
|
+
}
|
|
76
|
+
catch (err) {
|
|
77
|
+
callback(err);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
this.loggedIn ? func() : this.messageQueue.queue.push(func);
|
|
41
81
|
};
|
|
42
82
|
writeMultiResource = async (uri, updates, callback) => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
83
|
+
const func = async () => {
|
|
84
|
+
try {
|
|
85
|
+
if (!this.apiClient)
|
|
86
|
+
throw new Error('No API client set');
|
|
87
|
+
const response = await this.apiClient({
|
|
88
|
+
method: 'patch',
|
|
89
|
+
url: `/mobius/object/resource/${uri}`,
|
|
90
|
+
data: updates,
|
|
91
|
+
});
|
|
92
|
+
callback(null, response.data);
|
|
93
|
+
}
|
|
94
|
+
catch (err) {
|
|
95
|
+
callback(err);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
this.loggedIn ? func() : this.messageQueue.queue.push(func);
|
|
56
99
|
};
|
|
57
100
|
clearResource = async (uri, priority, callback) => {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
101
|
+
const func = async () => {
|
|
102
|
+
try {
|
|
103
|
+
if (!this.apiClient)
|
|
104
|
+
throw new Error('No API client set');
|
|
105
|
+
const response = await this.apiClient({
|
|
106
|
+
method: 'patch',
|
|
107
|
+
url: `/mobius/object/resource/clear/${uri}`,
|
|
108
|
+
data: {
|
|
109
|
+
priority,
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
callback(null, response.data);
|
|
113
|
+
}
|
|
114
|
+
catch (err) {
|
|
115
|
+
callback(err);
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
this.loggedIn ? func() : this.messageQueue.queue.push(func);
|
|
73
119
|
};
|
|
74
120
|
readResource = async (uri, callback) => {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
121
|
+
const func = async () => {
|
|
122
|
+
try {
|
|
123
|
+
if (!this.apiClient)
|
|
124
|
+
throw new Error('No API client set');
|
|
125
|
+
const response = await this.apiClient({
|
|
126
|
+
method: 'get',
|
|
127
|
+
url: `/mobius/object/resource/${uri}`,
|
|
128
|
+
});
|
|
129
|
+
callback(null, response.data);
|
|
130
|
+
}
|
|
131
|
+
catch (err) {
|
|
132
|
+
callback(err);
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
this.loggedIn ? func() : this.messageQueue.queue.push(func);
|
|
87
136
|
};
|
|
88
137
|
readObject = async (uri, callback) => {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
138
|
+
const func = async () => {
|
|
139
|
+
try {
|
|
140
|
+
if (!this.apiClient)
|
|
141
|
+
throw new Error('No API client set');
|
|
142
|
+
const response = await this.apiClient({
|
|
143
|
+
method: 'get',
|
|
144
|
+
url: `/mobius/object/${uri}`,
|
|
145
|
+
});
|
|
146
|
+
callback(null, response.data);
|
|
147
|
+
}
|
|
148
|
+
catch (err) {
|
|
149
|
+
callback(err);
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
this.loggedIn ? func() : this.messageQueue.queue.push(func);
|
|
101
153
|
};
|
|
102
|
-
sendBroadcastCommand = async (cid, commandData) => {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
154
|
+
sendBroadcastCommand = async (cid, commandData, callback) => {
|
|
155
|
+
const func = async () => {
|
|
156
|
+
try {
|
|
157
|
+
if (!this.apiClient)
|
|
158
|
+
throw new Error('No API client set');
|
|
159
|
+
const response = await this.apiClient({
|
|
160
|
+
method: 'post',
|
|
161
|
+
url: `/mobius/command/${cid}`,
|
|
162
|
+
data: commandData,
|
|
163
|
+
});
|
|
164
|
+
callback(null, 'Ok');
|
|
165
|
+
}
|
|
166
|
+
catch (err) {
|
|
167
|
+
callback(err);
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
this.loggedIn ? func() : this.messageQueue.queue.push(func);
|
|
115
171
|
};
|
|
116
172
|
sendDirectCommand = async (uri, cid, commandData, timeout, callback) => {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
173
|
+
const func = async () => {
|
|
174
|
+
try {
|
|
175
|
+
if (!this.apiClient)
|
|
176
|
+
throw new Error('No API client set');
|
|
177
|
+
const response = await this.apiClient({
|
|
178
|
+
method: 'post',
|
|
179
|
+
url: `/mobius/directCommand/${cid}`,
|
|
180
|
+
data: {
|
|
181
|
+
uri,
|
|
182
|
+
commandData,
|
|
183
|
+
timeout,
|
|
184
|
+
},
|
|
185
|
+
});
|
|
186
|
+
callback(null, response.data);
|
|
187
|
+
}
|
|
188
|
+
catch (err) {
|
|
189
|
+
callback(err);
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
this.loggedIn ? func() : this.messageQueue.queue.push(func);
|
|
134
193
|
};
|
|
135
194
|
getServiceConfig = async (uri, callback) => {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
url: `/mobius/service/config/${uri}`,
|
|
142
|
-
});
|
|
143
|
-
callback(null, response.data);
|
|
144
|
-
}
|
|
145
|
-
catch (err) {
|
|
146
|
-
callback(err);
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
updateObject = async (uri, config, callback) => {
|
|
150
|
-
try {
|
|
151
|
-
if (!this.apiClient)
|
|
152
|
-
throw new Error('No API client set');
|
|
153
|
-
const response = await this.apiClient({
|
|
154
|
-
method: 'post',
|
|
155
|
-
url: `/mobius/object/config/${uri}`,
|
|
156
|
-
data: config,
|
|
157
|
-
});
|
|
158
|
-
callback(null, response.data);
|
|
159
|
-
}
|
|
160
|
-
catch (err) {
|
|
161
|
-
callback(err);
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
|
-
filterObjectsByRIDValue = async (uri, pids, rid, limit, func, callback) => {
|
|
165
|
-
try {
|
|
166
|
-
if (!this.apiClient)
|
|
167
|
-
throw new Error('No API client set');
|
|
168
|
-
const discoveries = [];
|
|
169
|
-
for (let pid of pids) {
|
|
170
|
-
discoveries.push(this.apiClient({
|
|
195
|
+
const func = async () => {
|
|
196
|
+
try {
|
|
197
|
+
if (!this.apiClient)
|
|
198
|
+
throw new Error('No API client set');
|
|
199
|
+
const response = await this.apiClient({
|
|
171
200
|
method: 'get',
|
|
172
|
-
url: `/mobius/
|
|
173
|
-
})
|
|
201
|
+
url: `/mobius/service/config/${uri}`,
|
|
202
|
+
});
|
|
203
|
+
callback(null, response.data);
|
|
174
204
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
inss: response.data.data,
|
|
178
|
-
}));
|
|
179
|
-
const objectUris = [];
|
|
180
|
-
for (let pidGroup of pidGroups) {
|
|
181
|
-
for (let ins of pidGroup.inss) {
|
|
182
|
-
objectUris.push(`${pidGroup.uri}/${ins}`);
|
|
183
|
-
}
|
|
205
|
+
catch (err) {
|
|
206
|
+
callback(err);
|
|
184
207
|
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
208
|
+
};
|
|
209
|
+
this.loggedIn ? func() : this.messageQueue.queue.push(func);
|
|
210
|
+
};
|
|
211
|
+
updateObject = async (uri, config, callback) => {
|
|
212
|
+
const func = async () => {
|
|
213
|
+
try {
|
|
214
|
+
if (!this.apiClient)
|
|
215
|
+
throw new Error('No API client set');
|
|
216
|
+
const response = await this.apiClient({
|
|
217
|
+
method: 'post',
|
|
218
|
+
url: `/mobius/object/config/${uri}`,
|
|
219
|
+
data: config,
|
|
190
220
|
});
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
221
|
+
callback(null, response.data);
|
|
222
|
+
}
|
|
223
|
+
catch (err) {
|
|
224
|
+
callback(err);
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
this.loggedIn ? func() : this.messageQueue.queue.push(func);
|
|
228
|
+
};
|
|
229
|
+
filterObjectsByRIDValue = async (uri, pids, rid, limit, processFunc, callback) => {
|
|
230
|
+
const func = async () => {
|
|
231
|
+
try {
|
|
232
|
+
if (!this.apiClient)
|
|
233
|
+
throw new Error('No API client set');
|
|
234
|
+
const discoveries = [];
|
|
235
|
+
const discoverOnPid = (pid) => {
|
|
236
|
+
return (async () => {
|
|
237
|
+
try {
|
|
238
|
+
const response = await this.apiClient({
|
|
239
|
+
method: 'get',
|
|
240
|
+
url: `/mobius/discover/${uri}/${pid}`,
|
|
241
|
+
});
|
|
242
|
+
return response;
|
|
243
|
+
}
|
|
244
|
+
catch (err) {
|
|
245
|
+
if (err.response?.status === 404) {
|
|
246
|
+
return { data: { data: [], uri: uri } };
|
|
247
|
+
}
|
|
248
|
+
else {
|
|
249
|
+
throw err;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
})();
|
|
253
|
+
};
|
|
254
|
+
for (let pid of pids) {
|
|
255
|
+
discoveries.push(discoverOnPid(pid));
|
|
194
256
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
257
|
+
const pidGroups = (await Promise.all(discoveries)).map((response) => ({
|
|
258
|
+
uri: response.data.uri,
|
|
259
|
+
inss: response.data.data,
|
|
260
|
+
}));
|
|
261
|
+
const objectUris = [];
|
|
262
|
+
for (let pidGroup of pidGroups) {
|
|
263
|
+
for (let ins of pidGroup.inss) {
|
|
264
|
+
objectUris.push(`${pidGroup.uri}/${ins}`);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
const objects = [];
|
|
268
|
+
for (let objectUri of objectUris) {
|
|
269
|
+
const object = await this.apiClient({
|
|
270
|
+
method: 'get',
|
|
271
|
+
url: `/mobius/object/${objectUri}`,
|
|
200
272
|
});
|
|
273
|
+
const resource = object.data.data.resources.find((r) => r.rid === rid);
|
|
274
|
+
if (processFunc(resource?.pv)) {
|
|
275
|
+
objects.push(object.data.data);
|
|
276
|
+
}
|
|
277
|
+
if (objects.length >= limit) {
|
|
278
|
+
return callback(null, {
|
|
279
|
+
uri,
|
|
280
|
+
ts: new Date().toISOString(),
|
|
281
|
+
value: objects,
|
|
282
|
+
});
|
|
283
|
+
}
|
|
201
284
|
}
|
|
285
|
+
return callback(null, {
|
|
286
|
+
uri,
|
|
287
|
+
ts: new Date().toISOString(),
|
|
288
|
+
value: objects,
|
|
289
|
+
});
|
|
202
290
|
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
}
|
|
209
|
-
catch (err) {
|
|
210
|
-
callback(err);
|
|
211
|
-
}
|
|
291
|
+
catch (err) {
|
|
292
|
+
callback(err);
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
this.loggedIn ? func() : this.messageQueue.queue.push(func);
|
|
212
296
|
};
|
|
213
297
|
getHubId = async (callback) => {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
298
|
+
const func = async () => {
|
|
299
|
+
try {
|
|
300
|
+
if (!this.apiClient)
|
|
301
|
+
throw new Error('No API client set');
|
|
302
|
+
const response = await this.apiClient({
|
|
303
|
+
method: 'get',
|
|
304
|
+
url: `/mobius/admin/settings`,
|
|
305
|
+
});
|
|
306
|
+
callback(null, response.data.data.mobiusFlow.hubID.runtime);
|
|
307
|
+
}
|
|
308
|
+
catch (err) {
|
|
309
|
+
callback(err);
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
this.loggedIn ? func() : this.messageQueue.queue.push(func);
|
|
226
313
|
};
|
|
227
314
|
getNodeConfig = async (uri, callback) => {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
315
|
+
const func = async () => {
|
|
316
|
+
try {
|
|
317
|
+
if (!this.apiClient)
|
|
318
|
+
throw new Error('No API client set');
|
|
319
|
+
const response = await this.apiClient({
|
|
320
|
+
method: 'get',
|
|
321
|
+
url: `/mobius/node/config/${uri}`,
|
|
322
|
+
});
|
|
323
|
+
callback(null, response.data);
|
|
324
|
+
}
|
|
325
|
+
catch (err) {
|
|
326
|
+
callback(err);
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
this.loggedIn ? func() : this.messageQueue.queue.push(func);
|
|
240
330
|
};
|
|
241
331
|
changeAdminPassword = async (password, callback) => {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
332
|
+
const func = async () => {
|
|
333
|
+
try {
|
|
334
|
+
if (!this.apiClient)
|
|
335
|
+
throw new Error('No API client set');
|
|
336
|
+
const response = await this.apiClient({
|
|
337
|
+
method: 'get',
|
|
338
|
+
url: `/auth/user/admin`,
|
|
339
|
+
});
|
|
340
|
+
const adminUserId = response.data;
|
|
341
|
+
await this.apiClient({
|
|
342
|
+
method: 'patch',
|
|
343
|
+
url: `/auth/user/password/${adminUserId}`,
|
|
344
|
+
data: {
|
|
345
|
+
password,
|
|
346
|
+
},
|
|
347
|
+
});
|
|
348
|
+
callback(null, 'Ok');
|
|
349
|
+
}
|
|
350
|
+
catch (err) {
|
|
351
|
+
callback(err);
|
|
352
|
+
}
|
|
353
|
+
};
|
|
354
|
+
this.loggedIn ? func() : this.messageQueue.queue.push(func);
|
|
262
355
|
};
|
|
263
356
|
getNodeConfigTree = async (hid, callback) => {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
357
|
+
const func = async () => {
|
|
358
|
+
try {
|
|
359
|
+
if (!this.apiClient)
|
|
360
|
+
throw new Error('No API client set');
|
|
361
|
+
const response = await this.apiClient({
|
|
362
|
+
method: 'get',
|
|
363
|
+
url: `/mobius/node/configtree/${hid}`,
|
|
364
|
+
});
|
|
365
|
+
callback(null, response.data);
|
|
366
|
+
}
|
|
367
|
+
catch (err) {
|
|
368
|
+
callback(err);
|
|
369
|
+
}
|
|
370
|
+
};
|
|
371
|
+
this.loggedIn ? func() : this.messageQueue.queue.push(func);
|
|
276
372
|
};
|
|
277
373
|
getProfileByPid = async (hid, pid, callback) => {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
374
|
+
const func = async () => {
|
|
375
|
+
try {
|
|
376
|
+
if (!this.apiClient)
|
|
377
|
+
throw new Error('No API client set');
|
|
378
|
+
const response = await this.apiClient({
|
|
379
|
+
method: 'get',
|
|
380
|
+
url: `/mobius/profile/object/${hid}/${pid}`,
|
|
381
|
+
});
|
|
382
|
+
callback(null, response.data);
|
|
383
|
+
}
|
|
384
|
+
catch (err) {
|
|
385
|
+
callback(err);
|
|
386
|
+
}
|
|
387
|
+
};
|
|
388
|
+
this.loggedIn ? func() : this.messageQueue.queue.push(func);
|
|
290
389
|
};
|
|
291
390
|
getAllObjectProfiles = async (hid, callback) => {
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
391
|
+
const func = async () => {
|
|
392
|
+
try {
|
|
393
|
+
if (!this.apiClient)
|
|
394
|
+
throw new Error('No API client set');
|
|
395
|
+
const response = await this.apiClient({
|
|
396
|
+
method: 'get',
|
|
397
|
+
url: `/mobius/profile/object/${hid}`,
|
|
398
|
+
});
|
|
399
|
+
callback(null, response.data);
|
|
400
|
+
}
|
|
401
|
+
catch (err) {
|
|
402
|
+
callback(err);
|
|
403
|
+
}
|
|
404
|
+
};
|
|
405
|
+
this.loggedIn ? func() : this.messageQueue.queue.push(func);
|
|
304
406
|
};
|
|
305
407
|
}
|
|
306
408
|
exports.EngineApiCalls = EngineApiCalls;
|