@yuneta/gobj-js 7.26.9 → 7.26.11
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/gobj-js.cjs.js +38 -21
- package/dist/gobj-js.cjs.js.map +1 -1
- package/dist/gobj-js.cjs.min.js +154 -156
- package/dist/gobj-js.cjs.min.js.map +1 -1
- package/dist/gobj-js.es.js +38 -21
- package/dist/gobj-js.es.js.map +1 -1
- package/dist/gobj-js.es.min.js +14 -16
- package/dist/gobj-js.es.min.js.map +1 -1
- package/dist/gobj-js.iife.js +38 -21
- package/dist/gobj-js.iife.js.map +1 -1
- package/dist/gobj-js.iife.min.js +156 -158
- package/dist/gobj-js.iife.min.js.map +1 -1
- package/dist/gobj-js.umd.js +38 -21
- package/dist/gobj-js.umd.js.map +1 -1
- package/dist/gobj-js.umd.min.js +156 -158
- package/dist/gobj-js.umd.min.js.map +1 -1
- package/package.json +1 -1
package/dist/gobj-js.umd.min.js
CHANGED
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
data: l || []
|
|
133
133
|
};
|
|
134
134
|
}
|
|
135
|
-
var s = "7.0.0a", i = null, _ = null, a = null, u = null, c = null, f = null, g = [], d = Object.create(null), b = Object.create(null), p = null, m = null, h = 0,
|
|
135
|
+
var s = "7.0.0a", i = null, _ = null, a = null, u = null, c = null, f = null, g = [], d = Object.create(null), b = Object.create(null), p = null, m = null, h = 0, y = Object.freeze({
|
|
136
136
|
DTP_STRING: 1,
|
|
137
137
|
DTP_BOOLEAN: 2,
|
|
138
138
|
DTP_INTEGER: 3,
|
|
@@ -142,8 +142,8 @@
|
|
|
142
142
|
DTP_JSON: 7,
|
|
143
143
|
DTP_POINTER: 8
|
|
144
144
|
});
|
|
145
|
-
|
|
146
|
-
var
|
|
145
|
+
y.DTP_POINTER;
|
|
146
|
+
var E = Object.freeze({
|
|
147
147
|
SDF_NOTACCESS: 1,
|
|
148
148
|
SDF_RD: 2,
|
|
149
149
|
SDF_WR: 4,
|
|
@@ -166,7 +166,7 @@
|
|
|
166
166
|
SDF_AUTHZ_S: 524288,
|
|
167
167
|
SDF_AUTHZ_RS: 1048576
|
|
168
168
|
});
|
|
169
|
-
|
|
169
|
+
E.SDF_RD, E.SDF_WR, E.SDF_STATS, E.SDF_PERSIST, E.SDF_VOLATIL, E.SDF_RSTATS, E.SDF_PSTATS, E.SDF_WR, E.SDF_PERSIST;
|
|
170
170
|
var T = class {
|
|
171
171
|
constructor(e, t, n = 0, r = null, l = "", o = null, s = null, i = 0, _ = null, a = null, u = null) {
|
|
172
172
|
this.type = e, this.name = t, this.alias = o, this.flag = n, this.default_value = r, this.header = s, this.fillspace = i, this.description = l, this.json_fn = _, this.schema = a, this.authpth = u;
|
|
@@ -223,7 +223,7 @@
|
|
|
223
223
|
};
|
|
224
224
|
var C = 1;
|
|
225
225
|
function L(e) {
|
|
226
|
-
Zn(e) && (e = JSON.stringify(e)),
|
|
226
|
+
Zn(e) && (e = JSON.stringify(e)), En(" ".repeat(Math.max(1, 2 * h)) + String(e));
|
|
227
227
|
}
|
|
228
228
|
var P = Object.freeze({
|
|
229
229
|
TRACE_MACHINE: 65536,
|
|
@@ -427,19 +427,19 @@
|
|
|
427
427
|
function ae(e, t, n) {
|
|
428
428
|
let r, l = n.default_value;
|
|
429
429
|
switch (n.type) {
|
|
430
|
-
case
|
|
430
|
+
case y.DTP_STRING:
|
|
431
431
|
r = String(l);
|
|
432
432
|
break;
|
|
433
|
-
case
|
|
433
|
+
case y.DTP_BOOLEAN:
|
|
434
434
|
r = _r(l);
|
|
435
435
|
break;
|
|
436
|
-
case
|
|
436
|
+
case y.DTP_INTEGER:
|
|
437
437
|
r = parseInt(l), isNaN(r) && hn(`${et(e)}: attr NaN: ${n.name}`);
|
|
438
438
|
break;
|
|
439
|
-
case
|
|
439
|
+
case y.DTP_REAL:
|
|
440
440
|
r = Number(l), isNaN(r) && hn(`${et(e)}: attr NaN: ${n.name}`);
|
|
441
441
|
break;
|
|
442
|
-
case
|
|
442
|
+
case y.DTP_LIST:
|
|
443
443
|
if (tr(l)) try {
|
|
444
444
|
r = JSON.parse(l);
|
|
445
445
|
} catch (e) {
|
|
@@ -448,7 +448,7 @@
|
|
|
448
448
|
else r = l;
|
|
449
449
|
er(r) || (r = []);
|
|
450
450
|
break;
|
|
451
|
-
case
|
|
451
|
+
case y.DTP_DICT:
|
|
452
452
|
if (tr(l)) try {
|
|
453
453
|
r = JSON.parse(l);
|
|
454
454
|
} catch (e) {
|
|
@@ -457,7 +457,7 @@
|
|
|
457
457
|
else r = l;
|
|
458
458
|
Zn(r) || (r = {});
|
|
459
459
|
break;
|
|
460
|
-
case
|
|
460
|
+
case y.DTP_JSON:
|
|
461
461
|
if ("" === l || void 0 === l) r = null;
|
|
462
462
|
else if (tr(l)) try {
|
|
463
463
|
r = JSON.parse(l);
|
|
@@ -466,14 +466,14 @@
|
|
|
466
466
|
}
|
|
467
467
|
else r = l;
|
|
468
468
|
break;
|
|
469
|
-
case
|
|
469
|
+
case y.DTP_POINTER: r = l;
|
|
470
470
|
}
|
|
471
471
|
return void 0 === r && (hn(`default_value WRONG, it: ${n.name}, value: ${n.default_value}`), r = null), t[n.name] = r, 0;
|
|
472
472
|
}
|
|
473
473
|
function ue(e, t, n, r) {
|
|
474
474
|
let l;
|
|
475
475
|
switch (n.type) {
|
|
476
|
-
case
|
|
476
|
+
case y.DTP_STRING:
|
|
477
477
|
if (null == r) l = "";
|
|
478
478
|
else if (tr(r)) l = String(r);
|
|
479
479
|
else {
|
|
@@ -481,16 +481,16 @@
|
|
|
481
481
|
e && (l = String(e));
|
|
482
482
|
}
|
|
483
483
|
break;
|
|
484
|
-
case
|
|
484
|
+
case y.DTP_BOOLEAN:
|
|
485
485
|
l = _r(r);
|
|
486
486
|
break;
|
|
487
|
-
case
|
|
487
|
+
case y.DTP_INTEGER:
|
|
488
488
|
if (l = parseInt(r), isNaN(l)) return hn(`${et(e)}: attr NaN: ${n.name}`), -1;
|
|
489
489
|
break;
|
|
490
|
-
case
|
|
490
|
+
case y.DTP_REAL:
|
|
491
491
|
if (l = Number(r), isNaN(l)) return hn(`${et(e)}: attr NaN: ${n.name}`), -1;
|
|
492
492
|
break;
|
|
493
|
-
case
|
|
493
|
+
case y.DTP_LIST:
|
|
494
494
|
if (tr(r)) try {
|
|
495
495
|
l = JSON.parse(r);
|
|
496
496
|
} catch (e) {
|
|
@@ -499,7 +499,7 @@
|
|
|
499
499
|
else l = r;
|
|
500
500
|
if (!er(l)) return hn(`attr must be an array: ${n.name}`), -1;
|
|
501
501
|
break;
|
|
502
|
-
case
|
|
502
|
+
case y.DTP_DICT:
|
|
503
503
|
if (tr(r)) try {
|
|
504
504
|
l = JSON.parse(r);
|
|
505
505
|
} catch (e) {
|
|
@@ -508,7 +508,7 @@
|
|
|
508
508
|
else l = r;
|
|
509
509
|
if (!Zn(l)) return hn(`attr must be an object: ${n.name}`), -1;
|
|
510
510
|
break;
|
|
511
|
-
case
|
|
511
|
+
case y.DTP_JSON:
|
|
512
512
|
if (l = r, tr(r)) {
|
|
513
513
|
const e = r.trim();
|
|
514
514
|
if (e.startsWith("{") || e.startsWith("[")) try {
|
|
@@ -518,7 +518,7 @@
|
|
|
518
518
|
}
|
|
519
519
|
}
|
|
520
520
|
break;
|
|
521
|
-
case
|
|
521
|
+
case y.DTP_POINTER: l = r;
|
|
522
522
|
}
|
|
523
523
|
return void 0 === l && hn(`${et(e)}: attr undefined: ${n.name}`), t[n.name] = l, Zn(e.priv) && Object.prototype.hasOwnProperty.call(e.priv, n.name) && (e.priv[n.name] = l), e.obflag & R.obflag_created && !(e.obflag & R.obflag_destroyed) && e.gclass.gmt.mt_writing && e.gclass.gmt.mt_writing(e, n.name), 0;
|
|
524
524
|
}
|
|
@@ -553,7 +553,7 @@
|
|
|
553
553
|
const l = r.length;
|
|
554
554
|
for (let e = 0; e < l; e++) {
|
|
555
555
|
let n = r[e][0], l = r[e][1], o = r[e][2];
|
|
556
|
-
ir(n) ||
|
|
556
|
+
ir(n) || ye(c, t, n, l, o);
|
|
557
557
|
}
|
|
558
558
|
}
|
|
559
559
|
for (let e = 0; e < t.length; e++) {
|
|
@@ -598,17 +598,17 @@
|
|
|
598
598
|
function he(e, t) {
|
|
599
599
|
return e instanceof O ? pe(e, t) ? (hn(`state already exists: ${t}`), -1) : (e.dl_states.push(new A(t)), 0) : (hn("Cannot add state, typeof not GClass"), -1);
|
|
600
600
|
}
|
|
601
|
-
function
|
|
601
|
+
function ye(e, t, n, r, l) {
|
|
602
602
|
if (!(e instanceof O)) return hn("Cannot add state, typeof not GClass"), -1;
|
|
603
603
|
if (ir(t)) return hn("state_name EMPTY"), -1;
|
|
604
604
|
let o = pe(e, t);
|
|
605
605
|
return o ? me(o, n) ? (hn(`event already exists: gclass ${e.gclass_name}, state ${t}, event ${n}`), -1) : (o.dl_actions.push(new k(n, r, l)), 0) : (hn(`state not found: ${t}`), -1);
|
|
606
606
|
}
|
|
607
|
-
function
|
|
607
|
+
function Ee(e, t, n) {
|
|
608
608
|
ir(t) || e.push(new I(t, n));
|
|
609
609
|
}
|
|
610
610
|
function Te(e, t, n) {
|
|
611
|
-
return e instanceof O ?
|
|
611
|
+
return e instanceof O ? Ee(e.dl_events, t, n) : (hn("Cannot add state, typeof not GClass"), -1);
|
|
612
612
|
}
|
|
613
613
|
function ve(e, t) {
|
|
614
614
|
if (!(e instanceof O)) return hn("Cannot add state, typeof not GClass"), 0;
|
|
@@ -682,7 +682,7 @@
|
|
|
682
682
|
let o = 0;
|
|
683
683
|
for (const [s, i] of Object.entries(t)) {
|
|
684
684
|
const t = ge(l.gclass, s, !1);
|
|
685
|
-
t ? (-1 === n || t.flag & n) && (t.flag &
|
|
685
|
+
t ? (-1 === n || t.flag & n) && (t.flag & E.SDF_DEPRECATED && yn(`${et(l)}: Deprecated attribute used in gobj creation: ${s}`), o += ue(l, e, t, i)) : r && (r(l, s), o--);
|
|
686
686
|
}
|
|
687
687
|
return o;
|
|
688
688
|
})(ce(e), r, -1, e.gclass.gclass_flag & w.gcflag_ignore_unknown_attrs ? 0 : ke, e) < 0 && (hn(`${et(e)} json2data() FAILED`), Un(r));
|
|
@@ -696,7 +696,7 @@
|
|
|
696
696
|
if (!("string" == typeof l || l instanceof S)) return hn(`BAD TYPE of parent: ${l}`), null;
|
|
697
697
|
if (tr(l)) {
|
|
698
698
|
const e = l;
|
|
699
|
-
if (!(l = we(e))) return
|
|
699
|
+
if (!(l = we(e))) return yn(`parent service not found: ${e}`), null;
|
|
700
700
|
}
|
|
701
701
|
}
|
|
702
702
|
if (o & N.gobj_flag_service && we(e, !1)) return hn(`service ALREADY registered: ${t}^${e}`), null;
|
|
@@ -759,7 +759,7 @@
|
|
|
759
759
|
function Ve(e) {
|
|
760
760
|
if (ot(e)) return hn("gobj NULL or DESTROYED"), -1;
|
|
761
761
|
if (!e.running) return hn(`${et(e)}: GObj NOT RUNNING`), -1;
|
|
762
|
-
e.playing && (
|
|
762
|
+
e.playing && (yn(`${et(e)}: GObj stopping without previous pause`), xe(e)), J(e) && L(n("⏹ ⏹ stop: %s", tt(e))), e.running = !1;
|
|
763
763
|
let t = 0;
|
|
764
764
|
return e.gclass.gmt.mt_stop && (t = e.gclass.gmt.mt_stop(e)), t;
|
|
765
765
|
}
|
|
@@ -775,7 +775,7 @@
|
|
|
775
775
|
if (e.disabled) return hn(`${et(e)}: GObj DISABLED`), -1;
|
|
776
776
|
if (!Ke(e)) {
|
|
777
777
|
if (e.gclass.gclass_flag & w.gcflag_required_start_to_play) return hn(`${et(e)}: Cannot play, start not done`), -1;
|
|
778
|
-
|
|
778
|
+
yn(`${et(e)}: GObj playing without previous start`), Pe(e);
|
|
779
779
|
}
|
|
780
780
|
J(e) && L(n("⏯ ⏯ play: %s", tt(e))), e.playing = !0;
|
|
781
781
|
let t = 0;
|
|
@@ -843,7 +843,7 @@
|
|
|
843
843
|
}
|
|
844
844
|
function it(e, t) {
|
|
845
845
|
if (!sr(e)) return hn("gobj NULL of bad type"), null;
|
|
846
|
-
e.bottom_gobj && t &&
|
|
846
|
+
e.bottom_gobj && t && yn(`${et(e)}: bottom_gobj already set`), e.bottom_gobj = t;
|
|
847
847
|
}
|
|
848
848
|
function _t(e, t, n) {
|
|
849
849
|
return sr(e) ? t ? ge(e.gclass, t, n) : e.gclass.attrs_table : (hn("gobj NULL of bad type"), null);
|
|
@@ -939,7 +939,7 @@
|
|
|
939
939
|
function ht(e, t) {
|
|
940
940
|
return !ir(t) && !!ge(e.gclass, t, !1);
|
|
941
941
|
}
|
|
942
|
-
function
|
|
942
|
+
function yt(e, t, n) {
|
|
943
943
|
let r = e.jn_attrs;
|
|
944
944
|
if (t in r && Object.prototype.hasOwnProperty.call(r, t)) {
|
|
945
945
|
let n = r[t];
|
|
@@ -947,7 +947,7 @@
|
|
|
947
947
|
}
|
|
948
948
|
return hn(`${et(e)}: GClass Attribute NOT FOUND, attr ${t}`), null;
|
|
949
949
|
}
|
|
950
|
-
function
|
|
950
|
+
function Et(e, t, n) {
|
|
951
951
|
let r = {}, l = e.gclass.attrs_table;
|
|
952
952
|
for (let n = 0; n < l.length; n++) {
|
|
953
953
|
const o = l[n];
|
|
@@ -1134,16 +1134,16 @@
|
|
|
1134
1134
|
return null;
|
|
1135
1135
|
}
|
|
1136
1136
|
var Wt = [
|
|
1137
|
-
j(
|
|
1138
|
-
j(
|
|
1139
|
-
j(
|
|
1140
|
-
j(
|
|
1141
|
-
j(
|
|
1142
|
-
j(
|
|
1143
|
-
j(
|
|
1144
|
-
j(
|
|
1145
|
-
j(
|
|
1146
|
-
j(
|
|
1137
|
+
j(y.DTP_POINTER, "publisher", 0, null, "publisher gobj"),
|
|
1138
|
+
j(y.DTP_POINTER, "subscriber", 0, null, "subscriber gobj"),
|
|
1139
|
+
j(y.DTP_STRING, "event", 0, "", "event name subscribed"),
|
|
1140
|
+
j(y.DTP_STRING, "renamed_event", 0, "", "rename event name"),
|
|
1141
|
+
j(y.DTP_INTEGER, "subs_flag", 0, 0, "subscription flag"),
|
|
1142
|
+
j(y.DTP_JSON, "__config__", 0, null, "subscription config"),
|
|
1143
|
+
j(y.DTP_JSON, "__global__", 0, null, "global kw, merge in publishing"),
|
|
1144
|
+
j(y.DTP_JSON, "__local__", 0, null, "local kw, remove in publishing"),
|
|
1145
|
+
j(y.DTP_JSON, "__filter__", 0, null, "filter kw, filter in publishing"),
|
|
1146
|
+
j(y.DTP_STRING, "__service__", 0, "", "subscription service"),
|
|
1147
1147
|
v()
|
|
1148
1148
|
];
|
|
1149
1149
|
function xt(e, t) {
|
|
@@ -1193,7 +1193,7 @@
|
|
|
1193
1193
|
}
|
|
1194
1194
|
function Jt(e, t, r, l) {
|
|
1195
1195
|
let o = vr(e, t, "publisher", null, Zt.KW_REQUIRED), s = vr(e, t, "subscriber", null, Zt.KW_REQUIRED), i = Tr(e, t, "event", "", Zt.KW_REQUIRED);
|
|
1196
|
-
if (!!(
|
|
1196
|
+
if (!!(Er(e, t, "subs_flag", null, Zt.KW_REQUIRED) & Gt.__hard_subscription__) && !r) return -1;
|
|
1197
1197
|
let _ = B(s) || B(o);
|
|
1198
1198
|
if (Bt(o.dl_subscriptions, t) < 0) return _ && L(n("💜💜👎 unsubscribing event '%s': publisher %s, subscriber'%s', ALREADY REMOVED", i || "", et(o), et(s))), 1;
|
|
1199
1199
|
_ && (L(n("💜💜👎 unsubscribing event '%s': publisher %s, subscriber'%s'", i || "", et(o), et(s))), vn(t)), o.obflag & R.obflag_destroyed || l || o.gclass.gmt.mt_subscription_deleted && o.gclass.gmt.mt_subscription_deleted(o, t);
|
|
@@ -1215,11 +1215,11 @@
|
|
|
1215
1215
|
}), ir(t)) t = "";
|
|
1216
1216
|
else if (!(Ct(e, t, $.EVF_OUTPUT_EVENT) || e.gclass.gclass_flag & w.gcflag_no_check_output_events)) return hn(`event NOT in output event list: ${et(e)}, ${t}`), 0;
|
|
1217
1217
|
let s = xt(r, t), i = Yt(e.dl_subscriptions, e, t, s.renamed_event, s.kw, l), _ = null;
|
|
1218
|
-
for (let t = 0; t < i.length; t++) if (
|
|
1218
|
+
for (let t = 0; t < i.length; t++) if (Er(e, i[t], "subs_flag", 0, Zt.KW_REQUIRED) & Gt.__hard_subscription__) {
|
|
1219
1219
|
_ = i[t];
|
|
1220
1220
|
break;
|
|
1221
1221
|
}
|
|
1222
|
-
if (_) return
|
|
1222
|
+
if (_) return yn(`${et(e)}: Hard subscription REPEATED, the one there is kept and returned (event: ${t}, subscriber: ${et(l)})`), _;
|
|
1223
1223
|
Qn(i) > 0 && (hn(`${et(e)}: ${Qn(i)} subscription(s) REPEATED, will be deleted and override`), vn(i, "subscription REPEATED"), Ht(e, i, !1));
|
|
1224
1224
|
let a = function(e, t, n, r) {
|
|
1225
1225
|
let l = _e(e, Wt);
|
|
@@ -1240,11 +1240,11 @@
|
|
|
1240
1240
|
} else hn(`${et(e)}: EVENT NOT FOUND (__rename_event_name__: ${s})`);
|
|
1241
1241
|
}
|
|
1242
1242
|
if (gr(n, "__hard_subscription__")) {
|
|
1243
|
-
let t =
|
|
1243
|
+
let t = yr(e, n, "__hard_subscription__", !1);
|
|
1244
1244
|
Kn(n, "__hard_subscription__"), t && (o |= Gt.__hard_subscription__);
|
|
1245
1245
|
}
|
|
1246
1246
|
if (gr(n, "__own_event__")) {
|
|
1247
|
-
let t =
|
|
1247
|
+
let t = yr(e, n, "__own_event__", !1);
|
|
1248
1248
|
Kn(n, "__own_event__"), t && (o |= Gt.__own_event__);
|
|
1249
1249
|
}
|
|
1250
1250
|
}
|
|
@@ -1262,7 +1262,7 @@
|
|
|
1262
1262
|
function Ht(e, t, n) {
|
|
1263
1263
|
let r = [...t], l = 0;
|
|
1264
1264
|
for (let t = 0; t < r.length; t++) Jt(e, r[t], n, !1) > 0 && l++;
|
|
1265
|
-
return l &&
|
|
1265
|
+
return l && yn(`${et(e)}: Subscription(s) already removed, nothing to remove (count: ${l})`), 0;
|
|
1266
1266
|
}
|
|
1267
1267
|
function zt(e, t, n, r) {
|
|
1268
1268
|
return null == n && (n = {}), Yt(e.dl_subscriptions, e, t, null, n, r);
|
|
@@ -1290,7 +1290,7 @@
|
|
|
1290
1290
|
}
|
|
1291
1291
|
let u = vr(e, a, "subscriber", null, Zt.KW_REQUIRED);
|
|
1292
1292
|
if (!u || ot(u)) continue;
|
|
1293
|
-
let c =
|
|
1293
|
+
let c = Er(e, a, "subs_flag", 0, Zt.KW_REQUIRED), f = Tr(e, a, "event", "", Zt.KW_REQUIRED);
|
|
1294
1294
|
if (ir(f) || 0 === ur(f, t)) {
|
|
1295
1295
|
jr(e, a, "__config__", null, 0);
|
|
1296
1296
|
let l = jr(e, a, "__global__", null, 0), s = jr(e, a, "__local__", null, 0), f = Or(e, a, "__filter__", null, 0), g = a.renamed_event;
|
|
@@ -1310,7 +1310,7 @@
|
|
|
1310
1310
|
if (_ += m, i++, ot(e)) break;
|
|
1311
1311
|
}
|
|
1312
1312
|
}
|
|
1313
|
-
return i || l && l.event_flag & $.EVF_NO_WARN_SUBS ||
|
|
1313
|
+
return i || l && l.event_flag & $.EVF_NO_WARN_SUBS || yn(`${et(e)}: Publish event WITHOUT subscribers, ev ${t}`), _;
|
|
1314
1314
|
}
|
|
1315
1315
|
var Zt = Object.freeze({
|
|
1316
1316
|
KW_REQUIRED: 1,
|
|
@@ -1407,11 +1407,11 @@
|
|
|
1407
1407
|
let n = mn(e, ...t), r = el();
|
|
1408
1408
|
tn && (tn === en.error ? cn("error", n) && tn("%c" + r + " ERROR: " + String(n), "color:red") : (cn("error", n) && en.error("%c" + r + " ERROR: " + String(n), "color:red"), tn(`${r} ERROR: ${String(n)}`))), gn("error", n, r);
|
|
1409
1409
|
}
|
|
1410
|
-
function
|
|
1410
|
+
function yn(e, ...t) {
|
|
1411
1411
|
let n = mn(e, ...t), r = el();
|
|
1412
1412
|
nn && (nn === en.warn ? cn("warning", n) && nn("%c" + r + " WARNING: " + String(n), "color:yellow") : (cn("warning", n) && en.warn("%c" + r + " WARNING: " + String(n), "color:yellow"), nn(`${r} WARNING: ${String(n)}`))), gn("warning", n, r);
|
|
1413
1413
|
}
|
|
1414
|
-
function
|
|
1414
|
+
function En(e, ...t) {
|
|
1415
1415
|
let n = mn(e, ...t), r = el();
|
|
1416
1416
|
ln && cn("debug", n) && ln("%c" + r + " DEBUG: " + String(n), "color:silver"), gn("debug", n, r);
|
|
1417
1417
|
}
|
|
@@ -1766,7 +1766,7 @@
|
|
|
1766
1766
|
else if (s = mr(e, t, l, !0), void 0 === s) return -1;
|
|
1767
1767
|
return er(s) ? (hn(`${r}kw_delete(): cannot delete an item of a list: '${n}'`), -1) : Zn(s) && Object.prototype.hasOwnProperty.call(s, o) ? (delete s[o], 0) : (hn(`${r}kw_delete(): path not found: '${n}'`), -1);
|
|
1768
1768
|
}
|
|
1769
|
-
function
|
|
1769
|
+
function yr(e, t, n, r, l) {
|
|
1770
1770
|
e && !sr(e) && hn("GObj bad instanceof");
|
|
1771
1771
|
let o = mr(e, t, n, !1);
|
|
1772
1772
|
const s = l && l & Zt.KW_REQUIRED, i = l && l & Zt.KW_CREATE, _ = l && l & Zt.KW_EXTRACT, a = l && l & Zt.KW_WILD_NUMBER;
|
|
@@ -1787,7 +1787,7 @@
|
|
|
1787
1787
|
}
|
|
1788
1788
|
return _ && hr(e, t, n), u;
|
|
1789
1789
|
}
|
|
1790
|
-
function
|
|
1790
|
+
function Er(e, t, n, r, l) {
|
|
1791
1791
|
e && !sr(e) && hn("GObj bad instanceof");
|
|
1792
1792
|
let o = mr(e, t, n, !1);
|
|
1793
1793
|
const s = l && l & Zt.KW_REQUIRED, i = l && l & Zt.KW_CREATE, _ = l && l & Zt.KW_EXTRACT, a = l && l & Zt.KW_WILD_NUMBER;
|
|
@@ -1864,6 +1864,7 @@
|
|
|
1864
1864
|
function Sr(e, t, n, r) {
|
|
1865
1865
|
if (e && !sr(e) && hn("GObj bad instanceof"), !Zn(t)) return hn("kw is not an object"), -1;
|
|
1866
1866
|
if (!tr(n)) return hn(`${e ? et(e) + ": " : ""}kw_set_dict_value(): path must be a string: ${String(n)}`), -1;
|
|
1867
|
+
if ("" === n) return hn((e ? et(e) + ": " : "") + "kw_set_dict_value(): path empty"), -1;
|
|
1867
1868
|
let l = n.split("`"), o = l.length;
|
|
1868
1869
|
for (let s = 0; s < o; s++) {
|
|
1869
1870
|
let i = l[s];
|
|
@@ -2338,9 +2339,9 @@
|
|
|
2338
2339
|
return t.is_file && (t.type = "file"), t;
|
|
2339
2340
|
}
|
|
2340
2341
|
var bl = [
|
|
2341
|
-
j(
|
|
2342
|
-
j(
|
|
2343
|
-
j(
|
|
2342
|
+
j(y.DTP_POINTER, "subscriber", 0, null, "Subscriber of output events"),
|
|
2343
|
+
j(y.DTP_BOOLEAN, "periodic", 0, 0, "True for periodic timeouts"),
|
|
2344
|
+
j(y.DTP_INTEGER, "msec", 0, 0, "Timeout in milliseconds"),
|
|
2344
2345
|
v()
|
|
2345
2346
|
], pl = {
|
|
2346
2347
|
periodic: !1,
|
|
@@ -2353,7 +2354,7 @@
|
|
|
2353
2354
|
Vt(e, "EV_TIMEOUT", {}, e);
|
|
2354
2355
|
}, l.msec) : l.timer_id = -1, lt(e) ? Vt(nt(e), o, {}, e) : Xt(e, o, {}), l.periodic || -1 !== l.timer_id || Ke(e) && Ve(e), 0;
|
|
2355
2356
|
}
|
|
2356
|
-
var
|
|
2357
|
+
var yl = {
|
|
2357
2358
|
mt_create: function(e) {
|
|
2358
2359
|
let t = e.priv;
|
|
2359
2360
|
const n = Ot(e, "subscriber");
|
|
@@ -2378,7 +2379,7 @@
|
|
|
2378
2379
|
},
|
|
2379
2380
|
mt_destroy: function(e) {}
|
|
2380
2381
|
};
|
|
2381
|
-
function
|
|
2382
|
+
function El(e, t) {
|
|
2382
2383
|
return e instanceof S ? "C_TIMER" !== Ze(e) ? (hn("not C_TIMER GObj"), -1) : (Nt(e, "periodic", !1), void Rt(e, "msec", t)) : (hn("not GObj TYPE"), -1);
|
|
2383
2384
|
}
|
|
2384
2385
|
function Tl(e, t) {
|
|
@@ -2388,28 +2389,28 @@
|
|
|
2388
2389
|
return e instanceof S ? "C_TIMER" !== Ze(e) ? (hn("not C_TIMER GObj"), -1) : void Rt(e, "msec", -1) : (hn("not GObj TYPE"), -1);
|
|
2389
2390
|
}
|
|
2390
2391
|
var jl = [
|
|
2391
|
-
j(
|
|
2392
|
-
j(
|
|
2393
|
-
j(
|
|
2394
|
-
j(
|
|
2395
|
-
j(
|
|
2396
|
-
j(
|
|
2397
|
-
j(
|
|
2398
|
-
j(
|
|
2399
|
-
j(
|
|
2400
|
-
j(
|
|
2401
|
-
j(
|
|
2402
|
-
j(
|
|
2403
|
-
j(
|
|
2404
|
-
j(
|
|
2405
|
-
j(
|
|
2406
|
-
j(
|
|
2407
|
-
j(
|
|
2408
|
-
j(
|
|
2392
|
+
j(y.DTP_BOOLEAN, "changesLost", 0, !1, "Set true to warn about leaving page"),
|
|
2393
|
+
j(y.DTP_BOOLEAN, "browser_beforeunload", 0, !1, "Set true to refreshing browser"),
|
|
2394
|
+
j(y.DTP_STRING, "__username__", 0, "", "Username"),
|
|
2395
|
+
j(y.DTP_STRING, "start_date", 0, "", "Yuno starting date"),
|
|
2396
|
+
j(y.DTP_STRING, "node_uuid", 0, "", "uuid of node"),
|
|
2397
|
+
j(y.DTP_STRING, "yuno_role", 0, "", "Yuno role"),
|
|
2398
|
+
j(y.DTP_STRING, "yuno_id", 0, "", "Yuno Id. Set by agent"),
|
|
2399
|
+
j(y.DTP_STRING, "yuno_name", 0, "", "Yuno name. Set by agent"),
|
|
2400
|
+
j(y.DTP_STRING, "yuno_tag", 0, "", "Tags of yuno. Set by agent"),
|
|
2401
|
+
j(y.DTP_STRING, "yuno_release", 0, "", "Yuno Release. Set by agent"),
|
|
2402
|
+
j(y.DTP_STRING, "yuno_version", 0, "", "Yuno version (APP_VERSION)"),
|
|
2403
|
+
j(y.DTP_STRING, "yuneta_version", 0, s, "Yuneta version"),
|
|
2404
|
+
j(y.DTP_LIST, "required_services", 0, "[]", "Required services"),
|
|
2405
|
+
j(y.DTP_DICT, "trace_levels", E.SDF_PERSIST, "{}", "Trace levels"),
|
|
2406
|
+
j(y.DTP_DICT, "no_trace_levels", E.SDF_PERSIST, "{}", "No trace levels"),
|
|
2407
|
+
j(y.DTP_POINTER, "trace_ievent_callback", 0, null, "Where the traffic trace goes (C_IEVENT_CLI levels ievents/ievents2); console when null"),
|
|
2408
|
+
j(y.DTP_BOOLEAN, "developer", 0, !1, "Developer mode enabled"),
|
|
2409
|
+
j(y.DTP_INTEGER, "periodic_timeout", 0, "1000", "Timeout periodic, in miliseconds."),
|
|
2409
2410
|
v()
|
|
2410
2411
|
], Ol = { gobj_timer: null }, Sl = null;
|
|
2411
2412
|
function wl(e, t, n, r) {
|
|
2412
|
-
let l =
|
|
2413
|
+
let l = yt(e, t);
|
|
2413
2414
|
return Zn(l) || (l = {}), l[n] = r, St(e, t, l), De(e, t);
|
|
2414
2415
|
}
|
|
2415
2416
|
function Nl(e) {
|
|
@@ -2426,8 +2427,8 @@
|
|
|
2426
2427
|
var Dl = {
|
|
2427
2428
|
mt_create: function(e) {
|
|
2428
2429
|
let t = e.priv;
|
|
2429
|
-
$t(e, "start_date", el()), $t(e, "node_uuid", nl()), e.priv.gobj_timer = Ce(Xe(e), "C_TIMER", {}, e), t.periodic_timeout =
|
|
2430
|
-
let t =
|
|
2430
|
+
$t(e, "start_date", el()), $t(e, "node_uuid", nl()), e.priv.gobj_timer = Ce(Xe(e), "C_TIMER", {}, e), t.periodic_timeout = yt(e, "periodic_timeout"), function(e) {
|
|
2431
|
+
let t = yt(e, "trace_levels");
|
|
2431
2432
|
if (!Zn(t)) return 0;
|
|
2432
2433
|
let n = t.__global_trace__;
|
|
2433
2434
|
if (er(n)) {
|
|
@@ -2442,7 +2443,7 @@
|
|
|
2442
2443
|
} else hn(`${Xe(e)}: trace_levels of ${n} MUST be a list`);
|
|
2443
2444
|
}
|
|
2444
2445
|
}(e), function(e) {
|
|
2445
|
-
let t =
|
|
2446
|
+
let t = yt(e, "no_trace_levels");
|
|
2446
2447
|
if (!Zn(t)) return 0;
|
|
2447
2448
|
let n = t.__global_no_trace__;
|
|
2448
2449
|
if (er(n)) {
|
|
@@ -2498,21 +2499,21 @@
|
|
|
2498
2499
|
}
|
|
2499
2500
|
};
|
|
2500
2501
|
var kl = "ievent_gate_stack", Al = [
|
|
2501
|
-
j(
|
|
2502
|
-
j(
|
|
2503
|
-
j(
|
|
2504
|
-
j(
|
|
2505
|
-
j(
|
|
2506
|
-
j(
|
|
2507
|
-
j(
|
|
2508
|
-
j(
|
|
2509
|
-
j(
|
|
2510
|
-
j(
|
|
2511
|
-
j(
|
|
2512
|
-
j(
|
|
2513
|
-
j(
|
|
2514
|
-
j(
|
|
2515
|
-
j(
|
|
2502
|
+
j(y.DTP_STRING, "wanted_yuno_role", E.SDF_RD, "", "wanted yuno role"),
|
|
2503
|
+
j(y.DTP_STRING, "wanted_yuno_name", E.SDF_RD, "", "wanted yuno name"),
|
|
2504
|
+
j(y.DTP_STRING, "wanted_yuno_service", E.SDF_RD, "", "wanted yuno service"),
|
|
2505
|
+
j(y.DTP_STRING, "remote_yuno_role", E.SDF_RD, "", "confirmed remote yuno role"),
|
|
2506
|
+
j(y.DTP_STRING, "remote_yuno_name", E.SDF_RD, "", "confirmed remote yuno name"),
|
|
2507
|
+
j(y.DTP_STRING, "remote_yuno_service", E.SDF_RD, "", "confirmed remote yuno service"),
|
|
2508
|
+
j(y.DTP_STRING, "url", E.SDF_RD, "", "Url to connect"),
|
|
2509
|
+
j(y.DTP_STRING, "jwt", E.SDF_PERSIST, "", "JWT"),
|
|
2510
|
+
j(y.DTP_STRING, "cert_pem", E.SDF_PERSIST, "", "SSL server certification, PEM str format"),
|
|
2511
|
+
j(y.DTP_JSON, "extra_info", E.SDF_RD, "{}", "dict data set by user, added to the identity card msg."),
|
|
2512
|
+
j(y.DTP_LIST, "required_services", E.SDF_RD, "[]", "Services this LINK requires (identity card). Empty = the yuno's `required_services`, as before. A yuno with several links to DIFFERENT backends must set it per link: the yuno-wide list is the union, so every backend is told the service names of all the others."),
|
|
2513
|
+
j(y.DTP_INTEGER, "timeout_retry", E.SDF_RD, "5000", "First reconnect delay (ms). It BACKS OFF from here, doubling up to timeout_retry_max, and resets when a session is reached"),
|
|
2514
|
+
j(y.DTP_INTEGER, "timeout_retry_max", E.SDF_RD, "60000", "Cap of the reconnect backoff (ms). Set it equal to timeout_retry for the old fixed-interval behaviour"),
|
|
2515
|
+
j(y.DTP_INTEGER, "timeout_idack", E.SDF_RD, "5000", "timeout waiting idAck"),
|
|
2516
|
+
j(y.DTP_POINTER, "subscriber", 0, 0, "subscriber of output-events. If null then subscriber is the parent"),
|
|
2516
2517
|
v()
|
|
2517
2518
|
], Il = [
|
|
2518
2519
|
["ievents", "Trace inter-events with metadata of kw"],
|
|
@@ -2536,7 +2537,7 @@
|
|
|
2536
2537
|
function Ul(e) {
|
|
2537
2538
|
e.priv.websocket && hn("Websocket ALREADY setup");
|
|
2538
2539
|
const t = jt(e, "url");
|
|
2539
|
-
|
|
2540
|
+
En(`====> Starting WebSocket to '${t}' (${et(e)})`);
|
|
2540
2541
|
const n = ++e.priv.ws_seq;
|
|
2541
2542
|
let r;
|
|
2542
2543
|
try {
|
|
@@ -2548,7 +2549,7 @@
|
|
|
2548
2549
|
code: 1006,
|
|
2549
2550
|
reason: r.message,
|
|
2550
2551
|
was_clean: !1
|
|
2551
|
-
}, e) < 0 &&
|
|
2552
|
+
}, e) < 0 && El(e.priv.gobj_timer, ql(e)), null;
|
|
2552
2553
|
}
|
|
2553
2554
|
return r ? (r.onopen = () => {
|
|
2554
2555
|
n !== e.priv.ws_seq || ot(e) || Vt(e, "EV_ON_OPEN", {
|
|
@@ -2561,7 +2562,7 @@
|
|
|
2561
2562
|
data: r.data
|
|
2562
2563
|
}, e);
|
|
2563
2564
|
}, r.onclose = (r) => {
|
|
2564
|
-
ot(e) || n === e.priv.ws_seq && (Tt(qe(), "browser_beforeunload") ?
|
|
2565
|
+
ot(e) || n === e.priv.ws_seq && (Tt(qe(), "browser_beforeunload") ? yn("Close websocket by unload page") : Vt(e, "EV_ON_CLOSE", {
|
|
2565
2566
|
url: t,
|
|
2566
2567
|
ws_seq: n,
|
|
2567
2568
|
code: r.code,
|
|
@@ -2573,20 +2574,20 @@
|
|
|
2573
2574
|
function Fl(e, t = 1e3, n = "") {
|
|
2574
2575
|
let r = e.priv, l = r.websocket;
|
|
2575
2576
|
if (r.websocket = null, l && l.readyState !== WebSocket.CLOSED && l.readyState !== WebSocket.CLOSING) {
|
|
2576
|
-
|
|
2577
|
+
En(`Closing WebSocket (Code: ${t}, Reason: "${n}")`);
|
|
2577
2578
|
try {
|
|
2578
2579
|
l.close(t, n);
|
|
2579
2580
|
} catch (t) {
|
|
2580
2581
|
hn(`${et(e)}: Error closing WebSocket: ${t.message}`);
|
|
2581
2582
|
}
|
|
2582
|
-
} else
|
|
2583
|
+
} else yn("WebSocket is already closed or in the process of closing.");
|
|
2583
2584
|
}
|
|
2584
2585
|
function Vl(e, t, n) {
|
|
2585
2586
|
let r = el();
|
|
2586
2587
|
try {
|
|
2587
|
-
|
|
2588
|
+
En("\n" + r + " " + t + "\n"), Un(n);
|
|
2588
2589
|
} catch (e) {
|
|
2589
|
-
|
|
2590
|
+
En("ERROR in trace_inter_event: " + e);
|
|
2590
2591
|
}
|
|
2591
2592
|
}
|
|
2592
2593
|
var Gl = class {
|
|
@@ -2598,10 +2599,10 @@
|
|
|
2598
2599
|
return function(e, t) {
|
|
2599
2600
|
let n = e.priv, r = JSON.stringify(t);
|
|
2600
2601
|
if (Cl(e)) {
|
|
2601
|
-
let n = jt(e, "url"), l = Xe(qe()) + " ==> " + n, o =
|
|
2602
|
+
let n = jt(e, "url"), l = Xe(qe()) + " ==> " + n, o = yt(qe(), "trace_ievent_callback");
|
|
2602
2603
|
o ? o(l, t, 1, r.length) : Vl(0, l, t);
|
|
2603
2604
|
}
|
|
2604
|
-
if (!n.websocket || n.websocket.readyState !== WebSocket.OPEN) return
|
|
2605
|
+
if (!n.websocket || n.websocket.readyState !== WebSocket.OPEN) return yn(`${et(e)}: send_iev(): websocket not open, message lost`), -1;
|
|
2605
2606
|
try {
|
|
2606
2607
|
n.websocket.send(r);
|
|
2607
2608
|
} catch (t) {
|
|
@@ -2624,8 +2625,8 @@
|
|
|
2624
2625
|
};
|
|
2625
2626
|
}
|
|
2626
2627
|
function xl(e) {
|
|
2627
|
-
let t = e.priv, n = Je(qe()), r = jt(qe(), "yuno_version"), l = jt(qe(), "yuno_release"), o = jt(qe(), "yuno_tag"), i =
|
|
2628
|
-
i && i.length || (i =
|
|
2628
|
+
let t = e.priv, n = Je(qe()), r = jt(qe(), "yuno_version"), l = jt(qe(), "yuno_release"), o = jt(qe(), "yuno_tag"), i = yt(e, "required_services");
|
|
2629
|
+
i && i.length || (i = yt(qe(), "required_services"));
|
|
2629
2630
|
let _ = {
|
|
2630
2631
|
yuno_role: ze(),
|
|
2631
2632
|
yuno_id: Qe(),
|
|
@@ -2646,7 +2647,7 @@
|
|
|
2646
2647
|
language: "undefined" != typeof window ? window.navigator.language : "",
|
|
2647
2648
|
required_services: i
|
|
2648
2649
|
};
|
|
2649
|
-
return Gr(e, _, kl, Wl(e, Xe(nt(e)), null)), Wr(e, _, "__identity__"),
|
|
2650
|
+
return Gr(e, _, kl, Wl(e, Xe(nt(e)), null)), Wr(e, _, "__identity__"), El(t.gobj_timer, vt(e, "timeout_idack")), Ml(e, "EV_IDENTITY_CARD", _);
|
|
2650
2651
|
}
|
|
2651
2652
|
function Kl(e, t) {
|
|
2652
2653
|
if (ir(t.event)) return -1;
|
|
@@ -2659,16 +2660,16 @@
|
|
|
2659
2660
|
return Ke(e) && (l.websocket = Ul(e)), 0;
|
|
2660
2661
|
}
|
|
2661
2662
|
function Bl(e, t, n, r) {
|
|
2662
|
-
return
|
|
2663
|
+
return En("Websocket opened: " + e.priv.url), xl(e), 0;
|
|
2663
2664
|
}
|
|
2664
2665
|
function Jl(e, t, n, r) {
|
|
2665
2666
|
let l = e.priv, o = n.url;
|
|
2666
|
-
return void 0 !== n.ws_seq && n.ws_seq !== l.ws_seq || (bn(),
|
|
2667
|
+
return void 0 !== n.ws_seq && n.ws_seq !== l.ws_seq || (bn(), yn(`${et(e)}: WebSocket closed ${o} (Code: ${n.code}, Reason: "${n.reason}", Clean: ${n.was_clean})`), l.websocket && (l.websocket.onopen = null, l.websocket.onmessage = null, l.websocket.onerror = null, l.websocket.onclose = null, l.websocket = null), l.inform_on_close ? (l.inform_on_close = !1, Xt(e, "EV_ON_CLOSE", {
|
|
2667
2668
|
url: o,
|
|
2668
2669
|
remote_yuno_name: l.remote_yuno_name,
|
|
2669
2670
|
remote_yuno_role: l.remote_yuno_role,
|
|
2670
2671
|
remote_yuno_service: l.remote_yuno_service
|
|
2671
|
-
})) : Ke(e) && (
|
|
2672
|
+
})) : Ke(e) && (yn(`${et(e)}: EV_ON_OPEN_ERROR cannot open ${o} (Code: ${n.code}, Reason: "${n.reason}", Clean: ${n.was_clean})`), Xt(e, "EV_ON_OPEN_ERROR", {
|
|
2672
2673
|
url: o,
|
|
2673
2674
|
remote_yuno_name: l.remote_yuno_name,
|
|
2674
2675
|
remote_yuno_role: l.remote_yuno_role,
|
|
@@ -2676,7 +2677,7 @@
|
|
|
2676
2677
|
code: n.code,
|
|
2677
2678
|
reason: n.reason,
|
|
2678
2679
|
was_clean: n.was_clean
|
|
2679
|
-
})), Ke(e) &&
|
|
2680
|
+
})), Ke(e) && El(l.gobj_timer, ql(e))), 0;
|
|
2680
2681
|
}
|
|
2681
2682
|
function ql(e) {
|
|
2682
2683
|
let t = e.priv, n = vt(e, "timeout_retry"), r = vt(e, "timeout_retry_max");
|
|
@@ -2692,7 +2693,7 @@
|
|
|
2692
2693
|
vl(l.gobj_timer);
|
|
2693
2694
|
let o = Mr(e, n, kl, !0), s = Tr(e, o, "src_yuno", ""), i = Tr(e, o, "src_role", ""), _ = Tr(e, o, "src_service", "");
|
|
2694
2695
|
$t(e, "remote_yuno_name", s), $t(e, "remote_yuno_role", i), $t(e, "remote_yuno_service", _);
|
|
2695
|
-
let a =
|
|
2696
|
+
let a = Er(e, n, "result", -1, 0), u = Tr(e, n, "comment", "", 0), c = Tr(e, n, "username", "", 0), f = Or(e, n, "services_roles", {});
|
|
2696
2697
|
if (a < 0) {
|
|
2697
2698
|
Fl(e);
|
|
2698
2699
|
let t = {
|
|
@@ -2730,21 +2731,21 @@
|
|
|
2730
2731
|
try {
|
|
2731
2732
|
n = JSON.parse(t);
|
|
2732
2733
|
} catch (t) {
|
|
2733
|
-
return
|
|
2734
|
+
return yn(`${et(e)}: parsing inter_event json: ${t}`), null;
|
|
2734
2735
|
}
|
|
2735
|
-
if (!(n instanceof Object)) return
|
|
2736
|
+
if (!(n instanceof Object)) return yn(`${et(e)}: parsing inter_event: websocket data not a json object`), null;
|
|
2736
2737
|
let r = n.event;
|
|
2737
|
-
if (!r) return
|
|
2738
|
-
if ("string" != typeof r) return
|
|
2738
|
+
if (!r) return yn(`${et(e)}: parsing inter_event: no event`), null;
|
|
2739
|
+
if ("string" != typeof r) return yn(`${et(e)}: parsing inter_event: event not a string`), null;
|
|
2739
2740
|
let l = n.kw;
|
|
2740
2741
|
return l ? l instanceof Object ? {
|
|
2741
2742
|
event: r,
|
|
2742
2743
|
kw: l || {}
|
|
2743
|
-
} : (
|
|
2744
|
+
} : (yn(`${et(e)}: parsing inter_event: kw not a json object`), null) : (yn(`${et(e)}: parsing inter_kw: no kw`), null);
|
|
2744
2745
|
}(e, n.data);
|
|
2745
|
-
if (!o) return
|
|
2746
|
+
if (!o) return yn(`${et(e)}: frame dropped from ${l}: ${String(n.data).substring(0, 256)}`), -1;
|
|
2746
2747
|
if (Cl(e)) {
|
|
2747
|
-
let e = Xe(qe()) + " <== " + l, t = n.data.length, r =
|
|
2748
|
+
let e = Xe(qe()) + " <== " + l, t = n.data.length, r = yt(qe(), "trace_ievent_callback");
|
|
2748
2749
|
r ? r(e, o, 2, t) : Vl(0, e, o);
|
|
2749
2750
|
}
|
|
2750
2751
|
let s = o.event, i = o.kw;
|
|
@@ -2758,12 +2759,12 @@
|
|
|
2758
2759
|
let _ = xr(e, i), a = Mr(e, i, kl), u = Tr(e, a, "dst_role", "");
|
|
2759
2760
|
if (u.toLowerCase() !== ze().toLowerCase()) return hn(`"It's not my role, dst_role: ${u}, my_role: ${ze()}`), 0;
|
|
2760
2761
|
let c = Tr(e, a, "dst_service", "");
|
|
2761
|
-
if ("__subscribing__" === _) return
|
|
2762
|
-
if ("__unsubscribing__" === _) return
|
|
2762
|
+
if ("__subscribing__" === _) return yn(`${et(e)}: subscription event ignored, I'm client (service: ${c}, event: ${s})`), -1;
|
|
2763
|
+
if ("__unsubscribing__" === _) return yn(`${et(e)}: unsubscription event ignored, I'm client (service: ${c}, event: ${s})`), -1;
|
|
2763
2764
|
if (It(e, s, $.EVF_PUBLIC_EVENT)) return Vt(e, s, i, e), 0;
|
|
2764
2765
|
if (!ir(c)) {
|
|
2765
2766
|
let t = we(c, !1);
|
|
2766
|
-
return t ? It(t, s, $.EVF_PUBLIC_EVENT) ? (Vt(t, s, i, e), 0) : (hn(`${et(e)}: Service found but no event or not public, service '${et(t)}', ev '${s}'`), -1) : (
|
|
2767
|
+
return t ? It(t, s, $.EVF_PUBLIC_EVENT) ? (Vt(t, s, i, e), 0) : (hn(`${et(e)}: Service found but no event or not public, service '${et(t)}', ev '${s}'`), -1) : (yn(`${et(e)}: event for a service that is gone, DROPPED: service '${c}', ev '${s}'`), 0);
|
|
2767
2768
|
}
|
|
2768
2769
|
return lt(e) ? Vt(nt(e), s, i, e) : Xt(e, s, i), 0;
|
|
2769
2770
|
}
|
|
@@ -2876,7 +2877,7 @@
|
|
|
2876
2877
|
else if (o.length > 0 && "<" === o[0] && function(e) {
|
|
2877
2878
|
if (Xr.size >= 100) return;
|
|
2878
2879
|
const t = e.slice(0, 80);
|
|
2879
|
-
Xr.has(t) || (Xr.add(t),
|
|
2880
|
+
Xr.has(t) || (Xr.add(t), yn(`createElement2: a string that starts with '<' is TEXT (set_strings_are_text): use html_markup() if it is markup: ${JSON.stringify(t)}`));
|
|
2880
2881
|
}(o), n && _) i.textContent = n(_) || o;
|
|
2881
2882
|
else i.textContent = o;
|
|
2882
2883
|
else if (er(o)) {
|
|
@@ -2896,20 +2897,20 @@
|
|
|
2896
2897
|
let o = Or(null, t, e, l);
|
|
2897
2898
|
Yn(n, e, o);
|
|
2898
2899
|
}), n;
|
|
2899
|
-
}, e.current_timestamp = el, e.data_type_t =
|
|
2900
|
+
}, e.current_timestamp = el, e.data_type_t = y, e.db_list_persistent_attrs = function(e, t) {
|
|
2900
2901
|
let n = kr(al(e), null, !1), r = {};
|
|
2901
2902
|
return n && Zn(n) && (r = $r(e, n, t, !1)), r;
|
|
2902
2903
|
}, e.db_load_persistent_attrs = function(e, t) {
|
|
2903
|
-
let n =
|
|
2904
|
+
let n = Et(e, E.SDF_PERSIST), r = kr(al(e), null, !1);
|
|
2904
2905
|
if (r && Zn(r)) {
|
|
2905
2906
|
let l = $r(e, r, t, !1);
|
|
2906
|
-
l = $r(e, l, n, !1), wt(e, l,
|
|
2907
|
+
l = $r(e, l, n, !1), wt(e, l, E.SDF_PERSIST);
|
|
2907
2908
|
}
|
|
2908
2909
|
}, e.db_remove_persistent_attrs = function(e, t) {
|
|
2909
2910
|
let n = Dr(e, kr(al(e), null, !1), t, !1);
|
|
2910
2911
|
0 === zn(n) ? Ir(al(e)) : Ar(al(e), n);
|
|
2911
2912
|
}, e.db_save_persistent_attrs = function(e, t) {
|
|
2912
|
-
let n = $r(e,
|
|
2913
|
+
let n = $r(e, Et(e, E.SDF_PERSIST), t, !1), r = kr(al(e), null, !1);
|
|
2913
2914
|
return r && Zn(r) && Wn(n, r), Ar(al(e), n);
|
|
2914
2915
|
}, e.debounce = function(e, t = 0, n = !1) {
|
|
2915
2916
|
let r = null, l = null, o = null;
|
|
@@ -2995,7 +2996,7 @@
|
|
|
2995
2996
|
return l;
|
|
2996
2997
|
}, e.flat_key_join = function(e) {
|
|
2997
2998
|
return Array.isArray(e) && 0 !== e.length ? e.map((e) => "number" == typeof e ? `[${e}]` : sl(e)).join("`") : "";
|
|
2998
|
-
}, e.flat_key_split = il, e.gclass_add_ev_action =
|
|
2999
|
+
}, e.flat_key_split = il, e.gclass_add_ev_action = ye, e.gclass_add_event_type = Te, e.gclass_add_state = he, e.gclass_check_fsm = je, e.gclass_create = de, e.gclass_event_type = ve, e.gclass_find_by_name = Oe, e.gclass_flag_t = w, e.gclass_unregister = be, e.getPositionRelativeToBody = function(e) {
|
|
2999
3000
|
if (!e) return {
|
|
3000
3001
|
top: 0,
|
|
3001
3002
|
left: 0,
|
|
@@ -3017,7 +3018,7 @@
|
|
|
3017
3018
|
}, e.get_function_name = rl, e.get_now = function() {
|
|
3018
3019
|
return Math.floor(Date.now() / 1e3);
|
|
3019
3020
|
}, e.gobj_bottom_gobj = st, e.gobj_change_parent = function(e, t) {
|
|
3020
|
-
return ot(e) ? (hn("gobj NULL or DESTROYED"), null) : t instanceof S ? (e.parent && e.parent.gclass.gmt.mt_child_removed && e.parent.gclass.gmt.mt_child_removed(e.parent, e), e.parent && ($e(e.parent, e), e.parent = null), Re(t, e), t.gclass.gmt.mt_child_added && (Y(e) &&
|
|
3021
|
+
return ot(e) ? (hn("gobj NULL or DESTROYED"), null) : t instanceof S ? (e.parent && e.parent.gclass.gmt.mt_child_removed && e.parent.gclass.gmt.mt_child_removed(e.parent, e), e.parent && ($e(e.parent, e), e.parent = null), Re(t, e), t.gclass.gmt.mt_child_added && (Y(e) && En(n("👦👦🔵 child_added(%s): %s", tt(t), et(e))), t.gclass.gmt.mt_child_added(t, e)), 0) : (hn(`${et(e)}: gobj_change_parent() BAD TYPE of parent`), -1);
|
|
3021
3022
|
}, e.gobj_change_state = Dt, e.gobj_command = function(e, t, r, o) {
|
|
3022
3023
|
if (ot(e)) return hn("gobj NULL or DESTROYED"), -1;
|
|
3023
3024
|
if (function(e) {
|
|
@@ -3088,7 +3089,7 @@
|
|
|
3088
3089
|
}(n, e), n;
|
|
3089
3090
|
}, e.gobj_match_gobj = bt, e.gobj_name = Xe, e.gobj_parent = nt, e.gobj_pause = xe, e.gobj_play = We, e.gobj_post_event = Ut, e.gobj_posted_events_size = function() {
|
|
3090
3091
|
return Lt.length;
|
|
3091
|
-
}, e.gobj_publish_event = Xt, e.gobj_read_attr =
|
|
3092
|
+
}, e.gobj_publish_event = Xt, e.gobj_read_attr = yt, e.gobj_read_attrs = Et, e.gobj_read_bool_attr = Tt, e.gobj_read_integer_attr = vt, e.gobj_read_pointer_attr = Ot, e.gobj_read_str_attr = jt, e.gobj_remove_persistent_attrs = function(e, t) {
|
|
3092
3093
|
return Be(e) ? a ? a(e, t) : -1 : (hn(`${et(e)}: Only gobj services can load/save writable-persistent`), -1);
|
|
3093
3094
|
}, e.gobj_repr_global_trace_levels = function() {
|
|
3094
3095
|
return U.map(([e, t, n]) => ({
|
|
@@ -3106,7 +3107,7 @@
|
|
|
3106
3107
|
o.name && (n && o.flag & n || (-1 === t || o.flag & t) && (ae(e, e.jn_attrs, o), Zn(e.priv) && Object.prototype.hasOwnProperty.call(e.priv, o.name) && (e.priv[o.name] = e.jn_attrs[o.name]), e.gclass.gmt.mt_writing && e.gclass.gmt.mt_writing(e, o.name)));
|
|
3107
3108
|
}
|
|
3108
3109
|
return 0;
|
|
3109
|
-
}(e,
|
|
3110
|
+
}(e, E.SDF_VOLATIL, 0);
|
|
3110
3111
|
}, e.gobj_save_persistent_attrs = De, e.gobj_search_path = mt, e.gobj_send_event = Vt, e.gobj_services = function() {
|
|
3111
3112
|
let e = [];
|
|
3112
3113
|
for (const t of Object.keys(b)) qn(e, t);
|
|
@@ -3132,7 +3133,7 @@
|
|
|
3132
3133
|
const d = [["EV_STATE_CHANGED", $.EVF_SYSTEM_EVENT | $.EVF_OUTPUT_EVENT | $.EVF_NO_WARN_SUBS], [0, 0]];
|
|
3133
3134
|
for (let e = 0; e < d.length; e++) {
|
|
3134
3135
|
let t = d[e][0], n = d[e][1];
|
|
3135
|
-
|
|
3136
|
+
Ee(g, t, n);
|
|
3136
3137
|
}
|
|
3137
3138
|
return 0;
|
|
3138
3139
|
}, e.gobj_stats = function(e, t, r, l) {
|
|
@@ -3160,7 +3161,7 @@
|
|
|
3160
3161
|
let n = s[t], r = Jt(e, n, !1, !1);
|
|
3161
3162
|
0 === r ? i++ : r < 0 ? _++ : a++;
|
|
3162
3163
|
}
|
|
3163
|
-
return _ ?
|
|
3164
|
+
return _ ? yn(`${et(e)}: Hard subscription not removed, only gobj_unsubscribe_list() with force removes it (event: ${t}, hard: ${_})`) : i || a || (yn(`${et(e)}: No subscription found`), Un(n, "No subscription found")), 0;
|
|
3164
3165
|
}, e.gobj_unsubscribe_list = Ht, e.gobj_walk_gobj_children = at, e.gobj_walk_gobj_children_tree = ut, e.gobj_write_attr = St, e.gobj_write_attrs = wt, e.gobj_write_bool_attr = Nt, e.gobj_write_integer_attr = Rt, e.gobj_write_str_attr = $t, e.gobj_yuno = qe, e.gobj_yuno_id = Qe, e.gobj_yuno_name = He, e.gobj_yuno_role = ze, e.html_markup = function(e) {
|
|
3165
3166
|
return "string" != typeof e ? (hn("html_markup: not a string, type " + typeof e), new qr("")) : new qr(e);
|
|
3166
3167
|
}, e.id_index_in_obj_list = Pr, e.index_in_list = tl, e.is_array = er, e.is_boolean = rr, e.is_date = function(e) {
|
|
@@ -3187,14 +3188,9 @@
|
|
|
3187
3188
|
if (!tr(n)) return hn(`jdb_delete: path must be a string: ${String(n)}`), null;
|
|
3188
3189
|
let o, s = n.split("`"), i = l;
|
|
3189
3190
|
for (; (o = s.shift()) && !ir(o) && i;) Zn(i) && (i = Or(null, i, e.hook, null, 0)), i = Yr(i, null, o, !1);
|
|
3190
|
-
if (0
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
} else {
|
|
3194
|
-
let t = Or(null, i, e.hook, null, 0), n = Pr(t, r.id);
|
|
3195
|
-
n >= 0 && t.splice(n, 1);
|
|
3196
|
-
}
|
|
3197
|
-
return l;
|
|
3191
|
+
if (!i || 0 !== s.length) return hn(`jdb_delete: path not found in topic '${t}': '${n}'`), null;
|
|
3192
|
+
let _ = er(i) ? i : Or(null, i, e.hook, null, 0), a = Pr(_, r.id);
|
|
3193
|
+
return a < 0 ? (hn(`jdb_delete: record not found in topic '${t}': '${n}' '${r.id}'`), null) : (_.splice(a, 1), l);
|
|
3198
3194
|
}, e.jdb_get = function(e, t, n, r) {
|
|
3199
3195
|
let l = Or(null, Or(null, e, "topics", null, 0), t, null, 0);
|
|
3200
3196
|
return l ? (void 0 === r && (r = !0), Yr(l, e.hook, n, r)) : (hn("jdb_get: topic not found: " + t), null);
|
|
@@ -3211,22 +3207,24 @@
|
|
|
3211
3207
|
Tr(null, e, "hook", "data", Zt.KW_CREATE);
|
|
3212
3208
|
let l = Or(null, e, "schema", {}, Zt.KW_CREATE), o = Or(null, e, "topics", {}, Zt.KW_CREATE);
|
|
3213
3209
|
return Kr(l, function(e, t, n, l) {
|
|
3214
|
-
"__"
|
|
3210
|
+
"__" === t.substring(0, 2) || Zn(n) || Or(null, o, l, Fn(r), Zt.KW_CREATE);
|
|
3215
3211
|
}, t), e;
|
|
3216
3212
|
}, e.jdb_update = function(e, t, n, r) {
|
|
3217
3213
|
let l = Or(null, Or(null, e, "topics", null, 0), t, null, 0);
|
|
3218
3214
|
if (!l) return hn("jdb_update: topic not found: " + t), null;
|
|
3219
3215
|
if (ir(r.id)) return hn("jdb_update: record without id: " + r), Tn(r), null;
|
|
3220
3216
|
if (!tr(n)) return hn(`jdb_update: path must be a string: ${String(n)}`), null;
|
|
3221
|
-
let o, s = n.split("`"),
|
|
3222
|
-
for (; (o =
|
|
3223
|
-
if (0
|
|
3224
|
-
|
|
3217
|
+
let o, s, i = n.split("`"), _ = l;
|
|
3218
|
+
for (; (o = i.shift()) && !ir(o) && _;) Zn(_) && (_ = Or(null, _, e.hook, null, 0)), _ = Yr(_, null, o, !1);
|
|
3219
|
+
if (!_ || 0 !== i.length) return hn(`jdb_update: path not found in topic '${t}': '${n}'`), null;
|
|
3220
|
+
if (er(_)) s = _;
|
|
3225
3221
|
else {
|
|
3226
|
-
|
|
3227
|
-
|
|
3222
|
+
if (_.id === r.id) return Gn(_, r), l;
|
|
3223
|
+
if (s = Or(null, _, e.hook, null, 0), null == s) s = [], Yn(_, e.hook, s);
|
|
3224
|
+
else if (!er(s)) return hn(`jdb_update: the hook '${e.hook}' of '${n}' is not a list in topic '${t}'`), null;
|
|
3228
3225
|
}
|
|
3229
|
-
|
|
3226
|
+
let a = Yr(s, e.hook, r.id, !1);
|
|
3227
|
+
return a ? Gn(a, r) : s.push(r), l;
|
|
3230
3228
|
}, e.json2flat = function(e) {
|
|
3231
3229
|
const t = {}, n = (e, r, l) => {
|
|
3232
3230
|
if (l > ll) throw new Error("json2flat: deeper than 256");
|
|
@@ -3278,7 +3276,7 @@
|
|
|
3278
3276
|
if (!n || !er(t)) return r && hn("item NULL or kw_list is not a list"), -1;
|
|
3279
3277
|
for (let e = 0; e < t.length; e++) if (Vn(n, t[e])) return e;
|
|
3280
3278
|
return r && hn("item not found in this list"), -1;
|
|
3281
|
-
}, e.kw_find_path = mr, e.kw_flag_t = Zt, e.kw_get_bool =
|
|
3279
|
+
}, e.kw_find_path = mr, e.kw_flag_t = Zt, e.kw_get_bool = yr, e.kw_get_dict = jr, e.kw_get_dict_value = Or, e.kw_get_int = Er, e.kw_get_list = function(e, t, n, r, l) {
|
|
3282
3280
|
e && !sr(e) && hn("GObj bad instanceof");
|
|
3283
3281
|
let o = mr(e, t, n, !1);
|
|
3284
3282
|
const s = l && l & Zt.KW_REQUIRED, i = l && l & Zt.KW_CREATE, _ = l && l & Zt.KW_EXTRACT;
|
|
@@ -3404,10 +3402,10 @@
|
|
|
3404
3402
|
else n && n(r.status);
|
|
3405
3403
|
var e;
|
|
3406
3404
|
}, r.send();
|
|
3407
|
-
}, e.log_debug =
|
|
3405
|
+
}, e.log_debug = En, e.log_error = hn, e.log_info = function(e, ...t) {
|
|
3408
3406
|
let n = mn(e, ...t), r = el();
|
|
3409
3407
|
rn && cn("info", n) && rn("%c" + r + " INFO: " + String(n), "color:cyan"), gn("info", n, r);
|
|
3410
|
-
}, e.log_warning =
|
|
3408
|
+
}, e.log_warning = yn, e.mask_secrets_inline = kn, e.msg_iev_get_msg_type = xr, e.msg_iev_get_stack = Mr, e.msg_iev_push_stack = Gr, e.msg_iev_read_key = Fr, e.msg_iev_set_msg_type = Wr, e.msg_iev_write_key = Vr, e.node_uuid = nl, e.parseBoolean = _r, e.parseSVG = function(e) {
|
|
3411
3409
|
return new DOMParser().parseFromString(e, "image/svg+xml").firstChild;
|
|
3412
3410
|
}, e.refresh_language = function(e, t) {
|
|
3413
3411
|
if (!or(t)) return void hn("You must supply a translation function");
|
|
@@ -3539,7 +3537,7 @@
|
|
|
3539
3537
|
["EV_TIMEOUT", $.EVF_OUTPUT_EVENT],
|
|
3540
3538
|
["EV_TIMEOUT_PERIODIC", $.EVF_OUTPUT_EVENT],
|
|
3541
3539
|
[0, 0]
|
|
3542
|
-
], t,
|
|
3540
|
+
], t, yl, 0, bl, pl, 0, 0, 0, w.gcflag_manual_start)) ? 0 : -1;
|
|
3543
3541
|
}("C_TIMER");
|
|
3544
3542
|
}, e.register_c_yuno = function() {
|
|
3545
3543
|
return function(e) {
|
|
@@ -3555,7 +3553,7 @@
|
|
|
3555
3553
|
if (!e) return "";
|
|
3556
3554
|
const t = String(e).trim();
|
|
3557
3555
|
return /^javascript:/i.test(t) || /^data:/i.test(t) ? "" : Jr(t);
|
|
3558
|
-
}, e.sdata_flag_t =
|
|
3556
|
+
}, e.sdata_flag_t = E, e.send_http_json_post = function(e, t, n) {
|
|
3559
3557
|
let r = new XMLHttpRequest();
|
|
3560
3558
|
r.open("POST", e), r.setRequestHeader("Accept", "application/json"), r.setRequestHeader("Content-Type", "application/json"), r.onreadystatechange = function() {
|
|
3561
3559
|
4 === r.readyState && n(r.status, r.responseText);
|
|
@@ -3579,7 +3577,7 @@
|
|
|
3579
3577
|
} else on = e;
|
|
3580
3578
|
}, e.set_remote_log_functions = bn, e.set_strings_are_text = function(e) {
|
|
3581
3579
|
Qr = !!e;
|
|
3582
|
-
}, e.set_timeout =
|
|
3580
|
+
}, e.set_timeout = El, e.set_timeout_periodic = Tl, e.sprintf = n, e.stats_parser = function(e, t, n, r) {}, e.str_in_list = Ur, e.strcasecmp = ur, e.strcmp = ar, e.strings_are_text = function() {
|
|
3583
3581
|
return Qr;
|
|
3584
3582
|
}, e.strncmp = function(e, t, n) {
|
|
3585
3583
|
var r = (e + "").substring(0, n), l = (t + "").substring(0, n);
|
|
@@ -3629,9 +3627,9 @@
|
|
|
3629
3627
|
}, e.timeTracker = function(e = "Time Tracker", t = !1) {
|
|
3630
3628
|
const n = e, r = performance.now();
|
|
3631
3629
|
let l = r;
|
|
3632
|
-
return t &&
|
|
3630
|
+
return t && yn(`--\x3e ${n} - starting`), { mark: (e = "Intermediate", o = "") => {
|
|
3633
3631
|
const s = performance.now(), i = (s - l) / 1e3, _ = (s - r) / 1e3;
|
|
3634
|
-
return t &&
|
|
3632
|
+
return t && yn(`--\x3e ${n} ${e} - partial: ${i} sec, total: ${_} sec, ${o}`), l = s, {
|
|
3635
3633
|
partial: i,
|
|
3636
3634
|
total: _
|
|
3637
3635
|
};
|