0.2.1 • Published 8 days ago

@cityssm/mto-handler v0.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
8 days ago

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)
0.2.1

8 days ago

0.2.0

2 months ago

0.1.0

2 months ago