@ham2k/lib-operation-data 1.1.3 → 1.2.1
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 +18 -0
- package/dist/index.cjs +763 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +95 -1
- package/dist/index.d.ts +95 -1
- package/dist/index.js +758 -22
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -32,4 +32,98 @@ declare function adifModeAndSubmodeForMode(mode: string): string[];
|
|
|
32
32
|
declare function superModeForMode(mode: string): SuperMode;
|
|
33
33
|
declare function modeForFrequency(frequency: number, options?: ModeForFrequencyOptions): string | null | undefined | false;
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Where a level sits among its regulator's, judged by frequencies and modes alone: `full` has
|
|
37
|
+
* everything the regulator's widest level has, `intermediate` has some phone below 28 MHz, `basic` has none.
|
|
38
|
+
*/
|
|
39
|
+
type LicenseTier = 'basic' | 'intermediate' | 'full';
|
|
40
|
+
interface LicenseLevel {
|
|
41
|
+
code: string;
|
|
42
|
+
name: string;
|
|
43
|
+
nameLocal?: string;
|
|
44
|
+
tier: LicenseTier;
|
|
45
|
+
/** No longer issued, but still held. */
|
|
46
|
+
legacy?: boolean;
|
|
47
|
+
/** Names of legacy classes the rules convert into this one. */
|
|
48
|
+
aliases?: string[];
|
|
49
|
+
maxPowerW?: number;
|
|
50
|
+
/** The only supermodes this level may use anywhere; absent means all of them. */
|
|
51
|
+
superModes?: string[];
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* A callsign series that gives the level away. `pattern` is matched against the bare callsign
|
|
55
|
+
* (no portable prefix or suffix). With `atLeast`, the series only proves a minimum: the holder
|
|
56
|
+
* kept the call through an upgrade, or the series is shared with higher levels.
|
|
57
|
+
*/
|
|
58
|
+
interface LicenseCallsignRule {
|
|
59
|
+
pattern: string;
|
|
60
|
+
level: string;
|
|
61
|
+
atLeast?: boolean;
|
|
62
|
+
entities?: string[];
|
|
63
|
+
}
|
|
64
|
+
interface LicenseJurisdiction {
|
|
65
|
+
key: string;
|
|
66
|
+
name: string;
|
|
67
|
+
regulator: string;
|
|
68
|
+
rules?: string;
|
|
69
|
+
/** What the levels are called, in English ("License Class", "Category", …). */
|
|
70
|
+
term: string;
|
|
71
|
+
termLocal?: string;
|
|
72
|
+
/** DXCC entity prefixes whose operators this regulator licenses. */
|
|
73
|
+
entities: string[];
|
|
74
|
+
/** Lowest to highest. */
|
|
75
|
+
levels: LicenseLevel[];
|
|
76
|
+
/** First match wins. */
|
|
77
|
+
callsigns?: LicenseCallsignRule[];
|
|
78
|
+
}
|
|
79
|
+
interface LicenseLevelsData {
|
|
80
|
+
jurisdictions: LicenseJurisdiction[];
|
|
81
|
+
}
|
|
82
|
+
declare const LICENSE_LEVELS: LicenseLevelsData;
|
|
83
|
+
/** The jurisdiction licensing operators in a DXCC entity, or undefined when we have no per-level data for it. */
|
|
84
|
+
declare function licenseJurisdictionForEntity(entityPrefix: string): LicenseJurisdiction | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* How a level is named in the band plan and wherever it is stored: the jurisdiction travels with the
|
|
87
|
+
* code ("us:G"), because codes repeat across regulators.
|
|
88
|
+
*/
|
|
89
|
+
declare function licenseLevelKey(jurisdiction: LicenseJurisdiction, level: LicenseLevel): string;
|
|
90
|
+
/** The jurisdiction and level a key ("us:G") names, or undefined when it names nothing we know. */
|
|
91
|
+
declare function resolveLicenseLevel(key: string): {
|
|
92
|
+
jurisdiction: LicenseJurisdiction;
|
|
93
|
+
level: LicenseLevel;
|
|
94
|
+
} | undefined;
|
|
95
|
+
/**
|
|
96
|
+
* The level a callsign's series gives away under the regulator of `entityPrefix`, or undefined when
|
|
97
|
+
* it gives none away. Portable prefixes and suffixes are ignored: the bare call is the longest
|
|
98
|
+
* slash-separated part.
|
|
99
|
+
*/
|
|
100
|
+
declare function licenseLevelForCallsign(call: string, entityPrefix: string): {
|
|
101
|
+
jurisdiction: LicenseJurisdiction;
|
|
102
|
+
level: LicenseLevel;
|
|
103
|
+
atLeast: boolean;
|
|
104
|
+
} | undefined;
|
|
105
|
+
interface LicensePrivilegesOptions {
|
|
106
|
+
/** The level's key, as `licenseLevelKey` makes it ("us:G"). */
|
|
107
|
+
level: string;
|
|
108
|
+
/** Where the station is. A level only applies under its own regulator. */
|
|
109
|
+
entityPrefix: string;
|
|
110
|
+
ituRegion?: number;
|
|
111
|
+
/** The mode in use; without it only the frequency is judged. */
|
|
112
|
+
mode?: string;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Whether transmitting on `khz` is outside a level's privileges: true or false, or undefined when
|
|
116
|
+
* there is nothing to judge by — an unknown level, a station under another regulator, or a frequency
|
|
117
|
+
* on no band.
|
|
118
|
+
*
|
|
119
|
+
* Every level may use a band unless the band or a segment says otherwise. A segment's edges are
|
|
120
|
+
* outside it, so an operator on the line between two privileges is not flagged. Without an
|
|
121
|
+
* `ituRegion`, region-scoped segments are skipped: the permissive answer, so a station whose
|
|
122
|
+
* region is unknown is never flagged by mistake.
|
|
123
|
+
*
|
|
124
|
+
* Mode rules that bind every level of a country alike are left to the band plan's own segments;
|
|
125
|
+
* the `superModes` here only narrow one level against its regulator's others.
|
|
126
|
+
*/
|
|
127
|
+
declare function isOutsideLicensePrivileges(khz: number, options: LicensePrivilegesOptions): boolean | undefined;
|
|
128
|
+
|
|
129
|
+
export { ADIF_MODES, ADIF_MODES_AND_SUBMODES, ADIF_MODE_FOR_SUBMODE, ADIF_SUBMODES, ALL_MODES, BANDS, type Band, CONTEST_BANDS, EHF_BANDS, EXTENDED_BANDS, HF_BANDS, LICENSE_LEVELS, type LicenseCallsignRule, type LicenseJurisdiction, type LicenseLevel, type LicenseLevelsData, type LicensePrivilegesOptions, type LicenseTier, MAIN_MODES, PHONE_MODES, POPULAR_BANDS, POPULAR_MODES, SHF_BANDS, SUPER_MODES, type SuperMode, UHF_BANDS, VHF_BANDS, adifModeAndSubmodeForMode, bandForExactFrequencyInMHz, bandForFrequency, frequencyForBand, isOutsideLicensePrivileges, licenseJurisdictionForEntity, licenseLevelForCallsign, licenseLevelKey, modeForFrequency, resolveLicenseLevel, superModeForMode };
|
package/dist/index.d.ts
CHANGED
|
@@ -32,4 +32,98 @@ declare function adifModeAndSubmodeForMode(mode: string): string[];
|
|
|
32
32
|
declare function superModeForMode(mode: string): SuperMode;
|
|
33
33
|
declare function modeForFrequency(frequency: number, options?: ModeForFrequencyOptions): string | null | undefined | false;
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Where a level sits among its regulator's, judged by frequencies and modes alone: `full` has
|
|
37
|
+
* everything the regulator's widest level has, `intermediate` has some phone below 28 MHz, `basic` has none.
|
|
38
|
+
*/
|
|
39
|
+
type LicenseTier = 'basic' | 'intermediate' | 'full';
|
|
40
|
+
interface LicenseLevel {
|
|
41
|
+
code: string;
|
|
42
|
+
name: string;
|
|
43
|
+
nameLocal?: string;
|
|
44
|
+
tier: LicenseTier;
|
|
45
|
+
/** No longer issued, but still held. */
|
|
46
|
+
legacy?: boolean;
|
|
47
|
+
/** Names of legacy classes the rules convert into this one. */
|
|
48
|
+
aliases?: string[];
|
|
49
|
+
maxPowerW?: number;
|
|
50
|
+
/** The only supermodes this level may use anywhere; absent means all of them. */
|
|
51
|
+
superModes?: string[];
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* A callsign series that gives the level away. `pattern` is matched against the bare callsign
|
|
55
|
+
* (no portable prefix or suffix). With `atLeast`, the series only proves a minimum: the holder
|
|
56
|
+
* kept the call through an upgrade, or the series is shared with higher levels.
|
|
57
|
+
*/
|
|
58
|
+
interface LicenseCallsignRule {
|
|
59
|
+
pattern: string;
|
|
60
|
+
level: string;
|
|
61
|
+
atLeast?: boolean;
|
|
62
|
+
entities?: string[];
|
|
63
|
+
}
|
|
64
|
+
interface LicenseJurisdiction {
|
|
65
|
+
key: string;
|
|
66
|
+
name: string;
|
|
67
|
+
regulator: string;
|
|
68
|
+
rules?: string;
|
|
69
|
+
/** What the levels are called, in English ("License Class", "Category", …). */
|
|
70
|
+
term: string;
|
|
71
|
+
termLocal?: string;
|
|
72
|
+
/** DXCC entity prefixes whose operators this regulator licenses. */
|
|
73
|
+
entities: string[];
|
|
74
|
+
/** Lowest to highest. */
|
|
75
|
+
levels: LicenseLevel[];
|
|
76
|
+
/** First match wins. */
|
|
77
|
+
callsigns?: LicenseCallsignRule[];
|
|
78
|
+
}
|
|
79
|
+
interface LicenseLevelsData {
|
|
80
|
+
jurisdictions: LicenseJurisdiction[];
|
|
81
|
+
}
|
|
82
|
+
declare const LICENSE_LEVELS: LicenseLevelsData;
|
|
83
|
+
/** The jurisdiction licensing operators in a DXCC entity, or undefined when we have no per-level data for it. */
|
|
84
|
+
declare function licenseJurisdictionForEntity(entityPrefix: string): LicenseJurisdiction | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* How a level is named in the band plan and wherever it is stored: the jurisdiction travels with the
|
|
87
|
+
* code ("us:G"), because codes repeat across regulators.
|
|
88
|
+
*/
|
|
89
|
+
declare function licenseLevelKey(jurisdiction: LicenseJurisdiction, level: LicenseLevel): string;
|
|
90
|
+
/** The jurisdiction and level a key ("us:G") names, or undefined when it names nothing we know. */
|
|
91
|
+
declare function resolveLicenseLevel(key: string): {
|
|
92
|
+
jurisdiction: LicenseJurisdiction;
|
|
93
|
+
level: LicenseLevel;
|
|
94
|
+
} | undefined;
|
|
95
|
+
/**
|
|
96
|
+
* The level a callsign's series gives away under the regulator of `entityPrefix`, or undefined when
|
|
97
|
+
* it gives none away. Portable prefixes and suffixes are ignored: the bare call is the longest
|
|
98
|
+
* slash-separated part.
|
|
99
|
+
*/
|
|
100
|
+
declare function licenseLevelForCallsign(call: string, entityPrefix: string): {
|
|
101
|
+
jurisdiction: LicenseJurisdiction;
|
|
102
|
+
level: LicenseLevel;
|
|
103
|
+
atLeast: boolean;
|
|
104
|
+
} | undefined;
|
|
105
|
+
interface LicensePrivilegesOptions {
|
|
106
|
+
/** The level's key, as `licenseLevelKey` makes it ("us:G"). */
|
|
107
|
+
level: string;
|
|
108
|
+
/** Where the station is. A level only applies under its own regulator. */
|
|
109
|
+
entityPrefix: string;
|
|
110
|
+
ituRegion?: number;
|
|
111
|
+
/** The mode in use; without it only the frequency is judged. */
|
|
112
|
+
mode?: string;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Whether transmitting on `khz` is outside a level's privileges: true or false, or undefined when
|
|
116
|
+
* there is nothing to judge by — an unknown level, a station under another regulator, or a frequency
|
|
117
|
+
* on no band.
|
|
118
|
+
*
|
|
119
|
+
* Every level may use a band unless the band or a segment says otherwise. A segment's edges are
|
|
120
|
+
* outside it, so an operator on the line between two privileges is not flagged. Without an
|
|
121
|
+
* `ituRegion`, region-scoped segments are skipped: the permissive answer, so a station whose
|
|
122
|
+
* region is unknown is never flagged by mistake.
|
|
123
|
+
*
|
|
124
|
+
* Mode rules that bind every level of a country alike are left to the band plan's own segments;
|
|
125
|
+
* the `superModes` here only narrow one level against its regulator's others.
|
|
126
|
+
*/
|
|
127
|
+
declare function isOutsideLicensePrivileges(khz: number, options: LicensePrivilegesOptions): boolean | undefined;
|
|
128
|
+
|
|
129
|
+
export { ADIF_MODES, ADIF_MODES_AND_SUBMODES, ADIF_MODE_FOR_SUBMODE, ADIF_SUBMODES, ALL_MODES, BANDS, type Band, CONTEST_BANDS, EHF_BANDS, EXTENDED_BANDS, HF_BANDS, LICENSE_LEVELS, type LicenseCallsignRule, type LicenseJurisdiction, type LicenseLevel, type LicenseLevelsData, type LicensePrivilegesOptions, type LicenseTier, MAIN_MODES, PHONE_MODES, POPULAR_BANDS, POPULAR_MODES, SHF_BANDS, SUPER_MODES, type SuperMode, UHF_BANDS, VHF_BANDS, adifModeAndSubmodeForMode, bandForExactFrequencyInMHz, bandForFrequency, frequencyForBand, isOutsideLicensePrivileges, licenseJurisdictionForEntity, licenseLevelForCallsign, licenseLevelKey, modeForFrequency, resolveLicenseLevel, superModeForMode };
|