ironflock 1.2.2 → 1.2.4
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 +28 -8
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +11 -8
- package/dist/index.mjs +90 -78
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import C from "autobahn";
|
|
2
2
|
function P(d) {
|
|
3
3
|
return d && d.__esModule && Object.prototype.hasOwnProperty.call(d, "default") ? d.default : d;
|
|
4
4
|
}
|
|
5
|
-
var
|
|
5
|
+
var I = { exports: {} }, N;
|
|
6
6
|
function L() {
|
|
7
|
-
return
|
|
7
|
+
return N || (N = 1, (function(d) {
|
|
8
8
|
var r = Object.prototype.hasOwnProperty, s = "~";
|
|
9
9
|
function o() {
|
|
10
10
|
}
|
|
@@ -15,8 +15,8 @@ function L() {
|
|
|
15
15
|
function i(a, e, n, c, f) {
|
|
16
16
|
if (typeof n != "function")
|
|
17
17
|
throw new TypeError("The listener must be a function");
|
|
18
|
-
var v = new l(n, c || a, f),
|
|
19
|
-
return a._events[
|
|
18
|
+
var v = new l(n, c || a, f), g = s ? s + e : e;
|
|
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) {
|
|
22
22
|
--a._eventsCount === 0 ? a._events = new o() : delete a._events[e];
|
|
@@ -34,16 +34,16 @@ function L() {
|
|
|
34
34
|
var n = s ? s + e : e, c = this._events[n];
|
|
35
35
|
if (!c) return [];
|
|
36
36
|
if (c.fn) return [c.fn];
|
|
37
|
-
for (var f = 0, v = c.length,
|
|
38
|
-
|
|
39
|
-
return
|
|
37
|
+
for (var f = 0, v = c.length, g = new Array(v); f < v; f++)
|
|
38
|
+
g[f] = c[f].fn;
|
|
39
|
+
return g;
|
|
40
40
|
}, t.prototype.listenerCount = function(e) {
|
|
41
41
|
var n = s ? s + e : e, c = this._events[n];
|
|
42
42
|
return c ? c.fn ? 1 : c.length : 0;
|
|
43
|
-
}, t.prototype.emit = function(e, n, c, f, v,
|
|
43
|
+
}, t.prototype.emit = function(e, n, c, f, v, g) {
|
|
44
44
|
var w = s ? s + e : e;
|
|
45
45
|
if (!this._events[w]) return !1;
|
|
46
|
-
var h = this._events[w], b = arguments.length, _,
|
|
46
|
+
var h = this._events[w], b = arguments.length, _, y;
|
|
47
47
|
if (h.fn) {
|
|
48
48
|
switch (h.once && this.removeListener(e, h.fn, void 0, !0), b) {
|
|
49
49
|
case 1:
|
|
@@ -57,31 +57,31 @@ function L() {
|
|
|
57
57
|
case 5:
|
|
58
58
|
return h.fn.call(h.context, n, c, f, v), !0;
|
|
59
59
|
case 6:
|
|
60
|
-
return h.fn.call(h.context, n, c, f, v,
|
|
60
|
+
return h.fn.call(h.context, n, c, f, v, g), !0;
|
|
61
61
|
}
|
|
62
|
-
for (
|
|
63
|
-
_[
|
|
62
|
+
for (y = 1, _ = new Array(b - 1); y < b; y++)
|
|
63
|
+
_[y - 1] = arguments[y];
|
|
64
64
|
h.fn.apply(h.context, _);
|
|
65
65
|
} else {
|
|
66
66
|
var j = h.length, A;
|
|
67
|
-
for (
|
|
68
|
-
switch (h[
|
|
67
|
+
for (y = 0; y < j; y++)
|
|
68
|
+
switch (h[y].once && this.removeListener(e, h[y].fn, void 0, !0), b) {
|
|
69
69
|
case 1:
|
|
70
|
-
h[
|
|
70
|
+
h[y].fn.call(h[y].context);
|
|
71
71
|
break;
|
|
72
72
|
case 2:
|
|
73
|
-
h[
|
|
73
|
+
h[y].fn.call(h[y].context, n);
|
|
74
74
|
break;
|
|
75
75
|
case 3:
|
|
76
|
-
h[
|
|
76
|
+
h[y].fn.call(h[y].context, n, c);
|
|
77
77
|
break;
|
|
78
78
|
case 4:
|
|
79
|
-
h[
|
|
79
|
+
h[y].fn.call(h[y].context, n, c, f);
|
|
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
|
-
h[
|
|
84
|
+
h[y].fn.apply(h[y].context, _);
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
return !0;
|
|
@@ -94,12 +94,12 @@ function L() {
|
|
|
94
94
|
if (!this._events[v]) return this;
|
|
95
95
|
if (!n)
|
|
96
96
|
return u(this, v), this;
|
|
97
|
-
var
|
|
98
|
-
if (
|
|
99
|
-
|
|
97
|
+
var g = this._events[v];
|
|
98
|
+
if (g.fn)
|
|
99
|
+
g.fn === n && (!f || g.once) && (!c || g.context === c) && u(this, v);
|
|
100
100
|
else {
|
|
101
|
-
for (var w = 0, h = [], b =
|
|
102
|
-
(
|
|
101
|
+
for (var w = 0, h = [], b = g.length; w < b; w++)
|
|
102
|
+
(g[w].fn !== n || f && !g[w].once || c && g[w].context !== c) && h.push(g[w]);
|
|
103
103
|
h.length ? this._events[v] = h.length === 1 ? h[0] : h : u(this, v);
|
|
104
104
|
}
|
|
105
105
|
return this;
|
|
@@ -107,26 +107,26 @@ function L() {
|
|
|
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
|
+
})(I)), I.exports;
|
|
111
111
|
}
|
|
112
|
-
var
|
|
113
|
-
const
|
|
114
|
-
"https://studio.datapods.io":
|
|
115
|
-
"https://studio.ironflock.dev":
|
|
116
|
-
"https://studio.ironflock.com":
|
|
112
|
+
var D = L();
|
|
113
|
+
const U = /* @__PURE__ */ P(D), F = "wss://cbw.datapods.io/ws-ua-usr", $ = "wss://cbw.ironflock.com/ws-ua-usr", W = "wss://cbw.ironflock.dev/ws-ua-usr", V = "wss://cbw.record-evolution.com/ws-ua-usr", S = "ws://localhost:8080/ws-ua-usr", Y = {
|
|
114
|
+
"https://studio.datapods.io": F,
|
|
115
|
+
"https://studio.ironflock.dev": W,
|
|
116
|
+
"https://studio.ironflock.com": $,
|
|
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": S,
|
|
119
|
+
"http://localhost:8086": S,
|
|
120
|
+
"http://host.docker.internal:8086": S
|
|
121
121
|
}, Q = 6e3;
|
|
122
|
-
class x extends
|
|
122
|
+
class x extends U {
|
|
123
123
|
constructor() {
|
|
124
124
|
super(), this.subscriptions = [], this.registrations = [], this.firstResolver = () => {
|
|
125
125
|
}, this.firstRejecter = () => {
|
|
126
126
|
};
|
|
127
127
|
}
|
|
128
128
|
static getWebSocketURI(r) {
|
|
129
|
-
return r ? Y[r] ??
|
|
129
|
+
return r ? Y[r] ?? $ : $;
|
|
130
130
|
}
|
|
131
131
|
configure(r, s, o, l, i) {
|
|
132
132
|
this.realm = `realm-${r}-${s}-${o}`, this.serial_number = l, this.socketURI = i ?? x.getWebSocketURI();
|
|
@@ -136,7 +136,7 @@ class x extends D {
|
|
|
136
136
|
throw new Error("CrossbarConnection must be configured before starting. Call configure() first.");
|
|
137
137
|
return this.firstConnection = new Promise((r, s) => {
|
|
138
138
|
this.firstResolver = r, this.firstRejecter = s;
|
|
139
|
-
}), this.connection = new
|
|
139
|
+
}), this.connection = new C.Connection({
|
|
140
140
|
realm: this.realm,
|
|
141
141
|
url: this.socketURI,
|
|
142
142
|
authmethods: ["wampcra"],
|
|
@@ -147,7 +147,7 @@ class x extends D {
|
|
|
147
147
|
// @ts-ignore
|
|
148
148
|
autoping_interval: 2,
|
|
149
149
|
autoping_timeout: 4,
|
|
150
|
-
onchallenge: (r, s, o) =>
|
|
150
|
+
onchallenge: (r, s, o) => C.auth_cra.sign(this.serial_number, o.challenge)
|
|
151
151
|
}), this.connection.onopen = this.onOpen.bind(this), this.connection.onclose = this.onClose.bind(this), this.connection.open(), this.firstConnection;
|
|
152
152
|
}
|
|
153
153
|
onOpen(r) {
|
|
@@ -216,11 +216,11 @@ class x extends D {
|
|
|
216
216
|
r.map((s) => this.subscribe(s.topic, s.handler))
|
|
217
217
|
);
|
|
218
218
|
}
|
|
219
|
-
async register(r, s) {
|
|
220
|
-
var
|
|
219
|
+
async register(r, s, o) {
|
|
220
|
+
var u;
|
|
221
221
|
await this.sessionWait();
|
|
222
|
-
const o = await ((
|
|
223
|
-
return
|
|
222
|
+
const l = { force_reregister: !0, ...o ?? {} }, i = await ((u = this.session) == null ? void 0 : u.register(r, s, l));
|
|
223
|
+
return i && this.registrations.push(i), i;
|
|
224
224
|
}
|
|
225
225
|
async unregister(r) {
|
|
226
226
|
var o;
|
|
@@ -237,7 +237,7 @@ class x extends D {
|
|
|
237
237
|
return await this.sessionWait(), (i = this.session) == null ? void 0 : i.publish(r, s, o, l);
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
|
-
const
|
|
240
|
+
const K = (d) => Math.floor(d) === d && B <= d && d <= J, B = 0, J = 2 ** 32 - 1, R = (d) => q.test(d), q = /^[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, k = (d) => {
|
|
241
241
|
const r = (s) => {
|
|
242
242
|
if (d.length === 0)
|
|
243
243
|
return !0;
|
|
@@ -267,43 +267,43 @@ const R = (d) => Math.floor(d) === d && B <= d && d <= J, B = 0, J = 2 ** 32 - 1
|
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
269
|
});
|
|
270
|
-
var
|
|
270
|
+
var m;
|
|
271
271
|
(function(d) {
|
|
272
272
|
d[d.Start = 0] = "Start", d[d.Property = 1] = "Property", d[d.StringKey = 2] = "StringKey", d[d.NumberKey = 3] = "NumberKey";
|
|
273
|
-
})(
|
|
273
|
+
})(m || (m = {}));
|
|
274
274
|
const H = (d) => {
|
|
275
275
|
if (!d.startsWith("$input"))
|
|
276
276
|
throw new Error(`Invalid path: ${JSON.stringify(d)}`);
|
|
277
277
|
const r = [];
|
|
278
|
-
let s = "", o =
|
|
278
|
+
let s = "", o = m.Start, l = 5;
|
|
279
279
|
for (; l < d.length - 1; ) {
|
|
280
280
|
l++;
|
|
281
281
|
const i = d[l];
|
|
282
|
-
if (o ===
|
|
282
|
+
if (o === m.Property ? i === "." || i === "[" ? (r.push({
|
|
283
283
|
key: s
|
|
284
|
-
}), o =
|
|
284
|
+
}), o = m.Start) : l === d.length - 1 ? (s += i, r.push({
|
|
285
285
|
key: s
|
|
286
|
-
}), l++, o =
|
|
286
|
+
}), l++, o = m.Start) : s += i : o === m.StringKey ? i === '"' ? (r.push({
|
|
287
287
|
key: JSON.parse(s + i)
|
|
288
|
-
}), l += 2, o =
|
|
288
|
+
}), l += 2, o = m.Start) : i === "\\" ? (s += d[l], l++, s += d[l]) : s += i : o === m.NumberKey && (i === "]" ? (r.push({
|
|
289
289
|
key: Number.parseInt(s)
|
|
290
|
-
}), l++, o =
|
|
290
|
+
}), l++, o = m.Start) : s += i), o === m.Start && l < d.length - 1) {
|
|
291
291
|
const u = d[l];
|
|
292
292
|
if (s = "", u === "[")
|
|
293
|
-
d[l + 1] === '"' ? (o =
|
|
293
|
+
d[l + 1] === '"' ? (o = m.StringKey, l++, s = '"') : o = m.NumberKey;
|
|
294
294
|
else if (u === ".")
|
|
295
|
-
o =
|
|
295
|
+
o = m.Property;
|
|
296
296
|
else
|
|
297
297
|
throw new Error("Unreachable: pointer points invalid character");
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
|
-
if (o !==
|
|
300
|
+
if (o !== m.Start)
|
|
301
301
|
throw new Error(`Failed to parse path: ${JSON.stringify(d)}`);
|
|
302
302
|
return r;
|
|
303
303
|
};
|
|
304
304
|
var M = /* @__PURE__ */ ((d) => (d.DEVELOPMENT = "dev", d.PRODUCTION = "prod", d))(M || {});
|
|
305
305
|
const G = (() => {
|
|
306
|
-
const d = (e) => typeof e.limit == "number" &&
|
|
306
|
+
const d = (e) => typeof e.limit == "number" && K(e.limit) && 1 <= e.limit && e.limit <= 1e4 && (e.offset === void 0 || typeof e.offset == "number" && K(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" && R(e.start) && typeof e.end == "string" && R(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, c = !0) => [typeof e.limit == "number" && (K(e.limit) || a(c, {
|
|
307
307
|
path: n + ".limit",
|
|
308
308
|
expected: 'number & Type<"uint32">',
|
|
309
309
|
value: e.limit
|
|
@@ -319,7 +319,7 @@ const G = (() => {
|
|
|
319
319
|
path: n + ".limit",
|
|
320
320
|
expected: '(number & Type<"uint32"> & Minimum<1> & Maximum<10000>)',
|
|
321
321
|
value: e.limit
|
|
322
|
-
}), e.offset === void 0 || typeof e.offset == "number" && (
|
|
322
|
+
}), e.offset === void 0 || typeof e.offset == "number" && (K(e.offset) || a(c, {
|
|
323
323
|
path: n + ".offset",
|
|
324
324
|
expected: 'number & Type<"uint32">',
|
|
325
325
|
value: e.offset
|
|
@@ -355,7 +355,7 @@ const G = (() => {
|
|
|
355
355
|
path: n + ".filterAnd",
|
|
356
356
|
expected: "(Array<SQLFilterAnd> | undefined)",
|
|
357
357
|
value: e.filterAnd
|
|
358
|
-
})].every((f) => f), l = (e, n, c = !0) => [typeof e.start == "string" && (
|
|
358
|
+
})].every((f) => f), l = (e, n, c = !0) => [typeof e.start == "string" && (R(e.start) || a(c, {
|
|
359
359
|
path: n + ".start",
|
|
360
360
|
expected: 'string & Format<"date-time">',
|
|
361
361
|
value: e.start
|
|
@@ -363,7 +363,7 @@ const G = (() => {
|
|
|
363
363
|
path: n + ".start",
|
|
364
364
|
expected: '(string & Format<"date-time">)',
|
|
365
365
|
value: e.start
|
|
366
|
-
}), typeof e.end == "string" && (
|
|
366
|
+
}), typeof e.end == "string" && (R(e.end) || a(c, {
|
|
367
367
|
path: n + ".end",
|
|
368
368
|
expected: 'string & Format<"date-time">',
|
|
369
369
|
value: e.end
|
|
@@ -537,7 +537,7 @@ const G = (() => {
|
|
|
537
537
|
data: t
|
|
538
538
|
};
|
|
539
539
|
});
|
|
540
|
-
})(),
|
|
540
|
+
})(), te = (() => {
|
|
541
541
|
const d = (t) => typeof t.deviceKey == "string" && 1 <= t.deviceKey.length && typeof t.topic == "string" && 1 <= t.topic.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.deviceKey == "string" && (1 <= t.deviceKey.length || u(e, {
|
|
542
542
|
path: a + ".deviceKey",
|
|
543
543
|
expected: "string & MinLength<1>",
|
|
@@ -594,7 +594,7 @@ const G = (() => {
|
|
|
594
594
|
data: t
|
|
595
595
|
};
|
|
596
596
|
});
|
|
597
|
-
})(),
|
|
597
|
+
})(), T = (() => {
|
|
598
598
|
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
599
|
path: a + ".tablename",
|
|
600
600
|
expected: "string & MinLength<1>",
|
|
@@ -648,7 +648,7 @@ function E(d) {
|
|
|
648
648
|
var r;
|
|
649
649
|
return typeof process < "u" ? (r = process.env) == null ? void 0 : r[d] : void 0;
|
|
650
650
|
}
|
|
651
|
-
function
|
|
651
|
+
function z(d) {
|
|
652
652
|
const r = d ?? E("DEVICE_SERIAL_NUMBER");
|
|
653
653
|
if (!r)
|
|
654
654
|
throw new Error("serialNumber option is required (or set DEVICE_SERIAL_NUMBER env var in Node.js)");
|
|
@@ -656,7 +656,7 @@ function ee(d) {
|
|
|
656
656
|
}
|
|
657
657
|
class O {
|
|
658
658
|
constructor(r) {
|
|
659
|
-
this._isConfigured = !1, this._serialNumber =
|
|
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 x();
|
|
660
660
|
const s = [];
|
|
661
661
|
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
662
|
`Warning: The following environment variables must be present: ${s.join(", ")}`
|
|
@@ -702,7 +702,7 @@ class O {
|
|
|
702
702
|
});
|
|
703
703
|
}
|
|
704
704
|
async publishToTable(r, s, o) {
|
|
705
|
-
const l =
|
|
705
|
+
const l = T({ tablename: r, args: s, kwargs: o });
|
|
706
706
|
if (!l.success)
|
|
707
707
|
throw new Error(`Invalid table parameters: ${l.errors.map((u) => u.path + ": " + u.expected).join(", ")}`);
|
|
708
708
|
if (!this._swarmKey) throw new Error("SWARM_KEY not set in environment variables!");
|
|
@@ -711,13 +711,17 @@ class O {
|
|
|
711
711
|
return this.publish(i, s, o);
|
|
712
712
|
}
|
|
713
713
|
async appendToTable(r, s, o) {
|
|
714
|
-
const l =
|
|
714
|
+
const l = T({ tablename: r, args: s, kwargs: o });
|
|
715
715
|
if (!l.success)
|
|
716
|
-
throw new Error(`Invalid table parameters: ${l.errors.map((
|
|
716
|
+
throw new Error(`Invalid table parameters: ${l.errors.map((a) => a.path + ": " + a.expected).join(", ")}`);
|
|
717
717
|
if (!this._swarmKey) throw new Error("SWARM_KEY not set in environment variables!");
|
|
718
718
|
if (!this._appKey) throw new Error("APP_KEY not set in environment variables!");
|
|
719
|
-
const i = `append.${this._swarmKey}.${this._appKey}.${r}
|
|
720
|
-
|
|
719
|
+
const i = `append.${this._swarmKey}.${this._appKey}.${r}`, t = { ...{
|
|
720
|
+
DEVICE_SERIAL_NUMBER: this._serialNumber,
|
|
721
|
+
DEVICE_KEY: this._deviceKey,
|
|
722
|
+
DEVICE_NAME: this._deviceName
|
|
723
|
+
}, ...o ?? {} };
|
|
724
|
+
return this._connection.call(i, s, t);
|
|
721
725
|
}
|
|
722
726
|
async subscribe(r, s, o) {
|
|
723
727
|
return this._connection.subscribe(r, s);
|
|
@@ -728,19 +732,27 @@ class O {
|
|
|
728
732
|
const l = `${this._swarmKey}.${this._appKey}.${r}`;
|
|
729
733
|
return this.subscribe(l, s, o);
|
|
730
734
|
}
|
|
731
|
-
async call(r, s, o, l
|
|
732
|
-
|
|
733
|
-
if (!u.success)
|
|
734
|
-
throw new Error(`Invalid call parameters: ${u.errors.map((a) => a.path + ": " + a.expected).join(", ")}`);
|
|
735
|
-
const t = `${r}.${s}`;
|
|
736
|
-
return this._connection.call(t, o, l, i);
|
|
735
|
+
async call(r, s, o, l) {
|
|
736
|
+
return this._connection.call(r, s, o, l);
|
|
737
737
|
}
|
|
738
|
-
async
|
|
739
|
-
const
|
|
738
|
+
async callDeviceFunction(r, s, o, l, i) {
|
|
739
|
+
const u = `${this._swarmKey}.${r}.${this._appKey}.${this._env}.${s}`;
|
|
740
|
+
return this._connection.call(u, o, l, i);
|
|
741
|
+
}
|
|
742
|
+
/** @deprecated Use callDeviceFunction() instead. */
|
|
743
|
+
async callFunction(r, s, o, l, i) {
|
|
744
|
+
return console.warn("callFunction() is deprecated and will be removed in a future version. Use callDeviceFunction() instead."), this.callDeviceFunction(r, s, o, l, i);
|
|
745
|
+
}
|
|
746
|
+
async registerDeviceFunction(r, s, o) {
|
|
747
|
+
const l = `${this._swarmKey}.${this._deviceKey}.${this._appKey}.${this._env}.${r}`, i = await this._connection.register(l, s, o);
|
|
740
748
|
return console.log(`Function registered for IronFlock topic '${r}'. (Full WAMP topic: '${l}')`), i;
|
|
741
749
|
}
|
|
750
|
+
/** @deprecated Use registerDeviceFunction() instead. */
|
|
751
|
+
async registerFunction(r, s, o) {
|
|
752
|
+
return console.warn("registerFunction() is deprecated and will be removed in a future version. Use registerDeviceFunction() instead."), this.registerDeviceFunction(r, s, o);
|
|
753
|
+
}
|
|
742
754
|
async register(r, s, o) {
|
|
743
|
-
return this.
|
|
755
|
+
return this.registerDeviceFunction(r, s, o);
|
|
744
756
|
}
|
|
745
757
|
async getHistory(r, s = { limit: 10 }) {
|
|
746
758
|
if (!r) throw new Error("Tablename must not be empty!");
|
|
@@ -799,10 +811,10 @@ export {
|
|
|
799
811
|
x as CrossbarConnection,
|
|
800
812
|
O as IronFlock,
|
|
801
813
|
M as Stage,
|
|
802
|
-
|
|
814
|
+
te as validateCallParams,
|
|
803
815
|
X as validateLocationParams,
|
|
804
816
|
Z as validatePublishParams,
|
|
805
|
-
|
|
817
|
+
T as validateTableParams,
|
|
806
818
|
G as validateTableQueryParams
|
|
807
819
|
};
|
|
808
820
|
//# sourceMappingURL=index.mjs.map
|