@yuneta/gobj-js 7.26.22 → 7.26.24

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.
@@ -869,6 +869,75 @@
869
869
  var INT64_MIN = -(2n ** 63n);
870
870
  var INT64_MAX = 2n ** 63n - 1n;
871
871
  var REFUSED_TEXT = "a text that does not read as one";
872
+ var JSON_NUMBER_TOKEN = /-?(0|[1-9][0-9]*)(\.[0-9]+)?([eE][+-]?[0-9]+)?/y;
873
+ function is_surrogate_pair(high, low) {
874
+ return high >= 55296 && high <= 56319 && low >= 56320 && low <= 57343;
875
+ }
876
+ function json_text_refused_by_c(s) {
877
+ const n = s.length;
878
+ let i = 0;
879
+ while (i < n) {
880
+ const c = s.charCodeAt(i);
881
+ if (c === 34) {
882
+ i++;
883
+ while (i < n) {
884
+ const d = s.charCodeAt(i);
885
+ if (d === 34) {
886
+ i++;
887
+ break;
888
+ }
889
+ if (d === 92 && s[i + 1] === "u") {
890
+ const u = parseInt(s.substring(i + 2, i + 6), 16);
891
+ if (u === 0) return true;
892
+ if (u >= 55296 && u <= 57343) {
893
+ if (!is_surrogate_pair(u, s[i + 6] === "\\" && s[i + 7] === "u" ? parseInt(s.substring(i + 8, i + 12), 16) : -1)) return true;
894
+ i += 12;
895
+ continue;
896
+ }
897
+ i += 6;
898
+ continue;
899
+ }
900
+ if (d === 92) {
901
+ i += 2;
902
+ continue;
903
+ }
904
+ if (d >= 55296 && d <= 57343) {
905
+ if (!is_surrogate_pair(d, s.charCodeAt(i + 1))) return true;
906
+ i += 2;
907
+ continue;
908
+ }
909
+ i++;
910
+ }
911
+ continue;
912
+ }
913
+ if (c === 45 || c >= 48 && c <= 57) {
914
+ JSON_NUMBER_TOKEN.lastIndex = i;
915
+ const m = JSON_NUMBER_TOKEN.exec(s);
916
+ if (!m) return true;
917
+ const token = m[0];
918
+ if (/[.eE]/.test(token)) {
919
+ if (!Number.isFinite(Number(token))) return true;
920
+ } else {
921
+ const big = BigInt(token);
922
+ if (big < INT64_MIN || big > INT64_MAX) return true;
923
+ }
924
+ i += token.length;
925
+ continue;
926
+ }
927
+ i++;
928
+ }
929
+ return false;
930
+ }
931
+ function parse_json_text_as_c(s) {
932
+ let jn;
933
+ try {
934
+ jn = JSON.parse(s);
935
+ } catch (e) {
936
+ return;
937
+ }
938
+ if (json_text_refused_by_c(s)) return;
939
+ return jn;
940
+ }
872
941
  function value_has_shape(type, value) {
873
942
  if (DTP_IS_STRING(type)) return is_string(value);
874
943
  if (DTP_IS_DICT(type)) return is_object(value);
@@ -972,16 +1041,8 @@
972
1041
  };
973
1042
  }
974
1043
  if (DTP_IS_DICT(type) || DTP_IS_LIST(type)) {
975
- let jn;
976
- try {
977
- jn = JSON.parse(s);
978
- } catch (e) {
979
- return {
980
- value: void 0,
981
- refused: REFUSED_TEXT
982
- };
983
- }
984
- if (!value_has_shape(type, jn)) return {
1044
+ const jn = parse_json_text_as_c(s);
1045
+ if (jn === void 0 || !value_has_shape(type, jn)) return {
985
1046
  value: void 0,
986
1047
  refused: REFUSED_TEXT
987
1048
  };
@@ -990,12 +1051,12 @@
990
1051
  refused: null
991
1052
  };
992
1053
  }
