Skip to content

Commit 6b68642

Browse files
authored
fix: broken deno runtime secret injection (#946)
- Bumps to 0.5.0-rc.9 - Fixes bug with deno secret injection #### Migration notes --- - [x] The change comes with new or modified tests - [ ] Hard-to-understand functions have explanatory comments - [ ] End-user documentation is updated to reflect the change
1 parent 37f51aa commit 6b68642

File tree

29 files changed

+130
-59
lines changed

29 files changed

+130
-59
lines changed

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
@@ -24,7 +24,7 @@ exclude = [
2424
]
2525

2626
[workspace.package]
27-
version = "0.5.0-rc.8"
27+
version = "0.5.0-rc.9"
2828
edition = "2021"
2929

3030
[workspace.dependencies]

examples/templates/deno/api/example.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Policy, t, typegraph } from "jsr:@typegraph/[email protected]";
2-
import { PythonRuntime } from "jsr:@typegraph/[email protected].8/runtimes/python";
3-
import { DenoRuntime } from "jsr:@typegraph/[email protected].8/runtimes/deno";
2+
import { PythonRuntime } from "jsr:@typegraph/[email protected].9/runtimes/python";
3+
import { DenoRuntime } from "jsr:@typegraph/[email protected].9/runtimes/deno";
44

