Skip to content

Commit

Permalink
Merge branch 'main' into advanced-filters
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-0acf4 committed Dec 2, 2024
2 parents 14d7003 + 6f5adbc commit ff3b58e
Show file tree
Hide file tree
Showing 24 changed files with 1,775 additions and 266 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ jobs:
- uses: dsherret/rust-toolchain-file@v1
with:
targets: ${{ matrix.target }}
- uses: mozilla-actions/[email protected].5
- uses: mozilla-actions/[email protected].6
- run: |
# sometimes, dtolnay/rust-toolchain does not select the correct default target
rustup target add ${{ matrix.target }}
Expand Down Expand Up @@ -171,7 +171,7 @@ jobs:
- uses: WyriHaximus/[email protected]
id: latest-tag
- uses: dsherret/rust-toolchain-file@v1
- uses: mozilla-actions/[email protected].5
- uses: mozilla-actions/[email protected].6
- uses: metatypedev/setup-ghjk@318209a9d215f70716a4ac89dbeb9653a2deb8bc
- shell: bash
env:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
name: Setup sccache secrets
run: echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
- if: ${{ env.AWS_ACCESS_KEY_ID != '' }}
uses: mozilla-actions/[email protected].5
uses: mozilla-actions/[email protected].6
- uses: metatypedev/setup-ghjk@318209a9d215f70716a4ac89dbeb9653a2deb8bc
- shell: bash
run: |
Expand Down Expand Up @@ -129,7 +129,7 @@ jobs:
name: Setup sccache secrets
run: echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
- if: ${{ env.AWS_ACCESS_KEY_ID != '' }}
uses: mozilla-actions/[email protected].5
uses: mozilla-actions/[email protected].6
- uses: metatypedev/setup-ghjk@318209a9d215f70716a4ac89dbeb9653a2deb8bc
with:
# temporary fix
Expand Down Expand Up @@ -245,7 +245,7 @@ jobs:
name: Setup sccache secrets
run: echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
- if: ${{ env.AWS_ACCESS_KEY_ID != '' }}
uses: mozilla-actions/[email protected].5
uses: mozilla-actions/[email protected].6
# - name: Cache deno dir
# uses: actions/cache@v4
# with:
Expand Down Expand Up @@ -314,7 +314,7 @@ jobs:
# we need secrets for coverage so we skip if not avail
# this applies to dedpendabot PRs for example
- if: ${{ env.AWS_ACCESS_KEY_ID != '' }}
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.lcov
Expand Down
2 changes: 1 addition & 1 deletion docs/metatype.dev/shared/install/meta-cli.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ executable and add it to your `PATH` or use the automated method below.
- An installer script is also provided for the CLI in our repository. Curl and install in it with the following one-liner. The installer may ask for your password.

```bash
curl -fsSL https://raw.githubusercontent.com/metatypedev/metatype/main/installer.sh | bash
curl -fsSL https://metatype.dev/installer.sh | bash
```

:::info
Expand Down
4 changes: 2 additions & 2 deletions installer.sh → docs/metatype.dev/static/installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ EXT=tar.gz
NAME=meta-cli
EXE=meta

INSTALLER_URL="https://raw.githubusercontent.com/$ORG/$REPO/main/installer.sh"
INSTALLER_URL="https://metatype.dev/install.sh"
RELEASE_URL="https://github.com/$ORG/$REPO/releases"

LATEST_VERSION=$(curl "$RELEASE_URL/latest" -s -L -I -o /dev/null -w '%{url_effective}')
Expand Down Expand Up @@ -72,7 +72,7 @@ fi
DOWNLOAD_URL="$RELEASE_URL/download/v$VERSION/$ASSET.$EXT"
echo $DOWNLOAD_URL

