@profullstack/nichedb 0.58.0 → 0.62.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/package.json +1 -1
- package/src/index.js +54 -1
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import { homedir, tmpdir } from 'node:os';
|
|
|
15
15
|
import { join } from 'node:path';
|
|
16
16
|
import { createInterface } from 'node:readline';
|
|
17
17
|
|
|
18
|
-
export const VERSION = '0.
|
|
18
|
+
export const VERSION = '0.62.0';
|
|
19
19
|
const GEO_FLAGS = ['lat', 'long', 'radius', 'unit', 'bbox', 'sort', 'offset'];
|
|
20
20
|
const DEFAULT_API = process.env.NICHEDB_API ?? 'https://nichedb.dev';
|
|
21
21
|
const CONFIG_DIR = join(process.env.XDG_CONFIG_HOME ?? join(homedir(), '.config'), 'nichedb');
|
|
@@ -238,6 +238,26 @@ export const COMMANDS = [
|
|
|
238
238
|
'Is a domain name registered? Asks the registry over RDAP; a bare word is tried under each ending.',
|
|
239
239
|
options: ['--tlds <list>', '--json'],
|
|
240
240
|
},
|
|
241
|
+
{
|
|
242
|
+
name: 'airplane',
|
|
243
|
+
usage: 'airplane <N-number | hex | callsign | words> [--json]',
|
|
244
|
+
summary:
|
|
245
|
+
'An aircraft: its FAA registration (maker, model, year, status) and where it is flying right now (adsb.lol).',
|
|
246
|
+
options: ['--json'],
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
name: 'satellite',
|
|
250
|
+
usage: 'satellite <NORAD number | designator | name> [--json]',
|
|
251
|
+
summary:
|
|
252
|
+
'A satellite, rocket stage or piece of debris: GCAT catalogue entry and where it is over the Earth right now.',
|
|
253
|
+
options: ['--json'],
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
name: 'ship',
|
|
257
|
+
usage: 'ship <MMSI | IMO | name> [--json]',
|
|
258
|
+
summary: 'A ship or boat on open AIS: type, flag, size, destination and its live position.',
|
|
259
|
+
options: ['--json'],
|
|
260
|
+
},
|
|
241
261
|
{
|
|
242
262
|
name: 'business',
|
|
243
263
|
usage: 'business <name> [--domain <d>] [--state <st>] [--number <n>] [--ein <ein>]',
|
|
@@ -1178,6 +1198,39 @@ export async function run(
|
|
|
1178
1198
|
if (r.truncated) out('(only the first names were checked)');
|
|
1179
1199
|
return 0;
|
|
1180
1200
|
}
|
|
1201
|
+
case 'airplane':
|
|
1202
|
+
case 'satellite':
|
|
1203
|
+
case 'ship': {
|
|
1204
|
+
const term = rest.join(' ').trim();
|
|
1205
|
+
if (!term) throw new Error(`${cmd} <id or name>`);
|
|
1206
|
+
const path = { airplane: 'airplanes', satellite: 'satellites', ship: 'ships' }[cmd];
|
|
1207
|
+
const r = await client.get(`/api/v1/${path}/${encodeURIComponent(term)}`);
|
|
1208
|
+
if (json) {
|
|
1209
|
+
out(JSON.stringify(r, null, 2));
|
|
1210
|
+
return 0;
|
|
1211
|
+
}
|
|
1212
|
+
if (r.matches) {
|
|
1213
|
+
if (!r.matches.length) out('no matches');
|
|
1214
|
+
for (const m of r.matches) out(`${m.title} ${m.page}`);
|
|
1215
|
+
return 0;
|
|
1216
|
+
}
|
|
1217
|
+
if (r.record) out(r.record.summary);
|
|
1218
|
+
const now = r.position ?? r.live?.[0] ?? (Array.isArray(r.live) ? null : r.live);
|
|
1219
|
+
if (now?.lat !== undefined && now?.lat !== null) {
|
|
1220
|
+
const extra = [
|
|
1221
|
+
now.altitudeKm !== undefined ? `${now.altitudeKm} km up` : null,
|
|
1222
|
+
now.altitudeFt !== undefined && now.altitudeFt !== null ? `${now.altitudeFt} ft` : null,
|
|
1223
|
+
now.groundSpeedKt ? `${now.groundSpeedKt} kt` : null,
|
|
1224
|
+
now.speedKn ? `${now.speedKn} kn` : null,
|
|
1225
|
+
now.navStatus ?? null,
|
|
1226
|
+
].filter(Boolean);
|
|
1227
|
+
out(`now: ${now.lat}, ${now.lon}${extra.length ? ` (${extra.join(', ')})` : ''}`);
|
|
1228
|
+
} else {
|
|
1229
|
+
out('now: not seen live');
|
|
1230
|
+
}
|
|
1231
|
+
if (r.record?.url) out(r.record.url);
|
|
1232
|
+
return 0;
|
|
1233
|
+
}
|
|
1181
1234
|
case 'business': {
|
|
1182
1235
|
const qs = new URLSearchParams();
|
|
1183
1236
|
const name = rest.join(' ');
|