@bcts/dcbor-pattern 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/README.md +1 -1
- package/dist/index.cjs +28 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -0
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +8 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.iife.js +28 -0
- package/dist/index.iife.js.map +1 -1
- package/dist/index.mjs +28 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -22
- package/src/error.ts +4 -0
- package/src/format.ts +4 -0
- package/src/index.ts +4 -0
- package/src/interval.ts +4 -0
- package/src/parse/index.ts +4 -0
- package/src/parse/meta/and-parser.ts +4 -0
- package/src/parse/meta/capture-parser.ts +4 -0
- package/src/parse/meta/index.ts +4 -0
- package/src/parse/meta/not-parser.ts +4 -0
- package/src/parse/meta/or-parser.ts +4 -0
- package/src/parse/meta/primary-parser.ts +4 -0
- package/src/parse/meta/repeat-parser.ts +4 -0
- package/src/parse/meta/search-parser.ts +4 -0
- package/src/parse/parse-registry.ts +4 -0
- package/src/parse/structure/array-parser.ts +4 -0
- package/src/parse/structure/index.ts +4 -0
- package/src/parse/structure/map-parser.ts +4 -0
- package/src/parse/structure/tagged-parser.ts +4 -0
- package/src/parse/token.ts +4 -0
- package/src/parse/value/bool-parser.ts +4 -0
- package/src/parse/value/bytestring-parser.ts +4 -0
- package/src/parse/value/date-parser.ts +4 -0
- package/src/parse/value/digest-parser.ts +4 -0
- package/src/parse/value/index.ts +4 -0
- package/src/parse/value/known-value-parser.ts +4 -0
- package/src/parse/value/null-parser.ts +4 -0
- package/src/parse/value/number-parser.ts +4 -0
- package/src/parse/value/text-parser.ts +4 -0
- package/src/pattern/index.ts +4 -0
- package/src/pattern/match-registry.ts +4 -0
- package/src/pattern/matcher.ts +4 -0
- package/src/pattern/meta/and-pattern.ts +4 -0
- package/src/pattern/meta/any-pattern.ts +4 -0
- package/src/pattern/meta/capture-pattern.ts +4 -0
- package/src/pattern/meta/index.ts +4 -0
- package/src/pattern/meta/not-pattern.ts +4 -0
- package/src/pattern/meta/or-pattern.ts +4 -0
- package/src/pattern/meta/repeat-pattern.ts +4 -0
- package/src/pattern/meta/search-pattern.ts +4 -0
- package/src/pattern/meta/sequence-pattern.ts +4 -0
- package/src/pattern/structure/array-pattern/assigner.ts +4 -0
- package/src/pattern/structure/array-pattern/backtrack.ts +4 -0
- package/src/pattern/structure/array-pattern/helpers.ts +4 -0
- package/src/pattern/structure/array-pattern/index.ts +4 -0
- package/src/pattern/structure/index.ts +4 -0
- package/src/pattern/structure/map-pattern.ts +4 -0
- package/src/pattern/structure/tagged-pattern.ts +4 -0
- package/src/pattern/value/bool-pattern.ts +4 -0
- package/src/pattern/value/bytes-utils.ts +4 -0
- package/src/pattern/value/bytestring-pattern.ts +4 -0
- package/src/pattern/value/date-pattern.ts +4 -0
- package/src/pattern/value/digest-pattern.ts +4 -0
- package/src/pattern/value/index.ts +4 -0
- package/src/pattern/value/known-value-pattern.ts +4 -0
- package/src/pattern/value/null-pattern.ts +4 -0
- package/src/pattern/value/number-pattern.ts +4 -0
- package/src/pattern/value/text-pattern.ts +4 -0
- package/src/pattern/vm.ts +4 -0
- package/src/quantifier.ts +4 -0
- package/src/reluctance.ts +4 -0
package/LICENSE
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
Copyright © 2023-2026 Blockchain Commons, LLC
|
|
2
|
-
Copyright © 2025-2026
|
|
2
|
+
Copyright © 2025-2026 Parity Technologies
|
|
3
|
+
|
|
3
4
|
|
|
4
5
|
Redistribution and use in source and binary forms, with or without modification,
|
|
5
6
|
are permitted provided that the following conditions are met:
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## Introduction
|
|
6
6
|
|
|
7
|
-
`@bcts/dcbor-pattern` provides a powerful pattern matching language for querying and extracting data from [dCBOR](https://github.com/
|
|
7
|
+
`@bcts/dcbor-pattern` provides a powerful pattern matching language for querying and extracting data from [dCBOR](https://github.com/paritytech/bcts/tree/main/packages/dcbor) (Deterministic CBOR) structures. It supports value matching, structural patterns, and meta-patterns with named captures.
|
|
8
8
|
|
|
9
9
|
The pattern language is designed to be expressive yet concise, allowing you to match complex nested structures with simple pattern expressions.
|
|
10
10
|
|
package/dist/index.cjs
CHANGED
|
@@ -208,6 +208,10 @@ var PatternError = class extends globalThis.Error {
|
|
|
208
208
|
//#endregion
|
|
209
209
|
//#region src/reluctance.ts
|
|
210
210
|
/**
|
|
211
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
212
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
213
|
+
*
|
|
214
|
+
*
|
|
211
215
|
* Reluctance for quantifiers.
|
|
212
216
|
*
|
|
213
217
|
* This module defines the matching behavior for quantified patterns,
|
|
@@ -269,6 +273,10 @@ const reluctanceSuffix = (reluctance) => {
|
|
|
269
273
|
//#endregion
|
|
270
274
|
//#region src/interval.ts
|
|
271
275
|
/**
|
|
276
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
277
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
278
|
+
*
|
|
279
|
+
*
|
|
272
280
|
* Provides an `Interval` type representing a range of values with a
|
|
273
281
|
* minimum and optional maximum.
|
|
274
282
|
*
|
|
@@ -463,6 +471,10 @@ const DEFAULT_INTERVAL = Interval.exactly(1);
|
|
|
463
471
|
//#endregion
|
|
464
472
|
//#region src/quantifier.ts
|
|
465
473
|
/**
|
|
474
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
475
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
476
|
+
*
|
|
477
|
+
*
|
|
466
478
|
* Quantifier for pattern repetition.
|
|
467
479
|
*
|
|
468
480
|
* This module provides the Quantifier class which combines an interval
|
|
@@ -624,6 +636,10 @@ const DEFAULT_QUANTIFIER = Quantifier.exactly(1);
|
|
|
624
636
|
//#endregion
|
|
625
637
|
//#region src/format.ts
|
|
626
638
|
/**
|
|
639
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
640
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
641
|
+
*
|
|
642
|
+
*
|
|
627
643
|
* Format Module for dcbor-pattern
|
|
628
644
|
*
|
|
629
645
|
* This module provides formatting utilities for displaying paths returned by
|
|
@@ -1175,6 +1191,10 @@ const textPatternDisplay = (pattern) => {
|
|
|
1175
1191
|
//#endregion
|
|
1176
1192
|
//#region src/pattern/value/bytes-utils.ts
|
|
1177
1193
|
/**
|
|
1194
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
1195
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
1196
|
+
*
|
|
1197
|
+
*
|
|
1178
1198
|
* Byte array utility functions.
|
|
1179
1199
|
*
|
|
1180
1200
|
* @module pattern/value/bytes-utils
|
|
@@ -4247,6 +4267,10 @@ setPathsWithCapturesDirectFn(pathsWithCapturesDirect);
|
|
|
4247
4267
|
//#endregion
|
|
4248
4268
|
//#region src/parse/token.ts
|
|
4249
4269
|
/**
|
|
4270
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
4271
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
4272
|
+
*
|
|
4273
|
+
*
|
|
4250
4274
|
* Token types and Lexer for the dCBOR pattern language.
|
|
4251
4275
|
*
|
|
4252
4276
|
* This module provides tokenization for dCBOR pattern expressions,
|
|
@@ -5846,6 +5870,10 @@ const wrapInRepeat = (pattern, quantifier) => ({
|
|
|
5846
5870
|
//#endregion
|
|
5847
5871
|
//#region src/parse/meta/primary-parser.ts
|
|
5848
5872
|
/**
|
|
5873
|
+
* Copyright © 2023-2026 Blockchain Commons, LLC
|
|
5874
|
+
* Copyright © 2025-2026 Parity Technologies
|
|
5875
|
+
*
|
|
5876
|
+
*
|
|
5849
5877
|
* Primary pattern parser - handles atomic patterns.
|
|
5850
5878
|
*
|
|
5851
5879
|
* @module parse/meta/primary-parser
|