diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..a19ade0 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +CHANGELOG.md merge=union diff --git a/.github/workflows/test_publish.yml b/.github/workflows/test_publish.yml index a84badb..feedd3a 100644 --- a/.github/workflows/test_publish.yml +++ b/.github/workflows/test_publish.yml @@ -4,7 +4,7 @@ env: CI: true B2B_FLAVOUR: PREOPS B2B_ENDPOINT: https://b2b-proxy.4me.im/ - B2B_XSD_REMOTE_URL: https://wsdl.b2B-proxy.4me.im/26.0.0.tar.gz + B2B_XSD_REMOTE_URL: https://wsdl.b2B-proxy.4me.im/27.0.0.tar.gz B2B_API_KEY_ID: ${{ secrets.B2B_API_KEY_ID }} B2B_API_SECRET_KEY: ${{ secrets.B2B_API_SECRET_KEY }} CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index ebea797..28a736e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Master +- NMB2B v27.0.0 - Attach the current configuration to the service definition : `xxxxService.config`. - Remove moment.js, move to `date-fns` - Update dependencies diff --git a/README.md b/README.md index 0586e6d..bc882b6 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Exposes a general purpose Javascript library to interact with NM B2B web services. The idea is to abstract pain points while offering an API that maps the NM B2B WS API. -NM target version: **26.0.0** +NM target version: **27.0.0** ## Simple usage example diff --git a/src/Airspace/types.ts b/src/Airspace/types.ts index 919be52..a468c3d 100644 --- a/src/Airspace/types.ts +++ b/src/Airspace/types.ts @@ -102,6 +102,7 @@ type ADRMessageType = object; // eurocontrol.cfmu.cua.b2b.aixm.ADRMessage export interface AUPManualEntries { cdrs?: ADRMessageType; rsas?: ADRMessageType; + radRestrictionActivations?: ADRMessageType; } export interface AUPComputedEntries { diff --git a/src/Common/types.ts b/src/Common/types.ts index 935d94c..13d8bad 100644 --- a/src/Common/types.ts +++ b/src/Common/types.ts @@ -24,6 +24,8 @@ export type AirNavigationUnitId = string; // (UALPHA|DIGIT|SPECIAL_CHARACTER){1, export type UserId = string; // ANY{1,12} export type PlanDataId = string; // (O|F|S)(DIGIT){14}(UALPHA|DIGIT){0,40} +export type Colours = string; // TEXT{1,51} + // TODO: Implement proper duration (seconds) parsing export type SignedDurationHourMinuteSecond = string; // +hhmmss / -hhmmss @@ -140,6 +142,7 @@ export interface Reply { export interface Request { endUserId?: string; + onBehalfOfUnit?: AirNavigationUnitId; sendTime: DateTimeSecond; } diff --git a/src/Flight/queryFlightsByAerodrome.test.ts b/src/Flight/queryFlightsByAerodrome.test.ts index 80ea8b5..c4e0798 100644 --- a/src/Flight/queryFlightsByAerodrome.test.ts +++ b/src/Flight/queryFlightsByAerodrome.test.ts @@ -20,7 +20,7 @@ describe('queryFlightsByAirspace', async () => { trafficType: 'LOAD', trafficWindow, aerodrome: 'LFPG', - aerodromeRole: 'BOTH', + aerodromeRole: 'GLOBAL', }); /** @@ -41,7 +41,13 @@ describe('queryFlightsByAirspace', async () => { ), ).toBeLessThan(60 * 1000); - expect(res.data?.flights).toEqual(expect.any(Array)); + if (!res.data.flights) { + console.warn('No flights in the response.'); + return; + } + + expect(res.data.flights).toEqual(expect.any(Array)); + for (const flight of res.data?.flights) { expect(flight).toMatchObject({ flight: { diff --git a/src/Flight/queryFlightsByAerodromeSet.test.ts b/src/Flight/queryFlightsByAerodromeSet.test.ts index edd8edc..c78df38 100644 --- a/src/Flight/queryFlightsByAerodromeSet.test.ts +++ b/src/Flight/queryFlightsByAerodromeSet.test.ts @@ -20,7 +20,7 @@ describe('queryFlightsByAirspace', async () => { trafficType: 'LOAD', trafficWindow, aerodromeSet: 'LFPG+', - aerodromeRole: 'BOTH', + aerodromeRole: 'GLOBAL', }); /** @@ -41,8 +41,14 @@ describe('queryFlightsByAirspace', async () => { ), ).toBeLessThan(60 * 1000); - expect(res.data?.flights).toEqual(expect.any(Array)); - for (const flight of res.data?.flights) { + if (!res.data.flights) { + console.warn('No flights in the response.'); + return; + } + + expect(res.data.flights).toEqual(expect.any(Array)); + + for (const flight of res.data.flights) { expect(flight).toMatchObject({ flight: { flightId: { diff --git a/src/Flight/queryFlightsByAircraftOperator.test.ts b/src/Flight/queryFlightsByAircraftOperator.test.ts index c867cd3..f233bd9 100644 --- a/src/Flight/queryFlightsByAircraftOperator.test.ts +++ b/src/Flight/queryFlightsByAircraftOperator.test.ts @@ -43,8 +43,14 @@ describe('queryFlightsByAircraftOperator', async () => { ), ).toBeLessThan(60 * 1000); - expect(res.data?.flights).toEqual(expect.any(Array)); - for (const flight of res.data?.flights) { + if (!res.data.flights) { + console.warn('No flights in the response.'); + return; + } + + expect(res.data.flights).toEqual(expect.any(Array)); + + for (const flight of res.data.flights) { expect(flight).toMatchObject({ flight: { flightId: { diff --git a/src/Flight/queryFlightsByAirspace.test.ts b/src/Flight/queryFlightsByAirspace.test.ts index 2a00a67..21fdac3 100644 --- a/src/Flight/queryFlightsByAirspace.test.ts +++ b/src/Flight/queryFlightsByAirspace.test.ts @@ -40,8 +40,14 @@ describe('queryFlightsByAirspace', async () => { ), ).toBeLessThan(60 * 1000); - expect(res.data?.flights).toEqual(expect.any(Array)); - for (const flight of res.data?.flights) { + if (!res.data.flights) { + console.warn('No flights in the response.'); + return; + } + + expect(res.data.flights).toEqual(expect.any(Array)); + + for (const flight of res.data.flights) { expect(flight).toMatchObject({ flight: { flightId: { diff --git a/src/Flight/queryFlightsByMeasure.test.ts b/src/Flight/queryFlightsByMeasure.test.ts index 39a642e..bc28eb5 100644 --- a/src/Flight/queryFlightsByMeasure.test.ts +++ b/src/Flight/queryFlightsByMeasure.test.ts @@ -70,8 +70,15 @@ describe('queryFlightsByMeasure', async () => { }); expect(res.data.effectiveTrafficWindow).toEqual(measure.applicability); - expect(res.data?.flights).toEqual(expect.any(Array)); - for (const flight of res.data?.flights) { + + if (!res.data.flights) { + console.warn('No flights in the response.'); + return; + } + + expect(res.data.flights).toEqual(expect.any(Array)); + + for (const flight of res.data.flights) { expect(flight).toMatchObject({ flight: { flightId: { diff --git a/src/Flight/queryFlightsByTrafficVolume.test.ts b/src/Flight/queryFlightsByTrafficVolume.test.ts index 5446fc7..2564704 100644 --- a/src/Flight/queryFlightsByTrafficVolume.test.ts +++ b/src/Flight/queryFlightsByTrafficVolume.test.ts @@ -47,8 +47,14 @@ describe('queryFlightsByTrafficVolume', async () => { ), ).toBeLessThan(60 * 1000); - expect(res.data?.flights).toEqual(expect.any(Array)); - for (const flight of res.data?.flights) { + if (!res.data.flights) { + console.warn('No flights in the response.'); + return; + } + + expect(res.data.flights).toEqual(expect.any(Array)); + + for (const flight of res.data.flights) { if (!('flight' in flight)) { continue; } diff --git a/src/Flight/retrieveFlight.test.ts b/src/Flight/retrieveFlight.test.ts index 2d2f69a..1bbb86d 100644 --- a/src/Flight/retrieveFlight.test.ts +++ b/src/Flight/retrieveFlight.test.ts @@ -3,7 +3,7 @@ import { NMB2BError, makeFlightClient } from '..'; import b2bOptions from '../../tests/options'; import type { FlightKeys } from './types'; import { shouldUseRealB2BConnection } from '../../tests/utils'; -import { expect, beforeAll, test, describe } from 'vitest'; +import { expect, beforeAll, test, describe, assert } from 'vitest'; import { add, sub } from 'date-fns'; describe('retrieveFlight', async () => { @@ -27,18 +27,24 @@ describe('retrieveFlight', async () => { airspace: 'LFEERMS', }); - const flights = res.data.flights.filter((f) => { - if ('flightPlan' in f) { - return false; - } + if (!res.data.flights) { + console.warn('No flights in the response.'); + return; + } - return true; - }); + const flights = res.data.flights.filter( + (f): f is Extract => { + if ('flightPlan' in f) { + return false; + } + + return true; + }, + ); - // Second condition is here because TS won't infer that the array contains - // only Flight and not FlightPlan anymore const flight = flights[0]; - if (!flight || !('flight' in flight)) { + + if (!flight) { console.error('Could not fetch a known flight, test aborted'); return; } @@ -77,11 +83,11 @@ describe('retrieveFlight', async () => { }, requestedFlightDatasets: ['flight'], requestedFlightFields: ['ftfmPointProfile'], - requestedDataFormat: 'NM_B2B', }); - expect(res.data.flight?.ftfmPointProfile).toBeDefined(); - res.data.flight?.ftfmPointProfile?.forEach((item) => { + assert(res.data.flight?.ftfmPointProfile); + + res.data.flight.ftfmPointProfile.forEach((item) => { expect(item).toEqual( expect.objectContaining({ timeOver: expect.any(Date), @@ -90,7 +96,10 @@ describe('retrieveFlight', async () => { ); }); } catch (err) { - console.error(inspect(err, { depth: 4 })); + if (err instanceof NMB2BError) { + console.log(inspect(err, { depth: 4 })); + } + throw err; } }, @@ -114,7 +123,6 @@ describe('retrieveFlight', async () => { }, requestedFlightDatasets: ['flight'], requestedFlightFields: ['aircraftType', 'delay'], - requestedDataFormat: 'NM_B2B', }); const flight = res.data?.flight; diff --git a/src/Flight/types.ts b/src/Flight/types.ts index b56f6fb..1842df3 100644 --- a/src/Flight/types.ts +++ b/src/Flight/types.ts @@ -1,6 +1,9 @@ export type IFPLId = string; // UALPHA{2}DIGIT{8} export type FlightDataset = 'flight' | 'flightPlan' | 'flightPlanHistory'; -export type FlightIdentificationInput = { id: IFPLId } | { keys: FlightKeys }; +export type FlightIdentificationInput = + | { id: IFPLId } + | { keys: FlightKeys } + | { iataKeys: IATAFlightKeys }; export interface FlightIdentificationOutput { id?: IFPLId; keys?: FlightKeys; @@ -97,6 +100,7 @@ import { FlightLevelM, Cost, SignedDurationHourMinuteSecond, + Colours, Duration, } from '../Common/types'; @@ -114,6 +118,7 @@ import { MeasureId, TrafficVolumeScenarios, Flow, + ReroutingId, } from '../Flow/types'; export interface FlightKeys { @@ -126,6 +131,11 @@ export interface FlightKeys { estimatedOffBlockTime: DateTimeMinute; } +export type IATAFlightKeys = { + flightDesignator: AircraftIATAId; + estimatedOffBlockTime: DateTimeMinute; +}; + export interface TimeAndModel { model: TrafficType; dateTime: DateTimeSecond; @@ -252,8 +262,6 @@ export type FlightField = | 'oceanicReroute' | 'visibility'; -export type FlightExchangeModel = 'FIXM' | 'NM_B2B'; - export type FlightPlanOutput = { structured: StructuredFlightPlan }; export interface BasicTrajectoryData { @@ -290,7 +298,7 @@ export interface DepartureData { taxiTime: DurationMinute; } -export type FIXMFlight = object; // aero.fixm.flight._4.FlightType +export type FIXMFlight = Record; // aero.fixm.flight._4.FlightType export interface StructuredFlightPlan { flightPlan?: FlightPlan; basicTrajectoryData?: BasicTrajectoryData; @@ -450,8 +458,50 @@ export interface Flight { flightCriticality?: FlightCriticalityIndicator; oceanicRoute?: boolean; visibility?: FlightVisibility; + iataFlightDesignator?: AircraftIATAIdFromDataSource; + activeACDMAlerts?: NMList; + aoReroutingFeedbacks?: NMList; } +export type ReroutingFeedbackKind = 'LIKE' | 'DISLIKE'; +export type ReroutingFeedbackReason = + | 'TOTAL_COST' + | 'FUEL_SAVINGS' + | 'ROUTE_CHARGES' + | 'ATFM_DELAY_VALUE' + | 'DISTANCE' + | 'FLYING_TIME' + | 'OBT_VALIDITY' + | 'AO_INTERNAL_REASONS' + | 'OTHER'; + +export type ReroutingFeedback = { + kind: ReroutingFeedbackKind; + icaoRoute: string; + reason: ReroutingFeedbackReason; + comment?: string; + reroutingId?: ReroutingId; +}; + +export type ACDMAlertCode = string; // UALPHA{3}DIGIT{2}LALPHA{0,1} +export type ACDMAlertSeverity = 'HIGH' | 'MEDIUM' | 'LOW'; + +export type ACDMAlertData = { + alertCode: ACDMAlertCode; + timestamp: DateTimeMinute; + inconsistencyDetected: string; + actionToTake: string; + consequencesNote?: string; + severity?: ACDMAlertSeverity; +}; + +export type AircraftIATAIdFromDataSource = { + id: AircraftIATAId; + dataSource: AircraftIdDataSource; +}; + +export type AircraftIdDataSource = 'DDR' | 'API' | 'DPI' | 'FPM'; + export type FlightTrafficVolume = { trafficVolumeId: TrafficVolumeId; entryTime: DateTimeSecond; @@ -490,6 +540,7 @@ export type FlightCriticalityIndicator = { export type GroupReroutingSummary = { groupReroutingIndicator: GroupReroutingIndicator; + reroutingId: ReroutingId; deltaCost: Cost; deltaDelay?: SignedDurationHourMinuteSecond; }; @@ -581,6 +632,7 @@ export type ProposalInformation = { responseBy: DateTimeMinute; proposedCTOT?: DateTimeMinute; routeId?: ReroutingRouteId; + reroutingId?: ReroutingId; }; export type ReroutingRouteId = { @@ -763,7 +815,7 @@ export type Dinghies = { numberOfDinghies?: number; // NumberOfDinghies_DataType totalCapacity?: number; // TotalCapacity_DataType areCovered?: boolean; - colour?: string; // Colour_DataType // TEXT{1,51} + colours?: Colours; }; export type OtherInformation = { @@ -850,7 +902,8 @@ export type EURSTSIndicator = | 'EXM833' | 'PROTECTED' | 'RNAVINOP' - | 'RNAVX'; + | 'RNAVX' + | 'OAT'; export type AircraftOperatorName_DataType = string; @@ -907,10 +960,12 @@ export interface CDM { | 'PREDICTED' | 'PRE_SEQUENCED' | 'TARGETED'; - AirportType: 'ADVANCED_ATC_TWR' | 'CDM' | 'STANDARD'; + airportType: DepartureAirportType; info?: CDMInfo; } +export type DepartureAirportType = 'STANDARD' | 'ADVANCED_ATC_TWR' | 'CDM'; + export interface CDMInfo { turnaroundTargetTakeOffTime?: DateTimeMinute; earliestTargetTakeOffTime?: DateTimeMinute; @@ -1300,7 +1355,7 @@ export interface InvalidFiling { } export interface FlightListReplyData { - flights: FlightOrFlightPlan[]; + flights?: FlightOrFlightPlan[]; } export interface FlightListByLocationReplyData extends FlightListReplyData { @@ -1336,7 +1391,6 @@ export interface FlightRetrievalRequest { flightId: FlightIdentificationInput; requestedFlightDatasets: FlightDataset[]; requestedFlightFields?: FlightField[]; - requestedDataFormat: FlightExchangeModel; } export interface FlightRetrievalReply extends Reply { @@ -1344,6 +1398,7 @@ export interface FlightRetrievalReply extends Reply { latestFlightPlan?: FlightPlanOutput; flightPlanHistory?: FlightPlanHistory; flight?: Flight; + structuredFlightPlan?: StructuredFlightPlan; }; } @@ -1384,7 +1439,23 @@ export interface FlightListByAerodromeRequest aerodromeRole: AerodromeRole; } -export type AerodromeRole = 'DEPARTURE' | 'ARRIVAL' | 'BOTH'; +export type AerodromeRole = + /** + * The aerodrome is meant as of departure. + */ + | 'DEPARTURE' + /** + * The aerodrome is meat as of arrival. + */ + | 'ARRIVAL' + /** + * The aerodrome is meat as of departure or arrival. + */ + | 'GLOBAL' + /** + * The aerodrome is meat as of alternate. + */ + | 'ALTERNATE'; export interface FlightListByAerodromeReply extends Reply { data: FlightListByAerodromeReplyData; diff --git a/src/Flow/types.ts b/src/Flow/types.ts index acfcda3..0eb2dab 100644 --- a/src/Flow/types.ts +++ b/src/Flow/types.ts @@ -180,28 +180,31 @@ export interface CountsInterval { export type RegulationField = | 'applicability' | 'autolink' - | 'createdByFMP' - | 'dataId' - | 'delayConfirmationThreshold' - | 'delayTVSet' - | 'externallyEditable' + | 'measureCherryPicked' + | 'calculationType' | 'initialConstraints' - | 'lastUpdate' + | 'occupancyConstraints' | 'linkedRegulations' | 'location' - | 'mcdmRequired' - | 'measureCherryPicked' - | 'noDelayWindow' | 'protectedLocation' | 'reason' - | 'regulationState' | 'remark' - | 'scenarioReference' - | 'sourceHotspot' - | 'subType' + | 'regulationState' | 'supplementaryConstraints' + | 'lastUpdate' + | 'noDelayWindow' + | 'occupancyDuration' | 'updateCapacityRequired' - | 'updateTVActivationRequired'; + | 'updateTVActivationRequired' + | 'externallyEditable' + | 'subType' + | 'delayTVSet' + | 'createdByFMP' + | 'sourceHotspot' + | 'mcdmRequired' + | 'dataId' + | 'scenarioReference' + | 'delayConfirmationThreshold'; export interface SectorConfigurationPlanRetrievalRequest extends TacticalConfigurationRetrievalRequest { @@ -303,6 +306,8 @@ export interface TrafficCountsReplyData { flows?: NMSet; counts?: NMMap>; otmvAlerts?: NMMap>; + effectiveCapacities?: NMMap; + effectiveOTMVs?: NMMap; } export interface Flow { @@ -314,8 +319,8 @@ export interface Flow { } export type ScenarioImpact = { - totalCommonFlights: CountsValue; - totalOtherFlights: CountsValue; + totalCommonFlightCount: CountsValue; + totalOtherFlightCount: CountsValue; scenarioTrafficVolumeEntryPeriod?: DateTimeMinutePeriod; }; @@ -337,6 +342,14 @@ export interface Counts { } export type CountsValue = number; + +export type OTMVThresholds = { + peakThreshold?: OTMVThreshold; + sustaintedThreshold?: OTMVThreshold; + sustainedElapsedDuration?: DurationHourMinute; + sustainedCrossingOccurences?: number; +}; + export type SubTotalsTrafficCountsType = /** * Predicted flights that are not suspended @@ -463,8 +476,10 @@ interface IRegulationOrMCDMOnly extends Measure { regulationId: RegulationId; reason?: RegulationReason; location?: TrafficVolumeLocation; + calculationType?: null | CountsCalculationType; initialConstraints?: RegulationInitialConstraint[]; supplementaryConstraints?: RegulationSupplementaryConstraint[]; + occupancyConstraints?: RegulationOccupancyConstraint[]; remark?: string; autolink?: boolean; linkedRegulations?: NMSet; @@ -630,6 +645,13 @@ export interface RegulationSupplementaryConstraint { supplementaryRate: number; } +export interface RegulationOccupancyConstraint { + constraintPeriod: DateTimeMinutePeriod; + occupancyRate: number; + peakCapacity: number; + pendingCapacityPercentage: number; +} + export interface HotspotListRequest { dataset: Dataset; day: DateYearMonthDay; diff --git a/src/GeneralInformation/index.ts b/src/GeneralInformation/index.ts index 3e208c1..f12defd 100644 --- a/src/GeneralInformation/index.ts +++ b/src/GeneralInformation/index.ts @@ -34,13 +34,20 @@ function createGeneralInformationServices( }); } -import { BaseServiceInterface } from '../Common/ServiceInterface'; import queryNMB2BWSDLs, { Resolver as QueryNMB2BWSDLs, } from './queryNMB2BWSDLs'; +import retrieveUserInformation, { + Resolver as RetrieveUserInformation, +} from './retrieveUserinformation'; + +import type { BaseServiceInterface } from '../Common/ServiceInterface'; + export interface GeneralInformationService extends BaseServiceInterface { + __soapClient: object; queryNMB2BWSDLs: QueryNMB2BWSDLs; + retrieveUserInformation: RetrieveUserInformation; } export function getGeneralInformationClient( @@ -51,6 +58,7 @@ export function getGeneralInformationClient( __soapClient: client, config, queryNMB2BWSDLs: queryNMB2BWSDLs(client), + retrieveUserInformation: retrieveUserInformation(client), }), (err) => { // TODO: Implement a proper debug log message output diff --git a/src/GeneralInformation/queryNMB2BWSDLs.test.ts b/src/GeneralInformation/queryNMB2BWSDLs.test.ts index 2cc35d4..7d94b58 100644 --- a/src/GeneralInformation/queryNMB2BWSDLs.test.ts +++ b/src/GeneralInformation/queryNMB2BWSDLs.test.ts @@ -1,4 +1,3 @@ -import { GeneralInformationService } from '.'; import { makeGeneralInformationClient } from '..'; import b2bOptions from '../../tests/options'; import { shouldUseRealB2BConnection } from '../../tests/utils'; @@ -7,9 +6,9 @@ import { describe, test, expect } from 'vitest'; describe('queryNMB2BWSDLs', async () => { const GeneralInformation = await makeGeneralInformationClient(b2bOptions); - test.runIf(shouldUseRealB2BConnection)('Version 26.0.0', async () => { + test.runIf(shouldUseRealB2BConnection)('Version 27.0.0', async () => { const res = await GeneralInformation.queryNMB2BWSDLs({ - version: '26.0.0', + version: '27.0.0', }); expect(res.data).toBeDefined(); diff --git a/src/GeneralInformation/retrieveUserInformation.test.ts b/src/GeneralInformation/retrieveUserInformation.test.ts new file mode 100644 index 0000000..2d4c5a4 --- /dev/null +++ b/src/GeneralInformation/retrieveUserInformation.test.ts @@ -0,0 +1,14 @@ +import { makeGeneralInformationClient } from '..'; +import b2bOptions from '../../tests/options'; +import { shouldUseRealB2BConnection } from '../../tests/utils'; +import { describe, test, expect } from 'vitest'; + +describe('retrieveUserInformation', async () => { + const GeneralInformation = await makeGeneralInformationClient(b2bOptions); + + test.runIf(shouldUseRealB2BConnection)('basic', async () => { + const res = await GeneralInformation.retrieveUserInformation(); + + expect(res.status).toBe('OK'); + }); +}); diff --git a/src/PublishSubscribe/pauseSubscription.ts b/src/GeneralInformation/retrieveUserinformation.ts similarity index 54% rename from src/PublishSubscribe/pauseSubscription.ts rename to src/GeneralInformation/retrieveUserinformation.ts index 1df7ada..812cca3 100644 --- a/src/PublishSubscribe/pauseSubscription.ts +++ b/src/GeneralInformation/retrieveUserinformation.ts @@ -1,33 +1,34 @@ -import { PublishSubscribeClient } from './'; +import { GeneralInformationServiceClient } from './'; import { injectSendTime, responseStatusHandler } from '../utils/internals'; import { SoapOptions } from '../soap'; import { prepareSerializer } from '../utils/transformers'; import { instrument } from '../utils/instrumentation'; -import type { SubscriptionPauseRequest, SubscriptionPauseReply } from './types'; -export type Values = SubscriptionPauseRequest; -export type Result = SubscriptionPauseReply; +import type { UserInformationRequest, UserInformationReply } from './types'; + +type Values = UserInformationRequest; +type Result = UserInformationReply; export type Resolver = ( values?: Values, options?: SoapOptions, ) => Promise; -export default function preparePauseSubscription( - client: PublishSubscribeClient, +export default function prepareRetrieveUserInformation( + client: GeneralInformationServiceClient, ): Resolver { + // console.log(client.describe()); const schema = - client.describe().SubscriptionManagementService.SubscriptionManagementPort - .pauseSubscription.input; + client.describe().NMB2BInfoService.NMB2BInfoPort.retrieveUserInformation.input; const serializer = prepareSerializer(schema); return instrument({ - service: 'PublishSubscribe', - query: 'pauseSubscription', + service: 'GeneralInformation', + query: 'retrieveUserInformation', })( (values, options) => new Promise((resolve, reject) => { - client.pauseSubscription( + client.retrieveUserInformation( serializer(injectSendTime(values)), options, responseStatusHandler(resolve, reject), diff --git a/src/GeneralInformation/types.ts b/src/GeneralInformation/types.ts index ebe56ff..25db843 100644 --- a/src/GeneralInformation/types.ts +++ b/src/GeneralInformation/types.ts @@ -15,3 +15,15 @@ export interface NMB2BWSDLsReplyData { export interface B2BInfoFile extends File { hasAddendaErrata?: boolean; } + +export interface UserInformationRequest {} + +export interface UserInformationReply extends Reply { + data?: UserInformationReplyData; +} + +export type UserInformationReplyData = { + textReport: TextReport; +}; + +export type TextReport = string; diff --git a/src/PublishSubscribe/createSubscription.test.ts b/src/PublishSubscribe/createSubscription.test.ts deleted file mode 100644 index 2b08a70..0000000 --- a/src/PublishSubscribe/createSubscription.test.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { PublishSubscribeService } from '.'; -import { makePublishSubscribeClient } from '..'; -import b2bOptions from '../../tests/options'; -import { describe, test, expect, afterAll } from 'vitest'; -import { shouldUseRealB2BConnection } from '../../tests/utils'; - -// TODO: Check this -describe.skip('createSubscriptions', async () => { - const PublishSubscribe = await makePublishSubscribeClient(b2bOptions); - - afterAll(async () => { - const res = await PublishSubscribe.listSubscriptions(); - - const { - data: { subscriptions }, - } = res; - if ( - !subscriptions || - !subscriptions.item || - !Array.isArray(subscriptions.item) - ) { - return; - } - - const toDelete: string[] = subscriptions.item - .filter(({ description }) => description === '__TEST__') - .map(({ uuid }) => uuid); - - await Promise.all( - toDelete.map((uuid) => PublishSubscribe.deleteSubscription({ uuid })), - ); - }); - - test.skip('Empty test', () => {}); - - // xtest('create flight subscription', async () => { - // try { - // const res = await PubSub.createSubscription({ - // topic: 'FLIGHT_DATA', - // description: '__TEST__', - // 'messageFilter-FlightDataMessageFilter': { - // flightSet: { item: [{ anuIds: [{ item: 'LFEE' }] }] }, - // }, - // }); - // - // const { data: { subscription } } = res; - // - // expect(subscription).toBeDefined(); - // expect(subscription).toMatchObject({ - // uuid: expect.any(String), - // }); - // - // const res2 = await PubSub.listSubscriptions(); - // const { data: { subscriptions: { item: subscriptions } }} = res2; - // - // expect(subscriptions).toBeDefined(); - // const sub = subscriptions.filter(({ state, description }) => state === 'PAUSED' && description === '__TEST__'); - // expect(sub.length).toBeGreaterThan(0); - // - // } catch (err) { - // console.log(inspect(err, { depth: null })); - // throw err; - // } - // }); -}); diff --git a/src/PublishSubscribe/createSubscription.ts b/src/PublishSubscribe/createSubscription.ts deleted file mode 100644 index cc16316..0000000 --- a/src/PublishSubscribe/createSubscription.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { PublishSubscribeClient } from './'; -import { injectSendTime, responseStatusHandler } from '../utils/internals'; -import { SoapOptions } from '../soap'; -import { prepareSerializer } from '../utils/transformers'; -import { instrument } from '../utils/instrumentation'; - -import { - SubscriptionCreationRequest, - SubscriptionCreationReply, -} from './types'; -export { - SubscriptionCreationRequest, - SubscriptionCreationReply, -} from './types'; - -type Values = SubscriptionCreationRequest; -type Result = SubscriptionCreationReply; - -export type Resolver = ( - values?: Values, - options?: SoapOptions, -) => Promise; - -export default function prepareCreateSubscription( - client: PublishSubscribeClient, -): Resolver { - const schema = client.describe().SubscriptionManagementService - .SubscriptionManagementPort.createSubscription.input; - const serializer = prepareSerializer(schema); - - return instrument({ - service: 'PublishSubscribe', - query: 'createSubscription', - })( - (values, options) => - new Promise((resolve, reject) => { - client.createSubscription( - serializer(injectSendTime(values)), - options, - responseStatusHandler(resolve, reject), - ); - }), - ); -} diff --git a/src/PublishSubscribe/deleteSubscription.ts b/src/PublishSubscribe/deleteSubscription.ts deleted file mode 100644 index f4ec3fe..0000000 --- a/src/PublishSubscribe/deleteSubscription.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { PublishSubscribeClient } from './'; -import { injectSendTime, responseStatusHandler } from '../utils/internals'; -import { SoapOptions } from '../soap'; -import { prepareSerializer } from '../utils/transformers'; -import { instrument } from '../utils/instrumentation'; -import type { - SubscriptionDeletionRequest, - SubscriptionDeletionReply, -} from './types'; - -export type Values = SubscriptionDeletionRequest; -export type Result = SubscriptionDeletionReply; - -export type Resolver = ( - values?: SubscriptionDeletionRequest, - options?: SoapOptions, -) => Promise; - -export default function prepareDeleteSubscription( - client: PublishSubscribeClient, -): Resolver { - // console.log(Object.keys(client)); - // - const schema = - client.describe().SubscriptionManagementService.SubscriptionManagementPort - .deleteSubscription.input; - const serializer = prepareSerializer(schema); - - return instrument({ - service: 'PublishSubscribe', - query: 'deleteSubscription', - })( - (values, options) => - new Promise((resolve, reject) => { - client.deleteSubscription( - serializer(injectSendTime(values)), - options, - responseStatusHandler(resolve, reject), - ); - }), - ); -} diff --git a/src/PublishSubscribe/index.test.ts b/src/PublishSubscribe/index.test.ts deleted file mode 100644 index 1a98fdb..0000000 --- a/src/PublishSubscribe/index.test.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { makePublishSubscribeClient } from '..'; -import b2bOptions from '../../tests/options'; -import { test, expect } from 'vitest'; - -test('should create PublishSubscribeClient', async () => { - await expect(makePublishSubscribeClient(b2bOptions)).resolves.toBeDefined(); -}); diff --git a/src/PublishSubscribe/index.ts b/src/PublishSubscribe/index.ts deleted file mode 100644 index fd24d58..0000000 --- a/src/PublishSubscribe/index.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { createClient } from 'soap'; -import { Config, getEndpoint } from '../config'; -import { getWSDLPath } from '../constants'; -import { prepareSecurity } from '../security'; -import { deserializer as customDeserializer } from '../utils/transformers'; - -const getWSDL = ({ flavour, XSD_PATH }: Pick) => - getWSDLPath({ service: 'PublishsubscribeServices', flavour, XSD_PATH }); - -export type PublishSubscribeClient = any; -function createPublishSubscribeServices( - config: Config, -): Promise { - const endpoint = getEndpoint(config); - const WSDL = getWSDL(config); - const security = prepareSecurity(config); - - return new Promise((resolve, reject) => - createClient(WSDL, { customDeserializer, endpoint }, (err, client) => { - if (err) { - return reject(err); - } - - client.setSecurity(security); - - return resolve(client); - }), - ); -} - -import createSubscription, { - Resolver as CreateSubscription, -} from './createSubscription'; -import deleteSubscription, { - Resolver as DeleteSubscription, -} from './deleteSubscription'; -import listSubscriptions, { - Resolver as ListSubscriptions, -} from './listSubscriptions'; -import pauseSubscription, { - Resolver as PauseSubscription, -} from './pauseSubscription'; -import resumeSubscription, { - Resolver as ResumeSubscription, -} from './resumeSubscription'; -import { BaseServiceInterface } from '../Common/ServiceInterface'; - -export interface PublishSubscribeService extends BaseServiceInterface { - listSubscriptions: ListSubscriptions; - createSubscription: CreateSubscription; - deleteSubscription: DeleteSubscription; - resumeSubscription: ResumeSubscription; - pauseSubscription: PauseSubscription; -} - -export function getPublishSubscribeClient( - config: Config, -): Promise { - return createPublishSubscribeServices(config).then((client) => ({ - __soapClient: client, - config, - listSubscriptions: listSubscriptions(client), - createSubscription: createSubscription(client), - deleteSubscription: deleteSubscription(client), - resumeSubscription: resumeSubscription(client), - pauseSubscription: pauseSubscription(client), - })); -} diff --git a/src/PublishSubscribe/listSubscriptions.test.ts b/src/PublishSubscribe/listSubscriptions.test.ts deleted file mode 100644 index 14d50d4..0000000 --- a/src/PublishSubscribe/listSubscriptions.test.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { describe, expect, test } from 'vitest'; -import { makePublishSubscribeClient } from '..'; -import b2bOptions from '../../tests/options'; -import { SubscriptionListReply } from './listSubscriptions'; - -describe('listSubscriptions', async () => { - const PublishSubscribe = await makePublishSubscribeClient(b2bOptions); - - test.skip('List subscriptions', async () => { - const res: SubscriptionListReply = - await PublishSubscribe.listSubscriptions(); - - // console.log(inspect(res.data, { depth: 4 })); - - if (!res.data.subscriptions) { - console.warn('No subscriptions attached to this certificate'); - return; - } - - const { - data: { - subscriptions: { item: subscriptions }, - }, - } = res; - - expect(subscriptions).toBeDefined(); - expect(Array.isArray(subscriptions)).toBe(true); - - subscriptions.forEach((subscription: any) => - expect(subscription).toMatchObject({ - uuid: expect.any(String), - topic: expect.any(String), - queueName: expect.any(String), - creationDate: expect.stringMatching(/^\d{4}-\d\d-\d\d \d\d:\d\d:\d\d$/), - }), - ); - }); -}); diff --git a/src/PublishSubscribe/listSubscriptions.ts b/src/PublishSubscribe/listSubscriptions.ts deleted file mode 100644 index 9811fbd..0000000 --- a/src/PublishSubscribe/listSubscriptions.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { PublishSubscribeClient } from './'; -import { injectSendTime, responseStatusHandler } from '../utils/internals'; -import { SoapOptions } from '../soap'; -import { prepareSerializer } from '../utils/transformers'; -import { instrument } from '../utils/instrumentation'; - -import { SubscriptionListRequest, SubscriptionListReply } from './types'; -export { SubscriptionListRequest, SubscriptionListReply } from './types'; - -type Values = SubscriptionListRequest; -type Result = SubscriptionListReply; - -export type Resolver = ( - values?: Values, - options?: SoapOptions, -) => Promise; - -export default function prepareListSubscriptions( - client: PublishSubscribeClient, -): Resolver { - const schema = client.describe().SubscriptionManagementService - .SubscriptionManagementPort.listSubscriptions.input; - const serializer = prepareSerializer(schema); - - return instrument({ - service: 'PublishSubscribe', - query: 'listSubscriptions', - })( - (values, options) => - new Promise((resolve, reject) => { - client.listSubscriptions( - serializer(injectSendTime(values)), - options, - responseStatusHandler(resolve, reject), - ); - }), - ); -} diff --git a/src/PublishSubscribe/resumeSubscription.ts b/src/PublishSubscribe/resumeSubscription.ts deleted file mode 100644 index 7151a6e..0000000 --- a/src/PublishSubscribe/resumeSubscription.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { PublishSubscribeClient } from './'; -import { injectSendTime, responseStatusHandler } from '../utils/internals'; -import { SoapOptions } from '../soap'; -import { prepareSerializer } from '../utils/transformers'; -import { instrument } from '../utils/instrumentation'; -import type { - SubscriptionResumeRequest, - SubscriptionResumeReply, -} from './types'; - -export type Values = SubscriptionResumeRequest; -export type Result = SubscriptionResumeReply; - -export type Resolver = ( - values?: Values, - options?: SoapOptions, -) => Promise; - -export default function prepareResumeSubscription( - client: PublishSubscribeClient, -): Resolver { - const schema = - client.describe().SubscriptionManagementService.SubscriptionManagementPort - .resumeSubscription.input; - const serializer = prepareSerializer(schema); - - return instrument({ - service: 'PublishSubscribe', - query: 'resumeSubscription', - })( - (values, options) => - new Promise((resolve, reject) => { - client.resumeSubscription( - serializer(injectSendTime(values)), - options, - responseStatusHandler(resolve, reject), - ); - }), - ); -} diff --git a/src/PublishSubscribe/types.ts b/src/PublishSubscribe/types.ts deleted file mode 100644 index aed6846..0000000 --- a/src/PublishSubscribe/types.ts +++ /dev/null @@ -1,326 +0,0 @@ -import { FlightExchangeModel } from '../Flight/types'; -import { RegulationField } from '../Flow/types'; -import { - AirNavigationUnitId, - UUID, - NMRelease, - Reply, - NMSet, - DateTimeSecond, - Timestamp, -} from '../Common/types'; - -export type QueueName = string; // ANY{1,200} -export type SubscriptionTopic = - /** - * Notification about newly published AIMs (ATM Information Messages). - * - * The message type associated with this topic is the AIMMessage. This type of message is non-filterable and non-customizable. - */ - | 'ATM_INFORMATION' - /** - * Notification about the publication of new Complete and Incremental Airspace Datasets. - * - * The message type associated with this topic is the AirspaceDataMessage. - * - * The AirspaceDataMessage is filterable but non-customizable (see AirspaceDataMessageFilter). - */ - | 'AIRSPACE_DATA' - /** - * Notification about changes to ATFCM Regulations. - * - * The message type associated with this topic is the RegulationMessage. - * - * The RegulationMessage is both filterable and customizable (see RegulationMessageFilter and RegulationPayloadConfiguration). - * - * For this subscription topic the message customization (RegulationPayloadConfiguration) is mandatory. - */ - | 'REGULATIONS' - /** - * Notification about the publication of EAUPs and EUUPs. - * - * The message type associated with this topic is the EAUPMessage. - * - * The EAUPMessage is not filterable but it is customizable (see EAUPPayloadConfiguration). - */ - | 'EAUP' - /** - * Notification about changes to flight plans. - * - * The message type associated with this topic is the FlightPlanMessage. - * - * The FlightPlanMessage is filterable but non-customizable (see `FlightPlanMessageFilter`). - * - * For this subscription topic the message filter (FlightPlanMessageFilter) is mandatory. - */ - | 'FLIGHT_PLANS' - /** - * Notification about flight updates (e.g. trajectory, times, status, etc). - * - * The message type associated with this topic is the FlightDataMessage. - * - * The FlightDataMessage is both filterable and customizable (see FlightDataMessageFilter and FlightDataPayloadConfiguration). - * - * For this subscription topic the message filter (FlightDataMessageFilter) is mandatory. - */ - | 'FLIGHT_DATA' - /** - * Notification about automatic and manual processing of ATS messages (e.g. FPL, CHG, DLA, etc) that have been submitted to IFPS (via AFTN/SITA networks or via the equivalent B2B web services). - * - * The message type associated with this topic is the FlightFilingResultMessage. - * - * The FlightFilingResultMessage is filterable but non-customizable (see FlightFilingResultMessageFilter). - */ - | 'FLIGHT_FILING_RESULT' - /** - * Notification about changes to flight plans. - * - * The message type associated with this topic is the FficeFlightFilingMessage. - * - * The FficeFlightFilingMessage is filterable but non-customizable (see FficeFlightFilingMessageFilter). - * - * For this subscription topic the message filter (FficeFlightFilingMessageFilter) is mandatory. - */ - | 'FFICE_FLIGHT_FILING' - /** - * Notification about MCDM-specific topics (e.g. MCDMMeasureTopic, standalone or non-standalone MCDMFlightTopic). - * - * The message type associated with this subscription topic is the MCDMMessage. - * - * The MCDMMessage is filterable and customizable (see MCDMMessageFilter and MCDMPayloadConfiguration). - */ - | 'MCDM'; - -export interface SubscriptionCreationRequest { - topic: SubscriptionTopic; - description?: string; - messageFilter?: SubscriptionMessageFilter; - payloadConfiguration?: SubscriptionPayloadConfiguration; - queueName?: QueueName; -} - -export interface SubscriptionPauseRequest { - uuid: UUID; - heartbeatEnabled?: boolean; -} - -export interface SubscriptionPauseReply extends Reply { - data: {}; -} - -export interface SubscriptionResumeRequest { - uuid: UUID; -} - -export interface SubscriptionResumeReply extends Reply { - data: {}; -} - -export interface SubscriptionDeletionRequest { - uuid: UUID; -} - -export interface SubscriptionDeletionReply extends Reply { - data: {}; -} - -// export type SubscriptionCreationRequest = -// | SubscriptionCreationRequest_FlightData -// | SubscriptionCreationRequest_FlightPlan -// | SubscriptionCreationRequest_EAUP -// | SubscriptionCreationRequest_AIXM_Datasets -// | SubscriptionCreationRequest_ATM_INFORMATION; - -export interface SubscriptionCreationReply extends Reply { - data: SubscriptionCreationReplyData; -} - -export interface SubscriptionCreationReplyData { - subscription: Subscription; -} - -export interface SubscriptionListRequest { - states?: NMSet; -} - -export interface SubscriptionListReply extends Reply { - data: SubscriptionListReplyData; -} - -export interface SubscriptionListReplyData { - subscriptions?: NMSet; -} -export interface Subscription { - uuid: UUID; - release: NMRelease; - anuId: AirNavigationUnitId; - queueName: QueueName; - topic: SubscriptionTopic; - state: SubscriptionState; - description?: string; - creationDate: DateTimeSecond; - lastUpdatedBy: string; - lastUpdatedOn: Timestamp; - lastUpdateReason: SubscriptionUpdateReason; - lastUpdateComment?: string; - messageFilter?: SubscriptionMessageFilter; - payloadConfiguration: SubscriptionPayloadConfiguration; - heartbeatEnabled: boolean; -} - -export type SubscriptionState = - | 'ACTIVE' - | 'DELETED' - | 'PAUSED' - | 'SUSPENDED_ACTIVE' - | 'SUSPENDED_PAUSED'; - -export type SubscriptionUpdateReason = - | 'USER_REQUEST' - | 'MSG_EXPIRED' - | 'MAINTENANCE' - | 'NM_UPDATE' - | 'QUEUE_OVERFLOW'; - -export type SubscriptionMessageFilter = - | AIXMDatasetMessageFilter - | FlightPlanMessageFilter - | RegulationMessageFilter - | FlightFilingResultMessageFilter - | FlightDataMessageFilter; - -export interface SubscriptionCreationRequest_FlightData { - topic: 'FLIGHT_DATA'; - description?: string; - 'messageFilter-FlightDataMessageFilter': FlightDataMessageFilter; - 'payloadConfiguration-FlightDataPayloadConfiguration'?: FlightDataPayloadConfiguration; - queueName?: QueueName; -} - -export interface SubscriptionCreationRequest_FlightPlan { - topic: 'FLIGHT_PLAN'; - description?: string; - 'messageFilter-FlightPlanMessageFilter': NMSet; - 'payloadConfiguration-FlightPlanPayloadConfiguration'?: FlightPlanPayloadConfiguration; - queueName?: QueueName; -} - -export interface SubscriptionCreationRequest_Regulation { - topic: 'REGULATIONS'; - description?: string; - 'messageFilter-RegulationMessageFilter'?: NMSet; - 'payloadConfiguration-RegulationPayloadConfiguration'?: RegulationPayloadConfiguration; - queueName?: QueueName; -} - -export interface SubscriptionCreationRequest_EAUP { - topic: 'EAUP'; - description?: string; - 'payloadConfiguration-EAUPPayloadConfiguration'?: EAUPPayloadConfiguration; - queueName?: QueueName; -} - -export interface SubscriptionCreationRequest_AIXM_Datasets { - topic: 'AIXM_DATASETS'; - description?: string; - 'messageFilter-AIXMDatasetMessageFilter'?: NMSet; - queueName?: QueueName; -} - -export interface SubscriptionCreationRequest_ATM_INFORMATION { - topic: 'ATM_INFORMATION'; - description?: string; - queueName?: QueueName; -} - -export interface AIXMDatasetMessageFilter { - datasetTypes: any[]; -} - -export interface FlightPlanMessageFilter { - events?: any[]; // FlightPlanEventType - flightSet: object[]; // FlightSetDefinitionElement -} - -export interface FlightDataMessageFilter { - flightSet: NMSet; -} - -export interface FlightFilingResultMessageFilter { - originatorAnuId: AirNavigationUnitId; -} - -export interface RegulationMessageFilter { - tvs?: any[]; // TrafficVolumeIdWildcard - tvSets?: any[]; // TrafficVolumeSetIdWildcard -} - -export interface FlightSetDefinitionElement { - aircraftOperators?: any[]; // AircraftOperatorIATAId - aircraftRegistrations?: any[]; // AircraftRegistrationMark - aerodromesOfDeparture?: any[]; // AerodromeIATAOrICAOId - aerodromesOfArrival?: any[]; // AerodromeIATAOrICAOId - anuIds?: any[]; // AirNavigationUnitId - flightPlanOriginators?: any[]; // AirNavigationUnitId -} - -export type SubscriptionPayloadConfiguration = - | FlightPlanPayloadConfiguration - | EAUPPayloadConfiguration - | FlightDataPayloadConfiguration - | RegulationPayloadConfiguration; - -export interface FlightPlanPayloadConfiguration { - flightPlanFormat: FlightExchangeModel; -} - -export interface EAUPPayloadConfiguration { - includeCDROpeningsClosures: boolean; - includeRSAAllocations: boolean; -} - -export interface FlightDataPayloadConfiguration { - flightFields: PSFlightField[]; -} - -export interface RegulationPayloadConfiguration { - regulationFields: RegulationField[]; -} - -export type PSFlightField = - | 'aircraftType' - | 'aircraftOperator' - | 'operatingAircraftOperator' - | 'icaoRoute' - | 'filedRegistrationMark' - | 'lateFiler' - | 'lateUpdater' - | 'estimatedTakeOffTime' - | 'calculatedTakeOffTime' - | 'actualTakeOffTime' - | 'ctotLimitReason' - | 'currentlyUsedTaxiTime' - | 'suspensionStatus' - | 'readyStatus' - | 'cdm' - | 'exemptedFromRegulations' - | 'delay' - | 'mostPenalisingRegulation' - | 'mostPenalisingRegulationCause' - | 'hasOtherRegulations' - | 'regulationLocations' - | 'targetTimeOverFix' - | 'excludedRegulations' - | 'divertedAerodromeOfDestination' - | 'estimatedTimeOfArrival' - | 'calculatedTimeOfArrival' - | 'actualTimeOfArrival' - | 'arrivalInformation' - | 'flightState' - | 'confirmedCTFM' - | 'lastKnownPosition' - | 'highestModelPointProfile' - | 'highestModelAirspaceProfile' - | 'aircraftAddress' - | 'flightDataVersionNr' - | 'bestReroutingIndicator'; diff --git a/src/config.test.ts b/src/config.test.ts index 99c3082..d37b737 100644 --- a/src/config.test.ts +++ b/src/config.test.ts @@ -5,13 +5,13 @@ import { test, expect, describe } from 'vitest'; describe('getEndpoint', () => { test('without flavour', () => { expect(getEndpoint()).toMatchInlineSnapshot( - `"https://www.b2b.nm.eurocontrol.int/B2B_OPS/gateway/spec/26.0.0"`, + `"https://www.b2b.nm.eurocontrol.int/B2B_OPS/gateway/spec/27.0.0"`, ); }); test('with flavour', () => { expect(getEndpoint({ flavour: 'OPS' })).toMatchInlineSnapshot( - `"https://www.b2b.nm.eurocontrol.int/B2B_OPS/gateway/spec/26.0.0"`, + `"https://www.b2b.nm.eurocontrol.int/B2B_OPS/gateway/spec/27.0.0"`, ); }); }); diff --git a/src/constants.ts b/src/constants.ts index 44a2cba..fda00d8 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1,7 +1,7 @@ import path from 'path'; export type B2BFlavour = 'OPS' | 'PREOPS'; -export const B2B_VERSION = '26.0.0'; +export const B2B_VERSION = '27.0.0'; export const B2BFlavours = ['OPS', 'PREOPS']; export const getWSDLPath = ({ diff --git a/src/index.test.ts b/src/index.test.ts index 3fb14ed..70e7f6a 100644 --- a/src/index.test.ts +++ b/src/index.test.ts @@ -5,7 +5,6 @@ import { makeFlightClient, makeGeneralInformationClient, makeAirspaceClient, - makePublishSubscribeClient, } from '.'; import { Config } from './config'; @@ -20,7 +19,6 @@ describe('Main API', () => { expect(b2bClient.Flight).toBeDefined(); expect(b2bClient.Flow).toBeDefined(); expect(b2bClient.GeneralInformation).toBeDefined(); - expect(b2bClient.PublishSubscribe).toBeDefined(); }); test.each([ @@ -28,7 +26,6 @@ describe('Main API', () => { makeFlowClient, makeFlightClient, makeGeneralInformationClient, - makePublishSubscribeClient, ])('%O', async (fn) => { const res = await fn(b2bOptions); expect(res).toBeDefined(); diff --git a/src/index.ts b/src/index.ts index 95fa79e..783aba7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -7,10 +7,7 @@ const debug = d(); import { getAirspaceClient, AirspaceService } from './Airspace'; import { getFlightClient, FlightService } from './Flight'; -import { - getPublishSubscribeClient, - PublishSubscribeService, -} from './PublishSubscribe'; + import { getFlowClient, FlowService } from './Flow'; import { getGeneralInformationClient, @@ -19,7 +16,6 @@ import { export { AirspaceService } from './Airspace'; export { FlightService } from './Flight'; -export { PublishSubscribeService } from './PublishSubscribe'; export { FlowService } from './Flow'; export { GeneralInformationService } from './GeneralInformation'; export { NMB2BError } from './utils/NMB2BError'; @@ -27,7 +23,6 @@ export { NMB2BError } from './utils/NMB2BError'; export interface B2BClient { Airspace: AirspaceService; Flight: FlightService; - PublishSubscribe: PublishSubscribeService; Flow: FlowService; GeneralInformation: GeneralInformationService; } @@ -62,7 +57,6 @@ export async function makeB2BClient(args: InputOptions): Promise { return Promise.all([ getAirspaceClient(options), getFlightClient(options), - getPublishSubscribeClient(options), getFlowClient(options), getGeneralInformationClient(options), ]) @@ -70,10 +64,9 @@ export async function makeB2BClient(args: InputOptions): Promise { debug('Successfully created B2B Client'); return res; }) - .then(([Airspace, Flight, PublishSubscribe, Flow, GeneralInformation]) => ({ + .then(([Airspace, Flight, Flow, GeneralInformation]) => ({ Airspace, Flight, - PublishSubscribe, Flow, GeneralInformation, })); @@ -160,24 +153,3 @@ export async function makeGeneralInformationClient( return res; }); } - -export async function makePublishSubscribeClient( - args: InputOptions, -): Promise { - const options = { ...defaults, ...args }; - debug('Instantiating B2B PublishSubscribe client ...'); - - if (!isConfigValid(options)) { - debug('Invalid options provided'); - throw new Error('Invalid options provided'); - } - - debug('Config is %o', obfuscate(options)); - - await downloadWSDL(options); - - return getPublishSubscribeClient(options).then((res) => { - debug('Successfully created B2B PublishSubscribe client'); - return res; - }); -} diff --git a/src/types.ts b/src/types.ts index 337c75a..1b9613e 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,7 +1,6 @@ export { B2BClient } from './'; export { AirspaceService } from './Airspace'; export { FlightService } from './Flight'; -export { PublishSubscribeService } from './PublishSubscribe'; export { FlowService } from './Flow'; export { GeneralInformationService } from './GeneralInformation'; @@ -83,14 +82,3 @@ export { } from './Flow/retrieveSectorConfigurationPlan'; // GeneralInformation - -// PublishSubscribe -export { - SubscriptionCreationRequest, - SubscriptionCreationReply, -} from './PublishSubscribe/createSubscription'; - -export { - SubscriptionListRequest, - SubscriptionListReply, -} from './PublishSubscribe/listSubscriptions'; diff --git a/src/utils/xsd/lockfile.test.ts b/src/utils/xsd/lockfile.test.ts index 1b9f65a..e2c1f55 100644 --- a/src/utils/xsd/lockfile.test.ts +++ b/src/utils/xsd/lockfile.test.ts @@ -35,7 +35,7 @@ test('should prevent concurrent downloads', async () => { .reply(200, fs.readFileSync(TEST_FILE)); const soap = nock(root.origin) - .post('/B2B_PREOPS/gateway/spec/26.0.0') + .post('/B2B_PREOPS/gateway/spec/27.0.0') .reply( 200, ` diff --git a/tests/test.tar.gz b/tests/test.tar.gz index 33ed7d3..4128864 100644 Binary files a/tests/test.tar.gz and b/tests/test.tar.gz differ