transit-departures-widget 2.7.2 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/app/index.d.ts +1 -2
- package/dist/app/index.js +81 -552
- package/dist/app/index.js.map +1 -1
- package/dist/bin/transit-departures-widget.d.ts +1 -1
- package/dist/bin/transit-departures-widget.js +23 -638
- package/dist/bin/transit-departures-widget.js.map +1 -1
- package/dist/browser/THIRD_PARTY_LICENSES.txt +87 -0
- package/dist/browser/pbf.js +1 -0
- package/dist/index.d.ts +29 -26
- package/dist/index.js +2 -590
- package/dist/src-D_ggoL9P.js +55 -0
- package/dist/src-D_ggoL9P.js.map +1 -0
- package/dist/utils-BxiS6d7j.js +368 -0
- package/dist/utils-BxiS6d7j.js.map +1 -0
- package/package.json +11 -12
- package/dist/frontend_libraries/pbf.js +0 -1
- package/dist/index.js.map +0 -1
- /package/dist/{frontend_libraries → browser}/accessible-autocomplete.min.css +0 -0
- /package/dist/{frontend_libraries → browser}/accessible-autocomplete.min.js +0 -0
- /package/dist/{frontend_libraries → browser}/gtfs-realtime.browser.proto.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/bin/transit-departures-widget.ts","../../src/lib/file-utils.ts","../../src/lib/logging/log.ts","../../src/lib/transit-departures-widget.ts","../../src/lib/config/defaults.ts","../../src/lib/utils.ts","../../src/lib/logging/messages.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport yargs from 'yargs'\nimport { hideBin } from 'yargs/helpers'\nimport PrettyError from 'pretty-error'\n\nimport { getConfig } from '../lib/file-utils.ts'\nimport { formatError } from '../lib/logging/log.ts'\nimport transitDeparturesWidget from '../index.ts'\n\nconst pe = new PrettyError()\n\nconst argv = yargs(hideBin(process.argv))\n .usage('Usage: $0 --config ./config.json')\n .help()\n .option('c', {\n alias: 'configPath',\n describe: 'Path to config file',\n default: './config.json',\n type: 'string',\n })\n .option('s', {\n alias: 'skipImport',\n describe: 'Don’t import GTFS file.',\n type: 'boolean',\n })\n .default('skipImport', undefined)\n .parseSync()\n\nconst handleError = (error: any) => {\n const text = error || 'Unknown Error'\n process.stdout.write(`\\n${formatError(text)}\\n`)\n console.error(pe.render(error))\n process.exit(1)\n}\n\nconst setupImport = async () => {\n const config = await getConfig(argv)\n await transitDeparturesWidget(config)\n process.exit()\n}\n\nsetupImport().catch(handleError)\n","import { dirname, join, resolve } from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport {\n access,\n cp,\n copyFile,\n mkdir,\n readdir,\n readFile,\n rm,\n} from 'node:fs/promises'\nimport beautify from 'js-beautify'\nimport pug from 'pug'\nimport untildify from 'untildify'\n\nimport { Config } from '../types/global_interfaces.ts'\n\n/*\n * Attempt to parse the specified config JSON file.\n */\nexport async function getConfig(argv) {\n try {\n const data = await readFile(\n resolve(untildify(argv.configPath)),\n 'utf8',\n ).catch((error) => {\n console.error(\n new Error(\n `Cannot find configuration file at \\`${argv.configPath}\\`. Use config-sample.json as a starting point, pass --configPath option`,\n ),\n )\n throw error\n })\n const config = JSON.parse(data)\n\n if (argv.skipImport === true) {\n config.skipImport = argv.skipImport\n }\n\n return config\n } catch (error) {\n console.error(\n new Error(\n `Cannot parse configuration file at \\`${argv.configPath}\\`. Check to ensure that it is valid JSON.`,\n ),\n )\n throw error\n }\n}\n\n/*\n * Get the full path to this module's folder.\n */\nexport function getPathToThisModuleFolder() {\n const __dirname = dirname(fileURLToPath(import.meta.url))\n\n // Dynamically calculate the path to this module's folder\n let distFolderPath\n if (__dirname.endsWith('/dist/bin') || __dirname.endsWith('/dist/app')) {\n // When the file is in 'dist/bin' or 'dist/app'\n distFolderPath = resolve(__dirname, '../../')\n } else if (__dirname.endsWith('/dist')) {\n // When the file is in 'dist'\n distFolderPath = resolve(__dirname, '../')\n } else {\n // In case it's neither, fallback to project root\n distFolderPath = resolve(__dirname, '../../')\n }\n\n return distFolderPath\n}\n\n/*\n * Get the full path to the views folder.\n */\nexport function getPathToViewsFolder(config: Config) {\n if (config.templatePath) {\n return untildify(config.templatePath)\n }\n\n return join(getPathToThisModuleFolder(), 'views/widget')\n}\n\n/*\n * Get the full path of a template file.\n */\nfunction getPathToTemplateFile(templateFileName: string, config: Config) {\n const fullTemplateFileName =\n config.noHead !== true\n ? `${templateFileName}_full.pug`\n : `${templateFileName}.pug`\n\n return join(getPathToViewsFolder(config), fullTemplateFileName)\n}\n\n/*\n * Prepare the outputPath directory for writing timetable files.\n */\nexport async function prepDirectory(outputPath: string, config: Config) {\n // Check if outputPath exists\n try {\n await access(outputPath)\n } catch (error: any) {\n try {\n await mkdir(outputPath, { recursive: true })\n await mkdir(join(outputPath, 'data'))\n } catch (error: any) {\n if (error?.code === 'ENOENT') {\n throw new Error(\n `Unable to write to ${outputPath}. Try running this command from a writable directory.`,\n )\n }\n\n throw error\n }\n }\n\n // Check if outputPath is empty\n const files = await readdir(outputPath)\n if (config.overwriteExistingFiles === false && files.length > 0) {\n throw new Error(\n `Output directory ${outputPath} is not empty. Please specify an empty directory.`,\n )\n }\n\n // Delete all files in outputPath if `overwriteExistingFiles` is true\n if (config.overwriteExistingFiles === true) {\n await rm(join(outputPath, '*'), { recursive: true, force: true })\n }\n}\n\n/*\n * Copy needed CSS and JS to export path.\n */\nexport async function copyStaticAssets(config: Config, outputPath: string) {\n const viewsFolderPath = getPathToViewsFolder(config)\n const thisModuleFolderPath = getPathToThisModuleFolder()\n\n const foldersToCopy = ['css', 'js']\n\n for (const folder of foldersToCopy) {\n if (\n await access(join(viewsFolderPath, folder))\n .then(() => true)\n .catch(() => false)\n ) {\n await cp(join(viewsFolderPath, folder), join(outputPath, folder), {\n recursive: true,\n })\n }\n }\n\n // Copy js and css libraries from node_modules\n await copyFile(\n join(thisModuleFolderPath, 'dist/frontend_libraries/pbf.js'),\n join(outputPath, 'js/pbf.js'),\n )\n\n await copyFile(\n join(\n thisModuleFolderPath,\n 'dist/frontend_libraries/gtfs-realtime.browser.proto.js',\n ),\n join(outputPath, 'js/gtfs-realtime.browser.proto.js'),\n )\n\n await copyFile(\n join(\n thisModuleFolderPath,\n 'dist/frontend_libraries/accessible-autocomplete.min.js',\n ),\n join(outputPath, 'js/accessible-autocomplete.min.js'),\n )\n\n await copyFile(\n join(\n thisModuleFolderPath,\n 'dist/frontend_libraries/accessible-autocomplete.min.css',\n ),\n join(outputPath, 'css/accessible-autocomplete.min.css'),\n )\n}\n\n/*\n * Render the HTML based on the config.\n */\nexport async function renderFile(\n templateFileName: string,\n templateVars: any,\n config: Config,\n) {\n const templatePath = getPathToTemplateFile(templateFileName, config)\n const html = await pug.renderFile(templatePath, templateVars)\n\n // Beautify HTML if setting is set\n if (config.beautify === true) {\n return beautify.html_beautify(html, { indent_size: 2 })\n }\n\n return html\n}\n","import { clearLine, cursorTo } from 'node:readline'\nimport { noop } from 'lodash-es'\nimport * as colors from 'yoctocolors'\n\nimport { Config } from '../../types/global_interfaces.ts'\n\nexport type Logger = {\n info: (text: string, overwrite?: boolean) => void\n warn: (text: string) => void\n error: (text: string) => void\n}\n\nconst formatWarning = (text: string) => {\n const warningMessage = `${colors.underline('Warning')}: ${text}`\n return colors.yellow(warningMessage)\n}\n\nexport const formatError = (error: any) => {\n const messageText = error instanceof Error ? error.message : error\n const errorMessage = `${colors.underline('Error')}: ${messageText.replace(\n 'Error: ',\n '',\n )}`\n return colors.red(errorMessage)\n}\n\nconst logInfo = (config: Config) => {\n if (config.verbose === false) {\n return noop\n }\n\n if (config.logFunction) {\n return config.logFunction\n }\n\n return (text: string, overwrite?: boolean) => {\n if (overwrite === true && process.stdout.isTTY) {\n clearLine(process.stdout, 0)\n cursorTo(process.stdout, 0)\n } else {\n process.stdout.write('\\n')\n }\n\n process.stdout.write(text)\n }\n}\n\nconst logWarn = (config: Config) => {\n if (config.logFunction) {\n return config.logFunction\n }\n\n return (text: string) => {\n process.stdout.write(`\\n${formatWarning(text)}\\n`)\n }\n}\n\nconst logError = (config: Config) => {\n if (config.logFunction) {\n return config.logFunction\n }\n\n return (text: string) => {\n process.stdout.write(`\\n${formatError(text)}\\n`)\n }\n}\n\n/*\n * Create a structured logger with consistent methods.\n */\nexport function createLogger(config: Config): Logger {\n return {\n info: logInfo(config),\n warn: logWarn(config),\n error: logError(config),\n }\n}\n","import path from 'path'\nimport { clone, omit } from 'lodash-es'\nimport { writeFile } from 'node:fs/promises'\nimport { importGtfs, openDb, type ConfigAgency } from 'gtfs'\nimport sanitize from 'sanitize-filename'\nimport Timer from 'timer-machine'\nimport untildify from 'untildify'\n\nimport { copyStaticAssets, prepDirectory } from './file-utils.ts'\nimport { createLogger } from './logging/log.ts'\nimport { setDefaultConfig } from './config/defaults.ts'\nimport {\n generateTransitDeparturesWidgetHtml,\n generateTransitDeparturesWidgetJson,\n} from './utils.ts'\nimport { Config } from '../types/global_interfaces.ts'\n\n/*\n * Generate transit departures widget HTML from GTFS.\n */\nasync function transitDeparturesWidget(initialConfig: Config) {\n const config = setDefaultConfig(initialConfig)\n const logger = createLogger(config)\n\n try {\n openDb(config)\n } catch (error: any) {\n if (error?.code === 'SQLITE_CANTOPEN') {\n logger.error(\n `Unable to open sqlite database \"${config.sqlitePath}\" defined as \\`sqlitePath\\` config.json. Ensure the parent directory exists or remove \\`sqlitePath\\` from config.json.`,\n )\n }\n\n throw error\n }\n\n if (!config.agency) {\n throw new Error('No agency defined in `config.json`')\n }\n\n const timer = new Timer()\n const agencyKey = config.agency.agency_key ?? 'unknown'\n\n const outputPath = config.outputPath\n ? untildify(config.outputPath)\n : path.join(process.cwd(), 'html', sanitize(agencyKey))\n\n timer.start()\n\n if (!config.skipImport) {\n // Import GTFS\n const gtfsPath = config.agency.gtfs_static_path\n const gtfsUrl = config.agency.gtfs_static_url\n\n if (!gtfsPath && !gtfsUrl) {\n throw new Error(\n 'Missing GTFS source. Set `agency.gtfs_static_path` or `agency.gtfs_static_url` in config.json.',\n )\n }\n\n const agencyImportConfig: ConfigAgency = gtfsPath\n ? { path: gtfsPath }\n : { url: gtfsUrl as string }\n\n const gtfsImportConfig = {\n ...clone(omit(config, 'agency')),\n agencies: [agencyImportConfig],\n }\n\n await importGtfs(gtfsImportConfig)\n }\n\n await prepDirectory(outputPath, config)\n\n if (config.noHead !== true) {\n await copyStaticAssets(config, outputPath)\n }\n\n logger.info(`${agencyKey}: Generating Transit Departures Widget HTML`)\n\n config.assetPath = ''\n\n // Generate JSON of routes and stops\n const { routes, stops } = generateTransitDeparturesWidgetJson(config)\n await writeFile(\n path.join(outputPath, 'data', 'routes.json'),\n JSON.stringify(routes),\n )\n await writeFile(\n path.join(outputPath, 'data', 'stops.json'),\n JSON.stringify(stops),\n )\n\n const html = await generateTransitDeparturesWidgetHtml(config)\n await writeFile(path.join(outputPath, 'index.html'), html)\n\n timer.stop()\n\n // Print stats\n logger.info(\n `${agencyKey}: Transit Departures Widget HTML created at ${outputPath}`,\n )\n\n const seconds = Math.round(timer.time() / 1000)\n logger.info(`${agencyKey}: HTML generation required ${seconds} seconds`)\n}\n\nexport default transitDeparturesWidget\n","import { join } from 'path'\nimport { I18n } from 'i18n'\n\nimport { Config } from '../../types/global_interfaces.ts'\nimport { getPathToViewsFolder } from '../file-utils.ts'\n\n/*\n * Initialize configuration with defaults.\n */\nexport function setDefaultConfig(initialConfig: Config) {\n const defaults = {\n beautify: false,\n noHead: false,\n refreshIntervalSeconds: 20,\n skipImport: false,\n timeFormat: '12hour',\n includeCoordinates: false,\n overwriteExistingFiles: true,\n verbose: true,\n }\n\n const config = Object.assign(defaults, initialConfig)\n const viewsFolderPath = getPathToViewsFolder(config)\n const i18n = new I18n({\n directory: join(viewsFolderPath, 'locales'),\n defaultLocale: config.locale,\n updateFiles: false,\n })\n const configWithI18n = Object.assign(config, {\n __: i18n.__,\n })\n return configWithI18n\n}\n","import { openDb, getDirections, getRoutes, getStops, getTrips } from 'gtfs'\nimport { groupBy, last, maxBy, size, sortBy, uniqBy } from 'lodash-es'\nimport { renderFile } from './file-utils.ts'\nimport sqlString from 'sqlstring-sqlite'\nimport toposort from 'toposort'\n\nimport { Config, SqlWhere, SqlValue } from '../types/global_interfaces.ts'\nimport {\n ConfigWithI18n,\n GTFSCalendar,\n GTFSRoute,\n GTFSRouteDirection,\n GTFSStop,\n} from '../types/gtfs.ts'\nimport { createLogger } from './logging/log.ts'\nimport { messages } from './logging/messages.ts'\nexport { setDefaultConfig } from './config/defaults.ts'\n\n/*\n * Get calendars for a specified date range\n */\nconst getCalendarsForDateRange = (config: Config): GTFSCalendar[] => {\n const db = openDb(config)\n let whereClause = ''\n const whereClauses = []\n\n if (config.endDate) {\n whereClauses.push(`start_date <= ${sqlString.escape(config.endDate)}`)\n }\n\n if (config.startDate) {\n whereClauses.push(`end_date >= ${sqlString.escape(config.startDate)}`)\n }\n\n if (whereClauses.length > 0) {\n whereClause = `WHERE ${whereClauses.join(' AND ')}`\n }\n\n return db.prepare(`SELECT * FROM calendar ${whereClause}`).all()\n}\n\n/*\n * Format a route name.\n */\nfunction formatRouteName(route: GTFSRoute) {\n let routeName = ''\n\n if (route.route_short_name !== null) {\n routeName += route.route_short_name\n }\n\n if (route.route_short_name !== null && route.route_long_name !== null) {\n routeName += ' - '\n }\n\n if (route.route_long_name !== null) {\n routeName += route.route_long_name\n }\n\n return routeName\n}\n\n/*\n * Get directions for a route\n */\nfunction getDirectionsForRoute(route: GTFSRoute, config: ConfigWithI18n) {\n const logger = createLogger(config)\n const db = openDb(config)\n\n // Lookup direction names from non-standard directions.txt file\n const directions = getDirections({ route_id: route.route_id }, [\n 'direction_id',\n 'direction',\n ])\n .filter((direction) => direction.direction_id !== undefined)\n .map((direction) => ({\n direction_id: direction.direction_id as number | string,\n direction: direction.direction,\n }))\n\n const calendars = getCalendarsForDateRange(config)\n if (calendars.length === 0) {\n logger.warn(messages.noActiveCalendarsForRoute(route.route_id))\n return []\n }\n\n // Else use the most common headsigns as directions from trips.txt file\n if (directions.length === 0) {\n const headsigns = db\n .prepare(\n `SELECT direction_id, trip_headsign, count(*) AS count FROM trips WHERE route_id = ? AND service_id IN (${calendars\n .map((calendar: GTFSCalendar) => `'${calendar.service_id}'`)\n .join(', ')}) GROUP BY direction_id, trip_headsign`,\n )\n .all(route.route_id)\n\n for (const group of Object.values(groupBy(headsigns, 'direction_id'))) {\n const mostCommonHeadsign = maxBy(group, 'count')\n directions.push({\n direction_id: mostCommonHeadsign.direction_id,\n direction: config.__('To {{{headsign}}}', {\n headsign: mostCommonHeadsign.trip_headsign,\n }),\n })\n }\n }\n\n return directions\n}\n\n/*\n * Sort an array of stoptimes by stop_sequence using a directed graph\n */\nfunction sortStopIdsBySequence(stoptimes: Record<string, string>[]) {\n const stoptimesGroupedByTrip = groupBy(stoptimes, 'trip_id')\n\n // First, try using a directed graph to determine stop order.\n try {\n const stopGraph = []\n\n for (const tripStoptimes of Object.values(stoptimesGroupedByTrip)) {\n const sortedStopIds = sortBy(tripStoptimes, 'stop_sequence').map(\n (stoptime) => stoptime.stop_id,\n )\n\n for (const [index, stopId] of sortedStopIds.entries()) {\n if (index === sortedStopIds.length - 1) {\n continue\n }\n\n stopGraph.push([stopId, sortedStopIds[index + 1]])\n }\n }\n\n return toposort(\n stopGraph as unknown as readonly [string, string | undefined][],\n )\n } catch {\n // Ignore errors and move to next strategy.\n }\n\n // Finally, fall back to using the stop order from the trip with the most stoptimes.\n const longestTripStoptimes = maxBy(\n Object.values(stoptimesGroupedByTrip),\n (stoptimes) => size(stoptimes),\n )\n\n if (!longestTripStoptimes) {\n return []\n }\n\n return longestTripStoptimes.map((stoptime) => stoptime.stop_id)\n}\n\nfunction getStopsForDirection(\n route: GTFSRoute,\n direction: GTFSRouteDirection,\n config: Config,\n stopCache?: Map<string, GTFSStop>,\n) {\n const logger = createLogger(config)\n const db = openDb(config)\n const calendars = getCalendarsForDateRange(config)\n if (calendars.length === 0) {\n logger.warn(\n messages.noActiveCalendarsForDirection(\n route.route_id,\n direction.direction_id,\n ),\n )\n return []\n }\n const whereClause = formatWhereClauses({\n direction_id: direction.direction_id,\n route_id: route.route_id,\n service_id: calendars.map((calendar: GTFSCalendar) => calendar.service_id),\n })\n const stoptimes = db\n .prepare(\n `SELECT stop_id, stop_sequence, trip_id FROM stop_times WHERE trip_id IN (SELECT trip_id FROM trips ${whereClause}) ORDER BY stop_sequence ASC`,\n )\n .all()\n\n const sortedStopIds = sortStopIdsBySequence(stoptimes)\n\n const deduplicatedStopIds = sortedStopIds.reduce(\n (memo: string[], stopId: string) => {\n // Remove duplicated stop_ids in a row\n if (last(memo) !== stopId) {\n memo.push(stopId)\n }\n\n return memo\n },\n [],\n )\n\n // Remove last stop of route since boarding is not allowed\n deduplicatedStopIds.pop()\n\n // Fetch stop details\n const stopFields: (keyof GTFSStop)[] = [\n 'stop_id',\n 'stop_name',\n 'stop_code',\n 'parent_station',\n ]\n\n if (config.includeCoordinates) {\n stopFields.push('stop_lat', 'stop_lon')\n }\n\n const missingStopIds = stopCache\n ? deduplicatedStopIds.filter((stopId) => !stopCache.has(stopId))\n : deduplicatedStopIds\n\n const fetchedStops = missingStopIds.length\n ? (getStops as unknown as (query: any, fields?: any) => GTFSStop[])(\n { stop_id: missingStopIds },\n stopFields,\n )\n : []\n\n if (stopCache) {\n for (const stop of fetchedStops) {\n stopCache.set(stop.stop_id, stop)\n }\n }\n\n return deduplicatedStopIds\n .map((stopId: string) => {\n const stop =\n stopCache?.get(stopId) ??\n fetchedStops.find((candidate) => candidate.stop_id === stopId)\n\n if (!stop) {\n logger.warn(\n messages.stopNotFound(route.route_id, direction.direction_id, stopId),\n )\n }\n\n return stop\n })\n .filter(Boolean) as GTFSStop[]\n}\n\n/*\n * Generate HTML for transit departures widget.\n */\nexport function generateTransitDeparturesWidgetHtml(config: ConfigWithI18n) {\n const templateVars = {\n config,\n __: config.__,\n }\n return renderFile('widget', templateVars, config)\n}\n\n/*\n * Generate JSON of routes and stops for transit departures widget.\n */\nexport function generateTransitDeparturesWidgetJson(config: ConfigWithI18n) {\n const logger = createLogger(config)\n const calendars = getCalendarsForDateRange(config)\n if (calendars.length === 0) {\n logger.warn(messages.noActiveCalendarsGlobal)\n return { routes: [], stops: [] }\n }\n\n const routes = getRoutes() as GTFSRoute[]\n const stops: GTFSStop[] = []\n const filteredRoutes: GTFSRoute[] = []\n const stopCache = new Map<string, GTFSStop>()\n\n for (const route of routes) {\n const routeWithFullName: GTFSRoute = {\n ...route,\n route_full_name: formatRouteName(route),\n }\n\n const directions = getDirectionsForRoute(routeWithFullName, config)\n\n // Filter out routes with no directions\n if (directions.length === 0) {\n logger.warn(messages.routeHasNoDirections(route.route_id))\n continue\n }\n\n const directionsWithData = directions\n .map((direction) => {\n const directionStops = getStopsForDirection(\n routeWithFullName,\n direction,\n config,\n stopCache,\n )\n\n if (directionStops.length === 0) {\n return null\n }\n\n stops.push(...directionStops)\n\n const trips = getTrips(\n {\n route_id: route.route_id,\n direction_id: direction.direction_id,\n service_id: calendars.map(\n (calendar: GTFSCalendar) => calendar.service_id,\n ),\n },\n ['trip_id'],\n )\n\n return {\n ...direction,\n stopIds: directionStops.map((stop) => stop.stop_id),\n tripIds: trips.map((trip) => trip.trip_id),\n }\n })\n .filter(Boolean) as GTFSRouteDirection[]\n\n if (directionsWithData.length === 0) {\n continue\n }\n\n filteredRoutes.push({\n ...routeWithFullName,\n directions: directionsWithData,\n })\n }\n\n // Sort routes deterministically, handling mixed numeric/alphanumeric IDs\n const sortedRoutes = [...filteredRoutes].sort((a, b) => {\n const aShort = a.route_short_name ?? ''\n const bShort = b.route_short_name ?? ''\n const aNum = Number.parseInt(aShort, 10)\n const bNum = Number.parseInt(bShort, 10)\n\n if (!Number.isNaN(aNum) && !Number.isNaN(bNum) && aNum !== bNum) {\n return aNum - bNum\n }\n\n if (Number.isNaN(aNum) && !Number.isNaN(bNum)) {\n return 1\n }\n\n if (!Number.isNaN(aNum) && Number.isNaN(bNum)) {\n return -1\n }\n\n return aShort.localeCompare(bShort, undefined, {\n numeric: true,\n sensitivity: 'base',\n })\n })\n\n // Get Parent Station Stops\n const parentStationIds = new Set(stops.map((stop) => stop.parent_station))\n\n const parentStationStops = getStops(\n { stop_id: Array.from(parentStationIds) },\n ['stop_id', 'stop_name', 'stop_code', 'parent_station'],\n )\n\n stops.push(\n ...parentStationStops.map((stop) => ({\n ...stop,\n is_parent_station: true,\n })),\n )\n\n // Sort unique list of stops\n const sortedStops = sortBy(uniqBy(stops, 'stop_id'), 'stop_name')\n\n return {\n routes: arrayOfArrays(removeNulls(sortedRoutes)),\n stops: arrayOfArrays(removeNulls(sortedStops)),\n }\n}\n\n/*\n * Remove null values from array or object\n */\nfunction removeNulls(data: any): any {\n if (Array.isArray(data)) {\n return data\n .map(removeNulls)\n .filter((item) => item !== null && item !== undefined)\n } else if (\n data !== null &&\n typeof data === 'object' &&\n Object.getPrototypeOf(data) === Object.prototype\n ) {\n return Object.entries(data).reduce<Record<string, unknown>>(\n (acc, [key, value]) => {\n const cleanedValue = removeNulls(value)\n if (cleanedValue !== null && cleanedValue !== undefined) {\n acc[key] = cleanedValue\n }\n return acc\n },\n {},\n )\n } else {\n return data\n }\n}\n\n/*\n * Convert an array of objects into an Array-of-arrays JSON: { \"fields\": [...], \"rows\": [[...], ...] }\n */\nfunction arrayOfArrays(array: any[]): { fields: string[]; rows: any[][] } {\n if (array.length === 0) {\n return { fields: [], rows: [] }\n }\n\n const fields: string[] = Array.from(\n array.reduce<Set<string>>((fieldSet, item) => {\n Object.keys(item ?? {}).forEach((key) => fieldSet.add(key))\n return fieldSet\n }, new Set<string>()),\n )\n\n return {\n fields,\n rows: array.map((item) => fields.map((field) => item?.[field] ?? null)),\n }\n}\n\nexport function formatWhereClause(\n key: string,\n value: null | SqlValue | SqlValue[],\n) {\n if (Array.isArray(value)) {\n let whereClause = `${sqlString.escapeId(key)} IN (${value\n .filter((v) => v !== null)\n .map((v) => sqlString.escape(v))\n .join(', ')})`\n\n if (value.includes(null)) {\n whereClause = `(${whereClause} OR ${sqlString.escapeId(key)} IS NULL)`\n }\n\n return whereClause\n }\n\n if (value === null) {\n return `${sqlString.escapeId(key)} IS NULL`\n }\n\n return `${sqlString.escapeId(key)} = ${sqlString.escape(value)}`\n}\n\nexport function formatWhereClauses(query: SqlWhere) {\n if (Object.keys(query).length === 0) {\n return ''\n }\n\n const whereClauses = Object.entries(query).map(([key, value]) =>\n formatWhereClause(key, value),\n )\n return `WHERE ${whereClauses.join(' AND ')}`\n}\n","export const messages = {\n noActiveCalendarsGlobal:\n 'No active calendars found for the configured date range - returning empty routes and stops',\n noActiveCalendarsForRoute: (routeId: string) =>\n `route_id ${routeId} has no active calendars in range - skipping directions`,\n noActiveCalendarsForDirection: (\n routeId: string,\n directionId: string | number,\n ) =>\n `route_id ${routeId} direction ${directionId} has no active calendars in range - skipping stops`,\n routeHasNoDirections: (routeId: string) =>\n `route_id ${routeId} has no directions - skipping`,\n stopNotFound: (\n routeId: string,\n directionId: string | number,\n stopId: string,\n ) =>\n `stop_id ${stopId} for route ${routeId} direction ${directionId} not found - dropping`,\n}\n"],"mappings":";;;AAEA,OAAO,WAAW;AAClB,SAAS,eAAe;AACxB,OAAO,iBAAiB;;;ACJxB,SAAS,SAAS,MAAM,eAAe;AACvC,SAAS,qBAAqB;AAC9B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,OAAO,cAAc;AACrB,OAAO,SAAS;AAChB,OAAO,eAAe;AAOtB,eAAsB,UAAUA,OAAM;AACpC,MAAI;AACF,UAAM,OAAO,MAAM;AAAA,MACjB,QAAQ,UAAUA,MAAK,UAAU,CAAC;AAAA,MAClC;AAAA,IACF,EAAE,MAAM,CAAC,UAAU;AACjB,cAAQ;AAAA,QACN,IAAI;AAAA,UACF,uCAAuCA,MAAK,UAAU;AAAA,QACxD;AAAA,MACF;AACA,YAAM;AAAA,IACR,CAAC;AACD,UAAM,SAAS,KAAK,MAAM,IAAI;AAE9B,QAAIA,MAAK,eAAe,MAAM;AAC5B,aAAO,aAAaA,MAAK;AAAA,I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AAO,MAAM,QAAQ,QAAQ,IAAI,CAAC,EACrC,MAAM,kCAAkC,EACxC,KAAK,EACL,OAAO,KAAK;AAAA,EACX,OAAO;AAAA,EACP,UAAU;AAAA,EACV,SAAS;AAAA,EACT,MAAM;AACR,CAAC,EACA,OAAO,KAAK;AAAA,EACX,OAAO;AAAA,EACP,UAAU;AAAA,EACV,MAAM;AACR,CAAC,EACA,QAAQ,cAAc,MAAS,EAC/B,UAAU;AAEb,IAAM,cAAc,CAAC,UAAe;AAClC,QAAM,OAAO,SAAS;AACtB,UAAQ,OAAO,MAAM;AAAA,EAAK,YAAY,IAAI,CAAC;AAAA,CAAI;AAC/C,UAAQ,MAAM,GAAG,OAAO,KAAK,CAAC;AAC9B,UAAQ,KAAK,CAAC;AAChB;AAEA,IAAM,cAAc,YAAY;AAC9B,QAAM,SAAS,MAAM,UAAU,IAAI;AACnC,QAAM,kCAAwB,MAAM;AACpC,UAAQ,KAAK;AACf;AAEA,YAAY,EAAE,MAAM,WAAW;","names":["argv","error","openDb","untildify","join","join","stoptimes","openDb","untildify"]}
|
|
1
|
+
{"version":3,"file":"transit-departures-widget.js","names":[],"sources":["../../src/bin/transit-departures-widget.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport yargs from 'yargs'\nimport { hideBin } from 'yargs/helpers'\nimport PrettyError from 'pretty-error'\n\nimport { getConfig } from '../lib/file-utils.ts'\nimport { formatError } from '../lib/logging/log.ts'\nimport transitDeparturesWidget from '../index.ts'\n\nconst pe = new PrettyError()\n\nconst argv = yargs(hideBin(process.argv))\n .usage('Usage: $0 --config ./config.json')\n .help()\n .option('c', {\n alias: 'configPath',\n describe: 'Path to config file',\n default: './config.json',\n type: 'string',\n })\n .option('s', {\n alias: 'skipImport',\n describe: 'Don’t import GTFS file.',\n type: 'boolean',\n })\n .default('skipImport', undefined)\n .parseSync()\n\nconst handleError = (error: any) => {\n const text = error || 'Unknown Error'\n process.stdout.write(`\\n${formatError(text)}\\n`)\n console.error(pe.render(error))\n process.exit(1)\n}\n\nconst setupImport = async () => {\n const config = await getConfig(argv)\n await transitDeparturesWidget(config)\n process.exit()\n}\n\nsetupImport().catch(handleError)\n"],"mappings":";;;;;;;;AAUA,MAAM,KAAK,IAAI,YAAY;AAE3B,MAAM,OAAO,MAAM,QAAQ,QAAQ,IAAI,CAAC,CAAC,CACtC,MAAM,kCAAkC,CAAC,CACzC,KAAK,CAAC,CACN,OAAO,KAAK;CACX,OAAO;CACP,UAAU;CACV,SAAS;CACT,MAAM;AACR,CAAC,CAAC,CACD,OAAO,KAAK;CACX,OAAO;CACP,UAAU;CACV,MAAM;AACR,CAAC,CAAC,CACD,QAAQ,cAAc,MAAS,CAAC,CAChC,UAAU;AAEb,MAAM,eAAe,UAAe;CAClC,MAAM,OAAO,SAAS;CACtB,QAAQ,OAAO,MAAM,KAAK,YAAY,IAAI,EAAE,GAAG;CAC/C,QAAQ,MAAM,GAAG,OAAO,KAAK,CAAC;CAC9B,QAAQ,KAAK,CAAC;AAChB;AAEA,MAAM,cAAc,YAAY;CAE9B,MAAM,wBAAwB,MADT,UAAU,IAAI,CACC;CACpC,QAAQ,KAAK;AACf;AAEA,YAAY,CAAC,CAAC,MAAM,WAAW"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
Third-Party Licenses
|
|
2
|
+
════════════════════════════════════════
|
|
3
|
+
This file contains license notices for open-source libraries vendored
|
|
4
|
+
in dist/browser by transit-departures-widget (https://github.com/BlinkTagInc/transit-departures-widget).
|
|
5
|
+
|
|
6
|
+
pbf 5.1.0
|
|
7
|
+
────────────────────────────────────────
|
|
8
|
+
License: BSD-3-Clause
|
|
9
|
+
|
|
10
|
+
Copyright (c) 2026, Mapbox
|
|
11
|
+
All rights reserved.
|
|
12
|
+
|
|
13
|
+
Redistribution and use in source and binary forms, with or without
|
|
14
|
+
modification, are permitted provided that the following conditions are met:
|
|
15
|
+
|
|
16
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
17
|
+
list of conditions and the following disclaimer.
|
|
18
|
+
|
|
19
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
20
|
+
this list of conditions and the following disclaimer in the documentation
|
|
21
|
+
and/or other materials provided with the distribution.
|
|
22
|
+
|
|
23
|
+
* Neither the name of pbf nor the names of its
|
|
24
|
+
contributors may be used to endorse or promote products derived from
|
|
25
|
+
this software without specific prior written permission.
|
|
26
|
+
|
|
27
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
28
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
29
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
30
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
31
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
32
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
33
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
34
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
35
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
36
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
37
|
+
|
|
38
|
+
gtfs-realtime-pbf-js-module 1.0.0
|
|
39
|
+
────────────────────────────────────────
|
|
40
|
+
License: MIT
|
|
41
|
+
|
|
42
|
+
MIT License
|
|
43
|
+
|
|
44
|
+
Copyright (c) 2020 Gavin Rehkemper
|
|
45
|
+
|
|
46
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
47
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
48
|
+
in the Software without restriction, including without limitation the rights
|
|
49
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
50
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
51
|
+
furnished to do so, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
The above copyright notice and this permission notice shall be included in all
|
|
54
|
+
copies or substantial portions of the Software.
|
|
55
|
+
|
|
56
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
57
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
58
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
59
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
60
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
61
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
62
|
+
SOFTWARE.
|
|
63
|
+
|
|
64
|
+
accessible-autocomplete 3.0.1
|
|
65
|
+
────────────────────────────────────────
|
|
66
|
+
License: MIT
|
|
67
|
+
|
|
68
|
+
The MIT License (MIT)
|
|
69
|
+
|
|
70
|
+
Copyright (c) 2017 Crown Copyright (Government Digital Service)
|
|
71
|
+
|
|
72
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
73
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
74
|
+
the Software without restriction, including without limitation the rights to
|
|
75
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
76
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
77
|
+
subject to the following conditions:
|
|
78
|
+
|
|
79
|
+
The above copyright notice and this permission notice shall be included in all
|
|
80
|
+
copies or substantial portions of the Software.
|
|
81
|
+
|
|
82
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
83
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
84
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
85
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
86
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
87
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i((t="undefined"!=typeof globalThis?globalThis:t||self).Pbf={})}(this,function(t){"use strict";const i=4294967296,e=1/i,s="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");function r(t,i,e){return e?4294967296*i+(t>>>0):4294967296*(i>>>0)+(t>>>0)}function h(t,i,e){const s=i<=16383?1:i<=2097151?2:i<=268435455?3:Math.floor(Math.log(i)/(7*Math.LN2));e.realloc(s),e.buf.copyWithin(t+s,t,e.pos)}function o(t,i){for(let e=0;e<t.length;e++)i.writeVarint(t[e])}function n(t,i){for(let e=0;e<t.length;e++)i.writeSVarint(t[e])}function a(t,i){for(let e=0;e<t.length;e++)i.writeFloat(t[e])}function d(t,i){for(let e=0;e<t.length;e++)i.writeDouble(t[e])}function l(t,i){for(let e=0;e<t.length;e++)i.writeBoolean(t[e])}function u(t,i){for(let e=0;e<t.length;e++)i.writeFixed32(t[e])}function f(t,i){for(let e=0;e<t.length;e++)i.writeSFixed32(t[e])}function p(t,i){for(let e=0;e<t.length;e++)i.writeFixed64(t[e])}function w(t,i){for(let e=0;e<t.length;e++)i.writeSFixed64(t[e])}t.PbfReader=class{constructor(t){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this._valueStart=-1,this.length=this.buf.length}readFields(t,i,e=this.length){let s;for(;s=this.nextField(e);)t(s,i,this);return i}readMessage(t,i){return this.readFields(t,i,this.readVarint()+this.pos)}readFixed32(){const t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){const t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*i;return this.pos+=8,t}readSFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*i;return this.pos+=8,t}readFloat(){const t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){const t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){const i=this.buf,e=i[this.pos++];if(e<128)return e;let s,h=127&e;return s=i[this.pos++],h|=(127&s)<<7,s<128?h:(s=i[this.pos++],h|=(127&s)<<14,s<128?h:(s=i[this.pos++],h|=(127&s)<<21,s<128?h:(s=i[this.pos],h|=(15&s)<<28,function(t,i,e){const s=e.buf;let h,o;if(o=s[e.pos++],h=(112&o)>>4,o<128)return r(t,h,i);if(o=s[e.pos++],h|=(127&o)<<3,o<128)return r(t,h,i);if(o=s[e.pos++],h|=(127&o)<<10,o<128)return r(t,h,i);if(o=s[e.pos++],h|=(127&o)<<17,o<128)return r(t,h,i);if(o=s[e.pos++],h|=(127&o)<<24,o<128)return r(t,h,i);if(o=s[e.pos++],h|=(1&o)<<31,o<128)return r(t,h,i);throw new Error("Expected varint not more than 10 bytes")}(h,t,this))))}readSVarint(){const t=this.readVarint();return t%2==1?(t+1)/-2:t/2}readBoolean(){return Boolean(this.readVarint())}readString(){const t=this.readVarint()+this.pos,i=this.pos;return this.pos=t,t-i>=12&&s?s.decode(this.buf.subarray(i,t)):function(t,i,e){let s="",r=i;for(;r<e;){const i=t[r];let h,o,n,a=null,d=i>239?4:i>223?3:i>191?2:1;if(r+d>e)break;1===d?i<128&&(a=i):2===d?(h=t[r+1],128==(192&h)&&(a=(31&i)<<6|63&h,a<=127&&(a=null))):3===d?(h=t[r+1],o=t[r+2],128==(192&h)&&128==(192&o)&&(a=(15&i)<<12|(63&h)<<6|63&o,(a<=2047||a>=55296&&a<=57343)&&(a=null))):4===d&&(h=t[r+1],o=t[r+2],n=t[r+3],128==(192&h)&&128==(192&o)&&128==(192&n)&&(a=(15&i)<<18|(63&h)<<12|(63&o)<<6|63&n,(a<=65535||a>=1114112)&&(a=null))),null===a?(a=65533,d=1):a>65535&&(a-=65536,s+=String.fromCharCode(a>>>10&1023|55296),a=56320|1023&a),s+=String.fromCharCode(a),r+=d}return s}(this.buf,i,t)}readBytes(){const t=this.readVarint()+this.pos,i=this.buf.subarray(this.pos,t);return this.pos=t,i}readPackedVarint(t=[],i){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readVarint(i));return t}readPackedSVarint(t=[]){const i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readSVarint());return t}readPackedBoolean(t=[]){const i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readBoolean());return t}readPackedFloat(t=[]){const i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readFloat());return t}readPackedDouble(t=[]){const i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readDouble());return t}readPackedFixed32(t=[]){const i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readFixed32());return t}readPackedSFixed32(t=[]){const i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readSFixed32());return t}readPackedFixed64(t=[]){const i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readFixed64());return t}readPackedSFixed64(t=[]){const i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readSFixed64());return t}readPackedEnd(){return 2===this.type?this.readVarint()+this.pos:this.pos+1}nextField(t=this.length){if(this.pos===this._valueStart&&this.skip(this.type),this.pos>=t)return 0;const i=this.readVarint();return this.type=7&i,this._valueStart=this.pos,i>>>3}skip(t){const i=7&t;if(0===i)for(;this.buf[this.pos++]>127;);else if(2===i)this.pos=this.readVarint()+this.pos;else if(5===i)this.pos+=4;else{if(1!==i)throw new Error(`Unimplemented type: ${i}`);this.pos+=8}}},t.PbfWriter=class{constructor(t=new Uint8Array(16)){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.length=this.buf.length}writeTag(t,i){this.writeVarint(t<<3|i)}realloc(t){let i=this.length||16;for(;i<this.pos+t;)i*=2;if(i!==this.length){const t=new Uint8Array(i);t.set(this.buf),this.buf=t,this.dataView=new DataView(t.buffer),this.length=i}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeSFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,-1&t,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*e),!0),this.pos+=8}writeSFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,-1&t,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*e),!0),this.pos+=8}writeVarint(t){if((t=+t||0)>=0&&t<128)return this.pos>=this.length&&this.realloc(1),void(this.buf[this.pos++]=t);t>268435455||t<0?function(t,i){let e,s;t>=0?(e=t%4294967296|0,s=t/4294967296|0):(e=~(-t%4294967296),s=~(-t/4294967296),4294967295^e?e=e+1|0:(e=0,s=s+1|0));if(t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");i.realloc(10),function(t,i,e){e.buf[e.pos++]=127&t|128,t>>>=7,e.buf[e.pos++]=127&t|128,t>>>=7,e.buf[e.pos++]=127&t|128,t>>>=7,e.buf[e.pos++]=127&t|128,t>>>=7,e.buf[e.pos]=127&t}(e,0,i),function(t,i){const e=(7&t)<<4;if(i.buf[i.pos++]|=e|((t>>>=3)?128:0),!t)return;if(i.buf[i.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(i.buf[i.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(i.buf[i.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(i.buf[i.pos++]=127&t|((t>>>=7)?128:0),!t)return;i.buf[i.pos++]=127&t}(s,i)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))}writeSVarint(t){this.writeVarint(t<0?2*-t-1:2*t)}writeBoolean(t){this.writeVarint(+t)}writeString(t){t=String(t),this.realloc(4*t.length),this.pos++;const i=this.pos;this.pos=function(t,i,e){for(let s,r,h=0;h<i.length;h++){if(s=i.charCodeAt(h),s>55295&&s<57344){if(!r){s>56319||h+1===i.length?(t[e++]=239,t[e++]=191,t[e++]=189):r=s;continue}if(s<56320){t[e++]=239,t[e++]=191,t[e++]=189,r=s;continue}s=r-55296<<10|s-56320|65536,r=null}else r&&(t[e++]=239,t[e++]=191,t[e++]=189,r=null);s<128?t[e++]=s:(s<2048?t[e++]=s>>6|192:(s<65536?t[e++]=s>>12|224:(t[e++]=s>>18|240,t[e++]=s>>12&63|128),t[e++]=s>>6&63|128),t[e++]=63&s|128)}return e}(this.buf,t,this.pos);const e=this.pos-i;e>=128&&h(i,e,this),this.pos=i-1,this.writeVarint(e),this.pos+=e}writeFloat(t){this.realloc(4),this.dataView.setFloat32(this.pos,t,!0),this.pos+=4}writeDouble(t){this.realloc(8),this.dataView.setFloat64(this.pos,t,!0),this.pos+=8}writeBytes(t){const i=t.length;this.writeVarint(i),this.realloc(i),this.buf.set(t,this.pos),this.pos+=i}writeRawMessage(t,i){this.pos++;const e=this.pos;t(i,this);const s=this.pos-e;s>=128&&h(e,s,this),this.pos=e-1,this.writeVarint(s),this.pos+=s}writeMessage(t,i,e){this.writeTag(t,2),this.writeRawMessage(i,e)}writePackedVarint(t,i){i.length&&this.writeMessage(t,o,i)}writePackedSVarint(t,i){i.length&&this.writeMessage(t,n,i)}writePackedBoolean(t,i){i.length&&this.writeMessage(t,l,i)}writePackedFloat(t,i){i.length&&this.writeMessage(t,a,i)}writePackedDouble(t,i){i.length&&this.writeMessage(t,d,i)}writePackedFixed32(t,i){i.length&&this.writeMessage(t,u,i)}writePackedSFixed32(t,i){i.length&&this.writeMessage(t,f,i)}writePackedFixed64(t,i){i.length&&this.writeMessage(t,p,i)}writePackedSFixed64(t,i){i.length&&this.writeMessage(t,w,i)}writeBytesField(t,i){this.writeTag(t,2),this.writeBytes(i)}writeFixed32Field(t,i){this.writeTag(t,5),this.writeFixed32(i)}writeSFixed32Field(t,i){this.writeTag(t,5),this.writeSFixed32(i)}writeFixed64Field(t,i){this.writeTag(t,1),this.writeFixed64(i)}writeSFixed64Field(t,i){this.writeTag(t,1),this.writeSFixed64(i)}writeVarintField(t,i){this.writeTag(t,0),this.writeVarint(i)}writeSVarintField(t,i){this.writeTag(t,0),this.writeSVarint(i)}writeStringField(t,i){this.writeTag(t,2),this.writeString(i)}writeFloatField(t,i){this.writeTag(t,5),this.writeFloat(i)}writeDoubleField(t,i){this.writeTag(t,1),this.writeDouble(i)}writeBooleanField(t,i){this.writeVarintField(t,+i)}}});
|
package/dist/index.d.ts
CHANGED
|
@@ -1,30 +1,33 @@
|
|
|
1
|
+
//#region src/types/global_interfaces.d.ts
|
|
1
2
|
interface Config {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
3
|
+
agency: {
|
|
4
|
+
agency_key: string;
|
|
5
|
+
gtfs_static_path?: string;
|
|
6
|
+
gtfs_static_url?: string;
|
|
7
|
+
gtfs_rt_tripupdates_url: string;
|
|
8
|
+
gtfs_rt_tripupdates_headers?: Record<string, string>;
|
|
9
|
+
exclude?: string[];
|
|
10
|
+
};
|
|
11
|
+
assetPath?: string;
|
|
12
|
+
beautify?: boolean;
|
|
13
|
+
startDate?: string;
|
|
14
|
+
endDate?: string;
|
|
15
|
+
locale?: string;
|
|
16
|
+
includeCoordinates?: boolean;
|
|
17
|
+
noHead?: boolean;
|
|
18
|
+
outputPath?: string;
|
|
19
|
+
overwriteExistingFiles?: boolean;
|
|
20
|
+
refreshIntervalSeconds?: number;
|
|
21
|
+
skipImport?: boolean;
|
|
22
|
+
sqlitePath?: string;
|
|
23
|
+
templatePath?: string;
|
|
24
|
+
timeFormat?: string;
|
|
25
|
+
verbose?: boolean;
|
|
26
|
+
logFunction?: (text: string) => void;
|
|
26
27
|
}
|
|
27
|
-
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region src/lib/transit-departures-widget.d.ts
|
|
28
30
|
declare function transitDeparturesWidget(initialConfig: Config): Promise<void>;
|
|
29
|
-
|
|
31
|
+
//#endregion
|
|
30
32
|
export { transitDeparturesWidget as default };
|
|
33
|
+
//# sourceMappingURL=index.d.ts.map
|