@lotics/cli 0.35.0 → 0.36.1
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/README.md +33 -15
- package/dist/args.d.ts +2 -0
- package/dist/args.js +9 -0
- package/dist/args.test.js +28 -0
- package/dist/cli.js +224 -81
- package/dist/config.d.ts +102 -16
- package/dist/config.js +214 -25
- package/dist/config.test.js +229 -22
- package/dist/dev/wrapper_page.js +16 -0
- package/dist/src/cli.js +1290 -553
- package/dist/starter_template.d.ts +10 -0
- package/dist/starter_template.js +21 -1
- package/dist/starter_template.test.js +18 -1
- package/package.json +2 -2
package/dist/src/cli.js
CHANGED
|
@@ -120,7 +120,7 @@ var require_helpers = __commonJS({
|
|
|
120
120
|
* @returns {*}
|
|
121
121
|
*/
|
|
122
122
|
flattenDeep(arr1) {
|
|
123
|
-
return arr1.reduce((acc,
|
|
123
|
+
return arr1.reduce((acc, val) => Array.isArray(val) ? acc.concat(this.flattenDeep(val)) : acc.concat(val), []);
|
|
124
124
|
}
|
|
125
125
|
/**
|
|
126
126
|
*
|
|
@@ -768,11 +768,11 @@ var require_ssf = __commonJS({
|
|
|
768
768
|
function fix_hijri() {
|
|
769
769
|
return 0;
|
|
770
770
|
}
|
|
771
|
-
function write_date(type, fmt,
|
|
772
|
-
let o = "", ss = 0, tt = 0, y =
|
|
771
|
+
function write_date(type, fmt, val, ss0) {
|
|
772
|
+
let o = "", ss = 0, tt = 0, y = val.y, out, outl = 0;
|
|
773
773
|
switch (type) {
|
|
774
774
|
case 98:
|
|
775
|
-
y =
|
|
775
|
+
y = val.y + 543;
|
|
776
776
|
/* falls through */
|
|
777
777
|
case 121:
|
|
778
778
|
switch (fmt.length) {
|
|
@@ -791,35 +791,35 @@ var require_ssf = __commonJS({
|
|
|
791
791
|
switch (fmt.length) {
|
|
792
792
|
case 1:
|
|
793
793
|
case 2:
|
|
794
|
-
out =
|
|
794
|
+
out = val.m;
|
|
795
795
|
outl = fmt.length;
|
|
796
796
|
break;
|
|
797
797
|
case 3:
|
|
798
|
-
return months[
|
|
798
|
+
return months[val.m - 1][1];
|
|
799
799
|
case 5:
|
|
800
|
-
return months[
|
|
800
|
+
return months[val.m - 1][0];
|
|
801
801
|
default:
|
|
802
|
-
return months[
|
|
802
|
+
return months[val.m - 1][2];
|
|
803
803
|
}
|
|
804
804
|
break;
|
|
805
805
|
case 100:
|
|
806
806
|
switch (fmt.length) {
|
|
807
807
|
case 1:
|
|
808
808
|
case 2:
|
|
809
|
-
out =
|
|
809
|
+
out = val.d;
|
|
810
810
|
outl = fmt.length;
|
|
811
811
|
break;
|
|
812
812
|
case 3:
|
|
813
|
-
return days[
|
|
813
|
+
return days[val.q][0];
|
|
814
814
|
default:
|
|
815
|
-
return days[
|
|
815
|
+
return days[val.q][1];
|
|
816
816
|
}
|
|
817
817
|
break;
|
|
818
818
|
case 104:
|
|
819
819
|
switch (fmt.length) {
|
|
820
820
|
case 1:
|
|
821
821
|
case 2:
|
|
822
|
-
out = 1 + (
|
|
822
|
+
out = 1 + (val.H + 11) % 12;
|
|
823
823
|
outl = fmt.length;
|
|
824
824
|
break;
|
|
825
825
|
default:
|
|
@@ -830,7 +830,7 @@ var require_ssf = __commonJS({
|
|
|
830
830
|
switch (fmt.length) {
|
|
831
831
|
case 1:
|
|
832
832
|
case 2:
|
|
833
|
-
out =
|
|
833
|
+
out = val.H;
|
|
834
834
|
outl = fmt.length;
|
|
835
835
|
break;
|
|
836
836
|
default:
|
|
@@ -841,7 +841,7 @@ var require_ssf = __commonJS({
|
|
|
841
841
|
switch (fmt.length) {
|
|
842
842
|
case 1:
|
|
843
843
|
case 2:
|
|
844
|
-
out =
|
|
844
|
+
out = val.M;
|
|
845
845
|
outl = fmt.length;
|
|
846
846
|
break;
|
|
847
847
|
default:
|
|
@@ -850,10 +850,10 @@ var require_ssf = __commonJS({
|
|
|
850
850
|
break;
|
|
851
851
|
case 115:
|
|
852
852
|
if (fmt !== "s" && fmt !== "ss" && fmt !== ".0" && fmt !== ".00" && fmt !== ".000") throw "bad second format: " + fmt;
|
|
853
|
-
if (
|
|
853
|
+
if (val.u === 0 && (fmt === "s" || fmt === "ss")) return pad0(val.S, fmt.length);
|
|
854
854
|
if (ss0 >= 2) tt = ss0 === 3 ? 1e3 : 100;
|
|
855
855
|
else tt = ss0 === 1 ? 10 : 1;
|
|
856
|
-
ss = Math.round(tt * (
|
|
856
|
+
ss = Math.round(tt * (val.S + val.u));
|
|
857
857
|
if (ss >= 60 * tt) ss = 0;
|
|
858
858
|
if (fmt === "s") return ss === 0 ? "0" : "" + ss / tt;
|
|
859
859
|
o = pad0(ss, 2 + ss0);
|
|
@@ -863,15 +863,15 @@ var require_ssf = __commonJS({
|
|
|
863
863
|
switch (fmt) {
|
|
864
864
|
case "[h]":
|
|
865
865
|
case "[hh]":
|
|
866
|
-
out =
|
|
866
|
+
out = val.D * 24 + val.H;
|
|
867
867
|
break;
|
|
868
868
|
case "[m]":
|
|
869
869
|
case "[mm]":
|
|
870
|
-
out = (
|
|
870
|
+
out = (val.D * 24 + val.H) * 60 + val.M;
|
|
871
871
|
break;
|
|
872
872
|
case "[s]":
|
|
873
873
|
case "[ss]":
|
|
874
|
-
out = ((
|
|
874
|
+
out = ((val.D * 24 + val.H) * 60 + val.M) * 60 + Math.round(val.S + val.u);
|
|
875
875
|
break;
|
|
876
876
|
default:
|
|
877
877
|
throw "bad abstime format: " + fmt;
|
|
@@ -894,28 +894,28 @@ var require_ssf = __commonJS({
|
|
|
894
894
|
}
|
|
895
895
|
var write_num = /* @__PURE__ */ (function make_write_num() {
|
|
896
896
|
const pct1 = /%/g;
|
|
897
|
-
function write_num_pct(type, fmt,
|
|
897
|
+
function write_num_pct(type, fmt, val) {
|
|
898
898
|
const sfmt = fmt.replace(pct1, ""), mul = fmt.length - sfmt.length;
|
|
899
|
-
return write_num(type, sfmt,
|
|
899
|
+
return write_num(type, sfmt, val * Math.pow(10, 2 * mul)) + fill("%", mul);
|
|
900
900
|
}
|
|
901
|
-
function write_num_cm(type, fmt,
|
|
901
|
+
function write_num_cm(type, fmt, val) {
|
|
902
902
|
let idx = fmt.length - 1;
|
|
903
903
|
while (fmt.charCodeAt(idx - 1) === 44) --idx;
|
|
904
|
-
return write_num(type, fmt.substr(0, idx),
|
|
904
|
+
return write_num(type, fmt.substr(0, idx), val / Math.pow(10, 3 * (fmt.length - idx)));
|
|
905
905
|
}
|
|
906
|
-
function write_num_exp(fmt,
|
|
906
|
+
function write_num_exp(fmt, val) {
|
|
907
907
|
let o;
|
|
908
908
|
let idx = fmt.indexOf("E") - fmt.indexOf(".") - 1;
|
|
909
909
|
if (fmt.match(/^#+0.0E\+0$/)) {
|
|
910
|
-
if (
|
|
911
|
-
else if (
|
|
910
|
+
if (val === 0) return "0.0E+0";
|
|
911
|
+
else if (val < 0) return "-" + write_num_exp(fmt, -val);
|
|
912
912
|
let period = fmt.indexOf(".");
|
|
913
913
|
if (period === -1) period = fmt.indexOf("E");
|
|
914
|
-
let ee = Math.floor(Math.log(
|
|
914
|
+
let ee = Math.floor(Math.log(val) * Math.LOG10E) % period;
|
|
915
915
|
if (ee < 0) ee += period;
|
|
916
|
-
o = (
|
|
916
|
+
o = (val / Math.pow(10, ee)).toPrecision(idx + 1 + (period + ee) % period);
|
|
917
917
|
if (o.indexOf("e") === -1) {
|
|
918
|
-
const fakee = Math.floor(Math.log(
|
|
918
|
+
const fakee = Math.floor(Math.log(val) * Math.LOG10E);
|
|
919
919
|
if (o.indexOf(".") === -1) o = o.charAt(0) + "." + o.substr(1) + "E+" + (fakee - o.length + ee);
|
|
920
920
|
else o += "E+" + (fakee - ee);
|
|
921
921
|
while (o.substr(0, 2) === "0.") {
|
|
@@ -927,7 +927,7 @@ var require_ssf = __commonJS({
|
|
|
927
927
|
o = o.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/, function($$, $1, $2, $3) {
|
|
928
928
|
return $1 + $2 + $3.substr(0, (period + ee) % period) + "." + $3.substr(ee) + "E";
|
|
929
929
|
});
|
|
930
|
-
} else o =
|
|
930
|
+
} else o = val.toExponential(idx);
|
|
931
931
|
if (fmt.match(/E\+00$/) && o.match(/e[+-]\d$/)) o = o.substr(0, o.length - 1) + "0" + o.charAt(o.length - 1);
|
|
932
932
|
if (fmt.match(/E\-/) && o.match(/e\+/)) o = o.replace(/e\+/, "e");
|
|
933
933
|
return o.replace("e", "E");
|
|
@@ -960,48 +960,48 @@ var require_ssf = __commonJS({
|
|
|
960
960
|
}
|
|
961
961
|
return o;
|
|
962
962
|
}
|
|
963
|
-
function rnd(
|
|
963
|
+
function rnd(val, d) {
|
|
964
964
|
const dd = Math.pow(10, d);
|
|
965
|
-
return "" + Math.round(
|
|
965
|
+
return "" + Math.round(val * dd) / dd;
|
|
966
966
|
}
|
|
967
|
-
function dec(
|
|
968
|
-
if (d < ("" + Math.round((
|
|
967
|
+
function dec(val, d) {
|
|
968
|
+
if (d < ("" + Math.round((val - Math.floor(val)) * Math.pow(10, d))).length) {
|
|
969
969
|
return 0;
|
|
970
970
|
}
|
|
971
|
-
return Math.round((
|
|
971
|
+
return Math.round((val - Math.floor(val)) * Math.pow(10, d));
|
|
972
972
|
}
|
|
973
|
-
function carry(
|
|
974
|
-
if (d < ("" + Math.round((
|
|
973
|
+
function carry(val, d) {
|
|
974
|
+
if (d < ("" + Math.round((val - Math.floor(val)) * Math.pow(10, d))).length) {
|
|
975
975
|
return 1;
|
|
976
976
|
}
|
|
977
977
|
return 0;
|
|
978
978
|
}
|
|
979
|
-
function flr(
|
|
980
|
-
if (
|
|
981
|
-
return "" + Math.floor(
|
|
979
|
+
function flr(val) {
|
|
980
|
+
if (val < 2147483647 && val > -2147483648) return "" + (val >= 0 ? val | 0 : val - 1 | 0);
|
|
981
|
+
return "" + Math.floor(val);
|
|
982
982
|
}
|
|
983
|
-
function write_num_flt(type, fmt,
|
|
983
|
+
function write_num_flt(type, fmt, val) {
|
|
984
984
|
if (type.charCodeAt(0) === 40 && !fmt.match(closeparen)) {
|
|
985
985
|
const ffmt = fmt.replace(/\( */, "").replace(/ \)/, "").replace(/\)/, "");
|
|
986
|
-
if (
|
|
987
|
-
return "(" + write_num_flt("n", ffmt, -
|
|
986
|
+
if (val >= 0) return write_num_flt("n", ffmt, val);
|
|
987
|
+
return "(" + write_num_flt("n", ffmt, -val) + ")";
|
|
988
988
|
}
|
|
989
|
-
if (fmt.charCodeAt(fmt.length - 1) === 44) return write_num_cm(type, fmt,
|
|
990
|
-
if (fmt.indexOf("%") !== -1) return write_num_pct(type, fmt,
|
|
991
|
-
if (fmt.indexOf("E") !== -1) return write_num_exp(fmt,
|
|
992
|
-
if (fmt.charCodeAt(0) === 36) return "$" + write_num_flt(type, fmt.substr(fmt.charAt(1) == " " ? 2 : 1),
|
|
989
|
+
if (fmt.charCodeAt(fmt.length - 1) === 44) return write_num_cm(type, fmt, val);
|
|
990
|
+
if (fmt.indexOf("%") !== -1) return write_num_pct(type, fmt, val);
|
|
991
|
+
if (fmt.indexOf("E") !== -1) return write_num_exp(fmt, val);
|
|
992
|
+
if (fmt.charCodeAt(0) === 36) return "$" + write_num_flt(type, fmt.substr(fmt.charAt(1) == " " ? 2 : 1), val);
|
|
993
993
|
let o;
|
|
994
|
-
let r, ri, ff, aval = Math.abs(
|
|
994
|
+
let r, ri, ff, aval = Math.abs(val), sign = val < 0 ? "-" : "";
|
|
995
995
|
if (fmt.match(/^00+$/)) return sign + pad0r(aval, fmt.length);
|
|
996
996
|
if (fmt.match(/^[#?]+$/)) {
|
|
997
|
-
o = pad0r(
|
|
997
|
+
o = pad0r(val, 0);
|
|
998
998
|
if (o === "0") o = "";
|
|
999
999
|
return o.length > fmt.length ? o : hashq(fmt.substr(0, fmt.length - o.length)) + o;
|
|
1000
1000
|
}
|
|
1001
1001
|
if (r = fmt.match(frac1)) return write_num_f1(r, aval, sign);
|
|
1002
1002
|
if (fmt.match(/^#+0+$/)) return sign + pad0r(aval, fmt.length - fmt.indexOf("0"));
|
|
1003
1003
|
if (r = fmt.match(dec1)) {
|
|
1004
|
-
o = rnd(
|
|
1004
|
+
o = rnd(val, r[1].length).replace(/^([^\.]+)$/, "$1." + hashq(r[1])).replace(/\.$/, "." + hashq(r[1])).replace(/\.(\d*)$/, function($$, $1) {
|
|
1005
1005
|
return "." + $1 + fill("0", hashq(r[1]).length - $1.length);
|
|
1006
1006
|
});
|
|
1007
1007
|
return fmt.indexOf("0.") !== -1 ? o : o.replace(/^0\./, ".");
|
|
@@ -1012,18 +1012,18 @@ var require_ssf = __commonJS({
|
|
|
1012
1012
|
}
|
|
1013
1013
|
if (r = fmt.match(/^#{1,3},##0(\.?)$/)) return sign + commaify(pad0r(aval, 0));
|
|
1014
1014
|
if (r = fmt.match(/^#,##0\.([#0]*0)$/)) {
|
|
1015
|
-
return
|
|
1015
|
+
return val < 0 ? "-" + write_num_flt(type, fmt, -val) : commaify("" + (Math.floor(val) + carry(val, r[1].length))) + "." + pad0(dec(val, r[1].length), r[1].length);
|
|
1016
1016
|
}
|
|
1017
|
-
if (r = fmt.match(/^#,#*,#0/)) return write_num_flt(type, fmt.replace(/^#,#*,/, ""),
|
|
1017
|
+
if (r = fmt.match(/^#,#*,#0/)) return write_num_flt(type, fmt.replace(/^#,#*,/, ""), val);
|
|
1018
1018
|
if (r = fmt.match(/^([0#]+)(\\?-([0#]+))+$/)) {
|
|
1019
|
-
o = _strrev(write_num_flt(type, fmt.replace(/[\\-]/g, ""),
|
|
1019
|
+
o = _strrev(write_num_flt(type, fmt.replace(/[\\-]/g, ""), val));
|
|
1020
1020
|
ri = 0;
|
|
1021
1021
|
return _strrev(_strrev(fmt.replace(/\\/g, "")).replace(/[0#]/g, function(x) {
|
|
1022
1022
|
return ri < o.length ? o.charAt(ri++) : x === "0" ? "0" : "";
|
|
1023
1023
|
}));
|
|
1024
1024
|
}
|
|
1025
1025
|
if (fmt.match(phone)) {
|
|
1026
|
-
o = write_num_flt(type, "##########",
|
|
1026
|
+
o = write_num_flt(type, "##########", val);
|
|
1027
1027
|
return "(" + o.substr(0, 3) + ") " + o.substr(3, 3) + "-" + o.substr(6);
|
|
1028
1028
|
}
|
|
1029
1029
|
let oa = "";
|
|
@@ -1045,60 +1045,60 @@ var require_ssf = __commonJS({
|
|
|
1045
1045
|
return sign + (ff[0] || (ff[1] ? "" : "0")) + " " + (ff[1] ? pad_(ff[1], ri) + r[2] + "/" + r[3] + rpad_(ff[2], ri) : fill(" ", 2 * ri + 1 + r[2].length + r[3].length));
|
|
1046
1046
|
}
|
|
1047
1047
|
if (r = fmt.match(/^[#0?]+$/)) {
|
|
1048
|
-
o = pad0r(
|
|
1048
|
+
o = pad0r(val, 0);
|
|
1049
1049
|
if (fmt.length <= o.length) return o;
|
|
1050
1050
|
return hashq(fmt.substr(0, fmt.length - o.length)) + o;
|
|
1051
1051
|
}
|
|
1052
1052
|
if (r = fmt.match(/^([#0?]+)\.([#0]+)$/)) {
|
|
1053
|
-
o = "" +
|
|
1053
|
+
o = "" + val.toFixed(Math.min(r[2].length, 10)).replace(/([^0])0+$/, "$1");
|
|
1054
1054
|
ri = o.indexOf(".");
|
|
1055
1055
|
const lres = fmt.indexOf(".") - ri, rres = fmt.length - o.length - lres;
|
|
1056
1056
|
return hashq(fmt.substr(0, lres) + o + fmt.substr(fmt.length - rres));
|
|
1057
1057
|
}
|
|
1058
1058
|
if (r = fmt.match(/^00,000\.([#0]*0)$/)) {
|
|
1059
|
-
ri = dec(
|
|
1060
|
-
return
|
|
1059
|
+
ri = dec(val, r[1].length);
|
|
1060
|
+
return val < 0 ? "-" + write_num_flt(type, fmt, -val) : commaify(flr(val)).replace(/^\d,\d{3}$/, "0$&").replace(/^\d*$/, function($$) {
|
|
1061
1061
|
return "00," + ($$.length < 3 ? pad0(0, 3 - $$.length) : "") + $$;
|
|
1062
1062
|
}) + "." + pad0(ri, r[1].length);
|
|
1063
1063
|
}
|
|
1064
1064
|
switch (fmt) {
|
|
1065
1065
|
case "###,##0.00":
|
|
1066
|
-
return write_num_flt(type, "#,##0.00",
|
|
1066
|
+
return write_num_flt(type, "#,##0.00", val);
|
|
1067
1067
|
case "###,###":
|
|
1068
1068
|
case "##,###":
|
|
1069
1069
|
case "#,###":
|
|
1070
1070
|
const x = commaify(pad0r(aval, 0));
|
|
1071
1071
|
return x !== "0" ? sign + x : "";
|
|
1072
1072
|
case "###,###.00":
|
|
1073
|
-
return write_num_flt(type, "###,##0.00",
|
|
1073
|
+
return write_num_flt(type, "###,##0.00", val).replace(/^0\./, ".");
|
|
1074
1074
|
case "#,###.00":
|
|
1075
|
-
return write_num_flt(type, "#,##0.00",
|
|
1075
|
+
return write_num_flt(type, "#,##0.00", val).replace(/^0\./, ".");
|
|
1076
1076
|
default:
|
|
1077
1077
|
}
|
|
1078
1078
|
throw new Error("unsupported format |" + fmt + "|");
|
|
1079
1079
|
}
|
|
1080
|
-
function write_num_cm2(type, fmt,
|
|
1080
|
+
function write_num_cm2(type, fmt, val) {
|
|
1081
1081
|
let idx = fmt.length - 1;
|
|
1082
1082
|
while (fmt.charCodeAt(idx - 1) === 44) --idx;
|
|
1083
|
-
return write_num(type, fmt.substr(0, idx),
|
|
1083
|
+
return write_num(type, fmt.substr(0, idx), val / Math.pow(10, 3 * (fmt.length - idx)));
|
|
1084
1084
|
}
|
|
1085
|
-
function write_num_pct2(type, fmt,
|
|
1085
|
+
function write_num_pct2(type, fmt, val) {
|
|
1086
1086
|
const sfmt = fmt.replace(pct1, ""), mul = fmt.length - sfmt.length;
|
|
1087
|
-
return write_num(type, sfmt,
|
|
1087
|
+
return write_num(type, sfmt, val * Math.pow(10, 2 * mul)) + fill("%", mul);
|
|
1088
1088
|
}
|
|
1089
|
-
function write_num_exp2(fmt,
|
|
1089
|
+
function write_num_exp2(fmt, val) {
|
|
1090
1090
|
let o;
|
|
1091
1091
|
let idx = fmt.indexOf("E") - fmt.indexOf(".") - 1;
|
|
1092
1092
|
if (fmt.match(/^#+0.0E\+0$/)) {
|
|
1093
|
-
if (
|
|
1094
|
-
else if (
|
|
1093
|
+
if (val === 0) return "0.0E+0";
|
|
1094
|
+
else if (val < 0) return "-" + write_num_exp2(fmt, -val);
|
|
1095
1095
|
let period = fmt.indexOf(".");
|
|
1096
1096
|
if (period === -1) period = fmt.indexOf("E");
|
|
1097
|
-
let ee = Math.floor(Math.log(
|
|
1097
|
+
let ee = Math.floor(Math.log(val) * Math.LOG10E) % period;
|
|
1098
1098
|
if (ee < 0) ee += period;
|
|
1099
|
-
o = (
|
|
1099
|
+
o = (val / Math.pow(10, ee)).toPrecision(idx + 1 + (period + ee) % period);
|
|
1100
1100
|
if (!o.match(/[Ee]/)) {
|
|
1101
|
-
const fakee = Math.floor(Math.log(
|
|
1101
|
+
const fakee = Math.floor(Math.log(val) * Math.LOG10E);
|
|
1102
1102
|
if (o.indexOf(".") === -1) o = o.charAt(0) + "." + o.substr(1) + "E+" + (fakee - o.length + ee);
|
|
1103
1103
|
else o += "E+" + (fakee - ee);
|
|
1104
1104
|
o = o.replace(/\+-/, "-");
|
|
@@ -1106,33 +1106,33 @@ var require_ssf = __commonJS({
|
|
|
1106
1106
|
o = o.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/, function($$, $1, $2, $3) {
|
|
1107
1107
|
return $1 + $2 + $3.substr(0, (period + ee) % period) + "." + $3.substr(ee) + "E";
|
|
1108
1108
|
});
|
|
1109
|
-
} else o =
|
|
1109
|
+
} else o = val.toExponential(idx);
|
|
1110
1110
|
if (fmt.match(/E\+00$/) && o.match(/e[+-]\d$/)) o = o.substr(0, o.length - 1) + "0" + o.charAt(o.length - 1);
|
|
1111
1111
|
if (fmt.match(/E\-/) && o.match(/e\+/)) o = o.replace(/e\+/, "e");
|
|
1112
1112
|
return o.replace("e", "E");
|
|
1113
1113
|
}
|
|
1114
|
-
function write_num_int(type, fmt,
|
|
1114
|
+
function write_num_int(type, fmt, val) {
|
|
1115
1115
|
if (type.charCodeAt(0) === 40 && !fmt.match(closeparen)) {
|
|
1116
1116
|
const ffmt = fmt.replace(/\( */, "").replace(/ \)/, "").replace(/\)/, "");
|
|
1117
|
-
if (
|
|
1118
|
-
return "(" + write_num_int("n", ffmt, -
|
|
1117
|
+
if (val >= 0) return write_num_int("n", ffmt, val);
|
|
1118
|
+
return "(" + write_num_int("n", ffmt, -val) + ")";
|
|
1119
1119
|
}
|
|
1120
|
-
if (fmt.charCodeAt(fmt.length - 1) === 44) return write_num_cm2(type, fmt,
|
|
1121
|
-
if (fmt.indexOf("%") !== -1) return write_num_pct2(type, fmt,
|
|
1122
|
-
if (fmt.indexOf("E") !== -1) return write_num_exp2(fmt,
|
|
1123
|
-
if (fmt.charCodeAt(0) === 36) return "$" + write_num_int(type, fmt.substr(fmt.charAt(1) == " " ? 2 : 1),
|
|
1120
|
+
if (fmt.charCodeAt(fmt.length - 1) === 44) return write_num_cm2(type, fmt, val);
|
|
1121
|
+
if (fmt.indexOf("%") !== -1) return write_num_pct2(type, fmt, val);
|
|
1122
|
+
if (fmt.indexOf("E") !== -1) return write_num_exp2(fmt, val);
|
|
1123
|
+
if (fmt.charCodeAt(0) === 36) return "$" + write_num_int(type, fmt.substr(fmt.charAt(1) == " " ? 2 : 1), val);
|
|
1124
1124
|
let o;
|
|
1125
|
-
let r, ri, ff, aval = Math.abs(
|
|
1125
|
+
let r, ri, ff, aval = Math.abs(val), sign = val < 0 ? "-" : "";
|
|
1126
1126
|
if (fmt.match(/^00+$/)) return sign + pad0(aval, fmt.length);
|
|
1127
1127
|
if (fmt.match(/^[#?]+$/)) {
|
|
1128
|
-
o = "" +
|
|
1129
|
-
if (
|
|
1128
|
+
o = "" + val;
|
|
1129
|
+
if (val === 0) o = "";
|
|
1130
1130
|
return o.length > fmt.length ? o : hashq(fmt.substr(0, fmt.length - o.length)) + o;
|
|
1131
1131
|
}
|
|
1132
1132
|
if (r = fmt.match(frac1)) return write_num_f2(r, aval, sign);
|
|
1133
1133
|
if (fmt.match(/^#+0+$/)) return sign + pad0(aval, fmt.length - fmt.indexOf("0"));
|
|
1134
1134
|
if (r = fmt.match(dec1)) {
|
|
1135
|
-
o = ("" +
|
|
1135
|
+
o = ("" + val).replace(/^([^\.]+)$/, "$1." + hashq(r[1])).replace(/\.$/, "." + hashq(r[1]));
|
|
1136
1136
|
o = o.replace(/\.(\d*)$/, function($$, $1) {
|
|
1137
1137
|
return "." + $1 + fill("0", hashq(r[1]).length - $1.length);
|
|
1138
1138
|
});
|
|
@@ -1144,18 +1144,18 @@ var require_ssf = __commonJS({
|
|
|
1144
1144
|
}
|
|
1145
1145
|
if (r = fmt.match(/^#{1,3},##0(\.?)$/)) return sign + commaify("" + aval);
|
|
1146
1146
|
if (r = fmt.match(/^#,##0\.([#0]*0)$/)) {
|
|
1147
|
-
return
|
|
1147
|
+
return val < 0 ? "-" + write_num_int(type, fmt, -val) : commaify("" + val) + "." + fill("0", r[1].length);
|
|
1148
1148
|
}
|
|
1149
|
-
if (r = fmt.match(/^#,#*,#0/)) return write_num_int(type, fmt.replace(/^#,#*,/, ""),
|
|
1149
|
+
if (r = fmt.match(/^#,#*,#0/)) return write_num_int(type, fmt.replace(/^#,#*,/, ""), val);
|
|
1150
1150
|
if (r = fmt.match(/^([0#]+)(\\?-([0#]+))+$/)) {
|
|
1151
|
-
o = _strrev(write_num_int(type, fmt.replace(/[\\-]/g, ""),
|
|
1151
|
+
o = _strrev(write_num_int(type, fmt.replace(/[\\-]/g, ""), val));
|
|
1152
1152
|
ri = 0;
|
|
1153
1153
|
return _strrev(_strrev(fmt.replace(/\\/g, "")).replace(/[0#]/g, function(x) {
|
|
1154
1154
|
return ri < o.length ? o.charAt(ri++) : x === "0" ? "0" : "";
|
|
1155
1155
|
}));
|
|
1156
1156
|
}
|
|
1157
1157
|
if (fmt.match(phone)) {
|
|
1158
|
-
o = write_num_int(type, "##########",
|
|
1158
|
+
o = write_num_int(type, "##########", val);
|
|
1159
1159
|
return "(" + o.substr(0, 3) + ") " + o.substr(3, 3) + "-" + o.substr(6);
|
|
1160
1160
|
}
|
|
1161
1161
|
let oa = "";
|
|
@@ -1177,18 +1177,18 @@ var require_ssf = __commonJS({
|
|
|
1177
1177
|
return sign + (ff[0] || (ff[1] ? "" : "0")) + " " + (ff[1] ? pad_(ff[1], ri) + r[2] + "/" + r[3] + rpad_(ff[2], ri) : fill(" ", 2 * ri + 1 + r[2].length + r[3].length));
|
|
1178
1178
|
}
|
|
1179
1179
|
if (r = fmt.match(/^[#0?]+$/)) {
|
|
1180
|
-
o = "" +
|
|
1180
|
+
o = "" + val;
|
|
1181
1181
|
if (fmt.length <= o.length) return o;
|
|
1182
1182
|
return hashq(fmt.substr(0, fmt.length - o.length)) + o;
|
|
1183
1183
|
}
|
|
1184
1184
|
if (r = fmt.match(/^([#0]+)\.([#0]+)$/)) {
|
|
1185
|
-
o = "" +
|
|
1185
|
+
o = "" + val.toFixed(Math.min(r[2].length, 10)).replace(/([^0])0+$/, "$1");
|
|
1186
1186
|
ri = o.indexOf(".");
|
|
1187
1187
|
let lres = fmt.indexOf(".") - ri, rres = fmt.length - o.length - lres;
|
|
1188
1188
|
return hashq(fmt.substr(0, lres) + o + fmt.substr(fmt.length - rres));
|
|
1189
1189
|
}
|
|
1190
1190
|
if (r = fmt.match(/^00,000\.([#0]*0)$/)) {
|
|
1191
|
-
return
|
|
1191
|
+
return val < 0 ? "-" + write_num_int(type, fmt, -val) : commaify("" + val).replace(/^\d,\d{3}$/, "0$&").replace(/^\d*$/, function($$) {
|
|
1192
1192
|
return "00," + ($$.length < 3 ? pad0(0, 3 - $$.length) : "") + $$;
|
|
1193
1193
|
}) + "." + pad0(0, r[1].length);
|
|
1194
1194
|
}
|
|
@@ -1199,12 +1199,12 @@ var require_ssf = __commonJS({
|
|
|
1199
1199
|
const x = commaify("" + aval);
|
|
1200
1200
|
return x !== "0" ? sign + x : "";
|
|
1201
1201
|
default:
|
|
1202
|
-
if (fmt.match(/\.[0#?]*$/)) return write_num_int(type, fmt.slice(0, fmt.lastIndexOf(".")),
|
|
1202
|
+
if (fmt.match(/\.[0#?]*$/)) return write_num_int(type, fmt.slice(0, fmt.lastIndexOf(".")), val) + hashq(fmt.slice(fmt.lastIndexOf(".")));
|
|
1203
1203
|
}
|
|
1204
1204
|
throw new Error("unsupported format |" + fmt + "|");
|
|
1205
1205
|
}
|
|
1206
|
-
return function write_num2(type, fmt,
|
|
1207
|
-
return (
|
|
1206
|
+
return function write_num2(type, fmt, val) {
|
|
1207
|
+
return (val | 0) === val ? write_num_int(type, fmt, val) : write_num_flt(type, fmt, val);
|
|
1208
1208
|
};
|
|
1209
1209
|
})();
|
|
1210
1210
|
function split_fmt(fmt) {
|
|
@@ -3061,17 +3061,17 @@ var require_logical = __commonJS({
|
|
|
3061
3061
|
var H = FormulaHelpers;
|
|
3062
3062
|
function getNumLogicalValue(params) {
|
|
3063
3063
|
let numTrue = 0, numFalse = 0;
|
|
3064
|
-
H.flattenParams(params, null, true, (
|
|
3065
|
-
const type = typeof
|
|
3064
|
+
H.flattenParams(params, null, true, (val) => {
|
|
3065
|
+
const type = typeof val;
|
|
3066
3066
|
if (type === "string") {
|
|
3067
|
-
if (
|
|
3068
|
-
|
|
3069
|
-
else if (
|
|
3070
|
-
|
|
3067
|
+
if (val === "TRUE")
|
|
3068
|
+
val = true;
|
|
3069
|
+
else if (val === "FALSE")
|
|
3070
|
+
val = false;
|
|
3071
3071
|
} else if (type === "number")
|
|
3072
|
-
|
|
3073
|
-
if (typeof
|
|
3074
|
-
if (
|
|
3072
|
+
val = Boolean(val);
|
|
3073
|
+
if (typeof val === "boolean") {
|
|
3074
|
+
if (val === true)
|
|
3075
3075
|
numTrue++;
|
|
3076
3076
|
else
|
|
3077
3077
|
numFalse++;
|
|
@@ -3387,10 +3387,10 @@ var require_jstat = __commonJS({
|
|
|
3387
3387
|
var slice = Array.prototype.slice;
|
|
3388
3388
|
var toString = Object.prototype.toString;
|
|
3389
3389
|
function calcRdx(n, m) {
|
|
3390
|
-
var
|
|
3390
|
+
var val = n > m ? n : m;
|
|
3391
3391
|
return Math2.pow(
|
|
3392
3392
|
10,
|
|
3393
|
-
17 - ~~(Math2.log(
|
|
3393
|
+
17 - ~~(Math2.log(val > 0 ? val : -val) * Math2.LOG10E)
|
|
3394
3394
|
);
|
|
3395
3395
|
}
|
|
3396
3396
|
var isArray2 = Array.isArray || function isArray3(arg) {
|
|
@@ -10243,10 +10243,10 @@ var require_utils = __commonJS({
|
|
|
10243
10243
|
exports.peek = peek;
|
|
10244
10244
|
function timer(func) {
|
|
10245
10245
|
var start = (/* @__PURE__ */ new Date()).getTime();
|
|
10246
|
-
var
|
|
10246
|
+
var val = func();
|
|
10247
10247
|
var end = (/* @__PURE__ */ new Date()).getTime();
|
|
10248
10248
|
var total = end - start;
|
|
10249
|
-
return { time: total, value:
|
|
10249
|
+
return { time: total, value: val };
|
|
10250
10250
|
}
|
|
10251
10251
|
exports.timer = timer;
|
|
10252
10252
|
}
|
|
@@ -12227,7 +12227,7 @@ var require_tokens = __commonJS({
|
|
|
12227
12227
|
function assignCategoriesTokensProp(tokenTypes) {
|
|
12228
12228
|
utils_1.forEach(tokenTypes, function(currTokType) {
|
|
12229
12229
|
currTokType.categoryMatches = [];
|
|
12230
|
-
utils_1.forEach(currTokType.categoryMatchesMap, function(
|
|
12230
|
+
utils_1.forEach(currTokType.categoryMatchesMap, function(val, key) {
|
|
12231
12231
|
currTokType.categoryMatches.push(exports2.tokenIdxToClass[key].tokenTypeIdx);
|
|
12232
12232
|
});
|
|
12233
12233
|
});
|
|
@@ -18825,14 +18825,14 @@ var require_utils2 = __commonJS({
|
|
|
18825
18825
|
}
|
|
18826
18826
|
};
|
|
18827
18827
|
}
|
|
18828
|
-
_applyPrefix(prefixes,
|
|
18829
|
-
if (this.isFormulaError(
|
|
18830
|
-
return
|
|
18831
|
-
return Prefix.unaryOp(prefixes,
|
|
18828
|
+
_applyPrefix(prefixes, val, isArray2) {
|
|
18829
|
+
if (this.isFormulaError(val))
|
|
18830
|
+
return val;
|
|
18831
|
+
return Prefix.unaryOp(prefixes, val, isArray2);
|
|
18832
18832
|
}
|
|
18833
18833
|
async applyPrefixAsync(prefixes, value) {
|
|
18834
|
-
const { val
|
|
18835
|
-
return this._applyPrefix(prefixes,
|
|
18834
|
+
const { val, isArray: isArray2 } = this.extractRefValue(await value);
|
|
18835
|
+
return this._applyPrefix(prefixes, val, isArray2);
|
|
18836
18836
|
}
|
|
18837
18837
|
/**
|
|
18838
18838
|
* Apply + or - unary prefix.
|
|
@@ -18844,25 +18844,25 @@ var require_utils2 = __commonJS({
|
|
|
18844
18844
|
if (this.context.async) {
|
|
18845
18845
|
return this.applyPrefixAsync(prefixes, value);
|
|
18846
18846
|
} else {
|
|
18847
|
-
const { val
|
|
18848
|
-
return this._applyPrefix(prefixes,
|
|
18847
|
+
const { val, isArray: isArray2 } = this.extractRefValue(value);
|
|
18848
|
+
return this._applyPrefix(prefixes, val, isArray2);
|
|
18849
18849
|
}
|
|
18850
18850
|
}
|
|
18851
|
-
_applyPostfix(
|
|
18852
|
-
if (this.isFormulaError(
|
|
18853
|
-
return
|
|
18854
|
-
return Postfix.percentOp(
|
|
18851
|
+
_applyPostfix(val, isArray2, postfix) {
|
|
18852
|
+
if (this.isFormulaError(val))
|
|
18853
|
+
return val;
|
|
18854
|
+
return Postfix.percentOp(val, postfix, isArray2);
|
|
18855
18855
|
}
|
|
18856
18856
|
async applyPostfixAsync(value, postfix) {
|
|
18857
|
-
const { val
|
|
18858
|
-
return this._applyPostfix(
|
|
18857
|
+
const { val, isArray: isArray2 } = this.extractRefValue(await value);
|
|
18858
|
+
return this._applyPostfix(val, isArray2, postfix);
|
|
18859
18859
|
}
|
|
18860
18860
|
applyPostfix(value, postfix) {
|
|
18861
18861
|
if (this.context.async) {
|
|
18862
18862
|
return this.applyPostfixAsync(value, postfix);
|
|
18863
18863
|
} else {
|
|
18864
|
-
const { val
|
|
18865
|
-
return this._applyPostfix(
|
|
18864
|
+
const { val, isArray: isArray2 } = this.extractRefValue(value);
|
|
18865
|
+
return this._applyPostfix(val, isArray2, postfix);
|
|
18866
18866
|
}
|
|
18867
18867
|
}
|
|
18868
18868
|
_applyInfix(res1, infix, res2) {
|
|
@@ -25328,7 +25328,7 @@ var require_deflate = __commonJS({
|
|
|
25328
25328
|
}
|
|
25329
25329
|
function deflate(strm, flush) {
|
|
25330
25330
|
var old_flush, s;
|
|
25331
|
-
var beg,
|
|
25331
|
+
var beg, val;
|
|
25332
25332
|
if (!strm || !strm.state || flush > Z_BLOCK || flush < 0) {
|
|
25333
25333
|
return strm ? err2(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR;
|
|
25334
25334
|
}
|
|
@@ -25440,21 +25440,21 @@ var require_deflate = __commonJS({
|
|
|
25440
25440
|
flush_pending(strm);
|
|
25441
25441
|
beg = s.pending;
|
|
25442
25442
|
if (s.pending === s.pending_buf_size) {
|
|
25443
|
-
|
|
25443
|
+
val = 1;
|
|
25444
25444
|
break;
|
|
25445
25445
|
}
|
|
25446
25446
|
}
|
|
25447
25447
|
if (s.gzindex < s.gzhead.name.length) {
|
|
25448
|
-
|
|
25448
|
+
val = s.gzhead.name.charCodeAt(s.gzindex++) & 255;
|
|
25449
25449
|
} else {
|
|
25450
|
-
|
|
25450
|
+
val = 0;
|
|
25451
25451
|
}
|
|
25452
|
-
put_byte(s,
|
|
25453
|
-
} while (
|
|
25452
|
+
put_byte(s, val);
|
|
25453
|
+
} while (val !== 0);
|
|
25454
25454
|
if (s.gzhead.hcrc && s.pending > beg) {
|
|
25455
25455
|
strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
|
|
25456
25456
|
}
|
|
25457
|
-
if (
|
|
25457
|
+
if (val === 0) {
|
|
25458
25458
|
s.gzindex = 0;
|
|
25459
25459
|
s.status = COMMENT_STATE;
|
|
25460
25460
|
}
|
|
@@ -25473,21 +25473,21 @@ var require_deflate = __commonJS({
|
|
|
25473
25473
|
flush_pending(strm);
|
|
25474
25474
|
beg = s.pending;
|
|
25475
25475
|
if (s.pending === s.pending_buf_size) {
|
|
25476
|
-
|
|
25476
|
+
val = 1;
|
|
25477
25477
|
break;
|
|
25478
25478
|
}
|
|
25479
25479
|
}
|
|
25480
25480
|
if (s.gzindex < s.gzhead.comment.length) {
|
|
25481
|
-
|
|
25481
|
+
val = s.gzhead.comment.charCodeAt(s.gzindex++) & 255;
|
|
25482
25482
|
} else {
|
|
25483
|
-
|
|
25483
|
+
val = 0;
|
|
25484
25484
|
}
|
|
25485
|
-
put_byte(s,
|
|
25486
|
-
} while (
|
|
25485
|
+
put_byte(s, val);
|
|
25486
|
+
} while (val !== 0);
|
|
25487
25487
|
if (s.gzhead.hcrc && s.pending > beg) {
|
|
25488
25488
|
strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
|
|
25489
25489
|
}
|
|
25490
|
-
if (
|
|
25490
|
+
if (val === 0) {
|
|
25491
25491
|
s.status = HCRC_STATE;
|
|
25492
25492
|
}
|
|
25493
25493
|
} else {
|
|
@@ -29627,9 +29627,24 @@ var require_util2 = __commonJS({
|
|
|
29627
29627
|
return "";
|
|
29628
29628
|
}
|
|
29629
29629
|
};
|
|
29630
|
+
var DANGEROUS_PROPERTY_NAMES2 = [
|
|
29631
|
+
// '__proto__',
|
|
29632
|
+
// 'constructor',
|
|
29633
|
+
// 'prototype',
|
|
29634
|
+
"hasOwnProperty",
|
|
29635
|
+
"toString",
|
|
29636
|
+
"valueOf",
|
|
29637
|
+
"__defineGetter__",
|
|
29638
|
+
"__defineSetter__",
|
|
29639
|
+
"__lookupGetter__",
|
|
29640
|
+
"__lookupSetter__"
|
|
29641
|
+
];
|
|
29642
|
+
var criticalProperties2 = ["__proto__", "constructor", "prototype"];
|
|
29630
29643
|
exports2.isName = isName2;
|
|
29631
29644
|
exports2.getAllMatches = getAllMatches2;
|
|
29632
29645
|
exports2.nameRegexp = nameRegexp2;
|
|
29646
|
+
exports2.DANGEROUS_PROPERTY_NAMES = DANGEROUS_PROPERTY_NAMES2;
|
|
29647
|
+
exports2.criticalProperties = criticalProperties2;
|
|
29633
29648
|
}
|
|
29634
29649
|
});
|
|
29635
29650
|
|
|
@@ -29948,6 +29963,13 @@ var require_validator = __commonJS({
|
|
|
29948
29963
|
// ../../node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js
|
|
29949
29964
|
var require_OptionsBuilder = __commonJS({
|
|
29950
29965
|
"../../node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js"(exports2) {
|
|
29966
|
+
var { DANGEROUS_PROPERTY_NAMES: DANGEROUS_PROPERTY_NAMES2, criticalProperties: criticalProperties2 } = require_util2();
|
|
29967
|
+
var defaultOnDangerousProperty2 = (name) => {
|
|
29968
|
+
if (DANGEROUS_PROPERTY_NAMES2.includes(name)) {
|
|
29969
|
+
return "__" + name;
|
|
29970
|
+
}
|
|
29971
|
+
return name;
|
|
29972
|
+
};
|
|
29951
29973
|
var defaultOptions3 = {
|
|
29952
29974
|
preserveOrder: false,
|
|
29953
29975
|
attributeNamePrefix: "@_",
|
|
@@ -29969,11 +29991,11 @@ var require_OptionsBuilder = __commonJS({
|
|
|
29969
29991
|
leadingZeros: true,
|
|
29970
29992
|
eNotation: true
|
|
29971
29993
|
},
|
|
29972
|
-
tagValueProcessor: function(tagName,
|
|
29973
|
-
return
|
|
29994
|
+
tagValueProcessor: function(tagName, val) {
|
|
29995
|
+
return val;
|
|
29974
29996
|
},
|
|
29975
|
-
attributeValueProcessor: function(attrName,
|
|
29976
|
-
return
|
|
29997
|
+
attributeValueProcessor: function(attrName, val) {
|
|
29998
|
+
return val;
|
|
29977
29999
|
},
|
|
29978
30000
|
stopNodes: [],
|
|
29979
30001
|
//nested tags will not be parsed even for errors
|
|
@@ -29989,11 +30011,75 @@ var require_OptionsBuilder = __commonJS({
|
|
|
29989
30011
|
transformAttributeName: false,
|
|
29990
30012
|
updateTag: function(tagName, jPath, attrs) {
|
|
29991
30013
|
return tagName;
|
|
29992
|
-
}
|
|
30014
|
+
},
|
|
29993
30015
|
// skipEmptyListItem: false
|
|
30016
|
+
captureMetaData: false,
|
|
30017
|
+
maxNestedTags: 100,
|
|
30018
|
+
strictReservedNames: true,
|
|
30019
|
+
onDangerousProperty: defaultOnDangerousProperty2
|
|
29994
30020
|
};
|
|
30021
|
+
function validatePropertyName2(propertyName, optionName) {
|
|
30022
|
+
if (typeof propertyName !== "string") {
|
|
30023
|
+
return;
|
|
30024
|
+
}
|
|
30025
|
+
const normalized = propertyName.toLowerCase();
|
|
30026
|
+
if (DANGEROUS_PROPERTY_NAMES2.some((dangerous) => normalized === dangerous.toLowerCase())) {
|
|
30027
|
+
throw new Error(
|
|
30028
|
+
`[SECURITY] Invalid ${optionName}: "${propertyName}" is a reserved JavaScript keyword that could cause prototype pollution`
|
|
30029
|
+
);
|
|
30030
|
+
}
|
|
30031
|
+
if (criticalProperties2.some((dangerous) => normalized === dangerous.toLowerCase())) {
|
|
30032
|
+
throw new Error(
|
|
30033
|
+
`[SECURITY] Invalid ${optionName}: "${propertyName}" is a reserved JavaScript keyword that could cause prototype pollution`
|
|
30034
|
+
);
|
|
30035
|
+
}
|
|
30036
|
+
}
|
|
30037
|
+
function normalizeProcessEntities2(value) {
|
|
30038
|
+
if (typeof value === "boolean") {
|
|
30039
|
+
return {
|
|
30040
|
+
enabled: value,
|
|
30041
|
+
// true or false
|
|
30042
|
+
maxEntitySize: 1e4,
|
|
30043
|
+
maxExpansionDepth: 10,
|
|
30044
|
+
maxTotalExpansions: 1e3,
|
|
30045
|
+
maxExpandedLength: 1e5,
|
|
30046
|
+
allowedTags: null,
|
|
30047
|
+
tagFilter: null
|
|
30048
|
+
};
|
|
30049
|
+
}
|
|
30050
|
+
if (typeof value === "object" && value !== null) {
|
|
30051
|
+
return {
|
|
30052
|
+
enabled: value.enabled !== false,
|
|
30053
|
+
maxEntitySize: Math.max(1, value.maxEntitySize ?? 1e4),
|
|
30054
|
+
maxExpansionDepth: Math.max(1, value.maxExpansionDepth ?? 1e4),
|
|
30055
|
+
maxTotalExpansions: Math.max(1, value.maxTotalExpansions ?? Infinity),
|
|
30056
|
+
maxExpandedLength: Math.max(1, value.maxExpandedLength ?? 1e5),
|
|
30057
|
+
maxEntityCount: Math.max(1, value.maxEntityCount ?? 1e3),
|
|
30058
|
+
allowedTags: value.allowedTags ?? null,
|
|
30059
|
+
tagFilter: value.tagFilter ?? null
|
|
30060
|
+
};
|
|
30061
|
+
}
|
|
30062
|
+
return normalizeProcessEntities2(true);
|
|
30063
|
+
}
|
|
29995
30064
|
var buildOptions2 = function(options) {
|
|
29996
|
-
|
|
30065
|
+
const built = Object.assign({}, defaultOptions3, options);
|
|
30066
|
+
const propertyNameOptions = [
|
|
30067
|
+
{ value: built.attributeNamePrefix, name: "attributeNamePrefix" },
|
|
30068
|
+
{ value: built.attributesGroupName, name: "attributesGroupName" },
|
|
30069
|
+
{ value: built.textNodeName, name: "textNodeName" },
|
|
30070
|
+
{ value: built.cdataPropName, name: "cdataPropName" },
|
|
30071
|
+
{ value: built.commentPropName, name: "commentPropName" }
|
|
30072
|
+
];
|
|
30073
|
+
for (const { value, name } of propertyNameOptions) {
|
|
30074
|
+
if (value) {
|
|
30075
|
+
validatePropertyName2(value, name);
|
|
30076
|
+
}
|
|
30077
|
+
}
|
|
30078
|
+
if (built.onDangerousProperty === null) {
|
|
30079
|
+
built.onDangerousProperty = defaultOnDangerousProperty2;
|
|
30080
|
+
}
|
|
30081
|
+
built.processEntities = normalizeProcessEntities2(built.processEntities);
|
|
30082
|
+
return built;
|
|
29997
30083
|
};
|
|
29998
30084
|
exports2.buildOptions = buildOptions2;
|
|
29999
30085
|
exports2.defaultOptions = defaultOptions3;
|
|
@@ -30010,9 +30096,9 @@ var require_xmlNode = __commonJS({
|
|
|
30010
30096
|
this.child = [];
|
|
30011
30097
|
this[":@"] = {};
|
|
30012
30098
|
}
|
|
30013
|
-
add(key,
|
|
30099
|
+
add(key, val) {
|
|
30014
30100
|
if (key === "__proto__") key = "#__proto__";
|
|
30015
|
-
this.child.push({ [key]:
|
|
30101
|
+
this.child.push({ [key]: val });
|
|
30016
30102
|
}
|
|
30017
30103
|
addChild(node) {
|
|
30018
30104
|
if (node.tagname === "__proto__") node.tagname = "#__proto__";
|
|
@@ -30031,89 +30117,279 @@ var require_xmlNode = __commonJS({
|
|
|
30031
30117
|
var require_DocTypeReader = __commonJS({
|
|
30032
30118
|
"../../node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js"(exports2, module2) {
|
|
30033
30119
|
var util = require_util2();
|
|
30034
|
-
|
|
30035
|
-
|
|
30036
|
-
|
|
30037
|
-
|
|
30038
|
-
|
|
30039
|
-
|
|
30040
|
-
|
|
30041
|
-
|
|
30042
|
-
|
|
30043
|
-
|
|
30044
|
-
|
|
30045
|
-
|
|
30046
|
-
|
|
30047
|
-
|
|
30048
|
-
|
|
30049
|
-
|
|
30050
|
-
|
|
30051
|
-
|
|
30052
|
-
|
|
30053
|
-
|
|
30054
|
-
|
|
30055
|
-
|
|
30056
|
-
|
|
30057
|
-
|
|
30058
|
-
|
|
30059
|
-
|
|
30060
|
-
|
|
30061
|
-
|
|
30120
|
+
var DocTypeReader2 = class {
|
|
30121
|
+
constructor(options) {
|
|
30122
|
+
this.suppressValidationErr = !options;
|
|
30123
|
+
this.options = options || {};
|
|
30124
|
+
}
|
|
30125
|
+
readDocType(xmlData, i) {
|
|
30126
|
+
const entities = /* @__PURE__ */ Object.create(null);
|
|
30127
|
+
let entityCount = 0;
|
|
30128
|
+
if (xmlData[i + 3] === "O" && xmlData[i + 4] === "C" && xmlData[i + 5] === "T" && xmlData[i + 6] === "Y" && xmlData[i + 7] === "P" && xmlData[i + 8] === "E") {
|
|
30129
|
+
i = i + 9;
|
|
30130
|
+
let angleBracketsCount = 1;
|
|
30131
|
+
let hasBody = false, comment = false;
|
|
30132
|
+
let exp = "";
|
|
30133
|
+
for (; i < xmlData.length; i++) {
|
|
30134
|
+
if (xmlData[i] === "<" && !comment) {
|
|
30135
|
+
if (hasBody && hasSeq2(xmlData, "!ENTITY", i)) {
|
|
30136
|
+
i += 7;
|
|
30137
|
+
let entityName, val;
|
|
30138
|
+
[entityName, val, i] = this.readEntityExp(xmlData, i + 1, this.suppressValidationErr);
|
|
30139
|
+
if (val.indexOf("&") === -1) {
|
|
30140
|
+
if (this.options.enabled !== false && this.options.maxEntityCount != null && entityCount >= this.options.maxEntityCount) {
|
|
30141
|
+
throw new Error(
|
|
30142
|
+
`Entity count (${entityCount + 1}) exceeds maximum allowed (${this.options.maxEntityCount})`
|
|
30143
|
+
);
|
|
30144
|
+
}
|
|
30145
|
+
const escaped = entityName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
30146
|
+
entities[entityName] = {
|
|
30147
|
+
regx: RegExp(`&${escaped};`, "g"),
|
|
30148
|
+
val
|
|
30149
|
+
};
|
|
30150
|
+
entityCount++;
|
|
30151
|
+
}
|
|
30152
|
+
} else if (hasBody && hasSeq2(xmlData, "!ELEMENT", i)) {
|
|
30153
|
+
i += 8;
|
|
30154
|
+
const { index } = this.readElementExp(xmlData, i + 1);
|
|
30155
|
+
i = index;
|
|
30156
|
+
} else if (hasBody && hasSeq2(xmlData, "!ATTLIST", i)) {
|
|
30157
|
+
i += 8;
|
|
30158
|
+
} else if (hasBody && hasSeq2(xmlData, "!NOTATION", i)) {
|
|
30159
|
+
i += 9;
|
|
30160
|
+
const { index } = this.readNotationExp(xmlData, i + 1, this.suppressValidationErr);
|
|
30161
|
+
i = index;
|
|
30162
|
+
} else if (hasSeq2(xmlData, "!--", i)) {
|
|
30163
|
+
comment = true;
|
|
30164
|
+
} else {
|
|
30165
|
+
throw new Error(`Invalid DOCTYPE`);
|
|
30166
|
+
}
|
|
30167
|
+
angleBracketsCount++;
|
|
30168
|
+
exp = "";
|
|
30169
|
+
} else if (xmlData[i] === ">") {
|
|
30170
|
+
if (comment) {
|
|
30171
|
+
if (xmlData[i - 1] === "-" && xmlData[i - 2] === "-") {
|
|
30172
|
+
comment = false;
|
|
30173
|
+
angleBracketsCount--;
|
|
30174
|
+
}
|
|
30175
|
+
} else {
|
|
30062
30176
|
angleBracketsCount--;
|
|
30063
30177
|
}
|
|
30178
|
+
if (angleBracketsCount === 0) {
|
|
30179
|
+
break;
|
|
30180
|
+
}
|
|
30181
|
+
} else if (xmlData[i] === "[") {
|
|
30182
|
+
hasBody = true;
|
|
30064
30183
|
} else {
|
|
30065
|
-
|
|
30184
|
+
exp += xmlData[i];
|
|
30066
30185
|
}
|
|
30067
|
-
|
|
30068
|
-
|
|
30186
|
+
}
|
|
30187
|
+
if (angleBracketsCount !== 0) {
|
|
30188
|
+
throw new Error(`Unclosed DOCTYPE`);
|
|
30189
|
+
}
|
|
30190
|
+
} else {
|
|
30191
|
+
throw new Error(`Invalid Tag instead of DOCTYPE`);
|
|
30192
|
+
}
|
|
30193
|
+
return { entities, i };
|
|
30194
|
+
}
|
|
30195
|
+
readEntityExp(xmlData, i) {
|
|
30196
|
+
i = skipWhitespace2(xmlData, i);
|
|
30197
|
+
let entityName = "";
|
|
30198
|
+
while (i < xmlData.length && !/\s/.test(xmlData[i]) && xmlData[i] !== '"' && xmlData[i] !== "'") {
|
|
30199
|
+
entityName += xmlData[i];
|
|
30200
|
+
i++;
|
|
30201
|
+
}
|
|
30202
|
+
validateEntityName3(entityName);
|
|
30203
|
+
i = skipWhitespace2(xmlData, i);
|
|
30204
|
+
if (!this.suppressValidationErr) {
|
|
30205
|
+
if (xmlData.substring(i, i + 6).toUpperCase() === "SYSTEM") {
|
|
30206
|
+
throw new Error("External entities are not supported");
|
|
30207
|
+
} else if (xmlData[i] === "%") {
|
|
30208
|
+
throw new Error("Parameter entities are not supported");
|
|
30209
|
+
}
|
|
30210
|
+
}
|
|
30211
|
+
let entityValue = "";
|
|
30212
|
+
[i, entityValue] = this.readIdentifierVal(xmlData, i, "entity");
|
|
30213
|
+
if (this.options.enabled !== false && this.options.maxEntitySize != null && entityValue.length > this.options.maxEntitySize) {
|
|
30214
|
+
throw new Error(
|
|
30215
|
+
`Entity "${entityName}" size (${entityValue.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`
|
|
30216
|
+
);
|
|
30217
|
+
}
|
|
30218
|
+
i--;
|
|
30219
|
+
return [entityName, entityValue, i];
|
|
30220
|
+
}
|
|
30221
|
+
readNotationExp(xmlData, i) {
|
|
30222
|
+
i = skipWhitespace2(xmlData, i);
|
|
30223
|
+
let notationName = "";
|
|
30224
|
+
while (i < xmlData.length && !/\s/.test(xmlData[i])) {
|
|
30225
|
+
notationName += xmlData[i];
|
|
30226
|
+
i++;
|
|
30227
|
+
}
|
|
30228
|
+
!this.suppressValidationErr && validateEntityName3(notationName);
|
|
30229
|
+
i = skipWhitespace2(xmlData, i);
|
|
30230
|
+
const identifierType = xmlData.substring(i, i + 6).toUpperCase();
|
|
30231
|
+
if (!this.suppressValidationErr && identifierType !== "SYSTEM" && identifierType !== "PUBLIC") {
|
|
30232
|
+
throw new Error(`Expected SYSTEM or PUBLIC, found "${identifierType}"`);
|
|
30233
|
+
}
|
|
30234
|
+
i += identifierType.length;
|
|
30235
|
+
i = skipWhitespace2(xmlData, i);
|
|
30236
|
+
let publicIdentifier = null;
|
|
30237
|
+
let systemIdentifier = null;
|
|
30238
|
+
if (identifierType === "PUBLIC") {
|
|
30239
|
+
[i, publicIdentifier] = this.readIdentifierVal(xmlData, i, "publicIdentifier");
|
|
30240
|
+
i = skipWhitespace2(xmlData, i);
|
|
30241
|
+
if (xmlData[i] === '"' || xmlData[i] === "'") {
|
|
30242
|
+
[i, systemIdentifier] = this.readIdentifierVal(xmlData, i, "systemIdentifier");
|
|
30243
|
+
}
|
|
30244
|
+
} else if (identifierType === "SYSTEM") {
|
|
30245
|
+
[i, systemIdentifier] = this.readIdentifierVal(xmlData, i, "systemIdentifier");
|
|
30246
|
+
if (!this.suppressValidationErr && !systemIdentifier) {
|
|
30247
|
+
throw new Error("Missing mandatory system identifier for SYSTEM notation");
|
|
30248
|
+
}
|
|
30249
|
+
}
|
|
30250
|
+
return { notationName, publicIdentifier, systemIdentifier, index: --i };
|
|
30251
|
+
}
|
|
30252
|
+
readIdentifierVal(xmlData, i, type) {
|
|
30253
|
+
let identifierVal = "";
|
|
30254
|
+
const startChar = xmlData[i];
|
|
30255
|
+
if (startChar !== '"' && startChar !== "'") {
|
|
30256
|
+
throw new Error(`Expected quoted string, found "${startChar}"`);
|
|
30257
|
+
}
|
|
30258
|
+
i++;
|
|
30259
|
+
while (i < xmlData.length && xmlData[i] !== startChar) {
|
|
30260
|
+
identifierVal += xmlData[i];
|
|
30261
|
+
i++;
|
|
30262
|
+
}
|
|
30263
|
+
if (xmlData[i] !== startChar) {
|
|
30264
|
+
throw new Error(`Unterminated ${type} value`);
|
|
30265
|
+
}
|
|
30266
|
+
i++;
|
|
30267
|
+
return [i, identifierVal];
|
|
30268
|
+
}
|
|
30269
|
+
readElementExp(xmlData, i) {
|
|
30270
|
+
i = skipWhitespace2(xmlData, i);
|
|
30271
|
+
let elementName = "";
|
|
30272
|
+
while (i < xmlData.length && !/\s/.test(xmlData[i])) {
|
|
30273
|
+
elementName += xmlData[i];
|
|
30274
|
+
i++;
|
|
30275
|
+
}
|
|
30276
|
+
if (!this.suppressValidationErr && !util.isName(elementName)) {
|
|
30277
|
+
throw new Error(`Invalid element name: "${elementName}"`);
|
|
30278
|
+
}
|
|
30279
|
+
i = skipWhitespace2(xmlData, i);
|
|
30280
|
+
let contentModel = "";
|
|
30281
|
+
if (xmlData[i] === "E" && hasSeq2(xmlData, "MPTY", i)) {
|
|
30282
|
+
i += 4;
|
|
30283
|
+
} else if (xmlData[i] === "A" && hasSeq2(xmlData, "NY", i)) {
|
|
30284
|
+
i += 2;
|
|
30285
|
+
} else if (xmlData[i] === "(") {
|
|
30286
|
+
i++;
|
|
30287
|
+
while (i < xmlData.length && xmlData[i] !== ")") {
|
|
30288
|
+
contentModel += xmlData[i];
|
|
30289
|
+
i++;
|
|
30290
|
+
}
|
|
30291
|
+
if (xmlData[i] !== ")") {
|
|
30292
|
+
throw new Error("Unterminated content model");
|
|
30293
|
+
}
|
|
30294
|
+
} else if (!this.suppressValidationErr) {
|
|
30295
|
+
throw new Error(`Invalid Element Expression, found "${xmlData[i]}"`);
|
|
30296
|
+
}
|
|
30297
|
+
return {
|
|
30298
|
+
elementName,
|
|
30299
|
+
contentModel: contentModel.trim(),
|
|
30300
|
+
index: i
|
|
30301
|
+
};
|
|
30302
|
+
}
|
|
30303
|
+
readAttlistExp(xmlData, i) {
|
|
30304
|
+
i = skipWhitespace2(xmlData, i);
|
|
30305
|
+
let elementName = "";
|
|
30306
|
+
while (i < xmlData.length && !/\s/.test(xmlData[i])) {
|
|
30307
|
+
elementName += xmlData[i];
|
|
30308
|
+
i++;
|
|
30309
|
+
}
|
|
30310
|
+
validateEntityName3(elementName);
|
|
30311
|
+
i = skipWhitespace2(xmlData, i);
|
|
30312
|
+
let attributeName = "";
|
|
30313
|
+
while (i < xmlData.length && !/\s/.test(xmlData[i])) {
|
|
30314
|
+
attributeName += xmlData[i];
|
|
30315
|
+
i++;
|
|
30316
|
+
}
|
|
30317
|
+
if (!validateEntityName3(attributeName)) {
|
|
30318
|
+
throw new Error(`Invalid attribute name: "${attributeName}"`);
|
|
30319
|
+
}
|
|
30320
|
+
i = skipWhitespace2(xmlData, i);
|
|
30321
|
+
let attributeType = "";
|
|
30322
|
+
if (xmlData.substring(i, i + 8).toUpperCase() === "NOTATION") {
|
|
30323
|
+
attributeType = "NOTATION";
|
|
30324
|
+
i += 8;
|
|
30325
|
+
i = skipWhitespace2(xmlData, i);
|
|
30326
|
+
if (xmlData[i] !== "(") {
|
|
30327
|
+
throw new Error(`Expected '(', found "${xmlData[i]}"`);
|
|
30328
|
+
}
|
|
30329
|
+
i++;
|
|
30330
|
+
let allowedNotations = [];
|
|
30331
|
+
while (i < xmlData.length && xmlData[i] !== ")") {
|
|
30332
|
+
let notation = "";
|
|
30333
|
+
while (i < xmlData.length && xmlData[i] !== "|" && xmlData[i] !== ")") {
|
|
30334
|
+
notation += xmlData[i];
|
|
30335
|
+
i++;
|
|
30069
30336
|
}
|
|
30070
|
-
|
|
30071
|
-
|
|
30072
|
-
|
|
30073
|
-
|
|
30337
|
+
notation = notation.trim();
|
|
30338
|
+
if (!validateEntityName3(notation)) {
|
|
30339
|
+
throw new Error(`Invalid notation name: "${notation}"`);
|
|
30340
|
+
}
|
|
30341
|
+
allowedNotations.push(notation);
|
|
30342
|
+
if (xmlData[i] === "|") {
|
|
30343
|
+
i++;
|
|
30344
|
+
i = skipWhitespace2(xmlData, i);
|
|
30345
|
+
}
|
|
30346
|
+
}
|
|
30347
|
+
if (xmlData[i] !== ")") {
|
|
30348
|
+
throw new Error("Unterminated list of notations");
|
|
30349
|
+
}
|
|
30350
|
+
i++;
|
|
30351
|
+
attributeType += " (" + allowedNotations.join("|") + ")";
|
|
30352
|
+
} else {
|
|
30353
|
+
while (i < xmlData.length && !/\s/.test(xmlData[i])) {
|
|
30354
|
+
attributeType += xmlData[i];
|
|
30355
|
+
i++;
|
|
30356
|
+
}
|
|
30357
|
+
const validTypes = ["CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS"];
|
|
30358
|
+
if (!this.suppressValidationErr && !validTypes.includes(attributeType.toUpperCase())) {
|
|
30359
|
+
throw new Error(`Invalid attribute type: "${attributeType}"`);
|
|
30074
30360
|
}
|
|
30075
30361
|
}
|
|
30076
|
-
|
|
30077
|
-
|
|
30362
|
+
i = skipWhitespace2(xmlData, i);
|
|
30363
|
+
let defaultValue = "";
|
|
30364
|
+
if (xmlData.substring(i, i + 8).toUpperCase() === "#REQUIRED") {
|
|
30365
|
+
defaultValue = "#REQUIRED";
|
|
30366
|
+
i += 8;
|
|
30367
|
+
} else if (xmlData.substring(i, i + 7).toUpperCase() === "#IMPLIED") {
|
|
30368
|
+
defaultValue = "#IMPLIED";
|
|
30369
|
+
i += 7;
|
|
30370
|
+
} else {
|
|
30371
|
+
[i, defaultValue] = this.readIdentifierVal(xmlData, i, "ATTLIST");
|
|
30078
30372
|
}
|
|
30079
|
-
|
|
30080
|
-
|
|
30373
|
+
return {
|
|
30374
|
+
elementName,
|
|
30375
|
+
attributeName,
|
|
30376
|
+
attributeType,
|
|
30377
|
+
defaultValue,
|
|
30378
|
+
index: i
|
|
30379
|
+
};
|
|
30081
30380
|
}
|
|
30082
|
-
|
|
30083
|
-
|
|
30084
|
-
|
|
30085
|
-
|
|
30086
|
-
for (; i < xmlData.length && (xmlData[i] !== "'" && xmlData[i] !== '"'); i++) {
|
|
30087
|
-
entityName2 += xmlData[i];
|
|
30381
|
+
};
|
|
30382
|
+
var skipWhitespace2 = (data, index) => {
|
|
30383
|
+
while (index < data.length && /\s/.test(data[index])) {
|
|
30384
|
+
index++;
|
|
30088
30385
|
}
|
|
30089
|
-
|
|
30090
|
-
|
|
30091
|
-
|
|
30092
|
-
let
|
|
30093
|
-
|
|
30094
|
-
val2 += xmlData[i];
|
|
30386
|
+
return index;
|
|
30387
|
+
};
|
|
30388
|
+
function hasSeq2(data, seq, i) {
|
|
30389
|
+
for (let j = 0; j < seq.length; j++) {
|
|
30390
|
+
if (seq[j] !== data[i + j + 1]) return false;
|
|
30095
30391
|
}
|
|
30096
|
-
return
|
|
30097
|
-
}
|
|
30098
|
-
function isComment(xmlData, i) {
|
|
30099
|
-
if (xmlData[i + 1] === "!" && xmlData[i + 2] === "-" && xmlData[i + 3] === "-") return true;
|
|
30100
|
-
return false;
|
|
30101
|
-
}
|
|
30102
|
-
function isEntity(xmlData, i) {
|
|
30103
|
-
if (xmlData[i + 1] === "!" && xmlData[i + 2] === "E" && xmlData[i + 3] === "N" && xmlData[i + 4] === "T" && xmlData[i + 5] === "I" && xmlData[i + 6] === "T" && xmlData[i + 7] === "Y") return true;
|
|
30104
|
-
return false;
|
|
30105
|
-
}
|
|
30106
|
-
function isElement(xmlData, i) {
|
|
30107
|
-
if (xmlData[i + 1] === "!" && xmlData[i + 2] === "E" && xmlData[i + 3] === "L" && xmlData[i + 4] === "E" && xmlData[i + 5] === "M" && xmlData[i + 6] === "E" && xmlData[i + 7] === "N" && xmlData[i + 8] === "T") return true;
|
|
30108
|
-
return false;
|
|
30109
|
-
}
|
|
30110
|
-
function isAttlist(xmlData, i) {
|
|
30111
|
-
if (xmlData[i + 1] === "!" && xmlData[i + 2] === "A" && xmlData[i + 3] === "T" && xmlData[i + 4] === "T" && xmlData[i + 5] === "L" && xmlData[i + 6] === "I" && xmlData[i + 7] === "S" && xmlData[i + 8] === "T") return true;
|
|
30112
|
-
return false;
|
|
30113
|
-
}
|
|
30114
|
-
function isNotation(xmlData, i) {
|
|
30115
|
-
if (xmlData[i + 1] === "!" && xmlData[i + 2] === "N" && xmlData[i + 3] === "O" && xmlData[i + 4] === "T" && xmlData[i + 5] === "A" && xmlData[i + 6] === "T" && xmlData[i + 7] === "I" && xmlData[i + 8] === "O" && xmlData[i + 9] === "N") return true;
|
|
30116
|
-
return false;
|
|
30392
|
+
return true;
|
|
30117
30393
|
}
|
|
30118
30394
|
function validateEntityName3(name) {
|
|
30119
30395
|
if (util.isName(name))
|
|
@@ -30121,7 +30397,7 @@ var require_DocTypeReader = __commonJS({
|
|
|
30121
30397
|
else
|
|
30122
30398
|
throw new Error(`Invalid entity name ${name}`);
|
|
30123
30399
|
}
|
|
30124
|
-
module2.exports =
|
|
30400
|
+
module2.exports = DocTypeReader2;
|
|
30125
30401
|
}
|
|
30126
30402
|
});
|
|
30127
30403
|
|
|
@@ -30213,14 +30489,40 @@ var require_strnum = __commonJS({
|
|
|
30213
30489
|
}
|
|
30214
30490
|
});
|
|
30215
30491
|
|
|
30492
|
+
// ../../node_modules/fast-xml-parser/src/ignoreAttributes.js
|
|
30493
|
+
var require_ignoreAttributes = __commonJS({
|
|
30494
|
+
"../../node_modules/fast-xml-parser/src/ignoreAttributes.js"(exports2, module2) {
|
|
30495
|
+
function getIgnoreAttributesFn2(ignoreAttributes) {
|
|
30496
|
+
if (typeof ignoreAttributes === "function") {
|
|
30497
|
+
return ignoreAttributes;
|
|
30498
|
+
}
|
|
30499
|
+
if (Array.isArray(ignoreAttributes)) {
|
|
30500
|
+
return (attrName) => {
|
|
30501
|
+
for (const pattern of ignoreAttributes) {
|
|
30502
|
+
if (typeof pattern === "string" && attrName === pattern) {
|
|
30503
|
+
return true;
|
|
30504
|
+
}
|
|
30505
|
+
if (pattern instanceof RegExp && pattern.test(attrName)) {
|
|
30506
|
+
return true;
|
|
30507
|
+
}
|
|
30508
|
+
}
|
|
30509
|
+
};
|
|
30510
|
+
}
|
|
30511
|
+
return () => false;
|
|
30512
|
+
}
|
|
30513
|
+
module2.exports = getIgnoreAttributesFn2;
|
|
30514
|
+
}
|
|
30515
|
+
});
|
|
30516
|
+
|
|
30216
30517
|
// ../../node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js
|
|
30217
30518
|
var require_OrderedObjParser = __commonJS({
|
|
30218
30519
|
"../../node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js"(exports2, module2) {
|
|
30219
30520
|
"use strict";
|
|
30220
30521
|
var util = require_util2();
|
|
30221
30522
|
var xmlNode = require_xmlNode();
|
|
30222
|
-
var
|
|
30523
|
+
var DocTypeReader2 = require_DocTypeReader();
|
|
30223
30524
|
var toNumber2 = require_strnum();
|
|
30525
|
+
var getIgnoreAttributesFn2 = require_ignoreAttributes();
|
|
30224
30526
|
var OrderedObjParser2 = class {
|
|
30225
30527
|
constructor(options) {
|
|
30226
30528
|
this.options = options;
|
|
@@ -30248,8 +30550,8 @@ var require_OrderedObjParser = __commonJS({
|
|
|
30248
30550
|
"copyright": { regex: /&(copy|#169);/g, val: "\xA9" },
|
|
30249
30551
|
"reg": { regex: /&(reg|#174);/g, val: "\xAE" },
|
|
30250
30552
|
"inr": { regex: /&(inr|#8377);/g, val: "\u20B9" },
|
|
30251
|
-
"num_dec": { regex: /&#([0-9]{1,7});/g, val: (_, str) =>
|
|
30252
|
-
"num_hex": { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (_, str) =>
|
|
30553
|
+
"num_dec": { regex: /&#([0-9]{1,7});/g, val: (_, str) => fromCodePoint(str, 10, "&#") },
|
|
30554
|
+
"num_hex": { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (_, str) => fromCodePoint(str, 16, "&#x") }
|
|
30253
30555
|
};
|
|
30254
30556
|
this.addExternalEntities = addExternalEntities;
|
|
30255
30557
|
this.parseXml = parseXml3;
|
|
@@ -30261,38 +30563,55 @@ var require_OrderedObjParser = __commonJS({
|
|
|
30261
30563
|
this.readStopNodeData = readStopNodeData2;
|
|
30262
30564
|
this.saveTextToParentTag = saveTextToParentTag2;
|
|
30263
30565
|
this.addChild = addChild2;
|
|
30566
|
+
this.ignoreAttributesFn = getIgnoreAttributesFn2(this.options.ignoreAttributes);
|
|
30567
|
+
this.entityExpansionCount = 0;
|
|
30568
|
+
this.currentExpandedLength = 0;
|
|
30569
|
+
if (this.options.stopNodes && this.options.stopNodes.length > 0) {
|
|
30570
|
+
this.stopNodesExact = /* @__PURE__ */ new Set();
|
|
30571
|
+
this.stopNodesWildcard = /* @__PURE__ */ new Set();
|
|
30572
|
+
for (let i = 0; i < this.options.stopNodes.length; i++) {
|
|
30573
|
+
const stopNodeExp = this.options.stopNodes[i];
|
|
30574
|
+
if (typeof stopNodeExp !== "string") continue;
|
|
30575
|
+
if (stopNodeExp.startsWith("*.")) {
|
|
30576
|
+
this.stopNodesWildcard.add(stopNodeExp.substring(2));
|
|
30577
|
+
} else {
|
|
30578
|
+
this.stopNodesExact.add(stopNodeExp);
|
|
30579
|
+
}
|
|
30580
|
+
}
|
|
30581
|
+
}
|
|
30264
30582
|
}
|
|
30265
30583
|
};
|
|
30266
30584
|
function addExternalEntities(externalEntities) {
|
|
30267
30585
|
const entKeys = Object.keys(externalEntities);
|
|
30268
30586
|
for (let i = 0; i < entKeys.length; i++) {
|
|
30269
30587
|
const ent = entKeys[i];
|
|
30588
|
+
const escaped = ent.replace(/[.\-+*:]/g, "\\.");
|
|
30270
30589
|
this.lastEntities[ent] = {
|
|
30271
|
-
regex: new RegExp("&" +
|
|
30590
|
+
regex: new RegExp("&" + escaped + ";", "g"),
|
|
30272
30591
|
val: externalEntities[ent]
|
|
30273
30592
|
};
|
|
30274
30593
|
}
|
|
30275
30594
|
}
|
|
30276
|
-
function parseTextData2(
|
|
30277
|
-
if (
|
|
30595
|
+
function parseTextData2(val, tagName, jPath, dontTrim, hasAttributes, isLeafNode, escapeEntities) {
|
|
30596
|
+
if (val !== void 0) {
|
|
30278
30597
|
if (this.options.trimValues && !dontTrim) {
|
|
30279
|
-
|
|
30598
|
+
val = val.trim();
|
|
30280
30599
|
}
|
|
30281
|
-
if (
|
|
30282
|
-
if (!escapeEntities)
|
|
30283
|
-
const newval = this.options.tagValueProcessor(tagName,
|
|
30600
|
+
if (val.length > 0) {
|
|
30601
|
+
if (!escapeEntities) val = this.replaceEntitiesValue(val, tagName, jPath);
|
|
30602
|
+
const newval = this.options.tagValueProcessor(tagName, val, jPath, hasAttributes, isLeafNode);
|
|
30284
30603
|
if (newval === null || newval === void 0) {
|
|
30285
|
-
return
|
|
30286
|
-
} else if (typeof newval !== typeof
|
|
30604
|
+
return val;
|
|
30605
|
+
} else if (typeof newval !== typeof val || newval !== val) {
|
|
30287
30606
|
return newval;
|
|
30288
30607
|
} else if (this.options.trimValues) {
|
|
30289
|
-
return parseValue2(
|
|
30608
|
+
return parseValue2(val, this.options.parseTagValue, this.options.numberParseOptions);
|
|
30290
30609
|
} else {
|
|
30291
|
-
const trimmedVal =
|
|
30292
|
-
if (trimmedVal ===
|
|
30293
|
-
return parseValue2(
|
|
30610
|
+
const trimmedVal = val.trim();
|
|
30611
|
+
if (trimmedVal === val) {
|
|
30612
|
+
return parseValue2(val, this.options.parseTagValue, this.options.numberParseOptions);
|
|
30294
30613
|
} else {
|
|
30295
|
-
return
|
|
30614
|
+
return val;
|
|
30296
30615
|
}
|
|
30297
30616
|
}
|
|
30298
30617
|
}
|
|
@@ -30313,24 +30632,27 @@ var require_OrderedObjParser = __commonJS({
|
|
|
30313
30632
|
}
|
|
30314
30633
|
var attrsRegx2 = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
|
|
30315
30634
|
function buildAttributesMap2(attrStr, jPath, tagName) {
|
|
30316
|
-
if (
|
|
30635
|
+
if (this.options.ignoreAttributes !== true && typeof attrStr === "string") {
|
|
30317
30636
|
const matches = util.getAllMatches(attrStr, attrsRegx2);
|
|
30318
30637
|
const len = matches.length;
|
|
30319
30638
|
const attrs = {};
|
|
30320
30639
|
for (let i = 0; i < len; i++) {
|
|
30321
30640
|
const attrName = this.resolveNameSpace(matches[i][1]);
|
|
30641
|
+
if (this.ignoreAttributesFn(attrName, jPath)) {
|
|
30642
|
+
continue;
|
|
30643
|
+
}
|
|
30322
30644
|
let oldVal = matches[i][4];
|
|
30323
30645
|
let aName = this.options.attributeNamePrefix + attrName;
|
|
30324
30646
|
if (attrName.length) {
|
|
30325
30647
|
if (this.options.transformAttributeName) {
|
|
30326
30648
|
aName = this.options.transformAttributeName(aName);
|
|
30327
30649
|
}
|
|
30328
|
-
|
|
30650
|
+
aName = sanitizeName2(aName, this.options);
|
|
30329
30651
|
if (oldVal !== void 0) {
|
|
30330
30652
|
if (this.options.trimValues) {
|
|
30331
30653
|
oldVal = oldVal.trim();
|
|
30332
30654
|
}
|
|
30333
|
-
oldVal = this.replaceEntitiesValue(oldVal);
|
|
30655
|
+
oldVal = this.replaceEntitiesValue(oldVal, tagName, jPath);
|
|
30334
30656
|
const newVal = this.options.attributeValueProcessor(attrName, oldVal, jPath);
|
|
30335
30657
|
if (newVal === null || newVal === void 0) {
|
|
30336
30658
|
attrs[aName] = oldVal;
|
|
@@ -30365,6 +30687,9 @@ var require_OrderedObjParser = __commonJS({
|
|
|
30365
30687
|
let currentNode = xmlObj;
|
|
30366
30688
|
let textData = "";
|
|
30367
30689
|
let jPath = "";
|
|
30690
|
+
this.entityExpansionCount = 0;
|
|
30691
|
+
this.currentExpandedLength = 0;
|
|
30692
|
+
const docTypeReader = new DocTypeReader2(this.options.processEntities);
|
|
30368
30693
|
for (let i = 0; i < xmlData.length; i++) {
|
|
30369
30694
|
const ch = xmlData[i];
|
|
30370
30695
|
if (ch === "<") {
|
|
@@ -30409,7 +30734,7 @@ var require_OrderedObjParser = __commonJS({
|
|
|
30409
30734
|
if (tagData.tagName !== tagData.tagExp && tagData.attrExpPresent) {
|
|
30410
30735
|
childNode[":@"] = this.buildAttributesMap(tagData.tagExp, jPath, tagData.tagName);
|
|
30411
30736
|
}
|
|
30412
|
-
this.addChild(currentNode, childNode, jPath);
|
|
30737
|
+
this.addChild(currentNode, childNode, jPath, i);
|
|
30413
30738
|
}
|
|
30414
30739
|
i = tagData.closeIndex + 1;
|
|
30415
30740
|
} else if (xmlData.substr(i + 1, 3) === "!--") {
|
|
@@ -30421,19 +30746,19 @@ var require_OrderedObjParser = __commonJS({
|
|
|
30421
30746
|
}
|
|
30422
30747
|
i = endIndex;
|
|
30423
30748
|
} else if (xmlData.substr(i + 1, 2) === "!D") {
|
|
30424
|
-
const result = readDocType(xmlData, i);
|
|
30749
|
+
const result = docTypeReader.readDocType(xmlData, i);
|
|
30425
30750
|
this.docTypeEntities = result.entities;
|
|
30426
30751
|
i = result.i;
|
|
30427
30752
|
} else if (xmlData.substr(i + 1, 2) === "![") {
|
|
30428
30753
|
const closeIndex = findClosingIndex2(xmlData, "]]>", i, "CDATA is not closed.") - 2;
|
|
30429
30754
|
const tagExp = xmlData.substring(i + 9, closeIndex);
|
|
30430
30755
|
textData = this.saveTextToParentTag(textData, currentNode, jPath);
|
|
30431
|
-
let
|
|
30432
|
-
if (
|
|
30756
|
+
let val = this.parseTextData(tagExp, currentNode.tagname, jPath, true, false, true, true);
|
|
30757
|
+
if (val == void 0) val = "";
|
|
30433
30758
|
if (this.options.cdataPropName) {
|
|
30434
30759
|
currentNode.add(this.options.cdataPropName, [{ [this.options.textNodeName]: tagExp }]);
|
|
30435
30760
|
} else {
|
|
30436
|
-
currentNode.add(this.options.textNodeName,
|
|
30761
|
+
currentNode.add(this.options.textNodeName, val);
|
|
30437
30762
|
}
|
|
30438
30763
|
i = closeIndex + 2;
|
|
30439
30764
|
} else {
|
|
@@ -30444,7 +30769,14 @@ var require_OrderedObjParser = __commonJS({
|
|
|
30444
30769
|
let attrExpPresent = result.attrExpPresent;
|
|
30445
30770
|
let closeIndex = result.closeIndex;
|
|
30446
30771
|
if (this.options.transformTagName) {
|
|
30447
|
-
|
|
30772
|
+
const newTagName = this.options.transformTagName(tagName);
|
|
30773
|
+
if (tagExp === tagName) {
|
|
30774
|
+
tagExp = newTagName;
|
|
30775
|
+
}
|
|
30776
|
+
tagName = newTagName;
|
|
30777
|
+
}
|
|
30778
|
+
if (this.options.strictReservedNames && (tagName === this.options.commentPropName || tagName === this.options.cdataPropName || tagName === this.options.textNodeName || tagName === this.options.attributesGroupName)) {
|
|
30779
|
+
throw new Error(`Invalid tag name: ${tagName}`);
|
|
30448
30780
|
}
|
|
30449
30781
|
if (currentNode && textData) {
|
|
30450
30782
|
if (currentNode.tagname !== "!xml") {
|
|
@@ -30459,7 +30791,8 @@ var require_OrderedObjParser = __commonJS({
|
|
|
30459
30791
|
if (tagName !== xmlObj.tagname) {
|
|
30460
30792
|
jPath += jPath ? "." + tagName : tagName;
|
|
30461
30793
|
}
|
|
30462
|
-
|
|
30794
|
+
const startIndex = i;
|
|
30795
|
+
if (this.isItStopNode(this.stopNodesExact, this.stopNodesWildcard, jPath, tagName)) {
|
|
30463
30796
|
let tagContent = "";
|
|
30464
30797
|
if (tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1) {
|
|
30465
30798
|
if (tagName[tagName.length - 1] === "/") {
|
|
@@ -30487,7 +30820,7 @@ var require_OrderedObjParser = __commonJS({
|
|
|
30487
30820
|
}
|
|
30488
30821
|
jPath = jPath.substr(0, jPath.lastIndexOf("."));
|
|
30489
30822
|
childNode.add(this.options.textNodeName, tagContent);
|
|
30490
|
-
this.addChild(currentNode, childNode, jPath);
|
|
30823
|
+
this.addChild(currentNode, childNode, jPath, startIndex);
|
|
30491
30824
|
} else {
|
|
30492
30825
|
if (tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1) {
|
|
30493
30826
|
if (tagName[tagName.length - 1] === "/") {
|
|
@@ -30498,16 +30831,32 @@ var require_OrderedObjParser = __commonJS({
|
|
|
30498
30831
|
tagExp = tagExp.substr(0, tagExp.length - 1);
|
|
30499
30832
|
}
|
|
30500
30833
|
if (this.options.transformTagName) {
|
|
30501
|
-
|
|
30834
|
+
const newTagName = this.options.transformTagName(tagName);
|
|
30835
|
+
if (tagExp === tagName) {
|
|
30836
|
+
tagExp = newTagName;
|
|
30837
|
+
}
|
|
30838
|
+
tagName = newTagName;
|
|
30502
30839
|
}
|
|
30503
30840
|
const childNode = new xmlNode(tagName);
|
|
30504
30841
|
if (tagName !== tagExp && attrExpPresent) {
|
|
30505
30842
|
childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
|
|
30506
30843
|
}
|
|
30507
|
-
this.addChild(currentNode, childNode, jPath);
|
|
30844
|
+
this.addChild(currentNode, childNode, jPath, startIndex);
|
|
30508
30845
|
jPath = jPath.substr(0, jPath.lastIndexOf("."));
|
|
30846
|
+
} else if (this.options.unpairedTags.indexOf(tagName) !== -1) {
|
|
30847
|
+
const childNode = new xmlNode(tagName);
|
|
30848
|
+
if (tagName !== tagExp && attrExpPresent) {
|
|
30849
|
+
childNode[":@"] = this.buildAttributesMap(tagExp, jPath);
|
|
30850
|
+
}
|
|
30851
|
+
this.addChild(currentNode, childNode, jPath, startIndex);
|
|
30852
|
+
jPath = jPath.substr(0, jPath.lastIndexOf("."));
|
|
30853
|
+
i = result.closeIndex;
|
|
30854
|
+
continue;
|
|
30509
30855
|
} else {
|
|
30510
30856
|
const childNode = new xmlNode(tagName);
|
|
30857
|
+
if (this.tagsNodeStack.length > this.options.maxNestedTags) {
|
|
30858
|
+
throw new Error("Maximum nested tags exceeded");
|
|
30859
|
+
}
|
|
30511
30860
|
this.tagsNodeStack.push(currentNode);
|
|
30512
30861
|
if (tagName !== tagExp && attrExpPresent) {
|
|
30513
30862
|
childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
|
|
@@ -30525,59 +30874,110 @@ var require_OrderedObjParser = __commonJS({
|
|
|
30525
30874
|
}
|
|
30526
30875
|
return xmlObj.child;
|
|
30527
30876
|
};
|
|
30528
|
-
function addChild2(currentNode, childNode, jPath) {
|
|
30877
|
+
function addChild2(currentNode, childNode, jPath, startIndex) {
|
|
30878
|
+
if (!this.options.captureMetaData) startIndex = void 0;
|
|
30529
30879
|
const result = this.options.updateTag(childNode.tagname, jPath, childNode[":@"]);
|
|
30530
30880
|
if (result === false) {
|
|
30531
30881
|
} else if (typeof result === "string") {
|
|
30532
30882
|
childNode.tagname = result;
|
|
30533
|
-
currentNode.addChild(childNode);
|
|
30883
|
+
currentNode.addChild(childNode, startIndex);
|
|
30534
30884
|
} else {
|
|
30535
|
-
currentNode.addChild(childNode);
|
|
30885
|
+
currentNode.addChild(childNode, startIndex);
|
|
30536
30886
|
}
|
|
30537
30887
|
}
|
|
30538
|
-
var replaceEntitiesValue2 = function(
|
|
30539
|
-
if (
|
|
30540
|
-
|
|
30541
|
-
|
|
30542
|
-
|
|
30888
|
+
var replaceEntitiesValue2 = function(val, tagName, jPath) {
|
|
30889
|
+
if (val.indexOf("&") === -1) {
|
|
30890
|
+
return val;
|
|
30891
|
+
}
|
|
30892
|
+
const entityConfig = this.options.processEntities;
|
|
30893
|
+
if (!entityConfig.enabled) {
|
|
30894
|
+
return val;
|
|
30895
|
+
}
|
|
30896
|
+
if (entityConfig.allowedTags) {
|
|
30897
|
+
if (!entityConfig.allowedTags.includes(tagName)) {
|
|
30898
|
+
return val;
|
|
30899
|
+
}
|
|
30900
|
+
}
|
|
30901
|
+
if (entityConfig.tagFilter) {
|
|
30902
|
+
if (!entityConfig.tagFilter(tagName, jPath)) {
|
|
30903
|
+
return val;
|
|
30904
|
+
}
|
|
30905
|
+
}
|
|
30906
|
+
for (let entityName in this.docTypeEntities) {
|
|
30907
|
+
const entity = this.docTypeEntities[entityName];
|
|
30908
|
+
const matches = val.match(entity.regx);
|
|
30909
|
+
if (matches) {
|
|
30910
|
+
this.entityExpansionCount += matches.length;
|
|
30911
|
+
if (entityConfig.maxTotalExpansions && this.entityExpansionCount > entityConfig.maxTotalExpansions) {
|
|
30912
|
+
throw new Error(
|
|
30913
|
+
`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${entityConfig.maxTotalExpansions}`
|
|
30914
|
+
);
|
|
30915
|
+
}
|
|
30916
|
+
const lengthBefore = val.length;
|
|
30917
|
+
val = val.replace(entity.regx, entity.val);
|
|
30918
|
+
if (entityConfig.maxExpandedLength) {
|
|
30919
|
+
this.currentExpandedLength += val.length - lengthBefore;
|
|
30920
|
+
if (this.currentExpandedLength > entityConfig.maxExpandedLength) {
|
|
30921
|
+
throw new Error(
|
|
30922
|
+
`Total expanded content size exceeded: ${this.currentExpandedLength} > ${entityConfig.maxExpandedLength}`
|
|
30923
|
+
);
|
|
30924
|
+
}
|
|
30925
|
+
}
|
|
30543
30926
|
}
|
|
30544
|
-
|
|
30545
|
-
|
|
30546
|
-
|
|
30927
|
+
}
|
|
30928
|
+
if (val.indexOf("&") === -1) return val;
|
|
30929
|
+
for (const entityName of Object.keys(this.lastEntities)) {
|
|
30930
|
+
const entity = this.lastEntities[entityName];
|
|
30931
|
+
const matches = val.match(entity.regex);
|
|
30932
|
+
if (matches) {
|
|
30933
|
+
this.entityExpansionCount += matches.length;
|
|
30934
|
+
if (entityConfig.maxTotalExpansions && this.entityExpansionCount > entityConfig.maxTotalExpansions) {
|
|
30935
|
+
throw new Error(
|
|
30936
|
+
`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${entityConfig.maxTotalExpansions}`
|
|
30937
|
+
);
|
|
30938
|
+
}
|
|
30547
30939
|
}
|
|
30548
|
-
|
|
30549
|
-
|
|
30550
|
-
|
|
30551
|
-
|
|
30940
|
+
val = val.replace(entity.regex, entity.val);
|
|
30941
|
+
}
|
|
30942
|
+
if (val.indexOf("&") === -1) return val;
|
|
30943
|
+
if (this.options.htmlEntities) {
|
|
30944
|
+
for (const entityName of Object.keys(this.htmlEntities)) {
|
|
30945
|
+
const entity = this.htmlEntities[entityName];
|
|
30946
|
+
const matches = val.match(entity.regex);
|
|
30947
|
+
if (matches) {
|
|
30948
|
+
this.entityExpansionCount += matches.length;
|
|
30949
|
+
if (entityConfig.maxTotalExpansions && this.entityExpansionCount > entityConfig.maxTotalExpansions) {
|
|
30950
|
+
throw new Error(
|
|
30951
|
+
`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${entityConfig.maxTotalExpansions}`
|
|
30952
|
+
);
|
|
30953
|
+
}
|
|
30552
30954
|
}
|
|
30955
|
+
val = val.replace(entity.regex, entity.val);
|
|
30553
30956
|
}
|
|
30554
|
-
val2 = val2.replace(this.ampEntity.regex, this.ampEntity.val);
|
|
30555
30957
|
}
|
|
30556
|
-
|
|
30958
|
+
val = val.replace(this.ampEntity.regex, this.ampEntity.val);
|
|
30959
|
+
return val;
|
|
30557
30960
|
};
|
|
30558
|
-
function saveTextToParentTag2(textData,
|
|
30961
|
+
function saveTextToParentTag2(textData, parentNode, jPath, isLeafNode) {
|
|
30559
30962
|
if (textData) {
|
|
30560
|
-
if (isLeafNode === void 0) isLeafNode =
|
|
30963
|
+
if (isLeafNode === void 0) isLeafNode = parentNode.child.length === 0;
|
|
30561
30964
|
textData = this.parseTextData(
|
|
30562
30965
|
textData,
|
|
30563
|
-
|
|
30966
|
+
parentNode.tagname,
|
|
30564
30967
|
jPath,
|
|
30565
30968
|
false,
|
|
30566
|
-
|
|
30969
|
+
parentNode[":@"] ? Object.keys(parentNode[":@"]).length !== 0 : false,
|
|
30567
30970
|
isLeafNode
|
|
30568
30971
|
);
|
|
30569
30972
|
if (textData !== void 0 && textData !== "")
|
|
30570
|
-
|
|
30973
|
+
parentNode.add(this.options.textNodeName, textData);
|
|
30571
30974
|
textData = "";
|
|
30572
30975
|
}
|
|
30573
30976
|
return textData;
|
|
30574
30977
|
}
|
|
30575
|
-
function isItStopNode2(
|
|
30576
|
-
|
|
30577
|
-
|
|
30578
|
-
const stopNodeExp = stopNodes[stopNodePath];
|
|
30579
|
-
if (allNodesExp === stopNodeExp || jPath === stopNodeExp) return true;
|
|
30580
|
-
}
|
|
30978
|
+
function isItStopNode2(stopNodesExact, stopNodesWildcard, jPath, currentTagName) {
|
|
30979
|
+
if (stopNodesWildcard && stopNodesWildcard.has(currentTagName)) return true;
|
|
30980
|
+
if (stopNodesExact && stopNodesExact.has(jPath)) return true;
|
|
30581
30981
|
return false;
|
|
30582
30982
|
}
|
|
30583
30983
|
function tagExpWithClosingIndex2(xmlData, i, closingChar = ">") {
|
|
@@ -30685,20 +31085,36 @@ var require_OrderedObjParser = __commonJS({
|
|
|
30685
31085
|
}
|
|
30686
31086
|
}
|
|
30687
31087
|
}
|
|
30688
|
-
function parseValue2(
|
|
30689
|
-
if (shouldParse && typeof
|
|
30690
|
-
const newval =
|
|
31088
|
+
function parseValue2(val, shouldParse, options) {
|
|
31089
|
+
if (shouldParse && typeof val === "string") {
|
|
31090
|
+
const newval = val.trim();
|
|
30691
31091
|
if (newval === "true") return true;
|
|
30692
31092
|
else if (newval === "false") return false;
|
|
30693
|
-
else return toNumber2(
|
|
31093
|
+
else return toNumber2(val, options);
|
|
30694
31094
|
} else {
|
|
30695
|
-
if (util.isExist(
|
|
30696
|
-
return
|
|
31095
|
+
if (util.isExist(val)) {
|
|
31096
|
+
return val;
|
|
30697
31097
|
} else {
|
|
30698
31098
|
return "";
|
|
30699
31099
|
}
|
|
30700
31100
|
}
|
|
30701
31101
|
}
|
|
31102
|
+
function fromCodePoint(str, base, prefix) {
|
|
31103
|
+
const codePoint = Number.parseInt(str, base);
|
|
31104
|
+
if (codePoint >= 0 && codePoint <= 1114111) {
|
|
31105
|
+
return String.fromCodePoint(codePoint);
|
|
31106
|
+
} else {
|
|
31107
|
+
return prefix + str + ";";
|
|
31108
|
+
}
|
|
31109
|
+
}
|
|
31110
|
+
function sanitizeName2(name, options) {
|
|
31111
|
+
if (util.criticalProperties.includes(name)) {
|
|
31112
|
+
throw new Error(`[SECURITY] Invalid name: "${name}" is a reserved JavaScript keyword that could cause prototype pollution`);
|
|
31113
|
+
} else if (util.DANGEROUS_PROPERTY_NAMES.includes(name)) {
|
|
31114
|
+
return options.onDangerousProperty(name);
|
|
31115
|
+
}
|
|
31116
|
+
return name;
|
|
31117
|
+
}
|
|
30702
31118
|
module2.exports = OrderedObjParser2;
|
|
30703
31119
|
}
|
|
30704
31120
|
});
|
|
@@ -30725,26 +31141,26 @@ var require_node2json = __commonJS({
|
|
|
30725
31141
|
} else if (property === void 0) {
|
|
30726
31142
|
continue;
|
|
30727
31143
|
} else if (tagObj[property]) {
|
|
30728
|
-
let
|
|
30729
|
-
const isLeaf = isLeafTag2(
|
|
31144
|
+
let val = compress2(tagObj[property], options, newJpath);
|
|
31145
|
+
const isLeaf = isLeafTag2(val, options);
|
|
30730
31146
|
if (tagObj[":@"]) {
|
|
30731
|
-
assignAttributes2(
|
|
30732
|
-
} else if (Object.keys(
|
|
30733
|
-
|
|
30734
|
-
} else if (Object.keys(
|
|
30735
|
-
if (options.alwaysCreateTextNode)
|
|
30736
|
-
else
|
|
31147
|
+
assignAttributes2(val, tagObj[":@"], newJpath, options);
|
|
31148
|
+
} else if (Object.keys(val).length === 1 && val[options.textNodeName] !== void 0 && !options.alwaysCreateTextNode) {
|
|
31149
|
+
val = val[options.textNodeName];
|
|
31150
|
+
} else if (Object.keys(val).length === 0) {
|
|
31151
|
+
if (options.alwaysCreateTextNode) val[options.textNodeName] = "";
|
|
31152
|
+
else val = "";
|
|
30737
31153
|
}
|
|
30738
31154
|
if (compressedObj[property] !== void 0 && compressedObj.hasOwnProperty(property)) {
|
|
30739
31155
|
if (!Array.isArray(compressedObj[property])) {
|
|
30740
31156
|
compressedObj[property] = [compressedObj[property]];
|
|
30741
31157
|
}
|
|
30742
|
-
compressedObj[property].push(
|
|
31158
|
+
compressedObj[property].push(val);
|
|
30743
31159
|
} else {
|
|
30744
31160
|
if (options.isArray(property, newJpath, isLeaf)) {
|
|
30745
|
-
compressedObj[property] = [
|
|
31161
|
+
compressedObj[property] = [val];
|
|
30746
31162
|
} else {
|
|
30747
|
-
compressedObj[property] =
|
|
31163
|
+
compressedObj[property] = val;
|
|
30748
31164
|
}
|
|
30749
31165
|
}
|
|
30750
31166
|
}
|
|
@@ -30862,6 +31278,14 @@ var require_orderedJs2Xml = __commonJS({
|
|
|
30862
31278
|
function arrToStr(arr, options, jPath, indentation) {
|
|
30863
31279
|
let xmlStr = "";
|
|
30864
31280
|
let isPreviousElementTag = false;
|
|
31281
|
+
if (!Array.isArray(arr)) {
|
|
31282
|
+
if (arr !== void 0 && arr !== null) {
|
|
31283
|
+
let text = arr.toString();
|
|
31284
|
+
text = replaceEntitiesValue2(text, options);
|
|
31285
|
+
return text;
|
|
31286
|
+
}
|
|
31287
|
+
return "";
|
|
31288
|
+
}
|
|
30865
31289
|
for (let i = 0; i < arr.length; i++) {
|
|
30866
31290
|
const tagObj = arr[i];
|
|
30867
31291
|
const tagName = propName2(tagObj);
|
|
@@ -30932,7 +31356,7 @@ var require_orderedJs2Xml = __commonJS({
|
|
|
30932
31356
|
const keys2 = Object.keys(obj);
|
|
30933
31357
|
for (let i = 0; i < keys2.length; i++) {
|
|
30934
31358
|
const key = keys2[i];
|
|
30935
|
-
if (!
|
|
31359
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
30936
31360
|
if (key !== ":@") return key;
|
|
30937
31361
|
}
|
|
30938
31362
|
}
|
|
@@ -30940,7 +31364,7 @@ var require_orderedJs2Xml = __commonJS({
|
|
|
30940
31364
|
let attrStr = "";
|
|
30941
31365
|
if (attrMap && !options.ignoreAttributes) {
|
|
30942
31366
|
for (let attr in attrMap) {
|
|
30943
|
-
if (!
|
|
31367
|
+
if (!Object.prototype.hasOwnProperty.call(attrMap, attr)) continue;
|
|
30944
31368
|
let attrVal = options.attributeValueProcessor(attr, attrMap[attr]);
|
|
30945
31369
|
attrVal = replaceEntitiesValue2(attrVal, options);
|
|
30946
31370
|
if (attrVal === true && options.suppressBooleanAttributes) {
|
|
@@ -30978,6 +31402,7 @@ var require_json2xml = __commonJS({
|
|
|
30978
31402
|
"../../node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js"(exports2, module2) {
|
|
30979
31403
|
"use strict";
|
|
30980
31404
|
var buildFromOrderedJs = require_orderedJs2Xml();
|
|
31405
|
+
var getIgnoreAttributesFn2 = require_ignoreAttributes();
|
|
30981
31406
|
var defaultOptions3 = {
|
|
30982
31407
|
attributeNamePrefix: "@_",
|
|
30983
31408
|
attributesGroupName: false,
|
|
@@ -31014,11 +31439,12 @@ var require_json2xml = __commonJS({
|
|
|
31014
31439
|
};
|
|
31015
31440
|
function Builder(options) {
|
|
31016
31441
|
this.options = Object.assign({}, defaultOptions3, options);
|
|
31017
|
-
if (this.options.ignoreAttributes || this.options.attributesGroupName) {
|
|
31442
|
+
if (this.options.ignoreAttributes === true || this.options.attributesGroupName) {
|
|
31018
31443
|
this.isAttribute = function() {
|
|
31019
31444
|
return false;
|
|
31020
31445
|
};
|
|
31021
31446
|
} else {
|
|
31447
|
+
this.ignoreAttributesFn = getIgnoreAttributesFn2(this.options.ignoreAttributes);
|
|
31022
31448
|
this.attrPrefixLen = this.options.attributeNamePrefix.length;
|
|
31023
31449
|
this.isAttribute = isAttribute;
|
|
31024
31450
|
}
|
|
@@ -31044,38 +31470,41 @@ var require_json2xml = __commonJS({
|
|
|
31044
31470
|
[this.options.arrayNodeName]: jObj
|
|
31045
31471
|
};
|
|
31046
31472
|
}
|
|
31047
|
-
return this.j2x(jObj, 0).val;
|
|
31473
|
+
return this.j2x(jObj, 0, []).val;
|
|
31048
31474
|
}
|
|
31049
31475
|
};
|
|
31050
|
-
Builder.prototype.j2x = function(jObj, level) {
|
|
31476
|
+
Builder.prototype.j2x = function(jObj, level, ajPath) {
|
|
31051
31477
|
let attrStr = "";
|
|
31052
|
-
let
|
|
31478
|
+
let val = "";
|
|
31479
|
+
const jPath = ajPath.join(".");
|
|
31053
31480
|
for (let key in jObj) {
|
|
31054
31481
|
if (!Object.prototype.hasOwnProperty.call(jObj, key)) continue;
|
|
31055
31482
|
if (typeof jObj[key] === "undefined") {
|
|
31056
31483
|
if (this.isAttribute(key)) {
|
|
31057
|
-
|
|
31484
|
+
val += "";
|
|
31058
31485
|
}
|
|
31059
31486
|
} else if (jObj[key] === null) {
|
|
31060
31487
|
if (this.isAttribute(key)) {
|
|
31061
|
-
|
|
31488
|
+
val += "";
|
|
31489
|
+
} else if (key === this.options.cdataPropName) {
|
|
31490
|
+
val += "";
|
|
31062
31491
|
} else if (key[0] === "?") {
|
|
31063
|
-
|
|
31492
|
+
val += this.indentate(level) + "<" + key + "?" + this.tagEndChar;
|
|
31064
31493
|
} else {
|
|
31065
|
-
|
|
31494
|
+
val += this.indentate(level) + "<" + key + "/" + this.tagEndChar;
|
|
31066
31495
|
}
|
|
31067
31496
|
} else if (jObj[key] instanceof Date) {
|
|
31068
|
-
|
|
31497
|
+
val += this.buildTextValNode(jObj[key], key, "", level);
|
|
31069
31498
|
} else if (typeof jObj[key] !== "object") {
|
|
31070
31499
|
const attr = this.isAttribute(key);
|
|
31071
|
-
if (attr) {
|
|
31500
|
+
if (attr && !this.ignoreAttributesFn(attr, jPath)) {
|
|
31072
31501
|
attrStr += this.buildAttrPairStr(attr, "" + jObj[key]);
|
|
31073
|
-
} else {
|
|
31502
|
+
} else if (!attr) {
|
|
31074
31503
|
if (key === this.options.textNodeName) {
|
|
31075
31504
|
let newval = this.options.tagValueProcessor(key, "" + jObj[key]);
|
|
31076
|
-
|
|
31505
|
+
val += this.replaceEntitiesValue(newval);
|
|
31077
31506
|
} else {
|
|
31078
|
-
|
|
31507
|
+
val += this.buildTextValNode(jObj[key], key, "", level);
|
|
31079
31508
|
}
|
|
31080
31509
|
}
|
|
31081
31510
|
} else if (Array.isArray(jObj[key])) {
|
|
@@ -31086,17 +31515,17 @@ var require_json2xml = __commonJS({
|
|
|
31086
31515
|
const item = jObj[key][j];
|
|
31087
31516
|
if (typeof item === "undefined") {
|
|
31088
31517
|
} else if (item === null) {
|
|
31089
|
-
if (key[0] === "?")
|
|
31090
|
-
else
|
|
31518
|
+
if (key[0] === "?") val += this.indentate(level) + "<" + key + "?" + this.tagEndChar;
|
|
31519
|
+
else val += this.indentate(level) + "<" + key + "/" + this.tagEndChar;
|
|
31091
31520
|
} else if (typeof item === "object") {
|
|
31092
31521
|
if (this.options.oneListGroup) {
|
|
31093
|
-
const result = this.j2x(item, level + 1);
|
|
31522
|
+
const result = this.j2x(item, level + 1, ajPath.concat(key));
|
|
31094
31523
|
listTagVal += result.val;
|
|
31095
31524
|
if (this.options.attributesGroupName && item.hasOwnProperty(this.options.attributesGroupName)) {
|
|
31096
31525
|
listTagAttr += result.attrStr;
|
|
31097
31526
|
}
|
|
31098
31527
|
} else {
|
|
31099
|
-
listTagVal += this.processTextOrObjNode(item, key, level);
|
|
31528
|
+
listTagVal += this.processTextOrObjNode(item, key, level, ajPath);
|
|
31100
31529
|
}
|
|
31101
31530
|
} else {
|
|
31102
31531
|
if (this.options.oneListGroup) {
|
|
@@ -31111,7 +31540,7 @@ var require_json2xml = __commonJS({
|
|
|
31111
31540
|
if (this.options.oneListGroup) {
|
|
31112
31541
|
listTagVal = this.buildObjectNode(listTagVal, key, listTagAttr, level);
|
|
31113
31542
|
}
|
|
31114
|
-
|
|
31543
|
+
val += listTagVal;
|
|
31115
31544
|
} else {
|
|
31116
31545
|
if (this.options.attributesGroupName && key === this.options.attributesGroupName) {
|
|
31117
31546
|
const Ks = Object.keys(jObj[key]);
|
|
@@ -31120,29 +31549,29 @@ var require_json2xml = __commonJS({
|
|
|
31120
31549
|
attrStr += this.buildAttrPairStr(Ks[j], "" + jObj[key][Ks[j]]);
|
|
31121
31550
|
}
|
|
31122
31551
|
} else {
|
|
31123
|
-
|
|
31552
|
+
val += this.processTextOrObjNode(jObj[key], key, level, ajPath);
|
|
31124
31553
|
}
|
|
31125
31554
|
}
|
|
31126
31555
|
}
|
|
31127
|
-
return { attrStr, val
|
|
31556
|
+
return { attrStr, val };
|
|
31128
31557
|
};
|
|
31129
|
-
Builder.prototype.buildAttrPairStr = function(attrName,
|
|
31130
|
-
|
|
31131
|
-
|
|
31132
|
-
if (this.options.suppressBooleanAttributes &&
|
|
31558
|
+
Builder.prototype.buildAttrPairStr = function(attrName, val) {
|
|
31559
|
+
val = this.options.attributeValueProcessor(attrName, "" + val);
|
|
31560
|
+
val = this.replaceEntitiesValue(val);
|
|
31561
|
+
if (this.options.suppressBooleanAttributes && val === "true") {
|
|
31133
31562
|
return " " + attrName;
|
|
31134
|
-
} else return " " + attrName + '="' +
|
|
31563
|
+
} else return " " + attrName + '="' + val + '"';
|
|
31135
31564
|
};
|
|
31136
|
-
function processTextOrObjNode(object, key, level) {
|
|
31137
|
-
const result = this.j2x(object, level + 1);
|
|
31565
|
+
function processTextOrObjNode(object, key, level, ajPath) {
|
|
31566
|
+
const result = this.j2x(object, level + 1, ajPath.concat(key));
|
|
31138
31567
|
if (object[this.options.textNodeName] !== void 0 && Object.keys(object).length === 1) {
|
|
31139
31568
|
return this.buildTextValNode(object[this.options.textNodeName], key, result.attrStr, level);
|
|
31140
31569
|
} else {
|
|
31141
31570
|
return this.buildObjectNode(result.val, key, result.attrStr, level);
|
|
31142
31571
|
}
|
|
31143
31572
|
}
|
|
31144
|
-
Builder.prototype.buildObjectNode = function(
|
|
31145
|
-
if (
|
|
31573
|
+
Builder.prototype.buildObjectNode = function(val, key, attrStr, level) {
|
|
31574
|
+
if (val === "") {
|
|
31146
31575
|
if (key[0] === "?") return this.indentate(level) + "<" + key + attrStr + "?" + this.tagEndChar;
|
|
31147
31576
|
else {
|
|
31148
31577
|
return this.indentate(level) + "<" + key + attrStr + this.closeTag(key) + this.tagEndChar;
|
|
@@ -31154,12 +31583,12 @@ var require_json2xml = __commonJS({
|
|
|
31154
31583
|
piClosingChar = "?";
|
|
31155
31584
|
tagEndExp = "";
|
|
31156
31585
|
}
|
|
31157
|
-
if ((attrStr || attrStr === "") &&
|
|
31158
|
-
return this.indentate(level) + "<" + key + attrStr + piClosingChar + ">" +
|
|
31586
|
+
if ((attrStr || attrStr === "") && val.indexOf("<") === -1) {
|
|
31587
|
+
return this.indentate(level) + "<" + key + attrStr + piClosingChar + ">" + val + tagEndExp;
|
|
31159
31588
|
} else if (this.options.commentPropName !== false && key === this.options.commentPropName && piClosingChar.length === 0) {
|
|
31160
|
-
return this.indentate(level) + `<!--${
|
|
31589
|
+
return this.indentate(level) + `<!--${val}-->` + this.newLine;
|
|
31161
31590
|
} else {
|
|
31162
|
-
return this.indentate(level) + "<" + key + attrStr + piClosingChar + this.tagEndChar +
|
|
31591
|
+
return this.indentate(level) + "<" + key + attrStr + piClosingChar + this.tagEndChar + val + this.indentate(level) + tagEndExp;
|
|
31163
31592
|
}
|
|
31164
31593
|
}
|
|
31165
31594
|
};
|
|
@@ -31174,15 +31603,15 @@ var require_json2xml = __commonJS({
|
|
|
31174
31603
|
}
|
|
31175
31604
|
return closeTag;
|
|
31176
31605
|
};
|
|
31177
|
-
Builder.prototype.buildTextValNode = function(
|
|
31606
|
+
Builder.prototype.buildTextValNode = function(val, key, attrStr, level) {
|
|
31178
31607
|
if (this.options.cdataPropName !== false && key === this.options.cdataPropName) {
|
|
31179
|
-
return this.indentate(level) + `<![CDATA[${
|
|
31608
|
+
return this.indentate(level) + `<![CDATA[${val}]]>` + this.newLine;
|
|
31180
31609
|
} else if (this.options.commentPropName !== false && key === this.options.commentPropName) {
|
|
31181
|
-
return this.indentate(level) + `<!--${
|
|
31610
|
+
return this.indentate(level) + `<!--${val}-->` + this.newLine;
|
|
31182
31611
|
} else if (key[0] === "?") {
|
|
31183
31612
|
return this.indentate(level) + "<" + key + attrStr + "?" + this.tagEndChar;
|
|
31184
31613
|
} else {
|
|
31185
|
-
let textValue = this.options.tagValueProcessor(key,
|
|
31614
|
+
let textValue = this.options.tagValueProcessor(key, val);
|
|
31186
31615
|
textValue = this.replaceEntitiesValue(textValue);
|
|
31187
31616
|
if (textValue === "") {
|
|
31188
31617
|
return this.indentate(level) + "<" + key + attrStr + this.closeTag(key) + this.tagEndChar;
|
|
@@ -31569,6 +31998,9 @@ var LoticsClient = class {
|
|
|
31569
31998
|
import fs2 from "node:fs";
|
|
31570
31999
|
import path2 from "node:path";
|
|
31571
32000
|
import os from "node:os";
|
|
32001
|
+
function globalConfigFile() {
|
|
32002
|
+
return path2.join(os.homedir(), ".lotics", "config.json");
|
|
32003
|
+
}
|
|
31572
32004
|
function configFileForScope(scope) {
|
|
31573
32005
|
if (scope === "local") {
|
|
31574
32006
|
return path2.join(process.cwd(), ".lotics", "config.json");
|
|
@@ -31585,21 +32017,25 @@ function configFileForScope(scope) {
|
|
|
31585
32017
|
}
|
|
31586
32018
|
dir = parent;
|
|
31587
32019
|
}
|
|
31588
|
-
return
|
|
32020
|
+
return globalConfigFile();
|
|
31589
32021
|
}
|
|
31590
|
-
function
|
|
32022
|
+
function readConfigFile(file) {
|
|
31591
32023
|
try {
|
|
31592
|
-
const raw = fs2.readFileSync(
|
|
32024
|
+
const raw = fs2.readFileSync(file, "utf-8");
|
|
31593
32025
|
return JSON.parse(raw);
|
|
31594
32026
|
} catch {
|
|
31595
32027
|
return null;
|
|
31596
32028
|
}
|
|
31597
32029
|
}
|
|
31598
|
-
function
|
|
31599
|
-
const file = configFileForScope(scope);
|
|
32030
|
+
function writeConfigFile(file, config) {
|
|
31600
32031
|
fs2.mkdirSync(path2.dirname(file), { recursive: true, mode: 448 });
|
|
31601
|
-
|
|
31602
|
-
fs2.
|
|
32032
|
+
const tmp = `${file}.${process.pid}.tmp`;
|
|
32033
|
+
fs2.writeFileSync(tmp, JSON.stringify(config, null, 2) + "\n", { encoding: "utf-8", mode: 384 });
|
|
32034
|
+
fs2.chmodSync(tmp, 384);
|
|
32035
|
+
fs2.renameSync(tmp, file);
|
|
32036
|
+
}
|
|
32037
|
+
function saveConfig(config, scope = "auto") {
|
|
32038
|
+
writeConfigFile(configFileForScope(scope), config);
|
|
31603
32039
|
}
|
|
31604
32040
|
function deleteConfig(scope = "auto") {
|
|
31605
32041
|
try {
|
|
@@ -31610,9 +32046,154 @@ function deleteConfig(scope = "auto") {
|
|
|
31610
32046
|
function getConfigPath(scope = "auto") {
|
|
31611
32047
|
return configFileForScope(scope);
|
|
31612
32048
|
}
|
|
32049
|
+
function loadGlobalConfig() {
|
|
32050
|
+
return readConfigFile(globalConfigFile());
|
|
32051
|
+
}
|
|
32052
|
+
function saveGlobalConfig(config) {
|
|
32053
|
+
writeConfigFile(globalConfigFile(), config);
|
|
32054
|
+
}
|
|
32055
|
+
function loadLocalConfig() {
|
|
32056
|
+
const file = configFileForScope("auto");
|
|
32057
|
+
if (file === globalConfigFile()) return null;
|
|
32058
|
+
return readConfigFile(file);
|
|
32059
|
+
}
|
|
32060
|
+
function resolveProfileByNameOrId(profiles, nameOrId) {
|
|
32061
|
+
const byId = profiles[nameOrId];
|
|
32062
|
+
if (byId) return [nameOrId, byId];
|
|
32063
|
+
const matches = Object.entries(profiles).filter(
|
|
32064
|
+
([, p]) => p.org_name.toLowerCase() === nameOrId.toLowerCase()
|
|
32065
|
+
);
|
|
32066
|
+
if (matches.length === 1) return matches[0];
|
|
32067
|
+
if (matches.length > 1) {
|
|
32068
|
+
throw new Error(
|
|
32069
|
+
`"${nameOrId}" matches multiple saved orgs: ${matches.map(([id]) => id).join(", ")}. Use the org id.`
|
|
32070
|
+
);
|
|
32071
|
+
}
|
|
32072
|
+
return null;
|
|
32073
|
+
}
|
|
32074
|
+
function resolveContext(flags) {
|
|
32075
|
+
const envKey = process.env.LOTICS_API_KEY;
|
|
32076
|
+
const envOrg = process.env.LOTICS_ORG;
|
|
32077
|
+
const envWorkspace = process.env.LOTICS_WORKSPACE;
|
|
32078
|
+
const wsOverride = flags.workspace ?? envWorkspace;
|
|
32079
|
+
if (flags.apiKey) {
|
|
32080
|
+
return { apiKey: flags.apiKey, workspaceId: wsOverride, source: "flag" };
|
|
32081
|
+
}
|
|
32082
|
+
if (envKey) {
|
|
32083
|
+
return { apiKey: envKey, workspaceId: wsOverride, source: "env_key" };
|
|
32084
|
+
}
|
|
32085
|
+
const global2 = loadGlobalConfig();
|
|
32086
|
+
const profiles = global2?.profiles ?? {};
|
|
32087
|
+
if (envOrg) {
|
|
32088
|
+
const resolved = resolveProfileByNameOrId(profiles, envOrg);
|
|
32089
|
+
if (!resolved) {
|
|
32090
|
+
throw new Error(
|
|
32091
|
+
`LOTICS_ORG="${envOrg}" matches no saved credential. Run "lotics org" to list, or "lotics auth api-key <key>" to add one.`
|
|
32092
|
+
);
|
|
32093
|
+
}
|
|
32094
|
+
const [orgId, profile] = resolved;
|
|
32095
|
+
return {
|
|
32096
|
+
apiKey: profile.api_key,
|
|
32097
|
+
orgId,
|
|
32098
|
+
orgName: profile.org_name,
|
|
32099
|
+
workspaceId: wsOverride ?? profile.workspace_id,
|
|
32100
|
+
source: "env_org"
|
|
32101
|
+
};
|
|
32102
|
+
}
|
|
32103
|
+
const local = loadLocalConfig();
|
|
32104
|
+
if (local?.active_org) {
|
|
32105
|
+
const profile = profiles[local.active_org];
|
|
32106
|
+
if (!profile) {
|
|
32107
|
+
throw new Error(
|
|
32108
|
+
`This directory is pinned to org "${local.active_org}" (.lotics/config.json) but no saved credential exists for it. Run "lotics auth api-key <key>" while authenticated to that org.`
|
|
32109
|
+
);
|
|
32110
|
+
}
|
|
32111
|
+
return {
|
|
32112
|
+
apiKey: profile.api_key,
|
|
32113
|
+
orgId: local.active_org,
|
|
32114
|
+
orgName: profile.org_name,
|
|
32115
|
+
workspaceId: wsOverride ?? local.workspace_id ?? profile.workspace_id,
|
|
32116
|
+
source: "local_pointer"
|
|
32117
|
+
};
|
|
32118
|
+
}
|
|
32119
|
+
if (local && "api_key" in local) {
|
|
32120
|
+
throw new Error(
|
|
32121
|
+
`This directory's .lotics/config.json uses the old self-contained format (inline key), which is no longer supported. Re-pin with "lotics auth api-key <key> --local" (or "lotics org use <name|id> --local").`
|
|
32122
|
+
);
|
|
32123
|
+
}
|
|
32124
|
+
if (global2?.active_org) {
|
|
32125
|
+
const profile = profiles[global2.active_org];
|
|
32126
|
+
if (!profile) {
|
|
32127
|
+
throw new Error(
|
|
32128
|
+
`Active org "${global2.active_org}" has no saved credential. Run "lotics org use <name|id>" to pick one, or "lotics auth api-key <key>".`
|
|
32129
|
+
);
|
|
32130
|
+
}
|
|
32131
|
+
return {
|
|
32132
|
+
apiKey: profile.api_key,
|
|
32133
|
+
orgId: global2.active_org,
|
|
32134
|
+
orgName: profile.org_name,
|
|
32135
|
+
workspaceId: wsOverride ?? profile.workspace_id,
|
|
32136
|
+
source: "global_profile"
|
|
32137
|
+
};
|
|
32138
|
+
}
|
|
32139
|
+
return null;
|
|
32140
|
+
}
|
|
32141
|
+
function upsertProfile(orgId, fields) {
|
|
32142
|
+
const config = loadGlobalConfig() ?? {};
|
|
32143
|
+
const existing = config.profiles?.[orgId];
|
|
32144
|
+
const profile = {
|
|
32145
|
+
api_key: fields.api_key,
|
|
32146
|
+
org_name: fields.org_name,
|
|
32147
|
+
workspace_id: fields.workspace_id ?? existing?.workspace_id
|
|
32148
|
+
};
|
|
32149
|
+
saveGlobalConfig({
|
|
32150
|
+
profiles: { ...config.profiles, [orgId]: profile },
|
|
32151
|
+
active_org: config.active_org,
|
|
32152
|
+
email: config.email,
|
|
32153
|
+
last_update_check: config.last_update_check,
|
|
32154
|
+
latest_version: config.latest_version
|
|
32155
|
+
});
|
|
32156
|
+
}
|
|
32157
|
+
function removeProfile(orgId) {
|
|
32158
|
+
const config = loadGlobalConfig();
|
|
32159
|
+
if (!config?.profiles?.[orgId]) return;
|
|
32160
|
+
const { [orgId]: _removed, ...rest } = config.profiles;
|
|
32161
|
+
const remaining = Object.keys(rest);
|
|
32162
|
+
saveGlobalConfig({
|
|
32163
|
+
...config,
|
|
32164
|
+
profiles: rest,
|
|
32165
|
+
active_org: config.active_org === orgId ? remaining[0] : config.active_org
|
|
32166
|
+
});
|
|
32167
|
+
}
|
|
32168
|
+
function setActiveOrg(orgId, scope) {
|
|
32169
|
+
if (scope === "local") {
|
|
32170
|
+
saveConfig({ active_org: orgId }, "local");
|
|
32171
|
+
return;
|
|
32172
|
+
}
|
|
32173
|
+
const config = loadGlobalConfig() ?? {};
|
|
32174
|
+
saveGlobalConfig({ ...config, active_org: orgId });
|
|
32175
|
+
}
|
|
32176
|
+
function setSelectedWorkspace(workspaceId) {
|
|
32177
|
+
const local = loadLocalConfig();
|
|
32178
|
+
if (local?.active_org) {
|
|
32179
|
+
saveConfig({ ...local, workspace_id: workspaceId }, "auto");
|
|
32180
|
+
return { scope: "local", orgId: local.active_org };
|
|
32181
|
+
}
|
|
32182
|
+
const config = loadGlobalConfig() ?? {};
|
|
32183
|
+
const orgId = config.active_org;
|
|
32184
|
+
const profile = orgId ? config.profiles?.[orgId] : void 0;
|
|
32185
|
+
if (!orgId || !profile) {
|
|
32186
|
+
return null;
|
|
32187
|
+
}
|
|
32188
|
+
saveGlobalConfig({
|
|
32189
|
+
...config,
|
|
32190
|
+
profiles: { ...config.profiles, [orgId]: { ...profile, workspace_id: workspaceId } }
|
|
32191
|
+
});
|
|
32192
|
+
return { scope: "global", orgId };
|
|
32193
|
+
}
|
|
31613
32194
|
var UPDATE_CHECK_INTERVAL_MS = 24 * 60 * 60 * 1e3;
|
|
31614
32195
|
function checkForUpdate(currentVersion) {
|
|
31615
|
-
const config =
|
|
32196
|
+
const config = loadGlobalConfig();
|
|
31616
32197
|
const lastCheck = config?.last_update_check ?? 0;
|
|
31617
32198
|
if (Date.now() - lastCheck < UPDATE_CHECK_INTERVAL_MS) {
|
|
31618
32199
|
if (config?.latest_version && config.latest_version !== currentVersion) {
|
|
@@ -31622,8 +32203,8 @@ function checkForUpdate(currentVersion) {
|
|
|
31622
32203
|
}
|
|
31623
32204
|
fetchLatestVersion().then((latest) => {
|
|
31624
32205
|
if (!latest) return;
|
|
31625
|
-
const existing =
|
|
31626
|
-
|
|
32206
|
+
const existing = loadGlobalConfig() ?? {};
|
|
32207
|
+
saveGlobalConfig({ ...existing, last_update_check: Date.now(), latest_version: latest });
|
|
31627
32208
|
}).catch(() => {
|
|
31628
32209
|
});
|
|
31629
32210
|
}
|
|
@@ -31658,12 +32239,6 @@ Update available: ${current} \u2192 ${latest}`);
|
|
|
31658
32239
|
console.error(`Run: npm i -g @lotics/cli
|
|
31659
32240
|
`);
|
|
31660
32241
|
}
|
|
31661
|
-
function resolveAuth(flags) {
|
|
31662
|
-
const config = loadConfig();
|
|
31663
|
-
const apiKey = flags.apiKey ?? process.env.LOTICS_API_KEY ?? config?.api_key;
|
|
31664
|
-
if (!apiKey) return null;
|
|
31665
|
-
return { apiKey };
|
|
31666
|
-
}
|
|
31667
32242
|
|
|
31668
32243
|
// src/version.ts
|
|
31669
32244
|
import { readFileSync } from "node:fs";
|
|
@@ -31682,6 +32257,7 @@ import { tmpdir } from "node:os";
|
|
|
31682
32257
|
// src/starter_template.ts
|
|
31683
32258
|
var STARTER_FALLBACK_UI_VERSION = "1.8.0";
|
|
31684
32259
|
var STARTER_FALLBACK_SDK_VERSION = "0.11.0";
|
|
32260
|
+
var STARTER_REACT_NATIVE_VERSION = "0.85.3";
|
|
31685
32261
|
function buildStarterTemplate(args) {
|
|
31686
32262
|
const uiVersion = args.ui_version ?? `^${STARTER_FALLBACK_UI_VERSION}`;
|
|
31687
32263
|
const sdkVersion = args.sdk_version ?? `^${STARTER_FALLBACK_SDK_VERSION}`;
|
|
@@ -31713,7 +32289,7 @@ function buildStarterTemplate(args) {
|
|
|
31713
32289
|
"lucide-react-native": "^0.562.0",
|
|
31714
32290
|
react: "^19.0.0",
|
|
31715
32291
|
"react-dom": "^19.0.0",
|
|
31716
|
-
"react-native":
|
|
32292
|
+
"react-native": STARTER_REACT_NATIVE_VERSION,
|
|
31717
32293
|
"react-native-svg": "^15.0.0",
|
|
31718
32294
|
"react-native-web": "^0.21.0"
|
|
31719
32295
|
},
|
|
@@ -31791,6 +32367,11 @@ import react from "@vitejs/plugin-react";
|
|
|
31791
32367
|
// is identical to RN-SVG when running under RN-Web.
|
|
31792
32368
|
export default defineConfig({
|
|
31793
32369
|
plugins: [react()],
|
|
32370
|
+
// RN libraries (react-native-web, @react-native-picker's UnimplementedView)
|
|
32371
|
+
// reference the \`__DEV__\` global that Metro injects but Vite does not \u2014
|
|
32372
|
+
// undefined \u21D2 the bundle throws at load and the iframe renders blank. Define
|
|
32373
|
+
// it (false = production RN behaviour) so dev and the deployed build both boot.
|
|
32374
|
+
define: { __DEV__: "false" },
|
|
31794
32375
|
resolve: {
|
|
31795
32376
|
alias: [
|
|
31796
32377
|
{
|
|
@@ -31815,6 +32396,11 @@ export default defineConfig({
|
|
|
31815
32396
|
// Pre-bundling forces Vite to convert it to an ESM shim with a default
|
|
31816
32397
|
// export. Production build (rollup) handles it correctly without this.
|
|
31817
32398
|
include: ["recharts", "es-toolkit", "es-toolkit/compat"],
|
|
32399
|
+
// The dep optimizer pre-bundles deps with a SEPARATE esbuild pass that
|
|
32400
|
+
// top-level \`define\` doesn't always reach, so a pre-bundled RN dep can
|
|
32401
|
+
// still hit \`__DEV__ is not defined\` under \`lotics app dev\`. Define it
|
|
32402
|
+
// here too \u2014 belt-and-suspenders with the top-level \`define\` above.
|
|
32403
|
+
esbuildOptions: { define: { __DEV__: "false" } },
|
|
31818
32404
|
},
|
|
31819
32405
|
build: {
|
|
31820
32406
|
outDir: "dist",
|
|
@@ -32305,6 +32891,20 @@ function buildWrapperPage(args) {
|
|
|
32305
32891
|
return completed.file;
|
|
32306
32892
|
}
|
|
32307
32893
|
|
|
32894
|
+
// openExternal \u2014 the wrapper page is the top frame (un-sandboxed), so it
|
|
32895
|
+
// opens the link directly; NOT forwarded to the RPC endpoint (no server
|
|
32896
|
+
// op). Re-validate the scheme; never trust the iframe's payload.
|
|
32897
|
+
function handleOpenExternal(payload) {
|
|
32898
|
+
var url = payload && payload.url;
|
|
32899
|
+
if (typeof url !== "string") throw new Error("openExternal requires a url string");
|
|
32900
|
+
var parsed = new URL(url);
|
|
32901
|
+
if (parsed.protocol !== "https:" && parsed.protocol !== "http:") {
|
|
32902
|
+
throw new Error('openExternal: unsupported URL scheme "' + parsed.protocol + '"');
|
|
32903
|
+
}
|
|
32904
|
+
window.open(parsed.href, "_blank", "noopener,noreferrer");
|
|
32905
|
+
return undefined;
|
|
32906
|
+
}
|
|
32907
|
+
|
|
32308
32908
|
window.addEventListener("message", async function (event) {
|
|
32309
32909
|
if (event.source !== iframe.contentWindow || event.origin !== VITE_ORIGIN) return;
|
|
32310
32910
|
const msg = event.data;
|
|
@@ -32313,6 +32913,8 @@ function buildWrapperPage(args) {
|
|
|
32313
32913
|
try {
|
|
32314
32914
|
const data = msg.op === "upload"
|
|
32315
32915
|
? await handleUpload(msg.payload)
|
|
32916
|
+
: msg.op === "openExternal"
|
|
32917
|
+
? handleOpenExternal(msg.payload)
|
|
32316
32918
|
: await rpc(msg.op, msg.payload);
|
|
32317
32919
|
const ms = Math.round(performance.now() - startedAt);
|
|
32318
32920
|
console.debug("[lotics-dev] " + msg.op + " " + ms + "ms", data);
|
|
@@ -32942,11 +33544,13 @@ function parseArgs(argv) {
|
|
|
32942
33544
|
output: void 0,
|
|
32943
33545
|
as: void 0,
|
|
32944
33546
|
apiKey: void 0,
|
|
33547
|
+
workspace: void 0,
|
|
32945
33548
|
name: void 0,
|
|
32946
33549
|
timezone: void 0,
|
|
32947
33550
|
message: void 0,
|
|
32948
33551
|
forceWorkflowSync: false,
|
|
32949
33552
|
local: false,
|
|
33553
|
+
all: false,
|
|
32950
33554
|
version: false,
|
|
32951
33555
|
help: false
|
|
32952
33556
|
};
|
|
@@ -32974,6 +33578,10 @@ function parseArgs(argv) {
|
|
|
32974
33578
|
case "--api-key":
|
|
32975
33579
|
flags.apiKey = argv[++i];
|
|
32976
33580
|
break;
|
|
33581
|
+
case "--workspace":
|
|
33582
|
+
case "-w":
|
|
33583
|
+
flags.workspace = argv[++i];
|
|
33584
|
+
break;
|
|
32977
33585
|
case "--name":
|
|
32978
33586
|
flags.name = argv[++i];
|
|
32979
33587
|
break;
|
|
@@ -32990,6 +33598,9 @@ function parseArgs(argv) {
|
|
|
32990
33598
|
case "--local":
|
|
32991
33599
|
flags.local = true;
|
|
32992
33600
|
break;
|
|
33601
|
+
case "--all":
|
|
33602
|
+
flags.all = true;
|
|
33603
|
+
break;
|
|
32993
33604
|
case "--version":
|
|
32994
33605
|
case "-v":
|
|
32995
33606
|
flags.version = true;
|
|
@@ -34515,9 +35126,9 @@ function mergeEntityMaps(...maps) {
|
|
|
34515
35126
|
if (typeof raw === "string") {
|
|
34516
35127
|
out[key] = raw;
|
|
34517
35128
|
} else if (raw && typeof raw === "object" && raw.val !== void 0) {
|
|
34518
|
-
const
|
|
34519
|
-
if (typeof
|
|
34520
|
-
out[key] =
|
|
35129
|
+
const val = raw.val;
|
|
35130
|
+
if (typeof val === "string") {
|
|
35131
|
+
out[key] = val;
|
|
34521
35132
|
}
|
|
34522
35133
|
}
|
|
34523
35134
|
}
|
|
@@ -34890,11 +35501,11 @@ var defaultOptions2 = {
|
|
|
34890
35501
|
leadingZeros: true,
|
|
34891
35502
|
eNotation: true
|
|
34892
35503
|
},
|
|
34893
|
-
tagValueProcessor: function(tagName,
|
|
34894
|
-
return
|
|
35504
|
+
tagValueProcessor: function(tagName, val) {
|
|
35505
|
+
return val;
|
|
34895
35506
|
},
|
|
34896
|
-
attributeValueProcessor: function(attrName,
|
|
34897
|
-
return
|
|
35507
|
+
attributeValueProcessor: function(attrName, val) {
|
|
35508
|
+
return val;
|
|
34898
35509
|
},
|
|
34899
35510
|
stopNodes: [],
|
|
34900
35511
|
//nested tags will not be parsed even for errors
|
|
@@ -35009,9 +35620,9 @@ var XmlNode = class {
|
|
|
35009
35620
|
this.child = [];
|
|
35010
35621
|
this[":@"] = /* @__PURE__ */ Object.create(null);
|
|
35011
35622
|
}
|
|
35012
|
-
add(key,
|
|
35623
|
+
add(key, val) {
|
|
35013
35624
|
if (key === "__proto__") key = "#__proto__";
|
|
35014
|
-
this.child.push({ [key]:
|
|
35625
|
+
this.child.push({ [key]: val });
|
|
35015
35626
|
}
|
|
35016
35627
|
addChild(node, startIndex) {
|
|
35017
35628
|
if (node.tagname === "__proto__") node.tagname = "#__proto__";
|
|
@@ -35074,15 +35685,15 @@ var DocTypeReader = class {
|
|
|
35074
35685
|
if (xmlData[i] === "<" && !comment) {
|
|
35075
35686
|
if (hasBody && hasSeq(xmlData, "!ENTITY", i)) {
|
|
35076
35687
|
i += 7;
|
|
35077
|
-
let
|
|
35078
|
-
[
|
|
35079
|
-
if (
|
|
35688
|
+
let entityName, val;
|
|
35689
|
+
[entityName, val, i] = this.readEntityExp(xmlData, i + 1, this.suppressValidationErr);
|
|
35690
|
+
if (val.indexOf("&") === -1) {
|
|
35080
35691
|
if (this.options.enabled !== false && this.options.maxEntityCount != null && entityCount >= this.options.maxEntityCount) {
|
|
35081
35692
|
throw new Error(
|
|
35082
35693
|
`Entity count (${entityCount + 1}) exceeds maximum allowed (${this.options.maxEntityCount})`
|
|
35083
35694
|
);
|
|
35084
35695
|
}
|
|
35085
|
-
entities[
|
|
35696
|
+
entities[entityName] = val;
|
|
35086
35697
|
entityCount++;
|
|
35087
35698
|
}
|
|
35088
35699
|
} else if (hasBody && hasSeq(xmlData, "!ELEMENT", i)) {
|
|
@@ -35131,8 +35742,8 @@ var DocTypeReader = class {
|
|
|
35131
35742
|
while (i < xmlData.length && !/\s/.test(xmlData[i]) && xmlData[i] !== '"' && xmlData[i] !== "'") {
|
|
35132
35743
|
i++;
|
|
35133
35744
|
}
|
|
35134
|
-
let
|
|
35135
|
-
validateEntityName2(
|
|
35745
|
+
let entityName = xmlData.substring(startIndex, i);
|
|
35746
|
+
validateEntityName2(entityName, { xmlVersion: this.xmlVersion });
|
|
35136
35747
|
i = skipWhitespace(xmlData, i);
|
|
35137
35748
|
if (!this.suppressValidationErr) {
|
|
35138
35749
|
if (xmlData.substring(i, i + 6).toUpperCase() === "SYSTEM") {
|
|
@@ -35145,11 +35756,11 @@ var DocTypeReader = class {
|
|
|
35145
35756
|
[i, entityValue] = this.readIdentifierVal(xmlData, i, "entity");
|
|
35146
35757
|
if (this.options.enabled !== false && this.options.maxEntitySize != null && entityValue.length > this.options.maxEntitySize) {
|
|
35147
35758
|
throw new Error(
|
|
35148
|
-
`Entity "${
|
|
35759
|
+
`Entity "${entityName}" size (${entityValue.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`
|
|
35149
35760
|
);
|
|
35150
35761
|
}
|
|
35151
35762
|
i--;
|
|
35152
|
-
return [
|
|
35763
|
+
return [entityName, entityValue, i];
|
|
35153
35764
|
}
|
|
35154
35765
|
readNotationExp(xmlData, i) {
|
|
35155
35766
|
i = skipWhitespace(xmlData, i);
|
|
@@ -36330,28 +36941,28 @@ var OrderedObjParser = class {
|
|
|
36330
36941
|
}
|
|
36331
36942
|
}
|
|
36332
36943
|
};
|
|
36333
|
-
function parseTextData(
|
|
36944
|
+
function parseTextData(val, tagName, jPath, dontTrim, hasAttributes, isLeafNode, escapeEntities) {
|
|
36334
36945
|
const options = this.options;
|
|
36335
|
-
if (
|
|
36946
|
+
if (val !== void 0) {
|
|
36336
36947
|
if (options.trimValues && !dontTrim) {
|
|
36337
|
-
|
|
36948
|
+
val = val.trim();
|
|
36338
36949
|
}
|
|
36339
|
-
if (
|
|
36340
|
-
if (!escapeEntities)
|
|
36950
|
+
if (val.length > 0) {
|
|
36951
|
+
if (!escapeEntities) val = this.replaceEntitiesValue(val, tagName, jPath);
|
|
36341
36952
|
const jPathOrMatcher = options.jPath ? jPath.toString() : jPath;
|
|
36342
|
-
const newval = options.tagValueProcessor(tagName,
|
|
36953
|
+
const newval = options.tagValueProcessor(tagName, val, jPathOrMatcher, hasAttributes, isLeafNode);
|
|
36343
36954
|
if (newval === null || newval === void 0) {
|
|
36344
|
-
return
|
|
36345
|
-
} else if (typeof newval !== typeof
|
|
36955
|
+
return val;
|
|
36956
|
+
} else if (typeof newval !== typeof val || newval !== val) {
|
|
36346
36957
|
return newval;
|
|
36347
36958
|
} else if (options.trimValues) {
|
|
36348
|
-
return parseValue(
|
|
36959
|
+
return parseValue(val, options.parseTagValue, options.numberParseOptions);
|
|
36349
36960
|
} else {
|
|
36350
|
-
const trimmedVal =
|
|
36351
|
-
if (trimmedVal ===
|
|
36352
|
-
return parseValue(
|
|
36961
|
+
const trimmedVal = val.trim();
|
|
36962
|
+
if (trimmedVal === val) {
|
|
36963
|
+
return parseValue(val, options.parseTagValue, options.numberParseOptions);
|
|
36353
36964
|
} else {
|
|
36354
|
-
return
|
|
36965
|
+
return val;
|
|
36355
36966
|
}
|
|
36356
36967
|
}
|
|
36357
36968
|
}
|
|
@@ -36384,11 +36995,11 @@ function buildAttributesMap(attrStr, jPath, tagName, force = false) {
|
|
|
36384
36995
|
const attrName = this.resolveNameSpace(matches[i][1]);
|
|
36385
36996
|
const oldVal = matches[i][4];
|
|
36386
36997
|
if (attrName.length && oldVal !== void 0) {
|
|
36387
|
-
let
|
|
36388
|
-
if (options.trimValues)
|
|
36389
|
-
|
|
36390
|
-
processedVals[i] =
|
|
36391
|
-
rawAttrsForMatcher[attrName] =
|
|
36998
|
+
let val = oldVal;
|
|
36999
|
+
if (options.trimValues) val = val.trim();
|
|
37000
|
+
val = this.replaceEntitiesValue(val, tagName, this.readonlyMatcher);
|
|
37001
|
+
processedVals[i] = val;
|
|
37002
|
+
rawAttrsForMatcher[attrName] = val;
|
|
36392
37003
|
hasRawAttrs = true;
|
|
36393
37004
|
}
|
|
36394
37005
|
}
|
|
@@ -36510,12 +37121,12 @@ var parseXml = function(xmlData) {
|
|
|
36510
37121
|
const closeIndex = findClosingIndex(xmlData, "]]>", i, "CDATA is not closed.") - 2;
|
|
36511
37122
|
const tagExp = xmlData.substring(i + 9, closeIndex);
|
|
36512
37123
|
textData = this.saveTextToParentTag(textData, currentNode, this.readonlyMatcher);
|
|
36513
|
-
let
|
|
36514
|
-
if (
|
|
37124
|
+
let val = this.parseTextData(tagExp, currentNode.tagname, this.readonlyMatcher, true, false, true, true);
|
|
37125
|
+
if (val == void 0) val = "";
|
|
36515
37126
|
if (options.cdataPropName) {
|
|
36516
37127
|
currentNode.add(options.cdataPropName, [{ [options.textNodeName]: tagExp }]);
|
|
36517
37128
|
} else {
|
|
36518
|
-
currentNode.add(options.textNodeName,
|
|
37129
|
+
currentNode.add(options.textNodeName, val);
|
|
36519
37130
|
}
|
|
36520
37131
|
i = closeIndex + 2;
|
|
36521
37132
|
} else {
|
|
@@ -36645,25 +37256,25 @@ function addChild(currentNode, childNode, matcher, startIndex) {
|
|
|
36645
37256
|
currentNode.addChild(childNode, startIndex);
|
|
36646
37257
|
}
|
|
36647
37258
|
}
|
|
36648
|
-
function replaceEntitiesValue(
|
|
37259
|
+
function replaceEntitiesValue(val, tagName, jPath) {
|
|
36649
37260
|
const entityConfig = this.options.processEntities;
|
|
36650
37261
|
if (!entityConfig || !entityConfig.enabled) {
|
|
36651
|
-
return
|
|
37262
|
+
return val;
|
|
36652
37263
|
}
|
|
36653
37264
|
if (entityConfig.allowedTags) {
|
|
36654
37265
|
const jPathOrMatcher = this.options.jPath ? jPath.toString() : jPath;
|
|
36655
37266
|
const allowed = Array.isArray(entityConfig.allowedTags) ? entityConfig.allowedTags.includes(tagName) : entityConfig.allowedTags(tagName, jPathOrMatcher);
|
|
36656
37267
|
if (!allowed) {
|
|
36657
|
-
return
|
|
37268
|
+
return val;
|
|
36658
37269
|
}
|
|
36659
37270
|
}
|
|
36660
37271
|
if (entityConfig.tagFilter) {
|
|
36661
37272
|
const jPathOrMatcher = this.options.jPath ? jPath.toString() : jPath;
|
|
36662
37273
|
if (!entityConfig.tagFilter(tagName, jPathOrMatcher)) {
|
|
36663
|
-
return
|
|
37274
|
+
return val;
|
|
36664
37275
|
}
|
|
36665
37276
|
}
|
|
36666
|
-
return this.entityDecoder.decode(
|
|
37277
|
+
return this.entityDecoder.decode(val);
|
|
36667
37278
|
}
|
|
36668
37279
|
function saveTextToParentTag(textData, parentNode, matcher, isLeafNode) {
|
|
36669
37280
|
if (textData) {
|
|
@@ -36798,15 +37409,15 @@ function readStopNodeData(xmlData, tagName, i) {
|
|
|
36798
37409
|
}
|
|
36799
37410
|
}
|
|
36800
37411
|
}
|
|
36801
|
-
function parseValue(
|
|
36802
|
-
if (shouldParse && typeof
|
|
36803
|
-
const newval =
|
|
37412
|
+
function parseValue(val, shouldParse, options) {
|
|
37413
|
+
if (shouldParse && typeof val === "string") {
|
|
37414
|
+
const newval = val.trim();
|
|
36804
37415
|
if (newval === "true") return true;
|
|
36805
37416
|
else if (newval === "false") return false;
|
|
36806
|
-
else return toNumber(
|
|
37417
|
+
else return toNumber(val, options);
|
|
36807
37418
|
} else {
|
|
36808
|
-
if (isExist(
|
|
36809
|
-
return
|
|
37419
|
+
if (isExist(val)) {
|
|
37420
|
+
return val;
|
|
36810
37421
|
} else {
|
|
36811
37422
|
return "";
|
|
36812
37423
|
}
|
|
@@ -36870,33 +37481,33 @@ function compress(arr, options, matcher, readonlyMatcher) {
|
|
|
36870
37481
|
} else if (property === void 0) {
|
|
36871
37482
|
continue;
|
|
36872
37483
|
} else if (tagObj[property]) {
|
|
36873
|
-
let
|
|
36874
|
-
const isLeaf = isLeafTag(
|
|
36875
|
-
if (Object.keys(
|
|
36876
|
-
|
|
37484
|
+
let val = compress(tagObj[property], options, matcher, readonlyMatcher);
|
|
37485
|
+
const isLeaf = isLeafTag(val, options);
|
|
37486
|
+
if (Object.keys(val).length === 0 && options.alwaysCreateTextNode) {
|
|
37487
|
+
val[options.textNodeName] = "";
|
|
36877
37488
|
}
|
|
36878
37489
|
if (tagObj[":@"]) {
|
|
36879
|
-
assignAttributes(
|
|
36880
|
-
} else if (Object.keys(
|
|
36881
|
-
|
|
36882
|
-
} else if (Object.keys(
|
|
36883
|
-
if (options.alwaysCreateTextNode)
|
|
36884
|
-
else
|
|
37490
|
+
assignAttributes(val, tagObj[":@"], readonlyMatcher, options);
|
|
37491
|
+
} else if (Object.keys(val).length === 1 && val[options.textNodeName] !== void 0 && !options.alwaysCreateTextNode) {
|
|
37492
|
+
val = val[options.textNodeName];
|
|
37493
|
+
} else if (Object.keys(val).length === 0) {
|
|
37494
|
+
if (options.alwaysCreateTextNode) val[options.textNodeName] = "";
|
|
37495
|
+
else val = "";
|
|
36885
37496
|
}
|
|
36886
|
-
if (tagObj[METADATA_SYMBOL2] !== void 0 && typeof
|
|
36887
|
-
|
|
37497
|
+
if (tagObj[METADATA_SYMBOL2] !== void 0 && typeof val === "object" && val !== null) {
|
|
37498
|
+
val[METADATA_SYMBOL2] = tagObj[METADATA_SYMBOL2];
|
|
36888
37499
|
}
|
|
36889
37500
|
if (compressedObj[property] !== void 0 && Object.prototype.hasOwnProperty.call(compressedObj, property)) {
|
|
36890
37501
|
if (!Array.isArray(compressedObj[property])) {
|
|
36891
37502
|
compressedObj[property] = [compressedObj[property]];
|
|
36892
37503
|
}
|
|
36893
|
-
compressedObj[property].push(
|
|
37504
|
+
compressedObj[property].push(val);
|
|
36894
37505
|
} else {
|
|
36895
37506
|
const jPathOrMatcher = options.jPath ? readonlyMatcher.toString() : readonlyMatcher;
|
|
36896
37507
|
if (options.isArray(property, jPathOrMatcher, isLeaf)) {
|
|
36897
|
-
compressedObj[property] = [
|
|
37508
|
+
compressedObj[property] = [val];
|
|
36898
37509
|
} else {
|
|
36899
|
-
compressedObj[property] =
|
|
37510
|
+
compressedObj[property] = val;
|
|
36900
37511
|
}
|
|
36901
37512
|
}
|
|
36902
37513
|
if (property !== void 0 && property !== options.textNodeName) {
|
|
@@ -37734,14 +38345,14 @@ function inflateSync(data, opts) {
|
|
|
37734
38345
|
}
|
|
37735
38346
|
var fltn = function(d, p, t, o) {
|
|
37736
38347
|
for (var k in d) {
|
|
37737
|
-
var
|
|
37738
|
-
if (Array.isArray(
|
|
37739
|
-
op = mrg(o,
|
|
37740
|
-
if (
|
|
37741
|
-
t[n] = [
|
|
38348
|
+
var val = d[k], n = p + k, op = o;
|
|
38349
|
+
if (Array.isArray(val))
|
|
38350
|
+
op = mrg(o, val[1]), val = val[0];
|
|
38351
|
+
if (val instanceof u8)
|
|
38352
|
+
t[n] = [val, op];
|
|
37742
38353
|
else {
|
|
37743
38354
|
t[n += "/"] = [new u8(0), op];
|
|
37744
|
-
fltn(
|
|
38355
|
+
fltn(val, n, t, o);
|
|
37745
38356
|
}
|
|
37746
38357
|
}
|
|
37747
38358
|
};
|
|
@@ -38128,14 +38739,14 @@ function extractSchemeColor(el) {
|
|
|
38128
38739
|
if (!el) return "000000";
|
|
38129
38740
|
const srgb = el["a:srgbClr"];
|
|
38130
38741
|
if (srgb) {
|
|
38131
|
-
const
|
|
38132
|
-
const hex = typeof
|
|
38742
|
+
const val = Array.isArray(srgb) ? srgb[0] : srgb;
|
|
38743
|
+
const hex = typeof val === "object" && val !== null ? val["@_val"] : void 0;
|
|
38133
38744
|
if (hex) return hex;
|
|
38134
38745
|
}
|
|
38135
38746
|
const sys = el["a:sysClr"];
|
|
38136
38747
|
if (sys) {
|
|
38137
|
-
const
|
|
38138
|
-
const lastClr = typeof
|
|
38748
|
+
const val = Array.isArray(sys) ? sys[0] : sys;
|
|
38749
|
+
const lastClr = typeof val === "object" && val !== null ? val["@_lastClr"] : void 0;
|
|
38139
38750
|
if (lastClr) return lastClr;
|
|
38140
38751
|
}
|
|
38141
38752
|
return "000000";
|
|
@@ -39915,9 +40526,9 @@ function parsePageSetupElement(worksheet) {
|
|
|
39915
40526
|
for (const [key, def] of fields) {
|
|
39916
40527
|
const raw = pm[`@_${key}`];
|
|
39917
40528
|
if (raw === void 0) continue;
|
|
39918
|
-
const
|
|
39919
|
-
if (!Number.isNaN(
|
|
39920
|
-
margins[key] =
|
|
40529
|
+
const val = parseFloat(raw);
|
|
40530
|
+
if (!Number.isNaN(val) && Math.abs(val - def) > 1e-6) {
|
|
40531
|
+
margins[key] = val;
|
|
39921
40532
|
anyNonDefault = true;
|
|
39922
40533
|
}
|
|
39923
40534
|
}
|
|
@@ -39930,11 +40541,11 @@ function parseHeaderFooterElement(worksheet) {
|
|
|
39930
40541
|
if (!hf) return void 0;
|
|
39931
40542
|
const out = {};
|
|
39932
40543
|
const readText = (key) => {
|
|
39933
|
-
const
|
|
40544
|
+
const val = hf[key];
|
|
39934
40545
|
let raw;
|
|
39935
|
-
if (typeof
|
|
39936
|
-
else if (
|
|
39937
|
-
raw =
|
|
40546
|
+
if (typeof val === "string") raw = val;
|
|
40547
|
+
else if (val && typeof val === "object" && "#text" in val && typeof val["#text"] === "string") {
|
|
40548
|
+
raw = val["#text"];
|
|
39938
40549
|
}
|
|
39939
40550
|
return raw !== void 0 ? decodeXmlEntities(raw) : void 0;
|
|
39940
40551
|
};
|
|
@@ -40505,9 +41116,9 @@ function extractSparklineColor(group) {
|
|
|
40505
41116
|
if (!rgb) return void 0;
|
|
40506
41117
|
return `#${rgb.length === 8 ? rgb.slice(2) : rgb}`;
|
|
40507
41118
|
}
|
|
40508
|
-
function ensureSparkArray(
|
|
40509
|
-
if (
|
|
40510
|
-
return Array.isArray(
|
|
41119
|
+
function ensureSparkArray(val) {
|
|
41120
|
+
if (val === void 0 || val === null) return [];
|
|
41121
|
+
return Array.isArray(val) ? val : [val];
|
|
40511
41122
|
}
|
|
40512
41123
|
function parsePageBreaks(worksheet) {
|
|
40513
41124
|
const rowPageBreaks = [];
|
|
@@ -40532,9 +41143,9 @@ function parsePageBreaks(worksheet) {
|
|
|
40532
41143
|
}
|
|
40533
41144
|
return { rowPageBreaks: rowPageBreaks.sort((a, b) => a - b), colPageBreaks: colPageBreaks.sort((a, b) => a - b) };
|
|
40534
41145
|
}
|
|
40535
|
-
function ensureBreakArray(
|
|
40536
|
-
if (
|
|
40537
|
-
return Array.isArray(
|
|
41146
|
+
function ensureBreakArray(val) {
|
|
41147
|
+
if (val === void 0 || val === null) return [];
|
|
41148
|
+
return Array.isArray(val) ? val : [val];
|
|
40538
41149
|
}
|
|
40539
41150
|
function parseAutoFilter(worksheet) {
|
|
40540
41151
|
const afEl = worksheet["autoFilter"];
|
|
@@ -40552,8 +41163,8 @@ function parseAutoFilter(worksheet) {
|
|
|
40552
41163
|
const filterArr = filtersEl["filter"];
|
|
40553
41164
|
if (filterArr) {
|
|
40554
41165
|
for (const f of filterArr) {
|
|
40555
|
-
const
|
|
40556
|
-
if (
|
|
41166
|
+
const val = f["@_val"];
|
|
41167
|
+
if (val !== void 0) filterValues.push(decodeXmlEntities(val));
|
|
40557
41168
|
}
|
|
40558
41169
|
}
|
|
40559
41170
|
}
|
|
@@ -40746,9 +41357,9 @@ function extractSeriesName(txNode) {
|
|
|
40746
41357
|
}
|
|
40747
41358
|
function extractNumericValues(valNode) {
|
|
40748
41359
|
if (!valNode || typeof valNode !== "object") return [];
|
|
40749
|
-
const
|
|
40750
|
-
const numRef = getObj(
|
|
40751
|
-
const cache = numRef ? getObj(numRef, "c:numCache") ?? getObj(numRef, "numCache") : getObj(
|
|
41360
|
+
const val = valNode;
|
|
41361
|
+
const numRef = getObj(val, "c:numRef") ?? getObj(val, "numRef");
|
|
41362
|
+
const cache = numRef ? getObj(numRef, "c:numCache") ?? getObj(numRef, "numCache") : getObj(val, "c:numLit") ?? getObj(val, "numLit");
|
|
40752
41363
|
if (!cache || typeof cache !== "object") return [];
|
|
40753
41364
|
const pts = ensureArray(cache["c:pt"] ?? cache["pt"]);
|
|
40754
41365
|
const values2 = [];
|
|
@@ -40792,8 +41403,8 @@ function extractColor2(spPr) {
|
|
|
40792
41403
|
if (!solidFill || typeof solidFill !== "object") return void 0;
|
|
40793
41404
|
const srgb = getObj(solidFill, "a:srgbClr") ?? getObj(solidFill, "srgbClr");
|
|
40794
41405
|
if (srgb && typeof srgb === "object") {
|
|
40795
|
-
const
|
|
40796
|
-
if (typeof
|
|
41406
|
+
const val = srgb["@_val"];
|
|
41407
|
+
if (typeof val === "string") return `#${val}`;
|
|
40797
41408
|
}
|
|
40798
41409
|
return void 0;
|
|
40799
41410
|
}
|
|
@@ -40820,9 +41431,9 @@ function extractLegendPosition(legendNode) {
|
|
|
40820
41431
|
if (!legendNode || typeof legendNode !== "object") return void 0;
|
|
40821
41432
|
const pos = getObj(legendNode, "c:legendPos") ?? getObj(legendNode, "legendPos");
|
|
40822
41433
|
if (!pos || typeof pos !== "object") return void 0;
|
|
40823
|
-
const
|
|
41434
|
+
const val = pos["@_val"];
|
|
40824
41435
|
const map2 = { t: "top", b: "bottom", l: "left", r: "right" };
|
|
40825
|
-
return typeof
|
|
41436
|
+
return typeof val === "string" ? map2[val] ?? "right" : "right";
|
|
40826
41437
|
}
|
|
40827
41438
|
function parseAxes(plotArea) {
|
|
40828
41439
|
const axes = [];
|
|
@@ -40871,12 +41482,12 @@ function getObj(parent, key) {
|
|
|
40871
41482
|
function getAttr(obj, childKey, attr) {
|
|
40872
41483
|
const child = childKey ? obj[childKey] : obj;
|
|
40873
41484
|
if (!child || typeof child !== "object") return void 0;
|
|
40874
|
-
const
|
|
40875
|
-
return typeof
|
|
41485
|
+
const val = child[`@_${attr}`];
|
|
41486
|
+
return typeof val === "string" ? val : void 0;
|
|
40876
41487
|
}
|
|
40877
|
-
function ensureArray(
|
|
40878
|
-
if (
|
|
40879
|
-
return Array.isArray(
|
|
41488
|
+
function ensureArray(val) {
|
|
41489
|
+
if (val === void 0 || val === null) return [];
|
|
41490
|
+
return Array.isArray(val) ? val : [val];
|
|
40880
41491
|
}
|
|
40881
41492
|
|
|
40882
41493
|
// ../xlsx/src/ooxml_drawing.ts
|
|
@@ -41005,8 +41616,8 @@ function extractOutlineColor(spPr) {
|
|
|
41005
41616
|
function extractSrgb(fill) {
|
|
41006
41617
|
const srgb = fill["a:srgbClr"] ?? fill["srgbClr"];
|
|
41007
41618
|
if (srgb && typeof srgb === "object") {
|
|
41008
|
-
const
|
|
41009
|
-
if (typeof
|
|
41619
|
+
const val = srgb["@_val"];
|
|
41620
|
+
if (typeof val === "string") return `#${val}`;
|
|
41010
41621
|
}
|
|
41011
41622
|
return void 0;
|
|
41012
41623
|
}
|
|
@@ -41043,14 +41654,14 @@ function extractPicRId(pic) {
|
|
|
41043
41654
|
const rId = blip["@_r:embed"] ?? blip["@_embed"];
|
|
41044
41655
|
return typeof rId === "string" ? rId : void 0;
|
|
41045
41656
|
}
|
|
41046
|
-
function ensureArray2(
|
|
41047
|
-
if (
|
|
41048
|
-
return Array.isArray(
|
|
41657
|
+
function ensureArray2(val) {
|
|
41658
|
+
if (val === void 0 || val === null) return [];
|
|
41659
|
+
return Array.isArray(val) ? val : [val];
|
|
41049
41660
|
}
|
|
41050
|
-
function parseIntVal(
|
|
41051
|
-
if (typeof
|
|
41052
|
-
if (typeof
|
|
41053
|
-
const n = parseInt(
|
|
41661
|
+
function parseIntVal(val) {
|
|
41662
|
+
if (typeof val === "number") return val;
|
|
41663
|
+
if (typeof val === "string") {
|
|
41664
|
+
const n = parseInt(val, 10);
|
|
41054
41665
|
return isNaN(n) ? void 0 : n;
|
|
41055
41666
|
}
|
|
41056
41667
|
return void 0;
|
|
@@ -41122,12 +41733,12 @@ function extractTableRIds(rels) {
|
|
|
41122
41733
|
return result;
|
|
41123
41734
|
}
|
|
41124
41735
|
function strAttr(obj, attr) {
|
|
41125
|
-
const
|
|
41126
|
-
return typeof
|
|
41736
|
+
const val = obj[`@_${attr}`];
|
|
41737
|
+
return typeof val === "string" ? val : void 0;
|
|
41127
41738
|
}
|
|
41128
|
-
function ensureArray3(
|
|
41129
|
-
if (
|
|
41130
|
-
return Array.isArray(
|
|
41739
|
+
function ensureArray3(val) {
|
|
41740
|
+
if (val === void 0 || val === null) return [];
|
|
41741
|
+
return Array.isArray(val) ? val : [val];
|
|
41131
41742
|
}
|
|
41132
41743
|
|
|
41133
41744
|
// ../xlsx/src/ooxml_pivot.ts
|
|
@@ -41423,9 +42034,9 @@ function extractWorkbookPivotCaches(workbook) {
|
|
|
41423
42034
|
return out;
|
|
41424
42035
|
}
|
|
41425
42036
|
function strAttr2(obj, attr) {
|
|
41426
|
-
const
|
|
41427
|
-
if (typeof
|
|
41428
|
-
if (typeof
|
|
42037
|
+
const val = obj[`@_${attr}`];
|
|
42038
|
+
if (typeof val === "string") return val;
|
|
42039
|
+
if (typeof val === "number") return String(val);
|
|
41429
42040
|
return void 0;
|
|
41430
42041
|
}
|
|
41431
42042
|
function intAttr(obj, attr) {
|
|
@@ -41441,12 +42052,12 @@ function boolAttr(obj, attr, fallback) {
|
|
|
41441
42052
|
if (v === "0" || v === "false") return false;
|
|
41442
42053
|
return fallback;
|
|
41443
42054
|
}
|
|
41444
|
-
function ensureArray4(
|
|
41445
|
-
if (
|
|
41446
|
-
return Array.isArray(
|
|
42055
|
+
function ensureArray4(val) {
|
|
42056
|
+
if (val === void 0 || val === null) return [];
|
|
42057
|
+
return Array.isArray(val) ? val : [val];
|
|
41447
42058
|
}
|
|
41448
|
-
function asObj(
|
|
41449
|
-
return
|
|
42059
|
+
function asObj(val) {
|
|
42060
|
+
return val && typeof val === "object" ? val : {};
|
|
41450
42061
|
}
|
|
41451
42062
|
|
|
41452
42063
|
// ../xlsx/src/ooxml_shape.ts
|
|
@@ -41709,9 +42320,9 @@ function extractVmlText(textbox) {
|
|
|
41709
42320
|
}
|
|
41710
42321
|
return void 0;
|
|
41711
42322
|
}
|
|
41712
|
-
function ensureVmlArray(
|
|
41713
|
-
if (
|
|
41714
|
-
return Array.isArray(
|
|
42323
|
+
function ensureVmlArray(val) {
|
|
42324
|
+
if (val === void 0 || val === null) return [];
|
|
42325
|
+
return Array.isArray(val) ? val : [val];
|
|
41715
42326
|
}
|
|
41716
42327
|
|
|
41717
42328
|
// ../xlsx/src/excel_parser.ts
|
|
@@ -46313,20 +46924,31 @@ Lotics is an AI-powered operations platform. Through this CLI you can:
|
|
|
46313
46924
|
AUTHENTICATION
|
|
46314
46925
|
lotics auth Show auth help
|
|
46315
46926
|
lotics auth signup <email> Create account (run "lotics auth" for details)
|
|
46927
|
+
lotics auth api-key <key> Save a key \u2014 registers its org as a profile
|
|
46928
|
+
|
|
46929
|
+
ORGANIZATIONS
|
|
46930
|
+
Each saved API key belongs to one org. Register a key per org once, then
|
|
46931
|
+
switch between them with no re-pasting. Workspaces live inside an org.
|
|
46932
|
+
lotics org List saved orgs (marks active)
|
|
46933
|
+
lotics org use <name|id> Switch the active org
|
|
46934
|
+
lotics org use <name|id> --local Pin THIS directory to an org (worktrees)
|
|
46316
46935
|
|
|
46317
46936
|
USAGE
|
|
46318
46937
|
1. lotics auth signup <email> Create account or authenticate
|
|
46319
|
-
2. lotics
|
|
46320
|
-
3. lotics
|
|
46321
|
-
4. lotics tools
|
|
46322
|
-
5. lotics
|
|
46938
|
+
2. lotics org See saved orgs / which one is active
|
|
46939
|
+
3. lotics workspace Check current workspace (auto-selects if only one)
|
|
46940
|
+
4. lotics tools List available tools by category
|
|
46941
|
+
5. lotics tools <name> Show tool description and full input schema
|
|
46942
|
+
6. lotics run <tool> '<json>' Execute a tool with JSON arguments
|
|
46323
46943
|
|
|
46324
46944
|
Always inspect the schema (step 4) before calling a tool.
|
|
46325
46945
|
Tools are grouped by category (tables, records, views, etc.).
|
|
46326
46946
|
Query tools return IDs used as arguments to other tools.
|
|
46327
46947
|
|
|
46328
46948
|
COMMANDS
|
|
46329
|
-
lotics
|
|
46949
|
+
lotics org List saved orgs (marks active)
|
|
46950
|
+
lotics org use <name|id> [--local] Switch active org (--local pins this dir)
|
|
46951
|
+
lotics workspace List workspaces in the active org (marks current)
|
|
46330
46952
|
lotics workspace select <id> Switch to a different workspace
|
|
46331
46953
|
lotics workspace create <name> Create a new workspace (admin only)
|
|
46332
46954
|
lotics tools List all available tools
|
|
@@ -46357,15 +46979,23 @@ FLAGS
|
|
|
46357
46979
|
--timeout <ms> Timeout for tool execution (default: 60000)
|
|
46358
46980
|
-o <path> Output dir for downloads
|
|
46359
46981
|
--as <name> Override upload filename
|
|
46360
|
-
--api-key <key> API key (overrides saved config
|
|
46361
|
-
--
|
|
46982
|
+
--api-key <key> One-off API key (overrides saved config + env)
|
|
46983
|
+
--workspace <id> One-off workspace override (alias: -w)
|
|
46984
|
+
--local Pin the current directory (lotics org use / auth api-key)
|
|
46985
|
+
--all (lotics auth logout) Remove every saved credential
|
|
46362
46986
|
--version Show version
|
|
46363
46987
|
|
|
46364
46988
|
CONFIG
|
|
46365
|
-
|
|
46366
|
-
|
|
46367
|
-
|
|
46368
|
-
|
|
46989
|
+
API keys are stored once per org in the global ~/.lotics/config.json as named
|
|
46990
|
+
profiles. Switch with "lotics org use <name|id>" \u2014 no re-pasting. A directory
|
|
46991
|
+
(e.g. a git worktree) can pin its own org/workspace with "lotics org use
|
|
46992
|
+
<name|id> --local", which writes a .lotics/config.json pointer (the key is
|
|
46993
|
+
resolved from the global store) \u2014 so a global switch never disturbs it.
|
|
46994
|
+
|
|
46995
|
+
Resolution precedence (highest first):
|
|
46996
|
+
--api-key flag > LOTICS_API_KEY env > LOTICS_ORG env >
|
|
46997
|
+
local .lotics/config.json > global active profile
|
|
46998
|
+
LOTICS_WORKSPACE (or --workspace) overrides the workspace at any level.
|
|
46369
46999
|
|
|
46370
47000
|
OUTPUT
|
|
46371
47001
|
Default output is a compact text summary optimized for AI agents \u2014
|
|
@@ -46394,25 +47024,27 @@ function printAuthHelp() {
|
|
|
46394
47024
|
console.log(`Authentication commands:
|
|
46395
47025
|
|
|
46396
47026
|
lotics auth signup <email> Create account, org, workspace, and API key
|
|
46397
|
-
lotics auth api-key [key] Save an
|
|
47027
|
+
lotics auth api-key [key] Save an API key \u2014 registers its org as a profile
|
|
46398
47028
|
lotics auth web Send a magic link email to access the web app
|
|
46399
|
-
lotics auth whoami Show the
|
|
46400
|
-
lotics auth logout
|
|
47029
|
+
lotics auth whoami Show the active account, org, workspace, and source
|
|
47030
|
+
lotics auth logout [<name|id>] Remove a saved credential (default: the active org,
|
|
47031
|
+
or unpin the current directory)
|
|
47032
|
+
lotics auth logout --all Remove every saved credential
|
|
46401
47033
|
|
|
46402
47034
|
Auth flags:
|
|
46403
|
-
--local
|
|
46404
|
-
|
|
47035
|
+
--local Pin the current directory instead of the global store.
|
|
47036
|
+
signup/api-key write a self-contained ./.lotics/config.json
|
|
47037
|
+
(inline key) \u2014 for a hermetic worktree or CI.
|
|
46405
47038
|
--name <name> (signup) Display name (defaults to email prefix)
|
|
46406
47039
|
--timezone <timezone> (signup) Workspace timezone (defaults to UTC, e.g. Asia/Ho_Chi_Minh)
|
|
46407
47040
|
|
|
46408
|
-
|
|
46409
|
-
|
|
47041
|
+
API keys are stored once per org as named profiles in ~/.lotics/config.json.
|
|
47042
|
+
Registering a second key adds a profile \u2014 it does not overwrite the first.
|
|
47043
|
+
Switch active org with "lotics org use <name|id>".
|
|
46410
47044
|
|
|
46411
|
-
|
|
46412
|
-
|
|
46413
|
-
|
|
46414
|
-
its own account and workspace; --local creates one. Note: an exported
|
|
46415
|
-
LOTICS_API_KEY env var overrides the config file's key.`);
|
|
47045
|
+
Resolution precedence (highest first):
|
|
47046
|
+
--api-key flag > LOTICS_API_KEY env > LOTICS_ORG env > local .lotics/config.json
|
|
47047
|
+
> global active profile. LOTICS_WORKSPACE / --workspace override the workspace.`);
|
|
46416
47048
|
}
|
|
46417
47049
|
function readStdin() {
|
|
46418
47050
|
return new Promise((resolve, reject2) => {
|
|
@@ -46464,17 +47096,18 @@ async function handleSignup(positionalEmail, flags) {
|
|
|
46464
47096
|
}
|
|
46465
47097
|
process.exit(1);
|
|
46466
47098
|
}
|
|
46467
|
-
const
|
|
46468
|
-
const
|
|
46469
|
-
|
|
46470
|
-
|
|
46471
|
-
|
|
46472
|
-
|
|
46473
|
-
|
|
46474
|
-
|
|
47099
|
+
const apiKey = data.api_key;
|
|
47100
|
+
const orgId = data.organization_id;
|
|
47101
|
+
const workspaceId = data.workspace_id;
|
|
47102
|
+
const orgName = name || email.split("@")[0];
|
|
47103
|
+
upsertProfile(orgId, { api_key: apiKey, org_name: orgName, workspace_id: workspaceId });
|
|
47104
|
+
const existing = loadGlobalConfig() ?? {};
|
|
47105
|
+
saveGlobalConfig({ ...existing, email });
|
|
47106
|
+
setActiveOrg(orgId, flags.local ? "local" : "global");
|
|
46475
47107
|
console.error(`Account created. You can now use the CLI.`);
|
|
46476
|
-
console.error(` Email: ${
|
|
46477
|
-
console.error(`
|
|
47108
|
+
console.error(` Email: ${email}`);
|
|
47109
|
+
console.error(` Org: ${orgName} (${orgId})`);
|
|
47110
|
+
console.error(flags.local ? ` Pinned this directory: ${getConfigPath("local")}` : ` Saved to the "${orgName}" profile in ~/.lotics (now active)`);
|
|
46478
47111
|
console.error(`
|
|
46479
47112
|
Check your email for a magic link to access the Lotics web app.`);
|
|
46480
47113
|
console.error(`Run "lotics auth web" to request a new link at any time.`);
|
|
@@ -46486,53 +47119,70 @@ async function handleSetup(providedKey, local) {
|
|
|
46486
47119
|
process.exit(1);
|
|
46487
47120
|
}
|
|
46488
47121
|
const client = new LoticsClient({ apiKey });
|
|
46489
|
-
let
|
|
47122
|
+
let info;
|
|
46490
47123
|
try {
|
|
46491
|
-
|
|
46492
|
-
email = info.email;
|
|
47124
|
+
info = await client.whoami();
|
|
46493
47125
|
} catch (error) {
|
|
46494
47126
|
const message = error instanceof Error ? error.message : String(error);
|
|
46495
47127
|
console.error(`Authentication failed: ${message}`);
|
|
46496
47128
|
process.exit(1);
|
|
46497
47129
|
}
|
|
46498
|
-
|
|
46499
|
-
const existing = loadConfig(scope) ?? {};
|
|
46500
|
-
const newConfig = { ...existing, api_key: apiKey, email };
|
|
47130
|
+
let workspaceId;
|
|
46501
47131
|
try {
|
|
46502
47132
|
const workspaces = await client.listWorkspaces();
|
|
46503
47133
|
if (workspaces.length === 1) {
|
|
46504
|
-
|
|
47134
|
+
workspaceId = workspaces[0].id;
|
|
46505
47135
|
} else if (workspaces.length > 1) {
|
|
46506
47136
|
console.error(`
|
|
46507
|
-
Multiple workspaces
|
|
47137
|
+
Multiple workspaces in ${info.organization_name}. Run "lotics workspace select <id>" to choose one:`);
|
|
46508
47138
|
printWorkspaceList(workspaces);
|
|
46509
47139
|
}
|
|
46510
47140
|
} catch (error) {
|
|
46511
47141
|
const msg = error instanceof Error ? error.message : String(error);
|
|
46512
47142
|
console.error(`Warning: could not resolve workspace: ${msg}`);
|
|
46513
47143
|
}
|
|
46514
|
-
|
|
46515
|
-
|
|
46516
|
-
|
|
47144
|
+
upsertProfile(info.organization_id, {
|
|
47145
|
+
api_key: apiKey,
|
|
47146
|
+
org_name: info.organization_name,
|
|
47147
|
+
workspace_id: workspaceId
|
|
47148
|
+
});
|
|
47149
|
+
const existing = loadGlobalConfig() ?? {};
|
|
47150
|
+
saveGlobalConfig({ ...existing, email: info.email });
|
|
47151
|
+
setActiveOrg(info.organization_id, local ? "local" : "global");
|
|
47152
|
+
if (local) {
|
|
47153
|
+
console.error(`Authenticated as ${info.email} in ${info.organization_name}.`);
|
|
47154
|
+
console.error(` Pinned this directory: ${getConfigPath("local")}`);
|
|
47155
|
+
} else {
|
|
47156
|
+
console.error(`Authenticated as ${info.email} in ${info.organization_name} (now active).`);
|
|
47157
|
+
console.error(` Saved to the "${info.organization_name}" profile in ~/.lotics`);
|
|
47158
|
+
}
|
|
46517
47159
|
}
|
|
46518
47160
|
function requireClient(flags) {
|
|
46519
|
-
const
|
|
46520
|
-
if (!
|
|
46521
|
-
console.error('Not authenticated. Run "lotics auth signup" or set LOTICS_API_KEY.');
|
|
47161
|
+
const ctx = resolveContext(flags);
|
|
47162
|
+
if (!ctx) {
|
|
47163
|
+
console.error('Not authenticated. Run "lotics auth signup", "lotics auth api-key <key>", or set LOTICS_API_KEY.');
|
|
46522
47164
|
process.exit(1);
|
|
46523
47165
|
}
|
|
46524
|
-
|
|
46525
|
-
return new LoticsClient({ apiKey: auth.apiKey, workspaceId: config?.workspace_id });
|
|
47166
|
+
return { client: new LoticsClient({ apiKey: ctx.apiKey, workspaceId: ctx.workspaceId }), ctx };
|
|
46526
47167
|
}
|
|
47168
|
+
var SOURCE_LABELS = {
|
|
47169
|
+
flag: "--api-key flag",
|
|
47170
|
+
env_key: "LOTICS_API_KEY env",
|
|
47171
|
+
env_org: "LOTICS_ORG env",
|
|
47172
|
+
local_pointer: "local .lotics/config.json (pin)",
|
|
47173
|
+
global_profile: "global active profile"
|
|
47174
|
+
};
|
|
46527
47175
|
function printWorkspaceList(workspaces, currentId) {
|
|
46528
47176
|
for (const ws of workspaces) {
|
|
46529
47177
|
const marker = ws.id === currentId ? " (current)" : "";
|
|
46530
47178
|
console.error(` ${ws.id} ${ws.name} ${ws.timezone} ${ws.default_currency}${marker}`);
|
|
46531
47179
|
}
|
|
46532
47180
|
}
|
|
46533
|
-
async function resolveWorkspace(client) {
|
|
46534
|
-
|
|
46535
|
-
|
|
47181
|
+
async function resolveWorkspace(client, ctx) {
|
|
47182
|
+
if (ctx.workspaceId) {
|
|
47183
|
+
client.setWorkspaceId(ctx.workspaceId);
|
|
47184
|
+
return;
|
|
47185
|
+
}
|
|
46536
47186
|
let workspaces;
|
|
46537
47187
|
try {
|
|
46538
47188
|
workspaces = await client.listWorkspaces();
|
|
@@ -46546,8 +47196,7 @@ async function resolveWorkspace(client) {
|
|
|
46546
47196
|
process.exit(1);
|
|
46547
47197
|
}
|
|
46548
47198
|
if (workspaces.length === 1) {
|
|
46549
|
-
|
|
46550
|
-
saveConfig({ ...existing, workspace_id: workspaces[0].id });
|
|
47199
|
+
setSelectedWorkspace(workspaces[0].id);
|
|
46551
47200
|
client.setWorkspaceId(workspaces[0].id);
|
|
46552
47201
|
return;
|
|
46553
47202
|
}
|
|
@@ -46595,32 +47244,60 @@ async function main() {
|
|
|
46595
47244
|
return;
|
|
46596
47245
|
}
|
|
46597
47246
|
if (subcommand === "whoami") {
|
|
46598
|
-
const
|
|
46599
|
-
if (!
|
|
46600
|
-
console.error('Not authenticated. Run "lotics auth signup" or set LOTICS_API_KEY.');
|
|
47247
|
+
const ctx2 = resolveContext(flags);
|
|
47248
|
+
if (!ctx2) {
|
|
47249
|
+
console.error('Not authenticated. Run "lotics auth signup", "lotics auth api-key <key>", or set LOTICS_API_KEY.');
|
|
46601
47250
|
process.exit(1);
|
|
46602
47251
|
}
|
|
46603
|
-
const client2 = new LoticsClient({ apiKey:
|
|
47252
|
+
const client2 = new LoticsClient({ apiKey: ctx2.apiKey });
|
|
46604
47253
|
const info = await client2.whoami();
|
|
46605
|
-
const existing =
|
|
46606
|
-
|
|
47254
|
+
const existing = loadGlobalConfig() ?? {};
|
|
47255
|
+
saveGlobalConfig({ ...existing, email: info.email });
|
|
46607
47256
|
if (flags.json) {
|
|
46608
|
-
console.log(JSON.stringify(info, null, 2));
|
|
47257
|
+
console.log(JSON.stringify({ ...info, workspace_id: ctx2.workspaceId ?? null, source: ctx2.source }, null, 2));
|
|
46609
47258
|
} else {
|
|
46610
|
-
console.log(`Name:
|
|
46611
|
-
console.log(`Email:
|
|
46612
|
-
console.log(`Org:
|
|
47259
|
+
console.log(`Name: ${info.name}`);
|
|
47260
|
+
console.log(`Email: ${info.email}`);
|
|
47261
|
+
console.log(`Org: ${info.organization_name} (${info.organization_id})`);
|
|
47262
|
+
console.log(`Workspace: ${ctx2.workspaceId ?? "(none selected)"}`);
|
|
47263
|
+
console.log(`Source: ${SOURCE_LABELS[ctx2.source]}`);
|
|
46613
47264
|
}
|
|
46614
|
-
console.error(`Config: ${getConfigPath()}`);
|
|
46615
47265
|
return;
|
|
46616
47266
|
}
|
|
46617
47267
|
if (subcommand === "logout") {
|
|
46618
|
-
|
|
46619
|
-
|
|
47268
|
+
const local = loadLocalConfig();
|
|
47269
|
+
if (local && !flags.all && !toolArgs) {
|
|
47270
|
+
deleteConfig();
|
|
47271
|
+
console.error("Removed the local pin for this directory.");
|
|
47272
|
+
return;
|
|
47273
|
+
}
|
|
47274
|
+
if (flags.all) {
|
|
47275
|
+
const g2 = loadGlobalConfig();
|
|
47276
|
+
saveGlobalConfig({ last_update_check: g2?.last_update_check, latest_version: g2?.latest_version });
|
|
47277
|
+
console.error("Removed all saved credentials.");
|
|
47278
|
+
return;
|
|
47279
|
+
}
|
|
47280
|
+
const g = loadGlobalConfig() ?? {};
|
|
47281
|
+
const profiles = g.profiles ?? {};
|
|
47282
|
+
let resolved;
|
|
47283
|
+
if (toolArgs) {
|
|
47284
|
+
resolved = resolveProfileByNameOrId(profiles, toolArgs);
|
|
47285
|
+
} else if (g.active_org && profiles[g.active_org]) {
|
|
47286
|
+
resolved = [g.active_org, profiles[g.active_org]];
|
|
47287
|
+
} else {
|
|
47288
|
+
resolved = null;
|
|
47289
|
+
}
|
|
47290
|
+
if (!resolved) {
|
|
47291
|
+
console.error(toolArgs ? `No saved credential matches "${toolArgs}".` : "No active credential to remove. Pass an org name/id, or use --all.");
|
|
47292
|
+
process.exit(1);
|
|
47293
|
+
}
|
|
47294
|
+
const [orgId, profile] = resolved;
|
|
47295
|
+
removeProfile(orgId);
|
|
47296
|
+
console.error(`Removed the "${profile.org_name}" credential (${orgId}).`);
|
|
46620
47297
|
return;
|
|
46621
47298
|
}
|
|
46622
47299
|
if (subcommand === "web") {
|
|
46623
|
-
const client2 = requireClient(flags);
|
|
47300
|
+
const { client: client2 } = requireClient(flags);
|
|
46624
47301
|
const { email } = await client2.login();
|
|
46625
47302
|
console.error(`Magic link sent to ${email}. Check your email to access the Lotics web app.`);
|
|
46626
47303
|
return;
|
|
@@ -46640,6 +47317,63 @@ async function main() {
|
|
|
46640
47317
|
await runDocxCommand(subcommand, toolArgs, restArgs);
|
|
46641
47318
|
return;
|
|
46642
47319
|
}
|
|
47320
|
+
if (command === "org") {
|
|
47321
|
+
const global2 = loadGlobalConfig() ?? {};
|
|
47322
|
+
const profiles = global2.profiles ?? {};
|
|
47323
|
+
const local = loadLocalConfig();
|
|
47324
|
+
if (subcommand === "use") {
|
|
47325
|
+
if (!toolArgs) {
|
|
47326
|
+
console.error("Usage: lotics org use <name|id> [--local]");
|
|
47327
|
+
process.exit(1);
|
|
47328
|
+
}
|
|
47329
|
+
const resolved = resolveProfileByNameOrId(profiles, toolArgs);
|
|
47330
|
+
if (!resolved) {
|
|
47331
|
+
console.error(`No saved credential for "${toolArgs}". Run "lotics auth api-key <key>" while authenticated to that org, or "lotics org" to list.`);
|
|
47332
|
+
process.exit(1);
|
|
47333
|
+
}
|
|
47334
|
+
const [orgId, profile] = resolved;
|
|
47335
|
+
if (flags.local) {
|
|
47336
|
+
setActiveOrg(orgId, "local");
|
|
47337
|
+
console.error(`Pinned this directory to ${profile.org_name} (${orgId}).`);
|
|
47338
|
+
} else {
|
|
47339
|
+
setActiveOrg(orgId, "global");
|
|
47340
|
+
console.error(`Switched active org to ${profile.org_name} (${orgId}).`);
|
|
47341
|
+
if (local?.active_org) {
|
|
47342
|
+
console.error("Note: a local pin (.lotics/config.json) overrides the global default in this directory. Use --local to change the pin here.");
|
|
47343
|
+
}
|
|
47344
|
+
}
|
|
47345
|
+
return;
|
|
47346
|
+
}
|
|
47347
|
+
if (subcommand && subcommand !== "list") {
|
|
47348
|
+
console.error(`Unknown org subcommand: ${subcommand}`);
|
|
47349
|
+
console.error("Usage: lotics org [list | use <name|id> [--local]]");
|
|
47350
|
+
process.exit(1);
|
|
47351
|
+
}
|
|
47352
|
+
const orgIds = Object.keys(profiles);
|
|
47353
|
+
if (orgIds.length === 0) {
|
|
47354
|
+
console.error('No saved orgs. Run "lotics auth api-key <key>" to add one.');
|
|
47355
|
+
return;
|
|
47356
|
+
}
|
|
47357
|
+
const effectiveActive = local?.active_org ?? global2.active_org;
|
|
47358
|
+
if (flags.json) {
|
|
47359
|
+
console.log(JSON.stringify(
|
|
47360
|
+
orgIds.map((id) => ({
|
|
47361
|
+
org_id: id,
|
|
47362
|
+
org_name: profiles[id].org_name,
|
|
47363
|
+
workspace_id: profiles[id].workspace_id ?? null,
|
|
47364
|
+
active: id === effectiveActive
|
|
47365
|
+
})),
|
|
47366
|
+
null,
|
|
47367
|
+
2
|
|
47368
|
+
));
|
|
47369
|
+
} else {
|
|
47370
|
+
for (const id of orgIds) {
|
|
47371
|
+
const marker = id === effectiveActive ? " (active)" : "";
|
|
47372
|
+
console.log(`${id} ${profiles[id].org_name}${marker}`);
|
|
47373
|
+
}
|
|
47374
|
+
}
|
|
47375
|
+
return;
|
|
47376
|
+
}
|
|
46643
47377
|
if (command !== "tools" && command !== "upload" && command !== "run" && command !== "download" && command !== "workspace" && command !== "app") {
|
|
46644
47378
|
console.error(`Unknown command: ${command}`);
|
|
46645
47379
|
console.error('Run "lotics --help" for usage.');
|
|
@@ -46678,10 +47412,10 @@ async function main() {
|
|
|
46678
47412
|
console.error("Downloads every file on the given file field into the output dir.");
|
|
46679
47413
|
process.exit(1);
|
|
46680
47414
|
}
|
|
46681
|
-
const client = requireClient(flags);
|
|
47415
|
+
const { client, ctx } = requireClient(flags);
|
|
46682
47416
|
if (command === "workspace") {
|
|
46683
47417
|
const workspaces = await client.listWorkspaces();
|
|
46684
|
-
const
|
|
47418
|
+
const currentWorkspaceId = ctx.workspaceId;
|
|
46685
47419
|
if (subcommand === "select") {
|
|
46686
47420
|
const targetId = toolArgs;
|
|
46687
47421
|
if (!targetId) {
|
|
@@ -46693,12 +47427,16 @@ async function main() {
|
|
|
46693
47427
|
console.error(`Workspace not found: ${targetId}
|
|
46694
47428
|
|
|
46695
47429
|
Available workspaces:`);
|
|
46696
|
-
printWorkspaceList(workspaces,
|
|
47430
|
+
printWorkspaceList(workspaces, currentWorkspaceId);
|
|
46697
47431
|
process.exit(1);
|
|
46698
47432
|
}
|
|
46699
|
-
const
|
|
46700
|
-
|
|
46701
|
-
|
|
47433
|
+
const written = setSelectedWorkspace(target.id);
|
|
47434
|
+
if (!written) {
|
|
47435
|
+
console.error(`Switched to ${target.name} (${target.id}) for this command, but it could not be saved \u2014 credentials came from --api-key/LOTICS_API_KEY with no saved profile. Run "lotics auth api-key <key>" to persist a default.`);
|
|
47436
|
+
return;
|
|
47437
|
+
}
|
|
47438
|
+
const where = written.scope === "local" ? " (pinned to this directory)" : "";
|
|
47439
|
+
console.error(`Switched to workspace: ${target.name} (${target.id})${where}`);
|
|
46702
47440
|
return;
|
|
46703
47441
|
}
|
|
46704
47442
|
if (subcommand === "create") {
|
|
@@ -46709,8 +47447,7 @@ Available workspaces:`);
|
|
|
46709
47447
|
}
|
|
46710
47448
|
const timezone = flags.timezone;
|
|
46711
47449
|
const created = await client.createWorkspace({ name, timezone });
|
|
46712
|
-
|
|
46713
|
-
saveConfig({ ...existing, workspace_id: created.id });
|
|
47450
|
+
setSelectedWorkspace(created.id);
|
|
46714
47451
|
client.setWorkspaceId(created.id);
|
|
46715
47452
|
if (flags.json) {
|
|
46716
47453
|
console.log(JSON.stringify(created, null, 2));
|
|
@@ -46732,15 +47469,15 @@ Available workspaces:`);
|
|
|
46732
47469
|
console.error("No workspaces found.");
|
|
46733
47470
|
} else {
|
|
46734
47471
|
for (const ws of workspaces) {
|
|
46735
|
-
const marker = ws.id ===
|
|
47472
|
+
const marker = ws.id === currentWorkspaceId ? " (current)" : "";
|
|
46736
47473
|
console.log(`${ws.id} ${ws.name} ${ws.timezone} ${ws.default_currency}${marker}`);
|
|
46737
47474
|
}
|
|
46738
47475
|
}
|
|
46739
47476
|
}
|
|
46740
|
-
console.error(`
|
|
47477
|
+
if (ctx.orgName) console.error(`Org: ${ctx.orgName}`);
|
|
46741
47478
|
return;
|
|
46742
47479
|
}
|
|
46743
|
-
await resolveWorkspace(client);
|
|
47480
|
+
await resolveWorkspace(client, ctx);
|
|
46744
47481
|
if (command === "app") {
|
|
46745
47482
|
if (subcommand === "create") {
|
|
46746
47483
|
const name = toolArgs;
|