UNPKG

@dgac/nmb2b-client

Version:

EUROCONTROL Network Manager B2B SOAP client

128 lines (124 loc) 4.88 kB
import { Primitive, OptionalKeysOf } from 'type-fest'; type SoapDeserializer<TInput> = TInput extends Primitive | Date ? TInput : TInput extends Array<infer T> ? Array<Exclude<SoapDeserializer<T>, null | undefined>> | null | undefined : EmptyObjectToNullish<{ [TKey in keyof TInput]: SoapDeserializer<TInput[TKey]>; }>; type EmptyObjectToNullish<T extends object> = Exclude<keyof T, NullishKeysOf<T>> extends never ? T | null | undefined : T; type NullishKeysOf<T extends object> = UndefinedKeysOf<T> | NullKeysOf<T> | OptionalKeysOf<T>; type UndefinedKeysOf<T extends object> = keyof { [TKey in keyof T as undefined extends T[TKey] ? TKey : never]: T[TKey]; }; type NullKeysOf<T extends object> = keyof { [TKey in keyof T as null extends T[TKey] ? TKey : never]: T[TKey]; }; type DateYearMonthDay = Date; type DateTimeMinute = Date; type DateTimeSecond = Date; interface ShiftHourMinute { sign: 'MINUS' | 'PLUS'; value: DurationHourMinute; } type NMB2BVersion = string; interface File { id: FileId; type: FileType; releaseTime: DateTimeSecond; fileLength: number; } type Cost = number; type FileId = string; type FileType = string; type AirNavigationUnitId = string; type UserId = string; type PlanDataId = string; type Colours = string; type SignedDurationHourMinuteSecond = string; interface NMSet<A> { item: A[]; } interface NMList<A> { item: A[]; } interface NMMap<K, V> { item: Array<{ key: K; value: V; }>; } type DurationHourMinute = number; type DurationMinute = number; type DurationHourMinuteSecond = number; type Duration = number; interface DateYearMonthDayPeriod { wef?: DateYearMonthDay; unt?: DateYearMonthDay; } interface DateTimeMinutePeriod { wef: DateTimeMinute; unt: DateTimeMinute; } type TimeHourMinute = string; interface TimeHourMinutePeriod { wef: TimeHourMinute; unt: TimeHourMinute; } interface LastUpdate { timestamp: DateTimeSecond; userId: UserId; airNavigationUnitId?: AirNavigationUnitId; } type WeightKg = number; type FlightLevelM = number; interface Position { latitude: Latitude; longitude: Longitude; } interface Latitude { angle: string; side: LatitudeSide; } type LatitudeSide = string; interface Longitude { angle: string; side: LongitudeSide; } type LongitudeSide = string; type DatasetType = 'FORECAST' | 'OPERATIONAL' | 'SIMULATION'; type SimulationId = string; type SimulationState = 'INITIAL' | 'CURRENT'; interface Dataset { type: DatasetType; simulationIdentifier?: SimulationId; simulationState?: SimulationState; } type ReceivedOrSent = 'RECEIVED' | 'SENT' | 'UNKNOWN'; type DistanceM = number; type DistanceNM = number; type Bearing = number; type ReplyStatus = 'OK' | 'INVALID_INPUT' | 'INVALID_OUTPUT' | 'INTERNAL_ERROR' | 'SERVICE_UNAVAILABLE' | 'RESOURCE_OVERLOAD' | 'REQUEST_COUNT_QUOTA_EXCEEDED' | 'PARALLEL_REQUEST_COUNT_QUOTA_EXCEEDED' | 'REQUEST_OVERBOOKING_REJECTED' | 'BANDWIDTH_QUOTAS_EXCEEDED' | 'NOT_AUTHORISED' | 'OBJECT_NOT_FOUND' | 'TOO_MANY_RESULTS' | 'OBJECT_EXISTS' | 'OBJECT_OUTDATED' | 'CONFLICTING_UPDATE' | 'INVALID_DATASET'; interface Reply { requestReceptionTime?: DateTimeSecond; requestId?: string; sendTime?: DateTimeSecond; status: ReplyStatus; inputValidationErrors?: B2B_Error[]; outputValidationErrors?: B2B_Error[]; warnings?: B2B_Error[]; slaError?: B2B_Error; reason?: string; } type ReplyWithData<TData = never> = Reply & { data: SoapDeserializer<TData>; }; type ServiceGroup = 'AIRSPACE' | 'COMMON' | 'FFICE' | 'FLIGHT' | 'FLOW' | 'GENERAL_INFORMATION' | 'PUBLISH_SUBSCRIBE'; interface B2B_Error { attributes?: string[]; group: ServiceGroup; category: string; type: ErrorType; parameters: { [key: string]: string; }; message?: string; } type ErrorType = 'UNSUPPORTED_VERSION' | 'ATTRIBUTE_CANNOT_BE_NULL' | 'ATTRIBUTE_MUST_BE_NULL' | 'INVALID_COLLECTION_SIZE' | 'INVALID_ATTRIBUTE_VALUE' | 'MISSING_CHOICE_VALUE' | 'CHOICE_OVERFLOW' | 'REQUESTED_ATTRIBUTE_NOT_ALLOWED' | 'REPLY_ATTRIBUTE_NOT_SET' | 'REQUEST_COUNT_QUOTA_EXCEEDED' | 'REQUEST_OVERBOOKING_ACCEPTED' | 'UNKNOWN'; export type { AirNavigationUnitId as A, B2B_Error as B, Cost as C, DateTimeMinutePeriod as D, FlightLevelM as F, LastUpdate as L, NMMap as N, PlanDataId as P, ReplyWithData as R, SoapDeserializer as S, TimeHourMinutePeriod as T, UserId as U, WeightKg as W, DurationHourMinute as a, Dataset as b, DateYearMonthDay as c, NMSet as d, DateTimeSecond as e, DateTimeMinute as f, DistanceM as g, Duration as h, DurationMinute as i, ShiftHourMinute as j, ReceivedOrSent as k, DistanceNM as l, NMList as m, SignedDurationHourMinuteSecond as n, Colours as o, DurationHourMinuteSecond as p, Position as q, NMB2BVersion as r, File as s, ReplyStatus as t, Reply as u, Bearing as v, DateYearMonthDayPeriod as w };