993
- if (DTP_IS_JSON(type)) try {
994
- return {
995
- value: JSON.parse(s),
1054
+ if (DTP_IS_JSON(type)) {
1055
+ const jn = parse_json_text_as_c(s);
1056
+ if (jn !== void 0) return {
1057
+ value: jn,
996
1058
  refused: null
997
1059
  };
998
- } catch (e) {
999
1060
  const t = s.replace(/^[ \t]+/, "");
1000
1061
  if (t.startsWith("{") || t.startsWith("[") || t.startsWith("\"")) return {
1001
1062
  value: void 0,
@@ -1088,8 +1149,18 @@
1088
1149
  data_type_t.DTP_LIST,
1089
1150
  data_type_t.DTP_DICT
1090
1151
  ];
1152
+ var NO_JSON_TEXT = "a value with no json text";
1153
+ function json_text_of(value) {
1154
+ try {
1155
+ const s = JSON.stringify(value);
1156
+ return is_string(s) ? s : void 0;
1157
+ } catch (e) {
1158
+ return;
1159
+ }
1160
+ }
1091
1161
  function log_attr_value_refused(gobj, it, value, refused) {
1092
1162
  const types = {
1163
+ [data_type_t.DTP_STRING]: "a string",
1093
1164
  [data_type_t.DTP_BOOLEAN]: "a boolean",
1094
1165
  [data_type_t.DTP_INTEGER]: "an integer",
1095
1166
  [data_type_t.DTP_REAL]: "a real",
@@ -1099,7 +1170,8 @@
1099
1170
  let shown;
1100
1171
  if (it.flag & sdata_flag_t.SDF_SECRET) shown = "********";
1101
1172
  else {
1102
- shown = is_string(value) ? value : String(JSON.stringify(value === void 0 ? null : value));
1173
+ shown = is_string(value) ? value : json_text_of(value === void 0 ? null : value);
1174
+ if (shown === void 0) shown = `<${NO_JSON_TEXT}>`;
1103
1175
  const masked = mask_secrets_inline(shown);
1104
1176
  if (masked !== null) shown = masked;
1105
1177
  if (shown.length > ATTR_VALUE_SHOWN) {
@@ -1121,8 +1193,11 @@
1121
1193
  if (jn_value_ === null || jn_value_ === void 0) jn_value2 = "";
1122
1194
  else if (is_string(jn_value_)) jn_value2 = String(jn_value_);
1123
1195
  else {
1124
- let s = JSON.stringify(jn_value_);
1125
- if (s) jn_value2 = String(s);
1196
+ jn_value2 = json_text_of(jn_value_);
1197
+ if (jn_value2 === void 0) {
1198
+ log_attr_value_refused(gobj, it, jn_value_, NO_JSON_TEXT);
1199
+ return -1;
1200
+ }
1126
1201
  }
1127
1202
  break;
1128
1203
  case data_type_t.DTP_BOOLEAN:
@@ -2570,15 +2645,20 @@
2570
2645
  * The value a typed writer writes, read as ITS type by the grammar of
2571
2646
  * json2item() (a C writer takes its C type: a string is never read as a
2572
2647
  * number there). Return {value} or {refused} (logged): the attr keeps its
2573
- * value. A string writer never refuses: null and undefined are "", any
2574
- * other json its text, as a DTP_STRING attr reads them.
2648
+ * value. A string writer takes null and undefined as "", any other json
2649
+ * as its text, as a DTP_STRING attr reads them; it refuses only a value
2650
+ * with no json text (circular, a BigInt).
2575
2651
  ***************************************************************************/
2576
2652
  function typed_writer_value(gobj, name, type, value) {
2653
+ let r;
2577
2654
  if (DTP_IS_STRING(type)) {
2578
2655
  if (value === null || value === void 0) return { value: "" };
2579
- return { value: is_string(value) ? value : String(JSON.stringify(value)) };
2580
- }
2581
- const r = command_parameter_from_json(type, value);
2656
+ if (is_string(value)) return { value };
2657
+ r = {
2658
+ value: json_text_of(value),
2659
+ refused: NO_JSON_TEXT
2660
+ };
2661
+ } else r = command_parameter_from_json(type, value);
2582
2662
  if (r.value === void 0) {
2583
2663
  let holder = gobj;
2584
2664
  while (holder && !gobj_has_attr(holder, name)) holder = holder.bottom_gobj;
@@ -3023,9 +3103,9 @@
3023
3103
  }
3024
3104
  }
3025
3105
  const frame = push_dispatch_frame(dst, event, frame_kind_t.FRAME_ACTION);
3026
- if (event_action.next_state) gobj_change_state(dst, event_action.next_state);
3027
3106
  let ret = -1;
3028
3107
  try {
3108
+ if (event_action.next_state) gobj_change_state(dst, event_action.next_state);
3029
3109
  if (event_action.action) ret = event_action.action(dst, event, kw, src);
3030
3110
  } catch (e) {
3031
3111
  __inside__--;
@@ -3049,18 +3129,23 @@
3049
3129
  __own_event__: 4
3050
3130
  });
3051
3131
  /***************************************************************************
3052
- * The event type of `event_name` in any registered gclass, null if none.
3053
- * The C kernel's gobj_find_event_type(): any case, gclasses only.
3132
+ * The event type of `event_name` in any registered gclass whose flags
3133
+ * hold one of `event_flag` (0: any), null if none. The C kernel's
3134
+ * gobj_find_event_type(): any case, gclasses only. With `verbose` a miss
3135
+ * is logged, with the name as it was given: never verbose for a name
3136
+ * that came from a peer.
3054
3137
  ***************************************************************************/
3055
- function _find_event_type_in_gclasses(event_name) {
3138
+ function gobj_find_event_type(event_name, event_flag, verbose) {
3056
3139
  let lower = String(event_name).toLowerCase();
3057
3140
  for (let gclass_name in _gclass_register) {
3058
3141
  let dl = _gclass_register[gclass_name].dl_events;
3059
3142
  for (let i = 0; i < dl.length; i++) {
3060
3143
  let event_type = dl[i];
3144
+ if (event_flag && !(event_type.event_flag & event_flag)) continue;
3061
3145
  if (event_type.event_name && event_type.event_name.toLowerCase() === lower) return event_type;
3062
3146
  }
3063
3147
  }
3148
+ if (verbose) log_error(`EVENT NOT FOUND: ${event_name}`);
3064
3149
  return null;
3065
3150
  }
3066
3151
  var subscription_desc = [
@@ -3097,7 +3182,7 @@
3097
3182
  json_object_set_new(subs, "__config__", kw_clone);
3098
3183
  let renamed_event = kw_get_str(publisher, kw_clone, "__rename_event_name__", "");
3099
3184
  if (!empty_string(renamed_event)) {
3100
- let event_type = _find_event_type_in_gclasses(renamed_event);
3185
+ let event_type = gobj_find_event_type(renamed_event, 0, false);
3101
3186
  if (event_type) {
3102
3187
  json_object_set_new(subs, "renamed_event", event_type.event_name);
3103
3188
  delete kw_clone.__rename_event_name__;
@@ -3158,7 +3243,7 @@
3158
3243
  kw_match.__config__ = config_match;
3159
3244
  let renamed_event = "";
3160
3245
  let rename = config_match.__rename_event_name__;
3161
- let event_type = typeof rename === "string" && !empty_string(rename) ? _find_event_type_in_gclasses(rename) : null;
3246
+ let event_type = typeof rename === "string" && !empty_string(rename) ? gobj_find_event_type(rename, 0, false) : null;
3162
3247
  if (event_type) {
3163
3248
  renamed_event = event_type.event_name;
3164
3249
  delete config_match.__rename_event_name__;
@@ -4322,12 +4407,13 @@
4322
4407
  const name_from = word;
4323
4408
  word = p + 1;
4324
4409
  const secret = is_secret_name_tail(str, name_from, p, names);
4325
- if (secret && names === NAMES_NOW && !is_secret_name_tail(str, name_from, p, NAMES_7_26_9)) not_7_26_9 = true;
4410
+ if (secret && names === NAMES_NOW && !not_7_26_9 && !is_secret_name_tail(str, name_from, p, NAMES_7_26_9)) not_7_26_9 = true;
4326
4411
  if (!(secret || value_is_secret && p - name_from === 5 && ascii_case_equal(str, name_from, "value"))) {
4327
- if (judged && query_name_from(str, p) === name_from) judged[p] = 1;
4412
+ if (judged && query_name_from(str, p) === name_from) judged[p] = JUDGED_NOT_SECRET;
4328
4413
  p++;
4329
4414
  continue;
4330
4415
  }
4416
+ if (judged && secret && query_name_from(str, p) === name_from) judged[p] = JUDGED_SECRET;
4331
4417
  p++;
4332
4418
  let end;
4333
4419
  const quote = p < str.length && (str[p] === "\"" || str[p] === "'") ? str[p] : "";
@@ -4390,23 +4476,99 @@
4390
4476
  while (n > 0 && eq - n < MASK_MAX_NAME && is_name_char_code(str.charCodeAt(n - 1))) n--;
4391
4477
  return n;
4392
4478
  }
4479
+ var JUDGED_NOT_SECRET = 1;
4480
+ var JUDGED_SECRET = 2;
4481
+ function hex_digit_value(code) {
4482
+ if (code >= 48 && code <= 57) return code - 48;
4483
+ if (code >= 97 && code <= 102) return code - 87;
4484
+ if (code >= 65 && code <= 70) return code - 55;
4485
+ return -1;
4486
+ }
4487
+ function is_written_name_bracket_code(code) {
4488
+ return code === 91 || code === 93 || code === 39 || code === 34;
4489
+ }
4490
+ function is_written_name_code(code) {
4491
+ return is_name_char_code(code) || code === 37 || is_written_name_bracket_code(code);
4492
+ }
4493
+ function written_name_is_secret(str, eq) {
4494
+ let n = eq;
4495
+ let plain = -1;
4496
+ while (n > 0 && eq - n < MASK_MAX_NAME && is_written_name_code(str.charCodeAt(n - 1))) {
4497
+ n--;
4498
+ if (plain < 0 && !is_name_char_code(str.charCodeAt(n))) plain = n + 1;
4499
+ }
4500
+ if (plain < 0) return false;
4501
+ const to = str.charCodeAt(plain - 1) === 37 ? eq : plain - 1;
4502
+ let encoded = false;
4503
+ for (let s = n; s < to && !encoded; s++) encoded = str.charCodeAt(s) === 37;
4504
+ let name = str;
4505
+ let from = n;
4506
+ let end = to;
4507
+ if (encoded) {
4508
+ name = "";
4509
+ for (let s = n; s < to; s++) {
4510
+ const hi = str.charCodeAt(s) === 37 && to - s > 2 ? hex_digit_value(str.charCodeAt(s + 1)) : -1;
4511
+ const lo = hi >= 0 ? hex_digit_value(str.charCodeAt(s + 2)) : -1;
4512
+ if (lo >= 0) {
4513
+ name += String.fromCharCode(hi * 16 + lo);
4514
+ s += 2;
4515
+ } else name += str[s];
4516
+ }
4517
+ from = 0;
4518
+ end = name.length;
4519
+ }
4520
+ let seg = from;
4521
+ for (let i = from; i <= end; i++) {
4522
+ if (i < end && !is_written_name_bracket_code(name.charCodeAt(i))) continue;
4523
+ if (i - seg >= 3 && secret_name_check(name, seg, i, true, true)) return true;
4524
+ seg = i + 1;
4525
+ }
4526
+ return false;
4527
+ }
4528
+ function mark_query_value(str, eq, marks) {
4529
+ const v = eq + 1;
4530
+ if (v < str.length && (str[v] === "\"" || str[v] === "'")) return mark_run(str, v + 1, QUOTE_STOPS[str[v]], marks);
4531
+ mark_scheme_value(str, v, PARAM_VALUE_STOPS, marks);
4532
+ return mark_run(str, v, PARAM_VALUE_STOPS, marks);
4533
+ }
4534
+ var WRITTEN_NAME_MARKS = /[[\]%'"]/;
4393
4535
  function mark_query_params(str, marks, judged) {
4394
4536
  let frontier = 0;
4395
- for (let p = 1; p < str.length; p++) {
4396
- if (p < frontier) {
4397
- p = frontier - 1;
4398
- continue;
4399
- }
4400
- if (str.charCodeAt(p) !== 61) continue;
4401
- if (judged[p]) continue;
4402
- const n = query_name_from(str, p);
4403
- if (n === p || !secret_name_check(str, n, p, true, true)) continue;
4404
- const v = p + 1;
4405
- if (v < str.length && (str[v] === "\"" || str[v] === "'")) frontier = mark_run(str, v + 1, QUOTE_STOPS[str[v]], marks);
4406
- else {
4407
- mark_scheme_value(str, v, PARAM_VALUE_STOPS, marks);
4408
- frontier = mark_run(str, v, PARAM_VALUE_STOPS, marks);
4537
+ let frontier_written = WRITTEN_NAME_MARKS.test(str) ? 0 : str.length;
4538
+ let p = str.indexOf("=", 1);
4539
+ while (p > 0) {
4540
+ if (p >= frontier) {
4541
+ let secret = judged[p] === JUDGED_SECRET;
4542
+ if (!judged[p]) {
4543
+ const n = query_name_from(str, p);
4544
+ secret = n < p && secret_name_check(str, n, p, true, true);
4545
+ }
4546
+ if (secret) frontier = mark_query_value(str, p, marks);
4547
+ }
4548
+ if (p >= frontier_written && written_name_is_secret(str, p)) frontier_written = mark_query_value(str, p, marks);
4549
+ p = str.indexOf("=", p + 1);
4550
+ }
4551
+ }
4552
+ var URL_AUTHORITY_STOPS = stop_table("/?#\"'<> ");
4553
+ function mark_url_passwords(str, marks) {
4554
+ let p = str.indexOf("://", 1);
4555
+ while (p > 0) {
4556
+ let next = p + 1;
4557
+ if (is_ascii_alnum_code(str.charCodeAt(p - 1))) {
4558
+ let colon = -1;
4559
+ let at = -1;
4560
+ let e = p + 3;
4561
+ while (e < str.length) {
4562
+ const code = str.charCodeAt(e);
4563
+ if (code < 128 && URL_AUTHORITY_STOPS[code]) break;
4564
+ if (code === 64) at = e;
4565
+ else if (code === 58 && colon < 0) colon = e;
4566
+ e++;
4567
+ }
4568
+ if (colon >= 0 && at > colon) mark_range(marks, colon + 1, at);
4569
+ next = e - 1;
4409
4570
  }
4571
+ p = str.indexOf("://", next);
4410
4572
  }
4411
4573
  }
4412
4574
  function mark_shapes(str, marks) {
@@ -4467,6 +4629,7 @@
4467
4629
  if (mark_params(str, value_is_secret, READ_NOW, marks, judged) || value_is_secret !== value_is_secret_7_26_9) mark_params(str, value_is_secret_7_26_9, READ_AS_7_26_9, marks, null);
4468
4630
  if (has_shape_js_7_26_20(str)) mark_params(str, value_is_secret, READ_AS_GOBJ_JS_7_26_20, marks, null);
4469
4631
  mark_query_params(str, marks, judged);
4632
+ mark_url_passwords(str, marks);
4470
4633
  mark_shapes(str, marks);
4471
4634
  mark_labels(str, marks);
4472
4635
  }
@@ -8505,7 +8668,7 @@
8505
8668
  * show its first characters). As the C kernel shows the name of an
8506
8669
  * event that is not public (mask_secrets_inline_capped()).
8507
8670
  ***************************************************************/
8508
- var PEER_NAME_SHOWN = 64;
8671
+ var PEER_NAME_SHOWN = 128;
8509
8672
  var PEER_FRAME_SHOWN = 256;
8510
8673
  function peer_text_shown(text, max) {
8511
8674
  let s = String(text);
@@ -8728,7 +8891,8 @@
8728
8891
  let url = kw.url;
8729
8892
  if (kw.ws_seq !== void 0 && kw.ws_seq !== priv.ws_seq) return 0;
8730
8893
  set_remote_log_functions();
8731
- log_warning(`${gobj_short_name(gobj)}: WebSocket closed ${url} (Code: ${kw.code}, Reason: "${peer_text_shown(kw.reason, PEER_FRAME_SHOWN)}", Clean: ${kw.was_clean})`);
8894
+ const reason_shown = peer_text_shown(kw.reason === void 0 ? "" : kw.reason, PEER_FRAME_SHOWN);
8895
+ if (is_traffic_tracing(gobj)) trace_msg(`${gobj_short_name(gobj)}: WebSocket closed ${url} (Code: ${kw.code}, Reason: "${reason_shown}", Clean: ${kw.was_clean})`);
8732
8896
  if (priv.websocket) {
8733
8897
  priv.websocket.onopen = null;
8734
8898
  priv.websocket.onmessage = null;
@@ -8738,21 +8902,25 @@
8738
8902
  }
8739
8903
  if (priv.inform_on_close) {
8740
8904
  priv.inform_on_close = false;
8905
+ if ((!kw.was_clean || kw.code !== 1e3 && kw.code !== 1001) && gobj_is_running(gobj)) log_warning(`${gobj_short_name(gobj)}: session closed ${url} (Code: ${kw.code}, Reason: "${reason_shown}", Clean: ${kw.was_clean})`);
8741
8906
  gobj_publish_event(gobj, "EV_ON_CLOSE", {
8742
8907
  url,
8743
8908
  remote_yuno_name: priv.remote_yuno_name,
8744
8909
  remote_yuno_role: priv.remote_yuno_role,
8745
- remote_yuno_service: priv.remote_yuno_service
8910
+ remote_yuno_service: priv.remote_yuno_service,
8911
+ code: kw.code,
8912
+ reason: reason_shown,
8913
+ was_clean: kw.was_clean
8746
8914
  });
8747
8915
  } else if (!gobj_is_running(gobj)) {} else {
8748
- log_warning(`${gobj_short_name(gobj)}: EV_ON_OPEN_ERROR cannot open ${url} (Code: ${kw.code}, Reason: "${kw.reason}", Clean: ${kw.was_clean})`);
8916
+ log_warning(`${gobj_short_name(gobj)}: EV_ON_OPEN_ERROR cannot open ${url} (Code: ${kw.code}, Reason: "${reason_shown}", Clean: ${kw.was_clean})`);
8749
8917
  gobj_publish_event(gobj, "EV_ON_OPEN_ERROR", {
8750
8918
  url,
8751
8919
  remote_yuno_name: priv.remote_yuno_name,
8752
8920
  remote_yuno_role: priv.remote_yuno_role,
8753
8921
  remote_yuno_service: priv.remote_yuno_service,
8754
8922
  code: kw.code,
8755
- reason: kw.reason,
8923
+ reason: reason_shown,
8756
8924
  was_clean: kw.was_clean
8757
8925
  });
8758
8926
  }
@@ -8861,9 +9029,9 @@
8861
9029
  let iev_event = iev_msg.event;
8862
9030
  let iev_kw = iev_msg.kw;
8863
9031
  if (gobj_current_state(gobj) !== "ST_SESSION") {
8864
- if (gobj_has_event(gobj, iev_event, event_flag_t.EVF_PUBLIC_EVENT)) {
8865
- if (!(gobj_send_event(gobj, iev_event, iev_kw, gobj) < 0)) return 0;
8866
- } else log_error(`${gobj_short_name(gobj)}: event UNKNOWN in not-session state ${peer_text_shown(iev_event, PEER_NAME_SHOWN)}`);
9032
+ if (String(iev_event).toLowerCase() === "ev_identity_card_ack") {
9033
+ if (!(gobj_send_event(gobj, "EV_IDENTITY_CARD_ACK", iev_kw, gobj) < 0)) return 0;
9034
+ } else log_warning(`${gobj_short_name(gobj)}: event UNKNOWN in not-session state ${peer_text_shown(iev_event, PEER_NAME_SHOWN)}`);
8867
9035
  close_websocket(gobj);
8868
9036
  return -1;
8869
9037
  }
@@ -8871,9 +9039,16 @@
8871
9039
  let msg_type = msg_iev_get_msg_type(gobj, iev_kw);
8872
9040
  let event_id = msg_iev_get_stack(gobj, iev_kw, IEVENT_STACK_ID);
8873
9041
  let iev_dst_role = kw_get_str(gobj, event_id, "dst_role", "");
8874
- if (iev_dst_role.toLowerCase() !== gobj_yuno_role().toLowerCase()) {
8875
- log_error(`"It's not my role, dst_role: ${peer_text_shown(iev_dst_role, PEER_NAME_SHOWN)}, my_role: ${gobj_yuno_role()}`);
8876
- return 0;
9042
+ if (!empty_string(iev_dst_role) && iev_dst_role.toLowerCase() !== String(gobj_yuno_role()).toLowerCase()) {
9043
+ log_warning(`${gobj_short_name(gobj)}: It's not my role, dst_role: ${peer_text_shown(iev_dst_role, PEER_NAME_SHOWN)}, my_role: ${gobj_yuno_role()}, event: ${peer_text_shown(iev_event, PEER_NAME_SHOWN)}`);
9044
+ close_websocket(gobj);
9045
+ return -1;
9046
+ }
9047
+ let iev_dst_yuno = kw_get_str(gobj, event_id, "dst_yuno", "");
9048
+ if (!empty_string(iev_dst_yuno) && iev_dst_yuno.toLowerCase() !== String(gobj_yuno_name()).toLowerCase()) {
9049
+ log_warning(`${gobj_short_name(gobj)}: It's not my name, dst_yuno: ${peer_text_shown(iev_dst_yuno, PEER_NAME_SHOWN)}, my_name: ${gobj_yuno_name()}, event: ${peer_text_shown(iev_event, PEER_NAME_SHOWN)}`);
9050
+ close_websocket(gobj);
9051
+ return -1;
8877
9052
  }
8878
9053
  let iev_dst_service = kw_get_str(gobj, event_id, "dst_service", "");
8879
9054
  if (msg_type === "__subscribing__") {
@@ -8895,13 +9070,18 @@
8895
9070
  return 0;
8896
9071
  }
8897
9072
  if (!gobj_has_event(gobj_service, iev_event, event_flag_t.EVF_PUBLIC_EVENT)) {
8898
- log_error(`${gobj_short_name(gobj)}: Service found but no event or not public, service '${gobj_short_name(gobj_service)}', ev '${peer_text_shown(iev_event, PEER_NAME_SHOWN)}'`);
9073
+ log_warning(`${gobj_short_name(gobj)}: Service found but no event or not public, DROPPED: service '${gobj_short_name(gobj_service)}', ev '${peer_text_shown(iev_event, PEER_NAME_SHOWN)}'`);
8899
9074
  return -1;
8900
9075
  }
8901
9076
  gobj_send_event(gobj_service, iev_event, iev_kw, gobj);
8902
9077
  return 0;
8903
9078
  }
8904
- gobj_publish_event(gobj, iev_event, iev_kw);
9079
+ let event_type = gobj_find_event_type(iev_event, 0, false);
9080
+ if (!event_type) {
9081
+ log_warning(`${gobj_short_name(gobj)}: event that no gclass declares, DROPPED: ev '${peer_text_shown(iev_event, PEER_NAME_SHOWN)}'`);
9082
+ return -1;
9083
+ }
9084
+ gobj_publish_event(gobj, event_type.event_name, iev_kw);
8905
9085
  return 0;
8906
9086
  }
8907
9087
  /***************************************************************************
@@ -9116,6 +9296,7 @@
9116
9296
  exports.gobj_deliver_posted_events = gobj_deliver_posted_events;
9117
9297
  exports.gobj_destroy = gobj_destroy;
9118
9298
  exports.gobj_find_child = gobj_find_child;
9299
+ exports.gobj_find_event_type = gobj_find_event_type;
9119
9300
  exports.gobj_find_gobj = gobj_find_gobj;
9120
9301
  exports.gobj_find_service = gobj_find_service;
9121
9302
  exports.gobj_find_subscribings = gobj_find_subscribings;