specpress
Version:
Export PDF and/or DOCX files from a subset of Markdown, ASN.1 and JSON files
386 lines (385 loc) • 16.9 kB
TypeScript
import { BaseClass, BaseList } from "./Utils.js";
import { BandNumber } from "./BandNumber.js";
import { BC_ID } from "./BC_ID.js";
import { BWC_ID } from "./BWC_ID.js";
import { ChannelBandwidthList } from "./ChannelBandwidthPerBand.js";
import { RAN4JsonEncoder } from "./JsonTools.js";
import { HtmlTable } from "./HtmlTable.js";
/** Maximum valid BCS-ID value (inclusive). */
declare const MAX_BCS_ID = 31;
/** Thrown when a BCS-ID value is out of range or not an integer. */
export declare class InvalidBcsIdException extends RangeError {
}
/** Thrown when a carrier bandwidth value is invalid. */
export declare class InvalidCarrierBandwidthException extends RangeError {
}
/** Thrown when a band number is not defined in the channel bandwidth table. */
export declare class UndefinedBandNumberException extends RangeError {
}
/** Thrown when a band number does not match the BC-ID. */
export declare class UnexpectedBandNumberException extends RangeError {
}
/** Thrown when non-contiguous variants are used incorrectly. */
export declare class NonContVariantException extends RangeError {
}
/** Thrown when contiguous and non-contiguous carriers are mixed. */
export declare class ContNonContMixException extends RangeError {
}
/** Thrown when more non-contiguous carriers are specified than the BC-ID allows. */
export declare class TooManyNonContCarrierException extends RangeError {
}
/** Thrown when contiguous carrier variant counts are inconsistent. */
export declare class ContCarrierVariantMismatchException extends RangeError {
}
/** Thrown when fewer than two contiguous carriers are specified. */
export declare class LessThanTwoContigiousCarriersException extends RangeError {
}
/** Thrown when more contiguous carriers are specified than the BC-ID allows. */
export declare class TooManyContCarrierException extends RangeError {
}
/** Thrown when expected carrier components are not defined. */
export declare class UndefinedCarriersException extends RangeError {
}
/** Thrown when maxAggBwPerBand is not a valid positive integer. */
export declare class InvalidMaxBandwidthException extends RangeError {
}
/** Thrown when a referenced BC-ID is not found in the BC table. */
export declare class UndefinedBandCombinationException extends RangeError {
}
/** Thrown when a referenced channel bandwidth is not found. */
export declare class UndefinedChannelBandwidthException extends RangeError {
}
/** Thrown when a band number in a RefComponent doesn't match its parent BandEntry. */
export declare class BandNumberMismatchException extends RangeError {
}
/** Thrown when a BCS contains duplicate band entries for the same band. */
export declare class DuplicateBandEntryException extends RangeError {
}
/** Thrown when a BCS is missing its bcsId. */
export declare class MissingBandwidthCombinationSetIdException extends RangeError {
}
/** Thrown when a BCS has no band entries. */
export declare class MissingBandListException extends RangeError {
}
/** Thrown when an UL configuration references an undefined band or BC. */
export declare class UndefinedUplinkConfigException extends RangeError {
}
/** Thrown when a BC is missing its bcId. */
export declare class MissingBcIdException extends RangeError {
}
/** Thrown when a RefComponent references a multi-band BC-ID. */
export declare class InvalidReferenceBcId extends RangeError {
}
/** Thrown when a RefComponent's BWC doesn't match the BC-ID. */
export declare class UnexpectedBwcException extends RangeError {
}
/** Thrown when a BC contains duplicate BCS entries. */
export declare class DuplicateBcsException extends RangeError {
}
/** Thrown when a BC has no BCS entries. */
export declare class MissingBcsListException extends RangeError {
}
/** Thrown when a referenced BCS-ID is not found in a BC. */
export declare class UndefinedBcsException extends RangeError {
}
/** Thrown when a BCS contains duplicate UL configurations. */
export declare class DuplicateUplinkConfigException extends RangeError {
}
/** Thrown when the BandCombinationList is empty during validation. */
export declare class NoBandCombinationsException extends RangeError {
}
/** Thrown when the specification field does not match the expected value. */
export declare class InvalidSpecificationException extends Error {
}
/**
* A Bandwidth Combination Set identifier (0–31).
*
* Wraps an integer BCS-ID with validation. Accepts numeric values,
* string integers, or strings prefixed with `"BCS"`.
*/
export declare class BCS_ID {
private value;
/**
* @param aValue — a number, string (e.g. `"0"`, `"BCS3"`), or existing BCS_ID to copy.
* @throws InvalidBcsIdException if the value is out of range [0..31].
*/
constructor(aValue: number | string | BCS_ID);
/** Returns the numeric BCS-ID value. */
valueOf(): number;
/** Returns the BCS-ID as a string. */
toString(): string;
/** Returns true if this BCS-ID equals another. */
equals(aOther: BCS_ID): boolean;
}
/**
* A reference to another band combination or a single band number.
*
* Used within a BandEntry to indicate that the carrier configuration for
* this band is defined by referencing another BC (with a specific BCS-ID)
* or simply by the band's channel bandwidth table.
*/
export declare class RefComponent extends BaseClass {
/** The referenced BC-ID, or null if referencing by band number. */
bcId: BC_ID | null;
/** The BCS-ID within the referenced BC, or -1 if not applicable. */
bcsId: BCS_ID | number;
/** The referenced band number, or null if referencing by BC-ID. */
bandNumber: BandNumber | null;
/**
* @param aValue — a dict from JSON or an existing RefComponent to copy.
* @param aParent — the parent BandEntry.
*/
constructor(aValue: Record<string, unknown> | RefComponent, aParent?: BaseClass | null);
/**
* Validates the RefComponent against the channel bandwidth and BC tables.
* Checks that exactly one of bcId/bandNumber is set, band numbers match,
* and referenced BCs/BCSs exist.
*/
validate(aChBwList?: ChannelBandwidthList, aBcList?: BandCombinationList): void;
toString(): string;
toHTMLLink(): string;
getTag(): string;
toJSON(anEncoder: RAN4JsonEncoder, aLevel: number): void;
/** Returns the effective BWC-ID of this reference after validation. */
getBWC_ID(aChBwList?: ChannelBandwidthList, aBcList?: BandCombinationList): BWC_ID;
}
/**
* A single carrier component within a band entry.
*
* Contains a list of supported bandwidth values (integers in MHz) or a
* single BandNumber reference indicating that the carrier uses the band's
* full channel bandwidth table.
*/
export declare class Carrier extends BaseClass {
/** Bandwidth values (integers) or a single BandNumber reference. */
bwList: (number | BandNumber)[];
/**
* @param aValue — an array of bandwidth values or an existing Carrier to copy.
* @param aParent — the parent BandEntry.
*/
constructor(aValue: unknown[] | Carrier, aParent?: BaseClass | null);
validate(aChBwList?: ChannelBandwidthList, aBcList?: BandCombinationList): void;
toString(): string;
getTag(): string;
toJSON(anEncoder: RAN4JsonEncoder, aLevel: number): void;
}
/**
* A Contiguous Carrier Group Variant — one possible arrangement of
* contiguous carriers within a band.
*
* Contains a list of Carrier objects representing the individual
* component carriers in this contiguous group.
*/
export declare class CCGV extends BaseClass {
/** The component carriers in this contiguous group. */
ccList: Carrier[];
/**
* @param aValue — an array of carrier arrays or an existing CCGV to copy.
* @param aParent — the parent BandEntry or ContCarrierGroup.
*/
constructor(aValue: unknown[] | CCGV, aParent?: BaseClass | null);
toString(): string;
getTag(): string;
validate(aChBwList?: ChannelBandwidthList, aBcList?: BandCombinationList): void;
toJSON(anEncoder: RAN4JsonEncoder, aLevel: number): void;
/** Returns the number of component carriers in this group. */
getNrofCarriers(): number;
}
/**
* A Contiguous Carrier Group — a set of CCGV variants that all describe
* the same number of contiguous carriers with different bandwidth options.
*/
export declare class ContCarrierGroup extends BaseClass {
/** The list of CCGV variants. */
ccgvList: CCGV[];
/**
* @param aCCGVList — array of CCGV arrays from JSON.
* @param aParent — the parent BandEntry.
*/
constructor(aCCGVList: unknown[], aParent?: BaseClass | null);
validate(aChBwList?: ChannelBandwidthList, aBcList?: BandCombinationList): void;
toString(): string;
getTag(): string;
toJSON(anEncoder: RAN4JsonEncoder, aLevel: number): void;
/** Returns the number of contiguous carriers (from the first variant). */
getNrofContCarriers(): number;
/** Returns the number of CCGV variants. */
getNrofVariants(): number;
}
/**
* A band entry within a Bandwidth Combination Set (BCS).
*
* Describes the carrier configuration for one band within a band combination:
* non-contiguous carriers, contiguous carrier groups, referenced components,
* and the maximum aggregated bandwidth.
*/
export declare class BandEntry extends BaseClass {
/** The band number for this entry. */
bandNumber: BandNumber | null;
/** Non-contiguous (individual) carriers. */
nonContiguousCarriers: Carrier[];
/** Contiguous carrier group variants. */
contiguousCarriers: CCGV[];
/** References to other BCs or band numbers. */
referencedComponents: RefComponent[];
/** Maximum aggregated bandwidth per band in MHz (0 if not specified). */
maxAggBwPerBand: number;
/**
* @param aValue — a dict from JSON or an existing BandEntry to copy.
* @param aParent — the parent BCS.
*/
constructor(aValue: Record<string, unknown> | BandEntry, aParent?: BaseClass | null);
/**
* Validates this band entry against the channel bandwidth and BC tables.
* Checks band number existence, BWC-ID consistency, carrier counts, and
* referenced component validity.
*/
validate(aChBwList?: ChannelBandwidthList, aBcList?: BandCombinationList): void;
toString(): string;
getTag(): string;
/** Returns the BWC value table (FR1 or FR2) based on this band's frequency range. */
getBwcTable(): Record<string, {
nrofCarriers: number;
}>;
toJSON(anEncoder: RAN4JsonEncoder, aLevel: number): void;
toHTML(aHtmlTable: HtmlTable, aRow?: number, aColumn?: number): void;
}
/**
* An uplink configuration within a CA band combination.
*
* Identifies one UL component by either a BC-ID (for multi-carrier UL) or
* a band number (for single-carrier UL). If the bcId is a single-carrier
* configuration, it is automatically converted to a bandNumber.
*/
export declare class UlConfig extends BaseClass {
/** The BC-ID for multi-carrier UL, or null. */
bcId: BC_ID | null;
/** The band number for single-carrier UL, or null. */
bandNumber: BandNumber | null;
/** Optional specification notes. */
notes: Record<string, unknown>;
/**
* @param aValue — a dict from JSON or an existing UlConfig to copy.
* @param aParent — the parent BCS.
*/
constructor(aValue: Record<string, unknown> | UlConfig, aParent?: BaseClass | null);
validate(aChBwList?: ChannelBandwidthList, aBcList?: BandCombinationList): void;
toJSON(anEncoder: RAN4JsonEncoder, aLevel: number): void;
toString(): string;
toStringWithNotes(ulNoteDescriptions?: Record<string, string>): string;
getTag(): string;
}
/**
* A Bandwidth Combination Set within a band combination.
*
* Groups a BCS-ID with its list of band entries (one per band) and
* optional UL configurations. Each BCS represents one set of allowed
* bandwidth combinations for the parent BC.
*/
export declare class BCS extends BaseClass {
/** The BCS-ID (0–31). */
bcsId: BCS_ID | number;
/** UL configurations for this BCS. */
ulConfigList: UlConfig[];
/** Band entries (one per band in the combination). */
bandList: BandEntry[];
/**
* @param aValue — a dict from JSON or an existing BCS to copy.
* @param aParent — the parent BC.
*/
constructor(aValue: Record<string, unknown> | BCS, aParent?: BaseClass | null);
validate(aChBwList?: ChannelBandwidthList, aBcList?: BandCombinationList): void;
/** Returns true if this BCS already contains a band entry for the given band. */
hasBandEntry(aBandNumber: BandNumber): boolean;
/** Returns true if this BCS already contains the given UL configuration. */
hasUlConfig(anUlConfig: UlConfig): boolean;
toString(): string;
getTag(): string;
toJSON(anEncoder: RAN4JsonEncoder, aLevel: number): void;
toHTML(aHtmlTable: HtmlTable, aRow?: number, aColumn?: number, ulNoteDescriptions?: Record<string, string>): void;
}
/**
* A band combination (BC) — the top-level CA configuration.
*
* Contains a BC-ID, one or more Bandwidth Combination Sets (BCS), and
* optional notes. Corresponds to one `CA_*.json` file.
*/
export declare class BC extends BaseClass {
/** The BC-ID identifying this band combination. */
bcId: BC_ID | null;
/** The list of Bandwidth Combination Sets. */
bcsList: BCS[];
/** Optional specification notes. */
notes: Record<string, unknown>;
/** Specification number (e.g. "38.101-1"). */
specification: string | null;
/** Schema version */
schemaVersion: string | null;
/**
* @param aValue — a dict from JSON or an existing BC to copy.
* @param aParent — the parent BandCombinationList.
*/
constructor(aValue: Record<string, unknown> | BC, aParent?: BaseClass | null);
validate(aChBwList?: ChannelBandwidthList, aBcList?: BandCombinationList): void;
/** Returns true if this BC contains a BCS with the given BCS-ID. */
hasBCS(aBcsId: BCS_ID | number): boolean;
toString(): string;
getTag(): string;
toJSON(anEncoder: RAN4JsonEncoder, aLevel: number): void;
toHTML(aHtmlTable: HtmlTable, aRow?: number, aColumn?: number, ulNoteDescriptions?: Record<string, string>, dlNoteDescriptions?: Record<string, string>): void;
}
/**
* Collection of CA band combinations.
*
* Keyed by BC-ID string (e.g. `"CA_n1A-n78C"`). Supports loading from
* individual JSON files or a single multi-BC file, cross-reference
* validation against the channel bandwidth table, and export to JSON or HTML.
*/
export declare class BandCombinationList extends BaseList {
/** HTML table used for HTML export. */
html: HtmlTable;
private _skipSingleCarrierBCs;
constructor(aParent?: BaseClass | null);
protected _createEntry(aValue: unknown, aParent: BaseList): BaseClass;
protected _getEntryId(anEntry: BaseClass): string;
/** Returns true if a BC with the given BC-ID exists in this list. */
hasBC(aBcId: BC_ID | string): boolean;
/**
* Validates all BCs, passing the channel bandwidth table and this list
* for cross-reference checks. Throws on the first error.
*/
validate(): void;
/**
* Validates all BCs, collecting errors instead of throwing.
* @returns an array of error messages (empty if all valid).
*/
validateCollectErrors(): string[];
/** Loads BCs from a single JSON file containing a bandCombinationList array. */
loadFromFile(aJsonFile: string): void;
protected _getTargetSubfolder(anEntry: BaseClass): string;
protected _getFileName(anEntry: BaseClass): string;
protected _shouldStoreEntry(anEntry: BaseClass): boolean;
/**
* Stores all BCs as individual JSON files under the appropriate subfolders.
* @param aFolder — the root output folder.
* @param skipSingleCarrierBCs — if true (default), omit single-carrier BCs.
*/
storeAsJsonFiles(aFolder: string, skipSingleCarrierBCs?: boolean): void;
/** Exports all BCs to an HTML table file, sorted by BC-ID. */
storeAsHtmlFile(aFileName: string): void;
/**
* Adds the standard BC table headers to an HtmlTable.
* @param aHtmlTable — the table to add headers to (modifies row 0).
*/
static addTableHeaders(aHtmlTable: HtmlTable): void;
/**
* Renders a single BC as a complete HTML table string.
* @param data — Raw JSON object containing BC data
* @param ulNoteDescriptions — UL note descriptions for tooltips
* @param dlNoteDescriptions — DL note descriptions for tooltips
* @returns HTML table string with headers and one BC row
*/
static renderAsHtml(data: Record<string, unknown>, ulNoteDescriptions?: Record<string, string>, dlNoteDescriptions?: Record<string, string>): string;
toJSON(anEncoder: RAN4JsonEncoder, aLevel: number): void;
}
export { MAX_BCS_ID };