-
Notifications
You must be signed in to change notification settings - Fork 49
Small revisions and fixes For Wasm templates #1924
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: origin-dev
Are you sure you want to change the base?
Changes from 7 commits
ab96c7f
ef7543e
9cda933
80c6eef
d417782
49b89ca
3939cb4
a10464a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,8 @@ | ||
| format: 0.3.0 | ||
| strategies: | ||
| image: | ||
| name: wrap-wasm-as-build-image | ||
| node_version: 16.13.0 | ||
| name: template-wasm-as | ||
| node_version: 18.15.0 | ||
| include: | ||
| - ./package.json | ||
| - ./src |
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,31 +1,25 @@ | ||
| import { PolywrapClient } from "@polywrap/client-js"; | ||
| import * as App from "../types/wrap"; | ||
| import path from "path"; | ||
|
|
||
| jest.setTimeout(60000); | ||
|
|
||
| describe("Template Wrapper End to End Tests", () => { | ||
|
|
||
| const client: PolywrapClient = new PolywrapClient(); | ||
| let template: App.Template; | ||
| let wrapperUri: string; | ||
|
|
||
| beforeAll(() => { | ||
| const dirname: string = path.resolve(__dirname); | ||
| const wrapperPath: string = path.join(dirname, "..", "..", ".."); | ||
| const wrapperPath: string = path.join(__dirname, "..", "..", ".."); | ||
| wrapperUri = `fs/${wrapperPath}/build`; | ||
| template = new App.Template(undefined, undefined, wrapperUri) | ||
| }) | ||
|
|
||
| it("calls sampleMethod", async () => { | ||
| const expected: string = "polywrap"; | ||
|
|
||
| const result = await client.invoke<App.Template_SampleResult>({ | ||
| uri: wrapperUri, | ||
| method: "sampleMethod", | ||
| args: { arg: expected } | ||
| }); | ||
| const result = await template.sampleMethod({ arg: expected }) | ||
|
|
||
| expect(result.ok).toBeTruthy(); | ||
| if (!result.ok) return; | ||
| if (!result.ok) throw result.error; | ||
| expect(result.value.result).toEqual(expected); | ||
| }); | ||
| }); |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,31 +1,25 @@ | ||
| import { PolywrapClient } from "@polywrap/client-js"; | ||
| import * as App from "../types/wrap"; | ||
| import path from "path"; | ||
|
|
||
| jest.setTimeout(60000); | ||
|
|
||
| describe("Template Wrapper End to End Tests", () => { | ||
|
|
||
| const client: PolywrapClient = new PolywrapClient(); | ||
| let template: App.Template; | ||
| let wrapperUri: string; | ||
|
|
||
| beforeAll(() => { | ||
| const dirname: string = path.resolve(__dirname); | ||
| const wrapperPath: string = path.join(dirname, "..", "..", ".."); | ||
| const wrapperPath: string = path.join(__dirname, "..", "..", ".."); | ||
| wrapperUri = `fs/${wrapperPath}/build`; | ||
| template = new App.Template(undefined, undefined, wrapperUri) | ||
| }) | ||
|
|
||
| it("calls sampleMethod", async () => { | ||
| const expected: string = "polywrap"; | ||
|
|
||
| const result = await client.invoke<App.Template_SampleResult>({ | ||
| uri: wrapperUri, | ||
| method: "sampleMethod", | ||
| args: { arg: expected } | ||
| }); | ||
| const result = await template.sampleMethod({ arg: expected }) | ||
|
|
||
| expect(result.ok).toBeTruthy(); | ||
| if (!result.ok) return; | ||
| if (!result.ok) throw result.error; | ||
| expect(result.value.result).toEqual(expected); | ||
| }); | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| format: 0.2.0 | ||
| strategies: | ||
| image: | ||
| name: template-wasm-go | ||
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,3 +5,5 @@ project: | |
| source: | ||
| schema: ./polywrap.graphql | ||
| module: ./go.mod | ||
| extensions: | ||
| build: ./polywrap.build.yaml | ||
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,14 @@ | ||
| use crate::types::wrap::types::{ | ||
| TemplateModule, | ||
| TemplateModuleArgsSampleMethod | ||
| Template, | ||
| TemplateArgsSampleMethod | ||
| }; | ||
|
|
||
| #[test] | ||
| fn sample_method() { | ||
| let args = TemplateModuleArgsSampleMethod { | ||
| let args = TemplateArgsSampleMethod { | ||
| arg: "input data".to_string(), | ||
| }; | ||
| let template: TemplateModule = TemplateModule::new(None, None, None); | ||
| let response = template.sample_method(&args, None, None, None).unwrap(); | ||
| let template: Template = Template::new(None); | ||
| let response = template.sample_method(&args, None).unwrap(); | ||
| assert_eq!(response.result, "input data from sample_method"); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,6 @@ | ||
| format: 0.3.0 | ||
| strategies: | ||
| image: | ||
| name: template-wasm-ts | ||
| config: | ||
| scriptFile: ./bundled/wrap.js |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,7 @@ | ||
| type Module { | ||
| foo(bar: String!): String! | ||
| sampleMethod(arg: String!): SampleResult! | ||
| } | ||
|
|
||
| type SampleResult { | ||
| result: String! | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,3 +5,5 @@ project: | |
| source: | ||
| schema: ./polywrap.graphql | ||
| module: ./bundled/wrap.js | ||
| extensions: | ||
| build: ./polywrap.build.yaml | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import * as App from "../types/wrap"; | ||
| import path from "path"; | ||
|
|
||
| jest.setTimeout(60000); | ||
|
|
||
| describe("Template Wrapper End to End Tests", () => { | ||
|
|
||
| let template: App.Template; | ||
| let wrapperUri: string; | ||
|
|
||
| beforeAll(() => { | ||
| const wrapperPath: string = path.join(__dirname, "..", "..", ".."); | ||
| wrapperUri = `fs/${wrapperPath}/build`; | ||
| template = new App.Template(undefined, undefined, wrapperUri) | ||
| }) | ||
|
|
||
| it("calls sampleMethod", async () => { | ||
| const expected: string = "polywrap"; | ||
|
|
||
| const result = await template.sampleMethod({ arg: expected }) | ||
|
|
||
| if (!result.ok) throw result.error; | ||
| expect(result.value.result).toEqual(expected); | ||
| }); | ||
| }); |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| format: 0.3.0 | ||
| project: | ||
| name: sample-typescript-type-generation | ||
| type: app/typescript | ||
| source: | ||
| schema: ./schema.graphql | ||
| import_abis: | ||
| - uri: "wrap://ens/sample.eth" | ||
| abi: "../../../build/wrap.info" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| #import * into Template from "wrap://ens/sample.eth" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,9 @@ | ||
| import { Args_foo, ModuleBase } from "./wrap"; | ||
| import { Args_sampleMethod, SampleResult, ModuleBase } from "./wrap"; | ||
|
|
||
| export class Module extends ModuleBase { | ||
| foo(args: Args_foo): string { | ||
| throw new Error("Not implemented"); | ||
| sampleMethod(args: Args_sampleMethod): SampleResult { | ||
| return { | ||
| result: args.arg, | ||
| }; | ||
| } | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.