UNPKG

@mojaloop/ml-schema-transformer-lib

Version:
114 lines (113 loc) 3.32 kB
"use strict"; 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/types/type-guards.ts var type_guards_exports = {}; __export(type_guards_exports, { TypeGuards: () => TypeGuards, isContextLogger: () => isContextLogger }); module.exports = __toCommonJS(type_guards_exports); var isContextLogger = (logger) => { return "info" in logger && "error" in logger && "warn" in logger && "verbose" in logger && "debug" in logger && "silly" in logger && "audit" in logger && "trace" in logger; }; var baseFspiopGuards = { isSource: (source) => { return !!source.body; } }; var baseIsoGuards = { isSource: (source) => { return !!source.body; } }; var FSPIOP = { parties: { put: { isSource: (source) => { return !!(source.body && (source.headers?.["fspiop-source"] && source.headers["fspiop-destination"]) && (source.params.IdPath || source.params?.Type && source.params.ID)); } }, putError: { isSource: (source) => { return !!(source.body && (source.headers?.["fspiop-source"] && source.headers["fspiop-destination"]) && (source.params.IdPath || source.params?.Type && source.params.ID)); } } }, quotes: { post: baseFspiopGuards, put: { isSource: (source) => { return !!(source.body && source.params?.ID && (source.$context?.isoPostQuote || source.headers?.["fspiop-source"] && source.headers["fspiop-destination"])); } }, putError: baseFspiopGuards }, transfers: { post: baseFspiopGuards, patch: baseFspiopGuards, put: baseFspiopGuards, putError: baseFspiopGuards }, fxQuotes: { post: baseFspiopGuards, put: baseFspiopGuards, putError: baseFspiopGuards }, fxTransfers: { post: baseFspiopGuards, patch: baseFspiopGuards, put: baseFspiopGuards, putError: baseFspiopGuards } }; var FSPIOPISO20022 = { parties: { put: baseIsoGuards, putError: baseIsoGuards }, quotes: { post: baseIsoGuards, put: baseIsoGuards, putError: baseIsoGuards }, transfers: { post: baseIsoGuards, patch: baseIsoGuards, put: baseIsoGuards, putError: baseIsoGuards }, fxQuotes: { post: baseIsoGuards, put: baseIsoGuards, putError: baseIsoGuards }, fxTransfers: { post: baseIsoGuards, patch: baseIsoGuards, put: baseIsoGuards, putError: baseIsoGuards } }; var TypeGuards = { FSPIOP, FSPIOPISO20022 }; // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { TypeGuards, isContextLogger }); //# sourceMappingURL=type-guards.js.map