-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Marcos Candeia <[email protected]>
- Loading branch information
Showing
3 changed files
with
29 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"; | ||
|
@@ -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) { | ||
|
@@ -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 | ||
|
@@ -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<TArgs, TResult, TMetadata>, | ||
) => TCtx, | ||
): Handler => { | ||
): Deno.ServeHandler => { | ||
const authority = initializeAuthority(defaultOpts); | ||
const runner = workflowRemoteRunner<TArgs, TResult, TCtx, TMetadata>( | ||
workflow, | ||
|