Skip to content

Commit

Permalink
Rename factory to proxy
Browse files Browse the repository at this point in the history
Signed-off-by: Marcos Candeia <marrcooos@gmail.com>
  • Loading branch information
mcandeia committed Sep 23, 2024
1 parent a34a8b7 commit 49b9668
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"name": "@deco/actors",
"exports": {
".": "./src/actors/mod.ts",
"./hono": "./src/actors/hono/middleware.ts"
"./hono": "./src/actors/hono/middleware.ts",
"./proxy": "./src/actors/factory.ts"
},
"imports": {
"@core/asyncutil": "jsr:@core/asyncutil@^1.1.1",
Expand Down
7 changes: 7 additions & 0 deletions src/actors/factory.ts → src/actors/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import {
type ActorConstructor,
} from "./runtime.ts";

/**
* options to create a new actor proxy.
*/
export interface ProxyOptions<TInstance extends Actor> {
actor: ActorConstructor<TInstance> | string;
server: string;
Expand All @@ -15,6 +18,10 @@ type Promisify<Actor> = {
: (...args: Args) => Promise<Return>
: Actor[key];
};

/**
* utilities to create and manage actors.
*/
export const actors = {
proxy: <TInstance extends Actor>(c: ProxyOptions<TInstance>) => {
return {
Expand Down
2 changes: 1 addition & 1 deletion src/actors/runtime.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { assertEquals } from "@std/assert";
import { actors } from "./factory.ts";
import { actors } from "./proxy.ts";
import { ActorRuntime } from "./runtime.ts";
import type { ActorState } from "./state.ts";

Expand Down

0 comments on commit 49b9668

Please sign in to comment.