Skip to content

Commit

Permalink
Publish on JSR
Browse files Browse the repository at this point in the history
Signed-off-by: Marcos Candeia <[email protected]>
  • Loading branch information
mcandeia committed Aug 7, 2024
1 parent 9cd8aa9 commit 899c2f4
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 9 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions jsr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "@deco/durable",
"version": "0.5.3",
"exports": "./sdk/deno/mod.ts"
}
14 changes: 5 additions & 9 deletions sdk/deno/handler.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
// deno-lint-ignore-file no-explicit-any
import type {
ConnInfo,
Handler,
} from "https://deno.land/[email protected]/http/server.ts";
import { defaultOpts } from "../../client/init.ts";
import { Metadata } from "../../context.ts";
import { verify } from "../../djwt.js";
Expand Down Expand Up @@ -168,7 +164,7 @@ export const workflowHTTPHandler = <
Context: (
execution: WorkflowExecution<TArgs, TResult, TMetadata>,
) => TCtx,
): Handler => {
): Deno.ServeHandler => {
const authority = initializeAuthority(defaultOpts);
const runner = workflowRemoteRunner(workflow, Context);
return async function (req) {
Expand Down Expand Up @@ -215,8 +211,8 @@ export type Workflows = Array<Workflow<any, any, any> | AliasedWorkflow>;
export const useWorkflowRoutes = (
{ baseRoute }: CreateRouteOptions,
workflows: Workflows,
): Handler => {
const routes: Record<string, Handler> = {};
): Deno.ServeHandler => {
const routes: Record<string, Deno.ServeHandler> = {};
for (const wkflow of workflows) {
const { alias, func } = isAlisedWorkflow(wkflow)
? wkflow
Expand All @@ -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) {
Expand Down Expand Up @@ -291,7 +287,7 @@ export const workflowWebSocketHandler = <
Context: (
execution: WorkflowExecution<TArgs, TResult, TMetadata>,
) => TCtx,
): Handler => {
): Deno.ServeHandler => {
const authority = initializeAuthority(defaultOpts);
const runner = workflowRemoteRunner<TArgs, TResult, TCtx, TMetadata>(
workflow,
Expand Down

0 comments on commit 899c2f4

Please sign in to comment.