Skip to content

Commit

Permalink
fix(docs): fix demo typegraphs 2 (#756)
Browse files Browse the repository at this point in the history
<!--
Pull requests are squashed and merged using:
- their title as the commit message
- their description as the commit body

Having a good title and description is important for the users to get
readable changelog.
-->

Fix example typegraphs on metatype.dev.
- [x] reduce.ts
- [x] policies.ts
- [x] graphql.ts
- [x] authentication.ts

<!-- 1. Explain WHAT the change is about -->


[MET_574](https://linear.app/metatypedev/issue/MET-574/docs-fix-demo-typegraphs-2)

<!-- 2. Explain WHY the change cannot be made simpler -->



<!-- 3. Explain HOW users should update their code -->

#### Migration notes

_No Migrations Needed_

- [ ] The change comes with new or modified tests
- [ ] Hard-to-understand functions have explanatory comments
- [ ] End-user documentation is updated to reflect the change
  • Loading branch information
destifo authored Jun 20, 2024
1 parent 0890198 commit fc6a7bc
Show file tree
Hide file tree
Showing 14 changed files with 1,431 additions and 74 deletions.
46 changes: 25 additions & 21 deletions .ghjk/lock.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"version": "0",
"platform": "x86_64-linux",
"platform": "aarch64-darwin",
"moduleEntries": {
"ports": {
"version": "0",
Expand Down Expand Up @@ -784,6 +784,30 @@
"crateName": "cargo-udeps",
"profile": "dev",
"locked": true
},
"4c401f528bf0e02299e12f0033d8a2fbfc9a4681229f6ab8ac35d36294167fd6": {
"version": "3.28.0",
"depConfigs": {
"cpy_bs_ghrel": {
"version": "3.12.2",
"depConfigs": {
"tar_aa": {
"version": "1.34",
"depConfigs": {},
"portRef": "[email protected]"
},
"zstd_aa": {
"version": "v1.5.5,",
"depConfigs": {},
"portRef": "[email protected]"
}
},
"portRef": "[email protected]",
"releaseTag": "20240224"
}
},
"portRef": "[email protected]",
"packageName": "cmake"
}
}
},
Expand All @@ -809,7 +833,6 @@
"69cc04434a8b51a9d34210383f1a931646772e3b",
"8e5e02544073c4733d8f2156c404a0dd524cdaaf",
"54eba38cb79f88fca14cd3185e5bec0c3dd02682",
"e05f859f4a734a85fd3439f9b0fc0de1e733bdac",
"38285a3b335e394ccce5ac5d59e15f660bfa4cc9",
"7bbf00da8e265c56c2bff5bb7d89ba806e2590d2",
"14fd3752a984c5d82e1451f7388c73a21fcce705",
Expand Down Expand Up @@ -1353,25 +1376,6 @@
"crateName": "cross",
"locked": true
},
"e05f859f4a734a85fd3439f9b0fc0de1e733bdac": {
"version": "v2.4.0",
"port": {
"ty": "denoWorker@v1",
"name": "mold_ghrel",
"platforms": [
"aarch64-linux",
"x86_64-linux"
],
"version": "0.1.0",
"deps": [
{
"name": "tar_aa"
}
],
"moduleSpecifier": "https://raw.githubusercontent.com/metatypedev/ghjk/2725af8/ports/mold.ts"
},
"replaceLd": false
},
"38285a3b335e394ccce5ac5d59e15f660bfa4cc9": {
"version": "3.8.18",
"port": {
Expand Down
2 changes: 1 addition & 1 deletion examples/metatype.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ typegates:
BASIC_andim: hunter2
roadmap-reduce:
POSTGRES: "postgresql://postgres:password@localhost:5432/db?schema=roadmap_reduce"
BASIC_andim: hunter2
BASIC_andim: "password"
roadmap-execute:
POSTGRES: "postgresql://postgres:password@localhost:5432/db?schema=roadmap_execute"
BASIC_andim: hunter2
Expand Down
2 changes: 1 addition & 1 deletion examples/typegraphs/graphql.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def graphql(g: Graph):
public = Policy.public()

# highlight-next-line
user = t.struct({"id": t.string(), "name": t.string()})
user = t.struct({"id": t.string(), "name": t.string()}, name="User")

message = t.struct(
{
Expand Down
2 changes: 1 addition & 1 deletion examples/typegraphs/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ await typegraph({
const pub = Policy.public();

// highlight-next-line
const user = t.struct({ "id": t.string(), "name": t.string() });
const user = t.struct({ "id": t.string(), "name": t.string() }, {name: "User"});

const message = t.struct(
{
Expand Down
8 changes: 7 additions & 1 deletion typegate/src/runtimes/prisma/prisma.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,13 @@ export class PrismaRuntime extends Runtime {
iterParentStages(stages, (stage, children) => {
const mat = stage.props.materializer;
if (mat == null) {
throw new Error("");
this.logger.error(
"Materializer not found during Query Planning for Operation:",
stage.props.operationName,
);
throw new Error("Materializer not found during Query Planning.", {
cause: `${stage.props.operationName} - ${stage.props.operationType}`,
});
}
const matData = mat.data as unknown as PrismaOperationMatData;

Expand Down
Loading

0 comments on commit fc6a7bc

Please sign in to comment.