Skip to content

Commit 7a5ab6c

Browse files
authored
Merge pull request #1749 from polywrap/origin-0.10-dev
Prep Origin 0.10.3 | /workflows/release-pr
2 parents 40f3605 + 5b1281a commit 7a5ab6c

58 files changed

Lines changed: 6503 additions & 284 deletions

File tree

Some content is hidden

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

.github/workflows/ci-javascript.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,13 @@ jobs:
214214
mv wrappers packages/test-cases/cases
215215
216216
- name: Test cli:unit
217-
run: yarn test:cli:unit
217+
run: yarn test:unit
218+
working-directory: ./packages/cli
218219

219220
- name: Test cli:e2e:p1
220-
run: yarn test:cli:e2e:p1
221+
run: yarn test:e2e:p1
222+
working-directory: ./packages/cli
221223

222224
- name: Test cli:e2e:p2
223-
run: yarn test:cli:e2e:p2
225+
run: yarn test:e2e:p2
226+
working-directory: ./packages/cli

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
# Polywrap Origin (0.10.3)
2+
## Features
3+
**`polywrap` CLI:**
4+
* [PR-1747](https://github.com/polywrap/toolchain/pull/1747) **Add Rust & Python plugin template projects to CLI's `create` command**
5+
* The `create` command now supports `plugin/rust` and `plugin/python` project types.
6+
7+
## Bugs
8+
**`@polywrap/schema-bind`:**
9+
* [PR-1734](https://github.com/polywrap/toolchain/pull/1734) **Update `plugin/python` Bindings**
10+
* Update `wrap.info` python module embedding.
11+
* [PR-1728](https://github.com/polywrap/toolchain/pull/1728) **Update `plugin/rust` Bindings**
12+
* Modify JSON serialization within rust plugin's bindings.
13+
* [PR-1736](https://github.com/polywrap/toolchain/pull/1736) **Properly emit function name when `Env` is missing**
14+
* Fixed the error message that's emitted when an environment is not supplied to a function that requires it.
15+
* [PR-1733](https://github.com/polywrap/toolchain/pull/1733) **Add imported `Env` to `propertyDeps` transform**
16+
* Adds imported `Env` to `propertyDeps` transform, so that now codegen properly generates imports for dependencies of imported env.
17+
118
# Polywrap Origin (0.10.2)
219
## Bugs
320
**`@polywrap/schema-bind`:**

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.10.2
1+
0.10.3

packages/cli/src/commands/create.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const urlStr = intlMsg.commands_create_options_t_url();
2929
export const supportedLangs = {
3030
wasm: ["assemblyscript", "rust", "interface"] as const,
3131
app: ["typescript"] as const,
32-
plugin: ["typescript"] as const,
32+
plugin: ["typescript", "rust", "python"] as const,
3333
};
3434

3535
export type ProjectType = keyof typeof supportedLangs;

packages/schema/bind/src/bindings/assemblyscript/wasm/templates/imported/env-type/index-ts.mustache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {
22
Read,
33
Write,
4+
Box,
45
BigInt,
56
BigNumber,
67
JSON,

packages/schema/bind/src/bindings/assemblyscript/wasm/templates/module-type/wrapped-ts.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export function {{name}}Wrapped(module: ModuleBase, argsBuf: ArrayBuffer, env_si
1515
{{#env}}
1616
{{#required}}
1717
if (env_size == 0) {
18-
throw new Error("Environment is not set, and it is required by method 'objectMethod'")
18+
throw new Error("Environment is not set, and it is required by method '{{name}}'")
1919
}
2020

2121
const envBuf = wrap_load_env(env_size);

packages/schema/bind/src/bindings/python/plugin/index.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ const sort = (obj: Record<string, unknown>) =>
4040
export const generateBinding: GenerateBindingFn = (
4141
options: BindOptions
4242
): BindOutput => {
43+
const escapedAbi = JSON.stringify(
44+
sort((options.abi as unknown) as Record<string, unknown>)
45+
).replace(/\n/g, "\\n");
46+
const formattedAbi = JSON.stringify(JSON.parse(escapedAbi), null, 2);
47+
4348
// Apply Abi transforms
4449
const abi = applyTransforms(options.abi);
4550

@@ -55,9 +60,7 @@ export const generateBinding: GenerateBindingFn = (
5560
name: options.projectName,
5661
type: "plugin",
5762
version: latestWrapManifestVersion,
58-
abi: Buffer.from(
59-
JSON.stringify(sort((options.abi as unknown) as Record<string, unknown>))
60-
).toString("base64"),
63+
abi: formattedAbi,
6164
};
6265

6366
output.entries = renderTemplates(templatePath(""), { ...abi, manifest }, {});

packages/schema/bind/src/bindings/python/plugin/templates/wrap_info-py.mustache

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
from __future__ import annotations
44

55
import json
6-
from base64 import b64decode
76

87
from polywrap_manifest import WrapManifest
98

109
{{#manifest}}
11-
abi = json.loads(b64decode("{{abi}}").decode("utf-8"))
10+
abi = json.loads("""
11+
{{abi}}
12+
""")
1213

1314
manifest = WrapManifest.parse_obj({
1415
"name": "{{name}}",

packages/schema/bind/src/bindings/rust/plugin/templates/module-rs.mustache

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
/// All modifications will be overwritten.
33

44
use std::sync::Arc;
5-
use polywrap_core::{invoke::Invoker};
6-
use polywrap_plugin::error::PluginError;
7-
use polywrap_plugin::module::PluginModule;
5+
use polywrap_core::invoke::Invoker;
6+
use polywrap_plugin::{error::PluginError, module::PluginModule};
87
use serde::{Serialize, Deserialize};
98
use super::types::*;
109

packages/schema/bind/src/bindings/rust/plugin/templates/types-rs.mustache

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,12 @@
33

44
// NOTE: This is an auto-generated file.
55
// All modifications will be overwritten.
6+
use polywrap_core::{invoke::Invoker, uri::Uri};
7+
use polywrap_msgpack::{decode, serialize};
8+
use polywrap_plugin::{error::PluginError, BigInt, BigNumber, Map, JSON};
69
use serde::{Serialize, Deserialize};
7-
use num_bigint::BigInt;
8-
use bigdecimal::BigDecimal as BigNumber;
9-
use serde_json as JSON;
10-
use polywrap_msgpack::extensions::generic_map::GenericMap as Map;
1110
{{#importedModuleTypes}}
1211
use std::sync::Arc;
13-
use polywrap_msgpack::{decode, serialize};
14-
use polywrap_core::{invoke::{Invoker}, uri::Uri};
15-
use polywrap_plugin::error::PluginError;
1612
{{/importedModuleTypes}}
1713

1814
// Env START //
@@ -129,7 +125,7 @@ impl {{#detectKeyword}}{{#toUpper}}{{type}}{{/toUpper}}{{/detectKeyword}} {
129125
.map_err(|e| PluginError::SubinvocationError {
130126
uri: uri.to_string(),
131127
method: "{{name}}".to_string(),
132-
args: serde_json::to_string(&args).unwrap(),
128+
args: JSON::to_string(&args).unwrap(),
133129
exception: e.to_string(),
134130
})?;
135131
@@ -168,7 +164,7 @@ impl<'a> {{#detectKeyword}}{{#toUpper}}{{type}}{{/toUpper}}{{/detectKeyword}}<'a
168164
.map_err(|e| PluginError::SubinvocationError {
169165
uri: uri.to_string(),
170166
method: "{{name}}".to_string(),
171-
args: serde_json::to_string(&args).unwrap(),
167+
args: JSON::to_string(&args).unwrap(),
172168
exception: e.to_string(),
173169
})?;
174170

0 commit comments

Comments
 (0)