Skip to content

Commit 3cb34e1

Browse files
committed
Merge branch 'main' of https://github.com/metatypedev/metatype into MET-430--Upload-protocol-poc--uploading-wasm-file-for-WasmEdgeRuntime-for-single-replica-mode-
2 parents 3d724f8 + 97caf65 commit 3cb34e1

File tree

42 files changed

+1392
-1380
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1392
-1380
lines changed

CHANGELOG.md

Lines changed: 1285 additions & 1297 deletions
Large diffs are not rendered by default.

Cargo.lock

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ members = [
88
"typegraph/core", ]
99

1010
[workspace.package]
11-
version = "0.3.6-0"
11+
version = "0.3.7-0"
1212
edition = "2021"
1313

1414
[workspace.dependencies]

dev-tools/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "VSCode extension for Metatype support",
55
"icon": "logo.png",
66
"author": "Metatype Team",
7-
"version": "0.3.6-0",
7+
"version": "0.3.7-0",
88
"repository": {
99
"type": "git",
1010
"url": "https://github.com/metatypedev/metatype"

dev-tools/ts-language-server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "typegraph-ts-server",
33
"description": "TypeScript language server for TypeGraph",
44
"author": "Metatype Team",
5-
"version": "0.3.6-0",
5+
"version": "0.3.7-0",
66
"repository": {
77
"type": "git",
88
"url": "https://github.com/metatypedev/metatype"

dev-tools/vscode-metatype-support/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "vscode-metatype-support",
33
"description": "VSCode extension for Metatype support",
44
"author": "Metatype Team",
5-
"version": "0.3.6-0",
5+
"version": "0.3.7-0",
66
"repository": {
77
"type": "git",
88
"url": "https://github.com/metatypedev/metatype"

dev/lock.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ dev:
9494
WASMEDGE_VERSION: 0.13.5
9595
TYPEGRAPH_VERSION: 0.0.3
9696
PRISMA_VERSION: 5.5.2
97-
METATYPE_VERSION: 0.3.6-0
98-
PUBLISHED_VERSION: 0.3.5
97+
METATYPE_VERSION: 0.3.7-0
98+
PUBLISHED_VERSION: 0.3.6
9999
WASM_OPT_VERSION: 0.116.0
100100
MOLD_VERSION: v2.4.0
101101
CMAKE_VERSION: 3.28.0-rc6
Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
1-
import { Policy, t, typegraph } from "npm:@typegraph/[email protected].5/index.js";
2-
import { PythonRuntime } from "npm:@typegraph/[email protected].5/runtimes/python.js";
3-
import { DenoRuntime } from "npm:@typegraph/[email protected].5/runtimes/deno.js";
1+
import { Policy, t, typegraph } from "npm:@typegraph/[email protected].6/index.js";
2+
import { PythonRuntime } from "npm:@typegraph/[email protected].6/runtimes/python.js";
3+
import { DenoRuntime } from "npm:@typegraph/[email protected].6/runtimes/deno.js";
44

55
await typegraph("example", (g) => {
66
const pub = Policy.public();
77
const deno = new DenoRuntime();
88
const python = new PythonRuntime();
99

1010
g.expose({
11-
add: python.fromLambda(
12-
t.struct({ "first": t.float(), "second": t.float() }),
13-
t.float(),
14-
{ code: "lambda x: x['first'] + x['second']" },
15-
).withPolicy(pub),
16-
multiply: deno.func(
17-
t.struct({ "first": t.float(), "second": t.float() }),
18-
t.float(),
19-
{ code: "({first, second}) => first * second" },
20-
).withPolicy(pub),
11+
add: python
12+
.fromLambda(
13+
t.struct({ first: t.float(), second: t.float() }),
14+
t.float(),
15+
{ code: "lambda x: x['first'] + x['second']" }
16+
)
17+
.withPolicy(pub),
18+
multiply: deno
19+
.func(t.struct({ first: t.float(), second: t.float() }), t.float(), {
20+
code: "({first, second}) => first * second",
21+
})
22+
.withPolicy(pub),
2123
});
2224
});

examples/templates/deno/compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
services:
22
typegate:
3-
image: ghcr.io/metatypedev/typegate:v0.3.6-0
3+
image: ghcr.io/metatypedev/typegate:v0.3.7-0
44
restart: always
55
ports:
66
- "7890:7890"

examples/templates/node/compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
services:
22
typegate:
3-
image: ghcr.io/metatypedev/typegate:v0.3.6-0
3+
image: ghcr.io/metatypedev/typegate:v0.3.7-0
44
restart: always
55
ports:
66
- "7890:7890"

examples/templates/node/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"dev": "MCLI_LOADER_CMD='npm x tsx' meta dev"
77
},
88
"dependencies": {
9-
"@typegraph/sdk": "^0.3.5"
9+
"@typegraph/sdk": "^0.3.6"
1010
},
1111
"devDependencies": {
1212
"tsx": "^3.13.0",

examples/templates/python/compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
services:
22
typegate:
3-
image: ghcr.io/metatypedev/typegate:v0.3.6-0
3+
image: ghcr.io/metatypedev/typegate:v0.3.7-0
44
restart: always
55
ports:
66
- "7890:7890"

examples/templates/python/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[tool.poetry]
22
name = "example"
3-
version = "0.3.6-0"
3+
version = "0.3.7-0"
44
description = ""
55
authors = []
66

77
[tool.poetry.dependencies]
88
python = ">=3.8,<4.0"
9-
typegraph = "0.3.6-0"
9+
typegraph = "0.3.7-0"
1010

1111
[build-system]
1212
requires = ["poetry-core"]

libs/common/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "common"
3-
version = "0.3.6-0"
3+
version = "0.3.7-0"
44
edition = "2021"
55

66
[dependencies]

libs/common/src/archive.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,17 @@ pub fn archive_entries_from_bytes(entries: IndexMap<String, Vec<u8>>) -> Result<
116116

117117
tar.mode(tar::HeaderMode::Deterministic);
118118

119+
let mut entries = entries.clone();
120+
entries.sort_keys();
121+
119122
for (path, bytes) in entries.iter() {
123+
// https://www.gnu.org/software/tar/manual/html_section/Formats.html
124+
// ustar: filesize < 8GiB, filename <= 255
125+
// let mut header = Header::new_ustar();
126+
127+
// gnu: filesize, filename unlimited
120128
let mut header = Header::new_gnu();
129+
121130
header.set_size(bytes.len() as u64);
122131
header.set_entry_type(tar::EntryType::Regular);
123132
header.set_mode(0o666); // rw-rw-rw

libs/typescript/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "typescript"
3-
version = "0.3.6-0"
3+
version = "0.3.7-0"
44
edition = "2021"
55

66
[dependencies]

libs/xtask/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "xtask"
3-
version = "0.3.6-0"
3+
version = "0.3.7-0"
44
edition = "2021"
55

66
[dependencies]

meta-cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "meta-cli"
3-
version = "0.3.6-0"
3+
version = "0.3.7-0"
44
edition = "2021"
55

66
description = "Declarative API development platform. Build serverless backends with zero-trust and less code, no matter where and how your (legacy) systems are."

meta-cli/src/cli/codegen.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
use std::path::PathBuf;
55

66
use super::{Action, GenArgs};
7+
use actix_web::dev::ServerHandle;
78
use anyhow::{bail, Result};
89
use async_trait::async_trait;
910
use clap::{Parser, Subcommand};
@@ -22,10 +23,10 @@ pub enum Commands {
2223

2324
#[async_trait]
2425
impl Action for Codegen {
25-
async fn run(&self, args: GenArgs) -> Result<()> {
26+
async fn run(&self, args: GenArgs, server_handle: Option<ServerHandle>) -> Result<()> {
2627
match &self.command {
2728
Commands::Deno(deno) => {
28-
deno.run(args).await?;
29+
deno.run(args, server_handle).await?;
2930
}
3031
}
3132
Ok(())
@@ -44,7 +45,7 @@ pub struct Deno {
4445

4546
#[async_trait]
4647
impl Action for Deno {
47-
async fn run(&self, _args: GenArgs) -> Result<()> {
48+
async fn run(&self, _args: GenArgs, _: Option<ServerHandle>) -> Result<()> {
4849
bail!("codegen is currently disabled")
4950

5051
// let dir = args.dir()?;

meta-cli/src/cli/completion.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
22
// SPDX-License-Identifier: MPL-2.0
33

4+
use actix_web::dev::ServerHandle;
45
use anyhow::{anyhow, Result};
56
use async_trait::async_trait;
67
use clap::CommandFactory;
@@ -22,7 +23,7 @@ pub struct Completion {
2223

2324
#[async_trait]
2425
impl Action for Completion {
25-
async fn run(&self, _args: GenArgs) -> Result<()> {
26+
async fn run(&self, _args: GenArgs, _: Option<ServerHandle>) -> Result<()> {
2627
let mut cmd = Args::command();
2728
let name = cmd.get_name().to_string();
2829
match self.shell.or_else(Shell::from_env) {

meta-cli/src/cli/deploy.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// SPDX-License-Identifier: MPL-2.0
33

44
use std::path::{Path, PathBuf};
5-
use std::process::exit;
65
use std::sync::{Arc, Mutex};
76

87
use super::{Action, CommonArgs, GenArgs};
@@ -17,6 +16,7 @@ use crate::deploy::actors::loader::{
1716
use crate::deploy::actors::watcher::WatcherActor;
1817
use crate::deploy::push::pusher::PushResult;
1918
use actix::prelude::*;
19+
use actix_web::dev::ServerHandle;
2020
use anyhow::{bail, Context, Result};
2121
use async_trait::async_trait;
2222
use clap::Parser;
@@ -149,7 +149,7 @@ struct CtrlCHandlerData {
149149

150150
#[async_trait]
151151
impl Action for DeploySubcommand {
152-
async fn run(&self, args: GenArgs) -> Result<()> {
152+
async fn run(&self, args: GenArgs, server_handle: Option<ServerHandle>) -> Result<()> {
153153
let deploy = Deploy::new(self, &args).await?;
154154

155155
if !self.options.allow_dirty {
@@ -179,7 +179,8 @@ impl Action for DeploySubcommand {
179179
// deploy a single file
180180
let deploy = default_mode::DefaultMode::init(deploy).await?;
181181
deploy.run().await?;
182-
exit(0); // kill the server (TODO: use a global handle maybe?)
182+
183+
server_handle.unwrap().stop(true).await;
183184
}
184185

185186
Ok(())

meta-cli/src/cli/dev.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use super::deploy::DeploySubcommand;
66
use super::Action;
77
use super::CommonArgs;
88
use super::GenArgs;
9+
use actix_web::dev::ServerHandle;
910
use anyhow::Result;
1011
use async_trait::async_trait;
1112
use clap::Parser;
@@ -28,7 +29,7 @@ pub struct Dev {
2829

2930
#[async_trait]
3031
impl Action for Dev {
31-
async fn run(&self, args: GenArgs) -> Result<()> {
32+
async fn run(&self, args: GenArgs, server_handle: Option<ServerHandle>) -> Result<()> {
3233
log::info!("'meta dev' subcommand is an alias to 'meta deploy --codegen --allow-dirty --watch --create-migration'");
3334
let options = DeployOptions {
3435
codegen: true,
@@ -46,6 +47,6 @@ impl Action for Dev {
4647
None,
4748
self.max_parallel_loads,
4849
);
49-
deploy.run(args).await
50+
deploy.run(args, server_handle).await
5051
}
5152
}

0 commit comments

Comments
 (0)