ironflock 1.2.6 → 1.2.8
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/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.mjs +203 -175
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import
|
|
1
|
+
import O from "autobahn";
|
|
2
2
|
function L(d) {
|
|
3
3
|
return d && d.__esModule && Object.prototype.hasOwnProperty.call(d, "default") ? d.default : d;
|
|
4
4
|
}
|
|
5
|
-
var
|
|
6
|
-
function
|
|
7
|
-
return
|
|
5
|
+
var $ = { exports: {} }, C;
|
|
6
|
+
function j() {
|
|
7
|
+
return C || (C = 1, (function(d) {
|
|
8
8
|
var r = Object.prototype.hasOwnProperty, s = "~";
|
|
9
9
|
function o() {
|
|
10
10
|
}
|
|
11
11
|
Object.create && (o.prototype = /* @__PURE__ */ Object.create(null), new o().__proto__ || (s = !1));
|
|
12
|
-
function
|
|
12
|
+
function c(a, e, n) {
|
|
13
13
|
this.fn = a, this.context = e, this.once = n || !1;
|
|
14
14
|
}
|
|
15
|
-
function i(a, e, n,
|
|
15
|
+
function i(a, e, n, l, h) {
|
|
16
16
|
if (typeof n != "function")
|
|
17
17
|
throw new TypeError("The listener must be a function");
|
|
18
|
-
var v = new
|
|
18
|
+
var v = new c(n, l || a, h), g = s ? s + e : e;
|
|
19
19
|
return a._events[g] ? a._events[g].fn ? a._events[g] = [a._events[g], v] : a._events[g].push(v) : (a._events[g] = v, a._eventsCount++), a;
|
|
20
20
|
}
|
|
21
21
|
function u(a, e) {
|
|
@@ -25,118 +25,126 @@ function D() {
|
|
|
25
25
|
this._events = new o(), this._eventsCount = 0;
|
|
26
26
|
}
|
|
27
27
|
t.prototype.eventNames = function() {
|
|
28
|
-
var e = [], n,
|
|
28
|
+
var e = [], n, l;
|
|
29
29
|
if (this._eventsCount === 0) return e;
|
|
30
|
-
for (
|
|
31
|
-
r.call(n,
|
|
30
|
+
for (l in n = this._events)
|
|
31
|
+
r.call(n, l) && e.push(s ? l.slice(1) : l);
|
|
32
32
|
return Object.getOwnPropertySymbols ? e.concat(Object.getOwnPropertySymbols(n)) : e;
|
|
33
33
|
}, t.prototype.listeners = function(e) {
|
|
34
|
-
var n = s ? s + e : e,
|
|
35
|
-
if (!
|
|
36
|
-
if (
|
|
37
|
-
for (var
|
|
38
|
-
g[
|
|
34
|
+
var n = s ? s + e : e, l = this._events[n];
|
|
35
|
+
if (!l) return [];
|
|
36
|
+
if (l.fn) return [l.fn];
|
|
37
|
+
for (var h = 0, v = l.length, g = new Array(v); h < v; h++)
|
|
38
|
+
g[h] = l[h].fn;
|
|
39
39
|
return g;
|
|
40
40
|
}, t.prototype.listenerCount = function(e) {
|
|
41
|
-
var n = s ? s + e : e,
|
|
42
|
-
return
|
|
43
|
-
}, t.prototype.emit = function(e, n,
|
|
41
|
+
var n = s ? s + e : e, l = this._events[n];
|
|
42
|
+
return l ? l.fn ? 1 : l.length : 0;
|
|
43
|
+
}, t.prototype.emit = function(e, n, l, h, v, g) {
|
|
44
44
|
var w = s ? s + e : e;
|
|
45
45
|
if (!this._events[w]) return !1;
|
|
46
|
-
var
|
|
47
|
-
if (
|
|
48
|
-
switch (
|
|
46
|
+
var f = this._events[w], b = arguments.length, _, y;
|
|
47
|
+
if (f.fn) {
|
|
48
|
+
switch (f.once && this.removeListener(e, f.fn, void 0, !0), b) {
|
|
49
49
|
case 1:
|
|
50
|
-
return
|
|
50
|
+
return f.fn.call(f.context), !0;
|
|
51
51
|
case 2:
|
|
52
|
-
return
|
|
52
|
+
return f.fn.call(f.context, n), !0;
|
|
53
53
|
case 3:
|
|
54
|
-
return
|
|
54
|
+
return f.fn.call(f.context, n, l), !0;
|
|
55
55
|
case 4:
|
|
56
|
-
return
|
|
56
|
+
return f.fn.call(f.context, n, l, h), !0;
|
|
57
57
|
case 5:
|
|
58
|
-
return
|
|
58
|
+
return f.fn.call(f.context, n, l, h, v), !0;
|
|
59
59
|
case 6:
|
|
60
|
-
return
|
|
60
|
+
return f.fn.call(f.context, n, l, h, v, g), !0;
|
|
61
61
|
}
|
|
62
62
|
for (y = 1, _ = new Array(b - 1); y < b; y++)
|
|
63
63
|
_[y - 1] = arguments[y];
|
|
64
|
-
|
|
64
|
+
f.fn.apply(f.context, _);
|
|
65
65
|
} else {
|
|
66
|
-
var
|
|
67
|
-
for (y = 0; y <
|
|
68
|
-
switch (
|
|
66
|
+
var P = f.length, A;
|
|
67
|
+
for (y = 0; y < P; y++)
|
|
68
|
+
switch (f[y].once && this.removeListener(e, f[y].fn, void 0, !0), b) {
|
|
69
69
|
case 1:
|
|
70
|
-
|
|
70
|
+
f[y].fn.call(f[y].context);
|
|
71
71
|
break;
|
|
72
72
|
case 2:
|
|
73
|
-
|
|
73
|
+
f[y].fn.call(f[y].context, n);
|
|
74
74
|
break;
|
|
75
75
|
case 3:
|
|
76
|
-
|
|
76
|
+
f[y].fn.call(f[y].context, n, l);
|
|
77
77
|
break;
|
|
78
78
|
case 4:
|
|
79
|
-
|
|
79
|
+
f[y].fn.call(f[y].context, n, l, h);
|
|
80
80
|
break;
|
|
81
81
|
default:
|
|
82
82
|
if (!_) for (A = 1, _ = new Array(b - 1); A < b; A++)
|
|
83
83
|
_[A - 1] = arguments[A];
|
|
84
|
-
|
|
84
|
+
f[y].fn.apply(f[y].context, _);
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
return !0;
|
|
88
|
-
}, t.prototype.on = function(e, n,
|
|
89
|
-
return i(this, e, n,
|
|
90
|
-
}, t.prototype.once = function(e, n,
|
|
91
|
-
return i(this, e, n,
|
|
92
|
-
}, t.prototype.removeListener = function(e, n,
|
|
88
|
+
}, t.prototype.on = function(e, n, l) {
|
|
89
|
+
return i(this, e, n, l, !1);
|
|
90
|
+
}, t.prototype.once = function(e, n, l) {
|
|
91
|
+
return i(this, e, n, l, !0);
|
|
92
|
+
}, t.prototype.removeListener = function(e, n, l, h) {
|
|
93
93
|
var v = s ? s + e : e;
|
|
94
94
|
if (!this._events[v]) return this;
|
|
95
95
|
if (!n)
|
|
96
96
|
return u(this, v), this;
|
|
97
97
|
var g = this._events[v];
|
|
98
98
|
if (g.fn)
|
|
99
|
-
g.fn === n && (!
|
|
99
|
+
g.fn === n && (!h || g.once) && (!l || g.context === l) && u(this, v);
|
|
100
100
|
else {
|
|
101
|
-
for (var w = 0,
|
|
102
|
-
(g[w].fn !== n ||
|
|
103
|
-
|
|
101
|
+
for (var w = 0, f = [], b = g.length; w < b; w++)
|
|
102
|
+
(g[w].fn !== n || h && !g[w].once || l && g[w].context !== l) && f.push(g[w]);
|
|
103
|
+
f.length ? this._events[v] = f.length === 1 ? f[0] : f : u(this, v);
|
|
104
104
|
}
|
|
105
105
|
return this;
|
|
106
106
|
}, t.prototype.removeAllListeners = function(e) {
|
|
107
107
|
var n;
|
|
108
108
|
return e ? (n = s ? s + e : e, this._events[n] && u(this, n)) : (this._events = new o(), this._eventsCount = 0), this;
|
|
109
109
|
}, t.prototype.off = t.prototype.removeListener, t.prototype.addListener = t.prototype.on, t.prefixed = s, t.EventEmitter = t, d.exports = t;
|
|
110
|
-
})(
|
|
110
|
+
})($)), $.exports;
|
|
111
111
|
}
|
|
112
|
-
var
|
|
113
|
-
const U = /* @__PURE__ */ L(
|
|
112
|
+
var D = j();
|
|
113
|
+
const U = /* @__PURE__ */ L(D), F = "wss://cbw.datapods.io/ws-ua-usr", S = "wss://cbw.ironflock.com/ws-ua-usr", W = "wss://cbw.ironflock.dev/ws-ua-usr", V = "wss://cbw.record-evolution.com/ws-ua-usr", x = "ws://localhost:8080/ws-ua-usr", Y = {
|
|
114
114
|
"https://studio.datapods.io": F,
|
|
115
115
|
"https://studio.ironflock.dev": W,
|
|
116
|
-
"https://studio.ironflock.com":
|
|
116
|
+
"https://studio.ironflock.com": S,
|
|
117
117
|
"https://studio.record-evolution.com": V,
|
|
118
|
-
"http://localhost:8085":
|
|
119
|
-
"http://localhost:8086":
|
|
120
|
-
"http://host.docker.internal:8086":
|
|
118
|
+
"http://localhost:8085": x,
|
|
119
|
+
"http://localhost:8086": x,
|
|
120
|
+
"http://host.docker.internal:8086": x
|
|
121
121
|
}, Q = 6e3;
|
|
122
|
-
class
|
|
122
|
+
class I extends U {
|
|
123
123
|
constructor() {
|
|
124
124
|
super(), this.subscriptions = [], this.registrations = [], this.firstResolver = () => {
|
|
125
125
|
}, this.firstRejecter = () => {
|
|
126
|
-
};
|
|
126
|
+
}, this.shouldReconnect = !1, this.isReconnecting = !1, this.hasOpenedOnce = !1;
|
|
127
127
|
}
|
|
128
128
|
static getWebSocketURI(r) {
|
|
129
|
-
|
|
129
|
+
var o;
|
|
130
|
+
const s = typeof process < "u" ? (o = process.env) == null ? void 0 : o.DEVICE_ENDPOINT_URL : void 0;
|
|
131
|
+
if (s)
|
|
132
|
+
try {
|
|
133
|
+
const c = new URL(s);
|
|
134
|
+
return c.pathname = "/ws-ua-usr", c.toString().replace(/\/$/, "");
|
|
135
|
+
} catch {
|
|
136
|
+
}
|
|
137
|
+
return r ? Y[r] ?? S : S;
|
|
130
138
|
}
|
|
131
|
-
configure(r, s, o,
|
|
132
|
-
this.realm = `realm-${r}-${s}-${o}`, this.serial_number =
|
|
139
|
+
configure(r, s, o, c, i) {
|
|
140
|
+
this.realm = `realm-${r}-${s}-${o}`, this.serial_number = c, this.socketURI = i ?? I.getWebSocketURI();
|
|
133
141
|
}
|
|
134
142
|
async start() {
|
|
135
143
|
if (!this.realm || !this.serial_number || !this.socketURI)
|
|
136
144
|
throw new Error("CrossbarConnection must be configured before starting. Call configure() first.");
|
|
137
|
-
return this.firstConnection = new Promise((r, s) => {
|
|
145
|
+
return this.shouldReconnect = !0, this.firstConnection = new Promise((r, s) => {
|
|
138
146
|
this.firstResolver = r, this.firstRejecter = s;
|
|
139
|
-
}), this.connection = new
|
|
147
|
+
}), this.connection = new O.Connection({
|
|
140
148
|
realm: this.realm,
|
|
141
149
|
url: this.socketURI,
|
|
142
150
|
authmethods: ["wampcra"],
|
|
@@ -147,11 +155,11 @@ class x extends U {
|
|
|
147
155
|
// @ts-ignore
|
|
148
156
|
autoping_interval: 2,
|
|
149
157
|
autoping_timeout: 4,
|
|
150
|
-
onchallenge: (r, s, o) =>
|
|
158
|
+
onchallenge: (r, s, o) => O.auth_cra.sign(this.serial_number, o.challenge)
|
|
151
159
|
}), this.connection.onopen = this.onOpen.bind(this), this.connection.onclose = this.onClose.bind(this), this.connection.open(), this.firstConnection;
|
|
152
160
|
}
|
|
153
161
|
onOpen(r) {
|
|
154
|
-
this.session = r, this.session.caller_disclose_me = !0, this.resubscribeAll(), this.emit("connected", this.serial_number), this.firstResolver(), this.firstResolver = () => {
|
|
162
|
+
this.session = r, this.session.caller_disclose_me = !0, this.hasOpenedOnce = !0, this.resubscribeAll(), this.reregisterAll(), this.emit("connected", this.serial_number), this.firstResolver(), this.firstResolver = () => {
|
|
155
163
|
};
|
|
156
164
|
}
|
|
157
165
|
onClose(r, s) {
|
|
@@ -166,7 +174,21 @@ class x extends U {
|
|
|
166
174
|
realm: this.realm,
|
|
167
175
|
url: this.socketURI,
|
|
168
176
|
authid: this.serial_number
|
|
169
|
-
}), !1;
|
|
177
|
+
}), this.shouldReconnect && this.hasOpenedOnce && (s == null ? void 0 : s.will_retry) === !1 && this.handleManualReconnect((s == null ? void 0 : s.reason) ?? r), !1;
|
|
178
|
+
}
|
|
179
|
+
async handleManualReconnect(r) {
|
|
180
|
+
if (!(this.isReconnecting || !this.shouldReconnect)) {
|
|
181
|
+
for (this.isReconnecting = !0; this.shouldReconnect && !this.session; )
|
|
182
|
+
if (await new Promise((s) => setTimeout(s, 1e3)), this.shouldReconnect && this.connection && !this.session) {
|
|
183
|
+
console.log(`Manually retrying connection after ${r}...`);
|
|
184
|
+
try {
|
|
185
|
+
this.connection.open(), await new Promise((s) => setTimeout(s, 500));
|
|
186
|
+
} catch (s) {
|
|
187
|
+
console.error("Error during manual reconnection attempt:", s);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
this.isReconnecting = !1;
|
|
191
|
+
}
|
|
170
192
|
}
|
|
171
193
|
async sessionWait() {
|
|
172
194
|
const r = Date.now();
|
|
@@ -191,12 +213,12 @@ class x extends U {
|
|
|
191
213
|
}
|
|
192
214
|
stop() {
|
|
193
215
|
var r;
|
|
194
|
-
(r = this.connection) == null || r.close("wamp.close.normal", "Connection closed by client");
|
|
216
|
+
this.shouldReconnect = !1, (r = this.connection) == null || r.close("wamp.close.normal", "Connection closed by client");
|
|
195
217
|
}
|
|
196
218
|
async subscribe(r, s) {
|
|
197
|
-
var
|
|
219
|
+
var c;
|
|
198
220
|
await this.sessionWait();
|
|
199
|
-
const o = await ((
|
|
221
|
+
const o = await ((c = this.session) == null ? void 0 : c.subscribe(r, s));
|
|
200
222
|
return o && this.subscriptions.push(o), o;
|
|
201
223
|
}
|
|
202
224
|
async unsubscribe(r) {
|
|
@@ -216,10 +238,16 @@ class x extends U {
|
|
|
216
238
|
r.map((s) => this.subscribe(s.topic, s.handler))
|
|
217
239
|
);
|
|
218
240
|
}
|
|
241
|
+
async reregisterAll() {
|
|
242
|
+
const r = [...this.registrations];
|
|
243
|
+
this.registrations = [], await Promise.all(
|
|
244
|
+
r.map((s) => this.register(s.procedure, s.endpoint, s.options))
|
|
245
|
+
);
|
|
246
|
+
}
|
|
219
247
|
async register(r, s, o) {
|
|
220
248
|
var u;
|
|
221
249
|
await this.sessionWait();
|
|
222
|
-
const
|
|
250
|
+
const c = { force_reregister: !0, ...o ?? {} }, i = await ((u = this.session) == null ? void 0 : u.register(r, s, c));
|
|
223
251
|
return i && this.registrations.push(i), i;
|
|
224
252
|
}
|
|
225
253
|
async unregister(r) {
|
|
@@ -228,16 +256,16 @@ class x extends U {
|
|
|
228
256
|
const s = this.registrations.indexOf(r);
|
|
229
257
|
s !== -1 && this.registrations.splice(s, 1);
|
|
230
258
|
}
|
|
231
|
-
async call(r, s, o,
|
|
259
|
+
async call(r, s, o, c) {
|
|
232
260
|
var i;
|
|
233
|
-
return await this.sessionWait(), (i = this.session) == null ? void 0 : i.call(r, s, o,
|
|
261
|
+
return await this.sessionWait(), (i = this.session) == null ? void 0 : i.call(r, s, o, c);
|
|
234
262
|
}
|
|
235
|
-
async publish(r, s, o,
|
|
263
|
+
async publish(r, s, o, c) {
|
|
236
264
|
var i;
|
|
237
|
-
return await this.sessionWait(), (i = this.session) == null ? void 0 : i.publish(r, s, o,
|
|
265
|
+
return await this.sessionWait(), (i = this.session) == null ? void 0 : i.publish(r, s, o, c);
|
|
238
266
|
}
|
|
239
267
|
}
|
|
240
|
-
const
|
|
268
|
+
const R = (d) => Math.floor(d) === d && B <= d && d <= J, B = 0, J = 2 ** 32 - 1, K = (d) => H.test(d), H = /^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])(T|\s)([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](?:\.[0-9]{1,9})?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$/i, p = (d) => {
|
|
241
269
|
const r = (s) => {
|
|
242
270
|
if (d.length === 0)
|
|
243
271
|
return !0;
|
|
@@ -250,7 +278,7 @@ const K = (d) => Math.floor(d) === d && B <= d && d <= J, B = 0, J = 2 ** 32 - 1
|
|
|
250
278
|
`Please fill the \`${o.expected}\` typed value next time.`
|
|
251
279
|
].join(`
|
|
252
280
|
`))), d.push(o)), !1);
|
|
253
|
-
},
|
|
281
|
+
}, k = (d) => Object.assign(d, {
|
|
254
282
|
"~standard": {
|
|
255
283
|
version: 1,
|
|
256
284
|
vendor: "typia",
|
|
@@ -275,22 +303,22 @@ const G = (d) => {
|
|
|
275
303
|
if (!d.startsWith("$input"))
|
|
276
304
|
throw new Error(`Invalid path: ${JSON.stringify(d)}`);
|
|
277
305
|
const r = [];
|
|
278
|
-
let s = "", o = m.Start,
|
|
279
|
-
for (;
|
|
280
|
-
|
|
281
|
-
const i = d[
|
|
306
|
+
let s = "", o = m.Start, c = 5;
|
|
307
|
+
for (; c < d.length - 1; ) {
|
|
308
|
+
c++;
|
|
309
|
+
const i = d[c];
|
|
282
310
|
if (o === m.Property ? i === "." || i === "[" ? (r.push({
|
|
283
311
|
key: s
|
|
284
|
-
}), o = m.Start) :
|
|
312
|
+
}), o = m.Start) : c === d.length - 1 ? (s += i, r.push({
|
|
285
313
|
key: s
|
|
286
|
-
}),
|
|
314
|
+
}), c++, o = m.Start) : s += i : o === m.StringKey ? i === '"' ? (r.push({
|
|
287
315
|
key: JSON.parse(s + i)
|
|
288
|
-
}),
|
|
316
|
+
}), c += 2, o = m.Start) : i === "\\" ? (s += d[c], c++, s += d[c]) : s += i : o === m.NumberKey && (i === "]" ? (r.push({
|
|
289
317
|
key: Number.parseInt(s)
|
|
290
|
-
}),
|
|
291
|
-
const u = d[
|
|
318
|
+
}), c++, o = m.Start) : s += i), o === m.Start && c < d.length - 1) {
|
|
319
|
+
const u = d[c];
|
|
292
320
|
if (s = "", u === "[")
|
|
293
|
-
d[
|
|
321
|
+
d[c + 1] === '"' ? (o = m.StringKey, c++, s = '"') : o = m.NumberKey;
|
|
294
322
|
else if (u === ".")
|
|
295
323
|
o = m.Property;
|
|
296
324
|
else
|
|
@@ -303,122 +331,122 @@ const G = (d) => {
|
|
|
303
331
|
};
|
|
304
332
|
var M = /* @__PURE__ */ ((d) => (d.DEVELOPMENT = "dev", d.PRODUCTION = "prod", d))(M || {});
|
|
305
333
|
const q = (() => {
|
|
306
|
-
const d = (e) => typeof e.limit == "number" &&
|
|
334
|
+
const d = (e) => typeof e.limit == "number" && R(e.limit) && 1 <= e.limit && e.limit <= 1e4 && (e.offset === void 0 || typeof e.offset == "number" && R(e.offset) && 0 <= e.offset) && (e.timeRange === void 0 || typeof e.timeRange == "object" && e.timeRange !== null && r(e.timeRange)) && (e.filterAnd === void 0 || Array.isArray(e.filterAnd) && e.filterAnd.every((n) => typeof n == "object" && n !== null && s(n))), r = (e) => typeof e.start == "string" && K(e.start) && typeof e.end == "string" && K(e.end), s = (e) => typeof e.column == "string" && 1 <= e.column.length && typeof e.operator == "string" && 1 <= e.operator.length && e.value !== null && e.value !== void 0 && (typeof e.value == "string" || typeof e.value == "number" || typeof e.value == "boolean" || Array.isArray(e.value) && e.value.every((n) => typeof n == "string" || typeof n == "number")), o = (e, n, l = !0) => [typeof e.limit == "number" && (R(e.limit) || a(l, {
|
|
307
335
|
path: n + ".limit",
|
|
308
336
|
expected: 'number & Type<"uint32">',
|
|
309
337
|
value: e.limit
|
|
310
|
-
})) && (1 <= e.limit || a(
|
|
338
|
+
})) && (1 <= e.limit || a(l, {
|
|
311
339
|
path: n + ".limit",
|
|
312
340
|
expected: "number & Minimum<1>",
|
|
313
341
|
value: e.limit
|
|
314
|
-
})) && (e.limit <= 1e4 || a(
|
|
342
|
+
})) && (e.limit <= 1e4 || a(l, {
|
|
315
343
|
path: n + ".limit",
|
|
316
344
|
expected: "number & Maximum<10000>",
|
|
317
345
|
value: e.limit
|
|
318
|
-
})) || a(
|
|
346
|
+
})) || a(l, {
|
|
319
347
|
path: n + ".limit",
|
|
320
348
|
expected: '(number & Type<"uint32"> & Minimum<1> & Maximum<10000>)',
|
|
321
349
|
value: e.limit
|
|
322
|
-
}), e.offset === void 0 || typeof e.offset == "number" && (
|
|
350
|
+
}), e.offset === void 0 || typeof e.offset == "number" && (R(e.offset) || a(l, {
|
|
323
351
|
path: n + ".offset",
|
|
324
352
|
expected: 'number & Type<"uint32">',
|
|
325
353
|
value: e.offset
|
|
326
|
-
})) && (0 <= e.offset || a(
|
|
354
|
+
})) && (0 <= e.offset || a(l, {
|
|
327
355
|
path: n + ".offset",
|
|
328
356
|
expected: "number & Minimum<0>",
|
|
329
357
|
value: e.offset
|
|
330
|
-
})) || a(
|
|
358
|
+
})) || a(l, {
|
|
331
359
|
path: n + ".offset",
|
|
332
360
|
expected: '((number & Type<"uint32"> & Minimum<0>) | undefined)',
|
|
333
361
|
value: e.offset
|
|
334
|
-
}), e.timeRange === void 0 || (typeof e.timeRange == "object" && e.timeRange !== null || a(
|
|
362
|
+
}), e.timeRange === void 0 || (typeof e.timeRange == "object" && e.timeRange !== null || a(l, {
|
|
335
363
|
path: n + ".timeRange",
|
|
336
364
|
expected: "(ISOTimeRange | undefined)",
|
|
337
365
|
value: e.timeRange
|
|
338
|
-
})) &&
|
|
366
|
+
})) && c(e.timeRange, n + ".timeRange", l) || a(l, {
|
|
339
367
|
path: n + ".timeRange",
|
|
340
368
|
expected: "(ISOTimeRange | undefined)",
|
|
341
369
|
value: e.timeRange
|
|
342
|
-
}), e.filterAnd === void 0 || (Array.isArray(e.filterAnd) || a(
|
|
370
|
+
}), e.filterAnd === void 0 || (Array.isArray(e.filterAnd) || a(l, {
|
|
343
371
|
path: n + ".filterAnd",
|
|
344
372
|
expected: "(Array<SQLFilterAnd> | undefined)",
|
|
345
373
|
value: e.filterAnd
|
|
346
|
-
})) && e.filterAnd.map((
|
|
374
|
+
})) && e.filterAnd.map((h, v) => (typeof h == "object" && h !== null || a(l, {
|
|
347
375
|
path: n + ".filterAnd[" + v + "]",
|
|
348
376
|
expected: "SQLFilterAnd",
|
|
349
|
-
value:
|
|
350
|
-
})) && i(
|
|
377
|
+
value: h
|
|
378
|
+
})) && i(h, n + ".filterAnd[" + v + "]", l) || a(l, {
|
|
351
379
|
path: n + ".filterAnd[" + v + "]",
|
|
352
380
|
expected: "SQLFilterAnd",
|
|
353
|
-
value:
|
|
354
|
-
})).every((
|
|
381
|
+
value: h
|
|
382
|
+
})).every((h) => h) || a(l, {
|
|
355
383
|
path: n + ".filterAnd",
|
|
356
384
|
expected: "(Array<SQLFilterAnd> | undefined)",
|
|
357
385
|
value: e.filterAnd
|
|
358
|
-
})].every((
|
|
386
|
+
})].every((h) => h), c = (e, n, l = !0) => [typeof e.start == "string" && (K(e.start) || a(l, {
|
|
359
387
|
path: n + ".start",
|
|
360
388
|
expected: 'string & Format<"date-time">',
|
|
361
389
|
value: e.start
|
|
362
|
-
})) || a(
|
|
390
|
+
})) || a(l, {
|
|
363
391
|
path: n + ".start",
|
|
364
392
|
expected: '(string & Format<"date-time">)',
|
|
365
393
|
value: e.start
|
|
366
|
-
}), typeof e.end == "string" && (
|
|
394
|
+
}), typeof e.end == "string" && (K(e.end) || a(l, {
|
|
367
395
|
path: n + ".end",
|
|
368
396
|
expected: 'string & Format<"date-time">',
|
|
369
397
|
value: e.end
|
|
370
|
-
})) || a(
|
|
398
|
+
})) || a(l, {
|
|
371
399
|
path: n + ".end",
|
|
372
400
|
expected: '(string & Format<"date-time">)',
|
|
373
401
|
value: e.end
|
|
374
|
-
})].every((
|
|
402
|
+
})].every((h) => h), i = (e, n, l = !0) => [typeof e.column == "string" && (1 <= e.column.length || a(l, {
|
|
375
403
|
path: n + ".column",
|
|
376
404
|
expected: "string & MinLength<1>",
|
|
377
405
|
value: e.column
|
|
378
|
-
})) || a(
|
|
406
|
+
})) || a(l, {
|
|
379
407
|
path: n + ".column",
|
|
380
408
|
expected: "(string & MinLength<1>)",
|
|
381
409
|
value: e.column
|
|
382
|
-
}), typeof e.operator == "string" && (1 <= e.operator.length || a(
|
|
410
|
+
}), typeof e.operator == "string" && (1 <= e.operator.length || a(l, {
|
|
383
411
|
path: n + ".operator",
|
|
384
412
|
expected: "string & MinLength<1>",
|
|
385
413
|
value: e.operator
|
|
386
|
-
})) || a(
|
|
414
|
+
})) || a(l, {
|
|
387
415
|
path: n + ".operator",
|
|
388
416
|
expected: "(string & MinLength<1>)",
|
|
389
417
|
value: e.operator
|
|
390
|
-
}), (e.value !== null || a(
|
|
418
|
+
}), (e.value !== null || a(l, {
|
|
391
419
|
path: n + ".value",
|
|
392
420
|
expected: "(Array<string | number> | boolean | number | string)",
|
|
393
421
|
value: e.value
|
|
394
|
-
})) && (e.value !== void 0 || a(
|
|
422
|
+
})) && (e.value !== void 0 || a(l, {
|
|
395
423
|
path: n + ".value",
|
|
396
424
|
expected: "(Array<string | number> | boolean | number | string)",
|
|
397
425
|
value: e.value
|
|
398
|
-
})) && (typeof e.value == "string" || typeof e.value == "number" || typeof e.value == "boolean" || (Array.isArray(e.value) || a(
|
|
426
|
+
})) && (typeof e.value == "string" || typeof e.value == "number" || typeof e.value == "boolean" || (Array.isArray(e.value) || a(l, {
|
|
399
427
|
path: n + ".value",
|
|
400
428
|
expected: "(Array<string | number> | boolean | number | string)",
|
|
401
429
|
value: e.value
|
|
402
|
-
})) && e.value.map((
|
|
430
|
+
})) && e.value.map((h, v) => typeof h == "string" || typeof h == "number" || a(l, {
|
|
403
431
|
path: n + ".value[" + v + "]",
|
|
404
432
|
expected: "(number | string)",
|
|
405
|
-
value:
|
|
406
|
-
})).every((
|
|
433
|
+
value: h
|
|
434
|
+
})).every((h) => h) || a(l, {
|
|
407
435
|
path: n + ".value",
|
|
408
436
|
expected: "(Array<string | number> | boolean | number | string)",
|
|
409
437
|
value: e.value
|
|
410
|
-
}))].every((
|
|
438
|
+
}))].every((h) => h), u = (e) => typeof e == "object" && e !== null && d(e);
|
|
411
439
|
let t, a;
|
|
412
|
-
return
|
|
440
|
+
return k((e) => {
|
|
413
441
|
if (u(e) === !1) {
|
|
414
|
-
t = [], a =
|
|
415
|
-
path:
|
|
442
|
+
t = [], a = p(t), ((l, h, v = !0) => (typeof l == "object" && l !== null || a(!0, {
|
|
443
|
+
path: h + "",
|
|
416
444
|
expected: "TableQueryParams",
|
|
417
|
-
value:
|
|
418
|
-
})) && o(
|
|
419
|
-
path:
|
|
445
|
+
value: l
|
|
446
|
+
})) && o(l, h + "", !0) || a(!0, {
|
|
447
|
+
path: h + "",
|
|
420
448
|
expected: "TableQueryParams",
|
|
421
|
-
value:
|
|
449
|
+
value: l
|
|
422
450
|
}))(e, "$input", !0);
|
|
423
451
|
const n = t.length === 0;
|
|
424
452
|
return n ? {
|
|
@@ -436,39 +464,39 @@ const q = (() => {
|
|
|
436
464
|
};
|
|
437
465
|
});
|
|
438
466
|
})(), X = (() => {
|
|
439
|
-
const d = (i) => typeof i.longitude == "number" && -180 <= i.longitude && i.longitude <= 180 && typeof i.latitude == "number" && -90 <= i.latitude && i.latitude <= 90, r = (i, u, t = !0) => [typeof i.longitude == "number" && (-180 <= i.longitude ||
|
|
467
|
+
const d = (i) => typeof i.longitude == "number" && -180 <= i.longitude && i.longitude <= 180 && typeof i.latitude == "number" && -90 <= i.latitude && i.latitude <= 90, r = (i, u, t = !0) => [typeof i.longitude == "number" && (-180 <= i.longitude || c(t, {
|
|
440
468
|
path: u + ".longitude",
|
|
441
469
|
expected: "number & Minimum<-180>",
|
|
442
470
|
value: i.longitude
|
|
443
|
-
})) && (i.longitude <= 180 ||
|
|
471
|
+
})) && (i.longitude <= 180 || c(t, {
|
|
444
472
|
path: u + ".longitude",
|
|
445
473
|
expected: "number & Maximum<180>",
|
|
446
474
|
value: i.longitude
|
|
447
|
-
})) ||
|
|
475
|
+
})) || c(t, {
|
|
448
476
|
path: u + ".longitude",
|
|
449
477
|
expected: "(number & Minimum<-180> & Maximum<180>)",
|
|
450
478
|
value: i.longitude
|
|
451
|
-
}), typeof i.latitude == "number" && (-90 <= i.latitude ||
|
|
479
|
+
}), typeof i.latitude == "number" && (-90 <= i.latitude || c(t, {
|
|
452
480
|
path: u + ".latitude",
|
|
453
481
|
expected: "number & Minimum<-90>",
|
|
454
482
|
value: i.latitude
|
|
455
|
-
})) && (i.latitude <= 90 ||
|
|
483
|
+
})) && (i.latitude <= 90 || c(t, {
|
|
456
484
|
path: u + ".latitude",
|
|
457
485
|
expected: "number & Maximum<90>",
|
|
458
486
|
value: i.latitude
|
|
459
|
-
})) ||
|
|
487
|
+
})) || c(t, {
|
|
460
488
|
path: u + ".latitude",
|
|
461
489
|
expected: "(number & Minimum<-90> & Maximum<90>)",
|
|
462
490
|
value: i.latitude
|
|
463
491
|
})].every((a) => a), s = (i) => typeof i == "object" && i !== null && d(i);
|
|
464
|
-
let o,
|
|
465
|
-
return
|
|
492
|
+
let o, c;
|
|
493
|
+
return k((i) => {
|
|
466
494
|
if (s(i) === !1) {
|
|
467
|
-
o = [],
|
|
495
|
+
o = [], c = p(o), ((t, a, e = !0) => (typeof t == "object" && t !== null || c(!0, {
|
|
468
496
|
path: a + "",
|
|
469
497
|
expected: "LocationParams",
|
|
470
498
|
value: t
|
|
471
|
-
})) && r(t, a + "", !0) ||
|
|
499
|
+
})) && r(t, a + "", !0) || c(!0, {
|
|
472
500
|
path: a + "",
|
|
473
501
|
expected: "LocationParams",
|
|
474
502
|
value: t
|
|
@@ -509,11 +537,11 @@ const q = (() => {
|
|
|
509
537
|
path: a + ".kwargs",
|
|
510
538
|
expected: "(Record<string, unknown> | undefined)",
|
|
511
539
|
value: t.kwargs
|
|
512
|
-
})].every((n) => n), o = (t, a, e = !0) => [e === !1 || Object.keys(t).map((n) => (t[n] === void 0, !0)).every((n) => n)].every((n) => n),
|
|
540
|
+
})].every((n) => n), o = (t, a, e = !0) => [e === !1 || Object.keys(t).map((n) => (t[n] === void 0, !0)).every((n) => n)].every((n) => n), c = (t) => typeof t == "object" && t !== null && d(t);
|
|
513
541
|
let i, u;
|
|
514
|
-
return
|
|
515
|
-
if (
|
|
516
|
-
i = [], u =
|
|
542
|
+
return k((t) => {
|
|
543
|
+
if (c(t) === !1) {
|
|
544
|
+
i = [], u = p(i), ((e, n, l = !0) => (typeof e == "object" && e !== null || u(!0, {
|
|
517
545
|
path: n + "",
|
|
518
546
|
expected: "PublishParams",
|
|
519
547
|
value: e
|
|
@@ -566,11 +594,11 @@ const q = (() => {
|
|
|
566
594
|
path: a + ".kwargs",
|
|
567
595
|
expected: "(Record<string, unknown> | undefined)",
|
|
568
596
|
value: t.kwargs
|
|
569
|
-
})].every((n) => n), o = (t, a, e = !0) => [e === !1 || Object.keys(t).map((n) => (t[n] === void 0, !0)).every((n) => n)].every((n) => n),
|
|
597
|
+
})].every((n) => n), o = (t, a, e = !0) => [e === !1 || Object.keys(t).map((n) => (t[n] === void 0, !0)).every((n) => n)].every((n) => n), c = (t) => typeof t == "object" && t !== null && d(t);
|
|
570
598
|
let i, u;
|
|
571
|
-
return
|
|
572
|
-
if (
|
|
573
|
-
i = [], u =
|
|
599
|
+
return k((t) => {
|
|
600
|
+
if (c(t) === !1) {
|
|
601
|
+
i = [], u = p(i), ((e, n, l = !0) => (typeof e == "object" && e !== null || u(!0, {
|
|
574
602
|
path: n + "",
|
|
575
603
|
expected: "CallParams",
|
|
576
604
|
value: e
|
|
@@ -594,7 +622,7 @@ const q = (() => {
|
|
|
594
622
|
data: t
|
|
595
623
|
};
|
|
596
624
|
});
|
|
597
|
-
})(),
|
|
625
|
+
})(), N = (() => {
|
|
598
626
|
const d = (t) => typeof t.tablename == "string" && 1 <= t.tablename.length && (t.args === void 0 || Array.isArray(t.args)) && (t.kwargs === void 0 || typeof t.kwargs == "object" && t.kwargs !== null && Array.isArray(t.kwargs) === !1 && r(t.kwargs)), r = (t) => Object.keys(t).every((a) => (t[a] === void 0, !0)), s = (t, a, e = !0) => [typeof t.tablename == "string" && (1 <= t.tablename.length || u(e, {
|
|
599
627
|
path: a + ".tablename",
|
|
600
628
|
expected: "string & MinLength<1>",
|
|
@@ -615,11 +643,11 @@ const q = (() => {
|
|
|
615
643
|
path: a + ".kwargs",
|
|
616
644
|
expected: "(Record<string, unknown> | undefined)",
|
|
617
645
|
value: t.kwargs
|
|
618
|
-
})].every((n) => n), o = (t, a, e = !0) => [e === !1 || Object.keys(t).map((n) => (t[n] === void 0, !0)).every((n) => n)].every((n) => n),
|
|
646
|
+
})].every((n) => n), o = (t, a, e = !0) => [e === !1 || Object.keys(t).map((n) => (t[n] === void 0, !0)).every((n) => n)].every((n) => n), c = (t) => typeof t == "object" && t !== null && d(t);
|
|
619
647
|
let i, u;
|
|
620
|
-
return
|
|
621
|
-
if (
|
|
622
|
-
i = [], u =
|
|
648
|
+
return k((t) => {
|
|
649
|
+
if (c(t) === !1) {
|
|
650
|
+
i = [], u = p(i), ((e, n, l = !0) => (typeof e == "object" && e !== null || u(!0, {
|
|
623
651
|
path: n + "",
|
|
624
652
|
expected: "TableParams",
|
|
625
653
|
value: e
|
|
@@ -654,9 +682,9 @@ function z(d) {
|
|
|
654
682
|
throw new Error("serialNumber option is required (or set DEVICE_SERIAL_NUMBER env var in Node.js)");
|
|
655
683
|
return r;
|
|
656
684
|
}
|
|
657
|
-
class
|
|
685
|
+
class T {
|
|
658
686
|
constructor(r) {
|
|
659
|
-
this._isConfigured = !1, this._serialNumber = z(r == null ? void 0 : r.serialNumber), this._deviceName = (r == null ? void 0 : r.deviceName) ?? E("DEVICE_NAME"), this._deviceKey = (r == null ? void 0 : r.deviceKey) ?? E("DEVICE_KEY"), this._appName = (r == null ? void 0 : r.appName) ?? E("APP_NAME"), this._swarmKey = (r == null ? void 0 : r.swarmKey) ?? parseInt(E("SWARM_KEY") ?? "0", 10), this._appKey = (r == null ? void 0 : r.appKey) ?? parseInt(E("APP_KEY") ?? "0", 10), this._env = (r == null ? void 0 : r.env) ?? E("ENV"), this._reswarmUrl = (r == null ? void 0 : r.reswarmUrl) ?? E("RESWARM_URL"), this._cburl = r == null ? void 0 : r.cburl, this._connection = new
|
|
687
|
+
this._isConfigured = !1, this._serialNumber = z(r == null ? void 0 : r.serialNumber), this._deviceName = (r == null ? void 0 : r.deviceName) ?? E("DEVICE_NAME"), this._deviceKey = (r == null ? void 0 : r.deviceKey) ?? E("DEVICE_KEY"), this._appName = (r == null ? void 0 : r.appName) ?? E("APP_NAME"), this._swarmKey = (r == null ? void 0 : r.swarmKey) ?? parseInt(E("SWARM_KEY") ?? "0", 10), this._appKey = (r == null ? void 0 : r.appKey) ?? parseInt(E("APP_KEY") ?? "0", 10), this._env = (r == null ? void 0 : r.env) ?? E("ENV"), this._reswarmUrl = (r == null ? void 0 : r.reswarmUrl) ?? E("RESWARM_URL"), this._cburl = (r == null ? void 0 : r.ironFlockUrl) ?? (r == null ? void 0 : r.cburl), this._connection = new I();
|
|
660
688
|
const s = [];
|
|
661
689
|
this._deviceKey || s.push("DEVICE_KEY"), this._appName || s.push("APP_NAME"), this._swarmKey || s.push("SWARM_KEY"), this._appKey || s.push("APP_KEY"), s.length > 0 && console.warn(
|
|
662
690
|
`Warning: The following environment variables must be present: ${s.join(", ")}`
|
|
@@ -670,14 +698,14 @@ class O {
|
|
|
670
698
|
}
|
|
671
699
|
configureConnection(r) {
|
|
672
700
|
if (this._isConfigured) return;
|
|
673
|
-
const s = (this._env ?? "DEV").toUpperCase(),
|
|
701
|
+
const s = (this._env ?? "DEV").toUpperCase(), c = {
|
|
674
702
|
DEV: M.DEVELOPMENT,
|
|
675
703
|
PROD: M.PRODUCTION
|
|
676
|
-
}[s] ?? M.DEVELOPMENT, i = r ?? this._cburl ??
|
|
704
|
+
}[s] ?? M.DEVELOPMENT, i = r ?? this._cburl ?? I.getWebSocketURI(this._reswarmUrl);
|
|
677
705
|
this._connection.configure(
|
|
678
706
|
this._swarmKey,
|
|
679
707
|
this._appKey,
|
|
680
|
-
|
|
708
|
+
c,
|
|
681
709
|
this._serialNumber,
|
|
682
710
|
i
|
|
683
711
|
), this._isConfigured = !0;
|
|
@@ -689,9 +717,9 @@ class O {
|
|
|
689
717
|
this._connection.stop();
|
|
690
718
|
}
|
|
691
719
|
async publish(r, s, o) {
|
|
692
|
-
const
|
|
693
|
-
if (!
|
|
694
|
-
throw new Error(`Invalid publish parameters: ${
|
|
720
|
+
const c = Z({ topic: r, args: s, kwargs: o });
|
|
721
|
+
if (!c.success)
|
|
722
|
+
throw new Error(`Invalid publish parameters: ${c.errors.map((t) => t.path + ": " + t.expected).join(", ")}`);
|
|
695
723
|
const u = { ...{
|
|
696
724
|
DEVICE_SERIAL_NUMBER: this._serialNumber,
|
|
697
725
|
DEVICE_KEY: this._deviceKey,
|
|
@@ -702,18 +730,18 @@ class O {
|
|
|
702
730
|
});
|
|
703
731
|
}
|
|
704
732
|
async publishToTable(r, s, o) {
|
|
705
|
-
const
|
|
706
|
-
if (!
|
|
707
|
-
throw new Error(`Invalid table parameters: ${
|
|
733
|
+
const c = N({ tablename: r, args: s, kwargs: o });
|
|
734
|
+
if (!c.success)
|
|
735
|
+
throw new Error(`Invalid table parameters: ${c.errors.map((u) => u.path + ": " + u.expected).join(", ")}`);
|
|
708
736
|
if (!this._swarmKey) throw new Error("SWARM_KEY not set in environment variables!");
|
|
709
737
|
if (!this._appKey) throw new Error("APP_KEY not set in environment variables!");
|
|
710
738
|
const i = `${this._swarmKey}.${this._appKey}.${r}`;
|
|
711
739
|
return this.publish(i, s, o);
|
|
712
740
|
}
|
|
713
741
|
async appendToTable(r, s, o) {
|
|
714
|
-
const
|
|
715
|
-
if (!
|
|
716
|
-
throw new Error(`Invalid table parameters: ${
|
|
742
|
+
const c = N({ tablename: r, args: s, kwargs: o });
|
|
743
|
+
if (!c.success)
|
|
744
|
+
throw new Error(`Invalid table parameters: ${c.errors.map((a) => a.path + ": " + a.expected).join(", ")}`);
|
|
717
745
|
if (!this._swarmKey) throw new Error("SWARM_KEY not set in environment variables!");
|
|
718
746
|
if (!this._appKey) throw new Error("APP_KEY not set in environment variables!");
|
|
719
747
|
const i = `append.${this._swarmKey}.${this._appKey}.${r}`, t = { ...{
|
|
@@ -729,23 +757,23 @@ class O {
|
|
|
729
757
|
async subscribeToTable(r, s, o) {
|
|
730
758
|
if (!this._swarmKey) throw new Error("SWARM_KEY not set in environment variables!");
|
|
731
759
|
if (!this._appKey) throw new Error("APP_KEY not set in environment variables!");
|
|
732
|
-
const
|
|
733
|
-
return this.subscribe(
|
|
760
|
+
const c = `${this._swarmKey}.${this._appKey}.${r}`;
|
|
761
|
+
return this.subscribe(c, s, o);
|
|
734
762
|
}
|
|
735
|
-
async call(r, s, o,
|
|
736
|
-
return this._connection.call(r, s, o,
|
|
763
|
+
async call(r, s, o, c) {
|
|
764
|
+
return this._connection.call(r, s, o, c);
|
|
737
765
|
}
|
|
738
|
-
async callDeviceFunction(r, s, o,
|
|
766
|
+
async callDeviceFunction(r, s, o, c, i) {
|
|
739
767
|
const u = `${this._swarmKey}.${r}.${this._appKey}.${this._env}.${s}`;
|
|
740
|
-
return this._connection.call(u, o,
|
|
768
|
+
return this._connection.call(u, o, c, i);
|
|
741
769
|
}
|
|
742
770
|
/** @deprecated Use callDeviceFunction() instead. */
|
|
743
|
-
async callFunction(r, s, o,
|
|
744
|
-
return console.warn("callFunction() is deprecated and will be removed in a future version. Use callDeviceFunction() instead."), this.callDeviceFunction(r, s, o,
|
|
771
|
+
async callFunction(r, s, o, c, i) {
|
|
772
|
+
return console.warn("callFunction() is deprecated and will be removed in a future version. Use callDeviceFunction() instead."), this.callDeviceFunction(r, s, o, c, i);
|
|
745
773
|
}
|
|
746
774
|
async registerDeviceFunction(r, s, o) {
|
|
747
|
-
const
|
|
748
|
-
return console.log(`Function registered for IronFlock topic '${r}'. (Full WAMP topic: '${
|
|
775
|
+
const c = `${this._swarmKey}.${this._deviceKey}.${this._appKey}.${this._env}.${r}`, i = await this._connection.register(c, s, o);
|
|
776
|
+
return console.log(`Function registered for IronFlock topic '${r}'. (Full WAMP topic: '${c}')`), i;
|
|
749
777
|
}
|
|
750
778
|
/** @deprecated Use registerDeviceFunction() instead. */
|
|
751
779
|
async registerFunction(r, s, o) {
|
|
@@ -760,19 +788,19 @@ class O {
|
|
|
760
788
|
const o = q(s);
|
|
761
789
|
if (!o.success)
|
|
762
790
|
throw new Error(`Invalid query parameters: ${o.errors.map((i) => i.path + ": " + i.expected).join(", ")}`);
|
|
763
|
-
const
|
|
791
|
+
const c = `history.transformed.app.${this._appKey}.${r}`;
|
|
764
792
|
try {
|
|
765
|
-
return await this._connection.call(
|
|
793
|
+
return await this._connection.call(c, [s]);
|
|
766
794
|
} catch (i) {
|
|
767
795
|
const u = String(i);
|
|
768
|
-
return u.includes("no_such_procedure") || u.includes("no callee registered") ? (console.error(`Get history failed: History service procedure '${
|
|
796
|
+
return u.includes("no_such_procedure") || u.includes("no callee registered") ? (console.error(`Get history failed: History service procedure '${c}' not registered`), null) : (console.error(`Get history failed: ${i}`), null);
|
|
769
797
|
}
|
|
770
798
|
}
|
|
771
799
|
async setDeviceLocation(r, s) {
|
|
772
800
|
const o = X({ longitude: r, latitude: s });
|
|
773
801
|
if (!o.success)
|
|
774
802
|
throw new Error(`Invalid location parameters: ${o.errors.map((u) => u.path + ": " + u.expected).join(", ")}`);
|
|
775
|
-
const
|
|
803
|
+
const c = { long: r, lat: s }, i = {
|
|
776
804
|
DEVICE_SERIAL_NUMBER: this._serialNumber,
|
|
777
805
|
DEVICE_KEY: this._deviceKey,
|
|
778
806
|
DEVICE_NAME: this._deviceName
|
|
@@ -780,7 +808,7 @@ class O {
|
|
|
780
808
|
try {
|
|
781
809
|
return await this._connection.call(
|
|
782
810
|
"ironflock.location_service.update",
|
|
783
|
-
[
|
|
811
|
+
[c],
|
|
784
812
|
i
|
|
785
813
|
);
|
|
786
814
|
} catch (u) {
|
|
@@ -805,17 +833,17 @@ class O {
|
|
|
805
833
|
if (!s.ok)
|
|
806
834
|
throw new Error(`Failed to fetch IronFlock config from ${r}: ${s.status} ${s.statusText}`);
|
|
807
835
|
const o = await s.json();
|
|
808
|
-
return new
|
|
836
|
+
return new T(o);
|
|
809
837
|
}
|
|
810
838
|
}
|
|
811
839
|
export {
|
|
812
|
-
|
|
813
|
-
|
|
840
|
+
I as CrossbarConnection,
|
|
841
|
+
T as IronFlock,
|
|
814
842
|
M as Stage,
|
|
815
843
|
te as validateCallParams,
|
|
816
844
|
X as validateLocationParams,
|
|
817
845
|
Z as validatePublishParams,
|
|
818
|
-
|
|
846
|
+
N as validateTableParams,
|
|
819
847
|
q as validateTableQueryParams
|
|
820
848
|
};
|
|
821
849
|
//# sourceMappingURL=index.mjs.map
|