From 899c2f4c7bab0ce1cdd0469ac2edd3ef7ceb1c45 Mon Sep 17 00:00:00 2001 From: Marcos Candeia Date: Tue, 6 Aug 2024 21:58:03 -0300 Subject: [PATCH] Publish on JSR Signed-off-by: Marcos Candeia --- .github/workflows/publish.yaml | 19 +++++++++++++++++++ jsr.json | 5 +++++ sdk/deno/handler.ts | 14 +++++--------- 3 files changed, 29 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/publish.yaml create mode 100644 jsr.json diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..9259173 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,19 @@ +name: Publish +on: + push: + branches: + - main + +jobs: + publish: + runs-on: ubuntu-latest + + permissions: + contents: read + id-token: write + + steps: + - uses: actions/checkout@v4 + + - name: Publish package + run: npx jsr publish \ No newline at end of file diff --git a/jsr.json b/jsr.json new file mode 100644 index 0000000..2963cf6 --- /dev/null +++ b/jsr.json @@ -0,0 +1,5 @@ +{ + "name": "@deco/durable", + "version": "0.5.3", + "exports": "./sdk/deno/mod.ts" + } \ No newline at end of file diff --git a/sdk/deno/handler.ts b/sdk/deno/handler.ts index fffe4ac..11db1be 100644 --- a/sdk/deno/handler.ts +++ b/sdk/deno/handler.ts @@ -1,8 +1,4 @@ // deno-lint-ignore-file no-explicit-any -import type { - ConnInfo, - Handler, -} from "https://deno.land/std@0.173.0/http/server.ts"; import { defaultOpts } from "../../client/init.ts"; import { Metadata } from "../../context.ts"; import { verify } from "../../djwt.js"; @@ -168,7 +164,7 @@ export const workflowHTTPHandler = < Context: ( execution: WorkflowExecution, ) => TCtx, -): Handler => { +): Deno.ServeHandler => { const authority = initializeAuthority(defaultOpts); const runner = workflowRemoteRunner(workflow, Context); return async function (req) { @@ -215,8 +211,8 @@ export type Workflows = Array | AliasedWorkflow>; export const useWorkflowRoutes = ( { baseRoute }: CreateRouteOptions, workflows: Workflows, -): Handler => { - const routes: Record = {}; +): Deno.ServeHandler => { + const routes: Record = {}; for (const wkflow of workflows) { const { alias, func } = isAlisedWorkflow(wkflow) ? wkflow @@ -227,7 +223,7 @@ export const useWorkflowRoutes = ( (execution) => new WorkflowContext(execution), ); } - return (req: Request, conn: ConnInfo) => { + return (req: Request, conn: Deno.ServeHandlerInfo) => { const url = new URL(req.url); const handler = routes[url.pathname]; if (!handler) { @@ -291,7 +287,7 @@ export const workflowWebSocketHandler = < Context: ( execution: WorkflowExecution, ) => TCtx, -): Handler => { +): Deno.ServeHandler => { const authority = initializeAuthority(defaultOpts); const runner = workflowRemoteRunner( workflow,