Skip to content

Commit

Permalink
feat: add prefix to deploy target (#298)
Browse files Browse the repository at this point in the history
* feat: add prefix to deploy target

* chore: prepare release 0.1.7

* chore: update pre-commit
  • Loading branch information
zifeo authored May 2, 2023
1 parent 2a9ad28 commit 852feba
Show file tree
Hide file tree
Showing 31 changed files with 125 additions and 68 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
env:
PYTHON_VERSION: "3.8"
POETRY_VERSION: "1.4.1"
DENO_VERSION: "1.32.5"
DENO_VERSION: "1.33.1"

jobs:
check-bump:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ env:
PROTOC_VERSION: "3.x"
POETRY_VERSION: "1.4.1"
DENO_BINDGEN_URL: https://github.com/metatypedev/deno_bindgen/raw/main/cli.ts
DENO_VERSION: "1.32.5"
DENO_VERSION: "1.33.1"
PNPM_VERSION: "8.1.0"
NODE_VERSION: "19.8.1"

Expand Down
5 changes: 2 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,18 @@ repos:
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-symlinks
- id: end-of-file-fixer
exclude: (typegate/deno.lock|.*\.snap$)
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: "v0.0.261"
rev: "v0.0.263"
hooks:
- id: ruff
- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black
- repo: https://github.com/commitizen-tools/commitizen
rev: v2.42.1
rev: 3.2.0
hooks:
- id: commitizen
stages: [commit-msg]
Expand Down
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dev/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG RUST_VERSION=1.69.0
ARG DENO_VERSION=1.32.5
ARG DENO_VERSION=1.33.1
ARG DISTROLESS_TAG=nonroot

FROM rust:${RUST_VERSION} AS base
Expand Down
4 changes: 2 additions & 2 deletions dev/lock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ dev:
PROTOC_VERSION: 3.x
RUST_VERSION: 1.69.0
DENO_BINDGEN_URL: 'https://github.com/metatypedev/deno_bindgen/raw/main/cli.ts'
DENO_VERSION: 1.32.5
DENO_VERSION: 1.33.1
NODE_VERSION: 19.8.1
PNPM_VERSION: 8.1.0
TYPEGRAPH_VERSION: 0.0.1
METATYPE_VERSION: 0.1.6
METATYPE_VERSION: 0.1.7
TAGLINE: >-
Compose your data, anywhere, and build iterative API blocks with
zero-trust and serverless deployment, no matter where and how your
Expand Down
2 changes: 2 additions & 0 deletions dev/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export async function run(
cwd: string = Deno.cwd(),
env: Record<string, string> = Deno.env.toObject(),
) {
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({
cmd,
cwd: cwd,
Expand All @@ -43,6 +44,7 @@ export async function runOrExit(
cwd: string = Deno.cwd(),
env: Record<string, string> = Deno.env.toObject(),
) {
// deno-lint-ignore no-deprecated-deno-api
const p = Deno.run({
cmd,
cwd: cwd,
Expand Down
2 changes: 1 addition & 1 deletion dev/tree-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if (files.length === 0) {
if (files.length > 1) {
throw new Error("Cannot accept more than one file");
}

// deno-lint-ignore no-deprecated-deno-api
const process = Deno.run({
cmd: ["cargo", "run", "-p", "meta-cli", "--", "serialize", "-f", files[0]],
stdout: "piped",
Expand Down
2 changes: 1 addition & 1 deletion examples/templates/new/compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
typegate:
image: ghcr.io/metatypedev/typegate:v0.1.6
image: ghcr.io/metatypedev/typegate:v0.1.7
platform: linux/amd64
restart: always
ports:
Expand Down
4 changes: 2 additions & 2 deletions examples/templates/new/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[tool.poetry]
name = "example"
version = "0.1.6"
version = "0.1.7"
description = ""
authors = []
readme = "README.md"

[tool.poetry.dependencies]
python = ">=3.8,<4.0"
typegraph = "0.1.6"
typegraph = "0.1.7"

[build-system]
requires = ["poetry-core"]
Expand Down
2 changes: 1 addition & 1 deletion libs/common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "common"
version = "0.1.6"
version = "0.1.7"
edition = "2021"

[dependencies]
Expand Down
51 changes: 35 additions & 16 deletions libs/common/src/typegraph/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use serde_json::Value;
use serde_with::skip_serializing_none;

#[cfg_attr(feature = "codegen", derive(JsonSchema))]
#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct Typegraph {
#[serde(rename = "$id")]
pub id: String,
Expand All @@ -33,7 +33,7 @@ pub struct Typegraph {
}

#[cfg_attr(feature = "codegen", derive(JsonSchema))]
#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct Cors {
pub allow_origin: Vec<String>,
pub allow_headers: Vec<String>,
Expand All @@ -45,7 +45,7 @@ pub struct Cors {
}

#[cfg_attr(feature = "codegen", derive(JsonSchema))]
#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Clone, Debug)]
#[serde(rename_all = "lowercase")]
pub enum AuthProtocol {
OAuth2,
Expand All @@ -54,15 +54,15 @@ pub enum AuthProtocol {
}

#[cfg_attr(feature = "codegen", derive(JsonSchema))]
#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct Auth {
pub name: String,
pub protocol: AuthProtocol,
pub auth_data: IndexMap<String, Value>,
}

#[cfg_attr(feature = "codegen", derive(JsonSchema))]
#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct Rate {
pub window_limit: u32,
pub window_sec: u32,
Expand All @@ -72,7 +72,7 @@ pub struct Rate {
}

#[cfg_attr(feature = "codegen", derive(JsonSchema))]
#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct TypeMeta {
pub secrets: Vec<String>,
pub cors: Cors,
Expand Down Expand Up @@ -109,22 +109,22 @@ pub struct Materializer {
}

#[cfg_attr(feature = "codegen", derive(JsonSchema))]
#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct TGRuntime {
pub name: String,
pub data: IndexMap<String, Value>,
}

#[cfg_attr(feature = "codegen", derive(JsonSchema))]
#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct Policy {
pub name: String,
pub materializer: u32,
}

#[cfg_attr(feature = "codegen", derive(JsonSchema))]
#[skip_serializing_none]
#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct PolicyIndicesByEffect {
pub none: Option<u32>,
pub create: Option<u32>,
Expand All @@ -135,7 +135,7 @@ pub struct PolicyIndicesByEffect {

#[cfg_attr(feature = "codegen", derive(JsonSchema))]
#[skip_serializing_none]
#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Clone, Debug)]
#[serde(untagged)]
pub enum PolicyIndices {
Policy(u32),
Expand All @@ -144,12 +144,31 @@ pub enum PolicyIndices {

impl Typegraph {
pub fn name(&self) -> Result<String> {
let root_type = &self.types[0];
match root_type {
match &self.types[0] {
TypeNode::Object { base, .. } => Ok(base.title.clone()),
_ => bail!("invalid variant for root type"),
}
}

pub fn with_prefix(&self, prefix: &String) -> Result<Self> {
match &self.types[0] {
TypeNode::Object { base, data } => {
let new_type = TypeNode::Object {
base: TypeNodeBase {
title: format!("{}{}", prefix, base.title),
..base.clone()
},
data: data.clone(),
};
let tg = Typegraph {
types: vec![new_type],
..self.clone()
};
Ok(tg)
}
_ => bail!("invalid variant for root type"),
}
}
}

impl TypeNode {
Expand All @@ -163,19 +182,19 @@ impl TypeNode {
}

#[cfg_attr(feature = "codegen", derive(JsonSchema))]
#[derive(Serialize, Deserialize)]
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct FunctionMatData {
pub script: String,
}

#[cfg_attr(feature = "codegen", derive(JsonSchema))]
#[derive(Debug, Serialize, Deserialize)]
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct ModuleMatData {
pub code: String,
}

#[cfg_attr(feature = "codegen", derive(JsonSchema))]
#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct MigrationOptions {
pub migration_files: Option<String>,
// enable migration creation
Expand All @@ -187,7 +206,7 @@ pub struct MigrationOptions {

#[cfg_attr(feature = "codegen", derive(JsonSchema))]
#[skip_serializing_none]
#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct PrismaRuntimeData {
pub name: String,
pub datamodel: String,
Expand Down
Loading

0 comments on commit 852feba

Please sign in to comment.