diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..a863850 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,98 @@ +name: CI +run-name: CI for ${{ github.ref }} +on: + push: + branches-ignore: + - "tools/*" + pull_request: +jobs: + Tests: + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v6 + - name: NPM Install + run: npm i + working-directory: ${{ github.workspace }} + - name: Test Suite + run: | + export DOCUMENTED=1 + export MBUS_URL=https://mbus.bustime.mock.mb.thething.fyi/ + export RIDE_URL=https://ride.bustime.mock.mb.thething.fyi/ + npm start & + until curl localhost:3000 > /dev/null 2>&1 + do + sleep 1 # waits for initial startup + done + sleep 10 + until curl localhost:3000 > /dev/null 2>&1 + do + sleep 1 # waits for the walking cache to populate + done + sleep 10 # waits for the graph/predictions to be built + npx vitest run test + # npm test + working-directory: ${{ github.workspace }} + + Typecheck: + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v6 + # - name: Placeholder + # run: echo hi + # working-directory: ${{ github.workspace }} + - name: NPM Install + run: npm i + working-directory: ${{ github.workspace }} + - name: Typecheck + run: tsc --noEmit + working-directory: ${{ github.workspace }} + + Typedoc: + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v6 + - name: NPM Install + run: npm i + working-directory: ${{ github.workspace }} + - name: Build Docs + run: npx typedoc --entryPointStrategy expand ./src --treatWarningsAsErrors + working-directory: ${{ github.workspace }} + - name: Sync Files + uses: SamKirkland/FTP-Deploy-Action@v4.4.0 + with: + server: ${{ secrets.FTP_SERVER }} + port: ${{ secrets.FTP_PORT }} + username: ${{ secrets.FTP_USERNAME }} + password: ${{ secrets.FTP_PASSWORD }} + local-dir: ${{ github.workspace }}/docs/ + server-dir: ${{ github.ref }}/typedoc/ + + OpenAPI: + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v6 + - name: NPM Install + run: npm i + working-directory: ${{ github.workspace }} + - name: Build Spec + run: | + export DOCUMENTED=1 + export DOCUMENTED_OUTPUT_FILE=openapi/spec.json + export DOCUMENTED_EXIT_ON_OUTPUT=1 + mkdir openapi + npm start + working-directory: ${{ github.workspace }} + - name: Sync Files + uses: SamKirkland/FTP-Deploy-Action@v4.4.0 + with: + server: ${{ secrets.FTP_SERVER }} + port: ${{ secrets.FTP_PORT }} + username: ${{ secrets.FTP_USERNAME }} + password: ${{ secrets.FTP_PASSWORD }} + local-dir: ${{ github.workspace }}/openapi/ + server-dir: ${{ github.ref }}/openapi/ + diff --git a/.gitignore b/.gitignore index 8586e4f..6e073c3 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,6 @@ node_modules/ package-lock.json .env .vscode/ -src/assets/walkingCache.json \ No newline at end of file +src/assets/walkingCache.json +*.log +/docs/ diff --git a/docs/.nojekyll b/docs/.nojekyll deleted file mode 100644 index e2ac661..0000000 --- a/docs/.nojekyll +++ /dev/null @@ -1 +0,0 @@ -TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. \ No newline at end of file diff --git a/docs/assets/hierarchy.js b/docs/assets/hierarchy.js deleted file mode 100644 index c11396f..0000000 --- a/docs/assets/hierarchy.js +++ /dev/null @@ -1 +0,0 @@ -window.hierarchyData = "eJyVjjEOgzAMRe/iOVAFVAbO0LFbhVAKpkQNCXLcoULcvU5VVYwwWfr28/sLUAgcob7pomwUEA4OO7bBS7aAhGl4MyHUcMEHKHha30NdnCsFL3ISW89Ig+kwnsjMHKjl94wxl/N85MkJ0zkT5SFw7LPEZ38mLUfrekL/LVEpXepmVaKuNuqrnZDN3eHBDltuR5nkLfXWS8bHAemQ88fs8a3rB573gTo=" \ No newline at end of file diff --git a/docs/assets/highlight.css b/docs/assets/highlight.css deleted file mode 100644 index bc36a19..0000000 --- a/docs/assets/highlight.css +++ /dev/null @@ -1,43 +0,0 @@ -:root { - --light-hl-0: #795E26; - --dark-hl-0: #DCDCAA; - --light-hl-1: #000000; - --dark-hl-1: #D4D4D4; - --light-hl-2: #A31515; - --dark-hl-2: #CE9178; - --light-code-background: #FFFFFF; - --dark-code-background: #1E1E1E; -} - -@media (prefers-color-scheme: light) { :root { - --hl-0: var(--light-hl-0); - --hl-1: var(--light-hl-1); - --hl-2: var(--light-hl-2); - --code-background: var(--light-code-background); -} } - -@media (prefers-color-scheme: dark) { :root { - --hl-0: var(--dark-hl-0); - --hl-1: var(--dark-hl-1); - --hl-2: var(--dark-hl-2); - --code-background: var(--dark-code-background); -} } - -:root[data-theme='light'] { - --hl-0: var(--light-hl-0); - --hl-1: var(--light-hl-1); - --hl-2: var(--light-hl-2); - --code-background: var(--light-code-background); -} - -:root[data-theme='dark'] { - --hl-0: var(--dark-hl-0); - --hl-1: var(--dark-hl-1); - --hl-2: var(--dark-hl-2); - --code-background: var(--dark-code-background); -} - -.hl-0 { color: var(--hl-0); } -.hl-1 { color: var(--hl-1); } -.hl-2 { color: var(--hl-2); } -pre, code { background: var(--code-background); } diff --git a/docs/assets/icons.js b/docs/assets/icons.js deleted file mode 100644 index 58882d7..0000000 --- a/docs/assets/icons.js +++ /dev/null @@ -1,18 +0,0 @@ -(function() { - addIcons(); - function addIcons() { - if (document.readyState === "loading") return document.addEventListener("DOMContentLoaded", addIcons); - const svg = document.body.appendChild(document.createElementNS("http://www.w3.org/2000/svg", "svg")); - svg.innerHTML = `MMNEPVFCICPMFPCPTTAAATR`; - svg.style.display = "none"; - if (location.protocol === "file:") updateUseElements(); - } - - function updateUseElements() { - document.querySelectorAll("use").forEach(el => { - if (el.getAttribute("href").includes("#icon-")) { - el.setAttribute("href", el.getAttribute("href").replace(/.*#/, "#")); - } - }); - } -})() \ No newline at end of file diff --git a/docs/assets/icons.svg b/docs/assets/icons.svg deleted file mode 100644 index 50ad579..0000000 --- a/docs/assets/icons.svg +++ /dev/null @@ -1 +0,0 @@ -MMNEPVFCICPMFPCPTTAAATR \ No newline at end of file diff --git a/docs/assets/main.js b/docs/assets/main.js deleted file mode 100644 index 64b80ab..0000000 --- a/docs/assets/main.js +++ /dev/null @@ -1,60 +0,0 @@ -"use strict"; -window.translations={"copy":"Copy","copied":"Copied!","normally_hidden":"This member is normally hidden due to your filter settings.","hierarchy_expand":"Expand","hierarchy_collapse":"Collapse","folder":"Folder","search_index_not_available":"The search index is not available","search_no_results_found_for_0":"No results found for {0}","kind_1":"Project","kind_2":"Module","kind_4":"Namespace","kind_8":"Enumeration","kind_16":"Enumeration Member","kind_32":"Variable","kind_64":"Function","kind_128":"Class","kind_256":"Interface","kind_512":"Constructor","kind_1024":"Property","kind_2048":"Method","kind_4096":"Call Signature","kind_8192":"Index Signature","kind_16384":"Constructor Signature","kind_32768":"Parameter","kind_65536":"Type Literal","kind_131072":"Type Parameter","kind_262144":"Accessor","kind_524288":"Get Signature","kind_1048576":"Set Signature","kind_2097152":"Type Alias","kind_4194304":"Reference","kind_8388608":"Document"}; -"use strict";(()=>{var Ke=Object.create;var he=Object.defineProperty;var Ge=Object.getOwnPropertyDescriptor;var Ze=Object.getOwnPropertyNames;var Xe=Object.getPrototypeOf,Ye=Object.prototype.hasOwnProperty;var et=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var tt=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ze(e))!Ye.call(t,i)&&i!==n&&he(t,i,{get:()=>e[i],enumerable:!(r=Ge(e,i))||r.enumerable});return t};var nt=(t,e,n)=>(n=t!=null?Ke(Xe(t)):{},tt(e||!t||!t.__esModule?he(n,"default",{value:t,enumerable:!0}):n,t));var ye=et((me,ge)=>{(function(){var t=function(e){var n=new t.Builder;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),n.searchPipeline.add(t.stemmer),e.call(n,n),n.build()};t.version="2.3.9";t.utils={},t.utils.warn=(function(e){return function(n){e.console&&console.warn&&console.warn(n)}})(this),t.utils.asString=function(e){return e==null?"":e.toString()},t.utils.clone=function(e){if(e==null)return e;for(var n=Object.create(null),r=Object.keys(e),i=0;i0){var d=t.utils.clone(n)||{};d.position=[a,l],d.index=s.length,s.push(new t.Token(r.slice(a,o),d))}a=o+1}}return s},t.tokenizer.separator=/[\s\-]+/;t.Pipeline=function(){this._stack=[]},t.Pipeline.registeredFunctions=Object.create(null),t.Pipeline.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[e.label]=e},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn(`Function is not registered with pipeline. This may cause problems when serialising the index. -`,e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(r){var i=t.Pipeline.registeredFunctions[r];if(i)n.add(i);else throw new Error("Cannot load unregistered function: "+r)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(n){t.Pipeline.warnIfFunctionNotRegistered(n),this._stack.push(n)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");r=r+1,this._stack.splice(r,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");this._stack.splice(r,0,n)},t.Pipeline.prototype.remove=function(e){var n=this._stack.indexOf(e);n!=-1&&this._stack.splice(n,1)},t.Pipeline.prototype.run=function(e){for(var n=this._stack.length,r=0;r1&&(oe&&(r=s),o!=e);)i=r-n,s=n+Math.floor(i/2),o=this.elements[s*2];if(o==e||o>e)return s*2;if(oc?d+=2:a==c&&(n+=r[l+1]*i[d+1],l+=2,d+=2);return n},t.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},t.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),n=1,r=0;n0){var o=s.str.charAt(0),a;o in s.node.edges?a=s.node.edges[o]:(a=new t.TokenSet,s.node.edges[o]=a),s.str.length==1&&(a.final=!0),i.push({node:a,editsRemaining:s.editsRemaining,str:s.str.slice(1)})}if(s.editsRemaining!=0){if("*"in s.node.edges)var c=s.node.edges["*"];else{var c=new t.TokenSet;s.node.edges["*"]=c}if(s.str.length==0&&(c.final=!0),i.push({node:c,editsRemaining:s.editsRemaining-1,str:s.str}),s.str.length>1&&i.push({node:s.node,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)}),s.str.length==1&&(s.node.final=!0),s.str.length>=1){if("*"in s.node.edges)var l=s.node.edges["*"];else{var l=new t.TokenSet;s.node.edges["*"]=l}s.str.length==1&&(l.final=!0),i.push({node:l,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)})}if(s.str.length>1){var d=s.str.charAt(0),f=s.str.charAt(1),p;f in s.node.edges?p=s.node.edges[f]:(p=new t.TokenSet,s.node.edges[f]=p),s.str.length==1&&(p.final=!0),i.push({node:p,editsRemaining:s.editsRemaining-1,str:d+s.str.slice(2)})}}}return r},t.TokenSet.fromString=function(e){for(var n=new t.TokenSet,r=n,i=0,s=e.length;i=e;n--){var r=this.uncheckedNodes[n],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}};t.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},t.Index.prototype.search=function(e){return this.query(function(n){var r=new t.QueryParser(e,n);r.parse()})},t.Index.prototype.query=function(e){for(var n=new t.Query(this.fields),r=Object.create(null),i=Object.create(null),s=Object.create(null),o=Object.create(null),a=Object.create(null),c=0;c1?this._b=1:this._b=e},t.Builder.prototype.k1=function(e){this._k1=e},t.Builder.prototype.add=function(e,n){var r=e[this._ref],i=Object.keys(this._fields);this._documents[r]=n||{},this.documentCount+=1;for(var s=0;s=this.length)return t.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},t.QueryLexer.prototype.width=function(){return this.pos-this.start},t.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},t.QueryLexer.prototype.backup=function(){this.pos-=1},t.QueryLexer.prototype.acceptDigitRun=function(){var e,n;do e=this.next(),n=e.charCodeAt(0);while(n>47&&n<58);e!=t.QueryLexer.EOS&&this.backup()},t.QueryLexer.prototype.more=function(){return this.pos1&&(e.backup(),e.emit(t.QueryLexer.TERM)),e.ignore(),e.more())return t.QueryLexer.lexText},t.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.EDIT_DISTANCE),t.QueryLexer.lexText},t.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.BOOST),t.QueryLexer.lexText},t.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(t.QueryLexer.TERM)},t.QueryLexer.termSeparator=t.tokenizer.separator,t.QueryLexer.lexText=function(e){for(;;){var n=e.next();if(n==t.QueryLexer.EOS)return t.QueryLexer.lexEOS;if(n.charCodeAt(0)==92){e.escapeCharacter();continue}if(n==":")return t.QueryLexer.lexField;if(n=="~")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexEditDistance;if(n=="^")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexBoost;if(n=="+"&&e.width()===1||n=="-"&&e.width()===1)return e.emit(t.QueryLexer.PRESENCE),t.QueryLexer.lexText;if(n.match(t.QueryLexer.termSeparator))return t.QueryLexer.lexTerm}},t.QueryParser=function(e,n){this.lexer=new t.QueryLexer(e),this.query=n,this.currentClause={},this.lexemeIdx=0},t.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=t.QueryParser.parseClause;e;)e=e(this);return this.query},t.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},t.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},t.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},t.QueryParser.parseClause=function(e){var n=e.peekLexeme();if(n!=null)switch(n.type){case t.QueryLexer.PRESENCE:return t.QueryParser.parsePresence;case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expected either a field or a term, found "+n.type;throw n.str.length>=1&&(r+=" with value '"+n.str+"'"),new t.QueryParseError(r,n.start,n.end)}},t.QueryParser.parsePresence=function(e){var n=e.consumeLexeme();if(n!=null){switch(n.str){case"-":e.currentClause.presence=t.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=t.Query.presence.REQUIRED;break;default:var r="unrecognised presence operator'"+n.str+"'";throw new t.QueryParseError(r,n.start,n.end)}var i=e.peekLexeme();if(i==null){var r="expecting term or field, found nothing";throw new t.QueryParseError(r,n.start,n.end)}switch(i.type){case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expecting term or field, found '"+i.type+"'";throw new t.QueryParseError(r,i.start,i.end)}}},t.QueryParser.parseField=function(e){var n=e.consumeLexeme();if(n!=null){if(e.query.allFields.indexOf(n.str)==-1){var r=e.query.allFields.map(function(o){return"'"+o+"'"}).join(", "),i="unrecognised field '"+n.str+"', possible fields: "+r;throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.fields=[n.str];var s=e.peekLexeme();if(s==null){var i="expecting term, found nothing";throw new t.QueryParseError(i,n.start,n.end)}switch(s.type){case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var i="expecting term, found '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseTerm=function(e){var n=e.consumeLexeme();if(n!=null){e.currentClause.term=n.str.toLowerCase(),n.str.indexOf("*")!=-1&&(e.currentClause.usePipeline=!1);var r=e.peekLexeme();if(r==null){e.nextClause();return}switch(r.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+r.type+"'";throw new t.QueryParseError(i,r.start,r.end)}}},t.QueryParser.parseEditDistance=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="edit distance must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.editDistance=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseBoost=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="boost must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.boost=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},(function(e,n){typeof define=="function"&&define.amd?define(n):typeof me=="object"?ge.exports=n():e.lunr=n()})(this,function(){return t})})()});var M,G={getItem(){return null},setItem(){}},K;try{K=localStorage,M=K}catch{K=G,M=G}var S={getItem:t=>M.getItem(t),setItem:(t,e)=>M.setItem(t,e),disableWritingLocalStorage(){M=G},disable(){localStorage.clear(),M=G},enable(){M=K}};window.TypeDoc||={disableWritingLocalStorage(){S.disableWritingLocalStorage()},disableLocalStorage:()=>{S.disable()},enableLocalStorage:()=>{S.enable()}};window.translations||={copy:"Copy",copied:"Copied!",normally_hidden:"This member is normally hidden due to your filter settings.",hierarchy_expand:"Expand",hierarchy_collapse:"Collapse",search_index_not_available:"The search index is not available",search_no_results_found_for_0:"No results found for {0}",folder:"Folder",kind_1:"Project",kind_2:"Module",kind_4:"Namespace",kind_8:"Enumeration",kind_16:"Enumeration Member",kind_32:"Variable",kind_64:"Function",kind_128:"Class",kind_256:"Interface",kind_512:"Constructor",kind_1024:"Property",kind_2048:"Method",kind_4096:"Call Signature",kind_8192:"Index Signature",kind_16384:"Constructor Signature",kind_32768:"Parameter",kind_65536:"Type Literal",kind_131072:"Type Parameter",kind_262144:"Accessor",kind_524288:"Get Signature",kind_1048576:"Set Signature",kind_2097152:"Type Alias",kind_4194304:"Reference",kind_8388608:"Document"};var pe=[];function X(t,e){pe.push({selector:e,constructor:t})}var Z=class{alwaysVisibleMember=null;constructor(){this.createComponents(document.body),this.ensureFocusedElementVisible(),this.listenForCodeCopies(),window.addEventListener("hashchange",()=>this.ensureFocusedElementVisible()),document.body.style.display||(this.ensureFocusedElementVisible(),this.updateIndexVisibility(),this.scrollToHash())}createComponents(e){pe.forEach(n=>{e.querySelectorAll(n.selector).forEach(r=>{r.dataset.hasInstance||(new n.constructor({el:r,app:this}),r.dataset.hasInstance=String(!0))})})}filterChanged(){this.ensureFocusedElementVisible()}showPage(){document.body.style.display&&(document.body.style.removeProperty("display"),this.ensureFocusedElementVisible(),this.updateIndexVisibility(),this.scrollToHash())}scrollToHash(){if(location.hash){let e=document.getElementById(location.hash.substring(1));if(!e)return;e.scrollIntoView({behavior:"instant",block:"start"})}}ensureActivePageVisible(){let e=document.querySelector(".tsd-navigation .current"),n=e?.parentElement;for(;n&&!n.classList.contains(".tsd-navigation");)n instanceof HTMLDetailsElement&&(n.open=!0),n=n.parentElement;if(e&&!rt(e)){let r=e.getBoundingClientRect().top-document.documentElement.clientHeight/4;document.querySelector(".site-menu").scrollTop=r,document.querySelector(".col-sidebar").scrollTop=r}}updateIndexVisibility(){let e=document.querySelector(".tsd-index-content"),n=e?.open;e&&(e.open=!0),document.querySelectorAll(".tsd-index-section").forEach(r=>{r.style.display="block";let i=Array.from(r.querySelectorAll(".tsd-index-link")).every(s=>s.offsetParent==null);r.style.display=i?"none":"block"}),e&&(e.open=n)}ensureFocusedElementVisible(){if(this.alwaysVisibleMember&&(this.alwaysVisibleMember.classList.remove("always-visible"),this.alwaysVisibleMember.firstElementChild.remove(),this.alwaysVisibleMember=null),!location.hash)return;let e=document.getElementById(location.hash.substring(1));if(!e)return;let n=e.parentElement;for(;n&&n.tagName!=="SECTION";)n=n.parentElement;if(!n)return;let r=n.offsetParent==null,i=n;for(;i!==document.body;)i instanceof HTMLDetailsElement&&(i.open=!0),i=i.parentElement;if(n.offsetParent==null){this.alwaysVisibleMember=n,n.classList.add("always-visible");let s=document.createElement("p");s.classList.add("warning"),s.textContent=window.translations.normally_hidden,n.prepend(s)}r&&e.scrollIntoView()}listenForCodeCopies(){document.querySelectorAll("pre > button").forEach(e=>{let n;e.addEventListener("click",()=>{e.previousElementSibling instanceof HTMLElement&&navigator.clipboard.writeText(e.previousElementSibling.innerText.trim()),e.textContent=window.translations.copied,e.classList.add("visible"),clearTimeout(n),n=setTimeout(()=>{e.classList.remove("visible"),n=setTimeout(()=>{e.textContent=window.translations.copy},100)},1e3)})})}};function rt(t){let e=t.getBoundingClientRect(),n=Math.max(document.documentElement.clientHeight,window.innerHeight);return!(e.bottom<0||e.top-n>=0)}var fe=(t,e=100)=>{let n;return()=>{clearTimeout(n),n=setTimeout(()=>t(),e)}};var Ie=nt(ye(),1);async function R(t){let e=Uint8Array.from(atob(t),s=>s.charCodeAt(0)),r=new Blob([e]).stream().pipeThrough(new DecompressionStream("deflate")),i=await new Response(r).text();return JSON.parse(i)}var Y="closing",ae="tsd-overlay";function it(){let t=Math.abs(window.innerWidth-document.documentElement.clientWidth);document.body.style.overflow="hidden",document.body.style.paddingRight=`${t}px`}function st(){document.body.style.removeProperty("overflow"),document.body.style.removeProperty("padding-right")}function xe(t,e){t.addEventListener("animationend",()=>{t.classList.contains(Y)&&(t.classList.remove(Y),document.getElementById(ae)?.remove(),t.close(),st())}),t.addEventListener("cancel",n=>{n.preventDefault(),ve(t)}),e?.closeOnClick&&document.addEventListener("click",n=>{t.open&&!t.contains(n.target)&&ve(t)},!0)}function Ee(t){if(t.open)return;let e=document.createElement("div");e.id=ae,document.body.appendChild(e),t.showModal(),it()}function ve(t){if(!t.open)return;document.getElementById(ae)?.classList.add(Y),t.classList.add(Y)}var I=class{el;app;constructor(e){this.el=e.el,this.app=e.app}};var be=document.head.appendChild(document.createElement("style"));be.dataset.for="filters";var le={};function we(t){for(let e of t.split(/\s+/))if(le.hasOwnProperty(e)&&!le[e])return!0;return!1}var ee=class extends I{key;value;constructor(e){super(e),this.key=`filter-${this.el.name}`,this.value=this.el.checked,this.el.addEventListener("change",()=>{this.setLocalStorage(this.el.checked)}),this.setLocalStorage(this.fromLocalStorage()),be.innerHTML+=`html:not(.${this.key}) .tsd-is-${this.el.name} { display: none; } -`,this.app.updateIndexVisibility()}fromLocalStorage(){let e=S.getItem(this.key);return e?e==="true":this.el.checked}setLocalStorage(e){S.setItem(this.key,e.toString()),this.value=e,this.handleValueChange()}handleValueChange(){this.el.checked=this.value,document.documentElement.classList.toggle(this.key,this.value),le[`tsd-is-${this.el.name}`]=this.value,this.app.filterChanged(),this.app.updateIndexVisibility()}};var Le=0;async function Se(t,e){if(!window.searchData)return;let n=await R(window.searchData);t.data=n,t.index=Ie.Index.load(n.index),e.innerHTML=""}function _e(){let t=document.getElementById("tsd-search-trigger"),e=document.getElementById("tsd-search"),n=document.getElementById("tsd-search-input"),r=document.getElementById("tsd-search-results"),i=document.getElementById("tsd-search-script"),s=document.getElementById("tsd-search-status");if(!(t&&e&&n&&r&&i&&s))throw new Error("Search controls missing");let o={base:document.documentElement.dataset.base};o.base.endsWith("/")||(o.base+="/"),i.addEventListener("error",()=>{let a=window.translations.search_index_not_available;Pe(s,a)}),i.addEventListener("load",()=>{Se(o,s)}),Se(o,s),ot({trigger:t,searchEl:e,results:r,field:n,status:s},o)}function ot(t,e){let{field:n,results:r,searchEl:i,status:s,trigger:o}=t;xe(i,{closeOnClick:!0});function a(){Ee(i),n.setSelectionRange(0,n.value.length)}o.addEventListener("click",a),n.addEventListener("input",fe(()=>{at(r,n,s,e)},200)),n.addEventListener("keydown",l=>{if(r.childElementCount===0||l.ctrlKey||l.metaKey||l.altKey)return;let d=n.getAttribute("aria-activedescendant"),f=d?document.getElementById(d):null;if(f){let p=!1,v=!1;switch(l.key){case"Home":case"End":case"ArrowLeft":case"ArrowRight":v=!0;break;case"ArrowDown":case"ArrowUp":p=l.shiftKey;break}(p||v)&&ke(n)}if(!l.shiftKey)switch(l.key){case"Enter":f?.querySelector("a")?.click();break;case"ArrowUp":Te(r,n,f,-1),l.preventDefault();break;case"ArrowDown":Te(r,n,f,1),l.preventDefault();break}});function c(){ke(n)}n.addEventListener("change",c),n.addEventListener("blur",c),n.addEventListener("click",c),document.body.addEventListener("keydown",l=>{if(l.altKey||l.metaKey||l.shiftKey)return;let d=l.ctrlKey&&l.key==="k",f=!l.ctrlKey&&!ut()&&l.key==="/";(d||f)&&(l.preventDefault(),a())})}function at(t,e,n,r){if(!r.index||!r.data)return;t.innerHTML="",n.innerHTML="",Le+=1;let i=e.value.trim(),s;if(i){let a=i.split(" ").map(c=>c.length?`*${c}*`:"").join(" ");s=r.index.search(a).filter(({ref:c})=>{let l=r.data.rows[Number(c)].classes;return!l||!we(l)})}else s=[];if(s.length===0&&i){let a=window.translations.search_no_results_found_for_0.replace("{0}",` "${te(i)}" `);Pe(n,a);return}for(let a=0;ac.score-a.score);let o=Math.min(10,s.length);for(let a=0;a`,f=Ce(c.name,i);globalThis.DEBUG_SEARCH_WEIGHTS&&(f+=` (score: ${s[a].score.toFixed(2)})`),c.parent&&(f=` - ${Ce(c.parent,i)}.${f}`);let p=document.createElement("li");p.id=`tsd-search:${Le}-${a}`,p.role="option",p.ariaSelected="false",p.classList.value=c.classes??"";let v=document.createElement("a");v.tabIndex=-1,v.href=r.base+c.url,v.innerHTML=d+`${f}`,p.append(v),t.appendChild(p)}}function Te(t,e,n,r){let i;if(r===1?i=n?.nextElementSibling||t.firstElementChild:i=n?.previousElementSibling||t.lastElementChild,i!==n){if(!i||i.role!=="option"){console.error("Option missing");return}i.ariaSelected="true",i.scrollIntoView({behavior:"smooth",block:"nearest"}),e.setAttribute("aria-activedescendant",i.id),n?.setAttribute("aria-selected","false")}}function ke(t){let e=t.getAttribute("aria-activedescendant");(e?document.getElementById(e):null)?.setAttribute("aria-selected","false"),t.setAttribute("aria-activedescendant","")}function Ce(t,e){if(e==="")return t;let n=t.toLocaleLowerCase(),r=e.toLocaleLowerCase(),i=[],s=0,o=n.indexOf(r);for(;o!=-1;)i.push(te(t.substring(s,o)),`${te(t.substring(o,o+r.length))}`),s=o+r.length,o=n.indexOf(r,s);return i.push(te(t.substring(s))),i.join("")}var lt={"&":"&","<":"<",">":">","'":"'",'"':"""};function te(t){return t.replace(/[&<>"'"]/g,e=>lt[e])}function Pe(t,e){t.innerHTML=e?`
${e}
`:""}var ct=["button","checkbox","file","hidden","image","radio","range","reset","submit"];function ut(){let t=document.activeElement;return t?t.isContentEditable||t.tagName==="TEXTAREA"||t.tagName==="SEARCH"?!0:t.tagName==="INPUT"&&!ct.includes(t.type):!1}var D="mousedown",Me="mousemove",$="mouseup",ne={x:0,y:0},Qe=!1,ce=!1,dt=!1,F=!1,Oe=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);document.documentElement.classList.add(Oe?"is-mobile":"not-mobile");Oe&&"ontouchstart"in document.documentElement&&(dt=!0,D="touchstart",Me="touchmove",$="touchend");document.addEventListener(D,t=>{ce=!0,F=!1;let e=D=="touchstart"?t.targetTouches[0]:t;ne.y=e.pageY||0,ne.x=e.pageX||0});document.addEventListener(Me,t=>{if(ce&&!F){let e=D=="touchstart"?t.targetTouches[0]:t,n=ne.x-(e.pageX||0),r=ne.y-(e.pageY||0);F=Math.sqrt(n*n+r*r)>10}});document.addEventListener($,()=>{ce=!1});document.addEventListener("click",t=>{Qe&&(t.preventDefault(),t.stopImmediatePropagation(),Qe=!1)});var re=class extends I{active;className;constructor(e){super(e),this.className=this.el.dataset.toggle||"",this.el.addEventListener($,n=>this.onPointerUp(n)),this.el.addEventListener("click",n=>n.preventDefault()),document.addEventListener(D,n=>this.onDocumentPointerDown(n)),document.addEventListener($,n=>this.onDocumentPointerUp(n))}setActive(e){if(this.active==e)return;this.active=e,document.documentElement.classList.toggle("has-"+this.className,e),this.el.classList.toggle("active",e);let n=(this.active?"to-has-":"from-has-")+this.className;document.documentElement.classList.add(n),setTimeout(()=>document.documentElement.classList.remove(n),500)}onPointerUp(e){F||(this.setActive(!0),e.preventDefault())}onDocumentPointerDown(e){if(this.active){if(e.target.closest(".col-sidebar, .tsd-filter-group"))return;this.setActive(!1)}}onDocumentPointerUp(e){if(!F&&this.active&&e.target.closest(".col-sidebar")){let n=e.target.closest("a");if(n){let r=window.location.href;r.indexOf("#")!=-1&&(r=r.substring(0,r.indexOf("#"))),n.href.substring(0,r.length)==r&&setTimeout(()=>this.setActive(!1),250)}}}};var ue=new Map,de=class{open;accordions=[];key;constructor(e,n){this.key=e,this.open=n}add(e){this.accordions.push(e),e.open=this.open,e.addEventListener("toggle",()=>{this.toggle(e.open)})}toggle(e){for(let n of this.accordions)n.open=e;S.setItem(this.key,e.toString())}},ie=class extends I{constructor(e){super(e);let n=this.el.querySelector("summary"),r=n.querySelector("a");r&&r.addEventListener("click",()=>{location.assign(r.href)});let i=`tsd-accordion-${n.dataset.key??n.textContent.trim().replace(/\s+/g,"-").toLowerCase()}`,s;if(ue.has(i))s=ue.get(i);else{let o=S.getItem(i),a=o?o==="true":this.el.open;s=new de(i,a),ue.set(i,s)}s.add(this.el)}};function He(t){let e=S.getItem("tsd-theme")||"os";t.value=e,Ae(e),t.addEventListener("change",()=>{S.setItem("tsd-theme",t.value),Ae(t.value)})}function Ae(t){document.documentElement.dataset.theme=t}var se;function Ne(){let t=document.getElementById("tsd-nav-script");t&&(t.addEventListener("load",Re),Re())}async function Re(){let t=document.getElementById("tsd-nav-container");if(!t||!window.navigationData)return;let e=await R(window.navigationData);se=document.documentElement.dataset.base,se.endsWith("/")||(se+="/"),t.innerHTML="";for(let n of e)Be(n,t,[]);window.app.createComponents(t),window.app.showPage(),window.app.ensureActivePageVisible()}function Be(t,e,n){let r=e.appendChild(document.createElement("li"));if(t.children){let i=[...n,t.text],s=r.appendChild(document.createElement("details"));s.className=t.class?`${t.class} tsd-accordion`:"tsd-accordion";let o=s.appendChild(document.createElement("summary"));o.className="tsd-accordion-summary",o.dataset.key=i.join("$"),o.innerHTML='',De(t,o);let a=s.appendChild(document.createElement("div"));a.className="tsd-accordion-details";let c=a.appendChild(document.createElement("ul"));c.className="tsd-nested-navigation";for(let l of t.children)Be(l,c,i)}else De(t,r,t.class)}function De(t,e,n){if(t.path){let r=e.appendChild(document.createElement("a"));if(r.href=se+t.path,n&&(r.className=n),location.pathname===r.pathname&&!r.href.includes("#")&&(r.classList.add("current"),r.ariaCurrent="page"),t.kind){let i=window.translations[`kind_${t.kind}`].replaceAll('"',""");r.innerHTML=``}r.appendChild(Fe(t.text,document.createElement("span")))}else{let r=e.appendChild(document.createElement("span")),i=window.translations.folder.replaceAll('"',""");r.innerHTML=``,r.appendChild(Fe(t.text,document.createElement("span")))}}function Fe(t,e){let n=t.split(/(?<=[^A-Z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])|(?<=[_-])(?=[^_-])/);for(let r=0;r{let i=r.target;for(;i.parentElement&&i.parentElement.tagName!="LI";)i=i.parentElement;i.dataset.dropdown&&(i.dataset.dropdown=String(i.dataset.dropdown!=="true"))});let t=new Map,e=new Set;for(let r of document.querySelectorAll(".tsd-full-hierarchy [data-refl]")){let i=r.querySelector("ul");t.has(r.dataset.refl)?e.add(r.dataset.refl):i&&t.set(r.dataset.refl,i)}for(let r of e)n(r);function n(r){let i=t.get(r).cloneNode(!0);i.querySelectorAll("[id]").forEach(s=>{s.removeAttribute("id")}),i.querySelectorAll("[data-dropdown]").forEach(s=>{s.dataset.dropdown="false"});for(let s of document.querySelectorAll(`[data-refl="${r}"]`)){let o=gt(),a=s.querySelector("ul");s.insertBefore(o,a),o.dataset.dropdown=String(!!a),a||s.appendChild(i.cloneNode(!0))}}}function pt(){let t=document.getElementById("tsd-hierarchy-script");t&&(t.addEventListener("load",Ve),Ve())}async function Ve(){let t=document.querySelector(".tsd-panel.tsd-hierarchy:has(h4 a)");if(!t||!window.hierarchyData)return;let e=+t.dataset.refl,n=await R(window.hierarchyData),r=t.querySelector("ul"),i=document.createElement("ul");if(i.classList.add("tsd-hierarchy"),ft(i,n,e),r.querySelectorAll("li").length==i.querySelectorAll("li").length)return;let s=document.createElement("span");s.classList.add("tsd-hierarchy-toggle"),s.textContent=window.translations.hierarchy_expand,t.querySelector("h4 a")?.insertAdjacentElement("afterend",s),s.insertAdjacentText("beforebegin",", "),s.addEventListener("click",()=>{s.textContent===window.translations.hierarchy_expand?(r.insertAdjacentElement("afterend",i),r.remove(),s.textContent=window.translations.hierarchy_collapse):(i.insertAdjacentElement("afterend",r),i.remove(),s.textContent=window.translations.hierarchy_expand)})}function ft(t,e,n){let r=e.roots.filter(i=>mt(e,i,n));for(let i of r)t.appendChild(je(e,i,n))}function je(t,e,n,r=new Set){if(r.has(e))return;r.add(e);let i=t.reflections[e],s=document.createElement("li");if(s.classList.add("tsd-hierarchy-item"),e===n){let o=s.appendChild(document.createElement("span"));o.textContent=i.name,o.classList.add("tsd-hierarchy-target")}else{for(let a of i.uniqueNameParents||[]){let c=t.reflections[a],l=s.appendChild(document.createElement("a"));l.textContent=c.name,l.href=oe+c.url,l.className=c.class+" tsd-signature-type",s.append(document.createTextNode("."))}let o=s.appendChild(document.createElement("a"));o.textContent=t.reflections[e].name,o.href=oe+i.url,o.className=i.class+" tsd-signature-type"}if(i.children){let o=s.appendChild(document.createElement("ul"));o.classList.add("tsd-hierarchy");for(let a of i.children){let c=je(t,a,n,r);c&&o.appendChild(c)}}return r.delete(e),s}function mt(t,e,n){if(e===n)return!0;let r=new Set,i=[t.reflections[e]];for(;i.length;){let s=i.pop();if(!r.has(s)){r.add(s);for(let o of s.children||[]){if(o===n)return!0;i.push(t.reflections[o])}}}return!1}function gt(){let t=document.createElementNS("http://www.w3.org/2000/svg","svg");return t.setAttribute("width","20"),t.setAttribute("height","20"),t.setAttribute("viewBox","0 0 24 24"),t.setAttribute("fill","none"),t.innerHTML='',t}X(re,"a[data-toggle]");X(ie,".tsd-accordion");X(ee,".tsd-filter-item input[type=checkbox]");var qe=document.getElementById("tsd-theme");qe&&He(qe);var yt=new Z;Object.defineProperty(window,"app",{value:yt});_e();Ne();$e();"virtualKeyboard"in navigator&&(navigator.virtualKeyboard.overlaysContent=!0);})(); -/*! Bundled license information: - -lunr/lunr.js: - (** - * lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 2.3.9 - * Copyright (C) 2020 Oliver Nightingale - * @license MIT - *) - (*! - * lunr.utils - * Copyright (C) 2020 Oliver Nightingale - *) - (*! - * lunr.Set - * Copyright (C) 2020 Oliver Nightingale - *) - (*! - * lunr.tokenizer - * Copyright (C) 2020 Oliver Nightingale - *) - (*! - * lunr.Pipeline - * Copyright (C) 2020 Oliver Nightingale - *) - (*! - * lunr.Vector - * Copyright (C) 2020 Oliver Nightingale - *) - (*! - * lunr.stemmer - * Copyright (C) 2020 Oliver Nightingale - * Includes code from - http://tartarus.org/~martin/PorterStemmer/js.txt - *) - (*! - * lunr.stopWordFilter - * Copyright (C) 2020 Oliver Nightingale - *) - (*! - * lunr.trimmer - * Copyright (C) 2020 Oliver Nightingale - *) - (*! - * lunr.TokenSet - * Copyright (C) 2020 Oliver Nightingale - *) - (*! - * lunr.Index - * Copyright (C) 2020 Oliver Nightingale - *) - (*! - * lunr.Builder - * Copyright (C) 2020 Oliver Nightingale - *) -*/ diff --git a/docs/assets/navigation.js b/docs/assets/navigation.js deleted file mode 100644 index ee9438b..0000000 --- a/docs/assets/navigation.js +++ /dev/null @@ -1 +0,0 @@ -window.navigationData = "eJy1m9ly2zYUht9FvU2bOIvb5C62444TO/XISnqRyXggEqIQUwQLgkrVTt69AFdsPDi03Uub//8dLAcrqS//LiT9Wy7eLEhZLp4sSiK36o8dT+ucVk/VP3/Zyl2untyxIl28ef7jyeD4xteVb9H/dTxPFsmW5amgxeLNl8FeSSLkCUnuMsHrIn1v0TZ1kUjGi44X0Noxjl/++GoUTZBScrEIB75Kls3jt3nGBZPbnV+J1n/rKVEVA/hJTqoK4kciHj3/zajle16Lgh5GPCskFRuSQBE6k1OTV8c+95Jm90Irn083e+cquZGiTmQgewZ2p0A1+AnJgCbuSUoFNeYlWdMcgWl0EOhUNQYVjIwseShDpF7o1PHZ61+PXj23GqwBTDZW8xTVUJEebUHB7hvLciN5uWI7Ggf1Soimn0uyzimqaKYapApSVBsqEMROCdNYiSExd660KGe1IHpGm0iLFtKLwikxwi50IZItKTIK8gxdDKl76+IMpLWSGMhOjgAmkBM+pOuX6uTwh2AZg5vNU8fxLFbZVjI1Nq3FhteyWStZYIg2z27VM9QATemG1LkcOXuiJoi1Q+pUNvGFWT+iFs89XdKdeqSa5ZyLFb+jRiOO66vBnXB5K+0YJ6PybZ5fC5qyFheJ4Omj7CVL6bIBoNCjHEXWGY0HN+o4d0ZpcSXFlxJRwpNapR0rskueEGSXeZZYhOqaVwwNH9Vx7pxMs/Vz2Gp5IclhboTWBcc5F1xNyUV6RiSJ8001zP1AD8gs6ZUw7yMlglYSyTTVMFcPoxnJYckR5Dnp4RjidF292REcUySKtp+SZEsR8EGLYfKcCyxTa7FMTCuMYgT1othwsXN2SiDacCD5n9XiNo/fOWD+Dc1p0mxPsUuA64jw9SG4LnV5EOhRjKJe0aoiGarQtiFGnzlmZo2Xz3TLkpxe7EiGGDGmGsWdMVG5DoCvtoZscxh2WRG2owa4BZdKeUUviaSxsW5pAWaZk8K7ZQgSDSXAq8ie/q622dsIbdBBLDU+u2aJ0UYlxPtOSswuedABrLrAl87SgrdaFRV7ljRjNHR4yHSDNXs1M2Z/EunNt6YMdSjZqIex/UCY7jqBFmOFGjgkZ/8Ak2c4iOsEggi61qbJDAwHMF2Y3FYTpAxOR2G87YMCcCH11DijbQYLlKtlquLGNu1hvu8FE/ibO5V4yfkteDsZzsvI5OQxoSnKLOVuXQcu2wacfowbN1Qm22si1RQbadMGacmB/mp18JoaIqMW1UaKGIEjNzroGlW3PmKhvRzuJypJap2j/L7qJNgXEpIl9slsvH/xmaMeuIkxDvqnvNiwDG6Bnu3ZHrLJD+Jn7fUnd1jT6PA2y7o389ZHr/9EcFmc6D81B8nVVi02W56n7t2ej7TksQtDNXrmoA11jCz0jVVnvKnXVSJY6YzrQBIOoSbtQE6q8SpZkeECdGIAVxdsr89H8vCAekQgQHi6p4Ws3v1VkxzM0CGUYQA3JBu+4p8qes5Fk9A4uGeDdteCK2+1NLoQniCHKCFnPNAnr43nhQv4wf252vzpc8aKq6kMF8j2APA1qeg73Y/YyeMn7aCdowW+PHr98sUzk3pyf+rPRwA3pTk5zAM3llh5zx7CBUu8EXz3Adyp2Vitv2v0U8Q5NJgkaMYq2b4ocw5sEa7plJ1zKsry8aKALV2RHZ2fd9qFyWjZL0Pz8IMtxl89Bh9sH8nnZI5ubz93QruOVfidusddod+uB3pxYoPQMgd9bIsQGuYgeTTE0FbbgswP3qnMgwFDBkR7vujr24msA6PYpliIwAIDLFxthHW4Q49jS0EUnE70p0Weuw9q0bjNkLccRLmdA7yMmcyWKN3zgvcywQk2GsPyAfypKTYaQAIJeQxMgXEwD7W8NQmqjSM096nHj3zF0SD/lysOg/yoVxwj9xGvOEYocMVh3fnqS8GnUn/gwqRzszj0m/73ranBnZeH5vJmUB84imMzZ6LfSbp3rMbRz2cbDuCc16qa28yT5hX2RTqLbzmxcT6zewVRtmiE/v3z/WrjuefEm1sr24qK5A4wZJTQUJuIoKsd+IgFGchyx+Pdoza4mty/Fuga1CJ8uQ/HsF0wf+KrjlgA4OuOF+4VWZvkK/6RmF8XghFcGxRBd9aKqUU0cz6/gCM4NiBCNb/8Fa7sSitYyZRwGfxwMEA2LQB5T3I2fzA7rih/PjvGrag8DS1CxnocaG3LBL93Po1NQrhIkXkoHPVBEeFoiE/O8d+aO3em7caitQfuRUNfvX8n+V17TR3i55ykVyTwm5XOdtsJUIXdkuZiswhe8nrAXgx0l1e6aVywnLje6FH4XmmS++ryXep/OG7DDGFsw9dJP/IUx9TCGPOSFOmOiLszuoGZhhCdUWDajBrkpY/ay//Zepa0sj7eNn4qEKD7Tieg9fOBUViqJAr/+iIQxLFBEZqPHPQEofsnkrtGBNcG3VAUVS3abxbPuZj8liQQJOCE31q2052uPTKC5YHZXZueMTXTFqrdzwXf4aOE3Kh4ftcjQ4U7vztpfv0PiG7lUQ==" \ No newline at end of file diff --git a/docs/assets/search.js b/docs/assets/search.js deleted file mode 100644 index 474edbc..0000000 --- a/docs/assets/search.js +++ /dev/null @@ -1 +0,0 @@ -window.searchData = "eJy9XVuT47ax/i+zrxtbDd79Ft9O7YntpDab5MHlcnEkzgxtSdShqHE2Kf/3gwspNRpNqilx/ZB4d4W+APjQDfQHkv99aJvfjg9f/Pjfh1/r/ebhC/X2YV/uqocvHsrD4eHtw6nd6j/vms1pWx0/1//22Uu32+of1tvyeKy06MPD729D6V+ax2Mgbv5xUj6NzwqOXdl2X5brX5/b5rTf/C/W93Tar7u62fcamaaMlbcPh7Kt9t3gHOd1Wx66pv38+/V7+4c/b5+btu5edkFPXMOfg4aTvQOVny2Nm+hFx01IjKLOjvbp4lgClyFY62Ht2tNaN73XpTe+rnnuhTrxjK3iy1A+V91fD129q/9T6bk/tfvq4/Fu17XSZlD6y0XpH9mHd/v35f65+iRdqfdtr/tT9ag97e/23On4VB4eq+5f5Vb/8Py3al9uu493+6s1/uY0Hs4al/Q+Sc/O9yA5u1zvu6p9KtdTXvcyd4cLWKlLnF7rX6u2Lm/25A3SMHOwhkEYcW1bPR9vd6uXvtslZta+q55v8UuLLTt3m+rY1fvSpNJ7/Hnj67ltxMyYXHfz3ddLOVpvPomrp3aB4bwoWdzBar/5UO+qu/zTOjqnY3H3dMPn+r7RO6v4RM7dCUGn5NOgr+3ucs2KL+6U3Z3fjTmr5VOh7qg3SMbDm7IFctFus6rbs8aEi53erx2fqvYuD5GST+BgfbjTOatgecc+Hu6DXq9gCceYk+bf7QEpPCuf3esbiE+WX5aXzUWwkR2U6UbCrcTg3x2nRWp03rkQSY9u9MrHajtx5gscOAvcZNs7RZSbzQzDrvX9VuvjN7vD1IklsFwfq17ifuu7qp06lwa2h/a3zTTC9ndm3q4bts3+eHxfzN6GcNe7EYyXbVu/llsvkUo86eVkqVPkSWVi6Gw/rNSCXvRic1w4iyxh32T7WdZ7gaVsv9tvqn/PdqDupZbwItiSSJyQb0Fm+fBVc5oJhkFy3Usu4009DxOyPY/Idl94+rrWO+X9et7a7GU3F9kbPfKyxHrb7Of5MUgsYX3T7MxJvxJsC5AHWOpmL4oMkksK+YoWyMx+kvFiaHdz3rqaLiSGb8sX5z7OWqYif25cp9c8GlsuIp9uXi+MV8GRwHowdhywP05TcKjcOF1ndLqkRUXn1l2FRN/gnKrhWfLmuhGxLSsScWbx+P69rxtctTs0vH+kuXUtsjpnYfvi45Ou5bpTW93gzFl2QXfa5vDXp6e5jmipxkot4MJLdWo1ptdfNcepShznxyC6dqILOKOPiP/WwfPQbHU+28x0R58WfeEFHDrU61//MVUj4hwxQqereySZA5PlUc749YKozLB3VpCZlpwWRo3jGGV+6srHbSVJBrjxH5sVAsuj6aE7bv5UH/9U718qk003owPj9fy+vBF6xySQRR2TlKTHfBMXouXuXKnujnkiOd9MOuEh+XoJvNfVN/yDEYytLoDeobe3M42sX0JuUebEdTaR80HIH8pckK5gz4O7Vu8VhyR8F+eTmOEadcNfLJIFqxvdv0hmhKrB3uwQZXozEZreXd/fXGwbgev863XDr/Ucq683mqTlhK/puvdOrE7F0OamuaUG35murV+8q2iMTdRsEbNmW4Oodsaia7GIsfEyySU7LWOoX7XHLz/+1Q9cnFXaeCEX6isD61rcZuyy2W5Onb0xXIe1DPvTz/qnyUpGpFAefipP28v2/bVsa7NZ8HT1ja74fXGLvXZcrrv6tXpf7UylvD1+27Qfml+ryzRdrh4jyyNC93nyXHV/3m7/1lab2lmc9iFovoT19/Wmem9bSoxfWi9l2yxxsWnbeBHL8h4v1ltxT5fp5Zenerup98/fNetSBq5AYgEfjn9rjrXU/KXxIpZnrCu/+cLW9XmnXH+c6YMTutuTb9tGZ+395uuyK696gBvfbfkv1UcZ4oeGd1v8odKNj53MKm58t2UTm+RA91ovY3sG1En7ReybUZzrA5G53w/T5Kty/VJdN39uupDVZosuj0xbNU0XtCoY60vbZey+2z817c4/oUwaRwLLefBPvQub5UEvcLcHf6+21drWsYSbCCpwvwemjHA6mE5dN35pu5Td76vjsXyWdNxvv4D9eVFm6Qjzz+qlXm+rd7vy+XqMwY2XsixPMVTgPg/0qa5++ng+/ExbJ43vs7xvOq3s++q7squuRFiv6X1WD9tyT5++Ym2ihvdZPJav1f/oA/fLtL1zszut6bDYz88Ve5eGd1r8rTwITtnnZvdZO+3FPfSa3mBVoUFtX2tTHXw2E2TPUsj4UBgZWv2MW0kfmH7S/3Blk8vrp4LTHeV7wnpU73V8Kbf1f8aTIe8RFVzMo7Z6ND+PLSbeGyy0mCfnxarzYMclDN4XX2w5b5q2M8lQPkVnicV8OB02uktXigK8M6HofV4x6/YXEvGDJfvLaKS/IYsEWsW5JHB4sle7x1N41exs3Pwqjj5Vt375W9np9Do9cVap11rYIevrhO3JvR9nXrr5k3pwPchdjM+Ka1fs9ts5oeWh9W22OQxVXbnBBaQQR30LabX/qGNbvfaKUpeCf6j10lzap8HjazXgr5r9U/08Oa6DE4HUUr5M1hBYP6SlhJk+jJ1sxn0QHG+mfGCw1tJtW4C1dny3Nk6J6bTRfXjRG6CXZnvhdB0zFmr2Wgu7d3Z87CLFK36YRW75zSAotO+rmLjCEJC9Im8GwUW9wTz7DF+mCPfbPTFZQ//v9UaPDlr84MTv9SwAcVvNwDBqvBCE1+V+U5t92D8l80XtvzmLz5w33GuBZ/L5m/TwlnkUeCoMA4Frs6OAwJfd6dh9Wf35CddW5B4Z6ceq7KWX9EsYnAKPZscmgS+dbXCDM2fBO71Bu6bWsO9987+fHo/rtj7422FmE3XWPyp9e3RAvnX2NuSzyJO+7ZKJ9fjN/53K7Wzrblkdq15YOlWDip/tdZoxx26fKs/F4V+PRM3dzqLZO+3rV8OPdB9vd/qKjttnO52ea2afevYJtV/Efr1/aj40/zhW3zat3QCLvAikFvHl0Da60fE9WtaTB8SzO5zgkh79IwDCLL8Y8UW8O1b7zQ+GJPjQ6HOcyCNf5HYvYijiaHVx5bE8Vt94G4HpU84bIzBzBzBh/subzf8JFnFgU23Lj7M8sBLLjcDXdziw0Bg8tc3uL1PlRt++af5rNf5yjzmmZ5hdymRbPdfHzt1Z9omgKw5gwa4XvN+d94u5sxAajvo/s5elEVo2MnTDBnSWH2ep5Rz5sIAjC01N18xYLwYTt62YiVrYB/Z58cCDD9efHCcFhRBxI+cbp/rcfGYm/HDlvjoTjSf9uLRf2BE80ZMe/EVM0khNj0ekSUcCsYXdGlmHkz75Mnc6lE7tmib2bs6Vx4UQm07uXa66sVkKsLcfhZwjt5+HJjyhO5mrXvQCy3kwvru46ksgupxXfE6/6pEntpw3I6n9qjvdJ1rNflq97kazQMxlUqw+BE9kVv3r4vS4VXoLPW59vZseR+Zn0+NXPLhOj1+Mz6LHr9iV0OMXyzPpcWLb57Crz+3Li+rOv+NzBpL5159xk3mk5XmCaOIN9V7aXulX6DVbEVyb6/HkGhWq/oUOIIE7PPDfb8I8lzrLhze+Bqk/np7pGu/w7iq2RCpwEMt/Evfqw+2uOdll3AqgZa+WfWkf/UHPdgtc9ASXBHuvGJObcne01JK+DE/p3DRCgfAn8mzmSPmSS/tEko/QH1Eamu2LGfXwuUuhS57wop7NH6HFR+fmkfkUo3Jq2buo0974QkulusfTUTw1jAdvBnl5sCZaJgP2qeWfcLzm54wnHT/VUIUu3DRWvpqpwWr7Jfxu86H5wfyTyFMqtQzC7SMLH2p9Gnr2n4yc9oVILePLcfaYHBcfD/2LfTPMh+Y996YJxgcssYwPr+W2np2wiNCSnsz24l4P/AeRvmLOGej4xqDCk1nYj/HkLfNpyfzN+XePb0v5hZYTy0sIXmBLa9/eTQp3xHVaBLclJl9c1dKSNVU79QJI1Jbtfv+O4M+3Tbn5vgw/pdn//nP/u7SQ9FLa6w977m5JoHJoOz1G1FPWLu3GuNXxDolshiPIA2kwOx9QNjR8/903m+Aaoa8TtZN1ZvpVgvWRwm3a3JteQmATy47Zf66aXdW1lMK64gOSWsiPrpnngW1/u+2Ryf+h2Ygm37RbYPKDG9HTxt5MXIFmO227M2J7W4pwdzHuBJayHpQnr1mfeDelxDqd8O/K/WZXtr9+XT1NOoLaLTDh1wadWpsx6LhDNw56aF086ALre7yHF5nvJZayrwHxbnrBhR5oGfGi430IE1f/36nsf2kyncLQmz2/LLv1S//h2vfVEb8WD72FkjEQCsqAjroxkdvMhxD0aQzH1ZvceTMo65q9Uyb1jtE4ChH3uPsPPlJu87fXJUTQbe5q3cOXKti3rM5xV+vaIF3LuIsBemlz0PtDKRyI1NLQvMOLN1e/88GMFh2EMfcm3uIsdu/aK51vd+9Qdi8/r5um3Uhhx3roq1nASXzvxzy9b06vZjFPn1CQaip1B9zwrZv98dS6d4d927Rjb+Fg3GEEl/HoeTjfm7GU+eKJLObFv/zv7Ry/bZud2B9OeGnPgnAldOr2gPXT24fafo7ti/8+vPYvLPviQX0WfVZo0ae62url8sWPw35q3ex27m7Oplmf7B9/6pv9szIfGjSNXevPVw9vf1y9TeCzKMl/+untj4Ow/cH+w6Dj8i9WEPTfgBOEQBA8QaX/pjhBFQgqTzDSf4s4wSgQjDzBWP8t5gTjQDD2BBP9t+RtrD7L88QTTALBxBNM9d9SzmIaCKaeYKb/lnGCWSCYeYK5/lvOCeaBYO4JagT9WHCCRSBY+AAweAAWOxCCBwh6LHzgbZx+pvyhBQY/PoDAwAJYCEGIIfBBBAYawMIIQhyBDyQw8ID4bbz6LMqULxxiCXwwgYEIJKzlEE/gAwoMTCBlLYeYAh9UYKACGTfYIazAxxUYtEDOGg6hBT62wCAGWHRBCC/w8aUMYtSKW34qxJfy8aUMZBSHLxXiS5EAZSOUYg0zMcrHlzKIURErHOJL+fhSBjGKxZcK8aV8fCmDGMXiS4X4Uj6+lEGMYkOWCvGlfHwpAxnFhi0VAkz5AFP5WJBVIb6Ujy9lEKPYsKdCfCkfX5HFFwvOKMRX5OMrMpCJ2OAXhQCLfIBFBjIRmzyjEGARyYI2DbLRL2ISoQ+wKB4b7CjEV+TjKzKIiVhkRyG+Ih9fkUFMxCbhKMRX5OMrMoiJWGRHIb4iH1+RgUyUMpEgCvEV+fiKDGIiFthRiK/Ix1e8Go0EcYiv2MdXbPGVM17HIbxiH16xGo0icQiv2IdXbOFVcIZDdMVkn2U3WuyiiJmtlg+v2AAmZhdFHMIr9uEVp2PbiThEV+yjK85GcR2H6Ip9dMX56DyF6Ip9dMXF6FCH4Ip9cCUGLjEbBZIQXIkPrsTgJWb3QEmIrsRHV6JG90BJiK7ER1cSje4mkhBeiQ+vxMKLjSFJCK+EbOXHo1fC7OZ9eCUGMTEbgJIQX4mPr8QgJmZTaxLiK/HxlRjIxGwESkKAJT7AEoOZmE2PSYiwxEdYahHGpsc0RFjqIyyF0b1bGiIs9RGWqrGInYYAS32ApQYyCRuC0hBgqQ+wdHx7n4YAS32ApckotNMQYCk5L9rtF7vlTJkjow+wNBuN92kIsNQHWJqPZqk0BFjqAywtxgcsBFjqAyyz50f2SJOFAMt8gGX2/MgdabIQX5mPr0yNzlQWAizzAZbZ/T2XabIQX5mPr2x8e5+F+Mp8fGXJKESyEF+Zj6/MICZhvQ7hlZGShAFMojhZpijhoyvLx+c4RFfmoyszeEkiznAIrswHV27gkrC5Ig/Blfvgyg1eEjbc5yG6ch9ducFLwob7PERX7qMrj8bmKQ/Rlfvoyu3enk0VeYiu3EdXbktdfAEpRFfuoyu36GJTRR7CK/fhlRvEpGzEzkN85aTqZRCTspvGnCl8+fjKDWRSdg+VhwDLfYAVBjIpu4cqQoAVPsAKA5mURWcRAqzwAVYYyKQsOosQYIUPsMJgJmXRWYQIK3yEFQYzKYuwIkRY4SOsMJhJWYQVIcIKH2GFLajyZcoQYYWPsMIWVVmEFSHCCh9hhcFMxiKsCBFWkNqqwUzGIqxgyqu0vmpAk/GlyhVXYSUl1pXBTcaizP1G5UmZdWWgk/EFyxVTaF2RSuvKoCfj9nHuJypOaq0rg5+MRZv7jcqTcuvKQChjAed+o/Kk4royKMr44uWKqbmuSNF1ZYCUj9THmbrrihReV7akz1MsK6b0uiK115WBU86XyVdM9XVF4Gcr9jkPP67AH1T4DZxyHn5skZ/Azxbucx5+XJ2fFvpt7T5nQx1wpX5a67fl+5zHH1ftp+V+W8HPudIAcPV+WvC3Nfychx9X8qc1f1vHL3j4cWV/Wve3pfyChx9X+aelf1vNL3j4ccV/Uv0HW9AvePgx9X8gBADYon7Bw4/hAICQAGDr+gUPP4YGAMIDgC3tFzz8GCYACBUAtrpf8PBjyAAgbADYAn/Bhz+GDwBCCICt8Rc8/hhKAAgnALbMr3MSr4ABIOEFwNb6+fXDMANAqAGw1X6d03j7DAAJPQCR4ze5gw8wBAEQhgBs0V9nNVaeASAhCcDW/XVWY+UZABKeAGzpX2c1Vp6jOgkAbflfZzWeKmUQSPgCsBSATmu8AgaChDMASwPovMYrYDBIeAOwVAC/A2GIAyDMAVg2QOdF3j6DQUIfgGUEYIQjZxgEIBQCWFZAZ0ZWAcMiAKERIHY8OwtihkkAQiWAZQd0amTlGRASNgEsQ8AWD4DhE4AQCmA5Ap1Z+f5zlDvBoOUJYIR1Z3gFIMQC9MwCvwoYcgEIuwCWMNDZlVfAoJAwDGBZg7EpZEBIWAaIHQj5VcQwDUCoBkhW4xhgyAYgbAMkDoP8MmIIByCMAzjKQfHLiCEdgLAO4GgHxS8jhngAwjyAJROAr74BQz4AYR/AEgo6x/MecNc/CA4tqaCTPK+AwSFhIcASC6NdYHBImAiw5ALwFwyAISOAsBFgCQbgLxkAQ0gAYSTAkgzAXzQAhpQAwkqAJRqAvzAADDEBhJmA1CGx4O/hMEgk9ASk0ZQCBomEogDHUUQrXgGDREJTgOMpxhQwSCRUBVj2Qe9WuHDAkBVA2AqwBITerbDyDA4JYQGWgwBD5XEdYHBISAtwrMWYAgaHhLgAx1xE7M6MoS6AcBfgyIsoYR1g+AsgBAY4BmNMAQNDQmJA5m7BsTsjhscAQmRA5lDIr0SGywBCZkCWTKwDhs8AQmhAlk7AmCE1gLAakE3AkCE2gDAbkE3BkCE3gLAbkBVTk8jAkFAckK8mxpBhOYDQHJDDxBgyTAcQqgNyNZFTGLYDCN0BeTQeSxjGAwjlAXk8MQkM6wGE9oA8GV/KDPEBhPmAPJ2YRIb8AMJ+QJ6Nr0SG/wBCgEDuYMinNIYDAUKCQO7Oyew6YGgQIDwIFO6YzO4OGSYECBUChTsmszPAkCFA2BAo3DGZPeYyfAgQQgQKB8GRS6oMBgkpAoW7NcDvThleBAgxApbrAP7qEzDcCBByBCzfwRKlwLAjQOgRsIwH8JeJgGFIgFAkYFkP4C8UAcOSAKFJoHD3CPjNLcOUAKFKlKU+gL+hoxiuRBGuRFnuA/hbOoohSxQhS9TKXYviL8EybIkibImy9Afwt3UUw5cowpeolcMhC2TFECaKECZq5S6os0BWDGOiCGOiLAOiT2+8AuYaMaFMlKVAzCPZrALmKjHhTJTlQIBdCorhTBThTJTlQIC/N6AY0kQR0kS5hyJ4BxjSRBHSRLnnIvi7B4phTRRhTZR7OIK/f6AY2kQR2kS5ByT4ewSK4U0U4U2Ue0iCv0ugGOJEEeJE9Q9K8EBmqBNFqBPVPyzBA5nhThThTpR7YIK/V6AY8kQR8kS5pyb4uwWKYU8UYU+Ue3KCv1+gGPpE0YcnlLtdxSOZe36CPkBh+RDg7xko7iGK4CkKew2Zf36DfY6CANESIsDfVVDcsxT0YQrLiAB/X0Fxz1PQByosJQL8nQXFPVNBH6pQDog8krnnKuiDFY5E4e8uKO7ZCvpwhWVFgL+/oLgHLOgTFo5G4e8wKO4hC0KjKEej8NcYFMOjKMKjKMej8PcYFEOkKEKkKEek8BcZFMOkKMKkKMeksDyCYpgURZgU5ZiUjLutqBgiRREiRTkihb/KoBgiRREiRTkiZaQDDAwJj6KibKIDDAoJkaIckcLfpVAMkaIIkaIckcJfplAMkaIIkaIckcLfplAMkaIIkaIckcJfp1AMk6IIk6Ick8Lfp1AMlaIIlaJid3eeXwcMmaIImaIcmcLfqFAMmaIImaIcmcJfqVAMmaIImaIcmcLfqVAMmaIImaIcmcLeJ1UMl6IIl6Icl5LzK4khUxQhU5QjU/hrGYohUxQhU5QjU/h7GYphUxRhU5RjU/iLGYphUxRhU5RjU/ibGYphUxRhU5RjU/irGYphU4Z/s0+xv1ZtV23euafZf/zxoVx35jN9wxf6npq2/zrXfx9+7p951ztBa9k8/Z6n+v9///3yjLv+G3rM3fxmbJebDdagkAadXkQaDgesYXVRIJRv2/q13Ha1eSL/oieKkCeJk9Ugtf9NEpHmx/LZ61t20agyoYbzt74uegAPkuEtrKzhH9wfst5bU0WUGenWL/1LDNr+5UPIWq6Q2zpWilSaV3GYt7maN9PsyoOvsMAKC6FC+wZfpCVB82NOh1bOnNIk6twbpp/dO0iR0hjQyBayWXa6zMejj48fTZ/rja8zxjpl3fV0vlKFCe75nA6bdw5POJpivbKJDvQGzmLQr9RMpW3/rlqsMMcKo5kKTbe3l9epYr0Ylat4jt7QyWSFlc3B0biDCWCdsujqf4AdKQM01+YixFxll2+lY6UZViqLcOtts/fiboyGLhZOgx6qrj2Z96V42eiiqI+Iqg8TkVBvW3dVW5d+J1EfoU8LwvE7tTqMHS7vVMeTi4PsSjh0p9YuPF5hjBXKos6meipJ9E/QastlOMYfbkUORSuctOIhaQ25KkuHpCULPLrfZdud2ormbRwdE9nEbOz3svv3beGQgOHcZ/4+2w4dSKUje7ZAFiLyFoTja18hi1RkODA4iIuUuNef4cSMY7UQ1PTNflgdztCxLPRvmp0ZJz+c4qwcCwepbQ7N05OnBYW8RLbCLm9hQ93CkbMHbbbq/ztsQ4TBr9pvKHy9GNpvNzPZknAvHLNpRG/Oj+5NZUhzgZNSIts3VObFcMHWGC2MSAaTMB6Awqurj6TmSpxY3bFyn0LEO2OsNBmCTJINsUUGQvvRsMP5w25I/wrrj1aDWlkQcGrxN9uw5ghrHoajkM2S1cxsQ1Y4gkXDQaGQwckqfT1/aA2rxUErGo4dhXBwtZb+9ZoBRAvsrxK6OXwmG+canKTTc2aRbRYvr8fGqxLnZyWb7+eqK7fbkQlP0WLMZdHC6eO3xSnqcS5bQxd1wTykqLdCcPfajGN6O/ZUP/uIyTFiZCEDafSdQytFuD6cqrCbCG7CRaE12bOtPiqzu/QULQ3hgrAq+W1hinJNIUWv1TYCOpRcCtkeONC3rZ7Ltbc4UjS5wjOz1uqOO7/ZV1jiJIU3M4l4UnQU0Jlqv9HHE2+7nqJTXSHGnY4nAVgytGAL8YIdi3R4z1aI12tz0Km4/k+1+aU5tXvtpNfVi0ZxRwOF9b51n05Erl70irs9ei7BcVRYCxnU8ZDOcN4UFkN6jWZSxrTiRCQshRitNvy57y4hZThdCksgZ2XN1j/UZnj7uRpybySfmbNWv8N42ymsfgza6l3pI8Y8iIPCvRjeTtteb153wbY7wxlEWFHBKoeXsWKV2EthQUWrPFbbat2ZTyaFuSnHh1zhMd6o7MxZ9mD89LThbcxKPIy9tl11POqJ8f3D+1dhVcBqHF0p+JAHwuqr1tjvKwPo5HjhgXjh9erYkJPj5Qfi5dcXxM+vVX+yLzfGmQpvCZO5etvzq4mxSnxiToQJ3xSxd9tqQ9YgzldKSDf0uoKTPA6HKpLNCvqoET484xKDksWZl+qkT7P1et34hQ9cWk5kq4MUX3BkVpFsCs0i7ZrT0ZyxW/cZK3wA9eo5Qqf2GrTlVqfhMKAUWJ+Seog+gYxKeQhcWdEnDuGeqD5Wu0Pn7fpwPU8ICa3l352GWLMtu8qbCVzUT2Rh6Zfm0T+VooESKrBbHj9x4fA4R4veFfsnUJwARYqCMywO1elQwchkC3lbPlZeZQRri2QOWR3eECtMvchmadt/VmVTPfkrD6uKZOncfk4H68B81VCGUMLTJZmwGE2Y8NShNfgAxBMmW6nmS2mUHcWnKXNNTabHL1Hi3ZyK4mFkZNjZrfUS7Zq23D43bd29eFkPJQJZ8N5VrR+GcG1GGHJ3zaZ++ni+eeAld7wdFq603enYPVblk46SfkUSbzGFvLRt7w09phGFW1/ytRlcQseJN5Z1j3wMBmvD6U7IrXFO4Z1FJBynptNTuKtM5PdGHXMOADKfNCyfax/xeOr6InzSR4SBYspkYHPKSZfxSUHW4f4rERj4aPSFS9H7xgruLY4RwpL5oV7/evJCDWa8U1m2O+h4zuRN7A/AQOkJqSi9ae+6F70AXpotIalxTo+FHp6PKT6VhzO7sPSlVY34hTdlQkLq0DZ6OR5t9ZYLZOZpa7RzFILMKT3ta7vX7vgYCfjiEQhn2uWAzyeTAb4hNU+po+v9zQXO5rIc3qvrvyWKgI0ysZDnaitb1g1uBBV4VpSwl9WzDr+OOQyuyAG+V2YeeHZrJR025AOFaJ5/lBnrZ/z0eFy39SFklhQ2KLy55sF0XDNeVMIT8FB4qzddEyTPBCco4ek/PIPhGrwSskju5PV5eai9IxNaONL5MIo6+yn1oBAICca4cI/YeklEeReL+gTXs4VKeD5sTx4i8Q0PkfxRt+YvJmJiGLIzPSrD3LF8rYL1h+8KAsjCwlmR/ai1t5pxIBRWH47VfmN3L11TbgnbjNNeKgPasWpfa/OdNeuhDTr+hgjXgEDJotdZKXumxatUWAg6K9w9ngj3i3Oy8BB40VZ1JWVozHur0FlZOim9xiFI+fkZ91i4QQ00BlnFvEQBoXuuozWpqUXellW48gbaLLy5iglgBdJZ7iQ3IzEbrGCmpxNqcbFTuKvWarkZxzdbQN75vhR7qPbl1i9uYdZQpq1pO3sD1tOCp1h4lNcxixRyvVpSPFziEO5rLBfwWK5/fdaJab+hRTM8s3J99D6Q8rDnJDPZXsmG6M/1Zmmvt69BvDYP+6Ntu1xlvQ7DDF69woqTAa+34UWhKuo3aql04Oh9a3xDU3hTf3zjhAs+wjKIVWblcQ+RImnkdCyyfwkT9S0RRspejY9P79pNP+DDpTvhHP5mTglkF154t3hlIU3DSu+CzfD7WzLAd2SVsITR2Quhfs0YLyMQsj/ugOrHC7xmhLXM8zmX2dPhw242XEzLhjh0ZhKEz/tQpOAtv/Dqr1Fh+VdSw8WX7lPh8Hl8K+DLBEr4+JHBFqnc4w1NNlD0wkteNhQ++elNeW45wXjY/AvB26td6yzgV6UQeIdbmMKK0qCTPEeBy+DCizJnTY8fw9oePjQJL3CaheoNoFdG7Ts5hJPhkq1w4doY4PmHlu1wi1141dAoI6OHk73wYpDZqXq9xedfWZAMN7v4bpwSHkOYOtR47QAfFYX39E/7sf0fxpxwK3k6mEdZxm7eFTiICstRr+W2HntqCT8ZqYQX/Z2+UBe+OqqEZ2Ly/A9+3CQbuEUhvzD69I/3uIRsNQ2fUGaJMFwsEZbeBn0MnvEECCeUfOA5eI4Rb3uF5Wlyq8SLxMjDeIjyMixP3SnBDJmSFKt/evtwqA/V1lzd+OLHn37//f8Bl1j0uw=="; \ No newline at end of file diff --git a/docs/assets/style.css b/docs/assets/style.css deleted file mode 100644 index 44328e9..0000000 --- a/docs/assets/style.css +++ /dev/null @@ -1,1633 +0,0 @@ -@layer typedoc { - :root { - --dim-toolbar-contents-height: 2.5rem; - --dim-toolbar-border-bottom-width: 1px; - --dim-header-height: calc( - var(--dim-toolbar-border-bottom-width) + - var(--dim-toolbar-contents-height) - ); - - /* 0rem For mobile; unit is required for calculation in `calc` */ - --dim-container-main-margin-y: 0rem; - - --dim-footer-height: 3.5rem; - - --modal-animation-duration: 0.2s; - } - - :root { - /* Light */ - --light-color-background: #f2f4f8; - --light-color-background-secondary: #eff0f1; - /* Not to be confused with [:active](https://developer.mozilla.org/en-US/docs/Web/CSS/:active) */ - --light-color-background-active: #d6d8da; - --light-color-background-warning: #e6e600; - --light-color-warning-text: #222; - --light-color-accent: #c5c7c9; - --light-color-active-menu-item: var(--light-color-background-active); - --light-color-text: #222; - --light-color-contrast-text: #000; - --light-color-text-aside: #5e5e5e; - - --light-color-icon-background: var(--light-color-background); - --light-color-icon-text: var(--light-color-text); - - --light-color-comment-tag-text: var(--light-color-text); - --light-color-comment-tag: var(--light-color-background); - - --light-color-link: #1f70c2; - --light-color-focus-outline: #3584e4; - - --light-color-ts-keyword: #056bd6; - --light-color-ts-project: #b111c9; - --light-color-ts-module: var(--light-color-ts-project); - --light-color-ts-namespace: var(--light-color-ts-project); - --light-color-ts-enum: #7e6f15; - --light-color-ts-enum-member: var(--light-color-ts-enum); - --light-color-ts-variable: #4760ec; - --light-color-ts-function: #572be7; - --light-color-ts-class: #1f70c2; - --light-color-ts-interface: #108024; - --light-color-ts-constructor: var(--light-color-ts-class); - --light-color-ts-property: #9f5f30; - --light-color-ts-method: #be3989; - --light-color-ts-reference: #ff4d82; - --light-color-ts-call-signature: var(--light-color-ts-method); - --light-color-ts-index-signature: var(--light-color-ts-property); - --light-color-ts-constructor-signature: var( - --light-color-ts-constructor - ); - --light-color-ts-parameter: var(--light-color-ts-variable); - /* type literal not included as links will never be generated to it */ - --light-color-ts-type-parameter: #a55c0e; - --light-color-ts-accessor: #c73c3c; - --light-color-ts-get-signature: var(--light-color-ts-accessor); - --light-color-ts-set-signature: var(--light-color-ts-accessor); - --light-color-ts-type-alias: #d51270; - /* reference not included as links will be colored with the kind that it points to */ - --light-color-document: #000000; - - --light-color-alert-note: #0969d9; - --light-color-alert-tip: #1a7f37; - --light-color-alert-important: #8250df; - --light-color-alert-warning: #9a6700; - --light-color-alert-caution: #cf222e; - - --light-external-icon: url("data:image/svg+xml;utf8,"); - --light-color-scheme: light; - } - - :root { - /* Dark */ - --dark-color-background: #2b2e33; - --dark-color-background-secondary: #1e2024; - /* Not to be confused with [:active](https://developer.mozilla.org/en-US/docs/Web/CSS/:active) */ - --dark-color-background-active: #5d5d6a; - --dark-color-background-warning: #bebe00; - --dark-color-warning-text: #222; - --dark-color-accent: #9096a2; - --dark-color-active-menu-item: var(--dark-color-background-active); - --dark-color-text: #f5f5f5; - --dark-color-contrast-text: #ffffff; - --dark-color-text-aside: #dddddd; - - --dark-color-icon-background: var(--dark-color-background-secondary); - --dark-color-icon-text: var(--dark-color-text); - - --dark-color-comment-tag-text: var(--dark-color-text); - --dark-color-comment-tag: var(--dark-color-background); - - --dark-color-link: #00aff4; - --dark-color-focus-outline: #4c97f2; - - --dark-color-ts-keyword: #3399ff; - --dark-color-ts-project: #e358ff; - --dark-color-ts-module: var(--dark-color-ts-project); - --dark-color-ts-namespace: var(--dark-color-ts-project); - --dark-color-ts-enum: #f4d93e; - --dark-color-ts-enum-member: var(--dark-color-ts-enum); - --dark-color-ts-variable: #798dff; - --dark-color-ts-function: #a280ff; - --dark-color-ts-class: #8ac4ff; - --dark-color-ts-interface: #6cff87; - --dark-color-ts-constructor: var(--dark-color-ts-class); - --dark-color-ts-property: #ff984d; - --dark-color-ts-method: #ff4db8; - --dark-color-ts-reference: #ff4d82; - --dark-color-ts-call-signature: var(--dark-color-ts-method); - --dark-color-ts-index-signature: var(--dark-color-ts-property); - --dark-color-ts-constructor-signature: var(--dark-color-ts-constructor); - --dark-color-ts-parameter: var(--dark-color-ts-variable); - /* type literal not included as links will never be generated to it */ - --dark-color-ts-type-parameter: #e07d13; - --dark-color-ts-accessor: #ff6060; - --dark-color-ts-get-signature: var(--dark-color-ts-accessor); - --dark-color-ts-set-signature: var(--dark-color-ts-accessor); - --dark-color-ts-type-alias: #ff6492; - /* reference not included as links will be colored with the kind that it points to */ - --dark-color-document: #ffffff; - - --dark-color-alert-note: #0969d9; - --dark-color-alert-tip: #1a7f37; - --dark-color-alert-important: #8250df; - --dark-color-alert-warning: #9a6700; - --dark-color-alert-caution: #cf222e; - - --dark-external-icon: url("data:image/svg+xml;utf8,"); - --dark-color-scheme: dark; - } - - @media (prefers-color-scheme: light) { - :root { - --color-background: var(--light-color-background); - --color-background-secondary: var( - --light-color-background-secondary - ); - --color-background-active: var(--light-color-background-active); - --color-background-warning: var(--light-color-background-warning); - --color-warning-text: var(--light-color-warning-text); - --color-accent: var(--light-color-accent); - --color-active-menu-item: var(--light-color-active-menu-item); - --color-text: var(--light-color-text); - --color-contrast-text: var(--light-color-contrast-text); - --color-text-aside: var(--light-color-text-aside); - - --color-icon-background: var(--light-color-icon-background); - --color-icon-text: var(--light-color-icon-text); - - --color-comment-tag-text: var(--light-color-text); - --color-comment-tag: var(--light-color-background); - - --color-link: var(--light-color-link); - --color-focus-outline: var(--light-color-focus-outline); - - --color-ts-keyword: var(--light-color-ts-keyword); - --color-ts-project: var(--light-color-ts-project); - --color-ts-module: var(--light-color-ts-module); - --color-ts-namespace: var(--light-color-ts-namespace); - --color-ts-enum: var(--light-color-ts-enum); - --color-ts-enum-member: var(--light-color-ts-enum-member); - --color-ts-variable: var(--light-color-ts-variable); - --color-ts-function: var(--light-color-ts-function); - --color-ts-class: var(--light-color-ts-class); - --color-ts-interface: var(--light-color-ts-interface); - --color-ts-constructor: var(--light-color-ts-constructor); - --color-ts-property: var(--light-color-ts-property); - --color-ts-method: var(--light-color-ts-method); - --color-ts-reference: var(--light-color-ts-reference); - --color-ts-call-signature: var(--light-color-ts-call-signature); - --color-ts-index-signature: var(--light-color-ts-index-signature); - --color-ts-constructor-signature: var( - --light-color-ts-constructor-signature - ); - --color-ts-parameter: var(--light-color-ts-parameter); - --color-ts-type-parameter: var(--light-color-ts-type-parameter); - --color-ts-accessor: var(--light-color-ts-accessor); - --color-ts-get-signature: var(--light-color-ts-get-signature); - --color-ts-set-signature: var(--light-color-ts-set-signature); - --color-ts-type-alias: var(--light-color-ts-type-alias); - --color-document: var(--light-color-document); - - --color-alert-note: var(--light-color-alert-note); - --color-alert-tip: var(--light-color-alert-tip); - --color-alert-important: var(--light-color-alert-important); - --color-alert-warning: var(--light-color-alert-warning); - --color-alert-caution: var(--light-color-alert-caution); - - --external-icon: var(--light-external-icon); - --color-scheme: var(--light-color-scheme); - } - } - - @media (prefers-color-scheme: dark) { - :root { - --color-background: var(--dark-color-background); - --color-background-secondary: var( - --dark-color-background-secondary - ); - --color-background-active: var(--dark-color-background-active); - --color-background-warning: var(--dark-color-background-warning); - --color-warning-text: var(--dark-color-warning-text); - --color-accent: var(--dark-color-accent); - --color-active-menu-item: var(--dark-color-active-menu-item); - --color-text: var(--dark-color-text); - --color-contrast-text: var(--dark-color-contrast-text); - --color-text-aside: var(--dark-color-text-aside); - - --color-icon-background: var(--dark-color-icon-background); - --color-icon-text: var(--dark-color-icon-text); - - --color-comment-tag-text: var(--dark-color-text); - --color-comment-tag: var(--dark-color-background); - - --color-link: var(--dark-color-link); - --color-focus-outline: var(--dark-color-focus-outline); - - --color-ts-keyword: var(--dark-color-ts-keyword); - --color-ts-project: var(--dark-color-ts-project); - --color-ts-module: var(--dark-color-ts-module); - --color-ts-namespace: var(--dark-color-ts-namespace); - --color-ts-enum: var(--dark-color-ts-enum); - --color-ts-enum-member: var(--dark-color-ts-enum-member); - --color-ts-variable: var(--dark-color-ts-variable); - --color-ts-function: var(--dark-color-ts-function); - --color-ts-class: var(--dark-color-ts-class); - --color-ts-interface: var(--dark-color-ts-interface); - --color-ts-constructor: var(--dark-color-ts-constructor); - --color-ts-property: var(--dark-color-ts-property); - --color-ts-method: var(--dark-color-ts-method); - --color-ts-reference: var(--dark-color-ts-reference); - --color-ts-call-signature: var(--dark-color-ts-call-signature); - --color-ts-index-signature: var(--dark-color-ts-index-signature); - --color-ts-constructor-signature: var( - --dark-color-ts-constructor-signature - ); - --color-ts-parameter: var(--dark-color-ts-parameter); - --color-ts-type-parameter: var(--dark-color-ts-type-parameter); - --color-ts-accessor: var(--dark-color-ts-accessor); - --color-ts-get-signature: var(--dark-color-ts-get-signature); - --color-ts-set-signature: var(--dark-color-ts-set-signature); - --color-ts-type-alias: var(--dark-color-ts-type-alias); - --color-document: var(--dark-color-document); - - --color-alert-note: var(--dark-color-alert-note); - --color-alert-tip: var(--dark-color-alert-tip); - --color-alert-important: var(--dark-color-alert-important); - --color-alert-warning: var(--dark-color-alert-warning); - --color-alert-caution: var(--dark-color-alert-caution); - - --external-icon: var(--dark-external-icon); - --color-scheme: var(--dark-color-scheme); - } - } - - :root[data-theme="light"] { - --color-background: var(--light-color-background); - --color-background-secondary: var(--light-color-background-secondary); - --color-background-active: var(--light-color-background-active); - --color-background-warning: var(--light-color-background-warning); - --color-warning-text: var(--light-color-warning-text); - --color-icon-background: var(--light-color-icon-background); - --color-accent: var(--light-color-accent); - --color-active-menu-item: var(--light-color-active-menu-item); - --color-text: var(--light-color-text); - --color-contrast-text: var(--light-color-contrast-text); - --color-text-aside: var(--light-color-text-aside); - --color-icon-text: var(--light-color-icon-text); - - --color-comment-tag-text: var(--light-color-text); - --color-comment-tag: var(--light-color-background); - - --color-link: var(--light-color-link); - --color-focus-outline: var(--light-color-focus-outline); - - --color-ts-keyword: var(--light-color-ts-keyword); - --color-ts-project: var(--light-color-ts-project); - --color-ts-module: var(--light-color-ts-module); - --color-ts-namespace: var(--light-color-ts-namespace); - --color-ts-enum: var(--light-color-ts-enum); - --color-ts-enum-member: var(--light-color-ts-enum-member); - --color-ts-variable: var(--light-color-ts-variable); - --color-ts-function: var(--light-color-ts-function); - --color-ts-class: var(--light-color-ts-class); - --color-ts-interface: var(--light-color-ts-interface); - --color-ts-constructor: var(--light-color-ts-constructor); - --color-ts-property: var(--light-color-ts-property); - --color-ts-method: var(--light-color-ts-method); - --color-ts-reference: var(--light-color-ts-reference); - --color-ts-call-signature: var(--light-color-ts-call-signature); - --color-ts-index-signature: var(--light-color-ts-index-signature); - --color-ts-constructor-signature: var( - --light-color-ts-constructor-signature - ); - --color-ts-parameter: var(--light-color-ts-parameter); - --color-ts-type-parameter: var(--light-color-ts-type-parameter); - --color-ts-accessor: var(--light-color-ts-accessor); - --color-ts-get-signature: var(--light-color-ts-get-signature); - --color-ts-set-signature: var(--light-color-ts-set-signature); - --color-ts-type-alias: var(--light-color-ts-type-alias); - --color-document: var(--light-color-document); - - --color-note: var(--light-color-note); - --color-tip: var(--light-color-tip); - --color-important: var(--light-color-important); - --color-warning: var(--light-color-warning); - --color-caution: var(--light-color-caution); - - --external-icon: var(--light-external-icon); - --color-scheme: var(--light-color-scheme); - } - - :root[data-theme="dark"] { - --color-background: var(--dark-color-background); - --color-background-secondary: var(--dark-color-background-secondary); - --color-background-active: var(--dark-color-background-active); - --color-background-warning: var(--dark-color-background-warning); - --color-warning-text: var(--dark-color-warning-text); - --color-icon-background: var(--dark-color-icon-background); - --color-accent: var(--dark-color-accent); - --color-active-menu-item: var(--dark-color-active-menu-item); - --color-text: var(--dark-color-text); - --color-contrast-text: var(--dark-color-contrast-text); - --color-text-aside: var(--dark-color-text-aside); - --color-icon-text: var(--dark-color-icon-text); - - --color-comment-tag-text: var(--dark-color-text); - --color-comment-tag: var(--dark-color-background); - - --color-link: var(--dark-color-link); - --color-focus-outline: var(--dark-color-focus-outline); - - --color-ts-keyword: var(--dark-color-ts-keyword); - --color-ts-project: var(--dark-color-ts-project); - --color-ts-module: var(--dark-color-ts-module); - --color-ts-namespace: var(--dark-color-ts-namespace); - --color-ts-enum: var(--dark-color-ts-enum); - --color-ts-enum-member: var(--dark-color-ts-enum-member); - --color-ts-variable: var(--dark-color-ts-variable); - --color-ts-function: var(--dark-color-ts-function); - --color-ts-class: var(--dark-color-ts-class); - --color-ts-interface: var(--dark-color-ts-interface); - --color-ts-constructor: var(--dark-color-ts-constructor); - --color-ts-property: var(--dark-color-ts-property); - --color-ts-method: var(--dark-color-ts-method); - --color-ts-reference: var(--dark-color-ts-reference); - --color-ts-call-signature: var(--dark-color-ts-call-signature); - --color-ts-index-signature: var(--dark-color-ts-index-signature); - --color-ts-constructor-signature: var( - --dark-color-ts-constructor-signature - ); - --color-ts-parameter: var(--dark-color-ts-parameter); - --color-ts-type-parameter: var(--dark-color-ts-type-parameter); - --color-ts-accessor: var(--dark-color-ts-accessor); - --color-ts-get-signature: var(--dark-color-ts-get-signature); - --color-ts-set-signature: var(--dark-color-ts-set-signature); - --color-ts-type-alias: var(--dark-color-ts-type-alias); - --color-document: var(--dark-color-document); - - --color-note: var(--dark-color-note); - --color-tip: var(--dark-color-tip); - --color-important: var(--dark-color-important); - --color-warning: var(--dark-color-warning); - --color-caution: var(--dark-color-caution); - - --external-icon: var(--dark-external-icon); - --color-scheme: var(--dark-color-scheme); - } - - html { - color-scheme: var(--color-scheme); - @media (prefers-reduced-motion: no-preference) { - scroll-behavior: smooth; - } - } - - *:focus-visible, - .tsd-accordion-summary:focus-visible svg { - outline: 2px solid var(--color-focus-outline); - } - - .always-visible, - .always-visible .tsd-signatures { - display: inherit !important; - } - - h1, - h2, - h3, - h4, - h5, - h6 { - line-height: 1.2; - } - - h1 { - font-size: 1.875rem; - margin: 0.67rem 0; - } - - h2 { - font-size: 1.5rem; - margin: 0.83rem 0; - } - - h3 { - font-size: 1.25rem; - margin: 1rem 0; - } - - h4 { - font-size: 1.05rem; - margin: 1.33rem 0; - } - - h5 { - font-size: 1rem; - margin: 1.5rem 0; - } - - h6 { - font-size: 0.875rem; - margin: 2.33rem 0; - } - - dl, - menu, - ol, - ul { - margin: 1em 0; - } - - dd { - margin: 0 0 0 34px; - } - - .container { - max-width: 1700px; - padding: 0 2rem; - } - - /* Footer */ - footer { - border-top: 1px solid var(--color-accent); - padding-top: 1rem; - padding-bottom: 1rem; - max-height: var(--dim-footer-height); - } - footer > p { - margin: 0 1em; - } - - .container-main { - margin: var(--dim-container-main-margin-y) auto; - /* toolbar, footer, margin */ - min-height: calc( - 100svh - var(--dim-header-height) - var(--dim-footer-height) - - 2 * var(--dim-container-main-margin-y) - ); - } - - @keyframes fade-in { - from { - opacity: 0; - } - to { - opacity: 1; - } - } - @keyframes fade-out { - from { - opacity: 1; - visibility: visible; - } - to { - opacity: 0; - } - } - @keyframes pop-in-from-right { - from { - transform: translate(100%, 0); - } - to { - transform: translate(0, 0); - } - } - @keyframes pop-out-to-right { - from { - transform: translate(0, 0); - visibility: visible; - } - to { - transform: translate(100%, 0); - } - } - body { - background: var(--color-background); - font-family: - -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", - Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"; - font-size: 16px; - color: var(--color-text); - margin: 0; - } - - a { - color: var(--color-link); - text-decoration: none; - } - a:hover { - text-decoration: underline; - } - a.external[target="_blank"] { - background-image: var(--external-icon); - background-position: top 3px right; - background-repeat: no-repeat; - padding-right: 13px; - } - a.tsd-anchor-link { - color: var(--color-text); - } - :target { - scroll-margin-block: calc(var(--dim-header-height) + 0.5rem); - } - - code, - pre { - font-family: Menlo, Monaco, Consolas, "Courier New", monospace; - padding: 0.2em; - margin: 0; - font-size: 0.875rem; - border-radius: 0.8em; - } - - pre { - position: relative; - white-space: pre-wrap; - word-wrap: break-word; - padding: 10px; - border: 1px solid var(--color-accent); - margin-bottom: 8px; - } - pre code { - padding: 0; - font-size: 100%; - } - pre > button { - position: absolute; - top: 10px; - right: 10px; - opacity: 0; - transition: opacity 0.1s; - box-sizing: border-box; - } - pre:hover > button, - pre > button.visible, - pre > button:focus-visible { - opacity: 1; - } - - blockquote { - margin: 1em 0; - padding-left: 1em; - border-left: 4px solid gray; - } - - img { - max-width: 100%; - } - - * { - scrollbar-width: thin; - scrollbar-color: var(--color-accent) var(--color-icon-background); - } - - *::-webkit-scrollbar { - width: 0.75rem; - } - - *::-webkit-scrollbar-track { - background: var(--color-icon-background); - } - - *::-webkit-scrollbar-thumb { - background-color: var(--color-accent); - border-radius: 999rem; - border: 0.25rem solid var(--color-icon-background); - } - - dialog { - border: none; - outline: none; - padding: 0; - background-color: var(--color-background); - } - dialog::backdrop { - display: none; - } - #tsd-overlay { - background-color: rgba(0, 0, 0, 0.5); - position: fixed; - z-index: 9999; - top: 0; - left: 0; - right: 0; - bottom: 0; - animation: fade-in var(--modal-animation-duration) forwards; - } - #tsd-overlay.closing { - animation-name: fade-out; - } - - .tsd-typography { - line-height: 1.333em; - } - .tsd-typography ul { - list-style: square; - padding: 0 0 0 20px; - margin: 0; - } - .tsd-typography .tsd-index-panel h3, - .tsd-index-panel .tsd-typography h3, - .tsd-typography h4, - .tsd-typography h5, - .tsd-typography h6 { - font-size: 1em; - } - .tsd-typography h5, - .tsd-typography h6 { - font-weight: normal; - } - .tsd-typography p, - .tsd-typography ul, - .tsd-typography ol { - margin: 1em 0; - } - .tsd-typography table { - border-collapse: collapse; - border: none; - } - .tsd-typography td, - .tsd-typography th { - padding: 6px 13px; - border: 1px solid var(--color-accent); - } - .tsd-typography thead, - .tsd-typography tr:nth-child(even) { - background-color: var(--color-background-secondary); - } - - .tsd-alert { - padding: 8px 16px; - margin-bottom: 16px; - border-left: 0.25em solid var(--alert-color); - } - .tsd-alert blockquote > :last-child, - .tsd-alert > :last-child { - margin-bottom: 0; - } - .tsd-alert-title { - color: var(--alert-color); - display: inline-flex; - align-items: center; - } - .tsd-alert-title span { - margin-left: 4px; - } - - .tsd-alert-note { - --alert-color: var(--color-alert-note); - } - .tsd-alert-tip { - --alert-color: var(--color-alert-tip); - } - .tsd-alert-important { - --alert-color: var(--color-alert-important); - } - .tsd-alert-warning { - --alert-color: var(--color-alert-warning); - } - .tsd-alert-caution { - --alert-color: var(--color-alert-caution); - } - - .tsd-breadcrumb { - margin: 0; - margin-top: 1rem; - padding: 0; - color: var(--color-text-aside); - } - .tsd-breadcrumb a { - color: var(--color-text-aside); - text-decoration: none; - } - .tsd-breadcrumb a:hover { - text-decoration: underline; - } - .tsd-breadcrumb li { - display: inline; - } - .tsd-breadcrumb li:after { - content: " / "; - } - - .tsd-comment-tags { - display: flex; - flex-direction: column; - } - dl.tsd-comment-tag-group { - display: flex; - align-items: center; - overflow: hidden; - margin: 0.5em 0; - } - dl.tsd-comment-tag-group dt { - display: flex; - margin-right: 0.5em; - font-size: 0.875em; - font-weight: normal; - } - dl.tsd-comment-tag-group dd { - margin: 0; - } - code.tsd-tag { - padding: 0.25em 0.4em; - border: 0.1em solid var(--color-accent); - margin-right: 0.25em; - font-size: 70%; - } - h1 code.tsd-tag:first-of-type { - margin-left: 0.25em; - } - - dl.tsd-comment-tag-group dd:before, - dl.tsd-comment-tag-group dd:after { - content: " "; - } - dl.tsd-comment-tag-group dd pre, - dl.tsd-comment-tag-group dd:after { - clear: both; - } - dl.tsd-comment-tag-group p { - margin: 0; - } - - .tsd-panel.tsd-comment .lead { - font-size: 1.1em; - line-height: 1.333em; - margin-bottom: 2em; - } - .tsd-panel.tsd-comment .lead:last-child { - margin-bottom: 0; - } - - .tsd-filter-visibility h4 { - font-size: 1rem; - padding-top: 0.75rem; - padding-bottom: 0.5rem; - margin: 0; - } - .tsd-filter-item:not(:last-child) { - margin-bottom: 0.5rem; - } - .tsd-filter-input { - display: flex; - width: -moz-fit-content; - width: fit-content; - align-items: center; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - cursor: pointer; - } - .tsd-filter-input input[type="checkbox"] { - cursor: pointer; - position: absolute; - width: 1.5em; - height: 1.5em; - opacity: 0; - } - .tsd-filter-input input[type="checkbox"]:disabled { - pointer-events: none; - } - .tsd-filter-input svg { - cursor: pointer; - width: 1.5em; - height: 1.5em; - margin-right: 0.5em; - border-radius: 0.33em; - /* Leaving this at full opacity breaks event listeners on Firefox. - Don't remove unless you know what you're doing. */ - opacity: 0.99; - } - .tsd-filter-input input[type="checkbox"]:focus-visible + svg { - outline: 2px solid var(--color-focus-outline); - } - .tsd-checkbox-background { - fill: var(--color-accent); - } - input[type="checkbox"]:checked ~ svg .tsd-checkbox-checkmark { - stroke: var(--color-text); - } - .tsd-filter-input input:disabled ~ svg > .tsd-checkbox-background { - fill: var(--color-background); - stroke: var(--color-accent); - stroke-width: 0.25rem; - } - .tsd-filter-input input:disabled ~ svg > .tsd-checkbox-checkmark { - stroke: var(--color-accent); - } - - .settings-label { - font-weight: bold; - text-transform: uppercase; - display: inline-block; - } - - .tsd-filter-visibility .settings-label { - margin: 0.75rem 0 0.5rem 0; - } - - .tsd-theme-toggle .settings-label { - margin: 0.75rem 0.75rem 0 0; - } - - .tsd-hierarchy h4 label:hover span { - text-decoration: underline; - } - - .tsd-hierarchy { - list-style: square; - margin: 0; - } - .tsd-hierarchy-target { - font-weight: bold; - } - .tsd-hierarchy-toggle { - color: var(--color-link); - cursor: pointer; - } - - .tsd-full-hierarchy:not(:last-child) { - margin-bottom: 1em; - padding-bottom: 1em; - border-bottom: 1px solid var(--color-accent); - } - .tsd-full-hierarchy, - .tsd-full-hierarchy ul { - list-style: none; - margin: 0; - padding: 0; - } - .tsd-full-hierarchy ul { - padding-left: 1.5rem; - } - .tsd-full-hierarchy a { - padding: 0.25rem 0 !important; - font-size: 1rem; - display: inline-flex; - align-items: center; - color: var(--color-text); - } - .tsd-full-hierarchy svg[data-dropdown] { - cursor: pointer; - } - .tsd-full-hierarchy svg[data-dropdown="false"] { - transform: rotate(-90deg); - } - .tsd-full-hierarchy svg[data-dropdown="false"] ~ ul { - display: none; - } - - .tsd-panel-group.tsd-index-group { - margin-bottom: 0; - } - .tsd-index-panel .tsd-index-list { - list-style: none; - line-height: 1.333em; - margin: 0; - padding: 0.25rem 0 0 0; - overflow: hidden; - display: grid; - grid-template-columns: repeat(3, 1fr); - column-gap: 1rem; - grid-template-rows: auto; - } - @media (max-width: 1024px) { - .tsd-index-panel .tsd-index-list { - grid-template-columns: repeat(2, 1fr); - } - } - @media (max-width: 768px) { - .tsd-index-panel .tsd-index-list { - grid-template-columns: repeat(1, 1fr); - } - } - .tsd-index-panel .tsd-index-list li { - -webkit-page-break-inside: avoid; - -moz-page-break-inside: avoid; - -ms-page-break-inside: avoid; - -o-page-break-inside: avoid; - page-break-inside: avoid; - } - - .tsd-flag { - display: inline-block; - padding: 0.25em 0.4em; - border-radius: 4px; - color: var(--color-comment-tag-text); - background-color: var(--color-comment-tag); - text-indent: 0; - font-size: 75%; - line-height: 1; - font-weight: normal; - } - - .tsd-anchor { - position: relative; - top: -100px; - } - - .tsd-member { - position: relative; - } - .tsd-member .tsd-anchor + h3 { - display: flex; - align-items: center; - margin-top: 0; - margin-bottom: 0; - border-bottom: none; - } - - .tsd-navigation.settings { - margin: 0; - margin-bottom: 1rem; - } - .tsd-navigation > a, - .tsd-navigation .tsd-accordion-summary { - width: calc(100% - 0.25rem); - display: flex; - align-items: center; - } - .tsd-navigation a, - .tsd-navigation summary > span, - .tsd-page-navigation a { - display: flex; - width: calc(100% - 0.25rem); - align-items: center; - padding: 0.25rem; - color: var(--color-text); - text-decoration: none; - box-sizing: border-box; - } - .tsd-navigation a.current, - .tsd-page-navigation a.current { - background: var(--color-active-menu-item); - color: var(--color-contrast-text); - } - .tsd-navigation a:hover, - .tsd-page-navigation a:hover { - text-decoration: underline; - } - .tsd-navigation ul, - .tsd-page-navigation ul { - margin-top: 0; - margin-bottom: 0; - padding: 0; - list-style: none; - } - .tsd-navigation li, - .tsd-page-navigation li { - padding: 0; - max-width: 100%; - } - .tsd-navigation .tsd-nav-link { - display: none; - } - .tsd-nested-navigation { - margin-left: 3rem; - } - .tsd-nested-navigation > li > details { - margin-left: -1.5rem; - } - .tsd-small-nested-navigation { - margin-left: 1.5rem; - } - .tsd-small-nested-navigation > li > details { - margin-left: -1.5rem; - } - - .tsd-page-navigation-section > summary { - padding: 0.25rem; - } - .tsd-page-navigation-section > summary > svg { - margin-right: 0.25rem; - } - .tsd-page-navigation-section > div { - margin-left: 30px; - } - .tsd-page-navigation ul { - padding-left: 1.75rem; - } - - #tsd-sidebar-links a { - margin-top: 0; - margin-bottom: 0.5rem; - line-height: 1.25rem; - } - #tsd-sidebar-links a:last-of-type { - margin-bottom: 0; - } - - a.tsd-index-link { - padding: 0.25rem 0 !important; - font-size: 1rem; - line-height: 1.25rem; - display: inline-flex; - align-items: center; - color: var(--color-text); - } - .tsd-accordion-summary { - list-style-type: none; /* hide marker on non-safari */ - outline: none; /* broken on safari, so just hide it */ - display: flex; - align-items: center; - gap: 0.25rem; - box-sizing: border-box; - } - .tsd-accordion-summary::-webkit-details-marker { - display: none; /* hide marker on safari */ - } - .tsd-accordion-summary, - .tsd-accordion-summary a { - -moz-user-select: none; - -webkit-user-select: none; - -ms-user-select: none; - user-select: none; - - cursor: pointer; - } - .tsd-accordion-summary a { - width: calc(100% - 1.5rem); - } - .tsd-accordion-summary > * { - margin-top: 0; - margin-bottom: 0; - padding-top: 0; - padding-bottom: 0; - } - /* - * We need to be careful to target the arrow indicating whether the accordion - * is open, but not any other SVGs included in the details element. - */ - .tsd-accordion:not([open]) > .tsd-accordion-summary > svg:first-child { - transform: rotate(-90deg); - } - .tsd-index-content > :not(:first-child) { - margin-top: 0.75rem; - } - .tsd-index-summary { - margin-top: 1.5rem; - margin-bottom: 0.75rem; - display: flex; - align-content: center; - } - - .tsd-no-select { - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - } - .tsd-kind-icon { - margin-right: 0.5rem; - width: 1.25rem; - height: 1.25rem; - min-width: 1.25rem; - min-height: 1.25rem; - } - .tsd-signature > .tsd-kind-icon { - margin-right: 0.8rem; - } - - .tsd-panel { - margin-bottom: 2.5rem; - } - .tsd-panel.tsd-member { - margin-bottom: 4rem; - } - .tsd-panel:empty { - display: none; - } - .tsd-panel > h1, - .tsd-panel > h2, - .tsd-panel > h3 { - margin: 1.5rem -1.5rem 0.75rem -1.5rem; - padding: 0 1.5rem 0.75rem 1.5rem; - } - .tsd-panel > h1.tsd-before-signature, - .tsd-panel > h2.tsd-before-signature, - .tsd-panel > h3.tsd-before-signature { - margin-bottom: 0; - border-bottom: none; - } - - .tsd-panel-group { - margin: 2rem 0; - } - .tsd-panel-group.tsd-index-group { - margin: 2rem 0; - } - .tsd-panel-group.tsd-index-group details { - margin: 2rem 0; - } - .tsd-panel-group > .tsd-accordion-summary { - margin-bottom: 1rem; - } - - #tsd-search[open] { - animation: fade-in var(--modal-animation-duration) ease-out forwards; - } - #tsd-search[open].closing { - animation-name: fade-out; - } - - /* Avoid setting `display` on closed dialog */ - #tsd-search[open] { - display: flex; - flex-direction: column; - padding: 1rem; - width: 32rem; - max-width: 90vw; - max-height: calc(100vh - env(keyboard-inset-height, 0px) - 25vh); - /* Anchor dialog to top */ - margin-top: 10vh; - border-radius: 6px; - will-change: max-height; - } - #tsd-search-input { - box-sizing: border-box; - width: 100%; - padding: 0 0.625rem; /* 10px */ - outline: 0; - border: 2px solid var(--color-accent); - background-color: transparent; - color: var(--color-text); - border-radius: 4px; - height: 2.5rem; - flex: 0 0 auto; - font-size: 0.875rem; - transition: border-color 0.2s, background-color 0.2s; - } - #tsd-search-input:focus-visible { - background-color: var(--color-background-active); - border-color: transparent; - color: var(--color-contrast-text); - } - #tsd-search-input::placeholder { - color: inherit; - opacity: 0.8; - } - #tsd-search-results { - margin: 0; - padding: 0; - list-style: none; - flex: 1 1 auto; - display: flex; - flex-direction: column; - overflow-y: auto; - } - #tsd-search-results:not(:empty) { - margin-top: 0.5rem; - } - #tsd-search-results > li { - background-color: var(--color-background); - line-height: 1.5; - box-sizing: border-box; - border-radius: 4px; - } - #tsd-search-results > li:nth-child(even) { - background-color: var(--color-background-secondary); - } - #tsd-search-results > li:is(:hover, [aria-selected="true"]) { - background-color: var(--color-background-active); - color: var(--color-contrast-text); - } - /* It's important that this takes full size of parent `li`, to capture a click on `li` */ - #tsd-search-results > li > a { - display: flex; - align-items: center; - padding: 0.5rem 0.25rem; - box-sizing: border-box; - width: 100%; - } - #tsd-search-results > li > a > .text { - flex: 1 1 auto; - min-width: 0; - overflow-wrap: anywhere; - } - #tsd-search-results > li > a .parent { - color: var(--color-text-aside); - } - #tsd-search-results > li > a mark { - color: inherit; - background-color: inherit; - font-weight: bold; - } - #tsd-search-status { - flex: 1; - display: grid; - place-content: center; - text-align: center; - overflow-wrap: anywhere; - } - #tsd-search-status:not(:empty) { - min-height: 6rem; - } - - .tsd-signature { - margin: 0 0 1rem 0; - padding: 1rem 0.5rem; - border: 1px solid var(--color-accent); - font-family: Menlo, Monaco, Consolas, "Courier New", monospace; - font-size: 14px; - overflow-x: auto; - } - - .tsd-signature-keyword { - color: var(--color-ts-keyword); - font-weight: normal; - } - - .tsd-signature-symbol { - color: var(--color-text-aside); - font-weight: normal; - } - - .tsd-signature-type { - font-style: italic; - font-weight: normal; - } - - .tsd-signatures { - padding: 0; - margin: 0 0 1em 0; - list-style-type: none; - } - .tsd-signatures .tsd-signature { - margin: 0; - border-color: var(--color-accent); - border-width: 1px 0; - transition: background-color 0.1s; - } - .tsd-signatures .tsd-index-signature:not(:last-child) { - margin-bottom: 1em; - } - .tsd-signatures .tsd-index-signature .tsd-signature { - border-width: 1px; - } - .tsd-description .tsd-signatures .tsd-signature { - border-width: 1px; - } - - ul.tsd-parameter-list, - ul.tsd-type-parameter-list { - list-style: square; - margin: 0; - padding-left: 20px; - } - ul.tsd-parameter-list > li.tsd-parameter-signature, - ul.tsd-type-parameter-list > li.tsd-parameter-signature { - list-style: none; - margin-left: -20px; - } - ul.tsd-parameter-list h5, - ul.tsd-type-parameter-list h5 { - font-size: 16px; - margin: 1em 0 0.5em 0; - } - .tsd-sources { - margin-top: 1rem; - font-size: 0.875em; - } - .tsd-sources a { - color: var(--color-text-aside); - text-decoration: underline; - } - .tsd-sources ul { - list-style: none; - padding: 0; - } - - .tsd-page-toolbar { - position: sticky; - z-index: 1; - top: 0; - left: 0; - width: 100%; - color: var(--color-text); - background: var(--color-background-secondary); - border-bottom: var(--dim-toolbar-border-bottom-width) - var(--color-accent) solid; - transition: transform 0.3s ease-in-out; - } - .tsd-page-toolbar a { - color: var(--color-text); - } - .tsd-toolbar-contents { - display: flex; - align-items: center; - height: var(--dim-toolbar-contents-height); - margin: 0 auto; - } - .tsd-toolbar-contents > .title { - font-weight: bold; - margin-right: auto; - } - #tsd-toolbar-links { - display: flex; - align-items: center; - gap: 1.5rem; - margin-right: 1rem; - } - - .tsd-widget { - box-sizing: border-box; - display: inline-block; - opacity: 0.8; - height: 2.5rem; - width: 2.5rem; - transition: opacity 0.1s, background-color 0.1s; - text-align: center; - cursor: pointer; - border: none; - background-color: transparent; - } - .tsd-widget:hover { - opacity: 0.9; - } - .tsd-widget:active { - opacity: 1; - background-color: var(--color-accent); - } - #tsd-toolbar-menu-trigger { - display: none; - } - - .tsd-member-summary-name { - display: inline-flex; - align-items: center; - padding: 0.25rem; - text-decoration: none; - } - - .tsd-anchor-icon { - display: inline-flex; - align-items: center; - margin-left: 0.5rem; - color: var(--color-text); - vertical-align: middle; - } - - .tsd-anchor-icon svg { - width: 1em; - height: 1em; - visibility: hidden; - } - - .tsd-member-summary-name:hover > .tsd-anchor-icon svg, - .tsd-anchor-link:hover > .tsd-anchor-icon svg, - .tsd-anchor-icon:focus-visible svg { - visibility: visible; - } - - .deprecated { - text-decoration: line-through !important; - } - - .warning { - padding: 1rem; - color: var(--color-warning-text); - background: var(--color-background-warning); - } - - .tsd-kind-project { - color: var(--color-ts-project); - } - .tsd-kind-module { - color: var(--color-ts-module); - } - .tsd-kind-namespace { - color: var(--color-ts-namespace); - } - .tsd-kind-enum { - color: var(--color-ts-enum); - } - .tsd-kind-enum-member { - color: var(--color-ts-enum-member); - } - .tsd-kind-variable { - color: var(--color-ts-variable); - } - .tsd-kind-function { - color: var(--color-ts-function); - } - .tsd-kind-class { - color: var(--color-ts-class); - } - .tsd-kind-interface { - color: var(--color-ts-interface); - } - .tsd-kind-constructor { - color: var(--color-ts-constructor); - } - .tsd-kind-property { - color: var(--color-ts-property); - } - .tsd-kind-method { - color: var(--color-ts-method); - } - .tsd-kind-reference { - color: var(--color-ts-reference); - } - .tsd-kind-call-signature { - color: var(--color-ts-call-signature); - } - .tsd-kind-index-signature { - color: var(--color-ts-index-signature); - } - .tsd-kind-constructor-signature { - color: var(--color-ts-constructor-signature); - } - .tsd-kind-parameter { - color: var(--color-ts-parameter); - } - .tsd-kind-type-parameter { - color: var(--color-ts-type-parameter); - } - .tsd-kind-accessor { - color: var(--color-ts-accessor); - } - .tsd-kind-get-signature { - color: var(--color-ts-get-signature); - } - .tsd-kind-set-signature { - color: var(--color-ts-set-signature); - } - .tsd-kind-type-alias { - color: var(--color-ts-type-alias); - } - - /* if we have a kind icon, don't color the text by kind */ - .tsd-kind-icon ~ span { - color: var(--color-text); - } - - /* mobile */ - @media (max-width: 769px) { - #tsd-toolbar-menu-trigger { - display: inline-block; - /* temporary fix to vertically align, for compatibility */ - line-height: 2.5; - } - #tsd-toolbar-links { - display: none; - } - - .container-main { - display: flex; - } - .col-content { - float: none; - max-width: 100%; - width: 100%; - } - .col-sidebar { - position: fixed !important; - overflow-y: auto; - -webkit-overflow-scrolling: touch; - z-index: 1024; - top: 0 !important; - bottom: 0 !important; - left: auto !important; - right: 0 !important; - padding: 1.5rem 1.5rem 0 0; - width: 75vw; - visibility: hidden; - background-color: var(--color-background); - transform: translate(100%, 0); - } - .col-sidebar > *:last-child { - padding-bottom: 20px; - } - .overlay { - content: ""; - display: block; - position: fixed; - z-index: 1023; - top: 0; - left: 0; - right: 0; - bottom: 0; - background-color: rgba(0, 0, 0, 0.75); - visibility: hidden; - } - - .to-has-menu .overlay { - animation: fade-in 0.4s; - } - - .to-has-menu .col-sidebar { - animation: pop-in-from-right 0.4s; - } - - .from-has-menu .overlay { - animation: fade-out 0.4s; - } - - .from-has-menu .col-sidebar { - animation: pop-out-to-right 0.4s; - } - - .has-menu body { - overflow: hidden; - } - .has-menu .overlay { - visibility: visible; - } - .has-menu .col-sidebar { - visibility: visible; - transform: translate(0, 0); - display: flex; - flex-direction: column; - gap: 1.5rem; - max-height: 100vh; - padding: 1rem 2rem; - } - .has-menu .tsd-navigation { - max-height: 100%; - } - .tsd-navigation .tsd-nav-link { - display: flex; - } - } - - /* one sidebar */ - @media (min-width: 770px) { - .container-main { - display: grid; - grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); - grid-template-areas: "sidebar content"; - --dim-container-main-margin-y: 2rem; - } - - .tsd-breadcrumb { - margin-top: 0; - } - - .col-sidebar { - grid-area: sidebar; - } - .col-content { - grid-area: content; - padding: 0 1rem; - } - } - @media (min-width: 770px) and (max-width: 1399px) { - .col-sidebar { - max-height: calc( - 100vh - var(--dim-header-height) - var(--dim-footer-height) - - 2 * var(--dim-container-main-margin-y) - ); - overflow: auto; - position: sticky; - top: calc( - var(--dim-header-height) + var(--dim-container-main-margin-y) - ); - } - .site-menu { - margin-top: 1rem; - } - } - - /* two sidebars */ - @media (min-width: 1200px) { - .container-main { - grid-template-columns: - minmax(0, 1fr) minmax(0, 2.5fr) minmax( - 0, - 20rem - ); - grid-template-areas: "sidebar content toc"; - } - - .col-sidebar { - display: contents; - } - - .page-menu { - grid-area: toc; - padding-left: 1rem; - } - .site-menu { - grid-area: sidebar; - } - - .site-menu { - margin-top: 0rem; - } - - .page-menu, - .site-menu { - max-height: calc( - 100vh - var(--dim-header-height) - var(--dim-footer-height) - - 2 * var(--dim-container-main-margin-y) - ); - overflow: auto; - position: sticky; - top: calc( - var(--dim-header-height) + var(--dim-container-main-margin-y) - ); - } - } -} diff --git a/docs/classes/raptor_McRaptorAlgorithm.McRaptorAlgorithm.html b/docs/classes/raptor_McRaptorAlgorithm.McRaptorAlgorithm.html deleted file mode 100644 index 2ebb4a4..0000000 --- a/docs/classes/raptor_McRaptorAlgorithm.McRaptorAlgorithm.html +++ /dev/null @@ -1,30 +0,0 @@ -McRaptorAlgorithm | mbus-backend
mbus-backend
    Preparing search index...

    Implementation of the McRAPTOR (Multi-Criteria Round-Based Public Transit Routing) algorithm. -Optimizes for arrival time, walking distance, and number of transfers.

    -
    Index

    Constructors

    Methods

    • Calculates optimal journeys for a specific departure time.

      -

      Parameters

      • origin: string

        The starting Stop ID.

        -
      • destination: string

        The destination Stop ID.

        -
      • departureTime: number

        The exact departure time.

        -

      Returns Journey[]

      A list of optimal Journey objects.

      -
    • Finds the best journeys within a time window, filtering for Pareto optimality across all departures.

      -

      Parameters

      • origin: string

        The starting Stop ID.

        -
      • destination: string

        The destination Stop ID.

        -
      • startTime: number

        The start of the departure window.

        -
      • range: number

        The duration of the window to search (e.g. 3600s).

        -

      Returns Journey[]

      A deduplicated list of the best journeys found in the time range.

      -
    • Executes the McRAPTOR algorithm to find all non-dominated paths to the destination.

      -

      Parameters

      • origin: string

        The starting Stop ID.

        -
      • destination: string

        The destination Stop ID.

        -
      • departureTime: number

        The time of departure.

        -

      Returns Bag

      A Bag containing Pareto-optimal labels for the destination.

      -
    • Sets the penalty multiplier for walking (default is 1).

      -

      Parameters

      • penalty: number

        The multiplier for walking duration cost.

        -

      Returns void

    diff --git a/docs/classes/raptor_McStructs.Bag.html b/docs/classes/raptor_McStructs.Bag.html deleted file mode 100644 index 7463c61..0000000 --- a/docs/classes/raptor_McStructs.Bag.html +++ /dev/null @@ -1,13 +0,0 @@ -Bag | mbus-backend
    mbus-backend
      Preparing search index...

      A container for Labels at a specific stop that maintains a Pareto frontier. -Only keeps labels that are not dominated by any other label in the bag.

      -
      Index

      Constructors

      Properties

      Methods

      Constructors

      Properties

      labels: Label[] = []

      Methods

      • Attempts to add a label to the bag.

        -

        Parameters

        Returns boolean

        True if the label was added (it was non-dominated), False otherwise.

        -
      • Merges another bag's labels into this one.

        -

        Parameters

        Returns boolean

        True if the merge resulted in any changes to this bag.

        -
      diff --git a/docs/classes/raptor_McStructs.Label.html b/docs/classes/raptor_McStructs.Label.html deleted file mode 100644 index ca4ff9f..0000000 --- a/docs/classes/raptor_McStructs.Label.html +++ /dev/null @@ -1,36 +0,0 @@ -Label | mbus-backend
      mbus-backend
        Preparing search index...

        Represents a state or arrival at a specific stop in the routing graph. -Used to trace back the path and store performance metrics.

        -
        Index

        Constructors

        • Parameters

          • arrivalTime: number

            Time of arrival at this stop.

            -
          • walkingDistance: number

            Cumulative walking distance in meters.

            -
          • transferCount: number

            Number of transfers taken so far.

            -
          • parent: Label | null = null

            The previous label in the chain (used for backtracking).

            -
          • trip: Trip | null = null

            The trip taken to reach this state (if applicable).

            -
          • transfer: Transfer | null = null

            The transfer used to reach this state (if applicable).

            -
          • stop: string | null = null

            The ID of the current stop.

            -
          • enterTime: number = 0

            Time when the passenger boarded the vehicle.

            -
          • stopIndex: number = -1

            Index of the current stop in the trip's sequence.

            -

          Returns Label

        Properties

        arrivalTime: number

        Time of arrival at this stop.

        -
        enterTime: number = 0

        Time when the passenger boarded the vehicle.

        -
        parent: Label | null = null

        The previous label in the chain (used for backtracking).

        -
        stop: string | null = null

        The ID of the current stop.

        -
        stopIndex: number = -1

        Index of the current stop in the trip's sequence.

        -
        transfer: Transfer | null = null

        The transfer used to reach this state (if applicable).

        -
        transferCount: number

        Number of transfers taken so far.

        -
        trip: Trip | null = null

        The trip taken to reach this state (if applicable).

        -
        walkingDistance: number

        Cumulative walking distance in meters.

        -

        Methods

        • Determines if this label is strictly better than another label. -A label dominates if it is better or equal in all criteria and strictly better in at least one.

          -

          Parameters

          Returns boolean

        diff --git a/docs/functions/jobs.startBackgroundJobs.html b/docs/functions/jobs.startBackgroundJobs.html deleted file mode 100644 index 2eed3bd..0000000 --- a/docs/functions/jobs.startBackgroundJobs.html +++ /dev/null @@ -1,2 +0,0 @@ -startBackgroundJobs | mbus-backend
        mbus-backend
          Preparing search index...

          Function startBackgroundJobs

          • Starts background jobs for updating bus positions, initializing routes, and rebuilding the graph.

            -

            Returns void

          diff --git a/docs/functions/routes_api.activeRemindersForToken.html b/docs/functions/routes_api.activeRemindersForToken.html deleted file mode 100644 index af2db27..0000000 --- a/docs/functions/routes_api.activeRemindersForToken.html +++ /dev/null @@ -1,3 +0,0 @@ -activeRemindersForToken | mbus-backend
          mbus-backend
            Preparing search index...

            Function activeRemindersForToken

            • Parameters

              • req: Request

                Express request, token is path encoded

                -
              • res: Response<{ reminders: ActiveReminderInfo[] }>

                Express response

                -

              Returns void

            diff --git a/docs/functions/routes_api.getAllPredictions.html b/docs/functions/routes_api.getAllPredictions.html deleted file mode 100644 index 8b3990a..0000000 --- a/docs/functions/routes_api.getAllPredictions.html +++ /dev/null @@ -1,5 +0,0 @@ -getAllPredictions | mbus-backend
            mbus-backend
              Preparing search index...

              Function getAllPredictions

              • Returns all active bus predictions grouped by vehicle ID.

                -

                Parameters

                • req: Request

                  Express request

                  -
                • res: Response

                  Express response

                  -

                Returns void

                JSON array of objects, each with vid and stops (predictions).

                -
              diff --git a/docs/functions/routes_api.getAllRideRoutes.html b/docs/functions/routes_api.getAllRideRoutes.html deleted file mode 100644 index 23cfae4..0000000 --- a/docs/functions/routes_api.getAllRideRoutes.html +++ /dev/null @@ -1,5 +0,0 @@ -getAllRideRoutes | mbus-backend
              mbus-backend
                Preparing search index...

                Function getAllRideRoutes

                • Returns all cached ride route patterns.

                  -

                  Parameters

                  • req: Request

                    Express request

                    -
                  • res: Response

                    Express response

                    -

                  Returns void

                  JSON object with routes mapping route IDs to patterns.

                  -
                diff --git a/docs/functions/routes_api.getAllRideStops.html b/docs/functions/routes_api.getAllRideStops.html deleted file mode 100644 index ba9acd2..0000000 --- a/docs/functions/routes_api.getAllRideStops.html +++ /dev/null @@ -1,5 +0,0 @@ -getAllRideStops | mbus-backend
                mbus-backend
                  Preparing search index...

                  Function getAllRideStops

                  • Returns a list of all known stops with their locations.

                    -

                    Parameters

                    • req: Request

                      Express request

                      -
                    • res: Response

                      Express response

                      -

                    Returns void

                    JSON array of stop objects.

                    -
                  diff --git a/docs/functions/routes_api.getAllRoutes.html b/docs/functions/routes_api.getAllRoutes.html deleted file mode 100644 index f764bd9..0000000 --- a/docs/functions/routes_api.getAllRoutes.html +++ /dev/null @@ -1,5 +0,0 @@ -getAllRoutes | mbus-backend
                  mbus-backend
                    Preparing search index...

                    Function getAllRoutes

                    • Returns all cached route patterns.

                      -

                      Parameters

                      • req: Request

                        Express request

                        -
                      • res: Response

                        Express response

                        -

                      Returns void

                      JSON object with routes mapping route IDs to patterns.

                      -
                    diff --git a/docs/functions/routes_api.getAllStops.html b/docs/functions/routes_api.getAllStops.html deleted file mode 100644 index c997411..0000000 --- a/docs/functions/routes_api.getAllStops.html +++ /dev/null @@ -1,5 +0,0 @@ -getAllStops | mbus-backend
                    mbus-backend
                      Preparing search index...

                      Function getAllStops

                      • Returns a list of all known stops with their locations.

                        -

                        Parameters

                        • req: Request

                          Express request

                          -
                        • res: Response

                          Express response

                          -

                        Returns void

                        JSON array of stop objects.

                        -
                      diff --git a/docs/functions/routes_api.getBuildingLocations.html b/docs/functions/routes_api.getBuildingLocations.html deleted file mode 100644 index bd10bd4..0000000 --- a/docs/functions/routes_api.getBuildingLocations.html +++ /dev/null @@ -1,5 +0,0 @@ -getBuildingLocations | mbus-backend
                      mbus-backend
                        Preparing search index...

                        Function getBuildingLocations

                        • Serves the building locations JSON file.

                          -

                          Parameters

                          • req: Request

                            Express request

                            -
                          • res: Response

                            Express response

                            -

                          Returns void

                          JSON file containing building data.

                          -
                        diff --git a/docs/functions/routes_api.getBusPositions.html b/docs/functions/routes_api.getBusPositions.html deleted file mode 100644 index 4f304a7..0000000 --- a/docs/functions/routes_api.getBusPositions.html +++ /dev/null @@ -1,5 +0,0 @@ -getBusPositions | mbus-backend
                        mbus-backend
                          Preparing search index...

                          Function getBusPositions

                          • Returns current positions of all michgan buses.

                            -

                            Parameters

                            • req: Request

                              Express request

                              -
                            • res: Response

                              Express response

                              -

                            Returns void

                            JSON object with buses array.

                            -
                          diff --git a/docs/functions/routes_api.getBusPredictions.html b/docs/functions/routes_api.getBusPredictions.html deleted file mode 100644 index 8e85c0b..0000000 --- a/docs/functions/routes_api.getBusPredictions.html +++ /dev/null @@ -1,5 +0,0 @@ -getBusPredictions | mbus-backend
                          mbus-backend
                            Preparing search index...

                            Function getBusPredictions

                            • Returns predictions for a specific bus ID.

                              -

                              Parameters

                              • req: Request

                                Express request

                                -
                              • res: Response

                                Express response

                                -

                              Returns void

                              JSON object with bustime-response containing prd (predictions).

                              -
                            diff --git a/docs/functions/routes_api.getBusPredictionsLegacy.html b/docs/functions/routes_api.getBusPredictionsLegacy.html deleted file mode 100644 index bb8f4b8..0000000 --- a/docs/functions/routes_api.getBusPredictionsLegacy.html +++ /dev/null @@ -1,4 +0,0 @@ -getBusPredictionsLegacy | mbus-backend
                            mbus-backend
                              Preparing search index...

                              Function getBusPredictionsLegacy

                              • Legacy/test endpoint for bus predictions.

                                -

                                Parameters

                                • req: Request

                                  Express request

                                  -
                                • res: Response

                                  Express response

                                  -

                                Returns void

                              diff --git a/docs/functions/routes_api.getFrontendData.html b/docs/functions/routes_api.getFrontendData.html deleted file mode 100644 index cd99eab..0000000 --- a/docs/functions/routes_api.getFrontendData.html +++ /dev/null @@ -1,5 +0,0 @@ -getFrontendData | mbus-backend
                              mbus-backend
                                Preparing search index...

                                Function getFrontendData

                                • Returns aggregated data for the frontend, including route configs and metadata.

                                  -

                                  Parameters

                                  • req: Request

                                    Express request

                                    -
                                  • res: Response

                                    Express response

                                    -

                                  Returns void

                                  JSON object with routes (array of route details) and metadata.

                                  -
                                diff --git a/docs/functions/routes_api.getKeyStops.html b/docs/functions/routes_api.getKeyStops.html deleted file mode 100644 index 0aaba13..0000000 --- a/docs/functions/routes_api.getKeyStops.html +++ /dev/null @@ -1,5 +0,0 @@ -getKeyStops | mbus-backend
                                mbus-backend
                                  Preparing search index...

                                  Function getKeyStops

                                  • Returns key stops.

                                    -

                                    Parameters

                                    • req: Request

                                      Express request

                                      -
                                    • res: Response

                                      Express response

                                      -

                                    Returns void

                                    JSON object with message details.

                                    -
                                  diff --git a/docs/functions/routes_api.getNearestStops.html b/docs/functions/routes_api.getNearestStops.html deleted file mode 100644 index e360e8b..0000000 --- a/docs/functions/routes_api.getNearestStops.html +++ /dev/null @@ -1,5 +0,0 @@ -getNearestStops | mbus-backend
                                  mbus-backend
                                    Preparing search index...

                                    Function getNearestStops

                                    • Returns the nearest k stops to a given latitude and longitude.

                                      -

                                      Parameters

                                      • req: Request

                                        Express request

                                        -
                                      • res: Response

                                        Express response

                                        -

                                      Returns void

                                      JSON object with nearestStops array.

                                      -
                                    diff --git a/docs/functions/routes_api.getRidePositions.html b/docs/functions/routes_api.getRidePositions.html deleted file mode 100644 index 9c4abad..0000000 --- a/docs/functions/routes_api.getRidePositions.html +++ /dev/null @@ -1,5 +0,0 @@ -getRidePositions | mbus-backend
                                    mbus-backend
                                      Preparing search index...

                                      Function getRidePositions

                                      • returns positions of all ride busses

                                        -

                                        Parameters

                                        • req: Request

                                          Express request

                                          -
                                        • res: Response

                                          Express response

                                          -

                                        Returns void

                                        JSON object with buses array.

                                        -
                                      diff --git a/docs/functions/routes_api.getRidePredictions.html b/docs/functions/routes_api.getRidePredictions.html deleted file mode 100644 index a91929a..0000000 --- a/docs/functions/routes_api.getRidePredictions.html +++ /dev/null @@ -1,5 +0,0 @@ -getRidePredictions | mbus-backend
                                      mbus-backend
                                        Preparing search index...

                                        Function getRidePredictions

                                        • Returns predictions for a specific ride bus ID.

                                          -

                                          Parameters

                                          • req: Request

                                            Express request

                                            -
                                          • res: Response

                                            Express response

                                            -

                                          Returns void

                                          JSON object with bustime-response containing prd (predictions).

                                          -
                                        diff --git a/docs/functions/routes_api.getRideStopPredictions.html b/docs/functions/routes_api.getRideStopPredictions.html deleted file mode 100644 index ca779c0..0000000 --- a/docs/functions/routes_api.getRideStopPredictions.html +++ /dev/null @@ -1,5 +0,0 @@ -getRideStopPredictions | mbus-backend
                                        mbus-backend
                                          Preparing search index...

                                          Function getRideStopPredictions

                                          • Returns predictions for a specific ride stop ID.

                                            -

                                            Parameters

                                            • req: Request

                                              Express request

                                              -
                                            • res: Response

                                              Express response

                                              -

                                            Returns void

                                            JSON object with bustime-response containing prd (predictions).

                                            -
                                          diff --git a/docs/functions/routes_api.getRouteCache.html b/docs/functions/routes_api.getRouteCache.html deleted file mode 100644 index 5e3222b..0000000 --- a/docs/functions/routes_api.getRouteCache.html +++ /dev/null @@ -1,5 +0,0 @@ -getRouteCache | mbus-backend
                                          mbus-backend
                                            Preparing search index...

                                            Function getRouteCache

                                            • Returns the route timing cache used for extrapolation.

                                              -

                                              Parameters

                                              • req: Request

                                                Express request

                                                -
                                              • res: Response

                                                Express response

                                                -

                                              Returns void

                                              JSON object with routes containing timing data.

                                              -
                                            diff --git a/docs/functions/routes_api.getRouteColor.html b/docs/functions/routes_api.getRouteColor.html deleted file mode 100644 index 2b49c96..0000000 --- a/docs/functions/routes_api.getRouteColor.html +++ /dev/null @@ -1,5 +0,0 @@ -getRouteColor | mbus-backend
                                            mbus-backend
                                              Preparing search index...

                                              Function getRouteColor

                                              • Returns the color and image for a specific route ID.

                                                -

                                                Parameters

                                                • req: Request

                                                  Express request

                                                  -
                                                • res: Response

                                                  Express response

                                                  -

                                                Returns void

                                                JSON object with routeId, color, and image.

                                                -
                                              diff --git a/docs/functions/routes_api.getRouteColors.html b/docs/functions/routes_api.getRouteColors.html deleted file mode 100644 index 25a616d..0000000 --- a/docs/functions/routes_api.getRouteColors.html +++ /dev/null @@ -1,5 +0,0 @@ -getRouteColors | mbus-backend
                                              mbus-backend
                                                Preparing search index...

                                                Function getRouteColors

                                                • Returns configuration (colors and images) for all routes.

                                                  -

                                                  Parameters

                                                  • req: Request

                                                    Express request

                                                    -
                                                  • res: Response

                                                    Express response

                                                    -

                                                  Returns void

                                                  JSON object with a routes array containing route configs.

                                                  -
                                                diff --git a/docs/functions/routes_api.getRouteInfoVersion.html b/docs/functions/routes_api.getRouteInfoVersion.html deleted file mode 100644 index 5623b6d..0000000 --- a/docs/functions/routes_api.getRouteInfoVersion.html +++ /dev/null @@ -1,5 +0,0 @@ -getRouteInfoVersion | mbus-backend
                                                mbus-backend
                                                  Preparing search index...

                                                  Function getRouteInfoVersion

                                                  • Returns the current version of the route information.

                                                    -

                                                    Parameters

                                                    • req: Request

                                                      Express request

                                                      -
                                                    • res: Response

                                                      Express response

                                                      -

                                                    Returns void

                                                    JSON object with the version string.

                                                    -
                                                  diff --git a/docs/functions/routes_api.getRouteInformation.html b/docs/functions/routes_api.getRouteInformation.html deleted file mode 100644 index a583c28..0000000 --- a/docs/functions/routes_api.getRouteInformation.html +++ /dev/null @@ -1,5 +0,0 @@ -getRouteInformation | mbus-backend
                                                  mbus-backend
                                                    Preparing search index...

                                                    Function getRouteInformation

                                                    • Returns static route metadata including names, images, and colors.

                                                      -

                                                      Parameters

                                                      • req: Request

                                                        Express request

                                                        -
                                                      • res: Response

                                                        Express response

                                                        -

                                                      Returns void

                                                      JSON object containing routeIdToName, routeImages, metadata, and routeColors.

                                                      -
                                                    diff --git a/docs/functions/routes_api.getSelectableRoutes.html b/docs/functions/routes_api.getSelectableRoutes.html deleted file mode 100644 index 253334e..0000000 --- a/docs/functions/routes_api.getSelectableRoutes.html +++ /dev/null @@ -1,5 +0,0 @@ -getSelectableRoutes | mbus-backend
                                                    mbus-backend
                                                      Preparing search index...

                                                      Function getSelectableRoutes

                                                      • Returns a list of all selectable routes with their names and colors.

                                                        -

                                                        Parameters

                                                        • req: Request

                                                          Express request

                                                          -
                                                        • res: Response

                                                          Express response

                                                          -

                                                        Returns void

                                                        JSON object with a bustime-response containing a list of routes.

                                                        -
                                                      diff --git a/docs/functions/routes_api.getStartupInfo.html b/docs/functions/routes_api.getStartupInfo.html deleted file mode 100644 index 5a12518..0000000 --- a/docs/functions/routes_api.getStartupInfo.html +++ /dev/null @@ -1,5 +0,0 @@ -getStartupInfo | mbus-backend
                                                      mbus-backend
                                                        Preparing search index...

                                                        Function getStartupInfo

                                                        • Returns startup configuration info including supported versions and messages.

                                                          -

                                                          Parameters

                                                          • req: Request

                                                            Express request

                                                            -
                                                          • res: Response

                                                            Express response

                                                            -

                                                          Returns void

                                                          JSON object with version info and messages.

                                                          -
                                                        diff --git a/docs/functions/routes_api.getStartupMessages.html b/docs/functions/routes_api.getStartupMessages.html deleted file mode 100644 index df88d25..0000000 --- a/docs/functions/routes_api.getStartupMessages.html +++ /dev/null @@ -1,5 +0,0 @@ -getStartupMessages | mbus-backend
                                                        mbus-backend
                                                          Preparing search index...

                                                          Function getStartupMessages

                                                          • Returns special startup messages (e.g., holiday greetings).

                                                            -

                                                            Parameters

                                                            • req: Request

                                                              Express request

                                                              -
                                                            • res: Response

                                                              Express response

                                                              -

                                                            Returns void

                                                            JSON object with message details.

                                                            -
                                                          diff --git a/docs/functions/routes_api.getStopPredictions.html b/docs/functions/routes_api.getStopPredictions.html deleted file mode 100644 index ff7f2ec..0000000 --- a/docs/functions/routes_api.getStopPredictions.html +++ /dev/null @@ -1,5 +0,0 @@ -getStopPredictions | mbus-backend
                                                          mbus-backend
                                                            Preparing search index...

                                                            Function getStopPredictions

                                                            • Returns predictions for a specific stop ID.

                                                              -

                                                              Parameters

                                                              • req: Request

                                                                Express request

                                                                -
                                                              • res: Response

                                                                Express response

                                                                -

                                                              Returns void

                                                              JSON object with bustime-response containing prd (predictions).

                                                              -
                                                            diff --git a/docs/functions/routes_api.getVehicleImage.html b/docs/functions/routes_api.getVehicleImage.html deleted file mode 100644 index d7d2c1c..0000000 --- a/docs/functions/routes_api.getVehicleImage.html +++ /dev/null @@ -1,5 +0,0 @@ -getVehicleImage | mbus-backend
                                                            mbus-backend
                                                              Preparing search index...

                                                              Function getVehicleImage

                                                              • Serves the image file for a specific route.

                                                                -

                                                                Parameters

                                                                • req: Request

                                                                  Express request

                                                                  -
                                                                • res: Response

                                                                  Express response

                                                                  -

                                                                Returns void

                                                                Image file (PNG).

                                                                -
                                                              diff --git a/docs/functions/routes_api.getVehiclePositions.html b/docs/functions/routes_api.getVehiclePositions.html deleted file mode 100644 index bb3d311..0000000 --- a/docs/functions/routes_api.getVehiclePositions.html +++ /dev/null @@ -1,5 +0,0 @@ -getVehiclePositions | mbus-backend
                                                              mbus-backend
                                                                Preparing search index...

                                                                Function getVehiclePositions

                                                                • Alias for getBusPositions.

                                                                  -

                                                                  Parameters

                                                                  • req: Request

                                                                    Express request

                                                                    -
                                                                  • res: Response

                                                                    Express response

                                                                    -

                                                                  Returns void

                                                                  JSON object with buses array.

                                                                  -
                                                                diff --git a/docs/functions/routes_api.modifyReminders.html b/docs/functions/routes_api.modifyReminders.html deleted file mode 100644 index 7d03dcd..0000000 --- a/docs/functions/routes_api.modifyReminders.html +++ /dev/null @@ -1,4 +0,0 @@ -modifyReminders | mbus-backend
                                                                mbus-backend
                                                                  Preparing search index...

                                                                  Function modifyReminders

                                                                  • Lets you run the equivalent of several setReminder and unsetReminders in one call

                                                                    -

                                                                    Parameters

                                                                    • req: Request

                                                                      Express request expecting ModifyRemindersBody in body

                                                                      -
                                                                    • res: Response

                                                                      Express response

                                                                      -

                                                                    Returns void

                                                                  diff --git a/docs/functions/routes_api.notifyMeLater.html b/docs/functions/routes_api.notifyMeLater.html deleted file mode 100644 index 7035476..0000000 --- a/docs/functions/routes_api.notifyMeLater.html +++ /dev/null @@ -1 +0,0 @@ -notifyMeLater | mbus-backend
                                                                  mbus-backend
                                                                    Preparing search index...

                                                                    Function notifyMeLater

                                                                    • Parameters

                                                                      • req: Request
                                                                      • res: Response

                                                                      Returns void

                                                                    diff --git a/docs/functions/routes_api.planJourney.html b/docs/functions/routes_api.planJourney.html deleted file mode 100644 index 73be18d..0000000 --- a/docs/functions/routes_api.planJourney.html +++ /dev/null @@ -1,5 +0,0 @@ -planJourney | mbus-backend
                                                                    mbus-backend
                                                                      Preparing search index...

                                                                      Function planJourney

                                                                      • Plans a journey between origin and destination coordinates.

                                                                        -

                                                                        Parameters

                                                                        • req: Request

                                                                          Express request

                                                                          -
                                                                        • res: Response

                                                                          Express response

                                                                          -

                                                                        Returns Promise<void>

                                                                        JSON object with journeys array containing possible routes.

                                                                        -
                                                                      diff --git a/docs/functions/routes_api.saveGraph.html b/docs/functions/routes_api.saveGraph.html deleted file mode 100644 index 2dbfb87..0000000 --- a/docs/functions/routes_api.saveGraph.html +++ /dev/null @@ -1,5 +0,0 @@ -saveGraph | mbus-backend
                                                                      mbus-backend
                                                                        Preparing search index...

                                                                        Function saveGraph

                                                                        • Saves the current graph state to a file (DEV mode only).

                                                                          -

                                                                          Parameters

                                                                          • req: Request

                                                                            Express request

                                                                            -
                                                                          • res: Response

                                                                            Express response

                                                                            -

                                                                          Returns Promise<void>

                                                                          JSON message confirming the save path.

                                                                          -
                                                                        diff --git a/docs/functions/routes_api.setReminder.html b/docs/functions/routes_api.setReminder.html deleted file mode 100644 index 0903168..0000000 --- a/docs/functions/routes_api.setReminder.html +++ /dev/null @@ -1,3 +0,0 @@ -setReminder | mbus-backend
                                                                        mbus-backend
                                                                          Preparing search index...

                                                                          Function setReminder

                                                                          • Parameters

                                                                            • req: Request

                                                                              Express request, expects SetReminderBody in the body

                                                                              -
                                                                            • res: Response

                                                                              Express response, error message as string if error occurs

                                                                              -

                                                                            Returns void

                                                                          diff --git a/docs/functions/routes_api.swapToken.html b/docs/functions/routes_api.swapToken.html deleted file mode 100644 index d624bfc..0000000 --- a/docs/functions/routes_api.swapToken.html +++ /dev/null @@ -1,5 +0,0 @@ -swapToken | mbus-backend
                                                                          mbus-backend
                                                                            Preparing search index...

                                                                            Function swapToken

                                                                            • Parameters

                                                                              • req: Request

                                                                                Express request, SwapTokenBody in the body

                                                                                -
                                                                              • res: Response

                                                                                Express response, error message as string if error occurs

                                                                                -

                                                                                Upon responding with 200, future calls to /setReminder, /unsetReminder, and /activeReminders -will need the new token

                                                                                -

                                                                              Returns void

                                                                            diff --git a/docs/functions/routes_api.unsetReminder.html b/docs/functions/routes_api.unsetReminder.html deleted file mode 100644 index 64bb8e6..0000000 --- a/docs/functions/routes_api.unsetReminder.html +++ /dev/null @@ -1,3 +0,0 @@ -unsetReminder | mbus-backend
                                                                            mbus-backend
                                                                              Preparing search index...

                                                                              Function unsetReminder

                                                                              • Parameters

                                                                                • req: Request

                                                                                  Express request, UnsetReminderBody in the body

                                                                                  -
                                                                                • res: Response

                                                                                  Express response, error message as string if error occurs

                                                                                  -

                                                                                Returns void

                                                                              diff --git a/docs/functions/services_graphBuilder.findNearestStops.html b/docs/functions/services_graphBuilder.findNearestStops.html deleted file mode 100644 index 845e914..0000000 --- a/docs/functions/services_graphBuilder.findNearestStops.html +++ /dev/null @@ -1,2 +0,0 @@ -findNearestStops | mbus-backend
                                                                              mbus-backend
                                                                                Preparing search index...

                                                                                Function findNearestStops

                                                                                • Finds the nearest k stops to a given coordinate.

                                                                                  -

                                                                                  Parameters

                                                                                  • lat: number
                                                                                  • lon: number
                                                                                  • k: number = 2

                                                                                  Returns { distance: number; lat: number; lon: number; name: string; stpid: string }[]

                                                                                diff --git a/docs/functions/services_graphBuilder.initializeRoutes.html b/docs/functions/services_graphBuilder.initializeRoutes.html deleted file mode 100644 index 0be282b..0000000 --- a/docs/functions/services_graphBuilder.initializeRoutes.html +++ /dev/null @@ -1,2 +0,0 @@ -initializeRoutes | mbus-backend
                                                                                mbus-backend
                                                                                  Preparing search index...

                                                                                  Function initializeRoutes

                                                                                  • Initializes route data, caching patterns and stop locations.

                                                                                    -

                                                                                    Returns Promise<void>

                                                                                  diff --git a/docs/functions/services_graphBuilder.rebuildGraph.html b/docs/functions/services_graphBuilder.rebuildGraph.html deleted file mode 100644 index eef8bcb..0000000 --- a/docs/functions/services_graphBuilder.rebuildGraph.html +++ /dev/null @@ -1,2 +0,0 @@ -rebuildGraph | mbus-backend
                                                                                  mbus-backend
                                                                                    Preparing search index...
                                                                                    • Rebuilds the routing graph based on current predictions and static data.

                                                                                      -

                                                                                      Returns Promise<void>

                                                                                    diff --git a/docs/functions/services_graphBuilder.saveGraphState.html b/docs/functions/services_graphBuilder.saveGraphState.html deleted file mode 100644 index 36d84c0..0000000 --- a/docs/functions/services_graphBuilder.saveGraphState.html +++ /dev/null @@ -1,2 +0,0 @@ -saveGraphState | mbus-backend
                                                                                    mbus-backend
                                                                                      Preparing search index...
                                                                                      • Saves the current graph and state to a JSON file (DEV mode only).

                                                                                        -

                                                                                        Returns string

                                                                                      diff --git a/docs/functions/services_graphBuilder.sortPreds.html b/docs/functions/services_graphBuilder.sortPreds.html deleted file mode 100644 index d9e28f5..0000000 --- a/docs/functions/services_graphBuilder.sortPreds.html +++ /dev/null @@ -1,2 +0,0 @@ -sortPreds | mbus-backend
                                                                                      mbus-backend
                                                                                        Preparing search index...
                                                                                        diff --git a/docs/functions/services_graphBuilder.updateBusPositions.html b/docs/functions/services_graphBuilder.updateBusPositions.html deleted file mode 100644 index 914fac7..0000000 --- a/docs/functions/services_graphBuilder.updateBusPositions.html +++ /dev/null @@ -1,2 +0,0 @@ -updateBusPositions | mbus-backend
                                                                                        mbus-backend
                                                                                          Preparing search index...

                                                                                          Function updateBusPositions

                                                                                          • Fetches and updates current bus positions in state.

                                                                                            -

                                                                                            Returns Promise<void>

                                                                                          diff --git a/docs/functions/services_journey.planJourney.html b/docs/functions/services_journey.planJourney.html deleted file mode 100644 index c3c51ec..0000000 --- a/docs/functions/services_journey.planJourney.html +++ /dev/null @@ -1,8 +0,0 @@ -planJourney | mbus-backend
                                                                                          mbus-backend
                                                                                            Preparing search index...

                                                                                            Function planJourney

                                                                                            • Plans a journey between two coordinates using the McRaptor algorithm.

                                                                                              -

                                                                                              Parameters

                                                                                              • oLat: number

                                                                                                Origin latitude

                                                                                                -
                                                                                              • oLon: number

                                                                                                Origin longitude

                                                                                                -
                                                                                              • dLat: number

                                                                                                Destination latitude

                                                                                                -
                                                                                              • dLon: number

                                                                                                Destination longitude

                                                                                                -
                                                                                              • time: number

                                                                                                Start time in seconds since midnight

                                                                                                -
                                                                                              • options: { range?: number; walkingPenalty?: number }

                                                                                                Optional parameters for walking penalty and search range

                                                                                                -

                                                                                              Returns Promise<
                                                                                                  (
                                                                                                      | {
                                                                                                          arrivalTime: number;
                                                                                                          criteria: {
                                                                                                              arrivalTime: number;
                                                                                                              transferCount: number;
                                                                                                              walkingDistance: number;
                                                                                                          };
                                                                                                          departureTime: number;
                                                                                                          legs: any[];
                                                                                                      }
                                                                                                      | null
                                                                                                  )[],
                                                                                              >

                                                                                            diff --git a/docs/functions/services_mbus.fetchPatterns.html b/docs/functions/services_mbus.fetchPatterns.html deleted file mode 100644 index 3d27eac..0000000 --- a/docs/functions/services_mbus.fetchPatterns.html +++ /dev/null @@ -1,2 +0,0 @@ -fetchPatterns | mbus-backend
                                                                                            mbus-backend
                                                                                              Preparing search index...

                                                                                              Function fetchPatterns

                                                                                              • Fetches route patterns (path points) for a specific route.

                                                                                                -

                                                                                                Parameters

                                                                                                • rt: string

                                                                                                Returns Promise<any>

                                                                                              diff --git a/docs/functions/services_mbus.fetchPredictions.html b/docs/functions/services_mbus.fetchPredictions.html deleted file mode 100644 index b8b7d84..0000000 --- a/docs/functions/services_mbus.fetchPredictions.html +++ /dev/null @@ -1,2 +0,0 @@ -fetchPredictions | mbus-backend
                                                                                              mbus-backend
                                                                                                Preparing search index...

                                                                                                Function fetchPredictions

                                                                                                • Fetches predictions for multiple stop IDs.

                                                                                                  -

                                                                                                  Parameters

                                                                                                  • stopIds: string[]
                                                                                                  • routes: string[]

                                                                                                  Returns Promise<any[]>

                                                                                                diff --git a/docs/functions/services_mbus.fetchRoutes.html b/docs/functions/services_mbus.fetchRoutes.html deleted file mode 100644 index 3a62cea..0000000 --- a/docs/functions/services_mbus.fetchRoutes.html +++ /dev/null @@ -1,2 +0,0 @@ -fetchRoutes | mbus-backend
                                                                                                mbus-backend
                                                                                                  Preparing search index...

                                                                                                  Function fetchRoutes

                                                                                                  • Fetches all available routes.

                                                                                                    -

                                                                                                    Returns Promise<any>

                                                                                                  diff --git a/docs/functions/services_mbus.fetchVehicles.html b/docs/functions/services_mbus.fetchVehicles.html deleted file mode 100644 index 9bd7543..0000000 --- a/docs/functions/services_mbus.fetchVehicles.html +++ /dev/null @@ -1,2 +0,0 @@ -fetchVehicles | mbus-backend
                                                                                                  mbus-backend
                                                                                                    Preparing search index...

                                                                                                    Function fetchVehicles

                                                                                                    • Fetches vehicle positions for the given routes.

                                                                                                      -

                                                                                                      Parameters

                                                                                                      • routes: string[]

                                                                                                      Returns Promise<any[]>

                                                                                                    diff --git a/docs/functions/services_metadata.getAllRouteConfig.html b/docs/functions/services_metadata.getAllRouteConfig.html deleted file mode 100644 index 68c8d0c..0000000 --- a/docs/functions/services_metadata.getAllRouteConfig.html +++ /dev/null @@ -1,2 +0,0 @@ -getAllRouteConfig | mbus-backend
                                                                                                    mbus-backend
                                                                                                      Preparing search index...

                                                                                                      Function getAllRouteConfig

                                                                                                      • Returns configuration for all routes.

                                                                                                        -

                                                                                                        Returns { color: string; image: string; routeId: string }[]

                                                                                                      diff --git a/docs/functions/services_metadata.getRouteColor.html b/docs/functions/services_metadata.getRouteColor.html deleted file mode 100644 index 4a6765a..0000000 --- a/docs/functions/services_metadata.getRouteColor.html +++ /dev/null @@ -1,2 +0,0 @@ -getRouteColor | mbus-backend
                                                                                                      mbus-backend
                                                                                                        Preparing search index...

                                                                                                        Function getRouteColor

                                                                                                        • Gets the color for a specific route ID.

                                                                                                          -

                                                                                                          Parameters

                                                                                                          • routeId: string

                                                                                                          Returns string | null

                                                                                                        diff --git a/docs/functions/services_metadata.getRouteImage.html b/docs/functions/services_metadata.getRouteImage.html deleted file mode 100644 index 1bfc935..0000000 --- a/docs/functions/services_metadata.getRouteImage.html +++ /dev/null @@ -1,2 +0,0 @@ -getRouteImage | mbus-backend
                                                                                                        mbus-backend
                                                                                                          Preparing search index...

                                                                                                          Function getRouteImage

                                                                                                          • Gets the image filename for a specific route ID.

                                                                                                            -

                                                                                                            Parameters

                                                                                                            • routeId: string

                                                                                                            Returns string | null

                                                                                                          diff --git a/docs/functions/services_reminder.eventsEqual.html b/docs/functions/services_reminder.eventsEqual.html deleted file mode 100644 index 0f538f6..0000000 --- a/docs/functions/services_reminder.eventsEqual.html +++ /dev/null @@ -1 +0,0 @@ -eventsEqual | mbus-backend
                                                                                                          mbus-backend
                                                                                                            Preparing search index...

                                                                                                            Function eventsEqual

                                                                                                            diff --git a/docs/functions/services_reminder.infoToUseForRoute.html b/docs/functions/services_reminder.infoToUseForRoute.html deleted file mode 100644 index 6677cfb..0000000 --- a/docs/functions/services_reminder.infoToUseForRoute.html +++ /dev/null @@ -1 +0,0 @@ -infoToUseForRoute | mbus-backend
                                                                                                            mbus-backend
                                                                                                              Preparing search index...

                                                                                                              Function infoToUseForRoute

                                                                                                              • Parameters

                                                                                                                • rtid: string

                                                                                                                Returns
                                                                                                                    | {
                                                                                                                        predsByStopId: Record<string, Prediction[]>;
                                                                                                                        predsByVid: Record<string, Prediction[]>;
                                                                                                                        reminderSubscriptions: ReminderSubscriptions;
                                                                                                                    }
                                                                                                                    | null

                                                                                                              diff --git a/docs/functions/services_reminder.processRideReminders.html b/docs/functions/services_reminder.processRideReminders.html deleted file mode 100644 index 562319d..0000000 --- a/docs/functions/services_reminder.processRideReminders.html +++ /dev/null @@ -1 +0,0 @@ -processRideReminders | mbus-backend
                                                                                                              mbus-backend
                                                                                                                Preparing search index...

                                                                                                                Function processRideReminders

                                                                                                                diff --git a/docs/functions/services_reminder.processUniversityReminders.html b/docs/functions/services_reminder.processUniversityReminders.html deleted file mode 100644 index 01b0549..0000000 --- a/docs/functions/services_reminder.processUniversityReminders.html +++ /dev/null @@ -1 +0,0 @@ -processUniversityReminders | mbus-backend
                                                                                                                mbus-backend
                                                                                                                  Preparing search index...

                                                                                                                  Function processUniversityReminders

                                                                                                                  diff --git a/docs/functions/services_reminder.sendNotifToAll.html b/docs/functions/services_reminder.sendNotifToAll.html deleted file mode 100644 index 6b6f2e0..0000000 --- a/docs/functions/services_reminder.sendNotifToAll.html +++ /dev/null @@ -1 +0,0 @@ -sendNotifToAll | mbus-backend
                                                                                                                  mbus-backend
                                                                                                                    Preparing search index...

                                                                                                                    Function sendNotifToAll

                                                                                                                    • Parameters

                                                                                                                      • notif: { body: string; title: string }
                                                                                                                      • tokens: Set<string>

                                                                                                                      Returns void

                                                                                                                    diff --git a/docs/functions/services_reminderTypes.baseEvent.html b/docs/functions/services_reminderTypes.baseEvent.html deleted file mode 100644 index ad93406..0000000 --- a/docs/functions/services_reminderTypes.baseEvent.html +++ /dev/null @@ -1,2 +0,0 @@ -baseEvent | mbus-backend
                                                                                                                    mbus-backend
                                                                                                                      Preparing search index...
                                                                                                                      diff --git a/docs/functions/services_reminderTypes.delayEvent.html b/docs/functions/services_reminderTypes.delayEvent.html deleted file mode 100644 index 1207c39..0000000 --- a/docs/functions/services_reminderTypes.delayEvent.html +++ /dev/null @@ -1,2 +0,0 @@ -delayEvent | mbus-backend
                                                                                                                      mbus-backend
                                                                                                                        Preparing search index...
                                                                                                                        • factory

                                                                                                                          -

                                                                                                                          Parameters

                                                                                                                          • x: { currPred: number; prevPred: number; rtid: string; stpid: string }

                                                                                                                          Returns DelayEvent

                                                                                                                        diff --git a/docs/functions/services_reminderTypes.eventsEqual.html b/docs/functions/services_reminderTypes.eventsEqual.html deleted file mode 100644 index 83d0898..0000000 --- a/docs/functions/services_reminderTypes.eventsEqual.html +++ /dev/null @@ -1 +0,0 @@ -eventsEqual | mbus-backend
                                                                                                                        mbus-backend
                                                                                                                          Preparing search index...
                                                                                                                          diff --git a/docs/functions/services_reminderTypes.fromKey.html b/docs/functions/services_reminderTypes.fromKey.html deleted file mode 100644 index 426b120..0000000 --- a/docs/functions/services_reminderTypes.fromKey.html +++ /dev/null @@ -1 +0,0 @@ -fromKey | mbus-backend
                                                                                                                          mbus-backend
                                                                                                                            Preparing search index...
                                                                                                                            diff --git a/docs/functions/services_reminderTypes.registrationToken.html b/docs/functions/services_reminderTypes.registrationToken.html deleted file mode 100644 index a884ca7..0000000 --- a/docs/functions/services_reminderTypes.registrationToken.html +++ /dev/null @@ -1 +0,0 @@ -registrationToken | mbus-backend
                                                                                                                            mbus-backend
                                                                                                                              Preparing search index...

                                                                                                                              Function registrationToken

                                                                                                                              diff --git a/docs/functions/services_reminderTypes.sameBaseEvent.html b/docs/functions/services_reminderTypes.sameBaseEvent.html deleted file mode 100644 index b6a0765..0000000 --- a/docs/functions/services_reminderTypes.sameBaseEvent.html +++ /dev/null @@ -1 +0,0 @@ -sameBaseEvent | mbus-backend
                                                                                                                              mbus-backend
                                                                                                                                Preparing search index...
                                                                                                                                • Parameters

                                                                                                                                  • e1: CoreEvent
                                                                                                                                  • e2: CoreEvent

                                                                                                                                  Returns boolean

                                                                                                                                diff --git a/docs/functions/services_reminderTypes.thresholdEvent.html b/docs/functions/services_reminderTypes.thresholdEvent.html deleted file mode 100644 index af4ff72..0000000 --- a/docs/functions/services_reminderTypes.thresholdEvent.html +++ /dev/null @@ -1,2 +0,0 @@ -thresholdEvent | mbus-backend
                                                                                                                                mbus-backend
                                                                                                                                  Preparing search index...
                                                                                                                                  diff --git a/docs/functions/services_reminderTypes.toKey.html b/docs/functions/services_reminderTypes.toKey.html deleted file mode 100644 index bcbf4ea..0000000 --- a/docs/functions/services_reminderTypes.toKey.html +++ /dev/null @@ -1,2 +0,0 @@ -toKey | mbus-backend
                                                                                                                                  mbus-backend
                                                                                                                                    Preparing search index...
                                                                                                                                    diff --git a/docs/functions/services_ride.fetchPatterns.html b/docs/functions/services_ride.fetchPatterns.html deleted file mode 100644 index 6850074..0000000 --- a/docs/functions/services_ride.fetchPatterns.html +++ /dev/null @@ -1,2 +0,0 @@ -fetchPatterns | mbus-backend
                                                                                                                                    mbus-backend
                                                                                                                                      Preparing search index...

                                                                                                                                      Function fetchPatterns

                                                                                                                                      • Fetches route patterns (path points) for a specific route.

                                                                                                                                        -

                                                                                                                                        Parameters

                                                                                                                                        • rt: string

                                                                                                                                        Returns Promise<any>

                                                                                                                                      diff --git a/docs/functions/services_ride.fetchPredictions.html b/docs/functions/services_ride.fetchPredictions.html deleted file mode 100644 index 32d4c42..0000000 --- a/docs/functions/services_ride.fetchPredictions.html +++ /dev/null @@ -1,2 +0,0 @@ -fetchPredictions | mbus-backend
                                                                                                                                      mbus-backend
                                                                                                                                        Preparing search index...

                                                                                                                                        Function fetchPredictions

                                                                                                                                        • Fetches predictions for multiple stop IDs.

                                                                                                                                          -

                                                                                                                                          Parameters

                                                                                                                                          • stopIds: string[]
                                                                                                                                          • routes: string[]

                                                                                                                                          Returns Promise<any[]>

                                                                                                                                        diff --git a/docs/functions/services_ride.fetchRoutes.html b/docs/functions/services_ride.fetchRoutes.html deleted file mode 100644 index 21a65e6..0000000 --- a/docs/functions/services_ride.fetchRoutes.html +++ /dev/null @@ -1,2 +0,0 @@ -fetchRoutes | mbus-backend
                                                                                                                                        mbus-backend
                                                                                                                                          Preparing search index...

                                                                                                                                          Function fetchRoutes

                                                                                                                                          • Fetches all available routes.

                                                                                                                                            -

                                                                                                                                            Returns Promise<any>

                                                                                                                                          diff --git a/docs/functions/services_ride.fetchVehicles.html b/docs/functions/services_ride.fetchVehicles.html deleted file mode 100644 index 3dd3a95..0000000 --- a/docs/functions/services_ride.fetchVehicles.html +++ /dev/null @@ -1,2 +0,0 @@ -fetchVehicles | mbus-backend
                                                                                                                                          mbus-backend
                                                                                                                                            Preparing search index...

                                                                                                                                            Function fetchVehicles

                                                                                                                                            • Fetches vehicle positions for the given routes.

                                                                                                                                              -

                                                                                                                                              Parameters

                                                                                                                                              • routes: string[]

                                                                                                                                              Returns Promise<any[]>

                                                                                                                                            diff --git a/docs/functions/state_transitState.setCachedGraph.html b/docs/functions/state_transitState.setCachedGraph.html deleted file mode 100644 index 63000ff..0000000 --- a/docs/functions/state_transitState.setCachedGraph.html +++ /dev/null @@ -1,2 +0,0 @@ -setCachedGraph | mbus-backend
                                                                                                                                            mbus-backend
                                                                                                                                              Preparing search index...

                                                                                                                                              Function setCachedGraph

                                                                                                                                              diff --git a/docs/functions/state_transitState.setCachedRideStopLocations.html b/docs/functions/state_transitState.setCachedRideStopLocations.html deleted file mode 100644 index 7331229..0000000 --- a/docs/functions/state_transitState.setCachedRideStopLocations.html +++ /dev/null @@ -1,2 +0,0 @@ -setCachedRideStopLocations | mbus-backend
                                                                                                                                              mbus-backend
                                                                                                                                                Preparing search index...

                                                                                                                                                Function setCachedRideStopLocations

                                                                                                                                                • Updates the cached ride stop locations.

                                                                                                                                                  -

                                                                                                                                                  Parameters

                                                                                                                                                  • newLocs: Record<string, { lat: number; lon: number; name: string }>

                                                                                                                                                  Returns void

                                                                                                                                                diff --git a/docs/functions/state_transitState.setCachedStopLocations.html b/docs/functions/state_transitState.setCachedStopLocations.html deleted file mode 100644 index 9bbf317..0000000 --- a/docs/functions/state_transitState.setCachedStopLocations.html +++ /dev/null @@ -1,2 +0,0 @@ -setCachedStopLocations | mbus-backend
                                                                                                                                                mbus-backend
                                                                                                                                                  Preparing search index...

                                                                                                                                                  Function setCachedStopLocations

                                                                                                                                                  • Updates the cached stop locations.

                                                                                                                                                    -

                                                                                                                                                    Parameters

                                                                                                                                                    • newLocs: Record<string, { lat: number; lon: number; name: string }>

                                                                                                                                                    Returns void

                                                                                                                                                  diff --git a/docs/functions/walking_loadMap.haversine.html b/docs/functions/walking_loadMap.haversine.html deleted file mode 100644 index 79efb48..0000000 --- a/docs/functions/walking_loadMap.haversine.html +++ /dev/null @@ -1,7 +0,0 @@ -haversine | mbus-backend
                                                                                                                                                  mbus-backend
                                                                                                                                                    Preparing search index...

                                                                                                                                                    Function haversine

                                                                                                                                                    • Calculates the great-circle distance between two points using the Haversine formula.

                                                                                                                                                      -

                                                                                                                                                      Parameters

                                                                                                                                                      • aLat: number

                                                                                                                                                        Latitude of point A.

                                                                                                                                                        -
                                                                                                                                                      • aLon: number

                                                                                                                                                        Longitude of point A.

                                                                                                                                                        -
                                                                                                                                                      • bLat: number

                                                                                                                                                        Latitude of point B.

                                                                                                                                                        -
                                                                                                                                                      • bLon: number

                                                                                                                                                        Longitude of point B.

                                                                                                                                                        -

                                                                                                                                                      Returns number

                                                                                                                                                      Distance in meters.

                                                                                                                                                      -
                                                                                                                                                    diff --git a/docs/functions/walking_loadMap.loadMap.html b/docs/functions/walking_loadMap.loadMap.html deleted file mode 100644 index 6618d45..0000000 --- a/docs/functions/walking_loadMap.loadMap.html +++ /dev/null @@ -1,16 +0,0 @@ -loadMap | mbus-backend
                                                                                                                                                    mbus-backend
                                                                                                                                                      Preparing search index...

                                                                                                                                                      Function loadMap

                                                                                                                                                      • Loads and parses the GraphML map file into a usable graph structure.

                                                                                                                                                        -
                                                                                                                                                          -
                                                                                                                                                        • Performs the following steps:
                                                                                                                                                        • -
                                                                                                                                                        -
                                                                                                                                                          -
                                                                                                                                                        1. Reads the XML file.
                                                                                                                                                        2. -
                                                                                                                                                        3. Extracts Nodes (lat/lon).
                                                                                                                                                        4. -
                                                                                                                                                        5. Extracts Edges (filtering for walkable types like 'footway', 'path').
                                                                                                                                                        6. -
                                                                                                                                                        7. Parses edge geometry (WKT) if available.
                                                                                                                                                        8. -
                                                                                                                                                        9. Prunes disconnected components, keeping only the largest connected subgraph.
                                                                                                                                                        10. -
                                                                                                                                                        -
                                                                                                                                                          -
                                                                                                                                                        • -
                                                                                                                                                        -

                                                                                                                                                        Returns { graph: Map<string, GraphMLEdge[]>; nodes: Map<string, GraphMLNode> }

                                                                                                                                                        An object containing the map of Nodes and the Adjacency List (graph).

                                                                                                                                                        -
                                                                                                                                                      diff --git a/docs/functions/walking_walkingMap.buildStopNodeMap.html b/docs/functions/walking_walkingMap.buildStopNodeMap.html deleted file mode 100644 index 10e668b..0000000 --- a/docs/functions/walking_walkingMap.buildStopNodeMap.html +++ /dev/null @@ -1,4 +0,0 @@ -buildStopNodeMap | mbus-backend
                                                                                                                                                      mbus-backend
                                                                                                                                                        Preparing search index...

                                                                                                                                                        Function buildStopNodeMap

                                                                                                                                                        • Maps a list of bus stops to their nearest nodes on the street graph. -This optimizes future lookups by caching the StopID -> NodeID relationship.

                                                                                                                                                          -

                                                                                                                                                          Parameters

                                                                                                                                                          • locations: Record<string, { lat: number; lon: number }>

                                                                                                                                                            A map of StopID to {lat, lon}.

                                                                                                                                                            -

                                                                                                                                                          Returns void

                                                                                                                                                        diff --git a/docs/functions/walking_walkingMap.ensureCacheForStops.html b/docs/functions/walking_walkingMap.ensureCacheForStops.html deleted file mode 100644 index e90fe83..0000000 --- a/docs/functions/walking_walkingMap.ensureCacheForStops.html +++ /dev/null @@ -1,5 +0,0 @@ -ensureCacheForStops | mbus-backend
                                                                                                                                                        mbus-backend
                                                                                                                                                          Preparing search index...

                                                                                                                                                          Function ensureCacheForStops

                                                                                                                                                          • Ensures walking paths between all provided stops are calculated and cached. -Fetches missing paths in parallel and updates the disk cache.

                                                                                                                                                            -

                                                                                                                                                            Parameters

                                                                                                                                                            • stopIds: Set<string>

                                                                                                                                                              Set of stop IDs to verify.

                                                                                                                                                              -
                                                                                                                                                            • stopLocations: Record<string, { lat: number; lon: number }>

                                                                                                                                                              Map of Stop ID to coordinates.

                                                                                                                                                              -

                                                                                                                                                            Returns Promise<void>

                                                                                                                                                          diff --git a/docs/functions/walking_walkingMap.getCachedWalk.html b/docs/functions/walking_walkingMap.getCachedWalk.html deleted file mode 100644 index 65d8590..0000000 --- a/docs/functions/walking_walkingMap.getCachedWalk.html +++ /dev/null @@ -1,5 +0,0 @@ -getCachedWalk | mbus-backend
                                                                                                                                                          mbus-backend
                                                                                                                                                            Preparing search index...

                                                                                                                                                            Function getCachedWalk

                                                                                                                                                            • Retrieves a cached walking path between two stops.

                                                                                                                                                              -

                                                                                                                                                              Parameters

                                                                                                                                                              • originId: string

                                                                                                                                                                Origin Stop ID.

                                                                                                                                                                -
                                                                                                                                                              • destId: string

                                                                                                                                                                Destination Stop ID.

                                                                                                                                                                -

                                                                                                                                                              Returns WalkingResponse | undefined

                                                                                                                                                              Cached walking data or undefined.

                                                                                                                                                              -
                                                                                                                                                            diff --git a/docs/functions/walking_walkingMap.getWalkingDistancesFrom.html b/docs/functions/walking_walkingMap.getWalkingDistancesFrom.html deleted file mode 100644 index 916cc29..0000000 --- a/docs/functions/walking_walkingMap.getWalkingDistancesFrom.html +++ /dev/null @@ -1,8 +0,0 @@ -getWalkingDistancesFrom | mbus-backend
                                                                                                                                                            mbus-backend
                                                                                                                                                              Preparing search index...

                                                                                                                                                              Function getWalkingDistancesFrom

                                                                                                                                                              • Optimized method to get walking distances from an origin to ALL known bus stops. -Optionally includes a direct walk to a specific destination point. -Uses a single Dijkstra pass with early termination and LRU Cache.

                                                                                                                                                                -

                                                                                                                                                                Parameters

                                                                                                                                                                • lat: number

                                                                                                                                                                  Origin latitude.

                                                                                                                                                                  -
                                                                                                                                                                • lon: number

                                                                                                                                                                  Origin longitude.

                                                                                                                                                                  -
                                                                                                                                                                • OptionaldestLat: number

                                                                                                                                                                  (Optional) Destination latitude for direct walk.

                                                                                                                                                                  -
                                                                                                                                                                • OptionaldestLon: number

                                                                                                                                                                  (Optional) Destination longitude for direct walk.

                                                                                                                                                                  -

                                                                                                                                                                Returns { duration: number; stopId: string }[]

                                                                                                                                                              diff --git a/docs/functions/walking_walkingMap.getWalkingResponse.html b/docs/functions/walking_walkingMap.getWalkingResponse.html deleted file mode 100644 index cd96549..0000000 --- a/docs/functions/walking_walkingMap.getWalkingResponse.html +++ /dev/null @@ -1,7 +0,0 @@ -getWalkingResponse | mbus-backend
                                                                                                                                                              mbus-backend
                                                                                                                                                                Preparing search index...

                                                                                                                                                                Function getWalkingResponse

                                                                                                                                                                • Calculates a detailed walking path between two coordinates using A*. -Includes path geometry for rendering.

                                                                                                                                                                  -

                                                                                                                                                                  Parameters

                                                                                                                                                                  • originLat: number

                                                                                                                                                                    Latitude of origin.

                                                                                                                                                                    -
                                                                                                                                                                  • originLon: number

                                                                                                                                                                    Longitude of origin.

                                                                                                                                                                    -
                                                                                                                                                                  • destLat: number

                                                                                                                                                                    Latitude of destination.

                                                                                                                                                                    -
                                                                                                                                                                  • destLon: number

                                                                                                                                                                    Longitude of destination.

                                                                                                                                                                    -

                                                                                                                                                                  Returns Promise<WalkingResponse>

                                                                                                                                                                diff --git a/docs/hierarchy.html b/docs/hierarchy.html deleted file mode 100644 index e83590c..0000000 --- a/docs/hierarchy.html +++ /dev/null @@ -1 +0,0 @@ -mbus-backend
                                                                                                                                                                mbus-backend
                                                                                                                                                                  Preparing search index...

                                                                                                                                                                  mbus-backend

                                                                                                                                                                  Hierarchy Summary

                                                                                                                                                                  diff --git a/docs/index.html b/docs/index.html deleted file mode 100644 index e44630e..0000000 --- a/docs/index.html +++ /dev/null @@ -1,39 +0,0 @@ -mbus-backend
                                                                                                                                                                  mbus-backend
                                                                                                                                                                    Preparing search index...

                                                                                                                                                                    mbus-backend

                                                                                                                                                                    - Maizebus Logo -

                                                                                                                                                                    Maizebus Backend

                                                                                                                                                                    -

                                                                                                                                                                    - - Documentation - - License -

                                                                                                                                                                    -

                                                                                                                                                                    - Backend service for the Magic Bus application. Handles real-time bus tracking, route management, and multi-modal journey planning (bus + walking) using the McRaptor algorithm. -

                                                                                                                                                                    -
                                                                                                                                                                    -

                                                                                                                                                                    First, obtain an API key for the Magic Bus backend from the official Magic Bus Website.

                                                                                                                                                                    -

                                                                                                                                                                    Then, define the MBUS_API_KEY environment variable with your API key.

                                                                                                                                                                    -

                                                                                                                                                                    To install dependencies, run npm i

                                                                                                                                                                    -

                                                                                                                                                                    Create a Firebase project if you haven't already, and set FIREBASE_PROJECT_ID to its id. Follow the steps -here to create a service -account key file. Place this file into secrets/ and point GOOGLE_APPLICATION_CREDENTIALS to it. -(you can do this temporarily with export GOOGLE_APPLICATION_CREDENTIALS="./secrets/your-filename.json")

                                                                                                                                                                    -

                                                                                                                                                                    Some additional resources for iOS here. Make -sure that the firebase project is configured with the same app id as xcode.

                                                                                                                                                                    -

                                                                                                                                                                    To run the backend, run npm start.

                                                                                                                                                                    -

                                                                                                                                                                    By default, the service runs on port 3000. To define a port for the service to run on, define an environment variable called PORT before running the backend.

                                                                                                                                                                    -

                                                                                                                                                                    This project uses TSDoc for code documentation. -To compile the static documentation:

                                                                                                                                                                    -
                                                                                                                                                                    npm run docs
                                                                                                                                                                    -
                                                                                                                                                                    - -

                                                                                                                                                                    The documentation is served at http://localhost:3000/docs or this link.

                                                                                                                                                                    -

                                                                                                                                                                    This project uses Vitest for fast unit and integration testing.

                                                                                                                                                                    -
                                                                                                                                                                      -
                                                                                                                                                                    • Run all tests: npm test
                                                                                                                                                                    • -
                                                                                                                                                                    • Run stress tests: npm run stress-test
                                                                                                                                                                    • -
                                                                                                                                                                    -

                                                                                                                                                                    An example of passing the tests is below.

                                                                                                                                                                    -test example -

                                                                                                                                                                    Before submitting a pull request to main, please make sure you pass all the tests and can compile docs. If you believe some of the tests faulty or no longer needed after your commit, please contact Andrew Yu or Ryan Lu on Slack.

                                                                                                                                                                    -
                                                                                                                                                                    diff --git a/docs/interfaces/raptor_McRaptorAlgorithm.Journey.html b/docs/interfaces/raptor_McRaptorAlgorithm.Journey.html deleted file mode 100644 index b0210ca..0000000 --- a/docs/interfaces/raptor_McRaptorAlgorithm.Journey.html +++ /dev/null @@ -1,6 +0,0 @@ -Journey | mbus-backend
                                                                                                                                                                    mbus-backend
                                                                                                                                                                      Preparing search index...

                                                                                                                                                                      Represents a complete transit journey consisting of multiple legs.

                                                                                                                                                                      -
                                                                                                                                                                      interface Journey {
                                                                                                                                                                          criteria: {
                                                                                                                                                                              arrivalTime: number;
                                                                                                                                                                              transferCount: number;
                                                                                                                                                                              walkingDistance: number;
                                                                                                                                                                          };
                                                                                                                                                                          legs: JourneyLeg[];
                                                                                                                                                                      }
                                                                                                                                                                      Index

                                                                                                                                                                      Properties

                                                                                                                                                                      Properties

                                                                                                                                                                      criteria: {
                                                                                                                                                                          arrivalTime: number;
                                                                                                                                                                          transferCount: number;
                                                                                                                                                                          walkingDistance: number;
                                                                                                                                                                      }

                                                                                                                                                                      The performance metrics for this journey.

                                                                                                                                                                      -
                                                                                                                                                                      legs: JourneyLeg[]

                                                                                                                                                                      The sequence of legs (trips or walking transfers) in the journey.

                                                                                                                                                                      -
                                                                                                                                                                      diff --git a/docs/interfaces/raptor_McRaptorAlgorithm.JourneyLeg.html b/docs/interfaces/raptor_McRaptorAlgorithm.JourneyLeg.html deleted file mode 100644 index b6da33e..0000000 --- a/docs/interfaces/raptor_McRaptorAlgorithm.JourneyLeg.html +++ /dev/null @@ -1,14 +0,0 @@ -JourneyLeg | mbus-backend
                                                                                                                                                                      mbus-backend
                                                                                                                                                                        Preparing search index...

                                                                                                                                                                        Represents a single segment of a journey, either a transit trip or a walking transfer.

                                                                                                                                                                        -
                                                                                                                                                                        interface JourneyLeg {
                                                                                                                                                                            destination: string;
                                                                                                                                                                            destinationID: string;
                                                                                                                                                                            duration: number;
                                                                                                                                                                            endTime: number;
                                                                                                                                                                            origin: string;
                                                                                                                                                                            originID: string;
                                                                                                                                                                            rt?: string;
                                                                                                                                                                            startTime: number;
                                                                                                                                                                            stopTimes?: StopTime[];
                                                                                                                                                                            transfer?: Transfer;
                                                                                                                                                                            trip?: Trip;
                                                                                                                                                                            type: "Trip" | "Transfer";
                                                                                                                                                                        }
                                                                                                                                                                        Index

                                                                                                                                                                        Properties

                                                                                                                                                                        destination: string
                                                                                                                                                                        destinationID: string
                                                                                                                                                                        duration: number
                                                                                                                                                                        endTime: number
                                                                                                                                                                        origin: string
                                                                                                                                                                        originID: string
                                                                                                                                                                        rt?: string
                                                                                                                                                                        startTime: number
                                                                                                                                                                        stopTimes?: StopTime[]
                                                                                                                                                                        transfer?: Transfer
                                                                                                                                                                        trip?: Trip
                                                                                                                                                                        type: "Trip" | "Transfer"
                                                                                                                                                                        diff --git a/docs/interfaces/raptor_types.Leg.html b/docs/interfaces/raptor_types.Leg.html deleted file mode 100644 index e209caf..0000000 --- a/docs/interfaces/raptor_types.Leg.html +++ /dev/null @@ -1,4 +0,0 @@ -Leg | mbus-backend
                                                                                                                                                                        mbus-backend
                                                                                                                                                                          Preparing search index...

                                                                                                                                                                          Interface Leg

                                                                                                                                                                          Abstract representation of a connection between two stops.

                                                                                                                                                                          -
                                                                                                                                                                          interface Leg {
                                                                                                                                                                              destination: string;
                                                                                                                                                                              origin: string;
                                                                                                                                                                          }

                                                                                                                                                                          Hierarchy (View Summary)

                                                                                                                                                                          Index

                                                                                                                                                                          Properties

                                                                                                                                                                          Properties

                                                                                                                                                                          destination: string
                                                                                                                                                                          origin: string
                                                                                                                                                                          diff --git a/docs/interfaces/raptor_types.StopTime.html b/docs/interfaces/raptor_types.StopTime.html deleted file mode 100644 index eafc571..0000000 --- a/docs/interfaces/raptor_types.StopTime.html +++ /dev/null @@ -1,16 +0,0 @@ -StopTime | mbus-backend
                                                                                                                                                                          mbus-backend
                                                                                                                                                                            Preparing search index...

                                                                                                                                                                            Interface StopTime

                                                                                                                                                                            Represents a scheduled stop event within a trip (GTFS StopTime).

                                                                                                                                                                            -
                                                                                                                                                                            interface StopTime {
                                                                                                                                                                                arrivalTime: number;
                                                                                                                                                                                departureTime: number;
                                                                                                                                                                                dropOff: boolean;
                                                                                                                                                                                heursticCost?: number;
                                                                                                                                                                                isExtrapolated?: boolean;
                                                                                                                                                                                pickUp: boolean;
                                                                                                                                                                                rt?: string;
                                                                                                                                                                                stop: string;
                                                                                                                                                                            }
                                                                                                                                                                            Index

                                                                                                                                                                            Properties

                                                                                                                                                                            arrivalTime: number
                                                                                                                                                                            departureTime: number
                                                                                                                                                                            dropOff: boolean

                                                                                                                                                                            Whether passengers can alight from the vehicle here.

                                                                                                                                                                            -
                                                                                                                                                                            heursticCost?: number

                                                                                                                                                                            Optional pre-calculated cost for routing heuristics.

                                                                                                                                                                            -
                                                                                                                                                                            isExtrapolated?: boolean

                                                                                                                                                                            If the stop is predicted or not.

                                                                                                                                                                            -
                                                                                                                                                                            pickUp: boolean

                                                                                                                                                                            Whether passengers can board the vehicle here.

                                                                                                                                                                            -
                                                                                                                                                                            rt?: string

                                                                                                                                                                            Real-time status string (if available).

                                                                                                                                                                            -
                                                                                                                                                                            stop: string

                                                                                                                                                                            The ID of the stop.

                                                                                                                                                                            -
                                                                                                                                                                            diff --git a/docs/interfaces/raptor_types.TimetableLeg.html b/docs/interfaces/raptor_types.TimetableLeg.html deleted file mode 100644 index 347f2af..0000000 --- a/docs/interfaces/raptor_types.TimetableLeg.html +++ /dev/null @@ -1,6 +0,0 @@ -TimetableLeg | mbus-backend
                                                                                                                                                                            mbus-backend
                                                                                                                                                                              Preparing search index...

                                                                                                                                                                              Interface TimetableLeg

                                                                                                                                                                              A specific segment of a scheduled trip with fixed times.

                                                                                                                                                                              -
                                                                                                                                                                              interface TimetableLeg {
                                                                                                                                                                                  destination: string;
                                                                                                                                                                                  origin: string;
                                                                                                                                                                                  stopTimes: StopTime[];
                                                                                                                                                                                  trip: Trip;
                                                                                                                                                                              }

                                                                                                                                                                              Hierarchy (View Summary)

                                                                                                                                                                              • Leg
                                                                                                                                                                                • TimetableLeg
                                                                                                                                                                              Index

                                                                                                                                                                              Properties

                                                                                                                                                                              destination: string
                                                                                                                                                                              origin: string
                                                                                                                                                                              stopTimes: StopTime[]
                                                                                                                                                                              trip: Trip
                                                                                                                                                                              diff --git a/docs/interfaces/raptor_types.Transfer.html b/docs/interfaces/raptor_types.Transfer.html deleted file mode 100644 index 5249ef0..0000000 --- a/docs/interfaces/raptor_types.Transfer.html +++ /dev/null @@ -1,9 +0,0 @@ -Transfer | mbus-backend
                                                                                                                                                                              mbus-backend
                                                                                                                                                                                Preparing search index...

                                                                                                                                                                                Interface Transfer

                                                                                                                                                                                A walking connection between two stops with a defined duration.

                                                                                                                                                                                -
                                                                                                                                                                                interface Transfer {
                                                                                                                                                                                    destination: string;
                                                                                                                                                                                    duration: number;
                                                                                                                                                                                    endTime: number;
                                                                                                                                                                                    origin: string;
                                                                                                                                                                                    startTime: number;
                                                                                                                                                                                }

                                                                                                                                                                                Hierarchy (View Summary)

                                                                                                                                                                                Index

                                                                                                                                                                                Properties

                                                                                                                                                                                destination: string
                                                                                                                                                                                duration: number
                                                                                                                                                                                endTime: number

                                                                                                                                                                                Valid end time for this transfer window.

                                                                                                                                                                                -
                                                                                                                                                                                origin: string
                                                                                                                                                                                startTime: number

                                                                                                                                                                                Valid start time for this transfer window.

                                                                                                                                                                                -
                                                                                                                                                                                diff --git a/docs/interfaces/raptor_types.Trip.html b/docs/interfaces/raptor_types.Trip.html deleted file mode 100644 index 946cd62..0000000 --- a/docs/interfaces/raptor_types.Trip.html +++ /dev/null @@ -1,7 +0,0 @@ -Trip | mbus-backend
                                                                                                                                                                                mbus-backend
                                                                                                                                                                                  Preparing search index...

                                                                                                                                                                                  Interface Trip

                                                                                                                                                                                  Represents a transit vehicle run (GTFS Trip).

                                                                                                                                                                                  -
                                                                                                                                                                                  interface Trip {
                                                                                                                                                                                      stopTimes: StopTime[];
                                                                                                                                                                                      tripId: string;
                                                                                                                                                                                      vid: string | null;
                                                                                                                                                                                  }
                                                                                                                                                                                  Index

                                                                                                                                                                                  Properties

                                                                                                                                                                                  Properties

                                                                                                                                                                                  stopTimes: StopTime[]

                                                                                                                                                                                  Ordered list of stops made by this trip.

                                                                                                                                                                                  -
                                                                                                                                                                                  tripId: string
                                                                                                                                                                                  vid: string | null

                                                                                                                                                                                  Vehicle ID, if available.

                                                                                                                                                                                  -
                                                                                                                                                                                  diff --git a/docs/interfaces/walking_walkingMap.BatchWalkingResult.html b/docs/interfaces/walking_walkingMap.BatchWalkingResult.html deleted file mode 100644 index 7995faa..0000000 --- a/docs/interfaces/walking_walkingMap.BatchWalkingResult.html +++ /dev/null @@ -1,8 +0,0 @@ -BatchWalkingResult | mbus-backend
                                                                                                                                                                                  mbus-backend
                                                                                                                                                                                    Preparing search index...

                                                                                                                                                                                    Interface BatchWalkingResult

                                                                                                                                                                                    Result of a batch query from a single origin node to multiple destinations.

                                                                                                                                                                                    -
                                                                                                                                                                                    interface BatchWalkingResult {
                                                                                                                                                                                        distanceToNode: number;
                                                                                                                                                                                        nearestNodeId: string;
                                                                                                                                                                                        nodeDistances: Map<string, number>;
                                                                                                                                                                                    }
                                                                                                                                                                                    Index

                                                                                                                                                                                    Properties

                                                                                                                                                                                    distanceToNode: number

                                                                                                                                                                                    The straight-line distance from the origin coordinates to the street node.

                                                                                                                                                                                    -
                                                                                                                                                                                    nearestNodeId: string

                                                                                                                                                                                    The ID of the street node closest to the origin coordinates.

                                                                                                                                                                                    -
                                                                                                                                                                                    nodeDistances: Map<string, number>

                                                                                                                                                                                    A map of NodeID -> Distance (in meters) for all reachable nodes.

                                                                                                                                                                                    -
                                                                                                                                                                                    diff --git a/docs/interfaces/walking_walkingMap.WalkingResponse.html b/docs/interfaces/walking_walkingMap.WalkingResponse.html deleted file mode 100644 index 2889134..0000000 --- a/docs/interfaces/walking_walkingMap.WalkingResponse.html +++ /dev/null @@ -1,8 +0,0 @@ -WalkingResponse | mbus-backend
                                                                                                                                                                                    mbus-backend
                                                                                                                                                                                      Preparing search index...

                                                                                                                                                                                      Interface WalkingResponse

                                                                                                                                                                                      Standard response for a single point-to-point walking query.

                                                                                                                                                                                      -
                                                                                                                                                                                      interface WalkingResponse {
                                                                                                                                                                                          distance: number;
                                                                                                                                                                                          duration: number;
                                                                                                                                                                                          path_coords: { lat: number; lon: number }[];
                                                                                                                                                                                      }
                                                                                                                                                                                      Index

                                                                                                                                                                                      Properties

                                                                                                                                                                                      distance: number

                                                                                                                                                                                      Walking distance in meters.

                                                                                                                                                                                      -
                                                                                                                                                                                      duration: number

                                                                                                                                                                                      Walking duration in seconds.

                                                                                                                                                                                      -
                                                                                                                                                                                      path_coords: { lat: number; lon: number }[]

                                                                                                                                                                                      Ordered list of coordinates representing the walking path geometry.

                                                                                                                                                                                      -
                                                                                                                                                                                      diff --git a/docs/media/logo.png b/docs/media/logo.png deleted file mode 100644 index b086987..0000000 Binary files a/docs/media/logo.png and /dev/null differ diff --git a/docs/media/test_example.png b/docs/media/test_example.png deleted file mode 100644 index 41667bd..0000000 Binary files a/docs/media/test_example.png and /dev/null differ diff --git a/docs/modules.html b/docs/modules.html deleted file mode 100644 index 9561e10..0000000 --- a/docs/modules.html +++ /dev/null @@ -1 +0,0 @@ -mbus-backend
                                                                                                                                                                                      mbus-backend
                                                                                                                                                                                        Preparing search index...
                                                                                                                                                                                        diff --git a/docs/modules/app.html b/docs/modules/app.html deleted file mode 100644 index baf826b..0000000 --- a/docs/modules/app.html +++ /dev/null @@ -1 +0,0 @@ -app | mbus-backend
                                                                                                                                                                                        mbus-backend
                                                                                                                                                                                          Preparing search index...

                                                                                                                                                                                          Module app

                                                                                                                                                                                          diff --git a/docs/modules/jobs.html b/docs/modules/jobs.html deleted file mode 100644 index 217f3e1..0000000 --- a/docs/modules/jobs.html +++ /dev/null @@ -1 +0,0 @@ -jobs | mbus-backend
                                                                                                                                                                                          mbus-backend
                                                                                                                                                                                            Preparing search index...

                                                                                                                                                                                            Module jobs

                                                                                                                                                                                            Functions

                                                                                                                                                                                            startBackgroundJobs
                                                                                                                                                                                            diff --git a/docs/modules/raptor_McRaptorAlgorithm.html b/docs/modules/raptor_McRaptorAlgorithm.html deleted file mode 100644 index b3e9157..0000000 --- a/docs/modules/raptor_McRaptorAlgorithm.html +++ /dev/null @@ -1 +0,0 @@ -raptor/McRaptorAlgorithm | mbus-backend
                                                                                                                                                                                            mbus-backend
                                                                                                                                                                                              Preparing search index...

                                                                                                                                                                                              Module raptor/McRaptorAlgorithm

                                                                                                                                                                                              Classes

                                                                                                                                                                                              McRaptorAlgorithm

                                                                                                                                                                                              Interfaces

                                                                                                                                                                                              Journey
                                                                                                                                                                                              JourneyLeg
                                                                                                                                                                                              diff --git a/docs/modules/raptor_McStructs.html b/docs/modules/raptor_McStructs.html deleted file mode 100644 index 77efccd..0000000 --- a/docs/modules/raptor_McStructs.html +++ /dev/null @@ -1 +0,0 @@ -raptor/McStructs | mbus-backend
                                                                                                                                                                                              mbus-backend
                                                                                                                                                                                                Preparing search index...

                                                                                                                                                                                                Module raptor/McStructs

                                                                                                                                                                                                Classes

                                                                                                                                                                                                Bag
                                                                                                                                                                                                Label

                                                                                                                                                                                                Type Aliases

                                                                                                                                                                                                Criteria
                                                                                                                                                                                                diff --git a/docs/modules/raptor_types.html b/docs/modules/raptor_types.html deleted file mode 100644 index 432b43e..0000000 --- a/docs/modules/raptor_types.html +++ /dev/null @@ -1 +0,0 @@ -raptor/types | mbus-backend
                                                                                                                                                                                                mbus-backend
                                                                                                                                                                                                  Preparing search index...
                                                                                                                                                                                                  diff --git a/docs/modules/routes_api.html b/docs/modules/routes_api.html deleted file mode 100644 index 92b0831..0000000 --- a/docs/modules/routes_api.html +++ /dev/null @@ -1 +0,0 @@ -routes/api | mbus-backend
                                                                                                                                                                                                  mbus-backend
                                                                                                                                                                                                    Preparing search index...
                                                                                                                                                                                                    diff --git a/docs/modules/services_graphBuilder.html b/docs/modules/services_graphBuilder.html deleted file mode 100644 index c6dd5c0..0000000 --- a/docs/modules/services_graphBuilder.html +++ /dev/null @@ -1 +0,0 @@ -services/graphBuilder | mbus-backend
                                                                                                                                                                                                    mbus-backend
                                                                                                                                                                                                      Preparing search index...
                                                                                                                                                                                                      diff --git a/docs/modules/services_journey.html b/docs/modules/services_journey.html deleted file mode 100644 index 4bf332e..0000000 --- a/docs/modules/services_journey.html +++ /dev/null @@ -1 +0,0 @@ -services/journey | mbus-backend
                                                                                                                                                                                                      mbus-backend
                                                                                                                                                                                                        Preparing search index...

                                                                                                                                                                                                        Module services/journey

                                                                                                                                                                                                        Functions

                                                                                                                                                                                                        planJourney
                                                                                                                                                                                                        diff --git a/docs/modules/services_mbus.html b/docs/modules/services_mbus.html deleted file mode 100644 index 5c2a1c4..0000000 --- a/docs/modules/services_mbus.html +++ /dev/null @@ -1 +0,0 @@ -services/mbus | mbus-backend
                                                                                                                                                                                                        mbus-backend
                                                                                                                                                                                                          Preparing search index...
                                                                                                                                                                                                          diff --git a/docs/modules/services_metadata.html b/docs/modules/services_metadata.html deleted file mode 100644 index dff1332..0000000 --- a/docs/modules/services_metadata.html +++ /dev/null @@ -1 +0,0 @@ -services/metadata | mbus-backend
                                                                                                                                                                                                          mbus-backend
                                                                                                                                                                                                            Preparing search index...
                                                                                                                                                                                                            diff --git a/docs/modules/services_reminder.html b/docs/modules/services_reminder.html deleted file mode 100644 index e60ffda..0000000 --- a/docs/modules/services_reminder.html +++ /dev/null @@ -1 +0,0 @@ -services/reminder | mbus-backend
                                                                                                                                                                                                            mbus-backend
                                                                                                                                                                                                              Preparing search index...

                                                                                                                                                                                                              Module services/reminder

                                                                                                                                                                                                              Type Aliases

                                                                                                                                                                                                              PostThreshold
                                                                                                                                                                                                              PreThreshold

                                                                                                                                                                                                              Variables

                                                                                                                                                                                                              rideReminderSubscriptions
                                                                                                                                                                                                              testing
                                                                                                                                                                                                              universityReminderSubscriptions

                                                                                                                                                                                                              Functions

                                                                                                                                                                                                              eventsEqual
                                                                                                                                                                                                              infoToUseForRoute
                                                                                                                                                                                                              processRideReminders
                                                                                                                                                                                                              processUniversityReminders
                                                                                                                                                                                                              sendNotifToAll

                                                                                                                                                                                                              References

                                                                                                                                                                                                              baseEvent → baseEvent
                                                                                                                                                                                                              BaseEvent → BaseEvent
                                                                                                                                                                                                              delayEvent → delayEvent
                                                                                                                                                                                                              DelayEvent → DelayEvent
                                                                                                                                                                                                              fromKey → fromKey
                                                                                                                                                                                                              Key → Key
                                                                                                                                                                                                              registrationToken → registrationToken
                                                                                                                                                                                                              RegistrationToken → RegistrationToken
                                                                                                                                                                                                              sameBaseEvent → sameBaseEvent
                                                                                                                                                                                                              thresholdEvent → thresholdEvent
                                                                                                                                                                                                              ThresholdEvent → ThresholdEvent
                                                                                                                                                                                                              toKey → toKey
                                                                                                                                                                                                              diff --git a/docs/modules/services_reminderTypes.html b/docs/modules/services_reminderTypes.html deleted file mode 100644 index da54182..0000000 --- a/docs/modules/services_reminderTypes.html +++ /dev/null @@ -1 +0,0 @@ -services/reminderTypes | mbus-backend
                                                                                                                                                                                                              mbus-backend
                                                                                                                                                                                                                Preparing search index...
                                                                                                                                                                                                                diff --git a/docs/modules/services_ride.html b/docs/modules/services_ride.html deleted file mode 100644 index dff55af..0000000 --- a/docs/modules/services_ride.html +++ /dev/null @@ -1 +0,0 @@ -services/ride | mbus-backend
                                                                                                                                                                                                                mbus-backend
                                                                                                                                                                                                                  Preparing search index...
                                                                                                                                                                                                                  diff --git a/docs/modules/state_transitState.html b/docs/modules/state_transitState.html deleted file mode 100644 index b09cede..0000000 --- a/docs/modules/state_transitState.html +++ /dev/null @@ -1 +0,0 @@ -state/transitState | mbus-backend
                                                                                                                                                                                                                  mbus-backend
                                                                                                                                                                                                                    Preparing search index...
                                                                                                                                                                                                                    diff --git a/docs/modules/types.html b/docs/modules/types.html deleted file mode 100644 index 2859f15..0000000 --- a/docs/modules/types.html +++ /dev/null @@ -1 +0,0 @@ -types | mbus-backend
                                                                                                                                                                                                                    mbus-backend
                                                                                                                                                                                                                      Preparing search index...

                                                                                                                                                                                                                      Module types

                                                                                                                                                                                                                      Type Aliases

                                                                                                                                                                                                                      Route
                                                                                                                                                                                                                      diff --git a/docs/modules/walking_loadMap.html b/docs/modules/walking_loadMap.html deleted file mode 100644 index a1cc5b7..0000000 --- a/docs/modules/walking_loadMap.html +++ /dev/null @@ -1 +0,0 @@ -walking/loadMap | mbus-backend
                                                                                                                                                                                                                      mbus-backend
                                                                                                                                                                                                                        Preparing search index...

                                                                                                                                                                                                                        Module walking/loadMap

                                                                                                                                                                                                                        Functions

                                                                                                                                                                                                                        haversine
                                                                                                                                                                                                                        loadMap
                                                                                                                                                                                                                        diff --git a/docs/modules/walking_types.html b/docs/modules/walking_types.html deleted file mode 100644 index 247a6fb..0000000 --- a/docs/modules/walking_types.html +++ /dev/null @@ -1 +0,0 @@ -walking/types | mbus-backend
                                                                                                                                                                                                                        mbus-backend
                                                                                                                                                                                                                          Preparing search index...

                                                                                                                                                                                                                          Module walking/types

                                                                                                                                                                                                                          Type Aliases

                                                                                                                                                                                                                          GraphMLEdge
                                                                                                                                                                                                                          GraphMLNode
                                                                                                                                                                                                                          LandmarkDef
                                                                                                                                                                                                                          diff --git a/docs/modules/walking_walkingMap.html b/docs/modules/walking_walkingMap.html deleted file mode 100644 index bbb0db7..0000000 --- a/docs/modules/walking_walkingMap.html +++ /dev/null @@ -1 +0,0 @@ -walking/walkingMap | mbus-backend
                                                                                                                                                                                                                          mbus-backend
                                                                                                                                                                                                                            Preparing search index...
                                                                                                                                                                                                                            diff --git a/docs/types/raptor_McStructs.Criteria.html b/docs/types/raptor_McStructs.Criteria.html deleted file mode 100644 index f731f5d..0000000 --- a/docs/types/raptor_McStructs.Criteria.html +++ /dev/null @@ -1,5 +0,0 @@ -Criteria | mbus-backend
                                                                                                                                                                                                                            mbus-backend
                                                                                                                                                                                                                              Preparing search index...

                                                                                                                                                                                                                              Type Alias Criteria

                                                                                                                                                                                                                              Defines the optimization metrics used to compare different journey options.

                                                                                                                                                                                                                              -
                                                                                                                                                                                                                              type Criteria = {
                                                                                                                                                                                                                                  arrivalTime: number;
                                                                                                                                                                                                                                  transferCount: number;
                                                                                                                                                                                                                                  walkingDistance: number;
                                                                                                                                                                                                                              }
                                                                                                                                                                                                                              Index

                                                                                                                                                                                                                              Properties

                                                                                                                                                                                                                              arrivalTime: number
                                                                                                                                                                                                                              transferCount: number
                                                                                                                                                                                                                              walkingDistance: number
                                                                                                                                                                                                                              diff --git a/docs/types/raptor_types.Duration.html b/docs/types/raptor_types.Duration.html deleted file mode 100644 index bd2ff41..0000000 --- a/docs/types/raptor_types.Duration.html +++ /dev/null @@ -1,2 +0,0 @@ -Duration | mbus-backend
                                                                                                                                                                                                                              mbus-backend
                                                                                                                                                                                                                                Preparing search index...

                                                                                                                                                                                                                                Type Alias Duration

                                                                                                                                                                                                                                Duration: number

                                                                                                                                                                                                                                A span of time measured in seconds.

                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                diff --git a/docs/types/raptor_types.Interchange.html b/docs/types/raptor_types.Interchange.html deleted file mode 100644 index 018d219..0000000 --- a/docs/types/raptor_types.Interchange.html +++ /dev/null @@ -1,2 +0,0 @@ -Interchange | mbus-backend
                                                                                                                                                                                                                                mbus-backend
                                                                                                                                                                                                                                  Preparing search index...

                                                                                                                                                                                                                                  Type Alias Interchange

                                                                                                                                                                                                                                  Interchange: Record<StopID, Time>

                                                                                                                                                                                                                                  Map defining the minimum time required to switch vehicles at each stop.

                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                  diff --git a/docs/types/raptor_types.StopID.html b/docs/types/raptor_types.StopID.html deleted file mode 100644 index eec8b94..0000000 --- a/docs/types/raptor_types.StopID.html +++ /dev/null @@ -1,2 +0,0 @@ -StopID | mbus-backend
                                                                                                                                                                                                                                  mbus-backend
                                                                                                                                                                                                                                    Preparing search index...

                                                                                                                                                                                                                                    Type Alias StopID

                                                                                                                                                                                                                                    StopID: string

                                                                                                                                                                                                                                    Unique identifier for a transit stop (e.g., "NRW").

                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                    diff --git a/docs/types/raptor_types.Time.html b/docs/types/raptor_types.Time.html deleted file mode 100644 index bdf5077..0000000 --- a/docs/types/raptor_types.Time.html +++ /dev/null @@ -1,3 +0,0 @@ -Time | mbus-backend
                                                                                                                                                                                                                                    mbus-backend
                                                                                                                                                                                                                                      Preparing search index...

                                                                                                                                                                                                                                      Type Alias Time

                                                                                                                                                                                                                                      Time: number

                                                                                                                                                                                                                                      Time represented as seconds since midnight. -Values may exceed 86400 (24 hours) for trips extending into the next day.

                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                      diff --git a/docs/types/raptor_types.TransfersByOrigin.html b/docs/types/raptor_types.TransfersByOrigin.html deleted file mode 100644 index b24eb74..0000000 --- a/docs/types/raptor_types.TransfersByOrigin.html +++ /dev/null @@ -1,2 +0,0 @@ -TransfersByOrigin | mbus-backend
                                                                                                                                                                                                                                      mbus-backend
                                                                                                                                                                                                                                        Preparing search index...

                                                                                                                                                                                                                                        Type Alias TransfersByOrigin

                                                                                                                                                                                                                                        TransfersByOrigin: Record<StopID, Transfer[]>

                                                                                                                                                                                                                                        Lookup map for walking transfers, indexed by the origin Stop ID.

                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                        diff --git a/docs/types/raptor_types.TripID.html b/docs/types/raptor_types.TripID.html deleted file mode 100644 index ae31e00..0000000 --- a/docs/types/raptor_types.TripID.html +++ /dev/null @@ -1,2 +0,0 @@ -TripID | mbus-backend
                                                                                                                                                                                                                                        mbus-backend
                                                                                                                                                                                                                                          Preparing search index...

                                                                                                                                                                                                                                          Type Alias TripID

                                                                                                                                                                                                                                          TripID: string

                                                                                                                                                                                                                                          Unique identifier for a GTFS trip.

                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                          diff --git a/docs/types/services_reminder.PostThreshold.html b/docs/types/services_reminder.PostThreshold.html deleted file mode 100644 index 2eca7ea..0000000 --- a/docs/types/services_reminder.PostThreshold.html +++ /dev/null @@ -1,7 +0,0 @@ -PostThreshold | mbus-backend
                                                                                                                                                                                                                                          mbus-backend
                                                                                                                                                                                                                                            Preparing search index...

                                                                                                                                                                                                                                            Type Alias PostThreshold

                                                                                                                                                                                                                                            Waiting for the bus indicated by vid to be at the stop indicated by stpid. Logic for what notification to send -is complicated by arrival times sometimes skipping DUE, see ReminderSubscriptons.process for details.

                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                            type PostThreshold = {
                                                                                                                                                                                                                                                event: BaseEvent;
                                                                                                                                                                                                                                                stage: 1;
                                                                                                                                                                                                                                                vid: string;
                                                                                                                                                                                                                                                vidPredPrev: number | null;
                                                                                                                                                                                                                                            }
                                                                                                                                                                                                                                            Index

                                                                                                                                                                                                                                            Properties

                                                                                                                                                                                                                                            Properties

                                                                                                                                                                                                                                            event: BaseEvent
                                                                                                                                                                                                                                            stage: 1
                                                                                                                                                                                                                                            vid: string
                                                                                                                                                                                                                                            vidPredPrev: number | null
                                                                                                                                                                                                                                            diff --git a/docs/types/services_reminder.PreThreshold.html b/docs/types/services_reminder.PreThreshold.html deleted file mode 100644 index 041f7fe..0000000 --- a/docs/types/services_reminder.PreThreshold.html +++ /dev/null @@ -1,15 +0,0 @@ -PreThreshold | mbus-backend
                                                                                                                                                                                                                                            mbus-backend
                                                                                                                                                                                                                                              Preparing search index...

                                                                                                                                                                                                                                              Type Alias PreThreshold

                                                                                                                                                                                                                                              Waiting for a prediction of the right event to have a arrival timestamp that is at or after mustBeAfter and an -arrival time less than thresh. A bus is xx minutes from the stop notification is then sent. To handle delayed and -disappeared notifications, a candidateVid is set to the soonest arriving bus that arrives after mustbeAfter.

                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                              type PreThreshold = {
                                                                                                                                                                                                                                                  candidateVid: string | null;
                                                                                                                                                                                                                                                  candidateVidPredPrev: number | null;
                                                                                                                                                                                                                                                  event: BaseEvent;
                                                                                                                                                                                                                                                  mustBeAfter: number;
                                                                                                                                                                                                                                                  stage: 0;
                                                                                                                                                                                                                                                  thresh: number;
                                                                                                                                                                                                                                              }
                                                                                                                                                                                                                                              Index

                                                                                                                                                                                                                                              Properties

                                                                                                                                                                                                                                              candidateVid: string | null

                                                                                                                                                                                                                                              stores the bus that'll likely trigger the threshold notification, being only a candidate this can change -as things are updated and such a change won't trigger a disappeared notification

                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                              candidateVidPredPrev: number | null

                                                                                                                                                                                                                                              minutes

                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                              event: BaseEvent
                                                                                                                                                                                                                                              mustBeAfter: number

                                                                                                                                                                                                                                              unix epoch milliseconds

                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                              stage: 0
                                                                                                                                                                                                                                              thresh: number

                                                                                                                                                                                                                                              minutes

                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                              diff --git a/docs/types/services_reminderTypes.BaseEvent.html b/docs/types/services_reminderTypes.BaseEvent.html deleted file mode 100644 index 1dcbcc2..0000000 --- a/docs/types/services_reminderTypes.BaseEvent.html +++ /dev/null @@ -1 +0,0 @@ -BaseEvent | mbus-backend
                                                                                                                                                                                                                                              mbus-backend
                                                                                                                                                                                                                                                Preparing search index...
                                                                                                                                                                                                                                                BaseEvent: CoreEvent & { __brand: "event" }
                                                                                                                                                                                                                                                diff --git a/docs/types/services_reminderTypes.DelayEvent.html b/docs/types/services_reminderTypes.DelayEvent.html deleted file mode 100644 index 44c549c..0000000 --- a/docs/types/services_reminderTypes.DelayEvent.html +++ /dev/null @@ -1 +0,0 @@ -DelayEvent | mbus-backend
                                                                                                                                                                                                                                                mbus-backend
                                                                                                                                                                                                                                                  Preparing search index...
                                                                                                                                                                                                                                                  DelayEvent: CoreEvent & {
                                                                                                                                                                                                                                                      __brand: "delayEvent";
                                                                                                                                                                                                                                                      currPred: number;
                                                                                                                                                                                                                                                      prevPred: number;
                                                                                                                                                                                                                                                  }
                                                                                                                                                                                                                                                  diff --git a/docs/types/services_reminderTypes.Key.html b/docs/types/services_reminderTypes.Key.html deleted file mode 100644 index f07b39c..0000000 --- a/docs/types/services_reminderTypes.Key.html +++ /dev/null @@ -1 +0,0 @@ -Key | mbus-backend
                                                                                                                                                                                                                                                  mbus-backend
                                                                                                                                                                                                                                                    Preparing search index...

                                                                                                                                                                                                                                                    Type Alias Key<T>

                                                                                                                                                                                                                                                    Key: string & { __brand: "key"; __phantomData: T }

                                                                                                                                                                                                                                                    Type Parameters

                                                                                                                                                                                                                                                    • T
                                                                                                                                                                                                                                                    diff --git a/docs/types/services_reminderTypes.RegistrationToken.html b/docs/types/services_reminderTypes.RegistrationToken.html deleted file mode 100644 index a46cd40..0000000 --- a/docs/types/services_reminderTypes.RegistrationToken.html +++ /dev/null @@ -1 +0,0 @@ -RegistrationToken | mbus-backend
                                                                                                                                                                                                                                                    mbus-backend
                                                                                                                                                                                                                                                      Preparing search index...

                                                                                                                                                                                                                                                      Type Alias RegistrationToken

                                                                                                                                                                                                                                                      RegistrationToken: string & { __brand: "registrationToken" }
                                                                                                                                                                                                                                                      diff --git a/docs/types/services_reminderTypes.ThresholdEvent.html b/docs/types/services_reminderTypes.ThresholdEvent.html deleted file mode 100644 index 453a64b..0000000 --- a/docs/types/services_reminderTypes.ThresholdEvent.html +++ /dev/null @@ -1 +0,0 @@ -ThresholdEvent | mbus-backend
                                                                                                                                                                                                                                                      mbus-backend
                                                                                                                                                                                                                                                        Preparing search index...

                                                                                                                                                                                                                                                        Type Alias ThresholdEvent

                                                                                                                                                                                                                                                        ThresholdEvent: CoreEvent & { __brand: "thresholdEvent"; threshold: number }
                                                                                                                                                                                                                                                        diff --git a/docs/types/state_transitState.Prediction.html b/docs/types/state_transitState.Prediction.html deleted file mode 100644 index 9d40436..0000000 --- a/docs/types/state_transitState.Prediction.html +++ /dev/null @@ -1,2 +0,0 @@ -Prediction | mbus-backend
                                                                                                                                                                                                                                                        mbus-backend
                                                                                                                                                                                                                                                          Preparing search index...

                                                                                                                                                                                                                                                          Type Alias Prediction

                                                                                                                                                                                                                                                          Prediction: {
                                                                                                                                                                                                                                                              prdctdn: string;
                                                                                                                                                                                                                                                              prdtm: number;
                                                                                                                                                                                                                                                              rt: string;
                                                                                                                                                                                                                                                              stpid: string;
                                                                                                                                                                                                                                                              vid: string;
                                                                                                                                                                                                                                                          } & Record<string, any>

                                                                                                                                                                                                                                                          Represents a bus prediction.

                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                          diff --git a/docs/types/types.Route.html b/docs/types/types.Route.html deleted file mode 100644 index c373f72..0000000 --- a/docs/types/types.Route.html +++ /dev/null @@ -1,2 +0,0 @@ -Route | mbus-backend
                                                                                                                                                                                                                                                          mbus-backend
                                                                                                                                                                                                                                                            Preparing search index...

                                                                                                                                                                                                                                                            Type Alias Route

                                                                                                                                                                                                                                                            type Route = {
                                                                                                                                                                                                                                                                rt: string;
                                                                                                                                                                                                                                                            }
                                                                                                                                                                                                                                                            Index

                                                                                                                                                                                                                                                            Properties

                                                                                                                                                                                                                                                            rt -

                                                                                                                                                                                                                                                            Properties

                                                                                                                                                                                                                                                            rt: string
                                                                                                                                                                                                                                                            diff --git a/docs/types/walking_types.GraphMLEdge.html b/docs/types/walking_types.GraphMLEdge.html deleted file mode 100644 index 1ed522b..0000000 --- a/docs/types/walking_types.GraphMLEdge.html +++ /dev/null @@ -1,8 +0,0 @@ -GraphMLEdge | mbus-backend
                                                                                                                                                                                                                                                            mbus-backend
                                                                                                                                                                                                                                                              Preparing search index...

                                                                                                                                                                                                                                                              Type Alias GraphMLEdge

                                                                                                                                                                                                                                                              Represents a directed edge (street segment) connecting two nodes.

                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                              type GraphMLEdge = {
                                                                                                                                                                                                                                                                  dist: number;
                                                                                                                                                                                                                                                                  geometry?: { lat: number; lon: number }[];
                                                                                                                                                                                                                                                                  to: string;
                                                                                                                                                                                                                                                              }
                                                                                                                                                                                                                                                              Index

                                                                                                                                                                                                                                                              Properties

                                                                                                                                                                                                                                                              Properties

                                                                                                                                                                                                                                                              dist: number

                                                                                                                                                                                                                                                              Length of the edge in meters.

                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                              geometry?: { lat: number; lon: number }[]

                                                                                                                                                                                                                                                              Detailed geometry points (WKT) for rendering curved paths.

                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                              to: string

                                                                                                                                                                                                                                                              The ID of the target node this edge leads to.

                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                              diff --git a/docs/types/walking_types.GraphMLNode.html b/docs/types/walking_types.GraphMLNode.html deleted file mode 100644 index f225f2c..0000000 --- a/docs/types/walking_types.GraphMLNode.html +++ /dev/null @@ -1,8 +0,0 @@ -GraphMLNode | mbus-backend
                                                                                                                                                                                                                                                              mbus-backend
                                                                                                                                                                                                                                                                Preparing search index...

                                                                                                                                                                                                                                                                Type Alias GraphMLNode

                                                                                                                                                                                                                                                                Represents a node in the street graph derived from GraphML.

                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                type GraphMLNode = {
                                                                                                                                                                                                                                                                    id: string;
                                                                                                                                                                                                                                                                    lat: number;
                                                                                                                                                                                                                                                                    lon: number;
                                                                                                                                                                                                                                                                }
                                                                                                                                                                                                                                                                Index

                                                                                                                                                                                                                                                                Properties

                                                                                                                                                                                                                                                                id -lat -lon -

                                                                                                                                                                                                                                                                Properties

                                                                                                                                                                                                                                                                id: string

                                                                                                                                                                                                                                                                Unique identifier for the node (from OSM/GraphML).

                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                lat: number

                                                                                                                                                                                                                                                                Latitude coordinate.

                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                lon: number

                                                                                                                                                                                                                                                                Longitude coordinate.

                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                diff --git a/docs/types/walking_types.LandmarkDef.html b/docs/types/walking_types.LandmarkDef.html deleted file mode 100644 index 915b411..0000000 --- a/docs/types/walking_types.LandmarkDef.html +++ /dev/null @@ -1,10 +0,0 @@ -LandmarkDef | mbus-backend
                                                                                                                                                                                                                                                                mbus-backend
                                                                                                                                                                                                                                                                  Preparing search index...

                                                                                                                                                                                                                                                                  Type Alias LandmarkDef

                                                                                                                                                                                                                                                                  Definition for a navigation landmark used in the ALT heuristic algorithm.

                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  type LandmarkDef = {
                                                                                                                                                                                                                                                                      lat: number;
                                                                                                                                                                                                                                                                      lon: number;
                                                                                                                                                                                                                                                                      name: string;
                                                                                                                                                                                                                                                                      nodeId?: string;
                                                                                                                                                                                                                                                                  }
                                                                                                                                                                                                                                                                  Index

                                                                                                                                                                                                                                                                  Properties

                                                                                                                                                                                                                                                                  Properties

                                                                                                                                                                                                                                                                  lat: number

                                                                                                                                                                                                                                                                  Latitude coordinate.

                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  lon: number

                                                                                                                                                                                                                                                                  Longitude coordinate.

                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  name: string

                                                                                                                                                                                                                                                                  Display name of the landmark.

                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  nodeId?: string

                                                                                                                                                                                                                                                                  The Graph Node ID nearest to this landmark (computed at runtime).

                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                  diff --git a/docs/variables/routes_api.default.html b/docs/variables/routes_api.default.html deleted file mode 100644 index b90e1b3..0000000 --- a/docs/variables/routes_api.default.html +++ /dev/null @@ -1,3 +0,0 @@ -default | mbus-backend
                                                                                                                                                                                                                                                                  mbus-backend
                                                                                                                                                                                                                                                                    Preparing search index...

                                                                                                                                                                                                                                                                    Variable defaultConst

                                                                                                                                                                                                                                                                    default: Router = ...

                                                                                                                                                                                                                                                                    Express router for the MBus API v3. -Handles routes for static data, state debugging, journey planning, and startup info.

                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                    diff --git a/docs/variables/services_metadata.staticData.html b/docs/variables/services_metadata.staticData.html deleted file mode 100644 index 02a705b..0000000 --- a/docs/variables/services_metadata.staticData.html +++ /dev/null @@ -1,2 +0,0 @@ -staticData | mbus-backend
                                                                                                                                                                                                                                                                    mbus-backend
                                                                                                                                                                                                                                                                      Preparing search index...

                                                                                                                                                                                                                                                                      Variable staticDataConst

                                                                                                                                                                                                                                                                      staticData: any = metadata

                                                                                                                                                                                                                                                                      Raw static metadata from JSON.

                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                      diff --git a/docs/variables/services_reminder.rideReminderSubscriptions.html b/docs/variables/services_reminder.rideReminderSubscriptions.html deleted file mode 100644 index f0c65df..0000000 --- a/docs/variables/services_reminder.rideReminderSubscriptions.html +++ /dev/null @@ -1 +0,0 @@ -rideReminderSubscriptions | mbus-backend
                                                                                                                                                                                                                                                                      mbus-backend
                                                                                                                                                                                                                                                                        Preparing search index...

                                                                                                                                                                                                                                                                        Variable rideReminderSubscriptionsConst

                                                                                                                                                                                                                                                                        rideReminderSubscriptions: ReminderSubscriptions = ...
                                                                                                                                                                                                                                                                        diff --git a/docs/variables/services_reminder.testing.html b/docs/variables/services_reminder.testing.html deleted file mode 100644 index 2f9349e..0000000 --- a/docs/variables/services_reminder.testing.html +++ /dev/null @@ -1,2 +0,0 @@ -testing | mbus-backend
                                                                                                                                                                                                                                                                        mbus-backend
                                                                                                                                                                                                                                                                          Preparing search index...

                                                                                                                                                                                                                                                                          Variable testingConst

                                                                                                                                                                                                                                                                          testing: {
                                                                                                                                                                                                                                                                              eventsEqual: (e1: BaseEvent, e2: BaseEvent) => boolean;
                                                                                                                                                                                                                                                                              ReminderSubscriptions: typeof ReminderSubscriptions;
                                                                                                                                                                                                                                                                          } = ...

                                                                                                                                                                                                                                                                          exported for tests

                                                                                                                                                                                                                                                                          -

                                                                                                                                                                                                                                                                          Type Declaration

                                                                                                                                                                                                                                                                          • eventsEqual: (e1: BaseEvent, e2: BaseEvent) => boolean
                                                                                                                                                                                                                                                                          • ReminderSubscriptions: typeof ReminderSubscriptions
                                                                                                                                                                                                                                                                          diff --git a/docs/variables/services_reminder.universityReminderSubscriptions.html b/docs/variables/services_reminder.universityReminderSubscriptions.html deleted file mode 100644 index b19565d..0000000 --- a/docs/variables/services_reminder.universityReminderSubscriptions.html +++ /dev/null @@ -1 +0,0 @@ -universityReminderSubscriptions | mbus-backend
                                                                                                                                                                                                                                                                          mbus-backend
                                                                                                                                                                                                                                                                            Preparing search index...

                                                                                                                                                                                                                                                                            Variable universityReminderSubscriptionsConst

                                                                                                                                                                                                                                                                            universityReminderSubscriptions: ReminderSubscriptions = ...
                                                                                                                                                                                                                                                                            diff --git a/docs/variables/state_transitState.cachedGraph.html b/docs/variables/state_transitState.cachedGraph.html deleted file mode 100644 index 9b2a870..0000000 --- a/docs/variables/state_transitState.cachedGraph.html +++ /dev/null @@ -1,2 +0,0 @@ -cachedGraph | mbus-backend
                                                                                                                                                                                                                                                                            mbus-backend
                                                                                                                                                                                                                                                                              Preparing search index...

                                                                                                                                                                                                                                                                              Variable cachedGraph

                                                                                                                                                                                                                                                                              cachedGraph: {
                                                                                                                                                                                                                                                                                  interchange: Interchange;
                                                                                                                                                                                                                                                                                  transfers: TransfersByOrigin;
                                                                                                                                                                                                                                                                                  trips: Trip[];
                                                                                                                                                                                                                                                                              } = ...

                                                                                                                                                                                                                                                                              The current transit graph used for routing.

                                                                                                                                                                                                                                                                              -

                                                                                                                                                                                                                                                                              Type Declaration

                                                                                                                                                                                                                                                                              diff --git a/docs/variables/state_transitState.cachedPredsByStopId.html b/docs/variables/state_transitState.cachedPredsByStopId.html deleted file mode 100644 index 14a287b..0000000 --- a/docs/variables/state_transitState.cachedPredsByStopId.html +++ /dev/null @@ -1,2 +0,0 @@ -cachedPredsByStopId | mbus-backend
                                                                                                                                                                                                                                                                              mbus-backend
                                                                                                                                                                                                                                                                                Preparing search index...

                                                                                                                                                                                                                                                                                Variable cachedPredsByStopIdConst

                                                                                                                                                                                                                                                                                cachedPredsByStopId: Record<string, Prediction[]> = {}

                                                                                                                                                                                                                                                                                Predictions indexed by stop ID.

                                                                                                                                                                                                                                                                                -
                                                                                                                                                                                                                                                                                diff --git a/docs/variables/state_transitState.cachedPredsByVid.html b/docs/variables/state_transitState.cachedPredsByVid.html deleted file mode 100644 index e2f14ae..0000000 --- a/docs/variables/state_transitState.cachedPredsByVid.html +++ /dev/null @@ -1,2 +0,0 @@ -cachedPredsByVid | mbus-backend
                                                                                                                                                                                                                                                                                mbus-backend
                                                                                                                                                                                                                                                                                  Preparing search index...

                                                                                                                                                                                                                                                                                  Variable cachedPredsByVidConst

                                                                                                                                                                                                                                                                                  cachedPredsByVid: Record<string, Prediction[]> = {}

                                                                                                                                                                                                                                                                                  Predictions indexed by vehicle ID.

                                                                                                                                                                                                                                                                                  -
                                                                                                                                                                                                                                                                                  diff --git a/docs/variables/state_transitState.cachedRidePredsByStopId.html b/docs/variables/state_transitState.cachedRidePredsByStopId.html deleted file mode 100644 index a2d90a8..0000000 --- a/docs/variables/state_transitState.cachedRidePredsByStopId.html +++ /dev/null @@ -1,2 +0,0 @@ -cachedRidePredsByStopId | mbus-backend
                                                                                                                                                                                                                                                                                  mbus-backend
                                                                                                                                                                                                                                                                                    Preparing search index...

                                                                                                                                                                                                                                                                                    Variable cachedRidePredsByStopIdConst

                                                                                                                                                                                                                                                                                    cachedRidePredsByStopId: Record<string, Prediction[]> = {}

                                                                                                                                                                                                                                                                                    Predictions indexed by ride stop ID.

                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                    diff --git a/docs/variables/state_transitState.cachedRidePredsByVid.html b/docs/variables/state_transitState.cachedRidePredsByVid.html deleted file mode 100644 index 67a79b1..0000000 --- a/docs/variables/state_transitState.cachedRidePredsByVid.html +++ /dev/null @@ -1,2 +0,0 @@ -cachedRidePredsByVid | mbus-backend
                                                                                                                                                                                                                                                                                    mbus-backend
                                                                                                                                                                                                                                                                                      Preparing search index...

                                                                                                                                                                                                                                                                                      Variable cachedRidePredsByVidConst

                                                                                                                                                                                                                                                                                      cachedRidePredsByVid: Record<string, Prediction[]> = {}

                                                                                                                                                                                                                                                                                      Predictions indexed by ride vehicle ID.

                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                      diff --git a/docs/variables/state_transitState.cachedRideRoutes.html b/docs/variables/state_transitState.cachedRideRoutes.html deleted file mode 100644 index a85f23b..0000000 --- a/docs/variables/state_transitState.cachedRideRoutes.html +++ /dev/null @@ -1,2 +0,0 @@ -cachedRideRoutes | mbus-backend
                                                                                                                                                                                                                                                                                      mbus-backend
                                                                                                                                                                                                                                                                                        Preparing search index...

                                                                                                                                                                                                                                                                                        Variable cachedRideRoutesConst

                                                                                                                                                                                                                                                                                        cachedRideRoutes: Record<string, any> = {}

                                                                                                                                                                                                                                                                                        Cache of route patterns and static data for the ride.

                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                        diff --git a/docs/variables/state_transitState.cachedRideStopLocations.html b/docs/variables/state_transitState.cachedRideStopLocations.html deleted file mode 100644 index 8eaa636..0000000 --- a/docs/variables/state_transitState.cachedRideStopLocations.html +++ /dev/null @@ -1 +0,0 @@ -cachedRideStopLocations | mbus-backend
                                                                                                                                                                                                                                                                                        mbus-backend
                                                                                                                                                                                                                                                                                          Preparing search index...

                                                                                                                                                                                                                                                                                          Variable cachedRideStopLocations

                                                                                                                                                                                                                                                                                          cachedRideStopLocations: Record<
                                                                                                                                                                                                                                                                                              string,
                                                                                                                                                                                                                                                                                              { lat: number; lon: number; name: string },
                                                                                                                                                                                                                                                                                          > = {}
                                                                                                                                                                                                                                                                                          diff --git a/docs/variables/state_transitState.cachedRoutes.html b/docs/variables/state_transitState.cachedRoutes.html deleted file mode 100644 index 4c54c10..0000000 --- a/docs/variables/state_transitState.cachedRoutes.html +++ /dev/null @@ -1,2 +0,0 @@ -cachedRoutes | mbus-backend
                                                                                                                                                                                                                                                                                          mbus-backend
                                                                                                                                                                                                                                                                                            Preparing search index...

                                                                                                                                                                                                                                                                                            Variable cachedRoutesConst

                                                                                                                                                                                                                                                                                            cachedRoutes: Record<string, any> = {}

                                                                                                                                                                                                                                                                                            Cache of route patterns and static data.

                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                            diff --git a/docs/variables/state_transitState.cachedStopLocations.html b/docs/variables/state_transitState.cachedStopLocations.html deleted file mode 100644 index d89fc66..0000000 --- a/docs/variables/state_transitState.cachedStopLocations.html +++ /dev/null @@ -1,2 +0,0 @@ -cachedStopLocations | mbus-backend
                                                                                                                                                                                                                                                                                            mbus-backend
                                                                                                                                                                                                                                                                                              Preparing search index...

                                                                                                                                                                                                                                                                                              Variable cachedStopLocations

                                                                                                                                                                                                                                                                                              cachedStopLocations: Record<string, { lat: number; lon: number; name: string }> = {}

                                                                                                                                                                                                                                                                                              Cache of stop locations (lat/lon).

                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                              diff --git a/docs/variables/state_transitState.curBusPositions.html b/docs/variables/state_transitState.curBusPositions.html deleted file mode 100644 index 7bc30bd..0000000 --- a/docs/variables/state_transitState.curBusPositions.html +++ /dev/null @@ -1,2 +0,0 @@ -curBusPositions | mbus-backend
                                                                                                                                                                                                                                                                                              mbus-backend
                                                                                                                                                                                                                                                                                                Preparing search index...

                                                                                                                                                                                                                                                                                                Variable curBusPositionsConst

                                                                                                                                                                                                                                                                                                curBusPositions: { buses: any[] } = ...

                                                                                                                                                                                                                                                                                                Current positions of all buses.

                                                                                                                                                                                                                                                                                                -

                                                                                                                                                                                                                                                                                                Type Declaration

                                                                                                                                                                                                                                                                                                • buses: any[]
                                                                                                                                                                                                                                                                                                diff --git a/docs/variables/state_transitState.curRidePositions.html b/docs/variables/state_transitState.curRidePositions.html deleted file mode 100644 index 96ca1c9..0000000 --- a/docs/variables/state_transitState.curRidePositions.html +++ /dev/null @@ -1,2 +0,0 @@ -curRidePositions | mbus-backend
                                                                                                                                                                                                                                                                                                mbus-backend
                                                                                                                                                                                                                                                                                                  Preparing search index...

                                                                                                                                                                                                                                                                                                  Variable curRidePositionsConst

                                                                                                                                                                                                                                                                                                  curRidePositions: { buses: any[] } = ...

                                                                                                                                                                                                                                                                                                  Current positions of all ride buses.

                                                                                                                                                                                                                                                                                                  -

                                                                                                                                                                                                                                                                                                  Type Declaration

                                                                                                                                                                                                                                                                                                  • buses: any[]
                                                                                                                                                                                                                                                                                                  diff --git a/docs/variables/state_transitState.rideStopIdToName.html b/docs/variables/state_transitState.rideStopIdToName.html deleted file mode 100644 index b36e20b..0000000 --- a/docs/variables/state_transitState.rideStopIdToName.html +++ /dev/null @@ -1,2 +0,0 @@ -rideStopIdToName | mbus-backend
                                                                                                                                                                                                                                                                                                  mbus-backend
                                                                                                                                                                                                                                                                                                    Preparing search index...

                                                                                                                                                                                                                                                                                                    Variable rideStopIdToNameConst

                                                                                                                                                                                                                                                                                                    rideStopIdToName: Record<string, string> = {}

                                                                                                                                                                                                                                                                                                    Map of ride stop IDs to their human-readable names.

                                                                                                                                                                                                                                                                                                    -
                                                                                                                                                                                                                                                                                                    diff --git a/docs/variables/state_transitState.routeTimingCache.html b/docs/variables/state_transitState.routeTimingCache.html deleted file mode 100644 index 3a6c458..0000000 --- a/docs/variables/state_transitState.routeTimingCache.html +++ /dev/null @@ -1,2 +0,0 @@ -routeTimingCache | mbus-backend
                                                                                                                                                                                                                                                                                                    mbus-backend
                                                                                                                                                                                                                                                                                                      Preparing search index...

                                                                                                                                                                                                                                                                                                      Variable routeTimingCacheConst

                                                                                                                                                                                                                                                                                                      routeTimingCache: Record<
                                                                                                                                                                                                                                                                                                          string,
                                                                                                                                                                                                                                                                                                          Record<
                                                                                                                                                                                                                                                                                                              string,
                                                                                                                                                                                                                                                                                                              Record<string, { diff: number; rtdir: string; rtNext: string }>,
                                                                                                                                                                                                                                                                                                          >,
                                                                                                                                                                                                                                                                                                      > = ...

                                                                                                                                                                                                                                                                                                      Cache of timing differences between stops for extrapolation.

                                                                                                                                                                                                                                                                                                      -
                                                                                                                                                                                                                                                                                                      diff --git a/docs/variables/state_transitState.stopIdToName.html b/docs/variables/state_transitState.stopIdToName.html deleted file mode 100644 index 567074d..0000000 --- a/docs/variables/state_transitState.stopIdToName.html +++ /dev/null @@ -1,2 +0,0 @@ -stopIdToName | mbus-backend
                                                                                                                                                                                                                                                                                                      mbus-backend
                                                                                                                                                                                                                                                                                                        Preparing search index...

                                                                                                                                                                                                                                                                                                        Variable stopIdToNameConst

                                                                                                                                                                                                                                                                                                        stopIdToName: Record<string, string> = {}

                                                                                                                                                                                                                                                                                                        Map of stop IDs to their human-readable names.

                                                                                                                                                                                                                                                                                                        -
                                                                                                                                                                                                                                                                                                        diff --git a/docs/variables/state_transitState.tatripidToRt.html b/docs/variables/state_transitState.tatripidToRt.html deleted file mode 100644 index f36d203..0000000 --- a/docs/variables/state_transitState.tatripidToRt.html +++ /dev/null @@ -1,2 +0,0 @@ -tatripidToRt | mbus-backend
                                                                                                                                                                                                                                                                                                        mbus-backend
                                                                                                                                                                                                                                                                                                          Preparing search index...

                                                                                                                                                                                                                                                                                                          Variable tatripidToRtConst

                                                                                                                                                                                                                                                                                                          tatripidToRt: Record<string, string> = {}

                                                                                                                                                                                                                                                                                                          Map of trip IDs to route names.

                                                                                                                                                                                                                                                                                                          -
                                                                                                                                                                                                                                                                                                          diff --git a/docs/variables/state_transitState.validRideRoutes.html b/docs/variables/state_transitState.validRideRoutes.html deleted file mode 100644 index dcd6c7d..0000000 --- a/docs/variables/state_transitState.validRideRoutes.html +++ /dev/null @@ -1,2 +0,0 @@ -validRideRoutes | mbus-backend
                                                                                                                                                                                                                                                                                                          mbus-backend
                                                                                                                                                                                                                                                                                                            Preparing search index...

                                                                                                                                                                                                                                                                                                            Variable validRideRoutesConst

                                                                                                                                                                                                                                                                                                            validRideRoutes: Set<string> = ...

                                                                                                                                                                                                                                                                                                            Set of currently valid ride route IDs.

                                                                                                                                                                                                                                                                                                            -
                                                                                                                                                                                                                                                                                                            diff --git a/docs/variables/state_transitState.validRoutes.html b/docs/variables/state_transitState.validRoutes.html deleted file mode 100644 index dd1e43a..0000000 --- a/docs/variables/state_transitState.validRoutes.html +++ /dev/null @@ -1,2 +0,0 @@ -validRoutes | mbus-backend
                                                                                                                                                                                                                                                                                                            mbus-backend
                                                                                                                                                                                                                                                                                                              Preparing search index...

                                                                                                                                                                                                                                                                                                              Variable validRoutesConst

                                                                                                                                                                                                                                                                                                              validRoutes: Set<string> = ...

                                                                                                                                                                                                                                                                                                              Set of currently valid route IDs.

                                                                                                                                                                                                                                                                                                              -
                                                                                                                                                                                                                                                                                                              diff --git a/package.json b/package.json index 64c5d38..2b7b90a 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "start": "tsx src/app.ts", "test": "vitest run test", "stress-test": "vitest run test/search-stress.test.ts", - "docs": "typedoc --entryPointStrategy expand ./src --exclude \"**/legacy/**\"" + "docs": "typedoc --entryPointStrategy expand ./src" }, "author": "Efe Akinci", "license": "ISC", diff --git a/src/app.ts b/src/app.ts index 7690451..c5508a6 100644 --- a/src/app.ts +++ b/src/app.ts @@ -1,11 +1,12 @@ import express from "express"; import mbus from "./routes/api" +import * as documented from "./routes/documented"; const app = express(); app.use(express.json()); -app.use("/mbus/api/v3", mbus); +documented.addRouter(documented.globalContext, app, "/mbus/api/v3", mbus); app.use("/docs", express.static("docs")); const PORT = process.env.PORT || 3000; @@ -13,4 +14,7 @@ const PORT = process.env.PORT || 3000; app.listen(PORT, () => { console.log(`Server running on port ${PORT}`); + if (documented.ENABLED) { + documented.outputDocsFor(documented.globalContext); + } }); \ No newline at end of file diff --git a/src/legacy/busService-reminders.ts b/src/legacy/busService-reminders.ts deleted file mode 100644 index 1ead44c..0000000 --- a/src/legacy/busService-reminders.ts +++ /dev/null @@ -1,683 +0,0 @@ -import * as process from "node:process"; - -import axios from 'axios'; -import dotenv from "dotenv"; -import { Route } from "@/types"; -import { - Trip, - StopTime, - Transfer, - StopID, - TransfersByOrigin, - Interchange -} from "./raptor/types"; - -dotenv.config(); - -const API_KEY = process.env.MBUS_API_KEY; -if (API_KEY === undefined) { - throw new Error("MBus API key not set."); -} - -const curBusPositions: { - buses: any[] -} = { - "buses": [] -} - -const cachedRoutes: {[k: string]: any} = {}; -type Prediction = { vid: string; stpid: string } & Record; - -let cachedPredsByVid: Record = {}; -let cachedPredsByStopId: Record = {}; -// routeTimingCache: route -> fromStop -> toStop -> latest diff (minutes) -const routeTimingCache: Record>> = -{ - "CN": { - "N434NORTHBOUND": { - "N500": { - "diff": 5, - "rtdir": "SOUTHBOUND", - "rtNext": "CS" - } - }, - }, - "CS":{ - "S002SOUTHBOUND": { - "S001": { - "diff": 5, - "rtdir": "NORTHBOUND", - "rtNext": "CN" - } - } - } -}; - -const validRoutes = new Set(); -let curRouteSelections = {}; -const routes = ["BB", "CN", "CS", "CSX", "DD", "MX", "NE", "NW", "NX", "OS", "NES", "WS", "WX"]; -let cachedStopLocations: { [stopId: string]: {name : string, lat: number, lon: number } } = { - -}; - -const message = {id: "gradamatation", title: "Congrats Grads 🥳", message: "Congrats to everyone who is gradamatating! Enjoy some grad hats on the buses, and don't forget to celebrate!", buildVersion: '99'} - -let cachedGraph: { - trips: Trip[]; - transfers: TransfersByOrigin; - interchange: Interchange; -} - -let stopIdToName: Record = {}; -let tatripidToRt: Record = {}; - -const sortStopTimesByRouteSequence = (stopTimes: StopTime[]): StopTime[] => { - if (stopTimes.length <= 1) return stopTimes; - - // Sort by arrival time - return stopTimes.sort((a, b) => a.arrivalTime - b.arrivalTime); -}; - -const rebuildGraph = async () => { - try { - const predictions = await getAllBusPredictions(); - if (!predictions || predictions.length === 0) { - return; - } - - // Build stopIdToName and tatripidToRt maps - stopIdToName = {}; - tatripidToRt = {}; - predictions.forEach((trip: any) => { - if (trip.tatripid && trip.stops && trip.stops.length > 0) { - // Find first stop with rt - const firstStopWithRt = trip.stops.find((stop: any) => stop.rt); - if (firstStopWithRt && firstStopWithRt.rt) { - tatripidToRt[trip.tatripid] = firstStopWithRt.rt; - } - } - trip.stops.forEach((stop: any) => { - if (stop.stpid && stop.stpnm) { - stopIdToName[stop.stpid] = stop.stpnm; - } - }); - }); - - const now = new Date(); - const currentTime = now.getUTCHours() * 3600 + now.getUTCMinutes() * 60 + now.getUTCSeconds(); - - const transfers = cachedGraph?.transfers || {}; - const interchange = cachedGraph?.interchange || {}; - - const allStops = new Set(); - predictions.forEach((trip: any) => { - trip.stops.forEach((stop: any) => { - allStops.add(stop.stpid); - }); - }); - - allStops.forEach(stopId => { - if (!transfers[stopId]) { - transfers[stopId] = []; - } - if (!interchange[stopId]) { - interchange[stopId] = 60; // 1 minute interchange time - } - }); - - const stopPredictions: Record = {}; - predictions.forEach((trip: any) => { - trip.stops.forEach((stop: any) => { - if (!stopPredictions[stop.stpid]) { - stopPredictions[stop.stpid] = []; - } - stopPredictions[stop.stpid].push({ - stpid: stop.stpid, - prdctdn: stop.prdctdn, - tatripid: trip.tatripid - }); - }); - }); - - const trips: Trip[] = []; - interface TripPrediction { - vid: string; - stops: { - stpid: string; - prdctdn: string; - rt: string; - }[]; - } - - const tripPredictions: Record = {}; - - predictions.forEach((trip: any) => { - if (!tripPredictions[trip.tatripid]) { - tripPredictions[trip.tatripid] = { - vid: trip.vid, - stops: [] - }; - } - trip.stops.forEach((stop: any) => { - tripPredictions[trip.tatripid].stops.push({ - stpid: stop.stpid, - prdctdn: stop.prdctdn, - rt: stop.rt - }); - }); - }); - - Object.entries(tripPredictions).forEach(([tripId, preds]) => { - // Create stop times with prediction times - const stopTimes: StopTime[] = preds.stops.map(pred => ({ - stop: pred.stpid, - arrivalTime: currentTime + (parseInt(pred.prdctdn) * 60), - departureTime: currentTime + (parseInt(pred.prdctdn) * 60), - pickUp: true, - dropOff: true, - rt: pred.rt - })); - - // Sort stop times by their sequence in the route - const sortedStopTimes = sortStopTimesByRouteSequence(stopTimes); - - trips.push({ - tripId, - vid: preds.vid, - stopTimes: sortedStopTimes - }); - }); - - - cachedGraph = { - trips, - transfers, - interchange - }; - - // Add virtual stops and their interchange - const originStopId = 'VIRTUAL_ORIGIN'; - const destStopId = 'VIRTUAL_DESTINATION'; - cachedGraph.transfers[originStopId] = []; - cachedGraph.transfers[destStopId] = []; - cachedGraph.interchange[originStopId] = 60; - cachedGraph.interchange[destStopId] = 60; - const virtualOriginTrip = { - tripId: 'VIRTUAL_ORIGIN_TRIP', - vid: null, - stopTimes: [{ - stop: originStopId, - arrivalTime: 0, - departureTime: 0, - pickUp: true, - dropOff: true - }] - }; - const virtualDestTrip = { - tripId: 'VIRTUAL_DESTINATION_TRIP', - vid: null, - stopTimes: [{ - stop: destStopId, - arrivalTime: 0, - departureTime: 0, - pickUp: true, - dropOff: true - }] - }; - cachedGraph.trips.push(virtualOriginTrip); - cachedGraph.trips.push(virtualDestTrip); - - } catch (error) { - console.error('Error rebuilding graph:', error); - } -}; - -const getAllBusPredictions = async () => { - try { - // Get all unique stop IDs from cached routes - const allStopIds = new Set(); - Object.values(cachedRoutes).forEach((routePatterns: any) => { - if (Array.isArray(routePatterns)) { - routePatterns.forEach((pattern: any) => { - if (pattern.pt && Array.isArray(pattern.pt)) { - pattern.pt.forEach((point: any) => { - if (point.stpid) { - allStopIds.add(point.stpid); - } - }); - } - }); - } - }); - - const stopIdsArray = Array.from(allStopIds); - const chunks = []; - - for (let i = 0; i < stopIdsArray.length; i += 10) { - chunks.push(stopIdsArray.slice(i, i + 10)); - } - - const predictions = await Promise.all( - chunks.map(async (chunk) => { - const stopIds = chunk.join(','); - const response = await axios.get(`https://mbus.ltp.umich.edu/bustime/api/v3/getpredictions`, { - params: { - requestType: 'getpredictions', - locale: 'en', - stpid: stopIds, - rt: routes.join(','), - tmres: 's', - rtpidatafeed: 'bustime', - key: API_KEY, - format: 'json' - } - }); - return response.data; - }) - ); - - const formattedPredictions = predictions.flat().reduce((acc, predictionChunk) => { - if (predictionChunk['bustime-response'] && predictionChunk['bustime-response']['prd']) { - predictionChunk['bustime-response']['prd'].forEach((prd: any) => { - const tatripid = prd.tatripid; - const stopName = prd.stpnm; - const stopId = prd.stpid; - const rt = prd.rt; - const rtdir = prd.rtdir; - const vid = prd.vid; - let prdctdn = prd.prdctdn; - prdctdn = prdctdn === "DUE" ? "1" : prdctdn; - - let trip = acc.find((t: any) => t.tatripid === tatripid); - - if (!trip) { - if (vid) { // if no trip, go by vid - trip = acc.find((t: any) => t.vid === vid); - } - } - - if (!trip) { // if no trip, create one - trip = { tatripid, vid, stops: [] }; - acc.push(trip); - } else { // merge with existing trip - if (!trip.tatripid) { - trip.tatripid = tatripid; - } - if (!trip.vid && vid) { - trip.vid = vid; - } - } - - let stop = trip.stops.find((s: any) => s.stpnm === stopName && s.stpid === stopId); - if (!stop) { - stop = { stpnm: stopName, stpid: stopId, prdctdn: null, rt: null, rtdir : null }; - trip.stops.push(stop); - } - stop.rtdir = rtdir; - stop.rt = rt; - stop.prdctdn = prdctdn; - }); - } - return acc; - }, []); - - // Cache predictions by vid and stopId - cachedPredsByVid = {}; - cachedPredsByStopId = {}; - predictions.flat().forEach((predictionChunk) => { - const prds = predictionChunk['bustime-response']?.['prd']; - if (!prds) return; - - prds.forEach((prd: Prediction) => { - const { vid, stpid } = prd; - // stpid -> [pred, pred...] - if (!cachedPredsByStopId[stpid]) { - cachedPredsByStopId[stpid] = []; - } - cachedPredsByStopId[stpid].push(prd); // store reference - - if (!vid) return; - // vid -> [pred, pred...] - if (!cachedPredsByVid[vid]) { - cachedPredsByVid[vid] = []; - } - cachedPredsByVid[vid].push(prd); - - }); - }); - - // Cache predictions per route in routeTimingCache for extrapolation - - // Record of stop ids in order using routes - const routeInfoFilter: Record = {}; - for (const [routeName, routeList] of Object.entries(cachedRoutes as Record)) { - for (const route of routeList) { - const rtdir = route.rtdir; - const routeKey = routeName + rtdir; - if (!routeInfoFilter[routeKey]) { - routeInfoFilter[routeKey] = []; - } - for (const point of route.pt) { - if (point.typ !== "W" && point.stpid) { - routeInfoFilter[routeKey].push({ stpid: point.stpid, rtdir }); - } - } - } - } - - const stopIdToName: Record = {}; - formattedPredictions.forEach((trip: any) => { - trip.stops.forEach((stop: any) => { - if (stop.stpid && stop.stpnm) stopIdToName[stop.stpid] = stop.stpnm; - }); - }); - - // Create indices for route -> stop order - const routeStopIndexMaps = new Map>(); - for (const [routeId, stopOrder] of Object.entries(routeInfoFilter)) { - const stopIndexMap = new Map(stopOrder.map(({ stpid }, i) => [stpid, i])); - routeStopIndexMaps.set(routeId, stopIndexMap); - } - - formattedPredictions.forEach((trip: any) => { - if(trip.stops.length == 0) return; - const minPrdctdn = Math.min(...trip.stops.map((s : any) => parseInt(s.prdctdn, 10))); - const firstRoute = trip.stops.find((s: any) => parseInt(s.prdctdn, 10) === minPrdctdn)?.rt; - - if (!firstRoute) return; - // Sort by predicted time - trip.stops.sort((a: any, b: any) => { - const diffTime = parseInt(a.prdctdn, 10) - parseInt(b.prdctdn, 10); - if (diffTime !== 0) return diffTime; // primary sort - - // If not same route, put first route in front - if (a.rt + a.rtdir !== b.rt + b.rtdir) { - if (a.rt === firstRoute) return -1; - if (b.rt === firstRoute) return 1; - - return a.rt.localeCompare(b.rt); - } - // If same route, sort by stop order - const aMap = routeStopIndexMaps.get(a.rt + a.rtdir); - const bMap = routeStopIndexMaps.get(b.rt + b.rtdir); - - const aIdx = aMap?.get(a.stpid) ?? Number.MAX_SAFE_INTEGER; - const bIdx = bMap?.get(b.stpid) ?? Number.MAX_SAFE_INTEGER; - return aIdx - bIdx; - }); - // Create edges based on sorted order - for (let i = 0; i < trip.stops.length - 1; i++) { - const from = trip.stops[i]; - const to = trip.stops[i + 1]; - const diff = parseInt(to.prdctdn, 10) - parseInt(from.prdctdn, 10); - const rt = from.rt; - - const stopIndexMap = routeStopIndexMaps.get(from.rt + from.rtdir); - if (!stopIndexMap) continue; - - const fromIdx = stopIndexMap.get(from.stpid); - const toIdx = stopIndexMap.get(to.stpid); - // Ensure valid follow up stop by idx or end of idx - const isValidFollowUp = ( - fromIdx !== undefined && - toIdx !== undefined && - (toIdx === fromIdx + 1 || fromIdx === stopIndexMap.size - 1) - ); - if (!isValidFollowUp) continue; - - if (!routeTimingCache[rt]) routeTimingCache[rt] = {}; - const fromKey = from.stpid + (from.rtdir || ""); - if (!routeTimingCache[rt][fromKey]) routeTimingCache[rt][fromKey] = {}; - routeTimingCache[rt][fromKey][to.stpid] = { - diff : diff, - rtdir: to.rtdir, - rtNext: to.rt - }; - } - }); - - // Extrapolate future stops based on routeTimingCache - formattedPredictions.forEach((trip: any) => { - let stopsAdded = 0; - while (stopsAdded < 20 && trip.stops.length > 0) { - const lastStop = trip.stops[trip.stops.length - 1]; - const rt = lastStop.rt; - if (!rt) break; - - const fromKey = lastStop.stpid + (lastStop.rtdir || ""); - const nextStops = routeTimingCache[rt]?.[fromKey]; - if (!nextStops) break; - - const nextEntries = Object.entries(nextStops); - if (nextEntries.length === 0) break; - - const [nextStopId, { diff, rtdir, rtNext}] = nextEntries[0]; - const nextPrdctdn = (parseInt(lastStop.prdctdn, 10) + diff).toString(); - - trip.stops.push({ - stpnm: stopIdToName[nextStopId] || nextStopId, - stpid: nextStopId, - prdctdn: nextPrdctdn, - rt : rtNext, - rtdir : rtdir - }); - stopsAdded++; - } - }); - - return formattedPredictions; - } catch (err: unknown) { - const message = err instanceof Error ? err.message : String(err); - console.error("Error in getAllBusPredictions:", message); - return []; - } -}; - -const client = axios.create({ - baseURL: 'https://mbus.ltp.umich.edu/bustime/api/v3/', - params: { - key: API_KEY, - format: 'json' - } -}); - -const getBuses = async () => { - const getChunk = async (routesChunk: string[]) => { - try { - const res = await client.get('/getvehicles', { - params: { requestType: 'getvehicles', rt: routesChunk.join(',') }, - }); - - if ( - 'bustime-response' in res.data && - 'vehicle' in res.data['bustime-response'] - ) { - return res.data['bustime-response']['vehicle']; - } - - return []; - } catch (error) { - console.warn('getChunk failed for routes', routesChunk, error instanceof Error ? error.message : error); - return []; - } - }; - - const chunks = [] - for (let i = 0; i < routes.length; i += 10) { - chunks.push(routes.slice(i, i + 10)); - } - - let buses = await Promise.all(chunks.map(getChunk)); - buses = buses.flat(); - - return buses; -} - -const updateBusPositions = async () => { - curBusPositions.buses = await getBuses(); -} - -const addToCachedRoutes = async (rt: string) => { - try { - const res = await client.get('/getpatterns', { - params: { - requestType: 'getpatterns', - rtpidatafeed: 'bustime', - rt: rt - } - }); - - if (res.data['bustime-response'] && res.data['bustime-response']['ptr']) { - cachedRoutes[rt] = res.data['bustime-response']['ptr']; - } - } catch (e) { - console.log(`Error while getting routes: ${e}`); - } -} - -const getSelectableRoutes = () => { - axios.get(`https://mbus.ltp.umich.edu/bustime/api/v3/getroutes?requestType=getroutes&locale=en&key=${API_KEY}&format=json`).then(res => { - curRouteSelections = res.data; - validRoutes.clear(); - try { - res.data['bustime-response']['routes'].forEach((e: Route) => { - validRoutes.add(e['rt']); - addToCachedRoutes(e['rt']); - }); - } catch (e) { - if (res.data['bustime-response'].error !== undefined) { - console.log(res.data['bustime-response'].error); - } - console.log(`Failed to parse valid routes: ${e}`); - } - }) - .catch((err) => console.log(`Error while getting selectable routes: ${err}`)) - .finally(async () => { - // Update transfers - try { - if (!cachedGraph) { - cachedGraph = { - trips: [], - transfers: {}, - interchange: {} - }; - } - // Rebuild stop locations cache from cached routes - cachedStopLocations = {}; - console.log("Caching Transfers..") - Object.values(cachedRoutes).forEach((routePatterns: any) => { - if (Array.isArray(routePatterns)) { - routePatterns.forEach((pattern: any) => { - if (pattern.pt && Array.isArray(pattern.pt)) { - pattern.pt.forEach((point: any) => { - if (point.stpid && point.lat && point.lon) { - cachedStopLocations[point.stpid] = { - name: point.stpnm, - lat: parseFloat(point.lat), - lon: parseFloat(point.lon) - }; - } - }); - } - }); - } - }); - - console.log(`Number of stop locations: ${Object.keys(cachedStopLocations).length}`); - - const WALKING_SPEED_KMH = 4; - const WALKING_SPEED_MS = WALKING_SPEED_KMH * 1000 / 3600; // Convert to m/s - - const routeStops = new Set(); - Object.values(cachedRoutes).forEach((routePatterns: any) => { - if (Array.isArray(routePatterns)) { - routePatterns.forEach((pattern: any) => { - if (pattern.pt && Array.isArray(pattern.pt)) { - pattern.pt.forEach((point: any) => { - if (point.stpid) { - routeStops.add(point.stpid); - } - }); - } - }); - } - }); - - routeStops.forEach(stopId => { - cachedGraph.transfers[stopId] = []; - }); - - routeStops.forEach(stopId => { - if (!cachedGraph.interchange[stopId]) { - cachedGraph.interchange[stopId] = 60; // 1 minute interchange time - } - }); - - // Create transfers between all stops - routeStops.forEach(stopId => { - routeStops.forEach(otherStopId => { - if (stopId !== otherStopId) { - const stop1 = cachedStopLocations[stopId]; - const stop2 = cachedStopLocations[otherStopId]; - - let transferDuration: number; - - if (stop1 && stop2) { - // Compute diff with lat and lon - const latDiff = (stop2.lat - stop1.lat) * 111320; - const lonDiff = (stop2.lon - stop1.lon) * 111320 * Math.cos(stop1.lat * Math.PI / 180); - const distance = Math.sqrt(latDiff * latDiff + lonDiff * lonDiff); - let walkingTimeSeconds = distance / WALKING_SPEED_MS; - // if (distance > 1200) { - // walkingTimeSeconds *= 1.5; // penatly for too big distances - // } - transferDuration = Math.round(walkingTimeSeconds); - } else { - console.log('Invalid stop'); - transferDuration = 60000; - } - const existingTransfer = cachedGraph.transfers[stopId].find(t => t.destination === otherStopId); - - if (existingTransfer) { - existingTransfer.duration = transferDuration; - } else { - const transfer: Transfer = { - origin: stopId, - destination: otherStopId, - duration: transferDuration, - startTime: 0, - endTime: Number.MAX_SAFE_INTEGER - }; - cachedGraph.transfers[stopId].push(transfer); - } - } - }); - }); - - const totalTransfers = Object.values(cachedGraph.transfers).reduce((total, transfers) => total + transfers.length, 0); - console.log(`Total transfers in cachedGraph: ${totalTransfers}`); - } catch (error) { - console.error('Error updating transfers:', error); - } - }); -} - -export { - curBusPositions, - cachedRoutes, - cachedPredsByVid, - cachedPredsByStopId, - validRoutes, - curRouteSelections, - routes, - cachedStopLocations, - routeTimingCache, - cachedGraph, - stopIdToName, - tatripidToRt, - getAllBusPredictions, - updateBusPositions, - getSelectableRoutes, - rebuildGraph -}; - diff --git a/src/legacy/busService.ts b/src/legacy/busService.ts deleted file mode 100644 index bccae67..0000000 --- a/src/legacy/busService.ts +++ /dev/null @@ -1,751 +0,0 @@ -import * as process from "node:process"; -import * as fs from 'fs'; -import * as path from 'path'; -import * as walking from '../walking/walkingMap'; - -import axios from 'axios'; -import dotenv from "dotenv"; -import { Route } from "@/types"; -import { - Trip, - StopTime, - Transfer, - StopID, - TransfersByOrigin, - Interchange -} from "../raptor/types"; - -import { writeFileSync, readFileSync, existsSync } from "fs"; - -dotenv.config(); - -const API_KEY = process.env.MBUS_API_KEY; -if (API_KEY === undefined) { - throw new Error("MBus API key not set."); -} - -const curBusPositions: { - buses: any[] -} = { - "buses": [] -} - -const cachedRoutes: { [k: string]: any } = {}; -type Prediction = { vid: string; stpid: string } & Record; - -let cachedPredsByVid: Record = {}; -let cachedPredsByStopId: Record = {}; -// routeTimingCache: route -> fromStop -> toStop -> latest diff (minutes) -const routeTimingCache: Record>> = -{ - "CN": { - "N434NORTHBOUND": { - "N500": { - "diff": 5, - "rtdir": "SOUTHBOUND", - "rtNext": "CS" - } - }, - }, - "CS": { - "S002SOUTHBOUND": { - "S001": { - "diff": 5, - "rtdir": "NORTHBOUND", - "rtNext": "CN" - } - } - } -}; - -const validRoutes = new Set(); -let curRouteSelections = {}; -const routes = ["BB", "CN", "CS", "CSX", "DD", "MX", "NE", "NW", "NX", "OS", "NES", "WS", "WX"]; -let cachedStopLocations: { [stopId: string]: { name: string, lat: number, lon: number } } = { - -}; - -const message = { id: "gradamatation", title: "Congrats Grads 🥳", message: "Congrats to everyone who is gradamatating! Enjoy some grad hats on the buses, and don't forget to celebrate!", buildVersion: '99' } - -let cachedGraph: { - trips: Trip[]; - transfers: TransfersByOrigin; - interchange: Interchange; -} - -let stopIdToName: Record = {}; -let tatripidToRt: Record = {}; - -const sortStopTimesByRouteSequence = (stopTimes: StopTime[]): StopTime[] => { - if (stopTimes.length <= 1) return stopTimes; - - // Sort by arrival time - return stopTimes.sort((a, b) => a.arrivalTime - b.arrivalTime); -}; - -const rebuildGraph = async () => { - if (process.env.DEV_CACHE === 'true') { - if (cachedGraph && cachedGraph.trips && cachedGraph.trips.length > 0) return; - try { - const filePath = path.resolve(process.cwd(), 'saved_graph.json'); - if (fs.existsSync(filePath)) { - const data = JSON.parse(fs.readFileSync(filePath, 'utf8')); - cachedGraph = data.graph; - cachedStopLocations = data.stopLocations; - stopIdToName = data.stopNames; - cachedPredsByVid = data.predsByVid || {}; - cachedPredsByStopId = data.predsByStopId || {}; - console.log('Loaded graph and state from saved_graph.json'); - } else { - console.warn('DEV_CACHE set but saved_graph.json not found'); - } - } catch (err) { - console.error('Error loading cached graph:', err); - } - return; - } - try { - const predictions = await getAllBusPredictions(); - if (!predictions || predictions.length === 0) { - return; - } - - // Build stopIdToName and tatripidToRt maps - stopIdToName = {}; - tatripidToRt = {}; - predictions.forEach((trip: any) => { - if (trip.tatripid && trip.stops && trip.stops.length > 0) { - // Find first stop with rt - const firstStopWithRt = trip.stops.find((stop: any) => stop.rt); - if (firstStopWithRt && firstStopWithRt.rt) { - tatripidToRt[trip.tatripid] = firstStopWithRt.rt; - } - } - trip.stops.forEach((stop: any) => { - if (stop.stpid && stop.stpnm) { - stopIdToName[stop.stpid] = stop.stpnm; - } - }); - }); - - const now = new Date(); - const currentTime = now.getUTCHours() * 3600 + now.getUTCMinutes() * 60 + now.getUTCSeconds(); - - const transfers = cachedGraph?.transfers || {}; - const interchange = cachedGraph?.interchange || {}; - - const allStops = new Set(); - predictions.forEach((trip: any) => { - trip.stops.forEach((stop: any) => { - allStops.add(stop.stpid); - }); - }); - - allStops.forEach(stopId => { - if (!transfers[stopId]) { - transfers[stopId] = []; - } - if (!interchange[stopId]) { - interchange[stopId] = 30; // 30 seconds interchange time - } - }); - - const stopPredictions: Record = {}; - predictions.forEach((trip: any) => { - trip.stops.forEach((stop: any) => { - if (!stopPredictions[stop.stpid]) { - stopPredictions[stop.stpid] = []; - } - stopPredictions[stop.stpid].push({ - stpid: stop.stpid, - prdctdn: stop.prdctdn, - tatripid: trip.tatripid - }); - }); - }); - - const trips: Trip[] = []; - interface TripPrediction { - vid: string; - stops: { - stpid: string; - prdctdn: string; - rt: string; - }[]; - } - - const tripPredictions: Record = {}; - - predictions.forEach((trip: any) => { - if (!tripPredictions[trip.tatripid]) { - tripPredictions[trip.tatripid] = { - vid: trip.vid, - stops: [] - }; - } - trip.stops.forEach((stop: any) => { - tripPredictions[trip.tatripid].stops.push({ - stpid: stop.stpid, - prdctdn: stop.prdctdn, - rt: stop.rt - }); - }); - }); - - Object.entries(tripPredictions).forEach(([tripId, preds]) => { - // Create stop times with prediction times - const stopTimes: StopTime[] = preds.stops.map(pred => ({ - stop: pred.stpid, - arrivalTime: currentTime + (parseInt(pred.prdctdn) * 60), - departureTime: currentTime + (parseInt(pred.prdctdn) * 60), - pickUp: true, - dropOff: true, - rt: pred.rt - })); - - // Sort stop times by their sequence in the route - const sortedStopTimes = sortStopTimesByRouteSequence(stopTimes); - - trips.push({ - tripId, - vid: preds.vid, - stopTimes: sortedStopTimes - }); - }); - - - cachedGraph = { - trips, - transfers, - interchange - }; - - // Add virtual stops and their interchange - const originStopId = 'VIRTUAL_ORIGIN'; - const destStopId = 'VIRTUAL_DESTINATION'; - cachedGraph.transfers[originStopId] = []; - cachedGraph.transfers[destStopId] = []; - cachedGraph.interchange[originStopId] = 30; - cachedGraph.interchange[destStopId] = 30; - const virtualOriginTrip = { - tripId: 'VIRTUAL_ORIGIN_TRIP', - vid: null, - stopTimes: [{ - stop: originStopId, - arrivalTime: 0, - departureTime: 0, - pickUp: true, - dropOff: true - }] - }; - const virtualDestTrip = { - tripId: 'VIRTUAL_DESTINATION_TRIP', - vid: null, - stopTimes: [{ - stop: destStopId, - arrivalTime: 0, - departureTime: 0, - pickUp: true, - dropOff: true - }] - }; - cachedGraph.trips.push(virtualOriginTrip); - cachedGraph.trips.push(virtualDestTrip); - - } catch (error) { - console.error('Error rebuilding graph:', error); - } -}; - -const getAllBusPredictions = async () => { - try { - // Get all unique stop IDs from cached routes - const allStopIds = new Set(); - Object.values(cachedRoutes).forEach((routePatterns: any) => { - if (Array.isArray(routePatterns)) { - routePatterns.forEach((pattern: any) => { - if (pattern.pt && Array.isArray(pattern.pt)) { - pattern.pt.forEach((point: any) => { - if (point.stpid) { - allStopIds.add(point.stpid); - } - }); - } - }); - } - }); - - const stopIdsArray = Array.from(allStopIds); - const chunks = []; - - if (process.env.DEV_CACHE === 'true') { - return []; - } - - for (let i = 0; i < stopIdsArray.length; i += 10) { - chunks.push(stopIdsArray.slice(i, i + 10)); - } - - let formattedPredictions = []; - - - cachedPredsByVid = {}; - cachedPredsByStopId = {}; - - if (process.env.DEV === 'true') { - // In DEV mode, load static dummy data instead of fetching from the live API - try { - const dummyDataPath = path.resolve(process.cwd(), 'dummy_bus_data.json'); - const dummyData = fs.readFileSync(dummyDataPath, 'utf8'); - formattedPredictions = JSON.parse(dummyData); - - // Populate internal caches from the loaded dummy data - formattedPredictions.forEach((trip: any) => { - const vid = trip.vid; - trip.stops.forEach((stop: any) => { - const stpid = stop.stpid; - const prd: Prediction = { - tmstmp: new Date().toISOString(), - typ: "A", - stpnm: stop.stpnm, - stpid: stop.stpid, - vid: vid, - dstp: 0, - rt: stop.rt, - rtdd: stop.rt, - rtdir: stop.rtdir, - des: "", - prdctdn: stop.prdctdn, - tablockid: "", - tatripid: trip.tatripid, - dly: false, - prdctm: "", - zone: "" - }; - - if (!cachedPredsByStopId[stpid]) { - cachedPredsByStopId[stpid] = []; - } - cachedPredsByStopId[stpid].push(prd); - - if (vid) { - if (!cachedPredsByVid[vid]) { - cachedPredsByVid[vid] = []; - } - cachedPredsByVid[vid].push(prd); - } - }); - }); - - } catch (err) { - console.error('Error loading dummy bus data:', err); - formattedPredictions = []; - } - } else { - const predictions = await Promise.all( - chunks.map(async (chunk) => { - const stopIds = chunk.join(','); - const response = await axios.get(`https://mbus.ltp.umich.edu/bustime/api/v3/getpredictions`, { - params: { - requestType: 'getpredictions', - locale: 'en', - stpid: stopIds, - rt: routes.join(','), - tmres: 's', - rtpidatafeed: 'bustime', - key: API_KEY, - format: 'json' - } - }); - return response.data; - }) - ); - - formattedPredictions = predictions.flat().reduce((acc, predictionChunk) => { - if (predictionChunk['bustime-response'] && predictionChunk['bustime-response']['prd']) { - predictionChunk['bustime-response']['prd'].forEach((prd: any) => { - const tatripid = prd.tatripid; - const stopName = prd.stpnm; - const stopId = prd.stpid; - const rt = prd.rt; - const rtdir = prd.rtdir; - const vid = prd.vid; - let prdctdn = prd.prdctdn; - prdctdn = prdctdn === "DUE" ? "1" : prdctdn; - - let trip = acc.find((t: any) => t.tatripid === tatripid); - - if (!trip) { - if (vid) { - trip = acc.find((t: any) => t.vid === vid); - } - } - - if (!trip) { - trip = { tatripid, vid, stops: [] }; - acc.push(trip); - } else { - if (!trip.tatripid) { - trip.tatripid = tatripid; - } - if (!trip.vid && vid) { - trip.vid = vid; - } - } - - let stop = trip.stops.find((s: any) => s.stpnm === stopName && s.stpid === stopId); - if (!stop) { - stop = { stpnm: stopName, stpid: stopId, prdctdn: null, rt: null, rtdir: null }; - trip.stops.push(stop); - } - stop.rtdir = rtdir; - stop.rt = rt; - stop.prdctdn = prdctdn; - }); - } - return acc; - }, []); - - predictions.flat().forEach((predictionChunk) => { - const prds = predictionChunk['bustime-response']?.['prd']; - if (!prds) return; - - prds.forEach((prd: Prediction) => { - const { vid, stpid } = prd; - if (!cachedPredsByStopId[stpid]) { - cachedPredsByStopId[stpid] = []; - } - cachedPredsByStopId[stpid].push(prd); - - if (!vid) return; - if (!cachedPredsByVid[vid]) { - cachedPredsByVid[vid] = []; - } - cachedPredsByVid[vid].push(prd); - - }); - }); - } - - - // Cache predictions per route in routeTimingCache for extrapolation - - // Record of stop ids in order using routes - const routeInfoFilter: Record = {}; - for (const [routeName, routeList] of Object.entries(cachedRoutes as Record)) { - for (const route of routeList) { - const rtdir = route.rtdir; - const routeKey = routeName + rtdir; - if (!routeInfoFilter[routeKey]) { - routeInfoFilter[routeKey] = []; - } - for (const point of route.pt) { - if (point.typ !== "W" && point.stpid) { - routeInfoFilter[routeKey].push({ stpid: point.stpid, rtdir }); - } - } - } - } - - const stopIdToName: Record = {}; - formattedPredictions.forEach((trip: any) => { - trip.stops.forEach((stop: any) => { - if (stop.stpid && stop.stpnm) stopIdToName[stop.stpid] = stop.stpnm; - }); - }); - - // Create indices for route -> stop order - const routeStopIndexMaps = new Map>(); - for (const [routeId, stopOrder] of Object.entries(routeInfoFilter)) { - const stopIndexMap = new Map(stopOrder.map(({ stpid }, i) => [stpid, i])); - routeStopIndexMaps.set(routeId, stopIndexMap); - } - - formattedPredictions.forEach((trip: any) => { - if (trip.stops.length == 0) return; - const minPrdctdn = Math.min(...trip.stops.map((s: any) => parseInt(s.prdctdn, 10))); - const firstRoute = trip.stops.find((s: any) => parseInt(s.prdctdn, 10) === minPrdctdn)?.rt; - - if (!firstRoute) return; - // Sort by predicted time - trip.stops.sort((a: any, b: any) => { - const diffTime = parseInt(a.prdctdn, 10) - parseInt(b.prdctdn, 10); - if (diffTime !== 0) return diffTime; // primary sort - - // If not same route, put first route in front - if (a.rt + a.rtdir !== b.rt + b.rtdir) { - if (a.rt === firstRoute) return -1; - if (b.rt === firstRoute) return 1; - - return a.rt.localeCompare(b.rt); - } - // If same route, sort by stop order - const aMap = routeStopIndexMaps.get(a.rt + a.rtdir); - const bMap = routeStopIndexMaps.get(b.rt + b.rtdir); - - const aIdx = aMap?.get(a.stpid) ?? Number.MAX_SAFE_INTEGER; - const bIdx = bMap?.get(b.stpid) ?? Number.MAX_SAFE_INTEGER; - return aIdx - bIdx; - }); - // Create edges based on sorted order - for (let i = 0; i < trip.stops.length - 1; i++) { - const from = trip.stops[i]; - const to = trip.stops[i + 1]; - const diff = parseInt(to.prdctdn, 10) - parseInt(from.prdctdn, 10); - const rt = from.rt; - - const stopIndexMap = routeStopIndexMaps.get(from.rt + from.rtdir); - if (!stopIndexMap) continue; - - const fromIdx = stopIndexMap.get(from.stpid); - const toIdx = stopIndexMap.get(to.stpid); - // Ensure valid follow up stop by idx or end of idx - const isValidFollowUp = ( - fromIdx !== undefined && - toIdx !== undefined && - (toIdx === fromIdx + 1 || fromIdx === stopIndexMap.size - 1) - ); - if (!isValidFollowUp) continue; - - if (!routeTimingCache[rt]) routeTimingCache[rt] = {}; - const fromKey = from.stpid + (from.rtdir || ""); - if (!routeTimingCache[rt][fromKey]) routeTimingCache[rt][fromKey] = {}; - routeTimingCache[rt][fromKey][to.stpid] = { - diff: diff, - rtdir: to.rtdir, - rtNext: to.rt - }; - } - }); - - // Extrapolate future stops based on routeTimingCache - formattedPredictions.forEach((trip: any) => { - let stopsAdded = 0; - while (stopsAdded < 20 && trip.stops.length > 0) { - const lastStop = trip.stops[trip.stops.length - 1]; - const rt = lastStop.rt; - if (!rt) break; - - const fromKey = lastStop.stpid + (lastStop.rtdir || ""); - const nextStops = routeTimingCache[rt]?.[fromKey]; - if (!nextStops) break; - - const nextEntries = Object.entries(nextStops); - if (nextEntries.length === 0) break; - - const [nextStopId, { diff, rtdir, rtNext }] = nextEntries[0]; - const nextPrdctdn = (parseInt(lastStop.prdctdn, 10) + diff).toString(); - - trip.stops.push({ - stpnm: stopIdToName[nextStopId] || nextStopId, - stpid: nextStopId, - prdctdn: nextPrdctdn, - rt: rtNext, - rtdir: rtdir - }); - stopsAdded++; - } - }); - - return formattedPredictions; - } catch (err: unknown) { - const message = err instanceof Error ? err.message : String(err); - console.error("Error in getAllBusPredictions:", message); - return []; - } -}; - -const client = axios.create({ - baseURL: 'https://mbus.ltp.umich.edu/bustime/api/v3/', - params: { - key: API_KEY, - format: 'json' - } -}); - -const getBuses = async () => { - const getChunk = async (routesChunk: string[]) => { - try { - const res = await client.get('/getvehicles', { - params: { requestType: 'getvehicles', rt: routesChunk.join(',') }, - }); - - if ( - 'bustime-response' in res.data && - 'vehicle' in res.data['bustime-response'] - ) { - return res.data['bustime-response']['vehicle']; - } - - return []; - } catch (error) { - console.warn('getChunk failed for routes', routesChunk, error instanceof Error ? error.message : error); - return []; - } - }; - - const chunks = [] - for (let i = 0; i < routes.length; i += 10) { - chunks.push(routes.slice(i, i + 10)); - } - - let buses = await Promise.all(chunks.map(getChunk)); - buses = buses.flat(); - - return buses; -} - -const updateBusPositions = async () => { - curBusPositions.buses = await getBuses(); -} - -const addToCachedRoutes = async (rt: string) => { - try { - const res = await client.get('/getpatterns', { - params: { - requestType: 'getpatterns', - rtpidatafeed: 'bustime', - rt: rt - } - }); - - - if (res.data['bustime-response'] && res.data['bustime-response']['ptr']) { - cachedRoutes[rt] = res.data['bustime-response']['ptr']; - } - } catch (e) { - console.log(`Error while getting routes: ${e}`); - } -} - -const getSelectableRoutes = () => { - if (process.env.DEV_CACHE === 'true') return; - - axios.get(`https://mbus.ltp.umich.edu/bustime/api/v3/getroutes?requestType=getroutes&locale=en&key=${API_KEY}&format=json`).then(async res => { - curRouteSelections = res.data; - validRoutes.clear(); - try { - const promises: Promise[] = []; - res.data['bustime-response']['routes'].forEach((e: Route) => { - validRoutes.add(e['rt']); - promises.push(addToCachedRoutes(e['rt'])); - }); - await Promise.all(promises); - } catch (e) { - if (res.data['bustime-response'].error !== undefined) { - console.log(res.data['bustime-response'].error); - } - console.log(`Failed to parse valid routes: ${e}`); - } - }) - .catch((err) => console.log(`Error while getting selectable routes: ${err}`)) - .finally(async () => { - // Update transfers - try { - if (!cachedGraph) { - cachedGraph = { - trips: [], - transfers: {}, - interchange: {} - }; - } - // Rebuild stop locations cache from cached routes - cachedStopLocations = {}; - console.log("Caching Transfers..") - Object.values(cachedRoutes).forEach((routePatterns: any) => { - if (Array.isArray(routePatterns)) { - routePatterns.forEach((pattern: any) => { - if (pattern.pt && Array.isArray(pattern.pt)) { - pattern.pt.forEach((point: any) => { - if (point.stpid && point.lat && point.lon) { - cachedStopLocations[point.stpid] = { - name: point.stpnm, - lat: parseFloat(point.lat), - lon: parseFloat(point.lon) - }; - } - }); - } - }); - } - }); - - console.log(`Number of stop locations: ${Object.keys(cachedStopLocations).length}`); - walking.buildStopNodeMap(cachedStopLocations); - - const routeStops = new Set(); - Object.values(cachedRoutes).forEach((routePatterns: any) => { - if (Array.isArray(routePatterns)) { - routePatterns.forEach((pattern: any) => { - if (pattern.pt && Array.isArray(pattern.pt)) { - pattern.pt.forEach((point: any) => { - if (point.stpid) { - routeStops.add(point.stpid); - } - }); - } - }); - } - }); - - routeStops.forEach(stopId => { - cachedGraph.transfers[stopId] = []; - }); - - routeStops.forEach(stopId => { - if (!cachedGraph.interchange[stopId]) { - cachedGraph.interchange[stopId] = 30; // 30 seconds interchange time - } - }); - - // Create transfers between all stops - await walking.ensureCacheForStops(routeStops, cachedStopLocations); - - routeStops.forEach(stopId => { - routeStops.forEach(otherStopId => { - if (stopId !== otherStopId) { - - const cachedData = walking.getCachedWalk(stopId, otherStopId); - - if (cachedData) { - cachedGraph.transfers[stopId].push({ - origin: stopId, - destination: otherStopId, - duration: cachedData.duration, - startTime: 0, - endTime: Number.MAX_SAFE_INTEGER - }); - } else { - console.warn(`Unexpected missing walk data: ${stopId} -> ${otherStopId}`); - } - } - }); - }); - - const totalTransfers = Object.values(cachedGraph.transfers).reduce((total, t) => total + t.length, 0); - console.log(`Total transfers in cachedGraph: ${totalTransfers}`); - - } catch (error) { - console.error('Error updating transfers:', error); - } - }); -} - -export { - curBusPositions, - cachedRoutes, - cachedPredsByVid, - cachedPredsByStopId, - validRoutes, - curRouteSelections, - routes, - cachedStopLocations, - routeTimingCache, - cachedGraph, - stopIdToName, - tatripidToRt, - getAllBusPredictions, - updateBusPositions, - getSelectableRoutes, - rebuildGraph -}; diff --git a/src/legacy/reminderService-reminders.ts b/src/legacy/reminderService-reminders.ts deleted file mode 100644 index b997fcd..0000000 --- a/src/legacy/reminderService-reminders.ts +++ /dev/null @@ -1,240 +0,0 @@ -import dotenv from "dotenv"; -import { cachedPredsByStopId, stopIdToName } from "./busService"; -import { getMessaging } from "firebase-admin/messaging"; -import { applicationDefault, initializeApp } from "firebase-admin/app"; - -dotenv.config() - -// Initialize Firebase -initializeApp({ credential: applicationDefault() }); - -type Event = { - stpid: string, - rtid: string, - readonly __brand: "event" -} - -type RegistrationToken = string & { readonly __brand: "registration_token" } -type EventKey = string & { readonly __brand: "event_key" } - -function encodeEvent(e: Event): EventKey { - return `${e.stpid}|${e.rtid}` as EventKey; -} - -function decodeEvent(e: EventKey): Event { - const split = e.split('|'); - return { stpid: split[0], rtid: split[1] } as Event; -} - -// Subscriptions go through a pipeline, starting in the waiting for reminder -// stage. After the bus in x minutes notification is set they move to the -// waiting for bus stage, where they stay until the bus is arriving notification -// is sent. Being in the second stage is repsented by having a threshold of null. -class ReminderSubscriptions { - // a thresh of null means being in the second stage - subscriptions: Array<{ event: Event, thresh: number | null, token: RegistrationToken }> - - constructor() { - this.subscriptions = []; - } - - // addition is done to the start of the pipeline - add(event: Event, thresh: number, token: RegistrationToken) { - console.log("Adding a reminder subscription"); - this.subscriptions.push({ event, thresh, token }); - } - - // removes all subscriptions involving both `event` and `token` - remove(event: Event, token: RegistrationToken) { - console.log("Removing a reminder subscription"); - this.subscriptions = this.subscriptions - .filter((s) => s.event.rtid !== event.rtid || s.event.stpid !== event.stpid || s.token !== token); - } - - // updates the status of all registrations, returning an object representing the - // notifications that should be sent - process(arrivalTimes: Map): { - reminder: Map>, - atTheStop: Map>, - disappeared: Map>, - delayed: Map> - } { - const addHelper = (map: Map>, key: EventKey, token: RegistrationToken) => { - let tokens = map.get(key); - if (tokens === undefined) { - map.set(key, new Set()); - tokens = map.get(key)!; - } - tokens.add(token); - }; - const notifications = { - reminder: new Map(), atTheStop: new Map(), disappeared: new Map(), delayed: new Map() - }; - const newSubscriptions: typeof this.subscriptions = []; - for (const subscription of this.subscriptions) { - const key = encodeEvent(subscription.event); - const arrivalTime = arrivalTimes.get(key); - if (arrivalTime === undefined || arrivalTime.curr === null) { - addHelper(notifications.disappeared, key, subscription.token); - } else if (subscription.thresh === null && arrivalTime.curr === 0) { - addHelper(notifications.atTheStop, key, subscription.token); - } else if (arrivalTime.prev !== null && arrivalTime.curr > arrivalTime.prev) { - addHelper(notifications.delayed, key, subscription.token); - newSubscriptions.push(subscription); // keep subscription if delayed - } else if (subscription.thresh !== null && arrivalTime.prev !== null - && arrivalTime.curr <= subscription.thresh && arrivalTime.curr < arrivalTime.prev) { - addHelper(notifications.reminder, key, subscription.token); - // replace with next in pipeline, a subscription to bus at stop - newSubscriptions.push({ event: subscription.event, thresh: null, token: subscription.token }); - } else { - newSubscriptions.push(subscription); // keep subscription by default - } - } - this.subscriptions = newSubscriptions; - console.log(`Process completed with ${notifications.reminder.size}, ${notifications.atTheStop.size}, ${notifications.delayed.size}, ${notifications.disappeared.size}`); - return notifications; - } - - // removes all subscriptions involving `event` - removeAllFor(event: Event) { - this.subscriptions = this.subscriptions - .filter((s) => s.event.rtid !== event.rtid || s.event.stpid !== event.stpid); - } - - swapToken(from: RegistrationToken, to: RegistrationToken) { - this.subscriptions = this.subscriptions.map((s) => { - if (s.token === from) { - return { ...s, token: to }; - } else { - return s; - } - }); - } - - activeRemindersFor(id: RegistrationToken): Array<{ stpid: string, rtid: string, thresh: number | null }> { - return this.subscriptions - .filter((s) => s.token === id) - .map((s) => { - return {stpid: s.event.stpid, rtid: s.event.rtid, thresh: s.thresh }; - }); - } - - describe() { - console.log(`There are ${this.subscriptions.length} reminder subscriptions`); - } -} - -const reminderSubscriptions = new ReminderSubscriptions(); -const arrivalTimes: Map = new Map(); - -function processReminders() { - // move current arrival times to prev - for (const [_k, v] of arrivalTimes) { - v.prev = v.curr; - v.curr = null; - } - - const stpids = Object.keys(cachedPredsByStopId); - // determine arrival time updates for each stop - for (const stpid of stpids) { - for (const vehicle of cachedPredsByStopId[stpid]) { - const rtid = vehicle.rt; - const prediction = vehicle.prdctdn === 'DUE' ? 0 : parseInt(vehicle.prdctdn); - const key = encodeEvent({ stpid: stpid, rtid: rtid } as Event); - let time = arrivalTimes.get(key); - if (time === undefined) { - arrivalTimes.set(key, { curr: null, prev: null }); - time = arrivalTimes.get(key)!; - } - if (time.curr === null || prediction < time.curr) - time.curr = prediction; - } - } - - // send push notifications as needed - const notifications = reminderSubscriptions.process(arrivalTimes); - for (const [eventKey, tokens] of notifications.reminder) { - const event = decodeEvent(eventKey); - const stopName = stopIdToName[event.stpid] ?? event.stpid; - sendToAll( - { - notification: { - title: 'Bus Arrival Reminder', - body: `${event.rtid} is ${arrivalTimes.get(eventKey)?.curr} minute(s) away from ${stopName}` - } - }, - tokens - ); - } - for (const [eventKey, tokens] of notifications.atTheStop) { - const event = decodeEvent(eventKey); - const stopName = stopIdToName[event.stpid] ?? event.stpid; - sendToAll( - { - notification: { title: 'Bus Arriving', body: `${event.rtid} is almost at ${stopName}` }, - }, - tokens - ); - } - for (const [eventKey, tokens] of notifications.delayed) { - const event = decodeEvent(eventKey); - const stopName = stopIdToName[event.stpid] ?? event.stpid; - const arrivalTime = arrivalTimes.get(eventKey); - const delay = arrivalTime?.curr !== null && arrivalTime?.prev ? `${arrivalTime.curr - arrivalTime.prev}` : `some`; - sendToAll( - { - notification: { - title: `Bus Delayed`, - body: `The ${event.rtid} bus en route to ${stopName} got delayed by ${delay} minute(s).` - } - }, - tokens - ); - } - for (const [eventKey, tokens] of notifications.disappeared) { - const event = decodeEvent(eventKey); - const stopName = stopIdToName[event.stpid] ?? event.stpid; - sendToAll( - { - notification: { - title: `Bus Disappeared`, - body: `The ${event.rtid} bus en route to ${stopName} disappeared! Set a new reminder if desired.` - } - }, - tokens - ); - } - -} - -function sendToAll(msg: any, tokens: Set) { - console.log(`sending a message to ${tokens.size} devices`); - const group = new Set(); - for (const token of tokens) { - if (group.size === 500) { - sendToAllHelper(msg, group); - group.clear(); - } - group.add(token); - } - sendToAllHelper(msg, group); -} - -// REQUIRES: tokens.size <= 500 -function sendToAllHelper(msg: any, tokens: Set) { - const payload = { tokens: Array.from(tokens), ...msg }; - getMessaging().sendEachForMulticast(payload) - .then((res) => { - if (res.failureCount > 0) { - console.log(`${res.failureCount} messages failed to send!`); - res.responses.forEach((res, idx) => { - if (!res.success) { - console.log(`message send ${idx} failed`); - console.log(res.error); - } - }) - } - }); -} - -export { processReminders, reminderSubscriptions, Event, RegistrationToken }; diff --git a/src/legacy/v3-reminders.ts b/src/legacy/v3-reminders.ts deleted file mode 100644 index b01d078..0000000 --- a/src/legacy/v3-reminders.ts +++ /dev/null @@ -1,660 +0,0 @@ -import express from "express"; -import dotenv from "dotenv"; -import { - Transfer, - StopID, - TimetableLeg -} from "./raptor/types"; -import { RaptorAlgorithm } from "./raptor/RaptorAlgorithm"; -import { RaptorAlgorithmFactory } from "./raptor/RaptorAlgorithmFactory"; -import { DepartAfterQuery } from "./query/DepartAfterQuery"; -import { JourneyFactory } from "./results/JourneyFactory"; -import { earliestArrival, leastChanges, leastWalking } from "./results/filter/MultipleCriteriaFilter"; - -import * as metadata from "./assets/route-data.json"; -import * as valid_assets from "./assets/valid_assets.json"; -import * as path from "node:path"; -import { MaxPriorityQueue } from '@datastructures-js/priority-queue'; - - -import { - curBusPositions, - cachedPredsByStopId, - cachedRoutes, - cachedPredsByVid, - cachedStopLocations, - curRouteSelections, - stopIdToName, - tatripidToRt, - getAllBusPredictions, - routeTimingCache, - cachedGraph, - updateBusPositions, - getSelectableRoutes, - rebuildGraph -} from './busService'; -import axios from "axios"; - -// Simple Bus Color System -interface BusRoute { - routeId: string; - color: string; - image: string; -} - -class BusColorManager { - private readonly routes: BusRoute[] = [ - { routeId: "BB", color: "#2F773F", image: "bus_BB.png" }, - { routeId: "CN", color: "#643076", image: "bus_CN.png" }, - { routeId: "CS", color: "#3559B8", image: "bus_CS.png" }, - { routeId: "CSX", color: "#1C2256", image: "bus_CSX.png" }, - { routeId: "DD", color: "#A9C534", image: "bus_DD.png" }, - { routeId: "MX", color: "#5EC7DE", image: "bus_MX.png" }, - { routeId: "NE", color: "#C55188", image: "bus_NE.png" }, - { routeId: "NW", color: "#AE3636", image: "bus_NW.png" }, - { routeId: "NX", color: "#DA4343", image: "bus_NX.png" }, - { routeId: "OS", color: "#E8A43C", image: "bus_OS.png" }, - { routeId: "NES", color: "#C55188", image: "bus_NES.png" }, - { routeId: "WS", color: "#BA5231", image: "bus_WS.png" }, - { routeId: "WX", color: "#E8663E", image: "bus_WX.png" } - ]; - - public getRouteColor(routeId: string): string | null { - const route = this.routes.find(r => r.routeId === routeId); - return route ? route.color : null; - } - - public getRouteImage(routeId: string): string | null { - const route = this.routes.find(r => r.routeId === routeId); - return route ? route.image : null; - } - - public getAllRoutes(): BusRoute[] { - return [...this.routes]; - } - - public getRouteInfo(routeId: string): BusRoute | null { - return this.routes.find(r => r.routeId === routeId) || null; - } -} - -// Initialize bus color manager -const busColorManager = new BusColorManager(); - -dotenv.config(); -const router = express.Router(); -const routeImages: { [k: string]: string } = metadata.routeImages; - -setInterval(updateBusPositions, 7500); -setInterval(getSelectableRoutes, 60000); -setInterval(rebuildGraph, 10 * 1000); -setInterval(processReminders, 10 * 1000); -setInterval(() => reminderSubscriptions.describe(), 60000); -getSelectableRoutes(); -rebuildGraph(); - -import * as process from "node:process"; -import { getMessaging } from "firebase-admin/messaging"; -import { processReminders, reminderSubscriptions, Event, RegistrationToken } from "./reminderService"; - - -dotenv.config(); - -const API_KEY = process.env.MBUS_API_KEY; -router.get('/getBusPredictions1/:busId', (req, res) => { - axios.get(`https://mbus.ltp.umich.edu/bustime/api/v3/getpredictions?requestType=getpredictions&locale=en&vid=${req.params.busId}&top=4&tmres=s&rtpidatafeed=bustime&key=${API_KEY}&format=json&xtime=1626028950462`).then(apiRes => { - res.send(apiRes.data); - }).catch(err => { - console.log(err); - res.sendStatus(500); - - }); -}); - -router.get('/getBusPositions', (req, res) => { - res.send(curBusPositions); -}); - -router.get('/getVehiclePositions', (req, res) => { - res.send(curBusPositions); -}); - -router.get('/getSelectableRoutes', (req, res) => { - res.send(curRouteSelections); -}); - -router.get('/getAllRoutes', (req, res) => { - res.send({ routes: cachedRoutes }); -}); - -router.get('/getrouteCache', (req, res) => { - res.send({ routes: routeTimingCache }); -}); - -router.get('/getVehicleImage/:route', (req, res) => { - const { route } = req.params; - - const dirname = import.meta.dirname; - const assetPath = path.join(dirname, 'assets'); - const imagePath = path.join(assetPath, 'main2025'); - - if (!route || !(route in routeImages)) { - res.sendFile(path.join(assetPath, 'bus_CN.png')); - return res.sendStatus(400); - } - - res.sendFile(path.join(imagePath, routeImages[route])); -}); - -router.get('/getRouteInfoVersion', (req, res) => { - res.send(JSON.stringify({ version: metadata.metadata.version })); -}); - -router.get('/getRouteInformation', (req, res) => { - const infoToSend = { - routeIdToName: metadata.routeIdToName, - routeImages: metadata.routeImages, - metadata: metadata.metadata, - routeColors: busColorManager.getAllRoutes().map(route => ({ - routeId: route.routeId, - color: route.color, - image: route.image - })) - } - res.send(infoToSend); -}); - -router.get('/getStartupInfo', (req, res) => { - res.json({ - // updating this will disable older versions of the app - min_supported_version: "1.0.0", - why_update_message: { - title: "New Update Available", - subtitle: "Please update to the latest version for the best experience." - }, - // adding data here will show a persistant message on launch - persistant_message: { - title: "Update on missing bus predictions", - subtitle: "2/9 9:03 PM: The university has confirmed to us that they're actively working on fixing the issue with missing bus predictions. Thank you for your patience." - }, - // adding data here will show a one-time message on launch (not yet implemented) - one_time_message: { - title: "", - subtitle: "" - }, - // updating this will make bus images redownload on frontend - bus_image_version: "1", - }); -});; - -router.get('/getBusPredictions/:busId', (req, res) => { - const busId = req.params.busId; - const preds = cachedPredsByVid[busId]; - - if (!preds) { - return res.json({ - "bustime-response": { "prd": [] } - }); - } - res.json({ - "bustime-response": { "prd": preds } - }); -}); - -router.get('/getStopPredictions/:stopId', (req, res) => { - const stopId = req.params.stopId; - const preds = cachedPredsByStopId[stopId]; - - if (!preds) { - return res.json({ - "bustime-response": { "prd": [] } - }); - } - - res.json({ - "bustime-response": { "prd": preds } - }); -}); - -router.get('/getAllPredictions', async (req, res) => { - try { - const predictions = await getAllBusPredictions(); - res.send(predictions); - } catch (err) { - console.log(err); - res.sendStatus(500); - } -}); - -router.get('/getAllStops', (req, res) => { - const stopsList = Object.entries(cachedStopLocations).map(([stpid, stopInfo]) => ({ - stpid, - ...stopInfo, - })); - res.json(Object.values(stopsList)); -}); - -router.get('/getBuildingLocations', (req, res) => { - res.sendFile(path.join(import.meta.dirname, 'assets', 'building-data.json')); -}); - -router.get('/get-startup-messages', (req, res) => { - res.send(JSON.stringify(message)); -}); - -// Simple bus color endpoints -router.get('/getRouteColors', (req, res) => { - const routes = busColorManager.getAllRoutes(); - res.json({ - routes: routes.map(route => ({ - routeId: route.routeId, - color: route.color, - image: route.image - })) - }); -}); - -router.get('/getRouteColor/:routeId', (req, res) => { - const { routeId } = req.params; - const routeInfo = busColorManager.getRouteInfo(routeId); - - if (!routeInfo) { - return res.status(404).json({ error: `Route '${routeId}' not found` }); - } - - res.json({ - routeId: routeInfo.routeId, - color: routeInfo.color, - image: routeInfo.image - }); -}); - -// Simple endpoint for frontend, gets everything needed for UI -router.get('/getFrontendData', (req, res) => { - try { - const routes = busColorManager.getAllRoutes(); - - const response = { - routes: routes.map(route => ({ - routeId: route.routeId, - name: (metadata.routeIdToName as any)[route.routeId] || route.routeId, - image: route.image, - color: route.color, - imageUrl: `/mbus/api/v3/getVehicleImage/${route.routeId}` - })), - metadata: { - ...metadata.metadata, - lastUpdated: new Date().toISOString() - } - }; - - res.json(response); - } catch (error) { - res.status(500).json({ error: 'Failed to get frontend data' }); - } -}); - - -router.get('/nearest-stops', (req, res) => { - try { - const { lat, lon, k = '2' } = req.query; - - const originLat = parseFloat(lat as string); - const originLon = parseFloat(lon as string); - const numStops = parseInt(k as string); - - if (isNaN(originLat) || isNaN(originLon)) { - return res.status(400).json({ error: 'Invalid or missing lat/lon' }); - } - if (isNaN(numStops) || numStops <= 0) { - return res.status(400).json({ error: 'Parameter k must be a positive integer' }); - } - - const heap = new MaxPriorityQueue<{ stpid: string; name: string; lat: number; lon: number; distance: number }>({ - compare: (a, b) => a.distance - b.distance - }); - - for (const [stpid, stop] of Object.entries(cachedStopLocations)) { - const latDiff = (stop.lat - originLat) * 111320; - const lonDiff = (stop.lon - originLon) * 111320 * Math.cos(originLat * Math.PI / 180); - const distance = Math.sqrt(latDiff ** 2 + lonDiff ** 2); - - const stopWithDist = { - stpid, - name: stop.name, - lat: stop.lat, - lon: stop.lon, - distance - }; - - if (heap.size() < numStops) { - heap.enqueue(stopWithDist); - } else if (distance < heap.front().distance) { - heap.dequeue(); - heap.enqueue(stopWithDist); - } - } - - const nearestStops = heap.toArray().sort((a, b) => a.distance - b.distance); - res.json({ nearestStops }); - } catch (error) { - console.error('Error in /nearest-stops:', error); - res.status(500).json({ error: 'Internal server error' }); - } -}); - -function optimizeWalkingFastest(journey: any, cachedGraph: any): any { - if (!journey) return journey; - - const optimizedLegs: any[] = []; - const WALKING_SPEED_KMH = 4; - const WALKING_SPEED_MS = WALKING_SPEED_KMH * 1000 / 3600; - - function distanceMeters(lat1: number, lon1: number, lat2: number, lon2: number): number { - const dx = (lat2 - lat1) * 111320; - const dy = (lon2 - lon1) * 111320 * Math.cos(lat1 * Math.PI / 180); - return Math.sqrt(dx * dx + dy * dy); - } - - for (let i = 0; i < journey.legs.length; i++) { - const leg = journey.legs[i]; - - // Look for a transfer followed by a bus trip - if (leg.trip && i > 0 && "duration" in journey.legs[i - 1]) { - const transfer = journey.legs[i - 1] as Transfer; - const tripLeg = leg as TimetableLeg; - const trip = tripLeg.trip; - - const originalBoardStop = tripLeg.stopTimes[0].stop; - const boardIdx = trip.stopTimes.findIndex(st => st.stop === originalBoardStop); - const walkStartTime = transfer.startTime; - - let bestStop = originalBoardStop; - let bestIdx = boardIdx; - let bestDistance = Number.MAX_SAFE_INTEGER; - - const originLoc = cachedStopLocations[transfer.origin]; - if (!originLoc) { - optimizedLegs.push(leg); - continue; - } - - for (let j = boardIdx; j < trip.stopTimes.length; j++) { - const candidate = trip.stopTimes[j]; - const stopLoc = cachedStopLocations[candidate.stop]; - if (!stopLoc) continue; - - const dist = distanceMeters(originLoc.lat, originLoc.lon, stopLoc.lat, stopLoc.lon); - const walkArrival = walkStartTime + dist / WALKING_SPEED_MS; - const busArrival = candidate.arrivalTime - (cachedGraph.interchange[candidate.stop] ?? 0); - - if (walkArrival <= busArrival && dist < bestDistance) { - bestStop = candidate.stop; - bestIdx = j; - bestDistance = dist; - } - } - - if (bestStop !== originalBoardStop) { - console.log(`Optimized walking to ${bestStop} instead of ${originalBoardStop}, saving ${Math.round(bestDistance)} meters`); - // Update transfer - transfer.destination = bestStop; - transfer.duration = Math.round(bestDistance / WALKING_SPEED_MS); - - // Trim trip leg to start from bestStop - tripLeg.stopTimes = trip.stopTimes.slice(bestIdx); - - // Refresh trip leg duration - if (tripLeg.stopTimes.length > 1) { - const firstStop = tripLeg.stopTimes[0]; - const lastStop = tripLeg.stopTimes[tripLeg.stopTimes.length - 1]; - (tripLeg as any).duration = lastStop.arrivalTime - firstStop.departureTime; - } - } - } - - optimizedLegs.push(leg); - } - - return { ...journey, legs: optimizedLegs }; -} - -router.get('/plan-journey', async (req, res) => { - try { - const originStopId = 'VIRTUAL_ORIGIN'; - const destStopId = 'VIRTUAL_DESTINATION'; - - const { originLat, originLon, destLat, destLon, walkingPenalty: walkingPenaltyParam } = req.query; - if (!originLat || !originLon || !destLat || !destLon) { - return res.status(400).json({ error: 'Origin and destination coordinates are required' }); - } - - const now = new Date(); - const currentTime = now.getUTCHours() * 3600 + now.getUTCMinutes() * 60 + now.getUTCSeconds(); - - if (!cachedGraph || !cachedGraph.trips || cachedGraph.trips.length === 0) { - await rebuildGraph(); // try to build - if (!cachedGraph) { - return res.status(404).json({ error: 'No routes available at this time' }); - } - } - - // Clear all transfers from the virtual origin - cachedGraph.transfers[originStopId] = []; - cachedGraph.transfers[destStopId] = []; - // Clear all transfers to virtual destination - Object.keys(cachedGraph.transfers).forEach(stopId => { - cachedGraph.transfers[stopId] = cachedGraph.transfers[stopId].filter( - t => t.destination !== destStopId - ); - }); - - // Update the times for the virtual trips - const vOriginTrip = cachedGraph.trips.find(t => t.tripId === 'VIRTUAL_ORIGIN_TRIP'); - if (vOriginTrip) { - vOriginTrip.stopTimes[0].arrivalTime = currentTime; - vOriginTrip.stopTimes[0].departureTime = currentTime; - } - const vDestTrip = cachedGraph.trips.find(t => t.tripId === 'VIRTUAL_DESTINATION_TRIP'); - if (vDestTrip) { - vDestTrip.stopTimes[0].arrivalTime = currentTime; - vDestTrip.stopTimes[0].departureTime = currentTime; - } - - // Calculate transfers from origin to all real stops - const originLatNum = parseFloat(originLat as string); - const originLonNum = parseFloat(originLon as string); - const destLatNum = parseFloat(destLat as string); - const destLonNum = parseFloat(destLon as string); - - const WALKING_SPEED_KMH = 4; - const WALKING_SPEED_MS = WALKING_SPEED_KMH * 1000 / 3600; - - // Add transfers from origin to all real stops - Object.keys(cachedStopLocations).forEach(stopId => { - const stopLocation = cachedStopLocations[stopId]; - if (stopLocation) { - const latDiff = (stopLocation.lat - originLatNum) * 111320; - const lonDiff = (stopLocation.lon - originLonNum) * 111320 * Math.cos(originLatNum * Math.PI / 180); - const distance = Math.sqrt(latDiff * latDiff + lonDiff * lonDiff); - - let walkingTimeSeconds = distance / WALKING_SPEED_MS; - const transferDuration = Math.round(walkingTimeSeconds); - - const transfer: Transfer = { - origin: originStopId, - destination: stopId, - duration: transferDuration, - startTime: currentTime, - endTime: Number.MAX_SAFE_INTEGER - }; - cachedGraph.transfers[originStopId].push(transfer); - } - }); - - // Add transfers from all real stops to destination - Object.keys(cachedStopLocations).forEach(stopId => { - const stopLocation = cachedStopLocations[stopId]; - if (stopLocation) { - const latDiff = (destLatNum - stopLocation.lat) * 111320; - const lonDiff = (destLonNum - stopLocation.lon) * 111320 * Math.cos(stopLocation.lat * Math.PI / 180); - const distance = Math.sqrt(latDiff * latDiff + lonDiff * lonDiff); - - let walkingTimeSeconds = distance / WALKING_SPEED_MS; - const transferDuration = Math.round(walkingTimeSeconds); - - const transfer: Transfer = { - origin: stopId, - destination: destStopId, - duration: transferDuration, - startTime: currentTime, - endTime: Number.MAX_SAFE_INTEGER - }; - cachedGraph.transfers[stopId].push(transfer); - } - }); - - // Direct transfer from VIRTUAL_ORIGIN to VIRTUAL_DESTINATION - const directLatDiff = (destLatNum - originLatNum) * 111320; - const directLonDiff = (destLonNum - originLonNum) * 111320 * Math.cos(originLatNum * Math.PI / 180); - const directDistance = Math.sqrt(directLatDiff * directLatDiff + directLonDiff * directLonDiff); - - let directWalkingTimeSeconds = directDistance / WALKING_SPEED_MS; - - const directTransferDuration = Math.round(directWalkingTimeSeconds); - //console.log(`Walking Distance: ${directTransferDuration}`); - - const directTransfer: Transfer = { - origin: originStopId, - destination: destStopId, - duration: directTransferDuration, - startTime: currentTime, - endTime: Number.MAX_SAFE_INTEGER - }; - cachedGraph.transfers[originStopId].push(directTransfer); - - RaptorAlgorithm.setDebug(false); - const raptor = RaptorAlgorithmFactory.create(cachedGraph.trips, cachedGraph.transfers, cachedGraph.interchange); - let walkingPenalty = 1; // default no penalty - if (walkingPenaltyParam !== undefined) { - const parsed = parseFloat(walkingPenaltyParam as string); - if (!isNaN(parsed) && parsed > 0) { - walkingPenalty = parsed; - } - } - raptor.setWalkingPenalty(walkingPenalty); - - const resultsFactory = new JourneyFactory(); - const journeyPlanner = new DepartAfterQuery(raptor, resultsFactory); - const journeys = journeyPlanner.plan( - originStopId as StopID, - destStopId as StopID, - currentTime - ); - - const formatJourney = (journey: any) => { - if (!journey) return null; - return { - ...journey, - legs: journey.legs.map((leg: any) => { - const formattedLeg: any = { - ...leg, - origin_id: leg.origin, - origin: leg.origin === 'VIRTUAL_ORIGIN' ? 'Start' : (leg.origin === 'VIRTUAL_DESTINATION' ? 'End' : (stopIdToName[leg.origin] || leg.origin)), - destination_id: leg.destination, - destination: leg.destination === 'VIRTUAL_ORIGIN' ? 'Start' : (leg.destination === 'VIRTUAL_DESTINATION' ? 'End' : (stopIdToName[leg.destination] || leg.destination)) - }; - if (leg.trip && leg.trip.tripId) { - // Add duration for bus legs - if (leg.stopTimes && leg.stopTimes.length > 0) { - const firstStop = leg.stopTimes[0]; - const lastStop = leg.stopTimes[leg.stopTimes.length - 1]; - formattedLeg.duration = lastStop.arrivalTime - firstStop.departureTime; - formattedLeg.rt = firstStop.rt; - formattedLeg.vid = leg.vid; - - } - } else if (typeof leg.duration === 'number') { - // Add duration for transfer legs - formattedLeg.duration = leg.duration; - } - return formattedLeg; - }) - }; - }; - - let fastest = journeys.length > 0 ? journeys.reduce((best, j) => earliestArrival(best, j) ? j : best, journeys[0]) : null; - // if (fastest) { - // fastest = optimizeWalkingFastest(fastest, cachedGraph); - // } - const leastTransfers = journeys.length > 0 ? journeys.reduce((best, j) => leastChanges(best, j) ? j : best, journeys[0]) : null; - const leastWalk = journeys.length > 0 ? journeys.reduce((best, j) => leastWalking(best, j) ? j : best, journeys[0]) : null; - const uniqueJourneys = [fastest, leastTransfers, leastWalk] - .filter((j, i, arr) => j && arr.findIndex(x => x === j) === i) - .map(formatJourney); - res.json({ journeys: uniqueJourneys.slice(0, 3) }); - } catch (error) { - console.error('Error planning journey:', error); - res.status(500).json({ error: 'Failed to plan journey' }); - } -}); - -// Notifications / Reminders - -// Expects {token: string, stpid: string, rtid: string, thresh: number} in the body -router.post('/setReminder', (req, res) => { - const token = req.body.token as RegistrationToken; - const stpid: string = req.body.stpid; - const rtid: string = req.body.rtid; - const thresh: number = req.body.thresh; - reminderSubscriptions.add({ stpid, rtid } as Event, thresh, token); - res.sendStatus(200); -}); - -// Expects {token: string, stpid: string, rtid: string} in the body -router.post('/unsetReminder', (req, res) => { - const token = req.body.token as RegistrationToken; - const stpid: string = req.body.stpid; - const rtid: string = req.body.rtid; - reminderSubscriptions.remove({ stpid, rtid } as Event, token); - res.sendStatus(200); -}); - -// Expects {oldTok: string, newTok: string} in the body -// Upon responding with 200, future calls to /setReminder, /unsetReminder, and /activeReminders -// will need the new token -router.post('/swapToken', (req, res) => { - const oldTok = req.body.oldTok as RegistrationToken; - const newTok = req.body.newTok as RegistrationToken; - reminderSubscriptions.swapToken(oldTok, newTok); - res.sendStatus(200); -}); - -// Responds with { reminders: Array<{ stpid: string, rtid: string, thresh: number | null }> } -router.get('/activeReminders/:registrationToken', (req, res) => { - const token = req.params.registrationToken as RegistrationToken; - res.send({ reminders: reminderSubscriptions.activeRemindersFor(token) }); - res.status(200); -}); - -// testing purposes -router.post('/notifyMeLater', (req, res) => { - console.log("got request"); - const registrationToken = req.body.token; - if (registrationToken === undefined) { - console.log("got request with no token"); - console.log(req.body); - res.send("registration token missing"); - res.status(400); - return; - } - setTimeout(() => { - console.log("sending push notification.."); - getMessaging() - .send({ notification: { title: "hi", body: "hello world!" }, token: registrationToken }) - .catch((e) => console.log("Failed to send message: ", e)); - }, 10000); - res.sendStatus(200); -}); - -export default router; diff --git a/src/legacy/v3.ts b/src/legacy/v3.ts deleted file mode 100644 index 8de143a..0000000 --- a/src/legacy/v3.ts +++ /dev/null @@ -1,561 +0,0 @@ - -import * as walking from '../walking/walkingMap'; -import * as metadata from "../assets/route-data.json"; -import * as path from "node:path"; -import * as fs from 'fs'; - -import express from "express"; -import dotenv from "dotenv"; -import axios from "axios"; - -import { McRaptorAlgorithm, Journey, JourneyLeg } from "../raptor/McRaptorAlgorithm"; -import { MaxPriorityQueue } from '@datastructures-js/priority-queue'; - -import { - curBusPositions, - cachedPredsByStopId, - cachedRoutes, - cachedPredsByVid, - cachedStopLocations, - curRouteSelections, - stopIdToName, - tatripidToRt, - getAllBusPredictions, - routeTimingCache, - cachedGraph, - updateBusPositions, - getSelectableRoutes, - rebuildGraph, -} from './busService'; - -// Simple Bus Color System -interface BusRoute { - routeId: string; - color: string; - image: string; -} - -class BusColorManager { - private readonly routes: BusRoute[] = [ - { routeId: "BB", color: "#2F773F", image: "bus_BB.png" }, - { routeId: "CN", color: "#643076", image: "bus_CN.png" }, - { routeId: "CS", color: "#3559B8", image: "bus_CS.png" }, - { routeId: "CSX", color: "#1C2256", image: "bus_CSX.png" }, - { routeId: "DD", color: "#A9C534", image: "bus_DD.png" }, - { routeId: "MX", color: "#5EC7DE", image: "bus_MX.png" }, - { routeId: "NE", color: "#C55188", image: "bus_NE.png" }, - { routeId: "NW", color: "#AE3636", image: "bus_NW.png" }, - { routeId: "NX", color: "#DA4343", image: "bus_NX.png" }, - { routeId: "OS", color: "#E8A43C", image: "bus_OS.png" }, - { routeId: "NES", color: "#C55188", image: "bus_NES.png" }, - { routeId: "WS", color: "#BA5231", image: "bus_WS.png" }, - { routeId: "WX", color: "#E8663E", image: "bus_WX.png" } - ]; - - public getRouteColor(routeId: string): string | null { - const route = this.routes.find(r => r.routeId === routeId); - return route ? route.color : null; - } - - public getRouteImage(routeId: string): string | null { - const route = this.routes.find(r => r.routeId === routeId); - return route ? route.image : null; - } - - public getAllRoutes(): BusRoute[] { - return [...this.routes]; - } - - public getRouteInfo(routeId: string): BusRoute | null { - return this.routes.find(r => r.routeId === routeId) || null; - } -} - - -// Initialize bus color manager -const busColorManager = new BusColorManager(); - -dotenv.config(); -const router = express.Router(); -const routeImages: { [k: string]: string } = metadata.routeImages; - -setInterval(updateBusPositions, 7500); -setInterval(getSelectableRoutes, 60000); -setInterval(rebuildGraph, 10 * 1000); -getSelectableRoutes(); -rebuildGraph(); - -import * as process from "node:process"; - -const message = { - id: "gradamatation", - title: "Congrats Grads 🥳", - message: - "Congrats to everyone who is gradamatating! Enjoy some grad hats on the buses, and don't forget to celebrate!", - buildVersion: "99", -}; - -dotenv.config(); - -const API_KEY = process.env.MBUS_API_KEY; -router.get('/getBusPredictions1/:busId', (req, res) => { - axios.get(`https://mbus.ltp.umich.edu/bustime/api/v3/getpredictions?requestType=getpredictions&locale=en&vid=${req.params.busId}&top=4&tmres=s&rtpidatafeed=bustime&key=${API_KEY}&format=json&xtime=1626028950462`).then(apiRes => { - res.send(apiRes.data); - }).catch(err => { - console.log(err); - res.sendStatus(500); - - }); -}); - -router.get('/getBusPositions', (req, res) => { - res.send(curBusPositions); -}); - -router.get('/getVehiclePositions', (req, res) => { - res.send(curBusPositions); -}); - -router.get('/getSelectableRoutes', (req, res) => { - res.send(curRouteSelections); -}); - -router.get('/getAllRoutes', (req, res) => { - res.send({ routes: cachedRoutes }); -}); - -router.get('/getrouteCache', (req, res) => { - res.send({ routes: routeTimingCache }); -}); - -router.get('/getVehicleImage/:route', (req, res) => { - const { route } = req.params; - - const dirname = import.meta.dirname; - const assetPath = path.join(dirname, 'assets'); - const imagePath = path.join(assetPath, 'main2025'); - - if (!route || !(route in routeImages)) { - res.status(400).sendFile(path.join(imagePath, 'bus_CN.png')); - return; - } - res.sendFile(path.join(imagePath, routeImages[route]), (err) => { - if (err) { - console.error(`Error sending requested image for route ${route}: ${err.message}`); - if (!res.headersSent) res.status(404).send('Image file not found on server.'); - } - }); -}); - -router.get('/getRouteInfoVersion', (req, res) => { - res.send(JSON.stringify({ version: metadata.metadata.version })); -}); - -router.get('/getRouteInformation', (req, res) => { - const infoToSend = { - routeIdToName: metadata.routeIdToName, - routeImages: metadata.routeImages, - metadata: metadata.metadata, - routeColors: busColorManager.getAllRoutes().map(route => ({ - routeId: route.routeId, - color: route.color, - image: route.image - })) - } - res.send(infoToSend); -}); - -router.get('/getStartupInfo', (req, res) => { - res.json({ - // updating this will disable older versions of the app - min_supported_version: "1.0.0", - why_update_message: { - title: "New Update Available", - subtitle: "Please update to the latest version for the best experience." - }, - // adding data here will show a persistant message on launch - persistant_message: { - title: "", - subtitle: "" - }, - // adding data here will show a one-time message on launch (not yet implemented) - one_time_message: { - title: "", - subtitle: "" - }, - // updating this will make bus images redownload on frontend - bus_image_version: "1", - }); -});; - -router.get('/getBusPredictions/:busId', (req, res) => { - const busId = req.params.busId; - const preds = cachedPredsByVid[busId]; - - if (!preds) { - return res.json({ - "bustime-response": { "prd": [] } - }); - } - res.json({ - "bustime-response": { "prd": preds } - }); -}); - -router.get('/getStopPredictions/:stopId', (req, res) => { - const stopId = req.params.stopId; - const preds = cachedPredsByStopId[stopId]; - - if (!preds) { - return res.json({ - "bustime-response": { "prd": [] } - }); - } - - res.json({ - "bustime-response": { "prd": preds } - }); -}); - -router.get('/getAllPredictions', async (req, res) => { - try { - const predictions = await getAllBusPredictions(); - res.send(predictions); - } catch (err) { - console.log(err); - res.sendStatus(500); - } -}); - -router.get('/getAllStops', (req, res) => { - const stopsList = Object.entries(cachedStopLocations).map(([stpid, stopInfo]) => ({ - stpid, - ...stopInfo, - })); - res.json(Object.values(stopsList)); -}); - -router.get('/getBuildingLocations', (req, res) => { - res.sendFile(path.join(import.meta.dirname, 'assets', 'building-data.json')); -}); - -router.get('/get-startup-messages', (req, res) => { - res.send(JSON.stringify(message)); -}); - -// Simple bus color endpoints -router.get('/getRouteColors', (req, res) => { - const routes = busColorManager.getAllRoutes(); - res.json({ - routes: routes.map(route => ({ - routeId: route.routeId, - color: route.color, - image: route.image - })) - }); -}); - -router.get('/getRouteColor/:routeId', (req, res) => { - const { routeId } = req.params; - const routeInfo = busColorManager.getRouteInfo(routeId); - - if (!routeInfo) { - return res.status(404).json({ error: `Route '${routeId}' not found` }); - } - - res.json({ - routeId: routeInfo.routeId, - color: routeInfo.color, - image: routeInfo.image - }); -}); - -// Simple endpoint for frontend, gets everything needed for UI -router.get('/getFrontendData', (req, res) => { - try { - const routes = busColorManager.getAllRoutes(); - - const response = { - routes: routes.map(route => ({ - routeId: route.routeId, - name: (metadata.routeIdToName as any)[route.routeId] || route.routeId, - image: route.image, - color: route.color, - imageUrl: `/mbus/api/v3/getVehicleImage/${route.routeId}` - })), - metadata: { - ...metadata.metadata, - lastUpdated: new Date().toISOString() - } - }; - - res.json(response); - } catch (error) { - res.status(500).json({ error: 'Failed to get frontend data' }); - } -}); - - -router.get('/nearest-stops', (req, res) => { - try { - const { lat, lon, k = '2' } = req.query; - - const originLat = parseFloat(lat as string); - const originLon = parseFloat(lon as string); - const numStops = parseInt(k as string); - - if (isNaN(originLat) || isNaN(originLon)) { - return res.status(400).json({ error: 'Invalid or missing lat/lon' }); - } - if (isNaN(numStops) || numStops <= 0) { - return res.status(400).json({ error: 'Parameter k must be a positive integer' }); - } - - const heap = new MaxPriorityQueue<{ stpid: string; name: string; lat: number; lon: number; distance: number }>({ - compare: (a, b) => a.distance - b.distance - }); - - for (const [stpid, stop] of Object.entries(cachedStopLocations)) { - const latDiff = (stop.lat - originLat) * 111320; - const lonDiff = (stop.lon - originLon) * 111320 * Math.cos(originLat * Math.PI / 180); - const distance = Math.sqrt(latDiff ** 2 + lonDiff ** 2); - - const stopWithDist = { - stpid, - name: stop.name, - lat: stop.lat, - lon: stop.lon, - distance - }; - - if (heap.size() < numStops) { - heap.enqueue(stopWithDist); - } else if (distance < heap.front()!.distance) { - heap.dequeue(); - heap.enqueue(stopWithDist); - } - } - - const nearestStops = heap.toArray().sort((a, b) => a.distance - b.distance); - res.json({ nearestStops }); - } catch (error) { - console.error('Error in /nearest-stops:', error); - res.status(500).json({ error: 'Internal server error' }); - } -}); - -router.get('/plan-journey', async (req, res) => { - try { - const originStopId = 'VIRTUAL_ORIGIN'; - const destStopId = 'VIRTUAL_DESTINATION'; - - const { originLat, originLon, destLat, destLon, walkingPenalty: walkingPenaltyParam} = req.query; - if (!originLat || !originLon || !destLat || !destLon) { - return res.status(400).json({ error: 'Origin and destination coordinates are required' }); - } - - const oLat = parseFloat(originLat as string); - const oLon = parseFloat(originLon as string); - const dLat = parseFloat(destLat as string); - const dLon = parseFloat(destLon as string); - - const now = new Date(); - const currentTime = now.getUTCHours() * 3600 + now.getUTCMinutes() * 60 + now.getUTCSeconds(); - - if (!cachedGraph || !cachedGraph.trips || cachedGraph.trips.length === 0) { - await rebuildGraph(); - if (!cachedGraph) { - return res.status(404).json({ error: 'No routes available at this time' }); - } - } - - // Clear all transfers for virtual stops - cachedGraph.transfers[originStopId] = []; - cachedGraph.transfers[destStopId] = []; - Object.keys(cachedGraph.transfers).forEach(stopId => { - cachedGraph.transfers[stopId] = cachedGraph.transfers[stopId].filter( - t => t.destination !== destStopId - ); - }); - - const vOriginTrip = cachedGraph.trips.find(t => t.tripId === 'VIRTUAL_ORIGIN_TRIP'); - if (vOriginTrip) { - vOriginTrip.stopTimes[0].arrivalTime = currentTime; - vOriginTrip.stopTimes[0].departureTime = currentTime; - } - const vDestTrip = cachedGraph.trips.find(t => t.tripId === 'VIRTUAL_DESTINATION_TRIP'); - if (vDestTrip) { - vDestTrip.stopTimes[0].arrivalTime = currentTime; - vDestTrip.stopTimes[0].departureTime = currentTime; - } - - // Get walking times from origin to all stops - // Get walking times from all stops to dest - const walksFromOrigin = walking.getWalkingDistancesFrom(oLat, oLon, dLat, dLon); - const walksToDest = walking.getWalkingDistancesFrom(dLat, dLon); - - walksFromOrigin.forEach(walk => { - if (walk.stopId === "DIRECT_WALK") { - cachedGraph.transfers[originStopId].push({ - origin: originStopId, - destination: destStopId, - duration: walk.duration, - startTime: currentTime, - endTime: Number.MAX_SAFE_INTEGER - }); - } else { - cachedGraph.transfers[originStopId].push({ - origin: originStopId, - destination: walk.stopId, - duration: walk.duration, - startTime: currentTime, - endTime: Number.MAX_SAFE_INTEGER - }); - } - }); - - walksToDest.forEach(walk => { - cachedGraph.transfers[walk.stopId].push({ - origin: walk.stopId, - destination: destStopId, - duration: walk.duration, - startTime: currentTime, - endTime: Number.MAX_SAFE_INTEGER - }); - }); - - const mcRaptor = new McRaptorAlgorithm(cachedGraph.trips, cachedGraph.transfers, cachedGraph.interchange); - - let walkingPenalty = 1; - if (walkingPenaltyParam !== undefined) { - const parsed = parseFloat(walkingPenaltyParam as string); - if (!isNaN(parsed) && parsed > 0) { - walkingPenalty = parsed; - } - } - mcRaptor.setWalkingPenalty(walkingPenalty); - - let rangeInSeconds = 60*45; - const { range } = req.query; - if (range !== undefined) { - const parsedRange = parseInt(range as string); - if (!isNaN(parsedRange) && parsedRange > 0) { - rangeInSeconds = parsedRange * 60; - } - } - - let journeys: Journey[]; - if(range !== undefined) { - journeys = mcRaptor.getOptimizedJourneysInRange(originStopId, destStopId, currentTime, rangeInSeconds); - } else { - journeys = mcRaptor.getOptimizedJourneys(originStopId, destStopId, currentTime); - } - const processLeg = async (leg: JourneyLeg) => { - const isWalk = !leg.trip; - - const formattedLeg: any = { - origin_id: leg.origin, - origin: leg.origin === 'VIRTUAL_ORIGIN' ? 'Start' : (leg.origin === 'VIRTUAL_DESTINATION' ? 'End' : (stopIdToName[leg.origin] || leg.origin)), - destination_id: leg.destination, - destination: leg.destination === 'VIRTUAL_DESTINATION' ? 'End' : (stopIdToName[leg.destination] || leg.destination), - destinationName: leg.destination === 'VIRTUAL_DESTINATION' ? 'End' : (stopIdToName[leg.destination] || leg.destination), - startTime: Math.round(leg.startTime), - endTime: Math.round(leg.endTime), - duration: Math.round(leg.duration), - mode: isWalk ? 'walk' : 'bus', - originID: leg.originID, - destinationID: leg.destinationID, - stopTimes: leg.stopTimes, - trip: leg.trip, - rt: leg.rt - }; - - if (leg.trip) { - formattedLeg.tripId = leg.trip.tripId; - formattedLeg.vid = leg.trip.vid; - if (!formattedLeg.rt) { - const firstStop = leg.trip.stopTimes[0]; - formattedLeg.rt = firstStop.rt || tatripidToRt[leg.trip.tripId] || 'UNKNOWN'; - } - } - - if (isWalk) { - const cached = walking.getCachedWalk(leg.origin, leg.destination); - - if (cached) { - Object.assign(formattedLeg, cached); - } else { - const l1 = leg.origin === 'VIRTUAL_ORIGIN' ? { lat: oLat, lon: oLon } : cachedStopLocations[leg.origin]; - const l2 = leg.destination === 'VIRTUAL_DESTINATION' ? { lat: dLat, lon: dLon } : cachedStopLocations[leg.destination]; - - if (l1 && l2) { - try { - const data = await walking.getWalkingResponse(l1.lat, l1.lon, l2.lat, l2.lon); - data.duration = Math.round(data.duration); - Object.assign(formattedLeg, data); - } catch (e) { - formattedLeg.path_coords = []; - } - } - } - } - - return formattedLeg; - }; - - const processJourneys = async (journeys: Journey[]) => { - return Promise.all(journeys.map(async (journey: Journey) => { - if (!journey) return null; - - const legs = await Promise.all(journey.legs.map(processLeg)); - - return { - legs, - departureTime: journey.criteria.arrivalTime - (legs.reduce((acc, leg) => acc + leg.duration, 0)), - arrivalTime: journey.criteria.arrivalTime, - criteria: journey.criteria - }; - })); - }; - const processedList = await processJourneys(journeys); - const sortedJourneys = processedList - .filter((j: any) => j !== null) - .sort((a: any, b: any) => - a.arrivalTime - b.arrivalTime || - a.criteria.walkingDistance - b.criteria.walkingDistance - ); - res.json({ - journeys: sortedJourneys - }); - - } catch (error) { - console.error('Error planning journey:', error); - res.status(500).json({ error: 'Failed to plan journey' }); - } -}); - - -router.get('/save-graph', async (req, res) => { - if (process.env.DEV_SAVE !== 'true') { - return res.status(403).json({ error: 'Endpoint only available in DEV mode' }); - } - - try { - const filePath = path.resolve(process.cwd(), 'saved_graph.json'); - const fullState = { - graph: cachedGraph, - stopLocations: cachedStopLocations, - stopNames: stopIdToName, - predsByVid: cachedPredsByVid, - predsByStopId: cachedPredsByStopId - }; - const data = JSON.stringify(fullState, null, 2); - fs.writeFileSync(filePath, data); - res.json({ message: `Graph and state saved to ${filePath}` }); - } catch (error) { - console.error('Error saving graph:', error); - res.status(500).json({ error: 'Failed to save graph' }); - } -}); - -export default router; diff --git a/src/routes/api.ts b/src/routes/api.ts index 8f24271..1bd8f8d 100644 --- a/src/routes/api.ts +++ b/src/routes/api.ts @@ -9,6 +9,7 @@ import * as journeyService from '../services/journey'; import * as reminderService from '../services/reminder'; import * as graphBuilder from '../services/graphBuilder'; import { startBackgroundJobs } from '../jobs'; +import * as documented from "./documented"; /** * Express router for the MBus API v3. @@ -431,7 +432,7 @@ export function getStartupInfo(req: express.Request, res: express.Response) { res.json({ min_supported_version: "2.0.0", why_update_message: { title: "Update Needed", subtitle: "You need to update to the latest version for the app to work properly." }, - persistant_message: { title: "", subtitle: ""}, + persistant_message: { title: "", subtitle: "" }, one_time_message: { title: "", subtitle: "" }, bus_image_version: "1", }); @@ -487,22 +488,12 @@ router.get('/get-key-stops', getKeyStops); // Notifications / Reminders const SetReminderBody = z.object({ token: z.string(), stpid: z.string(), rtid: z.string(), thresh: z.number() }); -/** - * @param req - Express request, expects `SetReminderBody` in the body - * @param res - Express response, error message as string if error occurs - */ -export function setReminder(req: express.Request, res: express.Response) { - const result = SetReminderBody.safeParse(req.body); - if (!result.success) { - res.status(400); - res.send(result.error.message); - } else { - const { token, stpid, rtid, thresh } = result.data; +documented.addPostRoute( + documented.globalContext, router, '/setReminder', { ...documented.emptyFormat, reqBody: SetReminderBody }, + (_, __, { token, stpid, rtid, thresh }) => { const info = reminderService.infoToUseForRoute(rtid); if (info === null) { - res.status(400); - res.send(`Invalid route ${rtid}`); - return; + return documented.makeFailureResponse(400, `Invalid route ${rtid}`); } const { reminderSubscriptions, predsByStopId } = info; reminderSubscriptions.add( @@ -512,11 +503,9 @@ export function setReminder(req: express.Request, res: express.Response) { predsByStopId, Date.now(), ); - res.sendStatus(200); + return documented.makeSuccessResponse({}); } - -} -router.post('/setReminder', setReminder); +); const UnsetReminderBody = z.object({ token: z.string(), stpid: z.string(), rtid: z.string() }); /** @@ -529,7 +518,7 @@ export function unsetReminder(req: express.Request, res: express.Response) { res.status(400); res.send(result.error.message); } else { - const { token ,stpid, rtid } = result.data; + const { token, stpid, rtid } = result.data; const info = reminderService.infoToUseForRoute(rtid); if (info === null) { res.status(400); @@ -567,42 +556,47 @@ export function swapToken(req: express.Request, res: express.Response) { } router.post('/swapToken', swapToken); -type ActiveReminderInfo = { stpid: string, rtid: string, thresh: number | null, eta: number | null }; +const Token = z.string().meta({ id: "Token" }) +const ActiveReminder = z.object({ + stpid: z.string(), + rtid: z.string(), + thresh: z.number().nullable(), + eta: z.number().nullable(), +}).meta({ id: "Reminder" }); -/** - * @param req - Express request, token is path encoded - * @param res - Express response - */ -export function activeRemindersForToken( - req: express.Request, - res: express.Response<{ reminders: Array }> -) { - const subscriptionInfo = (r: reminderService.PreThreshold | reminderService.PostThreshold): - ActiveReminderInfo => +documented.addGetRoute( + documented.globalContext, router, '/activeReminders/:token', { - return { - stpid: r.event.stpid, - rtid: r.event.rtid, - thresh: r.stage === 0 ? r.thresh : null, - eta: r.stage === 0 ? r.candidateVidPredPrev : r.vidPredPrev + params: z.object({ token: Token }), + query: z.object(), + resBody: z.object({ reminders: z.array(ActiveReminder) }), + }, + ({ token }, _) => { + const regTok = reminderService.registrationToken(token); + const subscriptionInfo = (r: reminderService.PreThreshold | reminderService.PostThreshold) => { + return { + stpid: r.event.stpid, + rtid: r.event.rtid, + thresh: r.stage === 0 ? r.thresh : null, + eta: r.stage === 0 ? r.candidateVidPredPrev : r.vidPredPrev + }; }; - }; - const token = reminderService.registrationToken(req.params.registrationToken); - console.log(`Got request for active reminders of ${token}`); - res.status(200); - const universityReminders = reminderService - .universityReminderSubscriptions - .activeRemindersFor(token) - .map(subscriptionInfo); - const rideReminders = reminderService - .rideReminderSubscriptions - .activeRemindersFor(token) - .map(subscriptionInfo); - res.send({ - reminders: universityReminders.concat(rideReminders) - }); -} -router.get('/activeReminders/:registrationToken', activeRemindersForToken); + console.log(`Got request for active reminders of ${token}`); + const universityReminders = reminderService + .universityReminderSubscriptions + .activeRemindersFor(regTok) + .map(subscriptionInfo); + const rideReminders = reminderService + .rideReminderSubscriptions + .activeRemindersFor(regTok) + .map(subscriptionInfo); + return documented.makeSuccessResponse({ reminders: universityReminders.concat(rideReminders) }); + }, + { + summary: "active reminders", + description: `big long description idk, gets the reminders associated with a **registration token**, which is gotten from fcm or smth` + }, +) const ModifyRemindersBody = z.object({ token: z.string(), @@ -640,7 +634,7 @@ export function modifyReminders(req: express.Request, res: express.Response) { reminderService.registrationToken(token), predsByStopId, Date.now() - ); + ); } else { reminderSubscriptions.remove( event, reminderService.registrationToken(token) @@ -665,7 +659,7 @@ export function notifyMeLater(req: express.Request, res: express.Response) { } setTimeout(() => { console.log(`sending test push notification to ${registrationToken}`); - reminderService.sendNotifToAll({ title: "hi", body: "hello world!"}, new Set([registrationToken])); + reminderService.sendNotifToAll({ title: "hi", body: "hello world!" }, new Set([registrationToken])); }, 0); res.sendStatus(200); } diff --git a/src/routes/documented.ts b/src/routes/documented.ts new file mode 100644 index 0000000..2fd9035 --- /dev/null +++ b/src/routes/documented.ts @@ -0,0 +1,631 @@ +/** + * Wrappers around stuff you would otherwise do with express but with reflection + * capabilities used for openapi specification generation and built-in request + * format validation. + * + * The `req` and `res` objects aren't provided to the passed in handler + * functions, if you're doing something more complicated just use the router + * directly for now. + * + * Nested routing not supported yet, but should probably be added since api.ts + * is getting long (or we could separate the functions from the route + * defintions). + * + * Extra functionality can be added as needed. + * + * # Getting Started + * + * ```typescript + * // have express app + * const app = express(); + * + * // cool router (mandatory probably) + * const router = express.Router(); + * + * // use local context if you want + * const ctx = newContext(); + * + * // add router to app (app.use(router, '/api')) + * addRouter(globalContext, app, router, '/api') + * + * // add route (/api/double) + * addGetRoute( + * globalContext, router, '/double', + * // Zod schemas for each part of the request & response, defaults=emptyFormat + * // since query params end up as strings, z.coerce.number() is needed not z.number() + * { ...emptyFormat, query: z.object({ x: z.coerce.number() }), resBody: z.number() }, + * // handling logic goes here, first arg is ignored b/c it is the path params + * (_, { x }) => { + * // x is already a number as opposed to any/unknown + * makeSuccessResponse(x * 2); + * }, + * // documentation goes here + * { name: 'double a number', description: 'f: R -> R, x |-> 2x'} + * ); + * + * // get docs + * const spec: OpenAPI = docsFor(globalContext); + * // output docs + * outputDocsFor(globalContext); + * ``` + * + * ## Defining Routes + * + * Make sure you know how to use Zod, then look into {@link addRouter}, + * {@link addGetRoute}, and {@link addPostRoute}. It would also be useful to + * take a look at {@link HandlerReturn} + remember the existence of + * {@link emptyFormat} and {@link globalContext}. + * + * `z.tuple` isn't handled well by swagger_parser, prefer objects instead. + * + * If a Zod schema is reused / important enough to get its own variable, make + * sure to at the very least add `.meta({ id: 'unique name' })` to it so that + * API/docs consumers can also take advantage of this. Other schemas can also + * have this even if they are not variables. Note that id must be unique, and + * accidentally setting `name` instead won't have the intended outcome. + * + * ### Be Careful With Zod Transformations + * The OpenAPI spec will be populated with the output formats of the schemas you + * define routes with. This makes coerce work well with path/query formats but + * might be problematic with client generation if using transformations to + * non-primative types. Only use coerce, pipe, and transform with the parts of + * the request, not the response (the resBody schema is never used to validate, + * only to get a type). + * + * ## Getting OpenAPI Specs + * + * Look into setting the environment variables `DOCUMENTED` (to anything + * truthy), `DOCUMENTED_OUTPUT_FILE` (or it will log to the console), and + * `DOCUMENTED_EXIT_ON_OUTPUT`. Also look at {@link globalContext}, + * {@link docsFor}, and {@link outputDocsFor}. + * + * TODO: add examples + * + * TODO: make actually testable? + * + * TODO: add tests? + * @module + */ + +import * as fs from 'node:fs/promises'; + +import dotenv from 'dotenv'; +import express from 'express'; +import z from 'zod'; +import { JSONSchema, ToJSONSchemaParams } from 'zod/v4/core'; +import { exit } from 'node:process'; +import router from './api'; +import { ZodIssue } from 'zod/v3'; + +dotenv.config(); + +export const ENABLED = process.env.DOCUMENTED && true; +const OUTPUT_FILE = process.env.DOCUMENTED_OUTPUT_FILE ?? null +const EXIT_ON_OUTPUT = process.env.DOCUMENTED_EXIT_ON_OUTPUT && true; + +// === interface for people defining apis === + +/** + * Wrapper around `express.Express.use`, instead something like + * `app.use("/api", router)` you'd call + * `addRouter(someContext, app, "/api", router)`. + * + * @param route should not have a trailing slash (notably '/' would be + * incorrect, pass '' instead) + */ +export function addRouter(ctx: Context, app: express.Express, route: string, router: express.Router) { + if (ENABLED) { + ctx.routers.push({ route, router }); + } + app.use(route, router); +} + +/** + * You should genrally use either {@link makeSuccessResponse} or + * {@link makeFailureResponse} to construct this. + * + * Success responses were limited to just 200 because the response body of a + * 2XX catch-all entry isn't reflected in swagger_parser's output. + */ +export type HandlerReturn = { + success: true, status: 200, json: T +} | { + success: false, status: 400 | 401 | 403 | 404 | 500, error: string +}; + +/** + * helper function that should avoid weird typechecker issues + */ +export function makeSuccessResponse(json: T): HandlerReturn { + return { success: true, status: 200, json }; +} + +/** + * helper function that should avoid weird typechecker issues + */ +export function makeFailureResponse(status: 400 | 401 | 403 | 404 | 500, error: string): HandlerReturn { + return { success: false, status, error }; +} + +/** + * A type representing a Zod object (i.e. `z.object(...)`) where string fields + * like those from query & path parms can get parsed. + */ +export type StringlyZodObject = z.ZodObject>>; + +/** + * Meant to be used along with the spread operator to fill out format fields + * that aren't cared about. + */ +export const emptyFormat: { + params: StringlyZodObject, query: StringlyZodObject, reqBody: z.ZodType, resBody: z.ZodType, +} = { + params: z.object(), query: z.object(), reqBody: z.unknown(), resBody: z.unknown(), +}; + +/** + * Wrapper around router.get with built in validation and schema recording + * + * The `req` and `res` objects aren't provided to the passed in handler, if + * you're doing something more complicated (e.g. using headers) just use the + * router directly for now, the functionality needed could be incorporated in + * the future. + * + * @typeParam P - path parameters as a zod object + * @typeParam Q - query parameters as a zod object + * @typeParam RB - response body as a zod type + * + * @param ctx - which context to place this route in, see `globalContext` + * @param router - express router + * @param path - path the route happens, same format as used in express but + * avoid features not supported in openapi (e.g. advanced path matchers) + * @param format - zod schemas of the parts of the request and response, use + * `emptyFormat` to fill in default values + * @param handler - route handler + * @param docs - information that should end up in the openapi spec + * + * @returns the handler function that got passed to `router.get` internally, + * to be used in testing + */ +export function addGetRoute< + P extends StringlyZodObject, + Q extends StringlyZodObject, + RB extends z.ZodType +>( + ctx: Context, + router: express.Router, + path: string, + format: { params: P, query: Q, resBody: RB }, + handler: (params: z.infer

                                                                                                                                                                                                                                                                                                              , query: z.infer) => HandlerReturn>, + docs?: { + /** a short description of what is route does, becomes the title */ + summary?: string, + /** a longer explanation, commonmark accepted */ + description?: string, + }, +) { + const { params: paramsSchema, query: querySchema, resBody: resBodySchema } = format; + + if (ENABLED) { + ctx.routes.push({ + router, method: 'get', + pathSuffix: path, + params: paramsSchema.shape, + query: querySchema.shape, + resBody: resBodySchema instanceof z.ZodUnknown ? null : resBodySchema, + summary: docs?.summary ?? "", description: docs?.description ?? "", + }); + } + + router.get(path, (req: ExpressRequest, res: express.Response | { error: string }>) => { + const { status, json } = determineResponse(req); + res.status(status).json(json); + }); + + const determineResponse = (req: ExpressRequest): { status: number, json: z.infer | { error: string } } => { + let params = paramsSchema.safeParse(req.params); + if (params.error) { + return { + status: 400, + json: formatError('invalid path params', params.error) + }; + } + let query = querySchema.safeParse(req.query); + if (query.error) { + return { status: 400, json: formatError('invalid query params', query.error) }; + } + try { + const result = handler(params.data, query.data); + if (result.success) { + return { status: result.status, json: result.json }; + } else { + return { status: result.status, json: { error: result.error } }; + } + } catch (e) { + console.error(`uncaught exception in wrapped route: ${e}`) + if (e instanceof Error) { + return { status: 500, json: { error: e.message } } + } else { + return { status: 500, json: { error: JSON.stringify(e) } } + } + } + } + return determineResponse; +} + +/** + * Wrapper around router.post with built in validation and schema recording, + * more details can be found in {@link addGetRoute}. + * + * @typeParam P - path params + * @typeParam Q - query params + * @typeParam B - request body + * @typeParam RB - response body + * + * @param ctx - which context to place this route in, see `globalContext` + * @param router - express router + * @param path - path the route happens, same format as used in express but + * avoid features not supported in openapi (e.g. advanced path matchers) + * @param format - zod schemas of the parts of the request and response, use + * `emptyFormat` to fill in default values + * @param handler - route handler + * @param docs - information that should end up in the openapi spec + * + * @returns the handler function that got passed to `router.post` internally, + * to be used in testing + */ +export function addPostRoute< + P extends StringlyZodObject, + Q extends StringlyZodObject, + B extends z.ZodType, + RB extends z.ZodType, +>( + ctx: Context, + router: express.Router, + path: string, + format: { params: P, query: Q, reqBody: B, resBody: RB }, + handler: (params: z.infer

                                                                                                                                                                                                                                                                                                              , query: z.infer, body: z.infer) => HandlerReturn>, + docs?: { + /** a short description of what is route does, becomes the title */ + summary?: string, + /** a longer explanation, commonmark accepted */ + description?: string, + }, +) { + const { params: paramsSchema, query: querySchema, reqBody: reqBodySchema, resBody: resBodySchema } = format; + + if (ENABLED) { + ctx.routes.push({ + router, method: 'post', pathSuffix: path, + params: paramsSchema.shape, + query: querySchema.shape, + reqBody: reqBodySchema instanceof z.ZodUnknown ? null : reqBodySchema, + resBody: resBodySchema instanceof z.ZodUnknown ? null : resBodySchema, + summary: docs?.summary ?? "", description: docs?.description ?? "", + }); + } + + router.post(path, (req, res: express.Response | { error: string }>) => { + const { status, json } = determineResponse(req); + res.status(status).json(json); + }); + + const determineResponse = (req: ExpressRequest): { status: number, json: z.infer | { error: string } } => { + let params = paramsSchema.safeParse(req.params); + if (params.error) { + return { status: 400, json: formatError('invalid path params', params.error) }; + } + let query = querySchema.safeParse(req.query); + if (query.error) { + return { status: 400, json: formatError('invalid query params', query.error) }; + } + let body = reqBodySchema.safeParse(req.body); + if (body.error) { + return { status: 400, json: formatError('invalid body', body.error) }; + } + try { + const result = handler(params.data, query.data, body.data); + if (result.success) { + return { status: result.status, json: result.json }; + } else { + return { status: result.status, json: { error: result.error } }; + } + } catch (e) { + console.error(`uncaught exception in wrapped route: ${e}`) + if (e instanceof Error) { + return { status: 500, json: { error: e.message } } + } else { + return { status: 500, json: { error: JSON.stringify(e) } } + } + } + } + return determineResponse; +} + +function formatError(title: string, error: z.ZodError) { + const issuesText = error.issues + .map(i => `- ${i.path.length ? (i.path.join('.') + ': ') : ''}${i.message}`) + .join('\n'); + return { error: `${title}:\n${issuesText}` }; +} + +// === end of interface for api defining === + +/** + * The context you should probably be using for everything unless writing a + * test. + */ +export const globalContext: Context = newContext(); + +/** + * Returns an independent context. + */ +export function newContext() { + return { routers: [], routes: [] }; +} + +/** Where api route info is aggregated */ +export type Context = ReflectionInfoRaw; + +/** + * @internal + */ +export interface ReflectionInfoRaw { + routers: Array<{ route: string, router: express.Router }>, + /** full routes along with req+res schemas, routes are incomplete until info is finalized */ + routes: Array<{ + router: express.Router, + pathSuffix: string, + summary: string, + description: string, + params: Record, + query: Record, + resBody: z.ZodType | null, + } & ({ method: 'get' } | { method: 'post', reqBody: z.ZodType | null })>, +}; + +interface ReflectionInfo { + routes: Array<{ + path: string, + summary: string, + description: string, + params: Record, + query: Record, + resBody: JSONSchema.BaseSchema | null, + } & ({ method: 'get' } | { method: 'post', reqBody: JSONSchema.BaseSchema | null })>, + defs: Record, +}; + +interface OpenAPIPathCommon { + summary: string, + description: string, + parameters: Array<{ + name: string, + in: "path" | "query", + schema: JSONSchema.JSONSchema, + required: boolean, + }>, + responses: { + "200": { + description: "success", + content?: { + "application/json": { + schema: JSONSchema.JSONSchema, + } + } + } + }, +}; + +export interface OpenAPIGetPath extends OpenAPIPathCommon { }; + +export interface OpenAPIPostPath extends OpenAPIPathCommon { + requestBody?: { + content: { + "application/json": { + schema: JSONSchema.JSONSchema, + } + }, + required: boolean, + }, +}; + +/** the subset of the openapi format(s) we are concerned with generating */ +export interface OpenAPI { + openapi: "3.1.2", + info: { + title: string, + version: string, + }, + components: { + schemas: Record, + }, + paths: Record*/>, +} + +/** + * the parts of an express request that are relevant for mocking during tests + */ +export interface ExpressRequest { + params: express.Request['params'] + query: express.Request['query'] + body: express.Request['body'] +} + +function finalize(info: ReflectionInfoRaw): ReflectionInfo { + // replace $def with components/schemas + const fixSchema = (s: T, shouldStripDefs: boolean): T => { + stripExtraKeys(s, shouldStripDefs); + if (typeof s !== 'object' || !s) return s; + if ('$ref' in s && typeof s.$ref == 'string') + s.$ref = s.$ref.replace('$defs', 'components/schemas'); + for (const v of Object.values(s)) { + fixSchema(v, shouldStripDefs); + } + return s; + }; + + const stripExtraKeys = (s: T, shouldStripDefs: boolean): T => { + if (typeof s !== 'object' || !s) return s; + if (shouldStripDefs && '$defs' in s) { + delete s['$defs']; + } + if ('$schema' in s) delete s['$schema']; + for (const v of Object.values(s)) { + stripExtraKeys(v, shouldStripDefs); + } + return s; + } + + const schemaOpts: ToJSONSchemaParams = { + // reused: 'ref', + io: 'output', + } + const resultRoutes: ReflectionInfo['routes'] = []; + + // used to get the shared $defs + const model: Record = {}; + + for (const route of info.routes) { + try { + const basePath = info.routers.find((r) => r.router == route.router)?.route; + if (basePath == undefined) { + throw new Error('route has missing base path'); + } + const path = (basePath + route.pathSuffix).replace(/:([A-Za-z0-9_]+)/, "{$1}"); + const finalParams: Record = {}; + for (const param in route.params) { + const zodSchema = route.params[param]; + model[path + ' params ' + param] = zodSchema; + finalParams[param] = fixSchema(zodSchema.toJSONSchema(schemaOpts), true); + } + const finalQuery: Record = {}; + for (const key in route.query) { + const zodSchema = route.query[key]; + model[path + '?' + key] = zodSchema; + finalQuery[key] = fixSchema(zodSchema.toJSONSchema(schemaOpts), true); + } + const common = { + path, + params: finalParams, + query: finalQuery, + resBody: route.resBody === null ? null : fixSchema(route.resBody.toJSONSchema(schemaOpts), true), + summary: route.summary, + description: route.description, + }; + switch (route.method) { + case 'get': + resultRoutes.push({ ...common, method: 'get' }); + break; + case 'post': + resultRoutes.push({ + ...common, + method: 'post', + reqBody: route.reqBody === null + ? null + : fixSchema(route.reqBody.toJSONSchema(schemaOpts), true), + }); + if (route.reqBody) + model[path + ' reqBody'] = route.reqBody; + break; + default: + // TODO: use eslint exhaustiveness checking + const _: never = route; + } + if (route.resBody) + model[path + ' resBody'] = route.resBody; + } catch (e) { + throw new Error(`couldn't finalize "${route.pathSuffix}": ${e}`); + } + } + return { + routes: resultRoutes, + defs: fixSchema(z.object(model).toJSONSchema(schemaOpts), false).$defs ?? {}, + }; +} + +function makeOpenAPI(info: ReflectionInfo): OpenAPI { + const pathsArray = info.routes + .map((route): { url: string } & ( + { method: 'get', path: OpenAPIGetPath } | { method: 'post', path: OpenAPIPostPath } + ) => { + const parameters: OpenAPIGetPath['parameters'] = []; + for (const name in route.params) { + parameters.push({ name: name, in: 'path', required: true, schema: route.params[name] }); + } + for (const name in route.query) { + parameters.push({ name: name, in: 'query', required: true, schema: route.query[name] }); + } + const content = route.resBody === null + ? undefined + : { 'application/json': { schema: route.resBody } }; + const responses: OpenAPIGetPath['responses'] = { + '200': { + description: 'success', + content, + } + }; + const common: OpenAPIPathCommon = { + summary: route.summary, + description: route.description, + parameters, + responses, + }; + switch (route.method) { + case 'get': + return { url: route.path, method: 'get', path: common }; + case 'post': + const requestBody = route.reqBody == null + ? undefined + : { content: { "application/json": { schema: route.reqBody } }, required: true }; + return { + url: route.path, method: 'post', path: { + requestBody, ...common + } + }; + } + }); + const paths: OpenAPI['paths'] = {}; + for (const { url, method, path } of pathsArray) { + if (!paths[url]) paths[url] = {}; + if (method === 'get') + paths[url].get = path; + else + paths[url].post = path; + } + return { + openapi: "3.1.2", + info: { + title: "Maize Bus Backend", + version: "", + }, + components: { schemas: info.defs }, + paths, + } +} + +/** Get the OpenAPI spec as a structured object. */ +export function docsFor(ctx: Context) { + if (!ENABLED) throw new Error('documented must be enabled'); + const finalized = finalize(ctx); + const openAPI = makeOpenAPI(finalized); + return openAPI; +} + +/** + * Output the OpenAPI spec to the file specified by the environment, or to the + * console if this isn't set. Will also exit the process if configured to do so. + */ +export async function outputDocsFor(ctx: Context) { + if (!ENABLED) throw new Error('documented must be enabled'); + console.log('outputting docs...'); + const openAPI = docsFor(ctx); + const output = JSON.stringify(openAPI, null, 4); + if (OUTPUT_FILE) + await fs.writeFile(OUTPUT_FILE, output); + else + console.log(output); + if (EXIT_ON_OUTPUT) + exit(0); +} + diff --git a/src/services/mbus.ts b/src/services/mbus.ts index 1c9eeeb..a479f5a 100644 --- a/src/services/mbus.ts +++ b/src/services/mbus.ts @@ -5,7 +5,7 @@ import dotenv from "dotenv"; dotenv.config(); const API_KEY = process.env.MBUS_API_KEY; -const BASE_URL = 'https://mbus.ltp.umich.edu/bustime/api/v3/'; +const BASE_URL = process.env.MBUS_URL || 'https://mbus.ltp.umich.edu/bustime/api/v3/'; const client = axios.create({ baseURL: BASE_URL, diff --git a/src/services/reminder.ts b/src/services/reminder.ts index a274244..8b87c78 100644 --- a/src/services/reminder.ts +++ b/src/services/reminder.ts @@ -61,7 +61,7 @@ function prdctdnToNum(prdctdn: string): number { } /** result of ReminderSubscriptons.process */ -type RemindersToTrigger = { +export type RemindersToTrigger = { /** can be sent in bulk based off of route, stop, and threshold (or route, stop, and prdctdn) */ reminder: Map, Set>, /** can be sent in bulk based off of what route and stop */ @@ -74,7 +74,7 @@ type RemindersToTrigger = { }; /** Subscriptions go through a pipeline, see types above for details. */ -class ReminderSubscriptions { +export class ReminderSubscriptions { subscriptions: Array<{ token: RegistrationToken, subscription: PreThreshold | PostThreshold }> diff --git a/src/services/reminderTypes.ts b/src/services/reminderTypes.ts index eae8a53..5f4f54c 100644 --- a/src/services/reminderTypes.ts +++ b/src/services/reminderTypes.ts @@ -13,8 +13,8 @@ export function fromKey(key: Key): T { return JSON.parse(key); } -/** internal */ -type CoreEvent = { +/** @internal */ +export type CoreEvent = { stpid: string, rtid: string, } diff --git a/src/services/ride.ts b/src/services/ride.ts index 2a6455f..bd8fd31 100644 --- a/src/services/ride.ts +++ b/src/services/ride.ts @@ -7,7 +7,7 @@ import dotenv from "dotenv"; dotenv.config(); const RIDE_API_KEY = process.env.RIDE_API_KEY; -const BASE_URL = 'https://rt.theride.org/bustime/api/v3/'; +const BASE_URL = process.env.RIDE_URL || 'https://rt.theride.org/bustime/api/v3/'; const client = axios.create({ baseURL: BASE_URL, diff --git a/test/documented.test.ts b/test/documented.test.ts new file mode 100644 index 0000000..51a9641 --- /dev/null +++ b/test/documented.test.ts @@ -0,0 +1,374 @@ +import { beforeAll, expect, it } from "vitest"; +import * as d from '@/routes/documented'; + +import express from 'express'; +import z from 'zod'; + +beforeAll(() => { + if (!d.ENABLED) { + throw new Error('documented must be enabled'); + } +}); + +it('should handle path params (GET)', () => { + testCase( + 'get', + '/root', '/path/{item}', + { params: z.strictObject({ item: z.string() }) }, + { params: { item: 'five' }, query: {}, body: {} }, + { params: { wrong: 'five' }, query: {}, body: {} }, + (correct) => expect(correct) + .toMatchInlineSnapshot(` + { + "params": { + "item": "five", + }, + "query": {}, + } + `), + (incorrect) => expect(incorrect) + .toMatchInlineSnapshot(` + "invalid path params: + - item: Invalid input: expected string, received undefined + - Unrecognized key: "wrong"" + `), + (spec) => expect(spec.paths['/root/path/{item}'].get?.parameters[0]) + .toMatchInlineSnapshot(` + { + "in": "path", + "name": "item", + "required": true, + "schema": { + "type": "string", + }, + } + `), + ); +}); + +it('should accept params named id', () => { + testCase( + 'get', + '', '/test', + { params: z.object({ id: z.string() }) }, + {}, {}, null, null, + (spec) => expect(spec.paths['/test'].get?.parameters[0].name).toEqual("id") + ); +}); + +it('should work with schemas containing id', () => { + const B = z.object({ id: z.number() }).meta({ id: 'B'}); + testCase( + 'post', + '', '/test', + { reqBody: B, resBody: B }, + {}, {}, null, null, + (spec) => expect(spec.components.schemas.B.properties).toHaveProperty('id'), + ); +}); + +it('should handle query params (GET)', () => { + testCase( + 'get', '', '/api', + { query: z.object({ field: z.coerce.number() })}, + { query: { field: "-2" } }, + { query: { field: "no" } }, + (json) => expect(json).toMatchInlineSnapshot(` + { + "params": {}, + "query": { + "field": -2, + }, + } + `), + (error) => expect(error).toMatchInlineSnapshot(` + "invalid query params: + - field: Invalid input: expected number, received NaN" + `), + (spec) => expect(spec.paths['/api'].get?.parameters[0]).toMatchInlineSnapshot(` + { + "in": "query", + "name": "field", + "required": true, + "schema": { + "type": "number", + }, + } + `) + ) +}); + +it('should handle response bodies (GET)', () => { + // shows up in docs + testCase( + 'get', '/4', '/34', + { resBody: z.number() }, + {}, {}, + (json) => expect(json).toMatchInlineSnapshot(` + { + "params": {}, + "query": {}, + } + `), + null, + (spec) => expect(spec.paths['/4/34'].get?.responses["200"].content?.["application/json"].schema) + .toMatchInlineSnapshot(` + { + "type": "number", + } + `) + ); + // can be empty + testCase( + 'get', '', '/h', {}, {}, {}, null, null, + (spec) => expect(spec.paths['/h'].get!.responses["200"].content) + .toMatchInlineSnapshot(`undefined`) + ); +}); + +it('should handle path params (POST)', () => { + testCase( + 'post', + '/root', '/path/{item}', + { ...d.emptyFormat, params: z.object({ item: z.string() }) }, + { params: { item: 'five' }, query: {}, body: {} }, + { params: { wrong: 'five' }, query: {}, body: {} }, + (correct) => expect(correct) + .toMatchInlineSnapshot(` + { + "body": {}, + "params": { + "item": "five", + }, + "query": {}, + } + `), + (incorrect) => expect(incorrect) + .toMatchInlineSnapshot(` + "invalid path params: + - item: Invalid input: expected string, received undefined" + `), + (spec) => expect(spec.paths['/root/path/{item}'].post?.parameters[0]) + .toMatchInlineSnapshot(` + { + "in": "path", + "name": "item", + "required": true, + "schema": { + "type": "string", + }, + } + `), + ); +}); + +it('should handle query params (POST)', () => { + testCase( + 'post', '', '/api', + { query: z.object({ field: z.coerce.number() })}, + { query: { field: "-2" } }, + { query: { field: "no" } }, + (json) => expect(json).toMatchInlineSnapshot(` + { + "body": {}, + "params": {}, + "query": { + "field": -2, + }, + } + `), + (error) => expect(error).toMatchInlineSnapshot(` + "invalid query params: + - field: Invalid input: expected number, received NaN" + `), + (spec) => expect(spec.paths['/api'].post?.parameters[0]).toMatchInlineSnapshot(` + { + "in": "query", + "name": "field", + "required": true, + "schema": { + "type": "number", + }, + } + `) + ) +}); + +it('should handle request bodies (POST)', () => { + testCase( + 'post', '/a/b', '/c', + { reqBody: z.object({ field: z.boolean() })}, + { body: { field: true } }, + { body: { field: [] } }, + (json) => expect(json).toMatchInlineSnapshot(` + { + "body": { + "field": true, + }, + "params": {}, + "query": {}, + } + `), + (error) => expect(error).toMatchInlineSnapshot(` + "invalid body: + - field: Invalid input: expected boolean, received array" + `), + (spec) => expect(spec.paths['/a/b/c'].post?.parameters[0]).toMatchInlineSnapshot(`undefined`) + ) +}); + +it('should handle response bodies (POST)', () => { + // shows up in docs + testCase( + 'post', '/4', '/34', + { resBody: z.number() }, + {}, {}, + (json) => expect(json).toMatchInlineSnapshot(` + { + "body": {}, + "params": {}, + "query": {}, + } + `), + null, + (spec) => expect(spec.paths['/4/34'].post?.responses["200"].content?.["application/json"].schema) + .toMatchInlineSnapshot(` + { + "type": "number", + } + `) + ); + // can be empty + testCase( + 'post', '', '/h', {}, {}, {}, null, null, + (spec) => expect(spec.paths['/h'].post!.responses["200"].content) + .toMatchInlineSnapshot(`undefined`) + ); +}); + + +it('should be able to handle GET & POST to the same path', () => { + const app = express(); + const router = express.Router(); + + const ctx = d.newContext(); + d.addRouter(ctx, app, '', router); + + d.addGetRoute(ctx, router, '/rt', d.emptyFormat, () => d.makeSuccessResponse({}), {}); + d.addPostRoute(ctx, router, '/rt', d.emptyFormat, () => d.makeSuccessResponse({}), {}); + + const path = d.docsFor(ctx).paths['/rt']; + expect(path.get).toBeDefined(); + expect(path.post).toBeDefined(); + expect(path.get).toEqual(path.post); +}); + +it('should handle zod transform types in the request', () => { + const app = express(); + const router = express.Router(); + + const ctx = d.newContext(); + d.addRouter(ctx, app, '', router); + + const handler = d.addPostRoute( + ctx, router, '/rt', + { ...d.emptyFormat, reqBody: z.string().transform((s) => s.toLowerCase()) }, + (_, __, body) => d.makeSuccessResponse(body) + ); + const res = handler({ params: {}, query: {}, body: 'HI' }); + expect(res.json).toMatchInlineSnapshot(`"hi"`); +}); + +it('should surface type descriptions & names', () => { + const app = express(); + const router = express.Router(); + + const ctx = d.newContext(); + d.addRouter(ctx, app, '', router); + d.addGetRoute( + ctx, router, '/pan', + { ...d.emptyFormat, resBody: z.object().meta({ id: 'Obj', description: 'obj' }) }, + () => d.makeSuccessResponse({}) + ); + const spec = d.docsFor(ctx); + expect(spec.components.schemas).toMatchInlineSnapshot(` + { + "Obj": { + "additionalProperties": false, + "description": "obj", + "properties": {}, + "type": "object", + }, + } + `); +}); + +it('should surface route descriptions & names', () => { + const app = express(); + const router = express.Router(); + + const ctx = d.newContext(); + d.addRouter(ctx, app, '', router); + d.addGetRoute( + ctx, router, '/pan', + d.emptyFormat, + () => d.makeSuccessResponse({}), + { summary: 'summary', description: 'description' } + ); + const spec = d.docsFor(ctx); + const path = spec.paths['/pan'].get; + expect(path).toHaveProperty('description', 'description'); + expect(path).toHaveProperty('summary', 'summary'); +}); + +function testCase( + mode: 'get' | 'post', + base: string, + suffix: string, + format: Partial, + correct: Partial, + incorrect: Partial, + validateCorrect: null | ((json: unknown) => unknown), + validateIncorrect: null | ((error: string) => unknown), + validateSpec: (spec: d.OpenAPI) => unknown, +) { + const app = express(); + const router = express.Router(); + + const ctx = d.newContext(); + d.addRouter(ctx, app, base, router); + const handler = mode === 'get' + ? d.addGetRoute( + ctx, router, suffix, + { ...d.emptyFormat, ...format }, + (params, query) => d.makeSuccessResponse({ params, query }) + ) + : d.addPostRoute( + ctx, router, suffix, + { ...d.emptyFormat, ...format }, + (params, query, body) => d.makeSuccessResponse({ params, query, body }) + ); + + const defaultResponse: d.ExpressRequest = { query: {}, params: {}, body: {} }; + // correct value goes through? + if (validateCorrect) { + const res = handler({ ...defaultResponse, ...correct }); + expect(res.status).toBe(200); + validateCorrect(res.json); + } + + // incorrect value is caught? + if (validateIncorrect) { + const res = handler({ ...defaultResponse, ...incorrect }); + expect(res.status).toBe(400); + validateIncorrect( + typeof res.json === 'object' && res.json && 'error' in res.json && typeof res.json.error === 'string' + ? res.json.error + : '' + ); + } + + // shows up in docs? + const spec = d.docsFor(ctx); + validateSpec(spec); +} diff --git a/test/reminder.test.ts b/test/reminder.test.ts index 5a2a8f8..0d991e8 100644 --- a/test/reminder.test.ts +++ b/test/reminder.test.ts @@ -203,14 +203,14 @@ describe('Reminders', () => { it('should get unix timestamp from ride bus api', async () => { configDotenv(); const RIDE_API_KEY = process.env.RIDE_API_KEY; - const BASE_URL = 'https://rt.theride.org/bustime/api/v3/'; + const BASE_URL = process.env.RIDE_URL || 'https://rt.theride.org/bustime/api/v3/'; const client = axios.create({ baseURL: BASE_URL, params: { key: RIDE_API_KEY, format: 'json' } }); const res = await client.get('/gettime', { params: { unixTime: true } }); - expect(Math.abs(parseInt(res.data["bustime-response"]["tm"]) - Date.now())).toBeLessThan(60 * 1000); + expect(Math.abs(parseInt(res.data["bustime-response"]["tm"]) - Date.now())).toBeLessThan(2 * 24 * 60 * 60 * 1000); }); it('should have cached preds in a good state', async () => { @@ -229,7 +229,7 @@ describe('Reminders', () => { for (const k in sample) { expect(k + ":" +typeof x[k]).toBe(k + ":" + typeof sample[k]); if (k == "prdtm") { - expect(x[k]).toBeGreaterThanOrEqual(Date.now() - 15 * 1000); + expect(x[k]).toBeGreaterThanOrEqual(Date.now() - 2 * 24 * 60 * 60 * 1000); } } }; diff --git a/tsconfig.json b/tsconfig.json index 144c0e8..3422bf1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,14 +1,14 @@ { "compilerOptions": { - "target": "es6", + "target": "es2021", "module": "esnext", - "moduleResolution": "Node", + "moduleResolution": "bundler", "esModuleInterop": true, "resolveJsonModule": true, "forceConsistentCasingInFileNames": true, "strict": true, "skipLibCheck": true, - "baseUrl": "./", + // "baseUrl": "./", "paths": { "@/*": [ "./src/*"