Welcome! If you're reading this page, you probably want to program your own data retrieval software to be used by the POSCON. This can be used to:
- Pull ATIS information, METAR, TAF, and/or SIGMET from live sources
- Generate an ATIS, METAR, TAF, and/or SIGMET automatically
- Architecture
- Allowed Modules
- Sample Code
- How do I test locally?
- I'm done, now what?
- Questions? Comments? Concerns?
- Credits
All user-supplied JavaScript for the purpose of retriving an ATIS is run in a v8 Isolate. What does that mean? It means your code is being run in an isolated process, with no access to the host machine. We use this to ensure that no code supplied by other users may intefere with yours.
There may only be one file provided per FIR, which must contain all code for retrieval for any airports within the FIR. Unsafe functions, modules, and objects are also disabled, such as process, eval, and fs.
Our servers use Node v14 on an Alpine image, and store scripts on a remote location.
Your script must export a default function that returns AerodromeInformation or a Promise that completes with one.
export default function(icao: string): AerodromeInformation | PromiseLike<AerodromeInformation> { ... }Please refer to spec.d.ts for details. When compiled to CommonJS, it becomes the following:
exports.default = function(icao) { ... }The following modules are currently allowed to be import'ed by a script:
If you would like a module added that is not currently available, please open an issue with the title Request to add <module name>, and the body containing a brief description of how the module would be used, and justification for its inclusion.
The sample code in VHHK.ts will retrieve information for Hong Kong International Airport (VHHH) in VHHK FIR written in TypeScript. A CommonJS implementation is available in VHHK_CommonJS.js
The sample code in TypeScript embeds type annotations for easy understanding as well as context-aware code completion in popular IDEs. Run npm run build to build a CommonJS file from TypeScript. You can also write in CommonJS directly.
VABF.ts is an advanced sample involving an append-only cookie jar and session reuse.
Run npm install to install dependencies for testing, and then use the test script as below.
To test VHHK_CommonJS.js with station VHHH, run npm run test-js ./VHHK_CommonJS VHHH.
To test VHHK.ts with station VHHH, run npm test ./VHHK VHHH.
To test VABF.ts with stations VAAH, VEAT, VIAR, and VOBL, run npm test ./VABF VAAH VEAT VIAR VOBL.
There are a few requirements for your file. They are as such:
- It must be named YOUR-FIR.js (it cannot be TypeScript, it must be compiled)
- I.e., if you are writing a file to be used by the VHHK FIR, it would be named
VHHK.js
- I.e., if you are writing a file to be used by the VHHK FIR, it would be named
- The default export must be a function that returns either:
AerodromeInformation, as defined in spec.d.ts- A promise that resolves to
AerodromeInformation
- All unused or unknown fields must be blank values
- Only ONE of these two may be populated with anything other than an empty value:
- ATIS
body - ATIS
departureandarrival
- ATIS
Once you've written your script, please send it to support@poscon.net to be integrated.
If you have any questions about the library, please feel free to open an issue, or send us a message at support@poscon.net