@signalk/server-api 2.7.2 → 2.9.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.
Files changed (55) hide show
  1. package/dist/autopilotapi.d.ts +116 -9
  2. package/dist/autopilotapi.d.ts.map +1 -1
  3. package/dist/autopilotapi.js +41 -3
  4. package/dist/brand.d.ts +1 -1
  5. package/dist/course.d.ts +1 -0
  6. package/dist/course.d.ts.map +1 -1
  7. package/dist/coursetypes.d.ts +9 -0
  8. package/dist/coursetypes.d.ts.map +1 -1
  9. package/dist/coursetypes.js +1 -0
  10. package/dist/deltas.d.ts +21 -0
  11. package/dist/deltas.d.ts.map +1 -1
  12. package/dist/deltas.js +4 -0
  13. package/dist/features.d.ts +3 -1
  14. package/dist/features.d.ts.map +1 -1
  15. package/dist/history.d.ts +46 -0
  16. package/dist/history.d.ts.map +1 -0
  17. package/dist/history.js +20 -0
  18. package/dist/index.d.ts +7 -1
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +28 -2
  21. package/dist/mmsi/mid.d.ts +21 -0
  22. package/dist/mmsi/mid.d.ts.map +1 -0
  23. package/dist/mmsi/mid.js +301 -0
  24. package/dist/mmsi/mmsi.d.ts +75 -0
  25. package/dist/mmsi/mmsi.d.ts.map +1 -0
  26. package/dist/mmsi/mmsi.js +165 -0
  27. package/dist/mmsi/mmsi.test.d.ts +2 -0
  28. package/dist/mmsi/mmsi.test.d.ts.map +1 -0
  29. package/dist/plugin.d.ts +2 -0
  30. package/dist/plugin.d.ts.map +1 -1
  31. package/dist/propertyvalues.d.ts +5 -0
  32. package/dist/propertyvalues.d.ts.map +1 -1
  33. package/dist/propertyvalues.js +1 -0
  34. package/dist/resourcesapi.d.ts +10 -0
  35. package/dist/resourcesapi.d.ts.map +1 -1
  36. package/dist/resourcesapi.js +4 -0
  37. package/dist/resourcetypes.d.ts +14 -1
  38. package/dist/resourcetypes.d.ts.map +1 -1
  39. package/dist/serverapi.d.ts +10 -2
  40. package/dist/serverapi.d.ts.map +1 -1
  41. package/dist/streambundle.d.ts +1 -0
  42. package/dist/streambundle.d.ts.map +1 -1
  43. package/dist/subscriptionmanager.d.ts +10 -2
  44. package/dist/subscriptionmanager.d.ts.map +1 -1
  45. package/dist/weatherapi.d.ts +215 -0
  46. package/dist/weatherapi.d.ts.map +1 -0
  47. package/dist/weatherapi.guard.d.ts +3 -0
  48. package/dist/weatherapi.guard.d.ts.map +1 -0
  49. package/dist/weatherapi.guard.js +18 -0
  50. package/dist/weatherapi.js +20 -0
  51. package/package.json +13 -2
  52. package/tsconfig.tsbuildinfo +1 -1
  53. package/dist/autopilotapi.guard.d.ts +0 -3
  54. package/dist/autopilotapi.guard.d.ts.map +0 -1
  55. package/dist/autopilotapi.guard.js +0 -22
package/dist/index.js CHANGED
@@ -10,11 +10,33 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
10
10
  if (k2 === undefined) k2 = k;
11
11
  o[k2] = m[k];
12
12
  }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
13
18
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
19
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
20
  };
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
16
38
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.SKVersion = void 0;
39
+ exports.SKVersion = exports.history = void 0;
18
40
  __exportStar(require("./plugin"), exports);
19
41
  __exportStar(require("./serverapi"), exports);
20
42
  __exportStar(require("./deltas"), exports);
@@ -24,11 +46,15 @@ __exportStar(require("./resourcesapi"), exports);
24
46
  __exportStar(require("./features"), exports);
25
47
  __exportStar(require("./course"), exports);
26
48
  __exportStar(require("./autopilotapi"), exports);
27
- __exportStar(require("./autopilotapi.guard"), exports);
49
+ __exportStar(require("./mmsi/mmsi"), exports);
28
50
  __exportStar(require("./propertyvalues"), exports);
29
51
  __exportStar(require("./brand"), exports);
52
+ __exportStar(require("./weatherapi"), exports);
30
53
  __exportStar(require("./streambundle"), exports);
31
54
  __exportStar(require("./subscriptionmanager"), exports);
55
+ /** @category History API */
56
+ exports.history = __importStar(require("./history"));
57
+ /** @category Server API */
32
58
  var SKVersion;