if curl --fail --silent --location --output "$TMP_DIR/$ASSET.$EXT" "$DOWNLOAD_URL"; then
if curl --fail --location --progress-bar --output "$TMP_DIR/$ASSET.$EXT" "$DOWNLOAD_URL"; then
printf "Downloaded successfully: %s\n" "$ASSET.$EXT"
else
cat >&2 <<EOF
Expand Down
3 changes: 2 additions & 1 deletion examples/typegraphs/func.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from typegraph.graph.params import Auth
from typegraph.providers.prisma import PrismaRuntime
from typegraph.graph.params import Cors

# skip:end


Expand Down Expand Up @@ -83,7 +84,7 @@ def roadmap(g: Graph):
parse_markdown=deno.import_(
t.struct({"raw": t.string()}),
t.string(),
module="scripts/md2html.ts.src",
module="scripts/md2html.ts",
name="parse",
),
)
Expand Down
2 changes: 1 addition & 1 deletion examples/typegraphs/func.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ await typegraph(
create_vote: db.create(vote),
// skip:end
parse_markdown: deno.import(t.struct({ raw: t.string() }), t.string(), {
module: "scripts/md2html.ts.src",
module: "scripts/md2html.ts",
name: "parse",
}),
},
Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion src/metagen/src/client_py/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ class QueryGraph(QueryGraphBase):
{{"{node_name}": NodeDescs.{meta_method}}},
"$q"
)[0]
return {node_type}(node.node_name, node.instance_name, node.args, node.sub_nodes)
return {node_type}(node.node_name, node.instance_name, node.args, node.sub_nodes, node.files)
"#
)?;
}
Expand Down Expand Up @@ -280,6 +280,7 @@ fn render_node_metas(
Rc::new(node_metas::PyNodeMetasRenderer {
name_mapper,
named_types: named_types.clone(),
input_files: manifest.input_files.clone(),
}),
);
for &id in &manifest.node_metas {
Expand Down
33 changes: 30 additions & 3 deletions src/metagen/src/client_py/node_metas.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
// SPDX-License-Identifier: MPL-2.0

use std::fmt::Write;
use std::{collections::HashMap, fmt::Write, ops::Not};

use common::typegraph::*;

use super::utils::normalize_type_title;
use crate::{interlude::*, shared::types::*};
use crate::{
interlude::*,
shared::{files::TypePath, types::*},
};

pub struct PyNodeMetasRenderer {
pub name_mapper: Rc<super::NameMapper>,
pub named_types: Rc<std::sync::Mutex<IndexSet<u32>>>,
pub input_files: Rc<HashMap<u32, Vec<TypePath>>>,
}

impl PyNodeMetasRenderer {
Expand Down Expand Up @@ -52,6 +56,7 @@ impl PyNodeMetasRenderer {
ty_name: &str,
return_node: &str,
argument_fields: Option<IndexMap<String, Rc<str>>>,
input_files: Option<String>,
) -> std::fmt::Result {
write!(
dest,
Expand Down Expand Up @@ -84,6 +89,13 @@ impl PyNodeMetasRenderer {
}},"#
)?;
}
if let Some(input_files) = input_files {
write!(
dest,
r#"
input_files={input_files},"#
)?;
}
write!(
dest,
r#"
Expand Down Expand Up @@ -172,7 +184,22 @@ impl RenderType for PyNodeMetasRenderer {
};
let node_name = &base.title;
let ty_name = normalize_type_title(node_name).to_pascal_case();
self.render_for_func(renderer, &ty_name, &return_ty_name, props)?;
let input_files = self
.input_files
.get(&cursor.id)
.map(|files| {
files
.iter()
.map(|path| path.to_vec_str())
.collect::<Vec<_>>()
})
.and_then(|files| {
files
.is_empty()
.not()
.then_some(serde_json::to_string(&files).unwrap())
});
self.render_for_func(renderer, &ty_name, &return_ty_name, props, input_files)?;
ty_name
}
TypeNode::Object { data, base } => {
Expand Down
Loading

0 comments on commit ff3b58e

Please sign in to comment.