@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.iife.min.js
CHANGED
|
@@ -130,7 +130,7 @@ var gobjJs = function(e) {
|
|
|
130
130
|
data: l || []
|
|
131
131
|
};
|
|
132
132
|
}
|
|
133
|
-
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,
|
|
133
|
+
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({
|
|
134
134
|
DTP_STRING: 1,
|
|
135
135
|
DTP_BOOLEAN: 2,
|
|
136
136
|
DTP_INTEGER: 3,
|
|
@@ -140,8 +140,8 @@ var gobjJs = function(e) {
|
|
|
140
140
|
DTP_JSON: 7,
|
|
141
141
|
DTP_POINTER: 8
|
|
142
142
|
});
|
|
143
|
-
|
|
144
|
-
var
|
|
143
|
+
y.DTP_POINTER;
|
|
144
|
+
var E = Object.freeze({
|
|
145
145
|
SDF_NOTACCESS: 1,
|
|
146
146
|
SDF_RD: 2,
|
|
147
147
|
SDF_WR: 4,
|
|
@@ -164,7 +164,7 @@ var gobjJs = function(e) {
|
|
|
164
164
|
SDF_AUTHZ_S: 524288,
|
|
165
165
|
SDF_AUTHZ_RS: 1048576
|
|
166
166
|
});
|
|
167
|
-
|
|
167
|
+
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;
|
|
168
168
|
var T = class {
|
|
169
169
|
constructor(e, t, n = 0, r = null, l = "", o = null, s = null, i = 0, _ = null, a = null, u = null) {
|
|
170
170
|
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;
|
|
@@ -221,7 +221,7 @@ var gobjJs = function(e) {
|
|
|
221
221
|
};
|
|
222
222
|
var C = 1;
|
|
223
223
|
function L(e) {
|
|
224
|
-
Zn(e) && (e = JSON.stringify(e)),
|
|
224
|
+
Zn(e) && (e = JSON.stringify(e)), En(" ".repeat(Math.max(1, 2 * h)) + String(e));
|
|
225
225
|
}
|
|
226
226
|
var P = Object.freeze({
|
|
227
227
|
TRACE_MACHINE: 65536,
|
|
@@ -425,19 +425,19 @@ var gobjJs = function(e) {
|
|
|
425
425
|
function ae(e, t, n) {
|
|
426
426
|
let r, l = n.default_value;
|
|
427
427
|
switch (n.type) {
|
|
428
|
-
case
|
|
428
|
+
case y.DTP_STRING:
|
|
429
429
|
r = String(l);
|
|
430
430
|
break;
|
|
431
|
-
case
|
|
431
|
+
case y.DTP_BOOLEAN:
|
|
432
432
|
r = _r(l);
|
|
433
433
|
break;
|
|
434
|
-
case
|
|
434
|
+
case y.DTP_INTEGER:
|
|
435
435
|
r = parseInt(l), isNaN(r) && hn(`${et(e)}: attr NaN: ${n.name}`);
|
|
436
436
|
break;
|
|
437
|
-
case
|
|
437
|
+
case y.DTP_REAL:
|
|
438
438
|
r = Number(l), isNaN(r) && hn(`${et(e)}: attr NaN: ${n.name}`);
|
|
439
439
|
break;
|
|
440
|
-
case
|
|
440
|
+
case y.DTP_LIST:
|
|
441
441
|
if (tr(l)) try {
|
|
442
442
|
r = JSON.parse(l);
|
|
443
443
|
} catch (e) {
|
|
@@ -446,7 +446,7 @@ var gobjJs = function(e) {
|
|
|
446
446
|
else r = l;
|
|
447
447
|
er(r) || (r = []);
|
|
448
448
|
break;
|
|
449
|
-
case
|
|
449
|
+
case y.DTP_DICT:
|
|
450
450
|
if (tr(l)) try {
|
|
451
451
|
r = JSON.parse(l);
|
|
452
452
|
} catch (e) {
|
|
@@ -455,7 +455,7 @@ var gobjJs = function(e) {
|
|
|
455
455
|
else r = l;
|
|
456
456
|
Zn(r) || (r = {});
|
|
457
457
|
break;
|
|
458
|
-
case
|
|
458
|
+
case y.DTP_JSON:
|
|
459
459
|
if ("" === l || void 0 === l) r = null;
|
|
460
460
|
else if (tr(l)) try {
|
|
461
461
|
r = JSON.parse(l);
|
|
@@ -464,14 +464,14 @@ var gobjJs = function(e) {
|
|
|
464
464
|
}
|
|
465
465
|
else r = l;
|
|
466
466
|
break;
|
|
467
|
-
case
|
|
467
|
+
case y.DTP_POINTER: r = l;
|
|
468
468
|
}
|
|
469
469
|
return void 0 === r && (hn(`default_value WRONG, it: ${n.name}, value: ${n.default_value}`), r = null), t[n.name] = r, 0;
|
|
470
470
|
}
|
|
471
471
|
function ue(e, t, n, r) {
|
|
472
472
|
let l;
|
|
473
473
|
switch (n.type) {
|
|
474
|
-
case
|
|
474
|
+
case y.DTP_STRING:
|
|
475
475
|
if (null == r) l = "";
|
|
476
476
|
else if (tr(r)) l = String(r);
|
|
477
477
|
else {
|
|
@@ -479,16 +479,16 @@ var gobjJs = function(e) {
|
|
|
479
479
|
e && (l = String(e));
|
|
480
480
|
}
|
|
481
481
|
break;
|
|
482
|
-
case
|
|
482
|
+
case y.DTP_BOOLEAN:
|
|
483
483
|
l = _r(r);
|
|
484
484
|
break;
|
|
485
|
-
case
|
|
485
|
+
case y.DTP_INTEGER:
|
|
486
486
|
if (l = parseInt(r), isNaN(l)) return hn(`${et(e)}: attr NaN: ${n.name}`), -1;
|
|
487
487
|
break;
|
|
488
|
-
case
|
|
488
|
+
case y.DTP_REAL:
|
|
489
489
|
if (l = Number(r), isNaN(l)) return hn(`${et(e)}: attr NaN: ${n.name}`), -1;
|
|
490
490
|
break;
|
|
491
|
-
case
|
|
491
|
+
case y.DTP_LIST:
|
|
492
492
|
if (tr(r)) try {
|
|
493
493
|
l = JSON.parse(r);
|
|
494
494
|
} catch (e) {
|
|
@@ -497,7 +497,7 @@ var gobjJs = function(e) {
|
|
|
497
497
|
else l = r;
|
|
498
498
|
if (!er(l)) return hn(`attr must be an array: ${n.name}`), -1;
|
|
499
499
|
break;
|
|
500
|
-
case
|
|
500
|
+
case y.DTP_DICT:
|
|
501
501
|
if (tr(r)) try {
|
|
502
502
|
l = JSON.parse(r);
|
|
503
503
|
} catch (e) {
|
|
@@ -506,7 +506,7 @@ var gobjJs = function(e) {
|
|
|
506
506
|
else l = r;
|
|
507
507
|
if (!Zn(l)) return hn(`attr must be an object: ${n.name}`), -1;
|
|
508
508
|
break;
|
|
509
|
-
case
|
|
509
|
+
case y.DTP_JSON:
|
|
510
510
|
if (l = r, tr(r)) {
|
|
511
511
|
const e = r.trim();
|
|
512
512
|
if (e.startsWith("{") || e.startsWith("[")) try {
|
|
@@ -516,7 +516,7 @@ var gobjJs = function(e) {
|
|
|
516
516
|
}
|
|
517
517
|
}
|
|
518
518
|
break;
|
|
519
|
-
case
|
|
519
|
+
case y.DTP_POINTER: l = r;
|
|
520
520
|
}
|
|
521
521
|
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;
|
|
522
522
|
}
|
|
@@ -551,7 +551,7 @@ var gobjJs = function(e) {
|
|
|
551
551
|
const l = r.length;
|
|
552
552
|
for (let e = 0; e < l; e++) {
|
|
553
553
|
let n = r[e][0], l = r[e][1], o = r[e][2];
|
|
554
|
-
ir(n) ||
|
|
554
|
+
ir(n) || ye(c, t, n, l, o);
|
|
555
555
|
}
|
|
556
556
|
}
|
|
557
557
|
for (let e = 0; e < t.length; e++) {
|
|
@@ -596,17 +596,17 @@ var gobjJs = function(e) {
|
|
|
596
596
|
function he(e, t) {
|
|
597
597
|
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);
|
|
598
598
|
}
|
|
599
|
-
function
|
|
599
|
+
function ye(e, t, n, r, l) {
|
|
600
600
|
if (!(e instanceof O)) return hn("Cannot add state, typeof not GClass"), -1;
|
|
601
601
|
if (ir(t)) return hn("state_name EMPTY"), -1;
|
|
602
602
|
let o = pe(e, t);
|
|
603
603
|
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);
|
|
604
604
|
}
|
|
605
|
-
function
|
|
605
|
+
function Ee(e, t, n) {
|
|
606
606
|
ir(t) || e.push(new I(t, n));
|
|
607
607
|
}
|
|
608
608
|
function Te(e, t, n) {
|
|
609
|
-
return e instanceof O ?
|
|
609
|
+
return e instanceof O ? Ee(e.dl_events, t, n) : (hn("Cannot add state, typeof not GClass"), -1);
|
|
610
610
|
}
|
|
611
611
|
function ve(e, t) {
|
|
612
612
|
if (!(e instanceof O)) return hn("Cannot add state, typeof not GClass"), 0;
|
|
@@ -680,7 +680,7 @@ var gobjJs = function(e) {
|
|
|
680
680
|
let o = 0;
|
|
681
681
|
for (const [s, i] of Object.entries(t)) {
|
|
682
682
|
const t = ge(l.gclass, s, !1);
|
|
683
|
-
t ? (-1 === n || t.flag & n) && (t.flag &
|
|
683
|
+
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--);
|
|
684
684
|
}
|
|
685
685
|
return o;
|
|
686
686
|
})(ce(e), r, -1, e.gclass.gclass_flag & w.gcflag_ignore_unknown_attrs ? 0 : ke, e) < 0 && (hn(`${et(e)} json2data() FAILED`), Un(r));
|
|
@@ -694,7 +694,7 @@ var gobjJs = function(e) {
|
|
|
694
694
|
if (!("string" == typeof l || l instanceof S)) return hn(`BAD TYPE of parent: ${l}`), null;
|
|
695
695
|
if (tr(l)) {
|
|
696
696
|
const e = l;
|
|
697
|
-
if (!(l = we(e))) return
|
|
697
|
+
if (!(l = we(e))) return yn(`parent service not found: ${e}`), null;
|
|
698
698
|
}
|
|
699
699
|
}
|
|
700
700
|
if (o & N.gobj_flag_service && we(e, !1)) return hn(`service ALREADY registered: ${t}^${e}`), null;
|
|
@@ -757,7 +757,7 @@ var gobjJs = function(e) {
|
|
|
757
757
|
function Ve(e) {
|
|
758
758
|
if (ot(e)) return hn("gobj NULL or DESTROYED"), -1;
|
|
759
759
|
if (!e.running) return hn(`${et(e)}: GObj NOT RUNNING`), -1;
|
|
760
|
-
e.playing && (
|
|
760
|
+
e.playing && (yn(`${et(e)}: GObj stopping without previous pause`), xe(e)), J(e) && L(n("⏹ ⏹ stop: %s", tt(e))), e.running = !1;
|
|
761
761
|
let t = 0;
|
|
762
762
|
return e.gclass.gmt.mt_stop && (t = e.gclass.gmt.mt_stop(e)), t;
|
|
763
763
|
}
|
|
@@ -773,7 +773,7 @@ var gobjJs = function(e) {
|
|
|
773
773
|
if (e.disabled) return hn(`${et(e)}: GObj DISABLED`), -1;
|
|
774
774
|
if (!Ke(e)) {
|
|
775
775
|
if (e.gclass.gclass_flag & w.gcflag_required_start_to_play) return hn(`${et(e)}: Cannot play, start not done`), -1;
|
|
776
|
-
|
|
776
|
+
yn(`${et(e)}: GObj playing without previous start`), Pe(e);
|
|
777
777
|
}
|
|
778
778
|
J(e) && L(n("⏯ ⏯ play: %s", tt(e))), e.playing = !0;
|
|
779
779
|
let t = 0;
|
|
@@ -841,7 +841,7 @@ var gobjJs = function(e) {
|
|
|
841
841
|
}
|
|
842
842
|
function it(e, t) {
|
|
843
843
|
if (!sr(e)) return hn("gobj NULL of bad type"), null;
|
|
844
|
-
e.bottom_gobj && t &&
|
|
844
|
+
e.bottom_gobj && t && yn(`${et(e)}: bottom_gobj already set`), e.bottom_gobj = t;
|
|
845
845
|
}
|
|
846
846
|
function _t(e, t, n) {
|
|
847
847
|
return sr(e) ? t ? ge(e.gclass, t, n) : e.gclass.attrs_table : (hn("gobj NULL of bad type"), null);
|
|
@@ -937,7 +937,7 @@ var gobjJs = function(e) {
|
|
|
937
937
|
function ht(e, t) {
|
|
938
938
|
return !ir(t) && !!ge(e.gclass, t, !1);
|
|
939
939
|
}
|
|
940
|
-
function
|
|
940
|
+
function yt(e, t, n) {
|
|
941
941
|
let r = e.jn_attrs;
|
|
942
942
|
if (t in r && Object.prototype.hasOwnProperty.call(r, t)) {
|
|
943
943
|
let n = r[t];
|
|
@@ -945,7 +945,7 @@ var gobjJs = function(e) {
|
|
|
945
945
|
}
|
|
946
946
|
return hn(`${et(e)}: GClass Attribute NOT FOUND, attr ${t}`), null;
|
|
947
947
|
}
|
|
948
|
-
function
|
|
948
|
+
function Et(e, t, n) {
|
|
949
949
|
let r = {}, l = e.gclass.attrs_table;
|
|
950
950
|
for (let n = 0; n < l.length; n++) {
|
|
951
951
|
const o = l[n];
|
|
@@ -1132,16 +1132,16 @@ var gobjJs = function(e) {
|
|
|
1132
1132
|
return null;
|
|
1133
1133
|
}
|
|
1134
1134
|
var Wt = [
|
|
1135
|
-
j(
|
|
1136
|
-
j(
|
|
1137
|
-
j(
|
|
1138
|
-
j(
|
|
1139
|
-
j(
|
|
1140
|
-
j(
|
|
1141
|
-
j(
|
|
1142
|
-
j(
|
|
1143
|
-
j(
|
|
1144
|
-
j(
|
|
1135
|
+
j(y.DTP_POINTER, "publisher", 0, null, "publisher gobj"),
|
|
1136
|
+
j(y.DTP_POINTER, "subscriber", 0, null, "subscriber gobj"),
|
|
1137
|
+
j(y.DTP_STRING, "event", 0, "", "event name subscribed"),
|
|
1138
|
+
j(y.DTP_STRING, "renamed_event", 0, "", "rename event name"),
|
|
1139
|
+
j(y.DTP_INTEGER, "subs_flag", 0, 0, "subscription flag"),
|
|
1140
|
+
j(y.DTP_JSON, "__config__", 0, null, "subscription config"),
|
|
1141
|
+
j(y.DTP_JSON, "__global__", 0, null, "global kw, merge in publishing"),
|
|
1142
|
+
j(y.DTP_JSON, "__local__", 0, null, "local kw, remove in publishing"),
|
|
1143
|
+
j(y.DTP_JSON, "__filter__", 0, null, "filter kw, filter in publishing"),
|
|
1144
|
+
j(y.DTP_STRING, "__service__", 0, "", "subscription service"),
|
|
1145
1145
|
v()
|
|
1146
1146
|
];
|
|
1147
1147
|
function xt(e, t) {
|
|
@@ -1191,7 +1191,7 @@ var gobjJs = function(e) {
|
|
|
1191
1191
|
}
|
|
1192
1192
|
function Jt(e, t, r, l) {
|
|
1193
1193
|
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);
|
|
1194
|
-
if (!!(
|
|
1194
|
+
if (!!(Er(e, t, "subs_flag", null, Zt.KW_REQUIRED) & Gt.__hard_subscription__) && !r) return -1;
|
|
1195
1195
|
let _ = B(s) || B(o);
|
|
1196
1196
|
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;
|
|
1197
1197
|
_ && (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);
|
|
@@ -1213,11 +1213,11 @@ var gobjJs = function(e) {
|
|
|
1213
1213
|
}), ir(t)) t = "";
|
|
1214
1214
|
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;
|
|
1215
1215
|
let s = xt(r, t), i = Yt(e.dl_subscriptions, e, t, s.renamed_event, s.kw, l), _ = null;
|
|
1216
|
-
for (let t = 0; t < i.length; t++) if (
|
|
1216
|
+
for (let t = 0; t < i.length; t++) if (Er(e, i[t], "subs_flag", 0, Zt.KW_REQUIRED) & Gt.__hard_subscription__) {
|
|
1217
1217
|
_ = i[t];
|
|
1218
1218
|
break;
|
|
1219
1219
|
}
|
|
1220
|
-
if (_) return
|
|
1220
|
+
if (_) return yn(`${et(e)}: Hard subscription REPEATED, the one there is kept and returned (event: ${t}, subscriber: ${et(l)})`), _;
|
|
1221
1221
|
Qn(i) > 0 && (hn(`${et(e)}: ${Qn(i)} subscription(s) REPEATED, will be deleted and override`), vn(i, "subscription REPEATED"), Ht(e, i, !1));
|
|
1222
1222
|
let a = function(e, t, n, r) {
|
|
1223
1223
|
let l = _e(e, Wt);
|
|
@@ -1238,11 +1238,11 @@ var gobjJs = function(e) {
|
|
|
1238
1238
|
} else hn(`${et(e)}: EVENT NOT FOUND (__rename_event_name__: ${s})`);
|
|
1239
1239
|
}
|
|
1240
1240
|
if (gr(n, "__hard_subscription__")) {
|
|
1241
|
-
let t =
|
|
1241
|
+
let t = yr(e, n, "__hard_subscription__", !1);
|
|
1242
1242
|
Kn(n, "__hard_subscription__"), t && (o |= Gt.__hard_subscription__);
|
|
1243
1243
|
}
|
|
1244
1244
|
if (gr(n, "__own_event__")) {
|
|
1245
|
-
let t =
|
|
1245
|
+
let t = yr(e, n, "__own_event__", !1);
|
|
1246
1246
|
Kn(n, "__own_event__"), t && (o |= Gt.__own_event__);
|
|
1247
1247
|
}
|
|
1248
1248
|
}
|
|
@@ -1260,7 +1260,7 @@ var gobjJs = function(e) {
|
|
|
1260
1260
|
function Ht(e, t, n) {
|
|
1261
1261
|
let r = [...t], l = 0;
|
|
1262
1262
|
for (let t = 0; t < r.length; t++) Jt(e, r[t], n, !1) > 0 && l++;
|
|
1263
|
-
return l &&
|
|
1263
|
+
return l && yn(`${et(e)}: Subscription(s) already removed, nothing to remove (count: ${l})`), 0;
|
|
1264
1264
|
}
|
|
1265
1265
|
function zt(e, t, n, r) {
|
|
1266
1266
|
return null == n && (n = {}), Yt(e.dl_subscriptions, e, t, null, n, r);
|
|
@@ -1288,7 +1288,7 @@ var gobjJs = function(e) {
|
|
|
1288
1288
|
}
|
|
1289
1289
|
let u = vr(e, a, "subscriber", null, Zt.KW_REQUIRED);
|
|
1290
1290
|
if (!u || ot(u)) continue;
|
|
1291
|
-
let c =
|
|
1291
|
+
let c = Er(e, a, "subs_flag", 0, Zt.KW_REQUIRED), f = Tr(e, a, "event", "", Zt.KW_REQUIRED);
|
|
1292
1292
|
if (ir(f) || 0 === ur(f, t)) {
|
|
1293
1293
|
jr(e, a, "__config__", null, 0);
|
|
1294
1294
|
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;
|
|
@@ -1308,7 +1308,7 @@ var gobjJs = function(e) {
|
|
|
1308
1308
|
if (_ += m, i++, ot(e)) break;
|
|
1309
1309
|
}
|
|
1310
1310
|
}
|
|
1311
|
-
return i || l && l.event_flag & $.EVF_NO_WARN_SUBS ||
|
|
1311
|
+
return i || l && l.event_flag & $.EVF_NO_WARN_SUBS || yn(`${et(e)}: Publish event WITHOUT subscribers, ev ${t}`), _;
|
|
1312
1312
|
}
|
|
1313
1313
|
var Zt = Object.freeze({
|
|
1314
1314
|
KW_REQUIRED: 1,
|
|
@@ -1405,11 +1405,11 @@ var gobjJs = function(e) {
|
|
|
1405
1405
|
let n = mn(e, ...t), r = el();
|
|
1406
1406
|
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);
|
|
1407
1407
|
}
|
|
1408
|
-
function
|
|
1408
|
+
function yn(e, ...t) {
|
|
1409
1409
|
let n = mn(e, ...t), r = el();
|
|
1410
1410
|
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);
|
|
1411
1411
|
}
|
|
1412
|
-
function
|
|
1412
|
+
function En(e, ...t) {
|
|
1413
1413
|
let n = mn(e, ...t), r = el();
|
|
1414
1414
|
ln && cn("debug", n) && ln("%c" + r + " DEBUG: " + String(n), "color:silver"), gn("debug", n, r);
|
|
1415
1415
|
}
|
|
@@ -1764,7 +1764,7 @@ var gobjJs = function(e) {
|
|
|
1764
1764
|
else if (s = mr(e, t, l, !0), void 0 === s) return -1;
|
|
1765
1765
|
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);
|
|
1766
1766
|
}
|
|
1767
|
-
function
|
|
1767
|
+
function yr(e, t, n, r, l) {
|
|
1768
1768
|
e && !sr(e) && hn("GObj bad instanceof");
|
|
1769
1769
|
let o = mr(e, t, n, !1);
|
|
1770
1770
|
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;
|
|
@@ -1785,7 +1785,7 @@ var gobjJs = function(e) {
|
|
|
1785
1785
|
}
|
|
1786
1786
|
return _ && hr(e, t, n), u;
|
|
1787
1787
|
}
|
|
1788
|
-
function
|
|
1788
|
+
function Er(e, t, n, r, l) {
|
|
1789
1789
|
e && !sr(e) && hn("GObj bad instanceof");
|
|
1790
1790
|
let o = mr(e, t, n, !1);
|
|
1791
1791
|
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;
|
|
@@ -1862,6 +1862,7 @@ var gobjJs = function(e) {
|
|
|
1862
1862
|
function Sr(e, t, n, r) {
|
|
1863
1863
|
if (e && !sr(e) && hn("GObj bad instanceof"), !Zn(t)) return hn("kw is not an object"), -1;
|
|
1864
1864
|
if (!tr(n)) return hn(`${e ? et(e) + ": " : ""}kw_set_dict_value(): path must be a string: ${String(n)}`), -1;
|
|
1865
|
+
if ("" === n) return hn((e ? et(e) + ": " : "") + "kw_set_dict_value(): path empty"), -1;
|
|
1865
1866
|
let l = n.split("`"), o = l.length;
|
|
1866
1867
|
for (let s = 0; s < o; s++) {
|
|
1867
1868
|
let i = l[s];
|
|
@@ -2336,9 +2337,9 @@ var gobjJs = function(e) {
|
|
|
2336
2337
|
return t.is_file && (t.type = "file"), t;
|
|
2337
2338
|
}
|
|
2338
2339
|
var bl = [
|
|
2339
|
-
j(
|
|
2340
|
-
j(
|
|
2341
|
-
j(
|
|
2340
|
+
j(y.DTP_POINTER, "subscriber", 0, null, "Subscriber of output events"),
|
|
2341
|
+
j(y.DTP_BOOLEAN, "periodic", 0, 0, "True for periodic timeouts"),
|
|
2342
|
+
j(y.DTP_INTEGER, "msec", 0, 0, "Timeout in milliseconds"),
|
|
2342
2343
|
v()
|
|
2343
2344
|
], pl = {
|
|
2344
2345
|
periodic: !1,
|
|
@@ -2351,7 +2352,7 @@ var gobjJs = function(e) {
|
|
|
2351
2352
|
Vt(e, "EV_TIMEOUT", {}, e);
|
|
2352
2353
|
}, 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;
|
|
2353
2354
|
}
|
|
2354
|
-
var
|
|
2355
|
+
var yl = {
|
|
2355
2356
|
mt_create: function(e) {
|
|
2356
2357
|
let t = e.priv;
|
|
2357
2358
|
const n = Ot(e, "subscriber");
|
|
@@ -2376,7 +2377,7 @@ var gobjJs = function(e) {
|
|
|
2376
2377
|
},
|
|
2377
2378
|
mt_destroy: function(e) {}
|
|
2378
2379
|
};
|
|
2379
|
-
function
|
|
2380
|
+
function El(e, t) {
|
|
2380
2381
|
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);
|
|
2381
2382
|
}
|
|
2382
2383
|
function Tl(e, t) {
|
|
@@ -2386,28 +2387,28 @@ var gobjJs = function(e) {
|
|
|
2386
2387
|
return e instanceof S ? "C_TIMER" !== Ze(e) ? (hn("not C_TIMER GObj"), -1) : void Rt(e, "msec", -1) : (hn("not GObj TYPE"), -1);
|
|
2387
2388
|
}
|
|
2388
2389
|
var jl = [
|
|
2389
|
-
j(
|
|
2390
|
-
j(
|
|
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(
|
|
2390
|
+
j(y.DTP_BOOLEAN, "changesLost", 0, !1, "Set true to warn about leaving page"),
|
|
2391
|
+
j(y.DTP_BOOLEAN, "browser_beforeunload", 0, !1, "Set true to refreshing browser"),
|
|
2392
|
+
j(y.DTP_STRING, "__username__", 0, "", "Username"),
|
|
2393
|
+
j(y.DTP_STRING, "start_date", 0, "", "Yuno starting date"),
|
|
2394
|
+
j(y.DTP_STRING, "node_uuid", 0, "", "uuid of node"),
|
|
2395
|
+
j(y.DTP_STRING, "yuno_role", 0, "", "Yuno role"),
|
|
2396
|
+
j(y.DTP_STRING, "yuno_id", 0, "", "Yuno Id. Set by agent"),
|
|
2397
|
+
j(y.DTP_STRING, "yuno_name", 0, "", "Yuno name. Set by agent"),
|
|
2398
|
+
j(y.DTP_STRING, "yuno_tag", 0, "", "Tags of yuno. Set by agent"),
|
|
2399
|
+
j(y.DTP_STRING, "yuno_release", 0, "", "Yuno Release. Set by agent"),
|
|
2400
|
+
j(y.DTP_STRING, "yuno_version", 0, "", "Yuno version (APP_VERSION)"),
|
|
2401
|
+
j(y.DTP_STRING, "yuneta_version", 0, s, "Yuneta version"),
|
|
2402
|
+
j(y.DTP_LIST, "required_services", 0, "[]", "Required services"),
|
|
2403
|
+
j(y.DTP_DICT, "trace_levels", E.SDF_PERSIST, "{}", "Trace levels"),
|
|
2404
|
+
j(y.DTP_DICT, "no_trace_levels", E.SDF_PERSIST, "{}", "No trace levels"),
|
|
2405
|
+
j(y.DTP_POINTER, "trace_ievent_callback", 0, null, "Where the traffic trace goes (C_IEVENT_CLI levels ievents/ievents2); console when null"),
|
|
2406
|
+
j(y.DTP_BOOLEAN, "developer", 0, !1, "Developer mode enabled"),
|
|
2407
|
+
j(y.DTP_INTEGER, "periodic_timeout", 0, "1000", "Timeout periodic, in miliseconds."),
|
|
2407
2408
|
v()
|
|
2408
2409
|
], Ol = { gobj_timer: null }, Sl = null;
|
|
2409
2410
|
function wl(e, t, n, r) {
|
|
2410
|
-
let l =
|
|
2411
|
+
let l = yt(e, t);
|
|
2411
2412
|
return Zn(l) || (l = {}), l[n] = r, St(e, t, l), De(e, t);
|
|
2412
2413
|
}
|
|
2413
2414
|
function Nl(e) {
|
|
@@ -2424,8 +2425,8 @@ var gobjJs = function(e) {
|
|
|
2424
2425
|
var Dl = {
|
|
2425
2426
|
mt_create: function(e) {
|
|
2426
2427
|
let t = e.priv;
|
|
2427
|
-
$t(e, "start_date", el()), $t(e, "node_uuid", nl()), e.priv.gobj_timer = Ce(Xe(e), "C_TIMER", {}, e), t.periodic_timeout =
|
|
2428
|
-
let t =
|
|
2428
|
+
$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) {
|
|
2429
|
+
let t = yt(e, "trace_levels");
|
|
2429
2430
|
if (!Zn(t)) return 0;
|
|
2430
2431
|
let n = t.__global_trace__;
|
|
2431
2432
|
if (er(n)) {
|
|
@@ -2440,7 +2441,7 @@ var gobjJs = function(e) {
|
|
|
2440
2441
|
} else hn(`${Xe(e)}: trace_levels of ${n} MUST be a list`);
|
|
2441
2442
|
}
|
|
2442
2443
|
}(e), function(e) {
|
|
2443
|
-
let t =
|
|
2444
|
+
let t = yt(e, "no_trace_levels");
|
|
2444
2445
|
if (!Zn(t)) return 0;
|
|
2445
2446
|
let n = t.__global_no_trace__;
|
|
2446
2447
|
if (er(n)) {
|
|
@@ -2496,21 +2497,21 @@ var gobjJs = function(e) {
|
|
|
2496
2497
|
}
|
|
2497
2498
|
};
|
|
2498
2499
|
var kl = "ievent_gate_stack", Al = [
|
|
2499
|
-
j(
|
|
2500
|
-
j(
|
|
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(
|
|
2500
|
+
j(y.DTP_STRING, "wanted_yuno_role", E.SDF_RD, "", "wanted yuno role"),
|
|
2501
|
+
j(y.DTP_STRING, "wanted_yuno_name", E.SDF_RD, "", "wanted yuno name"),
|
|
2502
|
+
j(y.DTP_STRING, "wanted_yuno_service", E.SDF_RD, "", "wanted yuno service"),
|
|
2503
|
+
j(y.DTP_STRING, "remote_yuno_role", E.SDF_RD, "", "confirmed remote yuno role"),
|
|
2504
|
+
j(y.DTP_STRING, "remote_yuno_name", E.SDF_RD, "", "confirmed remote yuno name"),
|
|
2505
|
+
j(y.DTP_STRING, "remote_yuno_service", E.SDF_RD, "", "confirmed remote yuno service"),
|
|
2506
|
+
j(y.DTP_STRING, "url", E.SDF_RD, "", "Url to connect"),
|
|
2507
|
+
j(y.DTP_STRING, "jwt", E.SDF_PERSIST, "", "JWT"),
|
|
2508
|
+
j(y.DTP_STRING, "cert_pem", E.SDF_PERSIST, "", "SSL server certification, PEM str format"),
|
|
2509
|
+
j(y.DTP_JSON, "extra_info", E.SDF_RD, "{}", "dict data set by user, added to the identity card msg."),
|
|
2510
|
+
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."),
|
|
2511
|
+
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"),
|
|
2512
|
+
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"),
|
|
2513
|
+
j(y.DTP_INTEGER, "timeout_idack", E.SDF_RD, "5000", "timeout waiting idAck"),
|
|
2514
|
+
j(y.DTP_POINTER, "subscriber", 0, 0, "subscriber of output-events. If null then subscriber is the parent"),
|
|
2514
2515
|
v()
|
|
2515
2516
|
], Il = [
|
|
2516
2517
|
["ievents", "Trace inter-events with metadata of kw"],
|
|
@@ -2534,7 +2535,7 @@ var gobjJs = function(e) {
|
|
|
2534
2535
|
function Ul(e) {
|
|
2535
2536
|
e.priv.websocket && hn("Websocket ALREADY setup");
|
|
2536
2537
|
const t = jt(e, "url");
|
|
2537
|
-
|
|
2538
|
+
En(`====> Starting WebSocket to '${t}' (${et(e)})`);
|
|
2538
2539
|
const n = ++e.priv.ws_seq;
|
|
2539
2540
|
let r;
|
|
2540
2541
|
try {
|
|
@@ -2546,7 +2547,7 @@ var gobjJs = function(e) {
|
|
|
2546
2547
|
code: 1006,
|
|
2547
2548
|
reason: r.message,
|
|
2548
2549
|
was_clean: !1
|
|
2549
|
-
}, e) < 0 &&
|
|
2550
|
+
}, e) < 0 && El(e.priv.gobj_timer, ql(e)), null;
|
|
2550
2551
|
}
|
|
2551
2552
|
return r ? (r.onopen = () => {
|
|
2552
2553
|
n !== e.priv.ws_seq || ot(e) || Vt(e, "EV_ON_OPEN", {
|
|
@@ -2559,7 +2560,7 @@ var gobjJs = function(e) {
|
|
|
2559
2560
|
data: r.data
|
|
2560
2561
|
}, e);
|
|
2561
2562
|
}, r.onclose = (r) => {
|
|
2562
|
-
ot(e) || n === e.priv.ws_seq && (Tt(qe(), "browser_beforeunload") ?
|
|
2563
|
+
ot(e) || n === e.priv.ws_seq && (Tt(qe(), "browser_beforeunload") ? yn("Close websocket by unload page") : Vt(e, "EV_ON_CLOSE", {
|
|
2563
2564
|
url: t,
|
|
2564
2565
|
ws_seq: n,
|
|
2565
2566
|
code: r.code,
|
|
@@ -2571,20 +2572,20 @@ var gobjJs = function(e) {
|
|
|
2571
2572
|
function Fl(e, t = 1e3, n = "") {
|
|
2572
2573
|
let r = e.priv, l = r.websocket;
|
|
2573
2574
|
if (r.websocket = null, l && l.readyState !== WebSocket.CLOSED && l.readyState !== WebSocket.CLOSING) {
|
|
2574
|
-
|
|
2575
|
+
En(`Closing WebSocket (Code: ${t}, Reason: "${n}")`);
|
|
2575
2576
|
try {
|
|
2576
2577
|
l.close(t, n);
|
|
2577
2578
|
} catch (t) {
|
|
2578
2579
|
hn(`${et(e)}: Error closing WebSocket: ${t.message}`);
|
|
2579
2580
|
}
|
|
2580
|
-
} else
|
|
2581
|
+
} else yn("WebSocket is already closed or in the process of closing.");
|
|
2581
2582
|
}
|
|
2582
2583
|
function Vl(e, t, n) {
|
|
2583
2584
|
let r = el();
|
|
2584
2585
|
try {
|
|
2585
|
-
|
|
2586
|
+
En("\n" + r + " " + t + "\n"), Un(n);
|
|
2586
2587
|
} catch (e) {
|
|
2587
|
-
|
|
2588
|
+
En("ERROR in trace_inter_event: " + e);
|
|
2588
2589
|
}
|
|
2589
2590
|
}
|
|
2590
2591
|
var Gl = class {
|
|
@@ -2596,10 +2597,10 @@ var gobjJs = function(e) {
|
|
|
2596
2597
|
return function(e, t) {
|
|
2597
2598
|
let n = e.priv, r = JSON.stringify(t);
|
|
2598
2599
|
if (Cl(e)) {
|
|
2599
|
-
let n = jt(e, "url"), l = Xe(qe()) + " ==> " + n, o =
|
|
2600
|
+
let n = jt(e, "url"), l = Xe(qe()) + " ==> " + n, o = yt(qe(), "trace_ievent_callback");
|
|
2600
2601
|
o ? o(l, t, 1, r.length) : Vl(0, l, t);
|
|
2601
2602
|
}
|
|
2602
|
-
if (!n.websocket || n.websocket.readyState !== WebSocket.OPEN) return
|
|
2603
|
+
if (!n.websocket || n.websocket.readyState !== WebSocket.OPEN) return yn(`${et(e)}: send_iev(): websocket not open, message lost`), -1;
|
|
2603
2604
|
try {
|
|
2604
2605
|
n.websocket.send(r);
|
|
2605
2606
|
} catch (t) {
|
|
@@ -2622,8 +2623,8 @@ var gobjJs = function(e) {
|
|
|
2622
2623
|
};
|
|
2623
2624
|
}
|
|
2624
2625
|
function xl(e) {
|
|
2625
|
-
let t = e.priv, n = Je(qe()), r = jt(qe(), "yuno_version"), l = jt(qe(), "yuno_release"), o = jt(qe(), "yuno_tag"), i =
|
|
2626
|
-
i && i.length || (i =
|
|
2626
|
+
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");
|
|
2627
|
+
i && i.length || (i = yt(qe(), "required_services"));
|
|
2627
2628
|
let _ = {
|
|
2628
2629
|
yuno_role: ze(),
|
|
2629
2630
|
yuno_id: Qe(),
|
|
@@ -2644,7 +2645,7 @@ var gobjJs = function(e) {
|
|
|
2644
2645
|
language: "undefined" != typeof window ? window.navigator.language : "",
|
|
2645
2646
|
required_services: i
|
|
2646
2647
|
};
|
|
2647
|
-
return Gr(e, _, kl, Wl(e, Xe(nt(e)), null)), Wr(e, _, "__identity__"),
|
|
2648
|
+
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", _);
|
|
2648
2649
|
}
|
|
2649
2650
|
function Kl(e, t) {
|
|
2650
2651
|
if (ir(t.event)) return -1;
|
|
@@ -2657,16 +2658,16 @@ var gobjJs = function(e) {
|
|
|
2657
2658
|
return Ke(e) && (l.websocket = Ul(e)), 0;
|
|
2658
2659
|
}
|
|
2659
2660
|
function Bl(e, t, n, r) {
|
|
2660
|
-
return
|
|
2661
|
+
return En("Websocket opened: " + e.priv.url), xl(e), 0;
|
|
2661
2662
|
}
|
|
2662
2663
|
function Jl(e, t, n, r) {
|
|
2663
2664
|
let l = e.priv, o = n.url;
|
|
2664
|
-
return void 0 !== n.ws_seq && n.ws_seq !== l.ws_seq || (bn(),
|
|
2665
|
+
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", {
|
|
2665
2666
|
url: o,
|
|
2666
2667
|
remote_yuno_name: l.remote_yuno_name,
|
|
2667
2668
|
remote_yuno_role: l.remote_yuno_role,
|
|
2668
2669
|
remote_yuno_service: l.remote_yuno_service
|
|
2669
|
-
})) : Ke(e) && (
|
|
2670
|
+
})) : 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", {
|
|
2670
2671
|
url: o,
|
|
2671
2672
|
remote_yuno_name: l.remote_yuno_name,
|
|
2672
2673
|
remote_yuno_role: l.remote_yuno_role,
|
|
@@ -2674,7 +2675,7 @@ var gobjJs = function(e) {
|
|
|
2674
2675
|
code: n.code,
|
|
2675
2676
|
reason: n.reason,
|
|
2676
2677
|
was_clean: n.was_clean
|
|
2677
|
-
})), Ke(e) &&
|
|
2678
|
+
})), Ke(e) && El(l.gobj_timer, ql(e))), 0;
|
|
2678
2679
|
}
|
|
2679
2680
|
function ql(e) {
|
|
2680
2681
|
let t = e.priv, n = vt(e, "timeout_retry"), r = vt(e, "timeout_retry_max");
|
|
@@ -2690,7 +2691,7 @@ var gobjJs = function(e) {
|
|
|
2690
2691
|
vl(l.gobj_timer);
|
|
2691
2692
|
let o = Mr(e, n, kl, !0), s = Tr(e, o, "src_yuno", ""), i = Tr(e, o, "src_role", ""), _ = Tr(e, o, "src_service", "");
|
|
2692
2693
|
$t(e, "remote_yuno_name", s), $t(e, "remote_yuno_role", i), $t(e, "remote_yuno_service", _);
|
|
2693
|
-
let a =
|
|
2694
|
+
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", {});
|
|
2694
2695
|
if (a < 0) {
|
|
2695
2696
|
Fl(e);
|
|
2696
2697
|
let t = {
|
|
@@ -2728,21 +2729,21 @@ var gobjJs = function(e) {
|
|
|
2728
2729
|
try {
|
|
2729
2730
|
n = JSON.parse(t);
|
|
2730
2731
|
} catch (t) {
|
|
2731
|
-
return
|
|
2732
|
+
return yn(`${et(e)}: parsing inter_event json: ${t}`), null;
|
|
2732
2733
|
}
|
|
2733
|
-
if (!(n instanceof Object)) return
|
|
2734
|
+
if (!(n instanceof Object)) return yn(`${et(e)}: parsing inter_event: websocket data not a json object`), null;
|
|
2734
2735
|
let r = n.event;
|
|
2735
|
-
if (!r) return
|
|
2736
|
-
if ("string" != typeof r) return
|
|
2736
|
+
if (!r) return yn(`${et(e)}: parsing inter_event: no event`), null;
|
|
2737
|
+
if ("string" != typeof r) return yn(`${et(e)}: parsing inter_event: event not a string`), null;
|
|
2737
2738
|
let l = n.kw;
|
|
2738
2739
|
return l ? l instanceof Object ? {
|
|
2739
2740
|
event: r,
|
|
2740
2741
|
kw: l || {}
|
|
2741
|
-
} : (
|
|
2742
|
+
} : (yn(`${et(e)}: parsing inter_event: kw not a json object`), null) : (yn(`${et(e)}: parsing inter_kw: no kw`), null);
|
|
2742
2743
|
}(e, n.data);
|
|
2743
|
-
if (!o) return
|
|
2744
|
+
if (!o) return yn(`${et(e)}: frame dropped from ${l}: ${String(n.data).substring(0, 256)}`), -1;
|
|
2744
2745
|
if (Cl(e)) {
|
|
2745
|
-
let e = Xe(qe()) + " <== " + l, t = n.data.length, r =
|
|
2746
|
+
let e = Xe(qe()) + " <== " + l, t = n.data.length, r = yt(qe(), "trace_ievent_callback");
|
|
2746
2747
|
r ? r(e, o, 2, t) : Vl(0, e, o);
|
|
2747
2748
|
}
|
|
2748
2749
|
let s = o.event, i = o.kw;
|
|
@@ -2756,12 +2757,12 @@ var gobjJs = function(e) {
|
|
|
2756
2757
|
let _ = xr(e, i), a = Mr(e, i, kl), u = Tr(e, a, "dst_role", "");
|
|
2757
2758
|
if (u.toLowerCase() !== ze().toLowerCase()) return hn(`"It's not my role, dst_role: ${u}, my_role: ${ze()}`), 0;
|
|
2758
2759
|
let c = Tr(e, a, "dst_service", "");
|
|
2759
|
-
if ("__subscribing__" === _) return
|
|
2760
|
-
if ("__unsubscribing__" === _) return
|
|
2760
|
+
if ("__subscribing__" === _) return yn(`${et(e)}: subscription event ignored, I'm client (service: ${c}, event: ${s})`), -1;
|
|
2761
|
+
if ("__unsubscribing__" === _) return yn(`${et(e)}: unsubscription event ignored, I'm client (service: ${c}, event: ${s})`), -1;
|
|
2761
2762
|
if (It(e, s, $.EVF_PUBLIC_EVENT)) return Vt(e, s, i, e), 0;
|
|
2762
2763
|
if (!ir(c)) {
|
|
2763
2764
|
let t = we(c, !1);
|
|
2764
|
-
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) : (
|
|
2765
|
+
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);
|
|
2765
2766
|
}
|
|
2766
2767
|
return lt(e) ? Vt(nt(e), s, i, e) : Xt(e, s, i), 0;
|
|
2767
2768
|
}
|
|
@@ -2874,7 +2875,7 @@ var gobjJs = function(e) {
|
|
|
2874
2875
|
else if (o.length > 0 && "<" === o[0] && function(e) {
|
|
2875
2876
|
if (Xr.size >= 100) return;
|
|
2876
2877
|
const t = e.slice(0, 80);
|
|
2877
|
-
Xr.has(t) || (Xr.add(t),
|
|
2878
|
+
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)}`));
|
|
2878
2879
|
}(o), n && _) i.textContent = n(_) || o;
|
|
2879
2880
|
else i.textContent = o;
|
|
2880
2881
|
else if (er(o)) {
|
|
@@ -2894,20 +2895,20 @@ var gobjJs = function(e) {
|
|
|
2894
2895
|
let o = Or(null, t, e, l);
|
|
2895
2896
|
Yn(n, e, o);
|
|
2896
2897
|
}), n;
|
|
2897
|
-
}, e.current_timestamp = el, e.data_type_t =
|
|
2898
|
+
}, e.current_timestamp = el, e.data_type_t = y, e.db_list_persistent_attrs = function(e, t) {
|
|
2898
2899
|
let n = kr(al(e), null, !1), r = {};
|
|
2899
2900
|
return n && Zn(n) && (r = $r(e, n, t, !1)), r;
|
|
2900
2901
|
}, e.db_load_persistent_attrs = function(e, t) {
|
|
2901
|
-
let n =
|
|
2902
|
+
let n = Et(e, E.SDF_PERSIST), r = kr(al(e), null, !1);
|
|
2902
2903
|
if (r && Zn(r)) {
|
|
2903
2904
|
let l = $r(e, r, t, !1);
|
|
2904
|
-
l = $r(e, l, n, !1), wt(e, l,
|
|
2905
|
+
l = $r(e, l, n, !1), wt(e, l, E.SDF_PERSIST);
|
|
2905
2906
|
}
|
|
2906
2907
|
}, e.db_remove_persistent_attrs = function(e, t) {
|
|
2907
2908
|
let n = Dr(e, kr(al(e), null, !1), t, !1);
|
|
2908
2909
|
0 === zn(n) ? Ir(al(e)) : Ar(al(e), n);
|
|
2909
2910
|
}, e.db_save_persistent_attrs = function(e, t) {
|
|
2910
|
-
let n = $r(e,
|
|
2911
|
+
let n = $r(e, Et(e, E.SDF_PERSIST), t, !1), r = kr(al(e), null, !1);
|
|
2911
2912
|
return r && Zn(r) && Wn(n, r), Ar(al(e), n);
|
|
2912
2913
|
}, e.debounce = function(e, t = 0, n = !1) {
|
|
2913
2914
|
let r = null, l = null, o = null;
|
|
@@ -2993,7 +2994,7 @@ var gobjJs = function(e) {
|
|
|
2993
2994
|
return l;
|
|
2994
2995
|
}, e.flat_key_join = function(e) {
|
|
2995
2996
|
return Array.isArray(e) && 0 !== e.length ? e.map((e) => "number" == typeof e ? `[${e}]` : sl(e)).join("`") : "";
|
|
2996
|
-
}, e.flat_key_split = il, e.gclass_add_ev_action =
|
|
2997
|
+
}, 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) {
|
|
2997
2998
|
if (!e) return {
|
|
2998
2999
|
top: 0,
|
|
2999
3000
|
left: 0,
|
|
@@ -3015,7 +3016,7 @@ var gobjJs = function(e) {
|
|
|
3015
3016
|
}, e.get_function_name = rl, e.get_now = function() {
|
|
3016
3017
|
return Math.floor(Date.now() / 1e3);
|
|
3017
3018
|
}, e.gobj_bottom_gobj = st, e.gobj_change_parent = function(e, t) {
|
|
3018
|
-
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) &&
|
|
3019
|
+
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);
|
|
3019
3020
|
}, e.gobj_change_state = Dt, e.gobj_command = function(e, t, r, o) {
|
|
3020
3021
|
if (ot(e)) return hn("gobj NULL or DESTROYED"), -1;
|
|
3021
3022
|
if (function(e) {
|
|
@@ -3086,7 +3087,7 @@ var gobjJs = function(e) {
|
|
|
3086
3087
|
}(n, e), n;
|
|
3087
3088
|
}, 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() {
|
|
3088
3089
|
return Lt.length;
|
|
3089
|
-
}, e.gobj_publish_event = Xt, e.gobj_read_attr =
|
|
3090
|
+
}, 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) {
|
|
3090
3091
|
return Be(e) ? a ? a(e, t) : -1 : (hn(`${et(e)}: Only gobj services can load/save writable-persistent`), -1);
|
|
3091
3092
|
}, e.gobj_repr_global_trace_levels = function() {
|
|
3092
3093
|
return U.map(([e, t, n]) => ({
|
|
@@ -3104,7 +3105,7 @@ var gobjJs = function(e) {
|
|
|
3104
3105
|
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)));
|
|
3105
3106
|
}
|
|
3106
3107
|
return 0;
|
|
3107
|
-
}(e,
|
|
3108
|
+
}(e, E.SDF_VOLATIL, 0);
|
|
3108
3109
|
}, e.gobj_save_persistent_attrs = De, e.gobj_search_path = mt, e.gobj_send_event = Vt, e.gobj_services = function() {
|
|
3109
3110
|
let e = [];
|
|
3110
3111
|
for (const t of Object.keys(b)) qn(e, t);
|
|
@@ -3130,7 +3131,7 @@ var gobjJs = function(e) {
|
|
|
3130
3131
|
const d = [["EV_STATE_CHANGED", $.EVF_SYSTEM_EVENT | $.EVF_OUTPUT_EVENT | $.EVF_NO_WARN_SUBS], [0, 0]];
|
|
3131
3132
|
for (let e = 0; e < d.length; e++) {
|
|
3132
3133
|
let t = d[e][0], n = d[e][1];
|
|
3133
|
-
|
|
3134
|
+
Ee(g, t, n);
|
|
3134
3135
|
}
|
|
3135
3136
|
return 0;
|
|
3136
3137
|
}, e.gobj_stats = function(e, t, r, l) {
|
|
@@ -3158,7 +3159,7 @@ var gobjJs = function(e) {
|
|
|
3158
3159
|
let n = s[t], r = Jt(e, n, !1, !1);
|
|
3159
3160
|
0 === r ? i++ : r < 0 ? _++ : a++;
|
|
3160
3161
|
}
|
|
3161
|
-
return _ ?
|
|
3162
|
+
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;
|
|
3162
3163
|
}, 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) {
|
|
3163
3164
|
return "string" != typeof e ? (hn("html_markup: not a string, type " + typeof e), new qr("")) : new qr(e);
|
|
3164
3165
|
}, 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) {
|
|
@@ -3185,14 +3186,9 @@ var gobjJs = function(e) {
|
|
|
3185
3186
|
if (!tr(n)) return hn(`jdb_delete: path must be a string: ${String(n)}`), null;
|
|
3186
3187
|
let o, s = n.split("`"), i = l;
|
|
3187
3188
|
for (; (o = s.shift()) && !ir(o) && i;) Zn(i) && (i = Or(null, i, e.hook, null, 0)), i = Yr(i, null, o, !1);
|
|
3188
|
-
if (0
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
} else {
|
|
3192
|
-
let t = Or(null, i, e.hook, null, 0), n = Pr(t, r.id);
|
|
3193
|
-
n >= 0 && t.splice(n, 1);
|
|
3194
|
-
}
|
|
3195
|
-
return l;
|
|
3189
|
+
if (!i || 0 !== s.length) return hn(`jdb_delete: path not found in topic '${t}': '${n}'`), null;
|
|
3190
|
+
let _ = er(i) ? i : Or(null, i, e.hook, null, 0), a = Pr(_, r.id);
|
|
3191
|
+
return a < 0 ? (hn(`jdb_delete: record not found in topic '${t}': '${n}' '${r.id}'`), null) : (_.splice(a, 1), l);
|
|
3196
3192
|
}, e.jdb_get = function(e, t, n, r) {
|
|
3197
3193
|
let l = Or(null, Or(null, e, "topics", null, 0), t, null, 0);
|
|
3198
3194
|
return l ? (void 0 === r && (r = !0), Yr(l, e.hook, n, r)) : (hn("jdb_get: topic not found: " + t), null);
|
|
@@ -3209,22 +3205,24 @@ var gobjJs = function(e) {
|
|
|
3209
3205
|
Tr(null, e, "hook", "data", Zt.KW_CREATE);
|
|
3210
3206
|
let l = Or(null, e, "schema", {}, Zt.KW_CREATE), o = Or(null, e, "topics", {}, Zt.KW_CREATE);
|
|
3211
3207
|
return Kr(l, function(e, t, n, l) {
|
|
3212
|
-
"__"
|
|
3208
|
+
"__" === t.substring(0, 2) || Zn(n) || Or(null, o, l, Fn(r), Zt.KW_CREATE);
|
|
3213
3209
|
}, t), e;
|
|
3214
3210
|
}, e.jdb_update = function(e, t, n, r) {
|
|
3215
3211
|
let l = Or(null, Or(null, e, "topics", null, 0), t, null, 0);
|
|
3216
3212
|
if (!l) return hn("jdb_update: topic not found: " + t), null;
|
|
3217
3213
|
if (ir(r.id)) return hn("jdb_update: record without id: " + r), Tn(r), null;
|
|
3218
3214
|
if (!tr(n)) return hn(`jdb_update: path must be a string: ${String(n)}`), null;
|
|
3219
|
-
let o, s = n.split("`"),
|
|
3220
|
-
for (; (o =
|
|
3221
|
-
if (0
|
|
3222
|
-
|
|
3215
|
+
let o, s, i = n.split("`"), _ = l;
|
|
3216
|
+
for (; (o = i.shift()) && !ir(o) && _;) Zn(_) && (_ = Or(null, _, e.hook, null, 0)), _ = Yr(_, null, o, !1);
|
|
3217
|
+
if (!_ || 0 !== i.length) return hn(`jdb_update: path not found in topic '${t}': '${n}'`), null;
|
|
3218
|
+
if (er(_)) s = _;
|
|
3223
3219
|
else {
|
|
3224
|
-
|
|
3225
|
-
|
|
3220
|
+
if (_.id === r.id) return Gn(_, r), l;
|
|
3221
|
+
if (s = Or(null, _, e.hook, null, 0), null == s) s = [], Yn(_, e.hook, s);
|
|
3222
|
+
else if (!er(s)) return hn(`jdb_update: the hook '${e.hook}' of '${n}' is not a list in topic '${t}'`), null;
|
|
3226
3223
|
}
|
|
3227
|
-
|
|
3224
|
+
let a = Yr(s, e.hook, r.id, !1);
|
|
3225
|
+
return a ? Gn(a, r) : s.push(r), l;
|
|
3228
3226
|
}, e.json2flat = function(e) {
|
|
3229
3227
|
const t = {}, n = (e, r, l) => {
|
|
3230
3228
|
if (l > ll) throw new Error("json2flat: deeper than 256");
|
|
@@ -3276,7 +3274,7 @@ var gobjJs = function(e) {
|
|
|
3276
3274
|
if (!n || !er(t)) return r && hn("item NULL or kw_list is not a list"), -1;
|
|
3277
3275
|
for (let e = 0; e < t.length; e++) if (Vn(n, t[e])) return e;
|
|
3278
3276
|
return r && hn("item not found in this list"), -1;
|
|
3279
|
-
}, e.kw_find_path = mr, e.kw_flag_t = Zt, e.kw_get_bool =
|
|
3277
|
+
}, 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) {
|
|
3280
3278
|
e && !sr(e) && hn("GObj bad instanceof");
|
|
3281
3279
|
let o = mr(e, t, n, !1);
|
|
3282
3280
|
const s = l && l & Zt.KW_REQUIRED, i = l && l & Zt.KW_CREATE, _ = l && l & Zt.KW_EXTRACT;
|
|
@@ -3402,10 +3400,10 @@ var gobjJs = function(e) {
|
|
|
3402
3400
|
else n && n(r.status);
|
|
3403
3401
|
var e;
|
|
3404
3402
|
}, r.send();
|
|
3405
|
-
}, e.log_debug =
|
|
3403
|
+
}, e.log_debug = En, e.log_error = hn, e.log_info = function(e, ...t) {
|
|
3406
3404
|
let n = mn(e, ...t), r = el();
|
|
3407
3405
|
rn && cn("info", n) && rn("%c" + r + " INFO: " + String(n), "color:cyan"), gn("info", n, r);
|
|
3408
|
-
}, e.log_warning =
|
|
3406
|
+
}, 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) {
|
|
3409
3407
|
return new DOMParser().parseFromString(e, "image/svg+xml").firstChild;
|
|
3410
3408
|
}, e.refresh_language = function(e, t) {
|
|
3411
3409
|
if (!or(t)) return void hn("You must supply a translation function");
|
|
@@ -3537,7 +3535,7 @@ var gobjJs = function(e) {
|
|
|
3537
3535
|
["EV_TIMEOUT", $.EVF_OUTPUT_EVENT],
|
|
3538
3536
|
["EV_TIMEOUT_PERIODIC", $.EVF_OUTPUT_EVENT],
|
|
3539
3537
|
[0, 0]
|
|
3540
|
-
], t,
|
|
3538
|
+
], t, yl, 0, bl, pl, 0, 0, 0, w.gcflag_manual_start)) ? 0 : -1;
|
|
3541
3539
|
}("C_TIMER");
|
|
3542
3540
|
}, e.register_c_yuno = function() {
|
|
3543
3541
|
return function(e) {
|
|
@@ -3553,7 +3551,7 @@ var gobjJs = function(e) {
|
|
|
3553
3551
|
if (!e) return "";
|
|
3554
3552
|
const t = String(e).trim();
|
|
3555
3553
|
return /^javascript:/i.test(t) || /^data:/i.test(t) ? "" : Jr(t);
|
|
3556
|
-
}, e.sdata_flag_t =
|
|
3554
|
+
}, e.sdata_flag_t = E, e.send_http_json_post = function(e, t, n) {
|
|
3557
3555
|
let r = new XMLHttpRequest();
|
|
3558
3556
|
r.open("POST", e), r.setRequestHeader("Accept", "application/json"), r.setRequestHeader("Content-Type", "application/json"), r.onreadystatechange = function() {
|
|
3559
3557
|
4 === r.readyState && n(r.status, r.responseText);
|
|
@@ -3577,7 +3575,7 @@ var gobjJs = function(e) {
|
|
|
3577
3575
|
} else on = e;
|
|
3578
3576
|
}, e.set_remote_log_functions = bn, e.set_strings_are_text = function(e) {
|
|
3579
3577
|
Qr = !!e;
|
|
3580
|
-
}, e.set_timeout =
|
|
3578
|
+
}, 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() {
|
|
3581
3579
|
return Qr;
|
|
3582
3580
|
}, e.strncmp = function(e, t, n) {
|
|
3583
3581
|
var r = (e + "").substring(0, n), l = (t + "").substring(0, n);
|
|
@@ -3627,9 +3625,9 @@ var gobjJs = function(e) {
|
|
|
3627
3625
|
}, e.timeTracker = function(e = "Time Tracker", t = !1) {
|
|
3628
3626
|
const n = e, r = performance.now();
|
|
3629
3627
|
let l = r;
|
|
3630
|
-
return t &&
|
|
3628
|
+
return t && yn(`--\x3e ${n} - starting`), { mark: (e = "Intermediate", o = "") => {
|
|
3631
3629
|
const s = performance.now(), i = (s - l) / 1e3, _ = (s - r) / 1e3;
|
|
3632
|
-
return t &&
|
|
3630
|
+
return t && yn(`--\x3e ${n} ${e} - partial: ${i} sec, total: ${_} sec, ${o}`), l = s, {
|
|
3633
3631
|
partial: i,
|
|
3634
3632
|
total: _
|
|
3635
3633
|
};
|