@dgac/nmb2b-client
Version:
EUROCONTROL Network Manager B2B SOAP client
87 lines (84 loc) • 2.44 kB
JavaScript
;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/utils/index.ts
var utils_exports = {};
__export(utils_exports, {
NMB2BError: () => NMB2BError,
extractReferenceLocation: () => extractReferenceLocation
});
module.exports = __toCommonJS(utils_exports);
// src/utils/NMB2BError.ts
var NMB2BError = class extends Error {
constructor({
reply
}) {
super();
if (reply.requestId) {
this.requestId = reply.requestId;
}
if (reply.requestReceptionTime) {
this.requestReceptionTime = reply.requestReceptionTime;
}
if (reply.sendTime) {
this.sendTime = reply.sendTime;
}
if (reply.inputValidationErrors) {
this.inputValidationErrors = reply.inputValidationErrors;
}
if (reply.warnings) {
this.warnings = reply.warnings;
}
if (reply.slaError) {
this.slaError = reply.slaError;
}
if (reply.reason) {
this.reason = reply.reason;
}
this.status = reply.status;
this.message = this.status;
if (this.reason) {
this.message = `${this.message}: ${this.reason}`;
}
}
};
// src/utils/extractReferenceLocation.ts
var keys = [
"ReferenceLocationAirspace",
"ReferenceLocationAerodrome",
"ReferenceLocationAerodromeSet",
"ReferenceLocationDbePoint",
"ReferenceLocationPublishedPoint"
];
function extractReferenceLocation(prefix, input) {
if (!input) {
return;
}
for (const k of keys) {
const key = `${prefix}-${k}`;
if (key in input) {
return input[key];
}
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
NMB2BError,
extractReferenceLocation
});
//# sourceMappingURL=index.cjs.map