UNPKG

isoxml

Version:

JavaScript library to parse and generate ISOXML (ISO11783-10) files

76 lines (75 loc) 2.32 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AttachedFile = exports.AttachedFilePreserveEnum = void 0; const constants_1 = require("./constants"); const classRegistry_1 = require("../classRegistry"); const utils_1 = require("../utils"); var AttachedFilePreserveEnum; (function (AttachedFilePreserveEnum) { AttachedFilePreserveEnum["TaskControllerDoesNotNeedToPreserveAttachedFile"] = "1"; AttachedFilePreserveEnum["PreserveOnTaskControllerAndSendBackToFMIS"] = "2"; })(AttachedFilePreserveEnum || (exports.AttachedFilePreserveEnum = AttachedFilePreserveEnum = {})); const ATTRIBUTES = { A: { name: 'FilenameWithExtension', type: 'xs:ID', isPrimaryId: false, isOptional: false, isOnlyV4: undefined, }, B: { name: 'Preserve', type: 'xs:NMTOKEN', isPrimaryId: false, isOptional: false, isOnlyV4: undefined, }, C: { name: 'ManufacturerGLN', type: 'xs:anyURI', isPrimaryId: false, isOptional: false, isOnlyV4: undefined, }, D: { name: 'FileType', type: 'xs:unsignedByte', isPrimaryId: false, isOptional: false, isOnlyV4: undefined, minValue: 1, maxValue: 254, }, E: { name: 'FileVersion', type: 'xs:string', isPrimaryId: false, isOptional: true, isOnlyV4: undefined, }, F: { name: 'FileLength', type: 'xs:unsignedLong', isPrimaryId: false, isOptional: true, isOnlyV4: undefined, minValue: 0, maxValue: 4294967294, }, }; const CHILD_TAGS = {}; class AttachedFile { constructor(attributes, isoxmlManager) { this.attributes = attributes; this.isoxmlManager = isoxmlManager; this.tag = constants_1.TAGS.AttachedFile; } static fromXML(xml, isoxmlManager, internalId, targetClass = AttachedFile) { return (0, utils_1.fromXML)(xml, isoxmlManager, targetClass, ATTRIBUTES, CHILD_TAGS, internalId); } toXML() { return (0, utils_1.toXML)(this, ATTRIBUTES, CHILD_TAGS); } } exports.AttachedFile = AttachedFile; (0, classRegistry_1.registerEntityClass)('main', constants_1.TAGS.AttachedFile, AttachedFile);