Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ The TypeScript SDK lets you implement Airflow task logic in TypeScript (or plain
Node.js. The Dag and its scheduling remain in Python; individual tasks delegate to a Node.js subprocess that
is spawned by :class:`~airflow.sdk.coordinators.node.NodeCoordinator` for each task instance.

The SDK is an ESM-only package that ships from the ``ts-sdk/`` directory of the Airflow repository. It is currently in **alpha** and its API may change.
The SDK is an ESM-only package that ships from the ``ts-sdk/`` directory of the Airflow repository. It is currently in **beta** and its API may change.

.. warning::

Expand Down Expand Up @@ -93,7 +93,7 @@ entry point.

.. code-block:: typescript

import { Dag, DagRegistry, serveDags, type TaskHandlerArgs } from "@apache-airflow/ts-sdk";
import { Dag, DagRegistry, serveDags, type TaskHandlerArgs } from "apache-airflow-ts-sdk";

export async function buildMessage({ ctx, client }: TaskHandlerArgs) {
const upstream = await client.getXCom<string>({
Expand Down Expand Up @@ -304,7 +304,7 @@ Limitations
* **A Python stub Dag is still required.** The Execution API does not yet carry Dag structure for non-Python
languages, so task names and dependencies are declared in Python with
:func:`@task.stub <airflow.sdk.task.stub>`.
* **Alpha status.** The SDK API may change in incompatible ways between releases.
* **Beta status.** The SDK API may change in incompatible ways between releases.
* **One bundle per coordinator.** :class:`~airflow.sdk.coordinators.node.NodeCoordinator` launches the first
usable bundle found in ``bundles_root``; it does not yet route different Dags or tasks to different
bundles. To serve multiple bundles, register multiple coordinators on separate queues.
Expand Down
2 changes: 1 addition & 1 deletion dev/breeze/tests/test_release_management_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ def test_get_package_version_possibly_from_stable_txt_for_ts_sdk(
monkeypatch.setattr(global_constants, "AIRFLOW_ROOT_PATH", tmp_path)
package_json = tmp_path / "ts-sdk" / "package.json"
package_json.parent.mkdir(parents=True)
package_json.write_text('{"name": "@apache-airflow/ts-sdk", "version": "0.2.0-alpha.1"}\n')
package_json.write_text('{"name": "apache-airflow-ts-sdk", "version": "0.2.0-alpha.1"}\n')
if stable_txt_content is not None:
stable_txt = tmp_path / "generated" / "_build" / "docs" / "ts-sdk" / "stable.txt"
stable_txt.parent.mkdir(parents=True)
Expand Down
16 changes: 9 additions & 7 deletions ts-sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,21 @@

Public TypeScript interfaces for writing Apache Airflow task handlers.

**Status:** alpha · API will change · Node 22+ · ESM-only
**Status:** 0.1.0-beta1 · API may change · Node 22+ · ESM-only

This package defines the user-facing task handler contract and the coordinator
runtime used to execute registered TypeScript handlers from Airflow.

> **Note:** This package is not yet published to a public npm registry. Until an
> official Apache Airflow release is available, build and use it from source (see
> [Development](#development)).
## Installation

```bash
npm install apache-airflow-ts-sdk@0.1.0-beta1
```

## Task Handlers

```ts
import { Dag, DagRegistry, serveDags, type TaskHandlerArgs } from "@apache-airflow/ts-sdk";
import { Dag, DagRegistry, serveDags, type TaskHandlerArgs } from "apache-airflow-ts-sdk";

export async function sayHello({ ctx, client }: TaskHandlerArgs) {
const greeting = await client.getVariable("greeting");
Expand Down Expand Up @@ -98,7 +100,7 @@ Airflow metadata in the bundle itself.
TypeScript entrypoint:

```ts
import { Dag, DagRegistry, serveDags, type TaskHandlerArgs } from "@apache-airflow/ts-sdk";
import { Dag, DagRegistry, serveDags, type TaskHandlerArgs } from "apache-airflow-ts-sdk";

export async function extract({ client }: TaskHandlerArgs) {
const connection = await client.getConnection("sales_db");
Expand Down Expand Up @@ -151,7 +153,7 @@ entrypoint that serves them all:
```ts
import { salesDag } from "./sales/dag";
import { billingDag } from "./billing/dag";
import { DagRegistry, serveDags } from "@apache-airflow/ts-sdk";
import { DagRegistry, serveDags } from "apache-airflow-ts-sdk";

await serveDags(new DagRegistry(salesDag, billingDag));
```
Expand Down
15 changes: 8 additions & 7 deletions ts-sdk/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,24 @@ writing Apache Airflow task handlers and the coordinator runtime that executes
registered TypeScript handlers from an Airflow worker.

> **Note**
> This package is **alpha**: the API will change, it requires **Node 22+**, and
> it is **ESM-only**. It is not yet published to a public npm registry — until an
> official Apache Airflow release is available, build and use it from source.
> This package is **0.1.0-beta1**: the API may change, it requires **Node 22+**, and
> it is **ESM-only**.

## Getting Started

The SDK is currently distributed as source in the `ts-sdk/` directory of the
Apache Airflow repository. Build it there and add it as a local dependency of
your task bundle; it is not yet published to a public npm registry.
Install the beta package from npm:

```bash
npm install apache-airflow-ts-sdk@0.1.0-beta1
```

Define a Dag and register its task handlers. Handlers receive a `TaskContext`
and a `TaskClient`; any non-`undefined` return value is pushed to XCom under
the `"return_value"` key by the active runtime, matching Python `@task`
behavior:

```ts
import { Dag, DagRegistry, serveDags, type TaskHandlerArgs } from "@apache-airflow/ts-sdk";
import { Dag, DagRegistry, serveDags, type TaskHandlerArgs } from "apache-airflow-ts-sdk";

export async function sayHello({ ctx, client }: TaskHandlerArgs) {
const greeting = await client.getVariable("greeting");
Expand Down
4 changes: 2 additions & 2 deletions ts-sdk/docs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ts-sdk/docs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ts-sdk-docs-toolchain",
"version": "0.0.0",
"version": "0.1.0-beta1",
"private": true,
"description": "Documentation toolchain for the Apache Airflow TypeScript SDK (ts-sdk). TypeDoc renders the API reference straight to HTML with the clean-jsdoc-theme; it is kept in its own package so the docs-only dependencies stay out of the SDK's runtime and build toolchain.",
"type": "module",
Expand Down
6 changes: 3 additions & 3 deletions ts-sdk/example/package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "@apache-airflow/ts-sdk-example",
"name": "apache-airflow-ts-sdk-example",
"private": true,
"version": "0.0.0",
"version": "0.1.0-beta1",
"type": "module",
"license": "Apache-2.0",
"scripts": {
"build": "airflow-ts-pack src/main.ts --outdir dist",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@apache-airflow/ts-sdk": "file:.."
"apache-airflow-ts-sdk": "file:.."
},
"devDependencies": {
"@types/node": "^26.1.2",
Expand Down
2 changes: 1 addition & 1 deletion ts-sdk/example/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import { Dag, DagRegistry, serveDags, type TaskHandlerArgs } from "@apache-airflow/ts-sdk";
import { Dag, DagRegistry, serveDags, type TaskHandlerArgs } from "apache-airflow-ts-sdk";

const dag = new Dag("typescript_example");

Expand Down
7 changes: 5 additions & 2 deletions ts-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@apache-airflow/ts-sdk",
"version": "0.1.0-alpha.0",
"name": "apache-airflow-ts-sdk",
"version": "0.1.0-beta1",
"packageManager": "pnpm@10.28.1",
"description": "TypeScript Task SDK for Apache Airflow task handlers",
"license": "Apache-2.0",
Expand All @@ -19,6 +19,9 @@
"bugs": {
"url": "https://github.com/apache/airflow/issues"
},
"publishConfig": {
"tag": "beta"
},
"exports": {
".": {
"types": "./dist/index.d.ts",
Expand Down
34 changes: 17 additions & 17 deletions ts-sdk/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ts-sdk/src/sdk/brand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ export function hasBrand(value: unknown, name: string): boolean {

/** Tail shared by the errors reporting a second resolved copy. */
export const DUPLICATE_COPY_HINT =
"comes from a different copy of @apache-airflow/ts-sdk; deduplicate the dependency so one copy is resolved";
"comes from a different copy of apache-airflow-ts-sdk; deduplicate the dependency so one copy is resolved";
2 changes: 1 addition & 1 deletion ts-sdk/tests/public-api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ describe("public API", () => {
const foreign = {};
Object.defineProperty(foreign, Symbol.for("airflow.ts-sdk.DagRegistry"), { value: true });
await expect(serveDags(foreign as unknown as DagRegistry)).rejects.toThrow(
/different copy of @apache-airflow\/ts-sdk/,
/different copy of apache-airflow-ts-sdk/,
);
});

Expand Down
2 changes: 1 addition & 1 deletion ts-sdk/tests/sdk/registry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ describe("DagRegistry", () => {
const foreign = { dagId: "foreign_dag" };
Object.defineProperty(foreign, Symbol.for("airflow.ts-sdk.Dag"), { value: true });
expect(() => new DagRegistry(foreign as unknown as Dag)).toThrowError(
/different copy of @apache-airflow\/ts-sdk/,
/different copy of apache-airflow-ts-sdk/,
);
});

Expand Down
Loading