Skip to content

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

License

Notifications You must be signed in to change notification settings

cityssm/node-mto-handler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)

About

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

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks