smppjs
Version:
Modern approach to smpp protocol.
32 lines • 1.5 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.dataSmDTO = void 0;
const helpers_1 = require("../helpers");
const MAX_LENGTH = {
service_type: 6,
source_addr: 21,
destination_addr: 21,
};
const dataSmDTO = ({ destinationAddr, dataCoding, esmClass, systemTypeValue, sourceAddrTon, sourceAddrNpi, sourceAddr, destAddrTon, destAddrNpi, registeredDelivery, tlvs, }) => {
const dto = {
command: {
service_type: { type: 'Cstring', value: systemTypeValue || '' },
source_addr_ton: { type: 'Int8', value: sourceAddrTon || 0 },
source_addr_npi: { type: 'Int8', value: sourceAddrNpi || 0 },
source_addr: { type: 'Cstring', value: sourceAddr || '' },
dest_addr_ton: { type: 'Int8', value: destAddrTon || 0 },
dest_addr_npi: { type: 'Int8', value: destAddrNpi || 0 },
destination_addr: { type: 'Cstring', value: destinationAddr },
esm_class: { type: 'Int8', value: esmClass },
registered_delivery: { type: 'Int8', value: registeredDelivery || 0 },
data_coding: { type: 'Int8', value: dataCoding },
},
tlvs: {
message_payload: { type: 'Cstring', value: (tlvs === null || tlvs === void 0 ? void 0 : tlvs.messagePayload) || '', encode: 'ascii' },
},
};
(0, helpers_1.dtoValidation)({ dto, MAX_LENGTH });
return dto;
};
exports.dataSmDTO = dataSmDTO;
//# sourceMappingURL=data_sm.js.map