Node SDK

The Airplane Node SDK provides useful utilities to interact with the Airplane platform.

Installation

The Airplane Node SDK is available as an NPM package airplane.
bash
Copied
1
$ npm install airplane

Output

Tasks have Output that is rendered in the UI when executed. The simplest way to produce output is by returning it from the entrypoint of your task:
javascript
Copied
1
export default async function () {
2
const rows = await queryDB("...");
3
4
return { rows, count: rows.length };
5
}
This requires your task to buffer output in-memory before returning. Alternatively, output can be streamed while the task is executing using the Airplane SDK:
javascript
Copied
1
import airplane from "airplane";
2
3
export default async function () {
4
const rows = await queryDB("...");
5
6
for (let row of rows) {
7
airplane.appendOutput(row, "rows");
8
}
9
10
airplane.setOutput(rows.length, "count");
11
}
Both tasks produce the same output:
json
Copied
1
{
2
"rows": [
3
{ "name": "...", "age": 42 }
4
// ...
5
],
6
"count": 10
7
}