@cbortech/cbor 0.27.0 → 0.27.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.ja.md +73 -0
- package/README.md +75 -0
- package/dist/ast/CborAppSeqResult.d.ts +37 -4
- package/dist/ast/CborArray.d.ts +2 -2
- package/dist/ast/CborByteString.d.ts +2 -2
- package/dist/ast/CborEmbeddedCBOR.d.ts +1 -1
- package/dist/ast/CborFloat.d.ts +1 -1
- package/dist/ast/CborIndefiniteByteString.d.ts +1 -1
- package/dist/ast/CborIndefiniteTextString.d.ts +1 -1
- package/dist/ast/CborItem.d.ts +297 -7
- package/dist/ast/CborMap.d.ts +2 -2
- package/dist/ast/CborNint.d.ts +1 -1
- package/dist/ast/CborTag.d.ts +4 -4
- package/dist/ast/CborTextString.d.ts +2 -2
- package/dist/ast/CborUint.d.ts +1 -1
- package/dist/ast/index.cjs +1 -1
- package/dist/ast/index.js +1 -1
- package/dist/cddl/index.cjs +1 -1
- package/dist/cddl/index.js +1 -1
- package/dist/cdn/index.cjs +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/cdn/serialize-utils.d.ts +30 -2
- package/dist/extensions/cri.d.ts +2 -2
- package/dist/extensions/dt.d.ts +4 -4
- package/dist/extensions/ip.d.ts +3 -3
- package/dist/extensions/types.d.ts +40 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/{mapEntries-CvLdiN0h.js → mapEntries-CCLaJSaJ.js} +1114 -933
- package/dist/mapEntries-CCLaJSaJ.js.map +1 -0
- package/dist/mapEntries-CZZJScaj.cjs +13 -0
- package/dist/mapEntries-CZZJScaj.cjs.map +1 -0
- package/dist/{schema-CNfrVRYp.js → schema-DN9inJny.js} +3 -3
- package/dist/{schema-CNfrVRYp.js.map → schema-DN9inJny.js.map} +1 -1
- package/dist/{schema-iXpYtKQl.cjs → schema-zsg5yCPK.cjs} +2 -2
- package/dist/{schema-iXpYtKQl.cjs.map → schema-zsg5yCPK.cjs.map} +1 -1
- package/dist/{serialize-utils-CjTqQivB.cjs → serialize-utils-DhlW61ZX.cjs} +6 -6
- package/dist/serialize-utils-DhlW61ZX.cjs.map +1 -0
- package/dist/{serialize-utils-BuIZPaUc.js → serialize-utils-h-CVB9rg.js} +57 -47
- package/dist/{serialize-utils-BuIZPaUc.js.map → serialize-utils-h-CVB9rg.js.map} +1 -1
- package/dist/types.d.ts +273 -0
- package/dist/utils/hexfloat.d.ts +10 -2
- package/package.json +7 -8
- package/dist/mapEntries-C1f7G0AM.cjs +0 -13
- package/dist/mapEntries-C1f7G0AM.cjs.map +0 -1
- package/dist/mapEntries-CvLdiN0h.js.map +0 -1
- package/dist/serialize-utils-CjTqQivB.cjs.map +0 -1
|
@@ -940,21 +940,28 @@ function ee(e, t = !1) {
|
|
|
940
940
|
};
|
|
941
941
|
}
|
|
942
942
|
function j(e) {
|
|
943
|
-
let { options: t, depth: n, openChar: r, closeChar: i, count: a } = e, o = v(t), s = w(t), c = T(t), l =
|
|
944
|
-
if (
|
|
943
|
+
let { options: t, depth: n, openChar: r, closeChar: i, count: a } = e, o = v(t), s = w(t), c = T(t), l = !1;
|
|
944
|
+
if (o !== null) {
|
|
945
|
+
for (let n = 0; n < a; n++) if (e.hasEntryComments(n) && w(e.entryOptions ? e.entryOptions(n) : t)) {
|
|
946
|
+
l = !0;
|
|
947
|
+
break;
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
let u = o !== null && (s && C(e.node) || l), d = o !== null && !!t?.preserveBlankLines, f = !1;
|
|
951
|
+
if (d) {
|
|
945
952
|
for (let t = 0; t < a; t++) if (e.entryLeadingNode(t).blankLineBefore) {
|
|
946
|
-
|
|
953
|
+
f = !0;
|
|
947
954
|
break;
|
|
948
955
|
}
|
|
949
956
|
}
|
|
950
|
-
let { inlineSep:
|
|
951
|
-
if (o === null || a === 0 && !
|
|
957
|
+
let { inlineSep: p, multilineSep: m, trailSep: h, colSep: g } = ee(t, o === null), b = e.eiPosition ?? "open", x = e.indefiniteLength ? "" : Y(t, e.encodingWidth, () => J(e.canonicalCount ? e.canonicalCount() : BigInt(a))), S = b === "open" && x ? x + " " : "", E = b === "close" ? x : "", D = e.indefiniteLength && (e.indefiniteMarker ?? !0) && (t?.encodingIndicators ?? "auto") !== "never", k = (t) => e.indefiniteLength ? D ? a === 0 ? `${r}_ ${i}` : `${r}_ ${t}${i}` : `${r}${t}${i}` : `${r}${S}${t}${i}${E}`;
|
|
958
|
+
if (o === null || a === 0 && !u) {
|
|
952
959
|
let t = "";
|
|
953
|
-
for (let n = 0; n < a; n++) n > 0 && (t +=
|
|
954
|
-
return
|
|
960
|
+
for (let n = 0; n < a; n++) n > 0 && (t += p), t += e.renderEntry(n, g);
|
|
961
|
+
return k(t);
|
|
955
962
|
}
|
|
956
|
-
let
|
|
957
|
-
if ((t?.inlineLeafContainers || e.alwaysInlineLeaf) && a > 0 && !
|
|
963
|
+
let j = null;
|
|
964
|
+
if ((t?.inlineLeafContainers || e.alwaysInlineLeaf) && a > 0 && !u && !f) {
|
|
958
965
|
let t = !!e.entryIsLeaf, n = [], r = !0;
|
|
959
966
|
for (let i = 0; i < a; i++) {
|
|
960
967
|
if (e.entryIsLeaf && !e.entryIsLeaf(i)) {
|
|
@@ -965,7 +972,7 @@ function j(e) {
|
|
|
965
972
|
r = !1;
|
|
966
973
|
break;
|
|
967
974
|
}
|
|
968
|
-
let a = e.renderEntry(i,
|
|
975
|
+
let a = e.renderEntry(i, g);
|
|
969
976
|
if (n.push(a), a.includes("\n")) {
|
|
970
977
|
r = !1;
|
|
971
978
|
break;
|
|
@@ -975,31 +982,34 @@ function j(e) {
|
|
|
975
982
|
break;
|
|
976
983
|
}
|
|
977
984
|
}
|
|
978
|
-
if (r) return
|
|
979
|
-
|
|
980
|
-
}
|
|
981
|
-
let
|
|
982
|
-
for (let
|
|
983
|
-
|
|
984
|
-
let n = "";
|
|
985
|
-
if (
|
|
986
|
-
let { ownLines:
|
|
987
|
-
_(
|
|
985
|
+
if (r) return k(n.join(p));
|
|
986
|
+
j = n;
|
|
987
|
+
}
|
|
988
|
+
let M = y(o, n + 1), N = y(o, n), P = e.indefiniteLength ? D ? `${r}_ ` : r : `${r}${S}`, F = [];
|
|
989
|
+
for (let n = 0; n < a; n++) {
|
|
990
|
+
d && e.entryLeadingNode(n).blankLineBefore && F.push("");
|
|
991
|
+
let r = w(e.entryOptions ? e.entryOptions(n) : t), i = T(e.entryOptions ? e.entryOptions(n) : t), o = "";
|
|
992
|
+
if (r) {
|
|
993
|
+
let { ownLines: t, inlinePrefix: r } = O(e.entryLeadingNode(n), M, i);
|
|
994
|
+
_(F, t), o = r;
|
|
988
995
|
}
|
|
989
|
-
let
|
|
990
|
-
|
|
996
|
+
let s = n < a - 1 ? m : h, c = j?.[n] ?? e.renderEntry(n, g);
|
|
997
|
+
F.push(`${M}${o}${c}${s}${r ? e.entryTrailing(n, i) : ""}`);
|
|
991
998
|
}
|
|
992
|
-
return s && _(
|
|
999
|
+
return s && _(F, A(e.node, M, c)), `${P}\n${F.join("\n")}\n${N}${i}${E}`;
|
|
993
1000
|
}
|
|
994
|
-
function M(e, t, n, r, i, a, o) {
|
|
995
|
-
let
|
|
996
|
-
if (!(
|
|
997
|
-
let
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1001
|
+
function M(e, t, n, r, i, a, o, s) {
|
|
1002
|
+
let c = v(n), l = w(n), u = w(r);
|
|
1003
|
+
if (!(c !== null && (u && S(e) || l && C(t)))) return `${o}${a(i)}${s}`;
|
|
1004
|
+
let d = T(n), f = T(r), p = y(c, i + 1), m = y(c, i), { ownLines: h, inlinePrefix: g } = u ? O(e, p, f) : {
|
|
1005
|
+
ownLines: [],
|
|
1006
|
+
inlinePrefix: ""
|
|
1007
|
+
};
|
|
1008
|
+
return `${o}\n${[
|
|
1009
|
+
...h,
|
|
1010
|
+
`${p}${g}${a(i + 1)}${u ? k(e, f) : ""}`,
|
|
1011
|
+
...l ? A(t, p, d) : []
|
|
1012
|
+
].join("\n")}\n${m}${s}`;
|
|
1003
1013
|
}
|
|
1004
1014
|
var N = typeof (/* @__PURE__ */ new Uint8Array()).toBase64 == "function";
|
|
1005
1015
|
function P(e) {
|
|
@@ -1008,7 +1018,7 @@ function P(e) {
|
|
|
1008
1018
|
for (let n of e) t += String.fromCharCode(n);
|
|
1009
1019
|
return btoa(t).replace(/=/g, "");
|
|
1010
1020
|
}
|
|
1011
|
-
function
|
|
1021
|
+
function F(e) {
|
|
1012
1022
|
if (N) return e.toBase64({
|
|
1013
1023
|
alphabet: "base64url",
|
|
1014
1024
|
omitPadding: !0
|
|
@@ -1017,43 +1027,43 @@ function te(e) {
|
|
|
1017
1027
|
for (let n of e) t += String.fromCharCode(n);
|
|
1018
1028
|
return btoa(t).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
1019
1029
|
}
|
|
1020
|
-
var
|
|
1021
|
-
function
|
|
1030
|
+
var te = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", ne = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
|
|
1031
|
+
function I(e, t) {
|
|
1022
1032
|
let n = "", r = 0, i = 0;
|
|
1023
1033
|
for (let a of e) for (r = r << 8 | a, i += 8; i >= 5;) i -= 5, n += t[r >> i & 31];
|
|
1024
1034
|
return i > 0 && (n += t[r << 5 - i & 31]), n;
|
|
1025
1035
|
}
|
|
1026
|
-
function
|
|
1036
|
+
function re(e) {
|
|
1027
1037
|
for (let t of e) {
|
|
1028
1038
|
let e = t.codePointAt(0);
|
|
1029
1039
|
if (e < 32 || e === 127) return !0;
|
|
1030
1040
|
}
|
|
1031
1041
|
return !1;
|
|
1032
1042
|
}
|
|
1033
|
-
function
|
|
1043
|
+
function L(e, t) {
|
|
1034
1044
|
if (t === "string") {
|
|
1035
1045
|
let t = G(e);
|
|
1036
1046
|
if (t != null) return t;
|
|
1037
1047
|
}
|
|
1038
1048
|
if (t === "printable-string" || t === void 0) {
|
|
1039
1049
|
let t = G(e);
|
|
1040
|
-
if (t != null && !
|
|
1050
|
+
if (t != null && !re(t)) return t;
|
|
1041
1051
|
}
|
|
1042
1052
|
return null;
|
|
1043
1053
|
}
|
|
1044
|
-
function
|
|
1045
|
-
let r =
|
|
1054
|
+
function ie(e, t, n) {
|
|
1055
|
+
let r = L(e, n);
|
|
1046
1056
|
if (r !== null) return ye(r);
|
|
1047
1057
|
switch (t) {
|
|
1048
1058
|
case "base64": return `b64'${P(e)}'`;
|
|
1049
|
-
case "base64url": return `b64'${
|
|
1050
|
-
case "base32": return `b32'${
|
|
1051
|
-
case "base32hex": return `h32'${
|
|
1059
|
+
case "base64url": return `b64'${F(e)}'`;
|
|
1060
|
+
case "base32": return `b32'${I(e, te)}'`;
|
|
1061
|
+
case "base32hex": return `h32'${I(e, ne)}'`;
|
|
1052
1062
|
default: return `h'${o(e)}'`;
|
|
1053
1063
|
}
|
|
1054
1064
|
}
|
|
1055
|
-
function
|
|
1056
|
-
let n =
|
|
1065
|
+
function ae(e, t) {
|
|
1066
|
+
let n = L(e, t);
|
|
1057
1067
|
return n !== null && q(n);
|
|
1058
1068
|
}
|
|
1059
1069
|
var oe = /^[A-Za-z][A-Za-z0-9-]*['`]/;
|
|
@@ -1408,6 +1418,6 @@ function Oe(e, t, n, r, i) {
|
|
|
1408
1418
|
return a = Ee(a, n, i, o), a.replace(/_[0-3i]$/, "") + t;
|
|
1409
1419
|
}
|
|
1410
1420
|
//#endregion
|
|
1411
|
-
export { g as A, Y as C, w as D, j as E, u as F, e as I, c as M, o as N, O, l as P, T as S,
|
|
1421
|
+
export { g as A, Y as C, w as D, j as E, u as F, e as I, c as M, o as N, O, l as P, T as S, ie as T, R as _, D as a, _ as b, xe as c, k as d, S as f, q as g, se as h, E as i, d as j, me as k, we as l, ae as m, De as n, Te as o, y as p, J as r, be as s, Oe as t, Ce as u, x as v, v as w, M as x, b as y };
|
|
1412
1422
|
|
|
1413
|
-
//# sourceMappingURL=serialize-utils-
|
|
1423
|
+
//# sourceMappingURL=serialize-utils-h-CVB9rg.js.map
|