@bcts/dcbor 1.0.0-alpha.19 → 1.0.0-alpha.21
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/LICENSE +2 -1
- package/dist/index.cjs +80 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +4 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.iife.js +80 -3
- package/dist/index.iife.js.map +1 -1
- package/dist/index.mjs +80 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -21
- package/src/bignum.ts +4 -0
- package/src/byte-string.ts +4 -0
- package/src/cbor-codable.ts +4 -0
- package/src/cbor-tagged-codable.ts +4 -0
- package/src/cbor-tagged-decodable.ts +4 -0
- package/src/cbor-tagged-encodable.ts +4 -0
- package/src/cbor-tagged.ts +4 -0
- package/src/cbor.ts +6 -0
- package/src/conveniences.ts +4 -0
- package/src/date.ts +4 -0
- package/src/decode.ts +6 -0
- package/src/diag.ts +4 -0
- package/src/dump.ts +4 -0
- package/src/error.ts +4 -0
- package/src/exact.ts +4 -0
- package/src/float.ts +4 -0
- package/src/global.d.ts +4 -0
- package/src/globals.d.ts +5 -0
- package/src/index.ts +4 -0
- package/src/map.ts +4 -0
- package/src/prelude.ts +4 -0
- package/src/set.ts +4 -0
- package/src/simple.ts +4 -0
- package/src/stdlib.ts +4 -0
- package/src/string-util.ts +4 -0
- package/src/tag.ts +4 -0
- package/src/tags-store.ts +4 -0
- package/src/tags.ts +4 -0
- package/src/varint.ts +6 -0
- package/src/walk.ts +5 -3
package/dist/index.mjs
CHANGED
|
@@ -4280,6 +4280,10 @@ var CborError = class CborError extends Error {
|
|
|
4280
4280
|
//#endregion
|
|
4281
4281
|
//#region src/stdlib.ts
|
|
4282
4282
|
/**
|
|
4283
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
4284
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
4285
|
+
*
|
|
4286
|
+
*
|
|
4283
4287
|
* Standard library re-exports and compatibility layer.
|
|
4284
4288
|
*
|
|
4285
4289
|
* In Rust, this handles std/no_std feature flags.
|
|
@@ -4804,6 +4808,10 @@ var ExactU128 = class {
|
|
|
4804
4808
|
//#endregion
|
|
4805
4809
|
//#region src/float.ts
|
|
4806
4810
|
/**
|
|
4811
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
4812
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
4813
|
+
*
|
|
4814
|
+
*
|
|
4807
4815
|
* Float encoding and conversion utilities for dCBOR.
|
|
4808
4816
|
*
|
|
4809
4817
|
* # Floating Point Number Support in dCBOR
|
|
@@ -4957,6 +4965,11 @@ const f16CborData = (value) => {
|
|
|
4957
4965
|
|
|
4958
4966
|
//#endregion
|
|
4959
4967
|
//#region src/varint.ts
|
|
4968
|
+
/**
|
|
4969
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
4970
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
4971
|
+
*
|
|
4972
|
+
*/
|
|
4960
4973
|
const typeBits = (t) => {
|
|
4961
4974
|
return t << 5;
|
|
4962
4975
|
};
|
|
@@ -5050,6 +5063,10 @@ function getUint64(view, byteOffset, littleEndian) {
|
|
|
5050
5063
|
//#endregion
|
|
5051
5064
|
//#region src/string-util.ts
|
|
5052
5065
|
/**
|
|
5066
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
5067
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
5068
|
+
*
|
|
5069
|
+
*
|
|
5053
5070
|
* String utilities for dCBOR, including Unicode normalization.
|
|
5054
5071
|
*
|
|
5055
5072
|
* @module string-util
|
|
@@ -5223,6 +5240,10 @@ const getGlobalTagsStore = () => {
|
|
|
5223
5240
|
//#endregion
|
|
5224
5241
|
//#region src/dump.ts
|
|
5225
5242
|
/**
|
|
5243
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
5244
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
5245
|
+
*
|
|
5246
|
+
*
|
|
5226
5247
|
* Hex dump utilities for CBOR data.
|
|
5227
5248
|
*
|
|
5228
5249
|
* Affordances for viewing the encoded binary representation of CBOR as hexadecimal.
|
|
@@ -5407,6 +5428,10 @@ function dumpItems(cbor, level, opts) {
|
|
|
5407
5428
|
//#endregion
|
|
5408
5429
|
//#region src/diag.ts
|
|
5409
5430
|
/**
|
|
5431
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
5432
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
5433
|
+
*
|
|
5434
|
+
*
|
|
5410
5435
|
* Enhanced diagnostic formatting for CBOR values.
|
|
5411
5436
|
*
|
|
5412
5437
|
* Provides multiple formatting options including
|
|
@@ -5638,6 +5663,10 @@ function resolveTagsStore(tags) {
|
|
|
5638
5663
|
//#endregion
|
|
5639
5664
|
//#region src/simple.ts
|
|
5640
5665
|
/**
|
|
5666
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
5667
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
5668
|
+
*
|
|
5669
|
+
*
|
|
5641
5670
|
* CBOR Simple Values (Major Type 7).
|
|
5642
5671
|
*
|
|
5643
5672
|
* @module simple
|
|
@@ -5691,6 +5720,11 @@ const simpleCborData = (simple) => {
|
|
|
5691
5720
|
|
|
5692
5721
|
//#endregion
|
|
5693
5722
|
//#region src/decode.ts
|
|
5723
|
+
/**
|
|
5724
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
5725
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
5726
|
+
*
|
|
5727
|
+
*/
|
|
5694
5728
|
function decodeCbor(data) {
|
|
5695
5729
|
const { cbor, len } = decodeCborInternal(new DataView(data.buffer, data.byteOffset, data.byteLength));
|
|
5696
5730
|
const remaining = data.length - len;
|
|
@@ -5956,6 +5990,10 @@ function checkCanonicalEncoding(cbor, buf) {
|
|
|
5956
5990
|
//#endregion
|
|
5957
5991
|
//#region src/conveniences.ts
|
|
5958
5992
|
/**
|
|
5993
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
5994
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
5995
|
+
*
|
|
5996
|
+
*
|
|
5959
5997
|
* Convenience utilities for working with CBOR values.
|
|
5960
5998
|
*
|
|
5961
5999
|
* Provides type-safe helpers for checking types, extracting values,
|
|
@@ -6542,6 +6580,10 @@ const isNumber = (cbor) => {
|
|
|
6542
6580
|
//#endregion
|
|
6543
6581
|
//#region src/map.ts
|
|
6544
6582
|
/**
|
|
6583
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
6584
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
6585
|
+
*
|
|
6586
|
+
*
|
|
6545
6587
|
* Map Support in dCBOR
|
|
6546
6588
|
*
|
|
6547
6589
|
* A deterministic CBOR map implementation that ensures maps with the same
|
|
@@ -6774,6 +6816,10 @@ var CborMap = class CborMap {
|
|
|
6774
6816
|
//#endregion
|
|
6775
6817
|
//#region src/walk.ts
|
|
6776
6818
|
/**
|
|
6819
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
6820
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
6821
|
+
*
|
|
6822
|
+
*
|
|
6777
6823
|
* Tree traversal system for CBOR data structures.
|
|
6778
6824
|
*
|
|
6779
6825
|
* This module provides a visitor pattern implementation for traversing
|
|
@@ -6918,15 +6964,13 @@ const walk = (cbor, initialState, visitor) => {
|
|
|
6918
6964
|
*/
|
|
6919
6965
|
function walkInternal(cbor, level, edge, state, visitor, skipVisit = false) {
|
|
6920
6966
|
let currentState = state;
|
|
6921
|
-
let stopDescent = false;
|
|
6922
6967
|
if (!skipVisit) {
|
|
6923
6968
|
const [newState, stop] = visitor({
|
|
6924
6969
|
type: "single",
|
|
6925
6970
|
cbor
|
|
6926
6971
|
}, level, edge, currentState);
|
|
6927
6972
|
currentState = newState;
|
|
6928
|
-
|
|
6929
|
-
if (stopDescent) return currentState;
|
|
6973
|
+
if (stop) return currentState;
|
|
6930
6974
|
}
|
|
6931
6975
|
switch (cbor.type) {
|
|
6932
6976
|
case MajorType.Array:
|
|
@@ -7000,6 +7044,11 @@ function walkTagged(cbor, level, state, visitor) {
|
|
|
7000
7044
|
|
|
7001
7045
|
//#endregion
|
|
7002
7046
|
//#region src/cbor.ts
|
|
7047
|
+
/**
|
|
7048
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
7049
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
7050
|
+
*
|
|
7051
|
+
*/
|
|
7003
7052
|
const MajorType = {
|
|
7004
7053
|
Unsigned: 0,
|
|
7005
7054
|
Negative: 1,
|
|
@@ -7475,6 +7524,10 @@ const Cbor = {
|
|
|
7475
7524
|
//#endregion
|
|
7476
7525
|
//#region src/cbor-tagged-encodable.ts
|
|
7477
7526
|
/**
|
|
7527
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
7528
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
7529
|
+
*
|
|
7530
|
+
*
|
|
7478
7531
|
* Tagged CBOR encoding support.
|
|
7479
7532
|
*
|
|
7480
7533
|
* This module provides the `CborTaggedEncodable` interface, which enables types to
|
|
@@ -7521,6 +7574,10 @@ const createTaggedCbor = (encodable) => {
|
|
|
7521
7574
|
//#endregion
|
|
7522
7575
|
//#region src/cbor-tagged-decodable.ts
|
|
7523
7576
|
/**
|
|
7577
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
7578
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
7579
|
+
*
|
|
7580
|
+
*
|
|
7524
7581
|
* Tagged CBOR decoding support.
|
|
7525
7582
|
*
|
|
7526
7583
|
* This module provides the `CborTaggedDecodable` interface, which enables types to
|
|
@@ -7566,6 +7623,10 @@ const extractTaggedContent = (cbor) => {
|
|
|
7566
7623
|
//#endregion
|
|
7567
7624
|
//#region src/date.ts
|
|
7568
7625
|
/**
|
|
7626
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
7627
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
7628
|
+
*
|
|
7629
|
+
*
|
|
7569
7630
|
* Date/time support for CBOR with tag(1) encoding.
|
|
7570
7631
|
*
|
|
7571
7632
|
* A CBOR-friendly representation of a date and time.
|
|
@@ -8047,6 +8108,10 @@ var CborDate = class CborDate {
|
|
|
8047
8108
|
//#endregion
|
|
8048
8109
|
//#region src/bignum.ts
|
|
8049
8110
|
/**
|
|
8111
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
8112
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
8113
|
+
*
|
|
8114
|
+
*
|
|
8050
8115
|
* CBOR bignum (tags 2 and 3) support.
|
|
8051
8116
|
*
|
|
8052
8117
|
* This module provides conversion between CBOR and JavaScript BigInt types,
|
|
@@ -8309,6 +8374,10 @@ function cborToBigint(cbor) {
|
|
|
8309
8374
|
//#endregion
|
|
8310
8375
|
//#region src/tags.ts
|
|
8311
8376
|
/**
|
|
8377
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
8378
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
8379
|
+
*
|
|
8380
|
+
*
|
|
8312
8381
|
* Standard CBOR tag definitions from the IANA registry.
|
|
8313
8382
|
*
|
|
8314
8383
|
* @module tags
|
|
@@ -8521,6 +8590,10 @@ const tagsForValues = (values) => {
|
|
|
8521
8590
|
//#endregion
|
|
8522
8591
|
//#region src/set.ts
|
|
8523
8592
|
/**
|
|
8593
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
8594
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
8595
|
+
*
|
|
8596
|
+
*
|
|
8524
8597
|
* Set data structure for CBOR with tag(258) encoding.
|
|
8525
8598
|
*
|
|
8526
8599
|
* A Set is encoded as an array with no duplicate elements,
|
|
@@ -8922,6 +8995,10 @@ function encodeCborValue(value) {
|
|
|
8922
8995
|
//#endregion
|
|
8923
8996
|
//#region src/byte-string.ts
|
|
8924
8997
|
/**
|
|
8998
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
8999
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
9000
|
+
*
|
|
9001
|
+
*
|
|
8925
9002
|
* Byte string utilities for dCBOR.
|
|
8926
9003
|
*
|
|
8927
9004
|
* Represents a CBOR byte string (major type 2).
|