Skip to content

Commit

Permalink
Merge branch 'fix/broken-tests' into test/cli-e2e-alt
Browse files Browse the repository at this point in the history
  • Loading branch information
Natoandro committed Nov 22, 2023
2 parents 127b929 + ba5bdd4 commit 492ed48
Show file tree
Hide file tree
Showing 9 changed files with 187 additions and 192 deletions.
302 changes: 151 additions & 151 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions typegate/deno.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"compilerOptions": {
"allowJs": false,
"strict": true,
"types": [
"./engine/runtime.d.ts"
],
"lib": [
"deno.ns",
"deno.unstable",
Expand Down
5 changes: 5 additions & 0 deletions typegate/deno.lock
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,11 @@
"https://deno.land/x/deno_cache@0.5.2/lib/snippets/deno_cache_dir-77bed54ace8005e0/fs.js": "cbe3a976ed63c72c7cb34ef845c27013033a3b11f9d8d3e2c4aa5dda2c0c7af6",
"https://deno.land/x/deno_cache@0.5.2/mod.ts": "0b4d071ad095128bdc2b1bc6e5d2095222dcbae08287261690ee9757e6300db6",
"https://deno.land/x/deno_cache@0.5.2/util.ts": "f3f5a0cfc60051f09162942fb0ee87a0e27b11a12aec4c22076e3006be4cc1e2",
"https://deno.land/x/deno_graph@0.26.0/lib/deno_graph.generated.js": "2f7ca85b2ceb80ec4b3d1b7f3a504956083258610c7b9a1246238c5b7c68f62d",
"https://deno.land/x/deno_graph@0.26.0/lib/loader.ts": "380e37e71d0649eb50176a9786795988fc3c47063a520a54b616d7727b0f8629",
"https://deno.land/x/deno_graph@0.26.0/lib/media_type.ts": "222626d524fa2f9ebcc0ec7c7a7d5dfc74cc401cc46790f7c5e0eab0b0787707",
"https://deno.land/x/deno_graph@0.26.0/lib/snippets/deno_graph-de651bc9c240ed8d/src/deno_apis.js": "41192baaa550a5c6a146280fae358cede917ae16ec4e4315be51bef6631ca892",
"https://deno.land/x/deno_graph@0.26.0/mod.ts": "11131ae166580a1c7fa8506ff553751465a81c263d94443f18f353d0c320bc14",
"https://deno.land/x/dir@1.5.1/data_local_dir/mod.ts": "91eb1c4bfadfbeda30171007bac6d85aadacd43224a5ed721bbe56bc64e9eb66",
"https://deno.land/x/djwt@v2.7/algorithm.ts": "ba9941961c46838f35a507414407e48aa9a4eca69c679b04fbbede55fe276a09",
"https://deno.land/x/djwt@v2.7/deps.ts": "a5d7952aaf7fad421717c9a2db0b2e736b409632cb70f3f7f9e68f8e96e04f45",
Expand Down
32 changes: 13 additions & 19 deletions typegate/engine/bindings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,14 @@ export async function temporal_workflow_query(
return { Err: { message: err.toString() } };
}
}

export type WasiVmInitConfig = {
vm_name: string;
pylib_path: string;
wasi_mod_path: string;
preopens: Array<string>;
};

export type WasiVmSetupOut =
| "Ok"
| {
Expand All @@ -248,7 +256,6 @@ export type WasiVmSetupOut =
export type WasiVmUnregisterInp = {
vm_name: string;
};

export function register_virtual_machine(a0: WasiVmInitConfig): WasiVmSetupOut {
try {
Meta.python.registerVm(a0);
Expand Down Expand Up @@ -418,26 +425,13 @@ export type PrismaDiffInp = {
datamodel: string;
script: boolean;
};
export type PrismaDiffOut =
| {
Ok: {
diff: string | undefined | null;
};
}
| {
Err: {
message: string;
};
};

export async function prisma_diff(a0: PrismaDiffInp) {
try {
const res = await Meta.prisma.diff(a0);
return { Ok: { diff: res } };
} catch (err) {
return { Err: { message: err.toString() } };
}
export async function prisma_diff(
a0: PrismaDiffInp,
): Promise<string | null | undefined> {
return await Meta.prisma.diff(a0);
}

export type PrismaApplyResult =
| {
Err: {
Expand Down
24 changes: 10 additions & 14 deletions typegate/src/runtimes/prisma/hooks/run_migrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,11 @@ export const runMigrations: PushHandler = async (
}

// diff
const { diff } = nativeResult(
await native.prisma_diff({
datasource,
datamodel,
script: false,
}),
);
const diff = await native.prisma_diff({
datasource,
datamodel,
script: false,
});

if (diff != null) {
response.info(`Changes detected in the schema: ${diff}`);
Expand Down Expand Up @@ -126,13 +124,11 @@ export const runMigrations: PushHandler = async (
}
} else { // like `meta prisma deploy`
// diff
const { diff } = nativeResult(
await native.prisma_diff({
datasource,
datamodel,
script: false,
}),
);
const diff = await native.prisma_diff({
datasource,
datamodel,
script: false,
});
response.info(`Changes dectected: ${diff}`);

if (migration_files == null) {
Expand Down
4 changes: 1 addition & 3 deletions typegate/src/runtimes/prisma/migration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,7 @@ export class PrismaMigrationRuntime extends Runtime {

return {
runtimeName: name,
diff: nativeResult(
await native.prisma_diff({ datasource, datamodel, script }),
).diff,
diff: await native.prisma_diff({ datasource, datamodel, script }),
};
}) as Resolver;
break;
Expand Down
6 changes: 3 additions & 3 deletions typegate/tests/typecheck/input_validator_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Meta.test("input validator compiler", async (t) => {
);
const code = nativeResult(native.typescript_format_code({
source: generatedCode,
})).formatted_code;
}))!.formatted_code;

t.assertSnapshot(code);
});
Expand Down Expand Up @@ -79,7 +79,7 @@ Meta.test("input validator compiler", async (t) => {
const generatedCode = new InputValidationCompiler(tg).generate(enums.input);
const code = nativeResult(native.typescript_format_code({
source: generatedCode,
})).formatted_code;
}))!.formatted_code;

t.assertSnapshot(code);
});
Expand Down Expand Up @@ -130,7 +130,7 @@ Meta.test("input validator compiler", async (t) => {
const generatedCode = new InputValidationCompiler(tg).generate(posts.input);
const code = nativeResult(native.typescript_format_code({
source: generatedCode,
})).formatted_code;
}))!.formatted_code;

t.assertSnapshot(code);
});
Expand Down
2 changes: 1 addition & 1 deletion typegate/tests/typecheck/typecheck_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Meta.test("typecheck", async (t) => {

const formattedCode = nativeResult(native.typescript_format_code({
source: code,
})).formatted_code;
}))!.formatted_code;

t.assertSnapshot(formattedCode);
});
Expand Down
1 change: 0 additions & 1 deletion typegate/tests/utils/bindings_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
typegraph_validate,
typescript_format_code,
validate_prisma_runtime_data,
WasiInput,
wasmedge_wasi,
} from "native";

Expand Down

0 comments on commit 492ed48

Please sign in to comment.