@cityssm/mto-handler
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

MTO ARIS Handler for Node

npm (scoped) DeepSource Maintainability codecov Coverage Testing

Generates files compatible with the Ontario Ministry of Transportation's Authorized Requester Information Services (ARIS). Parses files downloaded from ARIS.

Installation

npm install @cityssm/mto-handler

Usage

import fs from 'node:fs/promises'

import { MTOBatchWriter, parseMTOBatchResult } from '@cityssm/mto-handler'

/*
 * Generate a file to send to MTO
 */

const writer = new MTOBatchWriter({
  authorizedUser: 'XXXX',
  includeLabels: false,
  sentDate: '2024-03-19'
})

writer.addBatchEntry({
  issueDate: '2024-01-01',
  ticketNumber: 'TKT12345',
  licencePlateNumber: 'SAMPLE'
})

const fileData = writer.writeBatch()

await fs.writeFile('./path/to/uploadToMto.txt', fileData)

/*
 * Parse data retrieved from MTO
 */

const resultsBuffer = await fs.readFile('./path/to/downloadedFromMto.txt')

const resultsData = resultsBuffer.toString()

const results = await parseMTOBatchResult(resultsData)

Readme

Keywords

Package Sidebar

Install

npm i @cityssm/mto-handler

Weekly Downloads

28

Version

0.2.0

License

MIT

Unpacked Size

38.4 kB

Total Files

18

Last publish

Collaborators

  • dgowans