Skip to content

Commit

Permalink
exclude kv typegraphs
Browse files Browse the repository at this point in the history
  • Loading branch information
j03-dev committed Aug 13, 2024
1 parent 21dbe42 commit 4ed8246
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 13 deletions.
2 changes: 2 additions & 0 deletions examples/metatype.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,11 @@ typegraphs:
exclude:
- "**/*"
- "typegraphs/temporal.py"
- "typegraphs/kv.py"
typescript:
exclude:
- "typegraphs/temporal.ts"
- "typegraphs/kv.ts"
include:
- "typegraphs/*.ts"
javascript:
Expand Down
9 changes: 7 additions & 2 deletions examples/typegraphs/kv.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
# skip:start
from typegraph import Graph, Policy, typegraph
from typegraph.graph.params import Cors
from typegraph.runtimes.kv import KvRuntime

# skip:end


@typegraph()
def kv(g: Graph):
@typegraph(
# skip:start
cors=Cors(allow_origin=["https://metatype.dev", "http://localhost:3000"]),
# skip:end
)
def key_value(g: Graph):
kv = KvRuntime("REDIS")

g.expose(
Expand Down
29 changes: 18 additions & 11 deletions examples/typegraphs/kv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,21 @@ import { KvRuntime } from "@typegraph/sdk/runtimes/kv.ts";

// skip:end

export const tg = await typegraph("kv", (g: any) => {
const kv = new KvRuntime("REDIS");
const pub = Policy.public();
g.expose({
get: kv.get(),
set: kv.set(),
delete: kv.delete(),
keys: kv.keys(),
values: kv.values(),
}, pub);
});
export const tg = await typegraph(
{
name: "key-value",
// skip:next-line
cors: { allowOrigin: ["https://metatype.dev", "http://localhost:3000"] },
},
(g) => {
const kv = new KvRuntime("REDIS");
const pub = Policy.public();
g.expose({
get: kv.get(),
set: kv.set(),
delete: kv.delete(),
keys: kv.keys(),
values: kv.values(),
}, pub);
},
);

0 comments on commit 4ed8246

Please sign in to comment.