shivaam commented on code in PR #67908:
URL: https://github.com/apache/airflow/pull/67908#discussion_r3478400806


##########
ts-sdk/README.md:
##########
@@ -0,0 +1,137 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ -->
+
+# Airflow TypeScript SDK
+
+Public TypeScript interfaces for writing Apache Airflow task handlers.
+
+**Status:** alpha · API will change · Node 22+ · ESM-only
+
+This package defines the user-facing task handler contract: task registration,
+runtime context types, and the `TaskClient` interface used for Airflow
+Variables, Connections, and XCom. Runtime transports implement this interface
+separately.
+
+## Install
+
+```bash
+pnpm add @apache-airflow/ts-sdk
+```
+
+## Task Handlers
+
+```ts
+import { registerTask } from "@apache-airflow/ts-sdk";
+
+registerTask({ dagId: "example_dag", taskId: "say_hello" }, async ({ ctx, 
client }) => {

Review Comment:
   Yes, the current interface should be compatible with future Dag authoring in 
the TypeScript SDK. My thinking is that registerTask can be the minimal 
interface for the current Python stub Dag mode: TypeScript binds a handler to 
an existing Airflow Dag/task, but does not declare the Dag yet.
   In the future, we can introduce a Dag-shaped API that uses the same 
registration primitive underneath. Users could then choose either the explicit 
registerTask form or the Dag-shaped API, and both would remain compatible.
   
   ```
   const dag = registerDag("sales_pipeline");
   dag.task("extract", extract);
   ```



##########
ts-sdk/src/sdk/client.ts:
##########
@@ -0,0 +1,88 @@
+/*!
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import type { ConnectionResult, GetXComOpts, SetXComOpts } from 
"./client-types.js";

Review Comment:
   Good point. I moved the public implementation files under ts-sdk/src/sdk/ 
and kept ts-sdk/src/index.ts as the package-root re-export, so users still 
import from @apache-airflow/ts-sdk.
   This keeps the user-facing SDK surface separate from future runtime 
internals. Later coordinator/runtime/bundle code can live under sibling folders 
such as 
   
   ```
   ts-sdk/src/index.ts          # public package entrypoint
   ts-sdk/src/sdk/              # public task-authoring API implementation
   ts-sdk/src/coordinator/      # coordinator runtime internals
   ts-sdk/src/bundle/           # bundle/build tooling internals
   ts-sdk/src/generated/        # generated protocol/schema types
   ```
   Let me know if you were thinking something else. 



##########
.pre-commit-config.yaml:
##########
@@ -239,6 +239,21 @@ repos:
           ^pyproject\.toml$
         pass_filenames: false
         require_serial: true
+      - id: ts-sdk-lint

Review Comment:
   Good point. I moved the TS SDK hook implementation under 
`ts-sdk/scripts/ci/prek/`.
   
   The root `.pre-commit-config.yaml` still registers the `ts-sdk-lint` hook so 
root-level prek and CI can discover it, but the SDK-specific implementation now 
lives with the SDK code.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to