33import type * as asn1 from '@yoursunny/asn1' ;
44import assert from 'tiny-invariant' ;
55import { DataSet } from './esm' ;
6+ import { DefaultMap } from 'mnemonist' ;
67import { Edge } from './esm' ;
78import { FullItem } from 'vis-data/declarations/data-interface' ;
89import type { H3Transport } from '@ndn/quic-transport' ;
@@ -118,14 +119,7 @@ declare class Alt extends Expr {
118119 protected exprToTokens ( ) : Iterable < T . Token > ;
119120}
120121
121- /**
122- * Specify several alternate patterns in "OR" relation.
123- *
124- * @remarks
125- * When matching a name, the first successful match is returned.
126- *
127- * When building a name, the first choice that does not have missing variable is returned.
128- */
122+ /** Specify several alternate patterns in "OR" relation. */
129123declare class AlternatePattern extends Pattern {
130124 readonly choices : Pattern [ ] ;
131125 constructor ( choices ?: Pattern [ ] ) ;
@@ -180,7 +174,7 @@ declare const And: new () => Operator;
180174 // …
181175
182176 for (const output of outputList) {
183- console.log(`write to: ${output}`);
177+ console.log(`write to: ${output}`);
184178 }
185179 }
186180
@@ -190,7 +184,10 @@ declare const And: new () => Operator;
190184
191185 @category Array
192186 */
193- declare type Arrayable < T > = T | readonly T [ ] ;
187+ declare type Arrayable < T > =
188+ T
189+ // TODO: Use `readonly T[]` when this issue is resolved: https://github.com/microsoft/TypeScript/issues/17002
190+ | T [ ] ;
194191
195192/**
196193 Provides all values for a constant array or tuple.
@@ -217,8 +214,8 @@ declare type ArrayValues<T extends readonly unknown[]> = T[number];
217214
218215declare const ArrowL : new ( ) => Operator ;
219216
220- /** Convert ArrayBuffer or ArrayBufferView to DataView. */
221- declare function asDataView ( a : BufferSource ) : DataView ;
217+ /** Convert (Shared) ArrayBuffer(View) to DataView. */
218+ declare function asDataView ( a : ArrayBufferLike | ArrayBufferView ) : DataView ;
222219
223220declare namespace ast {
224221 export {
@@ -240,8 +237,8 @@ declare namespace ast {
240237 }
241238}
242239
243- /** Convert ArrayBuffer or ArrayBufferView to Uint8Array. */
244- declare function asUint8Array ( a : BufferSource ) : Uint8Array ;
240+ /** Convert (Shared) ArrayBuffer(View) to Uint8Array. */
241+ declare function asUint8Array ( a : ArrayBufferLike | ArrayBufferView ) : Uint8Array ;
245242
246243declare namespace autoconfig {
247244 export {
@@ -413,6 +410,7 @@ declare class BuildState {
413410 readonly vars : Map < string , Name > ;
414411 constructor ( name : Name , vars : Map < string , Name > ) ;
415412 append ( ...comps : Component [ ] ) : BuildState ;
413+ toString ( ) : string ;
416414}
417415
418416/** Internal function call node. */
@@ -421,14 +419,14 @@ declare class Call extends Expr {
421419 args : Expr [ ] ;
422420 constructor ( func : string , args ?: Expr [ ] ) ;
423421 protected exprParens ( ) : boolean ;
424- protected exprToTokens ( ) : Generator < T . Token , void , undefined > ;
422+ protected exprToTokens ( ) : Generator < T . Token , void , any > ;
425423}
426424
427425/** Request to cancel a pending Interest. */
428426declare class CancelInterest implements FwPacket < Interest > {
429427 l3 : Interest ;
430- token ?: unknown ;
431- constructor ( l3 : Interest , token ?: unknown ) ;
428+ token ?: unknown | undefined ;
429+ constructor ( l3 : Interest , token ?: unknown | undefined ) ;
432430 readonly cancel = true ;
433431}
434432
@@ -740,7 +738,7 @@ declare interface CommonOptions {
740738 */
741739 describe ?: string ;
742740 /**
743- * AbortSignal that allows cancelation via AbortController.
741+ * AbortSignal that allows cancellation via AbortController.
744742 *
745743 * @remarks
746744 * In a consumer, the promise returned by consume() is rejected.
@@ -816,13 +814,15 @@ declare namespace Component {
816814 /** lhs is greater than rhs */
817815 GT = 2
818816 }
817+ /** Compare two components. */
818+ function compare ( lhs : Component , rhs : Component ) : CompareResult ;
819819}
820820
821821/** Component constraint node. */
822822declare class ComponentConstraint extends ComponentConstraintEq {
823823 terms : ComponentConstraintTerm [ ] ;
824824 constructor ( terms ?: ComponentConstraintTerm [ ] ) ;
825- protected componentConstraintToTokens ( ) : Generator < T . Token , void , undefined > ;
825+ protected componentConstraintToTokens ( ) : Generator < T . Token , void , any > ;
826826}
827827
828828/** Component constraint equation. */
@@ -838,15 +838,15 @@ declare class ComponentConstraintRel extends ComponentConstraintEq {
838838 op : T . Operator ;
839839 right : ComponentConstraintEq ;
840840 constructor ( left : ComponentConstraintEq , op : T . Operator , right : ComponentConstraintEq ) ;
841- protected componentConstraintToTokens ( parentOp : string ) : Generator < T . Token , void , undefined > ;
841+ protected componentConstraintToTokens ( parentOp : string ) : Generator < T . Token , void , any > ;
842842}
843843
844844/** Component constraint term node. */
845845declare class ComponentConstraintTerm extends Node_2 {
846846 tag : Ident_2 ;
847847 expr : Expr ;
848848 constructor ( tag : Ident_2 , expr : Expr ) ;
849- toTokens ( ) : Generator < T . Token , void , undefined > ;
849+ toTokens ( ) : Generator < T . Token , void , any > ;
850850}
851851
852852/** Name component or component URI. */
@@ -1141,7 +1141,7 @@ declare class CounterIvGen extends IvGen {
11411141 constructor ( opts : CounterIvGen . Options ) ;
11421142 private readonly ivPrefix ;
11431143 private readonly ci ;
1144- protected generate ( ) : Uint8Array ;
1144+ protected generate ( ) : Uint8Array < ArrayBufferLike > ;
11451145 protected update ( plaintextLength : number , ciphertextLength : number ) : void ;
11461146}
11471147
@@ -2232,8 +2232,8 @@ declare type ExceptOptions = {
22322232
22332233/** Expression node. */
22342234declare abstract class Expr extends Node_2 {
2235- toTokens ( ) : Generator < T . Token , void , undefined > ;
2236- protected static exprToTokens ( node : Expr , parent ?: Expr ) : Generator < T . Token , void , undefined > ;
2235+ toTokens ( ) : Generator < T . Token , void , any > ;
2236+ protected static exprToTokens ( node : Expr , parent ?: Expr ) : Generator < T . Token , void , any > ;
22372237 protected abstract exprParens ( parent : Expr ) : boolean ;
22382238 protected abstract exprToTokens ( ) : Iterable < T . Token > ;
22392239}
@@ -4306,6 +4306,7 @@ declare class MatchState {
43064306 * @returns Updated state, or `false` if variables are inconsistent.
43074307 */
43084308 extend ( incrementPos : number , ...varsL : Array < Iterable < readonly [ string , Name ] > > ) : MatchState | false ;
4309+ toString ( ) : string ;
43094310}
43104311
43114312declare const modifyFields : readonly [ "canBePrefix" , "mustBeFresh" , "fwHint" , "lifetime" , "hopLimit" ] ;
@@ -4439,7 +4440,6 @@ declare class Name {
44394440 equals ( other : NameLike ) : boolean ;
44404441 /** Determine if this name is a prefix of other. */
44414442 isPrefixOf ( other : NameLike ) : boolean ;
4442- private comparePrefix ;
44434443 encodeTo ( encoder : Encoder ) : void ;
44444444}
44454445
@@ -4459,6 +4459,8 @@ declare namespace Name {
44594459 /** rhs is less than, but not a prefix of lhs */
44604460 GT = 2
44614461 }
4462+ /** Compare two names. */
4463+ function compare ( lhs : Name , rhs : Name ) : CompareResult ;
44624464}
44634465
44644466/** Name node. */
@@ -4942,6 +4944,24 @@ declare interface OutputRefSubscription {
49424944 unsubscribe ( ) : void ;
49434945}
49444946
4947+ /**
4948+ * Specify several overlapped patterns in "AND" relation.
4949+ *
4950+ * @remarks
4951+ * When matching a name, every branch of this pattern must extract the same number of name
4952+ * components, and their variables must be consistent.
4953+ *
4954+ * When building a name, one branch is used to build the name as long as all required variables
4955+ * are present, and then the built name must match all branches.
4956+ */
4957+ declare class OverlapPattern extends Pattern {
4958+ readonly branches : Pattern [ ] ;
4959+ constructor ( branches ?: Pattern [ ] ) ;
4960+ simplify ( ) : Pattern ;
4961+ protected matchState ( state : MatchState , branchIndex ?: number , lastMatch ?: MatchState ) : Iterable < MatchState > ;
4962+ protected buildState ( state : BuildState ) : Iterable < BuildState > ;
4963+ }
4964+
49454965declare namespace packet {
49464966 export {
49474967 lpm ,
@@ -5245,7 +5265,8 @@ declare namespace pattern {
52455265 VariablePattern ,
52465266 CertNamePattern ,
52475267 ConcatPattern ,
5248- AlternatePattern
5268+ AlternatePattern ,
5269+ OverlapPattern
52495270 }
52505271}
52515272
@@ -5338,6 +5359,16 @@ declare function print_3(policy: TrustSchemaPolicy): string;
53385359/** Print policy as ECMAScript module. */
53395360declare function printESM ( policy : TrustSchemaPolicy ) : string ;
53405361
5362+ declare namespace printESM {
5363+ interface Context {
5364+ indent : string ;
5365+ imports : DefaultMap < string , Set < string > > ;
5366+ }
5367+ interface PrintableFilter extends VariablePattern . Filter {
5368+ printESM : ( ctx : Context ) => string ;
5369+ }
5370+ }
5371+
53415372/** Pretty-print TLV-TYPE number. */
53425373declare function printTT ( tlvType : number ) : string ;
53435374
@@ -5668,7 +5699,7 @@ declare function pushable<T>(): Pushable<T>;
56685699
56695700/** IV generator using all random bits. */
56705701declare class RandomIvGen extends IvGen {
5671- protected generate ( ) : Uint8Array ;
5702+ protected generate ( ) : Uint8Array < ArrayBuffer > ;
56725703}
56735704
56745705/**
@@ -5754,8 +5785,8 @@ declare class Reassembler {
57545785declare class RejectInterest implements FwPacket < Interest > {
57555786 reject : RejectInterest . Reason ;
57565787 l3 : Interest ;
5757- token ?: unknown ;
5758- constructor ( reject : RejectInterest . Reason , l3 : Interest , token ?: unknown ) ;
5788+ token ?: unknown | undefined ;
5789+ constructor ( reject : RejectInterest . Reason , l3 : Interest , token ?: unknown | undefined ) ;
57595790}
57605791
57615792declare namespace RejectInterest {
@@ -5892,7 +5923,7 @@ declare function scan_2(tokens: Iterable<T.Token>): Unit[];
58925923declare class Schema extends Node_2 {
58935924 stmts : Stmt [ ] ;
58945925 constructor ( stmts ?: Stmt [ ] ) ;
5895- toTokens ( ) : Generator < T . Token , void , undefined > ;
5926+ toTokens ( ) : Generator < T . Token , void , any > ;
58965927}
58975928
58985929/** Named secret key. */
@@ -6196,7 +6227,7 @@ declare const SigningAlgorithmListSlim: readonly SigningAlgorithm[];
61966227declare class SigningConstraint extends Node_2 {
61976228 signers : Ident_2 [ ] ;
61986229 constructor ( signers ?: Ident_2 [ ] ) ;
6199- toTokens ( ) : Generator < T . Token , void , undefined > ;
6230+ toTokens ( ) : Generator < T . Token , void , any > ;
62006231}
62016232
62026233declare type SigningOptG < I , Asym extends boolean , G > = { } extends G ? [
@@ -6308,7 +6339,7 @@ declare class Stmt extends Node_2 {
63086339 componentConstraint : ComponentConstraintEq | undefined ;
63096340 signingChain : SigningConstraint [ ] ;
63106341 constructor ( ident : Ident_2 , definition ?: Expr | undefined , componentConstraint ?: ComponentConstraintEq | undefined , signingChain ?: SigningConstraint [ ] ) ;
6311- toTokens ( ) : Generator < T . Token , void , undefined > ;
6342+ toTokens ( ) : Generator < T . Token , void , any > ;
63126343}
63136344
63146345/**
@@ -6399,12 +6430,14 @@ declare class StructBuilder<U extends {}> {
63996430 * Subclass constructor.
64006431 * This must be assigned, otherwise decoding function will not work.
64016432 */
6402- subclass ?: Constructor < U , [ ] > ;
6433+ subclass ?: Constructor < U , [ ] > & Decodable < U > ;
64036434 private readonly fields ;
64046435 private readonly flagBits ;
64056436 private readonly EVD ;
6406- /** Return field names. */
6407- get keys ( ) : string [ ] ;
6437+ /** Access EvDecoder for certain customizations. */
6438+ static evdOf < U extends { } > ( sb : StructBuilder < U > ) : Except < EvDecoder < U > , "add" > ;
6439+ /** Retrieve field names. */
6440+ static keysOf < U extends { } > ( sb : StructBuilder < U > ) : Array < keyof U > ;
64086441 /**
64096442 * Add a field.
64106443 * @param tt - TLV-TYPE number.
@@ -7709,6 +7742,7 @@ declare abstract class Transport {
77097742 readonly maxComps : number ;
77107743 readonly inner ?: Pattern ;
77117744 readonly filter ?: VariablePattern . Filter ;
7745+ simplify ( ) : Pattern ;
77127746 private innerMatch ;
77137747 private filtersAccept ;
77147748 protected matchState ( state : MatchState ) : Iterable < MatchState > ;
0 commit comments