Skip to content

Commit

Permalink
Reorganize typings (#156)
Browse files Browse the repository at this point in the history
* Reorganize Airspace types

* Clean up types, all b2b types are now exported
  • Loading branch information
kouak authored Jul 12, 2024
1 parent 3f775e2 commit 222fb69
Show file tree
Hide file tree
Showing 24 changed files with 94 additions and 85 deletions.
7 changes: 7 additions & 0 deletions .changeset/tame-mirrors-remember.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@dgac/nmb2b-client': patch
---

All B2B types are now exported.

Fix `AUPSummary.notes` typing.
28 changes: 4 additions & 24 deletions src/Airspace/queryCompleteAIXMDatasets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,13 @@ import { instrument } from '../utils/instrumentation';
import { injectSendTime, responseStatusHandler } from '../utils/internals';
import { prepareSerializer } from '../utils/transformers';
import type { AirspaceClient } from './';
import type { AiracIdentifier, AIXMFile } from './types';

import type {
DateYearMonthDay,
DateYearMonthDayPeriod,
ReplyWithData,
} from '../Common/types';
CompleteAIXMDatasetReply,
CompleteAIXMDatasetRequest,
} from './types';

export interface CompleteAIXMDatasetRequest {
queryCriteria: CompleteDatasetQueryCriteria;
}

export type CompleteAIXMDatasetReply = ReplyWithData<{
datasetSummaries: CompleteDatasetSummary[];
}>;
export type { CompleteAIXMDatasetReply, CompleteAIXMDatasetRequest } from './types';

type Values = CompleteAIXMDatasetRequest;
type Result = CompleteAIXMDatasetReply;
Expand Down Expand Up @@ -52,15 +44,3 @@ export default function prepareQueryCompleteAIXMDatasets(
}),
);
}

interface CompleteDatasetSummary {
updateId: string;
publicationDate: DateYearMonthDay;
sourceAIRACs: [AiracIdentifier] | [AiracIdentifier, AiracIdentifier];
files: AIXMFile[];
}

type CompleteDatasetQueryCriteria =
| { publicationPeriod: DateYearMonthDayPeriod }
| { airac: AiracIdentifier }
| { date: DateYearMonthDay };
14 changes: 3 additions & 11 deletions src/Airspace/retrieveAUP.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import type { ReplyWithData } from '../Common/types';
import type { SoapOptions } from '../soap';
import { instrument } from '../utils/instrumentation';
import { injectSendTime, responseStatusHandler } from '../utils/internals';
import { prepareSerializer } from '../utils/transformers';
import type { AirspaceClient } from './';
import type { AUP, AUPId } from './types';

import type { AUPRetrievalReply, AUPRetrievalRequest } from './types';
export type { AUPRetrievalReply, AUPRetrievalRequest };

type Values = AUPRetrievalRequest;
type Result = AUPRetrievalReply;
Expand Down Expand Up @@ -37,12 +38,3 @@ export default function prepareRetrieveAUP(client: AirspaceClient): Resolver {
}),
);
}

export interface AUPRetrievalRequest {
aupId: AUPId;
returnComputed?: boolean;
}

export type AUPRetrievalReply = ReplyWithData<{
aup: AUP;
}>;
18 changes: 2 additions & 16 deletions src/Airspace/retrieveAUPChain.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
import type {
AirNavigationUnitId,
DateYearMonthDay,
ReplyWithData,
} from '../Common/types';
import type { SoapOptions } from '../soap';
import { instrument } from '../utils/instrumentation';
import { injectSendTime, responseStatusHandler } from '../utils/internals';
import { prepareSerializer } from '../utils/transformers';
import type { AirspaceClient } from './';

import type { AUPChain } from './types';
import type { AUPChainRetrievalReply, AUPChainRetrievalRequest } from './types';
export type { AUPChainRetrievalReply, AUPChainRetrievalRequest };

type Values = AUPChainRetrievalRequest;
type Result = AUPChainRetrievalReply;
Expand Down Expand Up @@ -44,12 +39,3 @@ export default function prepareRetrieveAUPChain(
}),
);
}

export interface AUPChainRetrievalRequest {
chainDate: DateYearMonthDay;
amcIds?: AirNavigationUnitId[];
}

export type AUPChainRetrievalReply = ReplyWithData<{
chains: AUPChain[];
}>;
15 changes: 5 additions & 10 deletions src/Airspace/retrieveEAUPChain.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import type { DateYearMonthDay, ReplyWithData } from '../Common/types';
import type { SoapOptions } from '../soap';
import { instrument } from '../utils/instrumentation';
import { injectSendTime, responseStatusHandler } from '../utils/internals';
import { prepareSerializer } from '../utils/transformers';
import type { AirspaceClient } from './';
import type {
EAUPChainRetrievalReply,
EAUPChainRetrievalRequest,
} from './types';

import type { EAUPChain } from './types';
export type { EAUPChainRetrievalReply, EAUPChainRetrievalRequest };

type Values = EAUPChainRetrievalRequest;
type Result = EAUPChainRetrievalReply;
Expand Down Expand Up @@ -40,11 +43,3 @@ export default function prepareRetrieveEAUPChain(
}),
);
}

