@bcts/dcbor 1.0.0-alpha.21 → 1.0.0-alpha.23
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 +1 -1
- package/dist/index.cjs +88 -158
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.iife.js +327 -446
- package/dist/index.iife.js.map +1 -1
- package/dist/index.mjs +87 -156
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -9
- package/src/diag.ts +4 -5
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value:
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
//#region \0rolldown/runtime.js
|
|
3
3
|
var __create = Object.create;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -6,18 +6,14 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
9
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
10
10
|
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
}
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
12
|
+
key = keys[i];
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
14
|
+
get: ((k) => from[k]).bind(null, key),
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
21
17
|
}
|
|
22
18
|
return to;
|
|
23
19
|
};
|
|
@@ -25,9 +21,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
21
|
value: mod,
|
|
26
22
|
enumerable: true
|
|
27
23
|
}) : target, mod));
|
|
28
|
-
|
|
29
24
|
//#endregion
|
|
30
|
-
|
|
31
25
|
//#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/shim-function.js
|
|
32
26
|
var require_shim_function = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
33
27
|
module.exports = Function;
|
|
@@ -82,7 +76,6 @@ var require_shim_function = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
82
76
|
};
|
|
83
77
|
};
|
|
84
78
|
}));
|
|
85
|
-
|
|
86
79
|
//#endregion
|
|
87
80
|
//#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/generic-collection.js
|
|
88
81
|
var require_generic_collection = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -301,7 +294,6 @@ var require_generic_collection = /* @__PURE__ */ __commonJSMin(((exports, module
|
|
|
301
294
|
Object.defineProperty(GenericCollection.prototype, "size", GenericCollection._sizePropertyDescriptor);
|
|
302
295
|
require_shim_array();
|
|
303
296
|
}));
|
|
304
|
-
|
|
305
297
|
//#endregion
|
|
306
298
|
//#region ../../node_modules/.bun/weak-map@1.0.8/node_modules/weak-map/weak-map.js
|
|
307
299
|
var require_weak_map$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -421,7 +413,6 @@ var require_weak_map$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
421
413
|
}
|
|
422
414
|
}
|
|
423
415
|
}
|
|
424
|
-
Object.prototype.hasOwnProperty;
|
|
425
416
|
var gopn = Object.getOwnPropertyNames;
|
|
426
417
|
var defProp = Object.defineProperty;
|
|
427
418
|
var isExtensible = Object.isExtensible;
|
|
@@ -464,8 +455,7 @@ var require_weak_map$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
464
455
|
var HIDDEN_NAME_PREFIX = "weakmap:";
|
|
465
456
|
var HIDDEN_NAME = HIDDEN_NAME_PREFIX + "ident:" + Math.random() + "___";
|
|
466
457
|
if (typeof crypto !== "undefined" && typeof crypto.getRandomValues === "function" && typeof ArrayBuffer === "function" && typeof Uint8Array === "function") {
|
|
467
|
-
var
|
|
468
|
-
var u8s = new Uint8Array(ab);
|
|
458
|
+
var u8s = new Uint8Array(/* @__PURE__ */ new ArrayBuffer(25));
|
|
469
459
|
crypto.getRandomValues(u8s);
|
|
470
460
|
HIDDEN_NAME = HIDDEN_NAME_PREFIX + "rand:" + Array.prototype.map.call(u8s, function(u8) {
|
|
471
461
|
return (u8 % 36).toString(36);
|
|
@@ -653,6 +643,10 @@ var require_weak_map$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
653
643
|
};
|
|
654
644
|
OurWeakMap.prototype = Object.create(Object.prototype, {
|
|
655
645
|
get: {
|
|
646
|
+
/**
|
|
647
|
+
* Return the value most recently associated with key, or
|
|
648
|
+
* opt_default if none.
|
|
649
|
+
*/
|
|
656
650
|
value: function get(key, opt_default) {
|
|
657
651
|
return this.get___(key, opt_default);
|
|
658
652
|
},
|
|
@@ -660,6 +654,9 @@ var require_weak_map$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
660
654
|
configurable: true
|
|
661
655
|
},
|
|
662
656
|
has: {
|
|
657
|
+
/**
|
|
658
|
+
* Is there a value associated with key in this WeakMap?
|
|
659
|
+
*/
|
|
663
660
|
value: function has(key) {
|
|
664
661
|
return this.has___(key);
|
|
665
662
|
},
|
|
@@ -667,6 +664,10 @@ var require_weak_map$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
667
664
|
configurable: true
|
|
668
665
|
},
|
|
669
666
|
set: {
|
|
667
|
+
/**
|
|
668
|
+
* Associate value with key in this WeakMap, overwriting any
|
|
669
|
+
* previous association if present.
|
|
670
|
+
*/
|
|
670
671
|
value: function set(key, value) {
|
|
671
672
|
return this.set___(key, value);
|
|
672
673
|
},
|
|
@@ -674,6 +675,18 @@ var require_weak_map$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
674
675
|
configurable: true
|
|
675
676
|
},
|
|
676
677
|
"delete": {
|
|
678
|
+
/**
|
|
679
|
+
* Remove any association for key in this WeakMap, returning
|
|
680
|
+
* whether there was one.
|
|
681
|
+
*
|
|
682
|
+
* <p>Note that the boolean return here does not work like the
|
|
683
|
+
* {@code delete} operator. The {@code delete} operator returns
|
|
684
|
+
* whether the deletion succeeds at bringing about a state in
|
|
685
|
+
* which the deleted property is absent. The {@code delete}
|
|
686
|
+
* operator therefore returns true if the property was already
|
|
687
|
+
* absent, whereas this {@code delete} method returns false if
|
|
688
|
+
* the association was already absent.
|
|
689
|
+
*/
|
|
677
690
|
value: function remove(key) {
|
|
678
691
|
return this.delete___(key);
|
|
679
692
|
},
|
|
@@ -745,13 +758,11 @@ var require_weak_map$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
745
758
|
}
|
|
746
759
|
})();
|
|
747
760
|
}));
|
|
748
|
-
|
|
749
761
|
//#endregion
|
|
750
762
|
//#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/weak-map.js
|
|
751
763
|
var require_weak_map = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
752
764
|
module.exports = typeof WeakMap !== "undefined" ? WeakMap : require_weak_map$1();
|
|
753
765
|
}));
|
|
754
|
-
|
|
755
766
|
//#endregion
|
|
756
767
|
//#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/shim-object.js
|
|
757
768
|
var require_shim_object = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -1171,7 +1182,6 @@ var require_shim_object = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1171
1182
|
return object;
|
|
1172
1183
|
};
|
|
1173
1184
|
}));
|
|
1174
|
-
|
|
1175
1185
|
//#endregion
|
|
1176
1186
|
//#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/generic-order.js
|
|
1177
1187
|
var require_generic_order = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -1205,7 +1215,6 @@ var require_generic_order = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
1205
1215
|
return this.toArray();
|
|
1206
1216
|
};
|
|
1207
1217
|
}));
|
|
1208
|
-
|
|
1209
1218
|
//#endregion
|
|
1210
1219
|
//#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/shim-array.js
|
|
1211
1220
|
var require_shim_array = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -1480,7 +1489,6 @@ var require_shim_array = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1480
1489
|
return this._iterationObject;
|
|
1481
1490
|
};
|
|
1482
1491
|
}));
|
|
1483
|
-
|
|
1484
1492
|
//#endregion
|
|
1485
1493
|
//#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/shim-regexp.js
|
|
1486
1494
|
var require_shim_regexp = /* @__PURE__ */ __commonJSMin((() => {
|
|
@@ -1497,7 +1505,6 @@ var require_shim_regexp = /* @__PURE__ */ __commonJSMin((() => {
|
|
|
1497
1505
|
};
|
|
1498
1506
|
}
|
|
1499
1507
|
}));
|
|
1500
|
-
|
|
1501
1508
|
//#endregion
|
|
1502
1509
|
//#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/shim.js
|
|
1503
1510
|
var require_shim = /* @__PURE__ */ __commonJSMin((() => {
|
|
@@ -1506,7 +1513,6 @@ var require_shim = /* @__PURE__ */ __commonJSMin((() => {
|
|
|
1506
1513
|
require_shim_function();
|
|
1507
1514
|
require_shim_regexp();
|
|
1508
1515
|
}));
|
|
1509
|
-
|
|
1510
1516
|
//#endregion
|
|
1511
1517
|
//#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/generic-set.js
|
|
1512
1518
|
var require_generic_set = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -1576,7 +1582,6 @@ var require_generic_set = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1576
1582
|
return this.map(_entriesArrayFunction);
|
|
1577
1583
|
};
|
|
1578
1584
|
}));
|
|
1579
|
-
|
|
1580
1585
|
//#endregion
|
|
1581
1586
|
//#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/_list.js
|
|
1582
1587
|
var require__list = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -1875,7 +1880,6 @@ var require__list = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1875
1880
|
node.prev = this;
|
|
1876
1881
|
};
|
|
1877
1882
|
}));
|
|
1878
|
-
|
|
1879
1883
|
//#endregion
|
|
1880
1884
|
//#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/iterator.js
|
|
1881
1885
|
var require_iterator = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -2115,7 +2119,6 @@ var require_iterator = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2115
2119
|
});
|
|
2116
2120
|
};
|
|
2117
2121
|
}));
|
|
2118
|
-
|
|
2119
2122
|
//#endregion
|
|
2120
2123
|
//#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/generic-map.js
|
|
2121
2124
|
var require_generic_map = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -2253,7 +2256,6 @@ var require_generic_map = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2253
2256
|
return Object.compare(this.key, that.key);
|
|
2254
2257
|
};
|
|
2255
2258
|
}));
|
|
2256
|
-
|
|
2257
2259
|
//#endregion
|
|
2258
2260
|
//#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/_dict.js
|
|
2259
2261
|
var require__dict = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -2381,7 +2383,6 @@ var require__dict = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2381
2383
|
return this.toObject();
|
|
2382
2384
|
};
|
|
2383
2385
|
}));
|
|
2384
|
-
|
|
2385
2386
|
//#endregion
|
|
2386
2387
|
//#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/tree-log.js
|
|
2387
2388
|
var require_tree_log = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -2418,7 +2419,6 @@ var require_tree_log = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2418
2419
|
strafe: "┃"
|
|
2419
2420
|
};
|
|
2420
2421
|
}));
|
|
2421
|
-
|
|
2422
2422
|
//#endregion
|
|
2423
2423
|
//#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/_fast-set.js
|
|
2424
2424
|
var require__fast_set = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -2560,7 +2560,6 @@ var require__fast_set = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2560
2560
|
else write(" " + value);
|
|
2561
2561
|
};
|
|
2562
2562
|
}));
|
|
2563
|
-
|
|
2564
2563
|
//#endregion
|
|
2565
2564
|
//#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/_set.js
|
|
2566
2565
|
var require__set = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -2758,7 +2757,6 @@ var require__set = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2758
2757
|
GlobalSet.CollectionsSet = CollectionsSet;
|
|
2759
2758
|
}
|
|
2760
2759
|
}));
|
|
2761
|
-
|
|
2762
2760
|
//#endregion
|
|
2763
2761
|
//#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/_map.js
|
|
2764
2762
|
var require__map = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -2962,7 +2960,6 @@ var require__map = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2962
2960
|
GlobalMap.CollectionsMap = CollectionsMap;
|
|
2963
2961
|
}
|
|
2964
2962
|
}));
|
|
2965
|
-
|
|
2966
2963
|
//#endregion
|
|
2967
2964
|
//#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/listen/change-descriptor.js
|
|
2968
2965
|
var require_change_descriptor = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -3083,7 +3080,6 @@ var require_change_descriptor = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
3083
3080
|
WillChangeListenersRecord.prototype.constructor = WillChangeListenersRecord;
|
|
3084
3081
|
WillChangeListenersRecord.prototype.genericHandlerMethodName = "handlePropertyWillChange";
|
|
3085
3082
|
}));
|
|
3086
|
-
|
|
3087
3083
|
//#endregion
|
|
3088
3084
|
//#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/listen/property-changes.js
|
|
3089
3085
|
var require_property_changes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -3320,7 +3316,6 @@ var require_property_changes = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
3320
3316
|
else return PropertyChanges.prototype.makePropertyObservable.call(object, key);
|
|
3321
3317
|
};
|
|
3322
3318
|
}));
|
|
3323
|
-
|
|
3324
3319
|
//#endregion
|
|
3325
3320
|
//#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/listen/range-changes.js
|
|
3326
3321
|
var require_range_changes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -3471,7 +3466,6 @@ var require_range_changes = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
3471
3466
|
return this.dispatchRangeChange(plus, minus, index, true);
|
|
3472
3467
|
};
|
|
3473
3468
|
}));
|
|
3474
|
-
|
|
3475
3469
|
//#endregion
|
|
3476
3470
|
//#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/sorted-set.js
|
|
3477
3471
|
var require_sorted_set = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -3955,7 +3949,6 @@ var require_sorted_set = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
3955
3949
|
return this._iterationObject;
|
|
3956
3950
|
};
|
|
3957
3951
|
}));
|
|
3958
|
-
|
|
3959
3952
|
//#endregion
|
|
3960
3953
|
//#region ../../node_modules/.bun/collections@5.1.13/node_modules/collections/listen/map-changes.js
|
|
3961
3954
|
var require_map_changes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -4103,10 +4096,9 @@ var require_map_changes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
4103
4096
|
return this.dispatchMapChange(key, value, true);
|
|
4104
4097
|
};
|
|
4105
4098
|
}));
|
|
4106
|
-
|
|
4107
4099
|
//#endregion
|
|
4108
|
-
//#region
|
|
4109
|
-
var
|
|
4100
|
+
//#region src/tag.ts
|
|
4101
|
+
var import_sorted_map = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4110
4102
|
require_shim();
|
|
4111
4103
|
var SortedSet = require_sorted_set();
|
|
4112
4104
|
var GenericCollection = require_generic_collection();
|
|
@@ -4153,11 +4145,7 @@ var require_sorted_map = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
4153
4145
|
log(" key: " + node.key);
|
|
4154
4146
|
log(" value: " + node.value);
|
|
4155
4147
|
};
|
|
4156
|
-
}));
|
|
4157
|
-
|
|
4158
|
-
//#endregion
|
|
4159
|
-
//#region src/tag.ts
|
|
4160
|
-
var import_sorted_map = require_sorted_map();
|
|
4148
|
+
})))();
|
|
4161
4149
|
/**
|
|
4162
4150
|
* Create a new Tag.
|
|
4163
4151
|
*
|
|
@@ -4188,7 +4176,6 @@ const createTag = (value, name) => {
|
|
|
4188
4176
|
* @internal
|
|
4189
4177
|
*/
|
|
4190
4178
|
const tagToString = (tag) => tag.name ?? tag.value.toString();
|
|
4191
|
-
|
|
4192
4179
|
//#endregion
|
|
4193
4180
|
//#region src/error.ts
|
|
4194
4181
|
/**
|
|
@@ -4278,7 +4265,6 @@ var CborError = class CborError extends Error {
|
|
|
4278
4265
|
return error instanceof CborError;
|
|
4279
4266
|
}
|
|
4280
4267
|
};
|
|
4281
|
-
|
|
4282
4268
|
//#endregion
|
|
4283
4269
|
//#region src/stdlib.ts
|
|
4284
4270
|
/**
|
|
@@ -4334,10 +4320,9 @@ const lexicographicallyCompareBytes = (a, b) => {
|
|
|
4334
4320
|
if (a.length > b.length) return 1;
|
|
4335
4321
|
return 0;
|
|
4336
4322
|
};
|
|
4337
|
-
|
|
4338
4323
|
//#endregion
|
|
4339
|
-
//#region
|
|
4340
|
-
var
|
|
4324
|
+
//#region src/exact.ts
|
|
4325
|
+
var import_byte_data = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4341
4326
|
/*! https://github.com/rochars/byte-data
|
|
4342
4327
|
Copyright (c) 2019 Rafael da Silva Rocha */
|
|
4343
4328
|
(function() {
|
|
@@ -4595,11 +4580,7 @@ var require_byte_data = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
4595
4580
|
typeof module !== "undefined" ? module.exports = exports$1 : typeof define === "function" && define.amd ? define(["exports"], exports$1) : typeof global !== "undefined" && (global.byteData = exports$1);
|
|
4596
4581
|
return exports$1;
|
|
4597
4582
|
})();
|
|
4598
|
-
}));
|
|
4599
|
-
|
|
4600
|
-
//#endregion
|
|
4601
|
-
//#region src/exact.ts
|
|
4602
|
-
var import_byte_data = /* @__PURE__ */ __toESM(require_byte_data(), 1);
|
|
4583
|
+
})))(), 1);
|
|
4603
4584
|
const hasFract = (n) => {
|
|
4604
4585
|
return n % 1 !== 0;
|
|
4605
4586
|
};
|
|
@@ -4766,47 +4747,6 @@ var ExactU64 = class {
|
|
|
4766
4747
|
return source <= BigInt(Number.MAX_SAFE_INTEGER) ? Number(source) : source;
|
|
4767
4748
|
}
|
|
4768
4749
|
};
|
|
4769
|
-
/**
|
|
4770
|
-
* Exact conversions for u128 (JavaScript bigint, unsigned).
|
|
4771
|
-
*/
|
|
4772
|
-
var ExactU128 = class {
|
|
4773
|
-
static MIN = 0n;
|
|
4774
|
-
static MAX = 2n ** 128n - 1n;
|
|
4775
|
-
static exactFromF16(source) {
|
|
4776
|
-
if (!Number.isFinite(source)) return void 0;
|
|
4777
|
-
if (source <= -1) return void 0;
|
|
4778
|
-
if (hasFract(source)) return void 0;
|
|
4779
|
-
return BigInt(Math.trunc(source));
|
|
4780
|
-
}
|
|
4781
|
-
static exactFromF32(source) {
|
|
4782
|
-
if (!Number.isFinite(source)) return void 0;
|
|
4783
|
-
if (source <= -1) return void 0;
|
|
4784
|
-
if (hasFract(source)) return void 0;
|
|
4785
|
-
return BigInt(Math.trunc(source));
|
|
4786
|
-
}
|
|
4787
|
-
static exactFromF64(source) {
|
|
4788
|
-
if (!Number.isFinite(source)) return void 0;
|
|
4789
|
-
if (source <= -1) return void 0;
|
|
4790
|
-
if (hasFract(source)) return void 0;
|
|
4791
|
-
return BigInt(Math.trunc(source));
|
|
4792
|
-
}
|
|
4793
|
-
static exactFromU64(source) {
|
|
4794
|
-
return BigInt(source);
|
|
4795
|
-
}
|
|
4796
|
-
static exactFromI64(source) {
|
|
4797
|
-
const n = typeof source === "bigint" ? source : BigInt(source);
|
|
4798
|
-
if (n < 0n) return void 0;
|
|
4799
|
-
return n;
|
|
4800
|
-
}
|
|
4801
|
-
static exactFromU128(source) {
|
|
4802
|
-
return source;
|
|
4803
|
-
}
|
|
4804
|
-
static exactFromI128(source) {
|
|
4805
|
-
if (source < 0n) return void 0;
|
|
4806
|
-
return source;
|
|
4807
|
-
}
|
|
4808
|
-
};
|
|
4809
|
-
|
|
4810
4750
|
//#endregion
|
|
4811
4751
|
//#region src/float.ts
|
|
4812
4752
|
/**
|
|
@@ -4964,7 +4904,6 @@ const f16CborData = (value) => {
|
|
|
4964
4904
|
const bytes = numberToBinary16(value);
|
|
4965
4905
|
return new Uint8Array([249, ...bytes]);
|
|
4966
4906
|
};
|
|
4967
|
-
|
|
4968
4907
|
//#endregion
|
|
4969
4908
|
//#region src/varint.ts
|
|
4970
4909
|
/**
|
|
@@ -5061,7 +5000,6 @@ function getUint64(view, byteOffset, littleEndian) {
|
|
|
5061
5000
|
const highWord = littleEndian ? view.getUint32(byteOffset + 4, true) : view.getUint32(byteOffset, false);
|
|
5062
5001
|
return (BigInt(highWord) << BigInt(32)) + BigInt(lowWord);
|
|
5063
5002
|
}
|
|
5064
|
-
|
|
5065
5003
|
//#endregion
|
|
5066
5004
|
//#region src/string-util.ts
|
|
5067
5005
|
/**
|
|
@@ -5110,7 +5048,6 @@ const sanitized = (str) => {
|
|
|
5110
5048
|
if (!hasPrintable) return;
|
|
5111
5049
|
return chars.join("");
|
|
5112
5050
|
};
|
|
5113
|
-
|
|
5114
5051
|
//#endregion
|
|
5115
5052
|
//#region src/tags-store.ts
|
|
5116
5053
|
/**
|
|
@@ -5238,7 +5175,6 @@ const getGlobalTagsStore = () => {
|
|
|
5238
5175
|
globalTagsStore ??= new TagsStore();
|
|
5239
5176
|
return globalTagsStore;
|
|
5240
5177
|
};
|
|
5241
|
-
|
|
5242
5178
|
//#endregion
|
|
5243
5179
|
//#region src/dump.ts
|
|
5244
5180
|
/**
|
|
@@ -5426,7 +5362,6 @@ function dumpItems(cbor, level, opts) {
|
|
|
5426
5362
|
}
|
|
5427
5363
|
return items;
|
|
5428
5364
|
}
|
|
5429
|
-
|
|
5430
5365
|
//#endregion
|
|
5431
5366
|
//#region src/diag.ts
|
|
5432
5367
|
/**
|
|
@@ -5661,7 +5596,6 @@ function resolveTagsStore(tags) {
|
|
|
5661
5596
|
else if (tags === "global" || tags === void 0) return getGlobalTagsStore();
|
|
5662
5597
|
else return tags;
|
|
5663
5598
|
}
|
|
5664
|
-
|
|
5665
5599
|
//#endregion
|
|
5666
5600
|
//#region src/simple.ts
|
|
5667
5601
|
/**
|
|
@@ -5719,7 +5653,6 @@ const simpleCborData = (simple) => {
|
|
|
5719
5653
|
case "Float": return f64CborData(simple.value);
|
|
5720
5654
|
}
|
|
5721
5655
|
};
|
|
5722
|
-
|
|
5723
5656
|
//#endregion
|
|
5724
5657
|
//#region src/decode.ts
|
|
5725
5658
|
/**
|
|
@@ -5988,7 +5921,6 @@ function decodeCborInternal(data) {
|
|
|
5988
5921
|
function checkCanonicalEncoding(cbor, buf) {
|
|
5989
5922
|
if (!areBytesEqual(buf, isCbor(cbor) ? cborData(cbor) : encodeCbor(cbor))) throw new CborError({ type: "NonCanonicalNumeric" });
|
|
5990
5923
|
}
|
|
5991
|
-
|
|
5992
5924
|
//#endregion
|
|
5993
5925
|
//#region src/conveniences.ts
|
|
5994
5926
|
/**
|
|
@@ -6578,7 +6510,6 @@ const isNumber = (cbor) => {
|
|
|
6578
6510
|
if (cbor.type === MajorType.Simple) return isFloat$1(cbor.value);
|
|
6579
6511
|
return false;
|
|
6580
6512
|
};
|
|
6581
|
-
|
|
6582
6513
|
//#endregion
|
|
6583
6514
|
//#region src/map.ts
|
|
6584
6515
|
/**
|
|
@@ -6814,7 +6745,6 @@ var CborMap = class CborMap {
|
|
|
6814
6745
|
return map;
|
|
6815
6746
|
}
|
|
6816
6747
|
};
|
|
6817
|
-
|
|
6818
6748
|
//#endregion
|
|
6819
6749
|
//#region src/walk.ts
|
|
6820
6750
|
/**
|
|
@@ -6830,24 +6760,6 @@ var CborMap = class CborMap {
|
|
|
6830
6760
|
* @module walk
|
|
6831
6761
|
*/
|
|
6832
6762
|
/**
|
|
6833
|
-
* Types of edges in the CBOR tree traversal.
|
|
6834
|
-
*/
|
|
6835
|
-
let EdgeType = /* @__PURE__ */ function(EdgeType) {
|
|
6836
|
-
/** No specific edge type (root element) */
|
|
6837
|
-
EdgeType["None"] = "none";
|
|
6838
|
-
/** Element within an array */
|
|
6839
|
-
EdgeType["ArrayElement"] = "array_element";
|
|
6840
|
-
/** Key-value pair in a map (semantic unit) */
|
|
6841
|
-
EdgeType["MapKeyValue"] = "map_key_value";
|
|
6842
|
-
/** Key within a map */
|
|
6843
|
-
EdgeType["MapKey"] = "map_key";
|
|
6844
|
-
/** Value within a map */
|
|
6845
|
-
EdgeType["MapValue"] = "map_value";
|
|
6846
|
-
/** Content of a tagged value */
|
|
6847
|
-
EdgeType["TaggedContent"] = "tagged_content";
|
|
6848
|
-
return EdgeType;
|
|
6849
|
-
}({});
|
|
6850
|
-
/**
|
|
6851
6763
|
* Returns a short text label for the edge type, or undefined if no label is needed.
|
|
6852
6764
|
*
|
|
6853
6765
|
* This is primarily used for tree formatting to identify relationships between elements.
|
|
@@ -6867,12 +6779,12 @@ let EdgeType = /* @__PURE__ */ function(EdgeType) {
|
|
|
6867
6779
|
*/
|
|
6868
6780
|
const edgeLabel = (edge) => {
|
|
6869
6781
|
switch (edge.type) {
|
|
6870
|
-
case
|
|
6871
|
-
case
|
|
6872
|
-
case
|
|
6873
|
-
case
|
|
6874
|
-
case
|
|
6875
|
-
case
|
|
6782
|
+
case "array_element": return `arr[${edge.index}]`;
|
|
6783
|
+
case "map_key_value": return "kv";
|
|
6784
|
+
case "map_key": return "key";
|
|
6785
|
+
case "map_value": return "val";
|
|
6786
|
+
case "tagged_content": return "content";
|
|
6787
|
+
case "none": return;
|
|
6876
6788
|
}
|
|
6877
6789
|
};
|
|
6878
6790
|
/**
|
|
@@ -6957,7 +6869,7 @@ const asKeyValue = (element) => {
|
|
|
6957
6869
|
* ```
|
|
6958
6870
|
*/
|
|
6959
6871
|
const walk = (cbor, initialState, visitor) => {
|
|
6960
|
-
walkInternal(cbor, 0, { type:
|
|
6872
|
+
walkInternal(cbor, 0, { type: "none" }, initialState, visitor);
|
|
6961
6873
|
};
|
|
6962
6874
|
/**
|
|
6963
6875
|
* Internal recursive walk implementation.
|
|
@@ -7002,7 +6914,7 @@ function walkArray(cbor, level, state, visitor) {
|
|
|
7002
6914
|
message: `Array element at index ${index} is undefined`
|
|
7003
6915
|
});
|
|
7004
6916
|
currentState = walkInternal(item, level + 1, {
|
|
7005
|
-
type:
|
|
6917
|
+
type: "array_element",
|
|
7006
6918
|
index
|
|
7007
6919
|
}, currentState, visitor);
|
|
7008
6920
|
}
|
|
@@ -7026,11 +6938,11 @@ function walkMap(cbor, level, state, visitor) {
|
|
|
7026
6938
|
type: "keyvalue",
|
|
7027
6939
|
key,
|
|
7028
6940
|
value
|
|
7029
|
-
}, level + 1, { type:
|
|
6941
|
+
}, level + 1, { type: "map_key_value" }, currentState);
|
|
7030
6942
|
currentState = kvState;
|
|
7031
6943
|
if (!kvStop) {
|
|
7032
|
-
currentState = walkInternal(key, level + 1, { type:
|
|
7033
|
-
currentState = walkInternal(value, level + 1, { type:
|
|
6944
|
+
currentState = walkInternal(key, level + 1, { type: "map_key" }, currentState, visitor);
|
|
6945
|
+
currentState = walkInternal(value, level + 1, { type: "map_value" }, currentState, visitor);
|
|
7034
6946
|
}
|
|
7035
6947
|
}
|
|
7036
6948
|
return currentState;
|
|
@@ -7041,9 +6953,8 @@ function walkMap(cbor, level, state, visitor) {
|
|
|
7041
6953
|
* @internal
|
|
7042
6954
|
*/
|
|
7043
6955
|
function walkTagged(cbor, level, state, visitor) {
|
|
7044
|
-
return walkInternal(cbor.value, level + 1, { type:
|
|
6956
|
+
return walkInternal(cbor.value, level + 1, { type: "tagged_content" }, state, visitor);
|
|
7045
6957
|
}
|
|
7046
|
-
|
|
7047
6958
|
//#endregion
|
|
7048
6959
|
//#region src/cbor.ts
|
|
7049
6960
|
/**
|
|
@@ -7511,18 +7422,43 @@ const Cbor = {
|
|
|
7511
7422
|
value: NaN
|
|
7512
7423
|
}
|
|
7513
7424
|
}),
|
|
7425
|
+
/**
|
|
7426
|
+
* Creates a CBOR value from any JavaScript value.
|
|
7427
|
+
*
|
|
7428
|
+
* Matches Rust's `CBOR::from()` behavior for various types.
|
|
7429
|
+
*
|
|
7430
|
+
* @param value - Any JavaScript value (number, string, boolean, null, array, object, etc.)
|
|
7431
|
+
* @returns A CBOR symbolic representation with instance methods
|
|
7432
|
+
*/
|
|
7514
7433
|
from(value) {
|
|
7515
7434
|
return cbor(value);
|
|
7516
7435
|
},
|
|
7436
|
+
/**
|
|
7437
|
+
* Decodes binary data into CBOR symbolic representation.
|
|
7438
|
+
*
|
|
7439
|
+
* Matches Rust's `CBOR::try_from_data()` method.
|
|
7440
|
+
*
|
|
7441
|
+
* @param data - The binary data to decode
|
|
7442
|
+
* @returns A CBOR value with instance methods
|
|
7443
|
+
* @throws Error if the data is not valid CBOR or violates dCBOR encoding rules
|
|
7444
|
+
*/
|
|
7517
7445
|
tryFromData(data) {
|
|
7518
7446
|
return decodeCbor(data);
|
|
7519
7447
|
},
|
|
7448
|
+
/**
|
|
7449
|
+
* Decodes a hexadecimal string into CBOR symbolic representation.
|
|
7450
|
+
*
|
|
7451
|
+
* Matches Rust's `CBOR::try_from_hex()` method.
|
|
7452
|
+
*
|
|
7453
|
+
* @param hex - A string containing hexadecimal characters
|
|
7454
|
+
* @returns A CBOR value with instance methods
|
|
7455
|
+
* @throws Error if the hex string is invalid or the resulting data is not valid dCBOR
|
|
7456
|
+
*/
|
|
7520
7457
|
tryFromHex(hex) {
|
|
7521
7458
|
const data = hexToBytes(hex);
|
|
7522
7459
|
return this.tryFromData(data);
|
|
7523
7460
|
}
|
|
7524
7461
|
};
|
|
7525
|
-
|
|
7526
7462
|
//#endregion
|
|
7527
7463
|
//#region src/cbor-tagged-encodable.ts
|
|
7528
7464
|
/**
|
|
@@ -7572,7 +7508,6 @@ const createTaggedCbor = (encodable) => {
|
|
|
7572
7508
|
value: untagged
|
|
7573
7509
|
});
|
|
7574
7510
|
};
|
|
7575
|
-
|
|
7576
7511
|
//#endregion
|
|
7577
7512
|
//#region src/cbor-tagged-decodable.ts
|
|
7578
7513
|
/**
|
|
@@ -7621,7 +7556,6 @@ const extractTaggedContent = (cbor) => {
|
|
|
7621
7556
|
if (cbor.type !== MajorType.Tagged) throw new CborError({ type: "WrongType" });
|
|
7622
7557
|
return cbor.value;
|
|
7623
7558
|
};
|
|
7624
|
-
|
|
7625
7559
|
//#endregion
|
|
7626
7560
|
//#region src/date.ts
|
|
7627
7561
|
/**
|
|
@@ -7845,8 +7779,7 @@ var CborDate = class CborDate {
|
|
|
7845
7779
|
* ```
|
|
7846
7780
|
*/
|
|
7847
7781
|
static withDurationFromNow(durationMs) {
|
|
7848
|
-
const
|
|
7849
|
-
const future = new Date(now.getTime() + durationMs);
|
|
7782
|
+
const future = new Date((/* @__PURE__ */ new Date()).getTime() + durationMs);
|
|
7850
7783
|
return CborDate.fromDatetime(future);
|
|
7851
7784
|
}
|
|
7852
7785
|
/**
|
|
@@ -7943,7 +7876,7 @@ var CborDate = class CborDate {
|
|
|
7943
7876
|
* @returns A vector containing tag 1
|
|
7944
7877
|
*/
|
|
7945
7878
|
cborTags() {
|
|
7946
|
-
return [createTag(
|
|
7879
|
+
return [createTag(1, "date")];
|
|
7947
7880
|
}
|
|
7948
7881
|
/**
|
|
7949
7882
|
* Implementation of the `CborTaggedEncodable` interface for `CborDate`.
|
|
@@ -8004,7 +7937,8 @@ var CborDate = class CborDate {
|
|
|
8004
7937
|
message: "Invalid date CBOR: expected numeric value"
|
|
8005
7938
|
});
|
|
8006
7939
|
}
|
|
8007
|
-
|
|
7940
|
+
const date = CborDate.fromTimestamp(timestamp);
|
|
7941
|
+
this._datetime = date._datetime;
|
|
8008
7942
|
return this;
|
|
8009
7943
|
}
|
|
8010
7944
|
/**
|
|
@@ -8106,7 +8040,6 @@ var CborDate = class CborDate {
|
|
|
8106
8040
|
this._datetime = /* @__PURE__ */ new Date();
|
|
8107
8041
|
}
|
|
8108
8042
|
};
|
|
8109
|
-
|
|
8110
8043
|
//#endregion
|
|
8111
8044
|
//#region src/bignum.ts
|
|
8112
8045
|
/**
|
|
@@ -8372,7 +8305,6 @@ function cborToBigint(cbor) {
|
|
|
8372
8305
|
case MajorType.Simple: throw new CborError({ type: "WrongType" });
|
|
8373
8306
|
}
|
|
8374
8307
|
}
|
|
8375
|
-
|
|
8376
8308
|
//#endregion
|
|
8377
8309
|
//#region src/tags.ts
|
|
8378
8310
|
/**
|
|
@@ -8488,9 +8420,9 @@ const TAG_NAME_DATE = "date";
|
|
|
8488
8420
|
* @param tagsStore - The tags store to register tags into
|
|
8489
8421
|
*/
|
|
8490
8422
|
const registerTagsIn = (tagsStore) => {
|
|
8491
|
-
const tags = [createTag(
|
|
8423
|
+
const tags = [createTag(1, TAG_NAME_DATE)];
|
|
8492
8424
|
tagsStore.insertAll(tags);
|
|
8493
|
-
tagsStore.setSummarizer(
|
|
8425
|
+
tagsStore.setSummarizer(1, (untaggedCbor, _flat) => {
|
|
8494
8426
|
try {
|
|
8495
8427
|
return {
|
|
8496
8428
|
ok: true,
|
|
@@ -8506,10 +8438,10 @@ const registerTagsIn = (tagsStore) => {
|
|
|
8506
8438
|
};
|
|
8507
8439
|
}
|
|
8508
8440
|
});
|
|
8509
|
-
const biguintTag = createTag(
|
|
8510
|
-
const bigintTag = createTag(
|
|
8441
|
+
const biguintTag = createTag(2, TAG_NAME_POSITIVE_BIGNUM);
|
|
8442
|
+
const bigintTag = createTag(3, TAG_NAME_NEGATIVE_BIGNUM);
|
|
8511
8443
|
tagsStore.insertAll([biguintTag, bigintTag]);
|
|
8512
|
-
tagsStore.setSummarizer(
|
|
8444
|
+
tagsStore.setSummarizer(2, (untaggedCbor, _flat) => {
|
|
8513
8445
|
try {
|
|
8514
8446
|
return {
|
|
8515
8447
|
ok: true,
|
|
@@ -8525,7 +8457,7 @@ const registerTagsIn = (tagsStore) => {
|
|
|
8525
8457
|
};
|
|
8526
8458
|
}
|
|
8527
8459
|
});
|
|
8528
|
-
tagsStore.setSummarizer(
|
|
8460
|
+
tagsStore.setSummarizer(3, (untaggedCbor, _flat) => {
|
|
8529
8461
|
try {
|
|
8530
8462
|
return {
|
|
8531
8463
|
ok: true,
|
|
@@ -8588,7 +8520,6 @@ const tagsForValues = (values) => {
|
|
|
8588
8520
|
return createTag(value);
|
|
8589
8521
|
});
|
|
8590
8522
|
};
|
|
8591
|
-
|
|
8592
8523
|
//#endregion
|
|
8593
8524
|
//#region src/set.ts
|
|
8594
8525
|
/**
|
|
@@ -8880,7 +8811,7 @@ var CborSet = class CborSet {
|
|
|
8880
8811
|
for (const value of this) callback(value);
|
|
8881
8812
|
}
|
|
8882
8813
|
cborTags() {
|
|
8883
|
-
return [createTag(
|
|
8814
|
+
return [createTag(258, "set")];
|
|
8884
8815
|
}
|
|
8885
8816
|
untaggedCbor() {
|
|
8886
8817
|
return cbor(this.values());
|
|
@@ -8993,7 +8924,6 @@ function encodeCborValue(value) {
|
|
|
8993
8924
|
if (typeof value === "object" && value !== null && "isCbor" in value && value.isCbor === true) return value;
|
|
8994
8925
|
return cbor(value);
|
|
8995
8926
|
}
|
|
8996
|
-
|
|
8997
8927
|
//#endregion
|
|
8998
8928
|
//#region src/byte-string.ts
|
|
8999
8929
|
/**
|
|
@@ -9273,7 +9203,6 @@ var ByteString = class ByteString {
|
|
|
9273
9203
|
return new ByteString(this.toUint8Array());
|
|
9274
9204
|
}
|
|
9275
9205
|
};
|
|
9276
|
-
|
|
9277
9206
|
//#endregion
|
|
9278
9207
|
exports.ByteString = ByteString;
|
|
9279
9208
|
exports.Cbor = Cbor;
|
|
@@ -9403,4 +9332,5 @@ exports.tryIntoByteString = expectBytes;
|
|
|
9403
9332
|
exports.tryIntoText = expectText;
|
|
9404
9333
|
exports.validateTag = validateTag;
|
|
9405
9334
|
exports.walk = walk;
|
|
9335
|
+
|
|
9406
9336
|
//# sourceMappingURL=index.cjs.map
|