@voyantjs/flights 0.96.0 → 0.97.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.
@@ -1,26 +1 @@
1
- /**
2
- * `ReferenceDataProvider` contract — swappable provider for global
3
- * reference data (airlines, airports, aircraft, currencies, countries).
4
- *
5
- * Per architecture §5.11.6 / §6, implementable at any layer:
6
- * - **In-deployment local Postgres** (the simplest case)
7
- * - Static JSON / CSV bundle
8
- * - Internal data lake / warehouse
9
- * - Third-party services (OAG, Cirium, RouteHappy)
10
- * - GDS-bundled reference subscriptions
11
- * - Voyant Data (the hosted default)
12
- *
13
- * No implementer is privileged. Operators can run a fully self-contained
14
- * Voyant deployment with all reference data in their own database, no
15
- * external dependency.
16
- *
17
- * See `docs/architecture/catalog-flights-architecture.md` §6.
18
- */
19
- /**
20
- * Helper that hydrates a batch of distinct IATA codes once and returns a
21
- * Map. Used internally by providers that fetch from a slow upstream and
22
- * want to serve repeated lookups from an in-memory cache.
23
- */
24
- export function dedupeCodes(codes) {
25
- return Array.from(new Set(codes.filter((c) => c.length > 0)));
26
- }
1
+ export * from "@voyantjs/flights-contracts/reference/contract";
@@ -1,29 +1,2 @@
1
- /**
2
- * Static-bundle `ReferenceDataProvider`.
3
- *
4
- * Even simpler than a local-Postgres provider — ship a JSON / CSV bundle
5
- * with the deployment, load it into memory at startup, serve from a `Map`.
6
- * Appropriate for small operators with stable, narrow geographic scope and
7
- * no need for refresh.
8
- *
9
- * No DB, no external service, no network call.
10
- *
11
- * See `docs/architecture/catalog-flights-architecture.md` §6.2.
12
- */
13
- import type { Aircraft, Airline, Airport, ReferenceDataCapabilities, ReferenceDataProvider } from "./contract.js";
14
- export interface StaticBundleReferenceData {
15
- airlines?: Airline[];
16
- airports?: Airport[];
17
- aircraft?: Aircraft[];
18
- }
19
- export interface StaticBundleProviderOptions {
20
- data: StaticBundleReferenceData;
21
- /** Override capabilities; defaults are inferred from which arrays are populated. */
22
- capabilities?: Partial<ReferenceDataCapabilities>;
23
- }
24
- /**
25
- * Build a `ReferenceDataProvider` from in-memory bundles. Maps are built
26
- * once at construction; lookups are O(1).
27
- */
28
- export declare function createStaticBundleReferenceProvider(options: StaticBundleProviderOptions): ReferenceDataProvider;
1
+ export * from "@voyantjs/flights-contracts/reference/static-bundle";
29
2
  //# sourceMappingURL=static-bundle.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"static-bundle.d.ts","sourceRoot":"","sources":["../../src/reference/static-bundle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EACV,QAAQ,EACR,OAAO,EACP,OAAO,EACP,yBAAyB,EACzB,qBAAqB,EACtB,MAAM,eAAe,CAAA;AAGtB,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAA;IACpB,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAA;CACtB;AAED,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,yBAAyB,CAAA;IAC/B,oFAAoF;IACpF,YAAY,CAAC,EAAE,OAAO,CAAC,yBAAyB,CAAC,CAAA;CAClD;AAED;;;GAGG;AACH,wBAAgB,mCAAmC,CACjD,OAAO,EAAE,2BAA2B,GACnC,qBAAqB,CAuEvB"}
1
+ {"version":3,"file":"static-bundle.d.ts","sourceRoot":"","sources":["../../src/reference/static-bundle.ts"],"names":[],"mappings":"AAAA,cAAc,qDAAqD,CAAA"}
@@ -1,83 +1 @@
1
- /**
2
- * Static-bundle `ReferenceDataProvider`.
3
- *
4
- * Even simpler than a local-Postgres provider — ship a JSON / CSV bundle
5
- * with the deployment, load it into memory at startup, serve from a `Map`.
6
- * Appropriate for small operators with stable, narrow geographic scope and
7
- * no need for refresh.
8
- *
9
- * No DB, no external service, no network call.
10
- *
11
- * See `docs/architecture/catalog-flights-architecture.md` §6.2.
12
- */
13
- import { dedupeCodes } from "./contract.js";
14
- /**
15
- * Build a `ReferenceDataProvider` from in-memory bundles. Maps are built
16
- * once at construction; lookups are O(1).
17
- */
18
- export function createStaticBundleReferenceProvider(options) {
19
- const airlines = new Map();
20
- const airports = new Map();
21
- const aircraft = new Map();
22
- for (const airline of options.data.airlines ?? []) {
23
- airlines.set(airline.iataCode, airline);
24
- }
25
- for (const airport of options.data.airports ?? []) {
26
- airports.set(airport.iataCode, airport);
27
- }
28
- for (const ac of options.data.aircraft ?? []) {
29
- aircraft.set(ac.iataCode, ac);
30
- }
31
- const inferredCapabilities = {
32
- coversAirlines: airlines.size > 0,
33
- coversAirports: airports.size > 0,
34
- coversAircraft: aircraft.size > 0,
35
- coversCurrencies: false,
36
- coversCountries: false,
37
- isReadOnly: true,
38
- refreshCadence: "static",
39
- ...options.capabilities,
40
- };
41
- return {
42
- capabilities: inferredCapabilities,
43
- async getAirline(iataCode) {
44
- return airlines.get(iataCode) ?? null;
45
- },
46
- async getAirport(iataCode) {
47
- return airports.get(iataCode) ?? null;
48
- },
49
- async getAircraft(iataCode) {
50
- return aircraft.get(iataCode) ?? null;
51
- },
52
- async getAirlines(iataCodes) {
53
- const codes = dedupeCodes(iataCodes);
54
- const result = new Map();
55
- for (const code of codes) {
56
- const value = airlines.get(code);
57
- if (value)
58
- result.set(code, value);
59
- }
60
- return result;
61
- },
62
- async getAirports(iataCodes) {
63
- const codes = dedupeCodes(iataCodes);
64
- const result = new Map();
65
- for (const code of codes) {
66
- const value = airports.get(code);
67
- if (value)
68
- result.set(code, value);
69
- }
70
- return result;
71
- },
72
- async getAircraftBatch(iataCodes) {
73
- const codes = dedupeCodes(iataCodes);
74
- const result = new Map();
75
- for (const code of codes) {
76
- const value = aircraft.get(code);
77
- if (value)
78
- result.set(code, value);
79
- }
80
- return result;
81
- },
82
- };
83
- }
1
+ export * from "@voyantjs/flights-contracts/reference/static-bundle";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voyantjs/flights",
3
- "version": "0.96.0",
3
+ "version": "0.97.0",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "exports": {
@@ -64,8 +64,9 @@
64
64
  "dependencies": {
65
65
  "drizzle-orm": "^0.45.2",
66
66
  "zod": "^4.3.6",
67
- "@voyantjs/db": "0.96.0",
68
- "@voyantjs/catalog": "0.96.0"
67
+ "@voyantjs/db": "0.97.0",
68
+ "@voyantjs/catalog": "0.97.0",
69
+ "@voyantjs/flights-contracts": "0.97.0"
69
70
  },
70
71
  "devDependencies": {
71
72
  "typescript": "^6.0.2",