@qntx/ur 1.0.0 → 1.1.0
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.d.mts +1 -49
- package/dist/index.mjs +1 -1497
- package/dist/type-CSfO9fHL.d.mts +50 -0
- package/dist/typed.d.mts +59 -0
- package/dist/typed.mjs +146 -0
- package/dist/ur-C5n_FgVn.mjs +1500 -0
- package/package.json +22 -4
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Uniform Resources (UR) for TypeScript.
|
|
6
6
|
|
|
7
|
-
Bytewords, fountain codes, and single- or multi-part UR strings. Transport-only
|
|
7
|
+
Bytewords, fountain codes, and single- or multi-part UR strings. Transport-only at the root; typed dCBOR is `@qntx/ur/typed`. Wire-compatible with [bcur](https://github.com/qntx/bcur).
|
|
8
8
|
|
|
9
9
|
`Encoder` K==1 outbound is single-part (an ur-rs `Decoder` will not consume it). This package still decodes ur-rs `1-1`.
|
|
10
10
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,29 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
/** Discriminated error codes for the UR transport stack. */
|
|
3
|
-
type UrErrorCode = "InvalidWord" | "InvalidBytewordsChecksum" | "InvalidBytewordsLength" | "NonAscii" | "EmptyMessage" | "EmptyPart" | "InvalidFragmentLen" | "InvalidSequence" | "InconsistentPart" | "InvalidPadding" | "InvalidMessageChecksum" | "InvalidPartCbor" | "DecoderState" | "SinglePartExhausted" | "ResourceLimit" | "InvalidScheme" | "TypeUnspecified" | "InvalidType" | "InvalidIndices" | "NotSinglePart" | "UnexpectedType";
|
|
4
|
-
/** Structured error thrown by the UR stack. */
|
|
5
|
-
declare class UrError extends Error {
|
|
6
|
-
readonly code: UrErrorCode;
|
|
7
|
-
readonly expected?: string;
|
|
8
|
-
readonly found?: string;
|
|
9
|
-
readonly limit?: string;
|
|
10
|
-
constructor(code: UrErrorCode, options?: {
|
|
11
|
-
expected?: string;
|
|
12
|
-
found?: string;
|
|
13
|
-
limit?: string;
|
|
14
|
-
cause?: unknown;
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
/** Fail-closed decoder poison reason. */
|
|
18
|
-
type DecoderPoison = {
|
|
19
|
-
code: "ResourceLimit";
|
|
20
|
-
limit: string;
|
|
21
|
-
} | {
|
|
22
|
-
code: "DecoderState";
|
|
23
|
-
};
|
|
24
|
-
/** Rethrows the stored poison as a {@link UrError}. */
|
|
25
|
-
declare function failPoison(p: DecoderPoison): never;
|
|
26
|
-
//#endregion
|
|
1
|
+
import { a as UrError, i as DecoderPoison, n as DEFAULT_LIMITS, o as UrErrorCode, r as DecoderLimits, s as failPoison, t as UrType } from "./type-CSfO9fHL.mjs";
|
|
27
2
|
//#region src/crc32.d.ts
|
|
28
3
|
/**
|
|
29
4
|
* CRC-32 ISO-HDLC (polynomial 0xedb88320), matching bcur / ur-rs.
|
|
@@ -54,19 +29,6 @@ declare function decode$1(encoded: string, style: Style): Uint8Array;
|
|
|
54
29
|
/** Canonicalize a 2–4 letter token to the full 4-letter lowercase byteword. */
|
|
55
30
|
declare function canonicalizeByteword(token: string): string | undefined;
|
|
56
31
|
//#endregion
|
|
57
|
-
//#region src/fountain/limits.d.ts
|
|
58
|
-
/** Hard limits for adversarial multi-part streams. */
|
|
59
|
-
interface DecoderLimits {
|
|
60
|
-
maxMessageLength: number;
|
|
61
|
-
maxFragmentCount: number;
|
|
62
|
-
maxFragmentDataLength: number;
|
|
63
|
-
maxBufferParts: number;
|
|
64
|
-
maxReceivedParts: number;
|
|
65
|
-
maxUriLen: number;
|
|
66
|
-
}
|
|
67
|
-
/** Production Default; same integers as bcur 1.0. Hosts that need another budget pass `new Decoder({ limits })`. */
|
|
68
|
-
declare const DEFAULT_LIMITS: DecoderLimits;
|
|
69
|
-
//#endregion
|
|
70
32
|
//#region src/fountain/part.d.ts
|
|
71
33
|
/** A fountain part (wire metadata + fragment data). */
|
|
72
34
|
declare class Part {
|
|
@@ -138,16 +100,6 @@ declare class FountainEncoder {
|
|
|
138
100
|
nextPart(): Part;
|
|
139
101
|
}
|
|
140
102
|
//#endregion
|
|
141
|
-
//#region src/ur/type.d.ts
|
|
142
|
-
/** Validated UR type token (stored lowercase, `[a-z0-9-]+`). */
|
|
143
|
-
declare class UrType {
|
|
144
|
-
readonly value: string;
|
|
145
|
-
private constructor();
|
|
146
|
-
static parse(s: string): UrType;
|
|
147
|
-
static bytes(): UrType;
|
|
148
|
-
equals(other: UrType): boolean;
|
|
149
|
-
}
|
|
150
|
-
//#endregion
|
|
151
103
|
//#region src/ur/parse.d.ts
|
|
152
104
|
type Kind = "single" | "multi";
|
|
153
105
|
interface ParsedUr {
|