@bonsae/nrg 0.26.3 → 0.27.0

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.
@@ -1,5 +1,5 @@
1
1
  import { config as D } from "vitest-browser-vue";
2
- import { defineComponent as V, openBlock as l, createElementBlock as c, normalizeClass as N, createCommentVNode as f, renderSlot as k, createTextVNode as W, toDisplayString as E, resolveComponent as g, createBlock as v, createElementVNode as m, shallowRef as q, withDirectives as H, vShow as J, Teleport as K, Fragment as _, renderList as L, createVNode as R } from "vue";
2
+ import { defineComponent as V, openBlock as l, createElementBlock as c, normalizeClass as R, createCommentVNode as f, renderSlot as k, createTextVNode as W, toDisplayString as E, resolveComponent as g, createBlock as v, createElementVNode as m, shallowRef as q, withDirectives as H, vShow as J, Teleport as K, Fragment as _, renderList as j, createVNode as N } from "vue";
3
3
  import { beforeEach as Q } from "vitest";
4
4
  const Y = V({
5
5
  name: "NodeRedInputLabel",
@@ -37,7 +37,7 @@ function X(e, t, n, r, s, d) {
37
37
  "i",
38
38
  {
39
39
  key: 0,
40
- class: N(e.iconClass)
40
+ class: R(e.iconClass)
41
41
  },
42
42
  null,
43
43
  2
@@ -53,8 +53,8 @@ function X(e, t, n, r, s, d) {
53
53
  e.required ? (l(), c("span", G, "*")) : f("v-if", !0)
54
54
  ]);
55
55
  }
56
- const w = /* @__PURE__ */ T(Y, [["render", X], ["__scopeId", "data-v-864b02f2"]]), j = "*************", x = V({
57
- components: { NodeRedInputLabel: w },
56
+ const S = /* @__PURE__ */ T(Y, [["render", X], ["__scopeId", "data-v-864b02f2"]]), L = "*************", x = V({
57
+ components: { NodeRedInputLabel: S },
58
58
  props: {
59
59
  modelValue: {
60
60
  type: [String, Number],
@@ -108,10 +108,10 @@ const w = /* @__PURE__ */ T(Y, [["render", X], ["__scopeId", "data-v-864b02f2"]]
108
108
  this.internalValue = e.target.value, this.$emit("update:modelValue", this.internalValue), this.$emit("update:value", this.internalValue), this.$emit("input", this.internalValue);
109
109
  },
110
110
  onFocus() {
111
- this.type === "password" && this.internalValue === j && (this.internalValue = "");
111
+ this.type === "password" && this.internalValue === L && (this.internalValue = "");
112
112
  },
113
113
  onBlur() {
114
- this.type === "password" && this.effectiveValue === "__PWD__" && (this.internalValue = j);
114
+ this.type === "password" && this.effectiveValue === "__PWD__" && (this.internalValue = L);
115
115
  }
116
116
  }
117
117
  }), ee = { style: { display: "flex", "flex-direction": "column", width: "100%" } }, te = ["type", "value", "placeholder"], ne = {
@@ -148,7 +148,7 @@ function re(e, t, n, r, s, d) {
148
148
  )) : f("v-if", !0)
149
149
  ]);
150
150
  }
151
- const B = /* @__PURE__ */ T(x, [["render", re]]), oe = [
151
+ const U = /* @__PURE__ */ T(x, [["render", re]]), oe = [
152
152
  "msg",
153
153
  "flow",
154
154
  "global",
@@ -164,7 +164,7 @@ const B = /* @__PURE__ */ T(x, [["render", re]]), oe = [
164
164
  "node",
165
165
  "cred"
166
166
  ], ie = ["errorPort", "completePort", "statusPort"], se = V({
167
- components: { NodeRedInputLabel: w },
167
+ components: { NodeRedInputLabel: S },
168
168
  props: {
169
169
  modelValue: {
170
170
  type: Object,
@@ -322,8 +322,8 @@ function de(e, t, n, r, s, d) {
322
322
  )) : f("v-if", !0)
323
323
  ]);
324
324
  }
325
- const U = /* @__PURE__ */ T(se, [["render", de]]), pe = V({
326
- components: { NodeRedInputLabel: w },
325
+ const B = /* @__PURE__ */ T(se, [["render", de]]), pe = V({
326
+ components: { NodeRedInputLabel: S },
327
327
  props: {
328
328
  modelValue: {
329
329
  type: String,
@@ -421,8 +421,8 @@ function me(e, t, n, r, s, d) {
421
421
  )) : f("v-if", !0)
422
422
  ]);
423
423
  }
424
- const M = /* @__PURE__ */ T(pe, [["render", me]]), he = V({
425
- components: { NodeRedInputLabel: w },
424
+ const F = /* @__PURE__ */ T(pe, [["render", me]]), he = V({
425
+ components: { NodeRedInputLabel: S },
426
426
  props: {
427
427
  modelValue: {
428
428
  type: [String, Array],
@@ -538,8 +538,8 @@ function $e(e, t, n, r, s, d) {
538
538
  )) : f("v-if", !0)
539
539
  ]);
540
540
  }
541
- const F = /* @__PURE__ */ T(he, [["render", $e]]), Ie = V({
542
- components: { NodeRedInputLabel: w },
541
+ const M = /* @__PURE__ */ T(he, [["render", $e]]), Ie = V({
542
+ components: { NodeRedInputLabel: S },
543
543
  props: {
544
544
  modelValue: {
545
545
  type: String,
@@ -850,7 +850,7 @@ function ke(e, t, n, r, s, d) {
850
850
  /* NEED_PATCH */
851
851
  );
852
852
  }
853
- const P = /* @__PURE__ */ T(Ie, [["render", ke], ["__scopeId", "data-v-ea93e881"]]), we = V({
853
+ const P = /* @__PURE__ */ T(Ie, [["render", ke], ["__scopeId", "data-v-ea93e881"]]), Se = V({
854
854
  name: "NodeRedToggle",
855
855
  props: {
856
856
  modelValue: {
@@ -864,6 +864,13 @@ const P = /* @__PURE__ */ T(Ie, [["render", ke], ["__scopeId", "data-v-ea93e881"
864
864
  icon: {
865
865
  type: String,
866
866
  default: ""
867
+ },
868
+ /** Accessible name for the control when no visible `label` is rendered
869
+ * (e.g. a bare toggle in a table cell where the column header is the
870
+ * visible label but isn't programmatically associated). */
871
+ ariaLabel: {
872
+ type: String,
873
+ default: ""
867
874
  }
868
875
  },
869
876
  emits: ["update:modelValue"],
@@ -872,33 +879,34 @@ const P = /* @__PURE__ */ T(Ie, [["render", ke], ["__scopeId", "data-v-ea93e881"
872
879
  return this.icon ? `fa ${this.icon.startsWith("fa-") ? this.icon : `fa-${this.icon}`}` : "";
873
880
  }
874
881
  }
875
- }), Se = { class: "nrg-toggle-wrapper" }, qe = ["checked"], Re = {
882
+ }), we = { class: "nrg-toggle-wrapper" }, qe = ["checked", "aria-label"], Ne = {
876
883
  key: 0,
877
884
  class: "nrg-toggle__label"
878
885
  };
879
- function Ne(e, t, n, r, s, d) {
880
- return l(), c("div", Se, [
886
+ function Re(e, t, n, r, s, d) {
887
+ return l(), c("div", we, [
881
888
  m(
882
889
  "label",
883
890
  {
884
- class: N(["nrg-toggle", { "nrg-toggle--checked": e.modelValue }])
891
+ class: R(["nrg-toggle", { "nrg-toggle--checked": e.modelValue }])
885
892
  },
886
893
  [
887
894
  m("input", {
888
895
  type: "checkbox",
889
896
  checked: e.modelValue,
890
897
  class: "nrg-toggle__input",
898
+ "aria-label": e.ariaLabel || void 0,
891
899
  onChange: t[0] || (t[0] = (a) => e.$emit(
892
900
  "update:modelValue",
893
901
  a.target.checked
894
902
  ))
895
903
  }, null, 40, qe),
896
- e.icon || e.label ? (l(), c("span", Re, [
904
+ e.icon || e.label ? (l(), c("span", Ne, [
897
905
  e.icon ? (l(), c(
898
906
  "i",
899
907
  {
900
908
  key: 0,
901
- class: N(e.iconClass)
909
+ class: R(e.iconClass)
902
910
  },
903
911
  null,
904
912
  2
@@ -923,7 +931,7 @@ function Ne(e, t, n, r, s, d) {
923
931
  )
924
932
  ]);
925
933
  }
926
- const z = /* @__PURE__ */ T(we, [["render", Ne], ["__scopeId", "data-v-724dcae4"]]), _e = /* @__PURE__ */ new Set([
934
+ const z = /* @__PURE__ */ T(Se, [["render", Re], ["__scopeId", "data-v-4657f355"]]), _e = /* @__PURE__ */ new Set([
927
935
  "id",
928
936
  "type",
929
937
  "x",
@@ -940,16 +948,16 @@ const z = /* @__PURE__ */ T(we, [["render", Ne], ["__scopeId", "data-v-724dcae4"
940
948
  "outputReturnProperties",
941
949
  ...ie
942
950
  ]);
943
- function Le(e) {
951
+ function je(e) {
944
952
  return e.replace(/([A-Z])/g, " $1").replace(/^./, (t) => t.toUpperCase()).trim();
945
953
  }
946
- function je(e) {
954
+ function Le(e) {
947
955
  var t, n;
948
956
  return e.type === "object" && !!((t = e.properties) != null && t.value) && !!((n = e.properties) != null && n.type);
949
957
  }
950
958
  function C(e, t, n, r) {
951
- var b;
952
- const s = r || t.title || Le(e), d = t["x-nrg-form"] ?? {}, a = d.icon || "";
959
+ var I;
960
+ const s = r || t.title || je(e), d = t["x-nrg-form"] ?? {}, a = d.icon || "";
953
961
  if (t["x-nrg-node-type"])
954
962
  return {
955
963
  key: e,
@@ -959,7 +967,7 @@ function C(e, t, n, r) {
959
967
  required: n,
960
968
  configType: t["x-nrg-node-type"]
961
969
  };
962
- if (je(t))
970
+ if (Le(t))
963
971
  return {
964
972
  key: e,
965
973
  label: s,
@@ -969,7 +977,7 @@ function C(e, t, n, r) {
969
977
  // serialized schemas carry plain strings; trust them as typed-input type names
970
978
  types: d.typedInputTypes
971
979
  };
972
- if (t.type === "array" && ((b = t.items) != null && b.enum))
980
+ if (t.type === "array" && ((I = t.items) != null && I.enum))
973
981
  return {
974
982
  key: e,
975
983
  label: s,
@@ -1049,9 +1057,8 @@ function C(e, t, n, r) {
1049
1057
  key: e,
1050
1058
  label: s,
1051
1059
  icon: a,
1052
- inputType: "text",
1053
- required: n,
1054
- htmlType: "text"
1060
+ inputType: "object-json",
1061
+ required: n
1055
1062
  };
1056
1063
  default:
1057
1064
  return d.editorLanguage ? {
@@ -1074,12 +1081,12 @@ function C(e, t, n, r) {
1074
1081
  const Ce = V({
1075
1082
  name: "NodeRedJsonSchemaForm",
1076
1083
  components: {
1077
- NodeRedInputLabel: w,
1084
+ NodeRedInputLabel: S,
1078
1085
  NodeRedToggle: z,
1079
- NodeRedInput: B,
1080
- NodeRedSelectInput: F,
1081
- NodeRedTypedInput: U,
1082
- NodeRedConfigInput: M,
1086
+ NodeRedInput: U,
1087
+ NodeRedSelectInput: M,
1088
+ NodeRedTypedInput: B,
1089
+ NodeRedConfigInput: F,
1083
1090
  NodeRedEditorInput: P
1084
1091
  },
1085
1092
  props: {
@@ -1131,23 +1138,35 @@ const Ce = V({
1131
1138
  }
1132
1139
  },
1133
1140
  methods: {
1141
+ // Parse a JSON-object field's textarea into a real object so AJV's
1142
+ // `type: "object"` validates and the saved value is an object. On invalid
1143
+ // JSON, keep the raw string so the type error surfaces instead of being
1144
+ // silently swallowed. Runs on blur (`@change`) so typing isn't reformatted.
1145
+ setObjectField(e, t) {
1146
+ const n = this.node;
1147
+ try {
1148
+ n[e] = JSON.parse(t);
1149
+ } catch {
1150
+ n[e] = t;
1151
+ }
1152
+ },
1134
1153
  resolveI18n(e, t) {
1135
1154
  const n = this.$i18n(`${e}.${t}`), r = `${this.node.type}.${e}.${t}`;
1136
1155
  if (n && n !== r && n !== `${e}.${t}`)
1137
1156
  return n;
1138
1157
  }
1139
1158
  }
1140
- }), Ae = { key: 1 }, Oe = { key: 2 }, De = ["checked", "onChange"], We = { key: 6 }, Be = ["value", "onInput"], Ue = {
1159
+ }), Oe = { key: 1 }, Ae = { key: 2 }, De = ["checked", "onChange"], We = { key: 6 }, Ue = ["value", "onInput"], Be = {
1141
1160
  key: 0,
1142
1161
  class: "node-red-vue-input-error-message"
1143
1162
  };
1144
- function Me(e, t, n, r, s, d) {
1145
- const a = g("NodeRedInput"), h = g("NodeRedToggle"), b = g("NodeRedInputLabel"), i = g("NodeRedSelectInput"), u = g("NodeRedTypedInput"), y = g("NodeRedConfigInput"), I = g("NodeRedEditorInput");
1163
+ function Fe(e, t, n, r, s, d) {
1164
+ const a = g("NodeRedInput"), h = g("NodeRedToggle"), I = g("NodeRedInputLabel"), i = g("NodeRedSelectInput"), u = g("NodeRedTypedInput"), y = g("NodeRedConfigInput"), b = g("NodeRedEditorInput");
1146
1165
  return l(), c("div", null, [
1147
1166
  (l(!0), c(
1148
1167
  _,
1149
1168
  null,
1150
- L(e.configFields, (o) => (l(), c("div", {
1169
+ j(e.configFields, (o) => (l(), c("div", {
1151
1170
  key: o.key,
1152
1171
  class: "form-row"
1153
1172
  }, [
@@ -1160,15 +1179,15 @@ function Me(e, t, n, r, s, d) {
1160
1179
  icon: o.icon,
1161
1180
  required: o.required,
1162
1181
  error: e.errors[`node.${o.key}`]
1163
- }, null, 8, ["value", "onUpdate:value", "type", "label", "icon", "required", "error"])) : o.inputType === "boolean" && o.toggle ? (l(), c("div", Ae, [
1164
- R(h, {
1182
+ }, null, 8, ["value", "onUpdate:value", "type", "label", "icon", "required", "error"])) : o.inputType === "boolean" && o.toggle ? (l(), c("div", Oe, [
1183
+ N(h, {
1165
1184
  "model-value": e.node[o.key],
1166
1185
  label: o.label,
1167
1186
  icon: o.icon,
1168
1187
  "onUpdate:modelValue": (p) => e.node[o.key] = p
1169
1188
  }, null, 8, ["model-value", "label", "icon", "onUpdate:modelValue"])
1170
- ])) : o.inputType === "boolean" ? (l(), c("div", Oe, [
1171
- R(b, {
1189
+ ])) : o.inputType === "boolean" ? (l(), c("div", Ae, [
1190
+ N(I, {
1172
1191
  label: o.label,
1173
1192
  icon: o.icon,
1174
1193
  required: o.required
@@ -1212,7 +1231,7 @@ function Me(e, t, n, r, s, d) {
1212
1231
  required: o.required,
1213
1232
  error: e.errors[`node.${o.key}`]
1214
1233
  }, null, 8, ["value", "onUpdate:value", "type", "node", "prop-name", "label", "icon", "required", "error"])) : o.inputType === "array-text" ? (l(), c("div", We, [
1215
- R(b, {
1234
+ N(I, {
1216
1235
  label: o.label,
1217
1236
  icon: o.icon,
1218
1237
  required: o.required
@@ -1231,16 +1250,25 @@ function Me(e, t, n, r, s, d) {
1231
1250
  style: { width: "100%", resize: "vertical", "font-family": "monospace", "font-size": "13px" },
1232
1251
  onInput: (p) => e.node[o.key] = p.target.value.split(`
1233
1252
  `).filter(Boolean)
1234
- }, null, 40, Be),
1253
+ }, null, 40, Ue),
1235
1254
  e.errors[`node.${o.key}`] ? (l(), c(
1236
1255
  "span",
1237
- Ue,
1256
+ Be,
1238
1257
  E(e.errors[`node.${o.key}`]),
1239
1258
  1
1240
1259
  /* TEXT */
1241
1260
  )) : f("v-if", !0)
1242
- ])) : o.inputType === "editor" ? (l(), v(I, {
1261
+ ])) : o.inputType === "object-json" ? (l(), v(b, {
1243
1262
  key: 7,
1263
+ value: typeof e.node[o.key] == "string" ? e.node[o.key] : JSON.stringify(e.node[o.key] ?? {}, null, 2),
1264
+ language: "json",
1265
+ label: o.label,
1266
+ icon: o.icon,
1267
+ required: o.required,
1268
+ error: e.errors[`node.${o.key}`],
1269
+ "onUpdate:value": (p) => e.setObjectField(o.key, p)
1270
+ }, null, 8, ["value", "label", "icon", "required", "error", "onUpdate:value"])) : o.inputType === "editor" ? (l(), v(b, {
1271
+ key: 8,
1244
1272
  value: e.node[o.key],
1245
1273
  "onUpdate:value": (p) => e.node[o.key] = p,
1246
1274
  language: o.language,
@@ -1256,11 +1284,11 @@ function Me(e, t, n, r, s, d) {
1256
1284
  (l(!0), c(
1257
1285
  _,
1258
1286
  null,
1259
- L(e.credentialFields, (o) => (l(), c("div", {
1287
+ j(e.credentialFields, (o) => (l(), c("div", {
1260
1288
  key: `cred-${o.key}`,
1261
1289
  class: "form-row"
1262
1290
  }, [
1263
- R(a, {
1291
+ N(a, {
1264
1292
  value: e.node.credentials[o.key],
1265
1293
  "onUpdate:value": (p) => e.node.credentials[o.key] = p,
1266
1294
  type: o.htmlType,
@@ -1275,8 +1303,8 @@ function Me(e, t, n, r, s, d) {
1275
1303
  ))
1276
1304
  ]);
1277
1305
  }
1278
- const Fe = /* @__PURE__ */ T(Ce, [["render", Me]]);
1279
- function A() {
1306
+ const Me = /* @__PURE__ */ T(Ce, [["render", Fe]]);
1307
+ function O() {
1280
1308
  const e = {
1281
1309
  get(t) {
1282
1310
  return e[t];
@@ -1317,12 +1345,12 @@ function He() {
1317
1345
  }
1318
1346
  };
1319
1347
  return i;
1320
- }, b = {
1348
+ }, I = {
1321
1349
  _: (i) => i,
1322
1350
  editor: {
1323
1351
  createEditor(i) {
1324
1352
  let u = (i == null ? void 0 : i.value) || "";
1325
- const y = {}, I = {
1353
+ const y = {}, b = {
1326
1354
  on(o, p) {
1327
1355
  (y[o] ?? (y[o] = [])).push(p);
1328
1356
  }
@@ -1332,7 +1360,7 @@ function He() {
1332
1360
  setValue: (o) => {
1333
1361
  u = o, (y.change ?? []).forEach((p) => p());
1334
1362
  },
1335
- getSession: () => I,
1363
+ getSession: () => b,
1336
1364
  focus: () => {
1337
1365
  },
1338
1366
  destroy: () => {
@@ -1409,8 +1437,8 @@ function He() {
1409
1437
  filterLinks(i) {
1410
1438
  return n.filter(
1411
1439
  (u) => {
1412
- var y, I, o, p;
1413
- return (i.source === void 0 || u.source === i.source || ((y = u.source) == null ? void 0 : y.id) === ((I = i.source) == null ? void 0 : I.id)) && (i.target === void 0 || u.target === i.target || ((o = u.target) == null ? void 0 : o.id) === ((p = i.target) == null ? void 0 : p.id));
1440
+ var y, b, o, p;
1441
+ return (i.source === void 0 || u.source === i.source || ((y = u.source) == null ? void 0 : y.id) === ((b = i.source) == null ? void 0 : b.id)) && (i.target === void 0 || u.target === i.target || ((o = u.target) == null ? void 0 : o.id) === ((p = i.target) == null ? void 0 : p.id));
1414
1442
  }
1415
1443
  );
1416
1444
  },
@@ -1444,7 +1472,7 @@ function He() {
1444
1472
  },
1445
1473
  unsubscribe(i, u) {
1446
1474
  const y = s.findIndex(
1447
- (I) => I.topic === i && I.callback === u
1475
+ (b) => b.topic === i && b.callback === u
1448
1476
  );
1449
1477
  y !== -1 && s.splice(y, 1);
1450
1478
  },
@@ -1452,7 +1480,7 @@ function He() {
1452
1480
  [...s].filter((y) => Pe(y.topic, i)).forEach((y) => y.callback(i, u));
1453
1481
  }
1454
1482
  },
1455
- settings: A(),
1483
+ settings: O(),
1456
1484
  notify: () => ({
1457
1485
  update: () => {
1458
1486
  },
@@ -1460,23 +1488,23 @@ function He() {
1460
1488
  }
1461
1489
  })
1462
1490
  };
1463
- return Object.defineProperty(b, "__reset", {
1491
+ return Object.defineProperty(I, "__reset", {
1464
1492
  enumerable: !1,
1465
1493
  value: () => {
1466
1494
  e.clear(), t.clear(), n.length = 0;
1467
1495
  for (const i of Object.keys(r))
1468
1496
  delete r[i];
1469
- s.length = 0, d = !1, b.settings = A();
1497
+ s.length = 0, d = !1, I.settings = O();
1470
1498
  }
1471
- }), b;
1499
+ }), I;
1472
1500
  }
1473
- function O() {
1501
+ function A() {
1474
1502
  return { typedInput: { value: "", type: "" }, listeners: {} };
1475
1503
  }
1476
1504
  function Je(e) {
1477
- return e && !e.__jqState && (e.__jqState = O()), e ? e.__jqState : O();
1505
+ return e && !e.__jqState && (e.__jqState = A()), e ? e.__jqState : A();
1478
1506
  }
1479
- function S(e) {
1507
+ function w(e) {
1480
1508
  const t = Je(e), n = {
1481
1509
  0: e,
1482
1510
  length: e ? 1 : 0,
@@ -1545,7 +1573,7 @@ function S(e) {
1545
1573
  return r !== void 0 ? ((e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement) && (e.value = String(r)), n) : e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement ? e.value : "";
1546
1574
  },
1547
1575
  find(r) {
1548
- return S((e == null ? void 0 : e.querySelector(r)) ?? null);
1576
+ return w((e == null ? void 0 : e.querySelector(r)) ?? null);
1549
1577
  },
1550
1578
  append(r) {
1551
1579
  const s = (r == null ? void 0 : r[0]) || r;
@@ -1586,11 +1614,11 @@ function Ke() {
1586
1614
  if (s && n)
1587
1615
  for (const [d, a] of Object.entries(n))
1588
1616
  d === "html" ? s.innerHTML = String(a) : s.setAttribute(d, String(a));
1589
- return S(s);
1617
+ return w(s);
1590
1618
  }
1591
- return S(document.querySelector(t));
1619
+ return w(document.querySelector(t));
1592
1620
  }
1593
- return t instanceof Element || t && typeof t == "object" && t.nodeType ? S(t) : S(null);
1621
+ return t instanceof Element || t && typeof t == "object" && t.nodeType ? w(t) : w(null);
1594
1622
  };
1595
1623
  }
1596
1624
  function Qe() {
@@ -1600,13 +1628,13 @@ function Qe() {
1600
1628
  }
1601
1629
  D.global.mocks.$i18n = (e) => e;
1602
1630
  D.global.components = {
1603
- NodeRedInputLabel: w,
1631
+ NodeRedInputLabel: S,
1604
1632
  NodeRedToggle: z,
1605
- NodeRedInput: B,
1606
- NodeRedTypedInput: U,
1607
- NodeRedConfigInput: M,
1608
- NodeRedSelectInput: F,
1633
+ NodeRedInput: U,
1634
+ NodeRedTypedInput: B,
1635
+ NodeRedConfigInput: F,
1636
+ NodeRedSelectInput: M,
1609
1637
  NodeRedEditorInput: P,
1610
- NodeRedJsonSchemaForm: Fe
1638
+ NodeRedJsonSchemaForm: Me
1611
1639
  };
1612
1640
  Qe();
@@ -703,11 +703,17 @@ function packageJsonGenerator(options) {
703
703
  distDependencies = void 0;
704
704
  }
705
705
  const distPackageJson = {
706
- ...rootPackageJson,
706
+ name: rootPackageJson.name,
707
+ version: rootPackageJson.version,
708
+ description: rootPackageJson.description,
709
+ author: rootPackageJson.author,
710
+ license: rootPackageJson.license,
711
+ homepage: rootPackageJson.homepage,
712
+ repository: rootPackageJson.repository,
713
+ bugs: rootPackageJson.bugs,
714
+ engines: rootPackageJson.engines,
707
715
  main: "index.js",
708
716
  type: "commonjs",
709
- devDependencies: void 0,
710
- scripts: void 0,
711
717
  dependencies: distDependencies,
712
718
  keywords: [
713
719
  .../* @__PURE__ */ new Set([...rootPackageJson.keywords ?? [], "node-red"])
@@ -1856,8 +1862,8 @@ function localesGenerator(options) {
1856
1862
  }
1857
1863
  },
1858
1864
  help: {
1859
- validateInput: "\u5728 input() \u8FD0\u884C\u524D\uFF0C\u6839\u636E\u8F93\u5165\u6A21\u5F0F\u6821\u9A8C\u4F20\u5165\u6D88\u606F\u3002",
1860
- outputs: "\u6309\u7AEF\u53E3\u7684\u8F93\u51FA\u8BBE\u7F6E\u3002\u9A8C\u8BC1\u6570\u636E\u6839\u636E\u7AEF\u53E3\u6A21\u5F0F\u6821\u9A8C\u53D1\u9001\u7684\u503C\uFF1B\u4E0A\u4E0B\u6587\u6A21\u5F0F\u63A7\u5236\u5982\u4F55\u643A\u5E26\u4F20\u5165\u6D88\u606F\u3002",
1865
+ validateInput: "\u5728 input() \u8FD0\u884C\u524D\uFF0C\u6839\u636E\u8F93\u5165\u7ED3\u6784\u63CF\u8FF0\u6821\u9A8C\u4F20\u5165\u6D88\u606F\u3002",
1866
+ outputs: "\u6309\u7AEF\u53E3\u7684\u8F93\u51FA\u8BBE\u7F6E\u3002\u9A8C\u8BC1\u6570\u636E\u6839\u636E\u7AEF\u53E3\u7ED3\u6784\u63CF\u8FF0\u6821\u9A8C\u53D1\u9001\u7684\u503C\uFF1B\u4E0A\u4E0B\u6587\u6A21\u5F0F\u63A7\u5236\u5982\u4F55\u643A\u5E26\u4F20\u5165\u6D88\u606F\u3002",
1861
1867
  lifecyclePorts: "\u53EF\u9009\u7684\u989D\u5916\u8F93\u51FA\u7AEF\u53E3\uFF0C\u5728\u51FA\u9519\u3001\u5B8C\u6210\u4EE5\u53CA\u6BCF\u6B21\u72B6\u6001\u53D8\u5316\u65F6\u89E6\u53D1\u3002",
1862
1868
  learnMore: "\u4E86\u89E3\u66F4\u591A"
1863
1869
  }
@@ -1,9 +1,3 @@
1
- import { fileURLToPath as __nrgFileURLToPath } from "url";
2
- import { dirname as __nrgDirname } from "path";
3
- var __filename = __nrgFileURLToPath(import.meta.url);
4
- var __dirname = __nrgDirname(__filename);
5
-
6
-
7
1
  // src/test/server/integration/config.ts
8
2
  import path from "path";
9
3
  var defaultConfig = {
@@ -1,9 +1,3 @@
1
- import { fileURLToPath as __nrgFileURLToPath } from "url";
2
- import { dirname as __nrgDirname } from "path";
3
- var __filename = __nrgFileURLToPath(import.meta.url);
4
- var __dirname = __nrgDirname(__filename);
5
-
6
-
7
1
  // src/test/server/integration/runtime.ts
8
2
  import http from "http";
9
3
  import os from "os";
@@ -126,14 +120,16 @@ function setupContext(context, store) {
126
120
  await set(key, next);
127
121
  return next;
128
122
  };
129
- const run = (chains.get(lockKey) ?? Promise.resolve()).then(task, task);
130
- chains.set(
131
- lockKey,
132
- run.then(
133
- () => void 0,
134
- () => void 0
135
- )
123
+ const previous = chains.get(lockKey) ?? Promise.resolve();
124
+ const run = previous.then(task, task);
125
+ const settled = run.then(
126
+ () => void 0,
127
+ () => void 0
136
128
  );
129
+ chains.set(lockKey, settled);
130
+ void settled.then(() => {
131
+ if (chains.get(lockKey) === settled) chains.delete(lockKey);
132
+ });
137
133
  return run;
138
134
  };
139
135
  const increment = (key, by = 1) => {
@@ -1,9 +1,3 @@
1
- import { fileURLToPath as __nrgFileURLToPath } from "url";
2
- import { dirname as __nrgDirname } from "path";
3
- var __filename = __nrgFileURLToPath(import.meta.url);
4
- var __dirname = __nrgDirname(__filename);
5
-
6
-
7
1
  // src/test/server/unit/config.ts
8
2
  import path from "path";
9
3
  var defaultConfig = {
@@ -1,9 +1,3 @@
1
- import { fileURLToPath as __nrgFileURLToPath } from "url";
2
- import { dirname as __nrgDirname } from "path";
3
- var __filename = __nrgFileURLToPath(import.meta.url);
4
- var __dirname = __nrgDirname(__filename);
5
-
6
-
7
1
  // src/test/server/unit/index.ts
8
2
  import { vi as vi2 } from "vitest";
9
3
 
@@ -403,9 +397,7 @@ function initValidator(RED) {
403
397
  }
404
398
  ],
405
399
  customFormats: {
406
- "node-id": /^[a-zA-Z0-9-_]+$/,
407
- "flow-id": /^[a-f0-9]{16}$/,
408
- "topic-path": (data) => /^[a-zA-Z0-9/_-]+$/.test(data)
400
+ "node-id": /^[a-zA-Z0-9-_]+$/
409
401
  }
410
402
  })
411
403
  };
package/types/client.d.ts CHANGED
@@ -8,13 +8,16 @@ interface NodeRefResolved<T = any> {
8
8
  readonly __nrg_node_ref: true;
9
9
  readonly __instance: T;
10
10
  }
11
- interface TypedInputResolved {
12
- resolve(...args: any[]): any;
13
- value: unknown;
14
- type: string;
11
+ interface TypedInputResolved<T = unknown> {
12
+ readonly __nrg_typed_input: true;
13
+ readonly __value: T;
14
+ }
15
+ interface UnsafeResolved<T = unknown> {
16
+ readonly __nrg_unsafe: true;
17
+ readonly __value: T;
15
18
  }
16
19
  interface JsonSchemaObjectExtensions {
17
- format?: "node-id" | "flow-id" | "topic-path" | (string & {});
20
+ format?: "node-id" | (string & {});
18
21
  /** expose this settings property to the editor via RED.settings */
19
22
  exportable?: boolean;
20
23
  /** set by SchemaType.NodeRef — the referenced config node type */
@@ -233,7 +236,7 @@ export interface TypedInputValue {
233
236
  * - `TypedInput<T>` → `TypedInputValue` (raw value + type pair)
234
237
  * - Functions pass through, arrays and objects map recursively
235
238
  */
236
- export type EditorStatic<T> = T extends NodeRefResolved<any> ? string : T extends TypedInputResolved ? TypedInputValue : T extends (...args: any[]) => any ? T : T extends Array<infer I> ? EditorStatic<I>[] : T extends object ? {
239
+ export type EditorStatic<T> = T extends NodeRefResolved<any> ? string : T extends TypedInputResolved<any> ? TypedInputValue : T extends UnsafeResolved<infer V> ? V : T extends (...args: any[]) => any ? T : T extends Array<infer I> ? EditorStatic<I>[] : T extends object ? {
237
240
  [K in keyof T]: EditorStatic<T[K]>;
238
241
  } : T;
239
242
  /**
@@ -244,6 +247,9 @@ export type EditorStatic<T> = T extends NodeRefResolved<any> ? string : T extend
244
247
  * - `TypedInput<T>` → `{ value: string; type: string }`
245
248
  * - All other types resolve via TypeBox's `Static<T>`
246
249
  *
250
+ * Accepts a single schema or a record of schemas (e.g. an outputs map),
251
+ * mirroring the server `Infer` so the same pattern compiles on both planes.
252
+ *
247
253
  * @example
248
254
  * ```ts
249
255
  * import type { Infer } from "@bonsae/nrg/client";
@@ -252,7 +258,9 @@ export type EditorStatic<T> = T extends NodeRefResolved<any> ? string : T extend
252
258
  * type Config = Infer<typeof ConfigSchema>;
253
259
  * ```
254
260
  */
255
- export type Infer<T extends TSchema> = EditorStatic<Static<T>>;
261
+ export type Infer<T extends TSchema | Record<string, TSchema>> = T extends TSchema ? EditorStatic<Static<T>> : {
262
+ [K in keyof T & string]: T[K] extends TSchema ? EditorStatic<Static<T[K]>> : never;
263
+ };
256
264
 
257
265
  export {};
258
266