export interface EAUPChainRetrievalRequest {
chainDate: DateYearMonthDay;
}

export type EAUPChainRetrievalReply = ReplyWithData<{
chain: EAUPChain;
}>;
37 changes: 36 additions & 1 deletion src/Airspace/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import type {
DistanceNM,
LastUpdate,
Position,
ReplyWithData,
} from '../Common/types';

export interface AUPChain {
Expand Down Expand Up @@ -81,7 +82,7 @@ export interface AUPSummary {
aupState: AUPState;
nilAUP: boolean;
remark: string;
note: Array<string | null>;
note: Array<string>;
expandedAUP: boolean;
lastUpdate?: LastUpdate;
isP3?: boolean;
Expand Down Expand Up @@ -305,3 +306,37 @@ export interface FlightLevelRange {
min: FlightLevel;
max: FlightLevel;
}

export interface CompleteAIXMDatasetRequest {
queryCriteria: CompleteDatasetQueryCriteria;
}

export type CompleteAIXMDatasetReply = ReplyWithData<{
datasetSummaries: CompleteDatasetSummary[];
}>;

export interface AUPRetrievalRequest {
aupId: AUPId;
returnComputed?: boolean;
}

export type AUPRetrievalReply = ReplyWithData<{
aup: AUP;
}>;

export interface AUPChainRetrievalRequest {
chainDate: DateYearMonthDay;
amcIds?: AirNavigationUnitId[];
}

export type AUPChainRetrievalReply = ReplyWithData<{
chains: AUPChain[];
}>;

export interface EAUPChainRetrievalRequest {
chainDate: DateYearMonthDay;
}

export type EAUPChainRetrievalReply = ReplyWithData<{
chain: EAUPChain;
}>;
2 changes: 1 addition & 1 deletion src/Flight/queryFlightPlans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { SoapOptions } from '../soap';
import { prepareSerializer } from '../utils/transformers';
import { instrument } from '../utils/instrumentation';
import type { FlightPlanListRequest, FlightPlanListReply } from './types';
export { FlightPlanListRequest, FlightPlanListReply } from './types';
export type { FlightPlanListRequest, FlightPlanListReply } from './types';

type Values = FlightPlanListRequest;
type Result = FlightPlanListReply;
Expand Down
2 changes: 1 addition & 1 deletion src/Flight/queryFlightsByAirspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type {
FlightListByAirspaceReply,
} from './types';

export {
export type {
FlightListByAirspaceRequest,
FlightListByAirspaceReply,
} from './types';
Expand Down
6 changes: 5 additions & 1 deletion src/Flight/queryFlightsByMeasure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ import type {
FlightListByMeasureRequest,
FlightListByMeasureReply,
} from './types';
export { FlightListByMeasureRequest, FlightListByMeasureReply } from './types';

export type {
FlightListByMeasureRequest,
FlightListByMeasureReply,
} from './types';

type Values = FlightListByMeasureRequest;
type Result = FlightListByMeasureReply;
Expand Down
2 changes: 1 addition & 1 deletion src/Flight/queryFlightsByTrafficVolume.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type {
FlightListByTrafficVolumeReply,
} from './types';

export {
export type {
FlightListByTrafficVolumeRequest,
FlightListByTrafficVolumeReply,
} from './types';
Expand Down
2 changes: 1 addition & 1 deletion src/Flight/retrieveFlight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { prepareSerializer } from '../utils/transformers';
import { instrument } from '../utils/instrumentation';

import type { FlightRetrievalRequest, FlightRetrievalReply } from './types';
export { FlightRetrievalRequest, FlightRetrievalReply } from './types';
export type { FlightRetrievalRequest, FlightRetrievalReply } from './types';

type Values = FlightRetrievalRequest;
type Result = FlightRetrievalReply;
Expand Down
2 changes: 1 addition & 1 deletion src/Flow/queryHotspots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { prepareSerializer } from '../utils/transformers';
import { instrument } from '../utils/instrumentation';

import type { HotspotListRequest, HotspotListReply } from './types';
export { HotspotListRequest, HotspotListReply } from './types';
export type { HotspotListRequest, HotspotListReply } from './types';

type Values = HotspotListRequest;
type Result = HotspotListReply;
Expand Down
2 changes: 1 addition & 1 deletion src/Flow/queryRegulations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { prepareSerializer } from '../utils/transformers';
import { instrument } from '../utils/instrumentation';

import type { RegulationListRequest, RegulationListReply } from './types';
export { RegulationListRequest, RegulationListReply } from './types';
export type { RegulationListRequest, RegulationListReply } from './types';

type Values = RegulationListRequest;
type Result = RegulationListReply;
Expand Down
2 changes: 1 addition & 1 deletion src/Flow/queryTrafficCountsByAirspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type {
TrafficCountsByAirspaceReply,
} from './types';

export {
export type {
TrafficCountsByAirspaceRequest,
TrafficCountsByAirspaceReply,
} from './types';
Expand Down
2 changes: 1 addition & 1 deletion src/Flow/queryTrafficCountsByTrafficVolume.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type {
TrafficCountsByTrafficVolumeReply,
} from './types';

export {
export type {
TrafficCountsByTrafficVolumeRequest,
TrafficCountsByTrafficVolumeReply,
} from './types';
Expand Down
2 changes: 1 addition & 1 deletion src/Flow/retrieveCapacityPlan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type {
CapacityPlanRetrievalReply,
} from './types';

export {
export type {
CapacityPlanRetrievalRequest,
CapacityPlanRetrievalReply,
} from './types';
Expand Down
2 changes: 1 addition & 1 deletion src/Flow/retrieveOTMVPlan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { prepareSerializer } from '../utils/transformers';
import { instrument } from '../utils/instrumentation';

import type { OTMVPlanRetrievalRequest, OTMVPlanRetrievalReply } from './types';
export { OTMVPlanRetrievalRequest, OTMVPlanRetrievalReply } from './types';
export type { OTMVPlanRetrievalRequest, OTMVPlanRetrievalReply } from './types';

export type Values = OTMVPlanRetrievalRequest;
export type Result = OTMVPlanRetrievalReply;
Expand Down
3 changes: 2 additions & 1 deletion src/Flow/retrieveRunwayConfigurationPlan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import type {
RunwayConfigurationPlanRetrievalRequest,
RunwayConfigurationPlanRetrievalReply,
} from './types';
export {

export type {
RunwayConfigurationPlanRetrievalRequest,
RunwayConfigurationPlanRetrievalReply,
} from './types';
Expand Down
8 changes: 6 additions & 2 deletions src/Flow/retrieveSectorConfigurationPlan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type {
SectorConfigurationId,
} from './types';

export {
export type {
SectorConfigurationPlanRetrievalRequest,
SectorConfigurationPlanRetrievalReply,
} from './types';
Expand Down Expand Up @@ -54,7 +54,11 @@ export default function prepareRetrieveSectorConfigurationPlan(
}

export function knownConfigurationsToMap(
knownConfigurations: undefined | null | SafeB2BDeserializedResponse<KnownConfigurations>,
knownConfigurations:
| undefined
| null
| SafeB2BDeserializedResponse<KnownConfigurations>
| KnownConfigurations,
): Map<SectorConfigurationId, AirspaceId[]> {
if (!knownConfigurations?.item) {
return new Map();
Expand Down
14 changes: 7 additions & 7 deletions src/Flow/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ export type ScenarioTrafficVolumeMatchingKind =
| 'OVERLAPPING_REFERENCE_LOCATION'
| 'SAME_REFERENCE_LOCATION'
| 'SAME_TRAFFIC_VOLUME';
interface IRegulationOrMCDMOnly extends Measure {
export interface IRegulationOrMCDMOnly extends Measure {
regulationId: RegulationId;
reason?: RegulationReason;
location?: TrafficVolumeLocation;
Expand Down Expand Up @@ -673,36 +673,36 @@ export interface OTMVPlans extends TacticalConfigurationPlan {
>;
}

interface OTMVPlanForDuration {
export interface OTMVPlanForDuration {
nmSchedule?: NMSet<PlannedOTMV>;
clientSchedule: NMSet<PlannedOTMV>;
}

interface PlannedOTMV {
export interface PlannedOTMV {
applicabilityPeriod: DateTimeMinutePeriod;
dataSource: PlanDataSource;
otmv?: OTMV;
}

interface OTMV {
export interface OTMV {
trafficVolume: TrafficVolumeId;
otmvDuration: DurationHourMinute;
peak?: OTMVPeak;
sustained?: OTMVSustained;
remark?: string;
}

interface OTMVPeak {
export interface OTMVPeak {
threshold: OTMVThreshold;
}

interface OTMVSustained {
export interface OTMVSustained {
threshold: OTMVThreshold;
crossingOccurrences: number;
elapsed: DurationHourMinute;
}

type OTMVThreshold = number;
export type OTMVThreshold = number;

export type OTMVPlanRetrievalReply = ReplyWithData<OTMVPlanRetrievalReplyData>;

Expand Down
5 changes: 4 additions & 1 deletion src/Flow/updateCapacityPlan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ import type {
CapacityPlanUpdateReply,
} from './types';

export { CapacityPlanUpdateRequest, CapacityPlanUpdateReply } from './types';
export type {
CapacityPlanUpdateRequest,
CapacityPlanUpdateReply,
} from './types';

export type Values = CapacityPlanUpdateRequest;
export type Result = CapacityPlanUpdateReply;
Expand Down
2 changes: 1 addition & 1 deletion src/Flow/updateOTMVPlan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { instrument } from '../utils/instrumentation';

import type { OTMVPlanUpdateRequest, OTMVPlanUpdateReply } from './types';

export { OTMVPlanUpdateRequest, OTMVPlanUpdateReply } from './types';
export type { OTMVPlanUpdateRequest, OTMVPlanUpdateReply } from './types';

export type Values = OTMVPlanUpdateRequest;
export type Result = OTMVPlanUpdateReply;
Expand Down
Loading

0 comments on commit 222fb69

Please sign in to comment.