ironflock 1.2.9 → 1.3.2

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.mjs CHANGED
@@ -1,156 +1,156 @@
1
- import x from "autobahn";
1
+ import N from "autobahn";
2
2
  function D(d) {
3
3
  return d && d.__esModule && Object.prototype.hasOwnProperty.call(d, "default") ? d.default : d;
4
4
  }
5
- var S = { exports: {} }, O;
6
- function j() {
7
- return O || (O = 1, (function(d) {
8
- var r = Object.prototype.hasOwnProperty, s = "~";
9
- function o() {
5
+ var $ = { exports: {} }, T;
6
+ function U() {
7
+ return T || (T = 1, (function(d) {
8
+ var t = Object.prototype.hasOwnProperty, s = "~";
9
+ function a() {
10
10
  }
11
- Object.create && (o.prototype = /* @__PURE__ */ Object.create(null), new o().__proto__ || (s = !1));
12
- function c(i, e, n) {
13
- this.fn = i, this.context = e, this.once = n || !1;
11
+ Object.create && (a.prototype = /* @__PURE__ */ Object.create(null), new a().__proto__ || (s = !1));
12
+ function l(o, r, n) {
13
+ this.fn = o, this.context = r, this.once = n || !1;
14
14
  }
15
- function a(i, e, n, l, h) {
15
+ function i(o, r, n, u, f) {
16
16
  if (typeof n != "function")
17
17
  throw new TypeError("The listener must be a function");
18
- var v = new c(n, l || i, h), g = s ? s + e : e;
19
- return i._events[g] ? i._events[g].fn ? i._events[g] = [i._events[g], v] : i._events[g].push(v) : (i._events[g] = v, i._eventsCount++), i;
18
+ var v = new l(n, u || o, f), y = s ? s + r : r;
19
+ return o._events[y] ? o._events[y].fn ? o._events[y] = [o._events[y], v] : o._events[y].push(v) : (o._events[y] = v, o._eventsCount++), o;
20
20
  }
21
- function u(i, e) {
22
- --i._eventsCount === 0 ? i._events = new o() : delete i._events[e];
21
+ function c(o, r) {
22
+ --o._eventsCount === 0 ? o._events = new a() : delete o._events[r];
23
23
  }
24
- function t() {
25
- this._events = new o(), this._eventsCount = 0;
24
+ function e() {
25
+ this._events = new a(), this._eventsCount = 0;
26
26
  }
27
- t.prototype.eventNames = function() {
28
- var e = [], n, l;
29
- if (this._eventsCount === 0) return e;
30
- for (l in n = this._events)
31
- r.call(n, l) && e.push(s ? l.slice(1) : l);
32
- return Object.getOwnPropertySymbols ? e.concat(Object.getOwnPropertySymbols(n)) : e;
33
- }, t.prototype.listeners = function(e) {
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
- return g;
40
- }, t.prototype.listenerCount = function(e) {
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
- var w = s ? s + e : e;
27
+ e.prototype.eventNames = function() {
28
+ var r = [], n, u;
29
+ if (this._eventsCount === 0) return r;
30
+ for (u in n = this._events)
31
+ t.call(n, u) && r.push(s ? u.slice(1) : u);
32
+ return Object.getOwnPropertySymbols ? r.concat(Object.getOwnPropertySymbols(n)) : r;
33
+ }, e.prototype.listeners = function(r) {
34
+ var n = s ? s + r : r, u = this._events[n];
35
+ if (!u) return [];
36
+ if (u.fn) return [u.fn];
37
+ for (var f = 0, v = u.length, y = new Array(v); f < v; f++)
38
+ y[f] = u[f].fn;
39
+ return y;
40
+ }, e.prototype.listenerCount = function(r) {
41
+ var n = s ? s + r : r, u = this._events[n];
42
+ return u ? u.fn ? 1 : u.length : 0;
43
+ }, e.prototype.emit = function(r, n, u, f, v, y) {
44
+ var w = s ? s + r : r;
45
45
  if (!this._events[w]) return !1;
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) {
46
+ var h = this._events[w], b = arguments.length, A, g;
47
+ if (h.fn) {
48
+ switch (h.once && this.removeListener(r, h.fn, void 0, !0), b) {
49
49
  case 1:
50
- return f.fn.call(f.context), !0;
50
+ return h.fn.call(h.context), !0;
51
51
  case 2:
52
- return f.fn.call(f.context, n), !0;
52
+ return h.fn.call(h.context, n), !0;
53
53
  case 3:
54
- return f.fn.call(f.context, n, l), !0;
54
+ return h.fn.call(h.context, n, u), !0;
55
55
  case 4:
56
- return f.fn.call(f.context, n, l, h), !0;
56
+ return h.fn.call(h.context, n, u, f), !0;
57
57
  case 5:
58
- return f.fn.call(f.context, n, l, h, v), !0;
58
+ return h.fn.call(h.context, n, u, f, v), !0;
59
59
  case 6:
60
- return f.fn.call(f.context, n, l, h, v, g), !0;
60
+ return h.fn.call(h.context, n, u, f, v, y), !0;
61
61
  }
62
- for (y = 1, _ = new Array(b - 1); y < b; y++)
63
- _[y - 1] = arguments[y];
64
- f.fn.apply(f.context, _);
62
+ for (g = 1, A = new Array(b - 1); g < b; g++)
63
+ A[g - 1] = arguments[g];
64
+ h.fn.apply(h.context, A);
65
65
  } else {
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) {
66
+ var L = h.length, R;
67
+ for (g = 0; g < L; g++)
68
+ switch (h[g].once && this.removeListener(r, h[g].fn, void 0, !0), b) {
69
69
  case 1:
70
- f[y].fn.call(f[y].context);
70
+ h[g].fn.call(h[g].context);
71
71
  break;
72
72
  case 2:
73
- f[y].fn.call(f[y].context, n);
73
+ h[g].fn.call(h[g].context, n);
74
74
  break;
75
75
  case 3:
76
- f[y].fn.call(f[y].context, n, l);
76
+ h[g].fn.call(h[g].context, n, u);
77
77
  break;
78
78
  case 4:
79
- f[y].fn.call(f[y].context, n, l, h);
79
+ h[g].fn.call(h[g].context, n, u, f);
80
80
  break;
81
81
  default:
82
- if (!_) for (A = 1, _ = new Array(b - 1); A < b; A++)
83
- _[A - 1] = arguments[A];
84
- f[y].fn.apply(f[y].context, _);
82
+ if (!A) for (R = 1, A = new Array(b - 1); R < b; R++)
83
+ A[R - 1] = arguments[R];
84
+ h[g].fn.apply(h[g].context, A);
85
85
  }
86
86
  }
87
87
  return !0;
88
- }, t.prototype.on = function(e, n, l) {
89
- return a(this, e, n, l, !1);
90
- }, t.prototype.once = function(e, n, l) {
91
- return a(this, e, n, l, !0);
92
- }, t.prototype.removeListener = function(e, n, l, h) {
93
- var v = s ? s + e : e;
88
+ }, e.prototype.on = function(r, n, u) {
89
+ return i(this, r, n, u, !1);
90
+ }, e.prototype.once = function(r, n, u) {
91
+ return i(this, r, n, u, !0);
92
+ }, e.prototype.removeListener = function(r, n, u, f) {
93
+ var v = s ? s + r : r;
94
94
  if (!this._events[v]) return this;
95
95
  if (!n)
96
- return u(this, v), this;
97
- var g = this._events[v];
98
- if (g.fn)
99
- g.fn === n && (!h || g.once) && (!l || g.context === l) && u(this, v);
96
+ return c(this, v), this;
97
+ var y = this._events[v];
98
+ if (y.fn)
99
+ y.fn === n && (!f || y.once) && (!u || y.context === u) && c(this, v);
100
100
  else {
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);
101
+ for (var w = 0, h = [], b = y.length; w < b; w++)
102
+ (y[w].fn !== n || f && !y[w].once || u && y[w].context !== u) && h.push(y[w]);
103
+ h.length ? this._events[v] = h.length === 1 ? h[0] : h : c(this, v);
104
104
  }
105
105
  return this;
106
- }, t.prototype.removeAllListeners = function(e) {
106
+ }, e.prototype.removeAllListeners = function(r) {
107
107
  var n;
108
- return e ? (n = s ? s + e : e, this._events[n] && u(this, n)) : (this._events = new o(), this._eventsCount = 0), this;
109
- }, t.prototype.off = t.prototype.removeListener, t.prototype.addListener = t.prototype.on, t.prefixed = s, t.EventEmitter = t, d.exports = t;
110
- })(S)), S.exports;
108
+ return r ? (n = s ? s + r : r, this._events[n] && c(this, n)) : (this._events = new a(), this._eventsCount = 0), this;
109
+ }, e.prototype.off = e.prototype.removeListener, e.prototype.addListener = e.prototype.on, e.prefixed = s, e.EventEmitter = e, d.exports = e;
110
+ })($)), $.exports;
111
111
  }
112
- var U = j();
113
- const F = /* @__PURE__ */ D(U), W = "wss://cbw.datapods.io/ws-ua-usr", T = "wss://cbw.ironflock.com/ws-ua-usr", V = "wss://cbw.ironflock.dev/ws-ua-usr", Y = "wss://cbw.record-evolution.com/ws-ua-usr", $ = "ws://localhost:8080/ws-ua-usr", N = {
114
- "https://studio.datapods.io": W,
115
- "https://studio.ironflock.dev": V,
116
- "https://studio.ironflock.com": T,
117
- "https://studio.record-evolution.com": Y,
118
- "http://localhost:8085": $,
119
- "http://localhost:8086": $,
120
- "http://host.docker.internal:8086": $
112
+ var F = U();
113
+ const W = /* @__PURE__ */ D(F), V = "wss://cbw.datapods.io/ws-ua-usr", j = "wss://cbw.ironflock.com/ws-ua-usr", Y = "wss://cbw.ironflock.dev/ws-ua-usr", B = "wss://cbw.record-evolution.com/ws-ua-usr", S = "ws://localhost:8080/ws-ua-usr", x = {
114
+ "https://studio.datapods.io": V,
115
+ "https://studio.ironflock.dev": Y,
116
+ "https://studio.ironflock.com": j,
117
+ "https://studio.record-evolution.com": B,
118
+ "http://localhost:8085": S,
119
+ "http://localhost:8086": S,
120
+ "http://host.docker.internal:8086": S
121
121
  }, Q = 6e3;
122
- class I extends F {
122
+ class I extends W {
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
- static getWebSocketURI(r) {
129
- var c;
130
- const s = typeof process < "u" ? (c = process.env) == null ? void 0 : c.DEVICE_ENDPOINT_URL : void 0;
128
+ static getWebSocketURI(t) {
129
+ var l;
130
+ const s = typeof process < "u" ? (l = process.env) == null ? void 0 : l.DEVICE_ENDPOINT_URL : void 0;
131
131
  if (s)
132
132
  try {
133
- const a = new URL(s);
134
- return a.pathname = "/ws-ua-usr", a.toString().replace(/\/$/, "");
133
+ const i = new URL(s);
134
+ return i.pathname = "/ws-ua-usr", i.toString().replace(/\/$/, "");
135
135
  } catch {
136
136
  }
137
- if (!r) return T;
138
- const o = N[r];
139
- if (o === void 0)
137
+ if (!t) return j;
138
+ const a = x[t];
139
+ if (a === void 0)
140
140
  throw new Error(
141
- `Cannot resolve WebSocket URI for reswarmUrl=${JSON.stringify(r)}. Set DEVICE_ENDPOINT_URL to the deployment's WAMP router URL (e.g. ws://<host>:18080/ws-re-dev) or pass ironFlockUrl=… to IronFlock(). Known cloud URLs: ${JSON.stringify(Object.keys(N))}`
141
+ `Cannot resolve WebSocket URI for reswarmUrl=${JSON.stringify(t)}. Set DEVICE_ENDPOINT_URL to the deployment's WAMP router URL (e.g. ws://<host>:18080/ws-re-dev) or pass ironFlockUrl=… to IronFlock(). Known cloud URLs: ${JSON.stringify(Object.keys(x))}`
142
142
  );
143
- return o;
143
+ return a;
144
144
  }
145
- configure(r, s, o, c, a) {
146
- this.realm = `realm-${r}-${s}-${o}`, this.serial_number = c, this.socketURI = a ?? I.getWebSocketURI();
145
+ configure(t, s, a, l, i) {
146
+ this.realm = `realm-${t}-${s}-${a}`, this.serial_number = l, this.socketURI = i ?? I.getWebSocketURI();
147
147
  }
148
148
  async start() {
149
149
  if (!this.realm || !this.serial_number || !this.socketURI)
150
150
  throw new Error("CrossbarConnection must be configured before starting. Call configure() first.");
151
- return this.shouldReconnect = !0, this.firstConnection = new Promise((r, s) => {
152
- this.firstResolver = r, this.firstRejecter = s;
153
- }), this.connection = new x.Connection({
151
+ return this.shouldReconnect = !0, this.firstConnection = new Promise((t, s) => {
152
+ this.firstResolver = t, this.firstRejecter = s;
153
+ }), this.connection = new N.Connection({
154
154
  realm: this.realm,
155
155
  url: this.socketURI,
156
156
  authmethods: ["wampcra"],
@@ -161,32 +161,32 @@ class I extends F {
161
161
  // @ts-ignore
162
162
  autoping_interval: 2,
163
163
  autoping_timeout: 4,
164
- onchallenge: (r, s, o) => x.auth_cra.sign(this.serial_number, o.challenge)
164
+ onchallenge: (t, s, a) => N.auth_cra.sign(this.serial_number, a.challenge)
165
165
  }), this.connection.onopen = this.onOpen.bind(this), this.connection.onclose = this.onClose.bind(this), this.connection.open(), this.firstConnection;
166
166
  }
167
- onOpen(r) {
168
- 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 = () => {
167
+ onOpen(t) {
168
+ this.session = t, this.session.caller_disclose_me = !0, this.hasOpenedOnce = !0, this.resubscribeAll(), this.reregisterAll(), this.emit("connected", this.serial_number), this.firstResolver(), this.firstResolver = () => {
169
169
  };
170
170
  }
171
- onClose(r, s) {
171
+ onClose(t, s) {
172
172
  return this.session = void 0, this.emit("disconnected"), this.firstRejecter(
173
173
  new Error(
174
- `Connection failed: ${r} - ${JSON.stringify(s, null, 2)}`
174
+ `Connection failed: ${t} - ${JSON.stringify(s, null, 2)}`
175
175
  )
176
176
  ), this.firstRejecter = () => {
177
177
  }, console.warn("Connection closed:", {
178
- reason: r,
178
+ reason: t,
179
179
  details: s,
180
180
  realm: this.realm,
181
181
  url: this.socketURI,
182
182
  authid: this.serial_number
183
- }), this.shouldReconnect && this.hasOpenedOnce && (s == null ? void 0 : s.will_retry) === !1 && this.handleManualReconnect((s == null ? void 0 : s.reason) ?? r), !1;
183
+ }), this.shouldReconnect && this.hasOpenedOnce && (s == null ? void 0 : s.will_retry) === !1 && this.handleManualReconnect((s == null ? void 0 : s.reason) ?? t), !1;
184
184
  }
185
- async handleManualReconnect(r) {
185
+ async handleManualReconnect(t) {
186
186
  if (!(this.isReconnecting || !this.shouldReconnect)) {
187
187
  for (this.isReconnecting = !0; this.shouldReconnect && !this.session; )
188
188
  if (await new Promise((s) => setTimeout(s, 1e3)), this.shouldReconnect && this.connection && !this.session) {
189
- console.log(`Manually retrying connection after ${r}...`);
189
+ console.log(`Manually retrying connection after ${t}...`);
190
190
  try {
191
191
  this.connection.open(), await new Promise((s) => setTimeout(s, 500));
192
192
  } catch (s) {
@@ -197,9 +197,9 @@ class I extends F {
197
197
  }
198
198
  }
199
199
  async sessionWait() {
200
- const r = Date.now();
200
+ const t = Date.now();
201
201
  for (; !this.session; ) {
202
- if (Date.now() - r > Q)
202
+ if (Date.now() - t > Q)
203
203
  throw new Error("Timeout waiting for session");
204
204
  await new Promise((s) => setTimeout(s, 200));
205
205
  }
@@ -211,91 +211,91 @@ class I extends F {
211
211
  return this.session;
212
212
  }
213
213
  get is_open() {
214
- var r;
215
- return !!((r = this.session) != null && r.isOpen);
214
+ var t;
215
+ return !!((t = this.session) != null && t.isOpen);
216
216
  }
217
217
  isConnected() {
218
218
  return this.is_open;
219
219
  }
220
220
  stop() {
221
- var r;
222
- this.shouldReconnect = !1, (r = this.connection) == null || r.close("wamp.close.normal", "Connection closed by client");
221
+ var t;
222
+ this.shouldReconnect = !1, (t = this.connection) == null || t.close("wamp.close.normal", "Connection closed by client");
223
223
  }
224
- async subscribe(r, s) {
225
- var c;
224
+ async subscribe(t, s) {
225
+ var l;
226
226
  await this.sessionWait();
227
- const o = await ((c = this.session) == null ? void 0 : c.subscribe(r, s));
228
- return o && this.subscriptions.push(o), o;
227
+ const a = await ((l = this.session) == null ? void 0 : l.subscribe(t, s));
228
+ return a && this.subscriptions.push(a), a;
229
229
  }
230
- async unsubscribe(r) {
231
- var o;
230
+ async unsubscribe(t) {
231
+ var a;
232
232
  await this.sessionWait();
233
- const s = this.subscriptions.indexOf(r);
234
- s !== -1 && (this.subscriptions.splice(s, 1), await ((o = this.session) == null ? void 0 : o.unsubscribe(r)));
233
+ const s = this.subscriptions.indexOf(t);
234
+ s !== -1 && (this.subscriptions.splice(s, 1), await ((a = this.session) == null ? void 0 : a.unsubscribe(t)));
235
235
  }
236
- async unsubscribeTopic(r) {
237
- const s = this.subscriptions.filter((o) => o.topic === r);
238
- for (const o of s)
239
- await this.unsubscribe(o);
236
+ async unsubscribeTopic(t) {
237
+ const s = this.subscriptions.filter((a) => a.topic === t);
238
+ for (const a of s)
239
+ await this.unsubscribe(a);
240
240
  }
241
241
  async resubscribeAll() {
242
- const r = [...this.subscriptions];
242
+ const t = [...this.subscriptions];
243
243
  this.subscriptions = [], await Promise.all(
244
- r.map((s) => this.subscribe(s.topic, s.handler))
244
+ t.map((s) => this.subscribe(s.topic, s.handler))
245
245
  );
246
246
  }
247
247
  async reregisterAll() {
248
- const r = [...this.registrations];
248
+ const t = [...this.registrations];
249
249
  this.registrations = [], await Promise.all(
250
- r.map((s) => this.register(s.procedure, s.endpoint, s.options))
250
+ t.map((s) => this.register(s.procedure, s.endpoint, s.options))
251
251
  );
252
252
  }
253
- async register(r, s, o) {
254
- var u;
253
+ async register(t, s, a) {
254
+ var c;
255
255
  await this.sessionWait();
256
- const c = { force_reregister: !0, ...o ?? {} }, a = await ((u = this.session) == null ? void 0 : u.register(r, s, c));
257
- return a && this.registrations.push(a), a;
256
+ const l = { force_reregister: !0, ...a ?? {} }, i = await ((c = this.session) == null ? void 0 : c.register(t, s, l));
257
+ return i && this.registrations.push(i), i;
258
258
  }
259
- async unregister(r) {
260
- var o;
261
- await this.sessionWait(), await ((o = this.session) == null ? void 0 : o.unregister(r));
262
- const s = this.registrations.indexOf(r);
259
+ async unregister(t) {
260
+ var a;
261
+ await this.sessionWait(), await ((a = this.session) == null ? void 0 : a.unregister(t));
262
+ const s = this.registrations.indexOf(t);
263
263
  s !== -1 && this.registrations.splice(s, 1);
264
264
  }
265
- async call(r, s, o, c) {
266
- var a;
267
- return await this.sessionWait(), (a = this.session) == null ? void 0 : a.call(r, s, o, c);
265
+ async call(t, s, a, l) {
266
+ var i;
267
+ return await this.sessionWait(), (i = this.session) == null ? void 0 : i.call(t, s, a, l);
268
268
  }
269
- async publish(r, s, o, c) {
270
- var a;
271
- return await this.sessionWait(), (a = this.session) == null ? void 0 : a.publish(r, s, o, c);
269
+ async publish(t, s, a, l) {
270
+ var i;
271
+ return await this.sessionWait(), (i = this.session) == null ? void 0 : i.publish(t, s, a, l);
272
272
  }
273
273
  }
274
- const R = (d) => Math.floor(d) === d && J <= d && d <= B, J = 0, B = 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) => {
275
- const r = (s) => {
274
+ const p = (d) => Math.floor(d) === d && J <= d && d <= H, J = 0, H = 2 ** 32 - 1, K = (d) => G.test(d), G = /^[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) => {
275
+ const t = (s) => {
276
276
  if (d.length === 0)
277
277
  return !0;
278
- const o = d[d.length - 1].path;
279
- return s.length > o.length || o.substring(0, s.length) !== s;
278
+ const a = d[d.length - 1].path;
279
+ return s.length > a.length || a.substring(0, s.length) !== s;
280
280
  };
281
- return (s, o) => (s && r(o.path) && (o.value === void 0 && (o.description ?? (o.description = [
281
+ return (s, a) => (s && t(a.path) && (a.value === void 0 && (a.description ?? (a.description = [
282
282
  "The value at this path is `undefined`.",
283
283
  "",
284
- `Please fill the \`${o.expected}\` typed value next time.`
284
+ `Please fill the \`${a.expected}\` typed value next time.`
285
285
  ].join(`
286
- `))), d.push(o)), !1);
287
- }, k = (d) => Object.assign(d, {
286
+ `))), d.push(a)), !1);
287
+ }, _ = (d) => Object.assign(d, {
288
288
  "~standard": {
289
289
  version: 1,
290
290
  vendor: "typia",
291
- validate: (r) => {
292
- const s = d(r);
291
+ validate: (t) => {
292
+ const s = d(t);
293
293
  return s.success ? {
294
294
  value: s.data
295
295
  } : {
296
- issues: s.errors.map((o) => ({
297
- message: `expected ${o.expected}, got ${o.value}`,
298
- path: G(o.path)
296
+ issues: s.errors.map((a) => ({
297
+ message: `expected ${a.expected}, got ${a.value}`,
298
+ path: q(a.path)
299
299
  }))
300
300
  };
301
301
  }
@@ -305,392 +305,457 @@ var m;
305
305
  (function(d) {
306
306
  d[d.Start = 0] = "Start", d[d.Property = 1] = "Property", d[d.StringKey = 2] = "StringKey", d[d.NumberKey = 3] = "NumberKey";
307
307
  })(m || (m = {}));
308
- const G = (d) => {
308
+ const q = (d) => {
309
309
  if (!d.startsWith("$input"))
310
310
  throw new Error(`Invalid path: ${JSON.stringify(d)}`);
311
- const r = [];
312
- let s = "", o = m.Start, c = 5;
313
- for (; c < d.length - 1; ) {
314
- c++;
315
- const a = d[c];
316
- if (o === m.Property ? a === "." || a === "[" ? (r.push({
311
+ const t = [];
312
+ let s = "", a = m.Start, l = 5;
313
+ for (; l < d.length - 1; ) {
314
+ l++;
315
+ const i = d[l];
316
+ if (a === m.Property ? i === "." || i === "[" ? (t.push({
317
317
  key: s
318
- }), o = m.Start) : c === d.length - 1 ? (s += a, r.push({
318
+ }), a = m.Start) : l === d.length - 1 ? (s += i, t.push({
319
319
  key: s
320
- }), c++, o = m.Start) : s += a : o === m.StringKey ? a === '"' ? (r.push({
321
- key: JSON.parse(s + a)
322
- }), c += 2, o = m.Start) : a === "\\" ? (s += d[c], c++, s += d[c]) : s += a : o === m.NumberKey && (a === "]" ? (r.push({
320
+ }), l++, a = m.Start) : s += i : a === m.StringKey ? i === '"' ? (t.push({
321
+ key: JSON.parse(s + i)
322
+ }), l += 2, a = m.Start) : i === "\\" ? (s += d[l], l++, s += d[l]) : s += i : a === m.NumberKey && (i === "]" ? (t.push({
323
323
  key: Number.parseInt(s)
324
- }), c++, o = m.Start) : s += a), o === m.Start && c < d.length - 1) {
325
- const u = d[c];
326
- if (s = "", u === "[")
327
- d[c + 1] === '"' ? (o = m.StringKey, c++, s = '"') : o = m.NumberKey;
328
- else if (u === ".")
329
- o = m.Property;
324
+ }), l++, a = m.Start) : s += i), a === m.Start && l < d.length - 1) {
325
+ const c = d[l];
326
+ if (s = "", c === "[")
327
+ d[l + 1] === '"' ? (a = m.StringKey, l++, s = '"') : a = m.NumberKey;
328
+ else if (c === ".")
329
+ a = m.Property;
330
330
  else
331
331
  throw new Error("Unreachable: pointer points invalid character");
332
332
  }
333
333
  }
334
- if (o !== m.Start)
334
+ if (a !== m.Start)
335
335
  throw new Error(`Failed to parse path: ${JSON.stringify(d)}`);
336
- return r;
336
+ return t;
337
337
  };
338
338
  var M = /* @__PURE__ */ ((d) => (d.DEVELOPMENT = "dev", d.PRODUCTION = "prod", d))(M || {});
339
- const q = (() => {
340
- 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) || i(l, {
339
+ const X = (() => {
340
+ const d = (r) => typeof r.limit == "number" && p(r.limit) && 1 <= r.limit && r.limit <= 1e4 && (r.offset === void 0 || typeof r.offset == "number" && p(r.offset) && 0 <= r.offset) && (r.timeRange === void 0 || typeof r.timeRange == "object" && r.timeRange !== null && t(r.timeRange)) && (r.filterAnd === void 0 || Array.isArray(r.filterAnd) && r.filterAnd.every((n) => typeof n == "object" && n !== null && s(n))), t = (r) => typeof r.start == "string" && K(r.start) && typeof r.end == "string" && K(r.end), s = (r) => typeof r.column == "string" && 1 <= r.column.length && typeof r.operator == "string" && 1 <= r.operator.length && r.value !== null && r.value !== void 0 && (typeof r.value == "string" || typeof r.value == "number" || typeof r.value == "boolean" || Array.isArray(r.value) && r.value.every((n) => typeof n == "string" || typeof n == "number")), a = (r, n, u = !0) => [typeof r.limit == "number" && (p(r.limit) || o(u, {
341
341
  path: n + ".limit",
342
342
  expected: 'number & Type<"uint32">',
343
- value: e.limit
344
- })) && (1 <= e.limit || i(l, {
343
+ value: r.limit
344
+ })) && (1 <= r.limit || o(u, {
345
345
  path: n + ".limit",
346
346
  expected: "number & Minimum<1>",
347
- value: e.limit
348
- })) && (e.limit <= 1e4 || i(l, {
347
+ value: r.limit
348
+ })) && (r.limit <= 1e4 || o(u, {
349
349
  path: n + ".limit",
350
350
  expected: "number & Maximum<10000>",
351
- value: e.limit
352
- })) || i(l, {
351
+ value: r.limit
352
+ })) || o(u, {
353
353
  path: n + ".limit",
354
354
  expected: '(number & Type<"uint32"> & Minimum<1> & Maximum<10000>)',
355
- value: e.limit
356
- }), e.offset === void 0 || typeof e.offset == "number" && (R(e.offset) || i(l, {
355
+ value: r.limit
356
+ }), r.offset === void 0 || typeof r.offset == "number" && (p(r.offset) || o(u, {
357
357
  path: n + ".offset",
358
358
  expected: 'number & Type<"uint32">',
359
- value: e.offset
360
- })) && (0 <= e.offset || i(l, {
359
+ value: r.offset
360
+ })) && (0 <= r.offset || o(u, {
361
361
  path: n + ".offset",
362
362
  expected: "number & Minimum<0>",
363
- value: e.offset
364
- })) || i(l, {
363
+ value: r.offset
364
+ })) || o(u, {
365
365
  path: n + ".offset",
366
366
  expected: '((number & Type<"uint32"> & Minimum<0>) | undefined)',
367
- value: e.offset
368
- }), e.timeRange === void 0 || (typeof e.timeRange == "object" && e.timeRange !== null || i(l, {
367
+ value: r.offset
368
+ }), r.timeRange === void 0 || (typeof r.timeRange == "object" && r.timeRange !== null || o(u, {
369
369
  path: n + ".timeRange",
370
370
  expected: "(ISOTimeRange | undefined)",
371
- value: e.timeRange
372
- })) && c(e.timeRange, n + ".timeRange", l) || i(l, {
371
+ value: r.timeRange
372
+ })) && l(r.timeRange, n + ".timeRange", u) || o(u, {
373
373
  path: n + ".timeRange",
374
374
  expected: "(ISOTimeRange | undefined)",
375
- value: e.timeRange
376
- }), e.filterAnd === void 0 || (Array.isArray(e.filterAnd) || i(l, {
375
+ value: r.timeRange
376
+ }), r.filterAnd === void 0 || (Array.isArray(r.filterAnd) || o(u, {
377
377
  path: n + ".filterAnd",
378
378
  expected: "(Array<SQLFilterAnd> | undefined)",
379
- value: e.filterAnd
380
- })) && e.filterAnd.map((h, v) => (typeof h == "object" && h !== null || i(l, {
379
+ value: r.filterAnd
380
+ })) && r.filterAnd.map((f, v) => (typeof f == "object" && f !== null || o(u, {
381
381
  path: n + ".filterAnd[" + v + "]",
382
382
  expected: "SQLFilterAnd",
383
- value: h
384
- })) && a(h, n + ".filterAnd[" + v + "]", l) || i(l, {
383
+ value: f
384
+ })) && i(f, n + ".filterAnd[" + v + "]", u) || o(u, {
385
385
  path: n + ".filterAnd[" + v + "]",
386
386
  expected: "SQLFilterAnd",
387
- value: h
388
- })).every((h) => h) || i(l, {
387
+ value: f
388
+ })).every((f) => f) || o(u, {
389
389
  path: n + ".filterAnd",
390
390
  expected: "(Array<SQLFilterAnd> | undefined)",
391
- value: e.filterAnd
392
- })].every((h) => h), c = (e, n, l = !0) => [typeof e.start == "string" && (K(e.start) || i(l, {
391
+ value: r.filterAnd
392
+ })].every((f) => f), l = (r, n, u = !0) => [typeof r.start == "string" && (K(r.start) || o(u, {
393
393
  path: n + ".start",
394
394
  expected: 'string & Format<"date-time">',
395
- value: e.start
396
- })) || i(l, {
395
+ value: r.start
396
+ })) || o(u, {
397
397
  path: n + ".start",
398
398
  expected: '(string & Format<"date-time">)',
399
- value: e.start
400
- }), typeof e.end == "string" && (K(e.end) || i(l, {
399
+ value: r.start
400
+ }), typeof r.end == "string" && (K(r.end) || o(u, {
401
401
  path: n + ".end",
402
402
  expected: 'string & Format<"date-time">',
403
- value: e.end
404
- })) || i(l, {
403
+ value: r.end
404
+ })) || o(u, {
405
405
  path: n + ".end",
406
406
  expected: '(string & Format<"date-time">)',
407
- value: e.end
408
- })].every((h) => h), a = (e, n, l = !0) => [typeof e.column == "string" && (1 <= e.column.length || i(l, {
407
+ value: r.end
408
+ })].every((f) => f), i = (r, n, u = !0) => [typeof r.column == "string" && (1 <= r.column.length || o(u, {
409
409
  path: n + ".column",
410
410
  expected: "string & MinLength<1>",
411
- value: e.column
412
- })) || i(l, {
411
+ value: r.column
412
+ })) || o(u, {
413
413
  path: n + ".column",
414
414
  expected: "(string & MinLength<1>)",
415
- value: e.column
416
- }), typeof e.operator == "string" && (1 <= e.operator.length || i(l, {
415
+ value: r.column
416
+ }), typeof r.operator == "string" && (1 <= r.operator.length || o(u, {
417
417
  path: n + ".operator",
418
418
  expected: "string & MinLength<1>",
419
- value: e.operator
420
- })) || i(l, {
419
+ value: r.operator
420
+ })) || o(u, {
421
421
  path: n + ".operator",
422
422
  expected: "(string & MinLength<1>)",
423
- value: e.operator
424
- }), (e.value !== null || i(l, {
423
+ value: r.operator
424
+ }), (r.value !== null || o(u, {
425
425
  path: n + ".value",
426
426
  expected: "(Array<string | number> | boolean | number | string)",
427
- value: e.value
428
- })) && (e.value !== void 0 || i(l, {
427
+ value: r.value
428
+ })) && (r.value !== void 0 || o(u, {
429
429
  path: n + ".value",
430
430
  expected: "(Array<string | number> | boolean | number | string)",
431
- value: e.value
432
- })) && (typeof e.value == "string" || typeof e.value == "number" || typeof e.value == "boolean" || (Array.isArray(e.value) || i(l, {
431
+ value: r.value
432
+ })) && (typeof r.value == "string" || typeof r.value == "number" || typeof r.value == "boolean" || (Array.isArray(r.value) || o(u, {
433
433
  path: n + ".value",
434
434
  expected: "(Array<string | number> | boolean | number | string)",
435
- value: e.value
436
- })) && e.value.map((h, v) => typeof h == "string" || typeof h == "number" || i(l, {
435
+ value: r.value
436
+ })) && r.value.map((f, v) => typeof f == "string" || typeof f == "number" || o(u, {
437
437
  path: n + ".value[" + v + "]",
438
438
  expected: "(number | string)",
439
- value: h
440
- })).every((h) => h) || i(l, {
439
+ value: f
440
+ })).every((f) => f) || o(u, {
441
441
  path: n + ".value",
442
442
  expected: "(Array<string | number> | boolean | number | string)",
443
- value: e.value
444
- }))].every((h) => h), u = (e) => typeof e == "object" && e !== null && d(e);
445
- let t, i;
446
- return k((e) => {
447
- if (u(e) === !1) {
448
- t = [], i = p(t), ((l, h, v = !0) => (typeof l == "object" && l !== null || i(!0, {
449
- path: h + "",
443
+ value: r.value
444
+ }))].every((f) => f), c = (r) => typeof r == "object" && r !== null && d(r);
445
+ let e, o;
446
+ return _((r) => {
447
+ if (c(r) === !1) {
448
+ e = [], o = k(e), ((u, f, v = !0) => (typeof u == "object" && u !== null || o(!0, {
449
+ path: f + "",
450
450
  expected: "TableQueryParams",
451
- value: l
452
- })) && o(l, h + "", !0) || i(!0, {
453
- path: h + "",
451
+ value: u
452
+ })) && a(u, f + "", !0) || o(!0, {
453
+ path: f + "",
454
454
  expected: "TableQueryParams",
455
- value: l
456
- }))(e, "$input", !0);
457
- const n = t.length === 0;
455
+ value: u
456
+ }))(r, "$input", !0);
457
+ const n = e.length === 0;
458
458
  return n ? {
459
459
  success: n,
460
- data: e
460
+ data: r
461
461
  } : {
462
462
  success: n,
463
- errors: t,
464
- data: e
463
+ errors: e,
464
+ data: r
465
465
  };
466
466
  }
467
467
  return {
468
468
  success: !0,
469
- data: e
469
+ data: r
470
470
  };
471
471
  });
472
- })(), X = (() => {
473
- const d = (a) => typeof a.longitude == "number" && -180 <= a.longitude && a.longitude <= 180 && typeof a.latitude == "number" && -90 <= a.latitude && a.latitude <= 90, r = (a, u, t = !0) => [typeof a.longitude == "number" && (-180 <= a.longitude || c(t, {
474
- path: u + ".longitude",
472
+ })(), Z = (() => {
473
+ const d = (i) => typeof i.longitude == "number" && -180 <= i.longitude && i.longitude <= 180 && typeof i.latitude == "number" && -90 <= i.latitude && i.latitude <= 90, t = (i, c, e = !0) => [typeof i.longitude == "number" && (-180 <= i.longitude || l(e, {
474
+ path: c + ".longitude",
475
475
  expected: "number & Minimum<-180>",
476
- value: a.longitude
477
- })) && (a.longitude <= 180 || c(t, {
478
- path: u + ".longitude",
476
+ value: i.longitude
477
+ })) && (i.longitude <= 180 || l(e, {
478
+ path: c + ".longitude",
479
479
  expected: "number & Maximum<180>",
480
- value: a.longitude
481
- })) || c(t, {
482
- path: u + ".longitude",
480
+ value: i.longitude
481
+ })) || l(e, {
482
+ path: c + ".longitude",
483
483
  expected: "(number & Minimum<-180> & Maximum<180>)",
484
- value: a.longitude
485
- }), typeof a.latitude == "number" && (-90 <= a.latitude || c(t, {
486
- path: u + ".latitude",
484
+ value: i.longitude
485
+ }), typeof i.latitude == "number" && (-90 <= i.latitude || l(e, {
486
+ path: c + ".latitude",
487
487
  expected: "number & Minimum<-90>",
488
- value: a.latitude
489
- })) && (a.latitude <= 90 || c(t, {
490
- path: u + ".latitude",
488
+ value: i.latitude
489
+ })) && (i.latitude <= 90 || l(e, {
490
+ path: c + ".latitude",
491
491
  expected: "number & Maximum<90>",
492
- value: a.latitude
493
- })) || c(t, {
494
- path: u + ".latitude",
492
+ value: i.latitude
493
+ })) || l(e, {
494
+ path: c + ".latitude",
495
495
  expected: "(number & Minimum<-90> & Maximum<90>)",
496
- value: a.latitude
497
- })].every((i) => i), s = (a) => typeof a == "object" && a !== null && d(a);
498
- let o, c;
499
- return k((a) => {
500
- if (s(a) === !1) {
501
- o = [], c = p(o), ((t, i, e = !0) => (typeof t == "object" && t !== null || c(!0, {
502
- path: i + "",
496
+ value: i.latitude
497
+ })].every((o) => o), s = (i) => typeof i == "object" && i !== null && d(i);
498
+ let a, l;
499
+ return _((i) => {
500
+ if (s(i) === !1) {
501
+ a = [], l = k(a), ((e, o, r = !0) => (typeof e == "object" && e !== null || l(!0, {
502
+ path: o + "",
503
503
  expected: "LocationParams",
504
- value: t
505
- })) && r(t, i + "", !0) || c(!0, {
506
- path: i + "",
504
+ value: e
505
+ })) && t(e, o + "", !0) || l(!0, {
506
+ path: o + "",
507
507
  expected: "LocationParams",
508
- value: t
509
- }))(a, "$input", !0);
510
- const u = o.length === 0;
511
- return u ? {
512
- success: u,
513
- data: a
508
+ value: e
509
+ }))(i, "$input", !0);
510
+ const c = a.length === 0;
511
+ return c ? {
512
+ success: c,
513
+ data: i
514
514
  } : {
515
- success: u,
516
- errors: o,
517
- data: a
515
+ success: c,
516
+ errors: a,
517
+ data: i
518
518
  };
519
519
  }
520
520
  return {
521
521
  success: !0,
522
- data: a
522
+ data: i
523
523
  };
524
524
  });
525
- })(), Z = (() => {
526
- const d = (t) => 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((i) => (t[i] === void 0, !0)), s = (t, i, e = !0) => [typeof t.topic == "string" && (1 <= t.topic.length || u(e, {
527
- path: i + ".topic",
525
+ })(), z = (() => {
526
+ const d = (e) => typeof e.topic == "string" && 1 <= e.topic.length && (e.args === void 0 || Array.isArray(e.args)) && (e.kwargs === void 0 || typeof e.kwargs == "object" && e.kwargs !== null && Array.isArray(e.kwargs) === !1 && t(e.kwargs)), t = (e) => Object.keys(e).every((o) => (e[o] === void 0, !0)), s = (e, o, r = !0) => [typeof e.topic == "string" && (1 <= e.topic.length || c(r, {
527
+ path: o + ".topic",
528
528
  expected: "string & MinLength<1>",
529
- value: t.topic
530
- })) || u(e, {
531
- path: i + ".topic",
529
+ value: e.topic
530
+ })) || c(r, {
531
+ path: o + ".topic",
532
532
  expected: "(string & MinLength<1>)",
533
- value: t.topic
534
- }), t.args === void 0 || Array.isArray(t.args) || u(e, {
535
- path: i + ".args",
533
+ value: e.topic
534
+ }), e.args === void 0 || Array.isArray(e.args) || c(r, {
535
+ path: o + ".args",
536
536
  expected: "(Array<unknown> | undefined)",
537
- value: t.args
538
- }), t.kwargs === void 0 || (typeof t.kwargs == "object" && t.kwargs !== null && Array.isArray(t.kwargs) === !1 || u(e, {
539
- path: i + ".kwargs",
537
+ value: e.args
538
+ }), e.kwargs === void 0 || (typeof e.kwargs == "object" && e.kwargs !== null && Array.isArray(e.kwargs) === !1 || c(r, {
539
+ path: o + ".kwargs",
540
540
  expected: "(Record<string, unknown> | undefined)",
541
- value: t.kwargs
542
- })) && o(t.kwargs, i + ".kwargs", e) || u(e, {
543
- path: i + ".kwargs",
541
+ value: e.kwargs
542
+ })) && a(e.kwargs, o + ".kwargs", r) || c(r, {
543
+ path: o + ".kwargs",
544
544
  expected: "(Record<string, unknown> | undefined)",
545
- value: t.kwargs
546
- })].every((n) => n), o = (t, i, 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);
547
- let a, u;
548
- return k((t) => {
549
- if (c(t) === !1) {
550
- a = [], u = p(a), ((e, n, l = !0) => (typeof e == "object" && e !== null || u(!0, {
545
+ value: e.kwargs
546
+ })].every((n) => n), a = (e, o, r = !0) => [r === !1 || Object.keys(e).map((n) => (e[n] === void 0, !0)).every((n) => n)].every((n) => n), l = (e) => typeof e == "object" && e !== null && d(e);
547
+ let i, c;
548
+ return _((e) => {
549
+ if (l(e) === !1) {
550
+ i = [], c = k(i), ((r, n, u = !0) => (typeof r == "object" && r !== null || c(!0, {
551
551
  path: n + "",
552
552
  expected: "PublishParams",
553
- value: e
554
- })) && s(e, n + "", !0) || u(!0, {
553
+ value: r
554
+ })) && s(r, n + "", !0) || c(!0, {
555
555
  path: n + "",
556
556
  expected: "PublishParams",
557
- value: e
558
- }))(t, "$input", !0);
559
- const i = a.length === 0;
560
- return i ? {
561
- success: i,
562
- data: t
557
+ value: r
558
+ }))(e, "$input", !0);
559
+ const o = i.length === 0;
560
+ return o ? {
561
+ success: o,
562
+ data: e
563
563
  } : {
564
- success: i,
565
- errors: a,
566
- data: t
564
+ success: o,
565
+ errors: i,
566
+ data: e
567
567
  };
568
568
  }
569
569
  return {
570
570
  success: !0,
571
- data: t
571
+ data: e
572
572
  };
573
573
  });
574
574
  })(), te = (() => {
575
- 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((i) => (t[i] === void 0, !0)), s = (t, i, e = !0) => [typeof t.deviceKey == "string" && (1 <= t.deviceKey.length || u(e, {
576
- path: i + ".deviceKey",
575
+ const d = (e) => typeof e.deviceKey == "string" && 1 <= e.deviceKey.length && typeof e.topic == "string" && 1 <= e.topic.length && (e.args === void 0 || Array.isArray(e.args)) && (e.kwargs === void 0 || typeof e.kwargs == "object" && e.kwargs !== null && Array.isArray(e.kwargs) === !1 && t(e.kwargs)), t = (e) => Object.keys(e).every((o) => (e[o] === void 0, !0)), s = (e, o, r = !0) => [typeof e.deviceKey == "string" && (1 <= e.deviceKey.length || c(r, {
576
+ path: o + ".deviceKey",
577
577
  expected: "string & MinLength<1>",
578
- value: t.deviceKey
579
- })) || u(e, {
580
- path: i + ".deviceKey",
578
+ value: e.deviceKey
579
+ })) || c(r, {
580
+ path: o + ".deviceKey",
581
581
  expected: "(string & MinLength<1>)",
582
- value: t.deviceKey
583
- }), typeof t.topic == "string" && (1 <= t.topic.length || u(e, {
584
- path: i + ".topic",
582
+ value: e.deviceKey
583
+ }), typeof e.topic == "string" && (1 <= e.topic.length || c(r, {
584
+ path: o + ".topic",
585
585
  expected: "string & MinLength<1>",
586
- value: t.topic
587
- })) || u(e, {
588
- path: i + ".topic",
586
+ value: e.topic
587
+ })) || c(r, {
588
+ path: o + ".topic",
589
589
  expected: "(string & MinLength<1>)",
590
- value: t.topic
591
- }), t.args === void 0 || Array.isArray(t.args) || u(e, {
592
- path: i + ".args",
590
+ value: e.topic
591
+ }), e.args === void 0 || Array.isArray(e.args) || c(r, {
592
+ path: o + ".args",
593
593
  expected: "(Array<unknown> | undefined)",
594
- value: t.args
595
- }), t.kwargs === void 0 || (typeof t.kwargs == "object" && t.kwargs !== null && Array.isArray(t.kwargs) === !1 || u(e, {
596
- path: i + ".kwargs",
594
+ value: e.args
595
+ }), e.kwargs === void 0 || (typeof e.kwargs == "object" && e.kwargs !== null && Array.isArray(e.kwargs) === !1 || c(r, {
596
+ path: o + ".kwargs",
597
597
  expected: "(Record<string, unknown> | undefined)",
598
- value: t.kwargs
599
- })) && o(t.kwargs, i + ".kwargs", e) || u(e, {
600
- path: i + ".kwargs",
598
+ value: e.kwargs
599
+ })) && a(e.kwargs, o + ".kwargs", r) || c(r, {
600
+ path: o + ".kwargs",
601
601
  expected: "(Record<string, unknown> | undefined)",
602
- value: t.kwargs
603
- })].every((n) => n), o = (t, i, 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);
604
- let a, u;
605
- return k((t) => {
606
- if (c(t) === !1) {
607
- a = [], u = p(a), ((e, n, l = !0) => (typeof e == "object" && e !== null || u(!0, {
602
+ value: e.kwargs
603
+ })].every((n) => n), a = (e, o, r = !0) => [r === !1 || Object.keys(e).map((n) => (e[n] === void 0, !0)).every((n) => n)].every((n) => n), l = (e) => typeof e == "object" && e !== null && d(e);
604
+ let i, c;
605
+ return _((e) => {
606
+ if (l(e) === !1) {
607
+ i = [], c = k(i), ((r, n, u = !0) => (typeof r == "object" && r !== null || c(!0, {
608
608
  path: n + "",
609
609
  expected: "CallParams",
610
- value: e
611
- })) && s(e, n + "", !0) || u(!0, {
610
+ value: r
611
+ })) && s(r, n + "", !0) || c(!0, {
612
612
  path: n + "",
613
613
  expected: "CallParams",
614
- value: e
615
- }))(t, "$input", !0);
616
- const i = a.length === 0;
617
- return i ? {
618
- success: i,
619
- data: t
614
+ value: r
615
+ }))(e, "$input", !0);
616
+ const o = i.length === 0;
617
+ return o ? {
618
+ success: o,
619
+ data: e
620
620
  } : {
621
- success: i,
622
- errors: a,
623
- data: t
621
+ success: o,
622
+ errors: i,
623
+ data: e
624
624
  };
625
625
  }
626
626
  return {
627
627
  success: !0,
628
- data: t
628
+ data: e
629
629
  };
630
630
  });
631
- })(), C = (() => {
632
- 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((i) => (t[i] === void 0, !0)), s = (t, i, e = !0) => [typeof t.tablename == "string" && (1 <= t.tablename.length || u(e, {
633
- path: i + ".tablename",
631
+ })(), O = (() => {
632
+ const d = (e) => typeof e.tablename == "string" && 1 <= e.tablename.length && (e.args === void 0 || Array.isArray(e.args)) && (e.kwargs === void 0 || typeof e.kwargs == "object" && e.kwargs !== null && Array.isArray(e.kwargs) === !1 && t(e.kwargs)), t = (e) => Object.keys(e).every((o) => (e[o] === void 0, !0)), s = (e, o, r = !0) => [typeof e.tablename == "string" && (1 <= e.tablename.length || c(r, {
633
+ path: o + ".tablename",
634
634
  expected: "string & MinLength<1>",
635
- value: t.tablename
636
- })) || u(e, {
637
- path: i + ".tablename",
635
+ value: e.tablename
636
+ })) || c(r, {
637
+ path: o + ".tablename",
638
638
  expected: "(string & MinLength<1>)",
639
- value: t.tablename
640
- }), t.args === void 0 || Array.isArray(t.args) || u(e, {
641
- path: i + ".args",
639
+ value: e.tablename
640
+ }), e.args === void 0 || Array.isArray(e.args) || c(r, {
641
+ path: o + ".args",
642
642
  expected: "(Array<unknown> | undefined)",
643
- value: t.args
644
- }), t.kwargs === void 0 || (typeof t.kwargs == "object" && t.kwargs !== null && Array.isArray(t.kwargs) === !1 || u(e, {
645
- path: i + ".kwargs",
643
+ value: e.args
644
+ }), e.kwargs === void 0 || (typeof e.kwargs == "object" && e.kwargs !== null && Array.isArray(e.kwargs) === !1 || c(r, {
645
+ path: o + ".kwargs",
646
646
  expected: "(Record<string, unknown> | undefined)",
647
- value: t.kwargs
648
- })) && o(t.kwargs, i + ".kwargs", e) || u(e, {
649
- path: i + ".kwargs",
647
+ value: e.kwargs
648
+ })) && a(e.kwargs, o + ".kwargs", r) || c(r, {
649
+ path: o + ".kwargs",
650
650
  expected: "(Record<string, unknown> | undefined)",
651
- value: t.kwargs
652
- })].every((n) => n), o = (t, i, 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);
653
- let a, u;
654
- return k((t) => {
655
- if (c(t) === !1) {
656
- a = [], u = p(a), ((e, n, l = !0) => (typeof e == "object" && e !== null || u(!0, {
651
+ value: e.kwargs
652
+ })].every((n) => n), a = (e, o, r = !0) => [r === !1 || Object.keys(e).map((n) => (e[n] === void 0, !0)).every((n) => n)].every((n) => n), l = (e) => typeof e == "object" && e !== null && d(e);
653
+ let i, c;
654
+ return _((e) => {
655
+ if (l(e) === !1) {
656
+ i = [], c = k(i), ((r, n, u = !0) => (typeof r == "object" && r !== null || c(!0, {
657
657
  path: n + "",
658
658
  expected: "TableParams",
659
- value: e
660
- })) && s(e, n + "", !0) || u(!0, {
659
+ value: r
660
+ })) && s(r, n + "", !0) || c(!0, {
661
661
  path: n + "",
662
662
  expected: "TableParams",
663
- value: e
664
- }))(t, "$input", !0);
665
- const i = a.length === 0;
666
- return i ? {
667
- success: i,
668
- data: t
663
+ value: r
664
+ }))(e, "$input", !0);
665
+ const o = i.length === 0;
666
+ return o ? {
667
+ success: o,
668
+ data: e
669
669
  } : {
670
- success: i,
671
- errors: a,
672
- data: t
670
+ success: o,
671
+ errors: i,
672
+ data: e
673
673
  };
674
674
  }
675
675
  return {
676
676
  success: !0,
677
- data: t
677
+ data: e
678
+ };
679
+ });
680
+ })(), C = (() => {
681
+ const d = (e) => typeof e.tablename == "string" && 1 <= e.tablename.length && Array.isArray(e.rows) && 1 <= e.rows.length && e.rows.every((o) => typeof o == "object" && o !== null && Array.isArray(o) === !1 && t(o)) && (e.kwargs === void 0 || typeof e.kwargs == "object" && e.kwargs !== null && Array.isArray(e.kwargs) === !1 && t(e.kwargs)), t = (e) => Object.keys(e).every((o) => (e[o] === void 0, !0)), s = (e, o, r = !0) => [typeof e.tablename == "string" && (1 <= e.tablename.length || c(r, {
682
+ path: o + ".tablename",
683
+ expected: "string & MinLength<1>",
684
+ value: e.tablename
685
+ })) || c(r, {
686
+ path: o + ".tablename",
687
+ expected: "(string & MinLength<1>)",
688
+ value: e.tablename
689
+ }), (Array.isArray(e.rows) || c(r, {
690
+ path: o + ".rows",
691
+ expected: "(Array<Record<string, unknown>> & MinItems<1>)",
692
+ value: e.rows
693
+ })) && (1 <= e.rows.length || c(r, {
694
+ path: o + ".rows",
695
+ expected: "Array<> & MinItems<1>",
696
+ value: e.rows
697
+ })) && e.rows.map((n, u) => (typeof n == "object" && n !== null && Array.isArray(n) === !1 || c(r, {
698
+ path: o + ".rows[" + u + "]",
699
+ expected: "Record<string, unknown>",
700
+ value: n
701
+ })) && a(n, o + ".rows[" + u + "]", r) || c(r, {
702
+ path: o + ".rows[" + u + "]",
703
+ expected: "Record<string, unknown>",
704
+ value: n
705
+ })).every((n) => n) || c(r, {
706
+ path: o + ".rows",
707
+ expected: "(Array<Record<string, unknown>> & MinItems<1>)",
708
+ value: e.rows
709
+ }), e.kwargs === void 0 || (typeof e.kwargs == "object" && e.kwargs !== null && Array.isArray(e.kwargs) === !1 || c(r, {
710
+ path: o + ".kwargs",
711
+ expected: "(Record<string, unknown> | undefined)",
712
+ value: e.kwargs
713
+ })) && a(e.kwargs, o + ".kwargs", r) || c(r, {
714
+ path: o + ".kwargs",
715
+ expected: "(Record<string, unknown> | undefined)",
716
+ value: e.kwargs
717
+ })].every((n) => n), a = (e, o, r = !0) => [r === !1 || Object.keys(e).map((n) => (e[n] === void 0, !0)).every((n) => n)].every((n) => n), l = (e) => typeof e == "object" && e !== null && d(e);
718
+ let i, c;
719
+ return _((e) => {
720
+ if (l(e) === !1) {
721
+ i = [], c = k(i), ((r, n, u = !0) => (typeof r == "object" && r !== null || c(!0, {
722
+ path: n + "",
723
+ expected: "BulkTableParams",
724
+ value: r
725
+ })) && s(r, n + "", !0) || c(!0, {
726
+ path: n + "",
727
+ expected: "BulkTableParams",
728
+ value: r
729
+ }))(e, "$input", !0);
730
+ const o = i.length === 0;
731
+ return o ? {
732
+ success: o,
733
+ data: e
734
+ } : {
735
+ success: o,
736
+ errors: i,
737
+ data: e
738
+ };
739
+ }
740
+ return {
741
+ success: !0,
742
+ data: e
678
743
  };
679
744
  });
680
745
  })();
681
746
  function E(d) {
682
- var r;
683
- return typeof process < "u" ? (r = process.env) == null ? void 0 : r[d] : void 0;
747
+ var t;
748
+ return typeof process < "u" ? (t = process.env) == null ? void 0 : t[d] : void 0;
684
749
  }
685
- function z(d) {
686
- const r = d ?? E("DEVICE_SERIAL_NUMBER");
687
- if (!r)
750
+ function ee(d) {
751
+ const t = d ?? E("DEVICE_SERIAL_NUMBER");
752
+ if (!t)
688
753
  throw new Error("serialNumber option is required (or set DEVICE_SERIAL_NUMBER env var in Node.js)");
689
- return r;
754
+ return t;
690
755
  }
691
- class L {
692
- constructor(r) {
693
- 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();
756
+ class P {
757
+ constructor(t) {
758
+ this._isConfigured = !1, this._serialNumber = ee(t == null ? void 0 : t.serialNumber), this._deviceName = (t == null ? void 0 : t.deviceName) ?? E("DEVICE_NAME"), this._deviceKey = (t == null ? void 0 : t.deviceKey) ?? E("DEVICE_KEY"), this._appName = (t == null ? void 0 : t.appName) ?? E("APP_NAME"), this._swarmKey = (t == null ? void 0 : t.swarmKey) ?? parseInt(E("SWARM_KEY") ?? "0", 10), this._appKey = (t == null ? void 0 : t.appKey) ?? parseInt(E("APP_KEY") ?? "0", 10), this._env = (t == null ? void 0 : t.env) ?? E("ENV"), this._reswarmUrl = (t == null ? void 0 : t.reswarmUrl) ?? E("RESWARM_URL"), this._cburl = (t == null ? void 0 : t.ironFlockUrl) ?? (t == null ? void 0 : t.cburl), this._connection = new I();
694
759
  const s = [];
695
760
  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(
696
761
  `Warning: The following environment variables must be present: ${s.join(", ")}`
@@ -702,111 +767,153 @@ class L {
702
767
  get isConnected() {
703
768
  return this._connection.is_open;
704
769
  }
705
- configureConnection(r) {
770
+ configureConnection(t) {
706
771
  if (this._isConfigured) return;
707
- const s = (this._env ?? "DEV").toUpperCase(), c = {
772
+ const s = (this._env ?? "DEV").toUpperCase(), l = {
708
773
  DEV: M.DEVELOPMENT,
709
774
  PROD: M.PRODUCTION
710
- }[s] ?? M.DEVELOPMENT, a = r ?? this._cburl ?? I.getWebSocketURI(this._reswarmUrl);
775
+ }[s] ?? M.DEVELOPMENT, i = t ?? this._cburl ?? I.getWebSocketURI(this._reswarmUrl);
711
776
  this._connection.configure(
712
777
  this._swarmKey,
713
778
  this._appKey,
714
- c,
779
+ l,
715
780
  this._serialNumber,
716
- a
781
+ i
717
782
  ), this._isConfigured = !0;
718
783
  }
719
- async start(r) {
720
- this.configureConnection(r), await this._connection.start();
784
+ async start(t) {
785
+ this.configureConnection(t), await this._connection.start();
721
786
  }
722
787
  async stop() {
723
788
  this._connection.stop();
724
789
  }
725
- async publish(r, s, o) {
726
- const c = Z({ topic: r, args: s, kwargs: o });
727
- if (!c.success)
728
- throw new Error(`Invalid publish parameters: ${c.errors.map((t) => t.path + ": " + t.expected).join(", ")}`);
729
- const u = { ...{
790
+ async publish(t, s, a) {
791
+ const l = z({ topic: t, args: s, kwargs: a });
792
+ if (!l.success)
793
+ throw new Error(`Invalid publish parameters: ${l.errors.map((e) => e.path + ": " + e.expected).join(", ")}`);
794
+ const c = { ...{
730
795
  DEVICE_SERIAL_NUMBER: this._serialNumber,
731
796
  DEVICE_KEY: this._deviceKey,
732
797
  DEVICE_NAME: this._deviceName
733
- }, ...o ?? {} };
734
- return this._connection.publish(r, s, u, {
798
+ }, ...a ?? {} };
799
+ return this._connection.publish(t, s, c, {
735
800
  acknowledge: !0
736
801
  });
737
802
  }
738
- async publishToTable(r, s, o) {
739
- const c = C({ tablename: r, args: s, kwargs: o });
740
- if (!c.success)
741
- throw new Error(`Invalid table parameters: ${c.errors.map((u) => u.path + ": " + u.expected).join(", ")}`);
803
+ async publishToTable(t, s, a) {
804
+ const l = O({ tablename: t, args: s, kwargs: a });
805
+ if (!l.success)
806
+ throw new Error(`Invalid table parameters: ${l.errors.map((c) => c.path + ": " + c.expected).join(", ")}`);
742
807
  if (!this._swarmKey) throw new Error("SWARM_KEY not set in environment variables!");
743
808
  if (!this._appKey) throw new Error("APP_KEY not set in environment variables!");
744
- const a = `${this._swarmKey}.${this._appKey}.${r}`;
745
- return this.publish(a, s, o);
809
+ const i = `${this._swarmKey}.${this._appKey}.${t}`;
810
+ return this.publish(i, s, a);
746
811
  }
747
- async appendToTable(r, s, o) {
748
- const c = C({ tablename: r, args: s, kwargs: o });
749
- if (!c.success)
750
- throw new Error(`Invalid table parameters: ${c.errors.map((i) => i.path + ": " + i.expected).join(", ")}`);
812
+ async appendToTable(t, s, a) {
813
+ const l = O({ tablename: t, args: s, kwargs: a });
814
+ if (!l.success)
815
+ throw new Error(`Invalid table parameters: ${l.errors.map((o) => o.path + ": " + o.expected).join(", ")}`);
751
816
  if (!this._swarmKey) throw new Error("SWARM_KEY not set in environment variables!");
752
817
  if (!this._appKey) throw new Error("APP_KEY not set in environment variables!");
753
- const a = `append.${this._swarmKey}.${this._appKey}.${r}`, t = { ...{
818
+ const i = `append.${this._swarmKey}.${this._appKey}.${t}`, e = { ...{
754
819
  DEVICE_SERIAL_NUMBER: this._serialNumber,
755
820
  DEVICE_KEY: this._deviceKey,
756
821
  DEVICE_NAME: this._deviceName
757
- }, ...o ?? {} };
758
- return this._connection.call(a, s, t);
822
+ }, ...a ?? {} };
823
+ return this._connection.call(i, s, e);
759
824
  }
760
- async subscribe(r, s, o) {
761
- return this._connection.subscribe(r, s);
825
+ /**
826
+ * Publishes many rows in a single message (bulk insert) to the dedicated topic
827
+ * `bulk.{swarmKey}.{appKey}.{tablename}`. The platform inserts the whole batch
828
+ * atomically (all-or-nothing). Use for high-frequency data where one round-trip
829
+ * per row is too costly. Like publishToTable this is fire-and-forget — the ack
830
+ * confirms delivery to the router, not the DB insert. Use appendRowsToTable when
831
+ * you need the insert outcome.
832
+ */
833
+ async publishRowsToTable(t, s, a) {
834
+ const l = C({ tablename: t, rows: s, kwargs: a });
835
+ if (!l.success)
836
+ throw new Error(`Invalid bulk table parameters: ${l.errors.map((c) => c.path + ": " + c.expected).join(", ")}`);
837
+ if (!this._swarmKey) throw new Error("SWARM_KEY not set in environment variables!");
838
+ if (!this._appKey) throw new Error("APP_KEY not set in environment variables!");
839
+ const i = `bulk.${this._swarmKey}.${this._appKey}.${t}`;
840
+ return this.publish(i, [s], a);
762
841
  }
763
- async subscribeToTable(r, s, o) {
842
+ /**
843
+ * Appends many rows in a single RPC (bulk insert) by calling the dedicated
844
+ * procedure `appendBulk.{swarmKey}.{appKey}.{tablename}`. The platform inserts
845
+ * the whole batch atomically (all-or-nothing): if any row is invalid the entire
846
+ * batch is rejected and nothing is persisted. Resolves with the RPC result
847
+ * (e.g. { success: true, count: N }). Prefer over publishRowsToTable when you
848
+ * need the insert outcome.
849
+ */
850
+ async appendRowsToTable(t, s, a) {
851
+ const l = C({ tablename: t, rows: s, kwargs: a });
852
+ if (!l.success)
853
+ throw new Error(`Invalid bulk table parameters: ${l.errors.map((o) => o.path + ": " + o.expected).join(", ")}`);
764
854
  if (!this._swarmKey) throw new Error("SWARM_KEY not set in environment variables!");
765
855
  if (!this._appKey) throw new Error("APP_KEY not set in environment variables!");
766
- const c = `${this._swarmKey}.${this._appKey}.${r}`;
767
- return this.subscribe(c, s, o);
856
+ const i = `appendBulk.${this._swarmKey}.${this._appKey}.${t}`, e = { ...{
857
+ DEVICE_SERIAL_NUMBER: this._serialNumber,
858
+ DEVICE_KEY: this._deviceKey,
859
+ DEVICE_NAME: this._deviceName
860
+ }, ...a ?? {} };
861
+ return this._connection.call(i, [s], e);
862
+ }
863
+ async subscribe(t, s, a) {
864
+ return this._connection.subscribe(t, s);
865
+ }
866
+ async subscribeToTable(t, s, a) {
867
+ if (!this._swarmKey) throw new Error("SWARM_KEY not set in environment variables!");
868
+ if (!this._appKey) throw new Error("APP_KEY not set in environment variables!");
869
+ const l = `transformed.${t}`, i = await this.subscribe(l, s, a), c = (e, o, r) => {
870
+ const n = Array.isArray(e) ? e[0] : e, u = Array.isArray(n) ? n : n == null ? [] : [n];
871
+ for (const f of u)
872
+ s([f], o, r);
873
+ };
874
+ return await this.subscribe(`transformed.bulk.${t}`, c, a), i;
768
875
  }
769
- async call(r, s, o, c) {
770
- return this._connection.call(r, s, o, c);
876
+ async call(t, s, a, l) {
877
+ return this._connection.call(t, s, a, l);
771
878
  }
772
- async callDeviceFunction(r, s, o, c, a) {
773
- const u = `${this._swarmKey}.${r}.${this._appKey}.${this._env}.${s}`;
774
- return this._connection.call(u, o, c, a);
879
+ async callDeviceFunction(t, s, a, l, i) {
880
+ const c = `${this._swarmKey}.${t}.${this._appKey}.${this._env}.${s}`;
881
+ return this._connection.call(c, a, l, i);
775
882
  }
776
883
  /** @deprecated Use callDeviceFunction() instead. */
777
- async callFunction(r, s, o, c, a) {
778
- return console.warn("callFunction() is deprecated and will be removed in a future version. Use callDeviceFunction() instead."), this.callDeviceFunction(r, s, o, c, a);
884
+ async callFunction(t, s, a, l, i) {
885
+ return console.warn("callFunction() is deprecated and will be removed in a future version. Use callDeviceFunction() instead."), this.callDeviceFunction(t, s, a, l, i);
779
886
  }
780
- async registerDeviceFunction(r, s, o) {
781
- const c = `${this._swarmKey}.${this._deviceKey}.${this._appKey}.${this._env}.${r}`, a = await this._connection.register(c, s, o);
782
- return console.log(`Function registered for IronFlock topic '${r}'. (Full WAMP topic: '${c}')`), a;
887
+ async registerDeviceFunction(t, s, a) {
888
+ const l = `${this._swarmKey}.${this._deviceKey}.${this._appKey}.${this._env}.${t}`, i = await this._connection.register(l, s, a);
889
+ return console.log(`Function registered for IronFlock topic '${t}'. (Full WAMP topic: '${l}')`), i;
783
890
  }
784
891
  /** @deprecated Use registerDeviceFunction() instead. */
785
- async registerFunction(r, s, o) {
786
- return console.warn("registerFunction() is deprecated and will be removed in a future version. Use registerDeviceFunction() instead."), this.registerDeviceFunction(r, s, o);
892
+ async registerFunction(t, s, a) {
893
+ return console.warn("registerFunction() is deprecated and will be removed in a future version. Use registerDeviceFunction() instead."), this.registerDeviceFunction(t, s, a);
787
894
  }
788
- async register(r, s, o) {
789
- return this.registerDeviceFunction(r, s, o);
895
+ async register(t, s, a) {
896
+ return this.registerDeviceFunction(t, s, a);
790
897
  }
791
- async getHistory(r, s = { limit: 10 }) {
792
- if (!r) throw new Error("Tablename must not be empty!");
898
+ async getHistory(t, s = { limit: 10 }) {
899
+ if (!t) throw new Error("Tablename must not be empty!");
793
900
  s.offset == null && (s.offset = 0);
794
- const o = q(s);
795
- if (!o.success)
796
- throw new Error(`Invalid query parameters: ${o.errors.map((a) => a.path + ": " + a.expected).join(", ")}`);
797
- const c = `history.transformed.app.${this._appKey}.${r}`;
901
+ const a = X(s);
902
+ if (!a.success)
903
+ throw new Error(`Invalid query parameters: ${a.errors.map((i) => i.path + ": " + i.expected).join(", ")}`);
904
+ const l = `history.transformed.${t}`;
798
905
  try {
799
- return await this._connection.call(c, [s]);
800
- } catch (a) {
801
- const u = String(a);
802
- 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: ${a}`), null);
906
+ return await this._connection.call(l, [s]);
907
+ } catch (i) {
908
+ const c = String(i);
909
+ return c.includes("no_such_procedure") || c.includes("no callee registered") ? (console.error(`Get history failed: History service procedure '${l}' not registered`), null) : (console.error(`Get history failed: ${i}`), null);
803
910
  }
804
911
  }
805
- async setDeviceLocation(r, s) {
806
- const o = X({ longitude: r, latitude: s });
807
- if (!o.success)
808
- throw new Error(`Invalid location parameters: ${o.errors.map((u) => u.path + ": " + u.expected).join(", ")}`);
809
- const c = { long: r, lat: s }, a = {
912
+ async setDeviceLocation(t, s) {
913
+ const a = Z({ longitude: t, latitude: s });
914
+ if (!a.success)
915
+ throw new Error(`Invalid location parameters: ${a.errors.map((c) => c.path + ": " + c.expected).join(", ")}`);
916
+ const l = { long: t, lat: s }, i = {
810
917
  DEVICE_SERIAL_NUMBER: this._serialNumber,
811
918
  DEVICE_KEY: this._deviceKey,
812
919
  DEVICE_NAME: this._deviceName
@@ -814,15 +921,15 @@ class L {
814
921
  try {
815
922
  return await this._connection.call(
816
923
  "ironflock.location_service.update",
817
- [c],
818
- a
924
+ [l],
925
+ i
819
926
  );
820
- } catch (u) {
821
- return console.error(`Set location failed: ${u}`), null;
927
+ } catch (c) {
928
+ return console.error(`Set location failed: ${c}`), null;
822
929
  }
823
930
  }
824
- getRemoteAccessUrlForPort(r) {
825
- return this._deviceKey && this._appName ? `https://${this._deviceKey}-${this._appName.toLowerCase()}-${r}.app.ironflock.com` : null;
931
+ getRemoteAccessUrlForPort(t) {
932
+ return this._deviceKey && this._appName ? `https://${this._deviceKey}-${this._appName.toLowerCase()}-${t}.app.ironflock.com` : null;
826
933
  }
827
934
  /**
828
935
  * Create an IronFlock instance by fetching configuration from a server endpoint.
@@ -834,22 +941,23 @@ class L {
834
941
  * await flock.start();
835
942
  * ```
836
943
  */
837
- static async fromServer(r) {
838
- const s = await fetch(r);
944
+ static async fromServer(t) {
945
+ const s = await fetch(t);
839
946
  if (!s.ok)
840
- throw new Error(`Failed to fetch IronFlock config from ${r}: ${s.status} ${s.statusText}`);
841
- const o = await s.json();
842
- return new L(o);
947
+ throw new Error(`Failed to fetch IronFlock config from ${t}: ${s.status} ${s.statusText}`);
948
+ const a = await s.json();
949
+ return new P(a);
843
950
  }
844
951
  }
845
952
  export {
846
953
  I as CrossbarConnection,
847
- L as IronFlock,
954
+ P as IronFlock,
848
955
  M as Stage,
956
+ C as validateBulkTableParams,
849
957
  te as validateCallParams,
850
- X as validateLocationParams,
851
- Z as validatePublishParams,
852
- C as validateTableParams,
853
- q as validateTableQueryParams
958
+ Z as validateLocationParams,
959
+ z as validatePublishParams,
960
+ O as validateTableParams,
961
+ X as validateTableQueryParams
854
962
  };
855
963
  //# sourceMappingURL=index.mjs.map