55
await typegraph("example", (g) => {
66
const pub = Policy.public();

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.5.0-rc.8
3+
image: ghcr.io/metatypedev/typegate:v0.5.0-rc.9
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.5.0-rc.8
3+
image: ghcr.io/metatypedev/typegate:v0.5.0-rc.9
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.5.0-rc.8"
9+
"@typegraph/sdk": "^0.5.0-rc.9"
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.5.0-rc.8
3+
image: ghcr.io/metatypedev/typegate:v0.5.0-rc.9
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.5.0-rc.8"
3+
version = "0.5.0-rc.9"
44
description = ""
55
authors = []
66

77
[tool.poetry.dependencies]
88
python = ">=3.8,<4.0"
9-
typegraph = "0.5.0-rc.8"
9+
typegraph = "0.5.0-rc.9"
1010

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

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
[tool.poetry]
88
name = "metatype"
9-
version = "0.5.0-rc.8"
9+
version = "0.5.0-rc.9"
1010
description = ""
1111
authors = []
1212

src/pyrt_wit_wire/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "pyrt_wit_wire"
3-
version = "0.5.0-rc.8"
3+
version = "0.5.0-rc.9"
44
description = "Wasm component implementing the PythonRuntime host using wit_wire protocol."
55
license = "MPL-2.0"
66
readme = "README.md"

src/typegate/src/runtimes/deno/deno.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const predefinedFuncs: Record<string, Resolver<Record<string, unknown>>> = {
3737
allow: () => "ALLOW" as PolicyResolverOutput,
3838
deny: () => "DENY" as PolicyResolverOutput,
3939
pass: () => "PASS" as PolicyResolverOutput,
40-
internal_policy: ({ _: { context } }) => context.provider === "internal" ? "ALLOW" : "DENY" as PolicyResolverOutput,
40+
internal_policy: ({ _: { context } }) => context.provider === "internal" ? "ALLOW" : "PASS" as PolicyResolverOutput,
4141
};
4242

4343
export class DenoRuntime extends Runtime {
@@ -73,9 +73,9 @@ export class DenoRuntime extends Runtime {
7373

7474
const secrets: Record<string, string> = {};
7575
for (const m of materializers) {
76-
let secrets = (m.data.secrets as string[]) ?? [];
76+
let matSecrets = (m.data.secrets as string[]) ?? [];
7777
if (m.name === "outjection") {
78-
secrets = m.data.source === "secret"
78+
matSecrets = m.data.source === "secret"
7979
? [...getInjectionValues(m.data)]
8080
: [];
8181
}

src/typegate/src/runtimes/wit_wire/mod.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { getLogger } from "../../log.ts";
99

1010
const logger = getLogger(import.meta);
1111

12-
const METATYPE_VERSION = "0.5.0-rc.8";
12+
const METATYPE_VERSION = "0.5.0-rc.9";
1313

1414
export class WitWireMessenger {
1515
static async init(

src/typegraph/core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "typegraph_core"
3-
version = "0.5.0-rc.8"
3+
version = "0.5.0-rc.9"
44
edition = "2021"
55

66
[lib]

src/typegraph/core/src/global_store.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ const PREDEFINED_DENO_FUNCTIONS: &[&str] = &["identity", "true"];
108108

109109
thread_local! {
110110
pub static STORE: RefCell<Store> = RefCell::new(Store::new());
111-
pub static SDK_VERSION: String = "0.5.0-rc.8".to_owned();
111+
pub static SDK_VERSION: String = "0.5.0-rc.9".to_owned();
112112
}
113113

114114
fn with_store<T, F: FnOnce(&Store) -> T>(f: F) -> T {

src/typegraph/deno/deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@typegraph/sdk",
3-
"version": "0.5.0-rc.8",
3+
"version": "0.5.0-rc.9",
44
"publish": {
55
"exclude": [
66
"!src/gen",

src/typegraph/python/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "typegraph"
3-
version = "0.5.0-rc.8"
3+
version = "0.5.0-rc.9"
44
description = "Declarative API development platform. Build backend components with WASM, Typescript and Python, no matter where and how your (legacy) systems are."
55
authors = ["Metatype Contributors <[email protected]>"]
66
license = "MPL-2.0"

src/typegraph/python/typegraph/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
from typegraph.policy import Policy # noqa
66
from typegraph import effects as fx # noqa
77

8-
version = "0.5.0-rc.8"
8+
version = "0.5.0-rc.9"

src/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.5.0-rc.8"
3+
version = "0.5.0-rc.9"
44
edition = "2021"
55

66
# this allows us to exclude the rust files

tests/artifacts/artifacts_test.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,11 @@ for (const { mode, ...options } of variants) {
8181
...options,
8282
},
8383
async (t) => {
84-
const e = await t.engine("runtimes/deno/deno.py");
84+
const e = await t.engine("runtimes/deno/deno.py", {
85+
secrets: {
86+
DENO_SECRET: "deno_secret",
87+
},
88+
});
8589
const artifacts = e.tg.tg.meta.artifacts;
8690

8791
await t.should("have uploaded artifacts on deploy", async () => {
@@ -120,7 +124,11 @@ for (const { mode, ...options } of variants) {
120124
...options,
121125
},
122126
async (t) => {
123-
const e = await t.engine("runtimes/deno/deno.py");
127+
const e = await t.engine("runtimes/deno/deno.py", {
128+
secrets: {
129+
DENO_SECRET: "deno_secret",
130+
},
131+
});
124132
const artifacts = e.tg.tg.meta.artifacts;
125133

126134
await t.should("have uploaded artifacts on deploy", async () => {
@@ -149,7 +157,11 @@ for (const { mode, ...options } of variants) {
149157
...options,
150158
},
151159
async (t) => {
152-
const engine = await t.engine("runtimes/deno/deno.py");
160+
const engine = await t.engine("runtimes/deno/deno.py", {
161+
secrets: {
162+
DENO_SECRET: "deno_secret",
163+
},
164+
});
153165
const artifacts = engine.tg.tg.meta.artifacts;
154166

155167
const enginePartial = await t.engine("runtimes/deno/deno_partial.py");

tests/metagen/__snapshots__/metagen_test.ts.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ impl Router {
454454
}
455455
456456
pub fn init(&self, args: InitArgs) -> Result<InitResponse, InitError> {
457-
static MT_VERSION: &str = "0.5.0-rc.8";
457+
static MT_VERSION: &str = "0.5.0-rc.9";
458458
if args.metatype_version != MT_VERSION {
459459
return Err(InitError::VersionMismatch(MT_VERSION.into()));
460460
}
@@ -1255,7 +1255,7 @@ impl Router {
12551255
}
12561256
12571257
pub fn init(&self, args: InitArgs) -> Result<InitResponse, InitError> {
1258-
static MT_VERSION: &str = "0.5.0-rc.8";
1258+
static MT_VERSION: &str = "0.5.0-rc.9";
12591259
if args.metatype_version != MT_VERSION {
12601260
return Err(InitError::VersionMismatch(MT_VERSION.into()));
12611261
}

tests/metagen/typegraphs/sample/rs/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "sample_client"
33
edition = "2021"
4-
version = "0.5.0-rc.8"
4+
version = "0.5.0-rc.9"
55

66
[dependencies]
77
metagen-client.workspace = true

tests/metagen/typegraphs/sample/rs_upload/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "sample_client_upload"
33
edition = "2021"
4-
version = "0.5.0-rc.8"
4+
version = "0.5.0-rc.9"
55

66
[dependencies]
77
metagen-client.workspace = true

tests/runtimes/deno/deno.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ def deno(g: Graph):
3636
name="counter",
3737
effect=effects.update(),
3838
),
39+
secrets=deno.import_(
40+
t.struct(),
41+
t.struct({"ok": t.boolean()}),
42+
module="ts/deno.ts",
43+
name="secrets",
44+
secrets=["DENO_SECRET"],
45+
),
3946
min=deno.import_(number_input, t.float(), module="ts/math.ts", name="min"),
4047
max=deno.import_(number_input, t.float(), module="ts/math.ts", name="maxAsync"),
4148
log=deno.import_(

tests/runtimes/deno/deno_sync_test.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ Meta.test(
3737
},
3838
},
3939
async (t) => {
40-
const e = await t.engine("runtimes/deno/deno.py");
40+
const e = await t.engine("runtimes/deno/deno.py", {
41+
secrets: {
42+
DENO_SECRET: "deno_secret",
43+
},
44+
});
4145

4246
await t.should("work on the default worker", async () => {
4347
await gql`
@@ -128,7 +132,11 @@ Meta.test(
128132
},
129133
},
130134
async (t) => {
131-
const e = await t.engine("runtimes/deno/deno.py");
135+
const e = await t.engine("runtimes/deno/deno.py", {
136+
secrets: {
137+
DENO_SECRET: "deno_secret",
138+
},
139+
});
132140

133141
await t.should("success for allowed network access", async () => {
134142
await gql`
@@ -368,7 +376,11 @@ Meta.test(
368376
},
369377
},
370378
async (t) => {
371-
const e = await t.engine("runtimes/deno/deno.py");
379+
const e = await t.engine("runtimes/deno/deno.py", {
380+
secrets: {
381+
DENO_SECRET: "deno_secret",
382+
},
383+
});
372384

373385
await t.should("safely fail upon stack overflow", async () => {
374386
await gql`

0 commit comments

Comments
 (0)