Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: improve docs/reference/types #685

Merged
merged 47 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
b6cc651
docs: refactor and set missing descriptions
afmika Apr 15, 2024
d57227e
docs: wasm, random (wip)
afmika Apr 16, 2024
7b01d0c
fix: consistent style
afmika Apr 16, 2024
f0dd5f5
docs: finalize
afmika Apr 17, 2024
4eebb5e
feat: improve sdk switcher
zifeo Feb 11, 2024
aded0f1
docs: refresh
zifeo Mar 25, 2024
05b2182
docs: refresh
zifeo Mar 25, 2024
749d46c
refactor: apply feedback
Yohe-Am Apr 17, 2024
c925f1a
fix: remove obsolete env
Yohe-Am Apr 17, 2024
1c6102b
fix: pin python version for tooling
Yohe-Am Apr 17, 2024
ca56e2a
fix: `pre-commit` issue
Yohe-Am Apr 18, 2024
7bccd05
fix: `pre-commit` issue 2
Yohe-Am Apr 18, 2024
1eb5549
fix: use correct version for each runtime
afmika Apr 18, 2024
9484dfe
fix(ci): bump `setup-ghjk` version (#680)
Yohe-Am Apr 18, 2024
fad55dc
wip
Natoandro Apr 18, 2024
e2f30f9
Merge branch 'docs' into update-docs/ref/types
Natoandro Apr 18, 2024
b2be55d
fix: address comments, fix broken broken link
afmika Apr 18, 2024
f4659f2
Merge branch 'main' into docs-runtime
afmika Apr 18, 2024
a02a08c
fix: typo
afmika Apr 18, 2024
51242ff
docs: define 'tiers'
afmika Apr 18, 2024
2222362
fix: typo and phrasing
afmika Apr 18, 2024
05fb25f
doc: types page
Natoandro Apr 19, 2024
cde8e34
Merge branch 'main' into docs
Natoandro Apr 19, 2024
0814c8c
Merge branch 'docs' into update-docs/ref/types
Natoandro Apr 19, 2024
ddd93d8
Hide importers doc
Natoandro Apr 19, 2024
57f4d29
docs: update injections reference
Natoandro Apr 19, 2024
fe9d2ec
docs: remove obsolete reducers section
Natoandro Apr 19, 2024
52c3bde
fix: address comments and add missed sections
afmika Apr 19, 2024
6d75934
Merge branch 'main' into docs-runtime
afmika Apr 19, 2024
290e808
fix: typos
afmika Apr 19, 2024
6d00643
docs: header_prefix
afmika Apr 19, 2024
224b03e
Merge branch 'main' into docs-runtime
afmika Apr 22, 2024
cc63de7
Merge branch 'main' into update-docs/ref/types
afmika Apr 22, 2024
b899d77
address comments
afmika Apr 22, 2024
d3f1f42
fix: disable playground
afmika Apr 22, 2024
555492c
docs: add dynamic injection
afmika Apr 22, 2024
5a2792c
fix: injection loc
afmika Apr 22, 2024
c67b509
fix: limit contraction usage
afmika Apr 22, 2024
a8f9d05
merge docs-runtimes
afmika Apr 22, 2024
9f09cd1
fix injection typegraph and add to test
afmika Apr 22, 2024
3ca2f41
rename types
afmika Apr 22, 2024
579f4e2
Merge branch 'main' into update-docs/ref/types
afmika Apr 23, 2024
3031087
fix: broken links
afmika Apr 23, 2024
3643a49
Merge branch 'main' into update-docs/ref/types
afmika Apr 24, 2024
f31b451
Merge branch 'main' into update-docs/ref/types
afmika Apr 24, 2024
faab2e4
feat(website): remove unnecessary awaits + fix random + add title to…
afmika Apr 25, 2024
cf77da1
fix(typegraphs): fix typegraph comparison
afmika Apr 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions .ghjk/lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
"version": "0.13.5",
"depConfigs": {
"tar_aa": {
"version": "1.34",
"version": "1.35",
"depConfigs": {},
"portRef": "tar_aa@0.1.0"
}
},
"portRef": "wasmedge_ghrel@0.1.0"
},
"9e3fa7742c431c34ae7ba8d1e907e50c937ccfb631fb4dcfb7a1773742abe267": {
"version": "1.34",
"version": "1.35",
"depConfigs": {},
"portRef": "tar_aa@0.1.0"
},
Expand All @@ -30,20 +30,20 @@
"version": "3.28.0-rc6",
"depConfigs": {
"curl_aa": {
"version": "8.2.1",
"version": "8.5.0",
"depConfigs": {},
"portRef": "curl_aa@0.1.0"
},
"git_aa": {
"version": "2.40.1",
"version": "2.43.0",
"depConfigs": {},
"portRef": "git_aa@0.1.0"
},
"asdf_plugin_git": {
"version": "d631481e96",
"depConfigs": {
"git_aa": {
"version": "2.40.1",
"version": "2.43.0",
"depConfigs": {},
"portRef": "git_aa@0.1.0"
}
Expand All @@ -63,20 +63,20 @@
"installType": "version"
},
"c7d12a562ecc8f3f95df5469ec0272561bc6715ebc41bcd82ba94f17a69a6fcb": {
"version": "8.2.1",
"version": "8.5.0",
"depConfigs": {},
"portRef": "curl_aa@0.1.0"
},
"0c719c533251d13d9e84b3113733c9dcd9e48f978c02f3fc4e14816080f7a69e": {
"version": "2.40.1",
"version": "2.43.0",
"depConfigs": {},
"portRef": "git_aa@0.1.0"
},
"9ffe0540cc740abe4bae8b926d9f53b78deee279a25c863e64e99263ee0ec7d1": {
"version": "d631481e96",
"depConfigs": {
"git_aa": {
"version": "2.40.1",
"version": "2.43.0",
"depConfigs": {},
"portRef": "git_aa@0.1.0"
}
Expand Down Expand Up @@ -109,7 +109,7 @@
"version": "1.27.0",
"depConfigs": {
"git_aa": {
"version": "2.40.1",
"version": "2.43.0",
"depConfigs": {},
"portRef": "git_aa@0.1.0"
}
Expand All @@ -132,7 +132,7 @@
"version": "1.27.0",
"depConfigs": {
"git_aa": {
"version": "2.40.1",
"version": "2.43.0",
"depConfigs": {},
"portRef": "git_aa@0.1.0"
}
Expand All @@ -147,7 +147,7 @@
"version": "1.27.0",
"depConfigs": {
"git_aa": {
"version": "2.40.1",
"version": "2.43.0",
"depConfigs": {},
"portRef": "git_aa@0.1.0"
}
Expand All @@ -169,7 +169,7 @@
"version": "1.27.0",
"depConfigs": {
"git_aa": {
"version": "2.40.1",
"version": "2.43.0",
"depConfigs": {},
"portRef": "git_aa@0.1.0"
}
Expand Down Expand Up @@ -200,7 +200,7 @@
"version": "1.27.0",
"depConfigs": {
"git_aa": {
"version": "2.40.1",
"version": "2.43.0",
"depConfigs": {},
"portRef": "git_aa@0.1.0"
}
Expand All @@ -220,7 +220,7 @@
"version": "v20.8.0",
"depConfigs": {
"tar_aa": {
"version": "1.34",
"version": "1.35",
"depConfigs": {},
"portRef": "tar_aa@0.1.0"
}
Expand All @@ -239,7 +239,7 @@
"version": "v20.8.0",
"depConfigs": {
"tar_aa": {
"version": "1.34",
"version": "1.35",
"depConfigs": {},
"portRef": "tar_aa@0.1.0"
}
Expand All @@ -257,7 +257,7 @@
"version": "v20.8.0",
"depConfigs": {
"tar_aa": {
"version": "1.34",
"version": "1.35",
"depConfigs": {},
"portRef": "tar_aa@0.1.0"
}
Expand All @@ -272,7 +272,7 @@
"version": "v2.4.0",
"depConfigs": {
"tar_aa": {
"version": "1.34",
"version": "1.35",
"depConfigs": {},
"portRef": "tar_aa@0.1.0"
}
Expand All @@ -284,7 +284,7 @@
"version": "3.8.18",
"depConfigs": {
"tar_aa": {
"version": "1.34",
"version": "1.35",
"depConfigs": {},
"portRef": "tar_aa@0.1.0"
},
Expand All @@ -309,7 +309,7 @@
"version": "3.12.2",
"depConfigs": {
"tar_aa": {
"version": "1.34",
"version": "1.35",
"depConfigs": {},
"portRef": "tar_aa@0.1.0"
},
Expand All @@ -330,7 +330,7 @@
"version": "3.12.2",
"depConfigs": {
"tar_aa": {
"version": "1.34",
"version": "1.35",
"depConfigs": {},
"portRef": "tar_aa@0.1.0"
},
Expand All @@ -350,7 +350,7 @@
"version": "3.12.2",
"depConfigs": {
"tar_aa": {
"version": "1.34",
"version": "1.35",
"depConfigs": {},
"portRef": "tar_aa@0.1.0"
},
Expand Down Expand Up @@ -387,7 +387,7 @@
"version": "1.27.0",
"depConfigs": {
"git_aa": {
"version": "2.40.1",
"version": "2.43.0",
"depConfigs": {},
"portRef": "git_aa@0.1.0"
}
Expand Down
4 changes: 2 additions & 2 deletions examples/typegraphs/faas-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { PythonRuntime } from "@typegraph/sdk/runtimes/python.js";

// skip:end

await typegraph({
typegraph({
name: "faas-runner",
// skip:next-line
cors: { allowOrigin: ["https://metatype.dev", "http://localhost:3000"] },
Expand All @@ -20,7 +20,7 @@ await typegraph({

g.expose({
pycumsum: python.fromLambda(inp, out, {
code: `lambda inp: sum(range(inp["n"])`,
code: `lambda inp: sum(range(inp["n"]))`,
}),
tscumsum: deno.func(
inp,
Expand Down
2 changes: 1 addition & 1 deletion examples/typegraphs/iam-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function getEnvOrDefault(key: string, defaultValue: string) {
}
// skip:end

await typegraph({
typegraph({
name: "iam-provider",
// skip:next-line
cors: { allowOrigin: ["https://metatype.dev", "http://localhost:3000"] },
Expand Down
2 changes: 1 addition & 1 deletion examples/typegraphs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { HttpRuntime } from "@typegraph/sdk/runtimes/http.js";

// skip:end

await typegraph({
typegraph({
name: "homepage",
// skip:start
rate: { windowLimit: 2000, windowSec: 60, queryLimit: 200, localExcess: 0 },
Expand Down
35 changes: 35 additions & 0 deletions examples/typegraphs/injections.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
from typegraph import Policy, typegraph, t, Graph
from typegraph.runtimes.deno import DenoRuntime


@typegraph()
def injection_example(g: Graph):
deno = DenoRuntime()
pub = Policy.public()

g.expose(
get_injected=deno.func(
t.struct(
{
"static_value": t.integer().set(12),
"context_value": t.uuid().from_context("profile.userId"),
"secret_value": t.string().from_secret("secret_name"),
"dynamic_value": t.datetime().inject("now"),
}
).rename("Input"),
t.struct(
{
"static_value": t.integer().rename("Static"),
"context_value": t.uuid(),
"secret_value": t.string(),
"nested": deno.identity(
t.struct({"parent_value": t.integer().from_parent("Static")}),
),
"dynamic_value": t.datetime(),
}
).rename("Output"),
code="""
({ static_value, context_value, secret_value, dynamic_value }) => ({ static_value, context_value, secret_value, dynamic_value })
""",
).with_policy(pub)
)
34 changes: 34 additions & 0 deletions examples/typegraphs/injections.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { Policy, t, typegraph } from "@typegraph/sdk";
import { DenoRuntime } from "@typegraph/sdk/runtimes/deno.js";

typegraph("injection-example", (g) => {
const deno = new DenoRuntime();
const pub = Policy.public();

g.expose({
get_injected: deno.func(
t.struct({
static_value: t.integer().set(12),
context_value: t.uuid().fromContext("profile.userId"),
secret_value: t.string().fromSecret("secret_name"),
dynamic_value: t.datetime().inject("now"),
}).rename("Input"),
t.struct({
static_value: t.integer().rename("Static"),
context_value: t.uuid(),
secret_value: t.string(),
nested: deno.identity(
t.struct({
parent_value: t.integer().fromParent("Static"),
}),
),
dynamic_value: t.datetime(),
}).rename("Output"),
{
code: (
{ static_value, context_value, secret_value, dynamic_value },
) => ({ static_value, context_value, secret_value, dynamic_value }),
},
).withPolicy(pub),
});
});
2 changes: 1 addition & 1 deletion examples/typegraphs/jwt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { DenoRuntime } from "@typegraph/sdk/runtimes/deno.js";

// skip:end

await typegraph({
typegraph({
name: "jwt-authentication",
// skip:next-line
cors: { allowOrigin: ["https://metatype.dev", "http://localhost:3000"] },
Expand Down
2 changes: 1 addition & 1 deletion examples/typegraphs/math.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Policy, t, typegraph } from "@typegraph/sdk/index.js";
// skip:end
import { DenoRuntime } from "@typegraph/sdk/runtimes/deno.js";

await typegraph({
typegraph({
name: "math",
// skip:start
rate: { windowLimit: 2000, windowSec: 60, queryLimit: 200, localExcess: 0 },
Expand Down
2 changes: 1 addition & 1 deletion examples/typegraphs/microservice-orchestration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function getEnvOrDefault(key: string, defaultValue: string) {
}
// skip:end

await typegraph({
typegraph({
name: "team-a",
// skip:next-line
cors: { allowOrigin: ["https://metatype.dev", "http://localhost:3000"] },
Expand Down
2 changes: 1 addition & 1 deletion examples/typegraphs/oauth2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { DenoRuntime } from "@typegraph/sdk/runtimes/deno.js";

// skip:end

await typegraph({
typegraph({
name: "oauth2-authentication",
// skip:next-line
cors: { allowOrigin: ["https://metatype.dev", "http://localhost:3000"] },
Expand Down
2 changes: 1 addition & 1 deletion examples/typegraphs/policies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Auth } from "@typegraph/sdk/params.js";
import { DenoRuntime } from "@typegraph/sdk/runtimes/deno.js";
import { RandomRuntime } from "@typegraph/sdk/runtimes/random.js";

await typegraph({
typegraph({
name: "policies",
cors: { allowOrigin: ["https://metatype.dev", "http://localhost:3000"] },
}, (g) => {
Expand Down
2 changes: 1 addition & 1 deletion examples/typegraphs/prisma-runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { PrismaRuntime } from "@typegraph/sdk/providers/prisma.js";

// skip:end

await typegraph({
typegraph({
name: "prisma-runtime",
cors: {
// skip:start
Expand Down
2 changes: 1 addition & 1 deletion examples/typegraphs/prisma.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Policy, t, typegraph } from "@typegraph/sdk/index.js";
import { PrismaRuntime } from "@typegraph/sdk/providers/prisma.js";

await typegraph({
typegraph({
name: "roadmap-prisma",
// skip:next-line
cors: { allowOrigin: ["https://metatype.dev", "http://localhost:3000"] },
Expand Down
2 changes: 1 addition & 1 deletion examples/typegraphs/programmable-api-gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { DenoRuntime } from "@typegraph/sdk/runtimes/deno.js";

// skip:end

await typegraph({
typegraph({
name: "programmable-api-gateway",
// skip:next-line
cors: { allowOrigin: ["https://metatype.dev", "http://localhost:3000"] },
Expand Down
2 changes: 1 addition & 1 deletion examples/typegraphs/quick-start-project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { DenoRuntime } from "@typegraph/sdk/runtimes/deno.js";
import { PythonRuntime } from "@typegraph/sdk/runtimes/python.js";
import { PrismaRuntime } from "@typegraph/sdk/providers/prisma.js";

await typegraph("example", (g) => {
typegraph("example", (g) => {
// access control
const pub = Policy.public();

Expand Down
Loading