abra-flexi 0.5.6 → 0.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +18 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +18 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -96,7 +96,7 @@ function parsePropertyValue(propertyType, annot, obj) {
|
|
|
96
96
|
return new Date(parseInt(s[0], parseInt(s[1]) - 1));
|
|
97
97
|
case PropertyType.Numeric: return new big_js.Big(obj).round(annot?.decimals ?? 2);
|
|
98
98
|
case PropertyType.Logic: return obj.toLowerCase() === "true";
|
|
99
|
-
case PropertyType.Blob: return
|
|
99
|
+
case PropertyType.Blob: return base64ToBytes(obj);
|
|
100
100
|
case PropertyType.Array:
|
|
101
101
|
if (!annot?.itemType) throw new AFError(AFErrorCode.ITEM_TYPE_MISSING, "itemType is required for Array");
|
|
102
102
|
const myAnnot = { ...annot };
|
|
@@ -121,7 +121,7 @@ function serializePropertyValue(propertyType, annot, val) {
|
|
|
121
121
|
if (val instanceof big_js.Big) return val.toString();
|
|
122
122
|
return val;
|
|
123
123
|
case PropertyType.Logic: return !!val ? "true" : "false";
|
|
124
|
-
case PropertyType.Blob: return val
|
|
124
|
+
case PropertyType.Blob: return bytesToBase64(val);
|
|
125
125
|
case PropertyType.Array:
|
|
126
126
|
if (!annot?.itemType) throw new AFError(AFErrorCode.ITEM_TYPE_MISSING, "itemType is required for Array");
|
|
127
127
|
const myAnnot = { ...annot };
|
|
@@ -146,6 +146,22 @@ function dateToLocalIso(date) {
|
|
|
146
146
|
const offset = -date.getTimezoneOffset();
|
|
147
147
|
return `${yyyy}-${mm}-${dd}T${hh}:${mi}:${ss}.${ms}${offset >= 0 ? "+" : "-"}${pad(Math.floor(Math.abs(offset) / 60))}:${pad(Math.abs(offset) % 60)}`;
|
|
148
148
|
}
|
|
149
|
+
function base64ToBytes(base64) {
|
|
150
|
+
if (typeof Buffer !== "undefined") {
|
|
151
|
+
const buf = Buffer.from(base64, "base64");
|
|
152
|
+
return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
153
|
+
}
|
|
154
|
+
const binary = atob(base64);
|
|
155
|
+
const bytes = new Uint8Array(binary.length);
|
|
156
|
+
for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
|
|
157
|
+
return bytes;
|
|
158
|
+
}
|
|
159
|
+
function bytesToBase64(bytes) {
|
|
160
|
+
if (typeof Buffer !== "undefined") return Buffer.from(bytes).toString("base64");
|
|
161
|
+
let binary = "";
|
|
162
|
+
for (let i = 0; i < bytes.byteLength; i++) binary += String.fromCharCode(bytes[i]);
|
|
163
|
+
return btoa(binary);
|
|
164
|
+
}
|
|
149
165
|
function arraysEqual(a, b) {
|
|
150
166
|
if (a === b) return true;
|
|
151
167
|
if (a.length !== b.length) return false;
|
package/dist/index.d.cts
CHANGED
|
@@ -5054,7 +5054,7 @@ declare class AFPriloha extends AFEntity {
|
|
|
5054
5054
|
polSmlouvy?: AFSmlouvaPolozka | null;
|
|
5055
5055
|
uzel?: AFStrom | null;
|
|
5056
5056
|
adrUdalost?: AFUdalost | null;
|
|
5057
|
-
content?:
|
|
5057
|
+
content?: Uint8Array | null;
|
|
5058
5058
|
'uzivatelske-vazby'?: AFUzivatelskaVazba[];
|
|
5059
5059
|
get uzivatelskeVazby(): AFUzivatelskaVazba[] | undefined;
|
|
5060
5060
|
static propAnnotations: Record<string, TypeAnnotation>;
|