- Build backend components with WASM,
- {" "}
- Typescript and{" "}
- Python, no matter where and how your (legacy) systems
- are.
+ Build backend components with WASM,{" "}
+ Typescript and Python, no matter
+ where and how your (legacy) systems are.
castle building
- And castle building is{" "}
- hard. Even the best teams can struggle to build
- according to the plans, especially with the ever evolving needs and
- the tech landscape complexities.
+ And castle building is hard. Even the best teams can
+ struggle to build according to the plans, especially with the ever
+ evolving needs and the tech landscape complexities.
}>
@@ -111,9 +108,9 @@ function Stability(): JSX.Element {
typegraphs
- Typegraphs are programmable virtual graphs{" "}
- describing all the components of your stack. They enable you to
- compose APIs, storage and business logic in a type safe manner.
+ Typegraphs are programmable virtual graphs describing
+ all the components of your stack. They enable you to compose APIs,
+ storage and business logic in a type safe manner.
}>
@@ -135,8 +132,8 @@ function Modularity(): JSX.Element {
typegate
- Typegate is a GraphQL/REST composition engine{" "}
- that compiles, optimizes, runs and caches queries over typegraphs. It
+ Typegate is a GraphQL/REST composition engine that
+ compiles, optimizes, runs and caches queries over typegraphs. It
enforces authentication, authorization and security for you.
@@ -159,10 +156,9 @@ function Reusability(): JSX.Element {
Metatype
- Install third parties as dependencies{" "}
- and start reusing components. The Meta CLI offers you live reloading
- and one-command deployment to Metatype cloud or your self-hosted
- instance.
+ Install third parties as dependencies and start
+ reusing components. The Meta CLI offers you live reloading and
+ one-command deployment to Metatype cloud or your self-hosted instance.
}>
@@ -283,12 +279,8 @@ function TryIt(): JSX.Element {
in hours
- Watch the 3 minutes introduction{" "}
- of the Metatype platform and start designing your own typegraph. Once
- you have understood the basics, you already feel productive.
+ Watch the 3 minutes introduction of the Metatype
+ platform and start designing your own typegraph. Once you have
+ understood the basics, you already feel productive.
diff --git a/docs/metatype.dev/src/states/package_manager.ts b/docs/metatype.dev/src/states/package_manager.ts
index d369d7a644..b8a9cd59a5 100644
--- a/docs/metatype.dev/src/states/package_manager.ts
+++ b/docs/metatype.dev/src/states/package_manager.ts
@@ -20,8 +20,8 @@ const tsPmQueryAtom = atom(
(get) =>
get(locationAtom).searchParams?.get(tsKey) as TsPackageManager | null,
(get, set, value: TsPackageManager) => {
- const searchParams = get(locationAtom).searchParams ??
- new URLSearchParams();
+ const searchParams =
+ get(locationAtom).searchParams ?? new URLSearchParams();
searchParams.set(tsKey, value);
set(locationAtom, (prev) => ({
...prev,
@@ -36,8 +36,8 @@ const pythonPmQueryAtom = atom(
pythonKey,
) as PythonPackageManager | null,
(get, set, value: TsPackageManager) => {
- const searchParams = get(locationAtom).searchParams ??
- new URLSearchParams();
+ const searchParams =
+ get(locationAtom).searchParams ?? new URLSearchParams();
searchParams.set(pythonKey, value);
set(locationAtom, (prev) => ({
...prev,
diff --git a/docs/metatype.dev/src/states/sdk.ts b/docs/metatype.dev/src/states/sdk.ts
index 7724b28c7e..800735dde7 100644
--- a/docs/metatype.dev/src/states/sdk.ts
+++ b/docs/metatype.dev/src/states/sdk.ts
@@ -15,8 +15,8 @@ const locationAtom = atomWithLocation();
const sdkQueryAtom = atom(
(get) => get(locationAtom).searchParams?.get(key) as SDK | null,
(get, set, value: SDK) => {
- const searchParams = get(locationAtom).searchParams ??
- new URLSearchParams();
+ const searchParams =
+ get(locationAtom).searchParams ?? new URLSearchParams();
searchParams.set(key, value);
set(locationAtom, (prev) => ({
...prev,
diff --git a/examples/deno.jsonc b/examples/deno.jsonc
index 1ce1410442..9d5290c1b3 100644
--- a/examples/deno.jsonc
+++ b/examples/deno.jsonc
@@ -1,5 +1,12 @@
{
"imports": {
"@typegraph/sdk/": "../src/typegraph/deno/src/"
+ },
+ "lint": {
+ "rules": {
+ "exclude": [
+ "no-explicit-any"
+ ]
+ }
}
}
diff --git a/examples/deploy/deploy.ts b/examples/deploy/deploy.ts
index fd1891080b..d120f887c2 100644
--- a/examples/deploy/deploy.ts
+++ b/examples/deploy/deploy.ts
@@ -1,3 +1,6 @@
+// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
+// SPDX-License-Identifier: MPL-2.0
+
import { Policy, t, typegraph } from "@typegraph/sdk";
import { DenoRuntime } from "@typegraph/sdk/runtimes/deno";
import { PythonRuntime } from "@typegraph/sdk/runtimes/python";
@@ -20,7 +23,7 @@ const tg = await typegraph(
id: t.integer({}, { asId: true }),
name: t.string(),
},
- { name: "Student" }
+ { name: "Student" },
);
g.expose(
@@ -38,7 +41,7 @@ const tg = await typegraph(
sayHelloPyLambda: python.fromLambda(
t.struct({ name: t.string() }),
t.string(),
- { code: `lambda obj: f"Hello {obj['name']} from python lambda"` }
+ { code: `lambda obj: f"Hello {obj['name']} from python lambda"` },
),
sayHelloPyMod: python.import(
t.struct({ name: t.string() }),
@@ -47,15 +50,15 @@ const tg = await typegraph(
module: "scripts/python/say_hello.py",
name: "sayHello",
deps: ["scripts/python/import_.py"],
- }
+ },
),
// Prisma
createStudent: prisma.create(student),
findManyStudent: prisma.findMany(student),
},
- pub
+ pub,
);
- }
+ },
);
const artifactsConfig = {
@@ -70,7 +73,7 @@ const artifactsConfig = {
const baseUrl = "http://localhost:7890";
const auth = new BasicAuth("admin", "password");
-const { response, serialized } = await tgDeploy(tg, {
+const { response, serialized: _ } = await tgDeploy(tg, {
typegate: {
url: baseUrl,
auth,
@@ -81,8 +84,6 @@ const { response, serialized } = await tgDeploy(tg, {
typegraphPath: "./deploy.ts",
});
-// console.log(serialized);
-
const { migrations, messages } = response;
// migration status.. etc
diff --git a/examples/templates/node/api/example.ts b/examples/templates/node/api/example.ts
index 206b3529be..094c04136e 100644
--- a/examples/templates/node/api/example.ts
+++ b/examples/templates/node/api/example.ts
@@ -12,7 +12,7 @@ typegraph("example", (g) => {
.fromLambda(
t.struct({ first: t.float(), second: t.float() }),
t.float(),
- { code: "lambda x: x['first'] + x['second']" }
+ { code: "lambda x: x['first'] + x['second']" },
)
.withPolicy(pub),
multiply: deno
diff --git a/examples/templates/node/tsconfig.json b/examples/templates/node/tsconfig.json
index 999217dd3c..8654230394 100644
--- a/examples/templates/node/tsconfig.json
+++ b/examples/templates/node/tsconfig.json
@@ -1,8 +1,8 @@
{
- "compilerOptions": {
- "strict": true,
- "moduleResolution": "node16",
- "module": "Node16",
- "esModuleInterop": true
- }
+ "compilerOptions": {
+ "strict": true,
+ "moduleResolution": "node16",
+ "module": "Node16",
+ "esModuleInterop": true
+ }
}
diff --git a/examples/typegraphs/authentication.ts b/examples/typegraphs/authentication.ts
index d32b3b990c..740e5c51e9 100644
--- a/examples/typegraphs/authentication.ts
+++ b/examples/typegraphs/authentication.ts
@@ -32,9 +32,9 @@ await typegraph(
code: "(_: any, ctx: any) => Deno.inspect(ctx.context)",
}),
},
- Policy.public()
+ Policy.public(),
);
// skip:start
- }
+ },
);
// skip:end
diff --git a/examples/typegraphs/basic.ts b/examples/typegraphs/basic.ts
index 529e49c669..86edbe9f34 100644
--- a/examples/typegraphs/basic.ts
+++ b/examples/typegraphs/basic.ts
@@ -30,5 +30,5 @@ await typegraph(
})
.withPolicy(pub),
});
- }
+ },
);
diff --git a/examples/typegraphs/cors.ts b/examples/typegraphs/cors.ts
index dedb2c5bdf..296ba3cc77 100644
--- a/examples/typegraphs/cors.ts
+++ b/examples/typegraphs/cors.ts
@@ -24,7 +24,7 @@ await typegraph(
{
catch_me_if_you_can: random.gen(t.string()),
},
- Policy.public()
+ Policy.public(),
);
- }
+ },
);
diff --git a/examples/typegraphs/database.ts b/examples/typegraphs/database.ts
index 1e08a76bcb..364a34a220 100644
--- a/examples/typegraphs/database.ts
+++ b/examples/typegraphs/database.ts
@@ -24,7 +24,7 @@ await typegraph(
body: t.string(),
},
// highlight-next-line
- { name: "message" }
+ { name: "message" },
);
g.expose(
@@ -33,7 +33,7 @@ await typegraph(
create_message: db.create(message),
list_messages: db.findMany(message),
},
- pub
+ pub,
);
- }
+ },
);
diff --git a/examples/typegraphs/deno.ts b/examples/typegraphs/deno.ts
index be47cd8f14..c69762936e 100644
--- a/examples/typegraphs/deno.ts
+++ b/examples/typegraphs/deno.ts
@@ -33,14 +33,14 @@ await typegraph(
};
}
`,
- }
+ },
);
g.expose(
{
compute_fib: fib,
},
- pub
+ pub,
);
- }
+ },
);
diff --git a/examples/typegraphs/example_rest.ts b/examples/typegraphs/example_rest.ts
index a9280af9be..b0a5c3c81a 100644
--- a/examples/typegraphs/example_rest.ts
+++ b/examples/typegraphs/example_rest.ts
@@ -19,7 +19,7 @@ await typegraph(
id: t.integer(),
author: user,
},
- { name: "Post" }
+ { name: "Post" },
);
// skip:end
@@ -41,9 +41,9 @@ await typegraph(
}
}
}
- `
+ `,
);
// highlight-end
// skip:start
- }
+ },
);
diff --git a/examples/typegraphs/faas-runner.ts b/examples/typegraphs/faas-runner.ts
index 933a0e500a..5d840c82b7 100644
--- a/examples/typegraphs/faas-runner.ts
+++ b/examples/typegraphs/faas-runner.ts
@@ -26,10 +26,11 @@ typegraph(
code: `lambda inp: sum(range(inp['n']))`,
}),
tscumsum: deno.func(inp, out, {
- code: "({n}) => Array.from(Array(5).keys()).reduce((sum, e) => sum + e, 0)",
+ code:
+ "({n}) => Array.from(Array(5).keys()).reduce((sum, e) => sum + e, 0)",
}),
},
- pub
+ pub,
);
- }
+ },
);
diff --git a/examples/typegraphs/files-upload.ts b/examples/typegraphs/files-upload.ts
index 047bc52b39..aea8bc1edf 100644
--- a/examples/typegraphs/files-upload.ts
+++ b/examples/typegraphs/files-upload.ts
@@ -23,11 +23,11 @@ await typegraph(
signUploadUrl: s3.presignPut({ bucket: "examples" }),
upload: s3.upload(
"examples",
- t.file({ allow: ["image/png", "image/jpeg"] })
+ t.file({ allow: ["image/png", "image/jpeg"] }),
),
uploadMany: s3.uploadAll("examples"),
},
- Policy.public()
+ Policy.public(),
);
- }
+ },
);
diff --git a/examples/typegraphs/first-typegraph.ts b/examples/typegraphs/first-typegraph.ts
index b7ad5b7855..3d46e76c5d 100644
--- a/examples/typegraphs/first-typegraph.ts
+++ b/examples/typegraphs/first-typegraph.ts
@@ -25,7 +25,7 @@ await typegraph(
// input → output via runtime function
get_message: random.gen(message),
},
- pub
+ pub,
);
- }
+ },
);
diff --git a/examples/typegraphs/func-ctx.ts b/examples/typegraphs/func-ctx.ts
index 2e7f8c5ff7..1e388fcb59 100644
--- a/examples/typegraphs/func-ctx.ts
+++ b/examples/typegraphs/func-ctx.ts
@@ -48,11 +48,11 @@ await typegraph(
headers: Object.entries(ctx.headers),
secrets: Object.entries(ctx.secrets),
}),
- }
+ },
),
},
- Policy.public()
+ Policy.public(),
);
// skip:start
- }
+ },
);
diff --git a/examples/typegraphs/func.ts b/examples/typegraphs/func.ts
index e010cb8aec..9f44056ff6 100644
--- a/examples/typegraphs/func.ts
+++ b/examples/typegraphs/func.ts
@@ -27,7 +27,7 @@ await typegraph(
name: t.string(),
ideas: t.list(g.ref("idea")),
},
- { name: "bucket" }
+ { name: "bucket" },
);
const idea = t.struct(
@@ -38,7 +38,7 @@ await typegraph(
votes: t.list(g.ref("vote")),
bucket: g.ref("bucket"),
},
- { name: "idea" }
+ { name: "idea" },
);
const vote = t.struct(
@@ -49,14 +49,14 @@ await typegraph(
desc: t.string().optional(),
idea: g.ref("idea"),
},
- { name: "vote" }
+ { name: "vote" },
);
g.auth(Auth.basic(["andim"]));
const admins = deno.policy(
"admins",
- "(_args, { context }) => !!context.username"
+ "(_args, { context }) => !!context.username",
);
// skip:end
@@ -82,7 +82,7 @@ await typegraph(
name: "parse",
}),
},
- pub
+ pub,
);
// skip:start
@@ -99,7 +99,7 @@ await typegraph(
}
}
}
- `
+ `,
);
g.rest(
@@ -117,8 +117,8 @@ await typegraph(
}
}
}
- `
+ `,
);
// skip:end
- }
+ },
);
diff --git a/examples/typegraphs/http-runtime.ts b/examples/typegraphs/http-runtime.ts
index 2090af3984..9bb2374523 100644
--- a/examples/typegraphs/http-runtime.ts
+++ b/examples/typegraphs/http-runtime.ts
@@ -33,7 +33,7 @@ await typegraph(
}),
{
path: "/random",
- }
+ },
),
facts_as_text: facts.get(
t.struct({
@@ -41,10 +41,10 @@ await typegraph(
language: t.enum_(["en", "de"]),
}),
t.string(),
- { path: "/random", headerPrefix: "header_" }
+ { path: "/random", headerPrefix: "header_" },
),
},
- pub
+ pub,
);
- }
+ },
);
diff --git a/examples/typegraphs/iam-provider.ts b/examples/typegraphs/iam-provider.ts
index 86c74f7b2b..6b25e8a26b 100644
--- a/examples/typegraphs/iam-provider.ts
+++ b/examples/typegraphs/iam-provider.ts
@@ -27,9 +27,11 @@ typegraph(
const deno = new DenoRuntime();
const host = getEnvOrDefault("TG_URL", "http://localhost:7890");
- const url = `${host}/iam-provider/auth/github?redirect_uri=${encodeURIComponent(
- host
- )}`;
+ const url = `${host}/iam-provider/auth/github?redirect_uri=${
+ encodeURIComponent(
+ host,
+ )
+ }`;
g.expose(
{
@@ -39,11 +41,12 @@ typegraph(
t.struct({}),
t.struct({ username: t.string() }).optional(),
{
- code: "(_, { context }) => Object.keys(context).length === 0 ? null : context",
- }
+ code:
+ "(_, { context }) => Object.keys(context).length === 0 ? null : context",
+ },
),
},
- pub
+ pub,
);
- }
+ },
);
diff --git a/examples/typegraphs/jwt.ts b/examples/typegraphs/jwt.ts
index 82fd389973..cc396ae5ed 100644
--- a/examples/typegraphs/jwt.ts
+++ b/examples/typegraphs/jwt.ts
@@ -27,7 +27,7 @@ typegraph(
your_own_content: g.fromContext("your_own_content"),
}),
},
- pub
+ pub,
);
- }
+ },
);
diff --git a/examples/typegraphs/math.ts b/examples/typegraphs/math.ts
index bdec25bdfe..45db028804 100644
--- a/examples/typegraphs/math.ts
+++ b/examples/typegraphs/math.ts
@@ -24,7 +24,7 @@ await typegraph(
// the policy implementation is based on functions itself
const restrict_referer = deno.policy(
"restrict_referer_policy",
- '(_, context) => context.headers.referer && ["localhost", "metatype.dev"].includes(new URL(context.headers.referer).hostname)'
+ '(_, context) => context.headers.referer && ["localhost", "metatype.dev"].includes(new URL(context.headers.referer).hostname)',
);
// or we can point to a local file that's accessible to the meta-cli
@@ -42,15 +42,15 @@ await typegraph(
randomItem: deno.func(
t.struct({ items: t.list(t.string()) }),
t.string(),
- { code: random_item_fn }
+ { code: random_item_fn },
),
random: deno.func(
t.struct({}),
t.float(),
- { code: "() => Math.random()" } // more inline code
+ { code: "() => Math.random()" }, // more inline code
),
},
- pub
+ pub,
);
- }
+ },
);
diff --git a/examples/typegraphs/metagen-py.ts b/examples/typegraphs/metagen-py.ts
index 5de27f2490..924932199b 100644
--- a/examples/typegraphs/metagen-py.ts
+++ b/examples/typegraphs/metagen-py.ts
@@ -32,7 +32,7 @@ await typegraph(
})
.rename("remix_track"), // explicit names help
},
- Policy.public()
+ Policy.public(),
);
- }
+ },
);
diff --git a/examples/typegraphs/metagen-rs.ts b/examples/typegraphs/metagen-rs.ts
index 3d0142d801..e4e3f74c3e 100644
--- a/examples/typegraphs/metagen-rs.ts
+++ b/examples/typegraphs/metagen-rs.ts
@@ -32,13 +32,13 @@ await typegraph(
idv3,
{
name: "remix_track",
- }
+ },
// the traits will map to the name of the materializer
// and also the the name of the handler mentioned above
)
.rename("remix_track"),
},
- Policy.public()
+ Policy.public(),
);
- }
+ },
);
diff --git a/examples/typegraphs/metagen-sdk.ts b/examples/typegraphs/metagen-sdk.ts
index 4e429514fa..130a1691ab 100644
--- a/examples/typegraphs/metagen-sdk.ts
+++ b/examples/typegraphs/metagen-sdk.ts
@@ -1,3 +1,6 @@
+// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
+// SPDX-License-Identifier: MPL-2.0
+
// skip:start
import { Policy, t, typegraph } from "@typegraph/sdk/index.ts";
import { DenoRuntime } from "@typegraph/sdk/runtimes/deno.ts";
@@ -38,6 +41,7 @@ const tg = await typegraph(
},
);
+// deno-lint-ignore no-constant-condition
if (false) {
const myPath = import.meta.url.replace("file://", "");
const metagen = new Metagen(
diff --git a/examples/typegraphs/metagen/rs/fdk.rs b/examples/typegraphs/metagen/rs/fdk.rs
index 4969ee6017..c03038436c 100644
--- a/examples/typegraphs/metagen/rs/fdk.rs
+++ b/examples/typegraphs/metagen/rs/fdk.rs
@@ -109,7 +109,7 @@ impl Router {
}
pub fn init(&self, args: InitArgs) -> Result {
- static MT_VERSION: &str = "0.5.0-rc.4";
+ static MT_VERSION: &str = "0.5.0-rc.6";
if args.metatype_version != MT_VERSION {
return Err(InitError::VersionMismatch(MT_VERSION.into()));
}
diff --git a/examples/typegraphs/metagen/ts/fdk.ts b/examples/typegraphs/metagen/ts/fdk.ts
index b34231aaa1..223bec680a 100644
--- a/examples/typegraphs/metagen/ts/fdk.ts
+++ b/examples/typegraphs/metagen/ts/fdk.ts
@@ -42,5 +42,4 @@ export type Idv3 = {
mp3Url: StringUri;
};
-
export type RemixTrackHandler = Handler;
diff --git a/examples/typegraphs/metagen/ts/remix.ts b/examples/typegraphs/metagen/ts/remix.ts
index 0d0ecbac02..b69a0b4a53 100644
--- a/examples/typegraphs/metagen/ts/remix.ts
+++ b/examples/typegraphs/metagen/ts/remix.ts
@@ -1,4 +1,4 @@
-import type { RemixTrackHandler, Ctx, Idv3 } from "./fdk.ts";
+import type { Ctx, Idv3, RemixTrackHandler } from "./fdk.ts";
// the name of the export must match the one referred int he typegraph
export const remix_track: RemixTrackHandler = (inp, cx: Ctx) => {
diff --git a/examples/typegraphs/oauth2.ts b/examples/typegraphs/oauth2.ts
index 96172d572b..4164497f84 100644
--- a/examples/typegraphs/oauth2.ts
+++ b/examples/typegraphs/oauth2.ts
@@ -27,7 +27,7 @@ typegraph(
exp: g.fromContext("exp"),
}),
},
- pub
+ pub,
);
- }
+ },
);
diff --git a/examples/typegraphs/policies.ts b/examples/typegraphs/policies.ts
index e128ff32df..46651fc6b0 100644
--- a/examples/typegraphs/policies.ts
+++ b/examples/typegraphs/policies.ts
@@ -19,11 +19,11 @@ typegraph(
const admin_only = deno.policy(
"admin_only",
// note: policies either return true | false | null
- "(args, { context }) => context.username ? context.username === 'admin' : null"
+ "(args, { context }) => context.username ? context.username === 'admin' : null",
);
const user_only = deno.policy(
"user_only",
- "(args, { context }) => context.username ? context.username === 'user' : null"
+ "(args, { context }) => context.username ? context.username === 'user' : null",
);
g.auth(Auth.basic(["admin", "user"]));
@@ -37,9 +37,9 @@ typegraph(
both: random.gen(t.string()).withPolicy([user_only, admin_only]),
// set default policy for the exposed functions
},
- pub
+ pub,
);
// skip:start
- }
+ },
);
// skip:end
diff --git a/examples/typegraphs/prisma-no-sugar.py.disabled b/examples/typegraphs/prisma-no-sugar.py.disabled
index 869b2be4cd..1061f9ef7c 100644
--- a/examples/typegraphs/prisma-no-sugar.py.disabled
+++ b/examples/typegraphs/prisma-no-sugar.py.disabled
@@ -1,30 +1,30 @@
-# # skip:start
-# from typegraph import typegraph, effects, t, Graph
-# from typegraph.providers.prisma import PrismaRuntime
-#
-#
-# @typegraph()
-# def prisma_no_sugar(g: Graph):
-# db = PrismaRuntime("database", "POSTGRES_CONN")
-# message = t.struct({})
-# skip: end
-# t.func(
-# t.struct(
-# {
-# "data": t.struct(
-# {
-# # notice to absence of `id` as automatically generated
-# "title": t.string(),
-# "body": t.string(),
-# }
-# )
-# }
-# ),
-# t.list(message),
-# PrismaOperationMat(
-# db,
-# "Message",
-# "createOne",
-# effect=effects.create(),
-# ),
-# )
+# skip:start
+from typegraph import typegraph, effects, t, Graph
+from typegraph.providers.prisma import PrismaRuntime
+
+
+@typegraph()
+def prisma_no_sugar(g: Graph):
+ db = PrismaRuntime("database", "POSTGRES_CONN")
+ message = t.struct({})
+ skip: end
+ t.func(
+ t.struct(
+ {
+ "data": t.struct(
+ {
+ # notice to absence of `id` as automatically generated
+ "title": t.string(),
+ "body": t.string(),
+ }
+ )
+ }
+ ),
+ t.list(message),
+ PrismaOperationMat(
+ db,
+ "Message",
+ "createOne",
+ effect=effects.create(),
+ ),
+ )
diff --git a/examples/typegraphs/prisma-runtime.ts b/examples/typegraphs/prisma-runtime.ts
index c6bb7b2977..e446afc640 100644
--- a/examples/typegraphs/prisma-runtime.ts
+++ b/examples/typegraphs/prisma-runtime.ts
@@ -29,7 +29,7 @@ typegraph(
email: t.email(),
firstname: t.string({ min: 2, max: 2000 }, {}),
},
- { name: "user" }
+ { name: "user" },
);
g.expose(
@@ -42,10 +42,10 @@ typegraph(
id: t.string(),
term: t.string(),
}),
- t.list(user)
+ t.list(user),
),
},
- pub
+ pub,
);
- }
+ },
);
diff --git a/examples/typegraphs/programmable-api-gateway.ts b/examples/typegraphs/programmable-api-gateway.ts
index 9180126fd7..7f372f885d 100644
--- a/examples/typegraphs/programmable-api-gateway.ts
+++ b/examples/typegraphs/programmable-api-gateway.ts
@@ -17,7 +17,7 @@ typegraph(
const pub = Policy.public();
const roulette_access = deno.policy(
"roulette",
- "() => Math.random() < 0.5"
+ "() => Math.random() < 0.5",
);
// skip:next-line
@@ -34,8 +34,8 @@ typegraph(
foo: static_vals["foo"],
}),
},
- policy
+ policy,
);
}
- }
+ },
);
diff --git a/examples/typegraphs/quick-start-project.ts b/examples/typegraphs/quick-start-project.ts
index 887b68b351..4b968de079 100644
--- a/examples/typegraphs/quick-start-project.ts
+++ b/examples/typegraphs/quick-start-project.ts
@@ -24,19 +24,19 @@ typegraph(
title: t.string(),
body: t.string(),
},
- { name: "message" } // the name of our type
+ { name: "message" }, // the name of our type
);
// custom functions
const add = deno.func(
t.struct({ first: t.float(), second: t.float() }),
t.float(),
- { code: "({first, second}) => first + second" }
+ { code: "({first, second}) => first + second" },
);
const hello = python.fromLambda(
t.struct({ world: t.string() }),
t.string(),
- { code: `lambda x: f"Hello {x['world']}!"` }
+ { code: `lambda x: f"Hello {x['world']}!"` },
);
g.expose(
@@ -46,7 +46,7 @@ typegraph(
create_message: db.create(message),
list_messages: db.findMany(message),
},
- pub
+ pub,
);
- }
+ },
);
diff --git a/examples/typegraphs/random-field.ts b/examples/typegraphs/random-field.ts
index 0b2e4eb9b7..53c4b2f71b 100644
--- a/examples/typegraphs/random-field.ts
+++ b/examples/typegraphs/random-field.ts
@@ -27,7 +27,7 @@ typegraph(
`Daily bonus: ${(performance > 100 ? bonus : ["none"]).join(", ")}`,
}),
},
- pub
+ pub,
);
- }
+ },
);
diff --git a/examples/typegraphs/rate.ts b/examples/typegraphs/rate.ts
index a3115c1d84..608c04c00b 100644
--- a/examples/typegraphs/rate.ts
+++ b/examples/typegraphs/rate.ts
@@ -39,7 +39,7 @@ typegraph(
.gen(t.list(t.string()))
.rate({ calls: false, weight: 2 }), // increment by # of results returned
},
- pub
+ pub,
);
- }
+ },
);
diff --git a/examples/typegraphs/reduce.ts b/examples/typegraphs/reduce.ts
index def512775c..00cdb815ee 100644
--- a/examples/typegraphs/reduce.ts
+++ b/examples/typegraphs/reduce.ts
@@ -20,7 +20,7 @@ typegraph(
name: t.string(),
ideas: t.list(g.ref("idea")),
},
- { name: "bucket" }
+ { name: "bucket" },
);
const idea = t.struct(
@@ -31,7 +31,7 @@ typegraph(
votes: t.list(g.ref("vote")),
bucket: g.ref("bucket"),
},
- { name: "idea" }
+ { name: "idea" },
);
const vote = t.struct(
@@ -42,14 +42,14 @@ typegraph(
desc: t.string().optional(),
idea: g.ref("idea"),
},
- { name: "vote" }
+ { name: "vote" },
);
g.auth(Auth.basic(["andim"]));
const admins = deno.policy(
"admins",
- "(_args, { context }) => !!context.username"
+ "(_args, { context }) => !!context.username",
);
g.expose(
@@ -68,7 +68,7 @@ typegraph(
}),
create_vote: db.create(vote),
},
- pub
+ pub,
);
- }
+ },
);
diff --git a/examples/typegraphs/rest.ts b/examples/typegraphs/rest.ts
index c99aa80abb..60672ac706 100644
--- a/examples/typegraphs/rest.ts
+++ b/examples/typegraphs/rest.ts
@@ -20,7 +20,7 @@ typegraph(
name: t.string(),
ideas: t.list(g.ref("idea")),
},
- { name: "bucket" }
+ { name: "bucket" },
);
const idea = t.struct(
@@ -31,7 +31,7 @@ typegraph(
votes: t.list(g.ref("vote")),
bucket: g.ref("bucket"),
},
- { name: "idea" }
+ { name: "idea" },
);
const vote = t.struct(
@@ -42,14 +42,14 @@ typegraph(
desc: t.string().optional(),
idea: g.ref("idea"),
},
- { name: "vote" }
+ { name: "vote" },
);
g.auth(Auth.basic(["andim"]));
const admins = deno.policy(
"admins",
- "(_args, { context }) => !!context.username"
+ "(_args, { context }) => !!context.username",
);
g.expose(
@@ -68,7 +68,7 @@ typegraph(
}),
create_vote: db.create(vote),
},
- pub
+ pub,
);
g.rest(
@@ -84,7 +84,7 @@ typegraph(
}
}
}
- `
+ `,
);
g.rest(
@@ -102,7 +102,7 @@ typegraph(
}
}
}
- `
+ `,
);
- }
+ },
);
diff --git a/examples/typegraphs/roadmap-policies.ts b/examples/typegraphs/roadmap-policies.ts
index e526e195e3..7902f05033 100644
--- a/examples/typegraphs/roadmap-policies.ts
+++ b/examples/typegraphs/roadmap-policies.ts
@@ -21,7 +21,7 @@ typegraph(
name: t.string(),
ideas: t.list(g.ref("idea")),
},
- { name: "bucket" }
+ { name: "bucket" },
);
const idea = t.struct(
@@ -32,7 +32,7 @@ typegraph(
votes: t.list(g.ref("vote")),
bucket: g.ref("bucket"),
},
- { name: "idea" }
+ { name: "idea" },
);
const vote = t.struct(
@@ -43,14 +43,14 @@ typegraph(
desc: t.string().optional(),
idea: g.ref("idea"),
},
- { name: "vote" }
+ { name: "vote" },
);
g.auth(Auth.basic(["andim"]));
const admins = deno.policy(
"admins",
- "(_args, { context }) => !!context.username"
+ "(_args, { context }) => !!context.username",
);
g.expose(
@@ -61,7 +61,7 @@ typegraph(
create_idea: db.create(idea),
create_vote: db.create(vote),
},
- pub
+ pub,
);
- }
+ },
);
diff --git a/examples/typegraphs/roadmap-random.ts b/examples/typegraphs/roadmap-random.ts
index 02172f617d..628c666344 100644
--- a/examples/typegraphs/roadmap-random.ts
+++ b/examples/typegraphs/roadmap-random.ts
@@ -34,5 +34,5 @@ typegraph(
const random = new RandomRuntime({ seed: 1 });
const pub = Policy.public();
g.expose({ get_idea: random.gen(idea) }, pub);
- }
+ },
);
diff --git a/examples/typegraphs/temporal.ts b/examples/typegraphs/temporal.ts
index b56afac5ea..851fb8a0fe 100644
--- a/examples/typegraphs/temporal.ts
+++ b/examples/typegraphs/temporal.ts
@@ -1,18 +1,9 @@
+// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
+// SPDX-License-Identifier: MPL-2.0
+
import { Policy, t, typegraph } from "@typegraph/sdk/index.ts";
import { TemporalRuntime } from "@typegraph/sdk/providers/temporal.ts";
-
-// skip:start
-function getEnvVariable(
- key: string,
- defaultValue?: string
-): string | undefined {
- const glob = globalThis as any;
- const value = glob?.process
- ? glob?.process.env?.[key]
- : glob?.Deno.env.get(key);
- return value ?? defaultValue;
-}
-// skip:end
+import process from "node:process";
typegraph(
{
@@ -29,7 +20,7 @@ typegraph(
namespaceSecret: "NAMESPACE",
});
- const workflow_id = getEnvVariable("ID_FROM_ENV");
+ const workflow_id = process.env["ID_FROM_ENV"];
const arg = t.struct({ some_field: t.string() });
g.expose(
@@ -41,7 +32,7 @@ typegraph(
? temporal.describeWorkflow().reduce({ workflow_id })
: temporal.describeWorkflow(),
},
- pub
+ pub,
);
- }
+ },
);
diff --git a/examples/typegraphs/triggers.ts b/examples/typegraphs/triggers.ts
index ca4f92ba23..ac82710602 100644
--- a/examples/typegraphs/triggers.ts
+++ b/examples/typegraphs/triggers.ts
@@ -7,6 +7,7 @@ import { HttpRuntime } from "@typegraph/sdk/runtimes/http.ts";
typegraph(
{
name: "triggers",
+ // skip:next-line
cors: { allowOrigin: ["https://metatype.dev", "http://localhost:3000"] },
},
(g) => {
@@ -21,7 +22,7 @@ typegraph(
path: "/flip_coin",
}),
},
- pub
+ pub,
);
- }
+ },
);
diff --git a/examples/typegraphs/union-either.py b/examples/typegraphs/union-either.py
new file mode 100644
index 0000000000..21c2f16598
--- /dev/null
+++ b/examples/typegraphs/union-either.py
@@ -0,0 +1,69 @@
+# skip:start
+from typegraph import typegraph, Policy, t, Graph
+from typegraph.graph.params import Cors
+from typegraph.runtimes.deno import DenoRuntime
+
+
+# skip:end
+@typegraph(
+ # skip:start
+ cors=Cors(allow_origin=["https://metatype.dev", "http://localhost:3000"]),
+ # skip:end
+)
+def union_either(g: Graph):
+ deno = DenoRuntime()
+ members = [
+ t.string().rename("scalar_1"),
+ t.integer().rename("scalar_2"),
+ t.struct(
+ {
+ "field1": t.string(),
+ }
+ ).rename("comp_1"),
+ t.struct(
+ {
+ "field2": t.string(),
+ }
+ ).rename("comp_2"),
+ t.list(t.string()).rename("scalar_list"),
+ # # FIXME: list of composites is broken
+ # t.list(
+ # t.struct(
+ # {
+ # "listField": t.string(),
+ # }
+ # ),
+ # ),
+ ]
+ g.expose(
+ Policy.public(),
+ outer=deno.func(
+ t.struct(),
+ t.struct(
+ {
+ "union": t.union(members),
+ "either": t.either(members),
+ "unionList": t.list(t.union(members)),
+ }
+ ),
+ code="""() => ({
+ either: {
+ field1: "1",
+ },
+ union: {
+ field2: "2",
+ },
+ unionList: [
+ "scalar",
+ 2,
+ {
+ field1: "1",
+ },
+ {
+ field2: "2",
+ },
+ ["scalar_1", "scalar_2"],
+ ],
+ })""",
+ ),
+ )
diff --git a/examples/typegraphs/union-either.ts b/examples/typegraphs/union-either.ts
new file mode 100644
index 0000000000..ec4d93bda8
--- /dev/null
+++ b/examples/typegraphs/union-either.ts
@@ -0,0 +1,65 @@
+// skip:start
+import { Policy, t, typegraph } from "@typegraph/sdk/index.ts";
+import { DenoRuntime } from "@typegraph/sdk/runtimes/deno.ts";
+
+// skip:end
+typegraph(
+ {
+ name: "union-either",
+ // skip:next-line
+ cors: { allowOrigin: ["https://metatype.dev", "http://localhost:3000"] },
+ },
+ (g) => {
+ const deno = new DenoRuntime();
+ const members = [
+ t.string().rename("scalar_1"),
+ t.integer().rename("scalar_2"),
+ t.struct({
+ field1: t.string(),
+ }).rename("comp_1"),
+ t.struct({
+ field2: t.string(),
+ }).rename("comp_2"),
+ t.list(t.string()).rename("scalar_list"),
+ /* FIXME: list of composites is broken
+ t.list(
+ t.struct({
+ listField: t.string(),
+ }),
+ ), */
+ ];
+ g.expose({
+ outer: deno.func(
+ // input
+ t.struct({}),
+ // output
+ t.struct({
+ union: t.union(members),
+ either: t.either(members),
+ unionList: t.list(t.union(members)),
+ }),
+ {
+ code: () => ({
+ either: {
+ field1: "1",
+ },
+ union: {
+ field2: "2",
+ },
+ unionList: [
+ "scalar",
+ 2,
+ {
+ field1: "1",
+ },
+ {
+ field2: "2",
+ },
+ ["scalar_1", "scalar_2"],
+ ],
+ }),
+ },
+ ),
+ }, Policy.public());
+ },
+);
diff --git a/ghjk.ts b/ghjk.ts
index e950c4a310..ea1c538a51 100644
--- a/ghjk.ts
+++ b/ghjk.ts
@@ -1,3 +1,6 @@
+// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
+// SPDX-License-Identifier: MPL-2.0
+
// @ts-nocheck: Deno file
import { METATYPE_VERSION, PUBLISHED_VERSION } from "./tools/consts.ts";
diff --git a/src/common/src/typegraph/validator/injection.rs b/src/common/src/typegraph/validator/injection.rs
index cfdee4c4c2..09bd9cf381 100644
--- a/src/common/src/typegraph/validator/injection.rs
+++ b/src/common/src/typegraph/validator/injection.rs
@@ -1,3 +1,6 @@
+// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
+// SPDX-License-Identifier: MPL-2.0
+
use indexmap::IndexMap;
use serde_json::Value;
diff --git a/src/meta-cli/src/cli/fdk_template.rs b/src/meta-cli/src/cli/fdk_template.rs
index 7d363f114d..b7c8529111 100644
--- a/src/meta-cli/src/cli/fdk_template.rs
+++ b/src/meta-cli/src/cli/fdk_template.rs
@@ -1,3 +1,6 @@
+// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
+// SPDX-License-Identifier: MPL-2.0
+
use async_trait::async_trait;
use clap::{Parser, ValueEnum};
diff --git a/src/meta-cli/src/utils/shell_words.rs b/src/meta-cli/src/utils/shell_words.rs
index 5c00018f2e..0b77bdca5e 100644
--- a/src/meta-cli/src/utils/shell_words.rs
+++ b/src/meta-cli/src/utils/shell_words.rs
@@ -1,4 +1,4 @@
-// no-auto-license-header
+// no-auto-license-header | @generated (pre-commit doesn't support two headers)
/*
Copyright (c) 2016 Tomasz Miąsko
diff --git a/src/meta-cli/tests/graphs/nested/graph0.py b/src/meta-cli/tests/graphs/nested/graph0.py
index e69de29bb2..8e55187b7a 100644
--- a/src/meta-cli/tests/graphs/nested/graph0.py
+++ b/src/meta-cli/tests/graphs/nested/graph0.py
@@ -0,0 +1,2 @@
+# Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
+# SPDX-License-Identifier: MPL-2.0
diff --git a/src/meta-lsp/ts-language-server/src/analysis/diagnostics/context.ts b/src/meta-lsp/ts-language-server/src/analysis/diagnostics/context.ts
index 71322451ee..ad90f9619e 100644
--- a/src/meta-lsp/ts-language-server/src/analysis/diagnostics/context.ts
+++ b/src/meta-lsp/ts-language-server/src/analysis/diagnostics/context.ts
@@ -1,3 +1,6 @@
+// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
+// SPDX-License-Identifier: MPL-2.0
+
import { Diagnostic, DiagnosticSeverity } from "vscode-languageserver-types";
import { ScopeManager } from "../typescript-semantic/scope.ts";
import {
diff --git a/src/meta-lsp/ts-language-server/src/analysis/exposed_function.ts b/src/meta-lsp/ts-language-server/src/analysis/exposed_function.ts
index dc82d9e0c2..712996a101 100644
--- a/src/meta-lsp/ts-language-server/src/analysis/exposed_function.ts
+++ b/src/meta-lsp/ts-language-server/src/analysis/exposed_function.ts
@@ -1,3 +1,6 @@
+// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
+// SPDX-License-Identifier: MPL-2.0
+
import { Parser } from "../parser.ts";
import { ModuleDiagnosticsContext } from "./diagnostics/context.ts";
import { InputType, Runtime } from "./runtimes/mod.ts";
diff --git a/src/meta-lsp/ts-language-server/src/analysis/runtimes/mod.ts b/src/meta-lsp/ts-language-server/src/analysis/runtimes/mod.ts
index 29b1f2168b..f382675346 100644
--- a/src/meta-lsp/ts-language-server/src/analysis/runtimes/mod.ts
+++ b/src/meta-lsp/ts-language-server/src/analysis/runtimes/mod.ts
@@ -1,3 +1,6 @@
+// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
+// SPDX-License-Identifier: MPL-2.0
+
import { Parser } from "../../parser.ts";
import { ModuleDiagnosticsContext } from "../diagnostics/context.ts";
import { TgType } from "../typescript-semantic/semantic-node.ts";
@@ -8,7 +11,7 @@ export type InputType = {
};
export abstract class Runtime {
- protected constructor(public node: Parser.SyntaxNode) { }
+ protected constructor(public node: Parser.SyntaxNode) {}
static analyze(
node: Parser.SyntaxNode,
diff --git a/src/meta-lsp/ts-language-server/src/analysis/typescript-semantic/scope.ts b/src/meta-lsp/ts-language-server/src/analysis/typescript-semantic/scope.ts
index 6f0d87bf4c..490e403769 100644
--- a/src/meta-lsp/ts-language-server/src/analysis/typescript-semantic/scope.ts
+++ b/src/meta-lsp/ts-language-server/src/analysis/typescript-semantic/scope.ts
@@ -1,3 +1,6 @@
+// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
+// SPDX-License-Identifier: MPL-2.0
+
import { Parser, queryMatches } from "../../parser.ts";
import { ModuleDiagnosticsContext } from "../diagnostics/context.ts";
diff --git a/src/meta-lsp/ts-language-server/src/analysis/typescript-semantic/semantic-node.ts b/src/meta-lsp/ts-language-server/src/analysis/typescript-semantic/semantic-node.ts
index 864f35a100..e563519dea 100644
--- a/src/meta-lsp/ts-language-server/src/analysis/typescript-semantic/semantic-node.ts
+++ b/src/meta-lsp/ts-language-server/src/analysis/typescript-semantic/semantic-node.ts
@@ -1,3 +1,6 @@
+// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
+// SPDX-License-Identifier: MPL-2.0
+
import { Parser } from "../../parser.ts";
import { ModuleDiagnosticsContext } from "../diagnostics/context.ts";
import { asMethodCall } from "./utils/mod.ts";
@@ -28,7 +31,7 @@ export type TgTypeName =
// ];
export abstract class SemanticNode {
- protected constructor(public node: Parser.SyntaxNode) { }
+ protected constructor(public node: Parser.SyntaxNode) {}
asType(): TgType | null {
if (this instanceof TgType) {
@@ -54,9 +57,10 @@ export abstract class TgType extends SemanticNode {
}
toString(): string {
- return `TgType(${this.type}${this.children
- .map((c) => `, ${c.key} => ${c.type.toString()}`)
- .join("")
+ return `TgType(${this.type}${
+ this.children
+ .map((c) => `, ${c.key} => ${c.type.toString()}`)
+ .join("")
})`;
}
diff --git a/src/meta-lsp/ts-language-server/src/analysis/typescript-semantic/symbols.ts b/src/meta-lsp/ts-language-server/src/analysis/typescript-semantic/symbols.ts
index 02f75a3658..f810e8065a 100644
--- a/src/meta-lsp/ts-language-server/src/analysis/typescript-semantic/symbols.ts
+++ b/src/meta-lsp/ts-language-server/src/analysis/typescript-semantic/symbols.ts
@@ -1,3 +1,6 @@
+// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
+// SPDX-License-Identifier: MPL-2.0
+
import { ScopeManager } from "./scope.ts";
import { SemanticNode } from "./semantic-node.ts";
@@ -9,7 +12,7 @@ export abstract class Symbol {
public name: string,
public node: Parser.SyntaxNode,
private scopeManager: ScopeManager,
- ) { }
+ ) {}
}
export class ImportSymbol extends Symbol {
diff --git a/src/meta-lsp/ts-language-server/src/analysis/typescript-semantic/utils/mod.ts b/src/meta-lsp/ts-language-server/src/analysis/typescript-semantic/utils/mod.ts
index 387d64c9f0..c6f23ba7cd 100644
--- a/src/meta-lsp/ts-language-server/src/analysis/typescript-semantic/utils/mod.ts
+++ b/src/meta-lsp/ts-language-server/src/analysis/typescript-semantic/utils/mod.ts
@@ -1,3 +1,6 @@
+// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
+// SPDX-License-Identifier: MPL-2.0
+
import { Parser } from "../../../parser.ts";
export type MethodCall = {
diff --git a/src/meta-lsp/ts-language-server/src/lsp_client.ts b/src/meta-lsp/ts-language-server/src/lsp_client.ts
index c9e7848ef6..c7518160e6 100644
--- a/src/meta-lsp/ts-language-server/src/lsp_client.ts
+++ b/src/meta-lsp/ts-language-server/src/lsp_client.ts
@@ -1,3 +1,6 @@
+// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
+// SPDX-License-Identifier: MPL-2.0
+
import child_process from "node:child_process";
import { JSONRPCEndpoint, LspClient } from "ts-lsp-client";
diff --git a/src/meta-lsp/ts-language-server/src/parser.ts b/src/meta-lsp/ts-language-server/src/parser.ts
index 8fdc918c46..7de6247d5f 100644
--- a/src/meta-lsp/ts-language-server/src/parser.ts
+++ b/src/meta-lsp/ts-language-server/src/parser.ts
@@ -1,3 +1,6 @@
+// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
+// SPDX-License-Identifier: MPL-2.0
+
import Parser = require("tree-sitter");
import { typescript as TypeScript } from "tree-sitter-typescript";
import {
diff --git a/src/meta-lsp/ts-language-server/src/server.ts b/src/meta-lsp/ts-language-server/src/server.ts
index d05c00b2ae..7a379f1bd6 100644
--- a/src/meta-lsp/ts-language-server/src/server.ts
+++ b/src/meta-lsp/ts-language-server/src/server.ts
@@ -1,3 +1,6 @@
+// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
+// SPDX-License-Identifier: MPL-2.0
+
import { LspServer } from "./server/index.ts";
const server = new LspServer(["deno", "lsp"]);
diff --git a/src/meta-lsp/ts-language-server/src/server/documents.ts b/src/meta-lsp/ts-language-server/src/server/documents.ts
index 40b2582844..11a0534c84 100644
--- a/src/meta-lsp/ts-language-server/src/server/documents.ts
+++ b/src/meta-lsp/ts-language-server/src/server/documents.ts
@@ -1,3 +1,6 @@
+// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
+// SPDX-License-Identifier: MPL-2.0
+
import { Connection, TextDocuments } from "vscode-languageserver";
import { TextDocument } from "vscode-languageserver-textdocument";
import { ClientCapabilities } from "./mod.ts";
diff --git a/src/meta-lsp/ts-language-server/src/server/index.ts b/src/meta-lsp/ts-language-server/src/server/index.ts
index 93166a06ca..e71540edd6 100644
--- a/src/meta-lsp/ts-language-server/src/server/index.ts
+++ b/src/meta-lsp/ts-language-server/src/server/index.ts
@@ -1,3 +1,6 @@
+// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
+// SPDX-License-Identifier: MPL-2.0
+
import { LspClient } from "ts-lsp-client";
import { createLspClient } from "../lsp_client.ts";
import {
diff --git a/src/meta-lsp/ts-language-server/src/types.ts b/src/meta-lsp/ts-language-server/src/types.ts
index 4dfd84a17e..bbfd219d3d 100644
--- a/src/meta-lsp/ts-language-server/src/types.ts
+++ b/src/meta-lsp/ts-language-server/src/types.ts
@@ -1,3 +1,6 @@
+// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
+// SPDX-License-Identifier: MPL-2.0
+
import { Parser } from "../parser.ts";
export type TypegraphDefinition = {
diff --git a/src/meta-lsp/ts-language-server/tests/expose_analysis.test.ts b/src/meta-lsp/ts-language-server/tests/expose_analysis.test.ts
index d9660c561e..0e312c33e4 100644
--- a/src/meta-lsp/ts-language-server/tests/expose_analysis.test.ts
+++ b/src/meta-lsp/ts-language-server/tests/expose_analysis.test.ts
@@ -1,3 +1,6 @@
+// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
+// SPDX-License-Identifier: MPL-2.0
+
import { typescript } from "tree-sitter-typescript";
import {
findTypegraphDefinitions,
diff --git a/src/meta-lsp/ts-language-server/tests/typegraphs/deno_types.ts b/src/meta-lsp/ts-language-server/tests/typegraphs/deno_types.ts
index b2ae684dc0..1e36f95d1a 100644
--- a/src/meta-lsp/ts-language-server/tests/typegraphs/deno_types.ts
+++ b/src/meta-lsp/ts-language-server/tests/typegraphs/deno_types.ts
@@ -1,3 +1,6 @@
+// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
+// SPDX-License-Identifier: MPL-2.0
+
// TODO use deployed version of metatype in the import map
import { Policy, t, typegraph } from "npm:@typegraph/sdk@0.2.4";
import { PythonRuntime } from "npm:@typegraph/sdk@0.2.4/runtimes/python";
diff --git a/src/meta-lsp/ts-language-server/tests/utils.ts b/src/meta-lsp/ts-language-server/tests/utils.ts
index e69de29bb2..23d9e15ccf 100644
--- a/src/meta-lsp/ts-language-server/tests/utils.ts
+++ b/src/meta-lsp/ts-language-server/tests/utils.ts
@@ -0,0 +1,2 @@
+// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
+// SPDX-License-Identifier: MPL-2.0
diff --git a/src/meta-lsp/vscode-metatype-support/src/extension.ts b/src/meta-lsp/vscode-metatype-support/src/extension.ts
index 2cf821b9ed..c0a373c0af 100644
--- a/src/meta-lsp/vscode-metatype-support/src/extension.ts
+++ b/src/meta-lsp/vscode-metatype-support/src/extension.ts
@@ -1,3 +1,6 @@
+// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
+// SPDX-License-Identifier: MPL-2.0
+
import { join } from "node:path";
import { ExtensionContext } from "vscode";
diff --git a/src/metagen/fixtures/tg.ts b/src/metagen/fixtures/tg.ts
index 12fbe189ba..e0e4dae44e 100644
--- a/src/metagen/fixtures/tg.ts
+++ b/src/metagen/fixtures/tg.ts
@@ -1,3 +1,6 @@
+// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
+// SPDX-License-Identifier: MPL-2.0
+
import { Policy, t, typegraph } from "@typegraph/sdk/index.ts";
import { WasmRuntime } from "@typegraph/sdk/runtimes/wasm.ts";
diff --git a/src/metagen/src/client_rs/static/client.rs b/src/metagen/src/client_rs/static/client.rs
index 06ef4b9f2e..a848896a8a 100644
--- a/src/metagen/src/client_rs/static/client.rs
+++ b/src/metagen/src/client_rs/static/client.rs
@@ -1,6 +1,3 @@
-// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
-// SPDX-License-Identifier: MPL-2.0
-
use std::{collections::HashMap, marker::PhantomData};
use reqwest::Url;
diff --git a/src/metagen/src/client_rs/static/lib.rs b/src/metagen/src/client_rs/static/lib.rs
index 34b00f4242..b9babe5bc1 100644
--- a/src/metagen/src/client_rs/static/lib.rs
+++ b/src/metagen/src/client_rs/static/lib.rs
@@ -1,4 +1 @@
-// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
-// SPDX-License-Identifier: MPL-2.0
-
pub mod client;
diff --git a/src/metagen/src/fdk_python/static/types.py.jinja b/src/metagen/src/fdk_python/static/types.py.jinja
index b7df7ec36e..d8dd4c2e1e 100644
--- a/src/metagen/src/fdk_python/static/types.py.jinja
+++ b/src/metagen/src/fdk_python/static/types.py.jinja
@@ -1,3 +1,6 @@
+# This file was @generated by metagen and is intended
+# to be generated again on subsequent metagen runs.
+
from types import NoneType
from typing import Callable, List, Union, get_origin, ForwardRef, Any
from dataclasses import dataclass, asdict, fields
diff --git a/src/metagen/src/fdk_rust/static/fdk.rs b/src/metagen/src/fdk_rust/static/fdk.rs
index 6ad4ec62bf..6454d3d2b6 100644
--- a/src/metagen/src/fdk_rust/static/fdk.rs
+++ b/src/metagen/src/fdk_rust/static/fdk.rs
@@ -1,4 +1,3 @@
-// no-auto-license-header | @generated (pre-commit doesn't support two headers)
// gen-start
#![allow(dead_code)]
diff --git a/src/metagen/src/fdk_rust/static/lib.rs b/src/metagen/src/fdk_rust/static/lib.rs
index 3f6c2c8242..7b55348d1e 100644
--- a/src/metagen/src/fdk_rust/static/lib.rs
+++ b/src/metagen/src/fdk_rust/static/lib.rs
@@ -1,4 +1 @@
-// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
-// SPDX-License-Identifier: MPL-2.0
-
mod fdk;
diff --git a/src/metagen/src/fdk_substantial/mod.rs b/src/metagen/src/fdk_substantial/mod.rs
index 494d76ee87..26f80816ea 100644
--- a/src/metagen/src/fdk_substantial/mod.rs
+++ b/src/metagen/src/fdk_substantial/mod.rs
@@ -1,3 +1,6 @@
+// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
+// SPDX-License-Identifier: MPL-2.0
+
// TODO: keyword filtering
use crate::interlude::*;
diff --git a/src/metagen/src/fdk_substantial/static/substantial.py b/src/metagen/src/fdk_substantial/static/substantial.py
index 621b0bdb4d..b3530cfab9 100644
--- a/src/metagen/src/fdk_substantial/static/substantial.py
+++ b/src/metagen/src/fdk_substantial/static/substantial.py
@@ -10,20 +10,11 @@ async def save(
*,
timeout: Optional[timedelta] = None,
retry_strategy: Optional[RetryStrategy] = None,
- ):
- pass
-
- def handle(self, event_name: str, cb: Callable[[Any], Any]):
- pass
-
- async def ensure(self, f: Callable[[], bool]):
- pass
-
- async def sleep(self, duration: timedelta) -> Any:
- pass
-
- async def receive(name: str):
- pass
+ ): ...
+ def handle(self, event_name: str, cb: Callable[[Any], Any]): ...
+ async def ensure(self, f: Callable[[], bool]): ...
+ async def sleep(self, duration: timedelta) -> Any: ...
+ async def receive(name: str): ...
def workflow():
diff --git a/src/pyrt_wit_wire/main.py b/src/pyrt_wit_wire/main.py
index 28689e3fc9..91c941e7a4 100644
--- a/src/pyrt_wit_wire/main.py
+++ b/src/pyrt_wit_wire/main.py
@@ -1,3 +1,6 @@
+# Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
+# SPDX-License-Identifier: MPL-2.0
+
import importlib
import importlib.abc
import importlib.machinery
diff --git a/src/substantial/src/backends/fs.rs b/src/substantial/src/backends/fs.rs
index f154dd7fa5..373c9e76c7 100644
--- a/src/substantial/src/backends/fs.rs
+++ b/src/substantial/src/backends/fs.rs
@@ -1,3 +1,6 @@
+// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
+// SPDX-License-Identifier: MPL-2.0
+
use super::key_value::{Item, KeyValueBackend, KeyValueLike};
use anyhow::{Context, Result};
use chrono::{DateTime, Utc};
diff --git a/src/substantial/src/backends/key_value.rs b/src/substantial/src/backends/key_value.rs
index be0d9a65c4..cd6cfce7ad 100644
--- a/src/substantial/src/backends/key_value.rs
+++ b/src/substantial/src/backends/key_value.rs
@@ -1,3 +1,6 @@
+// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
+// SPDX-License-Identifier: MPL-2.0
+
use super::{Backend, BackendMetadataWriter, NextRun};
use crate::{
converters::{MetadataEvent, MetadataPayload},
diff --git a/src/substantial/src/backends/memory.rs b/src/substantial/src/backends/memory.rs
index 40c2fa0912..0c23871968 100644
--- a/src/substantial/src/backends/memory.rs
+++ b/src/substantial/src/backends/memory.rs
@@ -1,3 +1,6 @@
+// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
+// SPDX-License-Identifier: MPL-2.0
+
use super::key_value::{Item, KeyValueBackend, KeyValueLike};
use anyhow::Result;
use chrono::{DateTime, Utc};
diff --git a/src/substantial/src/backends/mod.rs b/src/substantial/src/backends/mod.rs
index f6541f64ff..6a4a8841f6 100644
--- a/src/substantial/src/backends/mod.rs
+++ b/src/substantial/src/backends/mod.rs
@@ -1,3 +1,6 @@
+// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
+// SPDX-License-Identifier: MPL-2.0
+
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
diff --git a/src/substantial/src/backends/redis.rs b/src/substantial/src/backends/redis.rs
index 72a4b5139e..cee8ff228e 100644
--- a/src/substantial/src/backends/redis.rs
+++ b/src/substantial/src/backends/redis.rs
@@ -1,3 +1,6 @@
+// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
+// SPDX-License-Identifier: MPL-2.0
+
use std::sync::Mutex;
use super::{Backend, BackendMetadataWriter, NextRun};
diff --git a/src/substantial/src/converters.rs b/src/substantial/src/converters.rs
index 3c146ca090..ea346d1288 100644
--- a/src/substantial/src/converters.rs
+++ b/src/substantial/src/converters.rs
@@ -1,3 +1,6 @@
+// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
+// SPDX-License-Identifier: MPL-2.0
+
use std::collections::HashMap;
use anyhow::{bail, Context, Ok, Result};
diff --git a/src/substantial/src/lib.rs b/src/substantial/src/lib.rs
index 89fe1cf78e..81b09d8a52 100644
--- a/src/substantial/src/lib.rs
+++ b/src/substantial/src/lib.rs
@@ -1,3 +1,6 @@
+// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
+// SPDX-License-Identifier: MPL-2.0
+
pub mod backends;
pub mod converters;
pub mod protocol;
diff --git a/src/substantial/tests/mod.rs b/src/substantial/tests/mod.rs
index 26e5469297..e218f9a887 100644
--- a/src/substantial/tests/mod.rs
+++ b/src/substantial/tests/mod.rs
@@ -1,3 +1,6 @@
+// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
+// SPDX-License-Identifier: MPL-2.0
+
#[cfg(test)]
mod tests {
use std::{collections::HashMap, fmt::Debug, path::PathBuf, thread::sleep, time::Duration};
diff --git a/src/typegate/src/runtimes/substantial/agent.ts b/src/typegate/src/runtimes/substantial/agent.ts
index 78439d637c..4fe0b4b7eb 100644
--- a/src/typegate/src/runtimes/substantial/agent.ts
+++ b/src/typegate/src/runtimes/substantial/agent.ts
@@ -1,3 +1,6 @@
+// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
+// SPDX-License-Identifier: MPL-2.0
+
import {
AddScheduleInput,
Backend,
@@ -16,7 +19,7 @@ import {
} from "./types.ts";
import { RunId, WorkerManager } from "./workflow_worker_manager.ts";
-const logger = getLogger();
+const logger = getLogger(import.meta, "WARN");
export interface StdKwargs {
taskContext: TaskContext;
@@ -117,8 +120,6 @@ export class Agent {
}
async #nextIteration() {
- logger.warn("POLL");
-
// Note: in multiple agents/typegate scenario, a single node may acquire all runs for itself within a tick span
// To account for that, keep this reasonable
const acquireMaxForThisAgent = this.config.maxAcquirePerTick;
@@ -169,7 +170,7 @@ export class Agent {
lease_seconds: this.config.leaseLifespanSec,
});
- logger.info(`Active leases: ${activeRunIds.join(", ")}`);
+ logger.debug(`Active leases: ${activeRunIds.join(", ")}`);
const next = await Meta.substantial.agentNextRun({
backend: this.backend,
@@ -342,7 +343,7 @@ export class Agent {
) {
this.workerManager.destroyWorker(workflowName, runId); // !
- logger.warn(`Interrupt "${workflowName}": ${result}"`);
+ logger.debug(`Interrupt "${workflowName}": ${result}"`);
// TODO: make all of these transactional
diff --git a/src/typegate/src/runtimes/substantial/worker.ts b/src/typegate/src/runtimes/substantial/worker.ts
index 61f7a5dec5..b74b8921ea 100644
--- a/src/typegate/src/runtimes/substantial/worker.ts
+++ b/src/typegate/src/runtimes/substantial/worker.ts
@@ -3,6 +3,7 @@
import { errorToString } from "../../worker_utils.ts";
import { Context } from "./deno_context.ts";
+import { toFileUrl } from "@std/path/to-file-url";
import { Err, Msg, Ok, WorkerData, WorkflowResult } from "./types.ts";
let runCtx: Context | undefined;
@@ -15,7 +16,7 @@ self.onmessage = async function (event) {
data;
// FIXME: handle case when script is missing and notify WorkerManager so it cleans up
// its registry.
- const module = await import(modulePath);
+ const module = await import(toFileUrl(modulePath).toString());
// TODO: for python use the same strategy but instead call from native
const workflowFn = module[functionName];
diff --git a/src/typegate/src/runtimes/substantial/workflow_worker_manager.ts b/src/typegate/src/runtimes/substantial/workflow_worker_manager.ts
index 62ff176d53..f40a299d4d 100644
--- a/src/typegate/src/runtimes/substantial/workflow_worker_manager.ts
+++ b/src/typegate/src/runtimes/substantial/workflow_worker_manager.ts
@@ -13,7 +13,7 @@ import {
WorkerEventHandler,
} from "./types.ts";
-const logger = getLogger();
+const logger = getLogger(import.meta, "WARN");
export type WorkerRecord = {
worker: Worker;
diff --git a/src/typegate/src/typegraph/mod.ts b/src/typegate/src/typegraph/mod.ts
index aaec624dba..83b6a4ffcc 100644
--- a/src/typegate/src/typegraph/mod.ts
+++ b/src/typegate/src/typegraph/mod.ts
@@ -68,7 +68,9 @@ export class SecretManager {
const value = this.secretOrNull(name);
ensure(
value != null,
- `cannot find secret "${name}" for "${this.typegraphName}"`,
+ `cannot find secret "${name}" for "${this.typegraphName}". Availaible secrets include: [${
+ Object.keys(this.secrets)
+ }]`,
);
return value as string;
}
diff --git a/src/typegate/src/typegraphs/introspection.json b/src/typegate/src/typegraphs/introspection.json
index 71997398b4..eeabf338f6 100644
--- a/src/typegate/src/typegraphs/introspection.json
+++ b/src/typegate/src/typegraphs/introspection.json
@@ -635,4 +635,4 @@
"randomSeed": null,
"artifacts": {}
}
-}
\ No newline at end of file
+}
diff --git a/src/typegate/src/typegraphs/prisma_migration.json b/src/typegate/src/typegraphs/prisma_migration.json
index c44d6428ba..6d5d98040d 100644
--- a/src/typegate/src/typegraphs/prisma_migration.json
+++ b/src/typegate/src/typegraphs/prisma_migration.json
@@ -411,4 +411,4 @@
"randomSeed": null,
"artifacts": {}
}
-}
\ No newline at end of file
+}
diff --git a/src/typegate/src/typegraphs/typegate.json b/src/typegate/src/typegraphs/typegate.json
index 8d1e0881a3..391ec404f0 100644
--- a/src/typegate/src/typegraphs/typegate.json
+++ b/src/typegate/src/typegraphs/typegate.json
@@ -956,4 +956,4 @@
"randomSeed": null,
"artifacts": {}
}
-}
\ No newline at end of file
+}
diff --git a/src/typegate/standalone/src/logger.rs b/src/typegate/standalone/src/logger.rs
index 5e57aa5e59..1a5c303e6c 100644
--- a/src/typegate/standalone/src/logger.rs
+++ b/src/typegate/standalone/src/logger.rs
@@ -1,9 +1,6 @@
// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
// SPDX-License-Identifier: MPL-2.0
-// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
-// SPDX-License-Identifier: MPL-2.0
-
use colored::Colorize;
use log::Level;
use std::io::Write;
diff --git a/src/typegraph/core/src/runtimes/prisma/type_generation/mod.rs b/src/typegraph/core/src/runtimes/prisma/type_generation/mod.rs
index d273666cdc..757ec162ad 100644
--- a/src/typegraph/core/src/runtimes/prisma/type_generation/mod.rs
+++ b/src/typegraph/core/src/runtimes/prisma/type_generation/mod.rs
@@ -1,5 +1,4 @@
// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
-//
// SPDX-License-Identifier: MPL-2.0
//! This module is responsible for generating the types for prisma operations.
diff --git a/src/typegraph/core/src/types/type_ref.rs b/src/typegraph/core/src/types/type_ref.rs
index aa4a0b09ac..57cd33b591 100644
--- a/src/typegraph/core/src/types/type_ref.rs
+++ b/src/typegraph/core/src/types/type_ref.rs
@@ -1,3 +1,6 @@
+// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
+// SPDX-License-Identifier: MPL-2.0
+
use std::hash::Hash;
use std::rc::Rc;
diff --git a/src/typegraph/core/src/types/type_ref/as_id.rs b/src/typegraph/core/src/types/type_ref/as_id.rs
index c5d2160eae..8b2c578b37 100644
--- a/src/typegraph/core/src/types/type_ref/as_id.rs
+++ b/src/typegraph/core/src/types/type_ref/as_id.rs
@@ -1,3 +1,6 @@
+// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
+// SPDX-License-Identifier: MPL-2.0
+
use serde::{Deserialize, Serialize};
use super::{ExtendedTypeDef, FindAttribute as _, RefAttr, TypeRef};
diff --git a/src/typegraph/core/src/types/type_ref/injection.rs b/src/typegraph/core/src/types/type_ref/injection.rs
index 9ae2846057..7296cc758b 100644
--- a/src/typegraph/core/src/types/type_ref/injection.rs
+++ b/src/typegraph/core/src/types/type_ref/injection.rs
@@ -1,3 +1,6 @@
+// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
+// SPDX-License-Identifier: MPL-2.0
+
use super::{RefAttr, TypeRef};
use crate::types::Type;
use crate::wit::utils::ReduceEntry;
diff --git a/src/typegraph/core/src/types/type_ref/policy.rs b/src/typegraph/core/src/types/type_ref/policy.rs
index 18e965fc23..6995a8b331 100644
--- a/src/typegraph/core/src/types/type_ref/policy.rs
+++ b/src/typegraph/core/src/types/type_ref/policy.rs
@@ -1,3 +1,6 @@
+// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
+// SPDX-License-Identifier: MPL-2.0
+
use crate::errors::{Result, TgError};
use crate::types::Type;
use serde::{Deserialize, Serialize};
diff --git a/src/typegraph/core/src/types/type_ref/runtime_config.rs b/src/typegraph/core/src/types/type_ref/runtime_config.rs
index fc26313706..bcd2438f13 100644
--- a/src/typegraph/core/src/types/type_ref/runtime_config.rs
+++ b/src/typegraph/core/src/types/type_ref/runtime_config.rs
@@ -1,3 +1,6 @@
+// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
+// SPDX-License-Identifier: MPL-2.0
+
use super::{RefAttr, TypeRef};
use crate::errors::{Result, TgError};
use crate::types::Type;
diff --git a/src/typegraph/core/src/types/type_ref/xdef.rs b/src/typegraph/core/src/types/type_ref/xdef.rs
index 0cf7ce5960..613c5c9635 100644
--- a/src/typegraph/core/src/types/type_ref/xdef.rs
+++ b/src/typegraph/core/src/types/type_ref/xdef.rs
@@ -1,3 +1,6 @@
+// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
+// SPDX-License-Identifier: MPL-2.0
+
use super::{FlatTypeRef, FlatTypeRefTarget, RefAttr, RefAttrs, TypeRef};
use crate::errors::Result;
use crate::global_store::Store;
diff --git a/src/typegraph/core/src/utils/postprocess/naming.rs b/src/typegraph/core/src/utils/postprocess/naming.rs
index 708a38581a..ab636ae38a 100644
--- a/src/typegraph/core/src/utils/postprocess/naming.rs
+++ b/src/typegraph/core/src/utils/postprocess/naming.rs
@@ -1,3 +1,6 @@
+// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
+// SPDX-License-Identifier: MPL-2.0
+
use std::{
collections::{HashMap, HashSet},
rc::Rc,
diff --git a/src/typegraph/deno/deno.json b/src/typegraph/deno/deno.json
index 960caa6de9..ad7121212f 100644
--- a/src/typegraph/deno/deno.json
+++ b/src/typegraph/deno/deno.json
@@ -8,6 +8,13 @@
"!README.md"
]
},
+ "lint": {
+ "rules": {
+ "exclude": [
+ "no-external-import"
+ ]
+ }
+ },
"exports": {
"./deps/_import.ts": "./src/deps/_import.ts",
"./deps/mod.ts": "./src/deps/mod.ts",
@@ -25,6 +32,7 @@
"./providers/temporal.ts": "./src/providers/temporal.ts",
"./runtimes/deno.ts": "./src/runtimes/deno.ts",
"./runtimes/graphql.ts": "./src/runtimes/graphql.ts",
+ "./runtimes/grpc.ts": "./src/runtimes/grpc.ts",
"./runtimes/http.ts": "./src/runtimes/http.ts",
"./runtimes/kv.ts": "./src/runtimes/kv.ts",
"./runtimes/mod.ts": "./src/runtimes/mod.ts",
@@ -37,9 +45,6 @@
"./tg_manage.ts": "./src/tg_manage.ts",
"./typegraph.ts": "./src/typegraph.ts",
"./types.ts": "./src/types.ts",
- "./utils/func_utils.ts": "./src/utils/func_utils.ts",
- "./utils/injection_utils.ts": "./src/utils/injection_utils.ts",
- "./utils/type_utils.ts": "./src/utils/type_utils.ts",
"./wit.ts": "./src/wit.ts"
}
}
diff --git a/src/typegraph/deno/src/deps/_import.ts b/src/typegraph/deno/src/deps/_import.ts
index b21c30e5ab..eb6a58283a 100644
--- a/src/typegraph/deno/src/deps/_import.ts
+++ b/src/typegraph/deno/src/deps/_import.ts
@@ -1,4 +1,4 @@
-// no-auto-license-header
+// no-auto-license-header | @generated (pre-commit doesn't support two headers)
/*
The MIT License (MIT)
@@ -31,6 +31,7 @@ export interface Bind {
export const up = 3;
+// deno-lint-ignore no-explicit-any
export function caller(this: Bind | any, levelUp = up): string | undefined {
const err = new Error();
const stack = err.stack?.split("\n")[levelUp];
@@ -39,6 +40,7 @@ export function caller(this: Bind | any, levelUp = up): string | undefined {
}
}
+// deno-lint-ignore no-explicit-any
export function getFile(this: Bind | any, stack: string): string {
stack = stack.substr(stack.indexOf("at ") + 3);
if (!stack.startsWith("file://")) {
@@ -48,7 +50,7 @@ export function getFile(this: Bind | any, stack: string): string {
let file = `${path[0]}:${path[1]}`;
if ((this as Bind)?.cb) {
- const cb = (this as Bind).cb as any;
+ const cb = (this as Bind).cb!;
file = cb(file);
}
return file;
diff --git a/src/typegraph/deno/src/deps/mod.ts b/src/typegraph/deno/src/deps/mod.ts
index 1c558b0f17..0ad837fc8c 100644
--- a/src/typegraph/deno/src/deps/mod.ts
+++ b/src/typegraph/deno/src/deps/mod.ts
@@ -2,13 +2,16 @@
// SPDX-License-Identifier: MPL-2.0
export { caller } from "./_import.ts";
-export function mapValues(
- object: object,
- fn: (value: any, key: string, object: object) => any,
-): any {
+export function mapValues<
+ O extends Record,
+ T,
+>(
+ object: O,
+ fn: (value: O[keyof O], key: keyof O, object: O) => T,
+): Record {
const newEntries = Object.entries(object).map(([k, v]) => [
k,
- fn(v, k, object),
+ fn(v as O[keyof O], k, object),
]);
return Object.fromEntries(newEntries);
}
diff --git a/src/typegraph/deno/src/effects.ts b/src/typegraph/deno/src/effects.ts
index 8c5dbcdf7e..92bd6edd92 100644
--- a/src/typegraph/deno/src/effects.ts
+++ b/src/typegraph/deno/src/effects.ts
@@ -1,7 +1,7 @@
// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
// SPDX-License-Identifier: MPL-2.0
-import {
+import type {
EffectCreate,
EffectDelete,
EffectRead,
diff --git a/src/typegraph/deno/src/envs/cli.ts b/src/typegraph/deno/src/envs/cli.ts
index e15a5dcb35..d9315ef1d1 100644
--- a/src/typegraph/deno/src/envs/cli.ts
+++ b/src/typegraph/deno/src/envs/cli.ts
@@ -43,7 +43,7 @@ export function loadCliEnv(): CliEnv | null {
} else {
switch (key) {
case "command":
- if (!COMMANDS.includes(envValue as any)) {
+ if (!(COMMANDS as readonly string[]).includes(envValue)) {
throw new Error(
`${name} env value should be one of: serialize, deploy`,
);
@@ -93,7 +93,7 @@ export function loadCliEnv(): CliEnv | null {
return record as CliEnv;
}
-export const CLI_ENV = loadCliEnv();
+export const CLI_ENV: CliEnv | null = loadCliEnv();
/** check if running in the meta cli */
export function hasCliEnv(): boolean {
diff --git a/src/typegraph/deno/src/io.ts b/src/typegraph/deno/src/io.ts
index e11fab63ab..a572c7e258 100644
--- a/src/typegraph/deno/src/io.ts
+++ b/src/typegraph/deno/src/io.ts
@@ -30,6 +30,7 @@ type RpcNotificationMethod =
| "Success"
| "Failure";
+// deno-lint-ignore no-explicit-any
const rpcNotify = (method: RpcNotificationMethod, params: any = null) => {
const message = JSON.stringify({
jsonrpc: JSONRPC_VERSION,
@@ -39,6 +40,7 @@ const rpcNotify = (method: RpcNotificationMethod, params: any = null) => {
writeRpcMessage(message);
};
+// deno-lint-ignore no-explicit-any
function getOutput(args: any[]) {
return args
.map((arg) => {
@@ -53,24 +55,36 @@ function getOutput(args: any[]) {
.join(" ");
}
-export const log = {
- debug(...args: any[]) {
+export const log: {
+ // deno-lint-ignore no-explicit-any
+ debug(...args: any[]): void;
+ // deno-lint-ignore no-explicit-any
+ info(...args: any[]): void;
+ // deno-lint-ignore no-explicit-any
+ warn(...args: any[]): void;
+ // deno-lint-ignore no-explicit-any
+ error(...args: any[]): void;
+ // deno-lint-ignore no-explicit-any
+ failure(data: any): void;
+ // deno-lint-ignore no-explicit-any
+ success(data: any, noEncode?: boolean): void;
+} = {
+ debug(...args): void {
rpcNotify("Debug", { message: getOutput(args) });
},
- info(...args: any[]) {
+ info(...args): void {
rpcNotify("Info", { message: getOutput(args) });
},
- warn(...args: any[]) {
+ warn(...args): void {
rpcNotify("Warning", { message: getOutput(args) });
},
- error(...args: any[]) {
+ error(...args): void {
rpcNotify("Error", { message: getOutput(args) });
},
-
- failure(data: any) {
+ failure(data): void {
rpcNotify("Failure", { data: data });
},
- success(data: any, noEncode = false) {
+ success(data, noEncode = false): void {
if (noEncode) {
rpcNotify("Success", { data: JSON.parse(data) });
} else {
@@ -80,7 +94,7 @@ export const log = {
};
class RpcResponseReader {
- private buffer: string = "";
+ private buffer = "";
constructor() {
process.stdin.setEncoding("utf-8");
@@ -109,7 +123,7 @@ class RpcResponseReader {
resolve(message.result);
break;
}
- } catch (e) {
+ } catch {
reject("invalid message");
}
}
@@ -124,6 +138,7 @@ const rpcCall = (() => {
const responseReader = new RpcResponseReader();
let latestRpcId = 0;
+ // deno-lint-ignore no-explicit-any
return (method: string, params: any = null) => {
const rpcId = latestRpcId++;
const rpcMessage = JSON.stringify({
diff --git a/src/typegraph/deno/src/metagen.ts b/src/typegraph/deno/src/metagen.ts
index ac347c11f1..d0bd191e83 100644
--- a/src/typegraph/deno/src/metagen.ts
+++ b/src/typegraph/deno/src/metagen.ts
@@ -1,12 +1,12 @@
// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
// SPDX-License-Identifier: MPL-2.0
-import {
+import type {
FdkConfig,
FdkOutput,
SerializeParams,
} from "./gen/typegraph_core.d.ts";
-import { TypegraphOutput } from "./typegraph.ts";
+import type { TypegraphOutput } from "./typegraph.ts";
import { wit_utils } from "./wit.ts";
import { freezeTgOutput } from "./utils/func_utils.ts";
@@ -46,7 +46,7 @@ export class Metagen {
overwrite?: false,
): Array {
const fdkConfig = this.getFdkConfig(tgOutput, targetName);
- return wit_utils.metagenExec(fdkConfig).map((value: any) => ({
+ return wit_utils.metagenExec(fdkConfig).map((value) => ({
...value,
overwrite: overwrite ?? value.overwrite,
})) as Array;
diff --git a/src/typegraph/deno/src/params.ts b/src/typegraph/deno/src/params.ts
index 669cc40279..25cbd2d7d0 100644
--- a/src/typegraph/deno/src/params.ts
+++ b/src/typegraph/deno/src/params.ts
@@ -2,12 +2,13 @@
// SPDX-License-Identifier: MPL-2.0
import { RawAuth } from "./typegraph.ts";
-import { Auth as Auth_, wit_utils } from "./wit.ts";
-import * as t from "./types.ts";
+import { type Auth as Auth_, wit_utils } from "./wit.ts";
+import type * as t from "./types.ts";
export type StdOauth2Profiler =
| { profiler: "default" }
| { profiler: "none" }
+ // deno-lint-ignore no-explicit-any
| { profiler: "extended"; extension: any }
| { profiler: "custom"; id: number };
@@ -19,6 +20,7 @@ export function defaultProfiler(): StdOauth2Profiler {
return { profiler: "default" };
}
+// deno-lint-ignore no-explicit-any
export function extendedProfiler(extension: any): StdOauth2Profiler {
return { profiler: "extended", extension };
}
@@ -28,13 +30,13 @@ export function customProfiler(func: t.Typedef): StdOauth2Profiler {
}
export class Auth {
- static jwt(name: string, format: string, algorithm?: any): Auth_ {
- if (!algorithm) {
- algorithm = {};
+ static jwt(name: string, format: string, algorithmParams?: object): Auth_ {
+ if (!algorithmParams) {
+ algorithmParams = {};
}
const authData = [
["format", JSON.stringify(format)],
- ["algorithm", JSON.stringify(algorithm)],
+ ["algorithm", JSON.stringify(algorithmParams)],
] as [string, string][];
return {
diff --git a/src/typegraph/deno/src/policy.ts b/src/typegraph/deno/src/policy.ts
index 8059b87508..13454f192c 100644
--- a/src/typegraph/deno/src/policy.ts
+++ b/src/typegraph/deno/src/policy.ts
@@ -1,15 +1,15 @@
// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
// SPDX-License-Identifier: MPL-2.0
-import { ContextCheck, MaterializerId } from "./gen/typegraph_core.d.ts";
+import type { ContextCheck, MaterializerId } from "./gen/typegraph_core.d.ts";
import { core } from "./wit.ts";
-interface PolicyPerEffectAlt {
+type PolicyPerEffectAlt = {
update?: Policy;
delete?: Policy;
create?: Policy;
read?: Policy;
-}
+};
export class PolicyPerEffectObject {
constructor(public readonly value: PolicyPerEffectAlt) {}
diff --git a/src/typegraph/deno/src/providers/aws.ts b/src/typegraph/deno/src/providers/aws.ts
index 25cb62b2b6..e71ddaa12c 100644
--- a/src/typegraph/deno/src/providers/aws.ts
+++ b/src/typegraph/deno/src/providers/aws.ts
@@ -1,9 +1,9 @@
// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
// SPDX-License-Identifier: MPL-2.0
-import { Materializer, Runtime } from "../runtimes/mod.ts";
+import { type Materializer, Runtime } from "../runtimes/mod.ts";
import { aws } from "../wit.ts";
-import {
+import type {
S3PresignGetParams,
S3PresignPutParams,
S3RuntimeData,
diff --git a/src/typegraph/deno/src/providers/prisma.ts b/src/typegraph/deno/src/providers/prisma.ts
index aa037fffb0..d39704f1fc 100644
--- a/src/typegraph/deno/src/providers/prisma.ts
+++ b/src/typegraph/deno/src/providers/prisma.ts
@@ -5,7 +5,7 @@ import { Runtime } from "../runtimes/mod.ts";
import { runtimes } from "../wit.ts";
import { Typedef } from "../types.ts";
import { t } from "../index.ts";
-import { Effect } from "../gen/typegraph_core.d.ts";
+import type { Effect } from "../gen/typegraph_core.d.ts";
import { genRef } from "./../typegraph.ts";
type PrismaLinkArg = {
diff --git a/src/typegraph/deno/src/providers/temporal.ts b/src/typegraph/deno/src/providers/temporal.ts
index 729a1d1ff2..b2184affe0 100644
--- a/src/typegraph/deno/src/providers/temporal.ts
+++ b/src/typegraph/deno/src/providers/temporal.ts
@@ -3,8 +3,8 @@
import { Runtime } from "../runtimes/mod.ts";
import { runtimes } from "../wit.ts";
-import { Func, Typedef } from "../types.ts";
-import {
+import { Func, type Typedef } from "../types.ts";
+import type {
TemporalOperationData,
TemporalOperationType,
} from "../gen/typegraph_core.d.ts";
diff --git a/src/typegraph/deno/src/runtimes/deno.ts b/src/typegraph/deno/src/runtimes/deno.ts
index ebf68b35a4..f72cc9b6e3 100644
--- a/src/typegraph/deno/src/runtimes/deno.ts
+++ b/src/typegraph/deno/src/runtimes/deno.ts
@@ -26,6 +26,7 @@ interface PredefinedFuncMat extends Materializer {
}
export interface DenoFunc {
+ // deno-lint-ignore no-explicit-any
code: string | ((...args: any[]) => any);
secrets?: Array;
effect?: Effect;
@@ -39,6 +40,7 @@ export interface DenoImport {
effect?: Effect;
}
+// deno-lint-ignore no-explicit-any
function stringifyFn(code: string | ((...any: []) => any)) {
if (typeof code == "function") {
const source = code.toString();
@@ -115,6 +117,7 @@ export class DenoRuntime extends Runtime {
}
/** use a static function already registered on the typegate */
+ // deno-lint-ignore no-explicit-any
static
(out: P, value: any): t.Func {
const mat = {
_id: runtimes.registerDenoStatic(
diff --git a/src/typegraph/deno/src/runtimes/graphql.ts b/src/typegraph/deno/src/runtimes/graphql.ts
index e53fa2abc1..4e89980417 100644
--- a/src/typegraph/deno/src/runtimes/graphql.ts
+++ b/src/typegraph/deno/src/runtimes/graphql.ts
@@ -1,10 +1,10 @@
// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
// SPDX-License-Identifier: MPL-2.0
-import { Effect } from "../gen/typegraph_core.d.ts";
+import type { Effect } from "../gen/typegraph_core.d.ts";
import * as t from "../types.ts";
import { runtimes } from "../wit.ts";
-import { Materializer, Runtime } from "./mod.ts";
+import { type Materializer, Runtime } from "./mod.ts";
import { fx } from "../index.ts";
export class GraphQLRuntime extends Runtime {
diff --git a/src/typegraph/deno/src/runtimes/grpc.ts b/src/typegraph/deno/src/runtimes/grpc.ts
index d75be27f79..c32635d401 100644
--- a/src/typegraph/deno/src/runtimes/grpc.ts
+++ b/src/typegraph/deno/src/runtimes/grpc.ts
@@ -14,7 +14,7 @@ export class GrpcRuntime extends Runtime {
super(id);
}
- call(method: string) {
+ call(method: string): Func {
const funcData = runtimes.callGrpcMethod(this._id, { method: method });
return Func.fromTypeFunc(funcData);
}
diff --git a/src/typegraph/deno/src/runtimes/http.ts b/src/typegraph/deno/src/runtimes/http.ts
index 992ad7ac93..7965bfadff 100644
--- a/src/typegraph/deno/src/runtimes/http.ts
+++ b/src/typegraph/deno/src/runtimes/http.ts
@@ -2,13 +2,13 @@
// SPDX-License-Identifier: MPL-2.0
import * as t from "../types.ts";
-import {
+import type {
Effect,
HttpMethod,
MaterializerHttpRequest,
} from "../gen/typegraph_core.d.ts";
import { runtimes } from "../wit.ts";
-import { Materializer, Runtime } from "./mod.ts";
+import { type Materializer, Runtime } from "./mod.ts";
import { fx } from "../index.ts";
type HttpRequestMat =
diff --git a/src/typegraph/deno/src/runtimes/kv.ts b/src/typegraph/deno/src/runtimes/kv.ts
index d3965b3a65..4c29222ae0 100644
--- a/src/typegraph/deno/src/runtimes/kv.ts
+++ b/src/typegraph/deno/src/runtimes/kv.ts
@@ -1,10 +1,10 @@
// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
// SPDX-License-Identifier: MPL-2.0
-import { Materializer, Runtime } from "./mod.ts";
+import { type Materializer, Runtime } from "./mod.ts";
import * as t from "../types.ts";
import { runtimes } from "../wit.ts";
-import { Effect, KvMaterializer } from "../gen/typegraph_core.d.ts";
+import type { Effect, KvMaterializer } from "../gen/typegraph_core.d.ts";
import { fx } from "../index.ts";
@@ -34,7 +34,11 @@ export class KvRuntime extends Runtime {
return new KvOperationMat(mad_id, operation);
}
- set() {
+ set(): t.Func<
+ t.Struct<{ key: t.String; value: t.String }>,
+ t.String,
+ KvOperationMat
+ > {
const mat = this.#operation("set", fx.update());
return t.func(
t.struct({ "key": t.string(), "value": t.string() }),
@@ -43,18 +47,18 @@ export class KvRuntime extends Runtime {
);
}
- get() {
+ get(): t.Func, t.Optional, KvOperationMat> {
const mat = this.#operation("get", fx.read());
// FIXME: consolidate response type construction inside tg_core
return t.func(t.struct({ "key": t.string() }), t.string().optional(), mat);
}
- delete() {
+ delete(): t.Func, t.Integer, KvOperationMat> {
const mat = this.#operation("delete", fx.delete_());
return t.func(t.struct({ "key": t.string() }), t.integer(), mat);
}
- keys() {
+ keys(): t.Func, t.List, KvOperationMat> {
const mat = this.#operation("keys", fx.read());
return t.func(
t.struct({ "filter": t.string().optional() }),
@@ -63,7 +67,7 @@ export class KvRuntime extends Runtime {
);
}
- values() {
+ values(): t.Func, t.List, KvOperationMat> {
const mat = this.#operation("values", fx.read());
return t.func(
t.struct({ "filter": t.string().optional() }),
diff --git a/src/typegraph/deno/src/runtimes/python.ts b/src/typegraph/deno/src/runtimes/python.ts
index 791a59306f..391afac0d2 100644
--- a/src/typegraph/deno/src/runtimes/python.ts
+++ b/src/typegraph/deno/src/runtimes/python.ts
@@ -3,10 +3,9 @@
import * as t from "../types.ts";
import { runtimes } from "../wit.ts";
-import { Effect, SubstantialBackend } from "../gen/typegraph_core.d.ts";
-import { Materializer, Runtime } from "./mod.ts";
+import type { Effect } from "../gen/typegraph_core.d.ts";
+import { type Materializer, Runtime } from "./mod.ts";
import { fx } from "../index.ts";
-import { SubstantialRuntime } from "../runtimes/substantial.ts";
interface LambdaMat extends Materializer {
fn: string;
diff --git a/src/typegraph/deno/src/runtimes/random.ts b/src/typegraph/deno/src/runtimes/random.ts
index 330944e561..1c57a5f4f8 100644
--- a/src/typegraph/deno/src/runtimes/random.ts
+++ b/src/typegraph/deno/src/runtimes/random.ts
@@ -3,8 +3,8 @@
import * as t from "../types.ts";
import { runtimes } from "../wit.ts";
-import { RandomRuntimeData } from "../gen/typegraph_core.d.ts";
-import { Materializer, Runtime } from "./mod.ts";
+import type { RandomRuntimeData } from "../gen/typegraph_core.d.ts";
+import { type Materializer, Runtime } from "./mod.ts";
import { fx } from "../index.ts";
interface RandomMat extends Materializer {
diff --git a/src/typegraph/deno/src/runtimes/wasm.ts b/src/typegraph/deno/src/runtimes/wasm.ts
index 462f8a261c..cf42c433e2 100644
--- a/src/typegraph/deno/src/runtimes/wasm.ts
+++ b/src/typegraph/deno/src/runtimes/wasm.ts
@@ -3,8 +3,8 @@
import * as t from "../types.ts";
import { runtimes } from "../wit.ts";
-import { Effect } from "../gen/typegraph_core.d.ts";
-import { Materializer, Runtime } from "./mod.ts";
+import type { Effect } from "../gen/typegraph_core.d.ts";
+import { type Materializer, Runtime } from "./mod.ts";
import { fx } from "../index.ts";
export class WasmRuntime extends Runtime {
diff --git a/src/typegraph/deno/src/tg_artifact_upload.ts b/src/typegraph/deno/src/tg_artifact_upload.ts
index d762f9623f..8560a1f3c3 100644
--- a/src/typegraph/deno/src/tg_artifact_upload.ts
+++ b/src/typegraph/deno/src/tg_artifact_upload.ts
@@ -1,8 +1,8 @@
// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
// SPDX-License-Identifier: MPL-2.0
-import { BasicAuth } from "./tg_deploy.ts";
-import { Artifact } from "./gen/typegraph_core.d.ts";
+import type { BasicAuth } from "./tg_deploy.ts";
+import type { Artifact } from "./gen/typegraph_core.d.ts";
import { dirname, join } from "node:path";
import * as fsp from "node:fs/promises";
import { log } from "./io.ts";
@@ -60,7 +60,7 @@ export class ArtifactUploader {
private async upload(
token: string | null,
meta: UploadArtifactMeta,
- ): Promise {
+ ): Promise