Skip to content
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions packages/templates/wasm/assemblyscript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,9 @@
"scripts": {
"codegen": "npx polywrap codegen",
"build": "npx polywrap build",
"test:env:up": "npx polywrap infra up --modules=eth-ens-ipfs",
"test:env:down": "npx polywrap infra down --modules=eth-ens-ipfs",
"deploy": "npx polywrap deploy",
"test": "yarn test:e2e && yarn test:workflow",
"test:e2e": "yarn test:e2e:codegen && jest --passWithNoTests --runInBand --verbose",
"test:e2e:codegen": "npx polywrap codegen -m ./src/__tests__/types/polywrap.app.yaml -g ./src/__tests__/types/wrap",
"test:workflow": "npx polywrap test -o ./workflows/output.json"
"test": "yarn test:codegen && jest --passWithNoTests --runInBand --verbose",
"test:codegen": "npx polywrap codegen -m ./src/__tests__/types/polywrap.app.yaml -g ./src/__tests__/types/wrap"
},
"devDependencies": {
"@types/jest": "26.0.8",
Expand Down
4 changes: 2 additions & 2 deletions packages/templates/wasm/assemblyscript/polywrap.build.yaml
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
7 changes: 0 additions & 7 deletions packages/templates/wasm/assemblyscript/polywrap.deploy.yaml

This file was deleted.

10 changes: 0 additions & 10 deletions packages/templates/wasm/assemblyscript/polywrap.test.yaml

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);
});
});
11 changes: 0 additions & 11 deletions packages/templates/wasm/assemblyscript/workflows/validator.cue

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);
});
});
6 changes: 2 additions & 4 deletions packages/templates/wasm/golang/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
"codegen": "npx polywrap codegen",
"build": "npx polywrap build",
"deploy": "npx polywrap deploy",
"test": "yarn test:e2e && yarn test:workflow",
"test:e2e": "yarn test:e2e:codegen && jest --passWithNoTests --runInBand --verbose",
"test:e2e:codegen": "npx polywrap codegen -m ./module/__tests__/types/polywrap.app.yaml -g ./module/__tests__/types/wrap",
"test:workflow": "npx polywrap test"
"test": "yarn test:codegen && jest --passWithNoTests --runInBand --verbose",
"test:codegen": "npx polywrap codegen -m ./module/__tests__/types/polywrap.app.yaml -g ./module/__tests__/types/wrap"
},
"devDependencies": {
"@types/jest": "26.0.8",
Expand Down
4 changes: 4 additions & 0 deletions packages/templates/wasm/golang/polywrap.build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
format: 0.2.0
strategies:
image:
name: template-wasm-go
11 changes: 0 additions & 11 deletions packages/templates/wasm/golang/polywrap.test.cue

This file was deleted.

10 changes: 0 additions & 10 deletions packages/templates/wasm/golang/polywrap.test.yaml

This file was deleted.

2 changes: 2 additions & 0 deletions packages/templates/wasm/golang/polywrap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ project:
source:
schema: ./polywrap.graphql
module: ./go.mod
extensions:
build: ./polywrap.build.yaml
7 changes: 0 additions & 7 deletions packages/templates/wasm/interface/polywrap.deploy.yaml

This file was deleted.

6 changes: 2 additions & 4 deletions packages/templates/wasm/rust/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
"codegen": "npx polywrap codegen",
"build": "npx polywrap build",
"deploy": "npx polywrap deploy",
"test": "yarn test:e2e && yarn test:workflow",
"test:e2e": "yarn test:e2e:codegen && cargo test --release",
"test:e2e:codegen": "npx polywrap codegen -m ./tests/types/polywrap.app.yaml -g ./tests/types/wrap",
"test:workflow": "npx polywrap test"
"test": "yarn test:codegen && cargo test --release",
"test:codegen": "npx polywrap codegen -m ./tests/types/polywrap.app.yaml -g ./tests/types/wrap"
},
"devDependencies": {
"polywrap": "0.12.1"
Expand Down
7 changes: 0 additions & 7 deletions packages/templates/wasm/rust/polywrap.deploy.yaml

This file was deleted.

11 changes: 0 additions & 11 deletions packages/templates/wasm/rust/polywrap.test.cue

This file was deleted.

10 changes: 0 additions & 10 deletions packages/templates/wasm/rust/polywrap.test.yaml

This file was deleted.

10 changes: 5 additions & 5 deletions packages/templates/wasm/rust/tests/it/module.rs
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");
}
9 changes: 5 additions & 4 deletions packages/templates/wasm/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
"main": "build/index.js",
"scripts": {
"bundle": "rollup -c",
"codegen": "polywrap codegen --verbose",
"build": "yarn bundle && npx polywrap build --no-codegen",
"test": "jest --passWithNoTests --runInBand --verbose",
"deploy": "polywrap deploy"
"codegen": "npx polywrap codegen",
"build": "yarn codegen && yarn bundle && npx polywrap build --no-codegen",
"deploy": "npx polywrap deploy",
"test": "yarn test:codegen && jest --passWithNoTests --runInBand --verbose",
"test:codegen": "npx polywrap codegen -m ./src/__tests__/types/polywrap.app.yaml -g ./src/__tests__/types/wrap"
},
"dependencies": {
"tslib": "^2.6.2"
Expand Down
3 changes: 3 additions & 0 deletions packages/templates/wasm/typescript/polywrap.build.yaml
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
6 changes: 5 additions & 1 deletion packages/templates/wasm/typescript/polywrap.graphql
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!
}
2 changes: 2 additions & 0 deletions packages/templates/wasm/typescript/polywrap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
8 changes: 5 additions & 3 deletions packages/templates/wasm/typescript/src/index.ts
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,
};
}
}