33
59
  (function (SKVersion) {
34
60
  SKVersion["v1"] = "v1";
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Represents a country with its ISO 3166 country codes and name.
3
+ *
4
+ * @see {@link https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes | List of ISO 3166 country codes}
5
+ * @category MMSI
6
+ */
7
+ export interface FlagCountry {
8
+ /** ISO 3166-1 alpha-2 country code (2 letters) */
9
+ alpha2: string;
10
+ /** ISO 3166-1 alpha-3 country code (3 letters) */
11
+ alpha3: string;
12
+ /** Country name */
13
+ name: string;
14
+ }
15
+ export declare const mid2Country: (mid: string) => FlagCountry | undefined;
16
+ type Mid2FlagCountries = {
17
+ [mid: string]: FlagCountry;
18
+ };
19
+ export declare const MID: Mid2FlagCountries;
20
+ export {};
21
+ //# sourceMappingURL=mid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mid.d.ts","sourceRoot":"","sources":["../../src/mmsi/mid.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAA;IACd,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAA;IACd,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAA;CACb;AAED,eAAO,MAAM,WAAW,GAAI,KAAK,MAAM,KAAG,WAAW,GAAG,SAAqB,CAAA;AAE7E,KAAK,iBAAiB,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAAA;CAAE,CAAA;AAGvD,eAAO,MAAM,GAAG,EAAE,iBAsSZ,CAAA"}
@@ -0,0 +1,301 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MID = exports.mid2Country = void 0;
4
+ const mid2Country = (mid) => exports.MID[mid];
5
+ exports.mid2Country = mid2Country;
6
+ // source: https://github.com/michaeljfazio/MIDs/blob/master/mids.json
7
+ exports.MID = Object.entries({
8
+ '201': ['AL', 'ALB', '', 'Albania'],
9
+ '202': ['AD', 'AND', '', 'Andorra'],
10
+ '203': ['AT', 'AUT', '', 'Austria'],
11
+ '204': ['PT', 'PRT', 'PT-20', 'Azores'],
12
+ '205': ['BE', 'BEL', '', 'Belgium'],
13
+ '206': ['BY', 'BLR', '', 'Belarus'],
14
+ '207': ['BG', 'BGR', '', 'Bulgaria'],
15
+ '208': ['VA', 'VAT', '', 'Vatican City State'],
16
+ '209': ['CY', 'CYP', '', 'Cyprus'],
17
+ '210': ['CY', 'CYP', '', 'Cyprus'],
18
+ '211': ['DE', 'DEU', '', 'Germany'],
19
+ '212': ['CY', 'CYP', '', 'Cyprus'],
20
+ '213': ['GE', 'GEO', '', 'Georgia'],
21
+ '214': ['MD', 'MDA', '', 'Moldova'],
22
+ '215': ['MT', 'MLT', '', 'Malta'],
23
+ '216': ['AM', 'ARM', '', 'Armenia'],
24
+ '218': ['DE', 'DEU', '', 'Germany'],
25
+ '219': ['DK', 'DNK', '', 'Denmark'],
26
+ '220': ['DK', 'DNK', '', 'Denmark'],
27
+ '224': ['ES', 'ESP', '', 'Spain'],
28
+ '225': ['ES', 'ESP', '', 'Spain'],
29
+ '226': ['FR', 'FRA', '', 'France'],
30
+ '227': ['FR', 'FRA', '', 'France'],
31
+ '228': ['FR', 'FRA', '', 'France'],
32
+ '229': ['MT', 'MLT', '', 'Malta'],
33
+ '230': ['FI', 'FIN', '', 'Finland'],
34
+ '231': ['FO', 'FRO', '', 'Faroe Islands'],
35
+ '232': ['GB', 'GBR', '', 'United Kingdom'],
36
+ '233': ['GB', 'GBR', '', 'United Kingdom'],
37
+ '234': ['GB', 'GBR', '', 'United Kingdom'],
38
+ '235': ['GB', 'GBR', '', 'United Kingdom'],
39
+ '236': ['GI', 'GIB', '', 'Gibraltar'],
40
+ '237': ['GR', 'GRC', '', 'Greece'],
41
+ '238': ['HR', 'HRV', '', 'Croatia'],
42
+ '239': ['GR', 'GRC', '', 'Greece'],
43
+ '240': ['GR', 'GRC', '', 'Greece'],
44
+ '241': ['GR', 'GRC', '', 'Greece'],
45
+ '242': ['MA', 'MAR', '', 'Morocco'],
46
+ '243': ['HU', 'HUN', '', 'Hungary'],
47
+ '244': ['NL', 'NLD', '', 'Netherlands'],
48
+ '245': ['NL', 'NLD', '', 'Netherlands'],
49
+ '246': ['NL', 'NLD', '', 'Netherlands'],
50
+ '247': ['IT', 'ITA', '', 'Italy'],
51
+ '248': ['MT', 'MLT', '', 'Malta'],
52
+ '249': ['MT', 'MLT', '', 'Malta'],
53
+ '250': ['IE', 'IRL', '', 'Ireland'],
54
+ '251': ['IS', 'ISL', '', 'Iceland'],
55
+ '252': ['LI', 'LIE', '', 'Liechtenstein'],
56
+ '253': ['LU', 'LUX', '', 'Luxembourg'],
57
+ '254': ['MC', 'MCO', '', 'Monaco'],
58
+ '255': ['PT', 'PRT', 'PT-30', 'Madeira'],
59
+ '256': ['MT', 'MLT', '', 'Malta'],
60
+ '257': ['NO', 'NOR', '', 'Norway'],
61
+ '258': ['NO', 'NOR', '', 'Norway'],
62
+ '259': ['NO', 'NOR', '', 'Norway'],
63
+ '261': ['PL', 'POL', '', 'Poland'],
64
+ '262': ['ME', 'MNE', '', 'Montenegro'],
65
+ '263': ['PT', 'PRT', '', 'Portugal'],
66
+ '264': ['RO', 'ROU', '', 'Romania'],
67
+ '265': ['SE', 'SWE', '', 'Sweden'],
68
+ '266': ['SE', 'SWE', '', 'Sweden'],
69
+ '267': ['SK', 'SVK', '', 'Slovak Republic'],
70
+ '268': ['SM', 'SMR', '', 'San Marino'],
71
+ '269': ['CH', 'CHE', '', 'Switzerland'],
72
+ '270': ['CZ', 'CZE', '', 'Czech Republic'],
73
+ '271': ['TR', 'TUR', '', 'Turkey'],
74
+ '272': ['UA', 'UKR', '', 'Ukraine'],
75
+ '273': ['RU', 'RUS', '', 'Russia'],
76
+ '274': ['MK', 'MKD', '', 'Macedonia'],
77
+ '275': ['LV', 'LVA', '', 'Latvia'],
78
+ '276': ['EE', 'EST', '', 'Estonia'],
79
+ '277': ['LT', 'LTU', '', 'Lithuania'],
80
+ '278': ['SI', 'SVN', '', 'Slovenia'],
81
+ '279': ['RS', 'SRB', '', 'Serbia'],
82
+ '301': ['AI', 'AIA', '', 'Anguilla'],
83
+ '303': ['US', 'USA', 'US-AK', 'Alaska'],
84
+ '304': ['AG', 'ATG', '', 'Antigua and Barbuda'],
85
+ '305': ['AG', 'ATG', '', 'Antigua and Barbuda'],
86
+ '306': ['CW', 'CUW', '', 'Antilles'],
87
+ '307': ['AW', 'ABW', '', 'Aruba'],
88
+ '308': ['BS', 'BHS', '', 'Bahamas'],
89
+ '309': ['BS', 'BHS', '', 'Bahamas'],
90
+ '310': ['BM', 'BMU', '', 'Bermuda'],
91
+ '311': ['BS', 'BMU', '', 'Bahamas'],
92
+ '312': ['BZ', 'BLZ', '', 'Belize'],
93
+ '314': ['BB', 'BRB', '', 'Barbados'],
94
+ '316': ['CA', 'CAN', '', 'Canada'],
95
+ '319': ['KY', 'CYM', '', 'Cayman Islands'],
96
+ '321': ['CR', 'CRI', '', 'Costa Rica'],
97
+ '323': ['CU', 'CUB', '', 'Cuba'],
98
+ '325': ['DM', 'DMA', '', 'Dominica'],
99
+ '327': ['DO', 'DOM', '', 'Dominican Republic'],
100
+ '329': ['GP', 'GLP', '', 'Guadeloupe'],
101
+ '330': ['GD', 'GRD', '', 'Grenada'],
102
+ '331': ['GL', 'GRL', '', 'Greenland'],
103
+ '332': ['GT', 'GTM', '', 'Guatemala'],
104
+ '335': ['HN', 'HND', '', 'Honduras'],
105
+ '336': ['HT', 'HTI', '', 'Haiti'],
106
+ '338': ['US', 'USA', '', 'United States of America'],
107
+ '339': ['JM', 'JAM', '', 'Jamaica'],
108
+ '341': ['KN', 'KNA', '', 'Saint Kitts and Nevis'],
109
+ '343': ['LC', 'LCA', '', 'Saint Lucia'],
110
+ '345': ['MX', 'MEX', '', 'Mexico'],
111
+ '347': ['MQ', 'MTQ', '', 'Martinique'],
112
+ '348': ['MS', 'MSR', '', 'Montserrat'],
113
+ '350': ['NI', 'NIC', '', 'Nicaragua'],
114
+ '351': ['PA', 'PAN', '', 'Panama'],
115
+ '352': ['PA', 'PAN', '', 'Panama'],
116
+ '353': ['PA', 'PAN', '', 'Panama'],
117
+ '354': ['PA', 'PAN', '', 'Panama'],
118
+ '355': ['PA', 'PAN', '', 'Panama'],
119
+ '356': ['PA', 'PAN', '', 'Panama'],
120
+ '357': ['PA', 'PAN', '', 'Panama'],
121
+ '358': ['PR', 'PRI', '', 'Puerto Rico'],
122
+ '359': ['SV', 'SLV', '', 'El Salvador'],
123
+ '361': ['PM', 'SPM', '', 'Saint Pierre and Miquelon'],
124
+ '362': ['TT', 'TTO', '', 'Trinidad and Tobago'],
125
+ '364': ['TC', 'TCA', '', 'Turks and Caicos Islands'],
126
+ '366': ['US', 'USA', '', 'United States of America'],
127
+ '367': ['US', 'USA', '', 'United States of America'],
128
+ '368': ['US', 'USA', '', 'United States of America'],
129
+ '369': ['US', 'USA', '', 'United States of America'],
130
+ '370': ['PA', 'PAN', '', 'Panama'],
131
+ '371': ['PA', 'PAN', '', 'Panama'],
132
+ '372': ['PA', 'PAN', '', 'Panama'],
133
+ '373': ['PA', 'PAN', '', 'Panama'],
134
+ '374': ['PA', 'PAN', '', 'Panama'],
135
+ '375': ['VC', 'VCT', '', 'Saint Vincent and the Grenadines'],
136
+ '376': ['VC', 'VCT', '', 'Saint Vincent and the Grenadines'],
137
+ '377': ['VC', 'VCT', '', 'Saint Vincent and the Grenadines'],
138
+ '378': ['VG', 'VGB', '', 'British Virgin Islands'],
139
+ '379': ['VI', 'VIR', '', 'United States Virgin Islands'],
140
+ '401': ['AF', 'AFG', '', 'Afghanistan'],
141
+ '403': ['SA', 'SAU', '', 'Saudi Arabia'],
142
+ '405': ['BD', 'BGD', '', 'Bangladesh'],
143
+ '408': ['BH', 'BHR', '', 'Bahrain'],
144
+ '410': ['BT', 'BTN', '', 'Bhutan'],
145
+ '412': ['CN', 'CHN', '', 'China'],
146
+ '413': ['CN', 'CHN', '', 'China'],
147
+ '414': ['CN', 'CHN', '', 'China'],
148
+ '416': ['TW', 'TWN', '', 'Taiwan'],
149
+ '417': ['LK', 'LKA', '', 'Sri Lanka'],
150
+ '419': ['IN', 'IND', '', 'India'],
151
+ '422': ['IR', 'IRN', '', 'Iran'],
152
+ '423': ['AZ', 'AZE', '', 'Azerbaijan'],
153
+ '425': ['IQ', 'IRQ', '', 'Iraq'],
154
+ '428': ['IL', 'ISR', '', 'Israel'],
155
+ '431': ['JP', 'JPN', '', 'Japan'],
156
+ '432': ['JP', 'JPN', '', 'Japan'],
157
+ '434': ['TM', 'TKM', '', 'Turkmenistan'],
158
+ '436': ['KZ', 'KAZ', '', 'Kazakhstan'],
159
+ '437': ['UZ', 'UZB', '', 'Uzbekistan'],
160
+ '438': ['JO', 'JOR', '', 'Jordan'],
161
+ '440': ['KR', 'KOR', '', 'Korea'],
162
+ '441': ['KR', 'KOR', '', 'Korea'],
163
+ '443': ['PS', 'PSE', '', 'State of Palestine'],
164
+ '445': ['KP', 'PRK', '', "Democratic People's Republic of Korea"],
165
+ '447': ['KW', 'KWT', '', 'Kuwait'],
166
+ '450': ['LB', 'LBN', '', 'Lebanon'],
167
+ '451': ['KG', 'KGZ', '', 'Kyrgyz Republic'],
168
+ '453': ['MO', 'MAC', '', 'Macao'],
169
+ '455': ['MV', 'MDV', '', 'Maldives'],
170
+ '457': ['MN', 'MNG', '', 'Mongolia'],
171
+ '459': ['NP', 'NPL', '', 'Nepal'],
172
+ '461': ['OM', 'OMN', '', 'Oman'],
173
+ '463': ['PK', 'PAK', '', 'Pakistan'],
174
+ '466': ['QA', 'QAT', '', 'Qatar (State of)'],
175
+ '468': ['SY', 'SYR', '', 'Syrian Arab Republic'],
176
+ '470': ['AE', 'ARE', '', 'United Arab Emirates'],
177
+ '472': ['TJ', 'TJK', '', 'Tajikistan'],
178
+ '473': ['YE', 'YEM', '', 'Yemen'],
179
+ '475': ['YE', 'YEM', '', 'Yemen'],
180
+ '477': ['HK', 'HKG', '', 'Hong Kong'],
181
+ '478': ['BA', 'BIH', '', 'Bosnia and Herzegovina'],
182
+ '501': ['FR', 'FRA', 'AQ', 'Adelie Land'],
183
+ '503': ['AU', 'AUS', '', 'Australia'],
184
+ '506': ['MM', 'MMR', '', 'Myanmar'],
185
+ '508': ['BN', 'BRN', '', 'Brunei Darussalam'],
186
+ '510': ['FM', 'FSM', '', 'Micronesia'],
187
+ '511': ['PW', 'PLW', '', 'Palau'],
188
+ '512': ['NZ', 'NZL', '', 'New Zealand'],
189
+ '514': ['KH', 'KHM', '', 'Cambodia'],
190
+ '515': ['KH', 'KHM', '', 'Cambodia'],
191
+ '516': ['CX', 'CXR', '', 'Christmas Island'],
192
+ '518': ['CK', 'COK', '', 'Cook Islands'],
193
+ '520': ['FJ', 'FJI', '', 'Fiji'],
194
+ '523': ['CC', 'CCK', '', 'Cocos (Keeling) Islands'],
195
+ '525': ['ID', 'IDN', '', 'Indonesia'],
196
+ '529': ['KI', 'KIR', '', 'Kiribati'],
197
+ '531': ['LA', 'LAO', '', "Lao People's Democratic Republic"],
198
+ '533': ['MY', 'MYS', '', 'Malaysia'],
199
+ '536': ['MP', 'MNP', '', 'Northern Mariana Islands'],
200
+ '538': ['MH', 'MHL', '', 'Marshall Islands'],
201
+ '540': ['NC', 'NCL', '', 'New Caledonia'],
202
+ '542': ['NU', 'NIU', '', 'Niue'],
203
+ '544': ['NR', 'NRU', '', 'Nauru'],
204
+ '546': ['PF', 'PYF', '', 'French Polynesia'],
205
+ '548': ['PH', 'PHL', '', 'Philippines'],
206
+ '553': ['PG', 'PNG', '', 'Papua New Guinea'],
207
+ '555': ['PN', 'PCN', '', 'Pitcairn Island'],
208
+ '557': ['SB', 'SLB', '', 'Solomon Islands'],
209
+ '559': ['AS', 'ASM', '', 'American Samoa'],
210
+ '561': ['WS', 'WSM', '', 'Samoa'],
211
+ '563': ['SG', 'SGP', '', 'Singapore'],
212
+ '564': ['SG', 'SGP', '', 'Singapore'],
213
+ '565': ['SG', 'SGP', '', 'Singapore'],
214
+ '566': ['SG', 'SGP', '', 'Singapore'],
215
+ '567': ['TH', 'THA', '', 'Thailand'],
216
+ '570': ['TO', 'TON', '', 'Tonga'],
217
+ '572': ['TV', 'TUV', '', 'Tuvalu'],
218
+ '574': ['VN', 'VNM', '', 'Viet Nam'],
219
+ '576': ['VU', 'VUT', '', 'Vanuatu'],
220
+ '577': ['VU', 'VUT', '', 'Vanuatu'],
221
+ '578': ['WF', 'WLF', '', 'Wallis and Futuna Islands'],
222
+ '601': ['ZA', 'ZAF', '', 'South Africa'],
223
+ '603': ['AO', 'AGO', '', 'Angola'],
224
+ '605': ['DZ', 'DZA', '', 'Algeria'],
225
+ '607': ['FR', 'FRA', 'TF', 'Saint Paul and Amsterdam Islands'],
226
+ '608': ['GB', 'GBR', 'AC', 'Ascension Island'],
227
+ '609': ['BI', 'BDI', '', 'Burundi'],
228
+ '610': ['BJ', 'BEN', '', 'Benin'],
229
+ '611': ['BW', 'BWA', '', 'Botswana'],
230
+ '612': ['CF', 'CAF', '', 'Central African Republic'],
231
+ '613': ['CM', 'CMR', '', 'Cameroon'],
232
+ '615': ['CG', 'COG', '', 'Congo'],
233
+ '616': ['KM', 'COM', '', 'Comoros'],
234
+ '617': ['CV', 'CPV', '', 'Cabo Verde'],
235
+ '618': ['FR', 'FRA', 'TF', 'Crozet Archipelago'],
236
+ '619': ['CI', 'CIV', '', 'Ivory Coast'],
237
+ '620': ['KM', 'COM', '', 'Comoros'],
238
+ '621': ['DJ', 'DJI', '', 'Djibouti'],
239
+ '622': ['EG', 'EGY', '', 'Egypt'],
240
+ '624': ['ET', 'ETH', '', 'Ethiopia'],
241
+ '625': ['ER', 'ERI', '', 'Eritrea'],
242
+ '626': ['GA', 'GAB', '', 'Gabonese Republic'],
243
+ '627': ['GH', 'GHA', '', 'Ghana'],
244
+ '629': ['GM', 'GMB', '', 'Gambia'],
245
+ '630': ['GW', 'GNB', '', 'Guinea-Bissau'],
246
+ '631': ['GQ', 'GNQ', '', 'Equatorial Guinea'],
247
+ '632': ['GN', 'GIN', '', 'Guinea'],
248
+ '633': ['BF', 'BFA', '', 'Burkina Faso'],
249
+ '634': ['KE', 'KEN', '', 'Kenya'],
250
+ '635': ['FR', 'FRA', 'TF', 'Kerguelen Islands'],
251
+ '636': ['LR', 'LBR', '', 'Liberia'],
252
+ '637': ['LR', 'LBR', '', 'Liberia'],
253
+ '638': ['SS', 'SSD', '', 'South Sudan'],
254
+ '642': ['LY', 'LBY', '', 'Libya'],
255
+ '644': ['LS', 'LSO', '', 'Lesotho'],
256
+ '645': ['MU', 'MUS', '', 'Mauritius'],
257
+ '647': ['MG', 'MDG', '', 'Madagascar'],
258
+ '649': ['ML', 'MLI', '', 'Mali'],
259
+ '650': ['MZ', 'MOZ', '', 'Mozambique'],
260
+ '654': ['MR', 'MRT', '', 'Mauritania'],
261
+ '655': ['MW', 'MWI', '', 'Malawi'],
262
+ '656': ['NE', 'NER', '', 'Niger'],
263
+ '657': ['NG', 'NGA', '', 'Nigeria'],
264
+ '659': ['NA', 'NAM', '', 'Namibia'],
265
+ '660': ['RE', 'REU', '', 'Reunion'],
266
+ '661': ['RW', 'RWA', '', 'Rwanda'],
267
+ '662': ['SD', 'SDN', '', 'Sudan'],
268
+ '663': ['SN', 'SEN', '', 'Senegal'],
269
+ '664': ['SC', 'SYC', '', 'Seychelles'],
270
+ '665': ['SH', 'SHN', '', 'Saint Helena'],
271
+ '666': ['SO', 'SOM', '', 'Somali Democratic Republic'],
272
+ '667': ['SL', 'SLE', '', 'Sierra Leone'],
273
+ '668': ['ST', 'STP', '', 'Sao Tome and Principe'],
274
+ '669': ['SZ', 'SWZ', '', 'Swaziland'],
275
+ '670': ['TD', 'TCD', '', 'Chad'],
276
+ '671': ['TG', 'TGO', '', 'Togolese Republic'],
277
+ '672': ['TN', 'TUN', '', 'Tunisian Republic'],
278
+ '674': ['TZ', 'TZA', '', 'Tanzania'],
279
+ '675': ['UG', 'UGA', '', 'Uganda'],
280
+ '676': ['CD', 'COD', '', 'Democratic Republic of the Congo'],
281
+ '677': ['TZ', 'TZA', '', 'Tanzania'],
282
+ '678': ['ZM', 'ZMB', '', 'Zambia'],
283
+ '679': ['ZW', 'ZWE', '', 'Zimbabwe'],
284
+ '701': ['AR', 'ARG', '', 'Argentine Republic'],
285
+ '710': ['BR', 'BRA', '', 'Brazil'],
286
+ '720': ['BO', 'BOL', '', 'Bolivia'],
287
+ '725': ['CL', 'CHL', '', 'Chile'],
288
+ '730': ['CO', 'COL', '', 'Colombia'],
289
+ '735': ['EC', 'ECU', '', 'Ecuador'],
290
+ '740': ['FK', 'FLK', '', 'Falkland Islands'],
291
+ '745': ['GF', 'GUF', '', 'Guiana'],
292
+ '750': ['GY', 'GUY', '', 'Guyana'],
293
+ '755': ['PY', 'PRY', '', 'Paraguay'],
294
+ '760': ['PE', 'PER', '', 'Peru'],
295
+ '765': ['SR', 'SUR', '', 'Suriname'],
296
+ '770': ['UY', 'URY', '', 'Uruguay'],
297
+ '775': ['VE', 'VEN', '', 'Venezuela']
298
+ }).reduce((acc, [key, [alpha2, alpha3, _unused, name]]) => {
299
+ acc[key] = { alpha2, alpha3, name };
300
+ return acc;
301
+ }, {});
@@ -0,0 +1,75 @@
1
+ import { FlagCountry } from './mid';
2
+ export { FlagCountry } from './mid';
3
+ export type MMSISourceType = 'ship' | 'coastalStation' | 'group' | 'aton' | 'auxiliaryCraft' | 'sart' | 'sarAircraft' | 'mobDevice' | 'epirb' | 'diverRadio';
4
+ /** @category MMSI */
5
+ export interface MMSIInfo {
6
+ /** Maritime identifier */
7
+ mid: number;
8
+ /** Mobile station identifier */
9
+ msi: number;
10
+ /** Source type */
11
+ type?: MMSISourceType;
12
+ /** Two character country code */
13
+ flagCountry?: FlagCountry;
14
+ }
15
+ /**
16
+ * Parse the supplied MMSI value into object containing mid, msi, type and flagCountry.
17
+ *
18
+ * @example
19
+ * ```javascript
20
+ * app.parseMmsi('201456789')
21
+ *
22
+ * returns: {
23
+ * mid: 201,
24
+ * msi: 456789,
25
+ * type: 'ship',
26
+ * flagCountry: {
27
+ * alpha2: 'AL',
28
+ * alpha3: 'ALB',
29
+ * name: 'Albania'
30
+ * }
31
+ * }
32
+ * ```
33
+ *
34
+ * @param mmsi - MMSI.
35
+ *
36
+ * @category MMSI
37
+ */
38
+ export declare const parseMmsi: (mmsi: string) => MMSIInfo | null;
39
+ /**
40
+ * Return the two letter country code for the MID from the supplied MMSI.
41
+ *
42
+ * @example
43
+ * ```javascript
44
+ * app.getFlag('201456789')
45
+
46
+ * returns: 'AL'
47
+ * ```
48
+ *
49
+ * @param mmsi - MMSI.
50
+ * @returns Two letter country code.
51
+ *
52
+ * @category MMSI
53
+ */
54
+ export declare const getFlag: (mmsi: string) => string | null;
55
+ /**
56
+ * Return the flag country information for the MID from the supplied MMSI.
57
+ *
58
+ * @example
59
+ * ```javascript
60
+ * app.getFlagCountry('201456789')
61
+ *
62
+ * returns: {
63
+ * alpha2: 'AL',
64
+ * alpha3: 'ALB',
65
+ * name: 'Albania'
66
+ * }
67
+ * ```
68
+ *
69
+ * @param mmsi - MMSI.
70
+ * @returns Flag country information with ISO codes and name, or null if not found.
71
+ *
72
+ * @category MMSI
73
+ */
74
+ export declare const getFlagCountry: (mmsi: string) => FlagCountry | null;
75
+ //# sourceMappingURL=mmsi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mmsi.d.ts","sourceRoot":"","sources":["../../src/mmsi/mmsi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAe,MAAM,OAAO,CAAA;AAEhD,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAEnC,MAAM,MAAM,cAAc,GACtB,MAAM,GACN,gBAAgB,GAChB,OAAO,GACP,MAAM,GACN,gBAAgB,GAChB,MAAM,GACN,aAAa,GACb,WAAW,GACX,OAAO,GACP,YAAY,CAAA;AAEhB,qBAAqB;AACrB,MAAM,WAAW,QAAQ;IACvB,0BAA0B;IAC1B,GAAG,EAAE,MAAM,CAAA;IACX,gCAAgC;IAChC,GAAG,EAAE,MAAM,CAAA;IACX,kBAAkB;IAClB,IAAI,CAAC,EAAE,cAAc,CAAA;IACrB,iCAAiC;IACjC,WAAW,CAAC,EAAE,WAAW,CAAA;CAC1B;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,KAAG,QAAQ,GAAG,IAkFnD,CAAA;AAED;;;;;;;;;;;;;;EAcE;AACF,eAAO,MAAM,OAAO,GAAI,MAAM,MAAM,KAAG,MAAM,GAAG,IAG/C,CAAA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,KAAG,WAAW,GAAG,IAG3D,CAAA"}
@@ -0,0 +1,165 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getFlagCountry = exports.getFlag = exports.parseMmsi = void 0;
4
+ const mid_1 = require("./mid");
5
+ /**
6
+ * Parse the supplied MMSI value into object containing mid, msi, type and flagCountry.
7
+ *
8
+ * @example
9
+ * ```javascript
10
+ * app.parseMmsi('201456789')
11
+ *
12
+ * returns: {
13
+ * mid: 201,
14
+ * msi: 456789,
15
+ * type: 'ship',
16
+ * flagCountry: {
17
+ * alpha2: 'AL',
18
+ * alpha3: 'ALB',
19
+ * name: 'Albania'
20
+ * }
21
+ * }
22
+ * ```
23
+ *
24
+ * @param mmsi - MMSI.
25
+ *
26
+ * @category MMSI
27
+ */
28
+ const parseMmsi = (mmsi) => {
29
+ if (typeof mmsi !== 'string') {
30
+ return null;
31
+ }
32
+ let info;
33
+ try {
34
+ if (mmsi.startsWith('00')) {
35
+ // coast station
36
+ info = {
37
+ mid: parseInt(mmsi.slice(2, 5)),
38
+ msi: parseInt(mmsi.slice(5)),
39
+ type: 'coastalStation'
40
+ };
41
+ }
42
+ else if (mmsi.startsWith('0')) {
43
+ // Group of ships
44
+ info = {
45
+ mid: parseInt(mmsi.slice(1, 4)),
46
+ msi: parseInt(mmsi.slice(4)),
47
+ type: 'group'
48
+ };
49
+ }
50
+ else if (mmsi.startsWith('99')) {
51
+ // AtoN
52
+ info = {
53
+ mid: parseInt(mmsi.slice(2, 5)),
54
+ msi: parseInt(mmsi.slice(5)),
55
+ type: 'aton'
56
+ };
57
+ }
58
+ else if (mmsi.startsWith('98')) {
59
+ // Aux craft associated with parent ship
60
+ info = {
61
+ mid: parseInt(mmsi.slice(2, 5)),
62
+ msi: parseInt(mmsi.slice(5)),
63
+ type: 'auxiliaryCraft'
64
+ };
65
+ }
66
+ else if (mmsi.startsWith('970')) {
67
+ // SART transmitter
68
+ info = {
69
+ mid: parseInt(mmsi.slice(3, 6)),
70
+ msi: parseInt(mmsi.slice(6)),
71
+ type: 'sart'
72
+ };
73
+ }
74
+ else if (mmsi.startsWith('972')) {
75
+ // MOB device
76
+ info = {
77
+ mid: parseInt(mmsi.slice(3, 6)),
78
+ msi: parseInt(mmsi.slice(6)),
79
+ type: 'mobDevice'
80
+ };
81
+ }
82
+ else if (mmsi.startsWith('974')) {
83
+ // EPIRB
84
+ info = {
85
+ mid: parseInt(mmsi.slice(3, 6)),
86
+ msi: parseInt(mmsi.slice(6)),
87
+ type: 'epirb'
88
+ };
89
+ }
90
+ else if (mmsi.startsWith('8')) {
91
+ // diver
92
+ info = {
93
+ mid: parseInt(mmsi.slice(1, 4)),
94
+ msi: parseInt(mmsi.slice(4)),
95
+ type: 'diverRadio'
96
+ };
97
+ }
98
+ else if (mmsi.startsWith('111')) {
99
+ // SaR
100
+ info = {
101
+ mid: parseInt(mmsi.slice(3, 6)),
102
+ msi: parseInt(mmsi.slice(6)),
103
+ type: 'sarAircraft'
104
+ };
105
+ }
106
+ else {
107
+ // ship
108
+ info = {
109
+ mid: parseInt(mmsi.slice(0, 3)),
110
+ msi: parseInt(mmsi.slice(3)),
111
+ type: 'ship'
112
+ };
113
+ }
114
+ info.flagCountry = (0, mid_1.mid2Country)(info.mid.toString()) ?? undefined;
115
+ return info;
116
+ }
117
+ catch {
118
+ return null;
119
+ }
120
+ };
121
+ exports.parseMmsi = parseMmsi;
122
+ /**
123
+ * Return the two letter country code for the MID from the supplied MMSI.
124
+ *
125
+ * @example
126
+ * ```javascript
127
+ * app.getFlag('201456789')
128
+
129
+ * returns: 'AL'
130
+ * ```
131
+ *
132
+ * @param mmsi - MMSI.
133
+ * @returns Two letter country code.
134
+ *
135
+ * @category MMSI
136
+ */
137
+ const getFlag = (mmsi) => {
138
+ const m = (0, exports.parseMmsi)(mmsi);
139
+ return m?.flagCountry?.alpha2 ?? null;
140
+ };
141
+ exports.getFlag = getFlag;
142
+ /**
143
+ * Return the flag country information for the MID from the supplied MMSI.
144
+ *
145
+ * @example
146
+ * ```javascript
147
+ * app.getFlagCountry('201456789')
148
+ *
149
+ * returns: {
150
+ * alpha2: 'AL',
151
+ * alpha3: 'ALB',
152
+ * name: 'Albania'
153
+ * }
154
+ * ```
155
+ *
156
+ * @param mmsi - MMSI.
157
+ * @returns Flag country information with ISO codes and name, or null if not found.
158
+ *
159
+ * @category MMSI
160
+ */
161
+ const getFlagCountry = (mmsi) => {
162
+ const m = (0, exports.parseMmsi)(mmsi);
163
+ return m?.flagCountry ?? null;
164
+ };
165
+ exports.getFlagCountry = getFlagCountry;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=mmsi.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mmsi.test.d.ts","sourceRoot":"","sources":["../../src/mmsi/mmsi.test.ts"],"names":[],"mappings":""}
package/dist/plugin.d.ts CHANGED
@@ -3,6 +3,7 @@ import { ServerAPI } from './serverapi';
3
3
  /**
4
4
  * A plugin constructor is the interface that all plugins must export.
5
5
  * It is called by the server when the server is starting up.
6
+ * @category Server API
6
7
  */
7
8
  export type PluginConstructor = (app: ServerAPI) => Plugin;
8
9
  /**
@@ -46,6 +47,7 @@ export type PluginConstructor = (app: ServerAPI) => Plugin;
46
47
  * return plugin;
47
48
  * }
48
49
  * ```
50
+ * @category Server API
49
51
  * @see [Developing Server Plugins](../../../docs/develop/plugins/README.md)
50
52
  */
51
53
  export interface Plugin {